mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-20 08:27:15 +00:00
Update to Build b28.
This commit is contained in:
parent
10cd453dcc
commit
f78b1b9ba0
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=329926
@ -1,6 +1,6 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PORTREVISION= 10
|
||||
PORTREVISION= 0
|
||||
CATEGORIES= java devel
|
||||
PKGNAMESUFFIX= -jre
|
||||
|
||||
|
@ -2,23 +2,16 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PORTNAME= openjdk6
|
||||
PORTVERSION= b27
|
||||
PORTREVISION?= 8
|
||||
PORTVERSION= b28
|
||||
PORTREVISION?= 0
|
||||
CATEGORIES= java devel
|
||||
MASTER_SITES= ${MASTER_SITE_APACHE:S,%SUBDIR%/,ant/binaries/:ant,} \
|
||||
http://download.java.net/jaxp/openjdk/jdk6/:jaxp \
|
||||
http://icedtea.classpath.org/download/drops/:jaxp \
|
||||
https://java.net/downloads/jax-ws/OpenJDK6/:jaf \
|
||||
http://icedtea.classpath.org/download/drops/:jaf \
|
||||
http://download.java.net/glassfish/components/jax-ws/openjdk/jdk6/:jaxws \
|
||||
http://icedtea.classpath.org/download/drops/:jaxws \
|
||||
http://download.java.net/openjdk/jtreg/promoted/4.1/b05/:jtreg \
|
||||
http://download.java.net/openjdk/jdk6/promoted/${PORTVERSION}/
|
||||
https://java.net/projects/openjdk6/downloads/download/ \
|
||||
LOCAL
|
||||
MASTER_SITE_SUBDIR= jkim
|
||||
DISTNAME= openjdk-6-src-${PORTVERSION}-${OPENJDK_BUILDDATE}
|
||||
DISTFILES= ${ANTFILE}:ant \
|
||||
${JAXPFILE}:jaxp \
|
||||
${JAFFILE}:jaf \
|
||||
${JAXWSFILE}:jaxws \
|
||||
${DISTNAME}${EXTRACT_SUFX}
|
||||
EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX} ${ANTFILE}
|
||||
|
||||
@ -27,7 +20,7 @@ COMMENT?= Oracle's Java 6 virtual machine release under the GPL v2
|
||||
|
||||
LICENSE= GPLv2
|
||||
LICENSE_FILE= ${WRKSRC}/LICENSE
|
||||
LICENSE_DISTFILES=${JAXPFILE} ${JAFFILE} ${JAXWSFILE} ${DISTNAME}${EXTRACT_SUFX}
|
||||
LICENSE_DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
|
||||
|
||||
BUILD_DEPENDS= ${LOCALBASE}/bin/zip:${PORTSDIR}/archivers/zip \
|
||||
${LOCALBASE}/bin/unzip:${PORTSDIR}/archivers/unzip \
|
||||
@ -36,7 +29,7 @@ LIB_DEPENDS= freetype:${PORTSDIR}/print/freetype2
|
||||
RUN_DEPENDS= javavm:${PORTSDIR}/java/javavmwrapper \
|
||||
${LOCALBASE}/lib/X11/fonts/dejavu:${PORTSDIR}/x11-fonts/dejavu
|
||||
|
||||
OPENJDK_BUILDDATE= 26_oct_2012
|
||||
OPENJDK_BUILDDATE= 04_oct_2013
|
||||
|
||||
OPTIONS_DEFINE= ICEDTEA IPV6 POLICY SOUND TZUPDATE
|
||||
OPTIONS_DEFAULT=ICEDTEA IPV6 TZUPDATE
|
||||
@ -72,12 +65,6 @@ USE_XORG= x11 xext xi xt xtst
|
||||
ANTVERSION= 1.8.4
|
||||
ANTFILE= apache-ant-${ANTVERSION}-bin.tar.bz2
|
||||
|
||||
JAXP_BUILD= 144_05
|
||||
JAXPFILE= jaxp${JAXP_BUILD}.zip
|
||||
JAF_BUILD= b20
|
||||
JAFFILE= jdk6-jaf-${JAF_BUILD}.zip
|
||||
JAXWS_BUILD= 2_1_6-2011_06_13
|
||||
JAXWSFILE= jdk6-jaxws${JAXWS_BUILD}.zip
|
||||
JTREG_BUILD= b05_29_nov_2012
|
||||
JTREGFILE= jtreg-4.1-bin-${JTREG_BUILD}.zip
|
||||
UPDATE_VERSION= 32
|
||||
@ -124,7 +111,6 @@ MAKE_ENV= LANG=C LC_ALL=C OS= \
|
||||
ALT_FREETYPE_LIB_PATH=${LOCALBASE}/lib \
|
||||
ALT_X11_PATH=${LOCALBASE} \
|
||||
ALT_PACKAGE_PATH=${LOCALBASE} \
|
||||
ALT_DROPS_DIR=${DISTDIR} \
|
||||
ANT_HOME=${WRKDIR}/apache-ant-${ANTVERSION} \
|
||||
JAVACMD=${BOOTSTRAPJDKDIR}/bin/java \
|
||||
BUILD_NUMBER=${PORTVERSION} \
|
||||
@ -132,11 +118,8 @@ MAKE_ENV= LANG=C LC_ALL=C OS= \
|
||||
MILESTONE=fcs \
|
||||
JDK_UPDATE_VERSION=${UPDATE_VERSION}
|
||||
|
||||
# HotSpot wants CCC instead of CXX. Also, HotSpot SA wants GCC.
|
||||
MAKE_ENV+= CCC="${CXX}" GCC="${CC}"
|
||||
|
||||
# XXX Turn off -Werror from HotSpot.
|
||||
MAKE_ENV+= WARNINGS_ARE_ERRORS="${WARNINGS_ARE_ERRORS}"
|
||||
MAKE_ENV+= COMPILER_WARNINGS_FATAL=false
|
||||
|
||||
# XXX Turn off parallel build by default.
|
||||
_MAKE_JOBS= #
|
||||
@ -174,29 +157,26 @@ EXTRA_PATCHES+= ${FILESDIR}/alsa-disable.patch
|
||||
DISTFILES+= ${JTREGFILE}:jtreg
|
||||
EXTRACT_ONLY+= ${JTREGFILE}
|
||||
BUILD_DEPENDS+= ${LOCALBASE}/lib/X11/fonts/dejavu:${PORTSDIR}/x11-fonts/dejavu
|
||||
USES+= display
|
||||
USES+= display:test
|
||||
.else
|
||||
EXTRA_PATCHES+= ${FILESDIR}/test_gamma-disable.patch
|
||||
.endif
|
||||
|
||||
.if !empty(ICONV_LIB)
|
||||
ICONV_INCLUDE= -I${LOCALBASE}/include
|
||||
ICONV_LIBS= -L${LOCALBASE}/lib ${ICONV_LIB}
|
||||
.else
|
||||
ICONV_INCLUDE=
|
||||
ICONV_LIBS=
|
||||
.endif
|
||||
|
||||
COPYDIRS= \
|
||||
hotspot/src/os/linux/vm \
|
||||
hotspot/src/os_cpu/linux_x86/vm \
|
||||
hotspot/agent/src/os/linux \
|
||||
hotspot/make/linux \
|
||||
hotspot/make/linux/makefiles \
|
||||
hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux \
|
||||
hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/amd64 \
|
||||
hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/x86 \
|
||||
hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/linux \
|
||||
hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/linux_amd64 \
|
||||
hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/linux_x86 \
|
||||
jdk/src/linux/doc/man
|
||||
|
||||
COPYFILES= \
|
||||
corba/make/common/Defs-linux.gmk \
|
||||
corba/make/common/shared/Defs-linux.gmk \
|
||||
hotspot/agent/src/share/classes/sun/jvm/hotspot/LinuxVtblAccess.java \
|
||||
hotspot/src/os/linux/vm/decoder_linux.cpp \
|
||||
jdk/make/com/sun/tools/attach/mapfile-linux \
|
||||
jdk/make/common/Defs-linux.gmk \
|
||||
jdk/make/common/shared/Defs-linux.gmk \
|
||||
@ -238,6 +218,12 @@ post-extract:
|
||||
-e s/Linux/FreeBSD/g {} \;
|
||||
|
||||
post-patch:
|
||||
@${REINPLACE_CMD} \
|
||||
-e "s|%%ICONV_INC%%|${ICONV_INCLUDE}|" \
|
||||
-e "s|%%ICONV_LIB%%|${ICONV_LIBS}|" \
|
||||
${WRKSRC}/Makefile ${WRKSRC}/jdk/make/java/instrument/Makefile \
|
||||
${WRKSRC}/jdk/make/java/npt/Makefile \
|
||||
${WRKSRC}/jdk/make/sun/splashscreen/Makefile
|
||||
@${REINPLACE_CMD} \
|
||||
-e "s|/lib:/usr/lib|/lib:/usr/lib:${LOCALBASE}/lib|" \
|
||||
${WRKSRC}/hotspot/src/os/bsd/vm/os_bsd.cpp
|
||||
@ -246,8 +232,17 @@ post-patch:
|
||||
-e 's|policy install-limited|policy install-unlimited|' \
|
||||
${WRKSRC}/jdk/make/javax/crypto/Makefile
|
||||
.endif
|
||||
.if empty(ICONV_LIB)
|
||||
@${PATCH} ${PATCH_ARGS} < ${FILESDIR}/libiconv.patch
|
||||
@${REINPLACE_CMD} \
|
||||
-e "s|%%LOCALBASE%%|${LOCALBASE}|" \
|
||||
${WRKSRC}/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java
|
||||
.if defined(BUILD_JRE)
|
||||
@${REINPLACE_CMD} \
|
||||
-e "s|%%OPENJDK_HOME%%|${PREFIX}/openjdk6-jre|" \
|
||||
${WRKSRC}/jdk/src/solaris/bin/java_md.c
|
||||
.else
|
||||
@${REINPLACE_CMD} \
|
||||
-e "s|%%OPENJDK_HOME%%|${PREFIX}/openjdk6|" \
|
||||
${WRKSRC}/jdk/src/solaris/bin/java_md.c
|
||||
.endif
|
||||
|
||||
post-build:
|
||||
@ -271,21 +266,20 @@ post-build:
|
||||
.endif
|
||||
@${ECHO_MSG} ""
|
||||
|
||||
test: build-depends build
|
||||
.if !defined(DISPLAY)
|
||||
@${LOCALBASE}/bin/Xvfb :1001 -screen 0 800x600x24 \
|
||||
-fp ${LOCALBASE}/lib/X11/fonts/misc > /dev/null 2>&1 & \
|
||||
${ECHO_CMD} $$! > ${WRKDIR}/.Xvfb.pid
|
||||
.endif
|
||||
@-(cd ${WRKSRC}/jdk/test; ${SETENV} ${MAKE_ENV} \
|
||||
PLATFORM=bsd ARCH=${ARCH:S/i386/i586/} ${GMAKE} tests)
|
||||
.if !defined(DISPLAY)
|
||||
@-${CAT} ${WRKDIR}/.Xvfb.pid | ${XARGS} kill
|
||||
@${RM} -f ${WRKDIR}/.Xvfb.pid
|
||||
.if defined(DISPLAY)
|
||||
_TEST_SEQ= do-test
|
||||
.else
|
||||
_TEST_SEQ= pre-test do-test post-test
|
||||
.ORDER: ${_TEST_SEQ}
|
||||
.endif
|
||||
test: ${_TEST_SEQ}
|
||||
@${ECHO_MSG} ""
|
||||
@${ECHO_MSG} "You can run \"make test\" again to re-execute only the failed tests."
|
||||
@${ECHO_MSG} ""
|
||||
|
||||
do-test: build-depends build
|
||||
@-(cd ${WRKSRC}/jdk/test; ${SETENV} PLATFORM=bsd ARCH=${ARCH} \
|
||||
${MAKE_ENV} ${GMAKE} tests)
|
||||
.endif
|
||||
|
||||
do-install:
|
||||
@ -368,4 +362,4 @@ do-install:
|
||||
@${ECHO_CMD} "exit 0" >> ${PKGDEINSTALL}
|
||||
@${ECHO_CMD} "exit 0" >> ${PKGINSTALL}
|
||||
|
||||
.include <bsd.port.post.mk>
|
||||
.include <bsd.port.mk>
|
||||
|
@ -1,170 +1,10 @@
|
||||
# $FreeBSD$
|
||||
|
||||
_PATCHES= \
|
||||
jaxp.patch \
|
||||
jaxws.patch \
|
||||
security/20120830/7182135-impossible_to_use_some_editors_directly.patch \
|
||||
security/20130201/7201068.patch \
|
||||
security/20130201/6563318.patch \
|
||||
security/20130201/6664509.patch \
|
||||
security/20130201/6776941.patch \
|
||||
security/20130201/7141694.patch \
|
||||
security/20130201/7173145.patch \
|
||||
security/20130201/7186945.patch \
|
||||
security/20130201/7186948.patch \
|
||||
security/20130201/7186952.patch \
|
||||
security/20130201/7186954.patch \
|
||||
security/20130201/7192392.patch \
|
||||
security/20130201/7192393.patch \
|
||||
security/20130201/7192977.patch \
|
||||
security/20130201/7197546.patch \
|
||||
security/20130201/7200491.patch \
|
||||
security/20130201/7200500.patch \
|
||||
security/20130201/7201064.patch \
|
||||
security/20130201/7201066.patch \
|
||||
security/20130201/7201070.patch \
|
||||
security/20130201/7201071.patch \
|
||||
security/20130201/8000210.patch \
|
||||
security/20130201/8000537.patch \
|
||||
security/20130201/8000540.patch \
|
||||
security/20130201/8000631.patch \
|
||||
security/20130201/8001242.patch \
|
||||
security/20130201/8001307.patch \
|
||||
security/20130201/8001972.patch \
|
||||
security/20130201/8002325.patch \
|
||||
security/20130219/8006446.patch \
|
||||
security/20130219/8006777.patch \
|
||||
security/20130219/8007688.patch \
|
||||
security/20130304/8007014.patch \
|
||||
security/20130304/8007675.patch \
|
||||
openjdk/7036559-concurrenthashmap_improvements.patch \
|
||||
security/20130416/8009063.patch \
|
||||
openjdk/8004302-soap_test_failure.patch \
|
||||
security/20130416/6657673.patch \
|
||||
security/20130416/6657673-fixup.patch \
|
||||
openjdk/7133220-factory_finder_parser_transform_useBSClassLoader.patch \
|
||||
security/20130416/6657673-factory_finder.patch \
|
||||
openjdk/6669869-queries_per_appcontext.patch \
|
||||
openjdk/5102804-memory_leak.patch \
|
||||
openjdk/6963811-deadlock_fix.patch \
|
||||
openjdk/7064279-resource_release.patch \
|
||||
openjdk/7064279-fixup.patch \
|
||||
security/20130416/7200507.patch \
|
||||
security/20130416/8000724.patch \
|
||||
security/20130416/8004986.patch \
|
||||
openjdk/6501644-icu_sync.patch \
|
||||
openjdk/6886358-layout_update.patch \
|
||||
security/20130416/8001031.patch \
|
||||
openjdk/7017324-kerning_crash.patch \
|
||||
security/20130416/8001040.patch \
|
||||
security/20130416/8001322.patch \
|
||||
security/20130416/8001329.patch \
|
||||
security/20130416/8003335.patch \
|
||||
security/20130416/8003445.patch \
|
||||
security/20130416/8003543.patch \
|
||||
security/20130416/8004261.patch \
|
||||
security/20130416/8004336.patch \
|
||||
security/20130416/8005432.patch \
|
||||
security/20130416/8005943.patch \
|
||||
security/20130416/8006309.patch \
|
||||
security/20130416/8006435.patch \
|
||||
security/20130416/8006790.patch \
|
||||
security/20130416/8006795.patch \
|
||||
security/20130416/8007406.patch \
|
||||
security/20130416/8007617.patch \
|
||||
security/20130416/8007667.patch \
|
||||
security/20130416/8007918.patch \
|
||||
security/20130416/8009305.patch \
|
||||
security/20130416/8009699.patch \
|
||||
security/20130416/8009814.patch \
|
||||
security/20130416/8009857.patch \
|
||||
openjdk/7195301-no_instanceof_node.patch \
|
||||
openjdk/6469266-xmlsec_1.4.2.patch \
|
||||
security/20130618/6741606-apache_santuario.patch \
|
||||
security/20130618/7170730-windows_network_stack.patch \
|
||||
security/20130618/8000638-improve_deserialization.patch \
|
||||
security/20130618/8001032-restrict_object_access-corba.patch \
|
||||
security/20130618/8001033-refactor_address_handling.patch \
|
||||
security/20130618/8001034-memory_management.patch \
|
||||
security/20130618/8001038-resourcefully_handle_resources.patch \
|
||||
security/20130618/8001043-clarify_definition_restrictions.patch \
|
||||
security/20130618/8001309-better_handling_of_annotation_interfaces.patch \
|
||||
security/20130618/8001318-socket_getlocaladdress_consistency.patch \
|
||||
security/20130618/8001318-6_fixup.patch \
|
||||
security/20130618/8001330-improve_checking_order.patch \
|
||||
security/20130618/8003703-update_rmi_connection_dialog.patch \
|
||||
openjdk/8005615-failure_to_load_logger_implementation.patch \
|
||||
openjdk/8007393.patch \
|
||||
openjdk/8007611.patch \
|
||||
security/20130618/8004584-augment_applet_contextualization.patch \
|
||||
security/20130618/8005007-better_glyph_processing.patch \
|
||||
security/20130618/8006328-sound_class_robustness.patch \
|
||||
security/20130618/8006328-6_fixup.patch \
|
||||
security/20130618/8006611-improve_scripting.patch \
|
||||
security/20130618/8007467-improve_jmx_internal_api_robustness.patch \
|
||||
security/20130618/8007471-improve_mbean_notifications.patch \
|
||||
security/20130618/8007471-6_fixup.patch \
|
||||
security/20130618/8007812-getenclosingmethod.patch \
|
||||
security/20130618/8008120-improve_jmx_class_checking.patch \
|
||||
security/20130618/8008124-better_compliance_testing.patch \
|
||||
security/20130618/8008128-better_jmx_api_coherence.patch \
|
||||
security/20130618/8008132-better_serialization.patch \
|
||||
security/20130618/8008585-jmx_data_handling.patch \
|
||||
security/20130618/8008593-better_urlclassloader.patch \
|
||||
security/20130618/8008603-jmx_provider_provision.patch \
|
||||
security/20130618/8008611-jmx_annotations.patch \
|
||||
security/20130618/8008611-6_fixup.patch \
|
||||
security/20130618/8008615-jmx_internal_api_robustness.patch \
|
||||
security/20130618/8008623-mbeanserver_handling.patch \
|
||||
security/20130618/8008744-6741606_rework.patch \
|
||||
security/20130618/8008982-jmx_interface_changes.patch \
|
||||
security/20130618/8009004-rmi_connection_improvement.patch \
|
||||
security/20130618/8009013-t2k_glyphs.patch \
|
||||
security/20130618/8009034-jmx_notification_improvement.patch \
|
||||
security/20130618/8009038-jmx_notification_support_improvement.patch \
|
||||
security/20130618/8009067-improve_key_storing.patch \
|
||||
security/20130618/8009235-improve_tsa_data_handling.patch \
|
||||
openjdk/6888167-medialib_memory_leaks.patch \
|
||||
security/20130618/8011243-improve_imaginglib.patch \
|
||||
security/20130618/8011248-better_component_rasters.patch \
|
||||
security/20130618/8011253-better_short_component_rasters.patch \
|
||||
security/20130618/8011257-better_byte_component_rasters.patch \
|
||||
security/20130618/8011557-improve_reflection.patch \
|
||||
security/20130618/8012421-better_positioning.patch \
|
||||
security/20130618/8012438-better_image_validation.patch \
|
||||
security/20130618/8012597-better_image_channel_validation.patch \
|
||||
security/20130618/8012601-better_layout_validation.patch \
|
||||
security/20130618/8014281-better_xml_signature_checking.patch \
|
||||
security/20130618/diamond_fix.patch \
|
||||
security/20130618/handle_npe.patch \
|
||||
security/20130618/javac_issue.patch \
|
||||
security/20130618/7158805-nested_subroutine_rewriting.patch \
|
||||
security/20130618/8001330-checking_order_improvement.patch \
|
||||
security/20130618/8000642-better_transportation_handling.patch \
|
||||
openjdk/6786028-wcag_bold_tags.patch \
|
||||
openjdk/6786682-wcag_lang.patch \
|
||||
openjdk/6802694-no_deprecated.patch \
|
||||
openjdk/6786690-wcag_dl.patch \
|
||||
openjdk/6786688-wcag_table.patch \
|
||||
openjdk/6961178-doclet_xml.patch \
|
||||
openjdk/6851834-restructure.patch \
|
||||
openjdk/6851834-handle_renames.patch \
|
||||
openjdk/7006270-regressions.patch \
|
||||
security/20130618/8012375-javadoc_framing.patch \
|
||||
security/20130618/8015997-more_javadoc_framing.patch \
|
||||
security/20130618/langtools_merge-01.patch \
|
||||
security/20130618/langtools_merge-02.patch \
|
||||
security/20130618/langtools_generics.patch \
|
||||
security/20130618/langtools_merge-03.patch \
|
||||
security/20130618/8009071-improve_shape_handling.patch
|
||||
_PATCHES=
|
||||
|
||||
.if ${PORT_OPTIONS:MICEDTEA}
|
||||
_PATCHES+= \
|
||||
applet_hole.patch \
|
||||
openjdk/7032388-work_without_cmov_instruction.patch \
|
||||
openjdk/8004341-jck_dialog_failure.patch \
|
||||
openjdk/8004341-jck_dialog_failure-02.patch \
|
||||
openjdk/7197906-handle_32_bit_shifts.patch \
|
||||
jpegclasses.patch
|
||||
.endif
|
||||
|
||||
|
@ -1,12 +1,6 @@
|
||||
SHA256 (apache-ant-1.8.4-bin.tar.bz2) = aeaed7d5c2b1e73ffc195d713931047ecc113b8c9844df5cbac2797007455069
|
||||
SIZE (apache-ant-1.8.4-bin.tar.bz2) = 4257152
|
||||
SHA256 (jaxp144_05.zip) = c1a8a5a219fa55ecbf2ad43b66514335a3e96ccad40bd2ec9165a821343b2bff
|
||||
SIZE (jaxp144_05.zip) = 5976387
|
||||
SHA256 (jdk6-jaf-b20.zip) = 78c7b5c9d6271e88ee46abadd018a61f1e9645f8936cc8df1617e5f4f5074012
|
||||
SIZE (jdk6-jaf-b20.zip) = 71243
|
||||
SHA256 (jdk6-jaxws2_1_6-2011_06_13.zip) = 229040544e791f44906e8e7b6f6faf503c730a5d854275135f3925490d5c3be3
|
||||
SIZE (jdk6-jaxws2_1_6-2011_06_13.zip) = 5512710
|
||||
SHA256 (openjdk-6-src-b27-26_oct_2012.tar.gz) = 044c3877b15940ff04f8aa817337f2878a00cc89674854557f1a02f15b1802a0
|
||||
SIZE (openjdk-6-src-b27-26_oct_2012.tar.gz) = 45789350
|
||||
SHA256 (openjdk-6-src-b28-04_oct_2013.tar.gz) = ac4fceed060ad61dab938c41181455fb0910f58f6944f820f0637b0f0c64bf75
|
||||
SIZE (openjdk-6-src-b28-04_oct_2013.tar.gz) = 53599044
|
||||
SHA256 (jtreg-4.1-bin-b05_29_nov_2012.zip) = 9291eb4a14501232b35614e88686ff66ad8b69d0098dbd4322b28f97b672653d
|
||||
SIZE (jtreg-4.1-bin-b05_29_nov_2012.zip) = 5993382
|
||||
|
@ -1,15 +0,0 @@
|
||||
--- jaxp/build.properties.orig 2012-10-26 14:23:11.000000000 -0400
|
||||
+++ jaxp/build.properties 2013-04-25 14:25:15.000000000 -0400
|
||||
@@ -77,6 +77,12 @@
|
||||
# Where patches to drop bundle sources live
|
||||
patches.dir=patches
|
||||
|
||||
+# Patches to apply
|
||||
+jaxp_src.patch.list=6657673.patch \
|
||||
+ 6657673-fixup.patch \
|
||||
+ 7133220-factory_finder_parser_transform_useBSClassLoader.patch \
|
||||
+ 6657673-factory_finder.patch
|
||||
+
|
||||
# Sanity information
|
||||
sanity.info= Sanity Settings:${line.separator}\
|
||||
ant.home=${ant.home}${line.separator}\
|
@ -1,13 +0,0 @@
|
||||
--- jaxws/build.properties.orig 2012-10-26 14:23:24.000000000 -0400
|
||||
+++ jaxws/build.properties 2013-04-25 15:06:29.000000000 -0400
|
||||
@@ -77,6 +77,10 @@
|
||||
# Where patches to drop bundle sources live
|
||||
patches.dir=patches
|
||||
|
||||
+# Patches to apply
|
||||
+jaxws_src.patch.list=8003543.patch \
|
||||
+ 8005432.patch
|
||||
+
|
||||
# Sanity information
|
||||
sanity.info= Sanity Settings:${line.separator}\
|
||||
ant.home=${ant.home}${line.separator}\
|
@ -1,429 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User andrew
|
||||
# Date 1365704033 -3600
|
||||
# Node ID 06255d9f82761abc74c30f31fda00968ffef4bc3
|
||||
# Parent a939f541de9af5ccb78225c27cd46cd7dc6bcf87
|
||||
5102804: Memory leak in Introspector.getBeanInfo(Class) for custom BeanInfo: Class param (includes WeakCache from 6397609)
|
||||
Reviewed-by: peterz
|
||||
|
||||
diff --git a/src/share/classes/com/sun/beans/WeakCache.java b/src/share/classes/com/sun/beans/WeakCache.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ jdk/src/share/classes/com/sun/beans/WeakCache.java
|
||||
@@ -0,0 +1,91 @@
|
||||
+/*
|
||||
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ * This code is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation. Sun designates this
|
||||
+ * particular file as subject to the "Classpath" exception as provided
|
||||
+ * by Sun in the LICENSE file that accompanied this code.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
+ * CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
+ * have any questions.
|
||||
+ */
|
||||
+package com.sun.beans;
|
||||
+
|
||||
+import java.lang.ref.Reference;
|
||||
+import java.lang.ref.WeakReference;
|
||||
+
|
||||
+import java.util.Map;
|
||||
+import java.util.WeakHashMap;
|
||||
+
|
||||
+/**
|
||||
+ * A hashtable-based cache with weak keys and weak values.
|
||||
+ * An entry in the map will be automatically removed
|
||||
+ * when its key is no longer in the ordinary use.
|
||||
+ * A value will be automatically removed as well
|
||||
+ * when it is no longer in the ordinary use.
|
||||
+ *
|
||||
+ * @since 1.7
|
||||
+ *
|
||||
+ * @author Sergey A. Malenkov
|
||||
+ */
|
||||
+public final class WeakCache<K, V> {
|
||||
+ private final Map<K, Reference<V>> map = new WeakHashMap<K, Reference<V>>();
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a value to which the specified {@code key} is mapped,
|
||||
+ * or {@code null} if this map contains no mapping for the {@code key}.
|
||||
+ *
|
||||
+ * @param key the key whose associated value is returned
|
||||
+ * @return a value to which the specified {@code key} is mapped
|
||||
+ */
|
||||
+ public V get(K key) {
|
||||
+ Reference<V> reference = this.map.get(key);
|
||||
+ if (reference == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ V value = reference.get();
|
||||
+ if (value == null) {
|
||||
+ this.map.remove(key);
|
||||
+ }
|
||||
+ return value;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Associates the specified {@code value} with the specified {@code key}.
|
||||
+ * Removes the mapping for the specified {@code key} from this cache
|
||||
+ * if it is present and the specified {@code value} is {@code null}.
|
||||
+ * If the cache previously contained a mapping for the {@code key},
|
||||
+ * the old value is replaced by the specified {@code value}.
|
||||
+ *
|
||||
+ * @param key the key with which the specified value is associated
|
||||
+ * @param value the value to be associated with the specified key
|
||||
+ */
|
||||
+ public void put(K key, V value) {
|
||||
+ if (value != null) {
|
||||
+ this.map.put(key, new WeakReference<V>(value));
|
||||
+ }
|
||||
+ else {
|
||||
+ this.map.remove(key);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Removes all of the mappings from this cache.
|
||||
+ */
|
||||
+ public void clear() {
|
||||
+ this.map.clear();
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/share/classes/java/beans/Introspector.java b/src/share/classes/java/beans/Introspector.java
|
||||
--- jdk/src/share/classes/java/beans/Introspector.java
|
||||
+++ jdk/src/share/classes/java/beans/Introspector.java
|
||||
@@ -25,25 +25,18 @@
|
||||
|
||||
package java.beans;
|
||||
|
||||
+import com.sun.beans.WeakCache;
|
||||
import com.sun.beans.finder.ClassFinder;
|
||||
|
||||
-import java.lang.ref.Reference;
|
||||
-import java.lang.ref.SoftReference;
|
||||
-
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
-import java.security.AccessController;
|
||||
-import java.security.PrivilegedAction;
|
||||
-
|
||||
-import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.EventListener;
|
||||
import java.util.List;
|
||||
-import java.util.WeakHashMap;
|
||||
import java.util.TreeMap;
|
||||
import sun.awt.AppContext;
|
||||
import sun.reflect.misc.ReflectUtil;
|
||||
@@ -110,8 +103,8 @@
|
||||
public final static int IGNORE_ALL_BEANINFO = 3;
|
||||
|
||||
// Static Caches to speed up introspection.
|
||||
- private static Map declaredMethodCache =
|
||||
- Collections.synchronizedMap(new WeakHashMap());
|
||||
+ private static WeakCache<Class<?>, Method[]> declaredMethodCache =
|
||||
+ new WeakCache<Class<?>, Method[]>();
|
||||
|
||||
private static final Object BEANINFO_CACHE = new Object();
|
||||
|
||||
@@ -177,20 +170,21 @@
|
||||
if (!ReflectUtil.isPackageAccessible(beanClass)) {
|
||||
return (new Introspector(beanClass, null, USE_ALL_BEANINFO)).getBeanInfo();
|
||||
}
|
||||
- Map<Class<?>, BeanInfo> map;
|
||||
synchronized (BEANINFO_CACHE) {
|
||||
- map = (Map<Class<?>, BeanInfo>) AppContext.getAppContext().get(BEANINFO_CACHE);
|
||||
- if (map == null) {
|
||||
- map = Collections.synchronizedMap(new WeakHashMap<Class<?>, BeanInfo>());
|
||||
- AppContext.getAppContext().put(BEANINFO_CACHE, map);
|
||||
+ WeakCache<Class<?>, BeanInfo> beanInfoCache =
|
||||
+ (WeakCache<Class<?>, BeanInfo>) AppContext.getAppContext().get(BEANINFO_CACHE);
|
||||
+
|
||||
+ if (beanInfoCache == null) {
|
||||
+ beanInfoCache = new WeakCache<Class<?>, BeanInfo>();
|
||||
+ AppContext.getAppContext().put(BEANINFO_CACHE, beanInfoCache);
|
||||
}
|
||||
+ BeanInfo beanInfo = beanInfoCache.get(beanClass);
|
||||
+ if (beanInfo == null) {
|
||||
+ beanInfo = (new Introspector(beanClass, null, USE_ALL_BEANINFO)).getBeanInfo();
|
||||
+ beanInfoCache.put(beanClass, beanInfo);
|
||||
+ }
|
||||
+ return beanInfo;
|
||||
}
|
||||
- BeanInfo bi = map.get(beanClass);
|
||||
- if (bi == null) {
|
||||
- bi = (new Introspector(beanClass, null, USE_ALL_BEANINFO)).getBeanInfo();
|
||||
- map.put(beanClass, bi);
|
||||
- }
|
||||
- return bi;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -337,11 +331,13 @@
|
||||
*/
|
||||
|
||||
public static void flushCaches() {
|
||||
- Map map = (Map) AppContext.getAppContext().get(BEANINFO_CACHE);
|
||||
- if (map != null) {
|
||||
- map.clear();
|
||||
+ synchronized (BEANINFO_CACHE) {
|
||||
+ WeakCache beanInfoCache = (WeakCache) AppContext.getAppContext().get(BEANINFO_CACHE);
|
||||
+ if (beanInfoCache != null) {
|
||||
+ beanInfoCache.clear();
|
||||
+ }
|
||||
+ declaredMethodCache.clear();
|
||||
}
|
||||
- declaredMethodCache.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -363,11 +359,13 @@
|
||||
if (clz == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
- Map map = (Map) AppContext.getAppContext().get(BEANINFO_CACHE);
|
||||
- if (map != null) {
|
||||
- map.remove(clz);
|
||||
+ synchronized (BEANINFO_CACHE) {
|
||||
+ WeakCache beanInfoCache = (WeakCache) AppContext.getAppContext().get(BEANINFO_CACHE);
|
||||
+ if (beanInfoCache != null) {
|
||||
+ beanInfoCache.put(clz, null);
|
||||
+ }
|
||||
+ declaredMethodCache.put(clz, null);
|
||||
}
|
||||
- declaredMethodCache.remove(clz);
|
||||
}
|
||||
|
||||
//======================================================================
|
||||
@@ -1306,41 +1304,26 @@
|
||||
/*
|
||||
* Internal method to return *public* methods within a class.
|
||||
*/
|
||||
- private static synchronized Method[] getPublicDeclaredMethods(Class clz) {
|
||||
+ private static Method[] getPublicDeclaredMethods(Class clz) {
|
||||
// Looking up Class.getDeclaredMethods is relatively expensive,
|
||||
// so we cache the results.
|
||||
- Method[] result = null;
|
||||
if (!ReflectUtil.isPackageAccessible(clz)) {
|
||||
return new Method[0];
|
||||
}
|
||||
- final Class fclz = clz;
|
||||
- Reference ref = (Reference)declaredMethodCache.get(fclz);
|
||||
- if (ref != null) {
|
||||
- result = (Method[])ref.get();
|
||||
- if (result != null) {
|
||||
- return result;
|
||||
+ synchronized (BEANINFO_CACHE) {
|
||||
+ Method[] result = declaredMethodCache.get(clz);
|
||||
+ if (result == null) {
|
||||
+ result = clz.getMethods();
|
||||
+ for (int i = 0; i < result.length; i++) {
|
||||
+ Method method = result[i];
|
||||
+ if (!method.getDeclaringClass().equals(clz)) {
|
||||
+ result[i] = null;
|
||||
+ }
|
||||
+ }
|
||||
+ declaredMethodCache.put(clz, result);
|
||||
}
|
||||
+ return result;
|
||||
}
|
||||
-
|
||||
- // We have to raise privilege for getDeclaredMethods
|
||||
- result = (Method[]) AccessController.doPrivileged(new PrivilegedAction() {
|
||||
- public Object run() {
|
||||
- return fclz.getDeclaredMethods();
|
||||
- }
|
||||
- });
|
||||
-
|
||||
-
|
||||
- // Null out any non-public methods.
|
||||
- for (int i = 0; i < result.length; i++) {
|
||||
- Method method = result[i];
|
||||
- int mods = method.getModifiers();
|
||||
- if (!Modifier.isPublic(mods)) {
|
||||
- result[i] = null;
|
||||
- }
|
||||
- }
|
||||
- // Add it to the cache.
|
||||
- declaredMethodCache.put(fclz, new SoftReference(result));
|
||||
- return result;
|
||||
}
|
||||
|
||||
//======================================================================
|
||||
diff --git a/test/java/beans/Introspector/Test5102804.java b/test/java/beans/Introspector/Test5102804.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ jdk/test/java/beans/Introspector/Test5102804.java
|
||||
@@ -0,0 +1,155 @@
|
||||
+/*
|
||||
+ * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ * This code is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
+ * CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
+ * have any questions.
|
||||
+ */
|
||||
+
|
||||
+/*
|
||||
+ * @test
|
||||
+ * @bug 5102804
|
||||
+ * @summary Tests memory leak
|
||||
+ * @author Sergey Malenkov
|
||||
+ */
|
||||
+
|
||||
+import java.beans.BeanInfo;
|
||||
+import java.beans.IntrospectionException;
|
||||
+import java.beans.Introspector;
|
||||
+import java.beans.PropertyDescriptor;
|
||||
+import java.beans.SimpleBeanInfo;
|
||||
+import java.lang.ref.Reference;
|
||||
+import java.lang.ref.WeakReference;
|
||||
+import java.net.URL;
|
||||
+import java.net.URLClassLoader;
|
||||
+
|
||||
+public class Test5102804 {
|
||||
+ private static final String BEAN_NAME = "Test5102804$Example";
|
||||
+ private static final String BEAN_INFO_NAME = BEAN_NAME + "BeanInfo";
|
||||
+
|
||||
+ public static void main(String[] args) {
|
||||
+ if (!isCollectible(getReference()))
|
||||
+ throw new Error("Reference is not collected");
|
||||
+ }
|
||||
+
|
||||
+ private static Reference getReference() {
|
||||
+ try {
|
||||
+ ClassLoader loader = new Loader();
|
||||
+ Class type = Class.forName(BEAN_NAME, true, loader);
|
||||
+ if (!type.getClassLoader().equals(loader)) {
|
||||
+ throw new Error("Wrong class loader");
|
||||
+ }
|
||||
+ BeanInfo info = Introspector.getBeanInfo(type);
|
||||
+ if (0 != info.getDefaultPropertyIndex()) {
|
||||
+ throw new Error("Wrong bean info found");
|
||||
+ }
|
||||
+ return new WeakReference<Class>(type);
|
||||
+ }
|
||||
+ catch (IntrospectionException exception) {
|
||||
+ throw new Error("Introspection Error", exception);
|
||||
+ }
|
||||
+ catch (ClassNotFoundException exception) {
|
||||
+ throw new Error("Class Not Found", exception);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static boolean isCollectible(Reference reference) {
|
||||
+ int[] array = new int[10];
|
||||
+ while (true) {
|
||||
+ try {
|
||||
+ array = new int[array.length + array.length / 3];
|
||||
+ }
|
||||
+ catch (OutOfMemoryError error) {
|
||||
+ return null == reference.get();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Custom class loader to load the Example class by itself.
|
||||
+ * Could also load it from a different code source, but this is easier to set up.
|
||||
+ */
|
||||
+ private static final class Loader extends URLClassLoader {
|
||||
+ Loader() {
|
||||
+ super(new URL[] {
|
||||
+ Test5102804.class.getProtectionDomain().getCodeSource().getLocation()
|
||||
+ });
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException {
|
||||
+ Class c = findLoadedClass(name);
|
||||
+ if (c == null) {
|
||||
+ if (BEAN_NAME.equals(name) || BEAN_INFO_NAME.equals(name)) {
|
||||
+ c = findClass(name);
|
||||
+ }
|
||||
+ else try {
|
||||
+ c = getParent().loadClass(name);
|
||||
+ }
|
||||
+ catch (ClassNotFoundException exception) {
|
||||
+ c = findClass(name);
|
||||
+ }
|
||||
+ }
|
||||
+ if (resolve) {
|
||||
+ resolveClass(c);
|
||||
+ }
|
||||
+ return c;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * A simple bean to load from the Loader class, not main class loader.
|
||||
+ */
|
||||
+ public static final class Example {
|
||||
+ private int value;
|
||||
+
|
||||
+ public int getValue() {
|
||||
+ return value;
|
||||
+ }
|
||||
+
|
||||
+ public void setValue(int value) {
|
||||
+ this.value = value;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The BeanInfo for the Example class.
|
||||
+ * It is also loaded from the Loader class.
|
||||
+ */
|
||||
+ public static final class ExampleBeanInfo extends SimpleBeanInfo {
|
||||
+ @Override
|
||||
+ public int getDefaultPropertyIndex() {
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public PropertyDescriptor[] getPropertyDescriptors() {
|
||||
+ try {
|
||||
+ return new PropertyDescriptor[] {
|
||||
+ new PropertyDescriptor("value", Class.forName(BEAN_NAME))
|
||||
+ };
|
||||
+ }
|
||||
+ catch (ClassNotFoundException exception) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ catch (IntrospectionException exception) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,355 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User andrew
|
||||
# Date 1365686276 -3600
|
||||
# Node ID a939f541de9af5ccb78225c27cd46cd7dc6bcf87
|
||||
# Parent 9745a1f43592582cce60d8632d614fafc7dfdc3c
|
||||
6669869: Beans.isDesignTime() and other queries should be per-AppContext
|
||||
Reviewed-by: peterz, rupashka
|
||||
|
||||
diff --git a/src/share/classes/java/beans/Beans.java b/src/share/classes/java/beans/Beans.java
|
||||
--- jdk/src/share/classes/java/beans/Beans.java
|
||||
+++ jdk/src/share/classes/java/beans/Beans.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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,26 +27,41 @@
|
||||
|
||||
import com.sun.beans.finder.ClassFinder;
|
||||
|
||||
-import java.applet.*;
|
||||
+import java.applet.Applet;
|
||||
+import java.applet.AppletContext;
|
||||
+import java.applet.AppletStub;
|
||||
+import java.applet.AudioClip;
|
||||
|
||||
-import java.awt.*;
|
||||
-
|
||||
-import java.beans.AppletInitializer;
|
||||
+import java.awt.GraphicsEnvironment;
|
||||
+import java.awt.Image;
|
||||
|
||||
import java.beans.beancontext.BeanContext;
|
||||
|
||||
-import java.io.*;
|
||||
-
|
||||
-import java.lang.reflect.Constructor;
|
||||
+import java.io.IOException;
|
||||
+import java.io.InputStream;
|
||||
+import java.io.ObjectInputStream;
|
||||
+import java.io.ObjectStreamClass;
|
||||
+import java.io.StreamCorruptedException;
|
||||
|
||||
import java.net.URL;
|
||||
-import java.lang.reflect.Array;
|
||||
+
|
||||
+import java.security.AccessController;
|
||||
+import java.security.PrivilegedAction;
|
||||
+
|
||||
+import java.util.Enumeration;
|
||||
+import java.util.Hashtable;
|
||||
+import java.util.Iterator;
|
||||
+import java.util.Vector;
|
||||
+
|
||||
+import sun.awt.AppContext;
|
||||
|
||||
/**
|
||||
* This class provides some general purpose beans control methods.
|
||||
*/
|
||||
|
||||
public class Beans {
|
||||
+ private static final Object DESIGN_TIME = new Object();
|
||||
+ private static final Object GUI_AVAILABLE = new Object();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -59,12 +74,12 @@
|
||||
* @param beanName the name of the bean within the class-loader.
|
||||
* For example "sun.beanbox.foobah"
|
||||
*
|
||||
- * @exception java.lang.ClassNotFoundException if the class of a serialized
|
||||
+ * @exception ClassNotFoundException if the class of a serialized
|
||||
* object could not be found.
|
||||
- * @exception java.io.IOException if an I/O error occurs.
|
||||
+ * @exception IOException if an I/O error occurs.
|
||||
*/
|
||||
|
||||
- public static Object instantiate(ClassLoader cls, String beanName) throws java.io.IOException, ClassNotFoundException {
|
||||
+ public static Object instantiate(ClassLoader cls, String beanName) throws IOException, ClassNotFoundException {
|
||||
return Beans.instantiate(cls, beanName, null, null);
|
||||
}
|
||||
|
||||
@@ -80,12 +95,12 @@
|
||||
* For example "sun.beanbox.foobah"
|
||||
* @param beanContext The BeanContext in which to nest the new bean
|
||||
*
|
||||
- * @exception java.lang.ClassNotFoundException if the class of a serialized
|
||||
+ * @exception ClassNotFoundException if the class of a serialized
|
||||
* object could not be found.
|
||||
- * @exception java.io.IOException if an I/O error occurs.
|
||||
+ * @exception IOException if an I/O error occurs.
|
||||
*/
|
||||
|
||||
- public static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext) throws java.io.IOException, ClassNotFoundException {
|
||||
+ public static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext) throws IOException, ClassNotFoundException {
|
||||
return Beans.instantiate(cls, beanName, beanContext, null);
|
||||
}
|
||||
|
||||
@@ -135,19 +150,19 @@
|
||||
* @param beanContext The BeanContext in which to nest the new bean
|
||||
* @param initializer The AppletInitializer for the new bean
|
||||
*
|
||||
- * @exception java.lang.ClassNotFoundException if the class of a serialized
|
||||
+ * @exception ClassNotFoundException if the class of a serialized
|
||||
* object could not be found.
|
||||
- * @exception java.io.IOException if an I/O error occurs.
|
||||
+ * @exception IOException if an I/O error occurs.
|
||||
*/
|
||||
|
||||
public static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext, AppletInitializer initializer)
|
||||
- throws java.io.IOException, ClassNotFoundException {
|
||||
+ throws IOException, ClassNotFoundException {
|
||||
|
||||
- java.io.InputStream ins;
|
||||
- java.io.ObjectInputStream oins = null;
|
||||
+ InputStream ins;
|
||||
+ ObjectInputStream oins = null;
|
||||
Object result = null;
|
||||
boolean serialized = false;
|
||||
- java.io.IOException serex = null;
|
||||
+ IOException serex = null;
|
||||
|
||||
// If the given classloader is null, we check if an
|
||||
// system classloader is available and (if so)
|
||||
@@ -166,8 +181,8 @@
|
||||
// Try to find a serialized object with this name
|
||||
final String serName = beanName.replace('.','/').concat(".ser");
|
||||
final ClassLoader loader = cls;
|
||||
- ins = (InputStream)java.security.AccessController.doPrivileged
|
||||
- (new java.security.PrivilegedAction() {
|
||||
+ ins = (InputStream)AccessController.doPrivileged
|
||||
+ (new PrivilegedAction() {
|
||||
public Object run() {
|
||||
if (loader == null)
|
||||
return ClassLoader.getSystemResourceAsStream(serName);
|
||||
@@ -185,7 +200,7 @@
|
||||
result = oins.readObject();
|
||||
serialized = true;
|
||||
oins.close();
|
||||
- } catch (java.io.IOException ex) {
|
||||
+ } catch (IOException ex) {
|
||||
ins.close();
|
||||
// Drop through and try opening the class. But remember
|
||||
// the exception in case we can't find the class either.
|
||||
@@ -264,8 +279,8 @@
|
||||
|
||||
final ClassLoader cloader = cls;
|
||||
objectUrl = (URL)
|
||||
- java.security.AccessController.doPrivileged
|
||||
- (new java.security.PrivilegedAction() {
|
||||
+ AccessController.doPrivileged
|
||||
+ (new PrivilegedAction() {
|
||||
public Object run() {
|
||||
if (cloader == null)
|
||||
return ClassLoader.getSystemResource
|
||||
@@ -377,10 +392,11 @@
|
||||
* @return True if we are running in an application construction
|
||||
* environment.
|
||||
*
|
||||
- * @see java.beans.DesignMode
|
||||
+ * @see DesignMode
|
||||
*/
|
||||
public static boolean isDesignTime() {
|
||||
- return designTime;
|
||||
+ Object value = AppContext.getAppContext().get(DESIGN_TIME);
|
||||
+ return (value instanceof Boolean) && (Boolean) value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -393,11 +409,12 @@
|
||||
* false in a server environment or if an application is
|
||||
* running as part of a batch job.
|
||||
*
|
||||
- * @see java.beans.Visibility
|
||||
+ * @see Visibility
|
||||
*
|
||||
*/
|
||||
public static boolean isGuiAvailable() {
|
||||
- return guiAvailable;
|
||||
+ Object value = AppContext.getAppContext().get(GUI_AVAILABLE);
|
||||
+ return (value instanceof Boolean) ? (Boolean) value : !GraphicsEnvironment.isHeadless();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -423,7 +440,7 @@
|
||||
if (sm != null) {
|
||||
sm.checkPropertiesAccess();
|
||||
}
|
||||
- designTime = isDesignTime;
|
||||
+ AppContext.getAppContext().put(DESIGN_TIME, Boolean.valueOf(isDesignTime));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -449,14 +466,7 @@
|
||||
if (sm != null) {
|
||||
sm.checkPropertiesAccess();
|
||||
}
|
||||
- guiAvailable = isGuiAvailable;
|
||||
- }
|
||||
-
|
||||
-
|
||||
- private static boolean designTime;
|
||||
- private static boolean guiAvailable;
|
||||
- static {
|
||||
- guiAvailable = !GraphicsEnvironment.isHeadless();
|
||||
+ AppContext.getAppContext().put(GUI_AVAILABLE, Boolean.valueOf(isGuiAvailable));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -501,7 +511,7 @@
|
||||
|
||||
class BeansAppletContext implements AppletContext {
|
||||
Applet target;
|
||||
- java.util.Hashtable imageCache = new java.util.Hashtable();
|
||||
+ Hashtable imageCache = new Hashtable();
|
||||
|
||||
BeansAppletContext(Applet target) {
|
||||
this.target = target;
|
||||
@@ -546,8 +556,8 @@
|
||||
return null;
|
||||
}
|
||||
|
||||
- public java.util.Enumeration getApplets() {
|
||||
- java.util.Vector applets = new java.util.Vector();
|
||||
+ public Enumeration getApplets() {
|
||||
+ Vector applets = new Vector();
|
||||
applets.addElement(target);
|
||||
return applets.elements();
|
||||
}
|
||||
@@ -573,7 +583,7 @@
|
||||
return null;
|
||||
}
|
||||
|
||||
- public java.util.Iterator getStreamKeys(){
|
||||
+ public Iterator getStreamKeys(){
|
||||
// We do nothing.
|
||||
return null;
|
||||
}
|
||||
diff --git a/test/java/beans/Beans/6669869/TestDesignTime.java b/test/java/beans/Beans/6669869/TestDesignTime.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ jdk/test/java/beans/Beans/6669869/TestDesignTime.java
|
||||
@@ -0,0 +1,52 @@
|
||||
+/*
|
||||
+ * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ * This code is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
+ * CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
+ * have any questions.
|
||||
+ */
|
||||
+
|
||||
+/*
|
||||
+ * @test
|
||||
+ * @bug 6669869
|
||||
+ * @summary Tests DesignTime property in different application contexts
|
||||
+ * @author Sergey Malenkov
|
||||
+ */
|
||||
+
|
||||
+import java.beans.Beans;
|
||||
+import sun.awt.SunToolkit;
|
||||
+
|
||||
+public class TestDesignTime implements Runnable {
|
||||
+ public static void main(String[] args) throws InterruptedException {
|
||||
+ if (Beans.isDesignTime()) {
|
||||
+ throw new Error("unexpected DesignTime property");
|
||||
+ }
|
||||
+ Beans.setDesignTime(!Beans.isDesignTime());
|
||||
+ ThreadGroup group = new ThreadGroup("$$$");
|
||||
+ Thread thread = new Thread(group, new TestDesignTime());
|
||||
+ thread.start();
|
||||
+ thread.join();
|
||||
+ }
|
||||
+
|
||||
+ public void run() {
|
||||
+ SunToolkit.createNewAppContext();
|
||||
+ if (Beans.isDesignTime()) {
|
||||
+ throw new Error("shared DesignTime property");
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/test/java/beans/Beans/6669869/TestGuiAvailable.java b/test/java/beans/Beans/6669869/TestGuiAvailable.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ jdk/test/java/beans/Beans/6669869/TestGuiAvailable.java
|
||||
@@ -0,0 +1,53 @@
|
||||
+/*
|
||||
+ * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ * This code is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
+ * CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
+ * have any questions.
|
||||
+ */
|
||||
+
|
||||
+/*
|
||||
+ * @test
|
||||
+ * @bug 6669869
|
||||
+ * @summary Tests GuiAvailable property in different application contexts
|
||||
+ * @author Sergey Malenkov
|
||||
+ */
|
||||
+
|
||||
+import java.awt.GraphicsEnvironment;
|
||||
+import java.beans.Beans;
|
||||
+import sun.awt.SunToolkit;
|
||||
+
|
||||
+public class TestGuiAvailable implements Runnable {
|
||||
+ public static void main(String[] args) throws InterruptedException {
|
||||
+ if (Beans.isGuiAvailable() == GraphicsEnvironment.isHeadless()) {
|
||||
+ throw new Error("unexpected GuiAvailable property");
|
||||
+ }
|
||||
+ Beans.setGuiAvailable(!Beans.isGuiAvailable());
|
||||
+ ThreadGroup group = new ThreadGroup("$$$");
|
||||
+ Thread thread = new Thread(group, new TestGuiAvailable());
|
||||
+ thread.start();
|
||||
+ thread.join();
|
||||
+ }
|
||||
+
|
||||
+ public void run() {
|
||||
+ SunToolkit.createNewAppContext();
|
||||
+ if (Beans.isGuiAvailable() == GraphicsEnvironment.isHeadless()) {
|
||||
+ throw new Error("shared GuiAvailable property");
|
||||
+ }
|
||||
+ }
|
||||
+}
|
File diff suppressed because it is too large
Load Diff
@ -1,274 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User bpatel
|
||||
# Date 1232068871 28800
|
||||
# Node ID 92a90d8c955b6cc619d16975e02d9143715dedaa
|
||||
# Parent a50f3556d6954decf0897aa984c8ba43def77b9e
|
||||
6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
|
||||
Reviewed-by: jjg
|
||||
|
||||
diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java
|
||||
--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java
|
||||
+++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java
|
||||
@@ -493,4 +493,14 @@
|
||||
public Comparator getMemberComparator() {
|
||||
return null;
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * {@inheritDoc}
|
||||
+ */
|
||||
+ public Locale getLocale() {
|
||||
+ if (root instanceof com.sun.tools.javadoc.RootDocImpl)
|
||||
+ return ((com.sun.tools.javadoc.RootDocImpl)root).getLocale();
|
||||
+ else
|
||||
+ return Locale.getDefault();
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java
|
||||
--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java
|
||||
+++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java
|
||||
@@ -85,7 +85,7 @@
|
||||
* Print <HTML> tag. Add a newline character at the end.
|
||||
*/
|
||||
public void html() {
|
||||
- println("<HTML>");
|
||||
+ println("<HTML lang=\"" + configuration.getLocale().getLanguage() + "\">");
|
||||
}
|
||||
|
||||
/**
|
||||
diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java
|
||||
--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java
|
||||
+++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java
|
||||
@@ -707,6 +707,11 @@
|
||||
}
|
||||
|
||||
/**
|
||||
+ * Return the Locale for this document.
|
||||
+ */
|
||||
+ public abstract Locale getLocale();
|
||||
+
|
||||
+ /**
|
||||
* Return the comparator that will be used to sort member documentation.
|
||||
* To no do any sorting, return null.
|
||||
*
|
||||
diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/SourceToHTMLConverter.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/SourceToHTMLConverter.java
|
||||
--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/SourceToHTMLConverter.java
|
||||
+++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/SourceToHTMLConverter.java
|
||||
@@ -155,7 +155,7 @@
|
||||
reader.close();
|
||||
}
|
||||
output = addLineNumbers(output.toString());
|
||||
- output.insert(0, getHeader());
|
||||
+ output.insert(0, getHeader(configuration));
|
||||
output.append(getFooter());
|
||||
writeToFile(output.toString(), outputdir, cd.name(), configuration);
|
||||
} catch (Exception e){
|
||||
@@ -205,10 +205,11 @@
|
||||
|
||||
/**
|
||||
* Get the header.
|
||||
+ * @param configuration the Doclet configuration
|
||||
* @return the header to the output file
|
||||
*/
|
||||
- protected static String getHeader() {
|
||||
- StringBuffer result = new StringBuffer("<HTML>" + DocletConstants.NL);
|
||||
+ protected static String getHeader(Configuration configuration) {
|
||||
+ StringBuffer result = new StringBuffer("<HTML lang=\"" + configuration.getLocale().getLanguage() + "\">" + DocletConstants.NL);
|
||||
result.append("<BODY BGCOLOR=\""+ BGCOLOR + "\">" + DocletConstants.NL);
|
||||
result.append("<PRE>" + DocletConstants.NL);
|
||||
return result.toString();
|
||||
diff --git a/src/share/classes/com/sun/tools/javadoc/RootDocImpl.java b/src/share/classes/com/sun/tools/javadoc/RootDocImpl.java
|
||||
--- langtools/src/share/classes/com/sun/tools/javadoc/RootDocImpl.java
|
||||
+++ langtools/src/share/classes/com/sun/tools/javadoc/RootDocImpl.java
|
||||
@@ -36,6 +36,7 @@
|
||||
import com.sun.tools.javac.util.List;
|
||||
import com.sun.tools.javac.util.ListBuffer;
|
||||
import com.sun.tools.javac.util.Position;
|
||||
+import java.util.Locale;
|
||||
|
||||
/**
|
||||
* This class holds the information from one run of javadoc.
|
||||
@@ -361,4 +362,11 @@
|
||||
public Locale getLocale() {
|
||||
return env.doclocale.locale;
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Return the locale provided by the user or the default locale value.
|
||||
+ */
|
||||
+ public Locale getLocale() {
|
||||
+ return env.doclocale.locale;
|
||||
+ }
|
||||
}
|
||||
diff --git a/test/com/sun/javadoc/testHtmlTag/TestHtmlTag.java b/test/com/sun/javadoc/testHtmlTag/TestHtmlTag.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ langtools/test/com/sun/javadoc/testHtmlTag/TestHtmlTag.java
|
||||
@@ -0,0 +1,93 @@
|
||||
+/*
|
||||
+ * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ * This code is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation. Sun designates this
|
||||
+ * particular file as subject to the "Classpath" exception as provided
|
||||
+ * by Sun in the LICENSE file that accompanied this code.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
+ * CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
+ * have any questions.
|
||||
+ */
|
||||
+
|
||||
+/*
|
||||
+ * @test
|
||||
+ * @bug 6786682
|
||||
+ * @summary This test verifies the use of lang attribute by <HTML>.
|
||||
+ * @author Bhavesh Patel
|
||||
+ * @library ../lib/
|
||||
+ * @build JavadocTester
|
||||
+ * @build TestHtmlTag
|
||||
+ * @run main TestHtmlTag
|
||||
+ */
|
||||
+
|
||||
+import java.util.Locale;
|
||||
+
|
||||
+public class TestHtmlTag extends JavadocTester {
|
||||
+
|
||||
+ private static final String BUG_ID = "6786682";
|
||||
+ private static final String[][] TEST1 = {
|
||||
+ {BUG_ID + FS + "pkg1" + FS + "C1.html", "<HTML lang=\"" + Locale.getDefault().getLanguage() + "\">"},
|
||||
+ {BUG_ID + FS + "pkg1" + FS + "package-summary.html", "<HTML lang=\"" + Locale.getDefault().getLanguage() + "\">"}};
|
||||
+ private static final String[][] NEGATED_TEST1 = {
|
||||
+ {BUG_ID + FS + "pkg1" + FS + "C1.html", "<HTML>"}};
|
||||
+ private static final String[][] TEST2 = {
|
||||
+ {BUG_ID + FS + "pkg2" + FS + "C2.html", "<HTML lang=\"ja\">"},
|
||||
+ {BUG_ID + FS + "pkg2" + FS + "package-summary.html", "<HTML lang=\"ja\">"}};
|
||||
+ private static final String[][] NEGATED_TEST2 = {
|
||||
+ {BUG_ID + FS + "pkg2" + FS + "C2.html", "<HTML>"}};
|
||||
+ private static final String[][] TEST3 = {
|
||||
+ {BUG_ID + FS + "pkg1" + FS + "C1.html", "<HTML lang=\"en\">"},
|
||||
+ {BUG_ID + FS + "pkg1" + FS + "package-summary.html", "<HTML lang=\"en\">"}};
|
||||
+ private static final String[][] NEGATED_TEST3 = {
|
||||
+ {BUG_ID + FS + "pkg1" + FS + "C1.html", "<HTML>"}};
|
||||
+
|
||||
+ private static final String[] ARGS1 =
|
||||
+ new String[] {
|
||||
+ "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1"};
|
||||
+ private static final String[] ARGS2 =
|
||||
+ new String[] {
|
||||
+ "-locale", "ja", "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg2"};
|
||||
+ private static final String[] ARGS3 =
|
||||
+ new String[] {
|
||||
+ "-locale", "en_US", "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1"};
|
||||
+
|
||||
+ /**
|
||||
+ * The entry point of the test.
|
||||
+ * @param args the array of command line arguments.
|
||||
+ */
|
||||
+ public static void main(String[] args) {
|
||||
+ TestHtmlTag tester = new TestHtmlTag();
|
||||
+ run(tester, ARGS1, TEST1, NEGATED_TEST1);
|
||||
+ run(tester, ARGS2, TEST2, NEGATED_TEST2);
|
||||
+ run(tester, ARGS3, TEST3, NEGATED_TEST3);
|
||||
+ tester.printSummary();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * {@inheritDoc}
|
||||
+ */
|
||||
+ public String getBugId() {
|
||||
+ return BUG_ID;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * {@inheritDoc}
|
||||
+ */
|
||||
+ public String getBugName() {
|
||||
+ return getClass().getName();
|
||||
+ }
|
||||
+}
|
||||
diff --git a/test/com/sun/javadoc/testHtmlTag/pkg1/C1.java b/test/com/sun/javadoc/testHtmlTag/pkg1/C1.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ langtools/test/com/sun/javadoc/testHtmlTag/pkg1/C1.java
|
||||
@@ -0,0 +1,33 @@
|
||||
+/*
|
||||
+ * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ * This code is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation. Sun designates this
|
||||
+ * particular file as subject to the "Classpath" exception as provided
|
||||
+ * by Sun in the LICENSE file that accompanied this code.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
+ * CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
+ * have any questions.
|
||||
+ */
|
||||
+
|
||||
+package pkg1;
|
||||
+
|
||||
+public class C1 {
|
||||
+
|
||||
+ public void method(int param1, int param2) {
|
||||
+
|
||||
+ }
|
||||
+}
|
||||
diff --git a/test/com/sun/javadoc/testHtmlTag/pkg2/C2.java b/test/com/sun/javadoc/testHtmlTag/pkg2/C2.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ langtools/test/com/sun/javadoc/testHtmlTag/pkg2/C2.java
|
||||
@@ -0,0 +1,31 @@
|
||||
+/*
|
||||
+ * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ * This code is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation. Sun designates this
|
||||
+ * particular file as subject to the "Classpath" exception as provided
|
||||
+ * by Sun in the LICENSE file that accompanied this code.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
+ * CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
+ * have any questions.
|
||||
+ */
|
||||
+
|
||||
+package pkg2;
|
||||
+
|
||||
+/**
|
||||
+ * <B>Comments:</B> Class 2
|
||||
+ */
|
||||
+public class C2 {}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,601 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User andrew
|
||||
# Date 1371571658 18000
|
||||
# Node ID 9b884c583c41a545352b035d11d1ccacb96fbb2f
|
||||
# Parent 92a90d8c955b6cc619d16975e02d9143715dedaa
|
||||
6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
|
||||
Reviewed-by: jjg
|
||||
|
||||
diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
|
||||
--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
|
||||
+++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
|
||||
@@ -245,6 +245,29 @@
|
||||
}
|
||||
|
||||
/**
|
||||
+ * Check whether there are any tags to be printed.
|
||||
+ *
|
||||
+ * @param doc the Doc object to check for tags.
|
||||
+ * @return true if there are tags to be printed else return false.
|
||||
+ */
|
||||
+ protected boolean hasTagsToPrint(Doc doc) {
|
||||
+ if (doc instanceof MethodDoc) {
|
||||
+ ClassDoc[] intfacs = ((MethodDoc)doc).containingClass().interfaces();
|
||||
+ MethodDoc overriddenMethod = ((MethodDoc)doc).overriddenMethod();
|
||||
+ if ((intfacs.length > 0 &&
|
||||
+ new ImplementedMethods((MethodDoc)doc, this.configuration).build().length > 0) ||
|
||||
+ overriddenMethod != null) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ TagletOutputImpl output = new TagletOutputImpl("");
|
||||
+ TagletWriter.genTagOuput(configuration.tagletManager, doc,
|
||||
+ configuration.tagletManager.getCustomTags(doc),
|
||||
+ getTagletWriterInstance(false), output);
|
||||
+ return (output.toString().trim().isEmpty());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
* Returns a TagletWriter that knows how to write HTML.
|
||||
*
|
||||
* @return a TagletWriter that knows how to write HTML.
|
||||
diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java
|
||||
--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java
|
||||
+++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java
|
||||
@@ -164,4 +164,20 @@
|
||||
public void writeMemberFooter(FieldDoc member) {
|
||||
writer.dlEnd();
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Check to see if member details should be printed. If
|
||||
+ * nocomment option set or if there is no text to be printed
|
||||
+ * for deprecation info, inline comment, no serial tag or inline tags,
|
||||
+ * do not print member details.
|
||||
+ */
|
||||
+ public boolean shouldPrintMemberDetails(FieldDoc field) {
|
||||
+ if (!configuration().nocomment)
|
||||
+ if((field.inlineTags().length > 0) ||
|
||||
+ (field.tags("serial").length > 0) || (writer.hasTagsToPrint(field)))
|
||||
+ return true;
|
||||
+ if (!Util.isDeprecated(field))
|
||||
+ return true;
|
||||
+ return false;
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/TagletOutputImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/TagletOutputImpl.java
|
||||
--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletOutputImpl.java
|
||||
+++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletOutputImpl.java
|
||||
@@ -67,4 +67,10 @@
|
||||
return output.toString();
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * Check whether the taglet output is empty.
|
||||
+ */
|
||||
+ public boolean isEmpty() {
|
||||
+ return (toString().trim().isEmpty());
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/SerializedFormWriter.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/SerializedFormWriter.java
|
||||
--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/SerializedFormWriter.java
|
||||
+++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/SerializedFormWriter.java
|
||||
@@ -152,6 +152,17 @@
|
||||
* @param member the member to write the header for.
|
||||
*/
|
||||
public void writeMemberFooter(FieldDoc member);
|
||||
+
|
||||
+ /**
|
||||
+ * Check to see if member details should be printed. If
|
||||
+ * nocomment option set or if there is no text to be printed
|
||||
+ * for deprecation info, inline comment, no serial tag or inline tags,
|
||||
+ * do not print member details.
|
||||
+ *
|
||||
+ * @param member the member to check details for.
|
||||
+ * @return true if details need to be printed
|
||||
+ */
|
||||
+ public boolean shouldPrintMemberDetails(FieldDoc member);
|
||||
}
|
||||
|
||||
/**
|
||||
diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java
|
||||
--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java
|
||||
+++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java
|
||||
@@ -403,16 +403,17 @@
|
||||
if (classDoc.definesSerializableFields()) {
|
||||
FieldDoc serialPersistentField =
|
||||
(FieldDoc)((Util.asList(classDoc.serializableFields()).get(0)));
|
||||
- String comment = serialPersistentField.commentText();
|
||||
- if (comment.length() > 0) {
|
||||
+ // Check to see if there are inline comments, tags or deprecation
|
||||
+ // information to be printed.
|
||||
+ if (fieldWriter.shouldPrintMemberDetails(serialPersistentField)) {
|
||||
fieldWriter.writeHeader(
|
||||
configuration.getText("doclet.Serialized_Form_class"));
|
||||
+ fieldWriter.writeMemberDeprecatedInfo(serialPersistentField);
|
||||
if (!configuration.nocomment) {
|
||||
- fieldWriter.writeMemberDeprecatedInfo(serialPersistentField);
|
||||
fieldWriter.writeMemberDescription(serialPersistentField);
|
||||
fieldWriter.writeMemberTags(serialPersistentField);
|
||||
- fieldWriter.writeMemberFooter(serialPersistentField);
|
||||
}
|
||||
+ fieldWriter.writeMemberFooter(serialPersistentField);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -429,6 +430,16 @@
|
||||
}
|
||||
|
||||
/**
|
||||
+ * Build the field deprecation information.
|
||||
+ */
|
||||
+ public void buildFieldDeprecationInfo() {
|
||||
+ if (!currentClass.definesSerializableFields()) {
|
||||
+ FieldDoc field = (FieldDoc)currentMember;
|
||||
+ fieldWriter.writeMemberDeprecatedInfo(field);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
* Build the field information.
|
||||
*/
|
||||
public void buildFieldInfo() {
|
||||
@@ -459,7 +470,6 @@
|
||||
"doclet.MissingSerialTag", cd.qualifiedName(),
|
||||
field.name());
|
||||
}
|
||||
- fieldWriter.writeMemberDeprecatedInfo(field);
|
||||
fieldWriter.writeMemberDescription(field);
|
||||
fieldWriter.writeMemberTags(field);
|
||||
}
|
||||
diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml
|
||||
--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml
|
||||
+++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml
|
||||
@@ -183,8 +183,8 @@
|
||||
<MethodHeader/>
|
||||
<SerializableMethods>
|
||||
<MethodSubHeader/>
|
||||
+ <DeprecatedMethodInfo/>
|
||||
<MethodInfo>
|
||||
- <DeprecatedMethodInfo/>
|
||||
<MethodDescription/>
|
||||
<MethodTags/>
|
||||
</MethodInfo>
|
||||
@@ -193,6 +193,7 @@
|
||||
<FieldHeader/>
|
||||
<SerializableFields>
|
||||
<FieldSubHeader/>
|
||||
+ <FieldDeprecationInfo/>
|
||||
<FieldInfo/>
|
||||
<FieldFooter/>
|
||||
</SerializableFields>
|
||||
diff --git a/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java b/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java
|
||||
@@ -0,0 +1,151 @@
|
||||
+/*
|
||||
+ * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ * This code is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation. Sun designates this
|
||||
+ * particular file as subject to the "Classpath" exception as provided
|
||||
+ * by Sun in the LICENSE file that accompanied this code.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
+ * CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
+ * have any questions.
|
||||
+ */
|
||||
+
|
||||
+/*
|
||||
+ * @test
|
||||
+ * @bug 6802694
|
||||
+ * @summary This test verifies deprecation info in serialized-form.html.
|
||||
+ * @author Bhavesh Patel
|
||||
+ * @library ../lib/
|
||||
+ * @build JavadocTester
|
||||
+ * @build TestSerializedFormDeprecationInfo
|
||||
+ * @run main TestSerializedFormDeprecationInfo
|
||||
+ */
|
||||
+
|
||||
+public class TestSerializedFormDeprecationInfo extends JavadocTester {
|
||||
+
|
||||
+ private static final String BUG_ID = "6802694";
|
||||
+
|
||||
+ // Test for normal run of javadoc. The serialized-form.html should
|
||||
+ // display the inline comments, tags and deprecation information if any.
|
||||
+ private static final String[][] TEST_CMNT_DEPR = {
|
||||
+ {BUG_ID + FS + "serialized-form.html", "<DL>" + NL + "<DD><DL>" + NL + NL +
|
||||
+ "<DT><STRONG>Throws:</STRONG>" + NL + "<DD><CODE>" +
|
||||
+ "java.io.IOException</CODE><DT><STRONG>See Also:</STRONG>" +
|
||||
+ "<DD><A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
|
||||
+ "<CODE>C1.setUndecorated(boolean)</CODE></A></DD>" + NL +
|
||||
+ "</DL>" + NL + "</DL>"},
|
||||
+ {BUG_ID + FS + "serialized-form.html", "<DL>" + NL +
|
||||
+ "<DD><STRONG>Deprecated.</STRONG> <I>As of JDK version" +
|
||||
+ " 1.5, replaced by" + NL +
|
||||
+ " <A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
|
||||
+ "<CODE>setUndecorated(boolean)</CODE></A>.</I>" +
|
||||
+ "<DD>This field indicates whether the C1 is undecorated." + NL +
|
||||
+ "<P>" + NL + "<DT><DD> <DL>" + NL +
|
||||
+ "<DT><STRONG>Since:</STRONG></DT>" + NL +
|
||||
+ " <DD>1.4</DD>" + NL + "<DT><STRONG>See Also:</STRONG>" +
|
||||
+ "<DD><A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
|
||||
+ "<CODE>C1.setUndecorated(boolean)</CODE></A></DL>" + NL +
|
||||
+ "</DL>"},
|
||||
+ {BUG_ID + FS + "serialized-form.html", "<DL>" + NL +
|
||||
+ "<DD><STRONG>Deprecated.</STRONG> <I>As of JDK version" +
|
||||
+ " 1.5, replaced by" + NL +
|
||||
+ " <A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
|
||||
+ "<CODE>setUndecorated(boolean)</CODE></A>.</I>" + NL + "<P>" + NL +
|
||||
+ "<DD>Reads the object stream." + NL + "<P>" + NL +
|
||||
+ "<DD><DL>" + NL + NL + "<DT><STRONG>Throws:" +
|
||||
+ "</STRONG>" + NL + "<DD><CODE><code>" +
|
||||
+ "IOException</code></CODE>" + NL +
|
||||
+ "<DD><CODE>java.io.IOException</CODE></DD>" + NL +
|
||||
+ "</DL>" + NL + "</DL>"},
|
||||
+ {BUG_ID + FS + "serialized-form.html", "<DL>" + NL +
|
||||
+ "<DD><STRONG>Deprecated.</STRONG> <DD>" +
|
||||
+ "The name for this class." + NL + "<P>" + NL +
|
||||
+ "<DT><DD> <DL>" + NL + "</DL>" + NL + "</DL>"}};
|
||||
+
|
||||
+ // Test with -nocomment option. The serialized-form.html should
|
||||
+ // not display the inline comments and tags but should display deprecation
|
||||
+ // information if any.
|
||||
+ private static final String[][] TEST_NOCMNT = {
|
||||
+ {BUG_ID + FS + "serialized-form.html", "<PRE>" + NL + "boolean <STRONG>" +
|
||||
+ "undecorated</STRONG></PRE>" + NL + "<DL>" + NL + "<DD><STRONG>" +
|
||||
+ "Deprecated.</STRONG> <I>As of JDK version 1.5, replaced by" + NL +
|
||||
+ " <A HREF=\"pkg1/C1.html#setUndecorated(boolean)\"><CODE>" +
|
||||
+ "setUndecorated(boolean)</CODE></A>.</I></DL>"},
|
||||
+ {BUG_ID + FS + "serialized-form.html", "<DL>" + NL + "<DD><STRONG>" +
|
||||
+ "Deprecated.</STRONG> <I>As of JDK version" +
|
||||
+ " 1.5, replaced by" + NL +
|
||||
+ " <A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
|
||||
+ "<CODE>setUndecorated(boolean)</CODE></A>.</I>" + NL + "<P>" + NL +
|
||||
+ "</DL>"},
|
||||
+ {BUG_ID + FS + "serialized-form.html", "<PRE>" + NL + "int <STRONG>" +
|
||||
+ "publicKey</STRONG></PRE>" + NL + "<DL>" + NL + "<DD><STRONG>" +
|
||||
+ "Deprecated.</STRONG> </DL>"}};
|
||||
+
|
||||
+ // Test with -nodeprecated option. The serialized-form.html should
|
||||
+ // ignore the -nodeprecated tag and display the deprecation info. This
|
||||
+ // test is similar to the normal run of javadoc in which inline comment, tags
|
||||
+ // and deprecation information will be displayed.
|
||||
+ private static final String[][] TEST_NODEPR = TEST_CMNT_DEPR;
|
||||
+
|
||||
+ // Test with -nodeprecated and -nocomment options. The serialized-form.html should
|
||||
+ // ignore the -nodeprecated tag and display the deprecation info but should not
|
||||
+ // display the inline comments and tags. This test is similar to the test with
|
||||
+ // -nocomment option.
|
||||
+ private static final String[][] TEST_NOCMNT_NODEPR = TEST_NOCMNT;
|
||||
+
|
||||
+ private static final String[] ARGS1 =
|
||||
+ new String[] {
|
||||
+ "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1"};
|
||||
+
|
||||
+ private static final String[] ARGS2 =
|
||||
+ new String[] {
|
||||
+ "-d", BUG_ID, "-nocomment", "-sourcepath", SRC_DIR, "pkg1"};
|
||||
+
|
||||
+ private static final String[] ARGS3 =
|
||||
+ new String[] {
|
||||
+ "-d", BUG_ID, "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
|
||||
+
|
||||
+ private static final String[] ARGS4 =
|
||||
+ new String[] {
|
||||
+ "-d", BUG_ID, "-nocomment", "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
|
||||
+
|
||||
+ /**
|
||||
+ * The entry point of the test.
|
||||
+ * @param args the array of command line arguments.
|
||||
+ */
|
||||
+ public static void main(String[] args) {
|
||||
+ TestSerializedFormDeprecationInfo tester = new TestSerializedFormDeprecationInfo();
|
||||
+ run(tester, ARGS1, TEST_CMNT_DEPR, TEST_NOCMNT);
|
||||
+ run(tester, ARGS2, TEST_NOCMNT, TEST_CMNT_DEPR);
|
||||
+ run(tester, ARGS3, TEST_NODEPR, TEST_NOCMNT_NODEPR);
|
||||
+ run(tester, ARGS4, TEST_NOCMNT_NODEPR, TEST_NODEPR);
|
||||
+ tester.printSummary();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * {@inheritDoc}
|
||||
+ */
|
||||
+ public String getBugId() {
|
||||
+ return BUG_ID;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * {@inheritDoc}
|
||||
+ */
|
||||
+ public String getBugName() {
|
||||
+ return getClass().getName();
|
||||
+ }
|
||||
+}
|
||||
diff --git a/test/com/sun/javadoc/testSerializedFormDeprecationInfo/pkg1/C1.java b/test/com/sun/javadoc/testSerializedFormDeprecationInfo/pkg1/C1.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/pkg1/C1.java
|
||||
@@ -0,0 +1,108 @@
|
||||
+/*
|
||||
+ * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ * This code is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation. Sun designates this
|
||||
+ * particular file as subject to the "Classpath" exception as provided
|
||||
+ * by Sun in the LICENSE file that accompanied this code.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
+ * CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
+ * have any questions.
|
||||
+ */
|
||||
+
|
||||
+package pkg1;
|
||||
+
|
||||
+import java.io.IOException;
|
||||
+import java.io.Serializable;
|
||||
+
|
||||
+/**
|
||||
+ * A class comment for testing.
|
||||
+ *
|
||||
+ * @author Bhavesh Patel
|
||||
+ * @see C2
|
||||
+ * @since JDK1.0
|
||||
+ */
|
||||
+
|
||||
+public class C1 implements Serializable {
|
||||
+
|
||||
+ /**
|
||||
+ * This field indicates whether the C1 is undecorated.
|
||||
+ *
|
||||
+ * @see #setUndecorated(boolean)
|
||||
+ * @since 1.4
|
||||
+ * @serial
|
||||
+ * @deprecated As of JDK version 1.5, replaced by
|
||||
+ * {@link C1#setUndecorated(boolean) setUndecorated(boolean)}.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public boolean undecorated = false;
|
||||
+
|
||||
+ private String title;
|
||||
+
|
||||
+ /**
|
||||
+ * This enum specifies the possible modal exclusion types.
|
||||
+ *
|
||||
+ * @since 1.6
|
||||
+ */
|
||||
+ public static enum ModalExclusionType {
|
||||
+ /**
|
||||
+ * No modal exclusion.
|
||||
+ */
|
||||
+ NO_EXCLUDE,
|
||||
+ /**
|
||||
+ * <code>APPLICATION_EXCLUDE</code> indicates that a top-level window
|
||||
+ * won't be blocked by any application-modal dialogs. Also, it isn't
|
||||
+ * blocked by document-modal dialogs from outside of its child hierarchy.
|
||||
+ */
|
||||
+ APPLICATION_EXCLUDE
|
||||
+ };
|
||||
+
|
||||
+ /**
|
||||
+ * Constructor.
|
||||
+ *
|
||||
+ * @param title the title
|
||||
+ * @param test boolean value
|
||||
+ * @exception IllegalArgumentException if the <code>owner</code>'s
|
||||
+ * <code>GraphicsConfiguration</code> is not from a screen device
|
||||
+ * @exception HeadlessException
|
||||
+ */
|
||||
+ public C1(String title, boolean test) {
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ public C1(String title) {
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Method comments.
|
||||
+ * @param undecorated <code>true</code> if no decorations are
|
||||
+ * to be enabled;
|
||||
+ * <code>false</code> if decorations are to be enabled.
|
||||
+ * @see #readObject()
|
||||
+ * @since 1.4
|
||||
+ */
|
||||
+ public void setUndecorated(boolean undecorated) {
|
||||
+ /* Make sure we don't run in the middle of peer creation.*/
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @see #setUndecorated(boolean)
|
||||
+ */
|
||||
+ public void readObject() throws IOException {
|
||||
+
|
||||
+ }
|
||||
+}
|
||||
diff --git a/test/com/sun/javadoc/testSerializedFormDeprecationInfo/pkg1/C2.java b/test/com/sun/javadoc/testSerializedFormDeprecationInfo/pkg1/C2.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/pkg1/C2.java
|
||||
@@ -0,0 +1,86 @@
|
||||
+/*
|
||||
+ * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ * This code is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation. Sun designates this
|
||||
+ * particular file as subject to the "Classpath" exception as provided
|
||||
+ * by Sun in the LICENSE file that accompanied this code.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
+ * CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
+ * have any questions.
|
||||
+ */
|
||||
+
|
||||
+package pkg1;
|
||||
+
|
||||
+import java.io.ObjectInputStream;
|
||||
+import java.io.IOException;
|
||||
+import java.io.Serializable;
|
||||
+
|
||||
+/**
|
||||
+ * A class comment for testing.
|
||||
+ *
|
||||
+ * @author Bhavesh Patel
|
||||
+ * @see C1
|
||||
+ * @since JDK1.0
|
||||
+ */
|
||||
+
|
||||
+public class C2 implements Serializable {
|
||||
+
|
||||
+ /**
|
||||
+ * This field indicates title.
|
||||
+ */
|
||||
+ String title;
|
||||
+
|
||||
+ public static enum ModalType {
|
||||
+ NO_EXCLUDE
|
||||
+ };
|
||||
+
|
||||
+ /**
|
||||
+ * Constructor.
|
||||
+ *
|
||||
+ */
|
||||
+ public C2() {
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ public C2(String title) {
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Set visible.
|
||||
+ *
|
||||
+ * @param set boolean
|
||||
+ * @since 1.4
|
||||
+ * @deprecated As of JDK version 1.5, replaced by
|
||||
+ * {@link C1#setUndecorated(boolean) setUndecorated(boolean)}.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void setVisible(boolean set) {
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Reads the object stream.
|
||||
+ *
|
||||
+ * @param s ObjectInputStream
|
||||
+ * @throws <code>IOException</code>
|
||||
+ * @deprecated As of JDK version 1.5, replaced by
|
||||
+ * {@link C1#setUndecorated(boolean) setUndecorated(boolean)}.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void readObject(ObjectInputStream s) throws IOException {
|
||||
+ }
|
||||
+}
|
||||
diff --git a/test/com/sun/javadoc/testSerializedFormDeprecationInfo/pkg1/C3.java b/test/com/sun/javadoc/testSerializedFormDeprecationInfo/pkg1/C3.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/pkg1/C3.java
|
||||
@@ -0,0 +1,65 @@
|
||||
+/*
|
||||
+ * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ * This code is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation. Sun designates this
|
||||
+ * particular file as subject to the "Classpath" exception as provided
|
||||
+ * by Sun in the LICENSE file that accompanied this code.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
+ * CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
+ * have any questions.
|
||||
+ */
|
||||
+
|
||||
+package pkg1;
|
||||
+
|
||||
+import java.io.Serializable;
|
||||
+
|
||||
+/**
|
||||
+ * Test for Serializable
|
||||
+ *
|
||||
+ * @author Bhavesh Patel
|
||||
+ * @deprecated This class is no longer used.
|
||||
+ */
|
||||
+@Deprecated
|
||||
+public abstract class C3 implements Serializable {
|
||||
+
|
||||
+ /**
|
||||
+ * The name for this class.
|
||||
+ *
|
||||
+ * @serial
|
||||
+ */
|
||||
+ private String name;
|
||||
+
|
||||
+ /**
|
||||
+ * @serial
|
||||
+ */
|
||||
+ private int publicKey;
|
||||
+
|
||||
+ /**
|
||||
+ * Constructor for serialization only.
|
||||
+ */
|
||||
+ protected C3() {
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Prints general information.
|
||||
+ *
|
||||
+ */
|
||||
+ public void printInfo() {
|
||||
+
|
||||
+ }
|
||||
+}
|
@ -1,605 +0,0 @@
|
||||
This handles the rename bits of the original 6851834
|
||||
diff -ruN openjdk.orig/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java openjdk/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java
|
||||
--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java 2013-06-25 14:55:45.802321034 -0400
|
||||
@@ -0,0 +1,298 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ * This code is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation. Oracle designates this
|
||||
+ * particular file as subject to the "Classpath" exception as provided
|
||||
+ * by Oracle in the LICENSE file that accompanied this code.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
+ * or visit www.oracle.com if you need additional information or have any
|
||||
+ * questions.
|
||||
+ */
|
||||
+
|
||||
+package com.sun.tools.doclets.formats.html;
|
||||
+
|
||||
+import java.io.*;
|
||||
+import javax.tools.FileObject;
|
||||
+import com.sun.javadoc.*;
|
||||
+import com.sun.tools.doclets.internal.toolkit.*;
|
||||
+import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
+import com.sun.tools.doclets.formats.html.markup.*;
|
||||
+
|
||||
+/**
|
||||
+ * Converts Java Source Code to HTML.
|
||||
+ *
|
||||
+ * This code is not part of an API.
|
||||
+ * It is implementation that is subject to change.
|
||||
+ * Do not use it as an API
|
||||
+ *
|
||||
+ * @author Jamie Ho
|
||||
+ * @author Bhavesh Patel (Modified)
|
||||
+ * @since 1.4
|
||||
+ */
|
||||
+public class SourceToHTMLConverter {
|
||||
+
|
||||
+ /**
|
||||
+ * The number of trailing blank lines at the end of the page.
|
||||
+ * This is inserted so that anchors at the bottom of small pages
|
||||
+ * can be reached.
|
||||
+ */
|
||||
+ private static final int NUM_BLANK_LINES = 60;
|
||||
+
|
||||
+ /**
|
||||
+ * New line to be added to the documentation.
|
||||
+ */
|
||||
+ private static final Content NEW_LINE = new RawHtml(DocletConstants.NL);
|
||||
+
|
||||
+ /**
|
||||
+ * Relative path from the documentation root to the file that is being
|
||||
+ * generated.
|
||||
+ */
|
||||
+ private static String relativePath = "";
|
||||
+
|
||||
+ /**
|
||||
+ * Source is converted to HTML using static methods below.
|
||||
+ */
|
||||
+ private SourceToHTMLConverter() {}
|
||||
+
|
||||
+ /**
|
||||
+ * Convert the Classes in the given RootDoc to an HTML.
|
||||
+ *
|
||||
+ * @param configuration the configuration.
|
||||
+ * @param rd the RootDoc to convert.
|
||||
+ * @param outputdir the name of the directory to output to.
|
||||
+ */
|
||||
+ public static void convertRoot(ConfigurationImpl configuration, RootDoc rd,
|
||||
+ String outputdir) {
|
||||
+ if (rd == null || outputdir == null) {
|
||||
+ return;
|
||||
+ }
|
||||
+ PackageDoc[] pds = rd.specifiedPackages();
|
||||
+ for (int i = 0; i < pds.length; i++) {
|
||||
+ convertPackage(configuration, pds[i], outputdir);
|
||||
+ }
|
||||
+ ClassDoc[] cds = rd.specifiedClasses();
|
||||
+ for (int i = 0; i < cds.length; i++) {
|
||||
+ convertClass(configuration, cds[i],
|
||||
+ getPackageOutputDir(outputdir, cds[i].containingPackage()));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Convert the Classes in the given Package to an HTML.
|
||||
+ *
|
||||
+ * @param configuration the configuration.
|
||||
+ * @param pd the Package to convert.
|
||||
+ * @param outputdir the name of the directory to output to.
|
||||
+ */
|
||||
+ public static void convertPackage(ConfigurationImpl configuration, PackageDoc pd,
|
||||
+ String outputdir) {
|
||||
+ if (pd == null || outputdir == null) {
|
||||
+ return;
|
||||
+ }
|
||||
+ String classOutputdir = getPackageOutputDir(outputdir, pd);
|
||||
+ ClassDoc[] cds = pd.allClasses();
|
||||
+ for (int i = 0; i < cds.length; i++) {
|
||||
+ convertClass(configuration, cds[i], classOutputdir);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Return the directory write output to for the given package.
|
||||
+ *
|
||||
+ * @param outputDir the directory to output to.
|
||||
+ * @param pd the Package to generate output for.
|
||||
+ * @return the package output directory as a String.
|
||||
+ */
|
||||
+ private static String getPackageOutputDir(String outputDir, PackageDoc pd) {
|
||||
+ return outputDir + File.separator +
|
||||
+ DirectoryManager.getDirectoryPath(pd) + File.separator;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Convert the given Class to an HTML.
|
||||
+ *
|
||||
+ * @param configuration the configuration.
|
||||
+ * @param cd the class to convert.
|
||||
+ * @param outputdir the name of the directory to output to.
|
||||
+ */
|
||||
+ public static void convertClass(ConfigurationImpl configuration, ClassDoc cd,
|
||||
+ String outputdir) {
|
||||
+ if (cd == null || outputdir == null) {
|
||||
+ return;
|
||||
+ }
|
||||
+ try {
|
||||
+ SourcePosition sp = cd.position();
|
||||
+ if (sp == null)
|
||||
+ return;
|
||||
+ Reader r;
|
||||
+ // temp hack until we can update SourcePosition API.
|
||||
+ if (sp instanceof com.sun.tools.javadoc.SourcePositionImpl) {
|
||||
+ FileObject fo = ((com.sun.tools.javadoc.SourcePositionImpl) sp).fileObject();
|
||||
+ if (fo == null)
|
||||
+ return;
|
||||
+ r = fo.openReader(true);
|
||||
+ } else {
|
||||
+ File file = sp.file();
|
||||
+ if (file == null)
|
||||
+ return;
|
||||
+ r = new FileReader(file);
|
||||
+ }
|
||||
+ LineNumberReader reader = new LineNumberReader(r);
|
||||
+ int lineno = 1;
|
||||
+ String line;
|
||||
+ relativePath = DirectoryManager.getRelativePath(DocletConstants.SOURCE_OUTPUT_DIR_NAME) +
|
||||
+ DirectoryManager.getRelativePath(cd.containingPackage());
|
||||
+ Content body = getHeader();
|
||||
+ Content pre = new HtmlTree(HtmlTag.PRE);
|
||||
+ try {
|
||||
+ while ((line = reader.readLine()) != null) {
|
||||
+ addLineNo(pre, lineno);
|
||||
+ addLine(pre, line, configuration.sourcetab, lineno);
|
||||
+ lineno++;
|
||||
+ }
|
||||
+ } finally {
|
||||
+ reader.close();
|
||||
+ }
|
||||
+ addBlankLines(pre);
|
||||
+ Content div = HtmlTree.DIV(HtmlStyle.sourceContainer, pre);
|
||||
+ body.addContent(div);
|
||||
+ writeToFile(body, outputdir, cd.name(), configuration);
|
||||
+ } catch (Exception e){
|
||||
+ e.printStackTrace();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Write the output to the file.
|
||||
+ *
|
||||
+ * @param body the documentation content to be written to the file.
|
||||
+ * @param outputDir the directory to output to.
|
||||
+ * @param className the name of the class that I am converting to HTML.
|
||||
+ * @param configuration the Doclet configuration to pass notices to.
|
||||
+ */
|
||||
+ private static void writeToFile(Content body, String outputDir,
|
||||
+ String className, ConfigurationImpl configuration) throws IOException {
|
||||
+ Content htmlDocType = DocType.Transitional();
|
||||
+ Content head = new HtmlTree(HtmlTag.HEAD);
|
||||
+ head.addContent(HtmlTree.TITLE(new StringContent(
|
||||
+ configuration.getText("doclet.Window_Source_title"))));
|
||||
+ head.addContent(getStyleSheetProperties(configuration));
|
||||
+ Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(),
|
||||
+ head, body);
|
||||
+ Content htmlDocument = new HtmlDocument(htmlDocType, htmlTree);
|
||||
+ File dir = new File(outputDir);
|
||||
+ dir.mkdirs();
|
||||
+ File newFile = new File(dir, className + ".html");
|
||||
+ configuration.message.notice("doclet.Generating_0", newFile.getPath());
|
||||
+ FileOutputStream fout = new FileOutputStream(newFile);
|
||||
+ BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fout));
|
||||
+ bw.write(htmlDocument.toString());
|
||||
+ bw.close();
|
||||
+ fout.close();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a link to the stylesheet file.
|
||||
+ *
|
||||
+ * @param configuration the doclet configuration for the current run of javadoc
|
||||
+ * @return an HtmlTree for the lINK tag which provides the stylesheet location
|
||||
+ */
|
||||
+ public static HtmlTree getStyleSheetProperties(ConfigurationImpl configuration) {
|
||||
+ String filename = configuration.stylesheetfile;
|
||||
+ if (filename.length() > 0) {
|
||||
+ File stylefile = new File(filename);
|
||||
+ String parent = stylefile.getParent();
|
||||
+ filename = (parent == null)?
|
||||
+ filename:
|
||||
+ filename.substring(parent.length() + 1);
|
||||
+ } else {
|
||||
+ filename = "stylesheet.css";
|
||||
+ }
|
||||
+ filename = relativePath + filename;
|
||||
+ HtmlTree link = HtmlTree.LINK("stylesheet", "text/css", filename, "Style");
|
||||
+ return link;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the header.
|
||||
+ *
|
||||
+ * @return the header content for the HTML file
|
||||
+ */
|
||||
+ private static Content getHeader() {
|
||||
+ return new HtmlTree(HtmlTag.BODY);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Add the line numbers for the source code.
|
||||
+ *
|
||||
+ * @param pre the content tree to which the line number will be added
|
||||
+ * @param lineno The line number
|
||||
+ */
|
||||
+ private static void addLineNo(Content pre, int lineno) {
|
||||
+ HtmlTree span = new HtmlTree(HtmlTag.SPAN);
|
||||
+ span.addStyle(HtmlStyle.sourceLineNo);
|
||||
+ if (lineno < 10) {
|
||||
+ span.addContent("00" + Integer.toString(lineno));
|
||||
+ } else if (lineno < 100) {
|
||||
+ span.addContent("0" + Integer.toString(lineno));
|
||||
+ } else {
|
||||
+ span.addContent(Integer.toString(lineno));
|
||||
+ }
|
||||
+ pre.addContent(span);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Add a line from source to the HTML file that is generated.
|
||||
+ *
|
||||
+ * @param pre the content tree to which the line will be added.
|
||||
+ * @param line the string to format.
|
||||
+ * @param tabLength the number of spaces for each tab.
|
||||
+ * @param currentLineNo the current number.
|
||||
+ */
|
||||
+ private static void addLine(Content pre, String line, int tabLength,
|
||||
+ int currentLineNo) {
|
||||
+ if (line != null) {
|
||||
+ StringBuffer lineBuffer = new StringBuffer(Util.escapeHtmlChars(line));
|
||||
+ Util.replaceTabs(tabLength, lineBuffer);
|
||||
+ pre.addContent(new RawHtml(lineBuffer.toString()));
|
||||
+ Content anchor = HtmlTree.A_NAME("line." + Integer.toString(currentLineNo));
|
||||
+ pre.addContent(anchor);
|
||||
+ pre.addContent(NEW_LINE);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Add trailing blank lines at the end of the page.
|
||||
+ *
|
||||
+ * @param pre the content tree to which the blank lines will be added.
|
||||
+ */
|
||||
+ private static void addBlankLines(Content pre) {
|
||||
+ for (int i = 0; i < NUM_BLANK_LINES; i++) {
|
||||
+ pre.addContent(NEW_LINE);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Given a <code>Doc</code>, return an anchor name for it.
|
||||
+ *
|
||||
+ * @param d the <code>Doc</code> to check.
|
||||
+ * @return the name of the anchor.
|
||||
+ */
|
||||
+ public static String getAnchorName(Doc d) {
|
||||
+ return "line." + d.position().line();
|
||||
+ }
|
||||
+}
|
||||
diff -ruN openjdk.orig/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/SourceToHTMLConverter.java openjdk/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/SourceToHTMLConverter.java
|
||||
--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/SourceToHTMLConverter.java 2013-06-25 14:55:45.802321034 -0400
|
||||
+++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/SourceToHTMLConverter.java 1969-12-31 19:00:00.000000000 -0500
|
||||
@@ -1,298 +0,0 @@
|
||||
-/*
|
||||
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
- *
|
||||
- * This code is free software; you can redistribute it and/or modify it
|
||||
- * under the terms of the GNU General Public License version 2 only, as
|
||||
- * published by the Free Software Foundation. Oracle designates this
|
||||
- * particular file as subject to the "Classpath" exception as provided
|
||||
- * by Oracle in the LICENSE file that accompanied this code.
|
||||
- *
|
||||
- * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
- * version 2 for more details (a copy is included in the LICENSE file that
|
||||
- * accompanied this code).
|
||||
- *
|
||||
- * You should have received a copy of the GNU General Public License version
|
||||
- * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
- *
|
||||
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
- * or visit www.oracle.com if you need additional information or have any
|
||||
- * questions.
|
||||
- */
|
||||
-
|
||||
-package com.sun.tools.doclets.formats.html;
|
||||
-
|
||||
-import java.io.*;
|
||||
-import javax.tools.FileObject;
|
||||
-import com.sun.javadoc.*;
|
||||
-import com.sun.tools.doclets.internal.toolkit.*;
|
||||
-import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
-import com.sun.tools.doclets.formats.html.markup.*;
|
||||
-
|
||||
-/**
|
||||
- * Converts Java Source Code to HTML.
|
||||
- *
|
||||
- * This code is not part of an API.
|
||||
- * It is implementation that is subject to change.
|
||||
- * Do not use it as an API
|
||||
- *
|
||||
- * @author Jamie Ho
|
||||
- * @author Bhavesh Patel (Modified)
|
||||
- * @since 1.4
|
||||
- */
|
||||
-public class SourceToHTMLConverter {
|
||||
-
|
||||
- /**
|
||||
- * The number of trailing blank lines at the end of the page.
|
||||
- * This is inserted so that anchors at the bottom of small pages
|
||||
- * can be reached.
|
||||
- */
|
||||
- private static final int NUM_BLANK_LINES = 60;
|
||||
-
|
||||
- /**
|
||||
- * New line to be added to the documentation.
|
||||
- */
|
||||
- private static final Content NEW_LINE = new RawHtml(DocletConstants.NL);
|
||||
-
|
||||
- /**
|
||||
- * Relative path from the documentation root to the file that is being
|
||||
- * generated.
|
||||
- */
|
||||
- private static String relativePath = "";
|
||||
-
|
||||
- /**
|
||||
- * Source is converted to HTML using static methods below.
|
||||
- */
|
||||
- private SourceToHTMLConverter() {}
|
||||
-
|
||||
- /**
|
||||
- * Convert the Classes in the given RootDoc to an HTML.
|
||||
- *
|
||||
- * @param configuration the configuration.
|
||||
- * @param rd the RootDoc to convert.
|
||||
- * @param outputdir the name of the directory to output to.
|
||||
- */
|
||||
- public static void convertRoot(ConfigurationImpl configuration, RootDoc rd,
|
||||
- String outputdir) {
|
||||
- if (rd == null || outputdir == null) {
|
||||
- return;
|
||||
- }
|
||||
- PackageDoc[] pds = rd.specifiedPackages();
|
||||
- for (int i = 0; i < pds.length; i++) {
|
||||
- convertPackage(configuration, pds[i], outputdir);
|
||||
- }
|
||||
- ClassDoc[] cds = rd.specifiedClasses();
|
||||
- for (int i = 0; i < cds.length; i++) {
|
||||
- convertClass(configuration, cds[i],
|
||||
- getPackageOutputDir(outputdir, cds[i].containingPackage()));
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Convert the Classes in the given Package to an HTML.
|
||||
- *
|
||||
- * @param configuration the configuration.
|
||||
- * @param pd the Package to convert.
|
||||
- * @param outputdir the name of the directory to output to.
|
||||
- */
|
||||
- public static void convertPackage(ConfigurationImpl configuration, PackageDoc pd,
|
||||
- String outputdir) {
|
||||
- if (pd == null || outputdir == null) {
|
||||
- return;
|
||||
- }
|
||||
- String classOutputdir = getPackageOutputDir(outputdir, pd);
|
||||
- ClassDoc[] cds = pd.allClasses();
|
||||
- for (int i = 0; i < cds.length; i++) {
|
||||
- convertClass(configuration, cds[i], classOutputdir);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Return the directory write output to for the given package.
|
||||
- *
|
||||
- * @param outputDir the directory to output to.
|
||||
- * @param pd the Package to generate output for.
|
||||
- * @return the package output directory as a String.
|
||||
- */
|
||||
- private static String getPackageOutputDir(String outputDir, PackageDoc pd) {
|
||||
- return outputDir + File.separator +
|
||||
- DirectoryManager.getDirectoryPath(pd) + File.separator;
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Convert the given Class to an HTML.
|
||||
- *
|
||||
- * @param configuration the configuration.
|
||||
- * @param cd the class to convert.
|
||||
- * @param outputdir the name of the directory to output to.
|
||||
- */
|
||||
- public static void convertClass(ConfigurationImpl configuration, ClassDoc cd,
|
||||
- String outputdir) {
|
||||
- if (cd == null || outputdir == null) {
|
||||
- return;
|
||||
- }
|
||||
- try {
|
||||
- SourcePosition sp = cd.position();
|
||||
- if (sp == null)
|
||||
- return;
|
||||
- Reader r;
|
||||
- // temp hack until we can update SourcePosition API.
|
||||
- if (sp instanceof com.sun.tools.javadoc.SourcePositionImpl) {
|
||||
- FileObject fo = ((com.sun.tools.javadoc.SourcePositionImpl) sp).fileObject();
|
||||
- if (fo == null)
|
||||
- return;
|
||||
- r = fo.openReader(true);
|
||||
- } else {
|
||||
- File file = sp.file();
|
||||
- if (file == null)
|
||||
- return;
|
||||
- r = new FileReader(file);
|
||||
- }
|
||||
- LineNumberReader reader = new LineNumberReader(r);
|
||||
- int lineno = 1;
|
||||
- String line;
|
||||
- relativePath = DirectoryManager.getRelativePath(DocletConstants.SOURCE_OUTPUT_DIR_NAME) +
|
||||
- DirectoryManager.getRelativePath(cd.containingPackage());
|
||||
- Content body = getHeader();
|
||||
- Content pre = new HtmlTree(HtmlTag.PRE);
|
||||
- try {
|
||||
- while ((line = reader.readLine()) != null) {
|
||||
- addLineNo(pre, lineno);
|
||||
- addLine(pre, line, configuration.sourcetab, lineno);
|
||||
- lineno++;
|
||||
- }
|
||||
- } finally {
|
||||
- reader.close();
|
||||
- }
|
||||
- addBlankLines(pre);
|
||||
- Content div = HtmlTree.DIV(HtmlStyle.sourceContainer, pre);
|
||||
- body.addContent(div);
|
||||
- writeToFile(body, outputdir, cd.name(), configuration);
|
||||
- } catch (Exception e){
|
||||
- e.printStackTrace();
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Write the output to the file.
|
||||
- *
|
||||
- * @param body the documentation content to be written to the file.
|
||||
- * @param outputDir the directory to output to.
|
||||
- * @param className the name of the class that I am converting to HTML.
|
||||
- * @param configuration the Doclet configuration to pass notices to.
|
||||
- */
|
||||
- private static void writeToFile(Content body, String outputDir,
|
||||
- String className, ConfigurationImpl configuration) throws IOException {
|
||||
- Content htmlDocType = DocType.Transitional();
|
||||
- Content head = new HtmlTree(HtmlTag.HEAD);
|
||||
- head.addContent(HtmlTree.TITLE(new StringContent(
|
||||
- configuration.getText("doclet.Window_Source_title"))));
|
||||
- head.addContent(getStyleSheetProperties(configuration));
|
||||
- Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(),
|
||||
- head, body);
|
||||
- Content htmlDocument = new HtmlDocument(htmlDocType, htmlTree);
|
||||
- File dir = new File(outputDir);
|
||||
- dir.mkdirs();
|
||||
- File newFile = new File(dir, className + ".html");
|
||||
- configuration.message.notice("doclet.Generating_0", newFile.getPath());
|
||||
- FileOutputStream fout = new FileOutputStream(newFile);
|
||||
- BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fout));
|
||||
- bw.write(htmlDocument.toString());
|
||||
- bw.close();
|
||||
- fout.close();
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Returns a link to the stylesheet file.
|
||||
- *
|
||||
- * @param configuration the doclet configuration for the current run of javadoc
|
||||
- * @return an HtmlTree for the lINK tag which provides the stylesheet location
|
||||
- */
|
||||
- public static HtmlTree getStyleSheetProperties(ConfigurationImpl configuration) {
|
||||
- String filename = configuration.stylesheetfile;
|
||||
- if (filename.length() > 0) {
|
||||
- File stylefile = new File(filename);
|
||||
- String parent = stylefile.getParent();
|
||||
- filename = (parent == null)?
|
||||
- filename:
|
||||
- filename.substring(parent.length() + 1);
|
||||
- } else {
|
||||
- filename = "stylesheet.css";
|
||||
- }
|
||||
- filename = relativePath + filename;
|
||||
- HtmlTree link = HtmlTree.LINK("stylesheet", "text/css", filename, "Style");
|
||||
- return link;
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Get the header.
|
||||
- *
|
||||
- * @return the header content for the HTML file
|
||||
- */
|
||||
- private static Content getHeader() {
|
||||
- return new HtmlTree(HtmlTag.BODY);
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Add the line numbers for the source code.
|
||||
- *
|
||||
- * @param pre the content tree to which the line number will be added
|
||||
- * @param lineno The line number
|
||||
- */
|
||||
- private static void addLineNo(Content pre, int lineno) {
|
||||
- HtmlTree span = new HtmlTree(HtmlTag.SPAN);
|
||||
- span.addStyle(HtmlStyle.sourceLineNo);
|
||||
- if (lineno < 10) {
|
||||
- span.addContent("00" + Integer.toString(lineno));
|
||||
- } else if (lineno < 100) {
|
||||
- span.addContent("0" + Integer.toString(lineno));
|
||||
- } else {
|
||||
- span.addContent(Integer.toString(lineno));
|
||||
- }
|
||||
- pre.addContent(span);
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Add a line from source to the HTML file that is generated.
|
||||
- *
|
||||
- * @param pre the content tree to which the line will be added.
|
||||
- * @param line the string to format.
|
||||
- * @param tabLength the number of spaces for each tab.
|
||||
- * @param currentLineNo the current number.
|
||||
- */
|
||||
- private static void addLine(Content pre, String line, int tabLength,
|
||||
- int currentLineNo) {
|
||||
- if (line != null) {
|
||||
- StringBuffer lineBuffer = new StringBuffer(Util.escapeHtmlChars(line));
|
||||
- Util.replaceTabs(tabLength, lineBuffer);
|
||||
- pre.addContent(new RawHtml(lineBuffer.toString()));
|
||||
- Content anchor = HtmlTree.A_NAME("line." + Integer.toString(currentLineNo));
|
||||
- pre.addContent(anchor);
|
||||
- pre.addContent(NEW_LINE);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Add trailing blank lines at the end of the page.
|
||||
- *
|
||||
- * @param pre the content tree to which the blank lines will be added.
|
||||
- */
|
||||
- private static void addBlankLines(Content pre) {
|
||||
- for (int i = 0; i < NUM_BLANK_LINES; i++) {
|
||||
- pre.addContent(NEW_LINE);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Given a <code>Doc</code>, return an anchor name for it.
|
||||
- *
|
||||
- * @param d the <code>Doc</code> to check.
|
||||
- * @return the name of the anchor.
|
||||
- */
|
||||
- public static String getAnchorName(Doc d) {
|
||||
- return "line." + d.position().line();
|
||||
- }
|
||||
-}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,134 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User bae
|
||||
# Date 1256300510 -14400
|
||||
# Node ID 0f5e355fe68c0ff29e28a962199185e4bd3d7e04
|
||||
# Parent 55257a533c9553d99e90e7b82affab14d5d6b056
|
||||
6888167: memory leaks in the medialib glue code
|
||||
Reviewed-by: igor, prr
|
||||
|
||||
diff --git a/src/share/native/sun/awt/medialib/awt_ImagingLib.c b/src/share/native/sun/awt/medialib/awt_ImagingLib.c
|
||||
--- jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.c
|
||||
+++ jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.c
|
||||
@@ -961,21 +961,15 @@
|
||||
mlib_filter filter;
|
||||
unsigned int *dP;
|
||||
|
||||
- if ((srcRasterP = (RasterS_t *) calloc(1, sizeof(RasterS_t))) == NULL) {
|
||||
- JNU_ThrowOutOfMemoryError(env, "Out of memory");
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- if ((dstRasterP = (RasterS_t *) calloc(1, sizeof(RasterS_t))) == NULL) {
|
||||
- JNU_ThrowOutOfMemoryError(env, "Out of memory");
|
||||
- free(srcRasterP);
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
/* This function requires a lot of local refs ??? Is 64 enough ??? */
|
||||
if ((*env)->EnsureLocalCapacity(env, 64) < 0)
|
||||
return 0;
|
||||
|
||||
+ if (s_nomlib) return 0;
|
||||
+ if (s_timeIt) {
|
||||
+ (*start_timer)(3600);
|
||||
+ }
|
||||
+
|
||||
switch(interpType) {
|
||||
case java_awt_image_AffineTransformOp_TYPE_BILINEAR:
|
||||
filter = MLIB_BILINEAR;
|
||||
@@ -991,9 +985,15 @@
|
||||
return -1;
|
||||
}
|
||||
|
||||
- if (s_nomlib) return 0;
|
||||
- if (s_timeIt) {
|
||||
- (*start_timer)(3600);
|
||||
+ if ((srcRasterP = (RasterS_t *) calloc(1, sizeof(RasterS_t))) == NULL) {
|
||||
+ JNU_ThrowOutOfMemoryError(env, "Out of memory");
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if ((dstRasterP = (RasterS_t *) calloc(1, sizeof(RasterS_t))) == NULL) {
|
||||
+ JNU_ThrowOutOfMemoryError(env, "Out of memory");
|
||||
+ free(srcRasterP);
|
||||
+ return -1;
|
||||
}
|
||||
|
||||
if ((*env)->GetArrayLength(env, jmatrix) < 6) {
|
||||
@@ -1216,6 +1216,9 @@
|
||||
}
|
||||
|
||||
if (tbl == NULL || table == NULL || jtable == NULL) {
|
||||
+ if (tbl != NULL) free(tbl);
|
||||
+ if (table != NULL) free(table);
|
||||
+ if (jtable != NULL) free(jtable);
|
||||
awt_freeParsedImage(srcImageP, TRUE);
|
||||
awt_freeParsedImage(dstImageP, TRUE);
|
||||
JNU_ThrowNullPointerException(env, "NULL LUT");
|
||||
@@ -1225,6 +1228,11 @@
|
||||
for (i=0; i < jlen; i++) {
|
||||
jtable[i] = (*env)->GetObjectArrayElement(env, jtableArrays, i);
|
||||
if (jtable[i] == NULL) {
|
||||
+ free(tbl);
|
||||
+ free(table);
|
||||
+ free(jtable);
|
||||
+ awt_freeParsedImage(srcImageP, TRUE);
|
||||
+ awt_freeParsedImage(dstImageP, TRUE);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1233,6 +1241,9 @@
|
||||
FALSE, &hint);
|
||||
if (nbands < 1) {
|
||||
/* Can't handle any custom images */
|
||||
+ free(tbl);
|
||||
+ free(table);
|
||||
+ free(jtable);
|
||||
awt_freeParsedImage(srcImageP, TRUE);
|
||||
awt_freeParsedImage(dstImageP, TRUE);
|
||||
return 0;
|
||||
@@ -1241,12 +1252,18 @@
|
||||
/* Allocate the arrays */
|
||||
if (allocateArray(env, srcImageP, &src, &sdata, TRUE, FALSE, FALSE) < 0) {
|
||||
/* Must be some problem */
|
||||
+ free(tbl);
|
||||
+ free(table);
|
||||
+ free(jtable);
|
||||
awt_freeParsedImage(srcImageP, TRUE);
|
||||
awt_freeParsedImage(dstImageP, TRUE);
|
||||
return 0;
|
||||
}
|
||||
if (allocateArray(env, dstImageP, &dst, &ddata, FALSE, FALSE, FALSE) < 0) {
|
||||
/* Must be some problem */
|
||||
+ free(tbl);
|
||||
+ free(table);
|
||||
+ free(jtable);
|
||||
freeArray(env, srcImageP, src, sdata, NULL, NULL, NULL);
|
||||
awt_freeParsedImage(srcImageP, TRUE);
|
||||
awt_freeParsedImage(dstImageP, TRUE);
|
||||
@@ -1285,6 +1302,9 @@
|
||||
(jbyte *) table[j],
|
||||
JNI_ABORT);
|
||||
}
|
||||
+ free(tbl);
|
||||
+ free(table);
|
||||
+ free(jtable);
|
||||
freeArray(env, srcImageP, src, sdata, NULL, NULL, NULL);
|
||||
awt_freeParsedImage(srcImageP, TRUE);
|
||||
awt_freeParsedImage(dstImageP, TRUE);
|
||||
@@ -1414,12 +1434,15 @@
|
||||
|
||||
/* Parse the source raster - reject custom images */
|
||||
if ((status = awt_parseRaster(env, jsrc, srcRasterP)) <= 0) {
|
||||
+ free(srcRasterP);
|
||||
+ free(dstRasterP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Parse the destination image - reject custom images */
|
||||
if ((status = awt_parseRaster(env, jdst, dstRasterP)) <= 0) {
|
||||
awt_freeParsedRaster(srcRasterP, TRUE);
|
||||
+ free(dstRasterP);
|
||||
return 0;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,42 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User andrew
|
||||
# Date 1365711839 -3600
|
||||
# Node ID df591e0dfd349dc5986cc17949939c588d5a9690
|
||||
# Parent 06255d9f82761abc74c30f31fda00968ffef4bc3
|
||||
6963811: Deadlock-prone locking changes in Introspector
|
||||
Reviewed-by: peterz, rupashka
|
||||
|
||||
diff --git a/src/share/classes/java/beans/Introspector.java b/src/share/classes/java/beans/Introspector.java
|
||||
--- jdk/src/share/classes/java/beans/Introspector.java
|
||||
+++ jdk/src/share/classes/java/beans/Introspector.java
|
||||
@@ -170,21 +170,24 @@
|
||||
if (!ReflectUtil.isPackageAccessible(beanClass)) {
|
||||
return (new Introspector(beanClass, null, USE_ALL_BEANINFO)).getBeanInfo();
|
||||
}
|
||||
+ WeakCache<Class<?>, BeanInfo> beanInfoCache;
|
||||
+ BeanInfo beanInfo;
|
||||
synchronized (BEANINFO_CACHE) {
|
||||
- WeakCache<Class<?>, BeanInfo> beanInfoCache =
|
||||
- (WeakCache<Class<?>, BeanInfo>) AppContext.getAppContext().get(BEANINFO_CACHE);
|
||||
+ beanInfoCache = (WeakCache<Class<?>, BeanInfo>) AppContext.getAppContext().get(BEANINFO_CACHE);
|
||||
|
||||
if (beanInfoCache == null) {
|
||||
beanInfoCache = new WeakCache<Class<?>, BeanInfo>();
|
||||
AppContext.getAppContext().put(BEANINFO_CACHE, beanInfoCache);
|
||||
}
|
||||
- BeanInfo beanInfo = beanInfoCache.get(beanClass);
|
||||
- if (beanInfo == null) {
|
||||
- beanInfo = (new Introspector(beanClass, null, USE_ALL_BEANINFO)).getBeanInfo();
|
||||
+ beanInfo = beanInfoCache.get(beanClass);
|
||||
+ }
|
||||
+ if (beanInfo == null) {
|
||||
+ beanInfo = (new Introspector(beanClass, null, USE_ALL_BEANINFO)).getBeanInfo();
|
||||
+ synchronized (BEANINFO_CACHE) {
|
||||
beanInfoCache.put(beanClass, beanInfo);
|
||||
}
|
||||
- return beanInfo;
|
||||
}
|
||||
+ return beanInfo;
|
||||
}
|
||||
|
||||
/**
|
@ -1,299 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User bpatel
|
||||
# Date 1292276687 28800
|
||||
# Node ID 445134ee98c84b6d139fab0f9a9d8718c686c63b
|
||||
# Parent 5761891cfee48bc9382dd68e5e1bf164cff9bfbf
|
||||
7006270: Several javadoc regression tests are failing on windows
|
||||
Reviewed-by: jjg
|
||||
|
||||
diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java
|
||||
--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java
|
||||
+++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java
|
||||
@@ -239,7 +239,7 @@
|
||||
Type superclass = Util.getFirstVisibleSuperClass(classDoc,
|
||||
configuration());
|
||||
if (superclass != null) {
|
||||
- pre.addContent("\n");
|
||||
+ pre.addContent(DocletConstants.NL);
|
||||
pre.addContent("extends ");
|
||||
Content link = new RawHtml(getLink(new LinkInfoImpl(
|
||||
LinkInfoImpl.CONTEXT_CLASS_SIGNATURE_PARENT_NAME,
|
||||
@@ -257,7 +257,7 @@
|
||||
continue;
|
||||
}
|
||||
if (counter == 0) {
|
||||
- pre.addContent("\n");
|
||||
+ pre.addContent(DocletConstants.NL);
|
||||
pre.addContent(isInterface? "extends " : "implements ");
|
||||
} else {
|
||||
pre.addContent(", ");
|
||||
diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java
|
||||
--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java
|
||||
+++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java
|
||||
@@ -144,11 +144,12 @@
|
||||
!configuration.nohelp) {
|
||||
HelpWriter.generate(configuration);
|
||||
}
|
||||
- // If a stylesheet file is not specified, copy the default stylesheet.
|
||||
+ // If a stylesheet file is not specified, copy the default stylesheet
|
||||
+ // and replace newline with platform-specific newline.
|
||||
if (configuration.stylesheetfile.length() == 0) {
|
||||
Util.copyFile(configuration, "stylesheet.css", Util.RESOURCESDIR,
|
||||
(configdestdir.isEmpty()) ?
|
||||
- System.getProperty("user.dir") : configdestdir, false);
|
||||
+ System.getProperty("user.dir") : configdestdir, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
|
||||
--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
|
||||
+++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
|
||||
@@ -216,15 +216,15 @@
|
||||
public Content getAllClassesLinkScript(String id) {
|
||||
HtmlTree script = new HtmlTree(HtmlTag.SCRIPT);
|
||||
script.addAttr(HtmlAttr.TYPE, "text/javascript");
|
||||
- String scriptCode = "<!--\n" +
|
||||
- " allClassesLink = document.getElementById(\"" + id + "\");\n" +
|
||||
- " if(window==top) {\n" +
|
||||
- " allClassesLink.style.display = \"block\";\n" +
|
||||
- " }\n" +
|
||||
- " else {\n" +
|
||||
- " allClassesLink.style.display = \"none\";\n" +
|
||||
- " }\n" +
|
||||
- " //-->\n";
|
||||
+ String scriptCode = "<!--" + DocletConstants.NL +
|
||||
+ " allClassesLink = document.getElementById(\"" + id + "\");" + DocletConstants.NL +
|
||||
+ " if(window==top) {" + DocletConstants.NL +
|
||||
+ " allClassesLink.style.display = \"block\";" + DocletConstants.NL +
|
||||
+ " }" + DocletConstants.NL +
|
||||
+ " else {" + DocletConstants.NL +
|
||||
+ " allClassesLink.style.display = \"none\";" + DocletConstants.NL +
|
||||
+ " }" + DocletConstants.NL +
|
||||
+ " //-->" + DocletConstants.NL;
|
||||
Content scriptContent = new RawHtml(scriptCode);
|
||||
script.addContent(scriptContent);
|
||||
Content div = HtmlTree.DIV(script);
|
||||
diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/markup/Comment.java b/src/share/classes/com/sun/tools/doclets/formats/html/markup/Comment.java
|
||||
--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/Comment.java
|
||||
+++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/Comment.java
|
||||
@@ -82,9 +82,9 @@
|
||||
*/
|
||||
public void write(StringBuilder contentBuilder) {
|
||||
if (!endsWithNewLine(contentBuilder))
|
||||
- contentBuilder.append("\n");
|
||||
+ contentBuilder.append(DocletConstants.NL);
|
||||
contentBuilder.append("<!-- ");
|
||||
contentBuilder.append(commentText);
|
||||
- contentBuilder.append(" -->\n");
|
||||
+ contentBuilder.append(" -->" + DocletConstants.NL);
|
||||
}
|
||||
}
|
||||
diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/markup/DocType.java b/src/share/classes/com/sun/tools/doclets/formats/html/markup/DocType.java
|
||||
--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/DocType.java
|
||||
+++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/DocType.java
|
||||
@@ -48,7 +48,7 @@
|
||||
*/
|
||||
private DocType(String type, String dtd) {
|
||||
docType = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 " + type +
|
||||
- "//EN\" \"" + dtd + "\">\n";
|
||||
+ "//EN\" \"" + dtd + "\">" + DocletConstants.NL;
|
||||
}
|
||||
|
||||
/**
|
||||
diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java
|
||||
--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java
|
||||
+++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java
|
||||
@@ -753,7 +753,7 @@
|
||||
*/
|
||||
public void write(StringBuilder contentBuilder) {
|
||||
if (!isInline() && !endsWithNewLine(contentBuilder))
|
||||
- contentBuilder.append("\n");
|
||||
+ contentBuilder.append(DocletConstants.NL);
|
||||
String tagString = htmlTag.toString();
|
||||
contentBuilder.append("<" + tagString);
|
||||
Iterator<HtmlAttr> iterator = attrs.keySet().iterator();
|
||||
@@ -772,6 +772,6 @@
|
||||
if (htmlTag.endTagRequired())
|
||||
contentBuilder.append("</" + tagString + ">");
|
||||
if (!isInline())
|
||||
- contentBuilder.append("\n");
|
||||
+ contentBuilder.append(DocletConstants.NL);
|
||||
}
|
||||
}
|
||||
diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java
|
||||
--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java
|
||||
+++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java
|
||||
@@ -287,11 +287,11 @@
|
||||
HtmlTree script = new HtmlTree(HtmlTag.SCRIPT);
|
||||
if(winTitle != null && winTitle.length() > 0) {
|
||||
script.addAttr(HtmlAttr.TYPE, "text/javascript");
|
||||
- String scriptCode = "<!--\n" +
|
||||
- " if (location.href.indexOf('is-external=true') == -1) {\n" +
|
||||
- " parent.document.title=\"" + winTitle + "\";\n" +
|
||||
- " }\n" +
|
||||
- "//-->\n";
|
||||
+ String scriptCode = "<!--" + DocletConstants.NL +
|
||||
+ " if (location.href.indexOf('is-external=true') == -1) {" + DocletConstants.NL +
|
||||
+ " parent.document.title=\"" + winTitle + "\";" + DocletConstants.NL +
|
||||
+ " }" + DocletConstants.NL +
|
||||
+ "//-->" + DocletConstants.NL;
|
||||
RawHtml scriptContent = new RawHtml(scriptCode);
|
||||
script.addContent(scriptContent);
|
||||
}
|
||||
@@ -306,15 +306,15 @@
|
||||
protected Content getFramesetJavaScript(){
|
||||
HtmlTree script = new HtmlTree(HtmlTag.SCRIPT);
|
||||
script.addAttr(HtmlAttr.TYPE, "text/javascript");
|
||||
- String scriptCode = "\n targetPage = \"\" + window.location.search;\n" +
|
||||
- " if (targetPage != \"\" && targetPage != \"undefined\")\n" +
|
||||
- " targetPage = targetPage.substring(1);\n" +
|
||||
- " if (targetPage.indexOf(\":\") != -1)\n" +
|
||||
- " targetPage = \"undefined\";\n" +
|
||||
- " function loadFrames() {\n" +
|
||||
- " if (targetPage != \"\" && targetPage != \"undefined\")\n" +
|
||||
- " top.classFrame.location = top.targetPage;\n" +
|
||||
- " }\n";
|
||||
+ String scriptCode = DocletConstants.NL + " targetPage = \"\" + window.location.search;" + DocletConstants.NL +
|
||||
+ " if (targetPage != \"\" && targetPage != \"undefined\")" + DocletConstants.NL +
|
||||
+ " targetPage = targetPage.substring(1);" + DocletConstants.NL +
|
||||
+ " if (targetPage.indexOf(\":\") != -1)" + DocletConstants.NL +
|
||||
+ " targetPage = \"undefined\";" + DocletConstants.NL +
|
||||
+ " function loadFrames() {" + DocletConstants.NL +
|
||||
+ " if (targetPage != \"\" && targetPage != \"undefined\")" + DocletConstants.NL +
|
||||
+ " top.classFrame.location = top.targetPage;" + DocletConstants.NL +
|
||||
+ " }" + DocletConstants.NL;
|
||||
RawHtml scriptContent = new RawHtml(scriptCode);
|
||||
script.addContent(scriptContent);
|
||||
return script;
|
||||
diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/Content.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/Content.java
|
||||
--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Content.java
|
||||
+++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Content.java
|
||||
@@ -101,6 +101,6 @@
|
||||
*/
|
||||
public boolean endsWithNewLine(StringBuilder contentBuilder) {
|
||||
return ((contentBuilder.length() == 0) ||
|
||||
- (contentBuilder.substring(contentBuilder.length() - 1).equals("\n")));
|
||||
+ (contentBuilder.toString().endsWith(DocletConstants.NL)));
|
||||
}
|
||||
}
|
||||
diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java
|
||||
--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java
|
||||
+++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java
|
||||
@@ -211,14 +211,14 @@
|
||||
try {
|
||||
while ((len = input.read(bytearr)) != -1) {
|
||||
output.write(bytearr, 0, len);
|
||||
- }
|
||||
+ }
|
||||
} catch (FileNotFoundException exc) {
|
||||
} catch (SecurityException exc) {
|
||||
- } finally {
|
||||
+ } finally {
|
||||
input.close();
|
||||
output.close();
|
||||
+ }
|
||||
}
|
||||
- }
|
||||
|
||||
/**
|
||||
* Copy the given directory contents from the source package directory
|
||||
@@ -330,7 +330,7 @@
|
||||
String resourcefile, boolean overwrite) {
|
||||
String destresourcesdir = configuration.destDirName + RESOURCESDIR;
|
||||
copyFile(configuration, resourcefile, RESOURCESDIR, destresourcesdir,
|
||||
- overwrite);
|
||||
+ overwrite, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -345,23 +345,46 @@
|
||||
* @param overwrite A flag to indicate whether the file in the
|
||||
* destination directory will be overwritten if
|
||||
* it already exists.
|
||||
+ * @param replaceNewLine true if the newline needs to be replaced with platform-
|
||||
+ * specific newline.
|
||||
*/
|
||||
public static void copyFile(Configuration configuration, String file, String source,
|
||||
- String destination, boolean overwrite) {
|
||||
+ String destination, boolean overwrite, boolean replaceNewLine) {
|
||||
DirectoryManager.createDirectory(configuration, destination);
|
||||
File destfile = new File(destination, file);
|
||||
if(destfile.exists() && (! overwrite)) return;
|
||||
try {
|
||||
InputStream in = Configuration.class.getResourceAsStream(
|
||||
- source + DirectoryManager.URL_FILE_SEPARATOR + file);
|
||||
+ source + DirectoryManager.URL_FILE_SEPARATOR + file);
|
||||
if(in==null) return;
|
||||
OutputStream out = new FileOutputStream(destfile);
|
||||
- byte[] buf = new byte[2048];
|
||||
- int n;
|
||||
- while((n = in.read(buf))>0) out.write(buf,0,n);
|
||||
- in.close();
|
||||
- out.close();
|
||||
- } catch(Throwable t) {}
|
||||
+ try {
|
||||
+ if (!replaceNewLine) {
|
||||
+ byte[] buf = new byte[2048];
|
||||
+ int n;
|
||||
+ while((n = in.read(buf))>0) out.write(buf,0,n);
|
||||
+ } else {
|
||||
+ BufferedReader reader = new BufferedReader(new InputStreamReader(in));
|
||||
+ BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out));
|
||||
+ try {
|
||||
+ String line;
|
||||
+ while ((line = reader.readLine()) != null) {
|
||||
+ writer.write(line);
|
||||
+ writer.write(DocletConstants.NL);
|
||||
+ }
|
||||
+ } finally {
|
||||
+ reader.close();
|
||||
+ writer.close();
|
||||
+ }
|
||||
+ }
|
||||
+ } finally {
|
||||
+ in.close();
|
||||
+ out.close();
|
||||
+ }
|
||||
+ } catch (IOException ie) {
|
||||
+ ie.printStackTrace();
|
||||
+ throw new DocletAbortException();
|
||||
+ }
|
||||
}
|
||||
|
||||
/**
|
||||
diff --git a/test/com/sun/javadoc/testHtmlDocument/TestHtmlDocument.java b/test/com/sun/javadoc/testHtmlDocument/TestHtmlDocument.java
|
||||
--- langtools/test/com/sun/javadoc/testHtmlDocument/TestHtmlDocument.java
|
||||
+++ langtools/test/com/sun/javadoc/testHtmlDocument/TestHtmlDocument.java
|
||||
@@ -44,6 +44,7 @@
|
||||
private static final String BUGID = "6851834";
|
||||
private static final String BUGNAME = "TestHtmlDocument";
|
||||
private static final String FS = System.getProperty("file.separator");
|
||||
+ private static final String LS = System.getProperty("line.separator");
|
||||
private static String srcdir = System.getProperty("test.src", ".");
|
||||
|
||||
// Entry point
|
||||
@@ -143,13 +144,17 @@
|
||||
System.out.println("\nFILE DOES NOT EXIST: " + filename);
|
||||
}
|
||||
BufferedReader in = new BufferedReader(new FileReader(file));
|
||||
+ StringBuilder fileString = new StringBuilder();
|
||||
// Create an array of characters the size of the file
|
||||
- char[] allChars = new char[(int)file.length()];
|
||||
- // Read the characters into the allChars array
|
||||
- in.read(allChars, 0, (int)file.length());
|
||||
- in.close();
|
||||
- // Convert to a string
|
||||
- String allCharsString = new String(allChars);
|
||||
- return allCharsString;
|
||||
+ try {
|
||||
+ String line;
|
||||
+ while ((line = in.readLine()) != null) {
|
||||
+ fileString.append(line);
|
||||
+ fileString.append(LS);
|
||||
+ }
|
||||
+ } finally {
|
||||
+ in.close();
|
||||
+ }
|
||||
+ return fileString.toString();
|
||||
}
|
||||
}
|
@ -1,101 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User andrew
|
||||
# Date 1365745184 -3600
|
||||
# Node ID 5ed9acc1f6be298713f10ad71c33564d48f46555
|
||||
# Parent d79bfc0c6371d1174209585a8d2bf08e3f3625f9
|
||||
7017324: Kerning crash in JDK 7 since ICU layout update
|
||||
Reviewed-by: igor, prr
|
||||
|
||||
diff --git a/src/share/native/sun/font/layout/KernTable.cpp b/src/share/native/sun/font/layout/KernTable.cpp
|
||||
--- jdk/src/share/native/sun/font/layout/KernTable.cpp
|
||||
+++ jdk/src/share/native/sun/font/layout/KernTable.cpp
|
||||
@@ -217,7 +217,7 @@
|
||||
// all the elements ahead of time and store them in the font
|
||||
|
||||
const PairInfo* p = pairsSwapped;
|
||||
- const PairInfo* tp = (const PairInfo*)(p + rangeShift);
|
||||
+ const PairInfo* tp = (const PairInfo*)(p + (rangeShift/KERN_PAIRINFO_SIZE)); /* rangeshift is in original table bytes */
|
||||
if (key > tp->key) {
|
||||
p = tp;
|
||||
}
|
||||
@@ -229,7 +229,7 @@
|
||||
le_uint32 probe = searchRange;
|
||||
while (probe > 1) {
|
||||
probe >>= 1;
|
||||
- tp = (const PairInfo*)(p + probe);
|
||||
+ tp = (const PairInfo*)(p + (probe/KERN_PAIRINFO_SIZE));
|
||||
le_uint32 tkey = tp->key;
|
||||
#if DEBUG
|
||||
fprintf(stdout, " %.3d (%0.8x)\n", (tp - pairsSwapped), tkey);
|
||||
diff --git a/test/java/awt/font/TextLayout/KernCrash.java b/test/java/awt/font/TextLayout/KernCrash.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ jdk/test/java/awt/font/TextLayout/KernCrash.java
|
||||
@@ -0,0 +1,67 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ * This code is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
+ * or visit www.oracle.com if you need additional information or have any
|
||||
+ * questions.
|
||||
+ */
|
||||
+
|
||||
+import java.io.*;
|
||||
+import java.awt.*;
|
||||
+import java.awt.font.*;
|
||||
+import java.util.*;
|
||||
+
|
||||
+/**
|
||||
+ * Shows (top) with kerning, (middle) without, (bottom) also without.
|
||||
+ *
|
||||
+ * @bug 7017324
|
||||
+ */
|
||||
+public class KernCrash extends Frame {
|
||||
+ private static Font font0;
|
||||
+ private static Font font1;
|
||||
+ private static Font font2;
|
||||
+
|
||||
+ public static void main(String[] args) throws Exception {
|
||||
+ HashMap attrs = new HashMap();
|
||||
+ font0 = Font.createFont(Font.TRUETYPE_FONT, new File("Vera.ttf"));
|
||||
+ System.out.println("using " + font0);
|
||||
+ attrs.put(TextAttribute.SIZE, new Float(58f));
|
||||
+ font1 = font0.deriveFont(attrs);
|
||||
+ attrs.put(TextAttribute.KERNING, TextAttribute.KERNING_ON);
|
||||
+ font2 = font0.deriveFont(attrs);
|
||||
+
|
||||
+ KernCrash f = new KernCrash();
|
||||
+ f.setTitle("Kerning Crash");
|
||||
+ f.setSize(600, 300);
|
||||
+ f.setForeground(Color.black);
|
||||
+ f.show();
|
||||
+ }
|
||||
+
|
||||
+ public void paint(Graphics g) {
|
||||
+ Graphics2D g2 = (Graphics2D)g;
|
||||
+ FontRenderContext frc = g2.getFontRenderContext();
|
||||
+ TextLayout layout = new TextLayout("text", font2, frc);
|
||||
+ layout.draw(g2, 10, 150);
|
||||
+
|
||||
+ String s = "WAVATastic";
|
||||
+ TextLayout layout2 = new TextLayout(s, font1, frc);
|
||||
+ layout2.draw(g2, 10, 200);
|
||||
+ TextLayout layout3 = new TextLayout(s, font2, frc);
|
||||
+ layout3.draw(g2, 10, 100);
|
||||
+ }
|
||||
+}
|
@ -1,178 +0,0 @@
|
||||
--- hotspot/src/cpu/x86/vm/assembler_x86.cpp 2011-03-30 11:31:16.408872134 -0700
|
||||
+++ hotspot/src/cpu/x86/vm/assembler_x86.cpp 2011-03-30 11:31:16.084614406 -0700
|
||||
@@ -7769,6 +7769,28 @@
|
||||
}
|
||||
}
|
||||
|
||||
+void MacroAssembler::cmov32(Condition cc, Register dst, Address src) {
|
||||
+ if (VM_Version::supports_cmov()) {
|
||||
+ cmovl(cc, dst, src);
|
||||
+ } else {
|
||||
+ Label L;
|
||||
+ jccb(negate_condition(cc), L);
|
||||
+ movl(dst, src);
|
||||
+ bind(L);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void MacroAssembler::cmov32(Condition cc, Register dst, Register src) {
|
||||
+ if (VM_Version::supports_cmov()) {
|
||||
+ cmovl(cc, dst, src);
|
||||
+ } else {
|
||||
+ Label L;
|
||||
+ jccb(negate_condition(cc), L);
|
||||
+ movl(dst, src);
|
||||
+ bind(L);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void MacroAssembler::verify_oop(Register reg, const char* s) {
|
||||
if (!VerifyOops) return;
|
||||
|
||||
@@ -9019,14 +9041,7 @@
|
||||
movl(result, cnt1);
|
||||
subl(cnt1, cnt2);
|
||||
push(cnt1);
|
||||
- if (VM_Version::supports_cmov()) {
|
||||
- cmovl(Assembler::lessEqual, cnt2, result);
|
||||
- } else {
|
||||
- Label GT_LABEL;
|
||||
- jccb(Assembler::greater, GT_LABEL);
|
||||
- movl(cnt2, result);
|
||||
- bind(GT_LABEL);
|
||||
- }
|
||||
+ cmov32(Assembler::lessEqual, cnt2, result);
|
||||
|
||||
// Is the minimum length zero?
|
||||
testl(cnt2, cnt2);
|
||||
--- hotspot/src/cpu/x86/vm/assembler_x86.hpp 2011-03-30 11:31:17.757655562 -0700
|
||||
+++ hotspot/src/cpu/x86/vm/assembler_x86.hpp 2011-03-30 11:31:17.553920606 -0700
|
||||
@@ -2244,10 +2244,13 @@
|
||||
|
||||
// Data
|
||||
|
||||
- void cmov(Condition cc, Register dst, Register src) { LP64_ONLY(cmovq(cc, dst, src)) NOT_LP64(cmovl(cc, dst, src)); }
|
||||
+ void cmov32( Condition cc, Register dst, Address src);
|
||||
+ void cmov32( Condition cc, Register dst, Register src);
|
||||
|
||||
- void cmovptr(Condition cc, Register dst, Address src) { LP64_ONLY(cmovq(cc, dst, src)) NOT_LP64(cmovl(cc, dst, src)); }
|
||||
- void cmovptr(Condition cc, Register dst, Register src) { LP64_ONLY(cmovq(cc, dst, src)) NOT_LP64(cmovl(cc, dst, src)); }
|
||||
+ void cmov( Condition cc, Register dst, Register src) { cmovptr(cc, dst, src); }
|
||||
+
|
||||
+ void cmovptr(Condition cc, Register dst, Address src) { LP64_ONLY(cmovq(cc, dst, src)) NOT_LP64(cmov32(cc, dst, src)); }
|
||||
+ void cmovptr(Condition cc, Register dst, Register src) { LP64_ONLY(cmovq(cc, dst, src)) NOT_LP64(cmov32(cc, dst, src)); }
|
||||
|
||||
void movoop(Register dst, jobject obj);
|
||||
void movoop(Address dst, jobject obj);
|
||||
--- hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp 2011-03-30 11:31:18.743456717 -0700
|
||||
+++ hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp 2011-03-30 11:31:18.541656202 -0700
|
||||
@@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
+#include "asm/assembler.hpp"
|
||||
#include "c1/c1_Compilation.hpp"
|
||||
#include "c1/c1_LIRAssembler.hpp"
|
||||
#include "c1/c1_MacroAssembler.hpp"
|
||||
@@ -569,24 +570,13 @@
|
||||
__ lea (rdi, Address(rdi, rcx, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR)));
|
||||
|
||||
// compute minimum length (in rax) and difference of lengths (on top of stack)
|
||||
- if (VM_Version::supports_cmov()) {
|
||||
- __ movl (rbx, Address(rbx, java_lang_String::count_offset_in_bytes()));
|
||||
- __ movl (rax, Address(rax, java_lang_String::count_offset_in_bytes()));
|
||||
- __ mov (rcx, rbx);
|
||||
- __ subptr (rbx, rax); // subtract lengths
|
||||
- __ push (rbx); // result
|
||||
- __ cmov (Assembler::lessEqual, rax, rcx);
|
||||
- } else {
|
||||
- Label L;
|
||||
- __ movl (rbx, Address(rbx, java_lang_String::count_offset_in_bytes()));
|
||||
- __ movl (rcx, Address(rax, java_lang_String::count_offset_in_bytes()));
|
||||
- __ mov (rax, rbx);
|
||||
- __ subptr (rbx, rcx);
|
||||
- __ push (rbx);
|
||||
- __ jcc (Assembler::lessEqual, L);
|
||||
- __ mov (rax, rcx);
|
||||
- __ bind (L);
|
||||
- }
|
||||
+ __ movl (rbx, Address(rbx, java_lang_String::count_offset_in_bytes()));
|
||||
+ __ movl (rax, Address(rax, java_lang_String::count_offset_in_bytes()));
|
||||
+ __ mov (rcx, rbx);
|
||||
+ __ subptr(rbx, rax); // subtract lengths
|
||||
+ __ push (rbx); // result
|
||||
+ __ cmov (Assembler::lessEqual, rax, rcx);
|
||||
+
|
||||
// is minimum length 0?
|
||||
Label noLoop, haveResult;
|
||||
__ testptr (rax, rax);
|
||||
--- hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp 2011-03-30 11:31:19.824124145 -0700
|
||||
+++ hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp 2011-03-30 11:31:19.606167752 -0700
|
||||
@@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
+#include "asm/assembler.hpp"
|
||||
#include "c1/c1_Defs.hpp"
|
||||
#include "c1/c1_MacroAssembler.hpp"
|
||||
#include "c1/c1_Runtime1.hpp"
|
||||
--- hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp 2011-03-30 11:31:20.910918826 -0700
|
||||
+++ hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp 2011-03-30 11:31:20.703693030 -0700
|
||||
@@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
+#include "asm/assembler.hpp"
|
||||
#include "interpreter/interpreter.hpp"
|
||||
#include "interpreter/interpreterRuntime.hpp"
|
||||
#include "interpreter/templateTable.hpp"
|
||||
@@ -1939,18 +1940,10 @@
|
||||
__ movl(temp, Address(array, h, Address::times_8, 0*wordSize));
|
||||
__ bswapl(temp);
|
||||
__ cmpl(key, temp);
|
||||
- if (VM_Version::supports_cmov()) {
|
||||
- __ cmovl(Assembler::less , j, h); // j = h if (key < array[h].fast_match())
|
||||
- __ cmovl(Assembler::greaterEqual, i, h); // i = h if (key >= array[h].fast_match())
|
||||
- } else {
|
||||
- Label set_i, end_of_if;
|
||||
- __ jccb(Assembler::greaterEqual, set_i); // {
|
||||
- __ mov(j, h); // j = h;
|
||||
- __ jmp(end_of_if); // }
|
||||
- __ bind(set_i); // else {
|
||||
- __ mov(i, h); // i = h;
|
||||
- __ bind(end_of_if); // }
|
||||
- }
|
||||
+ // j = h if (key < array[h].fast_match())
|
||||
+ __ cmov32(Assembler::less , j, h);
|
||||
+ // i = h if (key >= array[h].fast_match())
|
||||
+ __ cmov32(Assembler::greaterEqual, i, h);
|
||||
// while (i+1 < j)
|
||||
__ bind(entry);
|
||||
__ leal(h, Address(i, 1)); // i+1
|
||||
@@ -3478,22 +3471,14 @@
|
||||
|
||||
// find a free slot in the monitor block (result in rdx)
|
||||
{ Label entry, loop, exit;
|
||||
- __ movptr(rcx, monitor_block_top); // points to current entry, starting with top-most entry
|
||||
- __ lea(rbx, monitor_block_bot); // points to word before bottom of monitor block
|
||||
+ __ movptr(rcx, monitor_block_top); // points to current entry, starting with top-most entry
|
||||
+
|
||||
+ __ lea(rbx, monitor_block_bot); // points to word before bottom of monitor block
|
||||
__ jmpb(entry);
|
||||
|
||||
__ bind(loop);
|
||||
__ cmpptr(Address(rcx, BasicObjectLock::obj_offset_in_bytes()), (int32_t)NULL_WORD); // check if current entry is used
|
||||
-
|
||||
-// TODO - need new func here - kbt
|
||||
- if (VM_Version::supports_cmov()) {
|
||||
- __ cmov(Assembler::equal, rdx, rcx); // if not used then remember entry in rdx
|
||||
- } else {
|
||||
- Label L;
|
||||
- __ jccb(Assembler::notEqual, L);
|
||||
- __ mov(rdx, rcx); // if not used then remember entry in rdx
|
||||
- __ bind(L);
|
||||
- }
|
||||
+ __ cmovptr(Assembler::equal, rdx, rcx); // if not used then remember entry in rdx
|
||||
__ cmpptr(rax, Address(rcx, BasicObjectLock::obj_offset_in_bytes())); // check if current entry is for same object
|
||||
__ jccb(Assembler::equal, exit); // if same object then stop searching
|
||||
__ addptr(rcx, entry_size); // otherwise advance to next entry
|
File diff suppressed because it is too large
Load Diff
@ -1,71 +0,0 @@
|
||||
diff -Nru openjdk.orig/jdk/src/share/classes/java/beans/Introspector.java openjdk/jdk/src/share/classes/java/beans/Introspector.java
|
||||
--- jdk/src/share/classes/java/beans/Introspector.java 2013-04-16 14:35:31.707279166 +0100
|
||||
+++ jdk/src/share/classes/java/beans/Introspector.java 2013-04-16 14:39:23.715018865 +0100
|
||||
@@ -102,7 +102,7 @@
|
||||
public final static int IGNORE_ALL_BEANINFO = 3;
|
||||
|
||||
// Static Caches to speed up introspection.
|
||||
- private static final WeakCache<Class<?>, Method[]> declaredMethodCache = new WeakCache<>();
|
||||
+ private static final WeakCache<Class<?>, Method[]> declaredMethodCache = new WeakCache<Class<?>, Method[]>();
|
||||
|
||||
private Class beanClass;
|
||||
private BeanInfo explicitBeanInfo;
|
||||
diff -Nru openjdk.orig/jdk/src/share/classes/java/beans/ThreadGroupContext.java openjdk/jdk/src/share/classes/java/beans/ThreadGroupContext.java
|
||||
--- jdk/src/share/classes/java/beans/ThreadGroupContext.java 2013-04-16 14:35:31.707279166 +0100
|
||||
+++ jdk/src/share/classes/java/beans/ThreadGroupContext.java 2013-04-16 14:40:01.243623831 +0100
|
||||
@@ -25,9 +25,6 @@
|
||||
|
||||
package java.beans;
|
||||
|
||||
-import com.sun.beans.finder.BeanInfoFinder;
|
||||
-import com.sun.beans.finder.PropertyEditorFinder;
|
||||
-
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -42,7 +39,7 @@
|
||||
*/
|
||||
final class ThreadGroupContext {
|
||||
|
||||
- private static final Map<ThreadGroup, ThreadGroupContext> contexts = new WeakHashMap<>();
|
||||
+ private static final Map<ThreadGroup, ThreadGroupContext> contexts = new WeakHashMap<ThreadGroup, ThreadGroupContext>();
|
||||
|
||||
/**
|
||||
* Returns the appropriate {@code AppContext} for the caller,
|
||||
@@ -66,8 +63,6 @@
|
||||
private volatile Boolean isGuiAvailable;
|
||||
|
||||
private Map<Class<?>, BeanInfo> beanInfoCache;
|
||||
- private BeanInfoFinder beanInfoFinder;
|
||||
- private PropertyEditorFinder propertyEditorFinder;
|
||||
|
||||
|
||||
boolean isDesignTime() {
|
||||
@@ -99,7 +94,7 @@
|
||||
|
||||
BeanInfo putBeanInfo(Class<?> type, BeanInfo info) {
|
||||
if (this.beanInfoCache == null) {
|
||||
- this.beanInfoCache = new WeakHashMap<>();
|
||||
+ this.beanInfoCache = new WeakHashMap<Class<?>, BeanInfo>();
|
||||
}
|
||||
return this.beanInfoCache.put(type, info);
|
||||
}
|
||||
@@ -116,18 +111,4 @@
|
||||
}
|
||||
}
|
||||
|
||||
-
|
||||
- synchronized BeanInfoFinder getBeanInfoFinder() {
|
||||
- if (this.beanInfoFinder == null) {
|
||||
- this.beanInfoFinder = new BeanInfoFinder();
|
||||
- }
|
||||
- return this.beanInfoFinder;
|
||||
- }
|
||||
-
|
||||
- synchronized PropertyEditorFinder getPropertyEditorFinder() {
|
||||
- if (this.propertyEditorFinder == null) {
|
||||
- this.propertyEditorFinder = new PropertyEditorFinder();
|
||||
- }
|
||||
- return this.propertyEditorFinder;
|
||||
- }
|
||||
}
|
@ -1,436 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User andrew
|
||||
# Date 1365712268 -3600
|
||||
# Node ID 4d66f7ebcf99c1b322f47ff0aa6adadcd995f8f4
|
||||
# Parent df591e0dfd349dc5986cc17949939c588d5a9690
|
||||
7064279: Introspector.getBeanInfo() should release some resources in timely manner
|
||||
Reviewed-by: art, alexp
|
||||
|
||||
diff --git a/src/share/classes/java/beans/Beans.java b/src/share/classes/java/beans/Beans.java
|
||||
--- jdk/src/share/classes/java/beans/Beans.java
|
||||
+++ jdk/src/share/classes/java/beans/Beans.java
|
||||
@@ -32,7 +32,6 @@
|
||||
import java.applet.AppletStub;
|
||||
import java.applet.AudioClip;
|
||||
|
||||
-import java.awt.GraphicsEnvironment;
|
||||
import java.awt.Image;
|
||||
|
||||
import java.beans.beancontext.BeanContext;
|
||||
@@ -53,15 +52,11 @@
|
||||
import java.util.Iterator;
|
||||
import java.util.Vector;
|
||||
|
||||
-import sun.awt.AppContext;
|
||||
-
|
||||
/**
|
||||
* This class provides some general purpose beans control methods.
|
||||
*/
|
||||
|
||||
public class Beans {
|
||||
- private static final Object DESIGN_TIME = new Object();
|
||||
- private static final Object GUI_AVAILABLE = new Object();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -395,8 +390,7 @@
|
||||
* @see DesignMode
|
||||
*/
|
||||
public static boolean isDesignTime() {
|
||||
- Object value = AppContext.getAppContext().get(DESIGN_TIME);
|
||||
- return (value instanceof Boolean) && (Boolean) value;
|
||||
+ return ThreadGroupContext.getContext().isDesignTime();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -413,8 +407,7 @@
|
||||
*
|
||||
*/
|
||||
public static boolean isGuiAvailable() {
|
||||
- Object value = AppContext.getAppContext().get(GUI_AVAILABLE);
|
||||
- return (value instanceof Boolean) ? (Boolean) value : !GraphicsEnvironment.isHeadless();
|
||||
+ return ThreadGroupContext.getContext().isGuiAvailable();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -440,7 +433,7 @@
|
||||
if (sm != null) {
|
||||
sm.checkPropertiesAccess();
|
||||
}
|
||||
- AppContext.getAppContext().put(DESIGN_TIME, Boolean.valueOf(isDesignTime));
|
||||
+ ThreadGroupContext.getContext().setDesignTime(isDesignTime);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -466,7 +459,7 @@
|
||||
if (sm != null) {
|
||||
sm.checkPropertiesAccess();
|
||||
}
|
||||
- AppContext.getAppContext().put(GUI_AVAILABLE, Boolean.valueOf(isGuiAvailable));
|
||||
+ ThreadGroupContext.getContext().setGuiAvailable(isGuiAvailable);
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/share/classes/java/beans/Introspector.java b/src/share/classes/java/beans/Introspector.java
|
||||
--- jdk/src/share/classes/java/beans/Introspector.java
|
||||
+++ jdk/src/share/classes/java/beans/Introspector.java
|
||||
@@ -38,7 +38,6 @@
|
||||
import java.util.EventListener;
|
||||
import java.util.List;
|
||||
import java.util.TreeMap;
|
||||
-import sun.awt.AppContext;
|
||||
import sun.reflect.misc.ReflectUtil;
|
||||
|
||||
/**
|
||||
@@ -103,10 +102,7 @@
|
||||
public final static int IGNORE_ALL_BEANINFO = 3;
|
||||
|
||||
// Static Caches to speed up introspection.
|
||||
- private static WeakCache<Class<?>, Method[]> declaredMethodCache =
|
||||
- new WeakCache<Class<?>, Method[]>();
|
||||
-
|
||||
- private static final Object BEANINFO_CACHE = new Object();
|
||||
+ private static final WeakCache<Class<?>, Method[]> declaredMethodCache = new WeakCache<>();
|
||||
|
||||
private Class beanClass;
|
||||
private BeanInfo explicitBeanInfo;
|
||||
@@ -170,21 +166,15 @@
|
||||
if (!ReflectUtil.isPackageAccessible(beanClass)) {
|
||||
return (new Introspector(beanClass, null, USE_ALL_BEANINFO)).getBeanInfo();
|
||||
}
|
||||
- WeakCache<Class<?>, BeanInfo> beanInfoCache;
|
||||
+ ThreadGroupContext context = ThreadGroupContext.getContext();
|
||||
BeanInfo beanInfo;
|
||||
- synchronized (BEANINFO_CACHE) {
|
||||
- beanInfoCache = (WeakCache<Class<?>, BeanInfo>) AppContext.getAppContext().get(BEANINFO_CACHE);
|
||||
-
|
||||
- if (beanInfoCache == null) {
|
||||
- beanInfoCache = new WeakCache<Class<?>, BeanInfo>();
|
||||
- AppContext.getAppContext().put(BEANINFO_CACHE, beanInfoCache);
|
||||
- }
|
||||
- beanInfo = beanInfoCache.get(beanClass);
|
||||
+ synchronized (declaredMethodCache) {
|
||||
+ beanInfo = context.getBeanInfo(beanClass);
|
||||
}
|
||||
if (beanInfo == null) {
|
||||
beanInfo = (new Introspector(beanClass, null, USE_ALL_BEANINFO)).getBeanInfo();
|
||||
- synchronized (BEANINFO_CACHE) {
|
||||
- beanInfoCache.put(beanClass, beanInfo);
|
||||
+ synchronized (declaredMethodCache) {
|
||||
+ context.putBeanInfo(beanClass, beanInfo);
|
||||
}
|
||||
}
|
||||
return beanInfo;
|
||||
@@ -334,11 +324,8 @@
|
||||
*/
|
||||
|
||||
public static void flushCaches() {
|
||||
- synchronized (BEANINFO_CACHE) {
|
||||
- WeakCache beanInfoCache = (WeakCache) AppContext.getAppContext().get(BEANINFO_CACHE);
|
||||
- if (beanInfoCache != null) {
|
||||
- beanInfoCache.clear();
|
||||
- }
|
||||
+ synchronized (declaredMethodCache) {
|
||||
+ ThreadGroupContext.getContext().clearBeanInfoCache();
|
||||
declaredMethodCache.clear();
|
||||
}
|
||||
}
|
||||
@@ -362,11 +349,8 @@
|
||||
if (clz == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
- synchronized (BEANINFO_CACHE) {
|
||||
- WeakCache beanInfoCache = (WeakCache) AppContext.getAppContext().get(BEANINFO_CACHE);
|
||||
- if (beanInfoCache != null) {
|
||||
- beanInfoCache.put(clz, null);
|
||||
- }
|
||||
+ synchronized (declaredMethodCache) {
|
||||
+ ThreadGroupContext.getContext().removeBeanInfo(clz);
|
||||
declaredMethodCache.put(clz, null);
|
||||
}
|
||||
}
|
||||
@@ -1313,7 +1297,7 @@
|
||||
if (!ReflectUtil.isPackageAccessible(clz)) {
|
||||
return new Method[0];
|
||||
}
|
||||
- synchronized (BEANINFO_CACHE) {
|
||||
+ synchronized (declaredMethodCache) {
|
||||
Method[] result = declaredMethodCache.get(clz);
|
||||
if (result == null) {
|
||||
result = clz.getMethods();
|
||||
diff --git a/src/share/classes/java/beans/ThreadGroupContext.java b/src/share/classes/java/beans/ThreadGroupContext.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ jdk/src/share/classes/java/beans/ThreadGroupContext.java
|
||||
@@ -0,0 +1,133 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ * This code is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation. Oracle designates this
|
||||
+ * particular file as subject to the "Classpath" exception as provided
|
||||
+ * by Oracle in the LICENSE file that accompanied this code.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
+ * or visit www.oracle.com if you need additional information or have any
|
||||
+ * questions.
|
||||
+ */
|
||||
+
|
||||
+package java.beans;
|
||||
+
|
||||
+import com.sun.beans.finder.BeanInfoFinder;
|
||||
+import com.sun.beans.finder.PropertyEditorFinder;
|
||||
+
|
||||
+import java.awt.GraphicsEnvironment;
|
||||
+import java.util.HashMap;
|
||||
+import java.util.Map;
|
||||
+import java.util.WeakHashMap;
|
||||
+
|
||||
+/**
|
||||
+ * The {@code ThreadGroupContext} is an application-dependent
|
||||
+ * context referenced by the specific {@link ThreadGroup}.
|
||||
+ * This is a replacement for the {@link sun.awt.AppContext}.
|
||||
+ *
|
||||
+ * @author Sergey Malenkov
|
||||
+ */
|
||||
+final class ThreadGroupContext {
|
||||
+
|
||||
+ private static final Map<ThreadGroup, ThreadGroupContext> contexts = new WeakHashMap<>();
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the appropriate {@code AppContext} for the caller,
|
||||
+ * as determined by its {@code ThreadGroup}.
|
||||
+ *
|
||||
+ * @return the application-dependent context
|
||||
+ */
|
||||
+ static ThreadGroupContext getContext() {
|
||||
+ ThreadGroup group = Thread.currentThread().getThreadGroup();
|
||||
+ synchronized (contexts) {
|
||||
+ ThreadGroupContext context = contexts.get(group);
|
||||
+ if (context == null) {
|
||||
+ context = new ThreadGroupContext();
|
||||
+ contexts.put(group, context);
|
||||
+ }
|
||||
+ return context;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private volatile boolean isDesignTime;
|
||||
+ private volatile Boolean isGuiAvailable;
|
||||
+
|
||||
+ private Map<Class<?>, BeanInfo> beanInfoCache;
|
||||
+ private BeanInfoFinder beanInfoFinder;
|
||||
+ private PropertyEditorFinder propertyEditorFinder;
|
||||
+
|
||||
+
|
||||
+ boolean isDesignTime() {
|
||||
+ return this.isDesignTime;
|
||||
+ }
|
||||
+
|
||||
+ void setDesignTime(boolean isDesignTime) {
|
||||
+ this.isDesignTime = isDesignTime;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ boolean isGuiAvailable() {
|
||||
+ Boolean isGuiAvailable = this.isGuiAvailable;
|
||||
+ return (isGuiAvailable != null)
|
||||
+ ? isGuiAvailable.booleanValue()
|
||||
+ : !GraphicsEnvironment.isHeadless();
|
||||
+ }
|
||||
+
|
||||
+ void setGuiAvailable(boolean isGuiAvailable) {
|
||||
+ this.isGuiAvailable = Boolean.valueOf(isGuiAvailable);
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ BeanInfo getBeanInfo(Class<?> type) {
|
||||
+ return (this.beanInfoCache != null)
|
||||
+ ? this.beanInfoCache.get(type)
|
||||
+ : null;
|
||||
+ }
|
||||
+
|
||||
+ BeanInfo putBeanInfo(Class<?> type, BeanInfo info) {
|
||||
+ if (this.beanInfoCache == null) {
|
||||
+ this.beanInfoCache = new WeakHashMap<>();
|
||||
+ }
|
||||
+ return this.beanInfoCache.put(type, info);
|
||||
+ }
|
||||
+
|
||||
+ void removeBeanInfo(Class<?> type) {
|
||||
+ if (this.beanInfoCache != null) {
|
||||
+ this.beanInfoCache.remove(type);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ void clearBeanInfoCache() {
|
||||
+ if (this.beanInfoCache != null) {
|
||||
+ this.beanInfoCache.clear();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ synchronized BeanInfoFinder getBeanInfoFinder() {
|
||||
+ if (this.beanInfoFinder == null) {
|
||||
+ this.beanInfoFinder = new BeanInfoFinder();
|
||||
+ }
|
||||
+ return this.beanInfoFinder;
|
||||
+ }
|
||||
+
|
||||
+ synchronized PropertyEditorFinder getPropertyEditorFinder() {
|
||||
+ if (this.propertyEditorFinder == null) {
|
||||
+ this.propertyEditorFinder = new PropertyEditorFinder();
|
||||
+ }
|
||||
+ return this.propertyEditorFinder;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/test/java/beans/Beans/6669869/TestDesignTime.java b/test/java/beans/Beans/6669869/TestDesignTime.java
|
||||
--- jdk/test/java/beans/Beans/6669869/TestDesignTime.java
|
||||
+++ jdk/test/java/beans/Beans/6669869/TestDesignTime.java
|
||||
@@ -29,7 +29,6 @@
|
||||
*/
|
||||
|
||||
import java.beans.Beans;
|
||||
-import sun.awt.SunToolkit;
|
||||
|
||||
public class TestDesignTime implements Runnable {
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
@@ -44,7 +43,6 @@
|
||||
}
|
||||
|
||||
public void run() {
|
||||
- SunToolkit.createNewAppContext();
|
||||
if (Beans.isDesignTime()) {
|
||||
throw new Error("shared DesignTime property");
|
||||
}
|
||||
diff --git a/test/java/beans/Beans/6669869/TestGuiAvailable.java b/test/java/beans/Beans/6669869/TestGuiAvailable.java
|
||||
--- jdk/test/java/beans/Beans/6669869/TestGuiAvailable.java
|
||||
+++ jdk/test/java/beans/Beans/6669869/TestGuiAvailable.java
|
||||
@@ -30,7 +30,6 @@
|
||||
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.beans.Beans;
|
||||
-import sun.awt.SunToolkit;
|
||||
|
||||
public class TestGuiAvailable implements Runnable {
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
@@ -45,7 +44,6 @@
|
||||
}
|
||||
|
||||
public void run() {
|
||||
- SunToolkit.createNewAppContext();
|
||||
if (Beans.isGuiAvailable() == GraphicsEnvironment.isHeadless()) {
|
||||
throw new Error("shared GuiAvailable property");
|
||||
}
|
||||
diff --git a/test/java/beans/Introspector/7064279/Test7064279.java b/test/java/beans/Introspector/7064279/Test7064279.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ jdk/test/java/beans/Introspector/7064279/Test7064279.java
|
||||
@@ -0,0 +1,75 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ * This code is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
+ * or visit www.oracle.com if you need additional information or have any
|
||||
+ * questions.
|
||||
+ */
|
||||
+
|
||||
+/*
|
||||
+ * @test
|
||||
+ * @bug 7064279
|
||||
+ * @summary Tests that Introspector does not have strong references to context class loader
|
||||
+ * @author Sergey Malenkov
|
||||
+ */
|
||||
+
|
||||
+import java.beans.Introspector;
|
||||
+import java.io.File;
|
||||
+import java.lang.ref.WeakReference;
|
||||
+import java.net.URL;
|
||||
+import java.net.URLClassLoader;
|
||||
+
|
||||
+public class Test7064279 {
|
||||
+
|
||||
+ public static void main(String[] args) throws Exception {
|
||||
+ WeakReference ref = new WeakReference(test("test.jar", "test.Test"));
|
||||
+ try {
|
||||
+ int[] array = new int[1024];
|
||||
+ while (true) {
|
||||
+ array = new int[array.length << 1];
|
||||
+ }
|
||||
+ }
|
||||
+ catch (OutOfMemoryError error) {
|
||||
+ System.gc();
|
||||
+ }
|
||||
+ if (null != ref.get()) {
|
||||
+ throw new Error("ClassLoader is not released");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static Object test(String jarName, String className) throws Exception {
|
||||
+ StringBuilder sb = new StringBuilder(256);
|
||||
+ sb.append("file:");
|
||||
+ sb.append(System.getProperty("test.src", "."));
|
||||
+ sb.append(File.separatorChar);
|
||||
+ sb.append(jarName);
|
||||
+
|
||||
+ ClassLoader newLoader = new URLClassLoader(new URL[] { new URL(sb.toString()) });
|
||||
+ ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
|
||||
+
|
||||
+ Thread.currentThread().setContextClassLoader(newLoader);
|
||||
+ test(newLoader.loadClass(className));
|
||||
+ Thread.currentThread().setContextClassLoader(oldLoader);
|
||||
+
|
||||
+ return newLoader;
|
||||
+ }
|
||||
+
|
||||
+ private static void test(Class type) throws Exception {
|
||||
+ Introspector.getBeanInfo(type);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/test/java/beans/Introspector/Test6660539.java b/test/java/beans/Introspector/Test6660539.java
|
||||
--- jdk/test/java/beans/Introspector/Test6660539.java
|
||||
+++ jdk/test/java/beans/Introspector/Test6660539.java
|
||||
@@ -28,8 +28,6 @@
|
||||
* @author Sergey Malenkov
|
||||
*/
|
||||
|
||||
-import sun.awt.SunToolkit;
|
||||
-
|
||||
import java.beans.BeanInfo;
|
||||
import java.beans.IntrospectionException;
|
||||
import java.beans.Introspector;
|
||||
@@ -49,7 +47,6 @@
|
||||
}
|
||||
|
||||
public void run() {
|
||||
- SunToolkit.createNewAppContext();
|
||||
for (PropertyDescriptor pd : getPropertyDescriptors()) {
|
||||
if (pd.getDisplayName().equals(NAME))
|
||||
throw new Error("shared BeanInfo cache");
|
@ -1,299 +0,0 @@
|
||||
--- /dev/null 2013-04-25 14:11:00.000000000 -0400
|
||||
+++ jaxp/patches/jaxp_src/7133220-factory_finder_parser_transform_useBSClassLoader.patch 2013-04-25 14:19:44.000000000 -0400
|
||||
@@ -0,0 +1,296 @@
|
||||
+--- src/javax/xml/parsers/FactoryFinder.java 2013-04-22 12:37:39.305820912 -0400
|
||||
++++ src/javax/xml/parsers/FactoryFinder.java 2013-04-22 12:28:52.947388255 -0400
|
||||
+@@ -25,15 +25,12 @@
|
||||
+
|
||||
+ package javax.xml.parsers;
|
||||
+
|
||||
+-import java.io.File;
|
||||
+-import java.io.FileInputStream;
|
||||
+-
|
||||
+-import java.util.Properties;
|
||||
+ import java.io.BufferedReader;
|
||||
++import java.io.File;
|
||||
+ import java.io.IOException;
|
||||
+ import java.io.InputStream;
|
||||
+ import java.io.InputStreamReader;
|
||||
+-import java.net.URL;
|
||||
++import java.util.Properties;
|
||||
+
|
||||
+ /**
|
||||
+ * <p>Implements pluggable Datatypes.</p>
|
||||
+@@ -42,6 +39,7 @@
|
||||
+ * sync. It is package private for secure class loading.</p>
|
||||
+ *
|
||||
+ * @author Santiago.PericasGeertsen@sun.com
|
||||
++ * @author Huizhe.Wang@oracle.com
|
||||
+ */
|
||||
+ class FactoryFinder {
|
||||
+
|
||||
+@@ -95,18 +93,24 @@
|
||||
+ * If the class loader supplied is <code>null</code>, first try using the
|
||||
+ * context class loader followed by the current (i.e. bootstrap) class
|
||||
+ * loader.
|
||||
++ *
|
||||
++ * Use bootstrap classLoader if cl = null and useBSClsLoader is true
|
||||
+ */
|
||||
+ static private Class getProviderClass(String className, ClassLoader cl,
|
||||
+- boolean doFallback) throws ClassNotFoundException
|
||||
++ boolean doFallback, boolean useBSClsLoader) throws ClassNotFoundException
|
||||
+ {
|
||||
+ try {
|
||||
+ if (cl == null) {
|
||||
+- cl = ss.getContextClassLoader();
|
||||
+- if (cl == null) {
|
||||
+- throw new ClassNotFoundException();
|
||||
+- }
|
||||
+- else {
|
||||
+- return cl.loadClass(className);
|
||||
++ if (useBSClsLoader) {
|
||||
++ return Class.forName(className, true, FactoryFinder.class.getClassLoader());
|
||||
++ } else {
|
||||
++ cl = ss.getContextClassLoader();
|
||||
++ if (cl == null) {
|
||||
++ throw new ClassNotFoundException();
|
||||
++ }
|
||||
++ else {
|
||||
++ return cl.loadClass(className);
|
||||
++ }
|
||||
+ }
|
||||
+ }
|
||||
+ else {
|
||||
+@@ -131,8 +135,8 @@
|
||||
+ * @param className Name of the concrete class corresponding to the
|
||||
+ * service provider
|
||||
+ *
|
||||
+- * @param cl ClassLoader to use to load the class, null means to use
|
||||
+- * the bootstrap ClassLoader
|
||||
++ * @param cl <code>ClassLoader</code> used to load the factory class. If <code>null</code>
|
||||
++ * current <code>Thread</code>'s context classLoader is used to load the factory class.
|
||||
+ *
|
||||
+ * @param doFallback True if the current ClassLoader should be tried as
|
||||
+ * a fallback if the class is not found using cl
|
||||
+@@ -140,8 +144,30 @@
|
||||
+ static Object newInstance(String className, ClassLoader cl, boolean doFallback)
|
||||
+ throws ConfigurationError
|
||||
+ {
|
||||
++ return newInstance(className, cl, doFallback, false);
|
||||
++ }
|
||||
++
|
||||
++ /**
|
||||
++ * Create an instance of a class. Delegates to method
|
||||
++ * <code>getProviderClass()</code> in order to load the class.
|
||||
++ *
|
||||
++ * @param className Name of the concrete class corresponding to the
|
||||
++ * service provider
|
||||
++ *
|
||||
++ * @param cl <code>ClassLoader</code> used to load the factory class. If <code>null</code>
|
||||
++ * current <code>Thread</code>'s context classLoader is used to load the factory class.
|
||||
++ *
|
||||
++ * @param doFallback True if the current ClassLoader should be tried as
|
||||
++ * a fallback if the class is not found using cl
|
||||
++ *
|
||||
++ * @param useBSClsLoader True if cl=null actually meant bootstrap classLoader. This parameter
|
||||
++ * is needed since DocumentBuilderFactory/SAXParserFactory defined null as context classLoader.
|
||||
++ */
|
||||
++ static Object newInstance(String className, ClassLoader cl, boolean doFallback, boolean useBSClsLoader)
|
||||
++ throws ConfigurationError
|
||||
++ {
|
||||
+ try {
|
||||
+- Class providerClass = getProviderClass(className, cl, doFallback);
|
||||
++ Class providerClass = getProviderClass(className, cl, doFallback, useBSClsLoader);
|
||||
+ Object instance = providerClass.newInstance();
|
||||
+ if (debug) { // Extra check to avoid computing cl strings
|
||||
+ dPrint("created new instance of " + providerClass +
|
||||
+@@ -244,6 +270,7 @@
|
||||
+
|
||||
+ // First try the Context ClassLoader
|
||||
+ ClassLoader cl = ss.getContextClassLoader();
|
||||
++ boolean useBSClsLoader = false;
|
||||
+ if (cl != null) {
|
||||
+ is = ss.getResourceAsStream(cl, serviceId);
|
||||
+
|
||||
+@@ -251,11 +278,13 @@
|
||||
+ if (is == null) {
|
||||
+ cl = FactoryFinder.class.getClassLoader();
|
||||
+ is = ss.getResourceAsStream(cl, serviceId);
|
||||
++ useBSClsLoader = true;
|
||||
+ }
|
||||
+ } else {
|
||||
+ // No Context ClassLoader, try the current ClassLoader
|
||||
+ cl = FactoryFinder.class.getClassLoader();
|
||||
+ is = ss.getResourceAsStream(cl, serviceId);
|
||||
++ useBSClsLoader = true;
|
||||
+ }
|
||||
+
|
||||
+ if (is == null) {
|
||||
+@@ -293,7 +322,7 @@
|
||||
+ // ClassLoader because we want to avoid the case where the
|
||||
+ // resource file was found using one ClassLoader and the
|
||||
+ // provider class was instantiated using a different one.
|
||||
+- return newInstance(factoryClassName, cl, false);
|
||||
++ return newInstance(factoryClassName, cl, false, useBSClsLoader);
|
||||
+ }
|
||||
+
|
||||
+ // No provider found
|
||||
+--- src/javax/xml/transform/FactoryFinder.java 2013-04-22 12:37:39.312820966 -0400
|
||||
++++ src/javax/xml/transform/FactoryFinder.java 2013-04-22 12:35:08.715478293 -0400
|
||||
+@@ -25,15 +25,12 @@
|
||||
+
|
||||
+ package javax.xml.transform;
|
||||
+
|
||||
+-import java.io.File;
|
||||
+-import java.io.FileInputStream;
|
||||
+-
|
||||
+-import java.util.Properties;
|
||||
+ import java.io.BufferedReader;
|
||||
++import java.io.File;
|
||||
+ import java.io.IOException;
|
||||
+ import java.io.InputStream;
|
||||
+ import java.io.InputStreamReader;
|
||||
+-import java.net.URL;
|
||||
++import java.util.Properties;
|
||||
+
|
||||
+ /**
|
||||
+ * <p>Implements pluggable Datatypes.</p>
|
||||
+@@ -42,6 +39,7 @@
|
||||
+ * sync. It is package private for secure class loading.</p>
|
||||
+ *
|
||||
+ * @author Santiago.PericasGeertsen@sun.com
|
||||
++ * @author Huizhe.Wang@oracle.com
|
||||
+ */
|
||||
+ class FactoryFinder {
|
||||
+
|
||||
+@@ -95,18 +93,24 @@
|
||||
+ * If the class loader supplied is <code>null</code>, first try using the
|
||||
+ * context class loader followed by the current (i.e. bootstrap) class
|
||||
+ * loader.
|
||||
++ *
|
||||
++ * Use bootstrap classLoader if cl = null and useBSClsLoader is true
|
||||
+ */
|
||||
+ static private Class getProviderClass(String className, ClassLoader cl,
|
||||
+- boolean doFallback) throws ClassNotFoundException
|
||||
++ boolean doFallback, boolean useBSClsLoader) throws ClassNotFoundException
|
||||
+ {
|
||||
+ try {
|
||||
+ if (cl == null) {
|
||||
+- cl = ss.getContextClassLoader();
|
||||
+- if (cl == null) {
|
||||
+- throw new ClassNotFoundException();
|
||||
+- }
|
||||
+- else {
|
||||
+- return cl.loadClass(className);
|
||||
++ if (useBSClsLoader) {
|
||||
++ return Class.forName(className, true, FactoryFinder.class.getClassLoader());
|
||||
++ } else {
|
||||
++ cl = ss.getContextClassLoader();
|
||||
++ if (cl == null) {
|
||||
++ throw new ClassNotFoundException();
|
||||
++ }
|
||||
++ else {
|
||||
++ return cl.loadClass(className);
|
||||
++ }
|
||||
+ }
|
||||
+ }
|
||||
+ else {
|
||||
+@@ -131,8 +135,8 @@
|
||||
+ * @param className Name of the concrete class corresponding to the
|
||||
+ * service provider
|
||||
+ *
|
||||
+- * @param cl ClassLoader to use to load the class, null means to use
|
||||
+- * the bootstrap ClassLoader
|
||||
++ * @param cl <code>ClassLoader</code> used to load the factory class. If <code>null</code>
|
||||
++ * current <code>Thread</code>'s context classLoader is used to load the factory class.
|
||||
+ *
|
||||
+ * @param doFallback True if the current ClassLoader should be tried as
|
||||
+ * a fallback if the class is not found using cl
|
||||
+@@ -140,8 +144,30 @@
|
||||
+ static Object newInstance(String className, ClassLoader cl, boolean doFallback)
|
||||
+ throws ConfigurationError
|
||||
+ {
|
||||
++ return newInstance(className, cl, doFallback, false);
|
||||
++ }
|
||||
++
|
||||
++ /**
|
||||
++ * Create an instance of a class. Delegates to method
|
||||
++ * <code>getProviderClass()</code> in order to load the class.
|
||||
++ *
|
||||
++ * @param className Name of the concrete class corresponding to the
|
||||
++ * service provider
|
||||
++ *
|
||||
++ * @param cl <code>ClassLoader</code> used to load the factory class. If <code>null</code>
|
||||
++ * current <code>Thread</code>'s context classLoader is used to load the factory class.
|
||||
++ *
|
||||
++ * @param doFallback True if the current ClassLoader should be tried as
|
||||
++ * a fallback if the class is not found using cl
|
||||
++ *
|
||||
++ * @param useBSClsLoader True if cl=null actually meant bootstrap classLoader. This parameter
|
||||
++ * is needed since DocumentBuilderFactory/SAXParserFactory defined null as context classLoader.
|
||||
++ */
|
||||
++ static Object newInstance(String className, ClassLoader cl, boolean doFallback, boolean useBSClsLoader)
|
||||
++ throws ConfigurationError
|
||||
++ {
|
||||
+ try {
|
||||
+- Class providerClass = getProviderClass(className, cl, doFallback);
|
||||
++ Class providerClass = getProviderClass(className, cl, doFallback, useBSClsLoader);
|
||||
+ Object instance = providerClass.newInstance();
|
||||
+ if (debug) { // Extra check to avoid computing cl strings
|
||||
+ dPrint("created new instance of " + providerClass +
|
||||
+@@ -182,7 +208,7 @@
|
||||
+ String systemProp = ss.getSystemProperty(factoryId);
|
||||
+ if (systemProp != null) {
|
||||
+ dPrint("found system property, value=" + systemProp);
|
||||
+- return newInstance(systemProp, null, true);
|
||||
++ return newInstance(systemProp, null, true, false);
|
||||
+ }
|
||||
+ }
|
||||
+ catch (SecurityException se) {
|
||||
+@@ -210,7 +236,7 @@
|
||||
+
|
||||
+ if (factoryClassName != null) {
|
||||
+ dPrint("found in $java.home/jaxp.properties, value=" + factoryClassName);
|
||||
+- return newInstance(factoryClassName, null, true);
|
||||
++ return newInstance(factoryClassName, null, true, false);
|
||||
+ }
|
||||
+ }
|
||||
+ catch (Exception ex) {
|
||||
+@@ -228,7 +254,7 @@
|
||||
+ }
|
||||
+
|
||||
+ dPrint("loaded from fallback value: " + fallbackClassName);
|
||||
+- return newInstance(fallbackClassName, null, true);
|
||||
++ return newInstance(fallbackClassName, null, true, false);
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+@@ -244,6 +270,7 @@
|
||||
+
|
||||
+ // First try the Context ClassLoader
|
||||
+ ClassLoader cl = ss.getContextClassLoader();
|
||||
++ boolean useBSClsLoader = false;
|
||||
+ if (cl != null) {
|
||||
+ is = ss.getResourceAsStream(cl, serviceId);
|
||||
+
|
||||
+@@ -251,11 +278,13 @@
|
||||
+ if (is == null) {
|
||||
+ cl = FactoryFinder.class.getClassLoader();
|
||||
+ is = ss.getResourceAsStream(cl, serviceId);
|
||||
+- }
|
||||
++ useBSClsLoader = true;
|
||||
++ }
|
||||
+ } else {
|
||||
+ // No Context ClassLoader, try the current ClassLoader
|
||||
+ cl = FactoryFinder.class.getClassLoader();
|
||||
+ is = ss.getResourceAsStream(cl, serviceId);
|
||||
++ useBSClsLoader = true;
|
||||
+ }
|
||||
+
|
||||
+ if (is == null) {
|
||||
+@@ -293,7 +322,7 @@
|
||||
+ // ClassLoader because we want to avoid the case where the
|
||||
+ // resource file was found using one ClassLoader and the
|
||||
+ // provider class was instantiated using a different one.
|
||||
+- return newInstance(factoryClassName, cl, false);
|
||||
++ return newInstance(factoryClassName, cl, false, useBSClsLoader);
|
||||
+ }
|
||||
+
|
||||
+ // No provider found
|
@ -1,86 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User andrew
|
||||
# Date 1371053674 -3600
|
||||
# Node ID 2ae6d8da293f30c94c9478a6634c7a480328c5c5
|
||||
# Parent 18416c18dc35344d89a3a997420a65c996e5e906
|
||||
7195301: XML Signature DOM implementation should not use instanceof to determine type of Node
|
||||
Reviewed-by: mullan
|
||||
|
||||
diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/Init.java b/src/share/classes/com/sun/org/apache/xml/internal/security/Init.java
|
||||
--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/Init.java
|
||||
+++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/Init.java
|
||||
@@ -158,7 +158,7 @@
|
||||
}
|
||||
}
|
||||
for (Node el=config.getFirstChild();el!=null;el=el.getNextSibling()) {
|
||||
- if (!(el instanceof Element)) {
|
||||
+ if (el.getNodeType() != Node.ELEMENT_NODE) {
|
||||
continue;
|
||||
}
|
||||
String tag=el.getLocalName();
|
||||
diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/CanonicalizerBase.java b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/CanonicalizerBase.java
|
||||
--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/CanonicalizerBase.java
|
||||
+++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/CanonicalizerBase.java
|
||||
@@ -187,7 +187,7 @@
|
||||
this._excludeNode = excludeNode;
|
||||
try {
|
||||
NameSpaceSymbTable ns=new NameSpaceSymbTable();
|
||||
- if (rootNode instanceof Element) {
|
||||
+ if (rootNode != null && rootNode.getNodeType() == Node.ELEMENT_NODE) {
|
||||
//Fills the nssymbtable with the definitions of the parent of the root subnode
|
||||
getParentNameSpaces((Element)rootNode,ns);
|
||||
}
|
||||
@@ -306,7 +306,7 @@
|
||||
return;
|
||||
sibling=parentNode.getNextSibling();
|
||||
parentNode=parentNode.getParentNode();
|
||||
- if (!(parentNode instanceof Element)) {
|
||||
+ if (parentNode !=null && parentNode.getNodeType() != Node.ELEMENT_NODE) {
|
||||
parentNode=null;
|
||||
}
|
||||
}
|
||||
@@ -509,7 +509,7 @@
|
||||
return;
|
||||
sibling=parentNode.getNextSibling();
|
||||
parentNode=parentNode.getParentNode();
|
||||
- if (!(parentNode instanceof Element)) {
|
||||
+ if (parentNode != null && parentNode.getNodeType() != Node.ELEMENT_NODE) {
|
||||
parentNode=null;
|
||||
}
|
||||
}
|
||||
@@ -541,18 +541,14 @@
|
||||
final static void getParentNameSpaces(Element el,NameSpaceSymbTable ns) {
|
||||
List parents=new ArrayList();
|
||||
Node n1=el.getParentNode();
|
||||
- if (!(n1 instanceof Element)) {
|
||||
+ if (n1 == null || n1.getNodeType() != Node.ELEMENT_NODE) {
|
||||
return;
|
||||
}
|
||||
//Obtain all the parents of the elemnt
|
||||
- Element parent=(Element) el.getParentNode();
|
||||
- while (parent!=null) {
|
||||
- parents.add(parent);
|
||||
- Node n=parent.getParentNode();
|
||||
- if (!(n instanceof Element )) {
|
||||
- break;
|
||||
- }
|
||||
- parent=(Element)n;
|
||||
+ Node parent = n1;
|
||||
+ while (parent!=null && parent.getNodeType() == Node.ELEMENT_NODE) {
|
||||
+ parents.add((Element)parent);
|
||||
+ parent = parent.getParentNode();
|
||||
}
|
||||
//Visit them in reverse order.
|
||||
ListIterator it=parents.listIterator(parents.size());
|
||||
diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/XMLCipher.java b/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/XMLCipher.java
|
||||
--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/XMLCipher.java
|
||||
+++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/XMLCipher.java
|
||||
@@ -1523,7 +1523,7 @@
|
||||
// The de-serialiser returns a fragment whose children we need to
|
||||
// take on.
|
||||
|
||||
- if (sourceParent instanceof Document) {
|
||||
+ if (sourceParent != null && sourceParent.getNodeType() == Node.DOCUMENT_NODE) {
|
||||
|
||||
// If this is a content decryption, this may have problems
|
||||
|
@ -1,33 +0,0 @@
|
||||
--- hotspot/src/share/vm/memory/blockOffsetTable.hpp 2012-09-13 21:22:37.897456500 +0200
|
||||
+++ hotspot/src/share/vm/memory/blockOffsetTable.hpp 2012-09-13 21:22:34.345253300 +0200
|
||||
@@ -285,7 +285,7 @@
|
||||
};
|
||||
|
||||
static size_t power_to_cards_back(uint i) {
|
||||
- return (size_t)(1 << (LogBase * i));
|
||||
+ return (size_t)1 << (LogBase * i);
|
||||
}
|
||||
static size_t power_to_words_back(uint i) {
|
||||
return power_to_cards_back(i) * N_words;
|
||||
--- hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp 2012-09-13 21:22:37.901456800 +0200
|
||||
+++ hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp 2012-09-13 21:22:34.354253900 +0200
|
||||
@@ -110,7 +110,7 @@
|
||||
#ifndef PRODUCT
|
||||
bool CMBitMapRO::covers(ReservedSpace rs) const {
|
||||
// assert(_bm.map() == _virtual_space.low(), "map inconsistency");
|
||||
- assert(((size_t)_bm.size() * (size_t)(1 << _shifter)) == _bmWordSize,
|
||||
+ assert(((size_t)_bm.size() * ((size_t)1 << _shifter)) == _bmWordSize,
|
||||
"size inconsistency");
|
||||
return _bmStartWord == (HeapWord*)(rs.base()) &&
|
||||
_bmWordSize == rs.size()>>LogHeapWordSize;
|
||||
--- hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp 2012-09-13 21:22:37.898456600 +0200
|
||||
+++ hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp 2012-09-13 21:22:34.346253400 +0200
|
||||
@@ -273,7 +273,7 @@
|
||||
if (_max_fine_entries == 0) {
|
||||
assert(_mod_max_fine_entries_mask == 0, "Both or none.");
|
||||
size_t max_entries_log = (size_t)log2_long((jlong)G1RSetRegionEntries);
|
||||
- _max_fine_entries = (size_t)(1 << max_entries_log);
|
||||
+ _max_fine_entries = (size_t)1 << max_entries_log;
|
||||
_mod_max_fine_entries_mask = _max_fine_entries - 1;
|
||||
|
||||
assert(_fine_eviction_sample_size == 0
|
@ -1,75 +0,0 @@
|
||||
diff -Nru openjdk.orig/jdk/src/share/lib/security/java.security openjdk/jdk/src/share/lib/security/java.security
|
||||
--- jdk/src/share/lib/security/java.security 2013-04-16 14:23:48.623949921 +0100
|
||||
+++ jdk/src/share/lib/security/java.security 2013-04-16 14:26:07.318184299 +0100
|
||||
@@ -128,7 +128,9 @@
|
||||
# corresponding RuntimePermission ("accessClassInPackage."+package) has
|
||||
# been granted.
|
||||
package.access=sun.,\
|
||||
- com.sun.xml.internal.,\
|
||||
+ com.sun.xml.internal.bind.,\
|
||||
+ com.sun.xml.internal.org.jvnet.staxex.,\
|
||||
+ com.sun.xml.internal.ws.,\
|
||||
com.sun.imageio.,\
|
||||
com.sun.istack.internal.,\
|
||||
com.sun.jmx.
|
||||
@@ -144,7 +146,9 @@
|
||||
# checkPackageDefinition.
|
||||
#
|
||||
package.definition=sun.,\
|
||||
- com.sun.xml.internal.,\
|
||||
+ com.sun.xml.internal.bind.,\
|
||||
+ com.sun.xml.internal.org.jvnet.staxex.,\
|
||||
+ com.sun.xml.internal.ws.,\
|
||||
com.sun.imageio.,\
|
||||
com.sun.istack.internal.,\
|
||||
com.sun.jmx.
|
||||
diff -Nru openjdk.orig/jdk/src/share/lib/security/java.security-solaris openjdk/jdk/src/share/lib/security/java.security-solaris
|
||||
--- jdk/src/share/lib/security/java.security-solaris 2013-04-16 14:23:48.623949921 +0100
|
||||
+++ jdk/src/share/lib/security/java.security-solaris 2013-04-16 14:26:30.082551058 +0100
|
||||
@@ -129,7 +129,9 @@
|
||||
# corresponding RuntimePermission ("accessClassInPackage."+package) has
|
||||
# been granted.
|
||||
package.access=sun.,\
|
||||
- com.sun.xml.internal.,\
|
||||
+ com.sun.xml.internal.bind.,\
|
||||
+ com.sun.xml.internal.org.jvnet.staxex.,\
|
||||
+ com.sun.xml.internal.ws.,\
|
||||
com.sun.imageio.
|
||||
com.sun.istack.internal.,\
|
||||
com.sun.jmx.
|
||||
@@ -145,7 +147,9 @@
|
||||
# checkPackageDefinition.
|
||||
#
|
||||
package.definition=sun.,\
|
||||
- com.sun.xml.internal.,\
|
||||
+ com.sun.xml.internal.bind.,\
|
||||
+ com.sun.xml.internal.org.jvnet.staxex.,\
|
||||
+ com.sun.xml.internal.ws.,\
|
||||
com.sun.imageio.
|
||||
com.sun.istack.internal.,\
|
||||
com.sun.jmx.
|
||||
diff -Nru openjdk.orig/jdk/src/share/lib/security/java.security-windows openjdk/jdk/src/share/lib/security/java.security-windows
|
||||
--- jdk/src/share/lib/security/java.security-windows 2013-04-16 14:23:48.623949921 +0100
|
||||
+++ jdk/src/share/lib/security/java.security-windows 2013-04-16 14:26:51.170890824 +0100
|
||||
@@ -129,7 +129,9 @@
|
||||
# corresponding RuntimePermission ("accessClassInPackage."+package) has
|
||||
# been granted.
|
||||
package.access=sun.,\
|
||||
- com.sun.xml.internal.,\
|
||||
+ com.sun.xml.internal.bind.,\
|
||||
+ com.sun.xml.internal.org.jvnet.staxex.,\
|
||||
+ com.sun.xml.internal.ws.,\
|
||||
com.sun.imageio.
|
||||
com.sun.istack.internal.,\
|
||||
com.sun.jmx.
|
||||
@@ -145,7 +147,9 @@
|
||||
# checkPackageDefinition.
|
||||
#
|
||||
package.definition=sun.,\
|
||||
- com.sun.xml.internal.,\
|
||||
+ com.sun.xml.internal.bind.,\
|
||||
+ com.sun.xml.internal.org.jvnet.staxex.,\
|
||||
+ com.sun.xml.internal.ws.,\
|
||||
com.sun.imageio.
|
||||
com.sun.istack.internal.,\
|
||||
com.sun.jmx.
|
@ -1,18 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User andrew
|
||||
# Date 1360590852 0
|
||||
# Node ID 892e940d9996b09c01796de27fd57225faf8be0a
|
||||
# Parent c6058fa2a9824f71e06ca214aa8ec54400b56cc4
|
||||
8004341: Two JCK tests fails with 7u11 b06
|
||||
|
||||
diff --git a/src/share/classes/java/awt/Dialog.java b/src/share/classes/java/awt/Dialog.java
|
||||
--- jdk/src/share/classes/java/awt/Dialog.java
|
||||
+++ jdk/src/share/classes/java/awt/Dialog.java
|
||||
@@ -1643,7 +1643,6 @@
|
||||
this.resizable = fields.get("resizable", true);
|
||||
this.undecorated = fields.get("undecorated", false);
|
||||
this.title = (String)fields.get("title", "");
|
||||
- this.modalityType = localModalityType;
|
||||
|
||||
blockedWindows = new IdentityArrayList();
|
||||
|
@ -1,19 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User andrew
|
||||
# Date 1360323180 0
|
||||
# Node ID ca6ee539c5f4f4dd9d5fb9b0604d94c5806c3e28
|
||||
# Parent 635d562a25becae602dc5988dae8bce84b199eb4
|
||||
8004341: Two JCK tests fails with 7u11 b06
|
||||
|
||||
diff --git a/src/share/classes/java/awt/Dialog.java b/src/share/classes/java/awt/Dialog.java
|
||||
--- jdk/src/share/classes/java/awt/Dialog.java
|
||||
+++ jdk/src/share/classes/java/awt/Dialog.java
|
||||
@@ -1636,6 +1636,8 @@
|
||||
if (localModalityType == null) {
|
||||
this.modal = fields.get("modal", false);
|
||||
setModal(modal);
|
||||
+ } else {
|
||||
+ this.modalityType = localModalityType;
|
||||
}
|
||||
|
||||
this.resizable = fields.get("resizable", true);
|
@ -1,542 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User coffeys
|
||||
# Date 1360107230 0
|
||||
# Node ID cff0241d217f7b463d58ddcd0add8d41de9eb280
|
||||
# Parent dabed5898de907431b524952aade46f0b6b960aa
|
||||
8005615: Java Logger fails to load tomcat logger implementation (JULI)
|
||||
Reviewed-by: mchung
|
||||
|
||||
diff --git a/src/share/classes/java/util/logging/LogManager.java b/src/share/classes/java/util/logging/LogManager.java
|
||||
--- jdk/src/share/classes/java/util/logging/LogManager.java
|
||||
+++ jdk/src/share/classes/java/util/logging/LogManager.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 2000, 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
|
||||
@@ -159,7 +159,7 @@
|
||||
|
||||
// LoggerContext for system loggers and user loggers
|
||||
private final LoggerContext systemContext = new SystemLoggerContext();
|
||||
- private final LoggerContext userContext = new UserLoggerContext();
|
||||
+ private final LoggerContext userContext = new LoggerContext();
|
||||
private Logger rootLogger;
|
||||
|
||||
// Have we done the primordial reading of the configuration file?
|
||||
@@ -197,13 +197,13 @@
|
||||
|
||||
// Create and retain Logger for the root of the namespace.
|
||||
manager.rootLogger = manager.new RootLogger();
|
||||
- manager.systemContext.addLogger(manager.rootLogger);
|
||||
- manager.userContext.addLogger(manager.rootLogger);
|
||||
+ manager.addLogger(manager.rootLogger);
|
||||
+ manager.systemContext.addLocalLogger(manager.rootLogger);
|
||||
|
||||
// Adding the global Logger. Doing so in the Logger.<clinit>
|
||||
// would deadlock with the LogManager.<clinit>.
|
||||
Logger.global.setLogManager(manager);
|
||||
- manager.systemContext.addLogger(Logger.global);
|
||||
+ manager.addLogger(Logger.global);
|
||||
|
||||
// We don't call readConfiguration() here, as we may be running
|
||||
// very early in the JVM startup sequence. Instead readConfiguration
|
||||
@@ -329,7 +329,7 @@
|
||||
|
||||
// Returns the LoggerContext for the user code (i.e. application or AppContext).
|
||||
// Loggers are isolated from each AppContext.
|
||||
- LoggerContext getUserContext() {
|
||||
+ private LoggerContext getUserContext() {
|
||||
LoggerContext context = null;
|
||||
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
@@ -350,8 +350,8 @@
|
||||
if (javaAwtAccess.isMainAppContext()) {
|
||||
context = userContext;
|
||||
} else {
|
||||
- context = new UserLoggerContext();
|
||||
- context.addLogger(manager.rootLogger);
|
||||
+ context = new LoggerContext();
|
||||
+ context.addLocalLogger(manager.rootLogger);
|
||||
}
|
||||
javaAwtAccess.put(ecx, LoggerContext.class, context);
|
||||
}
|
||||
@@ -362,10 +362,6 @@
|
||||
return context;
|
||||
}
|
||||
|
||||
- LoggerContext getSystemContext() {
|
||||
- return systemContext;
|
||||
- }
|
||||
-
|
||||
private List<LoggerContext> contexts() {
|
||||
List<LoggerContext> cxs = new ArrayList<LoggerContext>();
|
||||
cxs.add(systemContext);
|
||||
@@ -373,6 +369,58 @@
|
||||
return cxs;
|
||||
}
|
||||
|
||||
+ // Find or create a specified logger instance. If a logger has
|
||||
+ // already been created with the given name it is returned.
|
||||
+ // Otherwise a new logger instance is created and registered
|
||||
+ // in the LogManager global namespace.
|
||||
+ // This method will always return a non-null Logger object.
|
||||
+ // Synchronization is not required here. All synchronization for
|
||||
+ // adding a new Logger object is handled by addLogger().
|
||||
+ //
|
||||
+ // This method must delegate to the LogManager implementation to
|
||||
+ // add a new Logger or return the one that has been added previously
|
||||
+ // as a LogManager subclass may override the addLogger, getLogger,
|
||||
+ // readConfiguration, and other methods.
|
||||
+ Logger demandLogger(String name, String resourceBundleName) {
|
||||
+ Logger result = getLogger(name);
|
||||
+ if (result == null) {
|
||||
+ // only allocate the new logger once
|
||||
+ Logger newLogger = new Logger(name, resourceBundleName);
|
||||
+ do {
|
||||
+ if (addLogger(newLogger)) {
|
||||
+ // We successfully added the new Logger that we
|
||||
+ // created above so return it without refetching.
|
||||
+ return newLogger;
|
||||
+ }
|
||||
+
|
||||
+ // We didn't add the new Logger that we created above
|
||||
+ // because another thread added a Logger with the same
|
||||
+ // name after our null check above and before our call
|
||||
+ // to addLogger(). We have to refetch the Logger because
|
||||
+ // addLogger() returns a boolean instead of the Logger
|
||||
+ // reference itself. However, if the thread that created
|
||||
+ // the other Logger is not holding a strong reference to
|
||||
+ // the other Logger, then it is possible for the other
|
||||
+ // Logger to be GC'ed after we saw it in addLogger() and
|
||||
+ // before we can refetch it. If it has been GC'ed then
|
||||
+ // we'll just loop around and try again.
|
||||
+ result = getLogger(name);
|
||||
+ } while (result == null);
|
||||
+ }
|
||||
+ return result;
|
||||
+ }
|
||||
+
|
||||
+ Logger demandSystemLogger(String name, String resourceBundleName) {
|
||||
+ return systemContext.demandLogger(name, resourceBundleName);
|
||||
+ }
|
||||
+
|
||||
+ // LoggerContext maintains the logger namespace per context.
|
||||
+ // The default LogManager implementation has one system context and user
|
||||
+ // context. The system context is used to maintain the namespace for
|
||||
+ // all system loggers and is queried by the system code. If a system logger
|
||||
+ // doesn't exist in the user context, it'll also be added to the user context.
|
||||
+ // The user context is queried by the user code and all other loggers are
|
||||
+ // added in the user context.
|
||||
static class LoggerContext {
|
||||
// Table of named Loggers that maps names to Loggers.
|
||||
|
||||
@@ -385,6 +433,12 @@
|
||||
this.root = new LogNode(null, this);
|
||||
}
|
||||
|
||||
+ Logger demandLogger(String name, String resourceBundleName) {
|
||||
+ // a LogManager subclass may have its own implementation to add and
|
||||
+ // get a Logger. So delegate to the LogManager to do the work.
|
||||
+ return manager.demandLogger(name, resourceBundleName);
|
||||
+ }
|
||||
+
|
||||
synchronized Logger findLogger(String name) {
|
||||
LoggerWeakRef ref = namedLoggers.get(name);
|
||||
if (ref == null) {
|
||||
@@ -399,7 +453,9 @@
|
||||
return logger;
|
||||
}
|
||||
|
||||
- synchronized boolean addLogger(Logger logger) {
|
||||
+ // Add a logger to this context. This method will only set its level
|
||||
+ // and process parent loggers. It doesn't set its handlers.
|
||||
+ synchronized boolean addLocalLogger(Logger logger) {
|
||||
final String name = logger.getName();
|
||||
if (name == null) {
|
||||
throw new NullPointerException();
|
||||
@@ -432,9 +488,6 @@
|
||||
doSetLevel(logger, level);
|
||||
}
|
||||
|
||||
- // Do we have a per logger handler too?
|
||||
- // Note: this will add a 200ms penalty
|
||||
- manager.loadLoggerHandlers(logger, name, name + ".handlers");
|
||||
processParentHandlers(logger, name);
|
||||
|
||||
// Find the new node and its parent.
|
||||
@@ -471,49 +524,21 @@
|
||||
return namedLoggers.keys();
|
||||
}
|
||||
|
||||
- Logger demandLogger(String name) {
|
||||
- return demandLogger(name, null);
|
||||
- }
|
||||
-
|
||||
- // Find or create a specified logger instance. If a logger has
|
||||
- // already been created with the given name it is returned.
|
||||
- // Otherwise a new logger instance is created and registered
|
||||
- // in the LogManager global namespace.
|
||||
- // This method will always return a non-null Logger object.
|
||||
- // Synchronization is not required here. All synchronization for
|
||||
- // adding a new Logger object is handled by addLogger().
|
||||
- Logger demandLogger(String name, String resourceBundleName) {
|
||||
- Logger result = findLogger(name);
|
||||
- if (result == null) {
|
||||
- // only allocate the new logger once
|
||||
- Logger newLogger = new Logger(name, resourceBundleName);
|
||||
- do {
|
||||
- if (addLogger(newLogger)) {
|
||||
- // We successfully added the new Logger that we
|
||||
- // created above so return it without refetching.
|
||||
- return newLogger;
|
||||
- }
|
||||
-
|
||||
- // We didn't add the new Logger that we created above
|
||||
- // because another thread added a Logger with the same
|
||||
- // name after our null check above and before our call
|
||||
- // to addLogger(). We have to refetch the Logger because
|
||||
- // addLogger() returns a boolean instead of the Logger
|
||||
- // reference itself. However, if the thread that created
|
||||
- // the other Logger is not holding a strong reference to
|
||||
- // the other Logger, then it is possible for the other
|
||||
- // Logger to be GC'ed after we saw it in addLogger() and
|
||||
- // before we can refetch it. If it has been GC'ed then
|
||||
- // we'll just loop around and try again.
|
||||
- result = findLogger(name);
|
||||
- } while (result == null);
|
||||
- }
|
||||
- return result;
|
||||
- }
|
||||
-
|
||||
// If logger.getUseParentHandlers() returns 'true' and any of the logger's
|
||||
// parents have levels or handlers defined, make sure they are instantiated.
|
||||
- private void processParentHandlers(Logger logger, String name) {
|
||||
+ private void processParentHandlers(final Logger logger, final String name) {
|
||||
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
||||
+ public Void run() {
|
||||
+ if (logger != manager.rootLogger) {
|
||||
+ boolean useParent = manager.getBooleanProperty(name + ".useParentHandlers", true);
|
||||
+ if (!useParent) {
|
||||
+ logger.setUseParentHandlers(false);
|
||||
+ }
|
||||
+ }
|
||||
+ return null;
|
||||
+ }
|
||||
+ });
|
||||
+
|
||||
int ix = 1;
|
||||
for (;;) {
|
||||
int ix2 = name.indexOf(".", ix);
|
||||
@@ -526,12 +551,12 @@
|
||||
|| manager.getProperty(pname + ".handlers") != null) {
|
||||
// This pname has a level/handlers definition.
|
||||
// Make sure it exists.
|
||||
- demandLogger(pname);
|
||||
+ demandLogger(pname, null);
|
||||
}
|
||||
ix = ix2 + 1;
|
||||
}
|
||||
}
|
||||
-
|
||||
+
|
||||
// Gets a node in our tree of logger nodes.
|
||||
// If necessary, create it.
|
||||
LogNode getNode(String name) {
|
||||
@@ -564,74 +589,55 @@
|
||||
}
|
||||
|
||||
static class SystemLoggerContext extends LoggerContext {
|
||||
- // Default resource bundle for all system loggers
|
||||
-
|
||||
- Logger demandLogger(String name) {
|
||||
- // default to use the system logger's resource bundle
|
||||
- return super.demandLogger(name, Logger.SYSTEM_LOGGER_RB_NAME);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- static class UserLoggerContext extends LoggerContext {
|
||||
-
|
||||
- /**
|
||||
- * Returns a Logger of the given name if there is one registered
|
||||
- * in this context. Otherwise, it will return the one registered
|
||||
- * in the system context if there is one. The returned Logger
|
||||
- * instance may be initialized with a different resourceBundleName.
|
||||
- * If no such logger exists, a new Logger instance will be created
|
||||
- * and registered in this context.
|
||||
- */
|
||||
+ // Add a system logger in the system context's namespace as well as
|
||||
+ // in the LogManager's namespace if not exist so that there is only
|
||||
+ // one single logger of the given name. System loggers are visible
|
||||
+ // to applications unless a logger of the same name has been added.
|
||||
Logger demandLogger(String name, String resourceBundleName) {
|
||||
Logger result = findLogger(name);
|
||||
if (result == null) {
|
||||
- // use the system logger if exists; or allocate a new logger.
|
||||
- // The system logger is added to the app logger context so that
|
||||
- // any child logger created in the app logger context can have
|
||||
- // a system logger as its parent if already exist.
|
||||
- Logger logger = manager.systemContext.findLogger(name);
|
||||
- Logger newLogger =
|
||||
- logger != null ? logger : new Logger(name, resourceBundleName);
|
||||
+ // only allocate the new system logger once
|
||||
+ Logger newLogger = new Logger(name, resourceBundleName);
|
||||
do {
|
||||
- if (addLogger(newLogger)) {
|
||||
+ if (addLocalLogger(newLogger)) {
|
||||
// We successfully added the new Logger that we
|
||||
// created above so return it without refetching.
|
||||
- return newLogger;
|
||||
+ result = newLogger;
|
||||
+ } else {
|
||||
+ // We didn't add the new Logger that we created above
|
||||
+ // because another thread added a Logger with the same
|
||||
+ // name after our null check above and before our call
|
||||
+ // to addLogger(). We have to refetch the Logger because
|
||||
+ // addLogger() returns a boolean instead of the Logger
|
||||
+ // reference itself. However, if the thread that created
|
||||
+ // the other Logger is not holding a strong reference to
|
||||
+ // the other Logger, then it is possible for the other
|
||||
+ // Logger to be GC'ed after we saw it in addLogger() and
|
||||
+ // before we can refetch it. If it has been GC'ed then
|
||||
+ // we'll just loop around and try again.
|
||||
+ result = findLogger(name);
|
||||
}
|
||||
-
|
||||
- // We didn't add the new Logger that we created above
|
||||
- // because another thread added a Logger with the same
|
||||
- // name after our null check above and before our call
|
||||
- // to addLogger(). We have to refetch the Logger because
|
||||
- // addLogger() returns a boolean instead of the Logger
|
||||
- // reference itself. However, if the thread that created
|
||||
- // the other Logger is not holding a strong reference to
|
||||
- // the other Logger, then it is possible for the other
|
||||
- // Logger to be GC'ed after we saw it in addLogger() and
|
||||
- // before we can refetch it. If it has been GC'ed then
|
||||
- // we'll just loop around and try again.
|
||||
- result = findLogger(name);
|
||||
} while (result == null);
|
||||
}
|
||||
- return result;
|
||||
+ // Add the system logger to the LogManager's namespace if not exists
|
||||
+ // The LogManager will set its handlers via the LogManager.addLogger method.
|
||||
+ if (!manager.addLogger(result) && result.getHandlers().length == 0) {
|
||||
+ // if logger already exists but handlers not set
|
||||
+ final Logger l = manager.getLogger(name);
|
||||
+ final Logger logger = result;
|
||||
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
||||
+ public Void run() {
|
||||
+ for (Handler hdl : l.getHandlers()) {
|
||||
+ logger.addHandler(hdl);
|
||||
+ }
|
||||
+ return null;
|
||||
+ }
|
||||
+ });
|
||||
+ }
|
||||
+ return result;
|
||||
}
|
||||
}
|
||||
|
||||
- // Package-level method.
|
||||
- // Find or create a specified logger instance. If a logger has
|
||||
- // already been created with the given name it is returned.
|
||||
- // Otherwise a new logger instance is created and registered
|
||||
- // in the LogManager global namespace.
|
||||
- synchronized Logger demandLogger(String name) {
|
||||
- Logger result = getLogger(name);
|
||||
- if (result == null) {
|
||||
- result = new Logger(name, null);
|
||||
- addLogger(result);
|
||||
- result = getLogger(name);
|
||||
- }
|
||||
- return result;
|
||||
- }
|
||||
-
|
||||
// Add new per logger handlers.
|
||||
// We need to raise privilege here. All our decisions will
|
||||
// be made based on the logging configuration, which can
|
||||
@@ -640,12 +646,6 @@
|
||||
final String handlersPropertyName) {
|
||||
AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
- if (logger != rootLogger) {
|
||||
- boolean useParent = getBooleanProperty(name + ".useParentHandlers", true);
|
||||
- if (!useParent) {
|
||||
- logger.setUseParentHandlers(false);
|
||||
- }
|
||||
- }
|
||||
|
||||
String names[] = parseClassNames(handlersPropertyName);
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
@@ -674,10 +674,10 @@
|
||||
}
|
||||
}
|
||||
return null;
|
||||
- }});
|
||||
+ }
|
||||
+ });
|
||||
}
|
||||
|
||||
-
|
||||
// loggerRefQueue holds LoggerWeakRef objects for Logger objects
|
||||
// that have been GC'ed.
|
||||
private final ReferenceQueue<Logger> loggerRefQueue
|
||||
@@ -815,10 +815,15 @@
|
||||
if (name == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
- if (systemContext.findLogger(name) != null) {
|
||||
+ LoggerContext cx = getUserContext();
|
||||
+ if (cx.addLocalLogger(logger)) {
|
||||
+ // Do we have a per logger handler too?
|
||||
+ // Note: this will add a 200ms penalty
|
||||
+ loadLoggerHandlers(logger, name, name + ".handlers");
|
||||
+ return true;
|
||||
+ } else {
|
||||
return false;
|
||||
}
|
||||
- return getUserContext().addLogger(logger);
|
||||
}
|
||||
|
||||
// Private method to set a level on a logger.
|
||||
@@ -839,8 +844,6 @@
|
||||
}});
|
||||
}
|
||||
|
||||
-
|
||||
-
|
||||
// Private method to set a parent on a logger.
|
||||
// If necessary, we raise privilege before doing the setParent call.
|
||||
private static void doSetParent(final Logger logger, final Logger parent) {
|
||||
@@ -875,15 +878,7 @@
|
||||
* @return matching logger or null if none is found
|
||||
*/
|
||||
public Logger getLogger(String name) {
|
||||
- // return the first logger added
|
||||
- //
|
||||
- // once a system logger is added in the system context, no one can
|
||||
- // adds a logger with the same name in the global context
|
||||
- // (see LogManager.addLogger). So if there is a logger in the global
|
||||
- // context with the same name as one in the system context, it must be
|
||||
- // added before the system logger was created.
|
||||
- Logger logger = getUserContext().findLogger(name);
|
||||
- return logger != null ? logger : systemContext.findLogger(name);
|
||||
+ return getUserContext().findLogger(name);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -903,11 +898,7 @@
|
||||
* @return enumeration of logger name strings
|
||||
*/
|
||||
public Enumeration<String> getLoggerNames() {
|
||||
- // only return unique names
|
||||
- Set<String> names =
|
||||
- new HashSet<String>(Collections.list(systemContext.getLoggerNames()));
|
||||
- names.addAll(Collections.list(getUserContext().getLoggerNames()));
|
||||
- return Collections.enumeration(names);
|
||||
+ return getUserContext().getLoggerNames();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1229,7 +1220,6 @@
|
||||
loadLoggerHandlers(rootLogger, null, "handlers");
|
||||
}
|
||||
|
||||
-
|
||||
private final Permission controlPermission = new LoggingPermission("control", null);
|
||||
|
||||
void checkPermission() {
|
||||
@@ -1288,7 +1278,6 @@
|
||||
// that we only instantiate the global handlers when they
|
||||
// are first needed.
|
||||
private class RootLogger extends Logger {
|
||||
-
|
||||
private RootLogger() {
|
||||
super("", null);
|
||||
setLevel(defaultLevel);
|
||||
diff --git a/src/share/classes/java/util/logging/Logger.java b/src/share/classes/java/util/logging/Logger.java
|
||||
--- jdk/src/share/classes/java/util/logging/Logger.java
|
||||
+++ jdk/src/share/classes/java/util/logging/Logger.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 2000, 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
|
||||
@@ -29,7 +29,6 @@
|
||||
import java.util.*;
|
||||
import java.security.*;
|
||||
import java.lang.ref.WeakReference;
|
||||
-import java.util.logging.LogManager.LoggerContext;
|
||||
|
||||
/**
|
||||
* A Logger object is used to log messages for a specific
|
||||
@@ -283,18 +282,32 @@
|
||||
//
|
||||
// As an interim solution, if the immediate caller whose caller loader is
|
||||
// null, we assume it's a system logger and add it to the system context.
|
||||
- private static LoggerContext getLoggerContext() {
|
||||
+ // These system loggers only set the resource bundle to the given
|
||||
+ // resource bundle name (rather than the default system resource bundle).
|
||||
+ private static class SystemLoggerHelper {
|
||||
+ static boolean disableCallerCheck = getBooleanProperty("sun.util.logging.disableCallerCheck");
|
||||
+ private static boolean getBooleanProperty(final String key) {
|
||||
+ String s = AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||
+ public String run() {
|
||||
+ return System.getProperty(key);
|
||||
+ }
|
||||
+ });
|
||||
+ return Boolean.valueOf(s);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static Logger demandLogger(String name, String resourceBundleName) {
|
||||
LogManager manager = LogManager.getLogManager();
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
- if (sm != null) {
|
||||
+ if (sm != null && !SystemLoggerHelper.disableCallerCheck) {
|
||||
// 0: Reflection 1: Logger.getLoggerContext 2: Logger.getLogger 3: caller
|
||||
final int SKIP_FRAMES = 3;
|
||||
Class<?> caller = sun.reflect.Reflection.getCallerClass(SKIP_FRAMES);
|
||||
if (caller.getClassLoader() == null) {
|
||||
- return manager.getSystemContext();
|
||||
+ return manager.demandSystemLogger(name, resourceBundleName);
|
||||
}
|
||||
}
|
||||
- return manager.getUserContext();
|
||||
+ return manager.demandLogger(name, resourceBundleName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -325,8 +338,7 @@
|
||||
* @throws NullPointerException if the name is null.
|
||||
*/
|
||||
public static synchronized Logger getLogger(String name) {
|
||||
- LoggerContext context = getLoggerContext();
|
||||
- return context.demandLogger(name);
|
||||
+ return demandLogger(name, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -369,8 +381,7 @@
|
||||
* @throws NullPointerException if the name is null.
|
||||
*/
|
||||
public static synchronized Logger getLogger(String name, String resourceBundleName) {
|
||||
- LoggerContext context = getLoggerContext();
|
||||
- Logger result = context.demandLogger(name, resourceBundleName);
|
||||
+ Logger result = demandLogger(name, resourceBundleName);
|
||||
if (result.resourceBundleName == null) {
|
||||
// Note: we may get a MissingResourceException here.
|
||||
result.setupResourceInfo(resourceBundleName);
|
||||
@@ -1300,7 +1311,8 @@
|
||||
public ResourceBundle run() {
|
||||
try {
|
||||
return ResourceBundle.getBundle(SYSTEM_LOGGER_RB_NAME,
|
||||
- locale);
|
||||
+ locale,
|
||||
+ ClassLoader.getSystemClassLoader());
|
||||
} catch (MissingResourceException e) {
|
||||
throw new InternalError(e.toString());
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
|
||||
# HG changeset patch
|
||||
# User coffeys
|
||||
# Date 1360860659 0
|
||||
# Node ID 828b93329939ec20530ed98f42b2966b2ea53048
|
||||
# Parent cff0241d217f7b463d58ddcd0add8d41de9eb280
|
||||
8007393: Possible race condition after JDK-6664509
|
||||
Reviewed-by: mchung
|
||||
|
||||
--- jdk/src/share/classes/java/util/logging/LogManager.java Tue Feb 05 23:33:50 2013 +0000
|
||||
+++ jdk/src/share/classes/java/util/logging/LogManager.java Thu Feb 14 16:50:59 2013 +0000
|
||||
@@ -411,7 +411,40 @@ public class LogManager {
|
||||
}
|
||||
|
||||
Logger demandSystemLogger(String name, String resourceBundleName) {
|
||||
- return systemContext.demandLogger(name, resourceBundleName);
|
||||
+ // Add a system logger in the system context's namespace
|
||||
+ final Logger sysLogger = systemContext.demandLogger(name, resourceBundleName);
|
||||
+
|
||||
+ // Add the system logger to the LogManager's namespace if not exist
|
||||
+ // so that there is only one single logger of the given name.
|
||||
+ // System loggers are visible to applications unless a logger of
|
||||
+ // the same name has been added.
|
||||
+ Logger logger;
|
||||
+ do {
|
||||
+ // First attempt to call addLogger instead of getLogger
|
||||
+ // This would avoid potential bug in custom LogManager.getLogger
|
||||
+ // implementation that adds a logger if not exists
|
||||
+ if (addLogger(sysLogger)) {
|
||||
+ // successfully added the new system logger
|
||||
+ logger = sysLogger;
|
||||
+ } else {
|
||||
+ logger = getLogger(name);
|
||||
+ }
|
||||
+ } while (logger == null);
|
||||
+
|
||||
+ // LogManager will set the sysLogger's handlers via LogManager.addLogger method.
|
||||
+ if (logger != sysLogger && sysLogger.getHandlers().length == 0) {
|
||||
+ // if logger already exists but handlers not set
|
||||
+ final Logger l = logger;
|
||||
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
||||
+ public Void run() {
|
||||
+ for (Handler hdl : l.getHandlers()) {
|
||||
+ sysLogger.addHandler(hdl);
|
||||
+ }
|
||||
+ return null;
|
||||
+ }
|
||||
+ });
|
||||
+ }
|
||||
+ return sysLogger;
|
||||
}
|
||||
|
||||
// LoggerContext maintains the logger namespace per context.
|
||||
@@ -619,22 +652,7 @@ public class LogManager {
|
||||
}
|
||||
} while (result == null);
|
||||
}
|
||||
- // Add the system logger to the LogManager's namespace if not exists
|
||||
- // The LogManager will set its handlers via the LogManager.addLogger method.
|
||||
- if (!manager.addLogger(result) && result.getHandlers().length == 0) {
|
||||
- // if logger already exists but handlers not set
|
||||
- final Logger l = manager.getLogger(name);
|
||||
- final Logger logger = result;
|
||||
- AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
||||
- public Void run() {
|
||||
- for (Handler hdl : l.getHandlers()) {
|
||||
- logger.addHandler(hdl);
|
||||
- }
|
||||
- return null;
|
||||
- }
|
||||
- });
|
||||
- }
|
||||
- return result;
|
||||
+ return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,24 +0,0 @@
|
||||
|
||||
# HG changeset patch
|
||||
# User coffeys
|
||||
# Date 1360861865 0
|
||||
# Node ID 25e83b78298b71abb46eb5a337ed7bddef418ca4
|
||||
# Parent 828b93329939ec20530ed98f42b2966b2ea53048
|
||||
8007611: logging behavior in applet changed
|
||||
Reviewed-by: mchung
|
||||
|
||||
--- jdk/src/share/classes/java/util/logging/LogManager.java Thu Feb 14 16:50:59 2013 +0000
|
||||
+++ jdk/src/share/classes/java/util/logging/LogManager.java Thu Feb 14 17:11:05 2013 +0000
|
||||
@@ -351,7 +351,10 @@ public class LogManager {
|
||||
context = userContext;
|
||||
} else {
|
||||
context = new LoggerContext();
|
||||
- context.addLocalLogger(manager.rootLogger);
|
||||
+ // during initialization, rootLogger is null when
|
||||
+ // instantiating itself RootLogger
|
||||
+ if (manager.rootLogger != null)
|
||||
+ context.addLocalLogger(manager.rootLogger);
|
||||
}
|
||||
javaAwtAccess.put(ecx, LoggerContext.class, context);
|
||||
}
|
||||
|
@ -1,519 +0,0 @@
|
||||
diff --git a/make/sun/Makefile b/make/sun/Makefile
|
||||
--- jdk/make/sun/Makefile
|
||||
+++ jdk/make/sun/Makefile
|
||||
@@ -64,7 +64,7 @@
|
||||
SUBDIRS = jar security javazic misc net audio $(RENDER_SUBDIR) image \
|
||||
awt splashscreen $(XAWT_SUBDIR) $(MOTIF_SUBDIRS) \
|
||||
$(HEADLESS_SUBDIR) $(DGA_SUBDIR) \
|
||||
- font jpeg cmm applet rmi $(JDBC_SUBDIR) \
|
||||
+ font jpeg cmm applet rmi beans $(JDBC_SUBDIR) \
|
||||
jawt text nio launcher management $(ORG_SUBDIR) \
|
||||
native2ascii serialver tools jconsole
|
||||
|
||||
diff --git a/make/sun/beans/Makefile b/make/sun/beans/Makefile
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ jdk/make/sun/beans/Makefile
|
||||
@@ -0,0 +1,43 @@
|
||||
+#
|
||||
+# Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+#
|
||||
+# This code is free software; you can redistribute it and/or modify it
|
||||
+# under the terms of the GNU General Public License version 2 only, as
|
||||
+# published by the Free Software Foundation. Oracle designates this
|
||||
+# particular file as subject to the "Classpath" exception as provided
|
||||
+# by Oracle in the LICENSE file that accompanied this code.
|
||||
+#
|
||||
+# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+# version 2 for more details (a copy is included in the LICENSE file that
|
||||
+# accompanied this code).
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License version
|
||||
+# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+#
|
||||
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
+# or visit www.oracle.com if you need additional information or have any
|
||||
+# questions.
|
||||
+#
|
||||
+
|
||||
+#
|
||||
+# Makefile for building sun.beans.*
|
||||
+#
|
||||
+
|
||||
+BUILDDIR = ../..
|
||||
+PACKAGE = sun.beans
|
||||
+PRODUCT = sun
|
||||
+include $(BUILDDIR)/common/Defs.gmk
|
||||
+
|
||||
+#
|
||||
+# Files
|
||||
+#
|
||||
+AUTO_FILES_JAVA_DIRS = sun/beans
|
||||
+
|
||||
+#
|
||||
+# Rules
|
||||
+#
|
||||
+include $(BUILDDIR)/common/Classes.gmk
|
||||
diff --git a/src/share/classes/com/sun/beans/editors/EnumEditor.java b/src/share/classes/com/sun/beans/editors/EnumEditor.java
|
||||
--- jdk/src/share/classes/com/sun/beans/editors/EnumEditor.java
|
||||
+++ jdk/src/share/classes/com/sun/beans/editors/EnumEditor.java
|
||||
@@ -42,7 +42,7 @@
|
||||
*
|
||||
* @author Sergey A. Malenkov
|
||||
*/
|
||||
-public final class EnumEditor implements PropertyEditor {
|
||||
+public class EnumEditor implements PropertyEditor {
|
||||
private final List<PropertyChangeListener> listeners = new ArrayList<PropertyChangeListener>();
|
||||
|
||||
private final Class type;
|
||||
diff --git a/src/share/classes/sun/beans/editors/BooleanEditor.java b/src/share/classes/sun/beans/editors/BooleanEditor.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ jdk/src/share/classes/sun/beans/editors/BooleanEditor.java
|
||||
@@ -0,0 +1,32 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ * This code is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation. Oracle designates this
|
||||
+ * particular file as subject to the "Classpath" exception as provided
|
||||
+ * by Oracle in the LICENSE file that accompanied this code.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
+ * or visit www.oracle.com if you need additional information or have any
|
||||
+ * questions.
|
||||
+ */
|
||||
+
|
||||
+package sun.beans.editors;
|
||||
+
|
||||
+/**
|
||||
+ * FOR BACKWARD COMPATIBILITY ONLY - DO NOT USE.
|
||||
+ */
|
||||
+public class BooleanEditor extends com.sun.beans.editors.BooleanEditor {
|
||||
+}
|
||||
diff --git a/src/share/classes/sun/beans/editors/ByteEditor.java b/src/share/classes/sun/beans/editors/ByteEditor.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ jdk/src/share/classes/sun/beans/editors/ByteEditor.java
|
||||
@@ -0,0 +1,32 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ * This code is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation. Oracle designates this
|
||||
+ * particular file as subject to the "Classpath" exception as provided
|
||||
+ * by Oracle in the LICENSE file that accompanied this code.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
+ * or visit www.oracle.com if you need additional information or have any
|
||||
+ * questions.
|
||||
+ */
|
||||
+
|
||||
+package sun.beans.editors;
|
||||
+
|
||||
+/**
|
||||
+ * FOR BACKWARD COMPATIBILITY ONLY - DO NOT USE.
|
||||
+ */
|
||||
+public class ByteEditor extends com.sun.beans.editors.ByteEditor {
|
||||
+}
|
||||
diff --git a/src/share/classes/sun/beans/editors/ColorEditor.java b/src/share/classes/sun/beans/editors/ColorEditor.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ jdk/src/share/classes/sun/beans/editors/ColorEditor.java
|
||||
@@ -0,0 +1,32 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ * This code is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation. Oracle designates this
|
||||
+ * particular file as subject to the "Classpath" exception as provided
|
||||
+ * by Oracle in the LICENSE file that accompanied this code.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
+ * or visit www.oracle.com if you need additional information or have any
|
||||
+ * questions.
|
||||
+ */
|
||||
+
|
||||
+package sun.beans.editors;
|
||||
+
|
||||
+/**
|
||||
+ * FOR BACKWARD COMPATIBILITY ONLY - DO NOT USE.
|
||||
+ */
|
||||
+public class ColorEditor extends com.sun.beans.editors.ColorEditor {
|
||||
+}
|
||||
diff --git a/src/share/classes/sun/beans/editors/DoubleEditor.java b/src/share/classes/sun/beans/editors/DoubleEditor.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ jdk/src/share/classes/sun/beans/editors/DoubleEditor.java
|
||||
@@ -0,0 +1,32 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ * This code is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation. Oracle designates this
|
||||
+ * particular file as subject to the "Classpath" exception as provided
|
||||
+ * by Oracle in the LICENSE file that accompanied this code.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
+ * or visit www.oracle.com if you need additional information or have any
|
||||
+ * questions.
|
||||
+ */
|
||||
+
|
||||
+package sun.beans.editors;
|
||||
+
|
||||
+/**
|
||||
+ * FOR BACKWARD COMPATIBILITY ONLY - DO NOT USE.
|
||||
+ */
|
||||
+public class DoubleEditor extends com.sun.beans.editors.DoubleEditor {
|
||||
+}
|
||||
diff --git a/src/share/classes/sun/beans/editors/EnumEditor.java b/src/share/classes/sun/beans/editors/EnumEditor.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ jdk/src/share/classes/sun/beans/editors/EnumEditor.java
|
||||
@@ -0,0 +1,35 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ * This code is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation. Oracle designates this
|
||||
+ * particular file as subject to the "Classpath" exception as provided
|
||||
+ * by Oracle in the LICENSE file that accompanied this code.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
+ * or visit www.oracle.com if you need additional information or have any
|
||||
+ * questions.
|
||||
+ */
|
||||
+
|
||||
+package sun.beans.editors;
|
||||
+
|
||||
+/**
|
||||
+ * FOR BACKWARD COMPATIBILITY ONLY - DO NOT USE.
|
||||
+ */
|
||||
+public class EnumEditor extends com.sun.beans.editors.EnumEditor {
|
||||
+ public EnumEditor(Class type) {
|
||||
+ super(type);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/share/classes/sun/beans/editors/FloatEditor.java b/src/share/classes/sun/beans/editors/FloatEditor.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ jdk/src/share/classes/sun/beans/editors/FloatEditor.java
|
||||
@@ -0,0 +1,32 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ * This code is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation. Oracle designates this
|
||||
+ * particular file as subject to the "Classpath" exception as provided
|
||||
+ * by Oracle in the LICENSE file that accompanied this code.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
+ * or visit www.oracle.com if you need additional information or have any
|
||||
+ * questions.
|
||||
+ */
|
||||
+
|
||||
+package sun.beans.editors;
|
||||
+
|
||||
+/**
|
||||
+ * FOR BACKWARD COMPATIBILITY ONLY - DO NOT USE.
|
||||
+ */
|
||||
+public class FloatEditor extends com.sun.beans.editors.FloatEditor {
|
||||
+}
|
||||
diff --git a/src/share/classes/sun/beans/editors/FontEditor.java b/src/share/classes/sun/beans/editors/FontEditor.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ jdk/src/share/classes/sun/beans/editors/FontEditor.java
|
||||
@@ -0,0 +1,32 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ * This code is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation. Oracle designates this
|
||||
+ * particular file as subject to the "Classpath" exception as provided
|
||||
+ * by Oracle in the LICENSE file that accompanied this code.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
+ * or visit www.oracle.com if you need additional information or have any
|
||||
+ * questions.
|
||||
+ */
|
||||
+
|
||||
+package sun.beans.editors;
|
||||
+
|
||||
+/**
|
||||
+ * FOR BACKWARD COMPATIBILITY ONLY - DO NOT USE.
|
||||
+ */
|
||||
+public class FontEditor extends com.sun.beans.editors.FontEditor {
|
||||
+}
|
||||
diff --git a/src/share/classes/sun/beans/editors/IntegerEditor.java b/src/share/classes/sun/beans/editors/IntegerEditor.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ jdk/src/share/classes/sun/beans/editors/IntegerEditor.java
|
||||
@@ -0,0 +1,32 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ * This code is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation. Oracle designates this
|
||||
+ * particular file as subject to the "Classpath" exception as provided
|
||||
+ * by Oracle in the LICENSE file that accompanied this code.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
+ * or visit www.oracle.com if you need additional information or have any
|
||||
+ * questions.
|
||||
+ */
|
||||
+
|
||||
+package sun.beans.editors;
|
||||
+
|
||||
+/**
|
||||
+ * FOR BACKWARD COMPATIBILITY ONLY - DO NOT USE.
|
||||
+ */
|
||||
+public class IntegerEditor extends com.sun.beans.editors.IntegerEditor {
|
||||
+}
|
||||
diff --git a/src/share/classes/sun/beans/editors/LongEditor.java b/src/share/classes/sun/beans/editors/LongEditor.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ jdk/src/share/classes/sun/beans/editors/LongEditor.java
|
||||
@@ -0,0 +1,32 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ * This code is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation. Oracle designates this
|
||||
+ * particular file as subject to the "Classpath" exception as provided
|
||||
+ * by Oracle in the LICENSE file that accompanied this code.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
+ * or visit www.oracle.com if you need additional information or have any
|
||||
+ * questions.
|
||||
+ */
|
||||
+
|
||||
+package sun.beans.editors;
|
||||
+
|
||||
+/**
|
||||
+ * FOR BACKWARD COMPATIBILITY ONLY - DO NOT USE.
|
||||
+ */
|
||||
+public class LongEditor extends com.sun.beans.editors.LongEditor {
|
||||
+}
|
||||
diff --git a/src/share/classes/sun/beans/editors/NumberEditor.java b/src/share/classes/sun/beans/editors/NumberEditor.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ jdk/src/share/classes/sun/beans/editors/NumberEditor.java
|
||||
@@ -0,0 +1,32 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ * This code is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation. Oracle designates this
|
||||
+ * particular file as subject to the "Classpath" exception as provided
|
||||
+ * by Oracle in the LICENSE file that accompanied this code.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
+ * or visit www.oracle.com if you need additional information or have any
|
||||
+ * questions.
|
||||
+ */
|
||||
+
|
||||
+package sun.beans.editors;
|
||||
+
|
||||
+/**
|
||||
+ * FOR BACKWARD COMPATIBILITY ONLY - DO NOT USE.
|
||||
+ */
|
||||
+abstract public class NumberEditor extends com.sun.beans.editors.NumberEditor {
|
||||
+}
|
||||
diff --git a/src/share/classes/sun/beans/editors/ShortEditor.java b/src/share/classes/sun/beans/editors/ShortEditor.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ jdk/src/share/classes/sun/beans/editors/ShortEditor.java
|
||||
@@ -0,0 +1,32 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ * This code is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation. Oracle designates this
|
||||
+ * particular file as subject to the "Classpath" exception as provided
|
||||
+ * by Oracle in the LICENSE file that accompanied this code.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
+ * or visit www.oracle.com if you need additional information or have any
|
||||
+ * questions.
|
||||
+ */
|
||||
+
|
||||
+package sun.beans.editors;
|
||||
+
|
||||
+/**
|
||||
+ * FOR BACKWARD COMPATIBILITY ONLY - DO NOT USE.
|
||||
+ */
|
||||
+public class ShortEditor extends com.sun.beans.editors.ShortEditor {
|
||||
+}
|
||||
diff --git a/src/share/classes/sun/beans/editors/StringEditor.java b/src/share/classes/sun/beans/editors/StringEditor.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ jdk/src/share/classes/sun/beans/editors/StringEditor.java
|
||||
@@ -0,0 +1,32 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ * This code is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation. Oracle designates this
|
||||
+ * particular file as subject to the "Classpath" exception as provided
|
||||
+ * by Oracle in the LICENSE file that accompanied this code.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
+ * or visit www.oracle.com if you need additional information or have any
|
||||
+ * questions.
|
||||
+ */
|
||||
+
|
||||
+package sun.beans.editors;
|
||||
+
|
||||
+/**
|
||||
+ * FOR BACKWARD COMPATIBILITY ONLY - DO NOT USE.
|
||||
+ */
|
||||
+public class StringEditor extends com.sun.beans.editors.StringEditor {
|
||||
+}
|
@ -1,36 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User coffeys
|
||||
# Date 1355323250 0
|
||||
# Node ID 0da6d4cbcc77b3326756b52e6086b1262d52c214
|
||||
# Parent 042882b32f75d0e736c19f93688d37fb98d7d26d
|
||||
6563318: RMI data sanitization
|
||||
Reviewed-by: dmocek
|
||||
|
||||
diff --git a/src/share/classes/sun/rmi/transport/proxy/CGIHandler.java b/src/share/classes/sun/rmi/transport/proxy/CGIHandler.java
|
||||
--- jdk/src/share/classes/sun/rmi/transport/proxy/CGIHandler.java
|
||||
+++ jdk/src/share/classes/sun/rmi/transport/proxy/CGIHandler.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -150,7 +150,7 @@ public final class CGIHandler {
|
||||
returnServerError(e.getMessage());
|
||||
}
|
||||
else
|
||||
- returnClientError("invalid command: " + command);
|
||||
+ returnClientError("Invalid command.");
|
||||
} catch (Exception e) {
|
||||
returnServerError("internal error: " + e.getMessage());
|
||||
}
|
||||
@@ -217,7 +217,7 @@ final class CGIForwardCommand implements
|
||||
try {
|
||||
port = Integer.parseInt(param);
|
||||
} catch (NumberFormatException e) {
|
||||
- throw new CGIClientException("invalid port number: " + param);
|
||||
+ throw new CGIClientException("invalid port number.");
|
||||
}
|
||||
if (port <= 0 || port > 0xFFFF)
|
||||
throw new CGIClientException("invalid port: " + port);
|
File diff suppressed because it is too large
Load Diff
@ -1,272 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User dholmes
|
||||
# Date 1350872930 14400
|
||||
# Node ID 6088f35106866940de257456c8eee21b130d5ff5
|
||||
# Parent 21487ef30163da2a96369eee80a3bf5e94612017
|
||||
6776941: Improve thread pool shutdown
|
||||
Reviewed-by: dl, skoivu
|
||||
|
||||
diff --git a/src/share/classes/java/util/concurrent/ThreadPoolExecutor.java b/src/share/classes/java/util/concurrent/ThreadPoolExecutor.java
|
||||
--- jdk/src/share/classes/java/util/concurrent/ThreadPoolExecutor.java
|
||||
+++ jdk/src/share/classes/java/util/concurrent/ThreadPoolExecutor.java
|
||||
@@ -34,8 +34,10 @@
|
||||
*/
|
||||
|
||||
package java.util.concurrent;
|
||||
-import java.util.concurrent.locks.*;
|
||||
-import java.util.concurrent.atomic.*;
|
||||
+import java.util.concurrent.locks.AbstractQueuedSynchronizer;
|
||||
+import java.util.concurrent.locks.Condition;
|
||||
+import java.util.concurrent.locks.ReentrantLock;
|
||||
+import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -491,10 +493,15 @@ public class ThreadPoolExecutor extends
|
||||
* policy limiting the number of threads. Even though it is not
|
||||
* treated as an error, failure to create threads may result in
|
||||
* new tasks being rejected or existing ones remaining stuck in
|
||||
- * the queue. On the other hand, no special precautions exist to
|
||||
- * handle OutOfMemoryErrors that might be thrown while trying to
|
||||
- * create threads, since there is generally no recourse from
|
||||
- * within this class.
|
||||
+ * the queue.
|
||||
+ *
|
||||
+ * We go further and preserve pool invariants even in the face of
|
||||
+ * errors such as OutOfMemoryError, that might be thrown while
|
||||
+ * trying to create threads. Such errors are rather common due to
|
||||
+ * the need to allocate a native stack in Thread#start, and users
|
||||
+ * will want to perform clean pool shutdown to clean up. There
|
||||
+ * will likely be enough memory available for the cleanup code to
|
||||
+ * complete without encountering yet another OutOfMemoryError.
|
||||
*/
|
||||
private volatile ThreadFactory threadFactory;
|
||||
|
||||
@@ -568,9 +575,13 @@ public class ThreadPoolExecutor extends
|
||||
* task execution. This protects against interrupts that are
|
||||
* intended to wake up a worker thread waiting for a task from
|
||||
* instead interrupting a task being run. We implement a simple
|
||||
- * non-reentrant mutual exclusion lock rather than use ReentrantLock
|
||||
- * because we do not want worker tasks to be able to reacquire the
|
||||
- * lock when they invoke pool control methods like setCorePoolSize.
|
||||
+ * non-reentrant mutual exclusion lock rather than use
|
||||
+ * ReentrantLock because we do not want worker tasks to be able to
|
||||
+ * reacquire the lock when they invoke pool control methods like
|
||||
+ * setCorePoolSize. Additionally, to suppress interrupts until
|
||||
+ * the thread actually starts running tasks, we initialize lock
|
||||
+ * state to a negative value, and clear it upon start (in
|
||||
+ * runWorker).
|
||||
*/
|
||||
private final class Worker
|
||||
extends AbstractQueuedSynchronizer
|
||||
@@ -594,6 +605,7 @@ public class ThreadPoolExecutor extends
|
||||
* @param firstTask the first task (null if none)
|
||||
*/
|
||||
Worker(Runnable firstTask) {
|
||||
+ setState(-1); // inhibit interrupts until runWorker
|
||||
this.firstTask = firstTask;
|
||||
this.thread = getThreadFactory().newThread(this);
|
||||
}
|
||||
@@ -609,7 +621,7 @@ public class ThreadPoolExecutor extends
|
||||
// The value 1 represents the locked state.
|
||||
|
||||
protected boolean isHeldExclusively() {
|
||||
- return getState() == 1;
|
||||
+ return getState() != 0;
|
||||
}
|
||||
|
||||
protected boolean tryAcquire(int unused) {
|
||||
@@ -630,6 +642,16 @@ public class ThreadPoolExecutor extends
|
||||
public boolean tryLock() { return tryAcquire(1); }
|
||||
public void unlock() { release(1); }
|
||||
public boolean isLocked() { return isHeldExclusively(); }
|
||||
+
|
||||
+ void interruptIfStarted() {
|
||||
+ Thread t;
|
||||
+ if (getState() >= 0 && (t = thread) != null && !t.isInterrupted()) {
|
||||
+ try {
|
||||
+ t.interrupt();
|
||||
+ } catch (SecurityException ignore) {
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -729,10 +751,7 @@ public class ThreadPoolExecutor extends
|
||||
mainLock.lock();
|
||||
try {
|
||||
for (Worker w : workers) {
|
||||
- try {
|
||||
- w.thread.interrupt();
|
||||
- } catch (SecurityException ignore) {
|
||||
- }
|
||||
+ w.interruptIfStarted();
|
||||
}
|
||||
} finally {
|
||||
mainLock.unlock();
|
||||
@@ -789,19 +808,6 @@ public class ThreadPoolExecutor extends
|
||||
}
|
||||
|
||||
private static final boolean ONLY_ONE = true;
|
||||
-
|
||||
- /**
|
||||
- * Ensures that unless the pool is stopping, the current thread
|
||||
- * does not have its interrupt set. This requires a double-check
|
||||
- * of state in case the interrupt was cleared concurrently with a
|
||||
- * shutdownNow -- if so, the interrupt is re-enabled.
|
||||
- */
|
||||
- private void clearInterruptsForTaskRun() {
|
||||
- if (runStateLessThan(ctl.get(), STOP) &&
|
||||
- Thread.interrupted() &&
|
||||
- runStateAtLeast(ctl.get(), STOP))
|
||||
- Thread.currentThread().interrupt();
|
||||
- }
|
||||
|
||||
/*
|
||||
* Misc utilities, most of which are also exported to
|
||||
@@ -862,12 +868,13 @@ public class ThreadPoolExecutor extends
|
||||
* Checks if a new worker can be added with respect to current
|
||||
* pool state and the given bound (either core or maximum). If so,
|
||||
* the worker count is adjusted accordingly, and, if possible, a
|
||||
- * new worker is created and started running firstTask as its
|
||||
+ * new worker is created and started, running firstTask as its
|
||||
* first task. This method returns false if the pool is stopped or
|
||||
* eligible to shut down. It also returns false if the thread
|
||||
- * factory fails to create a thread when asked, which requires a
|
||||
- * backout of workerCount, and a recheck for termination, in case
|
||||
- * the existence of this worker was holding up termination.
|
||||
+ * factory fails to create a thread when asked. If the thread
|
||||
+ * creation fails, either due to the thread factory returning
|
||||
+ * null, or due to an exception (typically OutOfMemoryError in
|
||||
+ * Thread#start), we roll back cleanly.
|
||||
*
|
||||
* @param firstTask the task the new thread should run first (or
|
||||
* null if none). Workers are created with an initial first task
|
||||
@@ -910,46 +917,65 @@ public class ThreadPoolExecutor extends
|
||||
}
|
||||
}
|
||||
|
||||
- Worker w = new Worker(firstTask);
|
||||
- Thread t = w.thread;
|
||||
+ boolean workerStarted = false;
|
||||
+ boolean workerAdded = false;
|
||||
+ Worker w = null;
|
||||
+ try {
|
||||
+ final ReentrantLock mainLock = this.mainLock;
|
||||
+ w = new Worker(firstTask);
|
||||
+ final Thread t = w.thread;
|
||||
+ if (t != null) {
|
||||
+ mainLock.lock();
|
||||
+ try {
|
||||
+ // Recheck while holding lock.
|
||||
+ // Back out on ThreadFactory failure or if
|
||||
+ // shut down before lock acquired.
|
||||
+ int c = ctl.get();
|
||||
+ int rs = runStateOf(c);
|
||||
|
||||
+ if (rs < SHUTDOWN ||
|
||||
+ (rs == SHUTDOWN && firstTask == null)) {
|
||||
+ if (t.isAlive()) // precheck that t is startable
|
||||
+ throw new IllegalThreadStateException();
|
||||
+ workers.add(w);
|
||||
+ int s = workers.size();
|
||||
+ if (s > largestPoolSize)
|
||||
+ largestPoolSize = s;
|
||||
+ workerAdded = true;
|
||||
+ }
|
||||
+ } finally {
|
||||
+ mainLock.unlock();
|
||||
+ }
|
||||
+ if (workerAdded) {
|
||||
+ t.start();
|
||||
+ workerStarted = true;
|
||||
+ }
|
||||
+ }
|
||||
+ } finally {
|
||||
+ if (! workerStarted)
|
||||
+ addWorkerFailed(w);
|
||||
+ }
|
||||
+ return workerStarted;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Rolls back the worker thread creation.
|
||||
+ * - removes worker from workers, if present
|
||||
+ * - decrements worker count
|
||||
+ * - rechecks for termination, in case the existence of this
|
||||
+ * worker was holding up termination
|
||||
+ */
|
||||
+ private void addWorkerFailed(Worker w) {
|
||||
final ReentrantLock mainLock = this.mainLock;
|
||||
mainLock.lock();
|
||||
try {
|
||||
- // Recheck while holding lock.
|
||||
- // Back out on ThreadFactory failure or if
|
||||
- // shut down before lock acquired.
|
||||
- int c = ctl.get();
|
||||
- int rs = runStateOf(c);
|
||||
-
|
||||
- if (t == null ||
|
||||
- (rs >= SHUTDOWN &&
|
||||
- ! (rs == SHUTDOWN &&
|
||||
- firstTask == null))) {
|
||||
- decrementWorkerCount();
|
||||
- tryTerminate();
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- workers.add(w);
|
||||
-
|
||||
- int s = workers.size();
|
||||
- if (s > largestPoolSize)
|
||||
- largestPoolSize = s;
|
||||
+ if (w != null)
|
||||
+ workers.remove(w);
|
||||
+ decrementWorkerCount();
|
||||
+ tryTerminate();
|
||||
} finally {
|
||||
mainLock.unlock();
|
||||
}
|
||||
-
|
||||
- t.start();
|
||||
- // It is possible (but unlikely) for a thread to have been
|
||||
- // added to workers, but not yet started, during transition to
|
||||
- // STOP, which could result in a rare missed interrupt,
|
||||
- // because Thread.interrupt is not guaranteed to have any effect
|
||||
- // on a non-yet-started Thread (see Thread#interrupt).
|
||||
- if (runStateOf(ctl.get()) == STOP && ! t.isInterrupted())
|
||||
- t.interrupt();
|
||||
-
|
||||
- return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1096,15 +1122,25 @@ public class ThreadPoolExecutor extends
|
||||
* @param w the worker
|
||||
*/
|
||||
final void runWorker(Worker w) {
|
||||
+ Thread wt = Thread.currentThread();
|
||||
Runnable task = w.firstTask;
|
||||
w.firstTask = null;
|
||||
+ w.unlock(); // allow interrupts
|
||||
boolean completedAbruptly = true;
|
||||
try {
|
||||
while (task != null || (task = getTask()) != null) {
|
||||
w.lock();
|
||||
- clearInterruptsForTaskRun();
|
||||
+ // If pool is stopping, ensure thread is interrupted;
|
||||
+ // if not, ensure thread is not interrupted. This
|
||||
+ // requires a recheck in second case to deal with
|
||||
+ // shutdownNow race while clearing interrupt
|
||||
+ if ((runStateAtLeast(ctl.get(), STOP) ||
|
||||
+ (Thread.interrupted() &&
|
||||
+ runStateAtLeast(ctl.get(), STOP))) &&
|
||||
+ !wt.isInterrupted())
|
||||
+ wt.interrupt();
|
||||
try {
|
||||
- beforeExecute(w.thread, task);
|
||||
+ beforeExecute(wt, task);
|
||||
Throwable thrown = null;
|
||||
try {
|
||||
task.run();
|
@ -1,87 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User mbankal
|
||||
# Date 1355396891 28800
|
||||
# Node ID 7eb471f1efdd127f982e53b290c1fece845a897c
|
||||
# Parent 58fdb67fcacc67693fc43b5601e88bd7c216f850
|
||||
7141694: Improving CORBA internals
|
||||
Reviewed-by: coffeys, ahgross
|
||||
|
||||
diff --git a/src/share/classes/com/sun/corba/se/spi/orb/ORB.java b/src/share/classes/com/sun/corba/se/spi/orb/ORB.java
|
||||
--- corba/src/share/classes/com/sun/corba/se/spi/orb/ORB.java
|
||||
+++ corba/src/share/classes/com/sun/corba/se/spi/orb/ORB.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -98,6 +98,7 @@ import com.sun.corba.se.impl.presentatio
|
||||
import com.sun.corba.se.impl.presentation.rmi.PresentationManagerImpl ;
|
||||
|
||||
import com.sun.corba.se.impl.orbutil.ORBClassLoader ;
|
||||
+import sun.awt.AppContext;
|
||||
|
||||
public abstract class ORB extends com.sun.corba.se.org.omg.CORBA.ORB
|
||||
implements Broker, TypeCodeFactory
|
||||
@@ -173,14 +174,7 @@ public abstract class ORB extends com.su
|
||||
|
||||
private MonitoringManager monitoringManager;
|
||||
|
||||
- // There is only one instance of the PresentationManager
|
||||
- // that is shared between all ORBs. This is necessary
|
||||
- // because RMI-IIOP requires the PresentationManager in
|
||||
- // places where no ORB is available, so the PresentationManager
|
||||
- // must be global. It is initialized here as well.
|
||||
- protected static PresentationManager globalPM = null ;
|
||||
-
|
||||
- static {
|
||||
+ private static PresentationManager setupPresentationManager() {
|
||||
staticWrapper = ORBUtilSystemException.get(
|
||||
CORBALogDomains.RPC_PRESENTATION ) ;
|
||||
|
||||
@@ -220,17 +214,26 @@ public abstract class ORB extends com.su
|
||||
}
|
||||
) ;
|
||||
|
||||
- globalPM = new PresentationManagerImpl( useDynamicStub ) ;
|
||||
- globalPM.setStubFactoryFactory( false,
|
||||
+ PresentationManager pm = new PresentationManagerImpl( useDynamicStub ) ;
|
||||
+ pm.setStubFactoryFactory( false,
|
||||
PresentationDefaults.getStaticStubFactoryFactory() ) ;
|
||||
- globalPM.setStubFactoryFactory( true, dynamicStubFactoryFactory ) ;
|
||||
+ pm.setStubFactoryFactory( true, dynamicStubFactoryFactory ) ;
|
||||
+ return pm;
|
||||
}
|
||||
|
||||
- /** Get the single instance of the PresentationManager
|
||||
+ /**
|
||||
+ * Returns the Presentation Manager for the current thread group, using the ThreadGroup-specific
|
||||
+ * AppContext to hold it. Creates and records one if needed.
|
||||
*/
|
||||
- public static PresentationManager getPresentationManager()
|
||||
+ public static PresentationManager getPresentationManager()
|
||||
{
|
||||
- return globalPM ;
|
||||
+ AppContext ac = AppContext.getAppContext();
|
||||
+ PresentationManager pm = (PresentationManager) ac.get(PresentationManager.class);
|
||||
+ if (pm == null) {
|
||||
+ pm = setupPresentationManager();
|
||||
+ ac.put(PresentationManager.class, pm);
|
||||
+ }
|
||||
+ return pm;
|
||||
}
|
||||
|
||||
/** Get the appropriate StubFactoryFactory. This
|
||||
@@ -240,8 +243,9 @@ public abstract class ORB extends com.su
|
||||
public static PresentationManager.StubFactoryFactory
|
||||
getStubFactoryFactory()
|
||||
{
|
||||
- boolean useDynamicStubs = globalPM.useDynamicStubs() ;
|
||||
- return globalPM.getStubFactoryFactory( useDynamicStubs ) ;
|
||||
+ PresentationManager gPM = getPresentationManager();
|
||||
+ boolean useDynamicStubs = gPM.useDynamicStubs() ;
|
||||
+ return gPM.getStubFactoryFactory( useDynamicStubs ) ;
|
||||
}
|
||||
|
||||
protected ORB()
|
@ -1,22 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User anthony
|
||||
# Date 1350043271 -14400
|
||||
# Node ID ce11c5c59cb8672eeddf9d5ce49563ccbc387854
|
||||
# Parent 9c2a2aae44a46e0b63b913987672d1488fa4e7a5
|
||||
7173145: Improve in-memory representation of splashscreens
|
||||
Reviewed-by: bae, mschoene
|
||||
|
||||
diff --git a/src/share/native/sun/awt/splashscreen/splashscreen_jpeg.c b/src/share/native/sun/awt/splashscreen/splashscreen_jpeg.c
|
||||
--- jdk/src/share/native/sun/awt/splashscreen/splashscreen_jpeg.c
|
||||
+++ jdk/src/share/native/sun/awt/splashscreen/splashscreen_jpeg.c
|
||||
@@ -133,6 +133,10 @@ SplashDecodeJpeg(Splash * splash, struct
|
||||
ImageFormat srcFormat;
|
||||
|
||||
jpeg_read_header(cinfo, TRUE);
|
||||
+
|
||||
+ // SplashScreen jpeg converter expects data in RGB format only
|
||||
+ cinfo->out_color_space = JCS_RGB;
|
||||
+
|
||||
jpeg_start_decompress(cinfo);
|
||||
|
||||
SplashCleanup(splash);
|
File diff suppressed because it is too large
Load Diff
@ -1,20 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User rupashka
|
||||
# Date 1350390610 -14400
|
||||
# Node ID 6deb10c2d5d0c8925fd2012d9fc3b9325c997f21
|
||||
# Parent ce11c5c59cb8672eeddf9d5ce49563ccbc387854
|
||||
7186948: Improve Swing data validation
|
||||
Reviewed-by: art, ahgross
|
||||
|
||||
diff --git a/src/share/classes/javax/swing/UIDefaults.java b/src/share/classes/javax/swing/UIDefaults.java
|
||||
--- jdk/src/share/classes/javax/swing/UIDefaults.java
|
||||
+++ jdk/src/share/classes/javax/swing/UIDefaults.java
|
||||
@@ -677,6 +677,8 @@ public class UIDefaults extends Hashtabl
|
||||
try {
|
||||
String className = (String)get(uiClassID);
|
||||
if (className != null) {
|
||||
+ ReflectUtil.checkPackageAccess(className);
|
||||
+
|
||||
Class cls = (Class)get(className);
|
||||
if (cls == null) {
|
||||
if (uiClassLoader == null) {
|
@ -1,127 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User denis
|
||||
# Date 1353947054 -14400
|
||||
# Node ID 9bbc6817b00c3e9d4eba05d53a8a20b45947ea03
|
||||
# Parent c684d497e159d3eebded29e997d953019305ec45
|
||||
7186952: Improve clipboard access
|
||||
Reviewed-by: serb, ahgross
|
||||
|
||||
diff --git a/src/share/classes/java/awt/TextComponent.java b/src/share/classes/java/awt/TextComponent.java
|
||||
--- jdk/src/share/classes/java/awt/TextComponent.java
|
||||
+++ jdk/src/share/classes/java/awt/TextComponent.java
|
||||
@@ -107,12 +107,6 @@ public class TextComponent extends Compo
|
||||
// the background color of non-editable TextComponents.
|
||||
boolean backgroundSetByClientCode = false;
|
||||
|
||||
- /**
|
||||
- * True if this <code>TextComponent</code> has access
|
||||
- * to the System clipboard.
|
||||
- */
|
||||
- transient private boolean canAccessClipboard;
|
||||
-
|
||||
transient protected TextListener textListener;
|
||||
|
||||
/*
|
||||
@@ -137,7 +131,6 @@ public class TextComponent extends Compo
|
||||
GraphicsEnvironment.checkHeadless();
|
||||
this.text = (text != null) ? text : "";
|
||||
setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
|
||||
- checkSystemClipboardAccess();
|
||||
}
|
||||
|
||||
private void enableInputMethodsIfNecessary() {
|
||||
@@ -727,17 +720,14 @@ public class TextComponent extends Compo
|
||||
/**
|
||||
* Assigns a valid value to the canAccessClipboard instance variable.
|
||||
*/
|
||||
- private void checkSystemClipboardAccess() {
|
||||
- canAccessClipboard = true;
|
||||
+ private boolean canAccessClipboard() {
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
- if (sm != null) {
|
||||
- try {
|
||||
- sm.checkSystemClipboardAccess();
|
||||
- }
|
||||
- catch (SecurityException e) {
|
||||
- canAccessClipboard = false;
|
||||
- }
|
||||
- }
|
||||
+ if (sm == null) return true;
|
||||
+ try {
|
||||
+ sm.checkSystemClipboardAccess();
|
||||
+ return true;
|
||||
+ } catch (SecurityException e) {}
|
||||
+ return false;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -820,7 +810,6 @@ public class TextComponent extends Compo
|
||||
}
|
||||
}
|
||||
enableInputMethodsIfNecessary();
|
||||
- checkSystemClipboardAccess();
|
||||
}
|
||||
|
||||
|
||||
diff --git a/src/windows/native/sun/windows/awt_TextComponent.cpp b/src/windows/native/sun/windows/awt_TextComponent.cpp
|
||||
--- jdk/src/windows/native/sun/windows/awt_TextComponent.cpp
|
||||
+++ jdk/src/windows/native/sun/windows/awt_TextComponent.cpp
|
||||
@@ -52,13 +52,11 @@ struct EnableEditingStruct {
|
||||
* AwtTextComponent fields
|
||||
*/
|
||||
|
||||
-/* java.awt.TextComponent fields */
|
||||
-jfieldID AwtTextComponent::canAccessClipboardID;
|
||||
-
|
||||
-
|
||||
/************************************************************************
|
||||
* AwtTextComponent methods
|
||||
*/
|
||||
+
|
||||
+jmethodID AwtTextComponent::canAccessClipboardMID;
|
||||
|
||||
AwtTextComponent::AwtTextComponent() {
|
||||
m_synthetic = FALSE;
|
||||
@@ -188,8 +186,7 @@ AwtTextComponent::WmPaste()
|
||||
}
|
||||
jobject target = GetTarget(env);
|
||||
jboolean canAccessClipboard =
|
||||
- env->GetBooleanField(target,
|
||||
- AwtTextComponent::canAccessClipboardID);
|
||||
+ env->CallBooleanMethod (target, AwtTextComponent::canAccessClipboardMID);
|
||||
env->DeleteLocalRef(target);
|
||||
return (canAccessClipboard) ? mrDoDefault : mrConsume;
|
||||
}
|
||||
@@ -622,12 +619,13 @@ Java_sun_awt_windows_WTextComponentPeer_
|
||||
{
|
||||
TRY;
|
||||
|
||||
- cls = env->FindClass("java/awt/TextComponent");
|
||||
- if (cls != NULL) {
|
||||
- AwtTextComponent::canAccessClipboardID =
|
||||
- env->GetFieldID(cls, "canAccessClipboard", "Z");
|
||||
- DASSERT(AwtTextComponent::canAccessClipboardID != NULL);
|
||||
- }
|
||||
+ jclass textComponentClassID = env->FindClass("java/awt/TextComponent");
|
||||
+ AwtTextComponent::canAccessClipboardMID =
|
||||
+ env->GetMethodID(textComponentClassID,
|
||||
+ "canAccessClipboard", "()Z");
|
||||
+ env->DeleteLocalRef(textComponentClassID);
|
||||
+
|
||||
+ DASSERT(AwtTextComponent::canAccessClipboardMID != NULL)
|
||||
|
||||
CATCH_BAD_ALLOC;
|
||||
}
|
||||
diff --git a/src/windows/native/sun/windows/awt_TextComponent.h b/src/windows/native/sun/windows/awt_TextComponent.h
|
||||
--- jdk/src/windows/native/sun/windows/awt_TextComponent.h
|
||||
+++ jdk/src/windows/native/sun/windows/awt_TextComponent.h
|
||||
@@ -42,8 +42,7 @@
|
||||
|
||||
class AwtTextComponent : public AwtComponent {
|
||||
public:
|
||||
- /* java.awt.TextComponent canAccessClipboard field ID */
|
||||
- static jfieldID canAccessClipboardID;
|
||||
+ static jmethodID canAccessClipboardMID;
|
||||
|
||||
AwtTextComponent();
|
||||
|
@ -1,81 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User dmeetry
|
||||
# Date 1352295947 -14400
|
||||
# Node ID ee4632a30696050ebd5c014fb3da64112ab48dd3
|
||||
# Parent 6e2d4ed84b41667df189abb7bd0915cda01a85a0
|
||||
7186954: Improve connection performance
|
||||
Reviewed-by: khazra
|
||||
|
||||
diff --git a/src/share/classes/sun/net/httpserver/ChunkedInputStream.java b/src/share/classes/sun/net/httpserver/ChunkedInputStream.java
|
||||
--- jdk/src/share/classes/sun/net/httpserver/ChunkedInputStream.java
|
||||
+++ jdk/src/share/classes/sun/net/httpserver/ChunkedInputStream.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -41,8 +41,12 @@ class ChunkedInputStream extends LeftOve
|
||||
|
||||
private boolean needToReadHeader = true;
|
||||
|
||||
- static char CR = '\r';
|
||||
- static char LF = '\n';
|
||||
+ final static char CR = '\r';
|
||||
+ final static char LF = '\n';
|
||||
+ /*
|
||||
+ * Maximum chunk header size of 2KB + 2 bytes for CRLF
|
||||
+ */
|
||||
+ private final static int MAX_CHUNK_HEADER_SIZE = 2050;
|
||||
|
||||
private int numeric (char[] arr, int nchars) throws IOException {
|
||||
assert arr.length >= nchars;
|
||||
@@ -73,9 +77,13 @@ class ChunkedInputStream extends LeftOve
|
||||
char[] len_arr = new char [16];
|
||||
int len_size = 0;
|
||||
boolean end_of_len = false;
|
||||
+ int read = 0;
|
||||
|
||||
while ((c=(char)in.read())!= -1) {
|
||||
- if (len_size == len_arr.length -1) {
|
||||
+ read++;
|
||||
+ if ((len_size == len_arr.length -1) ||
|
||||
+ (read > MAX_CHUNK_HEADER_SIZE))
|
||||
+ {
|
||||
throw new IOException ("invalid chunk header");
|
||||
}
|
||||
if (gotCR) {
|
||||
diff --git a/src/share/classes/sun/net/www/http/ChunkedInputStream.java b/src/share/classes/sun/net/www/http/ChunkedInputStream.java
|
||||
--- jdk/src/share/classes/sun/net/www/http/ChunkedInputStream.java
|
||||
+++ jdk/src/share/classes/sun/net/www/http/ChunkedInputStream.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -125,6 +125,11 @@ class ChunkedInputStream extends InputSt
|
||||
*/
|
||||
private boolean closed;
|
||||
|
||||
+ /*
|
||||
+ * Maximum chunk header size of 2KB + 2 bytes for CRLF
|
||||
+ */
|
||||
+ private final static int MAX_CHUNK_HEADER_SIZE = 2050;
|
||||
+
|
||||
/**
|
||||
* State to indicate that next field should be :-
|
||||
* chunk-size [ chunk-extension ] CRLF
|
||||
@@ -290,6 +295,10 @@ class ChunkedInputStream extends InputSt
|
||||
break;
|
||||
}
|
||||
pos++;
|
||||
+ if ((pos - rawPos) >= MAX_CHUNK_HEADER_SIZE) {
|
||||
+ error = true;
|
||||
+ throw new IOException("Chunk header too long");
|
||||
+ }
|
||||
}
|
||||
if (pos >= rawCount) {
|
||||
return;
|
@ -1,695 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User mbankal
|
||||
# Date 1355226562 28800
|
||||
# Node ID 726b9456757648efb7c68e41c6bcc08a401eef83
|
||||
# Parent aade089d4505d382f49306a90873c4217367e709
|
||||
7192392: Better validation of client keys
|
||||
Reviewed-by: xuelei
|
||||
|
||||
diff --git a/src/share/classes/com/sun/crypto/provider/DHKeyAgreement.java b/src/share/classes/com/sun/crypto/provider/DHKeyAgreement.java
|
||||
--- jdk/src/share/classes/com/sun/crypto/provider/DHKeyAgreement.java
|
||||
+++ jdk/src/share/classes/com/sun/crypto/provider/DHKeyAgreement.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -39,6 +39,7 @@ import javax.crypto.ShortBufferException
|
||||
import javax.crypto.ShortBufferException;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.spec.*;
|
||||
+import sun.security.util.KeyUtil;
|
||||
|
||||
/**
|
||||
* This class implements the Diffie-Hellman key agreement protocol between
|
||||
@@ -205,6 +206,9 @@ extends KeyAgreementSpi {
|
||||
if (pub_g != null && !(init_g.equals(pub_g))) {
|
||||
throw new InvalidKeyException("Incompatible parameters");
|
||||
}
|
||||
+
|
||||
+ // validate the Diffie-Hellman public key
|
||||
+ KeyUtil.validate(dhPubKey);
|
||||
|
||||
// store the y value
|
||||
this.y = dhPubKey.getY();
|
||||
diff --git a/src/share/classes/sun/security/pkcs11/P11KeyAgreement.java b/src/share/classes/sun/security/pkcs11/P11KeyAgreement.java
|
||||
--- jdk/src/share/classes/sun/security/pkcs11/P11KeyAgreement.java
|
||||
+++ jdk/src/share/classes/sun/security/pkcs11/P11KeyAgreement.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -37,6 +37,7 @@ import static sun.security.pkcs11.Templa
|
||||
import static sun.security.pkcs11.TemplateManager.*;
|
||||
import sun.security.pkcs11.wrapper.*;
|
||||
import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
|
||||
+import sun.security.util.KeyUtil;
|
||||
|
||||
/**
|
||||
* KeyAgreement implementation class. This class currently supports
|
||||
@@ -134,6 +135,8 @@ final class P11KeyAgreement extends KeyA
|
||||
BigInteger p, g, y;
|
||||
if (key instanceof DHPublicKey) {
|
||||
DHPublicKey dhKey = (DHPublicKey)key;
|
||||
+ // validate the Diffie-Hellman public key
|
||||
+ KeyUtil.validate(dhKey);
|
||||
y = dhKey.getY();
|
||||
DHParameterSpec params = dhKey.getParams();
|
||||
p = params.getP();
|
||||
@@ -145,6 +148,8 @@ final class P11KeyAgreement extends KeyA
|
||||
try {
|
||||
DHPublicKeySpec spec = (DHPublicKeySpec)kf.engineGetKeySpec
|
||||
(key, DHPublicKeySpec.class);
|
||||
+ // validate the Diffie-Hellman public key
|
||||
+ KeyUtil.validate(spec);
|
||||
y = spec.getY();
|
||||
p = spec.getP();
|
||||
g = spec.getG();
|
||||
diff --git a/src/share/classes/sun/security/ssl/ClientHandshaker.java b/src/share/classes/sun/security/ssl/ClientHandshaker.java
|
||||
--- jdk/src/share/classes/sun/security/ssl/ClientHandshaker.java
|
||||
+++ jdk/src/share/classes/sun/security/ssl/ClientHandshaker.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -168,7 +168,11 @@ final class ClientHandshaker extends Han
|
||||
}
|
||||
break;
|
||||
case K_DH_ANON:
|
||||
- this.serverKeyExchange(new DH_ServerKeyExchange(input));
|
||||
+ try {
|
||||
+ this.serverKeyExchange(new DH_ServerKeyExchange(input));
|
||||
+ } catch (GeneralSecurityException e) {
|
||||
+ throwSSLException("Server key", e);
|
||||
+ }
|
||||
break;
|
||||
case K_DHE_DSS:
|
||||
case K_DHE_RSA:
|
||||
@@ -811,7 +815,7 @@ final class ClientHandshaker extends Han
|
||||
case K_DHE_RSA:
|
||||
case K_DHE_DSS:
|
||||
case K_DH_ANON:
|
||||
- preMasterSecret = dh.getAgreedSecret(serverDH);
|
||||
+ preMasterSecret = dh.getAgreedSecret(serverDH, true);
|
||||
break;
|
||||
case K_ECDHE_RSA:
|
||||
case K_ECDHE_ECDSA:
|
||||
diff --git a/src/share/classes/sun/security/ssl/DHClientKeyExchange.java b/src/share/classes/sun/security/ssl/DHClientKeyExchange.java
|
||||
--- jdk/src/share/classes/sun/security/ssl/DHClientKeyExchange.java
|
||||
+++ jdk/src/share/classes/sun/security/ssl/DHClientKeyExchange.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -29,7 +29,7 @@ import java.io.IOException;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.math.BigInteger;
|
||||
-
|
||||
+import javax.net.ssl.SSLHandshakeException;
|
||||
|
||||
/*
|
||||
* Message used by clients to send their Diffie-Hellman public
|
||||
@@ -50,7 +50,7 @@ final class DHClientKeyExchange extends
|
||||
private byte dh_Yc[]; // 1 to 2^16 -1 bytes
|
||||
|
||||
BigInteger getClientPublicKey() {
|
||||
- return new BigInteger(1, dh_Yc);
|
||||
+ return dh_Yc == null ? null : new BigInteger(1, dh_Yc);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -72,7 +72,14 @@ final class DHClientKeyExchange extends
|
||||
* but that's what the protocol spec requires.)
|
||||
*/
|
||||
DHClientKeyExchange(HandshakeInStream input) throws IOException {
|
||||
- dh_Yc = input.getBytes16();
|
||||
+ if (input.available() >= 2) {
|
||||
+ dh_Yc = input.getBytes16();
|
||||
+ } else {
|
||||
+ // currently, we don't support cipher suites that requires
|
||||
+ // implicit public key of client.
|
||||
+ throw new SSLHandshakeException(
|
||||
+ "Unsupported implicit client DiffieHellman public key");
|
||||
+ }
|
||||
}
|
||||
|
||||
int messageLength() {
|
||||
@@ -84,7 +91,9 @@ final class DHClientKeyExchange extends
|
||||
}
|
||||
|
||||
void send(HandshakeOutStream s) throws IOException {
|
||||
- s.putBytes16(dh_Yc);
|
||||
+ if (dh_Yc != null && dh_Yc.length != 0) {
|
||||
+ s.putBytes16(dh_Yc);
|
||||
+ }
|
||||
}
|
||||
|
||||
void print(PrintStream s) throws IOException {
|
||||
diff --git a/src/share/classes/sun/security/ssl/DHCrypt.java b/src/share/classes/sun/security/ssl/DHCrypt.java
|
||||
--- jdk/src/share/classes/sun/security/ssl/DHCrypt.java
|
||||
+++ jdk/src/share/classes/sun/security/ssl/DHCrypt.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -28,11 +28,14 @@ package sun.security.ssl;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.security.*;
|
||||
+import java.io.IOException;
|
||||
+import javax.net.ssl.SSLHandshakeException;
|
||||
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.KeyAgreement;
|
||||
import javax.crypto.interfaces.DHPublicKey;
|
||||
import javax.crypto.spec.*;
|
||||
+import sun.security.util.KeyUtil;
|
||||
|
||||
/**
|
||||
* This class implements the Diffie-Hellman key exchange algorithm.
|
||||
@@ -54,7 +57,8 @@ import javax.crypto.spec.*;
|
||||
* . if we are server, call DHCrypt(keyLength,random). This generates
|
||||
* an ephemeral keypair of the request length.
|
||||
* . if we are client, call DHCrypt(modulus, base, random). This
|
||||
- * generates an ephemeral keypair using the parameters specified by the server.
|
||||
+ * generates an ephemeral keypair using the parameters specified by
|
||||
+ * the server.
|
||||
* . send parameters and public value to remote peer
|
||||
* . receive peers ephemeral public key
|
||||
* . call getAgreedSecret() to calculate the shared secret
|
||||
@@ -83,6 +87,9 @@ final class DHCrypt {
|
||||
// public component of our key, X = (g ^ x) mod p
|
||||
private BigInteger publicValue; // X (aka y)
|
||||
|
||||
+ // the times to recover from failure if public key validation
|
||||
+ private static int MAX_FAILOVER_TIMES = 2;
|
||||
+
|
||||
/**
|
||||
* Generate a Diffie-Hellman keypair of the specified size.
|
||||
*/
|
||||
@@ -90,9 +97,10 @@ final class DHCrypt {
|
||||
try {
|
||||
KeyPairGenerator kpg = JsseJce.getKeyPairGenerator("DiffieHellman");
|
||||
kpg.initialize(keyLength, random);
|
||||
- KeyPair kp = kpg.generateKeyPair();
|
||||
- privateKey = kp.getPrivate();
|
||||
- DHPublicKeySpec spec = getDHPublicKeySpec(kp.getPublic());
|
||||
+ DHPublicKeySpec spec = generateDHPublicKeySpec(kpg);
|
||||
+ if (spec == null) {
|
||||
+ throw new RuntimeException("Could not generate DH keypair");
|
||||
+ }
|
||||
publicValue = spec.getY();
|
||||
modulus = spec.getP();
|
||||
base = spec.getG();
|
||||
@@ -115,9 +123,10 @@ final class DHCrypt {
|
||||
KeyPairGenerator kpg = JsseJce.getKeyPairGenerator("DiffieHellman");
|
||||
DHParameterSpec params = new DHParameterSpec(modulus, base);
|
||||
kpg.initialize(params, random);
|
||||
- KeyPair kp = kpg.generateKeyPair();
|
||||
- privateKey = kp.getPrivate();
|
||||
- DHPublicKeySpec spec = getDHPublicKeySpec(kp.getPublic());
|
||||
+ DHPublicKeySpec spec = generateDHPublicKeySpec(kpg);
|
||||
+ if (spec == null) {
|
||||
+ throw new RuntimeException("Could not generate DH keypair");
|
||||
+ }
|
||||
publicValue = spec.getY();
|
||||
} catch (GeneralSecurityException e) {
|
||||
throw new RuntimeException("Could not generate DH keypair", e);
|
||||
@@ -128,7 +137,8 @@ final class DHCrypt {
|
||||
if (key instanceof DHPublicKey) {
|
||||
DHPublicKey dhKey = (DHPublicKey)key;
|
||||
DHParameterSpec params = dhKey.getParams();
|
||||
- return new DHPublicKeySpec(dhKey.getY(), params.getP(), params.getG());
|
||||
+ return new DHPublicKeySpec(dhKey.getY(),
|
||||
+ params.getP(), params.getG());
|
||||
}
|
||||
try {
|
||||
KeyFactory factory = JsseJce.getKeyFactory("DH");
|
||||
@@ -168,16 +178,29 @@ final class DHCrypt {
|
||||
* has not been set (or generated).
|
||||
*
|
||||
* @param peerPublicKey the peer's public key.
|
||||
- * @returns the secret, which is an unsigned big-endian integer
|
||||
+ * @param keyIsValidated whether the {@code peerPublicKey} has beed
|
||||
+ * validated
|
||||
+ * @return the secret, which is an unsigned big-endian integer
|
||||
* the same size as the Diffie-Hellman modulus.
|
||||
*/
|
||||
- SecretKey getAgreedSecret(BigInteger peerPublicValue) {
|
||||
+ SecretKey getAgreedSecret(BigInteger peerPublicValue,
|
||||
+ boolean keyIsValidated) throws IOException {
|
||||
try {
|
||||
KeyFactory kf = JsseJce.getKeyFactory("DiffieHellman");
|
||||
DHPublicKeySpec spec =
|
||||
new DHPublicKeySpec(peerPublicValue, modulus, base);
|
||||
PublicKey publicKey = kf.generatePublic(spec);
|
||||
KeyAgreement ka = JsseJce.getKeyAgreement("DiffieHellman");
|
||||
+ // validate the Diffie-Hellman public key
|
||||
+ if (!keyIsValidated &&
|
||||
+ !KeyUtil.isOracleJCEProvider(ka.getProvider().getName())) {
|
||||
+ try {
|
||||
+ KeyUtil.validate(spec);
|
||||
+ } catch (InvalidKeyException ike) {
|
||||
+ // prefer handshake_failure alert to internal_error alert
|
||||
+ throw new SSLHandshakeException(ike.getMessage());
|
||||
+ }
|
||||
+ }
|
||||
ka.init(privateKey);
|
||||
ka.doPhase(publicKey, true);
|
||||
return ka.generateSecret("TlsPremasterSecret");
|
||||
@@ -186,4 +209,33 @@ final class DHCrypt {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Generate and validate DHPublicKeySpec
|
||||
+ private DHPublicKeySpec generateDHPublicKeySpec(KeyPairGenerator kpg)
|
||||
+ throws GeneralSecurityException {
|
||||
+
|
||||
+ boolean doExtraValiadtion =
|
||||
+ (!KeyUtil.isOracleJCEProvider(kpg.getProvider().getName()));
|
||||
+ for (int i = 0; i <= MAX_FAILOVER_TIMES; i++) {
|
||||
+ KeyPair kp = kpg.generateKeyPair();
|
||||
+ privateKey = kp.getPrivate();
|
||||
+ DHPublicKeySpec spec = getDHPublicKeySpec(kp.getPublic());
|
||||
+
|
||||
+ // validate the Diffie-Hellman public key
|
||||
+ if (doExtraValiadtion) {
|
||||
+ try {
|
||||
+ KeyUtil.validate(spec);
|
||||
+ } catch (InvalidKeyException ivke) {
|
||||
+ if (i == MAX_FAILOVER_TIMES) {
|
||||
+ throw ivke;
|
||||
+ }
|
||||
+ // otherwise, ignore the exception and try the next one
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return spec;
|
||||
+ }
|
||||
+
|
||||
+ return null;
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/share/classes/sun/security/ssl/HandshakeMessage.java b/src/share/classes/sun/security/ssl/HandshakeMessage.java
|
||||
--- jdk/src/share/classes/sun/security/ssl/HandshakeMessage.java
|
||||
+++ jdk/src/share/classes/sun/security/ssl/HandshakeMessage.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -42,6 +42,7 @@ import javax.security.auth.x500.X500Prin
|
||||
|
||||
import javax.crypto.KeyGenerator;
|
||||
import javax.crypto.SecretKey;
|
||||
+import javax.crypto.spec.DHPublicKeySpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
import javax.net.ssl.*;
|
||||
@@ -51,6 +52,7 @@ import sun.security.internal.spec.TlsPrf
|
||||
import sun.security.internal.spec.TlsPrfParameterSpec;
|
||||
|
||||
import sun.security.ssl.CipherSuite.*;
|
||||
+import sun.security.util.KeyUtil;
|
||||
|
||||
/**
|
||||
* Many data structures are involved in the handshake messages. These
|
||||
@@ -715,6 +717,7 @@ class DH_ServerKeyExchange extends Serve
|
||||
* key exchange.
|
||||
*/
|
||||
DH_ServerKeyExchange(DHCrypt obj) {
|
||||
+ // The DH key has been validated in the constructor of DHCrypt.
|
||||
getValues(obj);
|
||||
signature = null;
|
||||
}
|
||||
@@ -727,6 +730,7 @@ class DH_ServerKeyExchange extends Serve
|
||||
DH_ServerKeyExchange(DHCrypt obj, PrivateKey key, byte clntNonce[],
|
||||
byte svrNonce[], SecureRandom sr) throws GeneralSecurityException {
|
||||
|
||||
+ // The DH key has been validated in the constructor of DHCrypt.
|
||||
getValues(obj);
|
||||
|
||||
Signature sig;
|
||||
@@ -751,10 +755,14 @@ class DH_ServerKeyExchange extends Serve
|
||||
* stream, as if sent from server to client for use with
|
||||
* DH_anon key exchange
|
||||
*/
|
||||
- DH_ServerKeyExchange(HandshakeInStream input) throws IOException {
|
||||
+ DH_ServerKeyExchange(HandshakeInStream input)
|
||||
+ throws IOException, GeneralSecurityException {
|
||||
dh_p = input.getBytes16();
|
||||
dh_g = input.getBytes16();
|
||||
dh_Ys = input.getBytes16();
|
||||
+ KeyUtil.validate(new DHPublicKeySpec(new BigInteger(1, dh_Ys),
|
||||
+ new BigInteger(1, dh_p),
|
||||
+ new BigInteger(1, dh_g)));
|
||||
signature = null;
|
||||
}
|
||||
|
||||
@@ -770,7 +778,9 @@ class DH_ServerKeyExchange extends Serve
|
||||
dh_p = input.getBytes16();
|
||||
dh_g = input.getBytes16();
|
||||
dh_Ys = input.getBytes16();
|
||||
-
|
||||
+ KeyUtil.validate(new DHPublicKeySpec(new BigInteger(1, dh_Ys),
|
||||
+ new BigInteger(1, dh_p),
|
||||
+ new BigInteger(1, dh_g)));
|
||||
byte signature[];
|
||||
if (dhKeyExchangeFix) {
|
||||
signature = input.getBytes16();
|
||||
diff --git a/src/share/classes/sun/security/ssl/RSAClientKeyExchange.java b/src/share/classes/sun/security/ssl/RSAClientKeyExchange.java
|
||||
--- jdk/src/share/classes/sun/security/ssl/RSAClientKeyExchange.java
|
||||
+++ jdk/src/share/classes/sun/security/ssl/RSAClientKeyExchange.java
|
||||
@@ -36,7 +36,7 @@ import javax.net.ssl.*;
|
||||
import javax.net.ssl.*;
|
||||
|
||||
import sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec;
|
||||
-import sun.security.util.KeyLength;
|
||||
+import sun.security.util.KeyUtil;
|
||||
|
||||
/**
|
||||
* This is the client key exchange message (CLIENT --> SERVER) used with
|
||||
@@ -194,7 +194,7 @@ final class RSAClientKeyExchange extends
|
||||
"unable to get the plaintext of the premaster secret");
|
||||
}
|
||||
|
||||
- int keySize = KeyLength.getKeySize(secretKey);
|
||||
+ int keySize = KeyUtil.getKeySize(secretKey);
|
||||
if (keySize > 0 && keySize != 384) { // 384 = 48 * 8
|
||||
if (debug != null && Debug.isOn("handshake")) {
|
||||
System.out.println(
|
||||
diff --git a/src/share/classes/sun/security/ssl/ServerHandshaker.java b/src/share/classes/sun/security/ssl/ServerHandshaker.java
|
||||
--- jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java
|
||||
+++ jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java
|
||||
@@ -1147,7 +1147,7 @@ final class ServerHandshaker extends Han
|
||||
if (debug != null && Debug.isOn("handshake")) {
|
||||
mesg.print(System.out);
|
||||
}
|
||||
- return dh.getAgreedSecret(mesg.getClientPublicKey());
|
||||
+ return dh.getAgreedSecret(mesg.getClientPublicKey(), false);
|
||||
}
|
||||
|
||||
private SecretKey clientKeyExchange(ECDHClientKeyExchange mesg)
|
||||
diff --git a/src/share/classes/sun/security/util/KeyLength.java b/src/share/classes/sun/security/util/KeyLength.java
|
||||
deleted file mode 100644
|
||||
--- jdk/src/share/classes/sun/security/util/KeyLength.java
|
||||
+++ /dev/null
|
||||
@@ -1,91 +0,0 @@
|
||||
-/*
|
||||
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
- *
|
||||
- * This code is free software; you can redistribute it and/or modify it
|
||||
- * under the terms of the GNU General Public License version 2 only, as
|
||||
- * published by the Free Software Foundation. Oracle designates this
|
||||
- * particular file as subject to the "Classpath" exception as provided
|
||||
- * by Oracle in the LICENSE file that accompanied this code.
|
||||
- *
|
||||
- * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
- * version 2 for more details (a copy is included in the LICENSE file that
|
||||
- * accompanied this code).
|
||||
- *
|
||||
- * You should have received a copy of the GNU General Public License version
|
||||
- * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
- *
|
||||
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
- * or visit www.oracle.com if you need additional information or have any
|
||||
- * questions.
|
||||
- */
|
||||
-
|
||||
-package sun.security.util;
|
||||
-
|
||||
-import java.security.Key;
|
||||
-import java.security.PrivilegedAction;
|
||||
-import java.security.AccessController;
|
||||
-import java.security.interfaces.ECKey;
|
||||
-import java.security.interfaces.RSAKey;
|
||||
-import java.security.interfaces.DSAKey;
|
||||
-import javax.crypto.SecretKey;
|
||||
-import javax.crypto.interfaces.DHKey;
|
||||
-
|
||||
-/**
|
||||
- * A utility class to get key length
|
||||
- */
|
||||
-public final class KeyLength {
|
||||
-
|
||||
- /**
|
||||
- * Returns the key size of the given key object in bits.
|
||||
- *
|
||||
- * @param key the key object, cannot be null
|
||||
- * @return the key size of the given key object in bits, or -1 if the
|
||||
- * key size is not accessible
|
||||
- */
|
||||
- final public static int getKeySize(Key key) {
|
||||
- int size = -1;
|
||||
-
|
||||
- if (key instanceof Length) {
|
||||
- try {
|
||||
- Length ruler = (Length)key;
|
||||
- size = ruler.length();
|
||||
- } catch (UnsupportedOperationException usoe) {
|
||||
- // ignore the exception
|
||||
- }
|
||||
-
|
||||
- if (size >= 0) {
|
||||
- return size;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- // try to parse the length from key specification
|
||||
- if (key instanceof SecretKey) {
|
||||
- SecretKey sk = (SecretKey)key;
|
||||
- String format = sk.getFormat();
|
||||
- if ("RAW".equals(format) && sk.getEncoded() != null) {
|
||||
- size = (sk.getEncoded().length * 8);
|
||||
- } // Otherwise, it may be a unextractable key of PKCS#11, or
|
||||
- // a key we are not able to handle.
|
||||
- } else if (key instanceof RSAKey) {
|
||||
- RSAKey pubk = (RSAKey)key;
|
||||
- size = pubk.getModulus().bitLength();
|
||||
- } else if (key instanceof ECKey) {
|
||||
- ECKey pubk = (ECKey)key;
|
||||
- size = pubk.getParams().getOrder().bitLength();
|
||||
- } else if (key instanceof DSAKey) {
|
||||
- DSAKey pubk = (DSAKey)key;
|
||||
- size = pubk.getParams().getP().bitLength();
|
||||
- } else if (key instanceof DHKey) {
|
||||
- DHKey pubk = (DHKey)key;
|
||||
- size = pubk.getParams().getP().bitLength();
|
||||
- } // Otherwise, it may be a unextractable key of PKCS#11, or
|
||||
- // a key we are not able to handle.
|
||||
-
|
||||
- return size;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
diff --git a/src/share/classes/sun/security/util/KeyUtil.java b/src/share/classes/sun/security/util/KeyUtil.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ jdk/src/share/classes/sun/security/util/KeyUtil.java
|
||||
@@ -0,0 +1,184 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+package sun.security.util;
|
||||
+
|
||||
+import java.security.Key;
|
||||
+import java.security.PrivilegedAction;
|
||||
+import java.security.AccessController;
|
||||
+import java.security.InvalidKeyException;
|
||||
+import java.security.interfaces.ECKey;
|
||||
+import java.security.interfaces.RSAKey;
|
||||
+import java.security.interfaces.DSAKey;
|
||||
+import java.security.spec.KeySpec;
|
||||
+import javax.crypto.SecretKey;
|
||||
+import javax.crypto.interfaces.DHKey;
|
||||
+import javax.crypto.interfaces.DHPublicKey;
|
||||
+import javax.crypto.spec.DHParameterSpec;
|
||||
+import javax.crypto.spec.DHPublicKeySpec;
|
||||
+import java.math.BigInteger;
|
||||
+
|
||||
+/**
|
||||
+ * A utility class to get key length, valiate keys, etc.
|
||||
+ */
|
||||
+public final class KeyUtil {
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the key size of the given key object in bits.
|
||||
+ *
|
||||
+ * @param key the key object, cannot be null
|
||||
+ * @return the key size of the given key object in bits, or -1 if the
|
||||
+ * key size is not accessible
|
||||
+ */
|
||||
+ public static final int getKeySize(Key key) {
|
||||
+ int size = -1;
|
||||
+
|
||||
+ if (key instanceof Length) {
|
||||
+ try {
|
||||
+ Length ruler = (Length)key;
|
||||
+ size = ruler.length();
|
||||
+ } catch (UnsupportedOperationException usoe) {
|
||||
+ // ignore the exception
|
||||
+ }
|
||||
+
|
||||
+ if (size >= 0) {
|
||||
+ return size;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // try to parse the length from key specification
|
||||
+ if (key instanceof SecretKey) {
|
||||
+ SecretKey sk = (SecretKey)key;
|
||||
+ String format = sk.getFormat();
|
||||
+ if ("RAW".equals(format) && sk.getEncoded() != null) {
|
||||
+ size = (sk.getEncoded().length * 8);
|
||||
+ } // Otherwise, it may be a unextractable key of PKCS#11, or
|
||||
+ // a key we are not able to handle.
|
||||
+ } else if (key instanceof RSAKey) {
|
||||
+ RSAKey pubk = (RSAKey)key;
|
||||
+ size = pubk.getModulus().bitLength();
|
||||
+ } else if (key instanceof ECKey) {
|
||||
+ ECKey pubk = (ECKey)key;
|
||||
+ size = pubk.getParams().getOrder().bitLength();
|
||||
+ } else if (key instanceof DSAKey) {
|
||||
+ DSAKey pubk = (DSAKey)key;
|
||||
+ size = pubk.getParams().getP().bitLength();
|
||||
+ } else if (key instanceof DHKey) {
|
||||
+ DHKey pubk = (DHKey)key;
|
||||
+ size = pubk.getParams().getP().bitLength();
|
||||
+ } // Otherwise, it may be a unextractable key of PKCS#11, or
|
||||
+ // a key we are not able to handle.
|
||||
+
|
||||
+ return size;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns whether the key is valid or not.
|
||||
+ * <P>
|
||||
+ * Note that this method is only apply to DHPublicKey at present.
|
||||
+ *
|
||||
+ * @param publicKey
|
||||
+ * the key object, cannot be null
|
||||
+ *
|
||||
+ * @throws NullPointerException if {@code publicKey} is null
|
||||
+ * @throws InvalidKeyException if {@code publicKey} is invalid
|
||||
+ */
|
||||
+ public static final void validate(Key key)
|
||||
+ throws InvalidKeyException {
|
||||
+ if (key == null) {
|
||||
+ throw new NullPointerException(
|
||||
+ "The key to be validated cannot be null");
|
||||
+ }
|
||||
+
|
||||
+ if (key instanceof DHPublicKey) {
|
||||
+ validateDHPublicKey((DHPublicKey)key);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ /**
|
||||
+ * Returns whether the key spec is valid or not.
|
||||
+ * <P>
|
||||
+ * Note that this method is only apply to DHPublicKeySpec at present.
|
||||
+ *
|
||||
+ * @param keySpec
|
||||
+ * the key spec object, cannot be null
|
||||
+ *
|
||||
+ * @throws NullPointerException if {@code keySpec} is null
|
||||
+ * @throws InvalidKeyException if {@code keySpec} is invalid
|
||||
+ */
|
||||
+ public static final void validate(KeySpec keySpec)
|
||||
+ throws InvalidKeyException {
|
||||
+ if (keySpec == null) {
|
||||
+ throw new NullPointerException(
|
||||
+ "The key spec to be validated cannot be null");
|
||||
+ }
|
||||
+
|
||||
+ if (keySpec instanceof DHPublicKeySpec) {
|
||||
+ validateDHPublicKey((DHPublicKeySpec)keySpec);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns whether the specified provider is Oracle provider or not.
|
||||
+ * <P>
|
||||
+ * Note that this method is only apply to SunJCE and SunPKCS11 at present.
|
||||
+ *
|
||||
+ * @param providerName
|
||||
+ * the provider name
|
||||
+ * @return true if, and only if, the provider of the specified
|
||||
+ * {@code providerName} is Oracle provider
|
||||
+ */
|
||||
+ public static final boolean isOracleJCEProvider(String providerName) {
|
||||
+ return providerName != null && (providerName.equals("SunJCE") ||
|
||||
+ providerName.startsWith("SunPKCS11"));
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns whether the Diffie-Hellman public key is valid or not.
|
||||
+ *
|
||||
+ * Per RFC 2631 and NIST SP800-56A, the following algorithm is used to
|
||||
+ * validate Diffie-Hellman public keys:
|
||||
+ * 1. Verify that y lies within the interval [2,p-1]. If it does not,
|
||||
+ * the key is invalid.
|
||||
+ * 2. Compute y^q mod p. If the result == 1, the key is valid.
|
||||
+ * Otherwise the key is invalid.
|
||||
+ */
|
||||
+ private static void validateDHPublicKey(DHPublicKey publicKey)
|
||||
+ throws InvalidKeyException {
|
||||
+ DHParameterSpec paramSpec = publicKey.getParams();
|
||||
+
|
||||
+ BigInteger p = paramSpec.getP();
|
||||
+ BigInteger g = paramSpec.getG();
|
||||
+ BigInteger y = publicKey.getY();
|
||||
+
|
||||
+ validateDHPublicKey(p, g, y);
|
||||
+ }
|
||||
+
|
||||
+ private static void validateDHPublicKey(DHPublicKeySpec publicKeySpec)
|
||||
+ throws InvalidKeyException {
|
||||
+ validateDHPublicKey(publicKeySpec.getP(),
|
||||
+ publicKeySpec.getG(), publicKeySpec.getY());
|
||||
+ }
|
||||
+
|
||||
+ private static void validateDHPublicKey(BigInteger p,
|
||||
+ BigInteger g, BigInteger y) throws InvalidKeyException {
|
||||
+
|
||||
+ // For better interoperability, the interval is limited to [2, p-2].
|
||||
+ BigInteger leftOpen = BigInteger.ONE;
|
||||
+ BigInteger rightOpen = p.subtract(BigInteger.ONE);
|
||||
+ if (y.compareTo(leftOpen) <= 0) {
|
||||
+ throw new InvalidKeyException(
|
||||
+ "Diffie-Hellman public key is too small");
|
||||
+ }
|
||||
+ if (y.compareTo(rightOpen) >= 0) {
|
||||
+ throw new InvalidKeyException(
|
||||
+ "Diffie-Hellman public key is too large");
|
||||
+ }
|
||||
+
|
||||
+ // Don't bother to check against the y^q mod p if safe primes are used.
|
||||
+ }
|
||||
+}
|
@ -1,60 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User mbankal
|
||||
# Date 1355294606 28800
|
||||
# Node ID 708c134c36312faf8721c0c981be6553e4ebf49f
|
||||
# Parent 175c95df5b8609142188946b59040de2e4cbe0af
|
||||
7192393: Better Checking of order of TLS Messages
|
||||
Reviewed-by: xuelei
|
||||
|
||||
diff --git a/src/share/classes/sun/security/ssl/ClientHandshaker.java b/src/share/classes/sun/security/ssl/ClientHandshaker.java
|
||||
--- jdk/src/share/classes/sun/security/ssl/ClientHandshaker.java
|
||||
+++ jdk/src/share/classes/sun/security/ssl/ClientHandshaker.java
|
||||
@@ -128,9 +128,8 @@ final class ClientHandshaker extends Han
|
||||
* in the constructor.
|
||||
*/
|
||||
void processMessage(byte type, int messageLen) throws IOException {
|
||||
- if (state > type
|
||||
- && (type != HandshakeMessage.ht_hello_request
|
||||
- && state != HandshakeMessage.ht_client_hello)) {
|
||||
+ if (state >= type
|
||||
+ && (type != HandshakeMessage.ht_hello_request)) {
|
||||
throw new SSLProtocolException(
|
||||
"Handshake message sequence violation, " + type);
|
||||
}
|
||||
diff --git a/src/share/classes/sun/security/ssl/ServerHandshaker.java b/src/share/classes/sun/security/ssl/ServerHandshaker.java
|
||||
--- jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java
|
||||
+++ jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java
|
||||
@@ -153,7 +153,7 @@ final class ServerHandshaker extends Han
|
||||
// In SSLv3 and TLS, messages follow strictly increasing
|
||||
// numerical order _except_ for one annoying special case.
|
||||
//
|
||||
- if ((state > type)
|
||||
+ if ((state >= type)
|
||||
&& (state != HandshakeMessage.ht_client_key_exchange
|
||||
&& type != HandshakeMessage.ht_certificate_verify)) {
|
||||
throw new SSLProtocolException(
|
||||
@@ -250,16 +250,17 @@ final class ServerHandshaker extends Han
|
||||
}
|
||||
|
||||
//
|
||||
- // Move the state machine forward except for that annoying
|
||||
- // special case. This means that clients could send extra
|
||||
- // cert verify messages; not a problem so long as all of
|
||||
- // them actually check out.
|
||||
+ // Move state machine forward if the message handling
|
||||
+ // code didn't already do so
|
||||
//
|
||||
- if (state < type && type != HandshakeMessage.ht_certificate_verify) {
|
||||
- state = type;
|
||||
+ if (state < type) {
|
||||
+ if(type == HandshakeMessage.ht_certificate_verify) {
|
||||
+ state = type + 2; // an annoying special case
|
||||
+ } else {
|
||||
+ state = type;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
-
|
||||
|
||||
/*
|
||||
* ClientHello presents the server with a bunch of options, to which the
|
@ -1,436 +0,0 @@
|
||||
diff --git a/src/share/classes/java/awt/EventQueue.java b/src/share/classes/java/awt/EventQueue.java
|
||||
--- jdk/src/share/classes/java/awt/EventQueue.java
|
||||
+++ jdk/src/share/classes/java/awt/EventQueue.java
|
||||
@@ -173,8 +173,14 @@ public class EventQueue {
|
||||
}
|
||||
public void removeSourceEvents(EventQueue eventQueue,
|
||||
Object source,
|
||||
- boolean removeAllEvents) {
|
||||
+ boolean removeAllEvents)
|
||||
+ {
|
||||
eventQueue.removeSourceEvents(source, removeAllEvents);
|
||||
+ }
|
||||
+ public void invokeAndWait(Object source, Runnable r)
|
||||
+ throws InterruptedException, InvocationTargetException
|
||||
+ {
|
||||
+ EventQueue.invokeAndWait(source, r);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1042,8 +1048,14 @@ public class EventQueue {
|
||||
* @since 1.2
|
||||
*/
|
||||
public static void invokeAndWait(Runnable runnable)
|
||||
- throws InterruptedException, InvocationTargetException {
|
||||
+ throws InterruptedException, InvocationTargetException
|
||||
+ {
|
||||
+ invokeAndWait(Toolkit.getDefaultToolkit(), runnable);
|
||||
+ }
|
||||
|
||||
+ static void invokeAndWait(Object source, Runnable runnable)
|
||||
+ throws InterruptedException, InvocationTargetException
|
||||
+ {
|
||||
if (EventQueue.isDispatchThread()) {
|
||||
throw new Error("Cannot call invokeAndWait from the event dispatcher thread");
|
||||
}
|
||||
@@ -1052,8 +1064,7 @@ public class EventQueue {
|
||||
Object lock = new AWTInvocationLock();
|
||||
|
||||
InvocationEvent event =
|
||||
- new InvocationEvent(Toolkit.getDefaultToolkit(), runnable, lock,
|
||||
- true);
|
||||
+ new InvocationEvent(source, runnable, lock, true);
|
||||
|
||||
synchronized (lock) {
|
||||
Toolkit.getEventQueue().postEvent(event);
|
||||
diff --git a/src/share/classes/java/awt/Window.java b/src/share/classes/java/awt/Window.java
|
||||
--- jdk/src/share/classes/java/awt/Window.java
|
||||
+++ jdk/src/share/classes/java/awt/Window.java
|
||||
@@ -1036,7 +1036,7 @@ public class Window extends Container im
|
||||
}
|
||||
else {
|
||||
try {
|
||||
- EventQueue.invokeAndWait(action);
|
||||
+ EventQueue.invokeAndWait(this, action);
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
System.err.println("Disposal was interrupted:");
|
||||
diff --git a/src/share/classes/javax/swing/RepaintManager.java b/src/share/classes/javax/swing/RepaintManager.java
|
||||
--- jdk/src/share/classes/javax/swing/RepaintManager.java
|
||||
+++ jdk/src/share/classes/javax/swing/RepaintManager.java
|
||||
@@ -27,17 +27,21 @@ package javax.swing;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
-import java.awt.peer.ComponentPeer;
|
||||
-import java.awt.peer.ContainerPeer;
|
||||
import java.awt.image.VolatileImage;
|
||||
+import java.security.AccessControlContext;
|
||||
import java.security.AccessController;
|
||||
+import java.security.PrivilegedAction;
|
||||
import java.util.*;
|
||||
+import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.applet.*;
|
||||
|
||||
import sun.awt.AppContext;
|
||||
+import sun.awt.AWTAccessor;
|
||||
import sun.awt.DisplayChangedListener;
|
||||
import sun.awt.SunToolkit;
|
||||
import sun.java2d.SunGraphicsEnvironment;
|
||||
+import sun.misc.JavaSecurityAccess;
|
||||
+import sun.misc.SharedSecrets;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
|
||||
@@ -168,6 +172,9 @@ public class RepaintManager
|
||||
* Runnable used to process all repaint/revalidate requests.
|
||||
*/
|
||||
private final ProcessingRunnable processingRunnable;
|
||||
+
|
||||
+ private final static JavaSecurityAccess javaSecurityAccess =
|
||||
+ SharedSecrets.getJavaSecurityAccess();
|
||||
|
||||
|
||||
static {
|
||||
@@ -553,13 +560,26 @@ public class RepaintManager
|
||||
// This is called from the toolkit thread when awt needs to run a
|
||||
// Runnable before we paint.
|
||||
//
|
||||
- void nativeQueueSurfaceDataRunnable(AppContext appContext, Component c,
|
||||
- Runnable r) {
|
||||
+ void nativeQueueSurfaceDataRunnable(AppContext appContext,
|
||||
+ final Component c, final Runnable r)
|
||||
+ {
|
||||
synchronized(this) {
|
||||
if (runnableList == null) {
|
||||
runnableList = new LinkedList<Runnable>();
|
||||
}
|
||||
- runnableList.add(r);
|
||||
+ runnableList.add(new Runnable() {
|
||||
+ public void run() {
|
||||
+ AccessControlContext stack = AccessController.getContext();
|
||||
+ AccessControlContext acc =
|
||||
+ AWTAccessor.getComponentAccessor().getAccessControlContext(c);
|
||||
+ javaSecurityAccess.doIntersectionPrivilege(new PrivilegedAction<Void>() {
|
||||
+ public Void run() {
|
||||
+ r.run();
|
||||
+ return null;
|
||||
+ }
|
||||
+ }, stack, acc);
|
||||
+ }
|
||||
+ });
|
||||
}
|
||||
scheduleProcessingRunnable(appContext);
|
||||
}
|
||||
@@ -639,9 +659,9 @@ public class RepaintManager
|
||||
* @see #addInvalidComponent
|
||||
*/
|
||||
public void validateInvalidComponents() {
|
||||
- java.util.List<Component> ic;
|
||||
+ final java.util.List<Component> ic;
|
||||
synchronized(this) {
|
||||
- if(invalidComponents == null) {
|
||||
+ if (invalidComponents == null) {
|
||||
return;
|
||||
}
|
||||
ic = invalidComponents;
|
||||
@@ -649,7 +669,17 @@ public class RepaintManager
|
||||
}
|
||||
int n = ic.size();
|
||||
for(int i = 0; i < n; i++) {
|
||||
- ic.get(i).validate();
|
||||
+ final Component c = ic.get(i);
|
||||
+ AccessControlContext stack = AccessController.getContext();
|
||||
+ AccessControlContext acc =
|
||||
+ AWTAccessor.getComponentAccessor().getAccessControlContext(c);
|
||||
+ javaSecurityAccess.doIntersectionPrivilege(
|
||||
+ new PrivilegedAction<Void>() {
|
||||
+ public Void run() {
|
||||
+ c.validate();
|
||||
+ return null;
|
||||
+ }
|
||||
+ }, stack, acc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -696,76 +726,75 @@ public class RepaintManager
|
||||
paintDirtyRegions(tmpDirtyComponents);
|
||||
}
|
||||
|
||||
- private void paintDirtyRegions(Map<Component,Rectangle>
|
||||
- tmpDirtyComponents){
|
||||
- int i, count;
|
||||
- java.util.List<Component> roots;
|
||||
- Component dirtyComponent;
|
||||
-
|
||||
- count = tmpDirtyComponents.size();
|
||||
- if (count == 0) {
|
||||
+ private void paintDirtyRegions(
|
||||
+ final Map<Component,Rectangle> tmpDirtyComponents)
|
||||
+ {
|
||||
+ if (tmpDirtyComponents.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
- Rectangle rect;
|
||||
- int localBoundsX = 0;
|
||||
- int localBoundsY = 0;
|
||||
- int localBoundsH = 0;
|
||||
- int localBoundsW = 0;
|
||||
- Enumeration keys;
|
||||
-
|
||||
- roots = new ArrayList<Component>(count);
|
||||
+ final java.util.List<Component> roots =
|
||||
+ new ArrayList<Component>(tmpDirtyComponents.size());
|
||||
|
||||
for (Component dirty : tmpDirtyComponents.keySet()) {
|
||||
collectDirtyComponents(tmpDirtyComponents, dirty, roots);
|
||||
}
|
||||
|
||||
- count = roots.size();
|
||||
- // System.out.println("roots size is " + count);
|
||||
+ final AtomicInteger count = new AtomicInteger(roots.size());
|
||||
painting = true;
|
||||
try {
|
||||
- for(i=0 ; i < count ; i++) {
|
||||
- dirtyComponent = roots.get(i);
|
||||
- rect = tmpDirtyComponents.get(dirtyComponent);
|
||||
- // System.out.println("Should refresh :" + rect);
|
||||
- localBoundsH = dirtyComponent.getHeight();
|
||||
- localBoundsW = dirtyComponent.getWidth();
|
||||
+ for(int j = 0; j < count.get(); j++) {
|
||||
+ final int i = j;
|
||||
+ final Component dirtyComponent = roots.get(j);
|
||||
|
||||
- SwingUtilities.computeIntersection(localBoundsX,
|
||||
- localBoundsY,
|
||||
- localBoundsW,
|
||||
- localBoundsH,
|
||||
- rect);
|
||||
- if (dirtyComponent instanceof JComponent) {
|
||||
- ((JComponent)dirtyComponent).paintImmediately(
|
||||
- rect.x,rect.y,rect.width, rect.height);
|
||||
- }
|
||||
- else if (dirtyComponent.isShowing()) {
|
||||
- Graphics g = JComponent.safelyGetGraphics(
|
||||
- dirtyComponent, dirtyComponent);
|
||||
- // If the Graphics goes away, it means someone disposed of
|
||||
- // the window, don't do anything.
|
||||
- if (g != null) {
|
||||
- g.setClip(rect.x, rect.y, rect.width, rect.height);
|
||||
- try {
|
||||
- dirtyComponent.paint(g);
|
||||
- } finally {
|
||||
- g.dispose();
|
||||
+ AccessControlContext stack = AccessController.getContext();
|
||||
+ AccessControlContext acc =
|
||||
+ AWTAccessor.getComponentAccessor().getAccessControlContext(dirtyComponent);
|
||||
+ javaSecurityAccess.doIntersectionPrivilege(new PrivilegedAction<Void>() {
|
||||
+ public Void run() {
|
||||
+ Rectangle rect = tmpDirtyComponents.get(dirtyComponent);
|
||||
+
|
||||
+ int localBoundsH = dirtyComponent.getHeight();
|
||||
+ int localBoundsW = dirtyComponent.getWidth();
|
||||
+ SwingUtilities.computeIntersection(0,
|
||||
+ 0,
|
||||
+ localBoundsW,
|
||||
+ localBoundsH,
|
||||
+ rect);
|
||||
+ if (dirtyComponent instanceof JComponent) {
|
||||
+ ((JComponent)dirtyComponent).paintImmediately(
|
||||
+ rect.x,rect.y,rect.width, rect.height);
|
||||
}
|
||||
+ else if (dirtyComponent.isShowing()) {
|
||||
+ Graphics g = JComponent.safelyGetGraphics(
|
||||
+ dirtyComponent, dirtyComponent);
|
||||
+ // If the Graphics goes away, it means someone disposed of
|
||||
+ // the window, don't do anything.
|
||||
+ if (g != null) {
|
||||
+ g.setClip(rect.x, rect.y, rect.width, rect.height);
|
||||
+ try {
|
||||
+ dirtyComponent.paint(g);
|
||||
+ } finally {
|
||||
+ g.dispose();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // If the repaintRoot has been set, service it now and
|
||||
+ // remove any components that are children of repaintRoot.
|
||||
+ if (repaintRoot != null) {
|
||||
+ adjustRoots(repaintRoot, roots, i + 1);
|
||||
+ count.set(roots.size());
|
||||
+ paintManager.isRepaintingRoot = true;
|
||||
+ repaintRoot.paintImmediately(0, 0, repaintRoot.getWidth(),
|
||||
+ repaintRoot.getHeight());
|
||||
+ paintManager.isRepaintingRoot = false;
|
||||
+ // Only service repaintRoot once.
|
||||
+ repaintRoot = null;
|
||||
+ }
|
||||
+
|
||||
+ return null;
|
||||
}
|
||||
- }
|
||||
- // If the repaintRoot has been set, service it now and
|
||||
- // remove any components that are children of repaintRoot.
|
||||
- if (repaintRoot != null) {
|
||||
- adjustRoots(repaintRoot, roots, i + 1);
|
||||
- count = roots.size();
|
||||
- paintManager.isRepaintingRoot = true;
|
||||
- repaintRoot.paintImmediately(0, 0, repaintRoot.getWidth(),
|
||||
- repaintRoot.getHeight());
|
||||
- paintManager.isRepaintingRoot = false;
|
||||
- // Only service repaintRoot once.
|
||||
- repaintRoot = null;
|
||||
- }
|
||||
+ }, stack, acc);
|
||||
}
|
||||
} finally {
|
||||
painting = false;
|
||||
diff --git a/src/share/classes/sun/applet/AppletPanel.java b/src/share/classes/sun/applet/AppletPanel.java
|
||||
--- jdk/src/share/classes/sun/applet/AppletPanel.java
|
||||
+++ jdk/src/share/classes/sun/applet/AppletPanel.java
|
||||
@@ -47,6 +47,7 @@ import java.util.WeakHashMap;
|
||||
import java.util.WeakHashMap;
|
||||
import javax.swing.SwingUtilities;
|
||||
import sun.awt.AppContext;
|
||||
+import sun.awt.AWTAccessor;
|
||||
import sun.awt.EmbeddedFrame;
|
||||
import sun.awt.SunToolkit;
|
||||
import sun.misc.MessageUtils;
|
||||
@@ -449,12 +450,12 @@ abstract class AppletPanel extends Panel
|
||||
// to avoid deadlock.
|
||||
try {
|
||||
final AppletPanel p = this;
|
||||
-
|
||||
- SwingUtilities.invokeAndWait(new Runnable() {
|
||||
- public void run() {
|
||||
- p.validate();
|
||||
- }
|
||||
- });
|
||||
+ Runnable r = new Runnable() {
|
||||
+ public void run() {
|
||||
+ p.validate();
|
||||
+ }
|
||||
+ };
|
||||
+ AWTAccessor.getEventQueueAccessor().invokeAndWait(applet, r);
|
||||
}
|
||||
catch(InterruptedException ie) {
|
||||
}
|
||||
@@ -479,18 +480,19 @@ abstract class AppletPanel extends Panel
|
||||
try {
|
||||
final AppletPanel p = this;
|
||||
final Applet a = applet;
|
||||
+ Runnable r = new Runnable() {
|
||||
+ public void run() {
|
||||
+ p.validate();
|
||||
+ a.setVisible(true);
|
||||
|
||||
- SwingUtilities.invokeAndWait(new Runnable() {
|
||||
- public void run() {
|
||||
- p.validate();
|
||||
- a.setVisible(true);
|
||||
-
|
||||
- // Fix for BugTraq ID 4041703.
|
||||
- // Set the default focus for an applet.
|
||||
- if (hasInitialFocus())
|
||||
- setDefaultFocus();
|
||||
+ // Fix for BugTraq ID 4041703.
|
||||
+ // Set the default focus for an applet.
|
||||
+ if (hasInitialFocus()) {
|
||||
+ setDefaultFocus();
|
||||
}
|
||||
- });
|
||||
+ }
|
||||
+ };
|
||||
+ AWTAccessor.getEventQueueAccessor().invokeAndWait(applet, r);
|
||||
}
|
||||
catch(InterruptedException ie) {
|
||||
}
|
||||
@@ -513,13 +515,12 @@ abstract class AppletPanel extends Panel
|
||||
// to avoid deadlock.
|
||||
try {
|
||||
final Applet a = applet;
|
||||
-
|
||||
- SwingUtilities.invokeAndWait(new Runnable() {
|
||||
- public void run()
|
||||
- {
|
||||
- a.setVisible(false);
|
||||
- }
|
||||
- });
|
||||
+ Runnable r = new Runnable() {
|
||||
+ public void run() {
|
||||
+ a.setVisible(false);
|
||||
+ }
|
||||
+ };
|
||||
+ AWTAccessor.getEventQueueAccessor().invokeAndWait(applet, r);
|
||||
}
|
||||
catch(InterruptedException ie) {
|
||||
}
|
||||
@@ -571,17 +572,14 @@ abstract class AppletPanel extends Panel
|
||||
}
|
||||
status = APPLET_DISPOSE;
|
||||
|
||||
- try
|
||||
- {
|
||||
+ try {
|
||||
final Applet a = applet;
|
||||
-
|
||||
- EventQueue.invokeAndWait(new Runnable()
|
||||
- {
|
||||
- public void run()
|
||||
- {
|
||||
+ Runnable r = new Runnable() {
|
||||
+ public void run() {
|
||||
remove(a);
|
||||
}
|
||||
- });
|
||||
+ };
|
||||
+ AWTAccessor.getEventQueueAccessor().invokeAndWait(applet, r);
|
||||
}
|
||||
catch(InterruptedException ie)
|
||||
{
|
||||
diff --git a/src/share/classes/sun/awt/AWTAccessor.java b/src/share/classes/sun/awt/AWTAccessor.java
|
||||
--- jdk/src/share/classes/sun/awt/AWTAccessor.java
|
||||
+++ jdk/src/share/classes/sun/awt/AWTAccessor.java
|
||||
@@ -29,6 +29,7 @@ import java.awt.*;
|
||||
|
||||
import sun.misc.Unsafe;
|
||||
|
||||
+import java.lang.reflect.InvocationTargetException;
|
||||
import java.security.AccessControlContext;
|
||||
|
||||
import java.util.Vector;
|
||||
@@ -198,6 +199,11 @@ public final class AWTAccessor {
|
||||
*/
|
||||
void removeSourceEvents(EventQueue eventQueue, Object source,
|
||||
boolean removeAllEvents);
|
||||
+ /**
|
||||
+ * Static in EventQueue
|
||||
+ */
|
||||
+ void invokeAndWait(Object source, Runnable r)
|
||||
+ throws InterruptedException, InvocationTargetException;
|
||||
}
|
||||
|
||||
/**
|
||||
diff --git a/src/windows/classes/sun/awt/windows/WComponentPeer.java b/src/windows/classes/sun/awt/windows/WComponentPeer.java
|
||||
--- jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java
|
||||
+++ jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java
|
||||
@@ -427,14 +427,15 @@ public abstract class WComponentPeer ext
|
||||
try {
|
||||
replaceSurfaceData();
|
||||
} catch (InvalidPipeException e) {
|
||||
- // REMIND : what do we do if our surface creation failed?
|
||||
+ // REMIND : what do we do if our surface creation failed?
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
+ Component c = (Component)target;
|
||||
// Fix 6255371.
|
||||
- if (!PaintEventDispatcher.getPaintEventDispatcher().queueSurfaceDataReplacing((Component)target, r)) {
|
||||
- postEvent(new InvocationEvent(Toolkit.getDefaultToolkit(), r));
|
||||
+ if (!PaintEventDispatcher.getPaintEventDispatcher().queueSurfaceDataReplacing(c, r)) {
|
||||
+ postEvent(new InvocationEvent(c, r));
|
||||
}
|
||||
}
|
||||
|
@ -1,479 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User mbankal
|
||||
# Date 1355327990 28800
|
||||
# Node ID 41f8dd88c5e9aec4975c36414a865aed5643c880
|
||||
# Parent 708c134c36312faf8721c0c981be6553e4ebf49f
|
||||
7197546: (proxy) Reflect about creating reflective proxies
|
||||
Reviewed-by: mchung
|
||||
|
||||
diff --git a/src/share/classes/java/lang/Class.java b/src/share/classes/java/lang/Class.java
|
||||
--- jdk/src/share/classes/java/lang/Class.java
|
||||
+++ jdk/src/share/classes/java/lang/Class.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 1994, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -65,7 +65,9 @@ import sun.reflect.generics.scope.ClassS
|
||||
import sun.reflect.generics.scope.ClassScope;
|
||||
import sun.security.util.SecurityConstants;
|
||||
import java.lang.annotation.Annotation;
|
||||
+import java.lang.reflect.Proxy;
|
||||
import sun.reflect.annotation.*;
|
||||
+import sun.reflect.misc.ReflectUtil;
|
||||
|
||||
/**
|
||||
* Instances of the class {@code Class} represent classes and
|
||||
@@ -320,7 +322,7 @@ public final
|
||||
throws InstantiationException, IllegalAccessException
|
||||
{
|
||||
if (System.getSecurityManager() != null) {
|
||||
- checkMemberAccess(Member.PUBLIC, ClassLoader.getCallerClassLoader());
|
||||
+ checkMemberAccess(Member.PUBLIC, ClassLoader.getCallerClassLoader(), false);
|
||||
}
|
||||
return newInstance0();
|
||||
}
|
||||
@@ -1294,7 +1296,7 @@ public final
|
||||
// be very careful not to change the stack depth of this
|
||||
// checkMemberAccess call for security reasons
|
||||
// see java.lang.SecurityManager.checkMemberAccess
|
||||
- checkMemberAccess(Member.PUBLIC, ClassLoader.getCallerClassLoader());
|
||||
+ checkMemberAccess(Member.PUBLIC, ClassLoader.getCallerClassLoader(), false);
|
||||
|
||||
// Privileged so this implementation can look at DECLARED classes,
|
||||
// something the caller might not have privilege to do. The code here
|
||||
@@ -1372,7 +1374,7 @@ public final
|
||||
// be very careful not to change the stack depth of this
|
||||
// checkMemberAccess call for security reasons
|
||||
// see java.lang.SecurityManager.checkMemberAccess
|
||||
- checkMemberAccess(Member.PUBLIC, ClassLoader.getCallerClassLoader());
|
||||
+ checkMemberAccess(Member.PUBLIC, ClassLoader.getCallerClassLoader(), true);
|
||||
return copyFields(privateGetPublicFields(null));
|
||||
}
|
||||
|
||||
@@ -1423,7 +1425,7 @@ public final
|
||||
// be very careful not to change the stack depth of this
|
||||
// checkMemberAccess call for security reasons
|
||||
// see java.lang.SecurityManager.checkMemberAccess
|
||||
- checkMemberAccess(Member.PUBLIC, ClassLoader.getCallerClassLoader());
|
||||
+ checkMemberAccess(Member.PUBLIC, ClassLoader.getCallerClassLoader(), true);
|
||||
return copyMethods(privateGetPublicMethods());
|
||||
}
|
||||
|
||||
@@ -1472,7 +1474,7 @@ public final
|
||||
// be very careful not to change the stack depth of this
|
||||
// checkMemberAccess call for security reasons
|
||||
// see java.lang.SecurityManager.checkMemberAccess
|
||||
- checkMemberAccess(Member.PUBLIC, ClassLoader.getCallerClassLoader());
|
||||
+ checkMemberAccess(Member.PUBLIC, ClassLoader.getCallerClassLoader(), true);
|
||||
return copyConstructors(privateGetDeclaredConstructors(true));
|
||||
}
|
||||
|
||||
@@ -1531,7 +1533,7 @@ public final
|
||||
// be very careful not to change the stack depth of this
|
||||
// checkMemberAccess call for security reasons
|
||||
// see java.lang.SecurityManager.checkMemberAccess
|
||||
- checkMemberAccess(Member.PUBLIC, ClassLoader.getCallerClassLoader());
|
||||
+ checkMemberAccess(Member.PUBLIC, ClassLoader.getCallerClassLoader(), true);
|
||||
Field field = getField0(name);
|
||||
if (field == null) {
|
||||
throw new NoSuchFieldException(name);
|
||||
@@ -1616,7 +1618,7 @@ public final
|
||||
// be very careful not to change the stack depth of this
|
||||
// checkMemberAccess call for security reasons
|
||||
// see java.lang.SecurityManager.checkMemberAccess
|
||||
- checkMemberAccess(Member.PUBLIC, ClassLoader.getCallerClassLoader());
|
||||
+ checkMemberAccess(Member.PUBLIC, ClassLoader.getCallerClassLoader(), true);
|
||||
Method method = getMethod0(name, parameterTypes);
|
||||
if (method == null) {
|
||||
throw new NoSuchMethodException(getName() + "." + name + argumentTypesToString(parameterTypes));
|
||||
@@ -1670,7 +1672,7 @@ public final
|
||||
// be very careful not to change the stack depth of this
|
||||
// checkMemberAccess call for security reasons
|
||||
// see java.lang.SecurityManager.checkMemberAccess
|
||||
- checkMemberAccess(Member.PUBLIC, ClassLoader.getCallerClassLoader());
|
||||
+ checkMemberAccess(Member.PUBLIC, ClassLoader.getCallerClassLoader(), true);
|
||||
return getConstructor0(parameterTypes, Member.PUBLIC);
|
||||
}
|
||||
|
||||
@@ -1712,7 +1714,7 @@ public final
|
||||
// be very careful not to change the stack depth of this
|
||||
// checkMemberAccess call for security reasons
|
||||
// see java.lang.SecurityManager.checkMemberAccess
|
||||
- checkMemberAccess(Member.DECLARED, ClassLoader.getCallerClassLoader());
|
||||
+ checkMemberAccess(Member.DECLARED, ClassLoader.getCallerClassLoader(), false);
|
||||
return getDeclaredClasses0();
|
||||
}
|
||||
|
||||
@@ -1756,7 +1758,7 @@ public final
|
||||
// be very careful not to change the stack depth of this
|
||||
// checkMemberAccess call for security reasons
|
||||
// see java.lang.SecurityManager.checkMemberAccess
|
||||
- checkMemberAccess(Member.DECLARED, ClassLoader.getCallerClassLoader());
|
||||
+ checkMemberAccess(Member.DECLARED, ClassLoader.getCallerClassLoader(), true);
|
||||
return copyFields(privateGetDeclaredFields(false));
|
||||
}
|
||||
|
||||
@@ -1804,7 +1806,7 @@ public final
|
||||
// be very careful not to change the stack depth of this
|
||||
// checkMemberAccess call for security reasons
|
||||
// see java.lang.SecurityManager.checkMemberAccess
|
||||
- checkMemberAccess(Member.DECLARED, ClassLoader.getCallerClassLoader());
|
||||
+ checkMemberAccess(Member.DECLARED, ClassLoader.getCallerClassLoader(), true);
|
||||
return copyMethods(privateGetDeclaredMethods(false));
|
||||
}
|
||||
|
||||
@@ -1849,7 +1851,7 @@ public final
|
||||
// be very careful not to change the stack depth of this
|
||||
// checkMemberAccess call for security reasons
|
||||
// see java.lang.SecurityManager.checkMemberAccess
|
||||
- checkMemberAccess(Member.DECLARED, ClassLoader.getCallerClassLoader());
|
||||
+ checkMemberAccess(Member.DECLARED, ClassLoader.getCallerClassLoader(), true);
|
||||
return copyConstructors(privateGetDeclaredConstructors(false));
|
||||
}
|
||||
|
||||
@@ -1893,7 +1895,7 @@ public final
|
||||
// be very careful not to change the stack depth of this
|
||||
// checkMemberAccess call for security reasons
|
||||
// see java.lang.SecurityManager.checkMemberAccess
|
||||
- checkMemberAccess(Member.DECLARED, ClassLoader.getCallerClassLoader());
|
||||
+ checkMemberAccess(Member.DECLARED, ClassLoader.getCallerClassLoader(), true);
|
||||
Field field = searchFields(privateGetDeclaredFields(false), name);
|
||||
if (field == null) {
|
||||
throw new NoSuchFieldException(name);
|
||||
@@ -1948,7 +1950,7 @@ public final
|
||||
// be very careful not to change the stack depth of this
|
||||
// checkMemberAccess call for security reasons
|
||||
// see java.lang.SecurityManager.checkMemberAccess
|
||||
- checkMemberAccess(Member.DECLARED, ClassLoader.getCallerClassLoader());
|
||||
+ checkMemberAccess(Member.DECLARED, ClassLoader.getCallerClassLoader(), true);
|
||||
Method method = searchMethods(privateGetDeclaredMethods(false), name, parameterTypes);
|
||||
if (method == null) {
|
||||
throw new NoSuchMethodException(getName() + "." + name + argumentTypesToString(parameterTypes));
|
||||
@@ -1998,7 +2000,7 @@ public final
|
||||
// be very careful not to change the stack depth of this
|
||||
// checkMemberAccess call for security reasons
|
||||
// see java.lang.SecurityManager.checkMemberAccess
|
||||
- checkMemberAccess(Member.DECLARED, ClassLoader.getCallerClassLoader());
|
||||
+ checkMemberAccess(Member.DECLARED, ClassLoader.getCallerClassLoader(), true);
|
||||
return getConstructor0(parameterTypes, Member.DECLARED);
|
||||
}
|
||||
|
||||
@@ -2168,18 +2170,26 @@ public final
|
||||
* <p> Default policy: allow all clients access with normal Java access
|
||||
* control.
|
||||
*/
|
||||
- private void checkMemberAccess(int which, ClassLoader ccl) {
|
||||
+ private void checkMemberAccess(int which, ClassLoader ccl, boolean checkProxyInterfaces) {
|
||||
SecurityManager s = System.getSecurityManager();
|
||||
if (s != null) {
|
||||
s.checkMemberAccess(this, which);
|
||||
ClassLoader cl = getClassLoader0();
|
||||
- if ((ccl != null) && (ccl != cl) &&
|
||||
- ((cl == null) || !cl.isAncestor(ccl))) {
|
||||
+ if (ReflectUtil.needsPackageAccessCheck(ccl, cl)) {
|
||||
+
|
||||
String name = this.getName();
|
||||
int i = name.lastIndexOf('.');
|
||||
if (i != -1) {
|
||||
- s.checkPackageAccess(name.substring(0, i));
|
||||
+ // skip the package access check on a proxy class in default proxy package
|
||||
+ String pkg = name.substring(0, i);
|
||||
+ if (!Proxy.isProxyClass(this) || !pkg.equals(ReflectUtil.PROXY_PACKAGE)) {
|
||||
+ s.checkPackageAccess(pkg);
|
||||
+ }
|
||||
}
|
||||
+ }
|
||||
+ // check package access on the proxy interfaces
|
||||
+ if (checkProxyInterfaces && Proxy.isProxyClass(this)) {
|
||||
+ ReflectUtil.checkProxyPackageAccess(ccl, this.getInterfaces());
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/src/share/classes/java/lang/reflect/Proxy.java b/src/share/classes/java/lang/reflect/Proxy.java
|
||||
--- jdk/src/share/classes/java/lang/reflect/Proxy.java
|
||||
+++ jdk/src/share/classes/java/lang/reflect/Proxy.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -27,6 +27,9 @@ package java.lang.reflect;
|
||||
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.WeakReference;
|
||||
+import java.security.AccessController;
|
||||
+import java.security.Permission;
|
||||
+import java.security.PrivilegedAction;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
@@ -35,6 +38,9 @@ import java.util.Set;
|
||||
import java.util.Set;
|
||||
import java.util.WeakHashMap;
|
||||
import sun.misc.ProxyGenerator;
|
||||
+import sun.reflect.Reflection;
|
||||
+import sun.reflect.misc.ReflectUtil;
|
||||
+import sun.security.util.SecurityConstants;
|
||||
|
||||
/**
|
||||
* {@code Proxy} provides static methods for creating dynamic proxy
|
||||
@@ -263,7 +269,67 @@ public class Proxy implements java.io.Se
|
||||
* @param h the invocation handler for this proxy instance
|
||||
*/
|
||||
protected Proxy(InvocationHandler h) {
|
||||
+ doNewInstanceCheck();
|
||||
this.h = h;
|
||||
+ }
|
||||
+
|
||||
+ private static class ProxyAccessHelper {
|
||||
+ // The permission is implementation specific.
|
||||
+ static final Permission PROXY_PERMISSION =
|
||||
+ new ReflectPermission("proxyConstructorNewInstance");
|
||||
+ // These system properties are defined to provide a short-term
|
||||
+ // workaround if customers need to disable the new security checks.
|
||||
+ static final boolean allowNewInstance;
|
||||
+ static final boolean allowNullLoader;
|
||||
+ static {
|
||||
+ allowNewInstance = getBooleanProperty("sun.reflect.proxy.allowsNewInstance");
|
||||
+ allowNullLoader = getBooleanProperty("sun.reflect.proxy.allowsNullLoader");
|
||||
+ }
|
||||
+
|
||||
+ private static boolean getBooleanProperty(final String key) {
|
||||
+ String s = AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||
+ public String run() {
|
||||
+ return System.getProperty(key);
|
||||
+ }
|
||||
+ });
|
||||
+ return Boolean.valueOf(s);
|
||||
+ }
|
||||
+
|
||||
+ static boolean needsNewInstanceCheck(Class<?> proxyClass) {
|
||||
+ if (!Proxy.isProxyClass(proxyClass) || allowNewInstance) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ if (proxyClass.getName().startsWith(ReflectUtil.PROXY_PACKAGE + ".")) {
|
||||
+ // all proxy interfaces are public
|
||||
+ return false;
|
||||
+ }
|
||||
+ for (Class<?> intf : proxyClass.getInterfaces()) {
|
||||
+ if (!Modifier.isPublic(intf.getModifiers())) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * Access check on a proxy class that implements any non-public interface.
|
||||
+ *
|
||||
+ * @throws SecurityException if a security manager exists, and
|
||||
+ * the caller does not have the permission.
|
||||
+ */
|
||||
+ private void doNewInstanceCheck() {
|
||||
+ SecurityManager sm = System.getSecurityManager();
|
||||
+ Class<?> proxyClass = this.getClass();
|
||||
+ if (sm != null && ProxyAccessHelper.needsNewInstanceCheck(proxyClass)) {
|
||||
+ try {
|
||||
+ sm.checkPermission(ProxyAccessHelper.PROXY_PERMISSION);
|
||||
+ } catch (SecurityException e) {
|
||||
+ throw new SecurityException("Not allowed to construct a Proxy "
|
||||
+ + "instance that implements a non-public interface", e);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -344,6 +410,50 @@ public class Proxy implements java.io.Se
|
||||
Class<?>... interfaces)
|
||||
throws IllegalArgumentException
|
||||
{
|
||||
+ return getProxyClass0(loader, interfaces); // stack walk magic: do not refactor
|
||||
+ }
|
||||
+
|
||||
+ private static void checkProxyLoader(ClassLoader ccl,
|
||||
+ ClassLoader loader)
|
||||
+ {
|
||||
+ SecurityManager sm = System.getSecurityManager();
|
||||
+ if (sm != null) {
|
||||
+ if (loader == null && ccl != null) {
|
||||
+ if (!ProxyAccessHelper.allowNullLoader) {
|
||||
+ sm.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * Generate a proxy class (caller-sensitive).
|
||||
+ *
|
||||
+ * To define a proxy class, it performs the access checks as in
|
||||
+ * Class.forName (VM will invoke ClassLoader.checkPackageAccess):
|
||||
+ * 1. "getClassLoader" permission check if loader == null
|
||||
+ * 2. checkPackageAccess on the interfaces it implements
|
||||
+ *
|
||||
+ * To get a constructor and new instance of a proxy class, it performs
|
||||
+ * the package access check on the interfaces it implements
|
||||
+ * as in Class.getConstructor.
|
||||
+ *
|
||||
+ * If an interface is non-public, the proxy class must be defined by
|
||||
+ * the defining loader of the interface. If the caller's class loader
|
||||
+ * is not the same as the defining loader of the interface, the VM
|
||||
+ * will throw IllegalAccessError when the generated proxy class is
|
||||
+ * being defined via the defineClass0 method.
|
||||
+ */
|
||||
+ private static Class<?> getProxyClass0(ClassLoader loader,
|
||||
+ Class<?>... interfaces) {
|
||||
+ SecurityManager sm = System.getSecurityManager();
|
||||
+ if (sm != null) {
|
||||
+ final int CALLER_FRAME = 3; // 0: Reflection, 1: getProxyClass0 2: Proxy 3: caller
|
||||
+ final Class<?> caller = Reflection.getCallerClass(CALLER_FRAME);
|
||||
+ final ClassLoader ccl = caller.getClassLoader();
|
||||
+ checkProxyLoader(ccl, loader);
|
||||
+ ReflectUtil.checkProxyPackageAccess(ccl, interfaces);
|
||||
+ }
|
||||
if (interfaces.length > 65535) {
|
||||
throw new IllegalArgumentException("interface limit exceeded");
|
||||
}
|
||||
@@ -494,8 +604,9 @@ public class Proxy implements java.io.Se
|
||||
}
|
||||
}
|
||||
|
||||
- if (proxyPkg == null) { // if no non-public proxy interfaces,
|
||||
- proxyPkg = ""; // use the unnamed package
|
||||
+ if (proxyPkg == null) {
|
||||
+ // if no non-public proxy interfaces, use sun.proxy package
|
||||
+ proxyPkg = ReflectUtil.PROXY_PACKAGE + ".";
|
||||
}
|
||||
|
||||
{
|
||||
@@ -595,22 +706,45 @@ public class Proxy implements java.io.Se
|
||||
/*
|
||||
* Look up or generate the designated proxy class.
|
||||
*/
|
||||
- Class cl = getProxyClass(loader, interfaces);
|
||||
+ Class<?> cl = getProxyClass0(loader, interfaces); // stack walk magic: do not refactor
|
||||
|
||||
/*
|
||||
* Invoke its constructor with the designated invocation handler.
|
||||
*/
|
||||
try {
|
||||
- Constructor cons = cl.getConstructor(constructorParams);
|
||||
- return (Object) cons.newInstance(new Object[] { h });
|
||||
+ final Constructor<?> cons = cl.getConstructor(constructorParams);
|
||||
+ final InvocationHandler ih = h;
|
||||
+ SecurityManager sm = System.getSecurityManager();
|
||||
+ if (sm != null && ProxyAccessHelper.needsNewInstanceCheck(cl)) {
|
||||
+ // create proxy instance with doPrivilege as the proxy class may
|
||||
+ // implement non-public interfaces that requires a special permission
|
||||
+ return AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
||||
+ public Object run() {
|
||||
+ return newInstance(cons, ih);
|
||||
+ }
|
||||
+ });
|
||||
+ } else {
|
||||
+ return newInstance(cons, ih);
|
||||
+ }
|
||||
} catch (NoSuchMethodException e) {
|
||||
throw new InternalError(e.toString());
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static Object newInstance(Constructor<?> cons, InvocationHandler h) {
|
||||
+ try {
|
||||
+ return cons.newInstance(new Object[] {h} );
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new InternalError(e.toString());
|
||||
} catch (InstantiationException e) {
|
||||
throw new InternalError(e.toString());
|
||||
} catch (InvocationTargetException e) {
|
||||
- throw new InternalError(e.toString());
|
||||
+ Throwable t = e.getCause();
|
||||
+ if (t instanceof RuntimeException) {
|
||||
+ throw (RuntimeException) t;
|
||||
+ } else {
|
||||
+ throw new InternalError(t.toString());
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/share/classes/sun/reflect/misc/ReflectUtil.java b/src/share/classes/sun/reflect/misc/ReflectUtil.java
|
||||
--- jdk/src/share/classes/sun/reflect/misc/ReflectUtil.java
|
||||
+++ jdk/src/share/classes/sun/reflect/misc/ReflectUtil.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -144,4 +144,63 @@ public final class ReflectUtil {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
+
|
||||
+ // Returns true if p is an ancestor of cl i.e. class loader 'p' can
|
||||
+ // be found in the cl's delegation chain
|
||||
+ private static boolean isAncestor(ClassLoader p, ClassLoader cl) {
|
||||
+ ClassLoader acl = cl;
|
||||
+ do {
|
||||
+ acl = acl.getParent();
|
||||
+ if (p == acl) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ } while (acl != null);
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns true if package access check is needed for reflective
|
||||
+ * access from a class loader 'from' to classes or members in
|
||||
+ * a class defined by class loader 'to'. This method returns true
|
||||
+ * if 'from' is not the same as or an ancestor of 'to'. All code
|
||||
+ * in a system domain are granted with all permission and so this
|
||||
+ * method returns false if 'from' class loader is a class loader
|
||||
+ * loading system classes. On the other hand, if a class loader
|
||||
+ * attempts to access system domain classes, it requires package
|
||||
+ * access check and this method will return true.
|
||||
+ */
|
||||
+ public static boolean needsPackageAccessCheck(ClassLoader from, ClassLoader to) {
|
||||
+ if (from == null || from == to)
|
||||
+ return false;
|
||||
+
|
||||
+ if (to == null)
|
||||
+ return true;
|
||||
+
|
||||
+ return !isAncestor(from, to);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Access check on the interfaces that a proxy class implements and throw
|
||||
+ * {@code SecurityException} if it accesses a restricted package.
|
||||
+ *
|
||||
+ * @param ccl the caller's class loader
|
||||
+ * @param interfaces the list of interfaces that a proxy class implements
|
||||
+ *
|
||||
+ * @see Proxy#checkProxyAccess
|
||||
+ */
|
||||
+ public static void checkProxyPackageAccess(ClassLoader ccl,
|
||||
+ Class<?>... interfaces)
|
||||
+ {
|
||||
+ SecurityManager sm = System.getSecurityManager();
|
||||
+ if (sm != null) {
|
||||
+ for (Class<?> intf : interfaces) {
|
||||
+ ClassLoader cl = intf.getClassLoader();
|
||||
+ if (needsPackageAccessCheck(ccl, cl)) {
|
||||
+ checkPackageAccess(intf);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static final String PROXY_PACKAGE = "sun.proxy";
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User rupashka
|
||||
# Date 1352203457 -14400
|
||||
# Node ID ac55f56db9ab0280853c4a6bfbdc2c578027f9f2
|
||||
# Parent 6deb10c2d5d0c8925fd2012d9fc3b9325c997f21
|
||||
7200491: Tighten up JTable layout code
|
||||
Reviewed-by: art, skoivu
|
||||
|
||||
diff --git a/src/share/classes/com/sun/java/swing/plaf/nimbus/NimbusLookAndFeel.java b/src/share/classes/com/sun/java/swing/plaf/nimbus/NimbusLookAndFeel.java
|
||||
--- jdk/src/share/classes/com/sun/java/swing/plaf/nimbus/NimbusLookAndFeel.java
|
||||
+++ jdk/src/share/classes/com/sun/java/swing/plaf/nimbus/NimbusLookAndFeel.java
|
||||
@@ -159,7 +159,12 @@ public class NimbusLookAndFeel extends S
|
||||
|
||||
// Store Table ScrollPane Corner Component
|
||||
uiDefaults.put("Table.scrollPaneCornerComponent",
|
||||
- TableScrollPaneCorner.class);
|
||||
+ new UIDefaults.ActiveValue() {
|
||||
+ @Override
|
||||
+ public Object createValue(UIDefaults table) {
|
||||
+ return new TableScrollPaneCorner();
|
||||
+ }
|
||||
+ });
|
||||
|
||||
// Setup the settings for ToolBarSeparator which is custom
|
||||
// installed for Nimbus
|
||||
diff --git a/src/share/classes/javax/swing/JTable.java b/src/share/classes/javax/swing/JTable.java
|
||||
--- jdk/src/share/classes/javax/swing/JTable.java
|
||||
+++ jdk/src/share/classes/javax/swing/JTable.java
|
||||
@@ -777,15 +777,11 @@ public class JTable extends JComponent i
|
||||
scrollPane.getCorner(JScrollPane.UPPER_TRAILING_CORNER);
|
||||
if (corner == null || corner instanceof UIResource){
|
||||
corner = null;
|
||||
- Object componentClass = UIManager.get(
|
||||
- "Table.scrollPaneCornerComponent");
|
||||
- if (componentClass instanceof Class){
|
||||
- try {
|
||||
- corner = (Component)
|
||||
- ((Class)componentClass).newInstance();
|
||||
- } catch (Exception e) {
|
||||
- // just ignore and don't set corner
|
||||
- }
|
||||
+ try {
|
||||
+ corner = (Component) UIManager.get(
|
||||
+ "Table.scrollPaneCornerComponent");
|
||||
+ } catch (Exception e) {
|
||||
+ // just ignore and don't set corner
|
||||
}
|
||||
scrollPane.setCorner(JScrollPane.UPPER_TRAILING_CORNER,
|
||||
corner);
|
@ -1,60 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User coffeys
|
||||
# Date 1353019348 0
|
||||
# Node ID 27bb245457d801fab2a5a835e42a4adefdf7ce85
|
||||
# Parent 46582c3c96b3fdd43b58761c3869ce55fad1c755
|
||||
7200500: Launcher better input validation
|
||||
Reviewed-by: ksrini
|
||||
|
||||
diff --git a/src/share/bin/parse_manifest.c b/src/share/bin/parse_manifest.c
|
||||
--- jdk/src/share/bin/parse_manifest.c
|
||||
+++ jdk/src/share/bin/parse_manifest.c
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -487,9 +487,9 @@ JLI_ParseManifest(char *jarfile, manifes
|
||||
#ifdef O_BINARY
|
||||
| O_BINARY /* use binary mode on windows */
|
||||
#endif
|
||||
- )) == -1)
|
||||
+ )) == -1) {
|
||||
return (-1);
|
||||
-
|
||||
+ }
|
||||
info->manifest_version = NULL;
|
||||
info->main_class = NULL;
|
||||
info->jre_version = NULL;
|
||||
@@ -536,12 +536,14 @@ JLI_JarUnpackFile(const char *jarfile, c
|
||||
zentry entry;
|
||||
void *data = NULL;
|
||||
|
||||
- fd = open(jarfile, O_RDONLY
|
||||
+ if ((fd = open(jarfile, O_RDONLY
|
||||
#ifdef O_BINARY
|
||||
| O_BINARY /* use binary mode on windows */
|
||||
#endif
|
||||
- );
|
||||
- if (fd != -1 && find_file(fd, &entry, filename) == 0) {
|
||||
+ )) == -1) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ if (find_file(fd, &entry, filename) == 0) {
|
||||
data = inflate_file(fd, &entry, size);
|
||||
}
|
||||
close(fd);
|
||||
@@ -583,9 +585,9 @@ JLI_ManifestIterate(const char *jarfile,
|
||||
#ifdef O_BINARY
|
||||
| O_BINARY /* use binary mode on windows */
|
||||
#endif
|
||||
- )) == -1)
|
||||
+ )) == -1) {
|
||||
return (-1);
|
||||
-
|
||||
+ }
|
||||
if (rc = find_file(fd, &entry, manifest_name) != 0) {
|
||||
close(fd);
|
||||
return (-2);
|
@ -1,117 +0,0 @@
|
||||
diff --git a/src/share/classes/java/awt/Dialog.java b/src/share/classes/java/awt/Dialog.java
|
||||
--- jdk/src/share/classes/java/awt/Dialog.java
|
||||
+++ jdk/src/share/classes/java/awt/Dialog.java
|
||||
@@ -34,6 +34,7 @@ import java.security.PrivilegedAction;
|
||||
import java.security.PrivilegedAction;
|
||||
import javax.accessibility.*;
|
||||
import sun.awt.AppContext;
|
||||
+import java.security.AccessControlException;
|
||||
import sun.awt.SunToolkit;
|
||||
import sun.awt.PeerEvent;
|
||||
import sun.awt.util.IdentityArrayList;
|
||||
@@ -127,6 +128,8 @@ public class Dialog extends Window {
|
||||
* @since 1.4
|
||||
*/
|
||||
boolean undecorated = false;
|
||||
+
|
||||
+ private transient boolean initialized = false;
|
||||
|
||||
/**
|
||||
* Modal dialogs block all input to some top-level windows.
|
||||
@@ -679,6 +682,7 @@ public class Dialog extends Window {
|
||||
this.title = title;
|
||||
setModalityType(modalityType);
|
||||
SunToolkit.checkAndSetPolicy(this, false);
|
||||
+ initialized = true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -730,6 +734,7 @@ public class Dialog extends Window {
|
||||
this.title = title;
|
||||
setModalityType(modalityType);
|
||||
SunToolkit.checkAndSetPolicy(this, false);
|
||||
+ initialized = true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -859,12 +864,9 @@ public class Dialog extends Window {
|
||||
if (modalityType == type) {
|
||||
return;
|
||||
}
|
||||
- if (type == ModalityType.TOOLKIT_MODAL) {
|
||||
- SecurityManager sm = System.getSecurityManager();
|
||||
- if (sm != null) {
|
||||
- sm.checkPermission(SecurityConstants.TOOLKIT_MODALITY_PERMISSION);
|
||||
- }
|
||||
- }
|
||||
+
|
||||
+ checkModalityPermission(type);
|
||||
+
|
||||
modalityType = type;
|
||||
modal = (modalityType != ModalityType.MODELESS);
|
||||
}
|
||||
@@ -1039,6 +1041,11 @@ public class Dialog extends Window {
|
||||
*/
|
||||
@Deprecated
|
||||
public void show() {
|
||||
+ if (!initialized) {
|
||||
+ throw new IllegalStateException("The dialog component " +
|
||||
+ "has not been initialized properly");
|
||||
+ }
|
||||
+
|
||||
beforeFirstShow = false;
|
||||
if (!isModal()) {
|
||||
conditionalShow(null, null);
|
||||
@@ -1614,18 +1621,50 @@ public class Dialog extends Window {
|
||||
}
|
||||
}
|
||||
|
||||
+ private void checkModalityPermission(ModalityType mt) {
|
||||
+ if (mt == ModalityType.TOOLKIT_MODAL) {
|
||||
+ SecurityManager sm = System.getSecurityManager();
|
||||
+ if (sm != null) {
|
||||
+ sm.checkPermission(
|
||||
+ SecurityConstants.TOOLKIT_MODALITY_PERMISSION
|
||||
+ );
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
private void readObject(ObjectInputStream s)
|
||||
throws ClassNotFoundException, IOException, HeadlessException
|
||||
{
|
||||
GraphicsEnvironment.checkHeadless();
|
||||
- s.defaultReadObject();
|
||||
+
|
||||
+ java.io.ObjectInputStream.GetField fields =
|
||||
+ s.readFields();
|
||||
+
|
||||
+ ModalityType localModalityType = (ModalityType)fields.get("modalityType", null);
|
||||
+
|
||||
+ try {
|
||||
+ checkModalityPermission(localModalityType);
|
||||
+ } catch (AccessControlException ace) {
|
||||
+ localModalityType = DEFAULT_MODALITY_TYPE;
|
||||
+ }
|
||||
|
||||
// in 1.5 or earlier modalityType was absent, so use "modal" instead
|
||||
- if (modalityType == null) {
|
||||
+ if (localModalityType == null) {
|
||||
+ this.modal = fields.get("modal", false);
|
||||
setModal(modal);
|
||||
}
|
||||
|
||||
+ this.resizable = fields.get("resizable", true);
|
||||
+ this.undecorated = fields.get("undecorated", false);
|
||||
+ this.title = (String)fields.get("title", "");
|
||||
+ this.modalityType = localModalityType;
|
||||
+
|
||||
blockedWindows = new IdentityArrayList();
|
||||
+
|
||||
+ SunToolkit.checkAndSetPolicy(this, false);
|
||||
+
|
||||
+ initialized = true;
|
||||
+
|
||||
}
|
||||
|
||||
/*
|
@ -1,66 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User coffeys
|
||||
# Date 1352217014 0
|
||||
# Node ID 58fdb67fcacc67693fc43b5601e88bd7c216f850
|
||||
# Parent 42b1142b39b5a511e1e07b5877cc55e93767064e
|
||||
7201066: Change modifiers on unused fields
|
||||
Reviewed-by: alanb, skoivu
|
||||
|
||||
diff --git a/src/share/classes/com/sun/corba/se/impl/activation/ServerMain.java b/src/share/classes/com/sun/corba/se/impl/activation/ServerMain.java
|
||||
--- corba/src/share/classes/com/sun/corba/se/impl/activation/ServerMain.java
|
||||
+++ corba/src/share/classes/com/sun/corba/se/impl/activation/ServerMain.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -322,9 +322,9 @@ class ServerCallback extends
|
||||
com.sun.corba.se.spi.activation._ServerImplBase
|
||||
{
|
||||
private ORB orb;
|
||||
- private Method installMethod ;
|
||||
- private Method uninstallMethod ;
|
||||
- private Method shutdownMethod ;
|
||||
+ private transient Method installMethod ;
|
||||
+ private transient Method uninstallMethod ;
|
||||
+ private transient Method shutdownMethod ;
|
||||
private Object methodArgs[] ;
|
||||
|
||||
ServerCallback(ORB orb, Method installMethod, Method uninstallMethod,
|
||||
diff --git a/src/share/classes/com/sun/corba/se/impl/io/ObjectStreamClass.java b/src/share/classes/com/sun/corba/se/impl/io/ObjectStreamClass.java
|
||||
--- corba/src/share/classes/com/sun/corba/se/impl/io/ObjectStreamClass.java
|
||||
+++ corba/src/share/classes/com/sun/corba/se/impl/io/ObjectStreamClass.java
|
||||
@@ -1536,8 +1536,8 @@ public class ObjectStreamClass implement
|
||||
private boolean hasExternalizableBlockData;
|
||||
Method writeObjectMethod;
|
||||
Method readObjectMethod;
|
||||
- private Method writeReplaceObjectMethod;
|
||||
- private Method readResolveObjectMethod;
|
||||
+ private transient Method writeReplaceObjectMethod;
|
||||
+ private transient Method readResolveObjectMethod;
|
||||
private Constructor cons ;
|
||||
|
||||
/**
|
||||
diff --git a/src/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClass_1_3_1.java b/src/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClass_1_3_1.java
|
||||
--- corba/src/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClass_1_3_1.java
|
||||
+++ corba/src/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClass_1_3_1.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -1119,8 +1119,8 @@ public class ObjectStreamClass_1_3_1 imp
|
||||
private boolean hasExternalizableBlockData;
|
||||
Method writeObjectMethod;
|
||||
Method readObjectMethod;
|
||||
- private Method writeReplaceObjectMethod;
|
||||
- private Method readResolveObjectMethod;
|
||||
+ private transient Method writeReplaceObjectMethod;
|
||||
+ private transient Method readResolveObjectMethod;
|
||||
|
||||
/*
|
||||
* ObjectStreamClass_1_3_1 that this one was built from.
|
@ -1,83 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User coffeys
|
||||
# Date 1352286387 0
|
||||
# Node ID 6e2d4ed84b41667df189abb7bd0915cda01a85a0
|
||||
# Parent ac55f56db9ab0280853c4a6bfbdc2c578027f9f2
|
||||
7201068: Better handling of UI elements
|
||||
Reviewed-by: mullan, skoivu
|
||||
|
||||
diff --git a/src/share/lib/security/java.security b/src/share/lib/security/java.security
|
||||
--- jdk/src/share/lib/security/java.security
|
||||
+++ jdk/src/share/lib/security/java.security
|
||||
@@ -127,7 +127,9 @@ system.scope=sun.security.provider.Ident
|
||||
# passed to checkPackageAccess unless the
|
||||
# corresponding RuntimePermission ("accessClassInPackage."+package) has
|
||||
# been granted.
|
||||
-package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.
|
||||
+package.access=sun.,\
|
||||
+ com.sun.xml.internal.,\
|
||||
+ com.sun.imageio.
|
||||
|
||||
#
|
||||
# List of comma-separated packages that start with or equal this string
|
||||
@@ -139,7 +141,9 @@ package.access=sun.,com.sun.xml.internal
|
||||
# by default, none of the class loaders supplied with the JDK call
|
||||
# checkPackageDefinition.
|
||||
#
|
||||
-package.definition=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.
|
||||
+package.definition=sun.,\
|
||||
+ com.sun.xml.internal.,\
|
||||
+ com.sun.imageio.
|
||||
|
||||
#
|
||||
# Determines whether this properties file can be appended to
|
||||
diff --git a/src/share/lib/security/java.security-solaris b/src/share/lib/security/java.security-solaris
|
||||
--- jdk/src/share/lib/security/java.security-solaris
|
||||
+++ jdk/src/share/lib/security/java.security-solaris
|
||||
@@ -128,7 +128,9 @@ system.scope=sun.security.provider.Ident
|
||||
# passed to checkPackageAccess unless the
|
||||
# corresponding RuntimePermission ("accessClassInPackage."+package) has
|
||||
# been granted.
|
||||
-package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.
|
||||
+package.access=sun.,\
|
||||
+ com.sun.xml.internal.,\
|
||||
+ com.sun.imageio.
|
||||
|
||||
#
|
||||
# List of comma-separated packages that start with or equal this string
|
||||
@@ -140,7 +142,9 @@ package.access=sun.,com.sun.xml.internal
|
||||
# by default, none of the class loaders supplied with the JDK call
|
||||
# checkPackageDefinition.
|
||||
#
|
||||
-package.definition=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.
|
||||
+package.definition=sun.,\
|
||||
+ com.sun.xml.internal.,\
|
||||
+ com.sun.imageio.
|
||||
|
||||
#
|
||||
# Determines whether this properties file can be appended to
|
||||
diff --git a/src/share/lib/security/java.security-windows b/src/share/lib/security/java.security-windows
|
||||
--- jdk/src/share/lib/security/java.security-windows
|
||||
+++ jdk/src/share/lib/security/java.security-windows
|
||||
@@ -128,7 +128,9 @@ system.scope=sun.security.provider.Ident
|
||||
# passed to checkPackageAccess unless the
|
||||
# corresponding RuntimePermission ("accessClassInPackage."+package) has
|
||||
# been granted.
|
||||
-package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.
|
||||
+package.access=sun.,\
|
||||
+ com.sun.xml.internal.,\
|
||||
+ com.sun.imageio.
|
||||
|
||||
#
|
||||
# List of comma-separated packages that start with or equal this string
|
||||
@@ -140,7 +142,9 @@ package.access=sun.,com.sun.xml.internal
|
||||
# by default, none of the class loaders supplied with the JDK call
|
||||
# checkPackageDefinition.
|
||||
#
|
||||
-package.definition=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.
|
||||
+package.definition=sun.,\
|
||||
+ com.sun.xml.internal.,\
|
||||
+ com.sun.imageio.
|
||||
|
||||
#
|
||||
# Determines whether this properties file can be appended to
|
@ -1,31 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User coffeys
|
||||
# Date 1355322673 0
|
||||
# Node ID 042882b32f75d0e736c19f93688d37fb98d7d26d
|
||||
# Parent 708c134c36312faf8721c0c981be6553e4ebf49f
|
||||
7201070: Serialization to conform to protocol
|
||||
Reviewed-by: smarks, skoivu
|
||||
|
||||
diff --git a/src/share/classes/java/io/ObjectInputStream.java b/src/share/classes/java/io/ObjectInputStream.java
|
||||
--- jdk/src/share/classes/java/io/ObjectInputStream.java
|
||||
+++ jdk/src/share/classes/java/io/ObjectInputStream.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -1749,6 +1749,12 @@ public class ObjectInputStream
|
||||
ObjectStreamClass desc = readClassDesc(false);
|
||||
desc.checkDeserialize();
|
||||
|
||||
+ Class<?> cl = desc.forClass();
|
||||
+ if (cl == String.class || cl == Class.class
|
||||
+ || cl == ObjectStreamClass.class) {
|
||||
+ throw new InvalidClassException("invalid class descriptor");
|
||||
+ }
|
||||
+
|
||||
Object obj;
|
||||
try {
|
||||
obj = desc.isInstantiable() ? desc.newInstance() : null;
|
@ -1,553 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User robm
|
||||
# Date 1352819613 0
|
||||
# Node ID 46582c3c96b3fdd43b58761c3869ce55fad1c755
|
||||
# Parent ee4632a30696050ebd5c014fb3da64112ab48dd3
|
||||
7201071: InetSocketAddress serialization issue
|
||||
Reviewed-by: chegar
|
||||
|
||||
diff --git a/src/share/classes/java/net/InetSocketAddress.java b/src/share/classes/java/net/InetSocketAddress.java
|
||||
--- jdk/src/share/classes/java/net/InetSocketAddress.java
|
||||
+++ jdk/src/share/classes/java/net/InetSocketAddress.java
|
||||
@@ -24,9 +24,12 @@
|
||||
*/
|
||||
package java.net;
|
||||
|
||||
-import java.io.ObjectInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InvalidObjectException;
|
||||
+import java.io.ObjectInputStream;
|
||||
+import java.io.ObjectOutputStream;
|
||||
+import java.io.ObjectStreamException;
|
||||
+import java.io.ObjectStreamField;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -46,24 +49,106 @@ import java.io.InvalidObjectException;
|
||||
* @see java.net.ServerSocket
|
||||
* @since 1.4
|
||||
*/
|
||||
-public class InetSocketAddress extends SocketAddress {
|
||||
- /* The hostname of the Socket Address
|
||||
- * @serial
|
||||
- */
|
||||
- private String hostname = null;
|
||||
- /* The IP address of the Socket Address
|
||||
- * @serial
|
||||
- */
|
||||
- private InetAddress addr = null;
|
||||
- /* The port number of the Socket Address
|
||||
- * @serial
|
||||
- */
|
||||
- private int port;
|
||||
+public class InetSocketAddress
|
||||
+ extends SocketAddress
|
||||
+{
|
||||
+ // Private implementation class pointed to by all public methods.
|
||||
+ private static class InetSocketAddressHolder {
|
||||
+ // The hostname of the Socket Address
|
||||
+ private String hostname;
|
||||
+ // The IP address of the Socket Address
|
||||
+ private InetAddress addr;
|
||||
+ // The port number of the Socket Address
|
||||
+ private int port;
|
||||
+
|
||||
+ private InetSocketAddressHolder(String hostname, InetAddress addr, int port) {
|
||||
+ this.hostname = hostname;
|
||||
+ this.addr = addr;
|
||||
+ this.port = port;
|
||||
+ }
|
||||
+
|
||||
+ private int getPort() {
|
||||
+ return port;
|
||||
+ }
|
||||
+
|
||||
+ private InetAddress getAddress() {
|
||||
+ return addr;
|
||||
+ }
|
||||
+
|
||||
+ private String getHostName() {
|
||||
+ if (hostname != null)
|
||||
+ return hostname;
|
||||
+ if (addr != null)
|
||||
+ return addr.getHostName();
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ private String getHostString() {
|
||||
+ if (hostname != null)
|
||||
+ return hostname;
|
||||
+ if (addr != null) {
|
||||
+ if (addr.hostName != null)
|
||||
+ return addr.hostName;
|
||||
+ else
|
||||
+ return addr.getHostAddress();
|
||||
+ }
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ private boolean isUnresolved() {
|
||||
+ return addr == null;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String toString() {
|
||||
+ if (isUnresolved()) {
|
||||
+ return hostname + ":" + port;
|
||||
+ } else {
|
||||
+ return addr.toString() + ":" + port;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public final boolean equals(Object obj) {
|
||||
+ if (obj == null || !(obj instanceof InetSocketAddressHolder))
|
||||
+ return false;
|
||||
+ InetSocketAddressHolder that = (InetSocketAddressHolder)obj;
|
||||
+ boolean sameIP;
|
||||
+ if (addr != null)
|
||||
+ sameIP = addr.equals(that.addr);
|
||||
+ else if (hostname != null)
|
||||
+ sameIP = (that.addr == null) &&
|
||||
+ hostname.equalsIgnoreCase(that.hostname);
|
||||
+ else
|
||||
+ sameIP = (that.addr == null) && (that.hostname == null);
|
||||
+ return sameIP && (port == that.port);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public final int hashCode() {
|
||||
+ if (addr != null)
|
||||
+ return addr.hashCode() + port;
|
||||
+ if (hostname != null)
|
||||
+ return hostname.toLowerCase().hashCode() + port;
|
||||
+ return port;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private final transient InetSocketAddressHolder holder;
|
||||
|
||||
private static final long serialVersionUID = 5076001401234631237L;
|
||||
|
||||
- private InetSocketAddress() {
|
||||
+ private static int checkPort(int port) {
|
||||
+ if (port < 0 || port > 0xFFFF)
|
||||
+ throw new IllegalArgumentException("port out of range:" + port);
|
||||
+ return port;
|
||||
}
|
||||
+
|
||||
+ private static String checkHost(String hostname) {
|
||||
+ if (hostname == null)
|
||||
+ throw new IllegalArgumentException("hostname can't be null");
|
||||
+ return hostname;
|
||||
+ }
|
||||
|
||||
/**
|
||||
* Creates a socket address where the IP address is the wildcard address
|
||||
@@ -97,14 +182,10 @@ public class InetSocketAddress extends S
|
||||
* range of valid port values.
|
||||
*/
|
||||
public InetSocketAddress(InetAddress addr, int port) {
|
||||
- if (port < 0 || port > 0xFFFF) {
|
||||
- throw new IllegalArgumentException("port out of range:" + port);
|
||||
- }
|
||||
- this.port = port;
|
||||
- if (addr == null)
|
||||
- this.addr = InetAddress.anyLocalAddress();
|
||||
- else
|
||||
- this.addr = addr;
|
||||
+ holder = new InetSocketAddressHolder(
|
||||
+ null,
|
||||
+ addr == null ? InetAddress.anyLocalAddress() : addr,
|
||||
+ checkPort(port));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -132,19 +213,20 @@ public class InetSocketAddress extends S
|
||||
* @see #isUnresolved()
|
||||
*/
|
||||
public InetSocketAddress(String hostname, int port) {
|
||||
- if (port < 0 || port > 0xFFFF) {
|
||||
- throw new IllegalArgumentException("port out of range:" + port);
|
||||
- }
|
||||
- if (hostname == null) {
|
||||
- throw new IllegalArgumentException("hostname can't be null");
|
||||
- }
|
||||
+ checkHost(hostname);
|
||||
+ InetAddress addr = null;
|
||||
+ String host = null;
|
||||
try {
|
||||
addr = InetAddress.getByName(hostname);
|
||||
} catch(UnknownHostException e) {
|
||||
- this.hostname = hostname;
|
||||
- addr = null;
|
||||
+ host = hostname;
|
||||
}
|
||||
- this.port = port;
|
||||
+ holder = new InetSocketAddressHolder(host, addr, checkPort(port));
|
||||
+ }
|
||||
+
|
||||
+ // private constructor for creating unresolved instances
|
||||
+ private InetSocketAddress(int port, String hostname) {
|
||||
+ holder = new InetSocketAddressHolder(hostname, null, port);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,31 +251,67 @@ public class InetSocketAddress extends S
|
||||
* @since 1.5
|
||||
*/
|
||||
public static InetSocketAddress createUnresolved(String host, int port) {
|
||||
- if (port < 0 || port > 0xFFFF) {
|
||||
- throw new IllegalArgumentException("port out of range:" + port);
|
||||
- }
|
||||
- if (host == null) {
|
||||
- throw new IllegalArgumentException("hostname can't be null");
|
||||
- }
|
||||
- InetSocketAddress s = new InetSocketAddress();
|
||||
- s.port = port;
|
||||
- s.hostname = host;
|
||||
- s.addr = null;
|
||||
- return s;
|
||||
+ return new InetSocketAddress(checkPort(port), checkHost(host));
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @serialField hostname String
|
||||
+ * @serialField addr InetAddress
|
||||
+ * @serialField port int
|
||||
+ */
|
||||
+ private static final ObjectStreamField[] serialPersistentFields = {
|
||||
+ new ObjectStreamField("hostname", String.class),
|
||||
+ new ObjectStreamField("addr", InetAddress.class),
|
||||
+ new ObjectStreamField("port", int.class)};
|
||||
+
|
||||
+ private void writeObject(ObjectOutputStream out)
|
||||
+ throws IOException
|
||||
+ {
|
||||
+ // Don't call defaultWriteObject()
|
||||
+ ObjectOutputStream.PutField pfields = out.putFields();
|
||||
+ pfields.put("hostname", holder.hostname);
|
||||
+ pfields.put("addr", holder.addr);
|
||||
+ pfields.put("port", holder.port);
|
||||
+ out.writeFields();
|
||||
}
|
||||
|
||||
- private void readObject(ObjectInputStream s)
|
||||
- throws IOException, ClassNotFoundException {
|
||||
- s.defaultReadObject();
|
||||
+ private void readObject(ObjectInputStream in)
|
||||
+ throws IOException, ClassNotFoundException
|
||||
+ {
|
||||
+ // Don't call defaultReadObject()
|
||||
+ ObjectInputStream.GetField oisFields = in.readFields();
|
||||
+ final String oisHostname = (String)oisFields.get("hostname", null);
|
||||
+ final InetAddress oisAddr = (InetAddress)oisFields.get("addr", null);
|
||||
+ final int oisPort = oisFields.get("port", -1);
|
||||
|
||||
// Check that our invariants are satisfied
|
||||
- if (port < 0 || port > 0xFFFF) {
|
||||
- throw new InvalidObjectException("port out of range:" + port);
|
||||
- }
|
||||
-
|
||||
- if (hostname == null && addr == null) {
|
||||
+ checkPort(oisPort);
|
||||
+ if (oisHostname == null && oisAddr == null)
|
||||
throw new InvalidObjectException("hostname and addr " +
|
||||
"can't both be null");
|
||||
+
|
||||
+ InetSocketAddressHolder h = new InetSocketAddressHolder(oisHostname,
|
||||
+ oisAddr,
|
||||
+ oisPort);
|
||||
+ UNSAFE.putObject(this, FIELDS_OFFSET, h);
|
||||
+ }
|
||||
+
|
||||
+ private void readObjectNoData()
|
||||
+ throws ObjectStreamException
|
||||
+ {
|
||||
+ throw new InvalidObjectException("Stream data required");
|
||||
+ }
|
||||
+
|
||||
+ private static final long FIELDS_OFFSET;
|
||||
+ private static final sun.misc.Unsafe UNSAFE;
|
||||
+ static {
|
||||
+ try {
|
||||
+ sun.misc.Unsafe unsafe = sun.misc.Unsafe.getUnsafe();
|
||||
+ FIELDS_OFFSET = unsafe.objectFieldOffset(
|
||||
+ InetSocketAddress.class.getDeclaredField("holder"));
|
||||
+ UNSAFE = unsafe;
|
||||
+ } catch (NoSuchFieldException e) {
|
||||
+ throw new Error(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,7 +321,7 @@ public class InetSocketAddress extends S
|
||||
* @return the port number.
|
||||
*/
|
||||
public final int getPort() {
|
||||
- return port;
|
||||
+ return holder.getPort();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -213,7 +331,7 @@ public class InetSocketAddress extends S
|
||||
* @return the InetAdress or <code>null</code> if it is unresolved.
|
||||
*/
|
||||
public final InetAddress getAddress() {
|
||||
- return addr;
|
||||
+ return holder.getAddress();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -222,11 +340,7 @@ public class InetSocketAddress extends S
|
||||
* @return the hostname part of the address.
|
||||
*/
|
||||
public final String getHostName() {
|
||||
- if (hostname != null)
|
||||
- return hostname;
|
||||
- if (addr != null)
|
||||
- return addr.getHostName();
|
||||
- return null;
|
||||
+ return holder.getHostName();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -238,15 +352,7 @@ public class InetSocketAddress extends S
|
||||
* @since 1.6
|
||||
*/
|
||||
final String getHostString() {
|
||||
- if (hostname != null)
|
||||
- return hostname;
|
||||
- if (addr != null) {
|
||||
- if (addr.hostName != null)
|
||||
- return addr.hostName;
|
||||
- else
|
||||
- return addr.getHostAddress();
|
||||
- }
|
||||
- return null;
|
||||
+ return holder.getHostString();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -256,7 +362,7 @@ public class InetSocketAddress extends S
|
||||
* an <code>InetAddress</code>.
|
||||
*/
|
||||
public final boolean isUnresolved() {
|
||||
- return addr == null;
|
||||
+ return holder.isUnresolved();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -267,12 +373,9 @@ public class InetSocketAddress extends S
|
||||
*
|
||||
* @return a string representation of this object.
|
||||
*/
|
||||
+ @Override
|
||||
public String toString() {
|
||||
- if (isUnresolved()) {
|
||||
- return hostname + ":" + port;
|
||||
- } else {
|
||||
- return addr.toString() + ":" + port;
|
||||
- }
|
||||
+ return holder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -295,16 +398,7 @@ public class InetSocketAddress extends S
|
||||
public final boolean equals(Object obj) {
|
||||
if (obj == null || !(obj instanceof InetSocketAddress))
|
||||
return false;
|
||||
- InetSocketAddress sockAddr = (InetSocketAddress) obj;
|
||||
- boolean sameIP = false;
|
||||
- if (this.addr != null)
|
||||
- sameIP = this.addr.equals(sockAddr.addr);
|
||||
- else if (this.hostname != null)
|
||||
- sameIP = (sockAddr.addr == null) &&
|
||||
- this.hostname.equals(sockAddr.hostname);
|
||||
- else
|
||||
- sameIP = (sockAddr.addr == null) && (sockAddr.hostname == null);
|
||||
- return sameIP && (this.port == sockAddr.port);
|
||||
+ return holder.equals(((InetSocketAddress) obj).holder);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -312,11 +406,8 @@ public class InetSocketAddress extends S
|
||||
*
|
||||
* @return a hash code value for this socket address.
|
||||
*/
|
||||
+ @Override
|
||||
public final int hashCode() {
|
||||
- if (addr != null)
|
||||
- return addr.hashCode() + port;
|
||||
- if (hostname != null)
|
||||
- return hostname.hashCode() + port;
|
||||
- return port;
|
||||
+ return holder.hashCode();
|
||||
}
|
||||
}
|
||||
diff --git a/src/share/classes/sun/nio/ch/DatagramChannelImpl.java b/src/share/classes/sun/nio/ch/DatagramChannelImpl.java
|
||||
--- jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java
|
||||
+++ jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java
|
||||
@@ -239,7 +239,7 @@ class DatagramChannelImpl
|
||||
|
||||
synchronized (writeLock) {
|
||||
ensureOpen();
|
||||
- InetSocketAddress isa = (InetSocketAddress)target;
|
||||
+ InetSocketAddress isa = Net.checkAddress(target);
|
||||
InetAddress ia = isa.getAddress();
|
||||
if (ia == null)
|
||||
throw new IOException("Target address not resolved");
|
||||
@@ -250,9 +250,9 @@ class DatagramChannelImpl
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
if (ia.isMulticastAddress()) {
|
||||
- sm.checkMulticast(isa.getAddress());
|
||||
+ sm.checkMulticast(ia);
|
||||
} else {
|
||||
- sm.checkConnect(isa.getAddress().getHostAddress(),
|
||||
+ sm.checkConnect(ia.getHostAddress(),
|
||||
isa.getPort());
|
||||
}
|
||||
}
|
||||
@@ -272,7 +272,7 @@ class DatagramChannelImpl
|
||||
return 0;
|
||||
writerThread = NativeThread.current();
|
||||
do {
|
||||
- n = send(fd, src, target);
|
||||
+ n = send(fd, src, isa);
|
||||
} while ((n == IOStatus.INTERRUPTED) && isOpen());
|
||||
return IOStatus.normalize(n);
|
||||
} finally {
|
||||
@@ -283,7 +283,7 @@ class DatagramChannelImpl
|
||||
}
|
||||
}
|
||||
|
||||
- private int send(FileDescriptor fd, ByteBuffer src, SocketAddress target)
|
||||
+ private int send(FileDescriptor fd, ByteBuffer src, InetSocketAddress target)
|
||||
throws IOException
|
||||
{
|
||||
if (src instanceof DirectBuffer)
|
||||
@@ -315,7 +315,7 @@ class DatagramChannelImpl
|
||||
}
|
||||
|
||||
private int sendFromNativeBuffer(FileDescriptor fd, ByteBuffer bb,
|
||||
- SocketAddress target)
|
||||
+ InetSocketAddress target)
|
||||
throws IOException
|
||||
{
|
||||
int pos = bb.position();
|
||||
@@ -324,7 +324,7 @@ class DatagramChannelImpl
|
||||
int rem = (pos <= lim ? lim - pos : 0);
|
||||
|
||||
int written = send0(fd, ((DirectBuffer)bb).address() + pos,
|
||||
- rem, target);
|
||||
+ rem, target.getAddress(), target.getPort());
|
||||
if (written > 0)
|
||||
bb.position(pos + written);
|
||||
return written;
|
||||
@@ -703,8 +703,8 @@ class DatagramChannelImpl
|
||||
boolean connected)
|
||||
throws IOException;
|
||||
|
||||
- private native int send0(FileDescriptor fd, long address, int len,
|
||||
- SocketAddress sa)
|
||||
+ private native int send0(FileDescriptor fd, long address,
|
||||
+ int len, InetAddress addr, int port)
|
||||
throws IOException;
|
||||
|
||||
static {
|
||||
diff --git a/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c b/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c
|
||||
--- jdk/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c
|
||||
+++ jdk/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c
|
||||
@@ -46,8 +46,6 @@
|
||||
|
||||
#include "sun_nio_ch_DatagramChannelImpl.h"
|
||||
|
||||
-static jfieldID isa_addrID; /* address in java.net.InetSocketAddress */
|
||||
-static jfieldID isa_portID; /* port in java.net.InetSocketAddress */
|
||||
static jfieldID dci_senderID; /* sender in sun.nio.ch.DatagramChannelImpl */
|
||||
static jfieldID dci_senderAddrID; /* sender InetAddress in sun.nio.ch.DatagramChannelImpl */
|
||||
static jfieldID dci_senderPortID; /* sender port in sun.nio.ch.DatagramChannelImpl */
|
||||
@@ -61,9 +59,6 @@ Java_sun_nio_ch_DatagramChannelImpl_init
|
||||
isa_class = (*env)->NewGlobalRef(env, clazz);
|
||||
isa_ctorID = (*env)->GetMethodID(env, clazz, "<init>",
|
||||
"(Ljava/net/InetAddress;I)V");
|
||||
- isa_addrID = (*env)->GetFieldID(env, clazz, "addr",
|
||||
- "Ljava/net/InetAddress;");
|
||||
- isa_portID = (*env)->GetFieldID(env, clazz, "port", "I");
|
||||
|
||||
clazz = (*env)->FindClass(env, "sun/nio/ch/DatagramChannelImpl");
|
||||
dci_senderID = (*env)->GetFieldID(env, clazz, "sender",
|
||||
@@ -198,16 +193,15 @@ Java_sun_nio_ch_DatagramChannelImpl_rece
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_sun_nio_ch_DatagramChannelImpl_send0(JNIEnv *env, jobject this,
|
||||
- jobject fdo, jlong address,
|
||||
- jint len, jobject dest)
|
||||
+ jobject fdo, jlong address,
|
||||
+ jint len, jobject destAddress,
|
||||
+ jint destPort)
|
||||
{
|
||||
jint fd = fdval(env, fdo);
|
||||
void *buf = (void *)jlong_to_ptr(address);
|
||||
SOCKADDR sa;
|
||||
int sa_len = SOCKADDR_LEN;
|
||||
jint n = 0;
|
||||
- jobject destAddress = (*env)->GetObjectField(env, dest, isa_addrID);
|
||||
- jint destPort = (*env)->GetIntField(env, dest, isa_portID);
|
||||
|
||||
if (len > MAX_PACKET_LEN) {
|
||||
len = MAX_PACKET_LEN;
|
||||
diff --git a/src/windows/native/sun/nio/ch/DatagramChannelImpl.c b/src/windows/native/sun/nio/ch/DatagramChannelImpl.c
|
||||
--- jdk/src/windows/native/sun/nio/ch/DatagramChannelImpl.c
|
||||
+++ jdk/src/windows/native/sun/nio/ch/DatagramChannelImpl.c
|
||||
@@ -34,8 +34,6 @@
|
||||
#include "net_util.h"
|
||||
#include <winsock2.h>
|
||||
|
||||
-static jfieldID isa_addrID; /* address in java.net.InetSocketAddress */
|
||||
-static jfieldID isa_portID; /* port in java.net.InetSocketAddress */
|
||||
static jfieldID dci_senderID; /* sender in sun.nio.ch.DatagramChannelImpl */
|
||||
static jfieldID dci_senderAddrID; /* sender InetAddress in sun.nio.ch.DatagramChannelImpl */
|
||||
static jfieldID dci_senderPortID; /* sender port in sun.nio.ch.DatagramChannelImpl */
|
||||
@@ -87,9 +85,6 @@ Java_sun_nio_ch_DatagramChannelImpl_init
|
||||
isa_class = (*env)->NewGlobalRef(env, clazz);
|
||||
isa_ctorID = (*env)->GetMethodID(env, clazz, "<init>",
|
||||
"(Ljava/net/InetAddress;I)V");
|
||||
- isa_addrID = (*env)->GetFieldID(env, clazz, "addr",
|
||||
- "Ljava/net/InetAddress;");
|
||||
- isa_portID = (*env)->GetFieldID(env, clazz, "port", "I");
|
||||
|
||||
clazz = (*env)->FindClass(env, "sun/nio/ch/DatagramChannelImpl");
|
||||
dci_senderID = (*env)->GetFieldID(env, clazz, "sender",
|
||||
@@ -268,17 +263,14 @@ Java_sun_nio_ch_DatagramChannelImpl_rece
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_sun_nio_ch_DatagramChannelImpl_send0(JNIEnv *env, jobject this,
|
||||
- jobject fdo, jlong address,
|
||||
- jint len, jobject dest)
|
||||
+ jobject fdo, jlong address, jint len,
|
||||
+ jobject destAddress, jint destPort)
|
||||
{
|
||||
jint fd = fdval(env, fdo);
|
||||
void *buf = (void *)jlong_to_ptr(address);
|
||||
SOCKETADDRESS psa;
|
||||
int sa_len = sizeof(psa);
|
||||
jint rv = 0;
|
||||
- jobject destAddress = (*env)->GetObjectField(env, dest, isa_addrID);
|
||||
- jint destPort = (*env)->GetIntField(env, dest, isa_portID);
|
||||
-
|
||||
|
||||
if (NET_InetAddressToSockaddr(env, destAddress, destPort,
|
||||
(struct sockaddr *)&psa,
|
||||
diff --git a/test/java/nio/channels/DatagramChannel/SendToUnresolved.java b/test/java/nio/channels/DatagramChannel/SendToUnresolved.java
|
||||
--- jdk/test/java/nio/channels/DatagramChannel/SendToUnresolved.java
|
||||
+++ jdk/test/java/nio/channels/DatagramChannel/SendToUnresolved.java
|
||||
@@ -44,6 +44,8 @@ public class SendToUnresolved {
|
||||
throw new RuntimeException("Expected exception not thrown");
|
||||
} catch (IOException e) {
|
||||
// Correct result
|
||||
+ } catch (UnresolvedAddressException e) {
|
||||
+ // Correct result
|
||||
}
|
||||
dc.close();
|
||||
}
|
@ -1,104 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User weijun
|
||||
# Date 1350962115 -28800
|
||||
# Node ID 9c2a2aae44a46e0b63b913987672d1488fa4e7a5
|
||||
# Parent 6088f35106866940de257456c8eee21b130d5ff5
|
||||
8000210: Improve JarFile code quality
|
||||
Reviewed-by: ahgross, xuelei, mschoene
|
||||
|
||||
diff --git a/src/share/classes/java/util/jar/JarFile.java b/src/share/classes/java/util/jar/JarFile.java
|
||||
--- jdk/src/share/classes/java/util/jar/JarFile.java
|
||||
+++ jdk/src/share/classes/java/util/jar/JarFile.java
|
||||
@@ -32,6 +32,7 @@ import java.security.CodeSigner;
|
||||
import java.security.CodeSigner;
|
||||
import java.security.cert.Certificate;
|
||||
import java.security.AccessController;
|
||||
+import sun.misc.IOUtils;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
import sun.security.util.ManifestEntryVerifier;
|
||||
import sun.misc.SharedSecrets;
|
||||
@@ -326,6 +327,9 @@ class JarFile extends ZipFile {
|
||||
if (names != null) {
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
JarEntry e = getJarEntry(names[i]);
|
||||
+ if (e == null) {
|
||||
+ throw new JarException("corrupted jar file");
|
||||
+ }
|
||||
if (!e.isDirectory()) {
|
||||
if (mev == null) {
|
||||
mev = new ManifestEntryVerifier
|
||||
@@ -345,6 +349,10 @@ class JarFile extends ZipFile {
|
||||
// treat the jar file as being unsigned
|
||||
jv = null;
|
||||
verify = false;
|
||||
+ if (JarVerifier.debug != null) {
|
||||
+ JarVerifier.debug.println("jarfile parsing error!");
|
||||
+ ex.printStackTrace();
|
||||
+ }
|
||||
}
|
||||
|
||||
// if after initializing the verifier we have nothing
|
||||
@@ -372,9 +380,8 @@ class JarFile extends ZipFile {
|
||||
* META-INF files.
|
||||
*/
|
||||
private byte[] getBytes(ZipEntry ze) throws IOException {
|
||||
- byte[] b = new byte[(int)ze.getSize()];
|
||||
- DataInputStream is = new DataInputStream(super.getInputStream(ze));
|
||||
- is.readFully(b, 0, b.length);
|
||||
+ InputStream is = super.getInputStream(ze);
|
||||
+ byte[] b = IOUtils.readFully(is, (int)ze.getSize(), true);
|
||||
is.close();
|
||||
return b;
|
||||
}
|
||||
@@ -476,12 +483,7 @@ class JarFile extends ZipFile {
|
||||
if (!isKnownToNotHaveClassPathAttribute()) {
|
||||
JarEntry manEntry = getManEntry();
|
||||
if (manEntry != null) {
|
||||
- byte[] b = new byte[(int)manEntry.getSize()];
|
||||
- DataInputStream dis = new DataInputStream(
|
||||
- super.getInputStream(manEntry));
|
||||
- dis.readFully(b, 0, b.length);
|
||||
- dis.close();
|
||||
-
|
||||
+ byte[] b = getBytes(manEntry);
|
||||
int last = b.length - src.length;
|
||||
int i = 0;
|
||||
next:
|
||||
diff --git a/src/share/classes/sun/security/util/DerIndefLenConverter.java b/src/share/classes/sun/security/util/DerIndefLenConverter.java
|
||||
--- jdk/src/share/classes/sun/security/util/DerIndefLenConverter.java
|
||||
+++ jdk/src/share/classes/sun/security/util/DerIndefLenConverter.java
|
||||
@@ -50,6 +50,7 @@ class DerIndefLenConverter {
|
||||
|
||||
private byte[] data, newData;
|
||||
private int newDataPos, dataPos, dataSize, index;
|
||||
+ private int unresolved = 0;
|
||||
|
||||
private ArrayList<Object> ndefsList = new ArrayList<Object>();
|
||||
|
||||
@@ -113,6 +114,7 @@ class DerIndefLenConverter {
|
||||
numOfEncapsulatedLenBytes;
|
||||
byte[] sectionLenBytes = getLengthBytes(sectionLen);
|
||||
ndefsList.set(index, sectionLenBytes);
|
||||
+ unresolved--;
|
||||
|
||||
// Add the number of bytes required to represent this section
|
||||
// to the total number of length bytes,
|
||||
@@ -149,6 +151,7 @@ class DerIndefLenConverter {
|
||||
int lenByte = data[dataPos++] & 0xff;
|
||||
if (isIndefinite(lenByte)) {
|
||||
ndefsList.add(new Integer(dataPos));
|
||||
+ unresolved++;
|
||||
return curLen;
|
||||
}
|
||||
if (isLongForm(lenByte)) {
|
||||
@@ -316,6 +319,10 @@ class DerIndefLenConverter {
|
||||
parseValue(len);
|
||||
}
|
||||
|
||||
+ if (unresolved != 0) {
|
||||
+ throw new IOException("not all indef len BER resolved");
|
||||
+ }
|
||||
+
|
||||
newData = new byte[dataSize + numOfTotalLenBytes];
|
||||
dataPos=0; newDataPos=0; index=0;
|
||||
|
@ -1,334 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User ewendeli
|
||||
# Date 1353844618 -3600
|
||||
# Node ID 21415f01c66add2891500f10e41c7e99b2b10447
|
||||
# Parent 787e9230b414f346f9c318918aaf58b872b9912e
|
||||
8000537: Contextualize RequiredModelMBean class
|
||||
Reviewed-by: jbachorik
|
||||
Contributed-by: Andreas Eriksson <andreas.eriksson@oracle.com>
|
||||
|
||||
diff --git a/src/share/classes/javax/management/modelmbean/RequiredModelMBean.java b/src/share/classes/javax/management/modelmbean/RequiredModelMBean.java
|
||||
--- jdk/src/share/classes/javax/management/modelmbean/RequiredModelMBean.java
|
||||
+++ jdk/src/share/classes/javax/management/modelmbean/RequiredModelMBean.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -39,6 +39,9 @@ import java.lang.reflect.InvocationTarge
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
+import java.security.AccessControlContext;
|
||||
+import java.security.AccessController;
|
||||
+import java.security.PrivilegedAction;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@@ -77,6 +80,8 @@ import javax.management.RuntimeOperation
|
||||
import javax.management.RuntimeOperationsException;
|
||||
import javax.management.ServiceNotFoundException;
|
||||
import javax.management.loading.ClassLoaderRepository;
|
||||
+import sun.misc.JavaSecurityAccess;
|
||||
+import sun.misc.SharedSecrets;
|
||||
|
||||
import sun.reflect.misc.MethodUtil;
|
||||
import sun.reflect.misc.ReflectUtil;
|
||||
@@ -138,6 +143,9 @@ public class RequiredModelMBean
|
||||
private boolean registered = false;
|
||||
private transient MBeanServer server = null;
|
||||
|
||||
+ private final static JavaSecurityAccess javaSecurityAccess = SharedSecrets.getJavaSecurityAccess();
|
||||
+ final private AccessControlContext acc = AccessController.getContext();
|
||||
+
|
||||
/*************************************/
|
||||
/* constructors */
|
||||
/*************************************/
|
||||
@@ -1025,10 +1033,30 @@ public class RequiredModelMBean
|
||||
|
||||
if (opClassName != null) {
|
||||
try {
|
||||
- final ClassLoader targetClassLoader =
|
||||
- targetObject.getClass().getClassLoader();
|
||||
- targetClass = Class.forName(opClassName, false,
|
||||
- targetClassLoader);
|
||||
+ AccessControlContext stack = AccessController.getContext();
|
||||
+ final Object obj = targetObject;
|
||||
+ final String className = opClassName;
|
||||
+ final ClassNotFoundException[] caughtException = new ClassNotFoundException[1];
|
||||
+
|
||||
+ targetClass = javaSecurityAccess.doIntersectionPrivilege(new PrivilegedAction<Class<?>>() {
|
||||
+
|
||||
+ public Class<?> run() {
|
||||
+ try {
|
||||
+ ReflectUtil.checkPackageAccess(className);
|
||||
+ final ClassLoader targetClassLoader =
|
||||
+ obj.getClass().getClassLoader();
|
||||
+ return Class.forName(className, false,
|
||||
+ targetClassLoader);
|
||||
+ } catch (ClassNotFoundException e) {
|
||||
+ caughtException[0] = e;
|
||||
+ }
|
||||
+ return null;
|
||||
+ }
|
||||
+ }, stack, acc);
|
||||
+
|
||||
+ if (caughtException[0] != null) {
|
||||
+ throw caughtException[0];
|
||||
+ }
|
||||
} catch (ClassNotFoundException e) {
|
||||
final String msg =
|
||||
"class for invoke " + opName + " not found";
|
||||
@@ -1061,9 +1090,9 @@ public class RequiredModelMBean
|
||||
return result;
|
||||
}
|
||||
|
||||
- private static Method resolveMethod(Class<?> targetClass,
|
||||
+ private Method resolveMethod(Class<?> targetClass,
|
||||
String opMethodName,
|
||||
- String[] sig)
|
||||
+ final String[] sig)
|
||||
throws ReflectionException {
|
||||
final boolean tracing = MODELMBEAN_LOGGER.isLoggable(Level.FINER);
|
||||
|
||||
@@ -1078,30 +1107,44 @@ public class RequiredModelMBean
|
||||
if (sig == null)
|
||||
argClasses = null;
|
||||
else {
|
||||
+ final AccessControlContext stack = AccessController.getContext();
|
||||
+ final ReflectionException[] caughtException = new ReflectionException[1];
|
||||
final ClassLoader targetClassLoader = targetClass.getClassLoader();
|
||||
- argClasses = new Class[sig.length];
|
||||
- for (int i = 0; i < sig.length; i++) {
|
||||
- if (tracing) {
|
||||
- MODELMBEAN_LOGGER.logp(Level.FINER,
|
||||
- RequiredModelMBean.class.getName(),"resolveMethod",
|
||||
- "resolve type " + sig[i]);
|
||||
- }
|
||||
- argClasses[i] = (Class) primitiveClassMap.get(sig[i]);
|
||||
- if (argClasses[i] == null) {
|
||||
- try {
|
||||
- argClasses[i] =
|
||||
- Class.forName(sig[i], false, targetClassLoader);
|
||||
- } catch (ClassNotFoundException e) {
|
||||
+ argClasses = new Class<?>[sig.length];
|
||||
+
|
||||
+ javaSecurityAccess.doIntersectionPrivilege(new PrivilegedAction<Void>() {
|
||||
+
|
||||
+ public Void run() {
|
||||
+ for (int i = 0; i < sig.length; i++) {
|
||||
if (tracing) {
|
||||
MODELMBEAN_LOGGER.logp(Level.FINER,
|
||||
- RequiredModelMBean.class.getName(),
|
||||
- "resolveMethod",
|
||||
- "class not found");
|
||||
+ RequiredModelMBean.class.getName(),"resolveMethod",
|
||||
+ "resolve type " + sig[i]);
|
||||
}
|
||||
- final String msg = "Parameter class not found";
|
||||
- throw new ReflectionException(e, msg);
|
||||
+ argClasses[i] = (Class<?>) primitiveClassMap.get(sig[i]);
|
||||
+ if (argClasses[i] == null) {
|
||||
+ try {
|
||||
+ ReflectUtil.checkPackageAccess(sig[i]);
|
||||
+ argClasses[i] =
|
||||
+ Class.forName(sig[i], false, targetClassLoader);
|
||||
+ } catch (ClassNotFoundException e) {
|
||||
+ if (tracing) {
|
||||
+ MODELMBEAN_LOGGER.logp(Level.FINER,
|
||||
+ RequiredModelMBean.class.getName(),
|
||||
+ "resolveMethod",
|
||||
+ "class not found");
|
||||
+ }
|
||||
+ final String msg = "Parameter class not found";
|
||||
+ caughtException[0] = new ReflectionException(e, msg);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
+ return null;
|
||||
}
|
||||
+ }, stack, acc);
|
||||
+
|
||||
+ if (caughtException[0] != null) {
|
||||
+ throw caughtException[0];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1133,7 +1177,7 @@ public class RequiredModelMBean
|
||||
/* Find a method in RequiredModelMBean as determined by the given
|
||||
parameters. Return null if there is none, or if the parameters
|
||||
exclude using it. Called from invoke. */
|
||||
- private static Method findRMMBMethod(String opMethodName,
|
||||
+ private Method findRMMBMethod(String opMethodName,
|
||||
Object targetObjectField,
|
||||
String opClassName,
|
||||
String[] sig) {
|
||||
@@ -1155,19 +1199,28 @@ public class RequiredModelMBean
|
||||
if (opClassName == null)
|
||||
targetClass = rmmbClass;
|
||||
else {
|
||||
- try {
|
||||
- final ClassLoader targetClassLoader =
|
||||
- rmmbClass.getClassLoader();
|
||||
- targetClass = Class.forName(opClassName, false,
|
||||
- targetClassLoader);
|
||||
- if (!rmmbClass.isAssignableFrom(targetClass))
|
||||
- return null;
|
||||
- } catch (ClassNotFoundException e) {
|
||||
- return null;
|
||||
- }
|
||||
+ AccessControlContext stack = AccessController.getContext();
|
||||
+ final String className = opClassName;
|
||||
+ targetClass = javaSecurityAccess.doIntersectionPrivilege(new PrivilegedAction<Class<?>>() {
|
||||
+
|
||||
+ public Class<?> run() {
|
||||
+ try {
|
||||
+ ReflectUtil.checkPackageAccess(className);
|
||||
+ final ClassLoader targetClassLoader =
|
||||
+ rmmbClass.getClassLoader();
|
||||
+ Class clz = Class.forName(className, false,
|
||||
+ targetClassLoader);
|
||||
+ if (!rmmbClass.isAssignableFrom(clz))
|
||||
+ return null;
|
||||
+ return clz;
|
||||
+ } catch (ClassNotFoundException e) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ }
|
||||
+ }, stack, acc);
|
||||
}
|
||||
try {
|
||||
- return resolveMethod(targetClass, opMethodName, sig);
|
||||
+ return targetClass != null ? resolveMethod(targetClass, opMethodName, sig) : null;
|
||||
} catch (ReflectionException e) {
|
||||
return null;
|
||||
}
|
||||
@@ -1177,12 +1231,34 @@ public class RequiredModelMBean
|
||||
* Invoke the given method, and throw the somewhat unpredictable
|
||||
* appropriate exception if the method itself gets an exception.
|
||||
*/
|
||||
- private Object invokeMethod(String opName, Method method,
|
||||
- Object targetObject, Object[] opArgs)
|
||||
+ private Object invokeMethod(String opName, final Method method,
|
||||
+ final Object targetObject, final Object[] opArgs)
|
||||
throws MBeanException, ReflectionException {
|
||||
try {
|
||||
- ReflectUtil.checkPackageAccess(method.getDeclaringClass());
|
||||
- return MethodUtil.invoke(method, targetObject, opArgs);
|
||||
+ final Throwable[] caughtException = new Throwable[1];
|
||||
+ AccessControlContext stack = AccessController.getContext();
|
||||
+ Object rslt = javaSecurityAccess.doIntersectionPrivilege(new PrivilegedAction<Object>() {
|
||||
+
|
||||
+ public Object run() {
|
||||
+ try {
|
||||
+ ReflectUtil.checkPackageAccess(method.getDeclaringClass());
|
||||
+ return MethodUtil.invoke(method, targetObject, opArgs);
|
||||
+ } catch (InvocationTargetException e) {
|
||||
+ caughtException[0] = e;
|
||||
+ } catch (IllegalAccessException e) {
|
||||
+ caughtException[0] = e;
|
||||
+ }
|
||||
+ return null;
|
||||
+ }
|
||||
+ }, stack, acc);
|
||||
+ if (caughtException[0] != null) {
|
||||
+ if (caughtException[0] instanceof Exception) {
|
||||
+ throw (Exception)caughtException[0];
|
||||
+ } else if(caughtException[0] instanceof Error) {
|
||||
+ throw (Error)caughtException[0];
|
||||
+ }
|
||||
+ }
|
||||
+ return rslt;
|
||||
} catch (RuntimeErrorException ree) {
|
||||
throw new RuntimeOperationsException(ree,
|
||||
"RuntimeException occurred in RequiredModelMBean "+
|
||||
@@ -1569,7 +1646,7 @@ public class RequiredModelMBean
|
||||
}
|
||||
|
||||
// make sure response class matches type field
|
||||
- String respType = attrInfo.getType();
|
||||
+ final String respType = attrInfo.getType();
|
||||
if (response != null) {
|
||||
String responseClass = response.getClass().getName();
|
||||
if (!respType.equals(responseClass)) {
|
||||
@@ -1592,9 +1669,30 @@ public class RequiredModelMBean
|
||||
// inequality may come from type subclassing
|
||||
boolean subtype;
|
||||
try {
|
||||
- ClassLoader cl =
|
||||
- response.getClass().getClassLoader();
|
||||
- Class c = Class.forName(respType, true, cl);
|
||||
+ final Class respClass = response.getClass();
|
||||
+ final Exception[] caughException = new Exception[1];
|
||||
+
|
||||
+ AccessControlContext stack = AccessController.getContext();
|
||||
+
|
||||
+ Class c = javaSecurityAccess.doIntersectionPrivilege(new PrivilegedAction<Class<?>>() {
|
||||
+
|
||||
+ public Class<?> run() {
|
||||
+ try {
|
||||
+ ReflectUtil.checkPackageAccess(respType);
|
||||
+ ClassLoader cl =
|
||||
+ respClass.getClassLoader();
|
||||
+ return Class.forName(respType, true, cl);
|
||||
+ } catch (Exception e) {
|
||||
+ caughException[0] = e;
|
||||
+ }
|
||||
+ return null;
|
||||
+ }
|
||||
+ }, stack, acc);
|
||||
+
|
||||
+ if (caughException[0] != null) {
|
||||
+ throw caughException[0];
|
||||
+ }
|
||||
+
|
||||
subtype = c.isInstance(response);
|
||||
} catch (Exception e) {
|
||||
subtype = false;
|
||||
@@ -2748,16 +2847,36 @@ public class RequiredModelMBean
|
||||
return MBeanServerFactory.getClassLoaderRepository(server);
|
||||
}
|
||||
|
||||
- private Class loadClass(String className)
|
||||
+ private Class<?> loadClass(final String className)
|
||||
throws ClassNotFoundException {
|
||||
- try {
|
||||
- return Class.forName(className);
|
||||
- } catch (ClassNotFoundException e) {
|
||||
- final ClassLoaderRepository clr =
|
||||
- getClassLoaderRepository();
|
||||
- if (clr == null) throw new ClassNotFoundException(className);
|
||||
- return clr.loadClass(className);
|
||||
+ AccessControlContext stack = AccessController.getContext();
|
||||
+ final ClassNotFoundException[] caughtException = new ClassNotFoundException[1];
|
||||
+
|
||||
+ Class c = javaSecurityAccess.doIntersectionPrivilege(new PrivilegedAction<Class<?>>() {
|
||||
+
|
||||
+ public Class<?> run() {
|
||||
+ try {
|
||||
+ ReflectUtil.checkPackageAccess(className);
|
||||
+ return Class.forName(className);
|
||||
+ } catch (ClassNotFoundException e) {
|
||||
+ final ClassLoaderRepository clr =
|
||||
+ getClassLoaderRepository();
|
||||
+ try {
|
||||
+ if (clr == null) throw new ClassNotFoundException(className);
|
||||
+ return clr.loadClass(className);
|
||||
+ } catch (ClassNotFoundException ex) {
|
||||
+ caughtException[0] = ex;
|
||||
+ }
|
||||
+ }
|
||||
+ return null;
|
||||
+ }
|
||||
+ }, stack, acc);
|
||||
+
|
||||
+ if (caughtException[0] != null) {
|
||||
+ throw caughtException[0];
|
||||
}
|
||||
+
|
||||
+ return c;
|
||||
}
|
||||
|
||||
|
@ -1,187 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User ngmr
|
||||
# Date 1354993606 0
|
||||
# Node ID 42b1142b39b5a511e1e07b5877cc55e93767064e
|
||||
# Parent c5203e9e0e07559914a9c46dbba4fe85df945624
|
||||
8000540: Improve IIOP type reuse management
|
||||
Reviewed-by: alanb, ahgross, coffeys
|
||||
|
||||
diff --git a/src/share/classes/com/sun/corba/se/impl/io/ObjectStreamClass.java b/src/share/classes/com/sun/corba/se/impl/io/ObjectStreamClass.java
|
||||
--- corba/src/share/classes/com/sun/corba/se/impl/io/ObjectStreamClass.java
|
||||
+++ corba/src/share/classes/com/sun/corba/se/impl/io/ObjectStreamClass.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -25,7 +25,7 @@
|
||||
/*
|
||||
* Licensed Materials - Property of IBM
|
||||
* RMI-IIOP v1.0
|
||||
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
|
||||
+ * Copyright IBM Corp. 1998 2012 All Rights Reserved
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -56,7 +56,8 @@ import java.io.Serializable;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
-import java.util.Hashtable;
|
||||
+import java.util.concurrent.ConcurrentHashMap;
|
||||
+import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import com.sun.corba.se.impl.util.RepositoryId;
|
||||
|
||||
@@ -82,8 +83,6 @@ public class ObjectStreamClass implement
|
||||
|
||||
private static Object noArgsList[] = {};
|
||||
private static Class noTypesList[] = {};
|
||||
-
|
||||
- private static Hashtable translatedFields;
|
||||
|
||||
private static final Bridge bridge =
|
||||
(Bridge)AccessController.doPrivileged(
|
||||
@@ -380,6 +379,58 @@ public class ObjectStreamClass implement
|
||||
*/
|
||||
}
|
||||
|
||||
+ private static final class PersistentFieldsValue {
|
||||
+ private final ConcurrentMap map = new ConcurrentHashMap();
|
||||
+ private static final Object NULL_VALUE =
|
||||
+ (PersistentFieldsValue.class.getName() + ".NULL_VALUE");
|
||||
+
|
||||
+ PersistentFieldsValue() { }
|
||||
+
|
||||
+ ObjectStreamField[] get(Class type) {
|
||||
+ Object value = map.get(type);
|
||||
+ if (value == null) {
|
||||
+ value = computeValue(type);
|
||||
+ Object oldValue = map.putIfAbsent(type, value);
|
||||
+ if (oldValue != null) {
|
||||
+ value = oldValue;
|
||||
+ }
|
||||
+ }
|
||||
+ return ((value == NULL_VALUE) ? null : (ObjectStreamField[])value);
|
||||
+ }
|
||||
+
|
||||
+ private static Object computeValue(Class<?> type) {
|
||||
+ try {
|
||||
+ Field pf = type.getDeclaredField("serialPersistentFields");
|
||||
+ int mods = pf.getModifiers();
|
||||
+ if (Modifier.isPrivate(mods) && Modifier.isStatic(mods) &&
|
||||
+ Modifier.isFinal(mods)) {
|
||||
+ pf.setAccessible(true);
|
||||
+ java.io.ObjectStreamField[] fields =
|
||||
+ (java.io.ObjectStreamField[])pf.get(type);
|
||||
+ return translateFields(fields);
|
||||
+ }
|
||||
+ } catch (NoSuchFieldException e1) {
|
||||
+ } catch (IllegalAccessException e2) {
|
||||
+ } catch (IllegalArgumentException e3) {
|
||||
+ } catch (ClassCastException e4) { }
|
||||
+ return NULL_VALUE;
|
||||
+ }
|
||||
+
|
||||
+ private static ObjectStreamField[] translateFields(
|
||||
+ java.io.ObjectStreamField[] fields) {
|
||||
+ ObjectStreamField[] translation =
|
||||
+ new ObjectStreamField[fields.length];
|
||||
+ for (int i = 0; i < fields.length; i++) {
|
||||
+ translation[i] = new ObjectStreamField(fields[i].getName(),
|
||||
+ fields[i].getType());
|
||||
+ }
|
||||
+ return translation;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static final PersistentFieldsValue persistentFieldsValue =
|
||||
+ new PersistentFieldsValue();
|
||||
+
|
||||
/*
|
||||
* Initialize class descriptor. This method is only invoked on class
|
||||
* descriptors created via calls to lookupInternal(). This method is kept
|
||||
@@ -412,35 +463,7 @@ public class ObjectStreamClass implement
|
||||
* If it is declared, use the declared serialPersistentFields.
|
||||
* Otherwise, extract the fields from the class itself.
|
||||
*/
|
||||
- try {
|
||||
- Field pf = cl.getDeclaredField("serialPersistentFields");
|
||||
- // serial bug 7; the serialPersistentFields were not
|
||||
- // being read and stored as Accessible bit was not set
|
||||
- pf.setAccessible(true);
|
||||
- // serial bug 7; need to find if the field is of type
|
||||
- // java.io.ObjectStreamField
|
||||
- java.io.ObjectStreamField[] f =
|
||||
- (java.io.ObjectStreamField[])pf.get(cl);
|
||||
- int mods = pf.getModifiers();
|
||||
- if ((Modifier.isPrivate(mods)) &&
|
||||
- (Modifier.isStatic(mods)) &&
|
||||
- (Modifier.isFinal(mods)))
|
||||
- {
|
||||
- fields = (ObjectStreamField[])translateFields((Object[])pf.get(cl));
|
||||
- }
|
||||
- } catch (NoSuchFieldException e) {
|
||||
- fields = null;
|
||||
- } catch (IllegalAccessException e) {
|
||||
- fields = null;
|
||||
- } catch (IllegalArgumentException e) {
|
||||
- fields = null;
|
||||
- } catch (ClassCastException e) {
|
||||
- /* Thrown if a field serialPersistentField exists
|
||||
- * but it is not of type ObjectStreamField.
|
||||
- */
|
||||
- fields = null;
|
||||
- }
|
||||
-
|
||||
+ fields = persistentFieldsValue.get(cl);
|
||||
|
||||
if (fields == null) {
|
||||
/* Get all of the declared fields for this
|
||||
@@ -635,44 +658,6 @@ public class ObjectStreamClass implement
|
||||
name = n;
|
||||
suid = s;
|
||||
superclass = null;
|
||||
- }
|
||||
-
|
||||
- private static Object[] translateFields(Object objs[])
|
||||
- throws NoSuchFieldException {
|
||||
- try{
|
||||
- java.io.ObjectStreamField fields[] = (java.io.ObjectStreamField[])objs;
|
||||
- Object translation[] = null;
|
||||
-
|
||||
- if (translatedFields == null)
|
||||
- translatedFields = new Hashtable();
|
||||
-
|
||||
- translation = (Object[])translatedFields.get(fields);
|
||||
-
|
||||
- if (translation != null)
|
||||
- return translation;
|
||||
- else {
|
||||
- Class osfClass = Class.forName("com.sun.corba.se.impl.io.ObjectStreamField");
|
||||
- translation = (Object[])java.lang.reflect.Array.newInstance(osfClass, objs.length);
|
||||
- Object arg[] = new Object[2];
|
||||
- Class types[] = {String.class, Class.class};
|
||||
- Constructor constructor = osfClass.getDeclaredConstructor(types);
|
||||
- for (int i = fields.length -1; i >= 0; i--){
|
||||
- arg[0] = fields[i].getName();
|
||||
- arg[1] = fields[i].getType();
|
||||
-
|
||||
- translation[i] = constructor.newInstance(arg);
|
||||
- }
|
||||
- translatedFields.put(fields, translation);
|
||||
-
|
||||
- }
|
||||
-
|
||||
- return (Object[])translation;
|
||||
- }
|
||||
- catch(Throwable t){
|
||||
- NoSuchFieldException nsfe = new NoSuchFieldException();
|
||||
- nsfe.initCause( t ) ;
|
||||
- throw nsfe ;
|
||||
- }
|
||||
}
|
||||
|
||||
/*
|
File diff suppressed because it is too large
Load Diff
@ -1,61 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User dmocek
|
||||
# Date 1353367979 28800
|
||||
# Node ID 49a37df9e80fae205a7b70d862cd303a62049c2c
|
||||
# Parent 2281f5670cc599f0fe97c880cdceb6a7db837dc3
|
||||
8001242: Improve RMI HTTP conformance
|
||||
Reviewed-by: ahgross, mchung, smarks
|
||||
|
||||
diff --git a/src/share/classes/sun/rmi/transport/proxy/CGIHandler.java b/src/share/classes/sun/rmi/transport/proxy/CGIHandler.java
|
||||
--- jdk/src/share/classes/sun/rmi/transport/proxy/CGIHandler.java
|
||||
+++ jdk/src/share/classes/sun/rmi/transport/proxy/CGIHandler.java
|
||||
@@ -285,11 +285,14 @@ final class CGIForwardCommand implements
|
||||
"unexpected EOF reading server response");
|
||||
|
||||
if (line.toLowerCase().startsWith(key)) {
|
||||
- if (contentLengthFound)
|
||||
- ; // what would we want to do in this case??
|
||||
- responseContentLength =
|
||||
- Integer.parseInt(line.substring(key.length()).trim());
|
||||
- contentLengthFound = true;
|
||||
+ if (contentLengthFound) {
|
||||
+ throw new CGIServerException(
|
||||
+ "Multiple Content-length entries found.");
|
||||
+ } else {
|
||||
+ responseContentLength =
|
||||
+ Integer.parseInt(line.substring(key.length()).trim());
|
||||
+ contentLengthFound = true;
|
||||
+ }
|
||||
}
|
||||
} while ((line.length() != 0) &&
|
||||
(line.charAt(0) != '\r') && (line.charAt(0) != '\n'));
|
||||
diff --git a/src/share/classes/sun/rmi/transport/proxy/HttpInputStream.java b/src/share/classes/sun/rmi/transport/proxy/HttpInputStream.java
|
||||
--- jdk/src/share/classes/sun/rmi/transport/proxy/HttpInputStream.java
|
||||
+++ jdk/src/share/classes/sun/rmi/transport/proxy/HttpInputStream.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 1996, 2001, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -70,11 +70,14 @@ class HttpInputStream extends FilterInpu
|
||||
throw new EOFException();
|
||||
|
||||
if (line.toLowerCase().startsWith(key)) {
|
||||
- if (contentLengthFound)
|
||||
- ; // what would we want to do in this case??
|
||||
- bytesLeft =
|
||||
- Integer.parseInt(line.substring(key.length()).trim());
|
||||
- contentLengthFound = true;
|
||||
+ if (contentLengthFound) {
|
||||
+ throw new IOException(
|
||||
+ "Multiple Content-length entries found.");
|
||||
+ } else {
|
||||
+ bytesLeft =
|
||||
+ Integer.parseInt(line.substring(key.length()).trim());
|
||||
+ contentLengthFound = true;
|
||||
+ }
|
||||
}
|
||||
|
||||
// The idea here is to go past the first blank line.
|
@ -1,27 +0,0 @@
|
||||
diff -Nru openjdk.orig/hotspot/src/share/vm/interpreter/linkResolver.cpp openjdk/hotspot/src/share/vm/interpreter/linkResolver.cpp
|
||||
--- openjdk.orig/hotspot/src/share/vm/interpreter/linkResolver.cpp 2011-11-14 22:07:35.000000000 +0000
|
||||
+++ hotspot/src/share/vm/interpreter/linkResolver.cpp 2013-02-01 21:46:24.084475305 +0000
|
||||
@@ -695,7 +695,7 @@
|
||||
|
||||
if (check_access &&
|
||||
// a) check if ACC_SUPER flag is set for the current class
|
||||
- current_klass->is_super() &&
|
||||
+ (current_klass->is_super() || !AllowNonVirtualCalls) &&
|
||||
// b) check if the method class is a superclass of the current class (superclass relation is not reflexive!)
|
||||
current_klass->is_subtype_of(method_klass()) && current_klass() != method_klass() &&
|
||||
// c) check if the method is not <init>
|
||||
diff -Nru openjdk.orig/hotspot/src/share/vm/runtime/globals.hpp openjdk/hotspot/src/share/vm/runtime/globals.hpp
|
||||
--- openjdk.orig/hotspot/src/share/vm/runtime/globals.hpp 2013-02-01 21:44:12.678449777 +0000
|
||||
+++ hotspot/src/share/vm/runtime/globals.hpp 2013-02-01 21:46:57.300987338 +0000
|
||||
@@ -3700,7 +3700,10 @@
|
||||
product(bool, UseVMInterruptibleIO, false, \
|
||||
"(Unstable, Solaris-specific) Thread interrupt before or with " \
|
||||
"EINTR for I/O operations results in OS_INTRPT. The default value"\
|
||||
- " of this flag is true for JDK 6 and earliers")
|
||||
+ " of this flag is true for JDK 6 and earlier") \
|
||||
+ \
|
||||
+ product(bool, AllowNonVirtualCalls, false, \
|
||||
+ "Obey the ACC_SUPER flag and allow invokenonvirtual calls")
|
||||
|
||||
/*
|
||||
* Macros for factoring of globals
|
@ -1,438 +0,0 @@
|
||||
diff -Nru openjdk.orig/jdk/src/share/classes/sun/awt/image/ByteComponentRaster.java openjdk/jdk/src/share/classes/sun/awt/image/ByteComponentRaster.java
|
||||
--- openjdk.orig/jdk/src/share/classes/sun/awt/image/ByteComponentRaster.java 2011-11-14 22:11:59.000000000 +0000
|
||||
+++ jdk/src/share/classes/sun/awt/image/ByteComponentRaster.java 2013-02-01 21:49:28.911324533 +0000
|
||||
@@ -198,7 +198,7 @@
|
||||
}
|
||||
this.bandOffset = this.dataOffsets[0];
|
||||
|
||||
- verify(false);
|
||||
+ verify();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -857,38 +857,68 @@
|
||||
}
|
||||
|
||||
/**
|
||||
- * Verify that the layout parameters are consistent with
|
||||
- * the data. If strictCheck
|
||||
- * is false, this method will check for ArrayIndexOutOfBounds conditions. If
|
||||
- * strictCheck is true, this method will check for additional error
|
||||
- * conditions such as line wraparound (width of a line greater than
|
||||
- * the scanline stride).
|
||||
- * @return String Error string, if the layout is incompatible with
|
||||
- * the data. Otherwise returns null.
|
||||
- */
|
||||
- private void verify (boolean strictCheck) {
|
||||
- // Make sure data for Raster is in a legal range
|
||||
- for (int i=0; i < dataOffsets.length; i++) {
|
||||
+ * Verify that the layout parameters are consistent with the data.
|
||||
+ *
|
||||
+ * The method verifies whether scanline stride and pixel stride do not
|
||||
+ * cause an integer overflow during calculation of a position of the pixel
|
||||
+ * in data buffer. It also verifies whether the data buffer has enough data
|
||||
+ * to correspond the raster layout attributes.
|
||||
+ *
|
||||
+ * @throws RasterFormatException if an integer overflow is detected,
|
||||
+ * or if data buffer has not enough capacity.
|
||||
+ */
|
||||
+ protected final void verify() {
|
||||
+ for (int i = 0; i < dataOffsets.length; i++) {
|
||||
if (dataOffsets[i] < 0) {
|
||||
- throw new RasterFormatException("Data offsets for band "+i+
|
||||
- "("+dataOffsets[i]+
|
||||
- ") must be >= 0");
|
||||
+ throw new RasterFormatException("Data offsets for band " + i
|
||||
+ + "(" + dataOffsets[i]
|
||||
+ + ") must be >= 0");
|
||||
}
|
||||
}
|
||||
|
||||
int maxSize = 0;
|
||||
int size;
|
||||
|
||||
- for (int i=0; i < numDataElements; i++) {
|
||||
- size = (height-1)*scanlineStride + (width-1)*pixelStride +
|
||||
- dataOffsets[i];
|
||||
+ // we can be sure that width and height are greater than 0
|
||||
+ if (scanlineStride < 0 ||
|
||||
+ scanlineStride > (Integer.MAX_VALUE / height))
|
||||
+ {
|
||||
+ // integer overflow
|
||||
+ throw new RasterFormatException("Incorrect scanline stride: "
|
||||
+ + scanlineStride);
|
||||
+ }
|
||||
+ int lastScanOffset = (height - 1) * scanlineStride;
|
||||
+
|
||||
+ if (pixelStride < 0 ||
|
||||
+ pixelStride > (Integer.MAX_VALUE / width))
|
||||
+ {
|
||||
+ // integer overflow
|
||||
+ throw new RasterFormatException("Incorrect pixel stride: "
|
||||
+ + pixelStride);
|
||||
+ }
|
||||
+ int lastPixelOffset = (width - 1) * pixelStride;
|
||||
+
|
||||
+ if (lastPixelOffset > (Integer.MAX_VALUE - lastScanOffset)) {
|
||||
+ // integer overflow
|
||||
+ throw new RasterFormatException("Incorrect raster attributes");
|
||||
+ }
|
||||
+ lastPixelOffset += lastScanOffset;
|
||||
+
|
||||
+ for (int i = 0; i < numDataElements; i++) {
|
||||
+ size = lastPixelOffset + dataOffsets[i];
|
||||
+ if (dataOffsets[i] > (Integer.MAX_VALUE - lastPixelOffset)) {
|
||||
+ throw new RasterFormatException("Incorrect band offset: "
|
||||
+ + dataOffsets[i]);
|
||||
+
|
||||
+ }
|
||||
+
|
||||
if (size > maxSize) {
|
||||
maxSize = size;
|
||||
}
|
||||
}
|
||||
if (data.length < maxSize) {
|
||||
- throw new RasterFormatException("Data array too small (should be "+
|
||||
- maxSize+" )");
|
||||
+ throw new RasterFormatException("Data array too small (should be "
|
||||
+ + maxSize + " )");
|
||||
}
|
||||
}
|
||||
|
||||
diff -Nru openjdk.orig/jdk/src/share/classes/sun/awt/image/ByteInterleavedRaster.java openjdk/jdk/src/share/classes/sun/awt/image/ByteInterleavedRaster.java
|
||||
--- openjdk.orig/jdk/src/share/classes/sun/awt/image/ByteInterleavedRaster.java 2011-11-14 22:11:59.000000000 +0000
|
||||
+++ jdk/src/share/classes/sun/awt/image/ByteInterleavedRaster.java 2013-02-01 21:49:28.911324533 +0000
|
||||
@@ -250,7 +250,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- verify(false);
|
||||
+ verify();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1292,33 +1292,6 @@
|
||||
return createCompatibleWritableRaster(width,height);
|
||||
}
|
||||
|
||||
- /**
|
||||
- * Verify that the layout parameters are consistent with
|
||||
- * the data. If strictCheck
|
||||
- * is false, this method will check for ArrayIndexOutOfBounds conditions. If
|
||||
- * strictCheck is true, this method will check for additional error
|
||||
- * conditions such as line wraparound (width of a line greater than
|
||||
- * the scanline stride).
|
||||
- * @return String Error string, if the layout is incompatible with
|
||||
- * the data. Otherwise returns null.
|
||||
- */
|
||||
- private void verify (boolean strictCheck) {
|
||||
- int maxSize = 0;
|
||||
- int size;
|
||||
-
|
||||
- for (int i=0; i < numDataElements; i++) {
|
||||
- size = (height-1)*scanlineStride + (width-1)*pixelStride +
|
||||
- dataOffsets[i];
|
||||
- if (size > maxSize) {
|
||||
- maxSize = size;
|
||||
- }
|
||||
- }
|
||||
- if (data.length < maxSize) {
|
||||
- throw new RasterFormatException("Data array too small (should be "+
|
||||
- maxSize+" )");
|
||||
- }
|
||||
- }
|
||||
-
|
||||
public String toString() {
|
||||
return new String ("ByteInterleavedRaster: width = "+width+" height = "
|
||||
+ height
|
||||
diff -Nru openjdk.orig/jdk/src/share/classes/sun/awt/image/ShortComponentRaster.java openjdk/jdk/src/share/classes/sun/awt/image/ShortComponentRaster.java
|
||||
--- openjdk.orig/jdk/src/share/classes/sun/awt/image/ShortComponentRaster.java 2011-11-14 22:11:59.000000000 +0000
|
||||
+++ jdk/src/share/classes/sun/awt/image/ShortComponentRaster.java 2013-02-01 21:49:28.911324533 +0000
|
||||
@@ -198,7 +198,7 @@
|
||||
}
|
||||
this.bandOffset = this.dataOffsets[0];
|
||||
|
||||
- verify(false);
|
||||
+ verify();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -791,38 +791,67 @@
|
||||
}
|
||||
|
||||
/**
|
||||
- * Verify that the layout parameters are consistent with
|
||||
- * the data. If strictCheck
|
||||
- * is false, this method will check for ArrayIndexOutOfBounds conditions. If
|
||||
- * strictCheck is true, this method will check for additional error
|
||||
- * conditions such as line wraparound (width of a line greater than
|
||||
- * the scanline stride).
|
||||
- * @return String Error string, if the layout is incompatible with
|
||||
- * the data. Otherwise returns null.
|
||||
- */
|
||||
- private void verify (boolean strictCheck) {
|
||||
- // Make sure data for Raster is in a legal range
|
||||
- for (int i=0; i < dataOffsets.length; i++) {
|
||||
+ * Verify that the layout parameters are consistent with the data.
|
||||
+ *
|
||||
+ * The method verifies whether scanline stride and pixel stride do not
|
||||
+ * cause an integer overflow during calculation of a position of the pixel
|
||||
+ * in data buffer. It also verifies whether the data buffer has enough data
|
||||
+ * to correspond the raster layout attributes.
|
||||
+ *
|
||||
+ * @throws RasterFormatException if an integer overflow is detected,
|
||||
+ * or if data buffer has not enough capacity.
|
||||
+ */
|
||||
+ protected final void verify() {
|
||||
+ for (int i = 0; i < dataOffsets.length; i++) {
|
||||
if (dataOffsets[i] < 0) {
|
||||
- throw new RasterFormatException("Data offsets for band "+i+
|
||||
- "("+dataOffsets[i]+
|
||||
- ") must be >= 0");
|
||||
+ throw new RasterFormatException("Data offsets for band " + i
|
||||
+ + "(" + dataOffsets[i]
|
||||
+ + ") must be >= 0");
|
||||
}
|
||||
}
|
||||
|
||||
int maxSize = 0;
|
||||
int size;
|
||||
|
||||
- for (int i=0; i < numDataElements; i++) {
|
||||
- size = (height-1)*scanlineStride + (width-1)*pixelStride +
|
||||
- dataOffsets[i];
|
||||
+ // we can be sure that width and height are greater than 0
|
||||
+ if (scanlineStride < 0 ||
|
||||
+ scanlineStride > (Integer.MAX_VALUE / height))
|
||||
+ {
|
||||
+ // integer overflow
|
||||
+ throw new RasterFormatException("Incorrect scanline stride: "
|
||||
+ + scanlineStride);
|
||||
+ }
|
||||
+ int lastScanOffset = (height - 1) * scanlineStride;
|
||||
+
|
||||
+ if (pixelStride < 0 ||
|
||||
+ pixelStride > (Integer.MAX_VALUE / width))
|
||||
+ {
|
||||
+ // integer overflow
|
||||
+ throw new RasterFormatException("Incorrect pixel stride: "
|
||||
+ + pixelStride);
|
||||
+ }
|
||||
+ int lastPixelOffset = (width - 1) * pixelStride;
|
||||
+
|
||||
+ if (lastPixelOffset > (Integer.MAX_VALUE - lastScanOffset)) {
|
||||
+ // integer overflow
|
||||
+ throw new RasterFormatException("Incorrect raster attributes");
|
||||
+ }
|
||||
+ lastPixelOffset += lastScanOffset;
|
||||
+
|
||||
+ for (int i = 0; i < numDataElements; i++) {
|
||||
+ size = lastPixelOffset + dataOffsets[i];
|
||||
+ if (dataOffsets[i] > (Integer.MAX_VALUE - lastPixelOffset)) {
|
||||
+ throw new RasterFormatException("Incorrect band offset: "
|
||||
+ + dataOffsets[i]);
|
||||
+ }
|
||||
+
|
||||
if (size > maxSize) {
|
||||
maxSize = size;
|
||||
}
|
||||
}
|
||||
if (data.length < maxSize) {
|
||||
- throw new RasterFormatException("Data array too small (should be "+
|
||||
- maxSize+" )");
|
||||
+ throw new RasterFormatException("Data array too small (should be "
|
||||
+ + maxSize + " )");
|
||||
}
|
||||
}
|
||||
|
||||
diff -Nru openjdk.orig/jdk/src/share/classes/sun/awt/image/ShortInterleavedRaster.java openjdk/jdk/src/share/classes/sun/awt/image/ShortInterleavedRaster.java
|
||||
--- openjdk.orig/jdk/src/share/classes/sun/awt/image/ShortInterleavedRaster.java 2011-11-14 22:11:59.000000000 +0000
|
||||
+++ jdk/src/share/classes/sun/awt/image/ShortInterleavedRaster.java 2013-02-01 21:49:28.911324533 +0000
|
||||
@@ -171,7 +171,7 @@
|
||||
sampleModel);
|
||||
}
|
||||
this.bandOffset = this.dataOffsets[0];
|
||||
- verify(false);
|
||||
+ verify();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -762,33 +762,6 @@
|
||||
return createCompatibleWritableRaster(width,height);
|
||||
}
|
||||
|
||||
- /**
|
||||
- * Verify that the layout parameters are consistent with
|
||||
- * the data. If strictCheck
|
||||
- * is false, this method will check for ArrayIndexOutOfBounds conditions. If
|
||||
- * strictCheck is true, this method will check for additional error
|
||||
- * conditions such as line wraparound (width of a line greater than
|
||||
- * the scanline stride).
|
||||
- * @return String Error string, if the layout is incompatible with
|
||||
- * the data. Otherwise returns null.
|
||||
- */
|
||||
- private void verify (boolean strictCheck) {
|
||||
- int maxSize = 0;
|
||||
- int size;
|
||||
-
|
||||
- for (int i=0; i < numDataElements; i++) {
|
||||
- size = (height-1)*scanlineStride + (width-1)*pixelStride +
|
||||
- dataOffsets[i];
|
||||
- if (size > maxSize) {
|
||||
- maxSize = size;
|
||||
- }
|
||||
- }
|
||||
- if (data.length < maxSize) {
|
||||
- throw new RasterFormatException("Data array too small (should be "+
|
||||
- maxSize+" )");
|
||||
- }
|
||||
- }
|
||||
-
|
||||
public String toString() {
|
||||
return new String ("ShortInterleavedRaster: width = "+width
|
||||
+" height = " + height
|
||||
diff -Nru openjdk.orig/jdk/src/share/native/sun/awt/image/awt_parseImage.c openjdk/jdk/src/share/native/sun/awt/image/awt_parseImage.c
|
||||
--- openjdk.orig/jdk/src/share/native/sun/awt/image/awt_parseImage.c 2011-11-14 22:12:11.000000000 +0000
|
||||
+++ jdk/src/share/native/sun/awt/image/awt_parseImage.c 2013-02-01 21:54:40.100132273 +0000
|
||||
@@ -114,6 +114,62 @@
|
||||
return status;
|
||||
}
|
||||
|
||||
+/* Verifies whether the channel offsets are sane and correspond to the type of
|
||||
+ * the raster.
|
||||
+ *
|
||||
+ * Return value:
|
||||
+ * 0: Failure: channel offsets are invalid
|
||||
+ * 1: Success
|
||||
+ */
|
||||
+static int checkChannelOffsets(RasterS_t *rasterP, int dataArrayLength) {
|
||||
+ int i, lastPixelOffset, lastScanOffset;
|
||||
+ switch (rasterP->rasterType) {
|
||||
+ case COMPONENT_RASTER_TYPE:
|
||||
+ if (!SAFE_TO_MULT(rasterP->height, rasterP->scanlineStride)) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ if (!SAFE_TO_MULT(rasterP->width, rasterP->pixelStride)) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ lastScanOffset = (rasterP->height - 1) * rasterP->scanlineStride;
|
||||
+ lastPixelOffset = (rasterP->width - 1) * rasterP->pixelStride;
|
||||
+
|
||||
+
|
||||
+ if (!SAFE_TO_ADD(lastPixelOffset, lastScanOffset)) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ lastPixelOffset += lastScanOffset;
|
||||
+
|
||||
+ for (i = 0; i < rasterP->numDataElements; i++) {
|
||||
+ int off = rasterP->chanOffsets[i];
|
||||
+ int size = lastPixelOffset + off;
|
||||
+
|
||||
+ if (off < 0 || !SAFE_TO_ADD(lastPixelOffset, off)) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (size < lastPixelOffset || size >= dataArrayLength) {
|
||||
+ // an overflow, or insufficient buffer capacity
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ return 1;
|
||||
+ case BANDED_RASTER_TYPE:
|
||||
+ // NB:caller does not support the banded rasters yet,
|
||||
+ // so this branch of the code must be re-defined in
|
||||
+ // order to provide valid criteria for the data offsets
|
||||
+ // verification, when/if banded rasters will be supported.
|
||||
+ // At the moment, we prohibit banded rasters as well.
|
||||
+ return 0;
|
||||
+ default:
|
||||
+ // PACKED_RASTER_TYPE: does not support channel offsets
|
||||
+ // UNKNOWN_RASTER_TYPE: should not be used, likely indicates an error
|
||||
+ return 0;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
/* Parse the raster. All of the raster information is returned in the
|
||||
* rasterP structure.
|
||||
*
|
||||
@@ -125,7 +181,6 @@
|
||||
int awt_parseRaster(JNIEnv *env, jobject jraster, RasterS_t *rasterP) {
|
||||
jobject joffs = NULL;
|
||||
/* int status;*/
|
||||
- int isDiscrete = TRUE;
|
||||
|
||||
if (JNU_IsNull(env, jraster)) {
|
||||
JNU_ThrowNullPointerException(env, "null Raster object");
|
||||
@@ -155,6 +210,9 @@
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ // make sure that the raster type is initialized
|
||||
+ rasterP->rasterType = UNKNOWN_RASTER_TYPE;
|
||||
+
|
||||
if (rasterP->numBands <= 0 ||
|
||||
rasterP->numBands > MAX_NUMBANDS)
|
||||
{
|
||||
@@ -254,7 +312,6 @@
|
||||
}
|
||||
rasterP->chanOffsets[0] = (*env)->GetIntField(env, jraster, g_BPRdataBitOffsetID);
|
||||
rasterP->dataType = BYTE_DATA_TYPE;
|
||||
- isDiscrete = FALSE;
|
||||
}
|
||||
else {
|
||||
rasterP->type = sun_awt_image_IntegerComponentRaster_TYPE_CUSTOM;
|
||||
@@ -265,7 +322,19 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
- if (isDiscrete) {
|
||||
+ // do basic validation of the raster structure
|
||||
+ if (rasterP->width <= 0 || rasterP->height <= 0 ||
|
||||
+ rasterP->pixelStride <= 0 || rasterP->scanlineStride <= 0)
|
||||
+ {
|
||||
+ // invalid raster
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ // channel (data) offsets
|
||||
+ switch (rasterP->rasterType) {
|
||||
+ case COMPONENT_RASTER_TYPE:
|
||||
+ case BANDED_RASTER_TYPE: // note that this routine does not support banded rasters at the moment
|
||||
+ // get channel (data) offsets
|
||||
rasterP->chanOffsets = NULL;
|
||||
if (SAFE_TO_ALLOC_2(rasterP->numDataElements, sizeof(jint))) {
|
||||
rasterP->chanOffsets =
|
||||
@@ -278,6 +347,17 @@
|
||||
}
|
||||
(*env)->GetIntArrayRegion(env, joffs, 0, rasterP->numDataElements,
|
||||
rasterP->chanOffsets);
|
||||
+ if (rasterP->jdata == NULL) {
|
||||
+ // unable to verify the raster
|
||||
+ return -1;
|
||||
+ }
|
||||
+ // verify whether channel offsets look sane
|
||||
+ if (!checkChannelOffsets(rasterP, (*env)->GetArrayLength(env, rasterP->jdata))) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+ break;
|
||||
+ default:
|
||||
+ ; // PACKED_RASTER_TYPE does not use the channel offsets.
|
||||
}
|
||||
|
||||
#if 0
|
||||
diff -Nru openjdk.orig/jdk/src/share/native/sun/awt/medialib/safe_alloc.h openjdk/jdk/src/share/native/sun/awt/medialib/safe_alloc.h
|
||||
--- openjdk.orig/jdk/src/share/native/sun/awt/medialib/safe_alloc.h 2011-11-14 22:12:12.000000000 +0000
|
||||
+++ jdk/src/share/native/sun/awt/medialib/safe_alloc.h 2013-02-01 21:49:28.911324533 +0000
|
||||
@@ -41,5 +41,10 @@
|
||||
(((w) > 0) && ((h) > 0) && ((sz) > 0) && \
|
||||
(((0xffffffffu / ((juint)(w))) / ((juint)(h))) > ((juint)(sz))))
|
||||
|
||||
+#define SAFE_TO_MULT(a, b) \
|
||||
+ (((a) > 0) && ((b) >= 0) && ((0x7fffffff / (a)) > (b)))
|
||||
+
|
||||
+#define SAFE_TO_ADD(a, b) \
|
||||
+ (((a) >= 0) && ((b) >= 0) && ((0x7fffffff - (a)) > (b)))
|
||||
|
||||
#endif // __SAFE_ALLOC_H__
|
@ -1,59 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User bae
|
||||
# Date 1353162084 -14400
|
||||
# Node ID 6081ed9a6461360252572f79713b20c49caa59ad
|
||||
# Parent 1e4909147511ffa8f2089c488df2435af4707283
|
||||
8002325: Improve management of images
|
||||
Reviewed-by: prr, ahgross
|
||||
|
||||
diff --git a/src/share/native/sun/awt/image/awt_parseImage.c b/src/share/native/sun/awt/image/awt_parseImage.c
|
||||
--- jdk/src/share/native/sun/awt/image/awt_parseImage.c
|
||||
+++ jdk/src/share/native/sun/awt/image/awt_parseImage.c
|
||||
@@ -223,9 +223,14 @@ int awt_parseRaster(JNIEnv *env, jobject
|
||||
return 0;
|
||||
}
|
||||
|
||||
+ rasterP->sppsm.isUsed = 0;
|
||||
+
|
||||
if ((*env)->IsInstanceOf(env, rasterP->jsampleModel,
|
||||
(*env)->FindClass(env,"java/awt/image/SinglePixelPackedSampleModel"))) {
|
||||
jobject jmask, joffs, jnbits;
|
||||
+
|
||||
+ rasterP->sppsm.isUsed = 1;
|
||||
+
|
||||
rasterP->sppsm.maxBitSize = (*env)->GetIntField(env,
|
||||
rasterP->jsampleModel,
|
||||
g_SPPSMmaxBitID);
|
||||
@@ -711,6 +716,21 @@ setHints(JNIEnv *env, BufImageS_t *image
|
||||
}
|
||||
else if (cmodelP->cmType == DIRECT_CM_TYPE || cmodelP->cmType == PACKED_CM_TYPE) {
|
||||
int i;
|
||||
+
|
||||
+ /* do some sanity check first: make sure that
|
||||
+ * - sample model is SinglePixelPackedSampleModel
|
||||
+ * - number of bands in the raster corresponds to the number
|
||||
+ * of color components in the color model
|
||||
+ */
|
||||
+ if (!rasterP->sppsm.isUsed ||
|
||||
+ rasterP->numBands != cmodelP->numComponents)
|
||||
+ {
|
||||
+ /* given raster is not compatible with the color model,
|
||||
+ * so the operation has to be aborted.
|
||||
+ */
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
if (cmodelP->maxNbits > 8) {
|
||||
hintP->needToExpand = TRUE;
|
||||
hintP->expandToNbits = cmodelP->maxNbits;
|
||||
diff --git a/src/share/native/sun/awt/image/awt_parseImage.h b/src/share/native/sun/awt/image/awt_parseImage.h
|
||||
--- jdk/src/share/native/sun/awt/image/awt_parseImage.h
|
||||
+++ jdk/src/share/native/sun/awt/image/awt_parseImage.h
|
||||
@@ -95,6 +95,7 @@ typedef struct {
|
||||
jint offsets[MAX_NUMBANDS];
|
||||
jint nBits[MAX_NUMBANDS];
|
||||
jint maxBitSize;
|
||||
+ jint isUsed; // flag to indicate whether the raster sample model is SPPSM
|
||||
} SPPSampleModelS_t;
|
||||
|
||||
/* Struct that holds information for the Raster object */
|
@ -1,395 +0,0 @@
|
||||
diff -Nru openjdk.orig/jdk/src/share/classes/com/sun/jmx/mbeanserver/ClassLoaderRepositorySupport.java openjdk/jdk/src/share/classes/com/sun/jmx/mbeanserver/ClassLoaderRepositorySupport.java
|
||||
--- openjdk.orig/jdk/src/share/classes/com/sun/jmx/mbeanserver/ClassLoaderRepositorySupport.java 2011-11-14 22:11:44.000000000 +0000
|
||||
+++ jdk/src/share/classes/com/sun/jmx/mbeanserver/ClassLoaderRepositorySupport.java 2013-02-15 03:40:40.511587149 +0000
|
||||
@@ -36,6 +36,7 @@
|
||||
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.loading.PrivateClassLoader;
|
||||
+import sun.reflect.misc.ReflectUtil;
|
||||
|
||||
/**
|
||||
* This class keeps the list of Class Loaders registered in the MBean Server.
|
||||
@@ -192,6 +193,7 @@
|
||||
final ClassLoader without,
|
||||
final ClassLoader stop)
|
||||
throws ClassNotFoundException {
|
||||
+ ReflectUtil.checkPackageAccess(className);
|
||||
final int size = list.length;
|
||||
for(int i=0; i<size; i++) {
|
||||
try {
|
||||
diff -Nru openjdk.orig/jdk/src/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java openjdk/jdk/src/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java
|
||||
--- openjdk.orig/jdk/src/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java 2011-11-14 22:11:44.000000000 +0000
|
||||
+++ jdk/src/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java 2013-02-15 03:40:40.511587149 +0000
|
||||
@@ -57,6 +57,7 @@
|
||||
import javax.management.RuntimeOperationsException;
|
||||
import javax.management.MBeanServer;
|
||||
import javax.management.MBeanServerDelegate;
|
||||
+import javax.management.MBeanServerPermission;
|
||||
import javax.management.loading.ClassLoaderRepository;
|
||||
|
||||
import static com.sun.jmx.defaults.JmxProperties.MBEANSERVER_LOGGER;
|
||||
@@ -1413,6 +1414,8 @@
|
||||
// Default is true.
|
||||
final boolean fairLock = DEFAULT_FAIR_LOCK_POLICY;
|
||||
|
||||
+ checkNewMBeanServerPermission();
|
||||
+
|
||||
// This constructor happens to disregard the value of the interceptors
|
||||
// flag - that is, it always uses the default value - false.
|
||||
// This is admitedly a bug, but we chose not to fix it for now
|
||||
@@ -1499,4 +1502,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ private static void checkNewMBeanServerPermission() {
|
||||
+ SecurityManager sm = System.getSecurityManager();
|
||||
+ if (sm != null) {
|
||||
+ Permission perm = new MBeanServerPermission("newMBeanServer");
|
||||
+ sm.checkPermission(perm);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
diff -Nru openjdk.orig/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java openjdk/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java
|
||||
--- openjdk.orig/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java 2011-11-14 22:11:44.000000000 +0000
|
||||
+++ jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java 2013-02-15 03:40:40.511587149 +0000
|
||||
@@ -32,11 +32,13 @@
|
||||
import java.io.ObjectInputStream;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
+import java.security.Permission;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javax.management.InstanceNotFoundException;
|
||||
import javax.management.MBeanException;
|
||||
+import javax.management.MBeanPermission;
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.OperationsException;
|
||||
@@ -44,7 +46,7 @@
|
||||
import javax.management.RuntimeErrorException;
|
||||
import javax.management.RuntimeMBeanException;
|
||||
import javax.management.RuntimeOperationsException;
|
||||
-
|
||||
+import sun.reflect.misc.ConstructorUtil;
|
||||
import sun.reflect.misc.ReflectUtil;
|
||||
|
||||
/**
|
||||
@@ -56,7 +58,6 @@
|
||||
* @since 1.5
|
||||
*/
|
||||
public class MBeanInstantiator {
|
||||
-
|
||||
private final ModifiableClassLoaderRepository clr;
|
||||
// private MetaData meta = null;
|
||||
|
||||
@@ -88,6 +89,7 @@
|
||||
"Exception occurred during object instantiation");
|
||||
}
|
||||
|
||||
+ ReflectUtil.checkPackageAccess(className);
|
||||
try {
|
||||
if (clr == null) throw new ClassNotFoundException(className);
|
||||
theClass = clr.loadClass(className);
|
||||
@@ -162,6 +164,7 @@
|
||||
continue;
|
||||
}
|
||||
|
||||
+ ReflectUtil.checkPackageAccess(signature[i]);
|
||||
// Ok we do not have a primitive type ! We need to build
|
||||
// the signature of the method
|
||||
//
|
||||
@@ -205,6 +208,9 @@
|
||||
*/
|
||||
public Object instantiate(Class theClass)
|
||||
throws ReflectionException, MBeanException {
|
||||
+
|
||||
+ checkMBeanPermission(theClass, null, null, "instantiate");
|
||||
+
|
||||
Object moi = null;
|
||||
|
||||
|
||||
@@ -260,6 +266,9 @@
|
||||
public Object instantiate(Class theClass, Object params[],
|
||||
String signature[], ClassLoader loader)
|
||||
throws ReflectionException, MBeanException {
|
||||
+
|
||||
+ checkMBeanPermission(theClass, null, null, "instantiate");
|
||||
+
|
||||
// Instantiate the new object
|
||||
|
||||
// ------------------------------
|
||||
@@ -408,6 +417,8 @@
|
||||
throw new RuntimeOperationsException(new
|
||||
IllegalArgumentException(), "Null className passed in parameter");
|
||||
}
|
||||
+
|
||||
+ ReflectUtil.checkPackageAccess(className);
|
||||
Class theClass = null;
|
||||
if (loaderName == null) {
|
||||
// Load the class using the agent class loader
|
||||
@@ -620,13 +631,13 @@
|
||||
**/
|
||||
static Class loadClass(String className, ClassLoader loader)
|
||||
throws ReflectionException {
|
||||
-
|
||||
Class theClass = null;
|
||||
if (className == null) {
|
||||
throw new RuntimeOperationsException(new
|
||||
IllegalArgumentException("The class name cannot be null"),
|
||||
"Exception occurred during object instantiation");
|
||||
}
|
||||
+ ReflectUtil.checkPackageAccess(className);
|
||||
try {
|
||||
if (loader == null)
|
||||
loader = MBeanInstantiator.class.getClassLoader();
|
||||
@@ -677,6 +688,7 @@
|
||||
// We need to load the class through the class
|
||||
// loader of the target object.
|
||||
//
|
||||
+ ReflectUtil.checkPackageAccess(signature[i]);
|
||||
tab[i] = Class.forName(signature[i], false, aLoader);
|
||||
}
|
||||
} catch (ClassNotFoundException e) {
|
||||
@@ -702,7 +714,7 @@
|
||||
|
||||
private Constructor<?> findConstructor(Class<?> c, Class<?>[] params) {
|
||||
try {
|
||||
- return c.getConstructor(params);
|
||||
+ return ConstructorUtil.getConstructor(c, params);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
@@ -716,4 +728,18 @@
|
||||
char.class, boolean.class})
|
||||
primitiveClasses.put(c.getName(), c);
|
||||
}
|
||||
+
|
||||
+ private static void checkMBeanPermission(Class<?> clazz,
|
||||
+ String member,
|
||||
+ ObjectName objectName,
|
||||
+ String actions) {
|
||||
+ SecurityManager sm = System.getSecurityManager();
|
||||
+ if (clazz != null && sm != null) {
|
||||
+ Permission perm = new MBeanPermission(clazz.getName(),
|
||||
+ member,
|
||||
+ objectName,
|
||||
+ actions);
|
||||
+ sm.checkPermission(perm);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
diff -Nru openjdk.orig/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanSupport.java openjdk/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanSupport.java
|
||||
--- openjdk.orig/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanSupport.java 2011-11-14 22:11:44.000000000 +0000
|
||||
+++ jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanSupport.java 2013-02-15 03:40:40.511587149 +0000
|
||||
@@ -38,6 +38,7 @@
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.ReflectionException;
|
||||
+import sun.reflect.misc.ReflectUtil;
|
||||
|
||||
/**
|
||||
* Base class for MBeans. There is one instance of this class for
|
||||
@@ -131,6 +132,7 @@
|
||||
" is not an instance of " + mbeanInterface.getName();
|
||||
throw new NotCompliantMBeanException(msg);
|
||||
}
|
||||
+ ReflectUtil.checkPackageAccess(mbeanInterface);
|
||||
this.resource = resource;
|
||||
MBeanIntrospector<M> introspector = getMBeanIntrospector();
|
||||
this.perInterface = introspector.getPerInterface(mbeanInterface);
|
||||
diff -Nru openjdk.orig/jdk/src/share/classes/sun/management/LockDataConverter.java openjdk/jdk/src/share/classes/sun/management/LockDataConverter.java
|
||||
--- openjdk.orig/jdk/src/share/classes/sun/management/LockDataConverter.java 2011-11-14 22:12:00.000000000 +0000
|
||||
+++ jdk/src/share/classes/sun/management/LockDataConverter.java 2013-02-15 03:40:40.511587149 +0000
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
import java.lang.management.LockInfo;
|
||||
import java.lang.management.ThreadInfo;
|
||||
+import java.security.AccessController;
|
||||
+import java.security.PrivilegedAction;
|
||||
import javax.management.Attribute;
|
||||
import javax.management.StandardMBean;
|
||||
import javax.management.openmbean.CompositeData;
|
||||
@@ -40,13 +42,13 @@
|
||||
private LockInfo lockInfo;
|
||||
private LockInfo[] lockedSyncs;
|
||||
|
||||
- LockDataConverter() {
|
||||
+ private LockDataConverter() {
|
||||
super(LockDataConverterMXBean.class, true);
|
||||
this.lockInfo = null;
|
||||
this.lockedSyncs = null;
|
||||
}
|
||||
|
||||
- LockDataConverter(ThreadInfo ti) {
|
||||
+ private LockDataConverter(ThreadInfo ti) {
|
||||
super(LockDataConverterMXBean.class, true);
|
||||
this.lockInfo = ti.getLockInfo();
|
||||
this.lockedSyncs = ti.getLockedSynchronizers();
|
||||
@@ -104,8 +106,24 @@
|
||||
}
|
||||
|
||||
static CompositeData toLockInfoCompositeData(LockInfo l) {
|
||||
- LockDataConverter ldc = new LockDataConverter();
|
||||
+ LockDataConverter ldc = newLockDataConverter();
|
||||
ldc.setLockInfo(l);
|
||||
return ldc.toLockInfoCompositeData();
|
||||
}
|
||||
+
|
||||
+ static LockDataConverter newLockDataConverter() {
|
||||
+ return AccessController.doPrivileged(new PrivilegedAction<LockDataConverter>() {
|
||||
+ public LockDataConverter run() {
|
||||
+ return new LockDataConverter();
|
||||
+ }
|
||||
+ });
|
||||
+ }
|
||||
+
|
||||
+ static LockDataConverter newLockDataConverter(final ThreadInfo ti) {
|
||||
+ LockDataConverter result = newLockDataConverter();
|
||||
+ result.lockInfo = ti.getLockInfo();
|
||||
+ result.lockedSyncs = ti.getLockedSynchronizers();
|
||||
+ return result;
|
||||
+ }
|
||||
}
|
||||
+
|
||||
diff -Nru openjdk.orig/jdk/src/share/classes/sun/management/ThreadInfoCompositeData.java openjdk/jdk/src/share/classes/sun/management/ThreadInfoCompositeData.java
|
||||
--- openjdk.orig/jdk/src/share/classes/sun/management/ThreadInfoCompositeData.java 2011-11-14 22:12:01.000000000 +0000
|
||||
+++ jdk/src/share/classes/sun/management/ThreadInfoCompositeData.java 2013-02-15 03:40:40.511587149 +0000
|
||||
@@ -85,7 +85,7 @@
|
||||
}
|
||||
|
||||
// Convert MonitorInfo[] and LockInfo[] to CompositeData[]
|
||||
- LockDataConverter converter = new LockDataConverter(threadInfo);
|
||||
+ LockDataConverter converter = LockDataConverter.newLockDataConverter(threadInfo);
|
||||
CompositeData lockInfoData = converter.toLockInfoCompositeData();
|
||||
CompositeData[] lockedSyncsData = converter.toLockedSynchronizersCompositeData();
|
||||
|
||||
@@ -315,7 +315,7 @@
|
||||
|
||||
// 6.0 new attributes
|
||||
public LockInfo lockInfo() {
|
||||
- LockDataConverter converter = new LockDataConverter();
|
||||
+ LockDataConverter converter = LockDataConverter.newLockDataConverter();
|
||||
CompositeData lockInfoData = (CompositeData) cdata.get(LOCK_INFO);
|
||||
return converter.toLockInfo(lockInfoData);
|
||||
}
|
||||
@@ -336,7 +336,7 @@
|
||||
}
|
||||
|
||||
public LockInfo[] lockedSynchronizers() {
|
||||
- LockDataConverter converter = new LockDataConverter();
|
||||
+ LockDataConverter converter = LockDataConverter.newLockDataConverter();
|
||||
CompositeData[] lockedSyncsData =
|
||||
(CompositeData[]) cdata.get(LOCKED_SYNCS);
|
||||
|
||||
diff -Nru openjdk.orig/jdk/src/share/lib/security/java.security openjdk/jdk/src/share/lib/security/java.security
|
||||
--- openjdk.orig/jdk/src/share/lib/security/java.security 2013-02-15 03:39:56.922892783 +0000
|
||||
+++ jdk/src/share/lib/security/java.security 2013-02-15 03:40:40.511587149 +0000
|
||||
@@ -131,8 +131,7 @@
|
||||
com.sun.xml.internal.,\
|
||||
com.sun.imageio.,\
|
||||
com.sun.istack.internal.,\
|
||||
- com.sun.jmx.defaults.,\
|
||||
- com.sun.jmx.remote.util.
|
||||
+ com.sun.jmx.
|
||||
|
||||
#
|
||||
# List of comma-separated packages that start with or equal this string
|
||||
@@ -148,8 +147,7 @@
|
||||
com.sun.xml.internal.,\
|
||||
com.sun.imageio.,\
|
||||
com.sun.istack.internal.,\
|
||||
- com.sun.jmx.defaults.,\
|
||||
- com.sun.jmx.remote.util.
|
||||
+ com.sun.jmx.
|
||||
|
||||
#
|
||||
# Determines whether this properties file can be appended to
|
||||
diff -Nru openjdk.orig/jdk/src/share/lib/security/java.security-solaris openjdk/jdk/src/share/lib/security/java.security-solaris
|
||||
--- openjdk.orig/jdk/src/share/lib/security/java.security-solaris 2013-02-15 03:39:56.902892466 +0000
|
||||
+++ jdk/src/share/lib/security/java.security-solaris 2013-02-15 03:41:36.996489851 +0000
|
||||
@@ -131,6 +131,8 @@
|
||||
package.access=sun.,\
|
||||
com.sun.xml.internal.,\
|
||||
com.sun.imageio.
|
||||
+ com.sun.istack.internal.,\
|
||||
+ com.sun.jmx.
|
||||
|
||||
#
|
||||
# List of comma-separated packages that start with or equal this string
|
||||
@@ -145,6 +147,8 @@
|
||||
package.definition=sun.,\
|
||||
com.sun.xml.internal.,\
|
||||
com.sun.imageio.
|
||||
+ com.sun.istack.internal.,\
|
||||
+ com.sun.jmx.
|
||||
|
||||
#
|
||||
# Determines whether this properties file can be appended to
|
||||
diff -Nru openjdk.orig/jdk/src/share/lib/security/java.security-windows openjdk/jdk/src/share/lib/security/java.security-windows
|
||||
--- openjdk.orig/jdk/src/share/lib/security/java.security-windows 2013-02-15 03:39:56.902892466 +0000
|
||||
+++ jdk/src/share/lib/security/java.security-windows 2013-02-15 03:42:05.304943135 +0000
|
||||
@@ -131,6 +131,8 @@
|
||||
package.access=sun.,\
|
||||
com.sun.xml.internal.,\
|
||||
com.sun.imageio.
|
||||
+ com.sun.istack.internal.,\
|
||||
+ com.sun.jmx.
|
||||
|
||||
#
|
||||
# List of comma-separated packages that start with or equal this string
|
||||
@@ -145,6 +147,8 @@
|
||||
package.definition=sun.,\
|
||||
com.sun.xml.internal.,\
|
||||
com.sun.imageio.
|
||||
+ com.sun.istack.internal.,\
|
||||
+ com.sun.jmx.
|
||||
|
||||
#
|
||||
# Determines whether this properties file can be appended to
|
||||
diff -Nru openjdk.orig/jdk/test/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation2Test.java openjdk/jdk/test/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation2Test.java
|
||||
--- openjdk.orig/jdk/test/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation2Test.java 2011-11-14 22:12:28.000000000 +0000
|
||||
+++ jdk/test/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation2Test.java 2013-02-15 03:40:40.511587149 +0000
|
||||
@@ -119,9 +119,6 @@
|
||||
System.out.println("Create SimpleStandard MBean");
|
||||
SimpleStandard s = new SimpleStandard("monitorRole");
|
||||
mbs.registerMBean(s, new ObjectName("MBeans:type=SimpleStandard"));
|
||||
- // Set Security Manager
|
||||
- //
|
||||
- System.setSecurityManager(new SecurityManager());
|
||||
// Create Properties containing the username/password entries
|
||||
//
|
||||
Properties props = new Properties();
|
||||
@@ -132,6 +129,9 @@
|
||||
HashMap env = new HashMap();
|
||||
env.put("jmx.remote.authenticator",
|
||||
new JMXPluggableAuthenticator(props));
|
||||
+ // Set Security Manager
|
||||
+ //
|
||||
+ System.setSecurityManager(new SecurityManager());
|
||||
// Create an RMI connector server
|
||||
//
|
||||
System.out.println("Create an RMI connector server");
|
||||
diff -Nru openjdk.orig/jdk/test/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation3Test.java openjdk/jdk/test/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation3Test.java
|
||||
--- openjdk.orig/jdk/test/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation3Test.java 2011-11-14 22:12:28.000000000 +0000
|
||||
+++ jdk/test/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation3Test.java 2013-02-15 03:40:40.511587149 +0000
|
||||
@@ -120,9 +120,6 @@
|
||||
System.out.println("Create SimpleStandard MBean");
|
||||
SimpleStandard s = new SimpleStandard("delegate");
|
||||
mbs.registerMBean(s, new ObjectName("MBeans:type=SimpleStandard"));
|
||||
- // Set Security Manager
|
||||
- //
|
||||
- System.setSecurityManager(new SecurityManager());
|
||||
// Create Properties containing the username/password entries
|
||||
//
|
||||
Properties props = new Properties();
|
||||
@@ -133,6 +130,9 @@
|
||||
HashMap env = new HashMap();
|
||||
env.put("jmx.remote.authenticator",
|
||||
new JMXPluggableAuthenticator(props));
|
||||
+ // Set Security Manager
|
||||
+ //
|
||||
+ System.setSecurityManager(new SecurityManager());
|
||||
// Create an RMI connector server
|
||||
//
|
||||
System.out.println("Create an RMI connector server");
|
File diff suppressed because it is too large
Load Diff
@ -1,130 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User coffeys
|
||||
# Date 1360873966 0
|
||||
# Node ID 617e68a3948824283f15c36fcd8cf264c1dd0a99
|
||||
# Parent 25e83b78298b71abb46eb5a337ed7bddef418ca4
|
||||
8007688: Blacklist known bad certificate
|
||||
Reviewed-by: mullan
|
||||
|
||||
diff --git a/src/share/classes/sun/security/util/UntrustedCertificates.java b/src/share/classes/sun/security/util/UntrustedCertificates.java
|
||||
--- jdk/src/share/classes/sun/security/util/UntrustedCertificates.java
|
||||
+++ jdk/src/share/classes/sun/security/util/UntrustedCertificates.java
|
||||
@@ -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
|
||||
@@ -739,5 +739,111 @@ public final class UntrustedCertificates
|
||||
"B8WfedLHjFW/TMcnXlEWKz4=\n" +
|
||||
"-----END CERTIFICATE-----");
|
||||
|
||||
+ //
|
||||
+ // Revoked DigiCert code signing certificates used to sign malware
|
||||
+ //
|
||||
+
|
||||
+ // Subject: CN=Buster Paper Comercial Ltda,
|
||||
+ // O=Buster Paper Comercial Ltda,
|
||||
+ // L=S?o Jos? Dos Campos,
|
||||
+ // ST=S?o Paulo,
|
||||
+ // C=BR
|
||||
+ // Issuer: CN=DigiCert Assured ID Code Signing CA-1,
|
||||
+ // OU=www.digicert.com,
|
||||
+ // O=DigiCert Inc,
|
||||
+ // C=US
|
||||
+ // Serial: 07:b4:4c:db:ff:fb:78:de:05:f4:26:16:72:a6:73:12
|
||||
+ add("buster-paper-comercial-ltda-72A67312",
|
||||
+ "-----BEGIN CERTIFICATE-----\n" +
|
||||
+ "MIIGwzCCBaugAwIBAgIQB7RM2//7eN4F9CYWcqZzEjANBgkqhkiG9w0BAQUFADBv\n" +
|
||||
+ "MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3\n" +
|
||||
+ "d3cuZGlnaWNlcnQuY29tMS4wLAYDVQQDEyVEaWdpQ2VydCBBc3N1cmVkIElEIENv\n" +
|
||||
+ "ZGUgU2lnbmluZyBDQS0xMB4XDTEzMDExNzAwMDAwMFoXDTE0MDEyMjEyMDAwMFow\n" +
|
||||
+ "gY4xCzAJBgNVBAYTAkJSMRMwEQYDVQQIDApTw6NvIFBhdWxvMR4wHAYDVQQHDBVT\n" +
|
||||
+ "w6NvIEpvc8OpIERvcyBDYW1wb3MxJDAiBgNVBAoTG0J1c3RlciBQYXBlciBDb21l\n" +
|
||||
+ "cmNpYWwgTHRkYTEkMCIGA1UEAxMbQnVzdGVyIFBhcGVyIENvbWVyY2lhbCBMdGRh\n" +
|
||||
+ "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzO0l6jWIpEfO2oUpVHpL\n" +
|
||||
+ "HETj5lzivNb0S9jKHgGJax917czh81PnGTxwxFXd6gLJuy/XFHvmiSi8g8jzlymn\n" +
|
||||
+ "2Ji5zQ3CPaz7nomJokSUDlMVJ2qYWtctw4jrdjuI4qtn+koXXUFkWjkf8h8251I4\n" +
|
||||
+ "tUs7S49HE2Go5owCYP3byajj7fsFAYR/Xb7TdVtndkZsUB/YgOjHovyACjouaNCi\n" +
|
||||
+ "mDiRyQ6zLLjZGiyeD65Yiseuhp5b8/BL5h1p7w76QYMYMVQNAdtDKut2R8MBpuWf\n" +
|
||||
+ "Ny7Eoi0x/gm1p9X5Rcl5aN7K0G4UtTAJKbkuUfXddsyFoM0Nx8uo8SgNQ8Y/X5Jx\n" +
|
||||
+ "BwIDAQABo4IDOTCCAzUwHwYDVR0jBBgwFoAUe2jOKarAF75JeuHlP9an90WPNTIw\n" +
|
||||
+ "HQYDVR0OBBYEFFLZ3n5nt/Eer7n1bvtOqMb1qKO5MA4GA1UdDwEB/wQEAwIHgDAT\n" +
|
||||
+ "BgNVHSUEDDAKBggrBgEFBQcDAzBzBgNVHR8EbDBqMDOgMaAvhi1odHRwOi8vY3Js\n" +
|
||||
+ "My5kaWdpY2VydC5jb20vYXNzdXJlZC1jcy0yMDExYS5jcmwwM6AxoC+GLWh0dHA6\n" +
|
||||
+ "Ly9jcmw0LmRpZ2ljZXJ0LmNvbS9hc3N1cmVkLWNzLTIwMTFhLmNybDCCAcQGA1Ud\n" +
|
||||
+ "IASCAbswggG3MIIBswYJYIZIAYb9bAMBMIIBpDA6BggrBgEFBQcCARYuaHR0cDov\n" +
|
||||
+ "L3d3dy5kaWdpY2VydC5jb20vc3NsLWNwcy1yZXBvc2l0b3J5Lmh0bTCCAWQGCCsG\n" +
|
||||
+ "AQUFBwICMIIBVh6CAVIAQQBuAHkAIAB1AHMAZQAgAG8AZgAgAHQAaABpAHMAIABD\n" +
|
||||
+ "AGUAcgB0AGkAZgBpAGMAYQB0AGUAIABjAG8AbgBzAHQAaQB0AHUAdABlAHMAIABh\n" +
|
||||
+ "AGMAYwBlAHAAdABhAG4AYwBlACAAbwBmACAAdABoAGUAIABEAGkAZwBpAEMAZQBy\n" +
|
||||
+ "AHQAIABDAFAALwBDAFAAUwAgAGEAbgBkACAAdABoAGUAIABSAGUAbAB5AGkAbgBn\n" +
|
||||
+ "ACAAUABhAHIAdAB5ACAAQQBnAHIAZQBlAG0AZQBuAHQAIAB3AGgAaQBjAGgAIABs\n" +
|
||||
+ "AGkAbQBpAHQAIABsAGkAYQBiAGkAbABpAHQAeQAgAGEAbgBkACAAYQByAGUAIABp\n" +
|
||||
+ "AG4AYwBvAHIAcABvAHIAYQB0AGUAZAAgAGgAZQByAGUAaQBuACAAYgB5ACAAcgBl\n" +
|
||||
+ "AGYAZQByAGUAbgBjAGUALjCBggYIKwYBBQUHAQEEdjB0MCQGCCsGAQUFBzABhhho\n" +
|
||||
+ "dHRwOi8vb2NzcC5kaWdpY2VydC5jb20wTAYIKwYBBQUHMAKGQGh0dHA6Ly9jYWNl\n" +
|
||||
+ "cnRzLmRpZ2ljZXJ0LmNvbS9EaWdpQ2VydEFzc3VyZWRJRENvZGVTaWduaW5nQ0Et\n" +
|
||||
+ "MS5jcnQwDAYDVR0TAQH/BAIwADANBgkqhkiG9w0BAQUFAAOCAQEAPTTQvpOIikXI\n" +
|
||||
+ "hTLnNbajaFRR5GhQpTzUNgBfF9VYSlNw/wMjpGsrh5RxaJCip52jbehmTgjMRhft\n" +
|
||||
+ "jRYyml44PAVsCcR9uEoDpCZYpI1fHI1R+F8jd1C9rqprbSwwOG4xlg4SmvTHYs6e\n" +
|
||||
+ "gBItQ/1p9XY+Sf4Wv1qOuOFL1qvV/5VyR2zdlOQCmKCeMgxt6a/tHLBDiAA67D44\n" +
|
||||
+ "/vfdoNJl0CU2It0PO60jdCPFNWIRcxL+OSDqAoePeUC7xQ+JsTEIxuUE8+d6w6fc\n" +
|
||||
+ "BV2mYb1flh22t46GLjh4gyo7xw3aL6L0L0jzlTT6IcEw6NIbaPbIKj/npQnHobYj\n" +
|
||||
+ "XMuKLxbh7g==\n" +
|
||||
+ "-----END CERTIFICATE-----");
|
||||
+
|
||||
+ // Subject: CN=BUSTER ASSISTENCIA TECNICA ELETRONICA LTDA - ME,
|
||||
+ // O=BUSTER ASSISTENCIA TECNICA ELETRONICA LTDA - ME,
|
||||
+ // L=S?o Paulo,
|
||||
+ // ST=S?o Paulo,
|
||||
+ // C=BR
|
||||
+ // Issuer: CN=DigiCert Assured ID Code Signing CA-1,
|
||||
+ // OU=www.digicert.com,
|
||||
+ // O=DigiCert Inc,
|
||||
+ // C=US
|
||||
+ // Serial: 0a:38:9b:95:ee:73:6d:d1:3b:c0:ed:74:3f:d7:4d:2f
|
||||
+ add("buster-assistencia-tecnica-electronica-ltda-3FD74D2F",
|
||||
+ "-----BEGIN CERTIFICATE-----\n" +
|
||||
+ "MIIG4DCCBcigAwIBAgIQCjible5zbdE7wO10P9dNLzANBgkqhkiG9w0BAQUFADBv\n" +
|
||||
+ "MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3\n" +
|
||||
+ "d3cuZGlnaWNlcnQuY29tMS4wLAYDVQQDEyVEaWdpQ2VydCBBc3N1cmVkIElEIENv\n" +
|
||||
+ "ZGUgU2lnbmluZyBDQS0xMB4XDTEyMTEwOTAwMDAwMFoXDTEzMTExNDEyMDAwMFow\n" +
|
||||
+ "gasxCzAJBgNVBAYTAkJSMRMwEQYDVQQIDApTw6NvIFBhdWxvMRMwEQYDVQQHDApT\n" +
|
||||
+ "w6NvIFBhdWxvMTgwNgYDVQQKEy9CVVNURVIgQVNTSVNURU5DSUEgVEVDTklDQSBF\n" +
|
||||
+ "TEVUUk9OSUNBIExUREEgLSBNRTE4MDYGA1UEAxMvQlVTVEVSIEFTU0lTVEVOQ0lB\n" +
|
||||
+ "IFRFQ05JQ0EgRUxFVFJPTklDQSBMVERBIC0gTUUwggEiMA0GCSqGSIb3DQEBAQUA\n" +
|
||||
+ "A4IBDwAwggEKAoIBAQDAqNeEs5/B2CTXGjTOkUIdu6jV6qulOZwdw4sefHWYj1UR\n" +
|
||||
+ "4z6zPk9kjpUgbnb402RFq88QtfInwddZ/wXn9OxMtDd/3TnC7HrhNS7ga79ZFL2V\n" +
|
||||
+ "JnmzKHum2Yvh0q82QEJ9tHBR2X9VdKpUIH08Zs3k6cWWM1H0YX0cxA/HohhesQJW\n" +
|
||||
+ "kwJ3urOIJiH/HeByDk8a1NS8safcCxk5vxvW4WvCg43iT09LeHY5Aa8abKw8lqVb\n" +
|
||||
+ "0tD5ZSIjdmdj3TT1U37iAHLLRM2DXbxfdbhouUX1c5U1ZHAMA67HwjKiseOiDaHj\n" +
|
||||
+ "NUGbC37C+cgbc9VVM/cURD8WvS0Kj6fQv7F2QtJDAgMBAAGjggM5MIIDNTAfBgNV\n" +
|
||||
+ "HSMEGDAWgBR7aM4pqsAXvkl64eU/1qf3RY81MjAdBgNVHQ4EFgQU88EXKAyDsh30\n" +
|
||||
+ "o9+Gu9a4xUy+FSMwDgYDVR0PAQH/BAQDAgeAMBMGA1UdJQQMMAoGCCsGAQUFBwMD\n" +
|
||||
+ "MHMGA1UdHwRsMGowM6AxoC+GLWh0dHA6Ly9jcmwzLmRpZ2ljZXJ0LmNvbS9hc3N1\n" +
|
||||
+ "cmVkLWNzLTIwMTFhLmNybDAzoDGgL4YtaHR0cDovL2NybDQuZGlnaWNlcnQuY29t\n" +
|
||||
+ "L2Fzc3VyZWQtY3MtMjAxMWEuY3JsMIIBxAYDVR0gBIIBuzCCAbcwggGzBglghkgB\n" +
|
||||
+ "hv1sAwEwggGkMDoGCCsGAQUFBwIBFi5odHRwOi8vd3d3LmRpZ2ljZXJ0LmNvbS9z\n" +
|
||||
+ "c2wtY3BzLXJlcG9zaXRvcnkuaHRtMIIBZAYIKwYBBQUHAgIwggFWHoIBUgBBAG4A\n" +
|
||||
+ "eQAgAHUAcwBlACAAbwBmACAAdABoAGkAcwAgAEMAZQByAHQAaQBmAGkAYwBhAHQA\n" +
|
||||
+ "ZQAgAGMAbwBuAHMAdABpAHQAdQB0AGUAcwAgAGEAYwBjAGUAcAB0AGEAbgBjAGUA\n" +
|
||||
+ "IABvAGYAIAB0AGgAZQAgAEQAaQBnAGkAQwBlAHIAdAAgAEMAUAAvAEMAUABTACAA\n" +
|
||||
+ "YQBuAGQAIAB0AGgAZQAgAFIAZQBsAHkAaQBuAGcAIABQAGEAcgB0AHkAIABBAGcA\n" +
|
||||
+ "cgBlAGUAbQBlAG4AdAAgAHcAaABpAGMAaAAgAGwAaQBtAGkAdAAgAGwAaQBhAGIA\n" +
|
||||
+ "aQBsAGkAdAB5ACAAYQBuAGQAIABhAHIAZQAgAGkAbgBjAG8AcgBwAG8AcgBhAHQA\n" +
|
||||
+ "ZQBkACAAaABlAHIAZQBpAG4AIABiAHkAIAByAGUAZgBlAHIAZQBuAGMAZQAuMIGC\n" +
|
||||
+ "BggrBgEFBQcBAQR2MHQwJAYIKwYBBQUHMAGGGGh0dHA6Ly9vY3NwLmRpZ2ljZXJ0\n" +
|
||||
+ "LmNvbTBMBggrBgEFBQcwAoZAaHR0cDovL2NhY2VydHMuZGlnaWNlcnQuY29tL0Rp\n" +
|
||||
+ "Z2lDZXJ0QXNzdXJlZElEQ29kZVNpZ25pbmdDQS0xLmNydDAMBgNVHRMBAf8EAjAA\n" +
|
||||
+ "MA0GCSqGSIb3DQEBBQUAA4IBAQAei1QmiXepje8OIfo/WonD4MIXgpPr2dfRaquQ\n" +
|
||||
+ "A8q63OpTRSveyqdQDCSPpDRF/nvO1Y30yksZvIH1tNBsW5LBdxAKN3lFdBlqBwtE\n" +
|
||||
+ "Q3jHc0KVVYRJ0FBaGE/PJHmRajscdAhYIcMPhTga0u0tDK+wOHEq3993dfl6yHjA\n" +
|
||||
+ "XHU2iW5pnk75ZoE39zALD5eKXT8ZXrET5c3XUFJKWA+XuGmdmyzqo0Au49PanBv9\n" +
|
||||
+ "UlZnabYfqoMArqMS0tGSX4cGgi9/2E+pHG9BX4sFW+ZDumroOA2pxyMWEKjxePEL\n" +
|
||||
+ "zCOfhbsRWdMLYepauaNZOIMZXmFwcrIl0TGMkTAtATz+XmZc\n" +
|
||||
+ "-----END CERTIFICATE-----");
|
||||
+
|
||||
}
|
||||
}
|
@ -1,463 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User bae
|
||||
# Date 1360857111 -14400
|
||||
# Node ID 0dcf8ad3e63dfa4bb929bf2de99b95f18f5ea1c8
|
||||
# Parent 8a980f97e66a6433a1cdc946c90aff4433ea505c
|
||||
8007014: Improve image handling
|
||||
Reviewed-by: prr, mschoene, jgodinez
|
||||
|
||||
--- jdk/src/share/classes/sun/awt/image/ByteComponentRaster.java Tue Feb 26 12:42:17 2013 -0800
|
||||
+++ jdk/src/share/classes/sun/awt/image/ByteComponentRaster.java Thu Feb 14 19:51:51 2013 +0400
|
||||
@@ -868,6 +868,15 @@ public class ByteComponentRaster extends
|
||||
* or if data buffer has not enough capacity.
|
||||
*/
|
||||
protected final void verify() {
|
||||
+ /* Need to re-verify the dimensions since a sample model may be
|
||||
+ * specified to the constructor
|
||||
+ */
|
||||
+ if (width <= 0 || height <= 0 ||
|
||||
+ height > (Integer.MAX_VALUE / width))
|
||||
+ {
|
||||
+ throw new RasterFormatException("Invalid raster dimension");
|
||||
+ }
|
||||
+
|
||||
for (int i = 0; i < dataOffsets.length; i++) {
|
||||
if (dataOffsets[i] < 0) {
|
||||
throw new RasterFormatException("Data offsets for band " + i
|
||||
@@ -905,12 +914,13 @@ public class ByteComponentRaster extends
|
||||
lastPixelOffset += lastScanOffset;
|
||||
|
||||
for (int i = 0; i < numDataElements; i++) {
|
||||
- size = lastPixelOffset + dataOffsets[i];
|
||||
if (dataOffsets[i] > (Integer.MAX_VALUE - lastPixelOffset)) {
|
||||
throw new RasterFormatException("Incorrect band offset: "
|
||||
+ dataOffsets[i]);
|
||||
|
||||
}
|
||||
+
|
||||
+ size = lastPixelOffset + dataOffsets[i];
|
||||
|
||||
if (size > maxSize) {
|
||||
maxSize = size;
|
||||
--- jdk/src/share/classes/sun/awt/image/BytePackedRaster.java Tue Feb 26 12:42:17 2013 -0800
|
||||
+++ jdk/src/share/classes/sun/awt/image/BytePackedRaster.java Thu Feb 14 19:51:51 2013 +0400
|
||||
@@ -1368,11 +1368,35 @@ public class BytePackedRaster extends Su
|
||||
throw new RasterFormatException("Data offsets must be >= 0");
|
||||
}
|
||||
|
||||
+ /* Need to re-verify the dimensions since a sample model may be
|
||||
+ * specified to the constructor
|
||||
+ */
|
||||
+ if (width <= 0 || height <= 0 ||
|
||||
+ height > (Integer.MAX_VALUE / width))
|
||||
+ {
|
||||
+ throw new RasterFormatException("Invalid raster dimension");
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ /*
|
||||
+ * pixelBitstride was verified in constructor, so just make
|
||||
+ * sure that it is safe to multiply it by width.
|
||||
+ */
|
||||
+ if ((width - 1) > Integer.MAX_VALUE / pixelBitStride) {
|
||||
+ throw new RasterFormatException("Invalid raster dimension");
|
||||
+ }
|
||||
+
|
||||
+ if (scanlineStride < 0 ||
|
||||
+ scanlineStride > (Integer.MAX_VALUE / height))
|
||||
+ {
|
||||
+ throw new RasterFormatException("Invalid scanline stride");
|
||||
+ }
|
||||
+
|
||||
int lastbit = (dataBitOffset
|
||||
+ (height-1) * scanlineStride * 8
|
||||
+ (width-1) * pixelBitStride
|
||||
+ pixelBitStride - 1);
|
||||
- if (lastbit / 8 >= data.length) {
|
||||
+ if (lastbit < 0 || lastbit / 8 >= data.length) {
|
||||
throw new RasterFormatException("raster dimensions overflow " +
|
||||
"array bounds");
|
||||
}
|
||||
--- jdk/src/share/classes/sun/awt/image/IntegerComponentRaster.java Tue Feb 26 12:42:17 2013 -0800
|
||||
+++ jdk/src/share/classes/sun/awt/image/IntegerComponentRaster.java Thu Feb 14 19:51:51 2013 +0400
|
||||
@@ -208,7 +208,7 @@ public class IntegerComponentRaster exte
|
||||
" SinglePixelPackedSampleModel");
|
||||
}
|
||||
|
||||
- verify(false);
|
||||
+ verify();
|
||||
}
|
||||
|
||||
|
||||
@@ -629,16 +629,26 @@ public class IntegerComponentRaster exte
|
||||
}
|
||||
|
||||
/**
|
||||
- * Verify that the layout parameters are consistent with
|
||||
- * the data. If strictCheck
|
||||
- * is false, this method will check for ArrayIndexOutOfBounds conditions. If
|
||||
- * strictCheck is true, this method will check for additional error
|
||||
- * conditions such as line wraparound (width of a line greater than
|
||||
- * the scanline stride).
|
||||
- * @return String Error string, if the layout is incompatible with
|
||||
- * the data. Otherwise returns null.
|
||||
- */
|
||||
- private void verify (boolean strictCheck) {
|
||||
+ * Verify that the layout parameters are consistent with the data.
|
||||
+ *
|
||||
+ * The method verifies whether scanline stride and pixel stride do not
|
||||
+ * cause an integer overflow during calculation of a position of the pixel
|
||||
+ * in data buffer. It also verifies whether the data buffer has enough data
|
||||
+ * to correspond the raster layout attributes.
|
||||
+ *
|
||||
+ * @throws RasterFormatException if an integer overflow is detected,
|
||||
+ * or if data buffer has not enough capacity.
|
||||
+ */
|
||||
+ protected final void verify() {
|
||||
+ /* Need to re-verify the dimensions since a sample model may be
|
||||
+ * specified to the constructor
|
||||
+ */
|
||||
+ if (width <= 0 || height <= 0 ||
|
||||
+ height > (Integer.MAX_VALUE / width))
|
||||
+ {
|
||||
+ throw new RasterFormatException("Invalid raster dimension");
|
||||
+ }
|
||||
+
|
||||
if (dataOffsets[0] < 0) {
|
||||
throw new RasterFormatException("Data offset ("+dataOffsets[0]+
|
||||
") must be >= 0");
|
||||
@@ -647,17 +657,46 @@ public class IntegerComponentRaster exte
|
||||
int maxSize = 0;
|
||||
int size;
|
||||
|
||||
- for (int i=0; i < numDataElements; i++) {
|
||||
- size = (height-1)*scanlineStride + (width-1)*pixelStride +
|
||||
- dataOffsets[i];
|
||||
+ // we can be sure that width and height are greater than 0
|
||||
+ if (scanlineStride < 0 ||
|
||||
+ scanlineStride > (Integer.MAX_VALUE / height))
|
||||
+ {
|
||||
+ // integer overflow
|
||||
+ throw new RasterFormatException("Incorrect scanline stride: "
|
||||
+ + scanlineStride);
|
||||
+ }
|
||||
+ int lastScanOffset = (height - 1) * scanlineStride;
|
||||
+
|
||||
+ if (pixelStride < 0 ||
|
||||
+ pixelStride > (Integer.MAX_VALUE / width))
|
||||
+ {
|
||||
+ // integer overflow
|
||||
+ throw new RasterFormatException("Incorrect pixel stride: "
|
||||
+ + pixelStride);
|
||||
+ }
|
||||
+ int lastPixelOffset = (width - 1) * pixelStride;
|
||||
+
|
||||
+ if (lastPixelOffset > (Integer.MAX_VALUE - lastScanOffset)) {
|
||||
+ // integer overflow
|
||||
+ throw new RasterFormatException("Incorrect raster attributes");
|
||||
+ }
|
||||
+ lastPixelOffset += lastScanOffset;
|
||||
+
|
||||
+ for (int i = 0; i < numDataElements; i++) {
|
||||
+ if (dataOffsets[i] > (Integer.MAX_VALUE - lastPixelOffset)) {
|
||||
+ throw new RasterFormatException("Incorrect band offset: "
|
||||
+ + dataOffsets[i]);
|
||||
+ }
|
||||
+
|
||||
+ size = lastPixelOffset + dataOffsets[i];
|
||||
+
|
||||
if (size > maxSize) {
|
||||
maxSize = size;
|
||||
}
|
||||
}
|
||||
if (data.length < maxSize) {
|
||||
- throw new RasterFormatException("Data array too small (should be "+
|
||||
- maxSize
|
||||
- +" but is "+data.length+" )");
|
||||
+ throw new RasterFormatException("Data array too small (should be "
|
||||
+ + maxSize + " )");
|
||||
}
|
||||
}
|
||||
|
||||
--- jdk/src/share/classes/sun/awt/image/IntegerInterleavedRaster.java Tue Feb 26 12:42:17 2013 -0800
|
||||
+++ jdk/src/share/classes/sun/awt/image/IntegerInterleavedRaster.java Thu Feb 14 19:51:51 2013 +0400
|
||||
@@ -151,7 +151,7 @@ public class IntegerInterleavedRaster ex
|
||||
throw new RasterFormatException("IntegerInterleavedRasters must have"+
|
||||
" SinglePixelPackedSampleModel");
|
||||
}
|
||||
- verify(false);
|
||||
+ verify();
|
||||
}
|
||||
|
||||
|
||||
@@ -540,31 +540,6 @@ public class IntegerInterleavedRaster ex
|
||||
return createCompatibleWritableRaster(width,height);
|
||||
}
|
||||
|
||||
- /**
|
||||
- * Verify that the layout parameters are consistent with
|
||||
- * the data. If strictCheck
|
||||
- * is false, this method will check for ArrayIndexOutOfBounds conditions. If
|
||||
- * strictCheck is true, this method will check for additional error
|
||||
- * conditions such as line wraparound (width of a line greater than
|
||||
- * the scanline stride).
|
||||
- * @return String Error string, if the layout is incompatible with
|
||||
- * the data. Otherwise returns null.
|
||||
- */
|
||||
- private void verify (boolean strictCheck) {
|
||||
- int maxSize = 0;
|
||||
- int size;
|
||||
-
|
||||
- size = (height-1)*scanlineStride + (width-1) + dataOffsets[0];
|
||||
- if (size > maxSize) {
|
||||
- maxSize = size;
|
||||
- }
|
||||
- if (data.length < maxSize) {
|
||||
- throw new RasterFormatException("Data array too small (should be "+
|
||||
- maxSize
|
||||
- +" but is "+data.length+" )");
|
||||
- }
|
||||
- }
|
||||
-
|
||||
public String toString() {
|
||||
return new String ("IntegerInterleavedRaster: width = "+width
|
||||
+" height = " + height
|
||||
--- jdk/src/share/classes/sun/awt/image/ShortComponentRaster.java Tue Feb 26 12:42:17 2013 -0800
|
||||
+++ jdk/src/share/classes/sun/awt/image/ShortComponentRaster.java Thu Feb 14 19:51:51 2013 +0400
|
||||
@@ -802,6 +802,15 @@ public class ShortComponentRaster extend
|
||||
* or if data buffer has not enough capacity.
|
||||
*/
|
||||
protected final void verify() {
|
||||
+ /* Need to re-verify the dimensions since a sample model may be
|
||||
+ * specified to the constructor
|
||||
+ */
|
||||
+ if (width <= 0 || height <= 0 ||
|
||||
+ height > (Integer.MAX_VALUE / width))
|
||||
+ {
|
||||
+ throw new RasterFormatException("Invalid raster dimension");
|
||||
+ }
|
||||
+
|
||||
for (int i = 0; i < dataOffsets.length; i++) {
|
||||
if (dataOffsets[i] < 0) {
|
||||
throw new RasterFormatException("Data offsets for band " + i
|
||||
@@ -839,11 +848,12 @@ public class ShortComponentRaster extend
|
||||
lastPixelOffset += lastScanOffset;
|
||||
|
||||
for (int i = 0; i < numDataElements; i++) {
|
||||
- size = lastPixelOffset + dataOffsets[i];
|
||||
if (dataOffsets[i] > (Integer.MAX_VALUE - lastPixelOffset)) {
|
||||
throw new RasterFormatException("Incorrect band offset: "
|
||||
+ dataOffsets[i]);
|
||||
}
|
||||
+
|
||||
+ size = lastPixelOffset + dataOffsets[i];
|
||||
|
||||
if (size > maxSize) {
|
||||
maxSize = size;
|
||||
--- jdk/src/share/native/sun/awt/image/awt_parseImage.c Tue Feb 26 12:42:17 2013 -0800
|
||||
+++ jdk/src/share/native/sun/awt/image/awt_parseImage.c Thu Feb 14 19:51:51 2013 +0400
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "java_awt_color_ColorSpace.h"
|
||||
#include "awt_Mlib.h"
|
||||
#include "safe_alloc.h"
|
||||
+#include "safe_math.h"
|
||||
|
||||
static int setHints(JNIEnv *env, BufImageS_t *imageP);
|
||||
|
||||
--- jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.c Tue Feb 26 12:42:17 2013 -0800
|
||||
+++ jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.c Thu Feb 14 19:51:51 2013 +0400
|
||||
@@ -42,6 +42,7 @@
|
||||
#include "awt_Mlib.h"
|
||||
#include "gdefs.h"
|
||||
#include "safe_alloc.h"
|
||||
+#include "safe_math.h"
|
||||
|
||||
/***************************************************************************
|
||||
* Definitions *
|
||||
@@ -1993,13 +1994,23 @@ cvtCustomToDefault(JNIEnv *env, BufImage
|
||||
unsigned char *dP = dataP;
|
||||
#define NUM_LINES 10
|
||||
int numLines = NUM_LINES;
|
||||
- int nbytes = rasterP->width*4*NUM_LINES;
|
||||
+ /* it is safe to calculate the scan length, because width has been verified
|
||||
+ * on creation of the mlib image
|
||||
+ */
|
||||
+ int scanLength = rasterP->width * 4;
|
||||
+
|
||||
+ int nbytes = 0;
|
||||
+ if (!SAFE_TO_MULT(numLines, scanLength)) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ nbytes = numLines * scanLength;
|
||||
|
||||
for (y=0; y < rasterP->height; y+=numLines) {
|
||||
/* getData, one scanline at a time */
|
||||
if (y+numLines > rasterP->height) {
|
||||
numLines = rasterP->height - y;
|
||||
- nbytes = rasterP->width*4*numLines;
|
||||
+ nbytes = numLines * scanLength;
|
||||
}
|
||||
jpixels = (*env)->CallObjectMethod(env, imageP->jimage,
|
||||
g_BImgGetRGBMID, 0, y,
|
||||
@@ -2129,8 +2140,14 @@ allocateArray(JNIEnv *env, BufImageS_t *
|
||||
if (cvtToDefault) {
|
||||
int status = 0;
|
||||
*mlibImagePP = (*sMlibSysFns.createFP)(MLIB_BYTE, 4, width, height);
|
||||
+ if (*mlibImagePP == NULL) {
|
||||
+ return -1;
|
||||
+ }
|
||||
cDataP = (unsigned char *) mlib_ImageGetData(*mlibImagePP);
|
||||
- /* Make sure the image is cleared */
|
||||
+ /* Make sure the image is cleared.
|
||||
+ * NB: the image dimension is already verified, so we can
|
||||
+ * safely calculate the length of the buffer.
|
||||
+ */
|
||||
memset(cDataP, 0, width*height*4);
|
||||
|
||||
if (!isSrc) {
|
||||
@@ -2380,6 +2397,9 @@ allocateRasterArray(JNIEnv *env, RasterS
|
||||
case sun_awt_image_IntegerComponentRaster_TYPE_BYTE_PACKED_SAMPLES:
|
||||
*mlibImagePP = (*sMlibSysFns.createFP)(MLIB_BYTE, rasterP->numBands,
|
||||
width, height);
|
||||
+ if (*mlibImagePP == NULL) {
|
||||
+ return -1;
|
||||
+ }
|
||||
if (!isSrc) return 0;
|
||||
cDataP = (unsigned char *) mlib_ImageGetData(*mlibImagePP);
|
||||
return expandPackedBCR(env, rasterP, -1, cDataP);
|
||||
@@ -2388,6 +2408,9 @@ allocateRasterArray(JNIEnv *env, RasterS
|
||||
if (rasterP->sppsm.maxBitSize <= 8) {
|
||||
*mlibImagePP = (*sMlibSysFns.createFP)(MLIB_BYTE, rasterP->numBands,
|
||||
width, height);
|
||||
+ if (*mlibImagePP == NULL) {
|
||||
+ return -1;
|
||||
+ }
|
||||
if (!isSrc) return 0;
|
||||
cDataP = (unsigned char *) mlib_ImageGetData(*mlibImagePP);
|
||||
return expandPackedSCR(env, rasterP, -1, cDataP);
|
||||
@@ -2397,6 +2420,9 @@ allocateRasterArray(JNIEnv *env, RasterS
|
||||
if (rasterP->sppsm.maxBitSize <= 8) {
|
||||
*mlibImagePP = (*sMlibSysFns.createFP)(MLIB_BYTE, rasterP->numBands,
|
||||
width, height);
|
||||
+ if (*mlibImagePP == NULL) {
|
||||
+ return -1;
|
||||
+ }
|
||||
if (!isSrc) return 0;
|
||||
cDataP = (unsigned char *) mlib_ImageGetData(*mlibImagePP);
|
||||
return expandPackedICR(env, rasterP, -1, cDataP);
|
||||
--- jdk/src/share/native/sun/awt/medialib/mlib_ImageCreate.c Tue Feb 26 12:42:17 2013 -0800
|
||||
+++ jdk/src/share/native/sun/awt/medialib/mlib_ImageCreate.c Thu Feb 14 19:51:51 2013 +0400
|
||||
@@ -120,6 +120,7 @@
|
||||
#include "mlib_image.h"
|
||||
#include "mlib_ImageRowTable.h"
|
||||
#include "mlib_ImageCreate.h"
|
||||
+#include "safe_math.h"
|
||||
|
||||
/***************************************************************/
|
||||
mlib_image* mlib_ImageSet(mlib_image *image,
|
||||
@@ -247,25 +248,47 @@ mlib_image *mlib_ImageCreate(mlib_type t
|
||||
return NULL;
|
||||
};
|
||||
|
||||
+ if (!SAFE_TO_MULT(width, channels)) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ wb = width * channels;
|
||||
+
|
||||
switch (type) {
|
||||
case MLIB_DOUBLE:
|
||||
- wb = width * channels * 8;
|
||||
+ if (!SAFE_TO_MULT(wb, 8)) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ wb *= 8;
|
||||
break;
|
||||
case MLIB_FLOAT:
|
||||
case MLIB_INT:
|
||||
- wb = width * channels * 4;
|
||||
+ if (!SAFE_TO_MULT(wb, 4)) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ wb *= 4;
|
||||
break;
|
||||
case MLIB_USHORT:
|
||||
case MLIB_SHORT:
|
||||
- wb = width * channels * 2;
|
||||
+ if (!SAFE_TO_MULT(wb, 4)) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ wb *= 2;
|
||||
break;
|
||||
case MLIB_BYTE:
|
||||
- wb = width * channels;
|
||||
+ // wb is ready
|
||||
break;
|
||||
case MLIB_BIT:
|
||||
- wb = (width * channels + 7) / 8;
|
||||
+ if (!SAFE_TO_ADD(7, wb)) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ wb = (wb + 7) / 8;
|
||||
break;
|
||||
default:
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ if (!SAFE_TO_MULT(wb, height)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
--- jdk/src/share/native/sun/awt/medialib/safe_alloc.h Tue Feb 26 12:42:17 2013 -0800
|
||||
+++ jdk/src/share/native/sun/awt/medialib/safe_alloc.h Thu Feb 14 19:51:51 2013 +0400
|
||||
@@ -41,10 +41,4 @@
|
||||
(((w) > 0) && ((h) > 0) && ((sz) > 0) && \
|
||||
(((0xffffffffu / ((juint)(w))) / ((juint)(h))) > ((juint)(sz))))
|
||||
|
||||
-#define SAFE_TO_MULT(a, b) \
|
||||
- (((a) > 0) && ((b) >= 0) && ((0x7fffffff / (a)) > (b)))
|
||||
-
|
||||
-#define SAFE_TO_ADD(a, b) \
|
||||
- (((a) >= 0) && ((b) >= 0) && ((0x7fffffff - (a)) > (b)))
|
||||
-
|
||||
#endif // __SAFE_ALLOC_H__
|
||||
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
||||
+++ jdk/src/share/native/sun/awt/medialib/safe_math.h Thu Feb 14 19:51:51 2013 +0400
|
||||
@@ -0,0 +1,35 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ * This code is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation. Oracle designates this
|
||||
+ * particular file as subject to the "Classpath" exception as provided
|
||||
+ * by Oracle in the LICENSE file that accompanied this code.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
+ * or visit www.oracle.com if you need additional information or have any
|
||||
+ * questions.
|
||||
+ */
|
||||
+
|
||||
+#ifndef __SAFE_MATH_H__
|
||||
+#define __SAFE_MATH_H__
|
||||
+
|
||||
+#define SAFE_TO_MULT(a, b) \
|
||||
+ (((a) > 0) && ((b) >= 0) && ((0x7fffffff / (a)) > (b)))
|
||||
+
|
||||
+#define SAFE_TO_ADD(a, b) \
|
||||
+ (((a) >= 0) && ((b) >= 0) && ((0x7fffffff - (a)) > (b)))
|
||||
+
|
||||
+#endif // __SAFE_MATH_H__
|
||||
|
@ -1,509 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User bae
|
||||
# Date 1361431543 -14400
|
||||
# Node ID b130c8cfecfc552614047b3244d5d94439827fcd
|
||||
# Parent 0dcf8ad3e63dfa4bb929bf2de99b95f18f5ea1c8
|
||||
8007675: Improve color conversion
|
||||
Reviewed-by: prr, jgodinez
|
||||
|
||||
--- jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java Thu Feb 14 19:51:51 2013 +0400
|
||||
+++ jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java Thu Feb 21 11:25:43 2013 +0400
|
||||
@@ -99,50 +99,75 @@ class LCMSImageLayout {
|
||||
int offset;
|
||||
|
||||
Object dataArray;
|
||||
- private LCMSImageLayout(int np, int pixelType, int pixelSize) {
|
||||
+ private int dataArrayLength; /* in bytes */
|
||||
+
|
||||
+ private LCMSImageLayout(int np, int pixelType, int pixelSize)
|
||||
+ throws ImageLayoutException
|
||||
+ {
|
||||
this.pixelType = pixelType;
|
||||
width = np;
|
||||
height = 1;
|
||||
- nextRowOffset = np*pixelSize;
|
||||
+ nextRowOffset = safeMult(pixelSize, np);
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
private LCMSImageLayout(int width, int height, int pixelType,
|
||||
- int pixelSize) {
|
||||
+ int pixelSize)
|
||||
+ throws ImageLayoutException
|
||||
+ {
|
||||
this.pixelType = pixelType;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
- nextRowOffset = width*pixelSize;
|
||||
+ nextRowOffset = safeMult(pixelSize, width);
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
|
||||
- public LCMSImageLayout(byte[] data, int np, int pixelType, int pixelSize) {
|
||||
+ public LCMSImageLayout(byte[] data, int np, int pixelType, int pixelSize)
|
||||
+ throws ImageLayoutException
|
||||
+ {
|
||||
this(np, pixelType, pixelSize);
|
||||
dataType = DT_BYTE;
|
||||
dataArray = data;
|
||||
- }
|
||||
-
|
||||
- public LCMSImageLayout(short[] data, int np, int pixelType, int pixelSize) {
|
||||
+ dataArrayLength = data.length;
|
||||
+
|
||||
+ verify();
|
||||
+ }
|
||||
+
|
||||
+ public LCMSImageLayout(short[] data, int np, int pixelType, int pixelSize)
|
||||
+ throws ImageLayoutException
|
||||
+ {
|
||||
this(np, pixelType, pixelSize);
|
||||
dataType = DT_SHORT;
|
||||
dataArray = data;
|
||||
- }
|
||||
-
|
||||
- public LCMSImageLayout(int[] data, int np, int pixelType, int pixelSize) {
|
||||
+ dataArrayLength = 2 * data.length;
|
||||
+
|
||||
+ verify();
|
||||
+ }
|
||||
+
|
||||
+ public LCMSImageLayout(int[] data, int np, int pixelType, int pixelSize)
|
||||
+ throws ImageLayoutException
|
||||
+ {
|
||||
this(np, pixelType, pixelSize);
|
||||
dataType = DT_INT;
|
||||
dataArray = data;
|
||||
+ dataArrayLength = 4 * data.length;
|
||||
+
|
||||
+ verify();
|
||||
}
|
||||
|
||||
public LCMSImageLayout(double[] data, int np, int pixelType, int pixelSize)
|
||||
+ throws ImageLayoutException
|
||||
{
|
||||
this(np, pixelType, pixelSize);
|
||||
dataType = DT_DOUBLE;
|
||||
dataArray = data;
|
||||
- }
|
||||
-
|
||||
- public LCMSImageLayout(BufferedImage image) {
|
||||
+ dataArrayLength = 8 * data.length;
|
||||
+
|
||||
+ verify();
|
||||
+ }
|
||||
+
|
||||
+ public LCMSImageLayout(BufferedImage image) throws ImageLayoutException {
|
||||
ShortComponentRaster shortRaster;
|
||||
IntegerComponentRaster intRaster;
|
||||
ByteComponentRaster byteRaster;
|
||||
@@ -186,9 +211,13 @@ class LCMSImageLayout {
|
||||
case BufferedImage.TYPE_INT_ARGB:
|
||||
case BufferedImage.TYPE_INT_BGR:
|
||||
intRaster = (IntegerComponentRaster)image.getRaster();
|
||||
- nextRowOffset = intRaster.getScanlineStride()*4;
|
||||
- offset = intRaster.getDataOffset(0)*4;
|
||||
+
|
||||
+ nextRowOffset = safeMult(4, intRaster.getScanlineStride());
|
||||
+
|
||||
+ offset = safeMult(4, intRaster.getDataOffset(0));
|
||||
+
|
||||
dataArray = intRaster.getDataStorage();
|
||||
+ dataArrayLength = 4 * intRaster.getDataStorage().length;
|
||||
dataType = DT_INT;
|
||||
break;
|
||||
|
||||
@@ -196,8 +225,10 @@ class LCMSImageLayout {
|
||||
case BufferedImage.TYPE_4BYTE_ABGR:
|
||||
byteRaster = (ByteComponentRaster)image.getRaster();
|
||||
nextRowOffset = byteRaster.getScanlineStride();
|
||||
- offset = byteRaster.getDataOffset(0);
|
||||
+ int firstBand = image.getSampleModel().getNumBands() - 1;
|
||||
+ offset = byteRaster.getDataOffset(firstBand);
|
||||
dataArray = byteRaster.getDataStorage();
|
||||
+ dataArrayLength = byteRaster.getDataStorage().length;
|
||||
dataType = DT_BYTE;
|
||||
break;
|
||||
|
||||
@@ -206,17 +237,20 @@ class LCMSImageLayout {
|
||||
nextRowOffset = byteRaster.getScanlineStride();
|
||||
offset = byteRaster.getDataOffset(0);
|
||||
dataArray = byteRaster.getDataStorage();
|
||||
+ dataArrayLength = byteRaster.getDataStorage().length;
|
||||
dataType = DT_BYTE;
|
||||
break;
|
||||
|
||||
case BufferedImage.TYPE_USHORT_GRAY:
|
||||
shortRaster = (ShortComponentRaster)image.getRaster();
|
||||
- nextRowOffset = shortRaster.getScanlineStride()*2;
|
||||
- offset = shortRaster.getDataOffset(0) * 2;
|
||||
+ nextRowOffset = safeMult(2, shortRaster.getScanlineStride());
|
||||
+ offset = safeMult(2, shortRaster.getDataOffset(0));
|
||||
dataArray = shortRaster.getDataStorage();
|
||||
+ dataArrayLength = 2 * shortRaster.getDataStorage().length;
|
||||
dataType = DT_SHORT;
|
||||
break;
|
||||
}
|
||||
+ verify();
|
||||
}
|
||||
|
||||
public static boolean isSupported(BufferedImage image) {
|
||||
@@ -232,4 +266,45 @@ class LCMSImageLayout {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
+
|
||||
+ private void verify() throws ImageLayoutException {
|
||||
+
|
||||
+ if (offset < 0 || offset >= dataArrayLength) {
|
||||
+ throw new ImageLayoutException("Invalid image layout");
|
||||
+ }
|
||||
+
|
||||
+ int lastPixelOffset = safeMult(nextRowOffset, (height - 1));
|
||||
+
|
||||
+ lastPixelOffset = safeAdd(lastPixelOffset, (width - 1));
|
||||
+
|
||||
+ int off = safeAdd(offset, lastPixelOffset);
|
||||
+
|
||||
+ if (off < 0 || off >= dataArrayLength) {
|
||||
+ throw new ImageLayoutException("Invalid image layout");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ static int safeAdd(int a, int b) throws ImageLayoutException {
|
||||
+ long res = a;
|
||||
+ res += b;
|
||||
+ if (res < Integer.MIN_VALUE || res > Integer.MAX_VALUE) {
|
||||
+ throw new ImageLayoutException("Invalid image layout");
|
||||
+ }
|
||||
+ return (int)res;
|
||||
+ }
|
||||
+
|
||||
+ static int safeMult(int a, int b) throws ImageLayoutException {
|
||||
+ long res = a;
|
||||
+ res *= b;
|
||||
+ if (res < Integer.MIN_VALUE || res > Integer.MAX_VALUE) {
|
||||
+ throw new ImageLayoutException("Invalid image layout");
|
||||
+ }
|
||||
+ return (int)res;
|
||||
+ }
|
||||
+
|
||||
+ public static class ImageLayoutException extends Exception {
|
||||
+ public ImageLayoutException(String message) {
|
||||
+ super(message);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
--- jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSTransform.java Fri Oct 26 14:32:40 2012 -0700
|
||||
+++ jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSTransform.java Mon Mar 04 19:22:10 2013 +0100
|
||||
@@ -51,6 +51,7 @@
|
||||
import java.awt.image.ComponentSampleModel;
|
||||
import sun.java2d.cmm.*;
|
||||
import sun.java2d.cmm.lcms.*;
|
||||
+import static sun.java2d.cmm.lcms.LCMSImageLayout.ImageLayoutException;
|
||||
|
||||
|
||||
public class LCMSTransform implements ColorTransform {
|
||||
@@ -111,15 +112,26 @@
|
||||
return profiles[profiles.length - 1].getNumComponents();
|
||||
}
|
||||
|
||||
+ private synchronized void doTransform(LCMSImageLayout in,
|
||||
+ LCMSImageLayout out) {
|
||||
+ // update native transfrom if needed
|
||||
+ if (ID == 0L) {
|
||||
+ ID = LCMS.createNativeTransform(profileIDs, renderType,
|
||||
+ disposerReferent);
|
||||
+ }
|
||||
+ LCMS.colorConvert(this, in, out);
|
||||
+ }
|
||||
+
|
||||
public void colorConvert(BufferedImage src, BufferedImage dst) {
|
||||
if (LCMSImageLayout.isSupported(src) &&
|
||||
LCMSImageLayout.isSupported(dst))
|
||||
{
|
||||
- synchronized(this) {
|
||||
- LCMS.colorConvert(this, new LCMSImageLayout(src),
|
||||
- new LCMSImageLayout(dst));
|
||||
+ try {
|
||||
+ doTransform(new LCMSImageLayout(src), new LCMSImageLayout(dst));
|
||||
+ return;
|
||||
+ } catch (ImageLayoutException e) {
|
||||
+ throw new CMMException("Unable to convert images");
|
||||
}
|
||||
- return;
|
||||
}
|
||||
LCMSImageLayout srcIL, dstIL;
|
||||
Raster srcRas = src.getRaster();
|
||||
@@ -177,14 +189,18 @@
|
||||
}
|
||||
int idx;
|
||||
// TODO check for src npixels = dst npixels
|
||||
- srcIL = new LCMSImageLayout(
|
||||
- srcLine, srcLine.length/getNumInComponents(),
|
||||
- LCMSImageLayout.CHANNELS_SH(getNumInComponents()) |
|
||||
- LCMSImageLayout.BYTES_SH(1), getNumInComponents());
|
||||
- dstIL = new LCMSImageLayout(
|
||||
- dstLine, dstLine.length/getNumOutComponents(),
|
||||
- LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) |
|
||||
- LCMSImageLayout.BYTES_SH(1), getNumOutComponents());
|
||||
+ try {
|
||||
+ srcIL = new LCMSImageLayout(
|
||||
+ srcLine, srcLine.length/getNumInComponents(),
|
||||
+ LCMSImageLayout.CHANNELS_SH(getNumInComponents()) |
|
||||
+ LCMSImageLayout.BYTES_SH(1), getNumInComponents());
|
||||
+ dstIL = new LCMSImageLayout(
|
||||
+ dstLine, dstLine.length/getNumOutComponents(),
|
||||
+ LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) |
|
||||
+ LCMSImageLayout.BYTES_SH(1), getNumOutComponents());
|
||||
+ } catch (ImageLayoutException e) {
|
||||
+ throw new CMMException("Unable to convert images");
|
||||
+ }
|
||||
// process each scanline
|
||||
for (int y = 0; y < h; y++) {
|
||||
// convert src scanline
|
||||
@@ -204,9 +220,8 @@
|
||||
}
|
||||
}
|
||||
// color convert srcLine to dstLine
|
||||
- synchronized (this) {
|
||||
- LCMS.colorConvert(this, srcIL, dstIL);
|
||||
- }
|
||||
+ doTransform(srcIL, dstIL);
|
||||
+
|
||||
// convert dst scanline
|
||||
pixel = null;
|
||||
idx = 0;
|
||||
@@ -234,16 +249,19 @@
|
||||
alpha = new float[w];
|
||||
}
|
||||
int idx;
|
||||
- srcIL = new LCMSImageLayout(
|
||||
- srcLine, srcLine.length/getNumInComponents(),
|
||||
- LCMSImageLayout.CHANNELS_SH(getNumInComponents()) |
|
||||
- LCMSImageLayout.BYTES_SH(2), getNumInComponents()*2);
|
||||
+ try {
|
||||
+ srcIL = new LCMSImageLayout(
|
||||
+ srcLine, srcLine.length/getNumInComponents(),
|
||||
+ LCMSImageLayout.CHANNELS_SH(getNumInComponents()) |
|
||||
+ LCMSImageLayout.BYTES_SH(2), getNumInComponents()*2);
|
||||
|
||||
- dstIL = new LCMSImageLayout(
|
||||
- dstLine, dstLine.length/getNumOutComponents(),
|
||||
- LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) |
|
||||
- LCMSImageLayout.BYTES_SH(2), getNumOutComponents()*2);
|
||||
-
|
||||
+ dstIL = new LCMSImageLayout(
|
||||
+ dstLine, dstLine.length/getNumOutComponents(),
|
||||
+ LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) |
|
||||
+ LCMSImageLayout.BYTES_SH(2), getNumOutComponents()*2);
|
||||
+ } catch (ImageLayoutException e) {
|
||||
+ throw new CMMException("Unable to convert images");
|
||||
+ }
|
||||
// process each scanline
|
||||
for (int y = 0; y < h; y++) {
|
||||
// convert src scanline
|
||||
@@ -263,9 +281,8 @@
|
||||
}
|
||||
}
|
||||
// color convert srcLine to dstLine
|
||||
- synchronized(this) {
|
||||
- LCMS.colorConvert(this, srcIL, dstIL);
|
||||
- }
|
||||
+ doTransform(srcIL, dstIL);
|
||||
+
|
||||
// convert dst scanline
|
||||
pixel = null;
|
||||
idx = 0;
|
||||
@@ -353,16 +370,19 @@
|
||||
short[] srcLine = new short[w * srcNumBands];
|
||||
short[] dstLine = new short[w * dstNumBands];
|
||||
int idx;
|
||||
- srcIL = new LCMSImageLayout(
|
||||
- srcLine, srcLine.length/getNumInComponents(),
|
||||
- LCMSImageLayout.CHANNELS_SH(getNumInComponents()) |
|
||||
- LCMSImageLayout.BYTES_SH(2), getNumInComponents()*2);
|
||||
+ try {
|
||||
+ srcIL = new LCMSImageLayout(
|
||||
+ srcLine, srcLine.length/getNumInComponents(),
|
||||
+ LCMSImageLayout.CHANNELS_SH(getNumInComponents()) |
|
||||
+ LCMSImageLayout.BYTES_SH(2), getNumInComponents()*2);
|
||||
|
||||
- dstIL = new LCMSImageLayout(
|
||||
- dstLine, dstLine.length/getNumOutComponents(),
|
||||
- LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) |
|
||||
- LCMSImageLayout.BYTES_SH(2), getNumOutComponents()*2);
|
||||
-
|
||||
+ dstIL = new LCMSImageLayout(
|
||||
+ dstLine, dstLine.length/getNumOutComponents(),
|
||||
+ LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) |
|
||||
+ LCMSImageLayout.BYTES_SH(2), getNumOutComponents()*2);
|
||||
+ } catch (ImageLayoutException e) {
|
||||
+ throw new CMMException("Unable to convert rasters");
|
||||
+ }
|
||||
// process each scanline
|
||||
for (int y = 0; y < h; y++, ys++, yd++) {
|
||||
// get src scanline
|
||||
@@ -377,9 +397,7 @@
|
||||
}
|
||||
|
||||
// color convert srcLine to dstLine
|
||||
- synchronized(this) {
|
||||
- LCMS.colorConvert(this, srcIL, dstIL);
|
||||
- }
|
||||
+ doTransform(srcIL, dstIL);
|
||||
|
||||
// store dst scanline
|
||||
xd = dst.getMinX();
|
||||
@@ -447,15 +465,18 @@
|
||||
byte[] dstLine = new byte[w * dstNumBands];
|
||||
int idx;
|
||||
// TODO check for src npixels = dst npixels
|
||||
- srcIL = new LCMSImageLayout(
|
||||
- srcLine, srcLine.length/getNumInComponents(),
|
||||
- LCMSImageLayout.CHANNELS_SH(getNumInComponents()) |
|
||||
- LCMSImageLayout.BYTES_SH(1), getNumInComponents());
|
||||
- dstIL = new LCMSImageLayout(
|
||||
- dstLine, dstLine.length/getNumOutComponents(),
|
||||
- LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) |
|
||||
- LCMSImageLayout.BYTES_SH(1), getNumOutComponents());
|
||||
-
|
||||
+ try {
|
||||
+ srcIL = new LCMSImageLayout(
|
||||
+ srcLine, srcLine.length/getNumInComponents(),
|
||||
+ LCMSImageLayout.CHANNELS_SH(getNumInComponents()) |
|
||||
+ LCMSImageLayout.BYTES_SH(1), getNumInComponents());
|
||||
+ dstIL = new LCMSImageLayout(
|
||||
+ dstLine, dstLine.length/getNumOutComponents(),
|
||||
+ LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) |
|
||||
+ LCMSImageLayout.BYTES_SH(1), getNumOutComponents());
|
||||
+ } catch (ImageLayoutException e) {
|
||||
+ throw new CMMException("Unable to convert rasters");
|
||||
+ }
|
||||
// process each scanline
|
||||
for (int y = 0; y < h; y++, ys++, yd++) {
|
||||
// get src scanline
|
||||
@@ -470,9 +491,7 @@
|
||||
}
|
||||
|
||||
// color convert srcLine to dstLine
|
||||
- synchronized(this) {
|
||||
- LCMS.colorConvert(this, srcIL, dstIL);
|
||||
- }
|
||||
+ doTransform(srcIL, dstIL);
|
||||
|
||||
// store dst scanline
|
||||
xd = dst.getMinX();
|
||||
@@ -489,16 +508,20 @@
|
||||
short[] srcLine = new short[w * srcNumBands];
|
||||
short[] dstLine = new short[w * dstNumBands];
|
||||
int idx;
|
||||
- srcIL = new LCMSImageLayout(
|
||||
- srcLine, srcLine.length/getNumInComponents(),
|
||||
- LCMSImageLayout.CHANNELS_SH(getNumInComponents()) |
|
||||
- LCMSImageLayout.BYTES_SH(2), getNumInComponents()*2);
|
||||
|
||||
- dstIL = new LCMSImageLayout(
|
||||
- dstLine, dstLine.length/getNumOutComponents(),
|
||||
- LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) |
|
||||
- LCMSImageLayout.BYTES_SH(2), getNumOutComponents()*2);
|
||||
+ try {
|
||||
+ srcIL = new LCMSImageLayout(
|
||||
+ srcLine, srcLine.length/getNumInComponents(),
|
||||
+ LCMSImageLayout.CHANNELS_SH(getNumInComponents()) |
|
||||
+ LCMSImageLayout.BYTES_SH(2), getNumInComponents()*2);
|
||||
|
||||
+ dstIL = new LCMSImageLayout(
|
||||
+ dstLine, dstLine.length/getNumOutComponents(),
|
||||
+ LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) |
|
||||
+ LCMSImageLayout.BYTES_SH(2), getNumOutComponents()*2);
|
||||
+ } catch (ImageLayoutException e) {
|
||||
+ throw new CMMException("Unable to convert rasters");
|
||||
+ }
|
||||
// process each scanline
|
||||
for (int y = 0; y < h; y++, ys++, yd++) {
|
||||
// get src scanline
|
||||
@@ -513,9 +536,8 @@
|
||||
}
|
||||
|
||||
// color convert srcLine to dstLine
|
||||
- synchronized(this) {
|
||||
- LCMS.colorConvert(this, srcIL, dstIL);
|
||||
- }
|
||||
+ doTransform(srcIL, dstIL);
|
||||
+
|
||||
// store dst scanline
|
||||
xd = dst.getMinX();
|
||||
idx = 0;
|
||||
@@ -540,21 +562,23 @@
|
||||
dst = new short [(src.length/getNumInComponents())*getNumOutComponents()];
|
||||
}
|
||||
|
||||
- LCMSImageLayout srcIL = new LCMSImageLayout(
|
||||
- src, src.length/getNumInComponents(),
|
||||
- LCMSImageLayout.CHANNELS_SH(getNumInComponents()) |
|
||||
- LCMSImageLayout.BYTES_SH(2), getNumInComponents()*2);
|
||||
+ try {
|
||||
+ LCMSImageLayout srcIL = new LCMSImageLayout(
|
||||
+ src, src.length/getNumInComponents(),
|
||||
+ LCMSImageLayout.CHANNELS_SH(getNumInComponents()) |
|
||||
+ LCMSImageLayout.BYTES_SH(2), getNumInComponents()*2);
|
||||
|
||||
- LCMSImageLayout dstIL = new LCMSImageLayout(
|
||||
- dst, dst.length/getNumOutComponents(),
|
||||
- LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) |
|
||||
- LCMSImageLayout.BYTES_SH(2), getNumOutComponents()*2);
|
||||
+ LCMSImageLayout dstIL = new LCMSImageLayout(
|
||||
+ dst, dst.length/getNumOutComponents(),
|
||||
+ LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) |
|
||||
+ LCMSImageLayout.BYTES_SH(2), getNumOutComponents()*2);
|
||||
|
||||
- synchronized(this) {
|
||||
- LCMS.colorConvert(this, srcIL, dstIL);
|
||||
+ doTransform(srcIL, dstIL);
|
||||
+
|
||||
+ return dst;
|
||||
+ } catch (ImageLayoutException e) {
|
||||
+ throw new CMMException("Unable to convert data");
|
||||
}
|
||||
-
|
||||
- return dst;
|
||||
}
|
||||
|
||||
public byte[] colorConvert(byte[] src, byte[] dst) {
|
||||
@@ -562,20 +586,22 @@
|
||||
dst = new byte [(src.length/getNumInComponents())*getNumOutComponents()];
|
||||
}
|
||||
|
||||
- LCMSImageLayout srcIL = new LCMSImageLayout(
|
||||
- src, src.length/getNumInComponents(),
|
||||
- LCMSImageLayout.CHANNELS_SH(getNumInComponents()) |
|
||||
- LCMSImageLayout.BYTES_SH(1), getNumInComponents());
|
||||
+ try {
|
||||
+ LCMSImageLayout srcIL = new LCMSImageLayout(
|
||||
+ src, src.length/getNumInComponents(),
|
||||
+ LCMSImageLayout.CHANNELS_SH(getNumInComponents()) |
|
||||
+ LCMSImageLayout.BYTES_SH(1), getNumInComponents());
|
||||
|
||||
- LCMSImageLayout dstIL = new LCMSImageLayout(
|
||||
- dst, dst.length/getNumOutComponents(),
|
||||
- LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) |
|
||||
- LCMSImageLayout.BYTES_SH(1), getNumOutComponents());
|
||||
+ LCMSImageLayout dstIL = new LCMSImageLayout(
|
||||
+ dst, dst.length/getNumOutComponents(),
|
||||
+ LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) |
|
||||
+ LCMSImageLayout.BYTES_SH(1), getNumOutComponents());
|
||||
|
||||
- synchronized(this) {
|
||||
- LCMS.colorConvert(this, srcIL, dstIL);
|
||||
+ doTransform(srcIL, dstIL);
|
||||
+
|
||||
+ return dst;
|
||||
+ } catch (ImageLayoutException e) {
|
||||
+ throw new CMMException("Unable to convert data");
|
||||
}
|
||||
-
|
||||
- return dst;
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
--- /dev/null 2013-04-25 14:56:29.000000000 -0400
|
||||
+++ jaxp/patches/jaxp_src/6657673-factory_finder.patch 2013-04-25 14:58:33.000000000 -0400
|
||||
@@ -0,0 +1,51 @@
|
||||
+--- src/javax/xml/parsers/FactoryFinder.java 2013-04-22 12:42:32.138748378 -0400
|
||||
++++ src/javax/xml/parsers/FactoryFinder.java 2013-04-22 12:41:36.033419998 -0400
|
||||
+@@ -44,7 +44,7 @@
|
||||
+ * @author Santiago.PericasGeertsen@sun.com
|
||||
+ */
|
||||
+ class FactoryFinder {
|
||||
+-
|
||||
++ private static final String DEFAULT_PACKAGE = "com.sun.org.apache.xerces.internal";
|
||||
+ /**
|
||||
+ * Internal debug flag.
|
||||
+ */
|
||||
+@@ -140,6 +140,14 @@
|
||||
+ static Object newInstance(String className, ClassLoader cl, boolean doFallback)
|
||||
+ throws ConfigurationError
|
||||
+ {
|
||||
++ // make sure we have access to restricted packages
|
||||
++ if (System.getSecurityManager() != null) {
|
||||
++ if (className != null && className.startsWith(DEFAULT_PACKAGE)) {
|
||||
++ cl = null;
|
||||
++ useBSClsLoader = true;
|
||||
++ }
|
||||
++ }
|
||||
++
|
||||
+ try {
|
||||
+ Class providerClass = getProviderClass(className, cl, doFallback);
|
||||
+ Object instance = providerClass.newInstance();
|
||||
+--- src/javax/xml/transform/FactoryFinder.java 2013-04-22 12:42:32.230748906 -0400
|
||||
++++ src/javax/xml/transform/FactoryFinder.java 2013-04-22 12:41:41.268451218 -0400
|
||||
+@@ -44,6 +44,7 @@
|
||||
+ * @author Santiago.PericasGeertsen@sun.com
|
||||
+ */
|
||||
+ class FactoryFinder {
|
||||
++ private static final String DEFAULT_PACKAGE = "com.sun.org.apache.xalan.internal.";
|
||||
+
|
||||
+ /**
|
||||
+ * Internal debug flag.
|
||||
+@@ -140,6 +141,14 @@
|
||||
+ static Object newInstance(String className, ClassLoader cl, boolean doFallback)
|
||||
+ throws ConfigurationError
|
||||
+ {
|
||||
++ // make sure we have access to restricted packages
|
||||
++ if (System.getSecurityManager() != null) {
|
||||
++ if (className != null && className.startsWith(DEFAULT_PACKAGE)) {
|
||||
++ cl = null;
|
||||
++ useBSClsLoader = true;
|
||||
++ }
|
||||
++ }
|
||||
++
|
||||
+ try {
|
||||
+ Class providerClass = getProviderClass(className, cl, doFallback);
|
||||
+ Object instance = providerClass.newInstance();
|
@ -1,228 +0,0 @@
|
||||
--- /dev/null 2013-04-25 14:48:41.000000000 -0400
|
||||
+++ jaxp/patches/jaxp_src/6657673-fixup.patch 2013-04-25 14:51:50.000000000 -0400
|
||||
@@ -0,0 +1,225 @@
|
||||
+--- src/com/sun/org/apache/xml/internal/serializer/CharInfo.java
|
||||
++++ src/com/sun/org/apache/xml/internal/serializer/CharInfo.java
|
||||
+@@ -36,6 +36,8 @@
|
||||
+
|
||||
+ import javax.xml.transform.TransformerException;
|
||||
+
|
||||
++import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
|
||||
++
|
||||
+ import com.sun.org.apache.xml.internal.serializer.utils.MsgKey;
|
||||
+ import com.sun.org.apache.xml.internal.serializer.utils.SystemIDResolver;
|
||||
+ import com.sun.org.apache.xml.internal.serializer.utils.Utils;
|
||||
+--- /dev/null
|
||||
++++ src/com/sun/org/apache/xml/internal/serializer/ObjectFactory.java
|
||||
+@@ -0,0 +1,200 @@
|
||||
++/*
|
||||
++ * reserved comment block
|
||||
++ * DO NOT REMOVE OR ALTER!
|
||||
++ */
|
||||
++/*
|
||||
++ * Copyright 2001-2004 The Apache Software Foundation.
|
||||
++ *
|
||||
++ * Licensed under the Apache License, Version 2.0 (the "License");
|
||||
++ * you may not use this file except in compliance with the License.
|
||||
++ * You may obtain a copy of the License at
|
||||
++ *
|
||||
++ * http://www.apache.org/licenses/LICENSE-2.0
|
||||
++ *
|
||||
++ * Unless required by applicable law or agreed to in writing, software
|
||||
++ * distributed under the License is distributed on an "AS IS" BASIS,
|
||||
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
++ * See the License for the specific language governing permissions and
|
||||
++ * limitations under the License.
|
||||
++ */
|
||||
++/*
|
||||
++ * $Id: ObjectFactory.java,v 1.2.4.1 2005/09/15 08:15:20 suresh_emailid Exp $
|
||||
++ */
|
||||
++
|
||||
++package com.sun.org.apache.xml.internal.serializer;
|
||||
++
|
||||
++import java.io.BufferedReader;
|
||||
++import java.io.File;
|
||||
++import java.io.FileInputStream;
|
||||
++import java.io.IOException;
|
||||
++import java.io.InputStream;
|
||||
++import java.io.InputStreamReader;
|
||||
++import java.util.Properties;
|
||||
++
|
||||
++/**
|
||||
++ * This class is duplicated for each JAXP subpackage so keep it in sync.
|
||||
++ * It is package private and therefore is not exposed as part of the JAXP
|
||||
++ * API.
|
||||
++ * <p>
|
||||
++ * This code is designed to implement the JAXP 1.1 spec pluggability
|
||||
++ * feature and is designed to run on JDK version 1.1 and
|
||||
++ * later, and to compile on JDK 1.2 and onward.
|
||||
++ * The code also runs both as part of an unbundled jar file and
|
||||
++ * when bundled as part of the JDK.
|
||||
++ * <p>
|
||||
++ * This class was moved from the <code>javax.xml.parsers.ObjectFactory</code>
|
||||
++ * class and modified to be used as a general utility for creating objects
|
||||
++ * dynamically.
|
||||
++ *
|
||||
++ * @xsl.usage internal
|
||||
++ */
|
||||
++class ObjectFactory {
|
||||
++
|
||||
++ //
|
||||
++ // Constants
|
||||
++ //
|
||||
++
|
||||
++ // name of default properties file to look for in JDK's jre/lib directory
|
||||
++ private static final String DEFAULT_PROPERTIES_FILENAME =
|
||||
++ "xalan.properties";
|
||||
++
|
||||
++ private static final String SERVICES_PATH = "META-INF/services/";
|
||||
++
|
||||
++ /** Set to true for debugging */
|
||||
++ private static final boolean DEBUG = false;
|
||||
++
|
||||
++ /** cache the contents of the xalan.properties file.
|
||||
++ * Until an attempt has been made to read this file, this will
|
||||
++ * be null; if the file does not exist or we encounter some other error
|
||||
++ * during the read, this will be empty.
|
||||
++ */
|
||||
++ private static Properties fXalanProperties = null;
|
||||
++
|
||||
++ /***
|
||||
++ * Cache the time stamp of the xalan.properties file so
|
||||
++ * that we know if it's been modified and can invalidate
|
||||
++ * the cache when necessary.
|
||||
++ */
|
||||
++ private static long fLastModified = -1;
|
||||
++
|
||||
++ /**
|
||||
++ * Create an instance of a class using the specified ClassLoader
|
||||
++ */
|
||||
++ static Object newInstance(String className, ClassLoader cl,
|
||||
++ boolean doFallback)
|
||||
++ throws ConfigurationError
|
||||
++ {
|
||||
++ // assert(className != null);
|
||||
++ try{
|
||||
++ Class providerClass = findProviderClass(className, cl, doFallback);
|
||||
++ Object instance = providerClass.newInstance();
|
||||
++ return instance;
|
||||
++ } catch (ClassNotFoundException x) {
|
||||
++ throw new ConfigurationError(
|
||||
++ "Provider " + className + " not found", x);
|
||||
++ } catch (Exception x) {
|
||||
++ throw new ConfigurationError(
|
||||
++ "Provider " + className + " could not be instantiated: " + x,
|
||||
++ x);
|
||||
++ }
|
||||
++ }
|
||||
++
|
||||
++ /**
|
||||
++ * Find a Class using the specified ClassLoader
|
||||
++ */
|
||||
++ static Class findProviderClass(String className, ClassLoader cl,
|
||||
++ boolean doFallback)
|
||||
++ throws ClassNotFoundException, ConfigurationError
|
||||
++ {
|
||||
++ //throw security exception if the calling thread is not allowed to access the
|
||||
++ //class. Restrict the access to the package classes as specified in java.security policy.
|
||||
++ SecurityManager security = System.getSecurityManager();
|
||||
++ try{
|
||||
++ if (security != null){
|
||||
++ final int lastDot = className.lastIndexOf(".");
|
||||
++ String packageName = className;
|
||||
++ if (lastDot != -1) packageName = className.substring(0, lastDot);
|
||||
++ security.checkPackageAccess(packageName);
|
||||
++ }
|
||||
++ }catch(SecurityException e){
|
||||
++ throw e;
|
||||
++ }
|
||||
++
|
||||
++ Class providerClass;
|
||||
++ if (cl == null) {
|
||||
++ // XXX Use the bootstrap ClassLoader. There is no way to
|
||||
++ // load a class using the bootstrap ClassLoader that works
|
||||
++ // in both JDK 1.1 and Java 2. However, this should still
|
||||
++ // work b/c the following should be true:
|
||||
++ //
|
||||
++ // (cl == null) iff current ClassLoader == null
|
||||
++ //
|
||||
++ // Thus Class.forName(String) will use the current
|
||||
++ // ClassLoader which will be the bootstrap ClassLoader.
|
||||
++ providerClass = Class.forName(className);
|
||||
++ } else {
|
||||
++ try {
|
||||
++ providerClass = cl.loadClass(className);
|
||||
++ } catch (ClassNotFoundException x) {
|
||||
++ if (doFallback) {
|
||||
++ // Fall back to current classloader
|
||||
++ ClassLoader current = ObjectFactory.class.getClassLoader();
|
||||
++ if (current == null) {
|
||||
++ providerClass = Class.forName(className);
|
||||
++ } else if (cl != current) {
|
||||
++ cl = current;
|
||||
++ providerClass = cl.loadClass(className);
|
||||
++ } else {
|
||||
++ throw x;
|
||||
++ }
|
||||
++ } else {
|
||||
++ throw x;
|
||||
++ }
|
||||
++ }
|
||||
++ }
|
||||
++
|
||||
++ return providerClass;
|
||||
++ }
|
||||
++
|
||||
++ //
|
||||
++ // Classes
|
||||
++ //
|
||||
++
|
||||
++ /**
|
||||
++ * A configuration error.
|
||||
++ */
|
||||
++ static class ConfigurationError
|
||||
++ extends Error {
|
||||
++ static final long serialVersionUID = 8859254254255146542L;
|
||||
++ //
|
||||
++ // Data
|
||||
++ //
|
||||
++
|
||||
++ /** Exception. */
|
||||
++ private Exception exception;
|
||||
++
|
||||
++ //
|
||||
++ // Constructors
|
||||
++ //
|
||||
++
|
||||
++ /**
|
||||
++ * Construct a new instance with the specified detail string and
|
||||
++ * exception.
|
||||
++ */
|
||||
++ ConfigurationError(String msg, Exception x) {
|
||||
++ super(msg);
|
||||
++ this.exception = x;
|
||||
++ } // <init>(String,Exception)
|
||||
++
|
||||
++ //
|
||||
++ // Public methods
|
||||
++ //
|
||||
++
|
||||
++ /** Returns the exception associated to this error. */
|
||||
++ Exception getException() {
|
||||
++ return exception;
|
||||
++ } // getException():Exception
|
||||
++
|
||||
++ } // class ConfigurationError
|
||||
++
|
||||
++} // class ObjectFactory
|
||||
+--- src/com/sun/org/apache/xml/internal/serializer/SerializerFactory.java
|
||||
++++ src/com/sun/org/apache/xml/internal/serializer/SerializerFactory.java
|
||||
+@@ -126,7 +126,7 @@
|
||||
+
|
||||
+
|
||||
+
|
||||
+- ClassLoader loader = ObjectFactory.findClassLoader();
|
||||
++ ClassLoader loader = com.sun.org.apache.xalan.internal.utils.ObjectFactory.findClassLoader();
|
||||
+
|
||||
+ Class cls = ObjectFactory.findProviderClass(className, loader, true);
|
||||
+
|
File diff suppressed because it is too large
Load Diff
@ -1,230 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User malenkov
|
||||
# Date 1360332416 -14400
|
||||
# Node ID b2b6ab9d345561a349b840b4d0f18ef9bb9911e4
|
||||
# Parent 4d66f7ebcf99c1b322f47ff0aa6adadcd995f8f4
|
||||
7200507: Refactor Introspector internals
|
||||
Reviewed-by: ahgross, art
|
||||
|
||||
diff --git a/src/share/classes/java/beans/ThreadGroupContext.java b/src/share/classes/java/beans/ThreadGroupContext.java
|
||||
--- jdk/src/share/classes/java/beans/ThreadGroupContext.java
|
||||
+++ jdk/src/share/classes/java/beans/ThreadGroupContext.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 2011, 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
|
||||
@@ -29,7 +29,6 @@
|
||||
import com.sun.beans.finder.PropertyEditorFinder;
|
||||
|
||||
import java.awt.GraphicsEnvironment;
|
||||
-import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
@@ -42,7 +41,7 @@
|
||||
*/
|
||||
final class ThreadGroupContext {
|
||||
|
||||
- private static final Map<ThreadGroup, ThreadGroupContext> contexts = new WeakHashMap<ThreadGroup, ThreadGroupContext>();
|
||||
+ private static final WeakIdentityMap<ThreadGroupContext> contexts = new WeakIdentityMap<ThreadGroupContext>();
|
||||
|
||||
/**
|
||||
* Returns the appropriate {@code AppContext} for the caller,
|
||||
@@ -69,6 +68,8 @@
|
||||
private BeanInfoFinder beanInfoFinder;
|
||||
private PropertyEditorFinder propertyEditorFinder;
|
||||
|
||||
+ private ThreadGroupContext() {
|
||||
+ }
|
||||
|
||||
boolean isDesignTime() {
|
||||
return this.isDesignTime;
|
||||
diff --git a/src/share/classes/java/beans/WeakIdentityMap.java b/src/share/classes/java/beans/WeakIdentityMap.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ jdk/src/share/classes/java/beans/WeakIdentityMap.java
|
||||
@@ -0,0 +1,181 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ * This code is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation. Oracle designates this
|
||||
+ * particular file as subject to the "Classpath" exception as provided
|
||||
+ * by Oracle in the LICENSE file that accompanied this code.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
+ * or visit www.oracle.com if you need additional information or have any
|
||||
+ * questions.
|
||||
+ */
|
||||
+
|
||||
+package java.beans;
|
||||
+
|
||||
+import java.lang.ref.ReferenceQueue;
|
||||
+import java.lang.ref.WeakReference;
|
||||
+
|
||||
+/**
|
||||
+ * Hash table based mapping, which uses weak references to store keys
|
||||
+ * and reference-equality in place of object-equality to compare them.
|
||||
+ * An entry will automatically be removed when its key is no longer
|
||||
+ * in ordinary use. Both null values and the null key are supported.
|
||||
+ *
|
||||
+ * @see java.util.IdentityHashMap
|
||||
+ * @see java.util.WeakHashMap
|
||||
+ */
|
||||
+final class WeakIdentityMap<T> {
|
||||
+
|
||||
+ private static final int MAXIMUM_CAPACITY = 1 << 30; // it MUST be a power of two
|
||||
+ private static final Object NULL = new Object(); // special object for null key
|
||||
+
|
||||
+ private final ReferenceQueue<Object> queue = new ReferenceQueue<Object>();
|
||||
+
|
||||
+ private Entry<T>[] table = newTable(1<<3); // table's length MUST be a power of two
|
||||
+ private int threshold = 6; // the next size value at which to resize
|
||||
+ private int size = 0; // the number of key-value mappings
|
||||
+
|
||||
+ public T get(Object key) {
|
||||
+ removeStaleEntries();
|
||||
+ if (key == null) {
|
||||
+ key = NULL;
|
||||
+ }
|
||||
+ int hash = key.hashCode();
|
||||
+ int index = getIndex(this.table, hash);
|
||||
+ for (Entry<T> entry = this.table[index]; entry != null; entry = entry.next) {
|
||||
+ if (entry.isMatched(key, hash)) {
|
||||
+ return entry.value;
|
||||
+ }
|
||||
+ }
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ public T put(Object key, T value) {
|
||||
+ removeStaleEntries();
|
||||
+ if (key == null) {
|
||||
+ key = NULL;
|
||||
+ }
|
||||
+ int hash = key.hashCode();
|
||||
+ int index = getIndex(this.table, hash);
|
||||
+ for (Entry<T> entry = this.table[index]; entry != null; entry = entry.next) {
|
||||
+ if (entry.isMatched(key, hash)) {
|
||||
+ T oldValue = entry.value;
|
||||
+ entry.value = value;
|
||||
+ return oldValue;
|
||||
+ }
|
||||
+ }
|
||||
+ this.table[index] = new Entry<T>(key, hash, value, this.queue, this.table[index]);
|
||||
+ if (++this.size >= this.threshold) {
|
||||
+ if (this.table.length == MAXIMUM_CAPACITY) {
|
||||
+ this.threshold = Integer.MAX_VALUE;
|
||||
+ }
|
||||
+ else {
|
||||
+ removeStaleEntries();
|
||||
+ Entry<T>[] table = newTable(this.table.length * 2);
|
||||
+ transfer(this.table, table);
|
||||
+
|
||||
+ // If ignoring null elements and processing ref queue caused massive
|
||||
+ // shrinkage, then restore old table. This should be rare, but avoids
|
||||
+ // unbounded expansion of garbage-filled tables.
|
||||
+ if (this.size >= this.threshold / 2) {
|
||||
+ this.table = table;
|
||||
+ this.threshold *= 2;
|
||||
+ }
|
||||
+ else {
|
||||
+ transfer(table, this.table);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ private void removeStaleEntries() {
|
||||
+ for (Object ref = this.queue.poll(); ref != null; ref = this.queue.poll()) {
|
||||
+ @SuppressWarnings("unchecked")
|
||||
+ Entry<T> entry = (Entry<T>) ref;
|
||||
+ int index = getIndex(this.table, entry.hash);
|
||||
+
|
||||
+ Entry<T> prev = this.table[index];
|
||||
+ Entry<T> current = prev;
|
||||
+ while (current != null) {
|
||||
+ Entry<T> next = current.next;
|
||||
+ if (current == entry) {
|
||||
+ if (prev == entry) {
|
||||
+ this.table[index] = next;
|
||||
+ }
|
||||
+ else {
|
||||
+ prev.next = next;
|
||||
+ }
|
||||
+ entry.value = null; // Help GC
|
||||
+ entry.next = null; // Help GC
|
||||
+ this.size--;
|
||||
+ break;
|
||||
+ }
|
||||
+ prev = current;
|
||||
+ current = next;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private void transfer(Entry<T>[] oldTable, Entry<T>[] newTable) {
|
||||
+ for (int i = 0; i < oldTable.length; i++) {
|
||||
+ Entry<T> entry = oldTable[i];
|
||||
+ oldTable[i] = null;
|
||||
+ while (entry != null) {
|
||||
+ Entry<T> next = entry.next;
|
||||
+ Object key = entry.get();
|
||||
+ if (key == null) {
|
||||
+ entry.value = null; // Help GC
|
||||
+ entry.next = null; // Help GC
|
||||
+ this.size--;
|
||||
+ }
|
||||
+ else {
|
||||
+ int index = getIndex(newTable, entry.hash);
|
||||
+ entry.next = newTable[index];
|
||||
+ newTable[index] = entry;
|
||||
+ }
|
||||
+ entry = next;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ @SuppressWarnings("unchecked")
|
||||
+ private Entry<T>[] newTable(int length) {
|
||||
+ return (Entry<T>[]) new Entry<?>[length];
|
||||
+ }
|
||||
+
|
||||
+ private static int getIndex(Entry<?>[] table, int hash) {
|
||||
+ return hash & (table.length - 1);
|
||||
+ }
|
||||
+
|
||||
+ private static class Entry<T> extends WeakReference<Object> {
|
||||
+ private final int hash;
|
||||
+ private T value;
|
||||
+ private Entry<T> next;
|
||||
+
|
||||
+ Entry(Object key, int hash, T value, ReferenceQueue<Object> queue, Entry<T> next) {
|
||||
+ super(key, queue);
|
||||
+ this.hash = hash;
|
||||
+ this.value = value;
|
||||
+ this.next = next;
|
||||
+ }
|
||||
+
|
||||
+ boolean isMatched(Object key, int hash) {
|
||||
+ return (this.hash == hash) && (key == get());
|
||||
+ }
|
||||
+ }
|
||||
+}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,113 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User andrew
|
||||
# Date 1365766584 -3600
|
||||
# Node ID ac0858a12d62c384c53a048a634d25dc1f8f1b72
|
||||
# Parent 5ed9acc1f6be298713f10ad71c33564d48f46555
|
||||
8001040: Rework RMI model
|
||||
Reviewed-by: alanb, ahgross, coffeys, dmocek
|
||||
|
||||
diff --git a/src/share/classes/sun/rmi/server/MarshalInputStream.java b/src/share/classes/sun/rmi/server/MarshalInputStream.java
|
||||
--- jdk/src/share/classes/sun/rmi/server/MarshalInputStream.java
|
||||
+++ jdk/src/share/classes/sun/rmi/server/MarshalInputStream.java
|
||||
@@ -55,13 +55,19 @@
|
||||
public class MarshalInputStream extends ObjectInputStream {
|
||||
|
||||
/**
|
||||
- * value of "java.rmi.server.useCodebaseOnly" property,
|
||||
+ * Value of "java.rmi.server.useCodebaseOnly" property,
|
||||
* as cached at class initialization time.
|
||||
+ *
|
||||
+ * The default value is true. That is, the value is true
|
||||
+ * if the property is absent or is not equal to "false".
|
||||
+ * The value is only false when the property is present
|
||||
+ * and is equal to "false".
|
||||
*/
|
||||
private static final boolean useCodebaseOnlyProperty =
|
||||
- ((Boolean) java.security.AccessController.doPrivileged(
|
||||
- new sun.security.action.GetBooleanAction(
|
||||
- "java.rmi.server.useCodebaseOnly"))).booleanValue();
|
||||
+ ! java.security.AccessController.doPrivileged(
|
||||
+ new sun.security.action.GetPropertyAction(
|
||||
+ "java.rmi.server.useCodebaseOnly", "true"))
|
||||
+ .equalsIgnoreCase("false");
|
||||
|
||||
/** table to hold sun classes to which access is explicitly permitted */
|
||||
protected static Map permittedSunClasses = new HashMap(3);
|
||||
diff --git a/test/java/rmi/registry/classPathCodebase/ClassPathCodebase.java b/test/java/rmi/registry/classPathCodebase/ClassPathCodebase.java
|
||||
--- jdk/test/java/rmi/registry/classPathCodebase/ClassPathCodebase.java
|
||||
+++ jdk/test/java/rmi/registry/classPathCodebase/ClassPathCodebase.java
|
||||
@@ -31,7 +31,8 @@
|
||||
*
|
||||
* @library ../../testlibrary
|
||||
* @build ClassPathCodebase Dummy
|
||||
- * @run main/othervm/policy=security.policy ClassPathCodebase
|
||||
+ * @run main/othervm/policy=security.policy
|
||||
+ * -Djava.rmi.server.useCodebaseOnly=false ClassPathCodebase
|
||||
*/
|
||||
|
||||
import java.io.*;
|
||||
diff --git a/test/java/rmi/registry/readTest/readTest.sh b/test/java/rmi/registry/readTest/readTest.sh
|
||||
--- jdk/test/java/rmi/registry/readTest/readTest.sh
|
||||
+++ jdk/test/java/rmi/registry/readTest/readTest.sh
|
||||
@@ -52,7 +52,8 @@
|
||||
RMIREG_OUT=rmi.out
|
||||
#start rmiregistry without any local classes on classpath
|
||||
cd rmi_tmp
|
||||
-${TESTJAVA}${FS}bin${FS}rmiregistry 7491 > ..${FS}${RMIREG_OUT} 2>&1 &
|
||||
+${TESTJAVA}${FS}bin${FS}rmiregistry -J-Djava.rmi.server.useCodebaseOnly=false \
|
||||
+ ${TESTTOOLVMOPTS} 64005 > ..${FS}${RMIREG_OUT} 2>&1 &
|
||||
RMIREG_PID=$!
|
||||
# allow some time to start
|
||||
sleep 3
|
||||
diff --git a/test/java/rmi/server/RMIClassLoader/downloadArrayClass/DownloadArrayClass.java b/test/java/rmi/server/RMIClassLoader/downloadArrayClass/DownloadArrayClass.java
|
||||
--- jdk/test/java/rmi/server/RMIClassLoader/downloadArrayClass/DownloadArrayClass.java
|
||||
+++ jdk/test/java/rmi/server/RMIClassLoader/downloadArrayClass/DownloadArrayClass.java
|
||||
@@ -68,6 +68,10 @@
|
||||
TestLibrary.bomb(e);
|
||||
}
|
||||
|
||||
+ System.err.println("Setting codebase property to: " + remoteCodebase);
|
||||
+ System.setProperty("java.rmi.server.codebase",
|
||||
+ remoteCodebase.toString());
|
||||
+
|
||||
/*
|
||||
* Load Foo from a non-RMI class loader so that it won't be already
|
||||
* loaded by an RMI class loader in this VM (for whatever that's
|
||||
diff --git a/test/java/rmi/server/RMIClassLoader/downloadArrayClass/security.policy b/test/java/rmi/server/RMIClassLoader/downloadArrayClass/security.policy
|
||||
--- jdk/test/java/rmi/server/RMIClassLoader/downloadArrayClass/security.policy
|
||||
+++ jdk/test/java/rmi/server/RMIClassLoader/downloadArrayClass/security.policy
|
||||
@@ -7,6 +7,8 @@
|
||||
};
|
||||
|
||||
grant {
|
||||
+ permission java.util.PropertyPermission
|
||||
+ "java.rmi.server.codebase", "read,write";
|
||||
|
||||
// permissions needed to move classes into separate codebase directories
|
||||
permission java.io.FilePermission
|
||||
diff --git a/test/java/rmi/server/RMIClassLoader/loadProxyClasses/LoadProxyClasses.java b/test/java/rmi/server/RMIClassLoader/loadProxyClasses/LoadProxyClasses.java
|
||||
--- jdk/test/java/rmi/server/RMIClassLoader/loadProxyClasses/LoadProxyClasses.java
|
||||
+++ jdk/test/java/rmi/server/RMIClassLoader/loadProxyClasses/LoadProxyClasses.java
|
||||
@@ -32,7 +32,8 @@
|
||||
* @library ../../../testlibrary
|
||||
* @build TestLibrary FnnClass FnnUnmarshal LoadProxyClasses NonpublicInterface
|
||||
* @build NonpublicInterface1 PublicInterface PublicInterface1
|
||||
- * @run main/othervm/policy=security.policy LoadProxyClasses
|
||||
+ * @run main/othervm/policy=security.policy
|
||||
+ * -Djava.rmi.server.useCodebaseOnly=false LoadProxyClasses
|
||||
*/
|
||||
|
||||
import java.rmi.server.RMIClassLoader;
|
||||
diff --git a/test/java/rmi/testlibrary/RMID.java b/test/java/rmi/testlibrary/RMID.java
|
||||
--- jdk/test/java/rmi/testlibrary/RMID.java
|
||||
+++ jdk/test/java/rmi/testlibrary/RMID.java
|
||||
@@ -109,6 +109,9 @@
|
||||
if (!TestParams.testClasses.equals("")) {
|
||||
args += " -C-Dtest.classes=" + TestParams.testClasses;
|
||||
}
|
||||
+
|
||||
+ args += " -C-Djava.rmi.server.useCodebaseOnly=false ";
|
||||
+
|
||||
args += " " + getCodeCoverageArgs();
|
||||
return args;
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User dfuchs
|
||||
# Date 1363010839 -3600
|
||||
# Node ID 4a3260353853c3590ceb915337e21fe17aa07dbd
|
||||
# Parent ac0858a12d62c384c53a048a634d25dc1f8f1b72
|
||||
8001322: Refactor deserialization
|
||||
Reviewed-by: mchung, skoivu, smarks
|
||||
|
||||
diff --git a/src/share/classes/java/io/ObjectInputStream.java b/src/share/classes/java/io/ObjectInputStream.java
|
||||
--- jdk/src/share/classes/java/io/ObjectInputStream.java
|
||||
+++ jdk/src/share/classes/java/io/ObjectInputStream.java
|
||||
@@ -41,6 +41,7 @@
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import static java.io.ObjectStreamClass.processQueue;
|
||||
+import sun.reflect.misc.ReflectUtil;
|
||||
|
||||
/**
|
||||
* An ObjectInputStream deserializes primitive data and objects previously
|
||||
@@ -1518,6 +1519,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ private boolean isCustomSubclass() {
|
||||
+ // Return true if this class is a custom subclass of ObjectInputStream
|
||||
+ return getClass().getClassLoader()
|
||||
+ != ObjectInputStream.class.getClassLoader();
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Reads in and returns class descriptor for a dynamic proxy class. Sets
|
||||
* passHandle to proxy class descriptor's assigned handle. If proxy class
|
||||
@@ -1547,6 +1554,15 @@
|
||||
try {
|
||||
if ((cl = resolveProxyClass(ifaces)) == null) {
|
||||
resolveEx = new ClassNotFoundException("null class");
|
||||
+ } else if (!Proxy.isProxyClass(cl)) {
|
||||
+ throw new InvalidClassException("Not a proxy");
|
||||
+ } else {
|
||||
+ // ReflectUtil.checkProxyPackageAccess makes a test
|
||||
+ // equivalent to isCustomSubclass so there's no need
|
||||
+ // to condition this call to isCustomSubclass == true here.
|
||||
+ ReflectUtil.checkProxyPackageAccess(
|
||||
+ getClass().getClassLoader(),
|
||||
+ cl.getInterfaces());
|
||||
}
|
||||
} catch (ClassNotFoundException ex) {
|
||||
resolveEx = ex;
|
||||
@@ -1588,9 +1604,12 @@
|
||||
Class cl = null;
|
||||
ClassNotFoundException resolveEx = null;
|
||||
bin.setBlockDataMode(true);
|
||||
+ final boolean checksRequired = isCustomSubclass();
|
||||
try {
|
||||
if ((cl = resolveClass(readDesc)) == null) {
|
||||
resolveEx = new ClassNotFoundException("null class");
|
||||
+ } else if (checksRequired) {
|
||||
+ ReflectUtil.checkPackageAccess(cl);
|
||||
}
|
||||
} catch (ClassNotFoundException ex) {
|
||||
resolveEx = ex;
|
@ -1,32 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User dmocek
|
||||
# Date 1360111105 28800
|
||||
# Node ID a0e51ed355c9ae1256f8d344df34babb87a1edce
|
||||
# Parent 4a3260353853c3590ceb915337e21fe17aa07dbd
|
||||
8001329: Augment RMI logging
|
||||
Reviewed-by: smarks, hawtin, alanb
|
||||
|
||||
diff --git a/src/share/classes/java/rmi/server/LogStream.java b/src/share/classes/java/rmi/server/LogStream.java
|
||||
--- jdk/src/share/classes/java/rmi/server/LogStream.java
|
||||
+++ jdk/src/share/classes/java/rmi/server/LogStream.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 1996, 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
|
||||
@@ -120,6 +120,13 @@
|
||||
*/
|
||||
@Deprecated
|
||||
public static synchronized void setDefaultStream(PrintStream newDefault) {
|
||||
+ SecurityManager sm = System.getSecurityManager();
|
||||
+
|
||||
+ if (sm != null) {
|
||||
+ sm.checkPermission(
|
||||
+ new java.util.logging.LoggingPermission("control", null));
|
||||
+ }
|
||||
+
|
||||
defaultStream = newDefault;
|
||||
}
|
||||
|
@ -1,63 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User chegar
|
||||
# Date 1356010827 0
|
||||
# Node ID 3c7eb39c811464c98847a4f1a167636c1db80f17
|
||||
# Parent a0e51ed355c9ae1256f8d344df34babb87a1edce
|
||||
8003335: Better handling of Finalizer thread
|
||||
Reviewed-by: alanb, ahgross
|
||||
|
||||
diff --git a/src/share/classes/java/lang/ref/Finalizer.java b/src/share/classes/java/lang/ref/Finalizer.java
|
||||
--- jdk/src/share/classes/java/lang/ref/Finalizer.java
|
||||
+++ jdk/src/share/classes/java/lang/ref/Finalizer.java
|
||||
@@ -38,9 +38,9 @@
|
||||
*/
|
||||
static native void invokeFinalizeMethod(Object o) throws Throwable;
|
||||
|
||||
- static private ReferenceQueue queue = new ReferenceQueue();
|
||||
- static private Finalizer unfinalized = null;
|
||||
- static private Object lock = new Object();
|
||||
+ private static ReferenceQueue queue = new ReferenceQueue();
|
||||
+ private static Finalizer unfinalized = null;
|
||||
+ private static final Object lock = new Object();
|
||||
|
||||
private Finalizer
|
||||
next = null,
|
||||
@@ -142,7 +142,11 @@
|
||||
/* Called by Runtime.runFinalization() */
|
||||
static void runFinalization() {
|
||||
forkSecondaryFinalizer(new Runnable() {
|
||||
+ private volatile boolean running;
|
||||
public void run() {
|
||||
+ if (running)
|
||||
+ return;
|
||||
+ running = true;
|
||||
for (;;) {
|
||||
Finalizer f = (Finalizer)queue.poll();
|
||||
if (f == null) break;
|
||||
@@ -155,7 +159,11 @@
|
||||
/* Invoked by java.lang.Shutdown */
|
||||
static void runAllFinalizers() {
|
||||
forkSecondaryFinalizer(new Runnable() {
|
||||
+ private volatile boolean running;
|
||||
public void run() {
|
||||
+ if (running)
|
||||
+ return;
|
||||
+ running = true;
|
||||
for (;;) {
|
||||
Finalizer f;
|
||||
synchronized (lock) {
|
||||
@@ -168,10 +176,14 @@
|
||||
}
|
||||
|
||||
private static class FinalizerThread extends Thread {
|
||||
+ private volatile boolean running;
|
||||
FinalizerThread(ThreadGroup g) {
|
||||
super(g, "Finalizer");
|
||||
}
|
||||
public void run() {
|
||||
+ if (running)
|
||||
+ return;
|
||||
+ running = true;
|
||||
for (;;) {
|
||||
try {
|
||||
Finalizer f = (Finalizer)queue.remove();
|
@ -1,77 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User andrew
|
||||
# Date 1365768981 -3600
|
||||
# Node ID 8f5ad2cacf6fff8efd817c5373469037d945f3dc
|
||||
# Parent 3c7eb39c811464c98847a4f1a167636c1db80f17
|
||||
8003445: Adjust JAX-WS to focus on API
|
||||
Reviewed-by: vinnie, ahgross, mgrebac
|
||||
|
||||
diff --git a/src/share/lib/security/java.security b/src/share/lib/security/java.security
|
||||
--- jdk/src/share/lib/security/java.security
|
||||
+++ jdk/src/share/lib/security/java.security
|
||||
@@ -150,7 +150,8 @@
|
||||
com.sun.org.apache.xalan.internal.xsltc.util.,\
|
||||
com.sun.org.apache.xml.internal.res.,\
|
||||
com.sun.org.apache.xml.internal.serializer.utils.,\
|
||||
- com.sun.org.apache.xml.internal.utils.
|
||||
+ com.sun.org.apache.xml.internal.utils.,\
|
||||
+ com.sun.org.glassfish.
|
||||
|
||||
#
|
||||
# List of comma-separated packages that start with or equal this string
|
||||
@@ -185,7 +186,8 @@
|
||||
com.sun.org.apache.xalan.internal.xsltc.util.,\
|
||||
com.sun.org.apache.xml.internal.res.,\
|
||||
com.sun.org.apache.xml.internal.serializer.utils.,\
|
||||
- com.sun.org.apache.xml.internal.utils.
|
||||
+ com.sun.org.apache.xml.internal.utils.,\
|
||||
+ com.sun.org.glassfish.
|
||||
|
||||
#
|
||||
# Determines whether this properties file can be appended to
|
||||
diff --git a/src/share/lib/security/java.security-solaris b/src/share/lib/security/java.security-solaris
|
||||
--- jdk/src/share/lib/security/java.security-solaris
|
||||
+++ jdk/src/share/lib/security/java.security-solaris
|
||||
@@ -151,7 +151,8 @@
|
||||
com.sun.org.apache.xalan.internal.xsltc.util.,\
|
||||
com.sun.org.apache.xml.internal.res.,\
|
||||
com.sun.org.apache.xml.internal.serializer.utils.,\
|
||||
- com.sun.org.apache.xml.internal.utils.
|
||||
+ com.sun.org.apache.xml.internal.utils.,\
|
||||
+ com.sun.org.glassfish.
|
||||
|
||||
#
|
||||
# List of comma-separated packages that start with or equal this string
|
||||
@@ -186,7 +187,8 @@
|
||||
com.sun.org.apache.xalan.internal.xsltc.util.,\
|
||||
com.sun.org.apache.xml.internal.res.,\
|
||||
com.sun.org.apache.xml.internal.serializer.utils.,\
|
||||
- com.sun.org.apache.xml.internal.utils.
|
||||
+ com.sun.org.apache.xml.internal.utils.,\
|
||||
+ com.sun.org.glassfish.
|
||||
|
||||
#
|
||||
# Determines whether this properties file can be appended to
|
||||
diff --git a/src/share/lib/security/java.security-windows b/src/share/lib/security/java.security-windows
|
||||
--- jdk/src/share/lib/security/java.security-windows
|
||||
+++ jdk/src/share/lib/security/java.security-windows
|
||||
@@ -151,7 +151,8 @@
|
||||
com.sun.org.apache.xalan.internal.xsltc.util.,\
|
||||
com.sun.org.apache.xml.internal.res.,\
|
||||
com.sun.org.apache.xml.internal.serializer.utils.,\
|
||||
- com.sun.org.apache.xml.internal.utils.
|
||||
+ com.sun.org.apache.xml.internal.utils.,\
|
||||
+ com.sun.org.glassfish.
|
||||
|
||||
#
|
||||
# List of comma-separated packages that start with or equal this string
|
||||
@@ -186,7 +187,8 @@
|
||||
com.sun.org.apache.xalan.internal.xsltc.util.,\
|
||||
com.sun.org.apache.xml.internal.res.,\
|
||||
com.sun.org.apache.xml.internal.serializer.utils.,\
|
||||
- com.sun.org.apache.xml.internal.utils.
|
||||
+ com.sun.org.apache.xml.internal.utils.,\
|
||||
+ com.sun.org.glassfish.
|
||||
|
||||
#
|
||||
# Determines whether this properties file can be appended to
|
@ -1,227 +0,0 @@
|
||||
--- /dev/null 2013-04-25 15:02:13.000000000 -0400
|
||||
+++ jaxws/patches/jaxws_src/8003543.patch 2013-04-25 15:03:47.000000000 -0400
|
||||
@@ -0,0 +1,224 @@
|
||||
+--- src/com/sun/xml/internal/org/jvnet/mimepull/MemoryData.java
|
||||
++++ src/com/sun/xml/internal/org/jvnet/mimepull/MemoryData.java
|
||||
+@@ -1,5 +1,5 @@
|
||||
+ /*
|
||||
+- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
++ * Copyright (c) 1997, 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,6 +27,7 @@
|
||||
+ import java.nio.ByteBuffer;
|
||||
+ import java.io.File;
|
||||
+ import java.io.IOException;
|
||||
++import java.util.logging.Level;
|
||||
+ import java.util.logging.Logger;
|
||||
+
|
||||
+ /**
|
||||
+@@ -49,41 +50,45 @@
|
||||
+ }
|
||||
+
|
||||
+ // size of the chunk given by the parser
|
||||
++ @Override
|
||||
+ public int size() {
|
||||
+ return len;
|
||||
+ }
|
||||
+
|
||||
++ @Override
|
||||
+ public byte[] read() {
|
||||
+ return data;
|
||||
+ }
|
||||
+
|
||||
++ @Override
|
||||
+ public long writeTo(DataFile file) {
|
||||
+ return file.writeTo(data, 0, len);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+- *
|
||||
+ * @param dataHead
|
||||
+ * @param buf
|
||||
+ * @return
|
||||
+ */
|
||||
++ @Override
|
||||
+ public Data createNext(DataHead dataHead, ByteBuffer buf) {
|
||||
+ if (!config.isOnlyMemory() && dataHead.inMemory >= config.memoryThreshold) {
|
||||
+ try {
|
||||
+ String prefix = config.getTempFilePrefix();
|
||||
+ String suffix = config.getTempFileSuffix();
|
||||
+- File dir = config.getTempDir();
|
||||
+- File tempFile = (dir == null)
|
||||
+- ? File.createTempFile(prefix, suffix)
|
||||
+- : File.createTempFile(prefix, suffix, dir);
|
||||
+- LOGGER.fine("Created temp file = "+tempFile);
|
||||
++ File tempFile = TempFiles.createTempFile(prefix, suffix, config.getTempDir());
|
||||
++ // delete the temp file when VM exits as a last resort for file clean up
|
||||
++ tempFile.deleteOnExit();
|
||||
++ if (LOGGER.isLoggable(Level.FINE)) {
|
||||
++ LOGGER.log(Level.FINE, "Created temp file = {0}", tempFile);
|
||||
++ }
|
||||
+ dataHead.dataFile = new DataFile(tempFile);
|
||||
+- } catch(IOException ioe) {
|
||||
++ } catch (IOException ioe) {
|
||||
+ throw new MIMEParsingException(ioe);
|
||||
+ }
|
||||
+
|
||||
+ if (dataHead.head != null) {
|
||||
+- for(Chunk c=dataHead.head; c != null; c=c.next) {
|
||||
++ for (Chunk c = dataHead.head; c != null; c = c.next) {
|
||||
+ long pointer = c.data.writeTo(dataHead.dataFile);
|
||||
+ c.data = new FileData(dataHead.dataFile, pointer, len);
|
||||
+ }
|
||||
+@@ -93,4 +98,5 @@
|
||||
+ return new MemoryData(buf, config);
|
||||
+ }
|
||||
+ }
|
||||
++
|
||||
+ }
|
||||
+--- /dev/null
|
||||
++++ src/com/sun/xml/internal/org/jvnet/mimepull/TempFiles.java
|
||||
+@@ -0,0 +1,144 @@
|
||||
++/*
|
||||
++ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
++ *
|
||||
++ * This code is free software; you can redistribute it and/or modify it
|
||||
++ * under the terms of the GNU General Public License version 2 only, as
|
||||
++ * published by the Free Software Foundation. Oracle designates this
|
||||
++ * particular file as subject to the "Classpath" exception as provided
|
||||
++ * by Oracle in the LICENSE file that accompanied this code.
|
||||
++ *
|
||||
++ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
++ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
++ * accompanied this code).
|
||||
++ *
|
||||
++ * You should have received a copy of the GNU General Public License version
|
||||
++ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
++ *
|
||||
++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
++ * or visit www.oracle.com if you need additional information or have any
|
||||
++ * questions.
|
||||
++ */
|
||||
++
|
||||
++package com.sun.xml.internal.org.jvnet.mimepull;
|
||||
++
|
||||
++import java.io.File;
|
||||
++import java.io.IOException;
|
||||
++import java.lang.reflect.Array;
|
||||
++import java.lang.reflect.InvocationTargetException;
|
||||
++import java.lang.reflect.Method;
|
||||
++import java.util.logging.Level;
|
||||
++import java.util.logging.Logger;
|
||||
++
|
||||
++/**
|
||||
++ * Helper utility to support jdk <= jdk1.6. After jdk1.6 EOL reflection can be removed and API can be used directly.
|
||||
++ */
|
||||
++class TempFiles {
|
||||
++
|
||||
++ private static final Logger LOGGER = Logger.getLogger(TempFiles.class.getName());
|
||||
++
|
||||
++ private static final Class<?> CLASS_FILES;
|
||||
++ private static final Class<?> CLASS_PATH;
|
||||
++ private static final Class<?> CLASS_FILE_ATTRIBUTE;
|
||||
++ private static final Class<?> CLASS_FILE_ATTRIBUTES;
|
||||
++ private static final Method METHOD_FILE_TO_PATH;
|
||||
++ private static final Method METHOD_FILES_CREATE_TEMP_FILE;
|
||||
++ private static final Method METHOD_FILES_CREATE_TEMP_FILE_WITHPATH;
|
||||
++
|
||||
++ private static final Method METHOD_PATH_TO_FILE;
|
||||
++
|
||||
++ private static boolean useJdk6API;
|
||||
++
|
||||
++ static {
|
||||
++ useJdk6API = isJdk6();
|
||||
++
|
||||
++ CLASS_FILES = safeGetClass("java.nio.file.Files");
|
||||
++ CLASS_PATH = safeGetClass("java.nio.file.Path");
|
||||
++ CLASS_FILE_ATTRIBUTE = safeGetClass("java.nio.file.attribute.FileAttribute");
|
||||
++ CLASS_FILE_ATTRIBUTES = safeGetClass("[Ljava.nio.file.attribute.FileAttribute;");
|
||||
++ METHOD_FILE_TO_PATH = safeGetMethod(File.class, "toPath");
|
||||
++ METHOD_FILES_CREATE_TEMP_FILE = safeGetMethod(CLASS_FILES, "createTempFile", String.class, String.class, CLASS_FILE_ATTRIBUTES);
|
||||
++ METHOD_FILES_CREATE_TEMP_FILE_WITHPATH = safeGetMethod(CLASS_FILES, "createTempFile", CLASS_PATH, String.class, String.class, CLASS_FILE_ATTRIBUTES);
|
||||
++ METHOD_PATH_TO_FILE = safeGetMethod(CLASS_PATH, "toFile");
|
||||
++ }
|
||||
++
|
||||
++ private static boolean isJdk6() {
|
||||
++ String javaVersion = System.getProperty("java.version");
|
||||
++ LOGGER.log(Level.FINEST, "Detected java version = {0}", javaVersion);
|
||||
++ return javaVersion.startsWith("1.6.");
|
||||
++ }
|
||||
++
|
||||
++ private static Class<?> safeGetClass(String className) {
|
||||
++ // it is jdk 6 or something failed already before
|
||||
++ if (useJdk6API) return null;
|
||||
++ try {
|
||||
++ return Class.forName(className);
|
||||
++ } catch (ClassNotFoundException e) {
|
||||
++ LOGGER.log(Level.SEVERE, "Exception cought", e);
|
||||
++ LOGGER.log(Level.WARNING, "Class {0} not found. Temp files will be created using old java.io API.", className);
|
||||
++ useJdk6API = true;
|
||||
++ return null;
|
||||
++ }
|
||||
++ }
|
||||
++
|
||||
++ private static Method safeGetMethod(Class<?> clazz, String methodName, Class<?>... parameterTypes) {
|
||||
++ // it is jdk 6 or something failed already before
|
||||
++ if (useJdk6API) return null;
|
||||
++ try {
|
||||
++ return clazz.getMethod(methodName, parameterTypes);
|
||||
++ } catch (NoSuchMethodException e) {
|
||||
++ LOGGER.log(Level.SEVERE, "Exception cought", e);
|
||||
++ LOGGER.log(Level.WARNING, "Method {0} not found. Temp files will be created using old java.io API.", methodName);
|
||||
++ useJdk6API = true;
|
||||
++ return null;
|
||||
++ }
|
||||
++ }
|
||||
++
|
||||
++
|
||||
++ static Object toPath(File f) throws InvocationTargetException, IllegalAccessException {
|
||||
++ return METHOD_FILE_TO_PATH.invoke(f);
|
||||
++ }
|
||||
++
|
||||
++ static File toFile(Object path) throws InvocationTargetException, IllegalAccessException {
|
||||
++ return (File) METHOD_PATH_TO_FILE.invoke(path);
|
||||
++ }
|
||||
++
|
||||
++ static File createTempFile(String prefix, String suffix, File dir) throws IOException {
|
||||
++
|
||||
++ if (useJdk6API) {
|
||||
++ LOGGER.log(Level.FINEST, "Jdk6 detected, temp file (prefix:{0}, suffix:{1}) being created using old java.io API.", new Object[]{prefix, suffix});
|
||||
++ return File.createTempFile(prefix, suffix, dir);
|
||||
++
|
||||
++ } else {
|
||||
++
|
||||
++ try {
|
||||
++ if (dir != null) {
|
||||
++ Object path = toPath(dir);
|
||||
++ LOGGER.log(Level.FINEST, "Temp file (path: {0}, prefix:{1}, suffix:{2}) being created using NIO API.", new Object[]{dir.getAbsolutePath(), prefix, suffix});
|
||||
++ return toFile(METHOD_FILES_CREATE_TEMP_FILE_WITHPATH.invoke(null, path, prefix, suffix, Array.newInstance(CLASS_FILE_ATTRIBUTE, 0)));
|
||||
++ } else {
|
||||
++ LOGGER.log(Level.FINEST, "Temp file (prefix:{0}, suffix:{1}) being created using NIO API.", new Object[]{prefix, suffix});
|
||||
++ return toFile(METHOD_FILES_CREATE_TEMP_FILE.invoke(null, prefix, suffix, Array.newInstance(CLASS_FILE_ATTRIBUTE, 0)));
|
||||
++ }
|
||||
++
|
||||
++ } catch (IllegalAccessException e) {
|
||||
++ LOGGER.log(Level.SEVERE, "Exception caught", e);
|
||||
++ LOGGER.log(Level.WARNING, "Error invoking java.nio API, temp file (path: {0}, prefix:{1}, suffix:{2}) being created using old java.io API.",
|
||||
++ new Object[]{dir != null ? dir.getAbsolutePath() : null, prefix, suffix});
|
||||
++ return File.createTempFile(prefix, suffix, dir);
|
||||
++
|
||||
++ } catch (InvocationTargetException e) {
|
||||
++ LOGGER.log(Level.SEVERE, "Exception caught", e);
|
||||
++ LOGGER.log(Level.WARNING, "Error invoking java.nio API, temp file (path: {0}, prefix:{1}, suffix:{2}) being created using old java.io API.",
|
||||
++ new Object[]{dir != null ? dir.getAbsolutePath() : null, prefix, suffix});
|
||||
++ return File.createTempFile(prefix, suffix, dir);
|
||||
++ }
|
||||
++ }
|
||||
++
|
||||
++ }
|
||||
++
|
||||
++
|
||||
++}
|
@ -1,142 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User andrew
|
||||
# Date 1365774039 -3600
|
||||
# Node ID 0236ab95a0f15e35aef6edd91f58a5072784dccd
|
||||
# Parent 8f5ad2cacf6fff8efd817c5373469037d945f3dc
|
||||
8004261: Improve input validation
|
||||
Reviewed-by: art, mschoene, amenkov
|
||||
|
||||
diff --git a/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java b/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java
|
||||
--- jdk/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java
|
||||
+++ jdk/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java
|
||||
@@ -56,7 +56,7 @@
|
||||
// from simultaneous creation and destruction
|
||||
// reduces possibility of deadlock, compared to
|
||||
// synchronizing to the class instance
|
||||
- private Object traRecLock = new Object();
|
||||
+ private final Object traRecLock = new Object();
|
||||
|
||||
// DEVICE ATTRIBUTES
|
||||
|
||||
@@ -474,7 +474,7 @@
|
||||
This is necessary for Receivers retrieved via MidiSystem.getReceiver()
|
||||
(which opens the device implicitely).
|
||||
*/
|
||||
- protected abstract class AbstractReceiver implements Receiver {
|
||||
+ abstract class AbstractReceiver implements Receiver {
|
||||
private boolean open = true;
|
||||
|
||||
|
||||
@@ -483,24 +483,24 @@
|
||||
Receiver. Therefore, subclasses should not override this method.
|
||||
Instead, they should implement implSend().
|
||||
*/
|
||||
- public synchronized void send(MidiMessage message, long timeStamp) {
|
||||
- if (open) {
|
||||
- implSend(message, timeStamp);
|
||||
- } else {
|
||||
+ @Override
|
||||
+ public final synchronized void send(final MidiMessage message,
|
||||
+ final long timeStamp) {
|
||||
+ if (!open) {
|
||||
throw new IllegalStateException("Receiver is not open");
|
||||
}
|
||||
+ implSend(message, timeStamp);
|
||||
}
|
||||
|
||||
-
|
||||
- protected abstract void implSend(MidiMessage message, long timeStamp);
|
||||
-
|
||||
+ abstract void implSend(MidiMessage message, long timeStamp);
|
||||
|
||||
/** Close the Receiver.
|
||||
* Here, the call to the magic method closeInternal() takes place.
|
||||
* Therefore, subclasses that override this method must call
|
||||
* 'super.close()'.
|
||||
*/
|
||||
- public void close() {
|
||||
+ @Override
|
||||
+ public final void close() {
|
||||
open = false;
|
||||
synchronized (AbstractMidiDevice.this.traRecLock) {
|
||||
AbstractMidiDevice.this.getReceiverList().remove(this);
|
||||
@@ -508,7 +508,7 @@
|
||||
AbstractMidiDevice.this.closeInternal(this);
|
||||
}
|
||||
|
||||
- protected boolean isOpen() {
|
||||
+ final boolean isOpen() {
|
||||
return open;
|
||||
}
|
||||
|
||||
diff --git a/src/share/classes/com/sun/media/sound/FastShortMessage.java b/src/share/classes/com/sun/media/sound/FastShortMessage.java
|
||||
--- jdk/src/share/classes/com/sun/media/sound/FastShortMessage.java
|
||||
+++ jdk/src/share/classes/com/sun/media/sound/FastShortMessage.java
|
||||
@@ -32,7 +32,7 @@
|
||||
*
|
||||
* @author Florian Bomers
|
||||
*/
|
||||
-class FastShortMessage extends ShortMessage {
|
||||
+final class FastShortMessage extends ShortMessage {
|
||||
private int packedMsg;
|
||||
|
||||
public FastShortMessage(int packedMsg) throws InvalidMidiDataException {
|
||||
diff --git a/src/share/classes/com/sun/media/sound/FastSysexMessage.java b/src/share/classes/com/sun/media/sound/FastSysexMessage.java
|
||||
--- jdk/src/share/classes/com/sun/media/sound/FastSysexMessage.java
|
||||
+++ jdk/src/share/classes/com/sun/media/sound/FastSysexMessage.java
|
||||
@@ -32,7 +32,7 @@
|
||||
*
|
||||
* @author Florian Bomers
|
||||
*/
|
||||
-class FastSysexMessage extends SysexMessage {
|
||||
+final class FastSysexMessage extends SysexMessage {
|
||||
|
||||
FastSysexMessage(byte[] data) throws InvalidMidiDataException {
|
||||
super(data);
|
||||
diff --git a/src/share/classes/com/sun/media/sound/MidiOutDevice.java b/src/share/classes/com/sun/media/sound/MidiOutDevice.java
|
||||
--- jdk/src/share/classes/com/sun/media/sound/MidiOutDevice.java
|
||||
+++ jdk/src/share/classes/com/sun/media/sound/MidiOutDevice.java
|
||||
@@ -103,9 +103,9 @@
|
||||
|
||||
class MidiOutReceiver extends AbstractReceiver {
|
||||
|
||||
- protected void implSend(MidiMessage message, long timeStamp) {
|
||||
- int length = message.getLength();
|
||||
- int status = message.getStatus();
|
||||
+ void implSend(final MidiMessage message, final long timeStamp) {
|
||||
+ final int length = message.getLength();
|
||||
+ final int status = message.getStatus();
|
||||
if (length <= 3 && status != 0xF0 && status != 0xF7) {
|
||||
int packedMsg;
|
||||
if (message instanceof ShortMessage) {
|
||||
@@ -140,11 +140,15 @@
|
||||
}
|
||||
nSendShortMessage(id, packedMsg, timeStamp);
|
||||
} else {
|
||||
+ final byte[] data;
|
||||
if (message instanceof FastSysexMessage) {
|
||||
- nSendLongMessage(id, ((FastSysexMessage) message).getReadOnlyMessage(),
|
||||
- length, timeStamp);
|
||||
+ data = ((FastSysexMessage) message).getReadOnlyMessage();
|
||||
} else {
|
||||
- nSendLongMessage(id, message.getMessage(), length, timeStamp);
|
||||
+ data = message.getMessage();
|
||||
+ }
|
||||
+ final int dataLength = Math.min(length, data.length);
|
||||
+ if (dataLength > 0) {
|
||||
+ nSendLongMessage(id, data, dataLength, timeStamp);
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/src/share/classes/com/sun/media/sound/RealTimeSequencer.java b/src/share/classes/com/sun/media/sound/RealTimeSequencer.java
|
||||
--- jdk/src/share/classes/com/sun/media/sound/RealTimeSequencer.java
|
||||
+++ jdk/src/share/classes/com/sun/media/sound/RealTimeSequencer.java
|
||||
@@ -1019,7 +1019,7 @@
|
||||
|
||||
class SequencerReceiver extends AbstractReceiver {
|
||||
|
||||
- protected void implSend(MidiMessage message, long timeStamp) {
|
||||
+ void implSend(MidiMessage message, long timeStamp) {
|
||||
if (recording) {
|
||||
long tickPos = 0;
|
||||
|
@ -1,29 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User twisti
|
||||
# Date 1361822075 28800
|
||||
# Node ID cf2b7f0f7a2188a1421bdd033e88bf4b0aa6870c
|
||||
# Parent f9d5be4340c0ab09bebfcd2dce5563a2042ccc95
|
||||
8004336: Better handling of method handle intrinsic frames
|
||||
Reviewed-by: kvn, jrose, ahgross
|
||||
|
||||
diff --git a/src/share/vm/opto/library_call.cpp b/src/share/vm/opto/library_call.cpp
|
||||
--- hotspot/src/share/vm/opto/library_call.cpp
|
||||
+++ hotspot/src/share/vm/opto/library_call.cpp
|
||||
@@ -1313,7 +1313,6 @@
|
||||
push(result);
|
||||
return true;
|
||||
}
|
||||
-
|
||||
//--------------------------pop_math_arg--------------------------------
|
||||
// Pop a double argument to a math function from the stack
|
||||
// rounding it if necessary.
|
||||
@@ -3746,7 +3745,8 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
- else if (method->is_method_handle_adapter()) {
|
||||
+
|
||||
+ if (method->is_method_handle_adapter()) {
|
||||
// This is an internal adapter frame from the MethodHandleCompiler -- skip it
|
||||
return true;
|
||||
}
|
@ -1,374 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User andrew
|
||||
# Date 1365737071 -3600
|
||||
# Node ID c7ddbf756d7f35d6e782eb91b86ce2938de44fb8
|
||||
# Parent a5bbb8808ac9a6a8e20c5f267044bb0cef0bbdc1
|
||||
8004986: Better handling of glyph table
|
||||
8004987: Improve font layout
|
||||
8004994: Improve checking of glyph table
|
||||
Reviewed-by: bae, mschoene, jgodinez
|
||||
Contributed-by: steven.loomis@oracle.com
|
||||
|
||||
diff --git a/src/share/native/sun/font/layout/ArabicLayoutEngine.cpp b/src/share/native/sun/font/layout/ArabicLayoutEngine.cpp
|
||||
--- jdk/src/share/native/sun/font/layout/ArabicLayoutEngine.cpp
|
||||
+++ jdk/src/share/native/sun/font/layout/ArabicLayoutEngine.cpp
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
/*
|
||||
*
|
||||
- * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
|
||||
+ * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -155,17 +155,16 @@
|
||||
UnicodeArabicOpenTypeLayoutEngine::UnicodeArabicOpenTypeLayoutEngine(
|
||||
const LEFontInstance *fontInstance,
|
||||
le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags)
|
||||
- : ArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags)
|
||||
+ : ArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags | LE_CHAR_FILTER_FEATURE_FLAG)
|
||||
{
|
||||
fGSUBTable = (const GlyphSubstitutionTableHeader *) CanonShaping::glyphSubstitutionTable;
|
||||
fGDEFTable = (const GlyphDefinitionTableHeader *) CanonShaping::glyphDefinitionTable;
|
||||
-
|
||||
- fSubstitutionFilter = new CharSubstitutionFilter(fontInstance);
|
||||
+ /* OpenTypeLayoutEngine will allocate a substitution filter */
|
||||
}
|
||||
|
||||
UnicodeArabicOpenTypeLayoutEngine::~UnicodeArabicOpenTypeLayoutEngine()
|
||||
{
|
||||
- delete fSubstitutionFilter;
|
||||
+ /* OpenTypeLayoutEngine will cleanup the substitution filter */
|
||||
}
|
||||
|
||||
// "glyphs", "indices" -> glyphs, indices
|
||||
diff --git a/src/share/native/sun/font/layout/LETypes.h b/src/share/native/sun/font/layout/LETypes.h
|
||||
--- jdk/src/share/native/sun/font/layout/LETypes.h
|
||||
+++ jdk/src/share/native/sun/font/layout/LETypes.h
|
||||
@@ -208,6 +208,35 @@
|
||||
#define LE_CLIENT_SHIFT 24
|
||||
|
||||
|
||||
+#ifndef LE_ASSERT_BAD_FONT
|
||||
+#define LE_ASSERT_BAD_FONT 0
|
||||
+#endif
|
||||
+
|
||||
+#if LE_ASSERT_BAD_FONT
|
||||
+#include <stdio.h>
|
||||
+#define LE_DEBUG_BAD_FONT(x) fprintf(stderr,"%s:%d: BAD FONT: %s\n", __FILE__, __LINE__, (x));
|
||||
+#else
|
||||
+#define LE_DEBUG_BAD_FONT(x)
|
||||
+#endif
|
||||
+
|
||||
+/**
|
||||
+ * Max value representable by a uintptr
|
||||
+ */
|
||||
+#ifndef UINTPTR_MAX
|
||||
+#ifndef UINT32_MAX
|
||||
+#define LE_UINTPTR_MAX 0xFFFFFFFFU
|
||||
+#else
|
||||
+#define LE_UINTPTR_MAX UINT32_MAX
|
||||
+#endif
|
||||
+#else
|
||||
+#define LE_UINTPTR_MAX UINTPTR_MAX
|
||||
+#endif
|
||||
+
|
||||
+/**
|
||||
+ * Range check for overflow
|
||||
+ */
|
||||
+#define LE_RANGE_CHECK(type, count, ptrfn) (( (LE_UINTPTR_MAX / sizeof(type)) < count ) ? NULL : (ptrfn))
|
||||
+
|
||||
/**
|
||||
* A convenience macro to get the Glyph ID part of an LEGlyphID.
|
||||
*
|
||||
@@ -599,6 +628,21 @@
|
||||
*/
|
||||
#define LE_SUCCESS(code) ((code)<=LE_NO_ERROR)
|
||||
|
||||
+enum LEFeatureENUMs {
|
||||
+ LE_Kerning_FEATURE_ENUM = 0,
|
||||
+ LE_Ligatures_FEATURE_ENUM = 1,
|
||||
+ LE_CHAR_FILTER_FEATURE_ENUM = 31,
|
||||
+};
|
||||
+
|
||||
+#define LE_Kerning_FEATURE_FLAG (1 << LE_Kerning_FEATURE_ENUM)
|
||||
+#define LE_Ligatures_FEATURE_FLAG (1 << LE_Ligatures_FEATURE_ENUM)
|
||||
+
|
||||
+#define LE_CHAR_FILTER_FEATURE_ENUM 31
|
||||
+
|
||||
+#define LE_CHAR_FILTER_FEATURE_FLAG (1 << LE_CHAR_FILTER_FEATURE_ENUM)
|
||||
+
|
||||
+#define LE_DEFAULT_FEATURE_FLAG (LE_Kerning_FEATURE_FLAG | LE_Ligatures_FEATURE_FLAG) /**< default features */
|
||||
+
|
||||
/**
|
||||
* A convenience macro to test for the failure of a LayoutEngine call.
|
||||
*
|
||||
diff --git a/src/share/native/sun/font/layout/LayoutEngine.cpp b/src/share/native/sun/font/layout/LayoutEngine.cpp
|
||||
--- jdk/src/share/native/sun/font/layout/LayoutEngine.cpp
|
||||
+++ jdk/src/share/native/sun/font/layout/LayoutEngine.cpp
|
||||
@@ -31,6 +31,7 @@
|
||||
|
||||
#include "LETypes.h"
|
||||
#include "LEScripts.h"
|
||||
+#include "LESwaps.h"
|
||||
#include "LELanguages.h"
|
||||
|
||||
#include "LayoutEngine.h"
|
||||
@@ -387,7 +388,7 @@
|
||||
|
||||
adjustMarkGlyphs(&chars[offset], count, reverse, glyphStorage, &filter, success);
|
||||
|
||||
- if (fTypoFlags & 0x1) { /* kerning enabled */
|
||||
+ if (fTypoFlags & LE_Kerning_FEATURE_FLAG) { /* kerning enabled */
|
||||
static const le_uint32 kernTableTag = LE_KERN_TABLE_TAG;
|
||||
|
||||
KernTable kt(fFontInstance, getFontTable(kernTableTag));
|
||||
@@ -538,7 +539,7 @@
|
||||
{
|
||||
// 3 -> kerning and ligatures
|
||||
return LayoutEngine::layoutEngineFactory(fontInstance, scriptCode,
|
||||
- languageCode, 3, success);
|
||||
+ languageCode, LE_DEFAULT_FEATURE_FLAG, success);
|
||||
}
|
||||
|
||||
LayoutEngine *LayoutEngine::layoutEngineFactory(const LEFontInstance *fontInstance,
|
||||
@@ -621,7 +622,7 @@
|
||||
const MorphTableHeader *morphTable =
|
||||
(MorphTableHeader *) fontInstance->getFontTable(mortTableTag);
|
||||
|
||||
- if (morphTable != NULL) {
|
||||
+ if (morphTable != NULL && SWAPL(morphTable->version)==0x00010000) {
|
||||
result = new GXLayoutEngine(fontInstance, scriptCode, languageCode, morphTable);
|
||||
} else {
|
||||
switch (scriptCode) {
|
||||
diff --git a/src/share/native/sun/font/layout/LigatureSubstProc.cpp b/src/share/native/sun/font/layout/LigatureSubstProc.cpp
|
||||
--- jdk/src/share/native/sun/font/layout/LigatureSubstProc.cpp
|
||||
+++ jdk/src/share/native/sun/font/layout/LigatureSubstProc.cpp
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
/*
|
||||
*
|
||||
- * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved
|
||||
+ * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -76,6 +76,10 @@
|
||||
}
|
||||
|
||||
componentStack[m] = currGlyph;
|
||||
+ } else if ( m == -1) {
|
||||
+ // bad font- skip this glyph.
|
||||
+ currGlyph++;
|
||||
+ return newState;
|
||||
}
|
||||
|
||||
ByteOffset actionOffset = flags & lsfActionOffsetMask;
|
||||
@@ -99,7 +103,21 @@
|
||||
offset = action & lafComponentOffsetMask;
|
||||
if (offset != 0) {
|
||||
const le_int16 *offsetTable = (const le_int16 *)((char *) &ligatureSubstitutionHeader->stHeader + 2 * SignExtend(offset, lafComponentOffsetMask));
|
||||
+ const le_int16 *tableEnd = (const le_int16 *)((char *) &ligatureSubstitutionHeader + 1 * SWAPW(ligatureSubstitutionHeader->length));
|
||||
|
||||
+ // Check if the font is internally consistent
|
||||
+ if(tableEnd < (const le_int16*)&ligatureSubstitutionHeader // stated end wrapped around?
|
||||
+ || offsetTable > tableEnd) { // offset past end of stated length?
|
||||
+ currGlyph++;
|
||||
+ LE_DEBUG_BAD_FONT("off end of ligature substitution header");
|
||||
+ return newState; // get out! bad font
|
||||
+ }
|
||||
+
|
||||
+ if(componentGlyph > glyphStorage.getGlyphCount()) {
|
||||
+ LE_DEBUG_BAD_FONT("preposterous componentGlyph");
|
||||
+ currGlyph++;
|
||||
+ return newState; // get out! bad font
|
||||
+ }
|
||||
i += SWAPW(offsetTable[LE_GET_GLYPH(glyphStorage[componentGlyph])]);
|
||||
|
||||
if (action & (lafLast | lafStore)) {
|
||||
@@ -107,13 +125,22 @@
|
||||
TTGlyphID ligatureGlyph = SWAPW(*ligatureOffset);
|
||||
|
||||
glyphStorage[componentGlyph] = LE_SET_GLYPH(glyphStorage[componentGlyph], ligatureGlyph);
|
||||
+ if(mm==nComponents) {
|
||||
+ LE_DEBUG_BAD_FONT("exceeded nComponents");
|
||||
+ mm--; // don't overrun the stack.
|
||||
+ }
|
||||
stack[++mm] = componentGlyph;
|
||||
i = 0;
|
||||
} else {
|
||||
glyphStorage[componentGlyph] = LE_SET_GLYPH(glyphStorage[componentGlyph], 0xFFFF);
|
||||
}
|
||||
}
|
||||
- } while (!(action & lafLast));
|
||||
+#if LE_ASSERT_BAD_FONT
|
||||
+ if(m<0) {
|
||||
+ LE_DEBUG_BAD_FONT("m<0")
|
||||
+ }
|
||||
+#endif
|
||||
+ } while (!(action & lafLast) && (m>=0) ); // stop if last bit is set, or if run out of items
|
||||
|
||||
while (mm >= 0) {
|
||||
if (++m >= nComponents) {
|
||||
diff --git a/src/share/native/sun/font/layout/LookupProcessor.cpp b/src/share/native/sun/font/layout/LookupProcessor.cpp
|
||||
--- jdk/src/share/native/sun/font/layout/LookupProcessor.cpp
|
||||
+++ jdk/src/share/native/sun/font/layout/LookupProcessor.cpp
|
||||
@@ -185,7 +185,7 @@
|
||||
lookupSelectCount = lookupListCount;
|
||||
|
||||
le_int32 count, order = 0;
|
||||
- le_int32 featureReferences = 0;
|
||||
+ le_uint32 featureReferences = 0;
|
||||
const FeatureTable *featureTable = NULL;
|
||||
LETag featureTag;
|
||||
|
||||
@@ -196,7 +196,7 @@
|
||||
// be the maximum number of entries in the lookupOrderArray. We can't use
|
||||
// lookupListCount because some lookups might be referenced by more than
|
||||
// one feature.
|
||||
- for (le_int32 feature = 0; feature < featureCount; feature += 1) {
|
||||
+ for (le_uint32 feature = 0; feature < featureCount; feature += 1) {
|
||||
le_uint16 featureIndex = SWAPW(langSysTable->featureIndexArray[feature]);
|
||||
|
||||
featureTable = featureListTable->getFeatureTable(featureIndex, &featureTag);
|
||||
diff --git a/src/share/native/sun/font/layout/OpenTypeLayoutEngine.cpp b/src/share/native/sun/font/layout/OpenTypeLayoutEngine.cpp
|
||||
--- jdk/src/share/native/sun/font/layout/OpenTypeLayoutEngine.cpp
|
||||
+++ jdk/src/share/native/sun/font/layout/OpenTypeLayoutEngine.cpp
|
||||
@@ -100,6 +100,14 @@
|
||||
const GlyphPositioningTableHeader *gposTable =
|
||||
(const GlyphPositioningTableHeader *) getFontTable(gposTableTag);
|
||||
|
||||
+ applyTypoFlags();
|
||||
+
|
||||
+}
|
||||
+
|
||||
+void OpenTypeLayoutEngine::applyTypoFlags() {
|
||||
+ const le_int32& typoFlags = fTypoFlags;
|
||||
+ const LEFontInstance *fontInstance = fFontInstance;
|
||||
+
|
||||
// todo: switch to more flags and bitfield rather than list of feature tags?
|
||||
switch (typoFlags) {
|
||||
case 0: break; // default
|
||||
@@ -109,13 +117,6 @@
|
||||
default: break;
|
||||
}
|
||||
|
||||
- setScriptAndLanguageTags();
|
||||
-
|
||||
- fGDEFTable = (const GlyphDefinitionTableHeader *) getFontTable(gdefTableTag);
|
||||
-
|
||||
- if (gposTable != NULL && gposTable->coversScriptAndLanguage(fScriptTag, fLangSysTag)) {
|
||||
- fGPOSTable = gposTable;
|
||||
- }
|
||||
}
|
||||
|
||||
void OpenTypeLayoutEngine::reset()
|
||||
@@ -133,11 +134,16 @@
|
||||
fFeatureOrder(FALSE), fGSUBTable(NULL), fGDEFTable(NULL),
|
||||
fGPOSTable(NULL), fSubstitutionFilter(NULL)
|
||||
{
|
||||
+ applyTypoFlags();
|
||||
setScriptAndLanguageTags();
|
||||
}
|
||||
|
||||
OpenTypeLayoutEngine::~OpenTypeLayoutEngine()
|
||||
{
|
||||
+ if (fTypoFlags & LE_CHAR_FILTER_FEATURE_FLAG) {
|
||||
+ delete fSubstitutionFilter;
|
||||
+ fSubstitutionFilter = NULL;
|
||||
+ }
|
||||
reset();
|
||||
}
|
||||
|
||||
diff --git a/src/share/native/sun/font/layout/OpenTypeLayoutEngine.h b/src/share/native/sun/font/layout/OpenTypeLayoutEngine.h
|
||||
--- jdk/src/share/native/sun/font/layout/OpenTypeLayoutEngine.h
|
||||
+++ jdk/src/share/native/sun/font/layout/OpenTypeLayoutEngine.h
|
||||
@@ -150,6 +150,11 @@
|
||||
*/
|
||||
static const LETag languageTags[];
|
||||
|
||||
+ /**
|
||||
+ * apply the typoflags. Only called by the c'tors.
|
||||
+ */
|
||||
+ void applyTypoFlags();
|
||||
+
|
||||
protected:
|
||||
/**
|
||||
* A set of "default" features. The default characterProcessing method
|
||||
diff --git a/src/share/native/sun/font/layout/StateTableProcessor.cpp b/src/share/native/sun/font/layout/StateTableProcessor.cpp
|
||||
--- jdk/src/share/native/sun/font/layout/StateTableProcessor.cpp
|
||||
+++ jdk/src/share/native/sun/font/layout/StateTableProcessor.cpp
|
||||
@@ -63,6 +63,9 @@
|
||||
|
||||
void StateTableProcessor::process(LEGlyphStorage &glyphStorage)
|
||||
{
|
||||
+
|
||||
+ LE_STATE_PATIENCE_INIT();
|
||||
+
|
||||
// Start at state 0
|
||||
// XXX: How do we know when to start at state 1?
|
||||
ByteOffset currentState = stateArrayOffset;
|
||||
@@ -74,6 +77,7 @@
|
||||
beginStateTable();
|
||||
|
||||
while (currGlyph <= glyphCount) {
|
||||
+ if(LE_STATE_PATIENCE_DECR()) break; // patience exceeded.
|
||||
ClassCode classCode = classCodeOOB;
|
||||
if (currGlyph == glyphCount) {
|
||||
// XXX: How do we handle EOT vs. EOL?
|
||||
@@ -90,8 +94,9 @@
|
||||
|
||||
const EntryTableIndex *stateArray = (const EntryTableIndex *) ((char *) &stateTableHeader->stHeader + currentState);
|
||||
EntryTableIndex entryTableIndex = stateArray[(le_uint8)classCode];
|
||||
-
|
||||
+ LE_STATE_PATIENCE_CURR(le_int32, currGlyph);
|
||||
currentState = processStateEntry(glyphStorage, currGlyph, entryTableIndex);
|
||||
+ LE_STATE_PATIENCE_INCR(currGlyph);
|
||||
}
|
||||
|
||||
endStateTable();
|
||||
diff --git a/src/share/native/sun/font/layout/StateTables.h b/src/share/native/sun/font/layout/StateTables.h
|
||||
--- jdk/src/share/native/sun/font/layout/StateTables.h
|
||||
+++ jdk/src/share/native/sun/font/layout/StateTables.h
|
||||
@@ -35,6 +35,41 @@
|
||||
#include "LETypes.h"
|
||||
#include "LayoutTables.h"
|
||||
|
||||
+
|
||||
+
|
||||
+
|
||||
+/*
|
||||
+ * State table loop detection.
|
||||
+ * Detects if too many ( LE_STATE_PATIENCE_COUNT ) state changes occur without moving the glyph index 'g'.
|
||||
+ *
|
||||
+ * Usage (pseudocode):
|
||||
+ *
|
||||
+ * {
|
||||
+ * LE_STATE_PATIENCE_INIT();
|
||||
+ *
|
||||
+ * int g=0; // the glyph index - expect it to be moving
|
||||
+ *
|
||||
+ * for(;;) {
|
||||
+ * if(LE_STATE_PATIENCE_DECR()) { // decrements the patience counter
|
||||
+ * // ran out of patience, get out.
|
||||
+ * break;
|
||||
+ * }
|
||||
+ *
|
||||
+ * LE_STATE_PATIENCE_CURR(int, g); // store the 'current'
|
||||
+ * state = newState(state,g);
|
||||
+ * g+= <something, could be zero>;
|
||||
+ * LE_STATE_PATIENCE_INCR(g); // if g has moved, increment the patience counter. Otherwise leave it.
|
||||
+ * }
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+#define LE_STATE_PATIENCE_COUNT 4096 /**< give up if a state table doesn't move the glyph after this many iterations */
|
||||
+#define LE_STATE_PATIENCE_INIT() le_uint32 le_patience_count = LE_STATE_PATIENCE_COUNT
|
||||
+#define LE_STATE_PATIENCE_DECR() --le_patience_count==0
|
||||
+#define LE_STATE_PATIENCE_CURR(type,x) type le_patience_curr=(x)
|
||||
+#define LE_STATE_PATIENCE_INCR(x) if((x)!=le_patience_curr) ++le_patience_count;
|
||||
+
|
||||
+
|
||||
struct StateTableHeader
|
||||
{
|
||||
le_int16 stateSize;
|
@ -1,511 +0,0 @@
|
||||
--- jdk/src/share/lib/security/java.security 2013-04-16 14:57:04.075141879 +0100
|
||||
+++ jdk/src/share/lib/security/java.security 2013-04-16 14:58:37.884647607 +0100
|
||||
@@ -128,10 +128,7 @@
|
||||
# corresponding RuntimePermission ("accessClassInPackage."+package) has
|
||||
# been granted.
|
||||
package.access=sun.,\
|
||||
- com.sun.xml.internal.bind.,\
|
||||
- com.sun.xml.internal.org.jvnet.staxex.,\
|
||||
- com.sun.xml.internal.stream.,\
|
||||
- com.sun.xml.internal.ws.,\
|
||||
+ com.sun.xml.internal.,\
|
||||
com.sun.imageio.,\
|
||||
com.sun.istack.internal.,\
|
||||
com.sun.jmx.,\
|
||||
@@ -164,10 +161,7 @@
|
||||
# checkPackageDefinition.
|
||||
#
|
||||
package.definition=sun.,\
|
||||
- com.sun.xml.internal.bind.,\
|
||||
- com.sun.xml.internal.org.jvnet.staxex.,\
|
||||
- com.sun.xml.internal.stream.,\
|
||||
- com.sun.xml.internal.ws.,\
|
||||
+ com.sun.xml.internal.,\
|
||||
com.sun.imageio.,\
|
||||
com.sun.istack.internal.,\
|
||||
com.sun.jmx.,\
|
||||
--- jdk/src/share/lib/security/java.security-solaris 2013-04-16 14:57:04.075141879 +0100
|
||||
+++ jdk/src/share/lib/security/java.security-solaris 2013-04-16 15:00:01.509990145 +0100
|
||||
@@ -129,10 +129,7 @@
|
||||
# corresponding RuntimePermission ("accessClassInPackage."+package) has
|
||||
# been granted.
|
||||
package.access=sun.,\
|
||||
- com.sun.xml.internal.bind.,\
|
||||
- com.sun.xml.internal.org.jvnet.staxex.,\
|
||||
- com.sun.xml.internal.stream.,\
|
||||
- com.sun.xml.internal.ws.,\
|
||||
+ com.sun.xml.internal.,\
|
||||
com.sun.imageio.
|
||||
com.sun.istack.internal.,\
|
||||
com.sun.jmx.,\
|
||||
@@ -165,10 +162,7 @@
|
||||
# checkPackageDefinition.
|
||||
#
|
||||
package.definition=sun.,\
|
||||
- com.sun.xml.internal.bind.,\
|
||||
- com.sun.xml.internal.org.jvnet.staxex.,\
|
||||
- com.sun.xml.internal.stream.,\
|
||||
- com.sun.xml.internal.ws.,\
|
||||
+ com.sun.xml.internal.,\
|
||||
com.sun.imageio.
|
||||
com.sun.istack.internal.,\
|
||||
com.sun.jmx.,\
|
||||
--- jdk/src/share/lib/security/java.security-windows 2013-04-16 14:57:04.075141879 +0100
|
||||
+++ jdk/src/share/lib/security/java.security-windows 2013-04-16 15:00:24.790356811 +0100
|
||||
@@ -129,10 +129,7 @@
|
||||
# corresponding RuntimePermission ("accessClassInPackage."+package) has
|
||||
# been granted.
|
||||
package.access=sun.,\
|
||||
- com.sun.xml.internal.bind.,\
|
||||
- com.sun.xml.internal.org.jvnet.staxex.,\
|
||||
- com.sun.xml.internal.stream.,\
|
||||
- com.sun.xml.internal.ws.,\
|
||||
+ com.sun.xml.internal.,\
|
||||
com.sun.imageio.
|
||||
com.sun.istack.internal.,\
|
||||
com.sun.jmx.,\
|
||||
@@ -165,10 +162,7 @@
|
||||
# checkPackageDefinition.
|
||||
#
|
||||
package.definition=sun.,\
|
||||
- com.sun.xml.internal.bind.,\
|
||||
- com.sun.xml.internal.org.jvnet.staxex.,\
|
||||
- com.sun.xml.internal.stream.,\
|
||||
- com.sun.xml.internal.ws.,\
|
||||
+ com.sun.xml.internal.,\
|
||||
com.sun.imageio.
|
||||
com.sun.istack.internal.,\
|
||||
com.sun.jmx.,\
|
||||
--- /dev/null 2013-04-25 15:02:13.000000000 -0400
|
||||
+++ jaxws/patches/jaxws_src/8005432.patch 2013-04-25 15:09:37.000000000 -0400
|
||||
@@ -0,0 +1,430 @@
|
||||
+--- src/com/sun/xml/internal/bind/v2/model/impl/ModelBuilder.java 2013-04-16 14:56:58.235048158 +0100
|
||||
++++ src/com/sun/xml/internal/bind/v2/model/impl/ModelBuilder.java 2013-04-16 14:58:37.884647607 +0100
|
||||
+@@ -1,5 +1,5 @@
|
||||
+ /*
|
||||
+- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
++ * Copyright (c) 1997, 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
|
||||
+@@ -235,7 +235,7 @@
|
||||
+ String pkg = nav.getPackageName(ci.getClazz());
|
||||
+ if(!registries.containsKey(pkg)) {
|
||||
+ // insert the package's object factory
|
||||
+- C c = nav.findClass(pkg + ".ObjectFactory",ci.getClazz());
|
||||
++ C c = loadObjectFactory(ci, pkg);
|
||||
+ if(c!=null)
|
||||
+ addRegistry(c,(Locatable)p);
|
||||
+ }
|
||||
+@@ -264,6 +264,15 @@
|
||||
+ return r;
|
||||
+ }
|
||||
+
|
||||
++ private C loadObjectFactory(ClassInfoImpl<T, C, F, M> ci, String pkg) {
|
||||
++ try {
|
||||
++ return nav.findClass(pkg + ".ObjectFactory", ci.getClazz());
|
||||
++ } catch (SecurityException ignored) {
|
||||
++ // treat SecurityException in same way as ClassNotFoundException in this case
|
||||
++ return null;
|
||||
++ }
|
||||
++ }
|
||||
++
|
||||
+ /**
|
||||
+ * Checks the uniqueness of the type name.
|
||||
+ */
|
||||
+--- src/com/sun/xml/internal/ws/client/WSServiceDelegate.java 2013-04-16 14:56:58.419051111 +0100
|
||||
++++ src/com/sun/xml/internal/ws/client/WSServiceDelegate.java 2013-04-16 14:58:37.884647607 +0100
|
||||
+@@ -1,5 +1,5 @@
|
||||
+ /*
|
||||
+- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
++ * Copyright (c) 1997, 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
|
||||
+@@ -22,7 +22,6 @@
|
||||
+ * or visit www.oracle.com if you need additional information or have any
|
||||
+ * questions.
|
||||
+ */
|
||||
+-
|
||||
+ package com.sun.xml.internal.ws.client;
|
||||
+
|
||||
+ import com.sun.istack.internal.NotNull;
|
||||
+@@ -45,8 +44,8 @@
|
||||
+ import com.sun.xml.internal.ws.client.HandlerConfigurator.AnnotationConfigurator;
|
||||
+ import com.sun.xml.internal.ws.client.HandlerConfigurator.HandlerResolverImpl;
|
||||
+ import com.sun.xml.internal.ws.client.sei.SEIStub;
|
||||
+-import com.sun.xml.internal.ws.developer.WSBindingProvider;
|
||||
+ import com.sun.xml.internal.ws.developer.UsesJAXBContextFeature;
|
||||
++import com.sun.xml.internal.ws.developer.WSBindingProvider;
|
||||
+ import com.sun.xml.internal.ws.model.AbstractSEIModelImpl;
|
||||
+ import com.sun.xml.internal.ws.model.RuntimeModeler;
|
||||
+ import com.sun.xml.internal.ws.model.SOAPSEIModel;
|
||||
+@@ -59,7 +58,6 @@
|
||||
+ import com.sun.xml.internal.ws.util.JAXWSUtils;
|
||||
+ import com.sun.xml.internal.ws.util.ServiceConfigurationError;
|
||||
+ import com.sun.xml.internal.ws.util.ServiceFinder;
|
||||
+-import static com.sun.xml.internal.ws.util.xml.XmlUtil.createDefaultCatalogResolver;
|
||||
+ import com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser;
|
||||
+ import org.xml.sax.SAXException;
|
||||
+
|
||||
+@@ -74,16 +72,18 @@
|
||||
+ import javax.xml.ws.handler.HandlerResolver;
|
||||
+ import javax.xml.ws.soap.AddressingFeature;
|
||||
+ import java.io.IOException;
|
||||
++import java.lang.RuntimePermission;
|
||||
+ import java.lang.reflect.Proxy;
|
||||
+ import java.net.MalformedURLException;
|
||||
+ import java.net.URL;
|
||||
+-import java.security.AccessController;
|
||||
+-import java.security.PrivilegedAction;
|
||||
++import java.security.*;
|
||||
+ import java.util.*;
|
||||
+ import java.util.concurrent.Executor;
|
||||
+ import java.util.concurrent.Executors;
|
||||
+ import java.util.concurrent.ThreadFactory;
|
||||
+
|
||||
++import static com.sun.xml.internal.ws.util.xml.XmlUtil.createDefaultCatalogResolver;
|
||||
++
|
||||
+ /**
|
||||
+ * <code>Service</code> objects provide the client view of a Web service.
|
||||
+ *
|
||||
+@@ -613,7 +613,7 @@
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+- private <T> T createEndpointIFBaseProxy(@Nullable WSEndpointReference epr,QName portName, Class<T> portInterface,
|
||||
++ private <T> T createEndpointIFBaseProxy(@Nullable WSEndpointReference epr,QName portName, final Class<T> portInterface,
|
||||
+ WebServiceFeature[] webServiceFeatures, SEIPortInfo eif) {
|
||||
+ //fail if service doesnt have WSDL
|
||||
+ if (wsdlService == null)
|
||||
+@@ -627,14 +627,37 @@
|
||||
+ BindingImpl binding = eif.createBinding(webServiceFeatures,portInterface);
|
||||
+ SEIStub pis = new SEIStub(this, binding, eif.model, createPipeline(eif, binding), epr);
|
||||
+
|
||||
+- T proxy = portInterface.cast(Proxy.newProxyInstance(portInterface.getClassLoader(),
|
||||
+- new Class[]{portInterface, WSBindingProvider.class, Closeable.class}, pis));
|
||||
++ T proxy = createProxy(portInterface, pis);
|
||||
++
|
||||
+ if (serviceInterceptor != null) {
|
||||
+ serviceInterceptor.postCreateProxy((WSBindingProvider)proxy, portInterface);
|
||||
+ }
|
||||
+ return proxy;
|
||||
+ }
|
||||
+
|
||||
++ private <T> T createProxy(final Class<T> portInterface, final SEIStub pis) {
|
||||
++
|
||||
++ // accessClassInPackage privilege needs to be granted ...
|
||||
++ RuntimePermission perm = new RuntimePermission("accessClassInPackage.com.sun." + "xml.internal.*");
|
||||
++ PermissionCollection perms = perm.newPermissionCollection();
|
||||
++ perms.add(perm);
|
||||
++
|
||||
++ return AccessController.doPrivileged(
|
||||
++ new PrivilegedAction<T>() {
|
||||
++ @Override
|
||||
++ public T run() {
|
||||
++ Object proxy = Proxy.newProxyInstance(portInterface.getClassLoader(),
|
||||
++ new Class[]{portInterface, WSBindingProvider.class, Closeable.class}, pis);
|
||||
++ return portInterface.cast(proxy);
|
||||
++ }
|
||||
++ },
|
||||
++ new AccessControlContext(
|
||||
++ new ProtectionDomain[]{
|
||||
++ new ProtectionDomain(null, perms)
|
||||
++ })
|
||||
++ );
|
||||
++ }
|
||||
++
|
||||
+ /**
|
||||
+ * Lists up the port names in WSDL. For error diagnostics.
|
||||
+ */
|
||||
+--- src/javax/xml/soap/FactoryFinder.java 2013-04-16 14:56:58.667055090 +0100
|
||||
++++ src/javax/xml/soap/FactoryFinder.java 2013-04-16 14:58:37.888647671 +0100
|
||||
+@@ -1,5 +1,5 @@
|
||||
+ /*
|
||||
+- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
++ * Copyright (c) 2004, 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
|
||||
+@@ -50,20 +50,12 @@
|
||||
+ throws SOAPException
|
||||
+ {
|
||||
+ try {
|
||||
+- Class spiClass;
|
||||
+- if (classLoader == null) {
|
||||
+- spiClass = Class.forName(className);
|
||||
+- } else {
|
||||
+- spiClass = classLoader.loadClass(className);
|
||||
+- }
|
||||
++ Class spiClass = safeLoadClass(className, classLoader);
|
||||
+ return spiClass.newInstance();
|
||||
+ } catch (ClassNotFoundException x) {
|
||||
+- throw new SOAPException(
|
||||
+- "Provider " + className + " not found", x);
|
||||
++ throw new SOAPException("Provider " + className + " not found", x);
|
||||
+ } catch (Exception x) {
|
||||
+- throw new SOAPException(
|
||||
+- "Provider " + className + " could not be instantiated: " + x,
|
||||
+- x);
|
||||
++ throw new SOAPException("Provider " + className + " could not be instantiated: " + x, x);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+@@ -83,6 +75,61 @@
|
||||
+ static Object find(String factoryId)
|
||||
+ throws SOAPException
|
||||
+ {
|
||||
++ return find(factoryId, null, false);
|
||||
++ }
|
||||
++
|
||||
++ /**
|
||||
++ * Finds the implementation <code>Class</code> object for the given
|
||||
++ * factory name, or if that fails, finds the <code>Class</code> object
|
||||
++ * for the given fallback class name. The arguments supplied must be
|
||||
++ * used in order. If using the first argument is successful, the second
|
||||
++ * one will not be used.
|
||||
++ * <P>
|
||||
++ * This method is package private so that this code can be shared.
|
||||
++ *
|
||||
++ * @return the <code>Class</code> object of the specified message factory;
|
||||
++ * may be <code>null</code>
|
||||
++ *
|
||||
++ * @param factoryId the name of the factory to find, which is
|
||||
++ * a system property
|
||||
++ * @param fallbackClassName the implementation class name, which is
|
||||
++ * to be used only if nothing else
|
||||
++ * is found; <code>null</code> to indicate that
|
||||
++ * there is no fallback class name
|
||||
++ * @exception SOAPException if there is a SOAP error
|
||||
++ */
|
||||
++ static Object find(String factoryId, String fallbackClassName)
|
||||
++ throws SOAPException
|
||||
++ {
|
||||
++ return find(factoryId, fallbackClassName, true);
|
||||
++ }
|
||||
++
|
||||
++ /**
|
||||
++ * Finds the implementation <code>Class</code> object for the given
|
||||
++ * factory name, or if that fails, finds the <code>Class</code> object
|
||||
++ * for the given default class name, but only if <code>tryFallback</code>
|
||||
++ * is <code>true</code>. The arguments supplied must be used in order
|
||||
++ * If using the first argument is successful, the second one will not
|
||||
++ * be used. Note the default class name may be needed even if fallback
|
||||
++ * is not to be attempted, so certain error conditions can be handled.
|
||||
++ * <P>
|
||||
++ * This method is package private so that this code can be shared.
|
||||
++ *
|
||||
++ * @return the <code>Class</code> object of the specified message factory;
|
||||
++ * may not be <code>null</code>
|
||||
++ *
|
||||
++ * @param factoryId the name of the factory to find, which is
|
||||
++ * a system property
|
||||
++ * @param defaultClassName the implementation class name, which is
|
||||
++ * to be used only if nothing else
|
||||
++ * is found; <code>null</code> to indicate
|
||||
++ * that there is no default class name
|
||||
++ * @param tryFallback whether to try the default class as a
|
||||
++ * fallback
|
||||
++ * @exception SOAPException if there is a SOAP error
|
||||
++ */
|
||||
++ static Object find(String factoryId, String defaultClassName,
|
||||
++ boolean tryFallback) throws SOAPException {
|
||||
+ ClassLoader classLoader;
|
||||
+ try {
|
||||
+ classLoader = Thread.currentThread().getContextClassLoader();
|
||||
+@@ -140,49 +187,56 @@
|
||||
+ } catch( Exception ex ) {
|
||||
+ }
|
||||
+
|
||||
+- return null;
|
||||
++ // If not found and fallback should not be tried, return a null result.
|
||||
++ if (!tryFallback)
|
||||
++ return null;
|
||||
++
|
||||
++ // We didn't find the class through the usual means so try the default
|
||||
++ // (built in) factory if specified.
|
||||
++ if (defaultClassName == null) {
|
||||
++ throw new SOAPException(
|
||||
++ "Provider for " + factoryId + " cannot be found", null);
|
||||
++ }
|
||||
++ return newInstance(defaultClassName, classLoader);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+- * Finds the implementation <code>Class</code> object for the given
|
||||
+- * factory name, or if that fails, finds the <code>Class</code> object
|
||||
+- * for the given fallback class name. The arguments supplied must be
|
||||
+- * used in order. If using the first argument is successful, the second
|
||||
+- * one will not be used.
|
||||
+- * <P>
|
||||
+- * This method is package private so that this code can be shared.
|
||||
+- *
|
||||
+- * @return the <code>Class</code> object of the specified message factory;
|
||||
+- * may not be <code>null</code>
|
||||
+- *
|
||||
+- * @param factoryId the name of the factory to find, which is
|
||||
+- * a system property
|
||||
+- * @param fallbackClassName the implementation class name, which is
|
||||
+- * to be used only if nothing else
|
||||
+- * is found; <code>null</code> to indicate that
|
||||
+- * there is no fallback class name
|
||||
+- * @exception SOAPException if there is a SOAP error
|
||||
++ * Loads the class, provided that the calling thread has an access to the
|
||||
++ * class being loaded. If this is the specified default factory class and it
|
||||
++ * is restricted by package.access we get a SecurityException and can do a
|
||||
++ * Class.forName() on it so it will be loaded by the bootstrap class loader.
|
||||
+ */
|
||||
+- static Object find(String factoryId, String fallbackClassName)
|
||||
+- throws SOAPException
|
||||
+- {
|
||||
+-
|
||||
+- Object obj = find(factoryId);
|
||||
+- if (obj != null)
|
||||
+- return obj;
|
||||
++ private static Class safeLoadClass(String className,
|
||||
++ ClassLoader classLoader)
|
||||
++ throws ClassNotFoundException {
|
||||
++ try {
|
||||
++ // make sure that the current thread has an access to the package of the given name.
|
||||
++ SecurityManager s = System.getSecurityManager();
|
||||
++ if (s != null) {
|
||||
++ int i = className.lastIndexOf('.');
|
||||
++ if (i != -1) {
|
||||
++ s.checkPackageAccess(className.substring(0, i));
|
||||
++ }
|
||||
++ }
|
||||
+
|
||||
+- ClassLoader classLoader;
|
||||
+- try {
|
||||
+- classLoader = Thread.currentThread().getContextClassLoader();
|
||||
+- } catch (Exception x) {
|
||||
+- throw new SOAPException(x.toString(), x);
|
||||
+- }
|
||||
++ if (classLoader == null)
|
||||
++ return Class.forName(className);
|
||||
++ else
|
||||
++ return classLoader.loadClass(className);
|
||||
++ } catch (SecurityException se) {
|
||||
++ // (only) default implementation can be loaded
|
||||
++ // using bootstrap class loader ...
|
||||
++ if (isDefaultImplementation(className))
|
||||
++ return Class.forName(className);
|
||||
+
|
||||
+- if (fallbackClassName == null) {
|
||||
+- throw new SOAPException(
|
||||
+- "Provider for " + factoryId + " cannot be found", null);
|
||||
++ throw se;
|
||||
+ }
|
||||
++ }
|
||||
+
|
||||
+- return newInstance(fallbackClassName, classLoader);
|
||||
++ private static boolean isDefaultImplementation(String className) {
|
||||
++ return MessageFactory.DEFAULT_MESSAGE_FACTORY.equals(className) ||
|
||||
++ SOAPFactory.DEFAULT_SOAP_FACTORY.equals(className) ||
|
||||
++ SOAPConnectionFactory.DEFAULT_SOAP_CONNECTION_FACTORY.equals(className) ||
|
||||
++ SAAJMetaFactory.DEFAULT_META_FACTORY_CLASS.equals(className);
|
||||
+ }
|
||||
+ }
|
||||
+--- src/javax/xml/soap/MessageFactory.java 2013-04-16 14:56:58.667055090 +0100
|
||||
++++ src/javax/xml/soap/MessageFactory.java 2013-04-16 14:58:37.888647671 +0100
|
||||
+@@ -1,5 +1,5 @@
|
||||
+ /*
|
||||
+- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
++ * Copyright (c) 2004, 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
|
||||
+@@ -72,7 +72,7 @@
|
||||
+ */
|
||||
+ public abstract class MessageFactory {
|
||||
+
|
||||
+- static private final String DEFAULT_MESSAGE_FACTORY
|
||||
++ static final String DEFAULT_MESSAGE_FACTORY
|
||||
+ = "com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl";
|
||||
+
|
||||
+ static private final String MESSAGE_FACTORY_PROPERTY
|
||||
+@@ -105,11 +105,14 @@
|
||||
+ public static MessageFactory newInstance()
|
||||
+ throws SOAPException {
|
||||
+ try {
|
||||
+- MessageFactory factory = (MessageFactory)
|
||||
+- FactoryFinder.find(MESSAGE_FACTORY_PROPERTY);
|
||||
++ MessageFactory factory = (MessageFactory) FactoryFinder.find(
|
||||
++ MESSAGE_FACTORY_PROPERTY,
|
||||
++ DEFAULT_MESSAGE_FACTORY,
|
||||
++ false);
|
||||
+
|
||||
+- if (factory != null)
|
||||
++ if (factory != null) {
|
||||
+ return factory;
|
||||
++ }
|
||||
+
|
||||
+ return newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
|
||||
+ } catch (Exception ex) {
|
||||
+--- src/javax/xml/soap/SAAJMetaFactory.java 2013-04-16 14:56:58.667055090 +0100
|
||||
++++ src/javax/xml/soap/SAAJMetaFactory.java 2013-04-16 14:58:37.888647671 +0100
|
||||
+@@ -1,5 +1,5 @@
|
||||
+ /*
|
||||
+- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
++ * Copyright (c) 2004, 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
|
||||
+@@ -50,7 +50,7 @@
|
||||
+ public abstract class SAAJMetaFactory {
|
||||
+ static private final String META_FACTORY_CLASS_PROPERTY =
|
||||
+ "javax.xml.soap.MetaFactory";
|
||||
+- static private final String DEFAULT_META_FACTORY_CLASS =
|
||||
++ static final String DEFAULT_META_FACTORY_CLASS =
|
||||
+ "com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl";
|
||||
+
|
||||
+ /**
|
||||
+--- src/javax/xml/soap/SOAPConnectionFactory.java 2013-04-16 14:56:58.667055090 +0100
|
||||
++++ src/javax/xml/soap/SOAPConnectionFactory.java 2013-04-16 14:58:37.888647671 +0100
|
||||
+@@ -1,5 +1,5 @@
|
||||
+ /*
|
||||
+- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
++ * Copyright (c) 2004, 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
|
||||
+@@ -44,7 +44,7 @@
|
||||
+ * A constant representing the default value for a <code>SOAPConnection</code>
|
||||
+ * object. The default is the point-to-point SOAP connection.
|
||||
+ */
|
||||
+- static private final String DEFAULT_SOAP_CONNECTION_FACTORY
|
||||
++ static final String DEFAULT_SOAP_CONNECTION_FACTORY
|
||||
+ = "com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnectionFactory";
|
||||
+
|
||||
+ /**
|
||||
+--- src/javax/xml/soap/SOAPFactory.java 2013-04-16 14:56:58.671055155 +0100
|
||||
++++ src/javax/xml/soap/SOAPFactory.java 2013-04-16 14:58:37.888647671 +0100
|
||||
+@@ -1,5 +1,5 @@
|
||||
+ /*
|
||||
+- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
++ * Copyright (c) 2004, 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
|
||||
+@@ -61,6 +61,12 @@
|
||||
+ "javax.xml.soap.SOAPFactory";
|
||||
+
|
||||
+ /**
|
||||
++ * Class name of default <code>SOAPFactory</code> implementation.
|
||||
++ */
|
||||
++ static final String DEFAULT_SOAP_FACTORY
|
||||
++ = "com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl";
|
||||
++
|
||||
++ /**
|
||||
+ * Creates a <code>SOAPElement</code> object from an existing DOM
|
||||
+ * <code>Element</code>. If the DOM <code>Element</code> that is passed in
|
||||
+ * as an argument is already a <code>SOAPElement</code> then this method
|
||||
+@@ -262,7 +268,7 @@
|
||||
+ throws SOAPException
|
||||
+ {
|
||||
+ try {
|
||||
+- SOAPFactory factory = (SOAPFactory) FactoryFinder.find(SOAP_FACTORY_PROPERTY);
|
||||
++ SOAPFactory factory = (SOAPFactory) FactoryFinder.find(SOAP_FACTORY_PROPERTY, DEFAULT_SOAP_FACTORY, false);
|
||||
+ if (factory != null)
|
||||
+ return factory;
|
||||
+ return newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
|
@ -1,202 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User andrew
|
||||
# Date 1365784383 -3600
|
||||
# Node ID dfa1c658a62a54dbcfa02e96c51af21a3cc71907
|
||||
# Parent 0938f449476b5c89ccb68f0c195a57a0e72e9dc4
|
||||
8005943: (process) Improved Runtime.exec
|
||||
Reviewed-by: alanb, ahgross
|
||||
|
||||
diff --git a/src/share/classes/java/lang/ProcessBuilder.java b/src/share/classes/java/lang/ProcessBuilder.java
|
||||
--- jdk/src/share/classes/java/lang/ProcessBuilder.java
|
||||
+++ jdk/src/share/classes/java/lang/ProcessBuilder.java
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
+import java.security.AccessControlException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -459,8 +460,9 @@
|
||||
String prog = cmdarray[0];
|
||||
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
- if (security != null)
|
||||
+ if (security != null) {
|
||||
security.checkExec(prog);
|
||||
+ }
|
||||
|
||||
String dir = directory == null ? null : directory.toString();
|
||||
|
||||
@@ -470,13 +472,24 @@
|
||||
dir,
|
||||
redirectErrorStream);
|
||||
} catch (IOException e) {
|
||||
+ String exceptionInfo = ": " + e.getMessage();
|
||||
+ Throwable cause = e;
|
||||
+ if (security != null) {
|
||||
+ // Can not disclose the fail reason for read-protected files.
|
||||
+ try {
|
||||
+ security.checkRead(prog);
|
||||
+ } catch (AccessControlException ace) {
|
||||
+ exceptionInfo = "";
|
||||
+ cause = ace;
|
||||
+ }
|
||||
+ }
|
||||
// It's much easier for us to create a high-quality error
|
||||
// message than the low-level C code which found the problem.
|
||||
throw new IOException(
|
||||
"Cannot run program \"" + prog + "\""
|
||||
+ (dir == null ? "" : " (in directory \"" + dir + "\")")
|
||||
- + ": " + e.getMessage(),
|
||||
- e);
|
||||
+ + exceptionInfo,
|
||||
+ cause);
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/src/windows/classes/java/lang/ProcessImpl.java b/src/windows/classes/java/lang/ProcessImpl.java
|
||||
--- jdk/src/windows/classes/java/lang/ProcessImpl.java
|
||||
+++ jdk/src/windows/classes/java/lang/ProcessImpl.java
|
||||
@@ -47,6 +47,88 @@
|
||||
return new ProcessImpl(cmdarray, envblock, dir, redirectErrorStream);
|
||||
}
|
||||
|
||||
+ // We guarantee the only command file execution for implicit [cmd.exe] run.
|
||||
+ // http://technet.microsoft.com/en-us/library/bb490954.aspx
|
||||
+ private static final char CMD_BAT_ESCAPE[] = {' ', '\t', '<', '>', '&', '|', '^'};
|
||||
+ private static final char WIN32_EXECUTABLE_ESCAPE[] = {' ', '\t', '<', '>'};
|
||||
+
|
||||
+ private static boolean isQuoted(boolean noQuotesInside, String arg,
|
||||
+ String errorMessage) {
|
||||
+ int lastPos = arg.length() - 1;
|
||||
+ if (lastPos >=1 && arg.charAt(0) == '"' && arg.charAt(lastPos) == '"') {
|
||||
+ // The argument has already been quoted.
|
||||
+ if (noQuotesInside) {
|
||||
+ if (arg.indexOf('"', 1) != lastPos) {
|
||||
+ // There is ["] inside.
|
||||
+ throw new IllegalArgumentException(errorMessage);
|
||||
+ }
|
||||
+ }
|
||||
+ return true;
|
||||
+ }
|
||||
+ if (noQuotesInside) {
|
||||
+ if (arg.indexOf('"') >= 0) {
|
||||
+ // There is ["] inside.
|
||||
+ throw new IllegalArgumentException(errorMessage);
|
||||
+ }
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ private static boolean needsEscaping(boolean isCmdFile, String arg) {
|
||||
+ // Switch off MS heuristic for internal ["].
|
||||
+ // Please, use the explicit [cmd.exe] call
|
||||
+ // if you need the internal ["].
|
||||
+ // Example: "cmd.exe", "/C", "Extended_MS_Syntax"
|
||||
+
|
||||
+ // For [.exe] or [.com] file the unpaired/internal ["]
|
||||
+ // in the argument is not a problem.
|
||||
+ boolean argIsQuoted = isQuoted(isCmdFile, arg,
|
||||
+ "Argument has embedded quote, use the explicit CMD.EXE call.");
|
||||
+
|
||||
+ if (!argIsQuoted) {
|
||||
+ char testEscape[] = isCmdFile
|
||||
+ ? CMD_BAT_ESCAPE
|
||||
+ : WIN32_EXECUTABLE_ESCAPE;
|
||||
+ for (int i = 0; i < testEscape.length; ++i) {
|
||||
+ if (arg.indexOf(testEscape[i]) >= 0) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ private static String getExecutablePath(String path)
|
||||
+ throws IOException
|
||||
+ {
|
||||
+ boolean pathIsQuoted = isQuoted(true, path,
|
||||
+ "Executable name has embedded quote, split the arguments");
|
||||
+
|
||||
+ // Win32 CreateProcess requires path to be normalized
|
||||
+ File fileToRun = new File(pathIsQuoted
|
||||
+ ? path.substring(1, path.length() - 1)
|
||||
+ : path);
|
||||
+
|
||||
+ // From the [CreateProcess] function documentation:
|
||||
+ //
|
||||
+ // "If the file name does not contain an extension, .exe is appended.
|
||||
+ // Therefore, if the file name extension is .com, this parameter
|
||||
+ // must include the .com extension. If the file name ends in
|
||||
+ // a period (.) with no extension, or if the file name contains a path,
|
||||
+ // .exe is not appended."
|
||||
+ //
|
||||
+ // "If the file name !does not contain a directory path!,
|
||||
+ // the system searches for the executable file in the following
|
||||
+ // sequence:..."
|
||||
+ //
|
||||
+ // In practice ANY non-existent path is extended by [.exe] extension
|
||||
+ // in the [CreateProcess] funcion with the only exception:
|
||||
+ // the path ends by (.)
|
||||
+
|
||||
+ return fileToRun.getPath();
|
||||
+ }
|
||||
+
|
||||
+
|
||||
private long handle = 0;
|
||||
private FileDescriptor stdin_fd;
|
||||
private FileDescriptor stdout_fd;
|
||||
@@ -61,30 +143,31 @@
|
||||
boolean redirectErrorStream)
|
||||
throws IOException
|
||||
{
|
||||
- // Win32 CreateProcess requires cmd[0] to be normalized
|
||||
- cmd[0] = new File(cmd[0]).getPath();
|
||||
+ // The [executablePath] is not quoted for any case.
|
||||
+ String executablePath = getExecutablePath(cmd[0]);
|
||||
+
|
||||
+ // We need to extend the argument verification procedure
|
||||
+ // to guarantee the only command file execution for implicit [cmd.exe]
|
||||
+ // run.
|
||||
+ String upPath = executablePath.toUpperCase();
|
||||
+ boolean isCmdFile = (upPath.endsWith(".CMD") || upPath.endsWith(".BAT"));
|
||||
|
||||
StringBuilder cmdbuf = new StringBuilder(80);
|
||||
- for (int i = 0; i < cmd.length; i++) {
|
||||
- if (i > 0) {
|
||||
- cmdbuf.append(' ');
|
||||
- }
|
||||
+
|
||||
+ // Quotation protects from interpretation of the [path] argument as
|
||||
+ // start of longer path with spaces. Quotation has no influence to
|
||||
+ // [.exe] extension heuristic.
|
||||
+ cmdbuf.append('"');
|
||||
+ cmdbuf.append(executablePath);
|
||||
+ cmdbuf.append('"');
|
||||
+
|
||||
+ for (int i = 1; i < cmd.length; i++) {
|
||||
+ cmdbuf.append(' ');
|
||||
String s = cmd[i];
|
||||
- if (s.indexOf(' ') >= 0 || s.indexOf('\t') >= 0) {
|
||||
- if (s.charAt(0) != '"') {
|
||||
- cmdbuf.append('"');
|
||||
- cmdbuf.append(s);
|
||||
- if (s.endsWith("\\")) {
|
||||
- cmdbuf.append("\\");
|
||||
- }
|
||||
- cmdbuf.append('"');
|
||||
- } else if (s.endsWith("\"")) {
|
||||
- /* The argument has already been quoted. */
|
||||
- cmdbuf.append(s);
|
||||
- } else {
|
||||
- /* Unmatched quote for the argument. */
|
||||
- throw new IllegalArgumentException();
|
||||
- }
|
||||
+ if (needsEscaping(isCmdFile, s)) {
|
||||
+ cmdbuf.append('"');
|
||||
+ cmdbuf.append(s);
|
||||
+ cmdbuf.append('"');
|
||||
} else {
|
||||
cmdbuf.append(s);
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User poonam
|
||||
# Date 1362616238 28800
|
||||
# Node ID ef36be1ae9bc7d061721f8890797e5d89c901846
|
||||
# Parent cf2b7f0f7a2188a1421bdd033e88bf4b0aa6870c
|
||||
8006309: More reliable control panel operation
|
||||
Summary: Added a comment in the dead Kernel code
|
||||
Reviewed-by: ahgross, sla, coleenp
|
||||
|
||||
diff --git a/src/share/vm/runtime/thread.cpp b/src/share/vm/runtime/thread.cpp
|
||||
--- hotspot/src/share/vm/runtime/thread.cpp
|
||||
+++ hotspot/src/share/vm/runtime/thread.cpp
|
||||
@@ -3416,6 +3416,9 @@
|
||||
os::dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(), name);
|
||||
library = os::dll_load(buffer, ebuf, sizeof ebuf);
|
||||
#ifdef KERNEL
|
||||
+
|
||||
+ // Dead code, KERNEL is never built in JDK7 or later. This code will be removed in a future update release.
|
||||
+
|
||||
// Download instrument dll
|
||||
if (library == NULL && strcmp(name, "instrument") == 0) {
|
||||
char *props = Arguments::get_kernel_properties();
|
@ -1,76 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User andrew
|
||||
# Date 1365784460 -3600
|
||||
# Node ID e0803f17f824df0bbedf0dd03aa06938389b1b9f
|
||||
# Parent dfa1c658a62a54dbcfa02e96c51af21a3cc71907
|
||||
8006435: Improvements in JMX
|
||||
Summary: Improvements in JMX
|
||||
Reviewed-by: dfuchs, skoivu
|
||||
|
||||
diff --git a/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java b/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java
|
||||
--- jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java
|
||||
+++ jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 2000, 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
|
||||
@@ -213,7 +213,6 @@
|
||||
|
||||
Object moi = null;
|
||||
|
||||
-
|
||||
// ------------------------------
|
||||
// ------------------------------
|
||||
Constructor cons = findConstructor(theClass, null);
|
||||
@@ -224,6 +223,7 @@
|
||||
// Instantiate the new object
|
||||
try {
|
||||
ReflectUtil.checkPackageAccess(theClass);
|
||||
+ ReflectUtil.ensureClassAccess(theClass);
|
||||
moi= cons.newInstance();
|
||||
} catch (InvocationTargetException e) {
|
||||
// Wrap the exception.
|
||||
@@ -270,7 +270,6 @@
|
||||
checkMBeanPermission(theClass, null, null, "instantiate");
|
||||
|
||||
// Instantiate the new object
|
||||
-
|
||||
// ------------------------------
|
||||
// ------------------------------
|
||||
final Class[] tab;
|
||||
@@ -301,6 +300,7 @@
|
||||
}
|
||||
try {
|
||||
ReflectUtil.checkPackageAccess(theClass);
|
||||
+ ReflectUtil.ensureClassAccess(theClass);
|
||||
moi = cons.newInstance(params);
|
||||
}
|
||||
catch (NoSuchMethodError error) {
|
||||
diff --git a/src/share/classes/sun/reflect/misc/ReflectUtil.java b/src/share/classes/sun/reflect/misc/ReflectUtil.java
|
||||
--- jdk/src/share/classes/sun/reflect/misc/ReflectUtil.java
|
||||
+++ jdk/src/share/classes/sun/reflect/misc/ReflectUtil.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 2005, 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
|
||||
@@ -46,6 +46,14 @@
|
||||
return cls.newInstance();
|
||||
}
|
||||
|
||||
+ public static void ensureClassAccess(Class clazz)
|
||||
+ throws IllegalAccessException
|
||||
+ {
|
||||
+ int mod = clazz.getModifiers();
|
||||
+ if ( ! Modifier.isPublic(mod) ){
|
||||
+ throw new IllegalAccessException("Class is not public and can't be instantiated");
|
||||
+ }
|
||||
+ }
|
||||
/*
|
||||
* Reflection.ensureMemberAccess is overly-restrictive
|
||||
* due to a bug. We awkwardly work around it for now.
|
@ -1,166 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User andrew
|
||||
# Date 1365784684 -3600
|
||||
# Node ID 08f7ab5f86a27c17b648f3b47f800393d939140c
|
||||
# Parent e0803f17f824df0bbedf0dd03aa06938389b1b9f
|
||||
8006790: Improve checking for windows
|
||||
Reviewed-by: art, mschoene
|
||||
|
||||
diff --git a/src/share/classes/java/awt/Window.java b/src/share/classes/java/awt/Window.java
|
||||
--- jdk/src/share/classes/java/awt/Window.java
|
||||
+++ jdk/src/share/classes/java/awt/Window.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 1995, 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
|
||||
@@ -2055,7 +2055,7 @@
|
||||
WindowPeer peer = (WindowPeer)this.peer;
|
||||
synchronized(getTreeLock()) {
|
||||
if (peer != null) {
|
||||
- peer.setAlwaysOnTop(alwaysOnTop);
|
||||
+ peer.updateAlwaysOnTopState();
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/src/share/classes/java/awt/peer/WindowPeer.java b/src/share/classes/java/awt/peer/WindowPeer.java
|
||||
--- jdk/src/share/classes/java/awt/peer/WindowPeer.java
|
||||
+++ jdk/src/share/classes/java/awt/peer/WindowPeer.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 1995, 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
|
||||
@@ -37,7 +37,7 @@
|
||||
public interface WindowPeer extends ContainerPeer {
|
||||
void toFront();
|
||||
void toBack();
|
||||
- void setAlwaysOnTop(boolean alwaysOnTop);
|
||||
+ void updateAlwaysOnTopState();
|
||||
void updateFocusableWindowState();
|
||||
boolean requestWindowFocus();
|
||||
void setModalBlocked(Dialog blocker, boolean blocked);
|
||||
diff --git a/src/share/classes/sun/awt/EmbeddedFrame.java b/src/share/classes/sun/awt/EmbeddedFrame.java
|
||||
--- jdk/src/share/classes/sun/awt/EmbeddedFrame.java
|
||||
+++ jdk/src/share/classes/sun/awt/EmbeddedFrame.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 1996, 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
|
||||
@@ -551,7 +551,7 @@
|
||||
public void toBack() {}
|
||||
public void updateFocusableWindowState() {}
|
||||
public void updateAlwaysOnTop() {}
|
||||
- public void setAlwaysOnTop(boolean alwaysOnTop) {}
|
||||
+ public void updateAlwaysOnTopState() {}
|
||||
public Component getGlobalHeavyweightFocusOwner() { return null; }
|
||||
public void setBoundsPrivate(int x, int y, int width, int height) {
|
||||
setBounds(x, y, width, height, SET_BOUNDS);
|
||||
diff --git a/src/solaris/classes/sun/awt/X11/XWindowPeer.java b/src/solaris/classes/sun/awt/X11/XWindowPeer.java
|
||||
--- jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java
|
||||
+++ jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 2002, 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
|
||||
@@ -1018,8 +1018,8 @@
|
||||
XLayerProtocol.LAYER_NORMAL);
|
||||
}
|
||||
|
||||
- public void setAlwaysOnTop(boolean alwaysOnTop) {
|
||||
- this.alwaysOnTop = alwaysOnTop;
|
||||
+ public void updateAlwaysOnTopState() {
|
||||
+ this.alwaysOnTop = ((Window) this.target).isAlwaysOnTop();
|
||||
updateAlwaysOnTop();
|
||||
}
|
||||
|
||||
diff --git a/src/windows/classes/sun/awt/windows/WFileDialogPeer.java b/src/windows/classes/sun/awt/windows/WFileDialogPeer.java
|
||||
--- jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java
|
||||
+++ jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 1996, 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
|
||||
@@ -199,7 +199,7 @@
|
||||
|
||||
// unused methods. Overridden to disable this functionality as
|
||||
// it requires HWND which is not available for FileDialog
|
||||
- public void setAlwaysOnTop(boolean value) {}
|
||||
+ public void updateAlwaysOnTopState() {}
|
||||
public void setDirectory(String dir) {}
|
||||
public void setFile(String file) {}
|
||||
public void setTitle(String title) {}
|
||||
diff --git a/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java b/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java
|
||||
--- jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java
|
||||
+++ jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 1999, 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
|
||||
@@ -115,7 +115,7 @@
|
||||
// unused methods. Overridden to disable this functionality as
|
||||
// it requires HWND which is not available for FileDialog
|
||||
void initialize() {}
|
||||
- public void setAlwaysOnTop(boolean b) {}
|
||||
+ public void updateAlwaysOnTopState() {}
|
||||
public void setResizable(boolean resizable) {}
|
||||
public void hide() {}
|
||||
public void enable() {}
|
||||
diff --git a/src/windows/classes/sun/awt/windows/WWindowPeer.java b/src/windows/classes/sun/awt/windows/WWindowPeer.java
|
||||
--- jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java
|
||||
+++ jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 1996, 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
|
||||
@@ -112,6 +112,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ public void updateAlwaysOnTopState() {
|
||||
+ setAlwaysOnTop(((Window)target).isAlwaysOnTop());
|
||||
+ }
|
||||
+
|
||||
public void updateFocusableWindowState() {
|
||||
setFocusableWindow(((Window)target).isFocusableWindow());
|
||||
}
|
||||
# HG changeset patch
|
||||
# User andrew
|
||||
# Date 1365787780 -3600
|
||||
# Node ID f135ac267a382a052f563d7dd8fb001cd27827be
|
||||
# Parent 014d4beffa044a4ae8f7f82618bdf9bc659056a7
|
||||
Extend 8006790 to cover the Motif peer
|
||||
|
||||
diff --git a/src/solaris/classes/sun/awt/motif/MWindowPeer.java b/src/solaris/classes/sun/awt/motif/MWindowPeer.java
|
||||
--- jdk/src/solaris/classes/sun/awt/motif/MWindowPeer.java
|
||||
+++ jdk/src/solaris/classes/sun/awt/motif/MWindowPeer.java
|
||||
@@ -183,6 +183,10 @@
|
||||
updateAlwaysOnTop(alwaysOnTop);
|
||||
}
|
||||
|
||||
+ public void updateAlwaysOnTopState() {
|
||||
+ setAlwaysOnTop(((Window)target).isAlwaysOnTop());
|
||||
+ }
|
||||
+
|
||||
public void toFront() {
|
||||
if (target.isVisible()) {
|
||||
updateFocusableWindowState();
|
@ -1,35 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User prr
|
||||
# Date 1360268071 28800
|
||||
# Node ID 2da00862b3dba3b690f5e212a00fe984e9f648ed
|
||||
# Parent 08f7ab5f86a27c17b648f3b47f800393d939140c
|
||||
8006795: Improve font warning messages
|
||||
Reviewed-by: bae, jgodinez, mschoene
|
||||
|
||||
diff --git a/src/share/classes/sun/font/CMap.java b/src/share/classes/sun/font/CMap.java
|
||||
--- jdk/src/share/classes/sun/font/CMap.java
|
||||
+++ jdk/src/share/classes/sun/font/CMap.java
|
||||
@@ -841,7 +841,6 @@
|
||||
|
||||
CMapFormat6(ByteBuffer bbuffer, int offset, char[] xlat) {
|
||||
|
||||
- System.err.println("WARNING: CMapFormat8 is untested.");
|
||||
bbuffer.position(offset+6);
|
||||
CharBuffer buffer = bbuffer.asCharBuffer();
|
||||
firstCode = buffer.get();
|
||||
@@ -884,7 +883,6 @@
|
||||
|
||||
CMapFormat8(ByteBuffer bbuffer, int offset, char[] xlat) {
|
||||
|
||||
- System.err.println("WARNING: CMapFormat8 is untested.");
|
||||
bbuffer.position(12);
|
||||
bbuffer.get(is32);
|
||||
nGroups = bbuffer.getInt();
|
||||
@@ -915,7 +913,6 @@
|
||||
|
||||
CMapFormat10(ByteBuffer bbuffer, int offset, char[] xlat) {
|
||||
|
||||
- System.err.println("WARNING: CMapFormat10 is untested.");
|
||||
firstCode = bbuffer.getInt() & INTMASK;
|
||||
entryCount = bbuffer.getInt() & INTMASK;
|
||||
bbuffer.position(offset+20);
|
@ -1,31 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User raginip
|
||||
# Date 1362146770 0
|
||||
# Node ID 014d4beffa044a4ae8f7f82618bdf9bc659056a7
|
||||
# Parent 2da00862b3dba3b690f5e212a00fe984e9f648ed
|
||||
8007406: Improve accessibility of AccessBridge
|
||||
Reviewed-by: skoivu, mullan, ptbrunet
|
||||
|
||||
diff --git a/src/share/lib/security/java.security-windows b/src/share/lib/security/java.security-windows
|
||||
--- jdk/src/share/lib/security/java.security-windows
|
||||
+++ jdk/src/share/lib/security/java.security-windows
|
||||
@@ -149,7 +149,8 @@
|
||||
com.sun.org.apache.xml.internal.res.,\
|
||||
com.sun.org.apache.xml.internal.serializer.utils.,\
|
||||
com.sun.org.apache.xml.internal.utils.,\
|
||||
- com.sun.org.glassfish.
|
||||
+ com.sun.org.glassfish.,\
|
||||
+ com.sun.java.accessibility.
|
||||
|
||||
#
|
||||
# List of comma-separated packages that start with or equal this string
|
||||
@@ -182,7 +183,8 @@
|
||||
com.sun.org.apache.xml.internal.res.,\
|
||||
com.sun.org.apache.xml.internal.serializer.utils.,\
|
||||
com.sun.org.apache.xml.internal.utils.,\
|
||||
- com.sun.org.glassfish.
|
||||
+ com.sun.org.glassfish.,\
|
||||
+ com.sun.java.accessibility.
|
||||
|
||||
#
|
||||
# Determines whether this properties file can be appended to
|
@ -1,376 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User bae
|
||||
# Date 1361531665 -14400
|
||||
# Node ID cf93d3828aa8f85003f3668f069646205c39c087
|
||||
# Parent ddd9e6df700fa59366b4560e58a3b7b0a16b4746
|
||||
8007617: Better validation of images
|
||||
Reviewed-by: prr, jgodinez
|
||||
|
||||
diff --git openjdk/jdk/src/share/classes/sun/awt/image/ImageRepresentation.java openjdk/jdk/src/share/classes/sun/awt/image/ImageRepresentation.java
|
||||
--- jdk/src/share/classes/sun/awt/image/ImageRepresentation.java
|
||||
+++ jdk/src/share/classes/sun/awt/image/ImageRepresentation.java
|
||||
@@ -333,10 +333,10 @@ public class ImageRepresentation extends
|
||||
hints = h;
|
||||
}
|
||||
|
||||
- private native void setICMpixels(int x, int y, int w, int h, int[] lut,
|
||||
+ private native boolean setICMpixels(int x, int y, int w, int h, int[] lut,
|
||||
byte[] pix, int off, int scansize,
|
||||
IntegerComponentRaster ict);
|
||||
- private native int setDiffICM(int x, int y, int w, int h, int[] lut,
|
||||
+ private native boolean setDiffICM(int x, int y, int w, int h, int[] lut,
|
||||
int transPix, int numLut, IndexColorModel icm,
|
||||
byte[] pix, int off, int scansize,
|
||||
ByteComponentRaster bct, int chanOff);
|
||||
@@ -426,10 +426,10 @@ public class ImageRepresentation extends
|
||||
IndexColorModel icm = (IndexColorModel) model;
|
||||
ByteComponentRaster bct = (ByteComponentRaster) biRaster;
|
||||
int numlut = numSrcLUT;
|
||||
- if (setDiffICM(x, y, w, h, srcLUT, srcLUTtransIndex,
|
||||
+ if (!setDiffICM(x, y, w, h, srcLUT, srcLUTtransIndex,
|
||||
numSrcLUT, icm,
|
||||
pix, off, scansize, bct,
|
||||
- bct.getDataOffset(0)) == 0) {
|
||||
+ bct.getDataOffset(0))) {
|
||||
convertToRGB();
|
||||
}
|
||||
else {
|
||||
@@ -470,9 +470,14 @@ public class ImageRepresentation extends
|
||||
if (s_useNative) {
|
||||
// Note that setICMpixels modifies the raster directly
|
||||
// so we must mark it as changed afterwards
|
||||
- setICMpixels(x, y, w, h, srcLUT, pix, off, scansize,
|
||||
- iraster);
|
||||
- iraster.markDirty();
|
||||
+ if (setICMpixels(x, y, w, h, srcLUT, pix, off, scansize,
|
||||
+ iraster))
|
||||
+ {
|
||||
+ iraster.markDirty();
|
||||
+ } else {
|
||||
+ abort();
|
||||
+ return;
|
||||
+ }
|
||||
}
|
||||
else {
|
||||
int[] storage = new int[w*h];
|
||||
diff --git openjdk/jdk/src/share/native/sun/awt/image/awt_ImageRep.c openjdk/jdk/src/share/native/sun/awt/image/awt_ImageRep.c
|
||||
--- jdk/src/share/native/sun/awt/image/awt_ImageRep.c
|
||||
+++ jdk/src/share/native/sun/awt/image/awt_ImageRep.c
|
||||
@@ -45,6 +45,53 @@ static int findIdx(unsigned int rgb, uns
|
||||
# define TRUE 1
|
||||
#endif
|
||||
|
||||
+#define CHECK_STRIDE(yy, hh, ss) \
|
||||
+ if ((ss) != 0) { \
|
||||
+ int limit = 0x7fffffff / ((ss) > 0 ? (ss) : -(ss)); \
|
||||
+ if (limit < (yy) || limit < ((yy) + (hh) - 1)) { \
|
||||
+ /* integer oveflow */ \
|
||||
+ return JNI_FALSE; \
|
||||
+ } \
|
||||
+ } \
|
||||
+
|
||||
+#define CHECK_SRC() \
|
||||
+ do { \
|
||||
+ int pixeloffset; \
|
||||
+ if (off < 0 || off >= srcDataLength) { \
|
||||
+ return JNI_FALSE; \
|
||||
+ } \
|
||||
+ CHECK_STRIDE(0, h, scansize); \
|
||||
+ \
|
||||
+ /* check scansize */ \
|
||||
+ pixeloffset = scansize * (h - 1); \
|
||||
+ if ((w - 1) > (0x7fffffff - pixeloffset)) { \
|
||||
+ return JNI_FALSE; \
|
||||
+ } \
|
||||
+ pixeloffset += (w - 1); \
|
||||
+ \
|
||||
+ if (off > (0x7fffffff - pixeloffset)) { \
|
||||
+ return JNI_FALSE; \
|
||||
+ } \
|
||||
+ } while (0) \
|
||||
+
|
||||
+#define CHECK_DST(xx, yy) \
|
||||
+ do { \
|
||||
+ int soffset = (yy) * sStride; \
|
||||
+ int poffset = (xx) * pixelStride; \
|
||||
+ if (poffset > (0x7fffffff - soffset)) { \
|
||||
+ return JNI_FALSE; \
|
||||
+ } \
|
||||
+ poffset += soffset; \
|
||||
+ if (dstDataOff > (0x7fffffff - poffset)) { \
|
||||
+ return JNI_FALSE; \
|
||||
+ } \
|
||||
+ poffset += dstDataOff; \
|
||||
+ \
|
||||
+ if (poffset < 0 || poffset >= dstDataLength) { \
|
||||
+ return JNI_FALSE; \
|
||||
+ } \
|
||||
+ } while (0) \
|
||||
+
|
||||
static jfieldID s_JnumSrcLUTID;
|
||||
static jfieldID s_JsrcLUTtransIndexID;
|
||||
|
||||
@@ -58,7 +105,7 @@ Java_sun_awt_image_ImageRepresentation_i
|
||||
/*
|
||||
* This routine is used to draw ICM pixels into a default color model
|
||||
*/
|
||||
-JNIEXPORT void JNICALL
|
||||
+JNIEXPORT jboolean JNICALL
|
||||
Java_sun_awt_image_ImageRepresentation_setICMpixels(JNIEnv *env, jclass cls,
|
||||
jint x, jint y, jint w,
|
||||
jint h, jintArray jlut,
|
||||
@@ -67,7 +114,10 @@ Java_sun_awt_image_ImageRepresentation_s
|
||||
jobject jict)
|
||||
{
|
||||
unsigned char *srcData = NULL;
|
||||
+ jint srcDataLength;
|
||||
int *dstData;
|
||||
+ jint dstDataLength;
|
||||
+ jint dstDataOff;
|
||||
int *dstP, *dstyP;
|
||||
unsigned char *srcyP, *srcP;
|
||||
int *srcLUT = NULL;
|
||||
@@ -80,12 +130,20 @@ Java_sun_awt_image_ImageRepresentation_s
|
||||
|
||||
if (JNU_IsNull(env, jlut)) {
|
||||
JNU_ThrowNullPointerException(env, "NullPointerException");
|
||||
- return;
|
||||
+ return JNI_FALSE;
|
||||
}
|
||||
|
||||
if (JNU_IsNull(env, jpix)) {
|
||||
JNU_ThrowNullPointerException(env, "NullPointerException");
|
||||
- return;
|
||||
+ return JNI_FALSE;
|
||||
+ }
|
||||
+
|
||||
+ if (x < 0 || w < 1 || (0x7fffffff - x) < w) {
|
||||
+ return JNI_FALSE;
|
||||
+ }
|
||||
+
|
||||
+ if (y < 0 || h < 1 || (0x7fffffff - y) < h) {
|
||||
+ return JNI_FALSE;
|
||||
}
|
||||
|
||||
sStride = (*env)->GetIntField(env, jict, g_ICRscanstrID);
|
||||
@@ -93,10 +151,47 @@ Java_sun_awt_image_ImageRepresentation_s
|
||||
joffs = (*env)->GetObjectField(env, jict, g_ICRdataOffsetsID);
|
||||
jdata = (*env)->GetObjectField(env, jict, g_ICRdataID);
|
||||
|
||||
+ if (JNU_IsNull(env, jdata)) {
|
||||
+ /* no destination buffer */
|
||||
+ return JNI_FALSE;
|
||||
+ }
|
||||
+
|
||||
+ if (JNU_IsNull(env, joffs) || (*env)->GetArrayLength(env, joffs) < 1) {
|
||||
+ /* invalid data offstes in raster */
|
||||
+ return JNI_FALSE;
|
||||
+ }
|
||||
+
|
||||
+ srcDataLength = (*env)->GetArrayLength(env, jpix);
|
||||
+ dstDataLength = (*env)->GetArrayLength(env, jdata);
|
||||
+
|
||||
+ cOffs = (int *) (*env)->GetPrimitiveArrayCritical(env, joffs, NULL);
|
||||
+ if (cOffs == NULL) {
|
||||
+ JNU_ThrowNullPointerException(env, "Null channel offset array");
|
||||
+ return JNI_FALSE;
|
||||
+ }
|
||||
+
|
||||
+ dstDataOff = cOffs[0];
|
||||
+
|
||||
+ /* the offset array is not needed anymore and can be released */
|
||||
+ (*env)->ReleasePrimitiveArrayCritical(env, joffs, cOffs, JNI_ABORT);
|
||||
+ joffs = NULL;
|
||||
+ cOffs = NULL;
|
||||
+
|
||||
+ /* do basic validation: make sure that offsets for
|
||||
+ * first pixel and for last pixel are safe to calculate and use */
|
||||
+ CHECK_STRIDE(y, h, sStride);
|
||||
+ CHECK_STRIDE(x, w, pixelStride);
|
||||
+
|
||||
+ CHECK_DST(x, y);
|
||||
+ CHECK_DST(x + w -1, y + h - 1);
|
||||
+
|
||||
+ /* check source array */
|
||||
+ CHECK_SRC();
|
||||
+
|
||||
srcLUT = (int *) (*env)->GetPrimitiveArrayCritical(env, jlut, NULL);
|
||||
if (srcLUT == NULL) {
|
||||
JNU_ThrowNullPointerException(env, "Null IndexColorModel LUT");
|
||||
- return;
|
||||
+ return JNI_FALSE;
|
||||
}
|
||||
|
||||
srcData = (unsigned char *) (*env)->GetPrimitiveArrayCritical(env, jpix,
|
||||
@@ -104,27 +199,18 @@ Java_sun_awt_image_ImageRepresentation_s
|
||||
if (srcData == NULL) {
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, jlut, srcLUT, JNI_ABORT);
|
||||
JNU_ThrowNullPointerException(env, "Null data array");
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- cOffs = (int *) (*env)->GetPrimitiveArrayCritical(env, joffs, NULL);
|
||||
- if (cOffs == NULL) {
|
||||
- (*env)->ReleasePrimitiveArrayCritical(env, jlut, srcLUT, JNI_ABORT);
|
||||
- (*env)->ReleasePrimitiveArrayCritical(env, jpix, srcData, JNI_ABORT);
|
||||
- JNU_ThrowNullPointerException(env, "Null channel offset array");
|
||||
- return;
|
||||
+ return JNI_FALSE;
|
||||
}
|
||||
|
||||
dstData = (int *) (*env)->GetPrimitiveArrayCritical(env, jdata, NULL);
|
||||
if (dstData == NULL) {
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, jlut, srcLUT, JNI_ABORT);
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, jpix, srcData, JNI_ABORT);
|
||||
- (*env)->ReleasePrimitiveArrayCritical(env, joffs, cOffs, JNI_ABORT);
|
||||
JNU_ThrowNullPointerException(env, "Null tile data array");
|
||||
- return;
|
||||
+ return JNI_FALSE;
|
||||
}
|
||||
|
||||
- dstyP = dstData + cOffs[0] + y*sStride + x*pixelStride;
|
||||
+ dstyP = dstData + dstDataOff + y*sStride + x*pixelStride;
|
||||
srcyP = srcData + off;
|
||||
for (yIdx = 0; yIdx < h; yIdx++, srcyP += scansize, dstyP+=sStride) {
|
||||
srcP = srcyP;
|
||||
@@ -137,12 +223,12 @@ Java_sun_awt_image_ImageRepresentation_s
|
||||
/* Release the locked arrays */
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, jlut, srcLUT, JNI_ABORT);
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, jpix, srcData, JNI_ABORT);
|
||||
- (*env)->ReleasePrimitiveArrayCritical(env, joffs, cOffs, JNI_ABORT);
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, jdata, dstData, JNI_ABORT);
|
||||
|
||||
+ return JNI_TRUE;
|
||||
}
|
||||
|
||||
-JNIEXPORT jint JNICALL
|
||||
+JNIEXPORT jboolean JNICALL
|
||||
Java_sun_awt_image_ImageRepresentation_setDiffICM(JNIEnv *env, jclass cls,
|
||||
jint x, jint y, jint w,
|
||||
jint h, jintArray jlut,
|
||||
@@ -150,7 +236,7 @@ Java_sun_awt_image_ImageRepresentation_s
|
||||
jobject jicm,
|
||||
jbyteArray jpix, jint off,
|
||||
jint scansize,
|
||||
- jobject jbct, jint chanOff)
|
||||
+ jobject jbct, jint dstDataOff)
|
||||
{
|
||||
unsigned int *srcLUT = NULL;
|
||||
unsigned int *newLUT = NULL;
|
||||
@@ -159,6 +245,8 @@ Java_sun_awt_image_ImageRepresentation_s
|
||||
int mapSize;
|
||||
jobject jdata = NULL;
|
||||
jobject jnewlut = NULL;
|
||||
+ jint srcDataLength;
|
||||
+ jint dstDataLength;
|
||||
unsigned char *srcData;
|
||||
unsigned char *dstData;
|
||||
unsigned char *dataP;
|
||||
@@ -174,13 +262,22 @@ Java_sun_awt_image_ImageRepresentation_s
|
||||
|
||||
if (JNU_IsNull(env, jlut)) {
|
||||
JNU_ThrowNullPointerException(env, "NullPointerException");
|
||||
- return 0;
|
||||
+ return JNI_FALSE;
|
||||
}
|
||||
|
||||
if (JNU_IsNull(env, jpix)) {
|
||||
JNU_ThrowNullPointerException(env, "NullPointerException");
|
||||
- return 0;
|
||||
+ return JNI_FALSE;
|
||||
}
|
||||
+
|
||||
+ if (x < 0 || w < 1 || (0x7fffffff - x) < w) {
|
||||
+ return JNI_FALSE;
|
||||
+ }
|
||||
+
|
||||
+ if (y < 0 || h < 1 || (0x7fffffff - y) < h) {
|
||||
+ return JNI_FALSE;
|
||||
+ }
|
||||
+
|
||||
|
||||
sStride = (*env)->GetIntField(env, jbct, g_BCRscanstrID);
|
||||
pixelStride =(*env)->GetIntField(env, jbct, g_BCRpixstrID);
|
||||
@@ -193,14 +290,31 @@ Java_sun_awt_image_ImageRepresentation_s
|
||||
of byte data type, so we have to convert the image data
|
||||
to default representation.
|
||||
*/
|
||||
- return 0;
|
||||
+ return JNI_FALSE;
|
||||
}
|
||||
|
||||
+ if (JNU_IsNull(env, jdata)) {
|
||||
+ /* no destination buffer */
|
||||
+ return JNI_FALSE;
|
||||
+ }
|
||||
+
|
||||
+ srcDataLength = (*env)->GetArrayLength(env, jpix);
|
||||
+ dstDataLength = (*env)->GetArrayLength(env, jdata);
|
||||
+
|
||||
+ CHECK_STRIDE(y, h, sStride);
|
||||
+ CHECK_STRIDE(x, w, pixelStride);
|
||||
+
|
||||
+ CHECK_DST(x, y);
|
||||
+ CHECK_DST(x + w -1, y + h - 1);
|
||||
+
|
||||
+ /* check source array */
|
||||
+ CHECK_SRC();
|
||||
+
|
||||
srcLUT = (unsigned int *) (*env)->GetPrimitiveArrayCritical(env, jlut,
|
||||
NULL);
|
||||
if (srcLUT == NULL) {
|
||||
/* out of memory error already thrown */
|
||||
- return 0;
|
||||
+ return JNI_FALSE;
|
||||
}
|
||||
|
||||
newLUT = (unsigned int *) (*env)->GetPrimitiveArrayCritical(env, jnewlut,
|
||||
@@ -208,7 +323,7 @@ Java_sun_awt_image_ImageRepresentation_s
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, jlut, srcLUT,
|
||||
JNI_ABORT);
|
||||
/* out of memory error already thrown */
|
||||
- return 0;
|
||||
+ return JNI_FALSE;
|
||||
}
|
||||
|
||||
newNumLut = numLut;
|
||||
@@ -219,7 +334,7 @@ Java_sun_awt_image_ImageRepresentation_s
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, jlut, srcLUT,
|
||||
JNI_ABORT);
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, jnewlut, newLUT, JNI_ABORT);
|
||||
- return 0;
|
||||
+ return JNI_FALSE;
|
||||
}
|
||||
|
||||
/* Don't need these any more */
|
||||
@@ -239,7 +354,7 @@ Java_sun_awt_image_ImageRepresentation_s
|
||||
NULL);
|
||||
if (srcData == NULL) {
|
||||
/* out of memory error already thrown */
|
||||
- return 0;
|
||||
+ return JNI_FALSE;
|
||||
}
|
||||
|
||||
dstData = (unsigned char *) (*env)->GetPrimitiveArrayCritical(env, jdata,
|
||||
@@ -247,10 +362,10 @@ Java_sun_awt_image_ImageRepresentation_s
|
||||
if (dstData == NULL) {
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, jpix, srcData, JNI_ABORT);
|
||||
/* out of memory error already thrown */
|
||||
- return 0;
|
||||
+ return JNI_FALSE;
|
||||
}
|
||||
|
||||
- ydataP = dstData + chanOff + y*sStride + x*pixelStride;
|
||||
+ ydataP = dstData + dstDataOff + y*sStride + x*pixelStride;
|
||||
ypixP = srcData + off;
|
||||
|
||||
for (i=0; i < h; i++) {
|
||||
@@ -268,7 +383,7 @@ Java_sun_awt_image_ImageRepresentation_s
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, jpix, srcData, JNI_ABORT);
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, jdata, dstData, JNI_ABORT);
|
||||
|
||||
- return 1;
|
||||
+ return JNI_TRUE;
|
||||
}
|
||||
|
||||
static int compareLUTs(unsigned int *lut1, int numLut1, int transIdx,
|
@ -1,579 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User bae
|
||||
# Date 1361823317 -14400
|
||||
# Node ID d868fe7c7618e5b55eea8dd69ee5d099c71816e0
|
||||
# Parent 6784c9903db7f65a93279ac12b7fc00c57dbaaa5
|
||||
8007667: Better image reading
|
||||
Reviewed-by: prr, jgodinez
|
||||
|
||||
diff --git openjdk/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java openjdk/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
|
||||
--- jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
|
||||
+++ jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
|
||||
@@ -281,12 +281,17 @@
|
||||
* sending warnings to listeners.
|
||||
*/
|
||||
protected void warningOccurred(int code) {
|
||||
- if ((code < 0) || (code > MAX_WARNING)){
|
||||
- throw new InternalError("Invalid warning index");
|
||||
- }
|
||||
- processWarningOccurred
|
||||
- ("com.sun.imageio.plugins.jpeg.JPEGImageReaderResources",
|
||||
- Integer.toString(code));
|
||||
+ cbLock.lock();
|
||||
+ try {
|
||||
+ if ((code < 0) || (code > MAX_WARNING)){
|
||||
+ throw new InternalError("Invalid warning index");
|
||||
+ }
|
||||
+ processWarningOccurred
|
||||
+ ("com.sun.imageio.plugins.jpeg.JPEGImageReaderResources",
|
||||
+ Integer.toString(code));
|
||||
+ } finally {
|
||||
+ cbLock.unlock();
|
||||
+ }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -303,7 +308,12 @@
|
||||
* library warnings from being printed to stderr.
|
||||
*/
|
||||
protected void warningWithMessage(String msg) {
|
||||
- processWarningOccurred(msg);
|
||||
+ cbLock.lock();
|
||||
+ try {
|
||||
+ processWarningOccurred(msg);
|
||||
+ } finally {
|
||||
+ cbLock.unlock();
|
||||
+ }
|
||||
}
|
||||
|
||||
public void setInput(Object input,
|
||||
@@ -312,18 +322,55 @@
|
||||
{
|
||||
setThreadLock();
|
||||
try {
|
||||
+ cbLock.check();
|
||||
+
|
||||
super.setInput(input, seekForwardOnly, ignoreMetadata);
|
||||
this.ignoreMetadata = ignoreMetadata;
|
||||
resetInternalState();
|
||||
iis = (ImageInputStream) input; // Always works
|
||||
- setSource(structPointer, iis);
|
||||
+ setSource(structPointer);
|
||||
} finally {
|
||||
clearThreadLock();
|
||||
}
|
||||
}
|
||||
|
||||
- private native void setSource(long structPointer,
|
||||
- ImageInputStream source);
|
||||
+ /**
|
||||
+ * This method is called from native code in order to fill
|
||||
+ * native input buffer.
|
||||
+ *
|
||||
+ * We block any attempt to change the reading state during this
|
||||
+ * method, in order to prevent a corruption of the native decoder
|
||||
+ * state.
|
||||
+ *
|
||||
+ * @return number of bytes read from the stream.
|
||||
+ */
|
||||
+ private int readInputData(byte[] buf, int off, int len) throws IOException {
|
||||
+ cbLock.lock();
|
||||
+ try {
|
||||
+ return iis.read(buf, off, len);
|
||||
+ } finally {
|
||||
+ cbLock.unlock();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * This method is called from the native code in order to
|
||||
+ * skip requested number of bytes in the input stream.
|
||||
+ *
|
||||
+ * @param n
|
||||
+ * @return
|
||||
+ * @throws IOException
|
||||
+ */
|
||||
+ private long skipInputBytes(long n) throws IOException {
|
||||
+ cbLock.lock();
|
||||
+ try {
|
||||
+ return iis.skipBytes(n);
|
||||
+ } finally {
|
||||
+ cbLock.unlock();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private native void setSource(long structPointer);
|
||||
|
||||
private void checkTablesOnly() throws IOException {
|
||||
if (debug) {
|
||||
@@ -375,6 +422,8 @@
|
||||
public int getNumImages(boolean allowSearch) throws IOException {
|
||||
setThreadLock();
|
||||
try { // locked thread
|
||||
+ cbLock.check();
|
||||
+
|
||||
return getNumImagesOnThread(allowSearch);
|
||||
} finally {
|
||||
clearThreadLock();
|
||||
@@ -574,8 +623,13 @@
|
||||
if (debug) {
|
||||
System.out.println("pushing back " + num + " bytes");
|
||||
}
|
||||
- iis.seek(iis.getStreamPosition()-num);
|
||||
- // The buffer is clear after this, so no need to set haveSeeked.
|
||||
+ cbLock.lock();
|
||||
+ try {
|
||||
+ iis.seek(iis.getStreamPosition()-num);
|
||||
+ // The buffer is clear after this, so no need to set haveSeeked.
|
||||
+ } finally {
|
||||
+ cbLock.unlock();
|
||||
+ }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -645,7 +699,12 @@
|
||||
* Ignore this profile.
|
||||
*/
|
||||
iccCS = null;
|
||||
- warningOccurred(WARNING_IGNORE_INVALID_ICC);
|
||||
+ cbLock.lock();
|
||||
+ try {
|
||||
+ warningOccurred(WARNING_IGNORE_INVALID_ICC);
|
||||
+ } finally {
|
||||
+ cbLock.unlock();
|
||||
+ }
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -680,6 +739,7 @@
|
||||
setThreadLock();
|
||||
try {
|
||||
if (currentImage != imageIndex) {
|
||||
+ cbLock.check();
|
||||
readHeader(imageIndex, true);
|
||||
}
|
||||
return width;
|
||||
@@ -692,6 +752,7 @@
|
||||
setThreadLock();
|
||||
try {
|
||||
if (currentImage != imageIndex) {
|
||||
+ cbLock.check();
|
||||
readHeader(imageIndex, true);
|
||||
}
|
||||
return height;
|
||||
@@ -720,6 +781,8 @@
|
||||
setThreadLock();
|
||||
try {
|
||||
if (currentImage != imageIndex) {
|
||||
+ cbLock.check();
|
||||
+
|
||||
readHeader(imageIndex, true);
|
||||
}
|
||||
|
||||
@@ -743,6 +806,7 @@
|
||||
private Iterator getImageTypesOnThread(int imageIndex)
|
||||
throws IOException {
|
||||
if (currentImage != imageIndex) {
|
||||
+ cbLock.check();
|
||||
readHeader(imageIndex, true);
|
||||
}
|
||||
|
||||
@@ -944,6 +1008,7 @@
|
||||
setThreadLock();
|
||||
try {
|
||||
if (!tablesOnlyChecked) {
|
||||
+ cbLock.check();
|
||||
checkTablesOnly();
|
||||
}
|
||||
return streamMetadata;
|
||||
@@ -964,6 +1029,8 @@
|
||||
return imageMetadata;
|
||||
}
|
||||
|
||||
+ cbLock.check();
|
||||
+
|
||||
gotoImage(imageIndex);
|
||||
|
||||
imageMetadata = new JPEGMetadata(false, false, iis, this);
|
||||
@@ -980,6 +1047,7 @@
|
||||
throws IOException {
|
||||
setThreadLock();
|
||||
try {
|
||||
+ cbLock.check();
|
||||
try {
|
||||
readInternal(imageIndex, param, false);
|
||||
} catch (RuntimeException e) {
|
||||
@@ -1209,58 +1277,63 @@
|
||||
}
|
||||
target.setRect(destROI.x, destROI.y + y, raster);
|
||||
|
||||
- processImageUpdate(image,
|
||||
- destROI.x, destROI.y+y,
|
||||
- raster.getWidth(), 1,
|
||||
- 1, 1,
|
||||
- destinationBands);
|
||||
- if ((y > 0) && (y%progInterval == 0)) {
|
||||
- int height = target.getHeight()-1;
|
||||
- float percentOfPass = ((float)y)/height;
|
||||
- if (progressive) {
|
||||
- if (knownPassCount != UNKNOWN) {
|
||||
- processImageProgress((pass + percentOfPass)*100.0F
|
||||
- / knownPassCount);
|
||||
- } else if (maxProgressivePass != Integer.MAX_VALUE) {
|
||||
- // Use the range of allowed progressive passes
|
||||
- processImageProgress((pass + percentOfPass)*100.0F
|
||||
- / (maxProgressivePass - minProgressivePass + 1));
|
||||
+ cbLock.lock();
|
||||
+ try {
|
||||
+ processImageUpdate(image,
|
||||
+ destROI.x, destROI.y+y,
|
||||
+ raster.getWidth(), 1,
|
||||
+ 1, 1,
|
||||
+ destinationBands);
|
||||
+ if ((y > 0) && (y%progInterval == 0)) {
|
||||
+ int height = target.getHeight()-1;
|
||||
+ float percentOfPass = ((float)y)/height;
|
||||
+ if (progressive) {
|
||||
+ if (knownPassCount != UNKNOWN) {
|
||||
+ processImageProgress((pass + percentOfPass)*100.0F
|
||||
+ / knownPassCount);
|
||||
+ } else if (maxProgressivePass != Integer.MAX_VALUE) {
|
||||
+ // Use the range of allowed progressive passes
|
||||
+ processImageProgress((pass + percentOfPass)*100.0F
|
||||
+ / (maxProgressivePass - minProgressivePass + 1));
|
||||
+ } else {
|
||||
+ // Assume there are a minimum of MIN_ESTIMATED_PASSES
|
||||
+ // and that there is always one more pass
|
||||
+ // Compute the percentage as the percentage at the end
|
||||
+ // of the previous pass, plus the percentage of this
|
||||
+ // pass scaled to be the percentage of the total remaining,
|
||||
+ // assuming a minimum of MIN_ESTIMATED_PASSES passes and
|
||||
+ // that there is always one more pass. This is monotonic
|
||||
+ // and asymptotic to 1.0, which is what we need.
|
||||
+ int remainingPasses = // including this one
|
||||
+ Math.max(2, MIN_ESTIMATED_PASSES-pass);
|
||||
+ int totalPasses = pass + remainingPasses-1;
|
||||
+ progInterval = Math.max(height/20*totalPasses,
|
||||
+ totalPasses);
|
||||
+ if (y%progInterval == 0) {
|
||||
+ percentToDate = previousPassPercentage +
|
||||
+ (1.0F - previousPassPercentage)
|
||||
+ * (percentOfPass)/remainingPasses;
|
||||
+ if (debug) {
|
||||
+ System.out.print("pass= " + pass);
|
||||
+ System.out.print(", y= " + y);
|
||||
+ System.out.print(", progInt= " + progInterval);
|
||||
+ System.out.print(", % of pass: " + percentOfPass);
|
||||
+ System.out.print(", rem. passes: "
|
||||
+ + remainingPasses);
|
||||
+ System.out.print(", prev%: "
|
||||
+ + previousPassPercentage);
|
||||
+ System.out.print(", %ToDate: " + percentToDate);
|
||||
+ System.out.print(" ");
|
||||
+ }
|
||||
+ processImageProgress(percentToDate*100.0F);
|
||||
+ }
|
||||
+ }
|
||||
} else {
|
||||
- // Assume there are a minimum of MIN_ESTIMATED_PASSES
|
||||
- // and that there is always one more pass
|
||||
- // Compute the percentage as the percentage at the end
|
||||
- // of the previous pass, plus the percentage of this
|
||||
- // pass scaled to be the percentage of the total remaining,
|
||||
- // assuming a minimum of MIN_ESTIMATED_PASSES passes and
|
||||
- // that there is always one more pass. This is monotonic
|
||||
- // and asymptotic to 1.0, which is what we need.
|
||||
- int remainingPasses = // including this one
|
||||
- Math.max(2, MIN_ESTIMATED_PASSES-pass);
|
||||
- int totalPasses = pass + remainingPasses-1;
|
||||
- progInterval = Math.max(height/20*totalPasses,
|
||||
- totalPasses);
|
||||
- if (y%progInterval == 0) {
|
||||
- percentToDate = previousPassPercentage +
|
||||
- (1.0F - previousPassPercentage)
|
||||
- * (percentOfPass)/remainingPasses;
|
||||
- if (debug) {
|
||||
- System.out.print("pass= " + pass);
|
||||
- System.out.print(", y= " + y);
|
||||
- System.out.print(", progInt= " + progInterval);
|
||||
- System.out.print(", % of pass: " + percentOfPass);
|
||||
- System.out.print(", rem. passes: "
|
||||
- + remainingPasses);
|
||||
- System.out.print(", prev%: "
|
||||
- + previousPassPercentage);
|
||||
- System.out.print(", %ToDate: " + percentToDate);
|
||||
- System.out.print(" ");
|
||||
- }
|
||||
- processImageProgress(percentToDate*100.0F);
|
||||
- }
|
||||
+ processImageProgress(percentOfPass * 100.0F);
|
||||
}
|
||||
- } else {
|
||||
- processImageProgress(percentOfPass * 100.0F);
|
||||
- }
|
||||
+ }
|
||||
+ } finally {
|
||||
+ cbLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1273,33 +1346,58 @@
|
||||
}
|
||||
|
||||
private void passStarted (int pass) {
|
||||
- this.pass = pass;
|
||||
- previousPassPercentage = percentToDate;
|
||||
- processPassStarted(image,
|
||||
- pass,
|
||||
- minProgressivePass,
|
||||
- maxProgressivePass,
|
||||
- 0, 0,
|
||||
- 1,1,
|
||||
- destinationBands);
|
||||
+ cbLock.lock();
|
||||
+ try {
|
||||
+ this.pass = pass;
|
||||
+ previousPassPercentage = percentToDate;
|
||||
+ processPassStarted(image,
|
||||
+ pass,
|
||||
+ minProgressivePass,
|
||||
+ maxProgressivePass,
|
||||
+ 0, 0,
|
||||
+ 1,1,
|
||||
+ destinationBands);
|
||||
+ } finally {
|
||||
+ cbLock.unlock();
|
||||
+ }
|
||||
}
|
||||
|
||||
private void passComplete () {
|
||||
- processPassComplete(image);
|
||||
+ cbLock.lock();
|
||||
+ try {
|
||||
+ processPassComplete(image);
|
||||
+ } finally {
|
||||
+ cbLock.unlock();
|
||||
+ }
|
||||
}
|
||||
|
||||
void thumbnailStarted(int thumbnailIndex) {
|
||||
- processThumbnailStarted(currentImage, thumbnailIndex);
|
||||
+ cbLock.lock();
|
||||
+ try {
|
||||
+ processThumbnailStarted(currentImage, thumbnailIndex);
|
||||
+ } finally {
|
||||
+ cbLock.unlock();
|
||||
+ }
|
||||
}
|
||||
|
||||
// Provide access to protected superclass method
|
||||
void thumbnailProgress(float percentageDone) {
|
||||
- processThumbnailProgress(percentageDone);
|
||||
+ cbLock.lock();
|
||||
+ try {
|
||||
+ processThumbnailProgress(percentageDone);
|
||||
+ } finally {
|
||||
+ cbLock.unlock();
|
||||
+ }
|
||||
}
|
||||
|
||||
// Provide access to protected superclass method
|
||||
void thumbnailComplete() {
|
||||
- processThumbnailComplete();
|
||||
+ cbLock.lock();
|
||||
+ try {
|
||||
+ processThumbnailComplete();
|
||||
+ } finally {
|
||||
+ cbLock.unlock();
|
||||
+ }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1323,6 +1421,11 @@
|
||||
public void abort() {
|
||||
setThreadLock();
|
||||
try {
|
||||
+ /**
|
||||
+ * NB: we do not check the call back lock here,
|
||||
+ * we allow to abort the reader any time.
|
||||
+ */
|
||||
+
|
||||
super.abort();
|
||||
abortRead(structPointer);
|
||||
} finally {
|
||||
@@ -1345,6 +1448,7 @@
|
||||
setThreadLock();
|
||||
Raster retval = null;
|
||||
try {
|
||||
+ cbLock.check();
|
||||
/*
|
||||
* This could be further optimized by not resetting the dest.
|
||||
* offset and creating a translated raster in readInternal()
|
||||
@@ -1384,6 +1488,8 @@
|
||||
public int getNumThumbnails(int imageIndex) throws IOException {
|
||||
setThreadLock();
|
||||
try {
|
||||
+ cbLock.check();
|
||||
+
|
||||
getImageMetadata(imageIndex); // checks iis state for us
|
||||
// Now check the jfif segments
|
||||
JFIFMarkerSegment jfif =
|
||||
@@ -1404,6 +1510,8 @@
|
||||
throws IOException {
|
||||
setThreadLock();
|
||||
try {
|
||||
+ cbLock.check();
|
||||
+
|
||||
if ((thumbnailIndex < 0)
|
||||
|| (thumbnailIndex >= getNumThumbnails(imageIndex))) {
|
||||
throw new IndexOutOfBoundsException("No such thumbnail");
|
||||
@@ -1422,6 +1530,8 @@
|
||||
throws IOException {
|
||||
setThreadLock();
|
||||
try {
|
||||
+ cbLock.check();
|
||||
+
|
||||
if ((thumbnailIndex < 0)
|
||||
|| (thumbnailIndex >= getNumThumbnails(imageIndex))) {
|
||||
throw new IndexOutOfBoundsException("No such thumbnail");
|
||||
@@ -1441,6 +1551,8 @@
|
||||
throws IOException {
|
||||
setThreadLock();
|
||||
try {
|
||||
+ cbLock.check();
|
||||
+
|
||||
if ((thumbnailIndex < 0)
|
||||
|| (thumbnailIndex >= getNumThumbnails(imageIndex))) {
|
||||
throw new IndexOutOfBoundsException("No such thumbnail");
|
||||
@@ -1481,6 +1593,7 @@
|
||||
public void reset() {
|
||||
setThreadLock();
|
||||
try {
|
||||
+ cbLock.check();
|
||||
super.reset();
|
||||
} finally {
|
||||
clearThreadLock();
|
||||
@@ -1492,6 +1605,8 @@
|
||||
public void dispose() {
|
||||
setThreadLock();
|
||||
try {
|
||||
+ cbLock.check();
|
||||
+
|
||||
if (structPointer != 0) {
|
||||
disposerRecord.dispose();
|
||||
structPointer = 0;
|
||||
@@ -1553,4 +1668,34 @@
|
||||
theThread = null;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ private CallBackLock cbLock = new CallBackLock();
|
||||
+
|
||||
+ private static class CallBackLock {
|
||||
+
|
||||
+ private State lockState;
|
||||
+
|
||||
+ CallBackLock() {
|
||||
+ lockState = State.Unlocked;
|
||||
+ }
|
||||
+
|
||||
+ void check() {
|
||||
+ if (lockState != State.Unlocked) {
|
||||
+ throw new IllegalStateException("Access to the reader is not allowed");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private void lock() {
|
||||
+ lockState = State.Locked;
|
||||
+ }
|
||||
+
|
||||
+ private void unlock() {
|
||||
+ lockState = State.Unlocked;
|
||||
+ }
|
||||
+
|
||||
+ private static enum State {
|
||||
+ Unlocked,
|
||||
+ Locked
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
diff --git openjdk/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c openjdk/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
|
||||
--- jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
|
||||
+++ jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
|
||||
@@ -57,8 +57,8 @@
|
||||
#define MAX(a,b) ((a) > (b) ? (a) : (b))
|
||||
|
||||
/* Cached Java method ids */
|
||||
-static jmethodID ImageInputStream_readID;
|
||||
-static jmethodID ImageInputStream_skipBytesID;
|
||||
+static jmethodID JPEGImageReader_readInputDataID;
|
||||
+static jmethodID JPEGImageReader_skipInputBytesID;
|
||||
static jmethodID JPEGImageReader_warningOccurredID;
|
||||
static jmethodID JPEGImageReader_warningWithMessageID;
|
||||
static jmethodID JPEGImageReader_setImageDataID;
|
||||
@@ -923,7 +923,7 @@ imageio_fill_input_buffer(j_decompress_p
|
||||
RELEASE_ARRAYS(env, data, src->next_input_byte);
|
||||
ret = (*env)->CallIntMethod(env,
|
||||
sb->stream,
|
||||
- ImageInputStream_readID,
|
||||
+ JPEGImageReader_readInputDataID,
|
||||
sb->hstreamBuffer, 0,
|
||||
sb->bufferLength);
|
||||
if ((*env)->ExceptionOccurred(env)
|
||||
@@ -1013,7 +1013,7 @@ imageio_fill_suspended_buffer(j_decompre
|
||||
}
|
||||
|
||||
ret = (*env)->CallIntMethod(env, sb->stream,
|
||||
- ImageInputStream_readID,
|
||||
+ JPEGImageReader_readInputDataID,
|
||||
sb->hstreamBuffer,
|
||||
offset, buflen);
|
||||
if ((*env)->ExceptionOccurred(env)
|
||||
@@ -1107,7 +1107,7 @@ imageio_skip_input_data(j_decompress_ptr
|
||||
RELEASE_ARRAYS(env, data, src->next_input_byte);
|
||||
ret = (*env)->CallLongMethod(env,
|
||||
sb->stream,
|
||||
- ImageInputStream_skipBytesID,
|
||||
+ JPEGImageReader_skipInputBytesID,
|
||||
(jlong) num_bytes);
|
||||
if ((*env)->ExceptionOccurred(env)
|
||||
|| !GET_ARRAYS(env, data, &(src->next_input_byte))) {
|
||||
@@ -1382,13 +1382,13 @@ Java_com_sun_imageio_plugins_jpeg_JPEGIm
|
||||
jclass qTableClass,
|
||||
jclass huffClass) {
|
||||
|
||||
- ImageInputStream_readID = (*env)->GetMethodID(env,
|
||||
- ImageInputStreamClass,
|
||||
- "read",
|
||||
+ JPEGImageReader_readInputDataID = (*env)->GetMethodID(env,
|
||||
+ cls,
|
||||
+ "readInputData",
|
||||
"([BII)I");
|
||||
- ImageInputStream_skipBytesID = (*env)->GetMethodID(env,
|
||||
- ImageInputStreamClass,
|
||||
- "skipBytes",
|
||||
+ JPEGImageReader_skipInputBytesID = (*env)->GetMethodID(env,
|
||||
+ cls,
|
||||
+ "skipInputBytes",
|
||||
"(J)J");
|
||||
JPEGImageReader_warningOccurredID = (*env)->GetMethodID(env,
|
||||
cls,
|
||||
@@ -1531,8 +1531,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGIm
|
||||
Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_setSource
|
||||
(JNIEnv *env,
|
||||
jobject this,
|
||||
- jlong ptr,
|
||||
- jobject source) {
|
||||
+ jlong ptr) {
|
||||
|
||||
imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
|
||||
j_common_ptr cinfo;
|
||||
@@ -1546,7 +1545,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGIm
|
||||
|
||||
cinfo = data->jpegObj;
|
||||
|
||||
- imageio_set_stream(env, cinfo, data, source);
|
||||
+ imageio_set_stream(env, cinfo, data, this);
|
||||
|
||||
imageio_init_source((j_decompress_ptr) cinfo);
|
||||
}
|
@ -1,357 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User bae
|
||||
# Date 1361827637 -14400
|
||||
# Node ID 90c9f1577a0b09128174b4d26404b438585428c5
|
||||
# Parent d868fe7c7618e5b55eea8dd69ee5d099c71816e0
|
||||
8007918: Better image writing
|
||||
Reviewed-by: prr, jgodinez
|
||||
|
||||
diff --git openjdk/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java openjdk/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java
|
||||
--- jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java
|
||||
+++ jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java
|
||||
@@ -178,8 +178,7 @@ public class JPEGImageWriter extends Ima
|
||||
static {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.LoadLibraryAction("jpeg"));
|
||||
- initWriterIDs(ImageOutputStream.class,
|
||||
- JPEGQTable.class,
|
||||
+ initWriterIDs(JPEGQTable.class,
|
||||
JPEGHuffmanTable.class);
|
||||
}
|
||||
|
||||
@@ -195,11 +194,13 @@ public class JPEGImageWriter extends Ima
|
||||
public void setOutput(Object output) {
|
||||
setThreadLock();
|
||||
try {
|
||||
+ cbLock.check();
|
||||
+
|
||||
super.setOutput(output); // validates output
|
||||
resetInternalState();
|
||||
ios = (ImageOutputStream) output; // so this will always work
|
||||
// Set the native destination
|
||||
- setDest(structPointer, ios);
|
||||
+ setDest(structPointer);
|
||||
} finally {
|
||||
clearThreadLock();
|
||||
}
|
||||
@@ -354,6 +355,8 @@ public class JPEGImageWriter extends Ima
|
||||
ImageWriteParam param) throws IOException {
|
||||
setThreadLock();
|
||||
try {
|
||||
+ cbLock.check();
|
||||
+
|
||||
writeOnThread(streamMetadata, image, param);
|
||||
} finally {
|
||||
clearThreadLock();
|
||||
@@ -1077,13 +1080,18 @@ public class JPEGImageWriter extends Ima
|
||||
haveMetadata,
|
||||
restartInterval);
|
||||
|
||||
- if (aborted) {
|
||||
- processWriteAborted();
|
||||
- } else {
|
||||
- processImageComplete();
|
||||
+ cbLock.lock();
|
||||
+ try {
|
||||
+ if (aborted) {
|
||||
+ processWriteAborted();
|
||||
+ } else {
|
||||
+ processImageComplete();
|
||||
+ }
|
||||
+
|
||||
+ ios.flush();
|
||||
+ } finally {
|
||||
+ cbLock.unlock();
|
||||
}
|
||||
-
|
||||
- ios.flush();
|
||||
currentImage++; // After a successful write
|
||||
}
|
||||
|
||||
@@ -1091,6 +1099,8 @@ public class JPEGImageWriter extends Ima
|
||||
throws IOException {
|
||||
setThreadLock();
|
||||
try {
|
||||
+ cbLock.check();
|
||||
+
|
||||
prepareWriteSequenceOnThread(streamMetadata);
|
||||
} finally {
|
||||
clearThreadLock();
|
||||
@@ -1170,6 +1180,8 @@ public class JPEGImageWriter extends Ima
|
||||
throws IOException {
|
||||
setThreadLock();
|
||||
try {
|
||||
+ cbLock.check();
|
||||
+
|
||||
if (sequencePrepared == false) {
|
||||
throw new IllegalStateException("sequencePrepared not called!");
|
||||
}
|
||||
@@ -1183,6 +1195,8 @@ public class JPEGImageWriter extends Ima
|
||||
public void endWriteSequence() throws IOException {
|
||||
setThreadLock();
|
||||
try {
|
||||
+ cbLock.check();
|
||||
+
|
||||
if (sequencePrepared == false) {
|
||||
throw new IllegalStateException("sequencePrepared not called!");
|
||||
}
|
||||
@@ -1195,6 +1209,10 @@ public class JPEGImageWriter extends Ima
|
||||
public synchronized void abort() {
|
||||
setThreadLock();
|
||||
try {
|
||||
+ /**
|
||||
+ * NB: we do not check the call back lock here, we allow to abort
|
||||
+ * the reader any time.
|
||||
+ */
|
||||
super.abort();
|
||||
abortWrite(structPointer);
|
||||
} finally {
|
||||
@@ -1218,6 +1236,8 @@ public class JPEGImageWriter extends Ima
|
||||
public void reset() {
|
||||
setThreadLock();
|
||||
try {
|
||||
+ cbLock.check();
|
||||
+
|
||||
super.reset();
|
||||
} finally {
|
||||
clearThreadLock();
|
||||
@@ -1227,6 +1247,8 @@ public class JPEGImageWriter extends Ima
|
||||
public void dispose() {
|
||||
setThreadLock();
|
||||
try {
|
||||
+ cbLock.check();
|
||||
+
|
||||
if (structPointer != 0) {
|
||||
disposerRecord.dispose();
|
||||
structPointer = 0;
|
||||
@@ -1246,13 +1268,18 @@ public class JPEGImageWriter extends Ima
|
||||
* sending warnings to listeners.
|
||||
*/
|
||||
void warningOccurred(int code) {
|
||||
- if ((code < 0) || (code > MAX_WARNING)){
|
||||
- throw new InternalError("Invalid warning index");
|
||||
+ cbLock.lock();
|
||||
+ try {
|
||||
+ if ((code < 0) || (code > MAX_WARNING)){
|
||||
+ throw new InternalError("Invalid warning index");
|
||||
+ }
|
||||
+ processWarningOccurred
|
||||
+ (currentImage,
|
||||
+ "com.sun.imageio.plugins.jpeg.JPEGImageWriterResources",
|
||||
+ Integer.toString(code));
|
||||
+ } finally {
|
||||
+ cbLock.unlock();
|
||||
}
|
||||
- processWarningOccurred
|
||||
- (currentImage,
|
||||
- "com.sun.imageio.plugins.jpeg.JPEGImageWriterResources",
|
||||
- Integer.toString(code));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1269,21 +1296,41 @@ public class JPEGImageWriter extends Ima
|
||||
* library warnings from being printed to stderr.
|
||||
*/
|
||||
void warningWithMessage(String msg) {
|
||||
- processWarningOccurred(currentImage, msg);
|
||||
+ cbLock.lock();
|
||||
+ try {
|
||||
+ processWarningOccurred(currentImage, msg);
|
||||
+ } finally {
|
||||
+ cbLock.unlock();
|
||||
+ }
|
||||
}
|
||||
|
||||
void thumbnailStarted(int thumbnailIndex) {
|
||||
- processThumbnailStarted(currentImage, thumbnailIndex);
|
||||
+ cbLock.lock();
|
||||
+ try {
|
||||
+ processThumbnailStarted(currentImage, thumbnailIndex);
|
||||
+ } finally {
|
||||
+ cbLock.unlock();
|
||||
+ }
|
||||
}
|
||||
|
||||
// Provide access to protected superclass method
|
||||
void thumbnailProgress(float percentageDone) {
|
||||
- processThumbnailProgress(percentageDone);
|
||||
+ cbLock.lock();
|
||||
+ try {
|
||||
+ processThumbnailProgress(percentageDone);
|
||||
+ } finally {
|
||||
+ cbLock.unlock();
|
||||
+ }
|
||||
}
|
||||
|
||||
// Provide access to protected superclass method
|
||||
void thumbnailComplete() {
|
||||
- processThumbnailComplete();
|
||||
+ cbLock.lock();
|
||||
+ try {
|
||||
+ processThumbnailComplete();
|
||||
+ } finally {
|
||||
+ cbLock.unlock();
|
||||
+ }
|
||||
}
|
||||
|
||||
///////// End of Package-access API
|
||||
@@ -1610,16 +1657,14 @@ public class JPEGImageWriter extends Ima
|
||||
////////////// Native methods and callbacks
|
||||
|
||||
/** Sets up static native structures. */
|
||||
- private static native void initWriterIDs(Class iosClass,
|
||||
- Class qTableClass,
|
||||
+ private static native void initWriterIDs(Class qTableClass,
|
||||
Class huffClass);
|
||||
|
||||
/** Sets up per-writer native structure and returns a pointer to it. */
|
||||
private native long initJPEGImageWriter();
|
||||
|
||||
/** Sets up native structures for output stream */
|
||||
- private native void setDest(long structPointer,
|
||||
- ImageOutputStream ios);
|
||||
+ private native void setDest(long structPointer);
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if the write was aborted.
|
||||
@@ -1744,7 +1789,12 @@ public class JPEGImageWriter extends Ima
|
||||
}
|
||||
raster.setRect(sourceLine);
|
||||
if ((y > 7) && (y%8 == 0)) { // Every 8 scanlines
|
||||
- processImageProgress((float) y / (float) sourceHeight * 100.0F);
|
||||
+ cbLock.lock();
|
||||
+ try {
|
||||
+ processImageProgress((float) y / (float) sourceHeight * 100.0F);
|
||||
+ } finally {
|
||||
+ cbLock.unlock();
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1769,6 +1819,25 @@ public class JPEGImageWriter extends Ima
|
||||
disposeWriter(pData);
|
||||
pData = 0;
|
||||
}
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * This method is called from native code in order to write encoder
|
||||
+ * output to the destination.
|
||||
+ *
|
||||
+ * We block any attempt to change the writer state during this
|
||||
+ * method, in order to prevent a corruption of the native encoder
|
||||
+ * state.
|
||||
+ */
|
||||
+ private void writeOutputData(byte[] data, int offset, int len)
|
||||
+ throws IOException
|
||||
+ {
|
||||
+ cbLock.lock();
|
||||
+ try {
|
||||
+ ios.write(data, offset, len);
|
||||
+ } finally {
|
||||
+ cbLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1806,4 +1875,34 @@ public class JPEGImageWriter extends Ima
|
||||
theThread = null;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ private CallBackLock cbLock = new CallBackLock();
|
||||
+
|
||||
+ private static class CallBackLock {
|
||||
+
|
||||
+ private State lockState;
|
||||
+
|
||||
+ CallBackLock() {
|
||||
+ lockState = State.Unlocked;
|
||||
+ }
|
||||
+
|
||||
+ void check() {
|
||||
+ if (lockState != State.Unlocked) {
|
||||
+ throw new IllegalStateException("Access to the writer is not allowed");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private void lock() {
|
||||
+ lockState = State.Locked;
|
||||
+ }
|
||||
+
|
||||
+ private void unlock() {
|
||||
+ lockState = State.Unlocked;
|
||||
+ }
|
||||
+
|
||||
+ private static enum State {
|
||||
+ Unlocked,
|
||||
+ Locked
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
diff --git openjdk/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c openjdk/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
|
||||
--- jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
|
||||
+++ jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
|
||||
@@ -66,7 +66,7 @@ static jmethodID JPEGImageReader_pushBac
|
||||
static jmethodID JPEGImageReader_pushBackID;
|
||||
static jmethodID JPEGImageReader_passStartedID;
|
||||
static jmethodID JPEGImageReader_passCompleteID;
|
||||
-static jmethodID ImageOutputStream_writeID;
|
||||
+static jmethodID JPEGImageWriter_writeOutputDataID;
|
||||
static jmethodID JPEGImageWriter_warningOccurredID;
|
||||
static jmethodID JPEGImageWriter_warningWithMessageID;
|
||||
static jmethodID JPEGImageWriter_writeMetadataID;
|
||||
@@ -2290,7 +2290,7 @@ imageio_empty_output_buffer (j_compress_
|
||||
|
||||
(*env)->CallVoidMethod(env,
|
||||
sb->stream,
|
||||
- ImageOutputStream_writeID,
|
||||
+ JPEGImageWriter_writeOutputDataID,
|
||||
sb->hstreamBuffer,
|
||||
0,
|
||||
sb->bufferLength);
|
||||
@@ -2327,7 +2327,7 @@ imageio_term_destination (j_compress_ptr
|
||||
|
||||
(*env)->CallVoidMethod(env,
|
||||
sb->stream,
|
||||
- ImageOutputStream_writeID,
|
||||
+ JPEGImageWriter_writeOutputDataID,
|
||||
sb->hstreamBuffer,
|
||||
0,
|
||||
datacount);
|
||||
@@ -2365,13 +2365,12 @@ Java_com_sun_imageio_plugins_jpeg_JPEGIm
|
||||
Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_initWriterIDs
|
||||
(JNIEnv *env,
|
||||
jclass cls,
|
||||
- jclass IOSClass,
|
||||
jclass qTableClass,
|
||||
jclass huffClass) {
|
||||
|
||||
- ImageOutputStream_writeID = (*env)->GetMethodID(env,
|
||||
- IOSClass,
|
||||
- "write",
|
||||
+ JPEGImageWriter_writeOutputDataID = (*env)->GetMethodID(env,
|
||||
+ cls,
|
||||
+ "writeOutputData",
|
||||
"([BII)V");
|
||||
|
||||
JPEGImageWriter_warningOccurredID = (*env)->GetMethodID(env,
|
||||
@@ -2495,8 +2494,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGIm
|
||||
Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_setDest
|
||||
(JNIEnv *env,
|
||||
jobject this,
|
||||
- jlong ptr,
|
||||
- jobject destination) {
|
||||
+ jlong ptr) {
|
||||
|
||||
imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
|
||||
j_compress_ptr cinfo;
|
||||
@@ -2510,7 +2508,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGIm
|
||||
|
||||
cinfo = (j_compress_ptr) data->jpegObj;
|
||||
|
||||
- imageio_set_stream(env, data->jpegObj, data, destination);
|
||||
+ imageio_set_stream(env, data->jpegObj, data, this);
|
||||
|
||||
|
||||
// Don't call the init method, as that depends on pinned arrays
|
@ -1,67 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User chegar
|
||||
# Date 1362305505 0
|
||||
# Node ID 98ad2f1e25d13aca196ad77b2f227f85072c9b16
|
||||
# Parent 17ac71e7b72087f0f7b7ac793ae93a816ef22d96
|
||||
8009063: Improve reliability of ConcurrentHashMap
|
||||
Reviewed-by: alanb, ahgross
|
||||
|
||||
diff --git a/src/share/classes/java/util/concurrent/ConcurrentHashMap.java b/src/share/classes/java/util/concurrent/ConcurrentHashMap.java
|
||||
--- jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java
|
||||
+++ jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java
|
||||
@@ -40,6 +40,7 @@ import java.io.IOException;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
+import java.io.ObjectStreamField;
|
||||
|
||||
/**
|
||||
* A hash table supporting full concurrency of retrievals and
|
||||
@@ -1535,7 +1536,23 @@ public class ConcurrentHashMap<K, V> ext
|
||||
@SuppressWarnings("unchecked")
|
||||
private void readObject(java.io.ObjectInputStream s)
|
||||
throws IOException, ClassNotFoundException {
|
||||
- s.defaultReadObject();
|
||||
+ // Don't call defaultReadObject()
|
||||
+ ObjectInputStream.GetField oisFields = s.readFields();
|
||||
+ final Segment<K,V>[] oisSegments = (Segment<K,V>[])oisFields.get("segments", null);
|
||||
+
|
||||
+ final int ssize = oisSegments.length;
|
||||
+ if (ssize < 1 || ssize > MAX_SEGMENTS
|
||||
+ || (ssize & (ssize-1)) != 0 ) // ssize not power of two
|
||||
+ throw new java.io.InvalidObjectException("Bad number of segments:"
|
||||
+ + ssize);
|
||||
+ int sshift = 0, ssizeTmp = ssize;
|
||||
+ while (ssizeTmp > 1) {
|
||||
+ ++sshift;
|
||||
+ ssizeTmp >>>= 1;
|
||||
+ }
|
||||
+ UNSAFE.putIntVolatile(this, SEGSHIFT_OFFSET, 32 - sshift);
|
||||
+ UNSAFE.putIntVolatile(this, SEGMASK_OFFSET, ssize - 1);
|
||||
+ UNSAFE.putObjectVolatile(this, SEGMENTS_OFFSET, oisSegments);
|
||||
|
||||
// set hashMask
|
||||
UNSAFE.putIntVolatile(this, HASHSEED_OFFSET, randomHashSeed(this));
|
||||
@@ -1568,6 +1585,9 @@ public class ConcurrentHashMap<K, V> ext
|
||||
private static final int SSHIFT;
|
||||
private static final long TBASE;
|
||||
private static final int TSHIFT;
|
||||
+ private static final long SEGSHIFT_OFFSET;
|
||||
+ private static final long SEGMASK_OFFSET;
|
||||
+ private static final long SEGMENTS_OFFSET;
|
||||
|
||||
static {
|
||||
int ss, ts;
|
||||
@@ -1581,6 +1601,12 @@ public class ConcurrentHashMap<K, V> ext
|
||||
SBASE = UNSAFE.arrayBaseOffset(sc);
|
||||
ts = UNSAFE.arrayIndexScale(tc);
|
||||
ss = UNSAFE.arrayIndexScale(sc);
|
||||
+ SEGSHIFT_OFFSET = UNSAFE.objectFieldOffset(
|
||||
+ ConcurrentHashMap.class.getDeclaredField("segmentShift"));
|
||||
+ SEGMASK_OFFSET = UNSAFE.objectFieldOffset(
|
||||
+ ConcurrentHashMap.class.getDeclaredField("segmentMask"));
|
||||
+ SEGMENTS_OFFSET = UNSAFE.objectFieldOffset(
|
||||
+ ConcurrentHashMap.class.getDeclaredField("segments"));
|
||||
} catch (Exception e) {
|
||||
throw new Error(e);
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User dfuchs
|
||||
# Date 1363278452 -3600
|
||||
# Node ID 31c782610044b0f04f981c2b97355804a1c57407
|
||||
# Parent 87bacc5ee8e430aadd200ae13a2d15fe9c8f4350
|
||||
8009305: Improve AWT data transfer
|
||||
Reviewed-by: art, skoivu, smarks, ant
|
||||
|
||||
diff --git openjdk/jdk/src/share/classes/sun/awt/datatransfer/TransferableProxy.java openjdk/jdk/src/share/classes/sun/awt/datatransfer/TransferableProxy.java
|
||||
--- jdk/src/share/classes/sun/awt/datatransfer/TransferableProxy.java
|
||||
+++ jdk/src/share/classes/sun/awt/datatransfer/TransferableProxy.java
|
||||
@@ -102,11 +102,11 @@ public class TransferableProxy implement
|
||||
protected final boolean isLocal;
|
||||
}
|
||||
|
||||
-class ClassLoaderObjectOutputStream extends ObjectOutputStream {
|
||||
+final class ClassLoaderObjectOutputStream extends ObjectOutputStream {
|
||||
private final Map<Set<String>, ClassLoader> map =
|
||||
new HashMap<Set<String>, ClassLoader>();
|
||||
|
||||
- public ClassLoaderObjectOutputStream(OutputStream os) throws IOException {
|
||||
+ ClassLoaderObjectOutputStream(OutputStream os) throws IOException {
|
||||
super(os);
|
||||
}
|
||||
|
||||
@@ -140,15 +140,15 @@ class ClassLoaderObjectOutputStream exte
|
||||
map.put(s, classLoader);
|
||||
}
|
||||
|
||||
- public Map<Set<String>, ClassLoader> getClassLoaderMap() {
|
||||
+ Map<Set<String>, ClassLoader> getClassLoaderMap() {
|
||||
return new HashMap(map);
|
||||
}
|
||||
}
|
||||
|
||||
-class ClassLoaderObjectInputStream extends ObjectInputStream {
|
||||
+final class ClassLoaderObjectInputStream extends ObjectInputStream {
|
||||
private final Map<Set<String>, ClassLoader> map;
|
||||
|
||||
- public ClassLoaderObjectInputStream(InputStream is,
|
||||
+ ClassLoaderObjectInputStream(InputStream is,
|
||||
Map<Set<String>, ClassLoader> map)
|
||||
throws IOException {
|
||||
super(is);
|
||||
@@ -166,8 +166,11 @@ class ClassLoaderObjectInputStream exten
|
||||
s.add(className);
|
||||
|
||||
ClassLoader classLoader = map.get(s);
|
||||
-
|
||||
- return Class.forName(className, false, classLoader);
|
||||
+ if (classLoader != null) {
|
||||
+ return Class.forName(className, false, classLoader);
|
||||
+ } else {
|
||||
+ return super.resolveClass(classDesc);
|
||||
+ }
|
||||
}
|
||||
|
||||
protected Class<?> resolveProxyClass(String[] interfaces)
|
||||
@@ -179,6 +182,9 @@ class ClassLoaderObjectInputStream exten
|
||||
}
|
||||
|
||||
ClassLoader classLoader = map.get(s);
|
||||
+ if (classLoader == null) {
|
||||
+ return super.resolveProxyClass(interfaces);
|
||||
+ }
|
||||
|
||||
// The code below is mostly copied from the superclass.
|
||||
ClassLoader nonPublicLoader = null;
|
@ -1,25 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User andrew
|
||||
# Date 1365790031 -3600
|
||||
# Node ID e95f24ac8e1e3c54e389b55c6992a8fc0266a698
|
||||
# Parent ef36be1ae9bc7d061721f8890797e5d89c901846
|
||||
8009699: Methodhandle lookup
|
||||
Reviewed-by: ahgross, jrose, jdn
|
||||
|
||||
diff --git a/src/share/vm/prims/methodHandles.cpp b/src/share/vm/prims/methodHandles.cpp
|
||||
--- hotspot/src/share/vm/prims/methodHandles.cpp
|
||||
+++ hotspot/src/share/vm/prims/methodHandles.cpp
|
||||
@@ -536,6 +536,13 @@
|
||||
}
|
||||
}
|
||||
methodHandle m = result.resolved_method();
|
||||
+ KlassHandle mklass = m->method_holder();
|
||||
+ KlassHandle receiver_limit = result.resolved_klass();
|
||||
+ if (receiver_limit.is_null() ||
|
||||
+ // ignore passed-in limit; interfaces are interconvertible
|
||||
+ receiver_limit->is_interface() && mklass->is_interface()) {
|
||||
+ receiver_limit = mklass;
|
||||
+ }
|
||||
oop vmtarget = NULL;
|
||||
int vmindex = methodOopDesc::nonvirtual_vtable_index;
|
||||
if (defc->is_interface()) {
|
@ -1,27 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User lancea
|
||||
# Date 1363442894 14400
|
||||
# Node ID a19614a3dabb1754f4e8b3f0eaf29053debce05f
|
||||
# Parent 0cf73f53c7e1236286ea600d766a0651fdf9b660
|
||||
8009814: Better driver management
|
||||
Reviewed-by: alanb, skoivu
|
||||
|
||||
diff --git openjdk/jdk/src/share/classes/java/sql/DriverManager.java openjdk/jdk/src/share/classes/java/sql/DriverManager.java
|
||||
--- jdk/src/share/classes/java/sql/DriverManager.java
|
||||
+++ jdk/src/share/classes/java/sql/DriverManager.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 1996, 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
|
||||
@@ -516,7 +516,7 @@ public class DriverManager {
|
||||
*/
|
||||
try{
|
||||
while(driversIterator.hasNext()) {
|
||||
- println(" Loading done by the java.util.ServiceLoader : "+driversIterator.next());
|
||||
+ driversIterator.next();
|
||||
}
|
||||
} catch(Throwable t) {
|
||||
// Do nothing
|
@ -1,66 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User smarks
|
||||
# Date 1363655131 25200
|
||||
# Node ID 2899c3dbf5e8791b559c39a75a820c17c729c20f
|
||||
# Parent b453d9be6b3f5496aa217ade7478d3b7fa32b13b
|
||||
8009857: Problem with plugin
|
||||
Reviewed-by: jdn, mchung
|
||||
|
||||
diff --git openjdk/jdk/src/share/classes/sun/reflect/misc/MethodUtil.java openjdk/jdk/src/share/classes/sun/reflect/misc/MethodUtil.java
|
||||
--- jdk/src/share/classes/sun/reflect/misc/MethodUtil.java
|
||||
+++ jdk/src/share/classes/sun/reflect/misc/MethodUtil.java
|
||||
@@ -50,8 +50,27 @@ import sun.security.util.SecurityConstan
|
||||
|
||||
|
||||
class Trampoline {
|
||||
+ static {
|
||||
+ if (Trampoline.class.getClassLoader() == null) {
|
||||
+ throw new Error(
|
||||
+ "Trampoline must not be defined by the bootstrap classloader");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static void ensureInvocableMethod(Method m)
|
||||
+ throws InvocationTargetException
|
||||
+ {
|
||||
+ Class<?> clazz = m.getDeclaringClass();
|
||||
+ if (clazz.equals(AccessController.class) ||
|
||||
+ clazz.equals(Method.class))
|
||||
+ throw new InvocationTargetException(
|
||||
+ new UnsupportedOperationException("invocation not supported"));
|
||||
+ }
|
||||
+
|
||||
private static Object invoke(Method m, Object obj, Object[] params)
|
||||
- throws InvocationTargetException, IllegalAccessException {
|
||||
+ throws InvocationTargetException, IllegalAccessException
|
||||
+ {
|
||||
+ ensureInvocableMethod(m);
|
||||
return m.invoke(obj, params);
|
||||
}
|
||||
}
|
||||
@@ -255,10 +275,6 @@ public final class MethodUtil extends Se
|
||||
*/
|
||||
public static Object invoke(Method m, Object obj, Object[] params)
|
||||
throws InvocationTargetException, IllegalAccessException {
|
||||
- if (m.getDeclaringClass().equals(AccessController.class) ||
|
||||
- m.getDeclaringClass().equals(Method.class))
|
||||
- throw new InvocationTargetException(
|
||||
- new UnsupportedOperationException("invocation not supported"));
|
||||
try {
|
||||
return bounce.invoke(null, new Object[] {m, obj, params});
|
||||
} catch (InvocationTargetException ie) {
|
||||
@@ -292,10 +307,10 @@ public final class MethodUtil extends Se
|
||||
|
||||
types = new Class[] {Method.class, Object.class, Object[].class};
|
||||
b = t.getDeclaredMethod("invoke", types);
|
||||
- ((AccessibleObject)b).setAccessible(true);
|
||||
- return b;
|
||||
- }
|
||||
- });
|
||||
+ b.setAccessible(true);
|
||||
+ return b;
|
||||
+ }
|
||||
+ });
|
||||
} catch (Exception e) {
|
||||
throw new InternalError("bouncer cannot be found");
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user