[Midnightbsd-cvs] mports [15460] start update of openjdk

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Mon Sep 16 23:10:31 EDT 2013


Revision: 15460
          http://svnweb.midnightbsd.org/mports/?rev=15460
Author:   laffer1
Date:     2013-09-16 23:10:26 -0400 (Mon, 16 Sep 2013)
Log Message:
-----------
start update of openjdk

Modified Paths:
--------------
    trunk/java/openjdk6/Makefile
    trunk/java/openjdk6/distinfo
    trunk/java/openjdk6/files/alsa-enable.patch
    trunk/java/openjdk6/files/patch-set
    trunk/java/openjdk6/files/patch-test

Added Paths:
-----------
    trunk/java/openjdk6/Makefile.icedtea
    trunk/java/openjdk6/files/icedtea/
    trunk/java/openjdk6/files/icedtea/applet_hole.patch
    trunk/java/openjdk6/files/icedtea/jaxp.patch
    trunk/java/openjdk6/files/icedtea/jaxws.patch
    trunk/java/openjdk6/files/icedtea/jpegclasses.patch
    trunk/java/openjdk6/files/icedtea/openjdk/
    trunk/java/openjdk6/files/icedtea/openjdk/5102804-memory_leak.patch
    trunk/java/openjdk6/files/icedtea/openjdk/6469266-xmlsec_1.4.2.patch
    trunk/java/openjdk6/files/icedtea/openjdk/6501644-icu_sync.patch
    trunk/java/openjdk6/files/icedtea/openjdk/6669869-queries_per_appcontext.patch
    trunk/java/openjdk6/files/icedtea/openjdk/6786028-wcag_bold_tags.patch
    trunk/java/openjdk6/files/icedtea/openjdk/6786682-wcag_lang.patch
    trunk/java/openjdk6/files/icedtea/openjdk/6786688-wcag_table.patch
    trunk/java/openjdk6/files/icedtea/openjdk/6786690-wcag_dl.patch
    trunk/java/openjdk6/files/icedtea/openjdk/6802694-no_deprecated.patch
    trunk/java/openjdk6/files/icedtea/openjdk/6851834-handle_renames.patch
    trunk/java/openjdk6/files/icedtea/openjdk/6851834-restructure.patch
    trunk/java/openjdk6/files/icedtea/openjdk/6886358-layout_update.patch
    trunk/java/openjdk6/files/icedtea/openjdk/6888167-medialib_memory_leaks.patch
    trunk/java/openjdk6/files/icedtea/openjdk/6961178-doclet_xml.patch
    trunk/java/openjdk6/files/icedtea/openjdk/6963811-deadlock_fix.patch
    trunk/java/openjdk6/files/icedtea/openjdk/7006270-regressions.patch
    trunk/java/openjdk6/files/icedtea/openjdk/7017324-kerning_crash.patch
    trunk/java/openjdk6/files/icedtea/openjdk/7032388-work_without_cmov_instruction.patch
    trunk/java/openjdk6/files/icedtea/openjdk/7036559-concurrenthashmap_improvements.patch
    trunk/java/openjdk6/files/icedtea/openjdk/7064279-fixup.patch
    trunk/java/openjdk6/files/icedtea/openjdk/7064279-resource_release.patch
    trunk/java/openjdk6/files/icedtea/openjdk/7133220-factory_finder_parser_transform_useBSClassLoader.patch
    trunk/java/openjdk6/files/icedtea/openjdk/7195301-no_instanceof_node.patch
    trunk/java/openjdk6/files/icedtea/openjdk/7197906-handle_32_bit_shifts.patch
    trunk/java/openjdk6/files/icedtea/openjdk/8004302-soap_test_failure.patch
    trunk/java/openjdk6/files/icedtea/openjdk/8004341-jck_dialog_failure-02.patch
    trunk/java/openjdk6/files/icedtea/openjdk/8004341-jck_dialog_failure.patch
    trunk/java/openjdk6/files/icedtea/openjdk/8005615-failure_to_load_logger_implementation.patch
    trunk/java/openjdk6/files/icedtea/openjdk/8007393.patch
    trunk/java/openjdk6/files/icedtea/openjdk/8007611.patch
    trunk/java/openjdk6/files/icedtea/security/
    trunk/java/openjdk6/files/icedtea/security/20120830/
    trunk/java/openjdk6/files/icedtea/security/20120830/7182135-impossible_to_use_some_editors_directly.patch
    trunk/java/openjdk6/files/icedtea/security/20130201/
    trunk/java/openjdk6/files/icedtea/security/20130201/6563318.patch
    trunk/java/openjdk6/files/icedtea/security/20130201/6664509.patch
    trunk/java/openjdk6/files/icedtea/security/20130201/6776941.patch
    trunk/java/openjdk6/files/icedtea/security/20130201/7141694.patch
    trunk/java/openjdk6/files/icedtea/security/20130201/7173145.patch
    trunk/java/openjdk6/files/icedtea/security/20130201/7186945.patch
    trunk/java/openjdk6/files/icedtea/security/20130201/7186948.patch
    trunk/java/openjdk6/files/icedtea/security/20130201/7186952.patch
    trunk/java/openjdk6/files/icedtea/security/20130201/7186954.patch
    trunk/java/openjdk6/files/icedtea/security/20130201/7192392.patch
    trunk/java/openjdk6/files/icedtea/security/20130201/7192393.patch
    trunk/java/openjdk6/files/icedtea/security/20130201/7192977.patch
    trunk/java/openjdk6/files/icedtea/security/20130201/7197546.patch
    trunk/java/openjdk6/files/icedtea/security/20130201/7200491.patch
    trunk/java/openjdk6/files/icedtea/security/20130201/7200500.patch
    trunk/java/openjdk6/files/icedtea/security/20130201/7201064.patch
    trunk/java/openjdk6/files/icedtea/security/20130201/7201066.patch
    trunk/java/openjdk6/files/icedtea/security/20130201/7201068.patch
    trunk/java/openjdk6/files/icedtea/security/20130201/7201070.patch
    trunk/java/openjdk6/files/icedtea/security/20130201/7201071.patch
    trunk/java/openjdk6/files/icedtea/security/20130201/8000210.patch
    trunk/java/openjdk6/files/icedtea/security/20130201/8000537.patch
    trunk/java/openjdk6/files/icedtea/security/20130201/8000540.patch
    trunk/java/openjdk6/files/icedtea/security/20130201/8000631.patch
    trunk/java/openjdk6/files/icedtea/security/20130201/8001242.patch
    trunk/java/openjdk6/files/icedtea/security/20130201/8001307.patch
    trunk/java/openjdk6/files/icedtea/security/20130201/8001972.patch
    trunk/java/openjdk6/files/icedtea/security/20130201/8002325.patch
    trunk/java/openjdk6/files/icedtea/security/20130219/
    trunk/java/openjdk6/files/icedtea/security/20130219/8006446.patch
    trunk/java/openjdk6/files/icedtea/security/20130219/8006777.patch
    trunk/java/openjdk6/files/icedtea/security/20130219/8007688.patch
    trunk/java/openjdk6/files/icedtea/security/20130304/
    trunk/java/openjdk6/files/icedtea/security/20130304/8007014.patch
    trunk/java/openjdk6/files/icedtea/security/20130304/8007675.patch
    trunk/java/openjdk6/files/icedtea/security/20130416/
    trunk/java/openjdk6/files/icedtea/security/20130416/6657673-factory_finder.patch
    trunk/java/openjdk6/files/icedtea/security/20130416/6657673-fixup.patch
    trunk/java/openjdk6/files/icedtea/security/20130416/6657673.patch
    trunk/java/openjdk6/files/icedtea/security/20130416/7200507.patch
    trunk/java/openjdk6/files/icedtea/security/20130416/8000724.patch
    trunk/java/openjdk6/files/icedtea/security/20130416/8001031.patch
    trunk/java/openjdk6/files/icedtea/security/20130416/8001040.patch
    trunk/java/openjdk6/files/icedtea/security/20130416/8001322.patch
    trunk/java/openjdk6/files/icedtea/security/20130416/8001329.patch
    trunk/java/openjdk6/files/icedtea/security/20130416/8003335.patch
    trunk/java/openjdk6/files/icedtea/security/20130416/8003445.patch
    trunk/java/openjdk6/files/icedtea/security/20130416/8003543.patch
    trunk/java/openjdk6/files/icedtea/security/20130416/8004261.patch
    trunk/java/openjdk6/files/icedtea/security/20130416/8004336.patch
    trunk/java/openjdk6/files/icedtea/security/20130416/8004986.patch
    trunk/java/openjdk6/files/icedtea/security/20130416/8005432.patch
    trunk/java/openjdk6/files/icedtea/security/20130416/8005943.patch
    trunk/java/openjdk6/files/icedtea/security/20130416/8006309.patch
    trunk/java/openjdk6/files/icedtea/security/20130416/8006435.patch
    trunk/java/openjdk6/files/icedtea/security/20130416/8006790.patch
    trunk/java/openjdk6/files/icedtea/security/20130416/8006795.patch
    trunk/java/openjdk6/files/icedtea/security/20130416/8007406.patch
    trunk/java/openjdk6/files/icedtea/security/20130416/8007617.patch
    trunk/java/openjdk6/files/icedtea/security/20130416/8007667.patch
    trunk/java/openjdk6/files/icedtea/security/20130416/8007918.patch
    trunk/java/openjdk6/files/icedtea/security/20130416/8009063.patch
    trunk/java/openjdk6/files/icedtea/security/20130416/8009305.patch
    trunk/java/openjdk6/files/icedtea/security/20130416/8009699.patch
    trunk/java/openjdk6/files/icedtea/security/20130416/8009814.patch
    trunk/java/openjdk6/files/icedtea/security/20130416/8009857.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/
    trunk/java/openjdk6/files/icedtea/security/20130618/6741606-apache_santuario.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/7158805-nested_subroutine_rewriting.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/7170730-windows_network_stack.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8000638-improve_deserialization.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8000642-better_transportation_handling.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8001032-restrict_object_access-corba.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8001033-refactor_address_handling.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8001034-memory_management.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8001038-resourcefully_handle_resources.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8001043-clarify_definition_restrictions.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8001309-better_handling_of_annotation_interfaces.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8001318-6_fixup.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8001318-socket_getlocaladdress_consistency.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8001330-checking_order_improvement.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8001330-improve_checking_order.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8003703-update_rmi_connection_dialog.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8004584-augment_applet_contextualization.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8005007-better_glyph_processing.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8006328-6_fixup.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8006328-sound_class_robustness.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8006611-improve_scripting.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8007467-improve_jmx_internal_api_robustness.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8007471-6_fixup.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8007471-improve_mbean_notifications.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8007812-getenclosingmethod.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8008120-improve_jmx_class_checking.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8008124-better_compliance_testing.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8008128-better_jmx_api_coherence.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8008132-better_serialization.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8008585-jmx_data_handling.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8008593-better_urlclassloader.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8008603-jmx_provider_provision.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8008611-6_fixup.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8008611-jmx_annotations.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8008615-jmx_internal_api_robustness.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8008623-mbeanserver_handling.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8008744-6741606_rework.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8008982-jmx_interface_changes.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8009004-rmi_connection_improvement.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8009013-t2k_glyphs.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8009034-jmx_notification_improvement.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8009038-jmx_notification_support_improvement.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8009067-improve_key_storing.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8009071-improve_shape_handling.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8009235-improve_tsa_data_handling.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8011243-improve_imaginglib.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8011248-better_component_rasters.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8011253-better_short_component_rasters.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8011257-better_byte_component_rasters.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8011557-improve_reflection.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8012375-javadoc_framing.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8012421-better_positioning.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8012438-better_image_validation.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8012597-better_image_channel_validation.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8012601-better_layout_validation.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8014281-better_xml_signature_checking.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/8015997-more_javadoc_framing.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/diamond_fix.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/handle_npe.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/javac_issue.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/langtools_generics.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/langtools_merge-01.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/langtools_merge-02.patch
    trunk/java/openjdk6/files/icedtea/security/20130618/langtools_merge-03.patch
    trunk/java/openjdk6/files/patch-sharedRuntime_x86_64.cpp
    trunk/java/openjdk6/files/test_gamma-disable.patch
    trunk/java/openjdk6/pkg-message

Property Changed:
----------------
    trunk/java/openjdk6/Makefile
    trunk/java/openjdk6/distinfo
    trunk/java/openjdk6/files/Makefile.test
    trunk/java/openjdk6/files/alsa-disable.patch
    trunk/java/openjdk6/files/alsa-enable.patch
    trunk/java/openjdk6/files/cacerts
    trunk/java/openjdk6/files/fontconfig.properties
    trunk/java/openjdk6/files/patch-ZoneInfoFile.java
    trunk/java/openjdk6/files/patch-set
    trunk/java/openjdk6/files/patch-test
    trunk/java/openjdk6/pkg-descr

Modified: trunk/java/openjdk6/Makefile
===================================================================
--- trunk/java/openjdk6/Makefile	2013-09-17 02:40:23 UTC (rev 15459)
+++ trunk/java/openjdk6/Makefile	2013-09-17 03:10:26 UTC (rev 15460)
@@ -1,16 +1,19 @@
-# $MidnightBSD: mports/java/openjdk6/Makefile,v 1.7 2012/09/14 03:54:28 laffer1 Exp $
+# $MidnightBSD$
 
 PORTNAME=	openjdk6
-PORTVERSION=	b25
+PORTVERSION=	b27
+PORTREVISION?=	0
 CATEGORIES=	java devel
 MASTER_SITES=	http://download.java.net/openjdk/jdk6/promoted/${PORTVERSION}/ \
 		http://download.java.net/jaxp/openjdk/jdk6/:jaxp \
 		http://download.java.net/glassfish/components/jax-ws/openjdk/jdk6/:jaxws \
 		https://java.net/downloads/jax-ws/OpenJDK6/:jaf \
-		http://icedtea.classpath.org/builds/icedtea6/src/ \
 		http://icedtea.classpath.org/download/drops/:jaxp \
 		http://icedtea.classpath.org/download/drops/:jaxws \
 		http://icedtea.classpath.org/download/drops/:jaf \
+		http://icedtea.wildebeest.org/download/drops/:jaxp \
+		http://icedtea.wildebeest.org/download/drops/:jaxws \
+		http://icedtea.wildebeest.org/download/drops/:jaf \
 		${MASTER_SITE_APACHE:S,%SUBDIR%/,ant/binaries/:ant,} \
 		http://download.java.net/openjdk/jtreg/promoted/4.1/${JTREGVERSION}/:jtreg
 DISTNAME=	openjdk-6-src-${PORTVERSION}-${OPENJDK_BUILDDATE}
@@ -23,24 +26,37 @@
 
 MAINTAINER=	luke at midnightbsd.org
 COMMENT=	Oracle's Java 6 virtual machine release under the GPL v2
+
 LICENSE=	gpl2
 
 BUILD_DEPENDS=	${LOCALBASE}/bin/zip:${PORTSDIR}/archivers/zip \
 		${LOCALBASE}/bin/unzip:${PORTSDIR}/archivers/unzip \
 		${LOCALBASE}/include/cups/cups.h:${PORTSDIR}/print/cups-client
-LIB_DEPENDS=	freetype.9:${PORTSDIR}/print/freetype2
+LIB_DEPENDS=	freetype:${PORTSDIR}/print/freetype2
 RUN_DEPENDS=	javavm:${PORTSDIR}/java/javavmwrapper \
 		${LOCALBASE}/lib/X11/fonts/dejavu:${PORTSDIR}/x11-fonts/dejavu
 
-OPENJDK_BUILDDATE=	01_may_2012
+OPENJDK_BUILDDATE=	26_oct_2012
 
-OPTIONS=	DEBUG "Enable legacy debugging support" off \
-		FASTDEBUG "Include fastdebug build" off \
-		IPV6 "Enable IPv6 support" off \
-		POLICY "Install the Unlimited Strength Policy Files" off \
-		SOUND "Enable sound support" off \
-		TEST "Add support for running regression test" off
+OPTIONS_DEFINE=	ICEDTEA IPV6 POLICY SOUND TZUPDATE
+OPTIONS_DEFAULT=ICEDTEA IPV6 TZUPDATE
+ICEDTEA_DESC=	Apply additional patches from IcedTea
+POLICY_DESC=	Install the Unlimited Strength Policy Files
+SOUND_DESC=	Enable sound support
+TZUPDATE_DESC=	Update the time zone data
 
+.if !defined(BUILD_JRE)
+OPTIONS_DEFINE+=DEBUG FASTDEBUG TEST
+DEBUG_DESC=	Enable legacy debugging support
+FASTDEBUG_DESC=	Include fastdebug build
+TEST_DESC=	Add support for running regression test
+.endif
+
+.include <bsd.mport.options.mk>
+.include "${.CURDIR}/../openjdk6/Makefile.icedtea"
+
+EXTRA_PATCHES=	${ICEDTEA_PATCHES}
+
 # java extracts directly to the cwd
 WRKSRC=		${WRKDIR}
 
@@ -47,9 +63,8 @@
 USE_GMAKE=	yes
 USE_MOTIF=	yes
 USE_XORG=	x11 xext xi xt xtst
-MAKE_JOBS_UNSAFE=	yes
 
-JAXP_BUILD=	144_03
+JAXP_BUILD=	144_05
 JAXPFILE=	jaxp${JAXP_BUILD}.zip
 JAXWS_BUILD=	2_1_6-2011_06_13
 JAXWSFILE=	jdk6-jaxws${JAXWS_BUILD}.zip
@@ -61,19 +76,19 @@
 
 # do not depend on devel/apache-ant to avoid circular dependency, but
 # use .tar.bz2 distfile to avoid duplicated downloads
-ANTVERSION=	1.8.3
+ANTVERSION=	1.8.4
 ANTFILE=	apache-ant-${ANTVERSION}-bin.tar.bz2
 
-# rely on bsdtar ability to extract .gz, .bz2 and .zip archives
-EXTRACT_CMD=	${CAT}
-EXTRACT_BEFORE_ARGS=
-
 .include <bsd.port.pre.mk>
 
-.if defined(WITH_IPV6)
+.if ${PORT_OPTIONS:MIPV6}
 CATEGORIES+=	ipv6
 .endif
 
+.if ${PORT_OPTIONS:MTZUPDATE}
+RUN_DEPENDS+=  ${LOCALBASE}/share/java/zi:${PORTSDIR}/java/java-zoneinfo
+.endif
+
 # avoid ARCH in MAKEFLAGS, breaks build
 NOPRECIOUSMAKEVARS=	yes
 
@@ -80,8 +95,7 @@
 ONLY_FOR_ARCHS=	amd64 i386
 
 BOOTSTRAP_JDKS=	${LOCALBASE}/openjdk6 \
-		${LOCALBASE}/jdk1.6.0 \
-		${LOCALBASE}/diablo-jdk1.6.0
+		${LOCALBASE}/bootstrap-openjdk
 
 # do we have valid native jdk installed?
 .for CJDK in ${BOOTSTRAP_JDKS}
@@ -92,16 +106,18 @@
 
 # if no valid jdk found, set dependency
 .if !defined(BOOTSTRAPJDKDIR)
-BOOTSTRAPJDKDIR?=	${LOCALBASE}/diablo-jdk1.6.0
-BUILD_DEPENDS+=		${BOOTSTRAPJDKDIR}/bin/javac:${PORTSDIR}/java/diablo-jdk16
+BOOTSTRAPJDKDIR?=	${LOCALBASE}/bootstrap-openjdk
+BUILD_DEPENDS+=		${BOOTSTRAPJDKDIR}/bin/javac:${PORTSDIR}/java/bootstrap-openjdk
 .endif
 
-MAKE_ENV=	LANG=C LC_ALL=C \
+FETCH_ARGS=	-Fpr
+MAKE_ENV=	LANG=C LC_ALL=C OS= \
+		OS_NAME=freebsd \
+		OS_VENDOR=FreeBSD \
+		PLATFORM=bsd \
 		ARCH=${ARCH} \
 		ARCH_DATA_MODEL=64 \
 		LIBARCH=${ARCH} \
-		PLATFORM=bsd \
-		OS_NAME=freebsd \
 		ALT_JDK_IMPORT_PATH=${BOOTSTRAPJDKDIR} \
 		ALT_BOOTDIR=${BOOTSTRAPJDKDIR} \
 		ALT_CACERTS_FILE=${FILESDIR}/cacerts \
@@ -113,52 +129,58 @@
 		ALT_PACKAGE_PATH=${LOCALBASE} \
 		ALT_DROPS_DIR=${DISTDIR} \
 		ANT_HOME=${WRKDIR}/apache-ant-${ANTVERSION} \
+		JAVACMD=${BOOTSTRAPJDKDIR}/bin/java \
 		BUILD_NUMBER=${PORTVERSION} \
 		NO_DOCS=true \
 		MILESTONE=fcs \
 		JDK_UPDATE_VERSION=${UPDATE_VERSION}
 
-.if defined(WITH_DEBUG)
+# 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}"
+
+# XXX Turn off parallel build by default.
+_MAKE_JOBS=	#
+MAKE_ENV+=	ALT_PARALLEL_COMPILE_JOBS=${MAKE_JOBS_NUMBER} \
+		HOTSPOT_BUILD_JOBS=${MAKE_JOBS_NUMBER}
+
+.if ${PORT_OPTIONS:MDEBUG}
 ALL_TARGET=	debug_build
 OPENJDK_OSARCH=	bsd-${ARCH:S/i386/i586/}-debug
 .else
 OPENJDK_OSARCH=	bsd-${ARCH:S/i386/i586/}
+WARNINGS_ARE_ERRORS?=	-w
 .endif
 
 # disable FASTDEBUG_BUILD by default to improve compile time.
-.if defined(WITH_FASTDEBUG)
+.if ${PORT_OPTIONS:MFASTDEBUG}
 MAKE_ENV+=	SKIP_FASTDEBUG_BUILD=false
 .else
 MAKE_ENV+=	SKIP_FASTDEBUG_BUILD=true
 .endif
 
-.if !defined(WITH_IPV6)
+.if empty(PORT_OPTIONS:MIPV6)
 MAKE_ENV+=	DONT_ENABLE_IPV6="YES"
 .endif
 
-.if defined(WITH_SOUND)
+.if ${PORT_OPTIONS:MSOUND}
 EXTRA_PATCHES+=	${FILESDIR}/alsa-enable.patch
-LIB_DEPENDS+=	asound.2:${PORTSDIR}/audio/alsa-lib
+LIB_DEPENDS+=	asound:${PORTSDIR}/audio/alsa-lib
 RUN_DEPENDS+=	${LOCALBASE}/lib/alsa-lib/libasound_module_pcm_oss.so:${PORTSDIR}/audio/alsa-plugins
 .else
 EXTRA_PATCHES+=	${FILESDIR}/alsa-disable.patch
 .endif
 
-.if defined(WITH_TEST)
+.if ${PORT_OPTIONS:MTEST}
 DISTFILES+=	${JTREGFILE}:jtreg
 EXTRACT_ONLY+=	${JTREGFILE}
 BUILD_DEPENDS+=	${LOCALBASE}/lib/X11/fonts/dejavu:${PORTSDIR}/x11-fonts/dejavu
 USE_DISPLAY=	yes
-.endif
-
-.if !defined(DISABLE_MAKE_JOBS)
-.if defined(MAKE_JOBS_NUMBER)
-BUILD_JOBS_NUMBER=	${MAKE_JOBS_NUMBER}
 .else
-BUILD_JOBS_NUMBER=	`${SYSCTL} -n kern.smp.cpus`
+EXTRA_PATCHES+=	${FILESDIR}/test_gamma-disable.patch
 .endif
-MAKE_ENV+=	HOTSPOT_BUILD_JOBS=${BUILD_JOBS_NUMBER}
-.endif
 
 COPYDIRS=	\
 	hotspot/src/os/linux/vm \
@@ -194,11 +216,11 @@
 
 post-extract:
 	@for d in ${COPYDIRS}; do \
-		${MKDIR} `echo ${WRKDIR}/$$d | ${SED} 's/linux/bsd/g;'`; \
-		cd ${WRKDIR}/$$d; \
+		${MKDIR} `echo ${WRKSRC}/$$d | ${SED} 's/linux/bsd/g;'`; \
+		cd ${WRKSRC}/$$d; \
 		for f in *; do \
 			if [ -f $$f ]; then \
-				t=`echo ${WRKDIR}/$$d/$$f | ${SED} 's/linux/bsd/g; s/Linux/Bsd/g'`; \
+				t=`echo ${WRKSRC}/$$d/$$f | ${SED} 's/linux/bsd/g; s/Linux/Bsd/g'`; \
 				${SED} 's/linux/bsd/g; s/Linux/Bsd/g; s/LINUX/BSD/g' < $$f > $$t; \
 			fi; \
 		done; \
@@ -205,33 +227,46 @@
 	done
 	@for f in ${COPYFILES}; do \
 		t=`echo $$f | ${SED} 's/linux/bsd/g; s/Linux/Bsd/g'`; \
-		${SED} 's/linux/bsd/g; s/Linux/Bsd/g' < ${WRKDIR}/$$f > ${WRKDIR}/$$t; \
+		${SED} 's/linux/bsd/g; s/Linux/Bsd/g' < ${WRKSRC}/$$f > ${WRKSRC}/$$t; \
 	done
 	@${SED} 's/solaris/bsd/g; s/Solaris/Bsd/g' \
-		< ${WRKDIR}/jdk/src/solaris/hpi/native_threads/src/threads_solaris.c \
-		> ${WRKDIR}/jdk/src/solaris/hpi/native_threads/src/threads_bsd.c
+		< ${WRKSRC}/jdk/src/solaris/hpi/native_threads/src/threads_solaris.c \
+		> ${WRKSRC}/jdk/src/solaris/hpi/native_threads/src/threads_bsd.c
 	@${SED} "s|/usr/local|${LOCALBASE}|" < ${FILESDIR}/fontconfig.properties \
-		> ${WRKDIR}/jdk/src/solaris/classes/sun/awt/fontconfigs/bsd.fontconfig.properties
+		> ${WRKSRC}/jdk/src/solaris/classes/sun/awt/fontconfigs/bsd.fontconfig.properties
 	@${SED} "s|%%LOCALBASE%%|${LOCALBASE}|" < ${FILESDIR}/Makefile.test \
-		> ${WRKDIR}/jdk/test/Makefile
-	@${FIND} ${WRKDIR}/jdk/test -type f -name \*.sh -exec ${SED} -i "" -e s/Linux/FreeBSD/g {} \;
+		> ${WRKSRC}/jdk/test/Makefile
+	@${FIND} ${WRKSRC}/jdk/test -type f -name \*.sh -exec ${SED} -i "" -e s/Linux/FreeBSD/g {} \;
 
 post-patch:
 	@${REINPLACE_CMD} "s|/lib:/usr/lib|/lib:/usr/lib:${LOCALBASE}/lib|" \
-		${WRKDIR}/hotspot/src/os/bsd/vm/os_bsd.cpp
-.if defined(WITH_POLICY)
+		${WRKSRC}/hotspot/src/os/bsd/vm/os_bsd.cpp
+.if ${PORT_OPTIONS:MPOLICY}
 	@${REINPLACE_CMD} 's|build-policy install-limited|build-policy install-unlimited|' \
 		${WRKSRC}/jdk/make/javax/crypto/Makefile
 .endif
+.if empty(ICONV_LIB)
+	@${REINPLACE_CMD} 's| -liconv||' \
+		${WRKSRC}/Makefile \
+		${WRKSRC}/jdk/make/sun/splashscreen/Makefile \
+		${WRKSRC}/jdk/make/java/npt/Makefile \
+		${WRKSRC}/jdk/make/java/instrument/Makefile
+.endif
 
 post-build:
-.if defined(WITH_TZUPDATE)
+.if ${PORT_OPTIONS:MTZUPDATE}
 	@# Update time zones
+.if defined(BUILD_JRE)
+	@${RM} -rf ${WRKSRC}/build/${OPENJDK_OSARCH}/j2re-image/lib/zi
+	@${LN} -s -f ${LOCALBASE}/share/java/zi \
+		${WRKSRC}/build/${OPENJDK_OSARCH}/j2re-image/lib
+.else
 	@${RM} -rf ${WRKSRC}/build/${OPENJDK_OSARCH}/j2sdk-image/jre/lib/zi
 	@${LN} -s -f ${LOCALBASE}/share/java/zi \
 		${WRKSRC}/build/${OPENJDK_OSARCH}/j2sdk-image/jre/lib
 .endif
-.if defined(WITH_TEST)
+.endif
+.if ${PORT_OPTIONS:MTEST}
 	@${ECHO_MSG} ""
 	@${ECHO_MSG} "Run \"make test\" to execute regression test (it could take a few hours to complete)."
 .if defined(DISPLAY)
@@ -254,12 +289,46 @@
 .endif
 
 do-install:
+.if defined(BUILD_JRE)
+	@${MKDIR} ${PREFIX}/openjdk6-jre/
+	@cd ${WRKSRC}/build/${OPENJDK_OSARCH}/j2re-image && \
+		${COPYTREE_SHARE} . ${PREFIX}/openjdk6-jre
+	@${CHOWN} ${BINOWN}:${BINGRP} ${PREFIX}/openjdk6-jre/bin/* \
+		${PREFIX}/openjdk6-jre/lib/${ARCH}/jexec
+	@${CHMOD} ${BINMODE} ${PREFIX}/openjdk6-jre/bin/* \
+		${PREFIX}/openjdk6-jre/lib/${ARCH}/jexec
+	@${ECHO_MSG} "@unexec ${LOCALBASE}/bin/unregistervm ${PREFIX}/openjdk6-jre/bin/java" >> ${TMPPLIST}
+	@${FIND} -s ${PREFIX}/openjdk6-jre -not -type d | \
+		${SED} -e 's#^${PREFIX}/##' >> ${TMPPLIST}
+	@${ECHO} "@exec mkdir ${PREFIX}/openjdk6-jre/lib/applet" >> ${TMPPLIST}
+	@${FIND} ${PREFIX}/openjdk6-jre -type d | ${SORT} -r | \
+		${SED} 's,^${PREFIX}/, at dirrm ,' >> ${TMPPLIST}
+	@${ECHO_MSG} "@exec ${LOCALBASE}/bin/registervm '${PREFIX}/openjdk6-jre/bin/java # OpenJDK6 JRE'" >> ${TMPPLIST}
+.else
 	@${MKDIR} ${PREFIX}/openjdk6/
-	@${CP} -Rp ${WRKSRC}/build/${OPENJDK_OSARCH}/j2sdk-image/ ${PREFIX}/openjdk6/
+	@cd ${WRKSRC}/build/${OPENJDK_OSARCH}/j2sdk-image && \
+		${COPYTREE_SHARE} . ${PREFIX}/openjdk6
 	@${INSTALL_DATA} ${WRKSRC}/build/${OPENJDK_OSARCH}/btjars/compilefontconfig.jar ${WRKSRC}/build/${OPENJDK_OSARCH}/btjars/javazic.jar ${PREFIX}/openjdk6/jre/lib/
-.if defined(WITH_FASTDEBUG)
+	@for dir in `${FIND} ${PREFIX}/openjdk6 -name bin -type d`; do \
+		${CHOWN} -h -R ${BINOWN}:${BINGRP} $$dir; \
+		${FIND} $$dir -type f -exec ${CHMOD} ${BINMODE} "{}" \; ; \
+	done
+	@${CHOWN} ${BINOWN}:${BINGRP} \
+		${PREFIX}/openjdk6/jre/lib/${ARCH}/jexec
+	@${CHMOD} ${BINMODE} \
+		${PREFIX}/openjdk6/jre/lib/${ARCH}/jexec
+.if ${PORT_OPTIONS:MFASTDEBUG}
 	@${MKDIR} ${PREFIX}/openjdk6-fastdebug/
-	@${CP} -Rp ${WRKSRC}/build/${OPENJDK_OSARCH}-fastdebug/j2sdk-image/ ${PREFIX}/openjdk6-fastdebug/
+	@cd ${WRKSRC}/build/${OPENJDK_OSARCH}/j2sdk-image && \
+		${COPYTREE_SHARE} . ${PREFIX}/openjdk6-fastdebug
+	@for dir in `${FIND} ${PREFIX}/openjdk6-fastdebug -name bin -type d`; do \
+		${CHOWN} -h -R ${BINOWN}:${BINGRP} $$dir; \
+		${FIND} $$dir -type f -exec ${CHMOD} ${BINMODE} "{}" \; ; \
+	done
+	@${CHOWN} ${BINOWN}:${BINGRP} \
+		${PREFIX}/openjdk6-fastdebug/jre/lib/${ARCH}/jexec
+	@${CHMOD} ${BINMODE} \
+		${PREFIX}/openjdk6-fastdebug/jre/lib/${ARCH}/jexec
 .endif
 	@${ECHO_MSG} "@unexec ${LOCALBASE}/bin/unregistervm ${TRUE_PREFIX}/openjdk6/bin/java" >> ${TMPPLIST}
 	@${FIND} -s ${PREFIX}/openjdk6 -not -type d | \
@@ -268,7 +337,7 @@
 	@${FIND} ${PREFIX}/openjdk6 -type d | ${SORT} -r | \
 		${SED} 's,^${PREFIX}/, at dirrm ,' >> ${TMPPLIST}
 	@${ECHO_MSG} "@exec ${LOCALBASE}/bin/registervm '${TRUE_PREFIX}/openjdk6/bin/java # OpenJDK6'" >> ${TMPPLIST}
-.if defined(WITH_FASTDEBUG)
+.if ${PORT_OPTIONS:MFASTDEBUG}
 	@${ECHO_MSG} "@unexec ${LOCALBASE}/bin/unregistervm ${TRUE_PREFIX}/openjdk6-fastdebug/bin/java" >> ${TMPPLIST}
 	@${FIND} -s ${PREFIX}/openjdk6-fastdebug -not -type d | \
 		${SED} -e 's#^${PREFIX}/##' >> ${TMPPLIST}
@@ -281,4 +350,6 @@
 post-install:
 	(cd ${PREFIX}/openjdk6/include/ && ${LN} -s freebsd midnightbsd)
 
+.endif
+
 .include <bsd.port.post.mk>


Property changes on: trunk/java/openjdk6/Makefile
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.8
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/java/openjdk6/Makefile.icedtea
===================================================================
--- trunk/java/openjdk6/Makefile.icedtea	                        (rev 0)
+++ trunk/java/openjdk6/Makefile.icedtea	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,173 @@
+# $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
+
+.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
+
+.for p in ${_PATCHES}
+ICEDTEA_PATCHES+=	${FILESDIR}/icedtea/${p}
+.endfor

Modified: trunk/java/openjdk6/distinfo
===================================================================
--- trunk/java/openjdk6/distinfo	2013-09-17 02:40:23 UTC (rev 15459)
+++ trunk/java/openjdk6/distinfo	2013-09-17 03:10:26 UTC (rev 15460)
@@ -1,12 +1,12 @@
-SHA256 (openjdk-6-src-b25-01_may_2012.tar.gz) = 42db988b436593017e29d6543ac09168a901027817e41dc1be5c795b85d53b05
-SIZE (openjdk-6-src-b25-01_may_2012.tar.gz) = 45761297
-SHA256 (jaxp144_03.zip) = c1a5348e17b330a7e4b18431e61a40efd2ba99a7da71102cf2c604478ef96012
-SIZE (jaxp144_03.zip) = 5964999
+SHA256 (openjdk-6-src-b27-26_oct_2012.tar.gz) = 044c3877b15940ff04f8aa817337f2878a00cc89674854557f1a02f15b1802a0
+SIZE (openjdk-6-src-b27-26_oct_2012.tar.gz) = 45789350
+SHA256 (jaxp144_05.zip) = c1a8a5a219fa55ecbf2ad43b66514335a3e96ccad40bd2ec9165a821343b2bff
+SIZE (jaxp144_05.zip) = 5976387
 SHA256 (jdk6-jaxws2_1_6-2011_06_13.zip) = 229040544e791f44906e8e7b6f6faf503c730a5d854275135f3925490d5c3be3
 SIZE (jdk6-jaxws2_1_6-2011_06_13.zip) = 5512710
 SHA256 (jdk6-jaf-b20.zip) = 78c7b5c9d6271e88ee46abadd018a61f1e9645f8936cc8df1617e5f4f5074012
 SIZE (jdk6-jaf-b20.zip) = 71243
-SHA256 (apache-ant-1.8.3-bin.tar.bz2) = 93238e8861acf0ca0546dc4f7c9256e0bf83effbff4afca0ba0aa024d4abd4d1
-SIZE (apache-ant-1.8.3-bin.tar.bz2) = 4254036
+SHA256 (apache-ant-1.8.4-bin.tar.bz2) = aeaed7d5c2b1e73ffc195d713931047ecc113b8c9844df5cbac2797007455069
+SIZE (apache-ant-1.8.4-bin.tar.bz2) = 4257152
 SHA256 (jtreg-4.1-bin-b04_14_mar_2012.zip) = 6d63447f3b70828b4d5f9e5c2416ba08ca00d54714a9d219837eae989df676c5
 SIZE (jtreg-4.1-bin-b04_14_mar_2012.zip) = 6126941


Property changes on: trunk/java/openjdk6/distinfo
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.4
\ No newline at end of property
Index: trunk/java/openjdk6/files/Makefile.test
===================================================================
--- trunk/java/openjdk6/files/Makefile.test	2013-09-17 02:40:23 UTC (rev 15459)
+++ trunk/java/openjdk6/files/Makefile.test	2013-09-17 03:10:26 UTC (rev 15460)

Property changes on: trunk/java/openjdk6/files/Makefile.test
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.1
\ No newline at end of property
Index: trunk/java/openjdk6/files/alsa-disable.patch
===================================================================
--- trunk/java/openjdk6/files/alsa-disable.patch	2013-09-17 02:40:23 UTC (rev 15459)
+++ trunk/java/openjdk6/files/alsa-disable.patch	2013-09-17 03:10:26 UTC (rev 15460)

Property changes on: trunk/java/openjdk6/files/alsa-disable.patch
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.1
\ No newline at end of property
Modified: trunk/java/openjdk6/files/alsa-enable.patch
===================================================================
--- trunk/java/openjdk6/files/alsa-enable.patch	2013-09-17 02:40:23 UTC (rev 15459)
+++ trunk/java/openjdk6/files/alsa-enable.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -16,6 +16,27 @@
  ifeq ($(PLATFORM), solaris)
    ifneq ($(ARCH), amd64)
      # build with ports and direct audio
+--- jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_CommonUtils.c	2012-05-01 17:18:35.000000000 -0400
++++ jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_CommonUtils.c	2012-09-26 17:35:48.000000000 -0400
+@@ -131,6 +131,10 @@
+ 
+ void getALSAVersion(char* buffer, int len) {
+     if (!hasGottenALSAVersion) {
++#ifdef __FreeBSD__
++        // XXX We do not use ALSA drivers.  Just copy the library version.
++        strcpy(ALSAVersionString, SND_LIB_VERSION_STR);
++#else
+         // get alsa version from proc interface
+         FILE* file;
+         int curr, len, totalLen, inVersionString;
+@@ -171,6 +175,7 @@
+             // null terminate
+             ALSAVersionString[len] = 0;
+         }
++#endif
+         hasGottenALSAVersion = TRUE;
+     }
+     strncpy(buffer, ALSAVersionString, len);
 --- jdk/src/share/native/com/sun/media/sound/Platform.c	2011-01-20 18:54:37.000000000 -0500
 +++ jdk/src/share/native/com/sun/media/sound/Platform.c	2011-02-11 16:20:52.000000000 -0500
 @@ -99,5 +99,15 @@


Property changes on: trunk/java/openjdk6/files/alsa-enable.patch
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.1
\ No newline at end of property
Index: trunk/java/openjdk6/files/cacerts
===================================================================
--- trunk/java/openjdk6/files/cacerts	2013-09-17 02:40:23 UTC (rev 15459)
+++ trunk/java/openjdk6/files/cacerts	2013-09-17 03:10:26 UTC (rev 15460)

Property changes on: trunk/java/openjdk6/files/cacerts
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.2
\ No newline at end of property
Index: trunk/java/openjdk6/files/fontconfig.properties
===================================================================
--- trunk/java/openjdk6/files/fontconfig.properties	2013-09-17 02:40:23 UTC (rev 15459)
+++ trunk/java/openjdk6/files/fontconfig.properties	2013-09-17 03:10:26 UTC (rev 15460)

Property changes on: trunk/java/openjdk6/files/fontconfig.properties
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.2
\ No newline at end of property
Added: trunk/java/openjdk6/files/icedtea/applet_hole.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/applet_hole.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/applet_hole.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,115 @@
+--- jdk/src/share/classes/sun/applet/AppletViewerPanel.java	Fri Nov 12 12:08:44 2010 +0000
++++ jdk/src/share/classes/sun/applet/AppletViewerPanel.java	Thu Dec 02 01:45:58 2010 +0000
+@@ -42,25 +42,25 @@
+  *
+  * @author      Arthur van Hoff
+  */
+-class AppletViewerPanel extends AppletPanel {
++public class AppletViewerPanel extends AppletPanel {
+ 
+     /* Are we debugging? */
+-    static boolean debug = false;
++    protected static boolean debug = false;
+ 
+     /**
+      * The document url.
+      */
+-    URL documentURL;
++    protected URL documentURL;
+ 
+     /**
+      * The base url.
+      */
+-    URL baseURL;
++    protected URL baseURL;
+ 
+     /**
+      * The attributes of the applet.
+      */
+-    Hashtable atts;
++    protected Hashtable<String,String> atts;
+ 
+     /*
+      * JDK 1.1 serialVersionUID
+@@ -70,7 +70,7 @@
+     /**
+      * Construct an applet viewer and start the applet.
+      */
+-    AppletViewerPanel(URL documentURL, Hashtable atts) {
++    protected AppletViewerPanel(URL documentURL, Hashtable<String,String> atts) {
+         this.documentURL = documentURL;
+         this.atts = atts;
+ 
+@@ -106,7 +106,7 @@
+      * Get an applet parameter.
+      */
+     public String getParameter(String name) {
+-        return (String)atts.get(name.toLowerCase());
++        return atts.get(name.toLowerCase());
+     }
+ 
+     /**
+@@ -202,12 +202,12 @@
+         return (AppletContext)getParent();
+     }
+ 
+-    static void debug(String s) {
++    protected static void debug(String s) {
+         if(debug)
+             System.err.println("AppletViewerPanel:::" + s);
+     }
+ 
+-    static void debug(String s, Throwable t) {
++    protected static void debug(String s, Throwable t) {
+         if(debug) {
+             t.printStackTrace();
+             debug(s);
+--- jdk/src/share/classes/sun/applet/AppletPanel.java	Fri Nov 12 12:08:44 2010 +0000
++++ jdk/src/share/classes/sun/applet/AppletPanel.java	Thu Dec 02 01:45:58 2010 +0000
+@@ -68,7 +68,7 @@
+     /**
+      * The applet (if loaded).
+      */
+-    Applet applet;
++    protected Applet applet;
+ 
+     /**
+      * Applet will allow initialization.  Should be
+@@ -117,7 +117,7 @@
+     /**
+      * The thread for the applet.
+      */
+-    Thread handler;
++    protected Thread handler;
+ 
+ 
+     /**
+@@ -162,7 +162,8 @@
+      * Creates a thread to run the applet. This method is called
+      * each time an applet is loaded and reloaded.
+      */
+-    synchronized void createAppletThread() {
++	//Overridden by NetxPanel.
++    protected synchronized void createAppletThread() {
+         // Create a thread group for the applet, and start a new
+         // thread to load the applet.
+         String nm = "applet-" + getCode();
+@@ -306,7 +307,7 @@
+     /**
+      * Get an event from the queue.
+      */
+-    synchronized AppletEvent getNextEvent() throws InterruptedException {
++    protected synchronized AppletEvent getNextEvent() throws InterruptedException {
+         while (queue == null || queue.isEmpty()) {
+             wait();
+         }
+@@ -695,7 +696,8 @@
+      * applet event processing so that it can be gracefully interrupted from
+      * things like HotJava.
+      */
+-    private void runLoader() {
++	//Overridden by NetxPanel.
++    protected void runLoader() {
+         if (status != APPLET_DISPOSE) {
+             showAppletStatus("notdisposed");
+             return;

Added: trunk/java/openjdk6/files/icedtea/jaxp.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/jaxp.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/jaxp.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,15 @@
+--- 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}\

Added: trunk/java/openjdk6/files/icedtea/jaxws.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/jaxws.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/jaxws.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,13 @@
+--- 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}\

Added: trunk/java/openjdk6/files/icedtea/jpegclasses.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/jpegclasses.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/jpegclasses.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,2667 @@
+--- jdk/src/share/classes/com/sun/image/codec/jpeg/ImageFormatException.java	1969-12-31 19:00:00.000000000 -0500
++++ jdk/src/share/classes/com/sun/image/codec/jpeg/ImageFormatException.java	2011-07-07 09:19:34.000000000 -0400
+@@ -0,0 +1,51 @@
++/* ImageFormatException.java
++ * Copyright (C) 2007 Matthew Flaschen
++ * Copyright (C) 2011 Red Hat, Inc.
++ *
++ * This file is part of IcedTea
++ *
++ * IcedTea is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2, or (at your option)
++ * any later version.
++ *
++ * IcedTea is distributed in the hope that it will be useful, but
++ * WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with GNU Classpath; see the file COPYING. If not, write to the
++ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++ * 02110-1301 USA.
++ *
++ * Linking this library statically or dynamically with other modules is
++ * making a combined work based on this library. Thus, the terms and
++ * conditions of the GNU General Public License cover the whole
++ * combination.
++ *
++ * As a special exception, the copyright holders of this library give you
++ * permission to link this library with independent modules to produce an
++ * executable, regardless of the license terms of these independent
++ * modules, and to copy and distribute the resulting executable under
++ * terms of your choice, provided that you also meet, for each linked
++ * independent module, the terms and conditions of the license of that
++ * module. An independent module is a module which is not derived from
++ * or based on this library. If you modify this library, you may extend
++ * this exception to your version of the library, but you are not
++ * obligated to do so. If you do not wish to do so, delete this
++ * exception statement from your version.
++ */
++
++package com.sun.image.codec.jpeg;
++
++public class ImageFormatException extends RuntimeException {
++
++    public ImageFormatException() {
++        super();
++    }
++
++    public ImageFormatException(String s) {
++        super(s);
++    }
++}
+--- jdk/src/share/classes/com/sun/image/codec/jpeg/JPEGCodec.java	1969-12-31 19:00:00.000000000 -0500
++++ jdk/src/share/classes/com/sun/image/codec/jpeg/JPEGCodec.java	2011-07-07 09:19:34.000000000 -0400
+@@ -0,0 +1,193 @@
++/* JPEGCodec.java --
++ * Copyright (C) 2007 Free Software Foundation, Inc.
++ * Copyright (C) 2007 Matthew Flaschen
++ *
++ * This file is part of GNU Classpath.
++ *
++ * GNU Classpath is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2, or (at your option)
++ * any later version.
++ *
++ * GNU Classpath is distributed in the hope that it will be useful, but
++ * WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with GNU Classpath; see the file COPYING. If not, write to the
++ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++ * 02110-1301 USA.
++ *
++ * Linking this library statically or dynamically with other modules is
++ * making a combined work based on this library. Thus, the terms and
++ * conditions of the GNU General Public License cover the whole
++ * combination.
++ *
++ * As a special exception, the copyright holders of this library give you
++ * permission to link this library with independent modules to produce an
++ * executable, regardless of the license terms of these independent
++ * modules, and to copy and distribute the resulting executable under
++ * terms of your choice, provided that you also meet, for each linked
++ * independent module, the terms and conditions of the license of that
++ * module. An independent module is a module which is not derived from
++ * or based on this library. If you modify this library, you may extend
++ * this exception to your version of the library, but you are not
++ * obligated to do so. If you do not wish to do so, delete this
++ * exception statement from your version.
++ */
++
++package com.sun.image.codec.jpeg;
++
++import java.io.InputStream;
++import java.io.OutputStream;
++import java.awt.color.ColorSpace;
++import java.awt.image.BufferedImage;
++import java.awt.image.ColorModel;
++import java.awt.image.Raster;
++
++import sun.awt.image.codec.JPEGImageDecoderImpl;
++import sun.awt.image.codec.JPEGImageEncoderImpl;
++import sun.awt.image.codec.JPEGParam;
++
++/**
++ * This class is a factory for implementations of the JPEG Image
++ * Decoder/Encoder.
++ */
++public class JPEGCodec {
++
++    private JPEGCodec() {}
++
++    /**
++     * This creates an instance of a JPEGImageDecoder that can be used to decode
++     * JPEG Data streams.
++     *
++     * @param src
++     * @return
++     */
++    public static JPEGImageDecoder createJPEGDecoder(InputStream src) {
++        return new JPEGImageDecoderImpl(src);
++    }
++
++    /**
++     * This creates an instance of a JPEGImageDecoder that can be used to decode
++     * JPEG Data streams.
++     *
++     * @param src
++     * @param jdp
++     * @return
++     */
++    public static JPEGImageDecoder createJPEGDecoder(InputStream src,
++            JPEGDecodeParam jdp) {
++        return new JPEGImageDecoderImpl(src, jdp);
++    }
++
++    /**
++     * This creates an instance of a JPEGImageEncoder that can be used to encode
++     * image data as JPEG Data streams.
++     *
++     * @param os
++     * @return
++     */
++    public static JPEGImageEncoder createJPEGEncoder(OutputStream os) {
++        return new JPEGImageEncoderImpl(os);
++    }
++
++    /**
++     * This creates an instance of a JPEGImageEncoder that can be used to encode
++     * image data as JPEG Data streams.
++     *
++     * @param dest
++     * @param jep
++     * @return
++     */
++    public static JPEGImageEncoder createJPEGEncoder(OutputStream dest,
++            JPEGEncodeParam jep) {
++        return new JPEGImageEncoderImpl(dest, jep);
++    }
++
++    /**
++     * This is a factory method for creating JPEGEncodeParam objects.
++     *
++     * @param bi
++     * @return
++     */
++    public static JPEGEncodeParam getDefaultJPEGEncodeParam(BufferedImage bi) {
++        return getDefaultJPEGEncodeParam(bi.getRaster(),
++                getDefaultColorID(bi.getColorModel()));
++    }
++
++    /**
++     * This is a factory method for creating JPEGEncodeParam objects.
++     *
++     * @param numBands
++     * @param colorID
++     * @return
++     */
++    public static JPEGEncodeParam getDefaultJPEGEncodeParam(int numBands,
++            int colorID) {
++        return new JPEGParam(colorID, numBands);
++    }
++
++    /**
++     * This is a factory method for creating a JPEGEncodeParam from a
++     * JPEGDecodeParam.
++     *
++     * @param jdp
++     * @return
++     */
++    public static JPEGEncodeParam getDefaultJPEGEncodeParam(JPEGDecodeParam jdp) {
++        return new JPEGParam(jdp);
++    }
++
++    /**
++     * This is a factory method for creating JPEGEncodeParam objects.
++     *
++     * @param ras
++     * @param colorID
++     * @return
++     */
++    public static JPEGEncodeParam getDefaultJPEGEncodeParam(Raster ras,
++            int colorID) {
++        return getDefaultJPEGEncodeParam(ras.getNumBands(), colorID);
++    }
++
++    private static int getDefaultColorID(ColorModel cm) {
++        ColorSpace cs = cm.getColorSpace();
++        int type = cs.getType();
++        int id = -1;
++        switch (type) {
++            case ColorSpace.TYPE_GRAY:
++                id = JPEGEncodeParam.COLOR_ID_GRAY;
++                break;
++
++            case ColorSpace.TYPE_RGB:
++                id = cm.hasAlpha() ? JPEGEncodeParam.COLOR_ID_RGBA
++                        : JPEGEncodeParam.COLOR_ID_RGB;
++
++            case ColorSpace.TYPE_YCbCr:
++                try {
++                    if (cs == ColorSpace.getInstance(ColorSpace.CS_PYCC)) {
++                        id = cm.hasAlpha() ? JPEGEncodeParam.COLOR_ID_PYCCA
++                                : JPEGEncodeParam.COLOR_ID_PYCC;
++                    }
++                } catch (IllegalArgumentException e) {
++                    /* We know it isn't PYCC type, nothing to handle */
++                }
++                if (id == -1) {
++                    id = cm.hasAlpha() ? JPEGEncodeParam.COLOR_ID_YCbCrA
++                            : JPEGEncodeParam.COLOR_ID_YCbCr;
++                }
++                break;
++
++            case ColorSpace.TYPE_CMYK:
++                id = JPEGEncodeParam.COLOR_ID_CMYK;
++                break;
++
++            default:
++                id = JPEGEncodeParam.COLOR_ID_UNKNOWN;
++        }
++
++        return id;
++    }
++}
+--- jdk/src/share/classes/com/sun/image/codec/jpeg/JPEGDecodeParam.java	1969-12-31 19:00:00.000000000 -0500
++++ jdk/src/share/classes/com/sun/image/codec/jpeg/JPEGDecodeParam.java	2011-07-07 09:19:34.000000000 -0400
+@@ -0,0 +1,390 @@
++/* JPEGImageDecoder.java --
++ * Copyright (C) 2007 Free Software Foundation, Inc.
++ * Copyright (C) 2007 Matthew Flaschen
++ *
++ * This file is part of GNU Classpath.
++ *
++ * GNU Classpath is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2, or (at your option)
++ * any later version.
++ *
++ * GNU Classpath is distributed in the hope that it will be useful, but
++ * WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with GNU Classpath; see the file COPYING. If not, write to the
++ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++ * 02110-1301 USA.
++ *
++ * Linking this library statically or dynamically with other modules is
++ * making a combined work based on this library. Thus, the terms and
++ * conditions of the GNU General Public License cover the whole
++ * combination.
++ *
++ * As a special exception, the copyright holders of this library give you
++ * permission to link this library with independent modules to produce an
++ * executable, regardless of the license terms of these independent
++ * modules, and to copy and distribute the resulting executable under
++ * terms of your choice, provided that you also meet, for each linked
++ * independent module, the terms and conditions of the license of that
++ * module. An independent module is a module which is not derived from
++ * or based on this library. If you modify this library, you may extend
++ * this exception to your version of the library, but you are not
++ * obligated to do so. If you do not wish to do so, delete this
++ * exception statement from your version.
++ */
++
++package com.sun.image.codec.jpeg;
++
++/**
++ * <p>
++ * JPEGDecodeParam encapsulates tables and options necessary to control decoding
++ * JPEG data streams. Parameters are either set explicitly by the application
++ * for encoding, or read from the JPEG header for decoding. In the case of
++ * decoding abbreviated data streams the application may need to set some/all of
++ * the values it's self.
++ * </p>
++ * <p>
++ * When working with BufferedImages (@see JPEGImageDecoder.decodeBufferedImage),
++ * the codec will attempt to generate an appropriate ColorModel for the JPEG
++ * COLOR_ID. This is not always possible (example mappings are listed below) .
++ * In cases where unsupported conversions are required, or unknown encoded
++ * COLOR_ID's are in use, the user must request the data as a Raster and perform
++ * the transformations themselves. When decoding into a raster (@see
++ * JPEGImageDecoder.decodeRaster) no ColorSpace adjustments are made. Note: The
++ * color ids described herein are simply enumerated values that influence data
++ * processing by the JPEG codec. JPEG compression is by definition color blind.
++ * These values are used as hints when decompressing JPEG data. Of particular
++ * interest is the default conversion from YCbCr to sRGB when decoding buffered
++ * Images.
++ * </p>
++ * <p>
++ * Note: because JPEG is mostly color-blind color fidelity can not be
++ * guaranteed. This will hopefully be rectified in the near future by the wide
++ * spread inclusion of ICC-profiles in the JPEG data stream (as a special
++ * marker). The following is an example of the conversions that take place. This
++ * is only a guide to the types of conversions that are allowed. This list is
++ * likely to change in the future so it is strongly recommended that you check
++ * for thrown ImageFormatExceptions and check the actual ColorModel associated
++ * with the BufferedImage returned rather than make assumptions.
++ * </p>
++ * DECODING:
++ *
++ * <pre>
++ * JPEG (Encoded) Color ID   BufferedImage ColorSpace
++ * =======================   ========================
++ * COLOR_ID_UNKNOWN          ** Invalid **
++ * COLOR_ID_GRAY             CS_GRAY
++ * COLOR_ID_RGB              CS_sRGB
++ * COLOR_ID_YCbCr            CS_sRGB
++ * COLOR_ID_CMYK             ** Invalid **
++ * COLOR_ID_PYCC             CS_PYCC
++ * COLOR_ID_RGBA             CS_sRGB (w/ alpha)
++ * COLOR_ID_YCbCrA           CS_sRGB (w/ alpha)
++ * COLOR_ID_RGBA_INVERTED    ** Invalid **
++ * COLOR_ID_YCbCrA_INVERTED  ** Invalid **
++ * COLOR_ID_PYCCA            CS_PYCC (w/ alpha)
++ * COLOR_ID_YCCK             ** Invalid **
++ * </pre>
++ * <p>
++ * If the user needs better control over conversion, the user must request the
++ * data as a Raster and handle the conversion of the image data themselves. When
++ * decoding JFIF files the encoded COLOR_ID will always be one of:
++ * COLOR_ID_UNKNOWN, COLOR_ID_GRAY, COLOR_ID_RGB, COLOR_ID_YCbCr, COLOR_ID_CMYK,
++ * or COLOR_ID_YCCK
++ * </p>
++ * <p>
++ * Note that the classes in the com.sun.image.codec.jpeg package are not part of
++ * the core Java APIs. They are a part of Sun's JDK and JRE distributions.
++ * Although other licensees may choose to distribute these classes, developers
++ * cannot depend on their availability in non-Sun implementations. We expect
++ * that equivalent functionality will eventually be available in a core API or
++ * standard extension.
++ * </p>
++ */
++public interface JPEGDecodeParam extends Cloneable {
++
++    /** APP0 marker - JFIF info */
++    public static final int APP0_MARKER = 0xE0;
++    /** APP1 marker */
++    public static final int APP1_MARKER = 0xE1;
++    /** APP2 marker */
++    public static final int APP2_MARKER = 0xE2;
++    /** APP3 marker */
++    public static final int APP3_MARKER = 0xE3;
++    /** APP4 marker */
++    public static final int APP4_MARKER = 0xE4;
++    /** APP5 marker */
++    public static final int APP5_MARKER = 0xE5;
++    /** APP6 marker */
++    public static final int APP6_MARKER = 0xE6;
++    /** APP7 marker */
++    public static final int APP7_MARKER = 0xE7;
++    /** APP8 marker */
++    public static final int APP8_MARKER = 0xE8;
++    /** APP9 marker */
++    public static final int APP9_MARKER = 0xE9;
++    /** APPA marker */
++    public static final int APPA_MARKER = 0xEA;
++    /** APPB marker */
++    public static final int APPB_MARKER = 0xEB;
++    /** APPC marker */
++    public static final int APPC_MARKER = 0xEC;
++    /** APPD marker */
++    public static final int APPD_MARKER = 0xED;
++    /** APPE marker - Adobe info */
++    public static final int APPE_MARKER = 0xEE;
++    /** APPF marker */
++    public static final int APPF_MARKER = 0xEF;
++    /** Adobe marker indicates presence/need for Adobe marker. */
++    public static final int COMMENT_MARKER = 0XFE;
++
++    /* Color ID values */
++    public static final int COLOR_ID_UNKNOWN = 0;
++    public static final int COLOR_ID_GRAY = 1;
++    public static final int COLOR_ID_RGB = 2;
++    public static final int COLOR_ID_YCbCr = 3;
++    public static final int COLOR_ID_CMYK = 4;
++    public static final int COLOR_ID_PYCC = 5;
++    public static final int COLOR_ID_RGBA = 6;
++    public static final int COLOR_ID_YCbCrA = 7;
++    public static final int COLOR_ID_RGBA_INVERTED = 8;
++    public static final int COLOR_ID_YCbCrA_INVERTED = 9;
++    public static final int COLOR_ID_PYCCA = 10;
++    public static final int COLOR_ID_YCCK = 11;
++    public static final int NUM_COLOR_ID = 12;
++
++    /** Number of allowed Huffman and Quantization Tables */
++    public static final int NUM_TABLES = 4;
++
++    /** The X and Y units simply indicate the aspect ratio of the pixels. */
++    public static final int DENSITY_UNIT_ASPECT_RATIO = 0;
++    /** Pixel density is in pixels per inch. */
++    public static final int DENSITY_UNIT_DOTS_INCH = 1;
++    /** Pixel density is in pixels per centimeter. */
++    public static final int DENSITY_UNIT_DOTS_CM = 2;
++    /** The max known value for DENSITY_UNIT */
++    public static final int NUM_DENSITY_UNIT = 3;
++
++    public Object clone();
++
++    /**
++     * Get the image width.
++     *
++     * @return int the width of the image data in pixels.
++     */
++    public int getWidth();
++
++    /**
++     * Get the image height.
++     *
++     * @return The height of the image data in pixels.
++     */
++    public int getHeight();
++
++    /**
++     * Return the Horizontal subsampling factor for requested Component. The
++     * Subsample factor is the number of input pixels that contribute to each
++     * output pixel. This is distinct from the way the JPEG to each output
++     * pixel. This is distinct from the way the JPEG standard defines this
++     * quantity, because fractional subsampling factors are not allowed.
++     *
++     * @param component
++     *            The component of the encoded image to return the subsampling
++     *            factor for.
++     * @return The subsample factor.
++     */
++    public int getHorizontalSubsampling(int component);
++
++    /**
++     * Return the Vertical subsampling factor for requested Component. The
++     * Subsample factor is the number of input pixels that contribute to each
++     * output pixel. This is distinct from the way the JPEG to each output
++     * pixel. This is distinct from the way the JPEG standard defines this
++     * quantity, because fractional subsampling factors are not allowed.
++     *
++     * @param component
++     *            The component of the encoded image to return the subsampling
++     *            factor for.
++     * @return The subsample factor.
++     */
++    public int getVerticalSubsampling(int component);
++
++    /**
++     * Returns the coefficient quantization tables or NULL if not defined.
++     * tableNum must range in value from 0 - 3.
++     *
++     * @param tableNum
++     *            the index of the table to be returned.
++     * @return Quantization table stored at index tableNum.
++     */
++    public JPEGQTable getQTable(int tableNum);
++
++    /**
++     * Returns the Quantization table for the requested component.
++     *
++     * @param component
++     *            the image component of interest.
++     * @return Quantization table associated with component
++     */
++    public JPEGQTable getQTableForComponent(int component);
++
++    /**
++     * Returns the DC Huffman coding table requested or null if not defined
++     *
++     * @param tableNum
++     *            the index of the table to be returned.
++     * @return Huffman table stored at index tableNum.
++     */
++    public JPEGHuffmanTable getDCHuffmanTable(int tableNum);
++
++    /**
++     * Returns the DC Huffman coding table for the requested component.
++     *
++     * @param component
++     *            the image component of interest.
++     * @return Huffman table associated with component
++     */
++    public JPEGHuffmanTable getDCHuffmanTableForComponent(int component);
++
++    /**
++     * Returns the AC Huffman coding table requested or null if not defined
++     *
++     * @param tableNum
++     *            the index of the table to be returned.
++     * @return Huffman table stored at index tableNum.
++     */
++    public JPEGHuffmanTable getACHuffmanTable(int tableNum);
++
++    /**
++     * Returns the AC Huffman coding table for the requested component.
++     *
++     * @param component
++     *            the image component of interest.
++     * @return Huffman table associated with component
++     */
++    public JPEGHuffmanTable getACHuffmanTableForComponent(int component);
++
++    /**
++     * Get the number of the DC Huffman table that will be used for a particular
++     * component.
++     *
++     * @param component
++     *            The Component of interest.
++     * @return The table number of the DC Huffman table for component.
++     */
++    public int getDCHuffmanComponentMapping(int component);
++
++    /**
++     * Get the number of the AC Huffman table that will be used for a particular
++     * component.
++     *
++     * @param component
++     *            The Component of interest.
++     * @return The table number of the AC Huffman table for component.
++     */
++    public int getACHuffmanComponentMapping(int component);
++
++    /**
++     * Get the number of the quantization table that will be used for a
++     * particular component.
++     *
++     * @param component
++     *            The Component of interest.
++     * @return The table number of the Quantization table for component.
++     */
++    public int getQTableComponentMapping(int component);
++
++    /**
++     * Returns true if the image information in the ParamBlock is currently
++     * valid. This indicates if image data was read from the stream for decoding
++     * and weather image data should be written when encoding.
++     */
++    public boolean isImageInfoValid();
++
++    /**
++     * Returns true if the tables in the ParamBlock are currently valid. This
++     * indicates that tables were read from the stream for decoding. When
++     * encoding this indicates whether tables should be written to the stream.
++     */
++    public boolean isTableInfoValid();
++
++    /**
++     * Returns true if at least one instance of the marker is present in the
++     * Parameter object. For encoding returns true if there is at least one
++     * instance of the marker to be written.
++     *
++     * @param marker
++     *            The marker of interest.
++     */
++    public boolean getMarker(int marker);
++
++    /**
++     * Returns a 'byte[][]' associated with the requested marker in the
++     * parameter object. Each entry in the 'byte[][]' is the data associated
++     * with one instance of the marker (each marker can theoretically appear any
++     * number of times in a stream).
++     *
++     * @param marker
++     *            The marker of interest.
++     * @return The 'byte[][]' for this marker or null if none available.
++     */
++    public byte[][] getMarkerData(int marker);
++
++    /**
++     * Returns the JPEG Encoded color id. This is generally speaking only used
++     * if you are decoding into Rasters. Note that when decoding into a Raster
++     * no color conversion is performed.
++     *
++     * @return The value of the JPEG encoded data's color id.
++     */
++    public int getEncodedColorID();
++
++    /**
++     * Returns the number of components for the current encoding COLOR_ID.
++     *
++     * @return the number of Components
++     */
++    public int getNumComponents();
++
++    /**
++     * Get the MCUs per restart marker.
++     *
++     * @return The number of MCUs between restart markers.
++     */
++    public int getRestartInterval();
++
++    /**
++     * Get the code for pixel size units This value is copied from the APP0
++     * marker. It isn't used by the JPEG codec. If the APP0 marker wasn't
++     * present then you can not rely on this value.
++     *
++     * @return Value indicating the density unit one of the DENSITY_UNIT_*
++     *         constants.
++     */
++    public int getDensityUnit();
++
++    /**
++     * Get the horizontal pixel density This value is copied from the APP0
++     * marker. It isn't used by the JPEG code. If the APP0 marker wasn't present
++     * then you can not rely on this value.
++     *
++     * @return The horizontal pixel density, in units described by
++     * @see #getDensityUnit()
++     */
++    public int getXDensity();
++
++    /**
++     * Get the vertical pixel density This value is copied into the APP0 marker.
++     * It isn't used by the JPEG code. If the APP0 marker wasn't present then
++     * you can not rely on this value.
++     *
++     * @return The vertical pixel density, in units described by
++     * @see #getDensityUnit()
++     */
++    public int getYDensity();
++
++}
+--- jdk/src/share/classes/com/sun/image/codec/jpeg/JPEGEncodeParam.java	1969-12-31 19:00:00.000000000 -0500
++++ jdk/src/share/classes/com/sun/image/codec/jpeg/JPEGEncodeParam.java	2011-07-07 09:19:34.000000000 -0400
+@@ -0,0 +1,307 @@
++/* JPEGEncodeParam.java --
++   Copyright (C) 2007 Free Software Foundation, Inc.
++
++   This file is part of GNU Classpath.
++
++   GNU Classpath is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 2, or (at your option)
++   any later version.
++
++   GNU Classpath is distributed in the hope that it will be useful, but
++   WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with GNU Classpath; see the file COPYING.  If not, write to the
++   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++   02110-1301 USA.
++
++   Linking this library statically or dynamically with other modules is
++   making a combined work based on this library.  Thus, the terms and
++   conditions of the GNU General Public License cover the whole
++   combination.
++
++   As a special exception, the copyright holders of this library give you
++   permission to link this library with independent modules to produce an
++   executable, regardless of the license terms of these independent
++   modules, and to copy and distribute the resulting executable under
++   terms of your choice, provided that you also meet, for each linked
++   independent module, the terms and conditions of the license of that
++   module.  An independent module is a module which is not derived from
++   or based on this library.  If you modify this library, you may extend
++   this exception to your version of the library, but you are not
++   obligated to do so.  If you do not wish to do so, delete this
++   exception statement from your version. */
++
++package com.sun.image.codec.jpeg;
++
++/**
++ * <p>
++ * JPEGEncodeParam encapsulates tables and options necessary to control encoding
++ * of JPEG data streams. Parameters are either set explicitly by the application
++ * for encoding, or read from another JPEG header.
++ * </p>
++ * <p>
++ * When working with BufferedImages, the codec will attempt to match the encoded
++ * JPEG COLOR_ID with the ColorModel in the BufferedImage. This is not always
++ * possible (the default mappings are listed below). In cases where unsupported
++ * conversions are required (or odd image colorspaces are in use) the user must
++ * either convert the image data to a known ColorSpace or encode the data from a
++ * raster. When encoding rasters no colorspace adjustments are made, so the user
++ * must do any conversions required to get to the encoded COLOR_ID. The COLOR_ID
++ * for the encoded images is used to control the JPEG codec's inital values for
++ * Huffman and Quantization Tables as well as subsampling factors. It is also
++ * used to determine what color conversion should be performed to obtain the
++ * best encoding.
++ * </p>
++ * <p>
++ * Note: The color ids described herein are simply enumerated values that
++ * influence data processing by the JPEG codec. JPEG compression is, by
++ * definition, color blind. These values are used as hints when compressing JPEG
++ * data. Through these values the JPEG codec can perform some default rotation
++ * of data into spaces that will aid in getting better compression ratios.
++ * </p>
++ * <p>
++ * Example behavior is described below. Since these mappings are likely to
++ * change in the future it is strongly recommended that you make use of the @see
++ * JPEGImageEncoder.getDefaultParamBlock calls and check the encodedColorID for
++ * your particular BufferedImage. In extreme cases is may be necessary for the
++ * user to convert the image to the desired colorspace, and encode it from a
++ * Raster. In this case the API programmer must specify the colorID of the data
++ * in the Raster and no color conversion will take place.
++ * </p>
++ *
++ * ENCODING:
++ *
++ * <pre>
++ * BufferedImage Type/Instance   JPEG (Encoded) Color ID
++ * ===========================   =======================
++ * TYPE_GRAY                     COLOR_ID_GRAYSCALE
++ * TYPE_RGB                      COLOR_ID_YCbCr
++ * TYPE_YCbCr                    COLOR_ID_YCbCr
++ * TYPE_YCbCr/CS_PYCC            COLOR_ID_PYCC
++ * TYPE_CMYK                     COLOR_ID_CMYK
++ * TYPE_RGB (w/ alpha)           COLOR_ID_YCbCrA
++ * TYPE_YCbCr (w/ alpha)         COLOR_ID_YCbCrA
++ * TYPE_YCbCr/CS_PYCC (w/ alpha) COLOR_ID_PYCCA
++ * ** Any Other **               COLOR_ID_UNKNOWN
++ * </pre>
++ * <p>
++ * When the user wants more control than the BufferedImage conversions provide,
++ * the user must encode the data from a Raster. In this case the data undergoes
++ * no color conversion at all. It is the user's responsibility to perform the
++ * desired conversions. If you intend to write a JFIF image (by including the
++ * APP0_MARKER) the encoded COLOR_ID must be one of: COLOR_ID_UNKNOWN,
++ * COLOR_ID_GRAYSCALE, COLOR_ID_YCbCr, or COLOR_ID_CMYK. In all other instances
++ * an ImageformatException will be thrown.
++ * </p>
++ * <p>
++ * IMPORTANT: an Alpha RGB BufferedImage will not map to a valid JFIF stream,
++ * you must strip off the alpha prior to encoding if you want a JFIF file. If
++ * the APP0 marker is set and you do not strip off the Alpha, an
++ * ImageFormatException will be thrown.
++ * </p>
++ * <p>
++ * Note that the classes in the com.sun.image.codec.jpeg package are not part of
++ * the core Java APIs. They are a part of Sun's JDK and JRE distributions.
++ * Although other licensees may choose to distribute these classes, developers
++ * cannot depend on their availability in non-Sun implementations. We expect
++ * that equivalent functionality will eventually be available in a core API or
++ * standard extension.
++ * </p>
++ */
++public interface JPEGEncodeParam extends JPEGDecodeParam {
++
++    /**
++     * Set the horizontal subsample factor for the given component. Note that
++     * the subsample factor is the number of input pixels that contribute to
++     * each output pixel (usually 2 for YCC).
++     *
++     * @param component
++     *            The component being specified.
++     * @param subsample
++     *            The subsampling factor being specified.
++     */
++    public void setHorizontalSubsampling(int component, int subsample);
++
++    /**
++     * Set the vertical subsample factor for the given component. Note that the
++     * subsample factor is the number of input pixels that contribute to each
++     * output pixel (usually 2 for YCC).
++     *
++     * @param component
++     *            The component being specified.
++     * @param subsample
++     *            The subsampling factor being specified.
++     */
++    public void setVerticalSubsampling(int component, int subsample);
++
++    /**
++     * Sets the coefficient quantization tables at index passed. tableNum must
++     * range in value from 0 - 3.
++     *
++     * @param qtable
++     *            that will be used.
++     * @param tableNum
++     *            the index of the table to be set.
++     */
++    public void setQTable(int tableNum, JPEGQTable qTable);
++
++    /**
++     * Sets the DC Huffman coding table at index to the table provided.
++     *
++     * @param huffTable
++     *            JPEGHuffmanTable that will be assigned to index tableNum.
++     * @param tableNum
++     *            - the index of the table to be set.
++     * @exception IllegalArgumentException
++     *                - thrown if the tableNum is out of range. Index must range
++     *                in value from 0 - 3.
++     */
++    public void setDCHuffmanTable(int tableNum, JPEGHuffmanTable huffTable);
++
++    /**
++     * Sets the AC Huffman coding table at index to the table provided.
++     *
++     * @param huffTable
++     *            JPEGHuffmanTable that will be assigned to index tableNum.
++     * @param tableNum
++     *            - the index of the table to be set.
++     * @exception IllegalArgumentException
++     *                - thrown if the tableNum is out of range. Index must range
++     *                in value from 0 - 3.
++     */
++    public void setACHuffmanTable(int tableNum, JPEGHuffmanTable huffTable);
++
++    /**
++     * Sets the mapping between a component and it's DC Huffman Table.
++     *
++     * @param component
++     *            The component to set the mapping for
++     * @param table
++     *            The DC Huffman table to use for component
++     */
++    public void setDCHuffmanComponentMapping(int component, int table);
++
++    /**
++     * Sets the mapping between a component and it's AC Huffman Table.
++     *
++     * @param component
++     *            The component to set the mapping for
++     * @param table
++     *            The AC Huffman table to use for component
++     */
++    public void setACHuffmanComponentMapping(int component, int table);
++
++    /**
++     * Sets the mapping between a component and it's Quantization Table.
++     *
++     * @param component
++     *            The component to set the mapping for
++     * @param table
++     *            The Quantization Table to use for component
++     */
++    public void setQTableComponentMapping(int component, int table);
++
++    /**
++     * Set the flag indicating the validity of the table information in the
++     * ParamBlock. This is used to indicate if tables should be included when
++     * encoding.
++     */
++    public void setImageInfoValid(boolean flag);
++
++    /**
++     * Set the flag indicating the validity of the image information in the
++     * ParamBlock. This is used to indicates if image data should be written
++     * when encoding.
++     */
++    public void setTableInfoValid(boolean flag);
++
++    /**
++     * Sets the marker data to be written to the output data stream. This
++     * removes any existing marker data in the JPEParm object. This can be used
++     * to remove the default APP0 marker by calling it with data set to null.
++     *
++     * @param marker
++     *            The marker to set the data for.
++     * @param data
++     *            the new set of data to be written.
++     */
++    public void setMarkerData(int marker, byte[][] data);
++
++    /**
++     * Appends 'data' to the array of byte[] associated with marker. This will
++     * result in additional instance of the marker being written (one for each
++     * byte[] in the array.).
++     *
++     * @param marker
++     *            The marker to add and instance of.
++     * @param data
++     *            the data to be written.
++     */
++    public void addMarkerData(int marker, byte[] data);
++
++    /**
++     * Set the MCUs per restart, or 0 for no restart markers.
++     *
++     * @param restartInterval
++     *            number MCUs per restart marker.
++     */
++    public void setRestartInterval(int restartInterval);
++
++    /**
++     * Set the pixel size units This value is copied into the APP0 marker (if
++     * that marker is written). This value isn't used by the JPEG code.
++     *
++     * @param unit
++     *            One of the DENSITY_UNIT_* values.
++     */
++    public void setDensityUnit(int unit);
++
++    /**
++     * Set the horizontal pixel density. This value is written into the APP0
++     * marker. It isn't used by the JPEG code.
++     *
++     * @param density
++     *            the horizontal pixel density, in units described by @see
++     *            JPEGParam.getDensityUnit.
++     */
++    public void setXDensity(int density);
++
++    /**
++     * Set the vertical pixel density. This value is copied into the JFIF APP0
++     * marker. It isn't used by the JPEG code.
++     *
++     * @param density
++     *            The vertical pixel density, in units described by @see
++     *            JPEGParam.getDensityUnit.
++     */
++    public void setYDensity(int density);
++
++    /**
++     * This creates new Quantization tables that replace the currently installed
++     * Quantization tables. It also updates the Component QTable mapping to the
++     * default for the current encoded COLOR_ID.
++     *
++     * The Created Quantization table varies from very high compression, very
++     * low quality, (0.0) to low compression, very high quality (1.0) based on
++     * the quality parameter.
++     *
++     * At a quality level of 1.0 the table will be all 1's which will lead to no
++     * loss of data due to quantization (however chrominance subsampling, if
++     * used, and roundoff error in the DCT will still degrade the image some
++     * what).
++     *
++     * This is a linear manipulation of the standard chrominance Q-Table.
++     *
++     * Some guidelines: 0.75 high quality 0.5 medium quality 0.25 low quality
++     *
++     * @param quality
++     *            0.0-1.0 setting of desired quality level.
++     * @param forceBaseline
++     *            force baseline quantization table
++     */
++    public void setQuality(float quality, boolean forceBaseline);
++}
+--- jdk/src/share/classes/com/sun/image/codec/jpeg/JPEGHuffmanTable.java	1969-12-31 19:00:00.000000000 -0500
++++ jdk/src/share/classes/com/sun/image/codec/jpeg/JPEGHuffmanTable.java	2011-07-07 09:19:34.000000000 -0400
+@@ -0,0 +1,129 @@
++/* JPEGHuffmanTable.java -- Huffman table implementation for JPEG.
++Copyright (C) 2011 Red Hat
++
++This program is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 2 of the License, or
++(at your option) any later version.
++
++This program is distributed in the hope that it will be useful, but
++WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with this program; if not, write to the Free Software
++Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++ */
++
++package com.sun.image.codec.jpeg;
++
++/**
++ * A class to encapsulate a JPEG Huffman table.
++ */
++public class JPEGHuffmanTable {
++
++    /**
++     * The standard DC luminance Huffman table.
++     */
++    public static final JPEGHuffmanTable StdDCLuminance;
++
++    /**
++     * The standard DC chrominance Huffman table.
++     */
++    public static final JPEGHuffmanTable StdDCChrominance;
++
++    /**
++     * The standard AC luminance Huffman table.
++     */
++    public static final JPEGHuffmanTable StdACLuminance;
++
++    /**
++     * The standard AC chrominance Huffman table.
++     */
++    public static final JPEGHuffmanTable StdACChrominance;
++
++    private short[] lengths;
++
++    private short[] symbols;
++
++    static {
++        javax.imageio.plugins.jpeg.JPEGHuffmanTable temp;
++
++        temp = javax.imageio.plugins.jpeg.JPEGHuffmanTable.StdDCLuminance;
++        StdDCLuminance = new JPEGHuffmanTable(temp.getLengths(),
++                temp.getValues());
++
++        temp = javax.imageio.plugins.jpeg.JPEGHuffmanTable.StdDCChrominance;
++        StdDCChrominance = new JPEGHuffmanTable(temp.getLengths(),
++                temp.getValues());
++
++        temp = javax.imageio.plugins.jpeg.JPEGHuffmanTable.StdACLuminance;
++        StdACLuminance = new JPEGHuffmanTable(temp.getLengths(),
++                temp.getValues());
++
++        temp = javax.imageio.plugins.jpeg.JPEGHuffmanTable.StdACChrominance;
++        StdACChrominance = new JPEGHuffmanTable(temp.getLengths(),
++                temp.getValues());
++    }
++
++    /**
++     * Creates a Huffman table and initializes it. The input arrays are copied.
++     * The arrays must describe a possible Huffman table. For example, 3 codes
++     * cannot be expressed with a single bit.
++     *
++     * @param lengths
++     *            an array of {@code short}s where <code>lengths[k]</code> is
++     *            equal to the number of values with corresponding codes of
++     *            length <code>k + 1</code> bits.
++     * @param values
++     *            an array of shorts containing the values in order of
++     *            increasing code length.
++     * @throws IllegalArgumentException
++     *             if <code>lengths</code> or <code>values</code> are null, the
++     *             length of <code>lengths</code> is greater than 16, the length
++     *             of <code>values</code> is greater than 256, if any value in
++     *             <code>lengths</code> or <code>values</code> is less than
++     *             zero, or if the arrays do not describe a valid Huffman table.
++     */
++    public JPEGHuffmanTable(short lengths[], short symbols[]) {
++        if (lengths == null)
++            throw new IllegalArgumentException("lengths array can not be null.");
++        if (symbols == null)
++            throw new IllegalArgumentException("symbols array can not be null.");
++        if (lengths.length > 17)
++            throw new IllegalArgumentException("lengths array can not be longer than 17.");
++        if (symbols.length > 256)
++            throw new IllegalArgumentException("symbols array can not be longer than 256.");
++        for (int a = 0; a < lengths.length; ++a)
++            if (lengths[a] < 0)
++                throw new IllegalArgumentException("length " + a + " is smaller than zero.");
++        for (int a = 0; a < symbols.length; ++a)
++            if (symbols[a] < 0)
++                throw new IllegalArgumentException("symbol " + a + " is smaller than zero.");
++        this.lengths = lengths;
++        this.symbols = symbols;
++    }
++
++    /**
++     * Return an array containing the number of symbols for each length in
++     * the Huffman table.
++     *
++     * @return A short array where length[a] is equal to the number of symbols
++     *         in the Huffman table of length a.  The first element (length[0])
++     *         is unused.
++     */
++    public short[] getLengths() {
++        return lengths;
++    }
++
++    /**
++     * Return an array containing the Huffman symbols arranged by increasing
++     * length. To make use of this array you must refer to the lengths array.
++     *
++     * @return A short array of Huffman symbols
++     */
++    public short[] getSymbols() {
++        return symbols;
++    }
++}
+--- jdk/src/share/classes/com/sun/image/codec/jpeg/JPEGImageDecoder.java	1969-12-31 19:00:00.000000000 -0500
++++ jdk/src/share/classes/com/sun/image/codec/jpeg/JPEGImageDecoder.java	2011-07-07 09:19:34.000000000 -0400
+@@ -0,0 +1,102 @@
++/* JPEGImageDecoder.java --
++   Copyright (C) 2007 Free Software Foundation, Inc.
++   Copyright (C) 2007 Matthew Flaschen
++
++   This file is part of GNU Classpath.
++
++   GNU Classpath is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 2, or (at your option)
++   any later version.
++
++   GNU Classpath is distributed in the hope that it will be useful, but
++   WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with GNU Classpath; see the file COPYING.  If not, write to the
++   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++   02110-1301 USA.
++
++   Linking this library statically or dynamically with other modules is
++   making a combined work based on this library.  Thus, the terms and
++   conditions of the GNU General Public License cover the whole
++   combination.
++
++   As a special exception, the copyright holders of this library give you
++   permission to link this library with independent modules to produce an
++   executable, regardless of the license terms of these independent
++   modules, and to copy and distribute the resulting executable under
++   terms of your choice, provided that you also meet, for each linked
++   independent module, the terms and conditions of the license of that
++   module.  An independent module is a module which is not derived from
++   or based on this library.  If you modify this library, you may extend
++   this exception to your version of the library, but you are not
++   obligated to do so.  If you do not wish to do so, delete this
++   exception statement from your version. */
++
++package com.sun.image.codec.jpeg;
++
++import java.awt.image.BufferedImage;
++import java.awt.image.Raster;
++
++import java.io.InputStream;
++import java.io.IOException;
++
++public interface JPEGImageDecoder {
++
++    /**
++     * Decodes the current JPEG data stream. The result of decoding this
++     * InputStream is a BufferedImage the ColorModel associated with this
++     * BufferedImage is determined based on the encoded COLOR_ID of the
++     * JPEGDecodeParam object. For a tables only stream this will return null.
++     *
++     * @return BufferedImage containing the image data.
++     * @throws ImageFormatException
++     *             If irregularities in the JPEG stream or an unknown condition
++     *             is encountered.
++     * @throws IOException
++     */
++    public BufferedImage decodeAsBufferedImage() throws IOException,
++            ImageFormatException;
++
++    /**
++     * Decode the JPEG stream that was passed as part of construction. The JPEG
++     * decompression will be performed according to the current settings of the
++     * JPEGDecodeParam object. For a tables only stream this will return null.
++     *
++     * @return Raster containg the image data. Colorspace and other pertinent
++     *         information can be obtained from the JPEGDecodeParam object.
++     * @throws ImageFormatException
++     *             If irregularities in the JPEG stream or an unknown condition
++     *             is encountered.
++     * @throws IOException
++     */
++    public Raster decodeAsRaster() throws IOException, ImageFormatException;
++
++    /**
++     * Get the input stream that decoding will occur from.
++     *
++     * @return The stream that the decoder is currently associated with.
++     */
++    public InputStream getInputStream();
++
++    /**
++     * Returns the JPEGDecodeParam object that resulted from the most recent
++     * decoding event.
++     *
++     * @return
++     */
++    public JPEGDecodeParam getJPEGDecodeParam();
++
++    /**
++     * Sets the JPEGDecodeParam object used to determine the features of the
++     * decompression performed on the JPEG encoded data. This is usually only
++     * needed for decoding abbreviated JPEG data streams.
++     *
++     * @param jdp
++     *            JPEGDecodeParam object
++     */
++    public void setJPEGDecodeParam(JPEGDecodeParam jdp);
++}
+--- jdk/src/share/classes/com/sun/image/codec/jpeg/JPEGImageEncoder.java	1969-12-31 19:00:00.000000000 -0500
++++ jdk/src/share/classes/com/sun/image/codec/jpeg/JPEGImageEncoder.java	2011-07-07 09:19:34.000000000 -0400
+@@ -0,0 +1,208 @@
++/* JPEGImageEncoder.java --
++   Copyright (C) 2007 Free Software Foundation, Inc.
++
++   This file is part of GNU Classpath.
++
++   GNU Classpath is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 2, or (at your option)
++   any later version.
++
++   GNU Classpath is distributed in the hope that it will be useful, but
++   WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with GNU Classpath; see the file COPYING.  If not, write to the
++   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++   02110-1301 USA.
++
++   Linking this library statically or dynamically with other modules is
++   making a combined work based on this library.  Thus, the terms and
++   conditions of the GNU General Public License cover the whole
++   combination.
++
++   As a special exception, the copyright holders of this library give you
++   permission to link this library with independent modules to produce an
++   executable, regardless of the license terms of these independent
++   modules, and to copy and distribute the resulting executable under
++   terms of your choice, provided that you also meet, for each linked
++   independent module, the terms and conditions of the license of that
++   module.  An independent module is a module which is not derived from
++   or based on this library.  If you modify this library, you may extend
++   this exception to your version of the library, but you are not
++   obligated to do so.  If you do not wish to do so, delete this
++   exception statement from your version. */
++
++package com.sun.image.codec.jpeg;
++
++import java.io.OutputStream;
++import java.io.IOException;
++
++import java.awt.image.BufferedImage;
++import java.awt.image.ColorModel;
++import java.awt.image.Raster;
++
++public interface JPEGImageEncoder {
++    /**
++     * This is a factory method for creating JPEGEncodeParam objects. The
++     * returned object will do a credible job of encoding the given
++     * BufferedImage.
++     *
++     * @param bi
++     * @return
++     * @throws ImageFormatException
++     */
++    public JPEGEncodeParam getDefaultJPEGEncodeParam(BufferedImage bi)
++            throws ImageFormatException;
++
++    /**
++     * This is a factory method for creating JPEGEncodeParam objects. It is the
++     * users responsibility to match the colorID with the given number of bands,
++     * which should match the data being encoded. Failure to do so may lead to
++     * poor compression and/or poor image quality. If you don't understand much
++     * about JPEG it is strongly recommended that you stick to the BufferedImage
++     * interface.
++     *
++     * @param numBands
++     *            the number of bands that will be encoded (max of four).
++     * @param colorID
++     *            the COLOR_ID for the encoded data. This is used to set
++     *            reasonable defaults in the parameter object. This must match
++     *            the number of bands given.
++     * @return
++     * @throws ImageFormatException
++     */
++    public JPEGEncodeParam getDefaultJPEGEncodeParam(int numBands, int colorID)
++            throws ImageFormatException;
++
++    /**
++     * This is a factory method for creating a JPEGEncodeParam from a
++     * JPEGDecodeParam. This will return a new JPEGEncodeParam object that is
++     * initialized from the JPEGDecodeParam object. All major pieces of
++     * information will be initialized from the DecodeParam (Markers, Tables,
++     * mappings).
++     *
++     * @param d
++     *            The JPEGDecodeParam object to copy.
++     * @return
++     * @throws ImageFormatException
++     */
++    public JPEGEncodeParam getDefaultJPEGEncodeParam(JPEGDecodeParam d)
++            throws ImageFormatException;
++
++    /**
++     * This is a factory method for creating JPEGEncodeParam objects. It is the
++     * users responsiblity to match the colorID with the data contained in the
++     * Raster. Failure to do so may lead to either poor compression or poor
++     * image quality. If you don't understand much about JPEG it is strongly
++     * reccomended that you stick to the BufferedImage interfaces.
++     *
++     * @param ras
++     * @param colorID
++     * @return
++     * @throws ImageFormatException
++     */
++    public JPEGEncodeParam getDefaultJPEGEncodeParam(Raster ras, int colorID)
++            throws ImageFormatException;
++
++    public JPEGEncodeParam getJPEGEncodeParam() throws ImageFormatException;
++
++    /**
++     * Set the JPEGEncodeParam object that is to be used for future encoding
++     * operations. 'p' is copied so changes will not be tracked, unless you call
++     * this method again.
++     *
++     * @param p
++     *            The JPEGEncodeParam object to use for future encodings.
++     */
++    public void setJPEGEncodeParam(JPEGEncodeParam p);
++
++    /**
++     * Return the stream the Encoder is current associated with.
++     *
++     * @return
++     */
++    public OutputStream getOutputStream();
++
++    /**
++     * Encode a BufferedImage as a JPEG data stream. Note, some color
++     * conversions may takes place. The jep's encoded COLOR_ID should match the
++     * value returned by getDefaultColorID when given the BufferedImage's
++     * ColorModel. This call also sets the current JPEGEncodeParam object. The
++     * given JPEGEncodeParam object will be used for this and future encodings.
++     * If p is null then a new JPEGEncodeParam object will be created by calling
++     * getDefaultJPEGEncodeParam with bi.
++     *
++     * @param bi
++     *            The BufferedImage to encode.
++     * @param p
++     *            The JPEGEncodeParam object used to control the encoding.
++     * @throws IOException
++     * @throws ImageFormatException
++     */
++    public void encode(BufferedImage bi, JPEGEncodeParam p) throws IOException,
++            ImageFormatException;
++
++    /**
++     * Encode a Raster as a JPEG data stream. Note that no color conversion
++     * takes place. It is required that you match the Raster to the encoded
++     * COLOR_ID contained in the current JPEGEncodeParam object. If no
++     * JPEGEncodeParam object has been provided yet a new JPEGEncodeParam object
++     * will be created by calling getDefaultJPEGEncodeParam with ras and
++     * COLOR_ID_UNKNOWN.
++     *
++     * @param ras
++     *            The Raster to encode.
++     * @throws IOException
++     * @throws ImageFormatException
++     */
++    public void encode(Raster ras) throws IOException, ImageFormatException;
++
++    /**
++     * Encode a BufferedImage as a JPEG data stream. Note, some color
++     * conversions may takes place. The current JPEGEncodeParam's encoded
++     * COLOR_ID should match the value returned by getDefaultColorID when given
++     * the BufferedImage's ColorModel. If no JPEGEncodeParam object has been
++     * provided yet a default one will be created by calling
++     * getDefaultJPEGEncodeParam with bi.
++     *
++     * @param bi
++     *            The BufferedImage to encode.
++     * @throws IOException
++     * @throws ImageFormatException
++     */
++    public void encode(BufferedImage bi) throws IOException,
++            ImageFormatException;
++
++    /**
++     * Encode a Raster as a JPEG data stream. Note that no color conversion
++     * takes place. It is required that you match the Raster to the encoded
++     * COLOR_ID contained in the JPEGEncodeParam object. If p is null a new
++     * JPEGEncodeParam object will be created by calling
++     * getDefaultJPEGEncodeParam with ras and COLOR_ID_UNKNOWN.
++     *
++     * @param ras
++     *            The Raster to encode.
++     * @param p
++     *            The JPEGEncodeParam object used to control the encoding.
++     * @throws IOException
++     * @throws ImageFormatException
++     */
++    public void encode(Raster ras, JPEGEncodeParam p) throws IOException,
++            ImageFormatException;
++
++    /**
++     * Returns the 'default' encoded COLOR_ID for a given ColorModel. This
++     * method is not needed in the simple case of encoding Buffered Images (the
++     * library will figure things out for you). It can be useful for encoding
++     * Rasters. To determine what needs to be done to the image prior to
++     * encoding.
++     *
++     * @param cm
++     *            The ColorModel to map to an jpeg encoded COLOR_ID.
++     * @return
++     */
++    public int getDefaultColorId(ColorModel cm);
++}
+--- jdk/src/share/classes/com/sun/image/codec/jpeg/JPEGQTable.java	1969-12-31 19:00:00.000000000 -0500
++++ jdk/src/share/classes/com/sun/image/codec/jpeg/JPEGQTable.java	2011-07-07 09:19:34.000000000 -0400
+@@ -0,0 +1,118 @@
++/* JPEGQTable.java --
++   Copyright (C) 2011 Red Hat
++   Copyright (C) 2007 Free Software Foundation, Inc.
++   Copyright (C) 2007 Matthew Flaschen
++
++   This file is part of GNU Classpath.
++
++   GNU Classpath is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 2, or (at your option)
++   any later version.
++
++   GNU Classpath is distributed in the hope that it will be useful, but
++   WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with GNU Classpath; see the file COPYING.  If not, write to the
++   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++   02110-1301 USA.
++
++   Linking this library statically or dynamically with other modules is
++   making a combined work based on this library.  Thus, the terms and
++   conditions of the GNU General Public License cover the whole
++   combination.
++
++   As a special exception, the copyright holders of this library give you
++   permission to link this library with independent modules to produce an
++   executable, regardless of the license terms of these independent
++   modules, and to copy and distribute the resulting executable under
++   terms of your choice, provided that you also meet, for each linked
++   independent module, the terms and conditions of the license of that
++   module.  An independent module is a module which is not derived from
++   or based on this library.  If you modify this library, you may extend
++   this exception to your version of the library, but you are not
++   obligated to do so.  If you do not wish to do so, delete this
++   exception statement from your version. */
++
++package com.sun.image.codec.jpeg;
++
++import java.util.Arrays;
++
++/**
++ * Class to encapsulate the JPEG quantization tables.
++ *
++ * Note: The tables K1Luminance, K1Div2Luminance, K2Chrominance,
++ * K2Div2Chrominance is an instance of the superclass.
++ *
++ * @author Andrew Su (asu at redhat.com)
++ *
++ */
++public class JPEGQTable {
++
++    /**
++     * Luminance quantization table (in zig-zag order).
++     */
++    public static final JPEGQTable StdLuminance;
++
++    /**
++     * Chromninance quantization table (in zig-zag order).
++     */
++    public static final JPEGQTable StdChrominance;
++
++    static {
++        /* table for luminance values in zig-zag order */
++        int[] table1 = { 16, 11, 12, 14, 12, 10, 16, 14, 13, 14, 18, 17, 16,
++                19, 24, 40, 26, 24, 22, 22, 24, 49, 35, 37, 29, 40, 58, 51, 61,
++                60, 57, 51, 56, 55, 64, 72, 92, 78, 64, 68, 87, 69, 55, 56, 80,
++                109, 81, 87, 95, 98, 103, 104, 103, 62, 77, 113, 121, 112, 100,
++                120, 92, 101, 103, 99 };
++
++        StdLuminance = new JPEGQTable(table1);
++
++        /* table for chrominance values in zig-zag order */
++        int[] table2 = { 17, 18, 18, 24, 21, 24, 47, 26, 26, 47, 99, 66, 56,
++                66, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
++                99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
++                99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
++                99, 99, 99 };
++        StdChrominance = new JPEGQTable(table2);
++    }
++
++    private int[] table;
++
++    /**
++     * Constructs an quantization table from the array that was passed. The
++     * coefficients must be in zig-zag order. The array must be of length 64.
++     * The table will be copied.
++     *
++     * @param table
++     *            the quantization table, as an int array.
++     * @throws IllegalArgumentException
++     *             if table is null or table.length is not equal to 64.
++     */
++    public JPEGQTable(int[] table) {
++        /* Table must be 8x8 thus 64 entries */
++        if (table == null || table.length != 64) {
++            throw new IllegalArgumentException("Not a valid table.");
++        }
++        this.table = Arrays.copyOf(table, table.length);
++    }
++
++    public int[] getTable() {
++        return Arrays.copyOf(table, table.length);
++    }
++
++    public JPEGQTable getScaledInstance(float scaleFactor, boolean forceBaseline) {
++        int limit = (forceBaseline) ? 255 : 32767;
++        int[] newTable = new int[table.length];
++        for (int i = 0; i < table.length; i++) {
++            int newValue = Math.round(table[i] * scaleFactor);
++            newTable[i] = (newValue < 1) ? 1 : (newValue > limit) ? limit : newValue;
++        }
++        return new JPEGQTable(newTable);
++    }
++
++}
+--- jdk/src/share/classes/com/sun/image/codec/jpeg/TruncatedFileException.java	1969-12-31 19:00:00.000000000 -0500
++++ jdk/src/share/classes/com/sun/image/codec/jpeg/TruncatedFileException.java	2011-07-07 09:19:34.000000000 -0400
+@@ -0,0 +1,92 @@
++/* TruncatedFileException.java
++   Copyright (C) 2007 Matthew Flaschen
++   Copyright (C) 2011 Red Hat, Inc.
++
++   This file is part of IcedTea
++
++   IcedTea is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 2, or (at your option)
++   any later version.
++
++   IcedTea is distributed in the hope that it will be useful, but
++   WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with GNU Classpath; see the file COPYING.  If not, write to the
++   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++   02110-1301 USA.
++
++   Linking this library statically or dynamically with other modules is
++   making a combined work based on this library.  Thus, the terms and
++   conditions of the GNU General Public License cover the whole
++   combination.
++
++   As a special exception, the copyright holders of this library give you
++   permission to link this library with independent modules to produce an
++   executable, regardless of the license terms of these independent
++   modules, and to copy and distribute the resulting executable under
++   terms of your choice, provided that you also meet, for each linked
++   independent module, the terms and conditions of the license of that
++   module.  An independent module is a module which is not derived from
++   or based on this library.  If you modify this library, you may extend
++   this exception to your version of the library, but you are not
++   obligated to do so.  If you do not wish to do so, delete this
++   exception statement from your version. */
++
++package com.sun.image.codec.jpeg;
++
++import java.awt.image.BufferedImage;
++import java.awt.image.Raster;
++
++public class TruncatedFileException extends RuntimeException {
++
++    private final BufferedImage bufferedImage;
++
++    private final Raster raster;
++
++    /**
++     * Creates a new exception with the specified {@link BufferedImage}
++     * containing the partially read image data.
++     *
++     * @param bufferedImage the partially decoded image (may be null).
++     */
++    public TruncatedFileException(BufferedImage bufferedImage) {
++        this.bufferedImage = bufferedImage;
++        this.raster = null;
++    }
++
++    /**
++     * Creates a new exception with the specified {@link Raster}
++     * containing the partially read image data.
++     *
++     * @param raster the partially decoded image (may be null).
++     */
++    public TruncatedFileException(Raster raster) {
++        this.raster = raster;
++        this.bufferedImage = null;
++    }
++
++    /**
++     * Returns the partially read data as a {@link BufferedImage}
++     * if available, or {@code null} if not.
++     *
++     * @return the partially read data.
++     */
++    public BufferedImage getBufferedImage() {
++        return bufferedImage;
++    }
++
++    /**
++     * Returns the partially read data as a {@link Raster}
++     * if available, or {@code null} if not.
++     *
++     * @return the partially read data.
++     */
++    public Raster getRaster() {
++        return raster;
++    }
++
++}
+--- jdk/src/share/classes/sun/awt/image/codec/JPEGImageDecoderImpl.java	1969-12-31 19:00:00.000000000 -0500
++++ jdk/src/share/classes/sun/awt/image/codec/JPEGImageDecoderImpl.java	2011-07-07 09:19:34.000000000 -0400
+@@ -0,0 +1,108 @@
++/* JPEGImageDecoderImpl.java -- JPEG decoder implementation
++Copyright (C) 2011 Red Hat
++
++This program is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 2 of the License, or
++(at your option) any later version.
++
++This program is distributed in the hope that it will be useful, but
++WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with this program; if not, write to the Free Software
++Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++ */
++package sun.awt.image.codec;
++
++import java.awt.image.BufferedImage;
++import java.awt.image.Raster;
++import java.io.IOException;
++import java.io.InputStream;
++import java.util.Iterator;
++
++import javax.imageio.ImageIO;
++import javax.imageio.ImageReader;
++import javax.imageio.plugins.jpeg.JPEGHuffmanTable;
++import javax.imageio.plugins.jpeg.JPEGImageReadParam;
++import javax.imageio.plugins.jpeg.JPEGQTable;
++import javax.imageio.stream.MemoryCacheImageInputStream;
++
++import com.sun.image.codec.jpeg.ImageFormatException;
++import com.sun.image.codec.jpeg.JPEGDecodeParam;
++import com.sun.image.codec.jpeg.JPEGImageDecoder;
++import com.sun.imageio.plugins.jpeg.JPEGImageReader;
++
++/**
++ * This class provides the implementation for a JPEG decoder.
++ */
++public class JPEGImageDecoderImpl implements JPEGImageDecoder {
++    private static final String JPGMime = "image/jpeg";
++
++    private JPEGImageReader JPGReader;
++    private InputStream in;
++    private JPEGDecodeParam param;
++
++    public JPEGImageDecoderImpl(InputStream in) {
++        this(in, null);
++    }
++
++    public JPEGImageDecoderImpl(InputStream in, JPEGDecodeParam param) {
++        this.in = in;
++        setJPEGDecodeParam(param);
++
++        Iterator<ImageReader> JPGReaderIter = ImageIO
++                .getImageReadersByMIMEType(JPGMime);
++        if (JPGReaderIter.hasNext()) {
++            JPGReader = (JPEGImageReader) JPGReaderIter.next();
++        }
++
++        JPGReader.setInput(new MemoryCacheImageInputStream(in));
++    }
++
++    public BufferedImage decodeAsBufferedImage() throws IOException,
++            ImageFormatException {
++        JPEGImageReadParam irp = null;
++
++        if (param != null) {
++            // We should do more than this, but it's a start.
++            JPEGQTable[] qTables = new JPEGQTable[4];
++            JPEGHuffmanTable[] DCHuffmanTables = new JPEGHuffmanTable[4];
++            JPEGHuffmanTable[] ACHuffmanTables = new JPEGHuffmanTable[4];
++
++            for (int i = 0; i < 4; i++) {
++                qTables[i] = new JPEGQTable(param.getQTable(i).getTable());
++                com.sun.image.codec.jpeg.JPEGHuffmanTable dcHuffman = param.getDCHuffmanTable(i);
++                com.sun.image.codec.jpeg.JPEGHuffmanTable acHuffman = param.getACHuffmanTable(i);
++                DCHuffmanTables[i] = new JPEGHuffmanTable(dcHuffman.getLengths(),
++                                                          dcHuffman.getSymbols());
++                ACHuffmanTables[i] = new JPEGHuffmanTable(acHuffman.getLengths(),
++                                                          dcHuffman.getSymbols());
++            }
++
++            irp = new JPEGImageReadParam();
++            irp.setDecodeTables(qTables, DCHuffmanTables, ACHuffmanTables);
++        }
++
++        return JPGReader.read(0, irp);
++    }
++
++    public Raster decodeAsRaster() throws IOException, ImageFormatException {
++        return JPGReader.readRaster(0, null);
++    }
++
++    public InputStream getInputStream() {
++        return in;
++    }
++
++    public JPEGDecodeParam getJPEGDecodeParam() {
++        if (param == null) return null;
++        return (JPEGDecodeParam) param.clone();
++    }
++
++    public void setJPEGDecodeParam(JPEGDecodeParam jdp) {
++        param = jdp;
++    }
++}
+--- jdk/src/share/classes/sun/awt/image/codec/JPEGImageEncoderImpl.java	1969-12-31 19:00:00.000000000 -0500
++++ jdk/src/share/classes/sun/awt/image/codec/JPEGImageEncoderImpl.java	2011-07-07 09:19:34.000000000 -0400
+@@ -0,0 +1,183 @@
++/* JPEGImageEncoder.java -- JPEG encoder implementation
++Copyright (C) 2011 Red Hat
++
++This program is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 2 of the License, or
++(at your option) any later version.
++
++This program is distributed in the hope that it will be useful, but
++WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with this program; if not, write to the Free Software
++Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++ */
++package sun.awt.image.codec;
++
++import java.awt.color.ColorSpace;
++import java.awt.image.BufferedImage;
++import java.awt.image.ColorModel;
++import java.awt.image.Raster;
++import java.io.IOException;
++import java.io.OutputStream;
++import java.util.ArrayList;
++import java.util.Iterator;
++
++import javax.imageio.IIOImage;
++import javax.imageio.ImageIO;
++import javax.imageio.ImageWriteParam;
++import javax.imageio.ImageWriter;
++import javax.imageio.plugins.jpeg.JPEGImageWriteParam;
++import javax.imageio.stream.MemoryCacheImageOutputStream;
++
++import com.sun.image.codec.jpeg.ImageFormatException;
++import com.sun.image.codec.jpeg.JPEGCodec;
++import com.sun.image.codec.jpeg.JPEGDecodeParam;
++import com.sun.image.codec.jpeg.JPEGEncodeParam;
++import com.sun.image.codec.jpeg.JPEGImageEncoder;
++import com.sun.imageio.plugins.jpeg.JPEG;
++
++/**
++ * This class provides the implementation for encoding JPEG images.
++ *
++ */
++public class JPEGImageEncoderImpl implements JPEGImageEncoder {
++    private static final String JPGMime = "image/jpeg";
++
++    private ImageWriter JPGWriter;
++    private JPEGEncodeParam param;
++    private OutputStream out;
++
++    public JPEGImageEncoderImpl(OutputStream os) {
++        this(os, null);
++    }
++
++    public JPEGImageEncoderImpl(OutputStream out, JPEGEncodeParam newParam) {
++        this.out = out;
++        setJPEGEncodeParam(newParam);
++
++        Iterator<ImageWriter> JPGWriterIter = ImageIO
++                .getImageWritersByMIMEType(JPGMime);
++        if (JPGWriterIter.hasNext()) {
++            JPGWriter = JPGWriterIter.next();
++        }
++
++        JPGWriter.setOutput(new MemoryCacheImageOutputStream(out));
++    }
++
++    public JPEGEncodeParam getDefaultJPEGEncodeParam(BufferedImage bi)
++            throws ImageFormatException {
++        return JPEGCodec.getDefaultJPEGEncodeParam(bi);
++    }
++
++    public JPEGEncodeParam getDefaultJPEGEncodeParam(int numBands, int colorID)
++            throws ImageFormatException {
++        return JPEGCodec.getDefaultJPEGEncodeParam(numBands, colorID);
++    }
++
++    public JPEGEncodeParam getDefaultJPEGEncodeParam(JPEGDecodeParam d)
++            throws ImageFormatException {
++        return JPEGCodec.getDefaultJPEGEncodeParam(d);
++    }
++
++    public JPEGEncodeParam getDefaultJPEGEncodeParam(Raster ras, int colorID)
++            throws ImageFormatException {
++        return JPEGCodec.getDefaultJPEGEncodeParam(ras, colorID);
++    }
++
++    public JPEGEncodeParam getJPEGEncodeParam() throws ImageFormatException {
++        if (param == null)
++            return null;
++        return (JPEGEncodeParam) param.clone();
++    }
++
++    public void setJPEGEncodeParam(JPEGEncodeParam p) {
++        param = p;
++    }
++
++    public OutputStream getOutputStream() {
++        return out;
++    }
++
++    private void encode(IIOImage img) throws IOException, ImageFormatException {
++        if (JPGWriter == null)
++            throw new ImageFormatException(
++                    "JPEG writer code not implemented in ImageIO");
++
++        JPEGImageWriteParam jiwp = new JPEGImageWriteParam(null);
++        ;
++        jiwp.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
++        if (param != null && param instanceof JPEGParam) {
++            JPEGParam jp = (JPEGParam) param;
++            jiwp.setCompressionQuality(jp.getQuality());
++        } else {
++            jiwp.setCompressionQuality(JPEG.DEFAULT_QUALITY);
++        }
++
++        JPGWriter.write(null, img, jiwp);
++    }
++
++    public void encode(BufferedImage bi, JPEGEncodeParam writeParam)
++            throws IOException, ImageFormatException {
++        setJPEGEncodeParam(writeParam);
++        encode(new IIOImage(bi, new ArrayList<BufferedImage>(), null));
++    }
++
++    public void encode(Raster rs, JPEGEncodeParam writeParam)
++            throws IOException, ImageFormatException {
++        setJPEGEncodeParam(writeParam);
++        encode(new IIOImage(rs, new ArrayList<BufferedImage>(), null));
++    }
++
++    public void encode(BufferedImage bi) throws IOException,
++            ImageFormatException {
++        encode(bi, null);
++    }
++
++    public void encode(Raster rs) throws IOException, ImageFormatException {
++        encode(rs, null);
++    }
++
++    @Override
++    public int getDefaultColorId(ColorModel cm) {
++        ColorSpace cs = cm.getColorSpace();
++        int type = cs.getType();
++        int id = -1;
++        switch (type) {
++            case ColorSpace.TYPE_GRAY:
++                id = JPEGEncodeParam.COLOR_ID_GRAY;
++                break;
++
++            case ColorSpace.TYPE_RGB:
++                id = cm.hasAlpha() ? JPEGEncodeParam.COLOR_ID_RGBA
++                        : JPEGEncodeParam.COLOR_ID_RGB;
++
++            case ColorSpace.TYPE_YCbCr:
++                try {
++                    if (cs == ColorSpace.getInstance(ColorSpace.CS_PYCC)) {
++                        id = cm.hasAlpha() ? JPEGEncodeParam.COLOR_ID_PYCCA
++                                : JPEGEncodeParam.COLOR_ID_PYCC;
++                    }
++                } catch (IllegalArgumentException e) {
++                    /* We know it isn't PYCC type, nothing to handle */
++                }
++                if (id == -1) {
++                    id = cm.hasAlpha() ? JPEGEncodeParam.COLOR_ID_YCbCrA
++                            : JPEGEncodeParam.COLOR_ID_YCbCr;
++                }
++                break;
++
++            case ColorSpace.TYPE_CMYK:
++                id = JPEGEncodeParam.COLOR_ID_CMYK;
++                break;
++
++            default:
++                id = JPEGEncodeParam.COLOR_ID_UNKNOWN;
++        }
++
++        return id;
++    }
++}
+--- jdk/src/share/classes/sun/awt/image/codec/JPEGParam.java	1969-12-31 19:00:00.000000000 -0500
++++ jdk/src/share/classes/sun/awt/image/codec/JPEGParam.java	2011-07-07 09:19:34.000000000 -0400
+@@ -0,0 +1,750 @@
++/* JPEGParam.java -- keeps track of encode and decode parameters for JPEG.
++ * Copyright (C) 2011 Red Hat
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful, but
++ * WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++ */
++package sun.awt.image.codec;
++
++import java.util.Arrays;
++
++import com.sun.image.codec.jpeg.JPEGDecodeParam;
++import com.sun.image.codec.jpeg.JPEGEncodeParam;
++import com.sun.image.codec.jpeg.JPEGHuffmanTable;
++import com.sun.image.codec.jpeg.JPEGQTable;
++import com.sun.imageio.plugins.jpeg.JPEG;
++
++/**
++ * This class encapsulates the information about encoding and decoding the JPEG
++ * image.
++ *
++ * @author Andrew Su (asu at redhat.com)
++ *
++ */
++public class JPEGParam implements JPEGEncodeParam {
++    /*
++     * NOTE: bands mean the same thing as components, trying to keep it
++     * Consistent with the documentation
++     *
++     * NOTE: subsampling is not done implementing.
++     */
++
++    private float quality = JPEG.DEFAULT_QUALITY;
++    private int colorID = -1;
++    private int width;
++    private int height;
++    private int numBands;
++    private boolean imageInfoValid = false;
++    private boolean tableInfoValid = false;
++    private JPEGQTable[] qTable = new JPEGQTable[NUM_TABLES];
++    private JPEGHuffmanTable[] acHuffmanTable = new JPEGHuffmanTable[NUM_TABLES];
++    private JPEGHuffmanTable[] dcHuffmanTable = new JPEGHuffmanTable[NUM_TABLES];
++
++    private int restartInterval = 0;
++    private int[] horizontalSubsampleComponents;
++    private int[] verticalSubsampleComponents;
++
++    /* [marker between 0xE0 to 0xEF minus 0xE0 to get index][data] */
++    private byte[][][] markers = new byte[16][][];
++    private byte[][] commentMarker = null;
++
++    /* number of components each color id has (color id from JPEGDecodeParam) */
++    private static int[] components = { 0, 1, 3, 3, 4, 3, 4, 4, 4, 4, 4, 4, };
++    private int[] qTableComponentMapping;
++    private int[] acHuffmanComponentMapping;
++    private int[] dcHuffmanComponentMapping;
++
++    /*
++     * Breakdown for marker bytes
++     * 5 for name.
++     * 2 for version.
++     * 1 for density type.
++     * 2 for x density.
++     * 2 for y density.
++     * 2 for thumbnail.
++     */
++    private byte APP0_MARKER_NUM_BYTES = 14;
++
++    public JPEGParam(JPEGEncodeParam param) {
++        this((JPEGDecodeParam) param);
++    }
++
++    public JPEGParam(JPEGDecodeParam param) {
++        this(param.getEncodedColorID(), param.getNumComponents());
++
++        setTableInfoValid(param.isTableInfoValid());
++        setImageInfoValid(param.isImageInfoValid());
++        setRestartInterval(param.getRestartInterval());
++
++        // Copy the Q tables and Huffman tables.
++        for (int i = 0; i < NUM_TABLES; i++) {
++            qTable[i] = param.getQTable(i);
++            acHuffmanTable[i] = param.getACHuffmanTable(i);
++            dcHuffmanTable[i] = param.getDCHuffmanTable(i);
++        }
++
++        // Next we want to copy the component mappings.
++        for (int i = 0; i < getNumComponents(); i++) {
++            setQTableComponentMapping(i, param.getQTableComponentMapping(i));
++            setACHuffmanComponentMapping(i,
++                    param.getACHuffmanComponentMapping(i));
++            setDCHuffmanComponentMapping(i,
++                    param.getDCHuffmanComponentMapping(i));
++        }
++
++        // Copy all the marker data.
++        for (int i = APP0_MARKER; i < APPF_MARKER; i++) {
++            byte[][] markerData = param.getMarkerData(i);
++            byte[][] copyMarkerData = null;
++            if (markerData != null) {
++                copyMarkerData = new byte[markerData.length][];
++                for (int j = 0; j < markerData.length; j++) {
++                    copyMarkerData[j] = Arrays.copyOf(markerData[j],
++                            markerData[j].length);
++                }
++            }
++            setMarkerData(i, copyMarkerData);
++        }
++
++        byte[][] commentData = param.getMarkerData(COMMENT_MARKER);
++        byte[][] copyCommentData = null;
++        if (commentData != null) {
++            copyCommentData = new byte[commentData.length][];
++            for (int i = 0; i < commentData.length; i++) {
++                copyCommentData[i] = Arrays.copyOf(commentData[i],
++                        commentData[i].length);
++            }
++            setMarkerData(COMMENT_MARKER, copyCommentData);
++        }
++    }
++
++    public JPEGParam(int colorID) {
++        this(colorID, components[colorID]);
++    }
++
++    public JPEGParam(int colorID, int numBands) {
++        // We were given an invalid color id, or the number of bands given to us
++        // did not match requirements.
++        if (colorID < 0
++                || colorID >= JPEGDecodeParam.NUM_COLOR_ID
++                || (colorID != COLOR_ID_UNKNOWN && numBands != components[colorID])) {
++            throw new IllegalArgumentException();
++        }
++        this.colorID = colorID;
++        this.numBands = numBands;
++
++        initialize();
++    }
++
++    private void initialize() {
++
++        qTable[0] = JPEGQTable.StdLuminance;
++        qTable[1] = JPEGQTable.StdChrominance;
++
++        acHuffmanTable[0] = JPEGHuffmanTable.StdACLuminance;
++        acHuffmanTable[1] = JPEGHuffmanTable.StdACChrominance;
++
++        dcHuffmanTable[0] = JPEGHuffmanTable.StdDCLuminance;
++        dcHuffmanTable[1] = JPEGHuffmanTable.StdDCChrominance;
++
++        qTableComponentMapping = new int[getNumComponents()];
++        acHuffmanComponentMapping = new int[getNumComponents()];
++        dcHuffmanComponentMapping = new int[getNumComponents()];
++
++        horizontalSubsampleComponents = new int[getNumComponents()];
++        verticalSubsampleComponents = new int[getNumComponents()];
++
++        /*
++         * we can just set these to true since they are using default values
++         * right now
++         */
++        setTableInfoValid(true);
++        setImageInfoValid(true);
++
++        setMarkerData(APP0_MARKER,
++                arrayAdd(getMarkerData(APP0_MARKER), createAPP0MarkerData()));
++
++    }
++
++    private byte[] createAPP0MarkerData() {
++        byte[] data = null;
++        // Create JFIF APP0 Marker if compatible.
++        // By compatible, it must be one of the following cases.
++        // Reference:
++        // http://www.jpeg.org/public/jfif.pdf
++        // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/JFIF.html
++        switch (colorID) {
++            case COLOR_ID_UNKNOWN:
++            case COLOR_ID_GRAY:
++            case COLOR_ID_RGB:
++            case COLOR_ID_YCbCr:
++            case COLOR_ID_CMYK:
++                data = new byte[APP0_MARKER_NUM_BYTES];
++
++                // Null terminated JFIF string. [5 bytes]
++                data[0] = 'J';
++                data[1] = 'F';
++                data[2] = 'I';
++                data[3] = 'F';
++                data[4] = 0x0;
++
++                // Version number [2 bytes]
++                data[5] = 1;
++                data[6] = 2;
++
++                // Density unit [1 byte]
++                data[7] = DENSITY_UNIT_ASPECT_RATIO;
++
++                // X density [2 bytes]
++                data[8] = 0;
++                data[9] = 1;
++
++                // Y density [2 bytes]
++                data[10] = 0;
++                data[11] = 1;
++
++                // Thumbnail [2 bytes]
++                data[12] = 0;
++                data[13] = 0;
++                break;
++        }
++
++        return data;
++    }
++
++    public void setQuality(float quality, boolean forceBaseline) {
++        if (quality < 0.0) {
++            quality = 0.00f;
++        } else if (quality > 1.0) {
++            quality = 1.0f;
++        }
++
++        this.quality = quality; // preserve original.
++
++        /*
++         * Since quality value of 1 is the lowest compression, we want our
++         * QTable to contain as much 1s as possible. Since scaling is by a
++         * factor, we want to invert the selection such that highest quality is
++         * 0 and lowest is 1.
++         */
++        quality = 1 - quality;
++
++        // We will scale our QTables to match the quality value given to us.
++        for (int i = 0; i < NUM_TABLES; i++) {
++            if (qTable[i] != null) {
++                qTable[i] = qTable[i].getScaledInstance(quality, forceBaseline);
++            }
++        }
++    }
++
++    public Object clone() {
++        JPEGParam c = new JPEGParam(this);
++        return c;
++    }
++
++    @Override
++    public int getWidth() {
++        return width;
++    }
++
++    @Override
++    public int getHeight() {
++        return height;
++    }
++
++    @Override
++    public int getHorizontalSubsampling(int component) {
++        if (component < 0 || component > getNumComponents()) {
++            throw new IllegalArgumentException("Invalid component");
++        }
++
++        return horizontalSubsampleComponents[component];
++    }
++
++    @Override
++    public int getVerticalSubsampling(int component) {
++        if (component < 0 || component > getNumComponents()) {
++            throw new IllegalArgumentException("Invalid component");
++        }
++
++        return verticalSubsampleComponents[component];
++    }
++
++    @Override
++    public JPEGQTable getQTable(int tableNum) {
++        if (tableNum < 0 || tableNum > NUM_TABLES)
++            throw new IllegalArgumentException("tableNum must be [0-"
++                    + (NUM_TABLES - 1) + "]");
++        return qTable[tableNum];
++    }
++
++    @Override
++    public JPEGQTable getQTableForComponent(int component) {
++        if (component < 0 || component > getNumComponents()) {
++            throw new IllegalArgumentException("Invalid component");
++        }
++
++        return qTable[qTableComponentMapping[component]];
++    }
++
++    @Override
++    public JPEGHuffmanTable getDCHuffmanTable(int tableNum) {
++        if (tableNum < 0 || tableNum > NUM_TABLES)
++            throw new IllegalArgumentException("tableNum must be [0-"
++                    + (NUM_TABLES - 1) + "]");
++        return dcHuffmanTable[tableNum];
++    }
++
++    @Override
++    public JPEGHuffmanTable getDCHuffmanTableForComponent(int component) {
++        if (component < 0 || component > getNumComponents()) {
++            throw new IllegalArgumentException("Invalid component");
++        }
++
++        return dcHuffmanTable[dcHuffmanComponentMapping[component]];
++    }
++
++    @Override
++    public JPEGHuffmanTable getACHuffmanTable(int tableNum) {
++        if (tableNum < 0 || tableNum > NUM_TABLES)
++            throw new IllegalArgumentException("tableNum must be [0-"
++                    + (NUM_TABLES - 1) + "]");
++        return acHuffmanTable[tableNum];
++    }
++
++    @Override
++    public JPEGHuffmanTable getACHuffmanTableForComponent(int component) {
++        if (component < 0 || component > getNumComponents()) {
++            throw new IllegalArgumentException("Invalid component");
++        }
++
++        return acHuffmanTable[acHuffmanComponentMapping[component]];
++    }
++
++    @Override
++    public int getDCHuffmanComponentMapping(int component) {
++        if (component < 0 || component > getNumComponents()) {
++            throw new IllegalArgumentException("Invalid component");
++        }
++        return dcHuffmanComponentMapping[component];
++    }
++
++    @Override
++    public int getACHuffmanComponentMapping(int component) {
++        if (component < 0 || component > getNumComponents()) {
++            throw new IllegalArgumentException("Invalid component");
++        }
++        return acHuffmanComponentMapping[component];
++    }
++
++    @Override
++    public int getQTableComponentMapping(int component) {
++        if (component < 0 || component > getNumComponents()) {
++            throw new IllegalArgumentException("Invalid component");
++        }
++        return qTableComponentMapping[component];
++    }
++
++    @Override
++    public boolean isImageInfoValid() {
++        return imageInfoValid;
++    }
++
++    @Override
++    public boolean isTableInfoValid() {
++        return tableInfoValid;
++    }
++
++    @Override
++    public boolean getMarker(int marker) {
++        byte[][] data = null;
++        switch (marker) {
++            case APP0_MARKER:
++            case APP1_MARKER:
++            case APP2_MARKER:
++            case APP3_MARKER:
++            case APP4_MARKER:
++            case APP5_MARKER:
++            case APP6_MARKER:
++            case APP7_MARKER:
++            case APP8_MARKER:
++            case APP9_MARKER:
++            case APPA_MARKER:
++            case APPB_MARKER:
++            case APPC_MARKER:
++            case APPD_MARKER:
++            case APPE_MARKER:
++            case APPF_MARKER:
++                data = markers[marker - APP0_MARKER];
++                break;
++            case COMMENT_MARKER:
++                data = commentMarker;
++                break;
++            default:
++                throw new IllegalArgumentException("Marker provided is invalid");
++        }
++
++        return data != null && data.length > 0;
++    }
++
++    @Override
++    public byte[][] getMarkerData(int marker) {
++        byte[][] data = null;
++
++        switch (marker) {
++            case APP0_MARKER:
++            case APP1_MARKER:
++            case APP2_MARKER:
++            case APP3_MARKER:
++            case APP4_MARKER:
++            case APP5_MARKER:
++            case APP6_MARKER:
++            case APP7_MARKER:
++            case APP8_MARKER:
++            case APP9_MARKER:
++            case APPA_MARKER:
++            case APPB_MARKER:
++            case APPC_MARKER:
++            case APPD_MARKER:
++            case APPE_MARKER:
++            case APPF_MARKER:
++                data = markers[marker - APP0_MARKER];
++                break;
++            case COMMENT_MARKER:
++                // TODO: Add stuff for comment marker
++                break;
++            default:
++                throw new IllegalArgumentException("Marker provided is invalid");
++        }
++        return data;
++    }
++
++    @Override
++    public int getEncodedColorID() {
++        return colorID;
++    }
++
++    @Override
++    public int getNumComponents() {
++        return numBands;
++    }
++
++    @Override
++    public int getRestartInterval() {
++        return restartInterval;
++    }
++
++    @Override
++    public int getDensityUnit() {
++        if (!getMarker(APP0_MARKER))
++            throw new IllegalArgumentException("APP0 Marker not found.");
++        byte[] data = getValidAPP0Marker();
++
++        if (data == null)
++            throw new IllegalArgumentException("No valid APP0 Marker found");
++
++        return data[7];
++    }
++
++    @Override
++    public int getXDensity() {
++        if (!getMarker(APP0_MARKER))
++            throw new IllegalArgumentException("APP0 Marker not found.");
++        byte[] data = getValidAPP0Marker();
++
++        if (data == null)
++            throw new IllegalArgumentException("No valid APP0 Marker found");
++
++        // data[8] is the upper portion of the density value
++        // data[9] is the lower portion of the density value
++        int upper = data[8] << 8; // Shift it so we can merge with lower value.
++        int lower = data[9] & 0xFF; // Keep it in bounds 0 - 256
++        return upper | lower; // Merge
++
++    }
++
++    @Override
++    public int getYDensity() {
++        if (!getMarker(APP0_MARKER))
++            throw new IllegalArgumentException("APP0 Marker not found.");
++        byte[] data = getValidAPP0Marker();
++
++        if (data == null)
++            throw new IllegalArgumentException("No valid APP0 Marker found");
++
++        // data[10] is the upper portion of the density value
++        // data[11] is the lower portion of the density value
++        int upper = data[10] << 8; // Shift it so we can merge with lower value.
++        int lower = data[11] & 0xFF;// Keep it in bounds 0 - 256
++        return upper | lower; // merge
++    }
++
++    @Override
++    public void setHorizontalSubsampling(int component, int subsample) {
++        if (component < 0 || component > getNumComponents()) {
++            throw new IllegalArgumentException("Invalid component");
++        }
++
++        horizontalSubsampleComponents[component] = subsample;
++    }
++
++    @Override
++    public void setVerticalSubsampling(int component, int subsample) {
++        if (component < 0 || component > getNumComponents()) {
++            throw new IllegalArgumentException("Invalid component");
++        }
++
++        verticalSubsampleComponents[component] = subsample;
++    }
++
++    @Override
++    public void setQTable(int tableNum, JPEGQTable qTable) {
++        if (tableNum < 0 || tableNum > NUM_TABLES)
++            throw new IllegalArgumentException("tableNum must be [0-"
++                    + (NUM_TABLES - 1) + "]");
++
++        this.qTable[tableNum] = qTable;
++    }
++
++    @Override
++    public void setDCHuffmanTable(int tableNum, JPEGHuffmanTable huffTable) {
++        if (tableNum < 0 || tableNum > NUM_TABLES)
++            throw new IllegalArgumentException("tableNum must be [0-"
++                    + (NUM_TABLES - 1) + "]");
++
++        dcHuffmanTable[tableNum] = huffTable;
++    }
++
++    @Override
++    public void setACHuffmanTable(int tableNum, JPEGHuffmanTable huffTable) {
++        if (tableNum < 0 || tableNum > NUM_TABLES)
++            throw new IllegalArgumentException("tableNum must be [0-"
++                    + (NUM_TABLES - 1) + "]");
++        acHuffmanTable[tableNum] = huffTable;
++    }
++
++    @Override
++    public void setACHuffmanComponentMapping(int component, int table) {
++        if (component < 0 || component > getNumComponents()) {
++            throw new IllegalArgumentException("Invalid component specified.");
++        } else if (table < 0 || table > NUM_TABLES) {
++            throw new IllegalArgumentException("Invalid table specified");
++        }
++
++        acHuffmanComponentMapping[component] = table;
++    }
++
++    @Override
++    public void setDCHuffmanComponentMapping(int component, int table) {
++        if (component < 0 || component > getNumComponents()) {
++            throw new IllegalArgumentException("Invalid component specified.");
++        } else if (table < 0 || table > NUM_TABLES) {
++            throw new IllegalArgumentException("Invalid table specified");
++        }
++
++        dcHuffmanComponentMapping[component] = table;
++    }
++
++    @Override
++    public void setQTableComponentMapping(int component, int table) {
++        if (component < 0 || component > getNumComponents()) {
++            throw new IllegalArgumentException("Invalid component specified.");
++        } else if (table < 0 || table > NUM_TABLES) {
++            throw new IllegalArgumentException("Invalid table specified");
++        }
++
++        qTableComponentMapping[component] = table;
++    }
++
++    @Override
++    public void setImageInfoValid(boolean flag) {
++        imageInfoValid = flag;
++    }
++
++    @Override
++    public void setTableInfoValid(boolean flag) {
++        tableInfoValid = flag;
++    }
++
++    @Override
++    public void setMarkerData(int marker, byte[][] data) {
++        if (data == null) {
++            return;
++        }
++
++        switch (marker) {
++            case APP0_MARKER:
++            case APP1_MARKER:
++            case APP2_MARKER:
++            case APP3_MARKER:
++            case APP4_MARKER:
++            case APP5_MARKER:
++            case APP6_MARKER:
++            case APP7_MARKER:
++            case APP8_MARKER:
++            case APP9_MARKER:
++            case APPA_MARKER:
++            case APPB_MARKER:
++            case APPC_MARKER:
++            case APPD_MARKER:
++            case APPE_MARKER:
++            case APPF_MARKER:
++                markers[marker - APP0_MARKER] = data;
++                break;
++            case COMMENT_MARKER:
++                commentMarker = data;
++                break;
++            default:
++                throw new IllegalArgumentException("Marker provided is invalid");
++        }
++    }
++
++    @Override
++    public void addMarkerData(int marker, byte[] data) {
++        if (data == null) {
++            return;
++        }
++        switch (marker) {
++            case APP0_MARKER:
++            case APP1_MARKER:
++            case APP2_MARKER:
++            case APP3_MARKER:
++            case APP4_MARKER:
++            case APP5_MARKER:
++            case APP6_MARKER:
++            case APP7_MARKER:
++            case APP8_MARKER:
++            case APP9_MARKER:
++            case APPA_MARKER:
++            case APPB_MARKER:
++            case APPC_MARKER:
++            case APPD_MARKER:
++            case APPE_MARKER:
++            case APPF_MARKER:
++                markers[marker - APP0_MARKER] = arrayAdd(markers[marker
++                        - APP0_MARKER], data);
++                break;
++            case COMMENT_MARKER:
++                commentMarker = arrayAdd(commentMarker, data);
++                break;
++            default:
++                throw new IllegalArgumentException("Marker provided is invalid");
++        }
++    }
++
++    @Override
++    public void setRestartInterval(int restartInterval) {
++        this.restartInterval = restartInterval;
++    }
++
++    @Override
++    public void setDensityUnit(int unit) {
++        if (unit < 0 || unit > NUM_DENSITY_UNIT) {
++            throw new IllegalArgumentException("Invalid density unit.");
++        }
++
++        byte[] data = getValidAPP0Marker();
++        if (data == null) { // We will create one now.
++            data = createAPP0MarkerData();
++            // markers[0] = array of APP0_MARKER
++            markers[0] = arrayAdd(markers[0], data);
++        }
++
++        data[7] = (byte) unit;
++    }
++
++    @Override
++    public void setXDensity(int density) {
++        byte[] data = getValidAPP0Marker();
++        if (data == null) { // We will create one now.
++            data = createAPP0MarkerData();
++            // markers[0] = array of APP0_MARKER
++            markers[0] = arrayAdd(markers[0], data);
++        }
++
++        byte upper = (byte) (density >>> 8 & 0xFF); // unsigned shift to keep it
++                                                    // positive
++        byte lower = (byte) (density & 0xFF);
++        data[8] = upper;
++        data[9] = lower;
++    }
++
++    @Override
++    public void setYDensity(int density) {
++        byte[] data = getValidAPP0Marker();
++        if (data == null) { // We will create one now.
++            data = createAPP0MarkerData();
++            // markers[0] = array of APP0_MARKER
++            markers[0] = arrayAdd(markers[0], data);
++        }
++
++        byte upper = (byte) (density >>> 8 & 0xFF); // unsigned shift to keep it
++                                                    // positive
++        byte lower = (byte) (density & 0xFF);
++        data[10] = upper;
++        data[11] = lower;
++    }
++
++    public void setWidth(int width) {
++        this.width = width;
++    }
++
++    public void setHeight(int height) {
++        this.height = height;
++    }
++
++    /**
++     * get the quality value.
++     *
++     * @return currently set quality value.
++     */
++    public float getQuality() {
++        return quality;
++    }
++
++    /**
++     * Appends new data to original array
++     *
++     * @param origArr
++     * @param newArr
++     * @return
++     */
++    private byte[][] arrayAdd(byte[][] origArr, byte[] newArr) {
++        byte[][] newData;
++        if (origArr != null) {
++            newData = Arrays.copyOf(origArr, origArr.length + 1);
++            newData[origArr.length] = Arrays.copyOf(newArr, newArr.length);
++        } else {
++            newData = new byte[1][];
++            newData[0] = Arrays.copyOf(newArr, newArr.length);
++        }
++
++        return newData;
++    }
++
++    private byte[] getValidAPP0Marker() {
++        byte[][] app0Markers = getMarkerData(APP0_MARKER);
++        for (int i = 0; i < app0Markers.length; i++) {
++            byte[] data = app0Markers[i];
++            if (data[0] == 'J' && data[1] == 'F' && data[2] == 'I'
++                    && data[3] == 'F' && data[4] == 0x0) {
++                if (data[5] <= 1) { // version is 1 or below.
++                    // We have a valid JFIF header.
++                    return data;
++                }
++            }
++        }
++        return null;
++    }
++}

Added: trunk/java/openjdk6/files/icedtea/openjdk/5102804-memory_leak.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/openjdk/5102804-memory_leak.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/openjdk/5102804-memory_leak.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,429 @@
+# 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;
++            }
++        }
++    }
++}

Added: trunk/java/openjdk6/files/icedtea/openjdk/6469266-xmlsec_1.4.2.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/openjdk/6469266-xmlsec_1.4.2.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/openjdk/6469266-xmlsec_1.4.2.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,23876 @@
+# HG changeset patch
+# User andrew
+# Date 1371136223 -3600
+# Node ID a955a845f0d1b8e21e0780986d971b3712db26c7
+# Parent  2ae6d8da293f30c94c9478a6634c7a480328c5c5
+6469266: Integrate Apache XMLSec 1.4.2 into JDK 7
+Reviewed-by: valeriep
+
+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
+@@ -20,12 +20,9 @@
+  */
+ package com.sun.org.apache.xml.internal.security;
+ 
+-
+-
+ import java.io.InputStream;
+ import java.security.AccessController;
+ import java.security.PrivilegedAction;
+-
+ import javax.xml.parsers.DocumentBuilder;
+ import javax.xml.parsers.DocumentBuilderFactory;
+ 
+@@ -51,7 +48,7 @@
+  * done by calling {@link Init#init} which should be done in any static block
+  * of the files of this library. We ensure that this call is only executed once.
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public final class Init {
+ 
+@@ -113,20 +110,19 @@
+             dbf.setValidating(false);
+ 
+             DocumentBuilder db = dbf.newDocumentBuilder();
+-
+             // We don't allow users to override the Apache XML Security
+             // configuration in the JRE. Users should use the standard security
+             // provider mechanism instead if implementing their own
+             // transform or canonicalization algorithms.
+-            // String cfile = System.getProperty("com.sun.org.apache.xml.internal.security.resource.config");
+-            // InputStream is =
+-            //     Class.forName("com.sun.org.apache.xml.internal.security.Init")
+-            //     .getResourceAsStream(cfile != null ? cfile : "resource/config.xml");
++            // InputStream is = Class.forName("com.sun.org.apache.xml.internal.security.Init").getResourceAsStream("resource/config.xml");
+             InputStream is = (InputStream) AccessController.doPrivileged(
+                 new PrivilegedAction() {
+                     public Object run() {
++//                        String cfile = System.getProperty
++//                            ("com.sun.org.apache.xml.internal.security.resource.config");
+                         return getClass().getResourceAsStream
+-                                ("resource/config.xml");
++//                            (cfile != null ? cfile : "resource/config.xml");
++                            ("resource/config.xml");
+                     }
+                 });
+ 
+@@ -167,7 +163,7 @@
+ //
+ //            if (tag.equals("ResourceBundles")){
+ //                XX_configure_i18n_start = System.currentTimeMillis();
+-//              Element resource=(Element)el;
++//                Element resource=(Element)el;
+ //               /* configure internationalization */
+ //               Attr langAttr = resource.getAttributeNode("defaultLanguageCode");
+ //               Attr countryAttr = resource.getAttributeNode("defaultCountryCode");
+@@ -202,11 +198,11 @@
+ 
+                         if (currMeth.getDeclaringClass().getName()
+                                 .equals(JAVACLASS)) {
+-                           log.log(java.util.logging.Level.FINE, currMeth.getDeclaringClass().toString());
++                           log.log(java.util.logging.Level.FINE, currMeth.getDe claringClass().toString());
+                         }
+                      }*/
+-                      if (true)
+-                        if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Canonicalizer.register(" + URI + ", "
++                      if (log.isLoggable(java.util.logging.Level.FINE))
++                        log.log(java.util.logging.Level.FINE, "Canonicalizer.register(" + URI + ", "
+                             + JAVACLASS + ")");
+                      Canonicalizer.register(URI, JAVACLASS);
+                   } catch (ClassNotFoundException e) {
+@@ -233,9 +229,8 @@
+                         "JAVACLASS");
+                   try {
+                      Class.forName(JAVACLASS);
+-                     if (true)
+-                        if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Transform.register(" + URI + ", " + JAVACLASS
+-                            + ")");
++                     if (log.isLoggable(java.util.logging.Level.FINE))
++                        log.log(java.util.logging.Level.FINE, "Transform.register(" + URI + ", " + JAVACLASS + ")");
+                      Transform.register(URI, JAVACLASS);
+                   } catch (ClassNotFoundException e) {
+                      Object exArgs[] = { URI, JAVACLASS };
+@@ -284,12 +279,11 @@
+ //
+ //                        if (currMeth.getDeclaringClass().getName()
+ //                                .equals(JAVACLASS)) {
+-//                           log.log(java.util.logging.Level.FINE, currMeth.getDeclaringClass().toString());
++//                           log.log(java.util.logging.Level.FINE, currMeth.getDe claringClass().toString());
+ //                        }
+ //                     }
+-                      if (true)
+-                        if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "SignatureAlgorithm.register(" + URI + ", "
+-                            + JAVACLASS + ")");
++                      if (log.isLoggable(java.util.logging.Level.FINE))
++                        log.log(java.util.logging.Level.FINE, "SignatureAlgorithm.register(" + URI + ", " + JAVACLASS + ")");
+                      SignatureAlgorithm.register(URI, JAVACLASS);
+                   } catch (ClassNotFoundException e) {
+                      Object exArgs[] = { URI, JAVACLASS };
+@@ -320,13 +314,11 @@
+                         "DESCRIPTION");
+ 
+                   if ((Description != null) && (Description.length() > 0)) {
+-                    if (true)
+-                        if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Register Resolver: " + JAVACLASS + ": "
+-                               + Description);
++                    if (log.isLoggable(java.util.logging.Level.FINE))
++                        log.log(java.util.logging.Level.FINE, "Register Resolver: " + JAVACLASS + ": " + Description);
+                   } else {
+-                    if (true)
+-                        if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Register Resolver: " + JAVACLASS
+-                               + ": For unknown purposes");
++                    if (log.isLoggable(java.util.logging.Level.FINE))
++                        log.log(java.util.logging.Level.FINE, "Register Resolver: " + JAVACLASS + ": For unknown purposes");
+                   }
+                                   try {
+                                           ResourceResolver.register(JAVACLASS);
+@@ -359,13 +351,11 @@
+                         "DESCRIPTION");
+ 
+                   if ((Description != null) && (Description.length() > 0)) {
+-                    if (true)
+-                        if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Register Resolver: " + JAVACLASS + ": "
+-                               + Description);
++                    if (log.isLoggable(java.util.logging.Level.FINE))
++                        log.log(java.util.logging.Level.FINE, "Register Resolver: " + JAVACLASS + ": " + Description);
+                   } else {
+-                    if (true)
+-                        if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Register Resolver: " + JAVACLASS
+-                               + ": For unknown purposes");
++                    if (log.isLoggable(java.util.logging.Level.FINE))
++                        log.log(java.util.logging.Level.FINE, "Register Resolver: " + JAVACLASS + ": For unknown purposes");
+                   }
+ 
+                   KeyResolver.register(JAVACLASS);
+@@ -376,8 +366,8 @@
+ 
+             if (tag.equals("PrefixMappings")){
+                 XX_configure_reg_prefixes_start = System.currentTimeMillis();
+-                if (true)
+-                        if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Now I try to bind prefixes:");
++                if (log.isLoggable(java.util.logging.Level.FINE))
++                    log.log(java.util.logging.Level.FINE, "Now I try to bind prefixes:");
+ 
+                Element[] nl = XMLUtils.selectNodes(el.getFirstChild(), CONF_NS,"PrefixMapping");
+ 
+@@ -386,8 +376,8 @@
+                                         "namespace");
+                   String prefix = nl[i].getAttributeNS(null,
+                                      "prefix");
+-                  if (true)
+-                        if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Now I try to bind " + prefix + " to " + namespace);
++                  if (log.isLoggable(java.util.logging.Level.FINE))
++                      log.log(java.util.logging.Level.FINE, "Now I try to bind " + prefix + " to " + namespace);
+                   com.sun.org.apache.xml.internal.security.utils.ElementProxy
+                      .setDefaultPrefix(namespace, prefix);
+                }
+@@ -398,19 +388,19 @@
+             long XX_init_end = System.currentTimeMillis();
+ 
+             //J-
+-            if (true) {
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "XX_init                             " + ((int)(XX_init_end - XX_init_start)) + " ms");
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "  XX_prng                           " + ((int)(XX_prng_end - XX_prng_start)) + " ms");
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "  XX_parsing                        " + ((int)(XX_parsing_end - XX_parsing_start)) + " ms");
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "  XX_configure_i18n                 " + ((int)(XX_configure_i18n_end- XX_configure_i18n_start)) + " ms");
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "  XX_configure_reg_c14n             " + ((int)(XX_configure_reg_c14n_end- XX_configure_reg_c14n_start)) + " ms");
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "  XX_configure_reg_jcemapper        " + ((int)(XX_configure_reg_jcemapper_end- XX_configure_reg_jcemapper_start)) + " ms");
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "  XX_configure_reg_keyInfo          " + ((int)(XX_configure_reg_keyInfo_end- XX_configure_reg_keyInfo_start)) + " ms");
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "  XX_configure_reg_keyResolver      " + ((int)(XX_configure_reg_keyResolver_end- XX_configure_reg_keyResolver_start)) + " ms");
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "  XX_configure_reg_prefixes         " + ((int)(XX_configure_reg_prefixes_end- XX_configure_reg_prefixes_start)) + " ms");
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "  XX_configure_reg_resourceresolver " + ((int)(XX_configure_reg_resourceresolver_end- XX_configure_reg_resourceresolver_start)) + " ms");
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "  XX_configure_reg_sigalgos         " + ((int)(XX_configure_reg_sigalgos_end- XX_configure_reg_sigalgos_start)) + " ms");
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "  XX_configure_reg_transforms       " + ((int)(XX_configure_reg_transforms_end- XX_configure_reg_transforms_start)) + " ms");
++            if (log.isLoggable(java.util.logging.Level.FINE)) {
++                log.log(java.util.logging.Level.FINE, "XX_init                             " + ((int)(XX_init_end - XX_init_start)) + " ms");
++                log.log(java.util.logging.Level.FINE, "  XX_prng                           " + ((int)(XX_prng_end - XX_prng_start)) + " ms");
++                log.log(java.util.logging.Level.FINE, "  XX_parsing                        " + ((int)(XX_parsing_end - XX_parsing_start)) + " ms");
++                log.log(java.util.logging.Level.FINE, "  XX_configure_i18n                 " + ((int)(XX_configure_i18n_end- XX_configure_i18n_start)) + " ms");
++                log.log(java.util.logging.Level.FINE, "  XX_configure_reg_c14n             " + ((int)(XX_configure_reg_c14n_end- XX_configure_reg_c14n_start)) + " ms");
++                log.log(java.util.logging.Level.FINE, "  XX_configure_reg_jcemapper        " + ((int)(XX_configure_reg_jcemapper_end- XX_configure_reg_jcemapper_start)) + " ms");
++                log.log(java.util.logging.Level.FINE, "  XX_configure_reg_keyInfo          " + ((int)(XX_configure_reg_keyInfo_end- XX_configure_reg_keyInfo_start)) + " ms");
++                log.log(java.util.logging.Level.FINE, "  XX_configure_reg_keyResolver      " + ((int)(XX_configure_reg_keyResolver_end- XX_configure_reg_keyResolver_start)) + " ms");
++                log.log(java.util.logging.Level.FINE, "  XX_configure_reg_prefixes         " + ((int)(XX_configure_reg_prefixes_end- XX_configure_reg_prefixes_start)) + " ms");
++                log.log(java.util.logging.Level.FINE, "  XX_configure_reg_resourceresolver " + ((int)(XX_configure_reg_resourceresolver_end- XX_configure_reg_resourceresolver_start)) + " ms");
++                log.log(java.util.logging.Level.FINE, "  XX_configure_reg_sigalgos         " + ((int)(XX_configure_reg_sigalgos_end- XX_configure_reg_sigalgos_start)) + " ms");
++                log.log(java.util.logging.Level.FINE, "  XX_configure_reg_transforms       " + ((int)(XX_configure_reg_transforms_end- XX_configure_reg_transforms_start)) + " ms");
+             }
+          } catch (Exception e) {
+             log.log(java.util.logging.Level.SEVERE, "Bad: ", e);
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/Algorithm.java b/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/Algorithm.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/Algorithm.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/Algorithm.java
+@@ -24,7 +24,7 @@
+ 
+ import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
+ import com.sun.org.apache.xml.internal.security.utils.Constants;
+-import com.sun.org.apache.xml.internal.security.utils.ElementProxy;
++import com.sun.org.apache.xml.internal.security.utils.SignatureElementProxy;
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+ 
+@@ -33,11 +33,7 @@
+  * The Algorithm class which stores the Algorithm URI as a string.
+  *
+  */
+-public abstract class Algorithm extends ElementProxy {
+-
+-   /** {@link java.util.logging} logging facility */
+-    static java.util.logging.Logger log =
+-        java.util.logging.Logger.getLogger(Algorithm.class.getName());
++public abstract class Algorithm extends SignatureElementProxy {
+ 
+    /**
+     *
+@@ -79,7 +75,7 @@
+     */
+    protected void setAlgorithmURI(String algorithmURI) {
+ 
+-      if ((this._state == MODE_CREATE) && (algorithmURI != null)) {
++      if ( (algorithmURI != null)) {
+          this._constructionElement.setAttributeNS(null, Constants._ATT_ALGORITHM,
+                                                 algorithmURI);
+       }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/JCEMapper.java b/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/JCEMapper.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/JCEMapper.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/JCEMapper.java
+@@ -35,7 +35,7 @@
+ /**
+  * This class maps algorithm identifier URIs to JAVA JCE class names.
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class JCEMapper {
+ 
+@@ -45,9 +45,9 @@
+ 
+ 
+ 
+-   private static Map uriToJCEName = new HashMap();
++   private static Map uriToJCEName;
+ 
+-   private static Map algorithmsMap = new HashMap();
++   private static Map algorithmsMap;
+ 
+    private static String providerName = null;
+    /**
+@@ -63,6 +63,8 @@
+ 
+    static void loadAlgorithms( Element algorithmsEl) {
+        Element[] algorithms = XMLUtils.selectNodes(algorithmsEl.getFirstChild(),Init.CONF_NS,"Algorithm");
++       uriToJCEName = new HashMap( algorithms.length * 2);
++       algorithmsMap = new HashMap( algorithms.length * 2);
+        for (int i = 0 ;i < algorithms.length ;i ++) {
+            Element el = algorithms[i];
+            String id = el.getAttribute("URI");
+@@ -70,6 +72,7 @@
+            uriToJCEName.put(id, jceName);
+            algorithmsMap.put(id, new Algorithm(el));
+        }
++
+    }
+ 
+    static Algorithm getAlgorithmMapping(String algoURI) {
+@@ -84,8 +87,8 @@
+     *
+     */
+    public static String translateURItoJCEID(String AlgorithmURI) {
+-      if (true)
+-          if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Request for URI " + AlgorithmURI);
++      if (log.isLoggable(java.util.logging.Level.FINE))
++          log.log(java.util.logging.Level.FINE, "Request for URI " + AlgorithmURI);
+ 
+       String jceName = (String) uriToJCEName.get(AlgorithmURI);
+       return jceName;
+@@ -100,8 +103,8 @@
+     *
+     */
+    public static String getAlgorithmClassFromURI(String AlgorithmURI) {
+-       if (true)
+-           if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Request for URI " + AlgorithmURI);
++       if (log.isLoggable(java.util.logging.Level.FINE))
++           log.log(java.util.logging.Level.FINE, "Request for URI " + AlgorithmURI);
+ 
+        return ((Algorithm) algorithmsMap.get(AlgorithmURI)).algorithmClass;
+    }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/MessageDigestAlgorithm.java b/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/MessageDigestAlgorithm.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/MessageDigestAlgorithm.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/MessageDigestAlgorithm.java
+@@ -20,10 +20,10 @@
+  */
+ package com.sun.org.apache.xml.internal.security.algorithms;
+ 
+-
+-
+ import java.security.MessageDigest;
+ import java.security.NoSuchProviderException;
++import java.util.HashMap;
++import java.util.Map;
+ 
+ import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException;
+ import com.sun.org.apache.xml.internal.security.utils.Constants;
+@@ -41,11 +41,6 @@
+  */
+ public class MessageDigestAlgorithm extends Algorithm {
+ 
+-   /** {@link java.util.logging} logging facility */
+-    static java.util.logging.Logger log =
+-        java.util.logging.Logger.getLogger(
+-                    MessageDigestAlgorithm.class.getName());
+-
+     /** Message Digest - NOT RECOMMENDED MD5*/
+    public static final String ALGO_ID_DIGEST_NOT_RECOMMENDED_MD5 = Constants.MoreAlgorithmsSpecNS + "md5";
+    /** Digest - Required SHA1*/
+@@ -76,6 +71,12 @@
+       this.algorithm = messageDigest;
+    }
+ 
++   static ThreadLocal instances=new ThreadLocal() {
++           protected Object initialValue() {
++                   return new HashMap();
++           };
++   };
++
+    /**
+     * Factory method for constructing a message digest algorithm by name.
+     *
+@@ -86,8 +87,15 @@
+     */
+    public static MessageDigestAlgorithm getInstance(
+            Document doc, String algorithmURI) throws XMLSignatureException {
++          MessageDigest md = getDigestInstance(algorithmURI);
++      return new MessageDigestAlgorithm(doc, md, algorithmURI);
++   }
+ 
+-      String algorithmID = JCEMapper.translateURItoJCEID(algorithmURI);
++private static MessageDigest getDigestInstance(String algorithmURI) throws XMLSignatureException {
++        MessageDigest result=(MessageDigest) ((Map)instances.get()).get(algorithmURI);
++        if (result!=null)
++                return result;
++    String algorithmID = JCEMapper.translateURItoJCEID(algorithmURI);
+ 
+           if (algorithmID == null) {
+                   Object[] exArgs = { algorithmURI };
+@@ -113,8 +121,9 @@
+ 
+         throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs);
+         }
+-      return new MessageDigestAlgorithm(doc, md, algorithmURI);
+-   }
++      ((Map)instances.get()).put(algorithmURI, md);
++        return md;
++}
+ 
+    /**
+     * Returns the actual {@link java.security.MessageDigest} algorithm object
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm.java b/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm.java
+@@ -25,6 +25,7 @@
+ import java.security.SecureRandom;
+ import java.security.spec.AlgorithmParameterSpec;
+ import java.util.HashMap;
++import java.util.Map;
+ 
+ import com.sun.org.apache.xml.internal.security.algorithms.implementations.IntegrityHmac;
+ import com.sun.org.apache.xml.internal.security.exceptions.AlgorithmAlreadyRegisteredException;
+@@ -52,9 +53,35 @@
+    /** All available algorithm classes are registered here */
+    static HashMap _algorithmHash = null;
+ 
++   static ThreadLocal instancesSigning=new ThreadLocal() {
++           protected Object initialValue() {
++                   return new HashMap();
++           };
++   };
++
++   static ThreadLocal instancesVerify=new ThreadLocal() {
++           protected Object initialValue() {
++                   return new HashMap();
++           };
++   };
++
++   static ThreadLocal keysSigning=new ThreadLocal() {
++           protected Object initialValue() {
++                   return new HashMap();
++           };
++   };
++   static ThreadLocal keysVerify=new ThreadLocal() {
++           protected Object initialValue() {
++                   return new HashMap();
++           };
++   };
++//   boolean isForSigning=false;
++
+    /** Field _signatureAlgorithm */
+    protected SignatureAlgorithmSpi _signatureAlgorithm = null;
+ 
++   private String algorithmURI;
++
+    /**
+     * Constructor SignatureAlgorithm
+     *
+@@ -64,18 +91,49 @@
+     */
+    public SignatureAlgorithm(Document doc, String algorithmURI)
+            throws XMLSecurityException {
++      super(doc, algorithmURI);
++      this.algorithmURI = algorithmURI;
++   }
+ 
+-      super(doc, algorithmURI);
+ 
+-      try {
++   private void initializeAlgorithm(boolean isForSigning) throws XMLSignatureException {
++           if (_signatureAlgorithm!=null) {
++                   return;
++           }
++           _signatureAlgorithm=isForSigning ? getInstanceForSigning(algorithmURI) : getInstanceForVerify(algorithmURI);
++                this._signatureAlgorithm
++                      .engineGetContextFromElement(this._constructionElement);
++   }
++   private static SignatureAlgorithmSpi getInstanceForSigning(String algorithmURI) throws XMLSignatureException {
++           SignatureAlgorithmSpi result=(SignatureAlgorithmSpi) ((Map)instancesSigning.get()).get(algorithmURI);
++           if (result!=null) {
++                   result.reset();
++                   return result;
++           }
++           result=buildSigner(algorithmURI, result);
++           ((Map)instancesSigning.get()).put(algorithmURI,result);
++           return result;
++   }
++   private static SignatureAlgorithmSpi getInstanceForVerify(String algorithmURI) throws XMLSignatureException {
++           SignatureAlgorithmSpi result=(SignatureAlgorithmSpi) ((Map)instancesVerify.get()).get(algorithmURI);
++           if (result!=null) {
++                   result.reset();
++                   return result;
++           }
++           result=buildSigner(algorithmURI, result);
++           ((Map)instancesVerify.get()).put(algorithmURI,result);
++           return result;
++   }
++
++   private static SignatureAlgorithmSpi buildSigner(String algorithmURI, SignatureAlgorithmSpi result) throws XMLSignatureException {
++        try {
+          Class implementingClass =
+             SignatureAlgorithm.getImplementingClass(algorithmURI);
+-         if (true)
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Create URI \"" + algorithmURI + "\" class \""
++         if (log.isLoggable(java.util.logging.Level.FINE))
++                log.log(java.util.logging.Level.FINE, "Create URI \"" + algorithmURI + "\" class \""
+                    + implementingClass + "\"");
+-
+-         this._signatureAlgorithm =
+-            (SignatureAlgorithmSpi) implementingClass.newInstance();
++         result=(SignatureAlgorithmSpi) implementingClass.newInstance();
++         return   result;
+       }  catch (IllegalAccessException ex) {
+          Object exArgs[] = { algorithmURI, ex.getMessage() };
+ 
+@@ -92,7 +150,7 @@
+          throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs,
+                                          ex);
+       }
+-   }
++}
+ 
+    /**
+     * Constructor SignatureAlgorithm
+@@ -107,7 +165,8 @@
+               throws XMLSecurityException {
+ 
+       this(doc, algorithmURI);
+-
++      this.algorithmURI=algorithmURI;
++      initializeAlgorithm(true);
+       this._signatureAlgorithm.engineSetHMACOutputLength(HMACOutputLength);
+       ((IntegrityHmac)this._signatureAlgorithm)
+          .engineAddContextToElement(this._constructionElement);
+@@ -124,37 +183,7 @@
+            throws XMLSecurityException {
+ 
+       super(element, BaseURI);
+-
+-      String algorithmURI = this.getURI();
+-
+-      try {
+-         Class implementingClass =
+-            SignatureAlgorithm.getImplementingClass(algorithmURI);
+-         if (true)
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Create URI \"" + algorithmURI + "\" class \""
+-                   + implementingClass + "\"");
+-
+-         this._signatureAlgorithm =
+-            (SignatureAlgorithmSpi) implementingClass.newInstance();
+-
+-         this._signatureAlgorithm
+-            .engineGetContextFromElement(this._constructionElement);
+-      }  catch (IllegalAccessException ex) {
+-         Object exArgs[] = { algorithmURI, ex.getMessage() };
+-
+-         throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs,
+-                                         ex);
+-      } catch (InstantiationException ex) {
+-         Object exArgs[] = { algorithmURI, ex.getMessage() };
+-
+-         throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs,
+-                                         ex);
+-      } catch (NullPointerException ex) {
+-         Object exArgs[] = { algorithmURI, ex.getMessage() };
+-
+-         throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs,
+-                                         ex);
+-      }
++      algorithmURI = this.getURI();
+    }
+ 
+    /**
+@@ -175,7 +204,12 @@
+     * @return the result of the {@link java.security.Signature#getAlgorithm} method
+     */
+    public String getJCEAlgorithmString() {
+-      return this._signatureAlgorithm.engineGetJCEAlgorithmString();
++      try {
++                return getInstanceForVerify(algorithmURI).engineGetJCEAlgorithmString();
++        } catch (XMLSignatureException e) {
++                //Ignore.
++                return null;
++        }
+    }
+ 
+    /**
+@@ -184,7 +218,11 @@
+     * @return The Provider of this Signature Alogrithm
+     */
+    public String getJCEProviderName() {
+-      return this._signatureAlgorithm.engineGetJCEProviderName();
++      try {
++                return getInstanceForVerify(algorithmURI).engineGetJCEProviderName();
++        } catch (XMLSignatureException e) {
++                return null;
++        }
+    }
+ 
+    /**
+@@ -231,7 +269,13 @@
+     * @throws XMLSignatureException
+     */
+    public void initSign(Key signingKey) throws XMLSignatureException {
+-      this._signatureAlgorithm.engineInitSign(signingKey);
++           initializeAlgorithm(true);
++           Map map=(Map)keysSigning.get();
++       if (map.get(this.algorithmURI)==signingKey) {
++           return;
++       }
++       map.put(this.algorithmURI,signingKey);
++           this._signatureAlgorithm.engineInitSign(signingKey);
+    }
+ 
+    /**
+@@ -244,6 +288,7 @@
+     */
+    public void initSign(Key signingKey, SecureRandom secureRandom)
+            throws XMLSignatureException {
++           initializeAlgorithm(true);
+       this._signatureAlgorithm.engineInitSign(signingKey, secureRandom);
+    }
+ 
+@@ -258,6 +303,7 @@
+    public void initSign(
+            Key signingKey, AlgorithmParameterSpec algorithmParameterSpec)
+               throws XMLSignatureException {
++           initializeAlgorithm(true);
+       this._signatureAlgorithm.engineInitSign(signingKey,
+                                               algorithmParameterSpec);
+    }
+@@ -282,7 +328,13 @@
+     * @throws XMLSignatureException
+     */
+    public void initVerify(Key verificationKey) throws XMLSignatureException {
+-      this._signatureAlgorithm.engineInitVerify(verificationKey);
++           initializeAlgorithm(false);
++           Map map=(Map)keysVerify.get();
++           if (map.get(this.algorithmURI)==verificationKey) {
++           return;
++       }
++           map.put(this.algorithmURI,verificationKey);
++           this._signatureAlgorithm.engineInitVerify(verificationKey);
+    }
+ 
+    /**
+@@ -320,7 +372,7 @@
+                .getLogger(SignatureAlgorithm.class.getName());
+       }
+ 
+-      if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Init() called");
++      log.log(java.util.logging.Level.FINE, "Init() called");
+ 
+       if (!SignatureAlgorithm._alreadyInitialized) {
+          SignatureAlgorithm._algorithmHash = new HashMap(10);
+@@ -340,8 +392,8 @@
+            throws AlgorithmAlreadyRegisteredException,XMLSignatureException {
+ 
+       {
+-         if (true)
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Try to register " + algorithmURI + " " + implementingClass);
++         if (log.isLoggable(java.util.logging.Level.FINE))
++                log.log(java.util.logging.Level.FINE, "Try to register " + algorithmURI + " " + implementingClass);
+ 
+          // are we already registered?
+          Class registeredClassClass =
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithmSpi.java b/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithmSpi.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithmSpi.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithmSpi.java
+@@ -20,27 +20,20 @@
+  */
+ package com.sun.org.apache.xml.internal.security.algorithms;
+ 
+-
+-
+ import java.security.Key;
+ import java.security.SecureRandom;
+ import java.security.spec.AlgorithmParameterSpec;
+ 
+ import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException;
+-import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+ 
+ 
+ /**
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public abstract class SignatureAlgorithmSpi {
+ 
+-   /** {@link java.util.logging} logging facility */
+-    static java.util.logging.Logger log =
+-        java.util.logging.Logger.getLogger(SignatureAlgorithmSpi.class.getName());
+-
+    /**
+     * Returns the URI representation of <code>Transformation algorithm</code>
+     *
+@@ -167,20 +160,6 @@
+    protected abstract void engineSetParameter(AlgorithmParameterSpec params)
+       throws XMLSignatureException;
+ 
+-   /** Field _doc */
+-   Document _doc = null;
+-
+-   /**
+-    * Method engineSetDocument
+-    *
+-    * @param doc
+-    */
+-   protected void engineSetDocument(Document doc) {
+-      this._doc = doc;
+-   }
+-
+-   /** Field _constructionElement */
+-   Element _constructionElement = null;
+ 
+    /**
+     * Method engineGetContextFromElement
+@@ -188,7 +167,6 @@
+     * @param element
+     */
+    protected void engineGetContextFromElement(Element element) {
+-      this._constructionElement = element;
+    }
+ 
+    /**
+@@ -199,4 +177,7 @@
+     */
+    protected abstract void engineSetHMACOutputLength(int HMACOutputLength)
+       throws XMLSignatureException;
++
++    public void reset() {
++        }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/IntegrityHmac.java b/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/IntegrityHmac.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/IntegrityHmac.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/IntegrityHmac.java
+@@ -45,7 +45,7 @@
+ 
+ /**
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public abstract class IntegrityHmac extends SignatureAlgorithmSpi {
+ 
+@@ -80,8 +80,8 @@
+    public IntegrityHmac() throws XMLSignatureException {
+ 
+       String algorithmID = JCEMapper.translateURItoJCEID(this.engineGetURI());
+-      if (true)
+-        if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Created IntegrityHmacSHA1 using " + algorithmID);
++      if (log.isLoggable(java.util.logging.Level.FINE))
++        log.log(java.util.logging.Level.FINE, "Created IntegrityHmacSHA1 using " + algorithmID);
+ 
+       try {
+          this._macAlgorithm = Mac.getInstance(algorithmID);
+@@ -105,6 +105,10 @@
+       throw new XMLSignatureException("empty");
+    }
+ 
++   public void reset() {
++           _HMACOutputLength=0;
++   }
++
+    /**
+     * Proxy method for {@link java.security.Signature#verify(byte[])}
+     * which is executed on the internal {@link java.security.Signature} object.
+@@ -153,7 +157,20 @@
+       try {
+          this._macAlgorithm.init(secretKey);
+       } catch (InvalidKeyException ex) {
+-         throw new XMLSignatureException("empty", ex);
++            // reinstantiate Mac object to work around bug in JDK
++            // see: http://bugs.sun.com/view_bug.do?bug_id=4953555
++            Mac mac = this._macAlgorithm;
++            try {
++                this._macAlgorithm = Mac.getInstance
++                    (_macAlgorithm.getAlgorithm());
++            } catch (Exception e) {
++                // this shouldn't occur, but if it does, restore previous Mac
++                if (log.isLoggable(java.util.logging.Level.FINE)) {
++                    log.log(java.util.logging.Level.FINE, "Exception when reinstantiating Mac:" + e);
++                }
++                this._macAlgorithm = mac;
++            }
++            throw new XMLSignatureException("empty", ex);
+       }
+    }
+ 
+@@ -333,7 +350,7 @@
+     */
+    protected String engineGetJCEAlgorithmString() {
+ 
+-      if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "engineGetJCEAlgorithmString()");
++      log.log(java.util.logging.Level.FINE, "engineGetJCEAlgorithmString()");
+ 
+       return this._macAlgorithm.getAlgorithm();
+    }
+@@ -407,7 +424,8 @@
+    /**
+     * Class IntegrityHmacSHA1
+     *
+-    * @author $Author: raul $
++    * @author $Author: mullan $
++    * @version $Revision: 1.5 $
+     */
+    public static class IntegrityHmacSHA1 extends IntegrityHmac {
+ 
+@@ -437,7 +455,8 @@
+    /**
+     * Class IntegrityHmacSHA256
+     *
+-    * @author $Author: raul $
++    * @author $Author: mullan $
++    * @version $Revision: 1.5 $
+     */
+    public static class IntegrityHmacSHA256 extends IntegrityHmac {
+ 
+@@ -467,7 +486,8 @@
+    /**
+     * Class IntegrityHmacSHA384
+     *
+-    * @author $Author: raul $
++    * @author $Author: mullan $
++    * @version $Revision: 1.5 $
+     */
+    public static class IntegrityHmacSHA384 extends IntegrityHmac {
+ 
+@@ -497,7 +517,8 @@
+    /**
+     * Class IntegrityHmacSHA512
+     *
+-    * @author $Author: raul $
++    * @author $Author: mullan $
++    * @version $Revision: 1.5 $
+     */
+    public static class IntegrityHmacSHA512 extends IntegrityHmac {
+ 
+@@ -527,7 +548,8 @@
+    /**
+     * Class IntegrityHmacRIPEMD160
+     *
+-    * @author $Author: raul $
++    * @author $Author: mullan $
++    * @version $Revision: 1.5 $
+     */
+    public static class IntegrityHmacRIPEMD160 extends IntegrityHmac {
+ 
+@@ -557,7 +579,8 @@
+    /**
+     * Class IntegrityHmacMD5
+     *
+-    * @author $Author: raul $
++    * @author $Author: mullan $
++    * @version $Revision: 1.5 $
+     */
+    public static class IntegrityHmacMD5 extends IntegrityHmac {
+ 
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureBaseRSA.java b/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureBaseRSA.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureBaseRSA.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureBaseRSA.java
+@@ -3,7 +3,7 @@
+  * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * Copyright  1999-2004 The Apache Software Foundation.
++ * Copyright  1999-2007 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.
+@@ -20,8 +20,6 @@
+  */
+ package com.sun.org.apache.xml.internal.security.algorithms.implementations;
+ 
+-
+-
+ import java.security.InvalidAlgorithmParameterException;
+ import java.security.InvalidKeyException;
+ import java.security.Key;
+@@ -38,329 +36,344 @@
+ import com.sun.org.apache.xml.internal.security.signature.XMLSignature;
+ import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException;
+ 
+-
+ /**
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public abstract class SignatureBaseRSA extends SignatureAlgorithmSpi {
+ 
+-   /** {@link java.util.logging} logging facility */
++    /** {@link java.util.logging} logging facility */
+     static java.util.logging.Logger log =
+-        java.util.logging.Logger.getLogger(SignatureBaseRSA.class.getName());
++        java.util.logging.Logger.getLogger
++        (SignatureBaseRSA.class.getName());
+ 
+     /** @inheritDoc */
+-   public abstract String engineGetURI();
++    public abstract String engineGetURI();
+ 
+-   /** Field algorithm */
+-   private java.security.Signature _signatureAlgorithm = null;
++    /** Field algorithm */
++    private java.security.Signature _signatureAlgorithm = null;
+ 
+-   /**
+-    * Constructor SignatureRSA
+-    *
+-    * @throws XMLSignatureException
+-    */
+-   public SignatureBaseRSA() throws XMLSignatureException {
++    /**
++     * Constructor SignatureRSA
++     *
++     * @throws XMLSignatureException
++     */
++    public SignatureBaseRSA() throws XMLSignatureException {
+ 
+-      String algorithmID = JCEMapper.translateURItoJCEID(this.engineGetURI());
++        String algorithmID = JCEMapper.translateURItoJCEID(this.engineGetURI());
+ 
+-      if (true)
+-        if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Created SignatureDSA using " + algorithmID);
+-      String provider=JCEMapper.getProviderId();
+-      try {
+-         if (provider==null) {
++        if (log.isLoggable(java.util.logging.Level.FINE))
++            log.log(java.util.logging.Level.FINE, "Created SignatureRSA using " + algorithmID);
++        String provider=JCEMapper.getProviderId();
++        try {
++            if (provider==null) {
+                 this._signatureAlgorithm = Signature.getInstance(algorithmID);
+-         } else {
++            } else {
+                 this._signatureAlgorithm = Signature.getInstance(algorithmID,provider);
+-         }
+-      } catch (java.security.NoSuchAlgorithmException ex) {
+-         Object[] exArgs = { algorithmID,
+-                             ex.getLocalizedMessage() };
++            }
++        } catch (java.security.NoSuchAlgorithmException ex) {
++            Object[] exArgs = { algorithmID, ex.getLocalizedMessage() };
+ 
+-         throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs);
+-      } catch (NoSuchProviderException ex) {
+-         Object[] exArgs = { algorithmID,
+-                                                 ex.getLocalizedMessage() };
++            throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs);
++        } catch (NoSuchProviderException ex) {
++            Object[] exArgs = { algorithmID, ex.getLocalizedMessage() };
+ 
+-         throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs);
++            throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs);
+         }
+-   }
++    }
+ 
+-   /** @inheritDoc */
+-   protected void engineSetParameter(AlgorithmParameterSpec params)
+-           throws XMLSignatureException {
++    /** @inheritDoc */
++    protected void engineSetParameter(AlgorithmParameterSpec params)
++        throws XMLSignatureException {
+ 
+-      try {
+-         this._signatureAlgorithm.setParameter(params);
+-      } catch (InvalidAlgorithmParameterException ex) {
+-         throw new XMLSignatureException("empty", ex);
+-      }
+-   }
++        try {
++            this._signatureAlgorithm.setParameter(params);
++        } catch (InvalidAlgorithmParameterException ex) {
++            throw new XMLSignatureException("empty", ex);
++        }
++    }
+ 
+-   /** @inheritDoc */
+-   protected boolean engineVerify(byte[] signature)
+-           throws XMLSignatureException {
++    /** @inheritDoc */
++    protected boolean engineVerify(byte[] signature)
++        throws XMLSignatureException {
+ 
+-      try {
+-         return this._signatureAlgorithm.verify(signature);
+-      } catch (SignatureException ex) {
+-         throw new XMLSignatureException("empty", ex);
+-      }
+-   }
++        try {
++            return this._signatureAlgorithm.verify(signature);
++        } catch (SignatureException ex) {
++            throw new XMLSignatureException("empty", ex);
++        }
++    }
+ 
+-   /** @inheritDoc */
+-   protected void engineInitVerify(Key publicKey) throws XMLSignatureException {
++    /** @inheritDoc */
++    protected void engineInitVerify(Key publicKey) throws XMLSignatureException {
+ 
+-      if (!(publicKey instanceof PublicKey)) {
+-         String supplied = publicKey.getClass().getName();
+-         String needed = PublicKey.class.getName();
+-         Object exArgs[] = { supplied, needed };
++        if (!(publicKey instanceof PublicKey)) {
++            String supplied = publicKey.getClass().getName();
++            String needed = PublicKey.class.getName();
++            Object exArgs[] = { supplied, needed };
+ 
+-         throw new XMLSignatureException("algorithms.WrongKeyForThisOperation",
+-                                         exArgs);
+-      }
++            throw new XMLSignatureException
++                ("algorithms.WrongKeyForThisOperation", exArgs);
++        }
+ 
+-      try {
+-         this._signatureAlgorithm.initVerify((PublicKey) publicKey);
+-      } catch (InvalidKeyException ex) {
+-         throw new XMLSignatureException("empty", ex);
+-      }
+-   }
++        try {
++            this._signatureAlgorithm.initVerify((PublicKey) publicKey);
++        } catch (InvalidKeyException ex) {
++            // reinstantiate Signature object to work around bug in JDK
++            // see: http://bugs.sun.com/view_bug.do?bug_id=4953555
++            Signature sig = this._signatureAlgorithm;
++            try {
++                this._signatureAlgorithm = Signature.getInstance
++                    (_signatureAlgorithm.getAlgorithm());
++            } catch (Exception e) {
++                // this shouldn't occur, but if it does, restore previous
++                // Signature
++                if (log.isLoggable(java.util.logging.Level.FINE)) {
++                    log.log(java.util.logging.Level.FINE, "Exception when reinstantiating Signature:" + e);
++                }
++                this._signatureAlgorithm = sig;
++            }
++            throw new XMLSignatureException("empty", ex);
++        }
++    }
+ 
+-   /** @inheritDoc */
+-   protected byte[] engineSign() throws XMLSignatureException {
++    /** @inheritDoc */
++    protected byte[] engineSign() throws XMLSignatureException {
++        try {
++            return this._signatureAlgorithm.sign();
++        } catch (SignatureException ex) {
++            throw new XMLSignatureException("empty", ex);
++        }
++    }
+ 
+-      try {
+-         return this._signatureAlgorithm.sign();
+-      } catch (SignatureException ex) {
+-         throw new XMLSignatureException("empty", ex);
+-      }
+-   }
++    /** @inheritDoc */
++    protected void engineInitSign(Key privateKey, SecureRandom secureRandom)
++        throws XMLSignatureException {
+ 
+-   /** @inheritDoc */
+-   protected void engineInitSign(Key privateKey, SecureRandom secureRandom)
+-           throws XMLSignatureException {
++        if (!(privateKey instanceof PrivateKey)) {
++            String supplied = privateKey.getClass().getName();
++            String needed = PrivateKey.class.getName();
++            Object exArgs[] = { supplied, needed };
+ 
+-      if (!(privateKey instanceof PrivateKey)) {
+-         String supplied = privateKey.getClass().getName();
+-         String needed = PrivateKey.class.getName();
+-         Object exArgs[] = { supplied, needed };
++            throw new XMLSignatureException
++                ("algorithms.WrongKeyForThisOperation", exArgs);
++        }
+ 
+-         throw new XMLSignatureException("algorithms.WrongKeyForThisOperation",
+-                                         exArgs);
+-      }
++        try {
++            this._signatureAlgorithm.initSign
++                ((PrivateKey) privateKey, secureRandom);
++        } catch (InvalidKeyException ex) {
++            throw new XMLSignatureException("empty", ex);
++        }
++    }
+ 
+-      try {
+-         this._signatureAlgorithm.initSign((PrivateKey) privateKey,
+-                                           secureRandom);
+-      } catch (InvalidKeyException ex) {
+-         throw new XMLSignatureException("empty", ex);
+-      }
+-   }
++    /** @inheritDoc */
++    protected void engineInitSign(Key privateKey) throws XMLSignatureException {
+ 
+-   /** @inheritDoc */
+-   protected void engineInitSign(Key privateKey) throws XMLSignatureException {
++        if (!(privateKey instanceof PrivateKey)) {
++            String supplied = privateKey.getClass().getName();
++            String needed = PrivateKey.class.getName();
++            Object exArgs[] = { supplied, needed };
+ 
+-      if (!(privateKey instanceof PrivateKey)) {
+-         String supplied = privateKey.getClass().getName();
+-         String needed = PrivateKey.class.getName();
+-         Object exArgs[] = { supplied, needed };
++            throw new XMLSignatureException
++                ("algorithms.WrongKeyForThisOperation", exArgs);
++        }
+ 
+-         throw new XMLSignatureException("algorithms.WrongKeyForThisOperation",
+-                                         exArgs);
+-      }
++        try {
++            this._signatureAlgorithm.initSign((PrivateKey) privateKey);
++        } catch (InvalidKeyException ex) {
++            throw new XMLSignatureException("empty", ex);
++        }
++    }
+ 
+-      try {
+-         this._signatureAlgorithm.initSign((PrivateKey) privateKey);
+-      } catch (InvalidKeyException ex) {
+-         throw new XMLSignatureException("empty", ex);
+-      }
+-   }
++    /** @inheritDoc */
++    protected void engineUpdate(byte[] input) throws XMLSignatureException {
++        try {
++            this._signatureAlgorithm.update(input);
++        } catch (SignatureException ex) {
++            throw new XMLSignatureException("empty", ex);
++        }
++    }
+ 
+-   /** @inheritDoc */
+-   protected void engineUpdate(byte[] input) throws XMLSignatureException {
++    /** @inheritDoc */
++    protected void engineUpdate(byte input) throws XMLSignatureException {
++        try {
++            this._signatureAlgorithm.update(input);
++        } catch (SignatureException ex) {
++            throw new XMLSignatureException("empty", ex);
++        }
++    }
+ 
+-      try {
+-         this._signatureAlgorithm.update(input);
+-      } catch (SignatureException ex) {
+-         throw new XMLSignatureException("empty", ex);
+-      }
+-   }
++    /** @inheritDoc */
++    protected void engineUpdate(byte buf[], int offset, int len)
++        throws XMLSignatureException {
++        try {
++            this._signatureAlgorithm.update(buf, offset, len);
++        } catch (SignatureException ex) {
++            throw new XMLSignatureException("empty", ex);
++        }
++    }
+ 
+-   /** @inheritDoc */
+-   protected void engineUpdate(byte input) throws XMLSignatureException {
++    /** @inheritDoc */
++    protected String engineGetJCEAlgorithmString() {
++        return this._signatureAlgorithm.getAlgorithm();
++    }
+ 
+-      try {
+-         this._signatureAlgorithm.update(input);
+-      } catch (SignatureException ex) {
+-         throw new XMLSignatureException("empty", ex);
+-      }
+-   }
++    /** @inheritDoc */
++    protected String engineGetJCEProviderName() {
++        return this._signatureAlgorithm.getProvider().getName();
++    }
+ 
+-   /** @inheritDoc */
+-   protected void engineUpdate(byte buf[], int offset, int len)
+-           throws XMLSignatureException {
++    /** @inheritDoc */
++    protected void engineSetHMACOutputLength(int HMACOutputLength)
++        throws XMLSignatureException {
++        throw new XMLSignatureException
++            ("algorithms.HMACOutputLengthOnlyForHMAC");
++    }
+ 
+-      try {
+-         this._signatureAlgorithm.update(buf, offset, len);
+-      } catch (SignatureException ex) {
+-         throw new XMLSignatureException("empty", ex);
+-      }
+-   }
++    /** @inheritDoc */
++    protected void engineInitSign(
++        Key signingKey, AlgorithmParameterSpec algorithmParameterSpec)
++        throws XMLSignatureException {
++        throw new XMLSignatureException(
++            "algorithms.CannotUseAlgorithmParameterSpecOnRSA");
++    }
+ 
+-   /** @inheritDoc */
+-   protected String engineGetJCEAlgorithmString() {
+-      return this._signatureAlgorithm.getAlgorithm();
+-   }
++    /**
++     * Class SignatureRSASHA1
++     *
++     * @author $Author: mullan $
++     * @version $Revision: 1.5 $
++     */
++    public static class SignatureRSASHA1 extends SignatureBaseRSA {
+ 
+-   /** @inheritDoc */
+-   protected String engineGetJCEProviderName() {
+-      return this._signatureAlgorithm.getProvider().getName();
+-   }
++        /**
++         * Constructor SignatureRSASHA1
++         *
++         * @throws XMLSignatureException
++         */
++        public SignatureRSASHA1() throws XMLSignatureException {
++            super();
++        }
+ 
+-   /** @inheritDoc */
+-   protected void engineSetHMACOutputLength(int HMACOutputLength)
+-           throws XMLSignatureException {
+-      throw new XMLSignatureException("algorithms.HMACOutputLengthOnlyForHMAC");
+-   }
++        /** @inheritDoc */
++        public String engineGetURI() {
++            return XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA1;
++        }
++    }
+ 
+-   /** @inheritDoc */
+-   protected void engineInitSign(
+-           Key signingKey, AlgorithmParameterSpec algorithmParameterSpec)
+-              throws XMLSignatureException {
+-      throw new XMLSignatureException(
+-         "algorithms.CannotUseAlgorithmParameterSpecOnRSA");
+-   }
++    /**
++     * Class SignatureRSASHA256
++     *
++     * @author $Author: mullan $
++     * @version $Revision: 1.5 $
++     */
++    public static class SignatureRSASHA256 extends SignatureBaseRSA {
+ 
+-   /**
+-    * Class SignatureRSASHA1
+-    *
+-    * @author $Author: raul $
+-    */
+-   public static class SignatureRSASHA1 extends SignatureBaseRSA {
++        /**
++         * Constructor SignatureRSASHA256
++         *
++         * @throws XMLSignatureException
++         */
++        public SignatureRSASHA256() throws XMLSignatureException {
++            super();
++        }
+ 
+-      /**
+-       * Constructor SignatureRSASHA1
+-       *
+-       * @throws XMLSignatureException
+-       */
+-      public SignatureRSASHA1() throws XMLSignatureException {
+-         super();
+-      }
++        /** @inheritDoc */
++        public String engineGetURI() {
++            return XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA256;
++        }
++    }
+ 
+-      /** @inheritDoc */
+-      public String engineGetURI() {
+-         return XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA1;
+-      }
+-   }
++    /**
++     * Class SignatureRSASHA384
++     *
++     * @author $Author: mullan $
++     * @version $Revision: 1.5 $
++     */
++    public static class SignatureRSASHA384 extends SignatureBaseRSA {
+ 
+-   /**
+-    * Class SignatureRSASHA256
+-    *
+-    * @author $Author: raul $
+-    */
+-   public static class SignatureRSASHA256 extends SignatureBaseRSA {
++        /**
++         * Constructor SignatureRSASHA384
++         *
++         * @throws XMLSignatureException
++         */
++        public SignatureRSASHA384() throws XMLSignatureException {
++            super();
++        }
+ 
+-      /**
+-       * Constructor SignatureRSASHA256
+-       *
+-       * @throws XMLSignatureException
+-       */
+-      public SignatureRSASHA256() throws XMLSignatureException {
+-         super();
+-      }
++        /** @inheritDoc */
++        public String engineGetURI() {
++            return XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA384;
++        }
++    }
+ 
+-      /** @inheritDoc */
+-      public String engineGetURI() {
+-         return XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA256;
+-      }
+-   }
++    /**
++     * Class SignatureRSASHA512
++     *
++     * @author $Author: mullan $
++     * @version $Revision: 1.5 $
++     */
++    public static class SignatureRSASHA512 extends SignatureBaseRSA {
+ 
+-   /**
+-    * Class SignatureRSASHA384
+-    *
+-    * @author $Author: raul $
+-    */
+-   public static class SignatureRSASHA384 extends SignatureBaseRSA {
++        /**
++         * Constructor SignatureRSASHA512
++         *
++         * @throws XMLSignatureException
++         */
++        public SignatureRSASHA512() throws XMLSignatureException {
++            super();
++        }
+ 
+-      /**
+-       * Constructor SignatureRSASHA384
+-       *
+-       * @throws XMLSignatureException
+-       */
+-      public SignatureRSASHA384() throws XMLSignatureException {
+-         super();
+-      }
++        /** @inheritDoc */
++        public String engineGetURI() {
++            return XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA512;
++        }
++    }
+ 
+-      /** @inheritDoc */
+-      public String engineGetURI() {
+-         return XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA384;
+-      }
+-   }
++    /**
++     * Class SignatureRSARIPEMD160
++     *
++     * @author $Author: mullan $
++     * @version $Revision: 1.5 $
++     */
++    public static class SignatureRSARIPEMD160 extends SignatureBaseRSA {
+ 
+-   /**
+-    * Class SignatureRSASHA512
+-    *
+-    * @author $Author: raul $
+-    */
+-   public static class SignatureRSASHA512 extends SignatureBaseRSA {
++        /**
++         * Constructor SignatureRSARIPEMD160
++         *
++         * @throws XMLSignatureException
++         */
++        public SignatureRSARIPEMD160() throws XMLSignatureException {
++            super();
++        }
+ 
+-      /**
+-       * Constructor SignatureRSASHA512
+-       *
+-       * @throws XMLSignatureException
+-       */
+-      public SignatureRSASHA512() throws XMLSignatureException {
+-         super();
+-      }
++        /** @inheritDoc */
++        public String engineGetURI() {
++            return XMLSignature.ALGO_ID_SIGNATURE_RSA_RIPEMD160;
++        }
++    }
+ 
+-      /** @inheritDoc */
+-      public String engineGetURI() {
+-         return XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA512;
+-      }
+-   }
++    /**
++     * Class SignatureRSAMD5
++     *
++     * @author $Author: mullan $
++     * @version $Revision: 1.5 $
++     */
++    public static class SignatureRSAMD5 extends SignatureBaseRSA {
+ 
+-   /**
+-    * Class SignatureRSARIPEMD160
+-    *
+-    * @author $Author: raul $
+-    */
+-   public static class SignatureRSARIPEMD160 extends SignatureBaseRSA {
++        /**
++         * Constructor SignatureRSAMD5
++         *
++         * @throws XMLSignatureException
++         */
++        public SignatureRSAMD5() throws XMLSignatureException {
++            super();
++        }
+ 
+-      /**
+-       * Constructor SignatureRSARIPEMD160
+-       *
+-       * @throws XMLSignatureException
+-       */
+-      public SignatureRSARIPEMD160() throws XMLSignatureException {
+-         super();
+-      }
+-
+-      /** @inheritDoc */
+-      public String engineGetURI() {
+-         return XMLSignature.ALGO_ID_SIGNATURE_RSA_RIPEMD160;
+-      }
+-   }
+-
+-   /**
+-    * Class SignatureRSAMD5
+-    *
+-    * @author $Author: raul $
+-    */
+-   public static class SignatureRSAMD5 extends SignatureBaseRSA {
+-
+-      /**
+-       * Constructor SignatureRSAMD5
+-       *
+-       * @throws XMLSignatureException
+-       */
+-      public SignatureRSAMD5() throws XMLSignatureException {
+-         super();
+-      }
+-
+-      /** @inheritDoc */
+-      public String engineGetURI() {
+-         return XMLSignature.ALGO_ID_SIGNATURE_NOT_RECOMMENDED_RSA_MD5;
+-      }
+-   }
++        /** @inheritDoc */
++        public String engineGetURI() {
++            return XMLSignature.ALGO_ID_SIGNATURE_NOT_RECOMMENDED_RSA_MD5;
++        }
++    }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureDSA.java b/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureDSA.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureDSA.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureDSA.java
+@@ -20,8 +20,6 @@
+  */
+ package com.sun.org.apache.xml.internal.security.algorithms.implementations;
+ 
+-
+-
+ import java.io.IOException;
+ import java.security.InvalidAlgorithmParameterException;
+ import java.security.InvalidKeyException;
+@@ -39,342 +37,359 @@
+ import com.sun.org.apache.xml.internal.security.utils.Base64;
+ import com.sun.org.apache.xml.internal.security.utils.Constants;
+ 
+-
+ /**
+  *
+- * @author $Author: vishal $
++ * @author $Author: mullan $
+  */
+ public class SignatureDSA extends SignatureAlgorithmSpi {
+ 
+-   /** {@link java.util.logging} logging facility */
++    /** {@link java.util.logging} logging facility */
+     static java.util.logging.Logger log =
+         java.util.logging.Logger.getLogger(SignatureDSA.class.getName());
+ 
+-   /** Field _URI */
+-   public static final String _URI = Constants.SignatureSpecNS + "dsa-sha1";
++    /** Field _URI */
++    public static final String _URI = Constants.SignatureSpecNS + "dsa-sha1";
+ 
+-   /** Field algorithm */
+-   private java.security.Signature _signatureAlgorithm = null;
++    /** Field algorithm */
++    private java.security.Signature _signatureAlgorithm = null;
+ 
+-   /**
+-    * Method engineGetURI
+-    *
+-    * @inheritDoc
+-    */
+-   protected String engineGetURI() {
+-      return SignatureDSA._URI;
+-   }
++    /**
++     * Method engineGetURI
++     *
++     * @inheritDoc
++     */
++    protected String engineGetURI() {
++        return SignatureDSA._URI;
++    }
+ 
+-   /**
+-    * Constructor SignatureDSA
+-    *
+-    * @throws XMLSignatureException
+-    */
+-   public SignatureDSA() throws XMLSignatureException {
++    /**
++     * Constructor SignatureDSA
++     *
++     * @throws XMLSignatureException
++     */
++    public SignatureDSA() throws XMLSignatureException {
+ 
+-      String algorithmID = JCEMapper.translateURItoJCEID(SignatureDSA._URI);
+-      if (true)
+-        if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Created SignatureDSA using " + algorithmID);
++        String algorithmID = JCEMapper.translateURItoJCEID(SignatureDSA._URI);
++        if (log.isLoggable(java.util.logging.Level.FINE))
++            log.log(java.util.logging.Level.FINE, "Created SignatureDSA using " + algorithmID);
+ 
+-      try {
+-         this._signatureAlgorithm = Signature.getInstance(algorithmID);
+-      } catch (java.security.NoSuchAlgorithmException ex) {
+-         Object[] exArgs = { algorithmID,
+-                             ex.getLocalizedMessage() };
++        String provider = JCEMapper.getProviderId();
++        try {
++            if (provider == null) {
++                this._signatureAlgorithm = Signature.getInstance(algorithmID);
++            } else {
++                this._signatureAlgorithm =
++                    Signature.getInstance(algorithmID, provider);
++            }
++        } catch (java.security.NoSuchAlgorithmException ex) {
++            Object[] exArgs = { algorithmID, ex.getLocalizedMessage() };
++            throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs);
++        } catch (java.security.NoSuchProviderException ex) {
++            Object[] exArgs = { algorithmID, ex.getLocalizedMessage() };
++            throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs);
++        }
++    }
+ 
+-         throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs);
+-      }
+-   }
++    /**
++     * @inheritDoc
++     */
++    protected void engineSetParameter(AlgorithmParameterSpec params)
++        throws XMLSignatureException {
+ 
+-   /**
+-    * @inheritDoc
+-    */
+-   protected void engineSetParameter(AlgorithmParameterSpec params)
++        try {
++            this._signatureAlgorithm.setParameter(params);
++        } catch (InvalidAlgorithmParameterException ex) {
++            throw new XMLSignatureException("empty", ex);
++        }
++    }
++
++    /**
++     * @inheritDoc
++     */
++    protected boolean engineVerify(byte[] signature)
+            throws XMLSignatureException {
+ 
+-      try {
+-         this._signatureAlgorithm.setParameter(params);
+-      } catch (InvalidAlgorithmParameterException ex) {
+-         throw new XMLSignatureException("empty", ex);
+-      }
+-   }
++        try {
++            if (log.isLoggable(java.util.logging.Level.FINE))
++                log.log(java.util.logging.Level.FINE, "Called DSA.verify() on " + Base64.encode(signature));
+ 
+-   /**
+-    * @inheritDoc
+-    */
+-   protected boolean engineVerify(byte[] signature)
++            byte[] jcebytes = SignatureDSA.convertXMLDSIGtoASN1(signature);
++
++            return this._signatureAlgorithm.verify(jcebytes);
++        } catch (SignatureException ex) {
++            throw new XMLSignatureException("empty", ex);
++        } catch (IOException ex) {
++            throw new XMLSignatureException("empty", ex);
++        }
++    }
++
++    /**
++     * @inheritDoc
++     */
++    protected void engineInitVerify(Key publicKey) throws XMLSignatureException {
++
++        if (!(publicKey instanceof PublicKey)) {
++            String supplied = publicKey.getClass().getName();
++            String needed = PublicKey.class.getName();
++            Object exArgs[] = { supplied, needed };
++
++            throw new XMLSignatureException
++                ("algorithms.WrongKeyForThisOperation", exArgs);
++        }
++
++        try {
++            this._signatureAlgorithm.initVerify((PublicKey) publicKey);
++        } catch (InvalidKeyException ex) {
++            // reinstantiate Signature object to work around bug in JDK
++            // see: http://bugs.sun.com/view_bug.do?bug_id=4953555
++            Signature sig = this._signatureAlgorithm;
++            try {
++                this._signatureAlgorithm = Signature.getInstance
++                    (_signatureAlgorithm.getAlgorithm());
++            } catch (Exception e) {
++                // this shouldn't occur, but if it does, restore previous
++                // Signature
++                if (log.isLoggable(java.util.logging.Level.FINE)) {
++                    log.log(java.util.logging.Level.FINE, "Exception when reinstantiating Signature:" + e);
++                }
++                this._signatureAlgorithm = sig;
++            }
++            throw new XMLSignatureException("empty", ex);
++        }
++    }
++
++    /**
++     * @inheritDoc
++     */
++    protected byte[] engineSign() throws XMLSignatureException {
++
++        try {
++            byte jcebytes[] = this._signatureAlgorithm.sign();
++
++            return SignatureDSA.convertASN1toXMLDSIG(jcebytes);
++        } catch (IOException ex) {
++            throw new XMLSignatureException("empty", ex);
++        } catch (SignatureException ex) {
++            throw new XMLSignatureException("empty", ex);
++        }
++    }
++
++    /**
++     * @inheritDoc
++     */
++    protected void engineInitSign(Key privateKey, SecureRandom secureRandom)
+            throws XMLSignatureException {
+ 
+-      try {
+-         if (true)
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Called DSA.verify() on " + Base64.encode(signature));
++        if (!(privateKey instanceof PrivateKey)) {
++            String supplied = privateKey.getClass().getName();
++            String needed = PrivateKey.class.getName();
++            Object exArgs[] = { supplied, needed };
+ 
+-         byte[] jcebytes = SignatureDSA.convertXMLDSIGtoASN1(signature);
++            throw new XMLSignatureException
++                ("algorithms.WrongKeyForThisOperation", exArgs);
++        }
+ 
+-         return this._signatureAlgorithm.verify(jcebytes);
+-      } catch (SignatureException ex) {
+-         throw new XMLSignatureException("empty", ex);
+-      } catch (IOException ex) {
+-         throw new XMLSignatureException("empty", ex);
+-      }
+-   }
++        try {
++            this._signatureAlgorithm.initSign((PrivateKey) privateKey,
++                                           secureRandom);
++        } catch (InvalidKeyException ex) {
++            throw new XMLSignatureException("empty", ex);
++        }
++    }
+ 
+-   /**
+-    * @inheritDoc
+-    */
+-   protected void engineInitVerify(Key publicKey) throws XMLSignatureException {
++    /**
++     * @inheritDoc
++     */
++    protected void engineInitSign(Key privateKey) throws XMLSignatureException {
+ 
+-      if (!(publicKey instanceof PublicKey)) {
+-         String supplied = publicKey.getClass().getName();
+-         String needed = PublicKey.class.getName();
+-         Object exArgs[] = { supplied, needed };
++        if (!(privateKey instanceof PrivateKey)) {
++            String supplied = privateKey.getClass().getName();
++            String needed = PrivateKey.class.getName();
++            Object exArgs[] = { supplied, needed };
+ 
+-         throw new XMLSignatureException("algorithms.WrongKeyForThisOperation",
+-                                         exArgs);
+-      }
++            throw new XMLSignatureException
++                ("algorithms.WrongKeyForThisOperation", exArgs);
++        }
+ 
+-      try {
+-         this._signatureAlgorithm.initVerify((PublicKey) publicKey);
+-      } catch (InvalidKeyException ex) {
+-         throw new XMLSignatureException("empty", ex);
+-      }
+-   }
++        try {
++            this._signatureAlgorithm.initSign((PrivateKey) privateKey);
++        } catch (InvalidKeyException ex) {
++            throw new XMLSignatureException("empty", ex);
++        }
++    }
+ 
+-   /**
+-    * @inheritDoc
+-    */
+-   protected byte[] engineSign() throws XMLSignatureException {
++    /**
++     * @inheritDoc
++     */
++    protected void engineUpdate(byte[] input) throws XMLSignatureException {
++        try {
++            this._signatureAlgorithm.update(input);
++        } catch (SignatureException ex) {
++            throw new XMLSignatureException("empty", ex);
++        }
++    }
+ 
+-      try {
+-         byte jcebytes[] = this._signatureAlgorithm.sign();
++    /**
++     * @inheritDoc
++     */
++    protected void engineUpdate(byte input) throws XMLSignatureException {
++        try {
++            this._signatureAlgorithm.update(input);
++        } catch (SignatureException ex) {
++            throw new XMLSignatureException("empty", ex);
++        }
++    }
+ 
+-         return SignatureDSA.convertASN1toXMLDSIG(jcebytes);
+-      } catch (IOException ex) {
+-         throw new XMLSignatureException("empty", ex);
+-      } catch (SignatureException ex) {
+-         throw new XMLSignatureException("empty", ex);
+-      }
+-   }
++    /**
++     * @inheritDoc
++     */
++    protected void engineUpdate(byte buf[], int offset, int len)
++        throws XMLSignatureException {
++        try {
++            this._signatureAlgorithm.update(buf, offset, len);
++        } catch (SignatureException ex) {
++            throw new XMLSignatureException("empty", ex);
++        }
++    }
+ 
+-   /**
+-    * @inheritDoc
+-    */
+-   protected void engineInitSign(Key privateKey, SecureRandom secureRandom)
+-           throws XMLSignatureException {
++    /**
++     * Method engineGetJCEAlgorithmString
++     *
++     * @inheritDoc
++     */
++    protected String engineGetJCEAlgorithmString() {
++        return this._signatureAlgorithm.getAlgorithm();
++    }
+ 
+-      if (!(privateKey instanceof PrivateKey)) {
+-         String supplied = privateKey.getClass().getName();
+-         String needed = PrivateKey.class.getName();
+-         Object exArgs[] = { supplied, needed };
++    /**
++     * Method engineGetJCEProviderName
++     *
++     * @inheritDoc
++     */
++    protected String engineGetJCEProviderName() {
++        return this._signatureAlgorithm.getProvider().getName();
++    }
+ 
+-         throw new XMLSignatureException("algorithms.WrongKeyForThisOperation",
+-                                         exArgs);
+-      }
+-
+-      try {
+-         this._signatureAlgorithm.initSign((PrivateKey) privateKey,
+-                                           secureRandom);
+-      } catch (InvalidKeyException ex) {
+-         throw new XMLSignatureException("empty", ex);
+-      }
+-   }
+-
+-   /**
+-    * @inheritDoc
+-    */
+-   protected void engineInitSign(Key privateKey) throws XMLSignatureException {
+-
+-      if (!(privateKey instanceof PrivateKey)) {
+-         String supplied = privateKey.getClass().getName();
+-         String needed = PrivateKey.class.getName();
+-         Object exArgs[] = { supplied, needed };
+-
+-         throw new XMLSignatureException("algorithms.WrongKeyForThisOperation",
+-                                         exArgs);
+-      }
+-
+-      try {
+-         this._signatureAlgorithm.initSign((PrivateKey) privateKey);
+-      } catch (InvalidKeyException ex) {
+-         throw new XMLSignatureException("empty", ex);
+-      }
+-   }
+-
+-   /**
+-    * @inheritDoc
+-    */
+-   protected void engineUpdate(byte[] input) throws XMLSignatureException {
+-
+-      try {
+-         this._signatureAlgorithm.update(input);
+-      } catch (SignatureException ex) {
+-         throw new XMLSignatureException("empty", ex);
+-      }
+-   }
+-
+-   /**
+-    * @inheritDoc
+-    */
+-   protected void engineUpdate(byte input) throws XMLSignatureException {
+-
+-      try {
+-         this._signatureAlgorithm.update(input);
+-      } catch (SignatureException ex) {
+-         throw new XMLSignatureException("empty", ex);
+-      }
+-   }
+-
+-   /**
+-    * @inheritDoc
+-    */
+-   protected void engineUpdate(byte buf[], int offset, int len)
+-           throws XMLSignatureException {
+-
+-      try {
+-         this._signatureAlgorithm.update(buf, offset, len);
+-      } catch (SignatureException ex) {
+-         throw new XMLSignatureException("empty", ex);
+-      }
+-   }
+-
+-   /**
+-    * Method engineGetJCEAlgorithmString
+-    *
+-    * @inheritDoc
+-    */
+-   protected String engineGetJCEAlgorithmString() {
+-      return this._signatureAlgorithm.getAlgorithm();
+-   }
+-
+-   /**
+-    * Method engineGetJCEProviderName
+-    *
+-    * @inheritDoc
+-    */
+-   protected String engineGetJCEProviderName() {
+-      return this._signatureAlgorithm.getProvider().getName();
+-   }
+-
+-
+-   /**
+-    * Converts an ASN.1 DSA value to a XML Signature DSA Value.
+-    *
+-    * The JAVA JCE DSA Signature algorithm creates ASN.1 encoded (r,s) value
+-    * pairs; the XML Signature requires the core BigInteger values.
+-    *
+-    * @param asn1Bytes
+-    * @return the decode bytes
+-    *
+-    * @throws IOException
+-    * @see <A HREF="http://www.w3.org/TR/xmldsig-core/#dsa-sha1">6.4.1 DSA</A>
+-    */
+-   private static byte[] convertASN1toXMLDSIG(byte asn1Bytes[])
++    /**
++     * Converts an ASN.1 DSA value to a XML Signature DSA Value.
++     *
++     * The JAVA JCE DSA Signature algorithm creates ASN.1 encoded (r,s) value
++     * pairs; the XML Signature requires the core BigInteger values.
++     *
++     * @param asn1Bytes
++     * @return the decode bytes
++     *
++     * @throws IOException
++     * @see <A HREF="http://www.w3.org/TR/xmldsig-core/#dsa-sha1">6.4.1 DSA</A>
++     */
++    private static byte[] convertASN1toXMLDSIG(byte asn1Bytes[])
+            throws IOException {
+ 
+-      byte rLength = asn1Bytes[3];
+-      int i;
++        byte rLength = asn1Bytes[3];
++        int i;
+ 
+-      for (i = rLength; (i > 0) && (asn1Bytes[(4 + rLength) - i] == 0); i--);
++        for (i = rLength; (i > 0) && (asn1Bytes[(4 + rLength) - i] == 0); i--);
+ 
+-      byte sLength = asn1Bytes[5 + rLength];
+-      int j;
++        byte sLength = asn1Bytes[5 + rLength];
++        int j;
+ 
+-      for (j = sLength;
++        for (j = sLength;
+               (j > 0) && (asn1Bytes[(6 + rLength + sLength) - j] == 0); j--);
+ 
+-      if ((asn1Bytes[0] != 48) || (asn1Bytes[1] != asn1Bytes.length - 2)
++        if ((asn1Bytes[0] != 48) || (asn1Bytes[1] != asn1Bytes.length - 2)
+               || (asn1Bytes[2] != 2) || (i > 20)
+               || (asn1Bytes[4 + rLength] != 2) || (j > 20)) {
+-         throw new IOException("Invalid ASN.1 format of DSA signature");
+-      }
+-      byte xmldsigBytes[] = new byte[40];
++            throw new IOException("Invalid ASN.1 format of DSA signature");
++        }
++        byte xmldsigBytes[] = new byte[40];
+ 
+-      System.arraycopy(asn1Bytes, (4 + rLength) - i, xmldsigBytes, 20 - i,
++        System.arraycopy(asn1Bytes, (4 + rLength) - i, xmldsigBytes, 20 - i,
+                           i);
+-      System.arraycopy(asn1Bytes, (6 + rLength + sLength) - j, xmldsigBytes,
++        System.arraycopy(asn1Bytes, (6 + rLength + sLength) - j, xmldsigBytes,
+                           40 - j, j);
+ 
+-       return xmldsigBytes;
+-   }
++        return xmldsigBytes;
++    }
+ 
+-   /**
+-    * Converts a XML Signature DSA Value to an ASN.1 DSA value.
+-    *
+-    * The JAVA JCE DSA Signature algorithm creates ASN.1 encoded (r,s) value
+-    * pairs; the XML Signature requires the core BigInteger values.
+-    *
+-    * @param xmldsigBytes
+-    * @return the encoded ASN.1 bytes
+-    *
+-    * @throws IOException
+-    * @see <A HREF="http://www.w3.org/TR/xmldsig-core/#dsa-sha1">6.4.1 DSA</A>
+-    */
+-   private static byte[] convertXMLDSIGtoASN1(byte xmldsigBytes[])
++    /**
++     * Converts a XML Signature DSA Value to an ASN.1 DSA value.
++     *
++     * The JAVA JCE DSA Signature algorithm creates ASN.1 encoded (r,s) value
++     * pairs; the XML Signature requires the core BigInteger values.
++     *
++     * @param xmldsigBytes
++     * @return the encoded ASN.1 bytes
++     *
++     * @throws IOException
++     * @see <A HREF="http://www.w3.org/TR/xmldsig-core/#dsa-sha1">6.4.1 DSA</A>
++     */
++    private static byte[] convertXMLDSIGtoASN1(byte xmldsigBytes[])
+            throws IOException {
+ 
+-      if (xmldsigBytes.length != 40) {
+-         throw new IOException("Invalid XMLDSIG format of DSA signature");
+-      }
++        if (xmldsigBytes.length != 40) {
++            throw new IOException("Invalid XMLDSIG format of DSA signature");
++        }
+ 
+-      int i;
++        int i;
+ 
+-      for (i = 20; (i > 0) && (xmldsigBytes[20 - i] == 0); i--);
++        for (i = 20; (i > 0) && (xmldsigBytes[20 - i] == 0); i--);
+ 
+-      int j = i;
++        int j = i;
+ 
+-      if (xmldsigBytes[20 - i] < 0) {
++        if (xmldsigBytes[20 - i] < 0) {
+          j += 1;
+-      }
++        }
+ 
+-      int k;
++        int k;
+ 
+-      for (k = 20; (k > 0) && (xmldsigBytes[40 - k] == 0); k--);
++        for (k = 20; (k > 0) && (xmldsigBytes[40 - k] == 0); k--);
+ 
+-      int l = k;
++        int l = k;
+ 
+-      if (xmldsigBytes[40 - k] < 0) {
+-         l += 1;
+-      }
++        if (xmldsigBytes[40 - k] < 0) {
++            l += 1;
++        }
+ 
+-      byte asn1Bytes[] = new byte[6 + j + l];
++        byte asn1Bytes[] = new byte[6 + j + l];
+ 
+-      asn1Bytes[0] = 48;
+-      asn1Bytes[1] = (byte) (4 + j + l);
+-      asn1Bytes[2] = 2;
+-      asn1Bytes[3] = (byte) j;
++        asn1Bytes[0] = 48;
++        asn1Bytes[1] = (byte) (4 + j + l);
++        asn1Bytes[2] = 2;
++        asn1Bytes[3] = (byte) j;
+ 
+-      System.arraycopy(xmldsigBytes, 20 - i, asn1Bytes, (4 + j) - i, i);
++        System.arraycopy(xmldsigBytes, 20 - i, asn1Bytes, (4 + j) - i, i);
+ 
+-      asn1Bytes[4 + j] = 2;
+-      asn1Bytes[5 + j] = (byte) l;
++        asn1Bytes[4 + j] = 2;
++        asn1Bytes[5 + j] = (byte) l;
+ 
+-      System.arraycopy(xmldsigBytes, 40 - k, asn1Bytes, (6 + j + l) - k, k);
++        System.arraycopy(xmldsigBytes, 40 - k, asn1Bytes, (6 + j + l) - k, k);
+ 
+-      return asn1Bytes;
+-   }
++        return asn1Bytes;
++    }
+ 
+-   /**
+-    * Method engineSetHMACOutputLength
+-    *
+-    * @param HMACOutputLength
+-    * @throws XMLSignatureException
+-    */
+-   protected void engineSetHMACOutputLength(int HMACOutputLength)
+-           throws XMLSignatureException {
+-      throw new XMLSignatureException("algorithms.HMACOutputLengthOnlyForHMAC");
+-   }
++    /**
++     * Method engineSetHMACOutputLength
++     *
++     * @param HMACOutputLength
++     * @throws XMLSignatureException
++     */
++    protected void engineSetHMACOutputLength(int HMACOutputLength)
++            throws XMLSignatureException {
++        throw new XMLSignatureException(
++            "algorithms.HMACOutputLengthOnlyForHMAC");
++    }
+ 
+-   /**
+-    * Method engineInitSign
+-    *
+-    * @param signingKey
+-    * @param algorithmParameterSpec
+-    * @throws XMLSignatureException
+-    */
+-   protected void engineInitSign(
+-           Key signingKey, AlgorithmParameterSpec algorithmParameterSpec)
+-              throws XMLSignatureException {
+-      throw new XMLSignatureException(
+-         "algorithms.CannotUseAlgorithmParameterSpecOnDSA");
+-   }
++    /**
++     * Method engineInitSign
++     *
++     * @param signingKey
++     * @param algorithmParameterSpec
++     * @throws XMLSignatureException
++     */
++    protected void engineInitSign(
++        Key signingKey, AlgorithmParameterSpec algorithmParameterSpec)
++            throws XMLSignatureException {
++        throw new XMLSignatureException(
++            "algorithms.CannotUseAlgorithmParameterSpecOnDSA");
++    }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureECDSA.java b/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureECDSA.java
+new file mode 100644
+--- /dev/null
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureECDSA.java
+@@ -0,0 +1,384 @@
++/*
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
++ */
++/*
++ * Copyright  1999-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.
++ *
++ */
++package com.sun.org.apache.xml.internal.security.algorithms.implementations;
++
++
++
++import java.io.IOException;
++import java.security.InvalidAlgorithmParameterException;
++import java.security.InvalidKeyException;
++import java.security.Key;
++import java.security.NoSuchProviderException;
++import java.security.PrivateKey;
++import java.security.PublicKey;
++import java.security.SecureRandom;
++import java.security.Signature;
++import java.security.SignatureException;
++import java.security.spec.AlgorithmParameterSpec;
++
++import com.sun.org.apache.xml.internal.security.algorithms.JCEMapper;
++import com.sun.org.apache.xml.internal.security.algorithms.SignatureAlgorithmSpi;
++import com.sun.org.apache.xml.internal.security.signature.XMLSignature;
++import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException;
++import com.sun.org.apache.xml.internal.security.utils.Base64;
++
++
++/**
++ *
++ * @author $Author: mullan $
++ */
++public abstract class SignatureECDSA extends SignatureAlgorithmSpi {
++
++   /** {@link java.util.logging} logging facility */
++    static java.util.logging.Logger log =
++        java.util.logging.Logger.getLogger(SignatureECDSA.class.getName());
++
++    /** @inheritDoc */
++   public abstract String engineGetURI();
++
++   /** Field algorithm */
++   private java.security.Signature _signatureAlgorithm = null;
++
++   /**
++    * Converts an ASN.1 ECDSA value to a XML Signature ECDSA Value.
++    *
++    * The JAVA JCE ECDSA Signature algorithm creates ASN.1 encoded (r,s) value
++    * pairs; the XML Signature requires the core BigInteger values.
++    *
++    * @param asn1Bytes
++    * @return the decode bytes
++    *
++    * @throws IOException
++    * @see <A HREF="http://www.w3.org/TR/xmldsig-core/#dsa-sha1">6.4.1 DSA</A>
++    * @see <A HREF="ftp://ftp.rfc-editor.org/in-notes/rfc4050.txt">3.3. ECDSA Signatures</A>
++    */
++   private static byte[] convertASN1toXMLDSIG(byte asn1Bytes[])
++           throws IOException {
++
++      byte rLength = asn1Bytes[3];
++      int i;
++
++      for (i = rLength; (i > 0) && (asn1Bytes[(4 + rLength) - i] == 0); i--);
++
++      byte sLength = asn1Bytes[5 + rLength];
++      int j;
++
++      for (j = sLength;
++              (j > 0) && (asn1Bytes[(6 + rLength + sLength) - j] == 0); j--);
++
++      if ((asn1Bytes[0] != 48) || (asn1Bytes[1] != asn1Bytes.length - 2)
++              || (asn1Bytes[2] != 2) || (i > 24)
++              || (asn1Bytes[4 + rLength] != 2) || (j > 24)) {
++         throw new IOException("Invalid ASN.1 format of ECDSA signature");
++      }
++      byte xmldsigBytes[] = new byte[48];
++
++      System.arraycopy(asn1Bytes, (4 + rLength) - i, xmldsigBytes, 24 - i,
++                          i);
++      System.arraycopy(asn1Bytes, (6 + rLength + sLength) - j, xmldsigBytes,
++                          48 - j, j);
++
++       return xmldsigBytes;
++   }
++
++   /**
++    * Converts a XML Signature ECDSA Value to an ASN.1 DSA value.
++    *
++    * The JAVA JCE ECDSA Signature algorithm creates ASN.1 encoded (r,s) value
++    * pairs; the XML Signature requires the core BigInteger values.
++    *
++    * @param xmldsigBytes
++    * @return the encoded ASN.1 bytes
++    *
++    * @throws IOException
++    * @see <A HREF="http://www.w3.org/TR/xmldsig-core/#dsa-sha1">6.4.1 DSA</A>
++    * @see <A HREF="ftp://ftp.rfc-editor.org/in-notes/rfc4050.txt">3.3. ECDSA Signatures</A>
++    */
++   private static byte[] convertXMLDSIGtoASN1(byte xmldsigBytes[])
++           throws IOException {
++
++      if (xmldsigBytes.length != 48) {
++         throw new IOException("Invalid XMLDSIG format of ECDSA signature");
++      }
++
++      int i;
++
++      for (i = 24; (i > 0) && (xmldsigBytes[24 - i] == 0); i--);
++
++      int j = i;
++
++      if (xmldsigBytes[24 - i] < 0) {
++         j += 1;
++      }
++
++      int k;
++
++      for (k = 24; (k > 0) && (xmldsigBytes[48 - k] == 0); k--);
++
++      int l = k;
++
++      if (xmldsigBytes[48 - k] < 0) {
++         l += 1;
++      }
++
++      byte asn1Bytes[] = new byte[6 + j + l];
++
++      asn1Bytes[0] = 48;
++      asn1Bytes[1] = (byte) (4 + j + l);
++      asn1Bytes[2] = 2;
++      asn1Bytes[3] = (byte) j;
++
++      System.arraycopy(xmldsigBytes, 24 - i, asn1Bytes, (4 + j) - i, i);
++
++      asn1Bytes[4 + j] = 2;
++      asn1Bytes[5 + j] = (byte) l;
++
++      System.arraycopy(xmldsigBytes, 48 - k, asn1Bytes, (6 + j + l) - k, k);
++
++      return asn1Bytes;
++   }
++
++   /**
++    * Constructor SignatureRSA
++    *
++    * @throws XMLSignatureException
++    */
++   public SignatureECDSA() throws XMLSignatureException {
++
++      String algorithmID = JCEMapper.translateURItoJCEID(this.engineGetURI());
++
++      if (log.isLoggable(java.util.logging.Level.FINE))
++        log.log(java.util.logging.Level.FINE, "Created SignatureECDSA using " + algorithmID);
++      String provider=JCEMapper.getProviderId();
++      try {
++         if (provider==null) {
++                this._signatureAlgorithm = Signature.getInstance(algorithmID);
++         } else {
++                this._signatureAlgorithm = Signature.getInstance(algorithmID,provider);
++         }
++      } catch (java.security.NoSuchAlgorithmException ex) {
++         Object[] exArgs = { algorithmID,
++                             ex.getLocalizedMessage() };
++
++         throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs);
++      } catch (NoSuchProviderException ex) {
++         Object[] exArgs = { algorithmID,
++                                                 ex.getLocalizedMessage() };
++
++         throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs);
++        }
++   }
++
++   /** @inheritDoc */
++   protected void engineSetParameter(AlgorithmParameterSpec params)
++           throws XMLSignatureException {
++
++      try {
++         this._signatureAlgorithm.setParameter(params);
++      } catch (InvalidAlgorithmParameterException ex) {
++         throw new XMLSignatureException("empty", ex);
++      }
++   }
++
++   /** @inheritDoc */
++   protected boolean engineVerify(byte[] signature)
++           throws XMLSignatureException {
++
++      try {
++         byte[] jcebytes = SignatureECDSA.convertXMLDSIGtoASN1(signature);
++
++         if (log.isLoggable(java.util.logging.Level.FINE))
++            log.log(java.util.logging.Level.FINE, "Called ECDSA.verify() on " + Base64.encode(signature));
++
++         return this._signatureAlgorithm.verify(jcebytes);
++      } catch (SignatureException ex) {
++         throw new XMLSignatureException("empty", ex);
++      } catch (IOException ex) {
++         throw new XMLSignatureException("empty", ex);
++      }
++   }
++
++   /** @inheritDoc */
++   protected void engineInitVerify(Key publicKey) throws XMLSignatureException {
++
++      if (!(publicKey instanceof PublicKey)) {
++         String supplied = publicKey.getClass().getName();
++         String needed = PublicKey.class.getName();
++         Object exArgs[] = { supplied, needed };
++
++         throw new XMLSignatureException("algorithms.WrongKeyForThisOperation",
++                                         exArgs);
++      }
++
++      try {
++         this._signatureAlgorithm.initVerify((PublicKey) publicKey);
++      } catch (InvalidKeyException ex) {
++            // reinstantiate Signature object to work around bug in JDK
++            // see: http://bugs.sun.com/view_bug.do?bug_id=4953555
++            Signature sig = this._signatureAlgorithm;
++            try {
++                this._signatureAlgorithm = Signature.getInstance
++                    (_signatureAlgorithm.getAlgorithm());
++            } catch (Exception e) {
++                // this shouldn't occur, but if it does, restore previous
++                // Signature
++                if (log.isLoggable(java.util.logging.Level.FINE)) {
++                    log.log(java.util.logging.Level.FINE, "Exception when reinstantiating Signature:" + e);
++                }
++                this._signatureAlgorithm = sig;
++            }
++            throw new XMLSignatureException("empty", ex);
++      }
++   }
++
++   /** @inheritDoc */
++   protected byte[] engineSign() throws XMLSignatureException {
++
++      try {
++         byte jcebytes[] = this._signatureAlgorithm.sign();
++
++         return SignatureECDSA.convertASN1toXMLDSIG(jcebytes);
++      } catch (SignatureException ex) {
++         throw new XMLSignatureException("empty", ex);
++      } catch (IOException ex) {
++          throw new XMLSignatureException("empty", ex);
++      }
++   }
++
++   /** @inheritDoc */
++   protected void engineInitSign(Key privateKey, SecureRandom secureRandom)
++           throws XMLSignatureException {
++
++      if (!(privateKey instanceof PrivateKey)) {
++         String supplied = privateKey.getClass().getName();
++         String needed = PrivateKey.class.getName();
++         Object exArgs[] = { supplied, needed };
++
++         throw new XMLSignatureException("algorithms.WrongKeyForThisOperation",
++                                         exArgs);
++      }
++
++      try {
++         this._signatureAlgorithm.initSign((PrivateKey) privateKey,
++                                           secureRandom);
++      } catch (InvalidKeyException ex) {
++         throw new XMLSignatureException("empty", ex);
++      }
++   }
++
++   /** @inheritDoc */
++   protected void engineInitSign(Key privateKey) throws XMLSignatureException {
++
++      if (!(privateKey instanceof PrivateKey)) {
++         String supplied = privateKey.getClass().getName();
++         String needed = PrivateKey.class.getName();
++         Object exArgs[] = { supplied, needed };
++
++         throw new XMLSignatureException("algorithms.WrongKeyForThisOperation",
++                                         exArgs);
++      }
++
++      try {
++         this._signatureAlgorithm.initSign((PrivateKey) privateKey);
++      } catch (InvalidKeyException ex) {
++         throw new XMLSignatureException("empty", ex);
++      }
++   }
++
++   /** @inheritDoc */
++   protected void engineUpdate(byte[] input) throws XMLSignatureException {
++
++      try {
++         this._signatureAlgorithm.update(input);
++      } catch (SignatureException ex) {
++         throw new XMLSignatureException("empty", ex);
++      }
++   }
++
++   /** @inheritDoc */
++   protected void engineUpdate(byte input) throws XMLSignatureException {
++
++      try {
++         this._signatureAlgorithm.update(input);
++      } catch (SignatureException ex) {
++         throw new XMLSignatureException("empty", ex);
++      }
++   }
++
++   /** @inheritDoc */
++   protected void engineUpdate(byte buf[], int offset, int len)
++           throws XMLSignatureException {
++
++      try {
++         this._signatureAlgorithm.update(buf, offset, len);
++      } catch (SignatureException ex) {
++         throw new XMLSignatureException("empty", ex);
++      }
++   }
++
++   /** @inheritDoc */
++   protected String engineGetJCEAlgorithmString() {
++      return this._signatureAlgorithm.getAlgorithm();
++   }
++
++   /** @inheritDoc */
++   protected String engineGetJCEProviderName() {
++      return this._signatureAlgorithm.getProvider().getName();
++   }
++
++   /** @inheritDoc */
++   protected void engineSetHMACOutputLength(int HMACOutputLength)
++           throws XMLSignatureException {
++      throw new XMLSignatureException("algorithms.HMACOutputLengthOnlyForHMAC");
++   }
++
++   /** @inheritDoc */
++   protected void engineInitSign(
++           Key signingKey, AlgorithmParameterSpec algorithmParameterSpec)
++              throws XMLSignatureException {
++      throw new XMLSignatureException(
++         "algorithms.CannotUseAlgorithmParameterSpecOnRSA");
++   }
++
++   /**
++    * Class SignatureRSASHA1
++    *
++    * @author $Author: mullan $
++    * @version $Revision: 1.2 $
++    */
++   public static class SignatureECDSASHA1 extends SignatureECDSA {
++
++      /**
++       * Constructor SignatureRSASHA1
++       *
++       * @throws XMLSignatureException
++       */
++      public SignatureECDSASHA1() throws XMLSignatureException {
++         super();
++      }
++
++      /** @inheritDoc */
++      public String engineGetURI() {
++         return XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA1;
++      }
++   }
++
++}
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/CanonicalizationException.java b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/CanonicalizationException.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/CanonicalizationException.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/CanonicalizationException.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/Canonicalizer.java b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/Canonicalizer.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/Canonicalizer.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/Canonicalizer.java
+@@ -3,7 +3,7 @@
+  * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * Copyright  1999-2004 The Apache Software Foundation.
++ * Copyright  1999-2008 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.
+@@ -20,8 +20,6 @@
+  */
+ package com.sun.org.apache.xml.internal.security.c14n;
+ 
+-
+-
+ import java.io.ByteArrayInputStream;
+ import java.io.OutputStream;
+ import java.util.HashMap;
+@@ -37,318 +35,326 @@
+ import org.w3c.dom.NodeList;
+ import org.xml.sax.InputSource;
+ 
+-
+ /**
+  *
+- *
+  * @author Christian Geuer-Pollmann
+  */
+ public class Canonicalizer {
+ 
+-   //J-
+-   /** The output encoding of canonicalized data */
+-   public static final String ENCODING = "UTF8";
++    /** The output encoding of canonicalized data */
++    public static final String ENCODING = "UTF8";
+ 
++    /**
++     * XPath Expresion for selecting every node and continuous comments joined
++     * in only one node
++     */
++    public static final String XPATH_C14N_WITH_COMMENTS_SINGLE_NODE =
++        "(.//. | .//@* | .//namespace::*)";
+ 
+-   /**
+-     * XPath Expresion for selecting every node and continuos comments joined in only one node
+-     */
+-    public static final String XPATH_C14N_WITH_COMMENTS_SINGLE_NODE = "(.//. | .//@* | .//namespace::*)";
+-
+-
+-   /**
++    /**
+      * The URL defined in XML-SEC Rec for inclusive c14n <b>without</b> comments.
+      */
+-   public static final String ALGO_ID_C14N_OMIT_COMMENTS = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315";
+-   /**
+-    * The URL defined in XML-SEC Rec for inclusive c14n <b>with</b> comments.
+-    */
+-   public static final String ALGO_ID_C14N_WITH_COMMENTS = ALGO_ID_C14N_OMIT_COMMENTS + "#WithComments";
+-   /**
+-    * The URL defined in XML-SEC Rec for exclusive c14n <b>without</b> comments.
+-    */
+-   public static final String ALGO_ID_C14N_EXCL_OMIT_COMMENTS = "http://www.w3.org/2001/10/xml-exc-c14n#";
+-   /**
+-    * The URL defined in XML-SEC Rec for exclusive c14n <b>with</b> comments.
+-    */
+-   public static final String ALGO_ID_C14N_EXCL_WITH_COMMENTS = ALGO_ID_C14N_EXCL_OMIT_COMMENTS + "WithComments";
++    public static final String ALGO_ID_C14N_OMIT_COMMENTS =
++        "http://www.w3.org/TR/2001/REC-xml-c14n-20010315";
++    /**
++     * The URL defined in XML-SEC Rec for inclusive c14n <b>with</b> comments.
++     */
++    public static final String ALGO_ID_C14N_WITH_COMMENTS =
++        ALGO_ID_C14N_OMIT_COMMENTS + "#WithComments";
++    /**
++     * The URL defined in XML-SEC Rec for exclusive c14n <b>without</b> comments.
++     */
++    public static final String ALGO_ID_C14N_EXCL_OMIT_COMMENTS =
++        "http://www.w3.org/2001/10/xml-exc-c14n#";
++    /**
++     * The URL defined in XML-SEC Rec for exclusive c14n <b>with</b> comments.
++     */
++    public static final String ALGO_ID_C14N_EXCL_WITH_COMMENTS =
++        ALGO_ID_C14N_EXCL_OMIT_COMMENTS + "WithComments";
++    /**
++     * The URI for inclusive c14n 1.1 <b>without</b> comments.
++     */
++    public static final String ALGO_ID_C14N11_OMIT_COMMENTS =
++        "http://www.w3.org/2006/12/xml-c14n11";
++    /**
++     * The URI for inclusive c14n 1.1 <b>with</b> comments.
++     */
++    public static final String ALGO_ID_C14N11_WITH_COMMENTS =
++        ALGO_ID_C14N11_OMIT_COMMENTS + "#WithComments";
+ 
+-   static boolean _alreadyInitialized = false;
+-   static Map _canonicalizerHash = null;
++    static boolean _alreadyInitialized = false;
++    static Map _canonicalizerHash = null;
+ 
+-   protected CanonicalizerSpi canonicalizerSpi = null;
+-   //J+
++    protected CanonicalizerSpi canonicalizerSpi = null;
+ 
+-   /**
+-    * Method init
+-    *
+-    */
+-   public static void init() {
++    /**
++     * Method init
++     *
++     */
++    public static void init() {
+ 
+-      if (!Canonicalizer._alreadyInitialized) {
+-         Canonicalizer._canonicalizerHash = new HashMap(10);
+-         Canonicalizer._alreadyInitialized = true;
+-      }
+-   }
++        if (!Canonicalizer._alreadyInitialized) {
++            Canonicalizer._canonicalizerHash = new HashMap(10);
++            Canonicalizer._alreadyInitialized = true;
++        }
++    }
+ 
+-   /**
+-    * Constructor Canonicalizer
+-    *
+-    * @param algorithmURI
+-    * @throws InvalidCanonicalizerException
+-    */
+-   private Canonicalizer(String algorithmURI)
++    /**
++     * Constructor Canonicalizer
++     *
++     * @param algorithmURI
++     * @throws InvalidCanonicalizerException
++     */
++    private Canonicalizer(String algorithmURI)
+            throws InvalidCanonicalizerException {
+ 
+-      try {
+-         Class implementingClass = getImplementingClass(algorithmURI);
++        try {
++            Class implementingClass = getImplementingClass(algorithmURI);
+ 
+-         this.canonicalizerSpi =
+-            (CanonicalizerSpi) implementingClass.newInstance();
+-         this.canonicalizerSpi.reset=true;
+-      } catch (Exception e) {
+-         Object exArgs[] = { algorithmURI };
++            this.canonicalizerSpi =
++                (CanonicalizerSpi) implementingClass.newInstance();
++            this.canonicalizerSpi.reset=true;
++        } catch (Exception e) {
++            Object exArgs[] = { algorithmURI };
+ 
+-         throw new InvalidCanonicalizerException(
+-            "signature.Canonicalizer.UnknownCanonicalizer", exArgs);
+-      }
+-   }
++            throw new InvalidCanonicalizerException(
++               "signature.Canonicalizer.UnknownCanonicalizer", exArgs);
++        }
++    }
+ 
+-   /**
+-    * Method getInstance
+-    *
+-    * @param algorithmURI
+-    * @return a Conicicalizer instance ready for the job
+-    * @throws InvalidCanonicalizerException
+-    */
+-   public static final Canonicalizer getInstance(String algorithmURI)
++    /**
++     * Method getInstance
++     *
++     * @param algorithmURI
++     * @return a Conicicalizer instance ready for the job
++     * @throws InvalidCanonicalizerException
++     */
++    public static final Canonicalizer getInstance(String algorithmURI)
+            throws InvalidCanonicalizerException {
+ 
+-      Canonicalizer c14nizer = new Canonicalizer(algorithmURI);
++        Canonicalizer c14nizer = new Canonicalizer(algorithmURI);
+ 
+-      return c14nizer;
+-   }
++        return c14nizer;
++    }
+ 
+-   /**
+-    * Method register
+-    *
+-    * @param algorithmURI
+-    * @param implementingClass
+-    * @throws AlgorithmAlreadyRegisteredException
+-    */
+-   public static void register(String algorithmURI, String implementingClass)
++    /**
++     * Method register
++     *
++     * @param algorithmURI
++     * @param implementingClass
++     * @throws AlgorithmAlreadyRegisteredException
++     */
++    public static void register(String algorithmURI, String implementingClass)
+            throws AlgorithmAlreadyRegisteredException {
+ 
+-      // check whether URI is already registered
+-      Class registeredClass = getImplementingClass(algorithmURI);
++        // check whether URI is already registered
++        Class registeredClass = getImplementingClass(algorithmURI);
+ 
+-      if (registeredClass != null)  {
+-         Object exArgs[] = { algorithmURI, registeredClass };
++        if (registeredClass != null)  {
++            Object exArgs[] = { algorithmURI, registeredClass };
+ 
+-         throw new AlgorithmAlreadyRegisteredException(
+-            "algorithm.alreadyRegistered", exArgs);
+-      }
++            throw new AlgorithmAlreadyRegisteredException(
++                "algorithm.alreadyRegistered", exArgs);
++        }
+ 
+-      try {
+-                _canonicalizerHash.put(algorithmURI, Class.forName(implementingClass));
++        try {
++            _canonicalizerHash.put(algorithmURI, Class.forName(implementingClass));
+         } catch (ClassNotFoundException e) {
+-                throw new RuntimeException("c14n class not found");
++            throw new RuntimeException("c14n class not found");
+         }
+-   }
++    }
+ 
+-   /**
+-    * Method getURI
+-    *
+-    * @return the URI defined for this c14n instance.
+-    */
+-   public final String getURI() {
+-      return this.canonicalizerSpi.engineGetURI();
+-   }
++    /**
++     * Method getURI
++     *
++     * @return the URI defined for this c14n instance.
++     */
++    public final String getURI() {
++        return this.canonicalizerSpi.engineGetURI();
++    }
+ 
+-   /**
+-    * Method getIncludeComments
+-    *
+-    * @return true if the c14n respect the comments.
+-    */
+-   public boolean getIncludeComments() {
+-      return this.canonicalizerSpi.engineGetIncludeComments();
+-   }
++    /**
++     * Method getIncludeComments
++     *
++     * @return true if the c14n respect the comments.
++     */
++    public boolean getIncludeComments() {
++        return this.canonicalizerSpi.engineGetIncludeComments();
++    }
+ 
+-   /**
+-    * This method tries to canonicalize the given bytes. It's possible to even
+-    * canonicalize non-wellformed sequences if they are well-formed after being
+-    * wrapped with a <CODE>>a<...>/a<</CODE>.
+-    *
+-    * @param inputBytes
+-    * @return the result of the conicalization.
+-    * @throws CanonicalizationException
+-    * @throws java.io.IOException
+-    * @throws javax.xml.parsers.ParserConfigurationException
+-    * @throws org.xml.sax.SAXException
+-    */
+-   public byte[] canonicalize(byte[] inputBytes)
++    /**
++     * This method tries to canonicalize the given bytes. It's possible to even
++     * canonicalize non-wellformed sequences if they are well-formed after being
++     * wrapped with a <CODE>>a<...>/a<</CODE>.
++     *
++     * @param inputBytes
++     * @return the result of the conicalization.
++     * @throws CanonicalizationException
++     * @throws java.io.IOException
++     * @throws javax.xml.parsers.ParserConfigurationException
++     * @throws org.xml.sax.SAXException
++     */
++    public byte[] canonicalize(byte[] inputBytes)
+            throws javax.xml.parsers.ParserConfigurationException,
+                   java.io.IOException, org.xml.sax.SAXException,
+                   CanonicalizationException {
+ 
+-      ByteArrayInputStream bais = new ByteArrayInputStream(inputBytes);
+-      InputSource in = new InputSource(bais);
+-      DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
++        ByteArrayInputStream bais = new ByteArrayInputStream(inputBytes);
++        InputSource in = new InputSource(bais);
++        DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
+ 
+-      dfactory.setNamespaceAware(true);
++        dfactory.setNamespaceAware(true);
+ 
+-      // needs to validate for ID attribute nomalization
+-      dfactory.setValidating(true);
++        // needs to validate for ID attribute nomalization
++        dfactory.setValidating(true);
+ 
+-      DocumentBuilder db = dfactory.newDocumentBuilder();
++        DocumentBuilder db = dfactory.newDocumentBuilder();
+ 
+-      /*
+-       * for some of the test vectors from the specification,
+-       * there has to be a validatin parser for ID attributes, default
+-       * attribute values, NMTOKENS, etc.
+-       * Unfortunaltely, the test vectors do use different DTDs or
+-       * even no DTD. So Xerces 1.3.1 fires many warnings about using
+-       * ErrorHandlers.
+-       *
+-       * Text from the spec:
+-       *
+-       * The input octet stream MUST contain a well-formed XML document,
+-       * but the input need not be validated. However, the attribute
+-       * value normalization and entity reference resolution MUST be
+-       * performed in accordance with the behaviors of a validating
+-       * XML processor. As well, nodes for default attributes (declared
+-       * in the ATTLIST with an AttValue but not specified) are created
+-       * in each element. Thus, the declarations in the document type
+-       * declaration are used to help create the canonical form, even
+-       * though the document type declaration is not retained in the
+-       * canonical form.
+-       *
+-       */
+-      db.setErrorHandler(new com.sun.org.apache.xml.internal.security.utils
+-         .IgnoreAllErrorHandler());
++        /*
++         * for some of the test vectors from the specification,
++         * there has to be a validatin parser for ID attributes, default
++         * attribute values, NMTOKENS, etc.
++         * Unfortunaltely, the test vectors do use different DTDs or
++         * even no DTD. So Xerces 1.3.1 fires many warnings about using
++         * ErrorHandlers.
++         *
++         * Text from the spec:
++         *
++         * The input octet stream MUST contain a well-formed XML document,
++         * but the input need not be validated. However, the attribute
++         * value normalization and entity reference resolution MUST be
++         * performed in accordance with the behaviors of a validating
++         * XML processor. As well, nodes for default attributes (declared
++         * in the ATTLIST with an AttValue but not specified) are created
++         * in each element. Thus, the declarations in the document type
++         * declaration are used to help create the canonical form, even
++         * though the document type declaration is not retained in the
++         * canonical form.
++         *
++         */
++        db.setErrorHandler(new com.sun.org.apache.xml.internal.security.utils
++            .IgnoreAllErrorHandler());
+ 
+-      Document document = db.parse(in);
+-      byte result[] = this.canonicalizeSubtree(document);
++        Document document = db.parse(in);
++        byte result[] = this.canonicalizeSubtree(document);
+ 
+-      return result;
+-   }
++        return result;
++    }
+ 
+-   /**
+-    * Canonicalizes the subtree rooted by <CODE>node</CODE>.
+-    *
+-    * @param node The node to canicalize
+-    * @return the result of the c14n.
+-    *
+-    * @throws CanonicalizationException
+-    */
+-   public byte[] canonicalizeSubtree(Node node)
++    /**
++     * Canonicalizes the subtree rooted by <CODE>node</CODE>.
++     *
++     * @param node The node to canicalize
++     * @return the result of the c14n.
++     *
++     * @throws CanonicalizationException
++     */
++    public byte[] canonicalizeSubtree(Node node)
+            throws CanonicalizationException {
+-      return this.canonicalizerSpi.engineCanonicalizeSubTree(node);
+-   }
++        return this.canonicalizerSpi.engineCanonicalizeSubTree(node);
++    }
+ 
+-   /**
+-    * Canonicalizes the subtree rooted by <CODE>node</CODE>.
+-    *
+-    * @param node
+-    * @param inclusiveNamespaces
+-    * @return the result of the c14n.
+-    * @throws CanonicalizationException
+-    */
+-   public byte[] canonicalizeSubtree(Node node, String inclusiveNamespaces)
++    /**
++     * Canonicalizes the subtree rooted by <CODE>node</CODE>.
++     *
++     * @param node
++     * @param inclusiveNamespaces
++     * @return the result of the c14n.
++     * @throws CanonicalizationException
++     */
++    public byte[] canonicalizeSubtree(Node node, String inclusiveNamespaces)
+            throws CanonicalizationException {
+-      return this.canonicalizerSpi.engineCanonicalizeSubTree(node,
++        return this.canonicalizerSpi.engineCanonicalizeSubTree(node,
+               inclusiveNamespaces);
+-   }
++    }
+ 
+-   /**
+-    * Canonicalizes an XPath node set. The <CODE>xpathNodeSet</CODE> is treated
+-    * as a list of XPath nodes, not as a list of subtrees.
+-    *
+-    * @param xpathNodeSet
+-    * @return the result of the c14n.
+-    * @throws CanonicalizationException
+-    */
+-   public byte[] canonicalizeXPathNodeSet(NodeList xpathNodeSet)
++    /**
++     * Canonicalizes an XPath node set. The <CODE>xpathNodeSet</CODE> is treated
++     * as a list of XPath nodes, not as a list of subtrees.
++     *
++     * @param xpathNodeSet
++     * @return the result of the c14n.
++     * @throws CanonicalizationException
++     */
++    public byte[] canonicalizeXPathNodeSet(NodeList xpathNodeSet)
+            throws CanonicalizationException {
+-      return this.canonicalizerSpi.engineCanonicalizeXPathNodeSet(xpathNodeSet);
+-   }
++        return this.canonicalizerSpi.engineCanonicalizeXPathNodeSet(xpathNodeSet);
++    }
+ 
+-   /**
+-    * Canonicalizes an XPath node set. The <CODE>xpathNodeSet</CODE> is treated
+-    * as a list of XPath nodes, not as a list of subtrees.
+-    *
+-    * @param xpathNodeSet
+-    * @param inclusiveNamespaces
+-    * @return the result of the c14n.
+-    * @throws CanonicalizationException
+-    */
+-   public byte[] canonicalizeXPathNodeSet(
++    /**
++     * Canonicalizes an XPath node set. The <CODE>xpathNodeSet</CODE> is treated
++     * as a list of XPath nodes, not as a list of subtrees.
++     *
++     * @param xpathNodeSet
++     * @param inclusiveNamespaces
++     * @return the result of the c14n.
++     * @throws CanonicalizationException
++     */
++    public byte[] canonicalizeXPathNodeSet(
+            NodeList xpathNodeSet, String inclusiveNamespaces)
+               throws CanonicalizationException {
+-      return this.canonicalizerSpi.engineCanonicalizeXPathNodeSet(xpathNodeSet,
++        return this.canonicalizerSpi.engineCanonicalizeXPathNodeSet(xpathNodeSet,
+               inclusiveNamespaces);
+-   }
++    }
+ 
+-   /**
+-    * Canonicalizes an XPath node set.
+-    *
+-    * @param xpathNodeSet
+-    * @return the result of the c14n.
+-    * @throws CanonicalizationException
+-    */
+-   public byte[] canonicalizeXPathNodeSet(Set xpathNodeSet)
++    /**
++     * Canonicalizes an XPath node set.
++     *
++     * @param xpathNodeSet
++     * @return the result of the c14n.
++     * @throws CanonicalizationException
++     */
++    public byte[] canonicalizeXPathNodeSet(Set xpathNodeSet)
+            throws CanonicalizationException {
+-       return this.canonicalizerSpi.engineCanonicalizeXPathNodeSet(xpathNodeSet);
+-   }
++        return this.canonicalizerSpi.engineCanonicalizeXPathNodeSet(xpathNodeSet);
++    }
+ 
+-   /**
+-    * Canonicalizes an XPath node set.
+-    *
+-    * @param xpathNodeSet
+-    * @param inclusiveNamespaces
+-    * @return the result of the c14n.
+-    * @throws CanonicalizationException
+-    */
+-   public byte[] canonicalizeXPathNodeSet(
+-           Set xpathNodeSet, String inclusiveNamespaces)
+-              throws CanonicalizationException {
+-       return this.canonicalizerSpi.engineCanonicalizeXPathNodeSet(xpathNodeSet,
+-              inclusiveNamespaces);
+-   }
++    /**
++     * Canonicalizes an XPath node set.
++     *
++     * @param xpathNodeSet
++     * @param inclusiveNamespaces
++     * @return the result of the c14n.
++     * @throws CanonicalizationException
++     */
++    public byte[] canonicalizeXPathNodeSet(Set xpathNodeSet,
++        String inclusiveNamespaces) throws CanonicalizationException {
++        return this.canonicalizerSpi.engineCanonicalizeXPathNodeSet(xpathNodeSet,
++            inclusiveNamespaces);
++    }
+ 
+-   /**
+-    * Sets the writter where the cannocalization ends. ByteArrayOutputStream if
+-    * none is setted.
+-    * @param os
+-    */
+-   public void setWriter(OutputStream os) {
+-            this.canonicalizerSpi.setWriter(os);
+-   }
++    /**
++     * Sets the writer where the canonicalization ends.  ByteArrayOutputStream
++     * if none is set.
++     * @param os
++     */
++    public void setWriter(OutputStream os) {
++        this.canonicalizerSpi.setWriter(os);
++    }
+ 
+-   /**
+-    * Returns the name of the implementing {@link CanonicalizerSpi} class
+-    *
+-    * @return the name of the implementing {@link CanonicalizerSpi} class
+-    */
+-   public String getImplementingCanonicalizerClass() {
+-      return this.canonicalizerSpi.getClass().getName();
+-   }
++    /**
++     * Returns the name of the implementing {@link CanonicalizerSpi} class
++     *
++     * @return the name of the implementing {@link CanonicalizerSpi} class
++     */
++    public String getImplementingCanonicalizerClass() {
++        return this.canonicalizerSpi.getClass().getName();
++    }
+ 
+-   /**
+-    * Method getImplementingClass
+-    *
+-    * @param URI
+-    * @return the name of the class that implements the give URI
+-    */
+-   private static Class getImplementingClass(String URI) {
+-      return (Class) _canonicalizerHash.get(URI);
+-   }
++    /**
++     * Method getImplementingClass
++     *
++     * @param URI
++     * @return the name of the class that implements the given URI
++     */
++    private static Class getImplementingClass(String URI) {
++        return (Class) _canonicalizerHash.get(URI);
++    }
+ 
+-   /**
+-    * Set the canonicalizator behaviour to not reset.
+-    *
+-    */
+-   public void notReset() {
+-            this.canonicalizerSpi.reset=false;
+-   }
++    /**
++     * Set the canonicalizer behaviour to not reset.
++     */
++    public void notReset() {
++        this.canonicalizerSpi.reset = false;
++    }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/InvalidCanonicalizerException.java b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/InvalidCanonicalizerException.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/InvalidCanonicalizerException.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/InvalidCanonicalizerException.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/helper/AttrCompare.java b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/helper/AttrCompare.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/helper/AttrCompare.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/helper/AttrCompare.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -21,17 +20,17 @@
+  */
+ package com.sun.org.apache.xml.internal.security.c14n.helper;
+ 
+-
+-
+ import com.sun.org.apache.xml.internal.security.utils.Constants;
+ import org.w3c.dom.Attr;
+-
++import java.io.Serializable;
++import java.util.Comparator;
+ 
+ /**
+  * Compares two attributes based on the C14n specification.
+  *
+  * <UL>
+- * <LI>Namespace nodes have a lesser document order position than attribute nodes.
++ * <LI>Namespace nodes have a lesser document order position than attribute
++ *   nodes.
+  * <LI> An element's namespace nodes are sorted lexicographically by
+  *   local name (the default namespace node, if one exists, has no
+  *   local name and is therefore lexicographically least).
+@@ -40,104 +39,89 @@
+  *   key (an empty namespace URI is lexicographically least).
+  * </UL>
+  *
+- * $todo$ Should we implement java.util.Comparator and import java.util.Arrays to use Arrays.sort(intarray);
+  * @author Christian Geuer-Pollmann
+  */
+-public class AttrCompare implements java.util.Comparator {
++public class AttrCompare implements Comparator, Serializable {
+ 
+-   private final int ATTR0_BEFORE_ATTR1 = -1;
+-   private final int ATTR1_BEFORE_ATTR0 = 1;
++    private final static long serialVersionUID = -7113259629930576230L;
++    private final static int ATTR0_BEFORE_ATTR1 = -1;
++    private final static int ATTR1_BEFORE_ATTR0 = 1;
++    private final static String XMLNS=Constants.NamespaceSpecNS;
+ 
+-   private final static String XMLNS=Constants.NamespaceSpecNS;
+-   /**
+-    * Compares two attributes based on the C14n specification.
+-    *
+-    * <UL>
+-    * <LI>Namespace nodes have a lesser document order position than attribute nodes.
+-    * <LI> An element's namespace nodes are sorted lexicographically by
+-    *   local name (the default namespace node, if one exists, has no
+-    *   local name and is therefore lexicographically least).
+-    * <LI> An element's attribute nodes are sorted lexicographically with
+-    *   namespace URI as the primary key and local name as the secondary
+-    *   key (an empty namespace URI is lexicographically least).
+-    * </UL>
+-    *
+-    * @param obj0 casted Attr
+-    * @param obj1 casted Attr
+-    * @return returns a negative integer, zero, or a positive integer as obj0 is less than, equal to, or greater than obj1
+-    *
+-    */
+-   public int compare(Object obj0, Object obj1) {
++    /**
++     * Compares two attributes based on the C14n specification.
++     *
++     * <UL>
++     * <LI>Namespace nodes have a lesser document order position than
++     *   attribute nodes.
++     * <LI> An element's namespace nodes are sorted lexicographically by
++     *   local name (the default namespace node, if one exists, has no
++     *   local name and is therefore lexicographically least).
++     * <LI> An element's attribute nodes are sorted lexicographically with
++     *   namespace URI as the primary key and local name as the secondary
++     *   key (an empty namespace URI is lexicographically least).
++     * </UL>
++     *
++     * @param obj0 casted Attr
++     * @param obj1 casted Attr
++     * @return returns a negative integer, zero, or a positive integer as
++     *   obj0 is less than, equal to, or greater than obj1
++     *
++     */
++    public int compare(Object obj0, Object obj1) {
+ 
+-      Attr attr0 = (Attr) obj0;
+-      Attr attr1 = (Attr) obj1;
+-      String namespaceURI0 = attr0.getNamespaceURI();
+-      String namespaceURI1 = attr1.getNamespaceURI();
++        Attr attr0 = (Attr) obj0;
++        Attr attr1 = (Attr) obj1;
++        String namespaceURI0 = attr0.getNamespaceURI();
++        String namespaceURI1 = attr1.getNamespaceURI();
+ 
+-      boolean isNamespaceAttr0 =
+-        XMLNS.equals(namespaceURI0);
+-      boolean isNamespaceAttr1 =
+-        XMLNS.equals(namespaceURI1);
++        boolean isNamespaceAttr0 = XMLNS==namespaceURI0;
++        boolean isNamespaceAttr1 = XMLNS==namespaceURI1;
+ 
+-      if (isNamespaceAttr0) {
+-         if (isNamespaceAttr1) {
++        if (isNamespaceAttr0) {
++            if (isNamespaceAttr1) {
++                // both are namespaces
++                String localname0 = attr0.getLocalName();
++                String localname1 = attr1.getLocalName();
+ 
+-            // both are namespaces
+-            String localname0 = attr0.getLocalName();
+-            String localname1 = attr1.getLocalName();
++                if (localname0.equals("xmlns")) {
++                    localname0 = "";
++                }
+ 
+-            if (localname0.equals("xmlns")) {
+-               localname0 = "";
++                if (localname1.equals("xmlns")) {
++                    localname1 = "";
++                }
++
++                return localname0.compareTo(localname1);
+             }
++            // attr0 is a namespace, attr1 is not
++            return ATTR0_BEFORE_ATTR1;
++        }
+ 
+-            if (localname1.equals("xmlns")) {
+-               localname1 = "";
+-            }
+-
+-            return localname0.compareTo(localname1);
+-         }
+-         // attr0 is a namespace, attr1 is not
+-         return ATTR0_BEFORE_ATTR1;
+-
+-      }
+-      if (isNamespaceAttr1) {
+-
++        if (isNamespaceAttr1) {
+             // attr1 is a namespace, attr0 is not
+             return ATTR1_BEFORE_ATTR0;
+-      }
++        }
+ 
+-      // none is a namespae
+-
+-      if (namespaceURI0 == null) {
+-        if (namespaceURI1 == null) {
+-                /*
+-                 String localName0 = attr0.getLocalName();
+-                 String localName1 = attr1.getLocalName();
+-                 return localName0.compareTo(localName1);
+-                 */
+-
++        // none is a namespace
++        if (namespaceURI0 == null) {
++            if (namespaceURI1 == null) {
+                 String name0 = attr0.getName();
+                 String name1 = attr1.getName();
+                 return name0.compareTo(name1);
++            }
++            return ATTR0_BEFORE_ATTR1;
+         }
+-        return ATTR0_BEFORE_ATTR1;
+ 
+-      }
+-      if (namespaceURI1 == null) {
+-                return ATTR1_BEFORE_ATTR0;
+-      }
+-      int a = namespaceURI0.compareTo(namespaceURI1);
++        if (namespaceURI1 == null) {
++            return ATTR1_BEFORE_ATTR0;
++        }
+ 
+-      if (a != 0) {
+-        return a;
+-      }
+-      /*
+-      String localName0 = ;
+-      String localName1 =;*/
++        int a = namespaceURI0.compareTo(namespaceURI1);
++        if (a != 0) {
++            return a;
++        }
+ 
+-      return (attr0.getLocalName())
+-                                .compareTo( attr1.getLocalName());
+-
+-   }
+-
++        return (attr0.getLocalName()).compareTo(attr1.getLocalName());
++    }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer11.java b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer11.java
+new file mode 100644
+--- /dev/null
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer11.java
+@@ -0,0 +1,684 @@
++/*
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
++ */
++/*
++ * Copyright 2008 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      http://www.apache.org/licenses/LICENSE-2.0
++ *
++ *  Unless required by applicable law or agreed to in writing, software
++ *  distributed under the License is distributed on an "AS IS" BASIS,
++ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ *  See the License for the specific language governing permissions and
++ *  limitations under the License.
++ *
++ */
++package com.sun.org.apache.xml.internal.security.c14n.implementations;
++
++import java.io.IOException;
++import java.net.URI;
++import java.net.URISyntaxException;
++import java.util.ArrayList;
++import java.util.Collection;
++import java.util.HashMap;
++import java.util.Iterator;
++import java.util.List;
++import java.util.Map;
++import java.util.Set;
++import java.util.SortedSet;
++import java.util.TreeSet;
++import javax.xml.parsers.ParserConfigurationException;
++import org.w3c.dom.Attr;
++import org.w3c.dom.Document;
++import org.w3c.dom.Element;
++import org.w3c.dom.NamedNodeMap;
++import org.w3c.dom.Node;
++import org.xml.sax.SAXException;
++
++import java.util.logging.Logger;
++import java.util.logging.Logger;
++import com.sun.org.apache.xml.internal.security.c14n.CanonicalizationException;
++import com.sun.org.apache.xml.internal.security.c14n.helper.C14nHelper;
++import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
++import com.sun.org.apache.xml.internal.security.utils.Constants;
++import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
++
++/**
++ * Implements <A HREF="http://www.w3.org/TR/2008/PR-xml-c14n11-20080129/">
++ * Canonical XML Version 1.1</A>, a W3C Proposed Recommendation from 29
++ * January 2008.
++ *
++ * @author Sean Mullan
++ * @author Raul Benito
++ * @version $Revision: 1.2 $
++ */
++public abstract class Canonicalizer11 extends CanonicalizerBase {
++    boolean firstCall = true;
++    final SortedSet result = new TreeSet(COMPARE);
++    static final String XMLNS_URI = Constants.NamespaceSpecNS;
++    static final String XML_LANG_URI = Constants.XML_LANG_SPACE_SpecNS;
++
++    static Logger log = Logger.getLogger(Canonicalizer11.class.getName());
++
++    static class XmlAttrStack {
++        int currentLevel = 0;
++        int lastlevel = 0;
++        XmlsStackElement cur;
++        static class XmlsStackElement {
++            int level;
++            boolean rendered = false;
++            List nodes = new ArrayList();
++        };
++        List levels = new ArrayList();
++        void push(int level) {
++            currentLevel = level;
++            if (currentLevel == -1)
++                return;
++            cur = null;
++            while (lastlevel >= currentLevel) {
++                levels.remove(levels.size() - 1);
++                if (levels.size() == 0) {
++                    lastlevel = 0;
++                    return;
++                }
++                lastlevel=((XmlsStackElement)levels.get(levels.size()-1)).level;
++            }
++        }
++        void addXmlnsAttr(Attr n) {
++            if (cur == null) {
++                cur = new XmlsStackElement();
++                cur.level = currentLevel;
++                levels.add(cur);
++                lastlevel = currentLevel;
++            }
++            cur.nodes.add(n);
++        }
++        void getXmlnsAttr(Collection col) {
++            if (cur == null) {
++                cur = new XmlsStackElement();
++                cur.level = currentLevel;
++                lastlevel = currentLevel;
++                levels.add(cur);
++            }
++            int size = levels.size() - 2;
++            boolean parentRendered = false;
++            XmlsStackElement e = null;
++            if (size == -1) {
++                parentRendered = true;
++            } else {
++                e = (XmlsStackElement) levels.get(size);
++                if (e.rendered && e.level+1 == currentLevel)
++                    parentRendered = true;
++            }
++            if (parentRendered) {
++                col.addAll(cur.nodes);
++                cur.rendered = true;
++                return;
++            }
++
++            Map loa = new HashMap();
++            List baseAttrs = new ArrayList();
++            boolean successiveOmitted = true;
++            for (;size>=0;size--) {
++                e = (XmlsStackElement) levels.get(size);
++                if (e.rendered) {
++                    successiveOmitted = false;
++                }
++                Iterator it = e.nodes.iterator();
++                while (it.hasNext() && successiveOmitted) {
++                    Attr n = (Attr) it.next();
++                    if (n.getLocalName().equals("base")) {
++                        if (!e.rendered) {
++                            baseAttrs.add(n);
++                        }
++                    } else if (!loa.containsKey(n.getName()))
++                        loa.put(n.getName(), n);
++                }
++            }
++            if (!baseAttrs.isEmpty()) {
++                Iterator it = cur.nodes.iterator();
++                String base = null;
++                Attr baseAttr = null;
++                while (it.hasNext()) {
++                    Attr n = (Attr) it.next();
++                    if (n.getLocalName().equals("base")) {
++                        base = n.getValue();
++                        baseAttr = n;
++                        break;
++                    }
++                }
++                it = baseAttrs.iterator();
++                while (it.hasNext()) {
++                    Attr n = (Attr) it.next();
++                    if (base == null) {
++                        base = n.getValue();
++                        baseAttr = n;
++                    } else {
++                        try {
++                            base = joinURI(n.getValue(), base);
++                        } catch (URISyntaxException ue) {
++                            ue.printStackTrace();
++                        }
++                    }
++                }
++                if (base != null && base.length() != 0) {
++                    baseAttr.setValue(base);
++                    col.add(baseAttr);
++                }
++            }
++
++            cur.rendered = true;
++            col.addAll(loa.values());
++        }
++    };
++    XmlAttrStack xmlattrStack = new XmlAttrStack();
++
++    /**
++     * Constructor Canonicalizer11
++     *
++     * @param includeComments
++     */
++    public Canonicalizer11(boolean includeComments) {
++        super(includeComments);
++    }
++
++    /**
++     * Returns the Attr[]s to be outputted for the given element.
++     * <br>
++     * The code of this method is a copy of {@link #handleAttributes(Element,
++     * NameSpaceSymbTable)},
++     * whereas it takes into account that subtree-c14n is -- well --
++     * subtree-based.
++     * So if the element in question isRoot of c14n, it's parent is not in the
++     * node set, as well as all other ancestors.
++     *
++     * @param E
++     * @param ns
++     * @return the Attr[]s to be outputted
++     * @throws CanonicalizationException
++     */
++    Iterator handleAttributesSubtree(Element E, NameSpaceSymbTable ns)
++        throws CanonicalizationException {
++        if (!E.hasAttributes() && !firstCall) {
++            return null;
++        }
++        // result will contain the attrs which have to be outputted
++        final SortedSet result = this.result;
++        result.clear();
++        NamedNodeMap attrs = E.getAttributes();
++        int attrsLength = attrs.getLength();
++
++        for (int i = 0; i < attrsLength; i++) {
++            Attr N = (Attr) attrs.item(i);
++            String NUri = N.getNamespaceURI();
++
++            if (XMLNS_URI != NUri) {
++                // It's not a namespace attr node. Add to the result and
++                // continue.
++                result.add(N);
++                continue;
++            }
++
++            String NName = N.getLocalName();
++            String NValue = N.getValue();
++            if (XML.equals(NName)
++                && XML_LANG_URI.equals(NValue)) {
++                // The default mapping for xml must not be output.
++                continue;
++            }
++
++            Node n = ns.addMappingAndRender(NName, NValue, N);
++
++            if (n != null) {
++                // Render the ns definition
++                result.add(n);
++                if (C14nHelper.namespaceIsRelative(N)) {
++                    Object exArgs[] = {E.getTagName(), NName, N.getNodeValue()};
++                    throw new CanonicalizationException(
++                        "c14n.Canonicalizer.RelativeNamespace", exArgs);
++                }
++            }
++        }
++
++        if (firstCall) {
++            // It is the first node of the subtree
++            // Obtain all the namespaces defined in the parents, and added
++            // to the output.
++            ns.getUnrenderedNodes(result);
++            // output the attributes in the xml namespace.
++            xmlattrStack.getXmlnsAttr(result);
++            firstCall = false;
++        }
++
++        return result.iterator();
++    }
++
++    /**
++     * Returns the Attr[]s to be outputted for the given element.
++     * <br>
++     * IMPORTANT: This method expects to work on a modified DOM tree, i.e. a
++     * DOM which has been prepared using
++     * {@link com.sun.org.apache.xml.internal.security.utils.XMLUtils#circumventBug2650(
++     * org.w3c.dom.Document)}.
++     *
++     * @param E
++     * @param ns
++     * @return the Attr[]s to be outputted
++     * @throws CanonicalizationException
++     */
++    Iterator handleAttributes(Element E, NameSpaceSymbTable ns)
++        throws CanonicalizationException {
++        // result will contain the attrs which have to be output
++        xmlattrStack.push(ns.getLevel());
++        boolean isRealVisible = isVisibleDO(E, ns.getLevel()) == 1;
++        NamedNodeMap attrs = null;
++        int attrsLength = 0;
++        if (E.hasAttributes()) {
++            attrs = E.getAttributes();
++            attrsLength = attrs.getLength();
++        }
++
++        SortedSet result = this.result;
++        result.clear();
++
++        for (int i = 0; i < attrsLength; i++) {
++            Attr N = (Attr) attrs.item(i);
++            String NUri = N.getNamespaceURI();
++
++            if (XMLNS_URI != NUri) {
++                // A non namespace definition node.
++                if (XML_LANG_URI == NUri) {
++                    if (N.getLocalName().equals("id")) {
++                        if (isRealVisible) {
++                            // treat xml:id like any other attribute
++                            // (emit it, but don't inherit it)
++                            result.add(N);
++                        }
++                    } else {
++                        xmlattrStack.addXmlnsAttr(N);
++                    }
++                } else if (isRealVisible) {
++                    // The node is visible add the attribute to the list of
++                    // output attributes.
++                    result.add(N);
++                }
++                // keep working
++                continue;
++            }
++
++            String NName = N.getLocalName();
++            String NValue = N.getValue();
++            if ("xml".equals(NName)
++                && XML_LANG_URI.equals(NValue)) {
++                /* except omit namespace node with local name xml, which defines
++                 * the xml prefix, if its string value is
++                 * http://www.w3.org/XML/1998/namespace.
++                 */
++                continue;
++            }
++            // add the prefix binding to the ns symb table.
++            // ns.addInclusiveMapping(NName,NValue,N,isRealVisible);
++            if (isVisible(N))  {
++                if (!isRealVisible && ns.removeMappingIfRender(NName)) {
++                    continue;
++                }
++                // The xpath select this node output it if needed.
++                // Node n = ns.addMappingAndRenderXNodeSet
++                //      (NName, NValue, N, isRealVisible);
++                Node n = ns.addMappingAndRender(NName, NValue, N);
++                if (n != null) {
++                    result.add(n);
++                    if (C14nHelper.namespaceIsRelative(N)) {
++                        Object exArgs[] =
++                            { E.getTagName(), NName, N.getNodeValue() };
++                        throw new CanonicalizationException(
++                            "c14n.Canonicalizer.RelativeNamespace", exArgs);
++                    }
++                }
++            } else {
++                if (isRealVisible && NName != XMLNS) {
++                    ns.removeMapping(NName);
++                } else {
++                    ns.addMapping(NName, NValue, N);
++                }
++            }
++        }
++        if (isRealVisible) {
++            // The element is visible, handle the xmlns definition
++            Attr xmlns = E.getAttributeNodeNS(XMLNS_URI, XMLNS);
++            Node n = null;
++            if (xmlns == null) {
++                // No xmlns def just get the already defined.
++                n = ns.getMapping(XMLNS);
++            } else if (!isVisible(xmlns)) {
++                // There is a defn but the xmlns is not selected by the xpath.
++                // then xmlns=""
++                n = ns.addMappingAndRender(XMLNS, "", nullNode);
++            }
++            // output the xmlns def if needed.
++            if (n != null) {
++                result.add(n);
++            }
++            // Float all xml:* attributes of the unselected parent elements to
++            // this one. addXmlAttributes(E,result);
++            xmlattrStack.getXmlnsAttr(result);
++            ns.getUnrenderedNodes(result);
++        }
++
++        return result.iterator();
++    }
++
++    /**
++     * Always throws a CanonicalizationException because this is inclusive c14n.
++     *
++     * @param xpathNodeSet
++     * @param inclusiveNamespaces
++     * @return none it always fails
++     * @throws CanonicalizationException always
++     */
++    public byte[] engineCanonicalizeXPathNodeSet(Set xpathNodeSet,
++        String inclusiveNamespaces) throws CanonicalizationException {
++        throw new CanonicalizationException(
++         "c14n.Canonicalizer.UnsupportedOperation");
++    }
++
++    /**
++     * Always throws a CanonicalizationException because this is inclusive c14n.
++     *
++     * @param rootNode
++     * @param inclusiveNamespaces
++     * @return none it always fails
++     * @throws CanonicalizationException
++     */
++    public byte[] engineCanonicalizeSubTree(Node rootNode,
++        String inclusiveNamespaces) throws CanonicalizationException {
++        throw new CanonicalizationException(
++            "c14n.Canonicalizer.UnsupportedOperation");
++    }
++
++    void circumventBugIfNeeded(XMLSignatureInput input)
++        throws CanonicalizationException, ParserConfigurationException,
++        IOException, SAXException {
++        if (!input.isNeedsToBeExpanded())
++            return;
++        Document doc = null;
++        if (input.getSubNode() != null) {
++            doc = XMLUtils.getOwnerDocument(input.getSubNode());
++        } else {
++            doc = XMLUtils.getOwnerDocument(input.getNodeSet());
++        }
++        XMLUtils.circumventBug2650(doc);
++    }
++
++    void handleParent(Element e, NameSpaceSymbTable ns) {
++        if (!e.hasAttributes()) {
++            return;
++        }
++        xmlattrStack.push(-1);
++        NamedNodeMap attrs = e.getAttributes();
++        int attrsLength = attrs.getLength();
++        for (int i = 0; i < attrsLength; i++) {
++            Attr N = (Attr) attrs.item(i);
++            if (Constants.NamespaceSpecNS != N.getNamespaceURI()) {
++                // Not a namespace definition, ignore.
++                if (XML_LANG_URI == N.getNamespaceURI()) {
++                    xmlattrStack.addXmlnsAttr(N);
++                }
++                continue;
++            }
++
++            String NName = N.getLocalName();
++            String NValue = N.getNodeValue();
++            if (XML.equals(NName)
++                && Constants.XML_LANG_SPACE_SpecNS.equals(NValue)) {
++                continue;
++            }
++            ns.addMapping(NName,NValue,N);
++        }
++    }
++
++    private static String joinURI(String baseURI, String relativeURI)
++        throws URISyntaxException {
++        String bscheme = null;
++        String bauthority = null;
++        String bpath = "";
++        String bquery = null;
++        String bfragment = null; // Is this correct?
++
++        // pre-parse the baseURI
++        if (baseURI != null) {
++            if (baseURI.endsWith("..")) {
++                baseURI = baseURI + "/";
++            }
++            URI base = new URI(baseURI);
++            bscheme = base.getScheme();
++            bauthority = base.getAuthority();
++            bpath = base.getPath();
++            bquery = base.getQuery();
++            bfragment = base.getFragment();
++        }
++
++        URI r = new URI(relativeURI);
++        String rscheme = r.getScheme();
++        String rauthority = r.getAuthority();
++        String rpath = r.getPath();
++        String rquery = r.getQuery();
++        String rfragment = null;
++
++        String tscheme, tauthority, tpath, tquery, tfragment;
++        if (rscheme != null && rscheme.equals(bscheme)) {
++            rscheme = null;
++        }
++        if (rscheme != null) {
++            tscheme = rscheme;
++            tauthority = rauthority;
++            tpath = removeDotSegments(rpath);
++            tquery = rquery;
++        } else {
++            if (rauthority != null) {
++                tauthority = rauthority;
++                tpath = removeDotSegments(rpath);
++                tquery = rquery;
++            } else {
++                if (rpath.length() == 0) {
++                    tpath = bpath;
++                    if (rquery != null) {
++                        tquery = rquery;
++                    } else {
++                        tquery = bquery;
++                    }
++                } else {
++                    if (rpath.startsWith("/")) {
++                        tpath = removeDotSegments(rpath);
++                    } else {
++                        if (bauthority != null && bpath.length() == 0) {
++                            tpath = "/" + rpath;
++                        } else {
++                            int last = bpath.lastIndexOf('/');
++                            if (last == -1) {
++                                tpath = rpath;
++                            } else {
++                                tpath = bpath.substring(0, last+1) + rpath;
++                            }
++                        }
++                        tpath = removeDotSegments(tpath);
++                    }
++                    tquery = rquery;
++                }
++                tauthority = bauthority;
++            }
++            tscheme = bscheme;
++        }
++        tfragment = rfragment;
++        return new URI(tscheme, tauthority, tpath, tquery, tfragment).toString();
++    }
++
++    private static String removeDotSegments(String path) {
++
++        log.log(java.util.logging.Level.FINE, "STEP   OUTPUT BUFFER\t\tINPUT BUFFER");
++
++        // 1. The input buffer is initialized with the now-appended path
++        // components then replace occurrences of "//" in the input buffer
++        // with "/" until no more occurrences of "//" are in the input buffer.
++        String input = path;
++        while (input.indexOf("//") > -1) {
++            input = input.replaceAll("//", "/");
++        }
++
++        // Initialize the output buffer with the empty string.
++        StringBuffer output = new StringBuffer();
++
++        // If the input buffer starts with a root slash "/" then move this
++        // character to the output buffer.
++        if (input.charAt(0) == '/') {
++            output.append("/");
++            input = input.substring(1);
++        }
++
++        printStep("1 ", output.toString(), input);
++
++        // While the input buffer is not empty, loop as follows
++        while (input.length() != 0) {
++            // 2A. If the input buffer begins with a prefix of "./",
++            // then remove that prefix from the input buffer
++            // else if the input buffer begins with a prefix of "../", then
++            // if also the output does not contain the root slash "/" only,
++            // then move this prefix to the end of the output buffer else
++            // remove that prefix
++            if (input.startsWith("./")) {
++                input = input.substring(2);
++                printStep("2A", output.toString(), input);
++            } else if (input.startsWith("../")) {
++                input = input.substring(3);
++                if (!output.toString().equals("/")) {
++                    output.append("../");
++                }
++                printStep("2A", output.toString(), input);
++            // 2B. if the input buffer begins with a prefix of "/./" or "/.",
++            // where "." is a complete path segment, then replace that prefix
++            // with "/" in the input buffer; otherwise,
++            } else if (input.startsWith("/./")) {
++                input = input.substring(2);
++                printStep("2B", output.toString(), input);
++            } else if (input.equals("/.")) {
++                // FIXME: what is complete path segment?
++                input = input.replaceFirst("/.", "/");
++                printStep("2B", output.toString(), input);
++            // 2C. if the input buffer begins with a prefix of "/../" or "/..",
++            // where ".." is a complete path segment, then replace that prefix
++            // with "/" in the input buffer and if also the output buffer is
++            // empty, last segment in the output buffer equals "../" or "..",
++            // where ".." is a complete path segment, then append ".." or "/.."
++            // for the latter case respectively to the output buffer else
++            // remove the last segment and its preceding "/" (if any) from the
++            // output buffer and if hereby the first character in the output
++            // buffer was removed and it was not the root slash then delete a
++            // leading slash from the input buffer; otherwise,
++            } else if (input.startsWith("/../")) {
++                input = input.substring(3);
++                if (output.length() == 0) {
++                    output.append("/");
++                } else if (output.toString().endsWith("../")) {
++                    output.append("..");
++                } else if (output.toString().endsWith("..")) {
++                    output.append("/..");
++                } else {
++                    int index = output.lastIndexOf("/");
++                    if (index == -1) {
++                        output = new StringBuffer();
++                        if (input.charAt(0) == '/') {
++                            input = input.substring(1);
++                        }
++                    } else {
++                        output = output.delete(index, output.length());
++                    }
++                }
++                printStep("2C", output.toString(), input);
++            } else if (input.equals("/..")) {
++                // FIXME: what is complete path segment?
++                input = input.replaceFirst("/..", "/");
++                if (output.length() == 0) {
++                    output.append("/");
++                } else if (output.toString().endsWith("../")) {
++                    output.append("..");
++                } else if (output.toString().endsWith("..")) {
++                    output.append("/..");
++                } else {
++                    int index = output.lastIndexOf("/");
++                    if (index == -1) {
++                        output = new StringBuffer();
++                        if (input.charAt(0) == '/') {
++                            input = input.substring(1);
++                        }
++                    } else {
++                        output = output.delete(index, output.length());
++                    }
++                }
++                printStep("2C", output.toString(), input);
++            // 2D. if the input buffer consists only of ".", then remove
++            // that from the input buffer else if the input buffer consists
++            // only of ".." and if the output buffer does not contain only
++            // the root slash "/", then move the ".." to the output buffer
++            // else delte it.; otherwise,
++            } else if (input.equals(".")) {
++                input = "";
++                printStep("2D", output.toString(), input);
++            } else if (input.equals("..")) {
++                if (!output.toString().equals("/"))
++                    output.append("..");
++                input = "";
++                printStep("2D", output.toString(), input);
++            // 2E. move the first path segment (if any) in the input buffer
++            // to the end of the output buffer, including the initial "/"
++            // character (if any) and any subsequent characters up to, but not
++            // including, the next "/" character or the end of the input buffer.
++            } else {
++                int end = -1;
++                int begin = input.indexOf('/');
++                if (begin == 0) {
++                    end = input.indexOf('/', 1);
++                } else {
++                    end = begin;
++                    begin = 0;
++                }
++                String segment;
++                if (end == -1) {
++                    segment = input.substring(begin);
++                    input = "";
++                } else {
++                    segment = input.substring(begin, end);
++                    input = input.substring(end);
++                }
++                output.append(segment);
++                printStep("2E", output.toString(), input);
++            }
++        }
++
++        // 3. Finally, if the only or last segment of the output buffer is
++        // "..", where ".." is a complete path segment not followed by a slash
++        // then append a slash "/". The output buffer is returned as the result
++        // of remove_dot_segments
++        if (output.toString().endsWith("..")) {
++            output.append("/");
++            printStep("3 ", output.toString(), input);
++        }
++
++        return output.toString();
++    }
++
++    private static void printStep(String step, String output, String input) {
++        if (log.isLoggable(java.util.logging.Level.FINE)) {
++            log.log(java.util.logging.Level.FINE, " " + step + ":   " + output);
++            if (output.length() == 0) {
++                log.log(java.util.logging.Level.FINE, "\t\t\t\t" + input);
++            } else {
++                log.log(java.util.logging.Level.FINE, "\t\t\t" + input);
++            }
++        }
++    }
++}
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer11_OmitComments.java b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer11_OmitComments.java
+new file mode 100644
+--- /dev/null
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer11_OmitComments.java
+@@ -0,0 +1,41 @@
++/*
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
++ */
++/*
++ * Copyright 2008 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      http://www.apache.org/licenses/LICENSE-2.0
++ *
++ *  Unless required by applicable law or agreed to in writing, software
++ *  distributed under the License is distributed on an "AS IS" BASIS,
++ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ *  See the License for the specific language governing permissions and
++ *  limitations under the License.
++ *
++ */
++package com.sun.org.apache.xml.internal.security.c14n.implementations;
++
++import com.sun.org.apache.xml.internal.security.c14n.Canonicalizer;
++
++/**
++ * @author Sean Mullan
++ */
++public class Canonicalizer11_OmitComments extends Canonicalizer11 {
++
++    public Canonicalizer11_OmitComments() {
++        super(false);
++    }
++
++    public final String engineGetURI() {
++        return Canonicalizer.ALGO_ID_C14N11_OMIT_COMMENTS;
++    }
++
++    public final boolean engineGetIncludeComments() {
++        return false;
++    }
++}
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer11_WithComments.java b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer11_WithComments.java
+new file mode 100644
+--- /dev/null
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer11_WithComments.java
+@@ -0,0 +1,41 @@
++/*
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
++ */
++/*
++ * Copyright 2008 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      http://www.apache.org/licenses/LICENSE-2.0
++ *
++ *  Unless required by applicable law or agreed to in writing, software
++ *  distributed under the License is distributed on an "AS IS" BASIS,
++ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ *  See the License for the specific language governing permissions and
++ *  limitations under the License.
++ *
++ */
++package com.sun.org.apache.xml.internal.security.c14n.implementations;
++
++import com.sun.org.apache.xml.internal.security.c14n.Canonicalizer;
++
++/**
++ * @author Sean Mullan
++ */
++public class Canonicalizer11_WithComments extends Canonicalizer11 {
++
++    public Canonicalizer11_WithComments() {
++        super(true);
++    }
++
++    public final String engineGetURI() {
++        return Canonicalizer.ALGO_ID_C14N11_WITH_COMMENTS;
++    }
++
++    public final boolean engineGetIncludeComments() {
++        return true;
++    }
++}
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315.java b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -23,20 +22,30 @@
+ 
+ 
+ 
++import java.io.IOException;
++import java.util.ArrayList;
++import java.util.Collection;
+ import java.util.HashMap;
+ import java.util.Iterator;
++import java.util.List;
+ import java.util.Map;
+ import java.util.Set;
+ import java.util.SortedSet;
+ import java.util.TreeSet;
+ 
++import javax.xml.parsers.ParserConfigurationException;
++
+ import com.sun.org.apache.xml.internal.security.c14n.CanonicalizationException;
+ import com.sun.org.apache.xml.internal.security.c14n.helper.C14nHelper;
++import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
+ import com.sun.org.apache.xml.internal.security.utils.Constants;
++import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
+ import org.w3c.dom.Attr;
++import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+ import org.w3c.dom.NamedNodeMap;
+ import org.w3c.dom.Node;
++import org.xml.sax.SAXException;
+ 
+ 
+ /**
+@@ -44,13 +53,92 @@
+  * XML Version 1.0</A>, a W3C Recommendation from 15 March 2001.
+  *
+  * @author Christian Geuer-Pollmann <geuerp at apache.org>
++ * @version $Revision: 1.5 $
+  */
+ public abstract class Canonicalizer20010315 extends CanonicalizerBase {
+         boolean firstCall=true;
+         final SortedSet result= new TreeSet(COMPARE);
+     static final String XMLNS_URI=Constants.NamespaceSpecNS;
+     static final String XML_LANG_URI=Constants.XML_LANG_SPACE_SpecNS;
+-   /**
++    static class XmlAttrStack {
++        int currentLevel=0;
++        int lastlevel=0;
++        XmlsStackElement cur;
++        static class XmlsStackElement {
++                int level;
++                boolean rendered=false;
++                List nodes=new ArrayList();
++        };
++        List levels=new ArrayList();
++        void push(int level) {
++                currentLevel=level;
++                if (currentLevel==-1)
++                        return;
++                cur=null;
++                while (lastlevel>=currentLevel) {
++                        levels.remove(levels.size()-1);
++                        if (levels.size()==0) {
++                                lastlevel=0;
++                                return;
++                        }
++                        lastlevel=((XmlsStackElement)levels.get(levels.size()-1)).level;
++                }
++        }
++        void addXmlnsAttr(Attr n) {
++                if (cur==null) {
++                        cur=new XmlsStackElement();
++                        cur.level=currentLevel;
++                        levels.add(cur);
++                        lastlevel=currentLevel;
++                }
++                cur.nodes.add(n);
++        }
++        void getXmlnsAttr(Collection col) {
++                int size=levels.size()-1;
++                if (cur==null) {
++                        cur=new XmlsStackElement();
++                        cur.level=currentLevel;
++                        lastlevel=currentLevel;
++                        levels.add(cur);
++                }
++                boolean parentRendered=false;
++                XmlsStackElement e=null;
++                if (size==-1) {
++                        parentRendered=true;
++                } else {
++                        e=(XmlsStackElement)levels.get(size);
++                        if (e.rendered && e.level+1==currentLevel)
++                                parentRendered=true;
++
++                }
++                if (parentRendered) {
++                                col.addAll(cur.nodes);
++                                cur.rendered=true;
++                                return;
++                        }
++
++                        Map loa = new HashMap();
++                for (;size>=0;size--) {
++                        e=(XmlsStackElement)levels.get(size);
++                        Iterator it=e.nodes.iterator();
++                        while (it.hasNext()) {
++                                Attr n=(Attr)it.next();
++                                if (!loa.containsKey(n.getName()))
++                                        loa.put(n.getName(),n);
++                        }
++                        //if (e.rendered)
++                                //break;
++
++                };
++                //cur.nodes.clear();
++                //cur.nodes.addAll(loa.values());
++                        cur.rendered=true;
++                col.addAll(loa.values());
++        }
++
++    }
++    XmlAttrStack xmlattrStack=new XmlAttrStack();
++    /**
+     * Constructor Canonicalizer20010315
+     *
+     * @param includeComments
+@@ -86,16 +174,16 @@
+ 
+       for (int i = 0; i < attrsLength; i++) {
+          Attr N = (Attr) attrs.item(i);
+-         String NName=N.getLocalName();
+-         String NValue=N.getValue();
+          String NUri =N.getNamespaceURI();
+ 
+-         if (!XMLNS_URI.equals(NUri)) {
++         if (XMLNS_URI!=NUri) {
+                 //It's not a namespace attr node. Add to the result and continue.
+             result.add(N);
+             continue;
+          }
+ 
++         String NName=N.getLocalName();
++         String NValue=N.getValue();
+          if (XML.equals(NName)
+                  && XML_LANG_URI.equals(NValue)) {
+                 //The default mapping for xml must not be output.
+@@ -120,65 +208,14 @@
+         //Obtain all the namespaces defined in the parents, and added to the output.
+         ns.getUnrenderedNodes(result);
+         //output the attributes in the xml namespace.
+-                addXmlAttributesSubtree(E, result);
+-        firstCall=false;
++        xmlattrStack.getXmlnsAttr(result);
++                firstCall=false;
+       }
+ 
+       return result.iterator();
+    }
+ 
+    /**
+-    * Float the xml:* attributes of the parent nodes to the root node of c14n
+-    * @param E the root node.
+-    * @param result the xml:* attributes  to output.
+-    */
+-   private void addXmlAttributesSubtree(Element E, SortedSet result) {
+-         // E is in the node-set
+-         Node parent = E.getParentNode();
+-         Map loa = new HashMap();
+-
+-         if ((parent != null) && (parent.getNodeType() == Node.ELEMENT_NODE)) {
+-
+-            // parent element is not in node set
+-            for (Node ancestor = parent;
+-                    (ancestor != null)
+-                    && (ancestor.getNodeType() == Node.ELEMENT_NODE);
+-                    ancestor = ancestor.getParentNode()) {
+-               Element el=((Element) ancestor);
+-               if (!el.hasAttributes()) {
+-                    continue;
+-               }
+-               // for all ancestor elements
+-               NamedNodeMap ancestorAttrs = el.getAttributes();
+-
+-               for (int i = 0; i < ancestorAttrs.getLength(); i++) {
+-                  // for all attributes in the ancestor element
+-                  Attr currentAncestorAttr = (Attr) ancestorAttrs.item(i);
+-
+-                  if (XML_LANG_URI.equals(
+-                          currentAncestorAttr.getNamespaceURI())) {
+-
+-                     // do we have an xml:* ?
+-                     if (!E.hasAttributeNS(
+-                             XML_LANG_URI,
+-                             currentAncestorAttr.getLocalName())) {
+-
+-                        // the xml:* attr is not in E
+-                        if (!loa.containsKey(currentAncestorAttr.getName())) {
+-                           loa.put(currentAncestorAttr.getName(),
+-                                   currentAncestorAttr);
+-                        }
+-                     }
+-                  }
+-               }
+-            }
+-         }
+-
+-         result.addAll( loa.values());
+-
+-      }
+-
+-   /**
+     * Returns the Attr[]s to be outputted for the given element.
+     * <br>
+     * IMPORTANT: This method expects to work on a modified DOM tree, i.e. a DOM which has
+@@ -192,7 +229,8 @@
+     */
+    Iterator handleAttributes(Element E,  NameSpaceSymbTable ns ) throws CanonicalizationException {
+     // result will contain the attrs which have to be outputted
+-    boolean isRealVisible=isVisible(E);
++        xmlattrStack.push(ns.getLevel());
++    boolean isRealVisible=isVisibleDO(E,ns.getLevel())==1;
+     NamedNodeMap attrs = null;
+     int attrsLength = 0;
+     if (E.hasAttributes()) {
+@@ -204,16 +242,15 @@
+     SortedSet result = this.result;
+     result.clear();
+ 
+-
+     for (int i = 0; i < attrsLength; i++) {
+        Attr N = (Attr) attrs.item(i);
+-       String NName=N.getLocalName();
+-       String NValue=N.getValue();
+        String NUri =N.getNamespaceURI();
+ 
+-       if (!XMLNS_URI.equals(NUri)) {
++       if (XMLNS_URI!=NUri) {
+           //A non namespace definition node.
+-          if (isRealVisible){
++           if (XML_LANG_URI==NUri) {
++                          xmlattrStack.addXmlnsAttr(N);
++           } else if (isRealVisible){
+                 //The node is visible add the attribute to the list of output attributes.
+                 result.add(N);
+           }
+@@ -221,7 +258,8 @@
+           continue;
+        }
+ 
+-
++       String NName=N.getLocalName();
++       String NValue=N.getValue();
+        if ("xml".equals(NName)
+                && XML_LANG_URI.equals(NValue)) {
+           /* except omit namespace node with local name xml, which defines
+@@ -232,16 +270,26 @@
+        //add the prefix binding to the ns symb table.
+        //ns.addInclusiveMapping(NName,NValue,N,isRealVisible);
+             if  (isVisible(N))  {
+-                            //The xpath select this node output it if needed.
+-                        Node n=ns.addMappingAndRenderXNodeSet(NName,NValue,N,isRealVisible);
+-                                if (n!=null) {
++                if (!isRealVisible && ns.removeMappingIfRender(NName)) {
++                        continue;
++                }
++                        //The xpath select this node output it if needed.
++                //Node n=ns.addMappingAndRenderXNodeSet(NName,NValue,N,isRealVisible);
++                Node n=ns.addMappingAndRender(NName,NValue,N);
++                        if (n!=null) {
+                                         result.add(n);
+                     if (C14nHelper.namespaceIsRelative(N)) {
+                        Object exArgs[] = { E.getTagName(), NName, N.getNodeValue() };
+                        throw new CanonicalizationException(
+                           "c14n.Canonicalizer.RelativeNamespace", exArgs);
+-                    }
+-                                }
++                   }
++                         }
++        } else {
++                if (isRealVisible && NName!=XMLNS) {
++                        ns.removeMapping(NName);
++                } else {
++                        ns.addMapping(NName,NValue,N);
++                }
+         }
+     }
+     if (isRealVisible) {
+@@ -254,85 +302,22 @@
+         } else if ( !isVisible(xmlns)) {
+                 //There is a definition but the xmlns is not selected by the xpath.
+                 //then xmlns=""
+-                n=ns.addMappingAndRenderXNodeSet(XMLNS,"",nullNode,true);
++                n=ns.addMappingAndRender(XMLNS,"",nullNode);
+         }
+         //output the xmlns def if needed.
+         if (n!=null) {
+                         result.add(n);
+         }
+         //Float all xml:* attributes of the unselected parent elements to this one.
+-        addXmlAttributes(E,result);
++        //addXmlAttributes(E,result);
++        xmlattrStack.getXmlnsAttr(result);
++        ns.getUnrenderedNodes(result);
++
+     }
+ 
+     return result.iterator();
+    }
+    /**
+-    *  Float the xml:* attributes of the unselected parent nodes to the ciurrent node.
+-    * @param E
+-    * @param result
+-    */
+-   private void addXmlAttributes(Element E, SortedSet result) {
+-        /* The processing of an element node E MUST be modified slightly when an
+-       * XPath node-set is given as input and the element's parent is omitted
+-       * from the node-set. The method for processing the attribute axis of an
+-       * element E in the node-set is enhanced. All element nodes along E's
+-       * ancestor axis are examined for nearest occurrences of attributes in
+-       * the xml namespace, such as xml:lang and xml:space (whether or not they
+-       * are in the node-set). From this list of attributes, remove any that are
+-       * in E's attribute axis (whether or not they are in the node-set). Then,
+-       * lexicographically merge this attribute list with the nodes of E's
+-       * attribute axis that are in the node-set. The result of visiting the
+-       * attribute axis is computed by processing the attribute nodes in this
+-       * merged attribute list.
+-       */
+-
+-         // E is in the node-set
+-         Node parent = E.getParentNode();
+-         Map loa = new HashMap();
+-
+-         if ((parent != null) && (parent.getNodeType() == Node.ELEMENT_NODE)
+-                 &&!isVisible(parent)) {
+-
+-            // parent element is not in node set
+-            for (Node ancestor = parent;
+-                    (ancestor != null)
+-                    && (ancestor.getNodeType() == Node.ELEMENT_NODE);
+-                    ancestor = ancestor.getParentNode()) {
+-                Element el=((Element) ancestor);
+-                if (!el.hasAttributes()) {
+-                        continue;
+-                }
+-               // for all ancestor elements
+-               NamedNodeMap ancestorAttrs =el.getAttributes();
+-
+-               for (int i = 0; i < ancestorAttrs.getLength(); i++) {
+-
+-                  // for all attributes in the ancestor element
+-                  Attr currentAncestorAttr = (Attr) ancestorAttrs.item(i);
+-
+-                  if (XML_LANG_URI.equals(
+-                          currentAncestorAttr.getNamespaceURI())) {
+-
+-                     // do we have an xml:* ?
+-                     if (!E.hasAttributeNS(
+-                             XML_LANG_URI,
+-                             currentAncestorAttr.getLocalName())) {
+-
+-                        // the xml:* attr is not in E
+-                        if (!loa.containsKey(currentAncestorAttr.getName())) {
+-                           loa.put(currentAncestorAttr.getName(),
+-                                   currentAncestorAttr);
+-                        }
+-                     }
+-                  }
+-               }
+-            }
+-         }
+-         result.addAll(loa.values());
+-
+-}
+-
+-   /**
+     * Always throws a CanonicalizationException because this is inclusive c14n.
+     *
+     * @param xpathNodeSet
+@@ -363,4 +348,43 @@
+       throw new CanonicalizationException(
+          "c14n.Canonicalizer.UnsupportedOperation");
+    }
++   void circumventBugIfNeeded(XMLSignatureInput input) throws CanonicalizationException, ParserConfigurationException, IOException, SAXException {
++           if (!input.isNeedsToBeExpanded())
++                   return;
++           Document doc = null;
++       if (input.getSubNode() != null) {
++           doc=XMLUtils.getOwnerDocument(input.getSubNode());
++       } else {
++           doc=XMLUtils.getOwnerDocument(input.getNodeSet());
++       }
++           XMLUtils.circumventBug2650(doc);
++
++   }
++
++   void handleParent(Element e, NameSpaceSymbTable ns) {
++           if (!e.hasAttributes()) {
++                        return;
++           }
++           xmlattrStack.push(-1);
++           NamedNodeMap attrs = e.getAttributes();
++           int attrsLength = attrs.getLength();
++           for (int i = 0; i < attrsLength; i++) {
++                   Attr N = (Attr) attrs.item(i);
++                   if (Constants.NamespaceSpecNS!=N.getNamespaceURI()) {
++                           //Not a namespace definition, ignore.
++                           if (XML_LANG_URI==N.getNamespaceURI()) {
++                                   xmlattrStack.addXmlnsAttr(N);
++                           }
++                           continue;
++                   }
++
++                   String NName=N.getLocalName();
++                   String NValue=N.getNodeValue();
++                   if (XML.equals(NName)
++                                   && Constants.XML_LANG_SPACE_SpecNS.equals(NValue)) {
++                                continue;
++                   }
++                   ns.addMapping(NName,NValue,N);
++           }
++   }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315Excl.java b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315Excl.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315Excl.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315Excl.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright 1999-2004 The Apache Software Foundation.
+  *
+@@ -21,20 +20,26 @@
+  */
+ package com.sun.org.apache.xml.internal.security.c14n.implementations;
+ 
++import java.io.IOException;
+ import java.util.Iterator;
+ import java.util.Set;
+ import java.util.SortedSet;
+ import java.util.TreeSet;
+ 
++import javax.xml.parsers.ParserConfigurationException;
++
+ import com.sun.org.apache.xml.internal.security.c14n.CanonicalizationException;
+ import com.sun.org.apache.xml.internal.security.c14n.helper.C14nHelper;
+ import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
+ import com.sun.org.apache.xml.internal.security.transforms.params.InclusiveNamespaces;
+ import com.sun.org.apache.xml.internal.security.utils.Constants;
++import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
+ import org.w3c.dom.Attr;
++import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+ import org.w3c.dom.NamedNodeMap;
+ import org.w3c.dom.Node;
++import org.xml.sax.SAXException;
+ /**
+  * Implements " <A
+  * HREF="http://www.w3.org/TR/2002/REC-xml-exc-c14n-20020718/">Exclusive XML
+@@ -47,6 +52,7 @@
+  * <i>THIS </i> implementation is a complete rewrite of the algorithm.
+  *
+  * @author Christian Geuer-Pollmann <geuerp at apache.org>
++ * @version $Revision: 1.5 $
+  * @see <a href="http://www.w3.org/TR/2002/REC-xml-exc-c14n-20020718/ Exclusive#">
+  *          XML Canonicalization, Version 1.0</a>
+  */
+@@ -55,7 +61,7 @@
+       * This Set contains the names (Strings like "xmlns" or "xmlns:foo") of
+       * the inclusive namespaces.
+       */
+-    TreeSet _inclusiveNSSet = null;
++    TreeSet _inclusiveNSSet = new TreeSet();
+     static final String XMLNS_URI=Constants.NamespaceSpecNS;
+     final SortedSet result = new TreeSet(COMPARE);
+         /**
+@@ -143,10 +149,8 @@
+ 
+                 for (int i = 0; i < attrsLength; i++) {
+                         Attr N = (Attr) attrs.item(i);
+-                        String NName=N.getLocalName();
+-                        String NNodeValue=N.getNodeValue();
+ 
+-                        if (!XMLNS_URI.equals(N.getNamespaceURI())) {
++                        if (XMLNS_URI!=N.getNamespaceURI()) {
+                                 //Not a namespace definition.
+                                 //The Element is output element, add his prefix(if used) to visibyUtilized
+                                 String prefix = N.getPrefix();
+@@ -157,6 +161,8 @@
+                                  result.add(N);
+                                 continue;
+                         }
++                        String NName=N.getLocalName();
++                        String NNodeValue=N.getNodeValue();
+ 
+                         if (ns.addMapping(NName, NNodeValue,N)) {
+                                 //New definition check if it is relative.
+@@ -168,17 +174,17 @@
+                 }
+             }
+                 }
++                String prefix;
++                if (E.getNamespaceURI() != null) {
++                        prefix = E.getPrefix();
++                        if ((prefix == null) || (prefix.length() == 0)) {
++                                prefix=XMLNS;
++                        }
+ 
+-                if (E.getNamespaceURI() != null) {
+-                        String prefix = E.getPrefix();
+-                        if ((prefix == null) || (prefix.length() == 0)) {
+-                                visiblyUtilized.add(XMLNS);
+-                        } else {
+-                                visiblyUtilized.add(prefix);
+-                        }
+                 } else {
+-                        visiblyUtilized.add(XMLNS);
++                        prefix=XMLNS;
+                 }
++                visiblyUtilized.add(prefix);
+ 
+                 //This can be optimezed by I don't have time
+                 Iterator it=visiblyUtilized.iterator();
+@@ -211,12 +217,6 @@
+ 
+         }
+ 
+-    /** @inheritDoc */
+-    public byte[] engineCanonicalizeXPathNodeSet(Set xpathNodeSet
+-            ) throws CanonicalizationException {
+-        return engineCanonicalizeXPathNodeSet(xpathNodeSet,"");
+-    }
+-
+         /**
+      * @inheritDoc
+          * @param E
+@@ -236,21 +236,20 @@
+                 //The prefix visibly utilized(in the attribute or in the name) in the element
+                 Set visiblyUtilized =null;
+                 //It's the output selected.
+-                boolean isOutputElement = isVisible(E);
++                boolean isOutputElement=isVisibleDO(E,ns.getLevel())==1;
+                 if (isOutputElement) {
+                         visiblyUtilized =  (Set) this._inclusiveNSSet.clone();
+                 }
+ 
+                 for (int i = 0; i < attrsLength; i++) {
+                         Attr N = (Attr) attrs.item(i);
+-                        String NName=N.getLocalName();
+-                        String NNodeValue=N.getNodeValue();
+-                        if ( !isVisible(N) )  {
+-                                //The node is not in the nodeset(if there is a nodeset)
+-                                continue;
+-                        }
+ 
+-                        if (!XMLNS_URI.equals(N.getNamespaceURI())) {
++
++                        if (XMLNS_URI!=N.getNamespaceURI()) {
++                                if ( !isVisible(N) )  {
++                                        //The node is not in the nodeset(if there is a nodeset)
++                                        continue;
++                                }
+                                 //Not a namespace definition.
+                                 if (isOutputElement) {
+                                         //The Element is output element, add his prefix(if used) to visibyUtilized
+@@ -263,6 +262,25 @@
+                                 }
+                                 continue;
+                         }
++                        String NName=N.getLocalName();
++                        if (isOutputElement && !isVisible(N) && NName!=XMLNS) {
++                        ns.removeMappingIfNotRender(NName);
++                        continue;
++                }
++                        String NNodeValue=N.getNodeValue();
++
++                        if (!isOutputElement && isVisible(N) && _inclusiveNSSet.contains(NName) && !ns.removeMappingIfRender(NName)) {
++                                Node n=ns.addMappingAndRender(NName,NNodeValue,N);
++                                if (n!=null) {
++                                                result.add(n);
++                            if (C14nHelper.namespaceIsRelative(N)) {
++                               Object exArgs[] = { E.getTagName(), NName, N.getNodeValue() };
++                               throw new CanonicalizationException(
++                                  "c14n.Canonicalizer.RelativeNamespace", exArgs);
++                           }
++                                 }
++                        }
++
+ 
+ 
+                         if (ns.addMapping(NName, NNodeValue,N)) {
+@@ -306,18 +324,20 @@
+                                 }
+                                 result.add(key);
+                         }
+-                } else /*if (_circunvented)*/ {
+-                        Iterator it=this._inclusiveNSSet.iterator();
+-                        while (it.hasNext()) {
+-                                String s=(String)it.next();
+-                                Attr key=ns.getMappingWithoutRendered(s);
+-                                if (key==null) {
+-                                        continue;
+-                                }
+-                                result.add(key);
+-                        }
+                 }
+ 
+                 return result.iterator();
+         }
++        void circumventBugIfNeeded(XMLSignatureInput input) throws CanonicalizationException, ParserConfigurationException, IOException, SAXException {
++                if (!input.isNeedsToBeExpanded() || _inclusiveNSSet.isEmpty())
++                        return;
++                Document doc = null;
++               if (input.getSubNode() != null) {
++                   doc=XMLUtils.getOwnerDocument(input.getSubNode());
++               } else {
++                   doc=XMLUtils.getOwnerDocument(input.getNodeSet());
++               }
++
++                XMLUtils.circumventBug2650(doc);
++           }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315ExclWithComments.java b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315ExclWithComments.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315ExclWithComments.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315ExclWithComments.java
+@@ -28,6 +28,7 @@
+ /**
+  * Class Canonicalizer20010315ExclWithComments
+  *
++ * @version $Revision: 1.5 $
+  */
+ public class Canonicalizer20010315ExclWithComments
+         extends Canonicalizer20010315Excl {
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315WithComments.java b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315WithComments.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315WithComments.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315WithComments.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+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
+@@ -27,9 +27,11 @@
+ import java.io.OutputStream;
+ import java.io.UnsupportedEncodingException;
+ import java.util.ArrayList;
++import java.util.HashMap;
+ import java.util.Iterator;
+ import java.util.List;
+ import java.util.ListIterator;
++import java.util.Map;
+ import java.util.Set;
+ 
+ import javax.xml.parsers.DocumentBuilderFactory;
+@@ -45,7 +47,6 @@
+ import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
+ import org.w3c.dom.Attr;
+ import org.w3c.dom.Comment;
+-import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+ import org.w3c.dom.NamedNodeMap;
+ import org.w3c.dom.Node;
+@@ -57,6 +58,7 @@
+  * Abstract base class for canonicalization algorithms.
+  *
+  * @author Christian Geuer-Pollmann <geuerp at apache.org>
++ * @version $Revision: 1.5 $
+  */
+ public abstract class CanonicalizerBase extends CanonicalizerSpi {
+    //Constants to be outputed, In char array form, so
+@@ -123,6 +125,18 @@
+                 return engineCanonicalizeSubTree(rootNode,(Node)null);
+    }
+    /**
++    * Method engineCanonicalizeXPathNodeSet
++    * @inheritDoc
++    * @param xpathNodeSet
++    * @throws CanonicalizationException
++    */
++   public byte[] engineCanonicalizeXPathNodeSet(Set xpathNodeSet)
++           throws CanonicalizationException {
++           this._xpathNodeSet = xpathNodeSet;
++           return engineCanonicalizeXPathNodeSetInternal(XMLUtils.getOwnerDocument(this._xpathNodeSet));
++   }
++
++   /**
+     * Canonicalizes a Subtree node.
+     * @param input the root of the subtree to canicalize
+     * @return The canonicalize stream.
+@@ -143,15 +157,8 @@
+                                 return bytes;
+                         } else if (input.isNodeSet()) {
+                                 nodeFilter=input.getNodeFilters();
+-                                Document doc = null;
+-                                if (input.getSubNode() != null) {
+-                                    doc=XMLUtils.getOwnerDocument(input.getSubNode());
+-                                } else {
+-                                    doc=XMLUtils.getOwnerDocument(input.getNodeSet());
+-                                }
+-                                if (input.isNeedsToBeExpanded()) {
+-                                        XMLUtils.circumventBug2650(doc);
+-                                }
++
++                circumventBugIfNeeded(input);
+ 
+                                 if (input.getSubNode() != null) {
+                                     bytes = engineCanonicalizeXPathNodeSetInternal(input.getSubNode());
+@@ -173,6 +180,13 @@
+                 }
+    }
+    /**
++    * @param _writer The _writer to set.
++    */
++    public void setWriter(OutputStream _writer) {
++        this._writer = _writer;
++    }
++
++    /**
+          * Canonicalizes a Subtree node.
+          *
+          * @param rootNode
+@@ -187,11 +201,13 @@
+         this._excludeNode = excludeNode;
+         try {
+          NameSpaceSymbTable ns=new NameSpaceSymbTable();
++         int nodeLevel=NODE_BEFORE_DOCUMENT_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);
++                nodeLevel=NODE_NOT_BEFORE_OR_AFTER_DOCUMENT_ELEMENT;
+          }
+-         this.canonicalizeSubTree(rootNode,ns,rootNode);
++         this.canonicalizeSubTree(rootNode,ns,rootNode,nodeLevel);
+          this._writer.close();
+          if (this._writer instanceof ByteArrayOutputStream) {
+             byte []result=((ByteArrayOutputStream)this._writer).toByteArray();
+@@ -199,6 +215,12 @@
+                 ((ByteArrayOutputStream)this._writer).reset();
+             }
+                 return result;
++         }  else if (this._writer instanceof UnsyncByteArrayOutputStream) {
++                 byte []result=((UnsyncByteArrayOutputStream)this._writer).toByteArray();
++             if (reset) {
++                 ((UnsyncByteArrayOutputStream)this._writer).reset();
++             }
++                 return result;
+          }
+          return null;
+ 
+@@ -219,13 +241,17 @@
+     * @throws CanonicalizationException
+     * @throws IOException
+     */
+-    final void canonicalizeSubTree(Node currentNode, NameSpaceSymbTable ns,Node endnode)
++    final void canonicalizeSubTree(Node currentNode, NameSpaceSymbTable ns,Node endnode,
++                int documentLevel)
+     throws CanonicalizationException, IOException {
++        if (isVisibleInt(currentNode)==-1)
++                return;
+         Node sibling=null;
+         Node parentNode=null;
+         final OutputStream writer=this._writer;
+         final Node excludeNode=this._excludeNode;
+         final boolean includeComments=this._includeComments;
++        Map cache=new HashMap();
+         do {
+                 switch (currentNode.getNodeType()) {
+ 
+@@ -242,18 +268,17 @@
+             case Node.DOCUMENT_FRAGMENT_NODE :
+                 case Node.DOCUMENT_NODE :
+                         ns.outputNodePush();
+-                        //currentNode = currentNode.getFirstChild();
+                         sibling= currentNode.getFirstChild();
+                         break;
+ 
+                 case Node.COMMENT_NODE :
+                         if (includeComments) {
+-                                outputCommentToWriter((Comment) currentNode, writer);
++                                outputCommentToWriter((Comment) currentNode, writer, documentLevel);
+                         }
+                         break;
+ 
+                 case Node.PROCESSING_INSTRUCTION_NODE :
+-                        outputPItoWriter((ProcessingInstruction) currentNode, writer);
++                        outputPItoWriter((ProcessingInstruction) currentNode, writer, documentLevel);
+                         break;
+ 
+                 case Node.TEXT_NODE :
+@@ -262,6 +287,7 @@
+                         break;
+ 
+                 case Node.ELEMENT_NODE :
++                        documentLevel=NODE_NOT_BEFORE_OR_AFTER_DOCUMENT_ELEMENT;
+                         if (currentNode==excludeNode) {
+                                 break;
+                         }
+@@ -270,27 +296,27 @@
+                         ns.outputNodePush();
+                         writer.write('<');
+                         String name=currentElement.getTagName();
+-                        writeStringToUtf8(name,writer);
++                        UtfHelpper.writeByte(name,writer,cache);
+ 
+                         Iterator attrs = this.handleAttributesSubtree(currentElement,ns);
+                         if (attrs!=null) {
+                                 //we output all Attrs which are available
+                                 while (attrs.hasNext()) {
+                                         Attr attr = (Attr) attrs.next();
+-                                        outputAttrToWriter(attr.getNodeName(),attr.getNodeValue(), writer);
++                                        outputAttrToWriter(attr.getNodeName(),attr.getNodeValue(), writer,cache);
+                                 }
+                         }
+                         writer.write('>');
+                         sibling= currentNode.getFirstChild();
+                         if (sibling==null) {
+                                 writer.write(_END_TAG);
+-                                writeStringToUtf8(name,writer);
++                                UtfHelpper.writeStringToUtf8(name,writer);
+                                 writer.write('>');
+                                 //We fineshed with this level, pop to the previous definitions.
+                                 ns.outputNodePop();
+-                                if (parentNode != null) {
++                                    if (parentNode != null) {
+                                         sibling= currentNode.getNextSibling();
+-                                }
++                                    }
+                         } else {
+                                 parentNode=currentElement;
+                         }
+@@ -298,7 +324,7 @@
+                 }
+                 while (sibling==null  && parentNode!=null) {
+                         writer.write(_END_TAG);
+-                        writeStringToUtf8(((Element)parentNode).getTagName(),writer);
++                        UtfHelpper.writeByte(((Element)parentNode).getTagName(),writer,cache);
+                         writer.write('>');
+                         //We fineshed with this level, pop to the previous definitions.
+                         ns.outputNodePop();
+@@ -307,6 +333,7 @@
+                         sibling=parentNode.getNextSibling();
+                         parentNode=parentNode.getParentNode();
+                         if (parentNode !=null && parentNode.getNodeType() != Node.ELEMENT_NODE) {
++                                documentLevel=NODE_AFTER_DOCUMENT_ELEMENT;
+                                 parentNode=null;
+                         }
+                 }
+@@ -317,47 +344,8 @@
+         } while(true);
+     }
+ 
+-   /**
+-    * Checks whether a Comment or ProcessingInstruction is before or after the
+-    * document element. This is needed for prepending or appending "\n"s.
+-    *
+-    * @param currentNode comment or pi to check
+-    * @return NODE_BEFORE_DOCUMENT_ELEMENT, NODE_NOT_BEFORE_OR_AFTER_DOCUMENT_ELEMENT or NODE_AFTER_DOCUMENT_ELEMENT
+-    * @see #NODE_BEFORE_DOCUMENT_ELEMENT
+-    * @see #NODE_NOT_BEFORE_OR_AFTER_DOCUMENT_ELEMENT
+-    * @see #NODE_AFTER_DOCUMENT_ELEMENT
+-    */
+-   final static int getPositionRelativeToDocumentElement(Node currentNode) {
+ 
+-      if ((currentNode == null) ||
+-            (currentNode.getParentNode().getNodeType() != Node.DOCUMENT_NODE) ) {
+-         return CanonicalizerBase.NODE_NOT_BEFORE_OR_AFTER_DOCUMENT_ELEMENT;
+-      }
+-      Element documentElement = currentNode.getOwnerDocument().getDocumentElement();
+-      if ( (documentElement == null)  || (documentElement == currentNode) ){
+-         return CanonicalizerBase.NODE_NOT_BEFORE_OR_AFTER_DOCUMENT_ELEMENT;
+-      }
+ 
+-      for (Node x = currentNode; x != null; x = x.getNextSibling()) {
+-         if (x == documentElement) {
+-            return CanonicalizerBase.NODE_BEFORE_DOCUMENT_ELEMENT;
+-         }
+-      }
+-
+-      return CanonicalizerBase.NODE_AFTER_DOCUMENT_ELEMENT;
+-   }
+-
+-   /**
+-    * Method engineCanonicalizeXPathNodeSet
+-    * @inheritDoc
+-    * @param xpathNodeSet
+-    * @throws CanonicalizationException
+-    */
+-   public byte[] engineCanonicalizeXPathNodeSet(Set xpathNodeSet)
+-           throws CanonicalizationException {
+-           this._xpathNodeSet = xpathNodeSet;
+-           return engineCanonicalizeXPathNodeSetInternal(XMLUtils.getOwnerDocument(this._xpathNodeSet));
+-   }
+    private  byte[] engineCanonicalizeXPathNodeSetInternal(Node doc)
+            throws CanonicalizationException {
+ 
+@@ -370,6 +358,12 @@
+                 ((ByteArrayOutputStream)this._writer).reset();
+             }
+                 return sol;
++         }  else if (this._writer instanceof UnsyncByteArrayOutputStream) {
++                 byte []result=((UnsyncByteArrayOutputStream)this._writer).toByteArray();
++             if (reset) {
++                 ((UnsyncByteArrayOutputStream)this._writer).reset();
++             }
++                 return result;
+          }
+          return null;
+       } catch (UnsupportedEncodingException ex) {
+@@ -390,11 +384,17 @@
+     */
+    final void canonicalizeXPathNodeSet(Node currentNode,Node endnode )
+            throws CanonicalizationException, IOException {
+-           boolean currentNodeIsVisible = false;
+-           NameSpaceSymbTable ns=new  NameSpaceSymbTable();
++        if (isVisibleInt(currentNode)==-1)
++                return;
++        boolean currentNodeIsVisible = false;
++        NameSpaceSymbTable ns=new  NameSpaceSymbTable();
++        if (currentNode != null && currentNode.getNodeType() == Node.ELEMENT_NODE)
++                getParentNameSpaces((Element)currentNode,ns);
+         Node sibling=null;
+         Node parentNode=null;
+         OutputStream writer=this._writer;
++        int documentLevel=NODE_BEFORE_DOCUMENT_ELEMENT;
++        Map cache=new HashMap();
+         do {
+                 switch (currentNode.getNodeType()) {
+ 
+@@ -416,14 +416,14 @@
+                         break;
+ 
+                 case Node.COMMENT_NODE :
+-                        if (this._includeComments && isVisible(currentNode)) {
+-                                outputCommentToWriter((Comment) currentNode, writer);
++                        if (this._includeComments && (isVisibleDO(currentNode,ns.getLevel())==1)) {
++                                outputCommentToWriter((Comment) currentNode, writer, documentLevel);
+                         }
+                         break;
+ 
+                 case Node.PROCESSING_INSTRUCTION_NODE :
+                         if (isVisible(currentNode))
+-                                outputPItoWriter((ProcessingInstruction) currentNode, writer);
++                                outputPItoWriter((ProcessingInstruction) currentNode, writer, documentLevel);
+                         break;
+ 
+                 case Node.TEXT_NODE :
+@@ -436,12 +436,6 @@
+                         || (nextSibling.getNodeType()
+                             == Node.CDATA_SECTION_NODE));
+                     nextSibling = nextSibling.getNextSibling()) {
+-               /* The XPath data model allows to select only the first of a
+-                * sequence of mixed text and CDATA nodes. But we must output
+-                * them all, so we must search:
+-                *
+-                * @see http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6329
+-                */
+                outputTextToWriter(nextSibling.getNodeValue(), writer);
+                currentNode=nextSibling;
+                sibling=currentNode.getNextSibling();
+@@ -451,15 +445,21 @@
+                         break;
+ 
+                 case Node.ELEMENT_NODE :
++                        documentLevel=NODE_NOT_BEFORE_OR_AFTER_DOCUMENT_ELEMENT;
+                         Element currentElement = (Element) currentNode;
+                         //Add a level to the nssymbtable. So latter can be pop-back.
+                         String name=null;
+-                        currentNodeIsVisible=isVisible(currentNode);
++                        int i=isVisibleDO(currentNode,ns.getLevel());
++                        if (i==-1) {
++                                sibling= currentNode.getNextSibling();
++                                break;
++                        }
++                        currentNodeIsVisible=(i==1);
+                         if (currentNodeIsVisible) {
+                                 ns.outputNodePush();
+                                 writer.write('<');
+                                 name=currentElement.getTagName();
+-                                writeStringToUtf8(name,writer);
++                                UtfHelpper.writeByte(name,writer,cache);
+                         } else {
+                                 ns.push();
+                         }
+@@ -469,7 +469,7 @@
+                                 //we output all Attrs which are available
+                                 while (attrs.hasNext()) {
+                                         Attr attr = (Attr) attrs.next();
+-                                        outputAttrToWriter(attr.getNodeName(),attr.getNodeValue(), writer);
++                                        outputAttrToWriter(attr.getNodeName(),attr.getNodeValue(), writer,cache);
+                                 }
+                         }
+                         if (currentNodeIsVisible) {
+@@ -480,7 +480,7 @@
+                         if (sibling==null) {
+                                 if (currentNodeIsVisible) {
+                                         writer.write(_END_TAG);
+-                                        writeStringToUtf8(name,writer);
++                                        UtfHelpper.writeByte(name,writer,cache);
+                                         writer.write('>');
+                                         //We fineshed with this level, pop to the previous definitions.
+                                         ns.outputNodePop();
+@@ -498,7 +498,7 @@
+                 while (sibling==null  && parentNode!=null) {
+                         if (isVisible(parentNode)) {
+                                 writer.write(_END_TAG);
+-                                writeStringToUtf8(((Element)parentNode).getTagName(),writer);
++                                UtfHelpper.writeByte(((Element)parentNode).getTagName(),writer,cache);
+                                 writer.write('>');
+                                 //We fineshed with this level, pop to the previous definitions.
+                                 ns.outputNodePop();
+@@ -511,6 +511,7 @@
+                         parentNode=parentNode.getParentNode();
+                         if (parentNode != null && parentNode.getNodeType() != Node.ELEMENT_NODE) {
+                                 parentNode=null;
++                                documentLevel=NODE_AFTER_DOCUMENT_ELEMENT;
+                         }
+                 }
+                 if (sibling==null)
+@@ -519,12 +520,38 @@
+                 sibling=currentNode.getNextSibling();
+         } while(true);
+    }
++   int isVisibleDO(Node currentNode,int level) {
++           if (nodeFilter!=null) {
++                        Iterator it=nodeFilter.iterator();
++                        while (it.hasNext()) {
++                                int i=((NodeFilter)it.next()).isNodeIncludeDO(currentNode,level);
++                                if (i!=1)
++                                        return i;
++                        }
++                   }
++           if ((this._xpathNodeSet!=null) && !this._xpathNodeSet.contains(currentNode))
++                        return 0;
++           return 1;
++   }
++   int isVisibleInt(Node currentNode) {
++           if (nodeFilter!=null) {
++                Iterator it=nodeFilter.iterator();
++                while (it.hasNext()) {
++                        int i=((NodeFilter)it.next()).isNodeInclude(currentNode);
++                        if (i!=1)
++                                return i;
++                }
++           }
++                if ((this._xpathNodeSet!=null) && !this._xpathNodeSet.contains(currentNode))
++                        return 0;
++                return 1;
++        }
+ 
+    boolean isVisible(Node currentNode) {
+            if (nodeFilter!=null) {
+                 Iterator it=nodeFilter.iterator();
+                 while (it.hasNext()) {
+-                        if (!((NodeFilter)it.next()).isNodeInclude(currentNode))
++                        if (((NodeFilter)it.next()).isNodeInclude(currentNode)!=1)
+                                 return false;
+                 }
+            }
+@@ -533,13 +560,36 @@
+                 return true;
+         }
+ 
++        void handleParent(Element e,NameSpaceSymbTable ns) {
++           if (!e.hasAttributes()) {
++                                return;
++                }
++                NamedNodeMap attrs = e.getAttributes();
++                int attrsLength = attrs.getLength();
++                for (int i = 0; i < attrsLength; i++) {
++                        Attr N = (Attr) attrs.item(i);
++                        if (Constants.NamespaceSpecNS!=N.getNamespaceURI()) {
++                                //Not a namespace definition, ignore.
++                                continue;
++                        }
++
++                        String NName=N.getLocalName();
++                        String NValue=N.getNodeValue();
++                        if (XML.equals(NName)
++               && Constants.XML_LANG_SPACE_SpecNS.equals(NValue)) {
++                                        continue;
++                        }
++                        ns.addMapping(NName,NValue,N);
++                }
++   }
++
+         /**
+          * Adds to ns the definitons from the parent elements of el
+          * @param el
+          * @param ns
+          */
+-        final static void getParentNameSpaces(Element el,NameSpaceSymbTable ns)  {
+-                List parents=new ArrayList();
++        final void getParentNameSpaces(Element el,NameSpaceSymbTable ns)  {
++                List parents=new ArrayList(10);
+                 Node n1=el.getParentNode();
+                 if (n1 == null || n1.getNodeType() != Node.ELEMENT_NODE) {
+                         return;
+@@ -553,28 +603,9 @@
+                 //Visit them in reverse order.
+                 ListIterator it=parents.listIterator(parents.size());
+                 while (it.hasPrevious()) {
+-                Element ele=(Element)it.previous();
+-        if (!ele.hasAttributes()) {
+-                continue;
++                        Element ele=(Element)it.previous();
++                        handleParent(ele, ns);
+         }
+-                NamedNodeMap attrs = ele.getAttributes();
+-                int attrsLength = attrs.getLength();
+-                 for (int i = 0; i < attrsLength; i++) {
+-            Attr N = (Attr) attrs.item(i);
+-            if (!Constants.NamespaceSpecNS.equals(N.getNamespaceURI())) {
+-               //Not a namespace definition, ignore.
+-               continue;
+-            }
+-
+-            String NName=N.getLocalName();
+-            String NValue=N.getNodeValue();
+-            if (XML.equals(NName)
+-                    && Constants.XML_LANG_SPACE_SpecNS.equals(NValue)) {
+-               continue;
+-            }
+-            ns.addMapping(NName,NValue,N);
+-                 }
+-                }
+         Attr nsprefix;
+         if (((nsprefix=ns.getMappingWithoutRendered("xmlns"))!=null)
+                 && "".equals(nsprefix.getValue())) {
+@@ -582,269 +613,6 @@
+         }
+         }
+    /**
+-    * Outputs an Attribute to the internal Writer.
+-    *
+-    * The string value of the node is modified by replacing
+-    * <UL>
+-    * <LI>all ampersands (&) with <CODE>&amp;</CODE></LI>
+-    * <LI>all open angle brackets (<) with <CODE>&lt;</CODE></LI>
+-    * <LI>all quotation mark characters with <CODE>&quot;</CODE></LI>
+-    * <LI>and the whitespace characters <CODE>#x9</CODE>, #xA, and #xD, with character
+-    * references. The character references are written in uppercase
+-    * hexadecimal with no leading zeroes (for example, <CODE>#xD</CODE> is represented
+-    * by the character reference <CODE>&#xD;</CODE>)</LI>
+-    * </UL>
+-    *
+-    * @param name
+-    * @param value
+-    * @param writer
+-    * @throws IOException
+-    */
+-   static final void outputAttrToWriter(final String name, final String value, final OutputStream writer) throws IOException {
+-      writer.write(' ');
+-      writeStringToUtf8(name,writer);
+-      writer.write(equalsStr);
+-      byte  []toWrite;
+-      final int length = value.length();
+-      for (int i=0;i < length; i++) {
+-         char c = value.charAt(i);
+-
+-         switch (c) {
+-
+-         case '&' :
+-                toWrite=_AMP_;
+-            //writer.write(_AMP_);
+-            break;
+-
+-         case '<' :
+-                toWrite=_LT_;
+-            //writer.write(_LT_);
+-            break;
+-
+-         case '"' :
+-                toWrite=_QUOT_;
+-            //writer.write(_QUOT_);
+-            break;
+-
+-         case 0x09 :    // '\t'
+-                toWrite=__X9_;
+-            //writer.write(__X9_);
+-            break;
+-
+-         case 0x0A :    // '\n'
+-                toWrite=__XA_;
+-            //writer.write(__XA_);
+-            break;
+-
+-         case 0x0D :    // '\r'
+-                toWrite=__XD_;
+-            //writer.write(__XD_);
+-            break;
+-
+-         default :
+-            writeCharToUtf8(c,writer);
+-            //this._writer.write(c);
+-            continue;
+-         }
+-         writer.write(toWrite);
+-      }
+-
+-      writer.write('\"');
+-   }
+-
+-   final static void writeCharToUtf8(final char c,final OutputStream out) throws IOException{
+-        char ch;
+-        if (/*(c >= 0x0001) &&*/ (c <= 0x007F)) {
+-        out.write(c);
+-        return;
+-    }
+-    int bias;
+-    int write;
+-    if (c > 0x07FF) {
+-        ch=(char)(c>>>12);
+-        write=0xE0;
+-        if (ch>0) {
+-            write |= ( ch & 0x0F);
+-        }
+-        out.write(write);
+-        write=0x80;
+-        bias=0x3F;
+-    } else {
+-        write=0xC0;
+-        bias=0x1F;
+-    }
+-    ch=(char)(c>>>6);
+-    if (ch>0) {
+-         write|= (ch & bias);
+-    }
+-    out.write(write);
+-    out.write(0x80 | ((c) & 0x3F));
+-
+-   }
+-
+-   final static void writeStringToUtf8(final String str,final OutputStream out) throws IOException{
+-        final int length=str.length();
+-        int i=0;
+-    char c;
+-        while (i<length) {
+-                c=str.charAt(i++);
+-        if (/*(c >= 0x0001) &&*/ (c <= 0x007F)) {
+-            out.write(c);
+-            continue;
+-        }
+-        char ch;
+-        int bias;
+-        int write;
+-        if (c > 0x07FF) {
+-            ch=(char)(c>>>12);
+-            write=0xE0;
+-            if (ch>0) {
+-                write |= ( ch & 0x0F);
+-            }
+-            out.write(write);
+-            write=0x80;
+-            bias=0x3F;
+-        } else {
+-                write=0xC0;
+-                bias=0x1F;
+-        }
+-        ch=(char)(c>>>6);
+-        if (ch>0) {
+-             write|= (ch & bias);
+-        }
+-        out.write(write);
+-        out.write(0x80 | ((c) & 0x3F));
+-        continue;
+-
+-        }
+-
+-   }
+-   /**
+-    * Outputs a PI to the internal Writer.
+-    *
+-    * @param currentPI
+-    * @param writer where to write the things
+-    * @throws IOException
+-    */
+-   static final void outputPItoWriter(ProcessingInstruction currentPI, OutputStream writer) throws IOException {
+-          final int position = getPositionRelativeToDocumentElement(currentPI);
+-
+-      if (position == NODE_AFTER_DOCUMENT_ELEMENT) {
+-        writer.write('\n');
+-      }
+-      writer.write(_BEGIN_PI);
+-
+-      final String target = currentPI.getTarget();
+-      int length = target.length();
+-
+-      for (int i = 0; i < length; i++) {
+-         char c=target.charAt(i);
+-         if (c==0x0D) {
+-            writer.write(__XD_);
+-         } else {
+-            writeCharToUtf8(c,writer);
+-         }
+-      }
+-
+-      final String data = currentPI.getData();
+-
+-      length = data.length();
+-
+-      if (length > 0) {
+-         writer.write(' ');
+-
+-         for (int i = 0; i < length; i++) {
+-                char c=data.charAt(i);
+-            if (c==0x0D) {
+-               writer.write(__XD_);
+-            } else {
+-               writeCharToUtf8(c,writer);
+-            }
+-         }
+-      }
+-
+-      writer.write(_END_PI);
+-      if (position == NODE_BEFORE_DOCUMENT_ELEMENT) {
+-        writer.write('\n');
+-     }
+-   }
+-
+-   /**
+-    * Method outputCommentToWriter
+-    *
+-    * @param currentComment
+-    * @param writer writer where to write the things
+-    * @throws IOException
+-    */
+-   static final void outputCommentToWriter(Comment currentComment, OutputStream writer) throws IOException {
+-          final int position = getPositionRelativeToDocumentElement(currentComment);
+-          if (position == NODE_AFTER_DOCUMENT_ELEMENT) {
+-                writer.write('\n');
+-          }
+-      writer.write(_BEGIN_COMM);
+-
+-      final String data = currentComment.getData();
+-      final int length = data.length();
+-
+-      for (int i = 0; i < length; i++) {
+-         char c=data.charAt(i);
+-         if (c==0x0D) {
+-            writer.write(__XD_);
+-         } else {
+-            writeCharToUtf8(c,writer);
+-         }
+-      }
+-
+-      writer.write(_END_COMM);
+-      if (position == NODE_BEFORE_DOCUMENT_ELEMENT) {
+-                writer.write('\n');
+-         }
+-   }
+-
+-   /**
+-    * Outputs a Text of CDATA section to the internal Writer.
+-    *
+-    * @param text
+-    * @param writer writer where to write the things
+-    * @throws IOException
+-    */
+-   static final void outputTextToWriter(final String text, final OutputStream writer) throws IOException {
+-      final int length = text.length();
+-      byte []toWrite;
+-      for (int i = 0; i < length; i++) {
+-         char c = text.charAt(i);
+-
+-         switch (c) {
+-
+-         case '&' :
+-                toWrite=_AMP_;
+-            //writer.write(_AMP_);
+-            break;
+-
+-         case '<' :
+-                toWrite=_LT_;
+-            //writer.write(_LT_);
+-            break;
+-
+-         case '>' :
+-                toWrite=_GT_;
+-            //writer.write(_GT_);
+-            break;
+-
+-         case 0xD :
+-                toWrite=__XD_;
+-            //writer.write(__XD_);
+-            break;
+-
+-         default :
+-            writeCharToUtf8(c,writer);
+-            continue;
+-         }
+-         writer.write(toWrite);
+-      }
+-   }
+-
+-   /**
+     * Obtain the attributes to output for this node in XPathNodeSet c14n.
+     *
+     * @param E
+@@ -866,13 +634,207 @@
+    abstract Iterator handleAttributesSubtree(Element E, NameSpaceSymbTable ns)
+    throws CanonicalizationException;
+ 
++   abstract void circumventBugIfNeeded(XMLSignatureInput input) throws CanonicalizationException, ParserConfigurationException, IOException, SAXException;
+ 
++   /**
++            * Outputs an Attribute to the internal Writer.
++            *
++            * The string value of the node is modified by replacing
++            * <UL>
++            * <LI>all ampersands (&) with <CODE>&amp;</CODE></LI>
++            * <LI>all open angle brackets (<) with <CODE>&lt;</CODE></LI>
++            * <LI>all quotation mark characters with <CODE>&quot;</CODE></LI>
++            * <LI>and the whitespace characters <CODE>#x9</CODE>, #xA, and #xD, with character
++            * references. The character references are written in uppercase
++            * hexadecimal with no leading zeroes (for example, <CODE>#xD</CODE> is represented
++            * by the character reference <CODE>&#xD;</CODE>)</LI>
++            * </UL>
++            *
++            * @param name
++            * @param value
++            * @param writer
++            * @throws IOException
++            */
++           static final void outputAttrToWriter(final String name, final String value, final OutputStream writer,
++                                final Map cache) throws IOException {
++              writer.write(' ');
++              UtfHelpper.writeByte(name,writer,cache);
++              writer.write(equalsStr);
++              byte  []toWrite;
++              final int length = value.length();
++              int i=0;
++              while (i < length) {
++                 char c = value.charAt(i++);
+ 
+-    /**
+-     * @param _writer The _writer to set.
+-     */
+-    public void setWriter(OutputStream _writer) {
+-        this._writer = _writer;
+-    }
++                 switch (c) {
++
++                 case '&' :
++                        toWrite=_AMP_;
++                    break;
++
++                 case '<' :
++                        toWrite=_LT_;
++                    break;
++
++                 case '"' :
++                        toWrite=_QUOT_;
++                    break;
++
++                 case 0x09 :    // '\t'
++                        toWrite=__X9_;
++                    break;
++
++                 case 0x0A :    // '\n'
++                        toWrite=__XA_;
++                    break;
++
++                 case 0x0D :    // '\r'
++                        toWrite=__XD_;
++                    break;
++
++                 default :
++                        if (c < 0x80 ) {
++                                writer.write(c);
++                        } else {
++                                UtfHelpper.writeCharToUtf8(c,writer);
++                        };
++                    continue;
++                 }
++                 writer.write(toWrite);
++              }
++
++              writer.write('\"');
++           }
++
++        /**
++            * Outputs a PI to the internal Writer.
++            *
++            * @param currentPI
++            * @param writer where to write the things
++            * @throws IOException
++            */
++           static final void outputPItoWriter(ProcessingInstruction currentPI, OutputStream writer,int position) throws IOException {
++
++              if (position == NODE_AFTER_DOCUMENT_ELEMENT) {
++                writer.write('\n');
++              }
++              writer.write(_BEGIN_PI);
++
++              final String target = currentPI.getTarget();
++              int length = target.length();
++
++              for (int i = 0; i < length; i++) {
++                 char c=target.charAt(i);
++                 if (c==0x0D) {
++                    writer.write(__XD_);
++                 } else {
++                         if (c < 0x80)  {
++                                writer.write(c);
++                        } else {
++                                UtfHelpper.writeCharToUtf8(c,writer);
++                        };
++                 }
++              }
++
++              final String data = currentPI.getData();
++
++              length = data.length();
++
++              if (length > 0) {
++                 writer.write(' ');
++
++                 for (int i = 0; i < length; i++) {
++                        char c=data.charAt(i);
++                    if (c==0x0D) {
++                       writer.write(__XD_);
++                    } else {
++                        UtfHelpper.writeCharToUtf8(c,writer);
++                    }
++                 }
++              }
++
++              writer.write(_END_PI);
++              if (position == NODE_BEFORE_DOCUMENT_ELEMENT) {
++                writer.write('\n');
++             }
++           }
++
++           /**
++            * Method outputCommentToWriter
++            *
++            * @param currentComment
++            * @param writer writer where to write the things
++            * @throws IOException
++            */
++           static final void outputCommentToWriter(Comment currentComment, OutputStream writer,int position) throws IOException {
++                  if (position == NODE_AFTER_DOCUMENT_ELEMENT) {
++                        writer.write('\n');
++                  }
++              writer.write(_BEGIN_COMM);
++
++              final String data = currentComment.getData();
++              final int length = data.length();
++
++              for (int i = 0; i < length; i++) {
++                 char c=data.charAt(i);
++                 if (c==0x0D) {
++                    writer.write(__XD_);
++                 } else {
++                         if (c < 0x80)  {
++                                writer.write(c);
++                        } else {
++                                UtfHelpper.writeCharToUtf8(c,writer);
++                        };
++                 }
++              }
++
++              writer.write(_END_COMM);
++              if (position == NODE_BEFORE_DOCUMENT_ELEMENT) {
++                        writer.write('\n');
++                 }
++           }
++
++           /**
++            * Outputs a Text of CDATA section to the internal Writer.
++            *
++            * @param text
++            * @param writer writer where to write the things
++            * @throws IOException
++            */
++           static final void outputTextToWriter(final String text, final OutputStream writer) throws IOException {
++              final int length = text.length();
++              byte []toWrite;
++              for (int i = 0; i < length; i++) {
++                 char c = text.charAt(i);
++
++                 switch (c) {
++
++                 case '&' :
++                        toWrite=_AMP_;
++                    break;
++
++                 case '<' :
++                        toWrite=_LT_;
++                    break;
++
++                 case '>' :
++                        toWrite=_GT_;
++                    break;
++
++                 case 0xD :
++                        toWrite=__XD_;
++                    break;
++
++                 default :
++                         if (c < 0x80) {
++                                 writer.write(c);
++                         } else {
++                                 UtfHelpper.writeCharToUtf8(c,writer);
++                         };
++                    continue;
++                 }
++                 writer.write(toWrite);
++              }
++           }
+ 
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/NameSpaceSymbTable.java b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/NameSpaceSymbTable.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/NameSpaceSymbTable.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/NameSpaceSymbTable.java
+@@ -20,16 +20,10 @@
+  */
+ package com.sun.org.apache.xml.internal.security.c14n.implementations;
+ 
+-import java.lang.reflect.Array;
+-import java.util.AbstractList;
+ import java.util.ArrayList;
+-import java.util.Arrays;
+ import java.util.Collection;
+-import java.util.HashMap;
+ import java.util.Iterator;
+ import java.util.List;
+-import java.util.Map;
+-
+ 
+ 
+ import org.w3c.dom.Attr;
+@@ -46,21 +40,26 @@
+ public class NameSpaceSymbTable {
+ 
+         /**The map betwen prefix-> entry table. */
+-        SymbMap symb = new SymbMap();
++        SymbMap symb;
+         /**The level of nameSpaces (for Inclusive visibility).*/
+         int nameSpaces=0;
+         /**The stacks for removing the definitions when doing pop.*/
+-        List level = new ArrayList();
++        List level;
+     boolean cloned=true;
+         static final String XMLNS="xmlns";
++        final static SymbMap initialMap=new SymbMap();
++        static {
++                NameSpaceSymbEntry ne=new NameSpaceSymbEntry("",null,true,XMLNS);
++                ne.lastrendered="";
++                initialMap.put(XMLNS,ne);
++        }
+     /**
+      * Default constractor
+      **/
+     public NameSpaceSymbTable() {
++        level = new ArrayList(10);
+         //Insert the default binding for xmlns.
+-        NameSpaceSymbEntry ne=new NameSpaceSymbEntry("",null,true);
+-                ne.lastrendered="";
+-        symb.put(XMLNS,ne);
++        symb=(SymbMap) initialMap.clone();
+     }
+ 
+     /**
+@@ -75,8 +74,14 @@
+                         NameSpaceSymbEntry n=(NameSpaceSymbEntry)(it.next());
+                         //put them rendered?
+                         if ((!n.rendered) && (n.n!=null)) {
++                                n=(NameSpaceSymbEntry) n.clone();
++                needsClone();
++                symb.put(n.prefix,n);
++                n.lastrendered=n.uri;
++                n.rendered=true;
++
+                                 result.add(n.n);
+-                                n.rendered=true;
++
+                         }
+            }
+         }
+@@ -104,10 +109,6 @@
+      **/
+         public void push() {
+                 //Put the number of namespace definitions in the stack.
+-        /**if (cloned) {
+-                Object ob[]= {symb,cloned ? symb : null};
+-                level.add(ob);
+-        } **/
+         level.add(null);
+         cloned=false;
+         }
+@@ -124,7 +125,7 @@
+             if (size==0) {
+                cloned=false;
+             } else
+-            cloned=(level.get(size-1)!=symb);
++                cloned=(level.get(size-1)!=symb);
+         } else {
+                 cloned=false;
+         }
+@@ -134,8 +135,7 @@
+ 
+         final void needsClone() {
+                 if (!cloned) {
+-            level.remove(level.size()-1);
+-            level.add(symb);
++            level.set(level.size()-1,symb);
+                         symb=(SymbMap) symb.clone();
+             cloned=true;
+         }
+@@ -200,7 +200,7 @@
+                         return false;
+                 }
+                 //Creates and entry in the table for this new definition.
+-                NameSpaceSymbEntry ne=new NameSpaceSymbEntry(uri,n,false);
++                NameSpaceSymbEntry ne=new NameSpaceSymbEntry(uri,n,false,prefix);
+         needsClone();
+                 symb.put(prefix, ne);
+                 if (ob != null) {
+@@ -238,7 +238,7 @@
+             return null;
+         }
+ 
+-        NameSpaceSymbEntry ne=new NameSpaceSymbEntry(uri,n,true);
++        NameSpaceSymbEntry ne=new NameSpaceSymbEntry(uri,n,true,prefix);
+         ne.lastrendered=uri;
+         needsClone();
+         symb.put(prefix, ne);
+@@ -251,53 +251,38 @@
+         }
+         return ne.n;
+     }
+-        /**
+-     * Adds & gets(if needed) the attribute node that defines the binding for the prefix.
+-     * Take on account if the rules of rendering in the inclusive c14n.
+-     * For inclusive c14n.
+-     * @param prefix the prefix to obtain the attribute.
+-     * @param outputNode the container element is an output element.
+-     * @param uri the Uri of the definition
+-     * @param n the attribute that have the definition
+-     * @return null if there is no need to render the prefix. Otherwise the node of
+-     * definition.
+-     **/
+-        public Node addMappingAndRenderXNodeSet(String prefix, String uri,Attr n,boolean outputNode) {
++
++        public int getLevel() {
++                // TODO Auto-generated method stub
++                return level.size();
++        }
++
++        public void removeMapping(String prefix) {
+                 NameSpaceSymbEntry ob = symb.get(prefix);
+-                int visibleNameSpaces=nameSpaces;
+-                if ((ob!=null) && uri.equals(ob.uri)) {
+-                        if (!ob.rendered) {
+-                                ob=(NameSpaceSymbEntry)ob.clone();
+-                needsClone();
+-                symb.put(prefix,ob);
+-                                ob.rendered=true;
+-                                ob.level=visibleNameSpaces;
+-                                return ob.n;
+-                        }
+-            ob=(NameSpaceSymbEntry)ob.clone();
++
++        if (ob!=null) {
+             needsClone();
+-            symb.put(prefix,ob);
+-                        if (outputNode && (((visibleNameSpaces-ob.level)<2) || XMLNS.equals(prefix)) ) {
+-                                ob.level=visibleNameSpaces;
+-                                return null; //Already rendered, just return nulll
+-                        }
+-                        ob.level=visibleNameSpaces;
+-                        return ob.n;
+-                }
++            symb.put(prefix,null);
++        }
++        }
+ 
+-                NameSpaceSymbEntry ne=new NameSpaceSymbEntry(uri,n,true);
+-                ne.level=nameSpaces;
+-                ne.rendered=true;
+-        needsClone();
+-                symb.put(prefix, ne);
+-                if (ob != null) {
+-                        ne.lastrendered=ob.lastrendered;
++        public void removeMappingIfNotRender(String prefix) {
++                NameSpaceSymbEntry ob = symb.get(prefix);
+ 
+-                        if ((ob.lastrendered!=null)&& (ob.lastrendered.equals(uri))) {
+-                                ne.rendered=true;
+-                        }
+-                }
+-                return ne.n;
++        if (ob!=null && !ob.rendered) {
++            needsClone();
++            symb.put(prefix,null);
++        }
++        }
++
++        public boolean removeMappingIfRender(String prefix) {
++                NameSpaceSymbEntry ob = symb.get(prefix);
++
++        if (ob!=null && ob.rendered) {
++            needsClone();
++            symb.put(prefix,null);
++        }
++        return false;
+         }
+ }
+ 
+@@ -305,10 +290,11 @@
+  * The internal structure of NameSpaceSymbTable.
+  **/
+ class NameSpaceSymbEntry implements Cloneable {
+-    NameSpaceSymbEntry(String name,Attr n,boolean rendered) {
++    NameSpaceSymbEntry(String name,Attr n,boolean rendered,String prefix) {
+         this.uri=name;
+         this.rendered=rendered;
+         this.n=n;
++        this.prefix=prefix;
+     }
+     /** @inheritDoc */
+     public Object clone() {
+@@ -320,6 +306,7 @@
+     }
+     /** The level where the definition was rendered(Only for inclusive) */
+     int level=0;
++    String prefix;
+     /**The URI that the prefix defines */
+     String uri;
+     /**The last output in the URI for this prefix (This for speed reason).*/
+@@ -330,53 +317,57 @@
+     Attr n;
+ };
+ 
+-class SymbMap implements Cloneable{
+-        int free=23;
+-        NameSpaceSymbEntry[] entries=new NameSpaceSymbEntry[free];
+-        String[] keys=new String[free];
+-
+-        void put(String key, NameSpaceSymbEntry value) {
++class SymbMap implements Cloneable {
++    int free=23;
++    NameSpaceSymbEntry[] entries;
++    String[] keys;
++        SymbMap() {
++                entries=new NameSpaceSymbEntry[free];
++                keys=new String[free];
++        }
++    void put(String key, NameSpaceSymbEntry value) {
+         int index = index(key);
+-                Object oldKey = keys[index];
+-                keys[index] = key;
+-                entries[index] = value;
++        Object oldKey = keys[index];
++        keys[index] = key;
++        entries[index] = value;
+         if (oldKey==null || !oldKey.equals(key)) {
+-                if (--free == 0) {
+-                                free=entries.length;
+-                    int newCapacity = free<<2;
+-                    rehash(newCapacity);
+-                }
++            if (--free == 0) {
++                free=entries.length;
++                int newCapacity = free<<2;
++                rehash(newCapacity);
++            }
+         }
+     }
+ 
+     List entrySet() {
+-                List a=new ArrayList();
+-                for (int i=0;i<entries.length;i++) {
+-                        if ((entries[i]!=null) && !("".equals(entries[i]))) {
+-                                a.add(entries[i]);
+-                        }
+-                }
+-                return a;
++        List a=new ArrayList();
++        for (int i=0;i<entries.length;i++) {
++                if ((entries[i]!=null) && !("".equals(entries[i].uri))) {
++                        a.add(entries[i]);
++            }
+         }
++        return a;
++    }
+ 
+-
+-        protected int index(Object obj) {
++    protected int index(Object obj) {
+         Object[] set = keys;
+-                int length = set.length;
+-                //abs of index
++        int length = set.length;
++        //abs of index
+         int index = (obj.hashCode() & 0x7fffffff) %  length;
+         Object cur = set[index];
+ 
+         if (cur == null || (cur.equals( obj))) {
+-                        return index;
++                return index;
+         }
++        length=length-1;
+         do {
+-                        index=index==length? 0:++index;
+-                        cur = set[index];
++                index=index==length? 0:++index;
++                cur = set[index];
+         } while (cur != null && (!cur.equals(obj)));
+         return index;
+     }
+-         /**
++
++    /**
+      * rehashes the map to the new capacity.
+      *
+      * @param newCapacity an <code>int</code> value
+@@ -384,37 +375,38 @@
+     protected void rehash(int newCapacity) {
+         int oldCapacity = keys.length;
+         String oldKeys[] = keys;
+-                NameSpaceSymbEntry oldVals[] = entries;
++        NameSpaceSymbEntry oldVals[] = entries;
+ 
+-                keys = new String[newCapacity];
+-                entries = new NameSpaceSymbEntry[newCapacity];
++        keys = new String[newCapacity];
++        entries = new NameSpaceSymbEntry[newCapacity];
+ 
+         for (int i = oldCapacity; i-- > 0;) {
+             if(oldKeys[i] != null) {
+                 String o = oldKeys[i];
+                 int index = index(o);
+-                                keys[index] = o;
+-                                entries[index] = oldVals[i];
++                keys[index] = o;
++                entries[index] = oldVals[i];
+             }
+         }
+     }
+-         NameSpaceSymbEntry get(String key) {
+-                return  entries[index(key)];
+-            }
+-         protected Object clone()  {
+-                // TODO Auto-generated method stub
+-                try {
+-                        SymbMap copy=(SymbMap) super.clone();
+-                        copy.entries=new NameSpaceSymbEntry[entries.length];
+-                        System.arraycopy(entries,0,copy.entries,0,entries.length);
+-                        copy.keys=new String[keys.length];
+-                        System.arraycopy(keys,0,copy.keys,0,keys.length);
+ 
+-                        return copy;
+-                } catch (CloneNotSupportedException e) {
+-                        // TODO Auto-generated catch block
+-                        e.printStackTrace();
+-                }
+-                return null;
++    NameSpaceSymbEntry get(String key) {
++        return  entries[index(key)];
++    }
++
++    protected Object clone()  {
++        try {
++                SymbMap copy=(SymbMap) super.clone();
++                copy.entries=new NameSpaceSymbEntry[entries.length];
++                System.arraycopy(entries,0,copy.entries,0,entries.length);
++                copy.keys=new String[keys.length];
++                System.arraycopy(keys,0,copy.keys,0,keys.length);
++
++                return copy;
++        } catch (CloneNotSupportedException e) {
++            // TODO Auto-generated catch block
++            e.printStackTrace();
+         }
++        return null;
++    }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/UtfHelpper.java b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/UtfHelpper.java
+new file mode 100644
+--- /dev/null
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/UtfHelpper.java
+@@ -0,0 +1,155 @@
++package com.sun.org.apache.xml.internal.security.c14n.implementations;
++
++import java.io.IOException;
++import java.io.OutputStream;
++import java.util.Map;
++
++public class UtfHelpper {
++
++        final static void writeByte(final String str,final OutputStream out,Map cache) throws IOException {
++                   byte []result=(byte[]) cache.get(str);
++                   if (result==null) {
++                           result=getStringInUtf8(str);
++                           cache.put(str,result);
++                   }
++
++                   out.write(result);
++
++           }
++
++        final static void writeCharToUtf8(final char c,final OutputStream out) throws IOException{
++                if (c < 0x80) {
++                out.write(c);
++                return;
++            }
++                if ((c >= 0xD800 && c <= 0xDBFF) || (c >= 0xDC00 && c <= 0xDFFF) ){
++                //No Surrogates in sun java
++                out.write(0x3f);
++                return;
++        }
++            int bias;
++            int write;
++            char ch;
++            if (c > 0x07FF) {
++                ch=(char)(c>>>12);
++                write=0xE0;
++                if (ch>0) {
++                    write |= ( ch & 0x0F);
++                }
++                out.write(write);
++                write=0x80;
++                bias=0x3F;
++            } else {
++                write=0xC0;
++                bias=0x1F;
++            }
++            ch=(char)(c>>>6);
++            if (ch>0) {
++                 write|= (ch & bias);
++            }
++            out.write(write);
++            out.write(0x80 | ((c) & 0x3F));
++
++           }
++
++        final static void writeStringToUtf8(final String str,final OutputStream out) throws IOException{
++                final int length=str.length();
++                int i=0;
++            char c;
++                while (i<length) {
++                        c=str.charAt(i++);
++                if (c < 0x80)  {
++                    out.write(c);
++                    continue;
++                }
++                if ((c >= 0xD800 && c <= 0xDBFF) || (c >= 0xDC00 && c <= 0xDFFF) ){
++                        //No Surrogates in sun java
++                        out.write(0x3f);
++                        continue;
++                }
++                char ch;
++                int bias;
++                int write;
++                if (c > 0x07FF) {
++                    ch=(char)(c>>>12);
++                    write=0xE0;
++                    if (ch>0) {
++                        write |= ( ch & 0x0F);
++                    }
++                    out.write(write);
++                    write=0x80;
++                    bias=0x3F;
++                } else {
++                        write=0xC0;
++                        bias=0x1F;
++                }
++                ch=(char)(c>>>6);
++                if (ch>0) {
++                     write|= (ch & bias);
++                }
++                out.write(write);
++                out.write(0x80 | ((c) & 0x3F));
++
++                }
++
++           }
++        public final static byte[] getStringInUtf8(final String str) {
++                   final int length=str.length();
++                   boolean expanded=false;
++                   byte []result=new byte[length];
++                        int i=0;
++                        int out=0;
++                    char c;
++                        while (i<length) {
++                                c=str.charAt(i++);
++                        if ( c < 0x80 ) {
++                            result[out++]=(byte)c;
++                            continue;
++                        }
++                        if ((c >= 0xD800 && c <= 0xDBFF) || (c >= 0xDC00 && c <= 0xDFFF) ){
++                                   //No Surrogates in sun java
++                                   result[out++]=0x3f;
++
++                                continue;
++                        }
++                        if (!expanded) {
++                                byte newResult[]=new byte[3*length];
++                                        System.arraycopy(result, 0, newResult, 0, out);
++                                        result=newResult;
++                                        expanded=true;
++                        }
++                        char ch;
++                        int bias;
++                        byte write;
++                        if (c > 0x07FF) {
++                            ch=(char)(c>>>12);
++                            write=(byte)0xE0;
++                            if (ch>0) {
++                                write |= ( ch & 0x0F);
++                            }
++                            result[out++]=write;
++                            write=(byte)0x80;
++                            bias=0x3F;
++                        } else {
++                                write=(byte)0xC0;
++                                bias=0x1F;
++                        }
++                        ch=(char)(c>>>6);
++                        if (ch>0) {
++                             write|= (ch & bias);
++                        }
++                        result[out++]=write;
++                        result[out++]=(byte)(0x80 | ((c) & 0x3F));/**/
++
++                        }
++                        if (expanded) {
++                                byte newResult[]=new byte[out];
++                                System.arraycopy(result, 0, newResult, 0, out);
++                                result=newResult;
++                        }
++                        return result;
++           }
++
++
++
++}
+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
+@@ -22,6 +22,7 @@
+ 
+ 
+ import java.io.ByteArrayOutputStream;
++import java.io.InputStream;
+ import java.io.IOException;
+ import java.io.StringReader;
+ import java.io.UnsupportedEncodingException;
+@@ -30,6 +31,7 @@
+ import java.security.Key;
+ import java.security.NoSuchAlgorithmException;
+ import java.security.NoSuchProviderException;
++import java.util.HashMap;
+ import java.util.Iterator;
+ import java.util.LinkedList;
+ import java.util.List;
+@@ -204,7 +206,7 @@
+      * @since 1.0.
+      */
+     private XMLCipher() {
+-        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Constructing XMLCipher...");
++        logger.log(java.util.logging.Level.FINE, "Constructing XMLCipher...");
+ 
+         _factory = new Factory();
+         _serializer = new Serializer();
+@@ -266,7 +268,7 @@
+     public static XMLCipher getInstance(String transformation) throws
+             XMLEncryptionException {
+         // sanity checks
+-        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Getting XMLCipher...");
++        logger.log(java.util.logging.Level.FINE, "Getting XMLCipher...");
+         if (null == transformation)
+             logger.log(java.util.logging.Level.SEVERE, "Transformation unexpectedly null...");
+         if(!isValidEncryptionAlgorithm(transformation))
+@@ -294,7 +296,7 @@
+ 
+                 try {
+             instance._contextCipher = Cipher.getInstance(jceAlgorithm);
+-            if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "cihper.algoritm = " +
++            logger.log(java.util.logging.Level.FINE, "cihper.algoritm = " +
+                 instance._contextCipher.getAlgorithm());
+         } catch (NoSuchAlgorithmException nsae) {
+             throw new XMLEncryptionException("empty", nsae);
+@@ -305,49 +307,6 @@
+         return (instance);
+     }
+ 
+-    public static XMLCipher getInstance(String transformation,Cipher cipher) throws
+-            XMLEncryptionException {
+-        // sanity checks
+-        logger.log(java.util.logging.Level.FINE, "Getting XMLCipher...");
+-        if (null == transformation)
+-            logger.log(java.util.logging.Level.SEVERE, "Transformation unexpectedly null...");
+-        if(!isValidEncryptionAlgorithm(transformation))
+-            logger.log(java.util.logging.Level.WARNING, "Algorithm non-standard, expected one of " + ENC_ALGORITHMS);
+-
+-        XMLCipher instance = new XMLCipher();
+-
+-        instance._algorithm = transformation;
+-        instance._key = null;
+-        instance._kek = null;
+-
+-
+-                /* Create a canonicaliser - used when serialising DOM to octets
+-                 * prior to encryption (and for the reverse) */
+-
+-        try {
+-            instance._canon = Canonicalizer.getInstance
+-                    (Canonicalizer.ALGO_ID_C14N_WITH_COMMENTS);
+-
+-        } catch (InvalidCanonicalizerException ice) {
+-            throw new XMLEncryptionException("empty", ice);
+-        }
+-
+-        String jceAlgorithm = JCEMapper.translateURItoJCEID(transformation);
+-
+-        try {
+-            instance._contextCipher = cipher;
+-            //Cipher.getInstance(jceAlgorithm);
+-            logger.log(java.util.logging.Level.FINE, "cihper.algoritm = " +
+-                    instance._contextCipher.getAlgorithm());
+-        }catch(Exception ex) {
+-            throw new XMLEncryptionException("empty", ex);
+-        }
+-
+-        return (instance);
+-    }
+-
+-
+-
+         /**
+          * Returns an <code>XMLCipher</code> that implements the specified
+          * transformation, operates on the specified context document and serializes
+@@ -380,6 +339,45 @@
+                 return instance;
+         }
+ 
++    public static XMLCipher getInstance(String transformation,Cipher cipher) throws XMLEncryptionException {
++        // sanity checks
++        logger.log(java.util.logging.Level.FINE, "Getting XMLCipher...");
++        if (null == transformation)
++            logger.log(java.util.logging.Level.SEVERE, "Transformation unexpectedly null...");
++        if(!isValidEncryptionAlgorithm(transformation))
++            logger.log(java.util.logging.Level.WARNING, "Algorithm non-standard, expected one of " + ENC_ALGORITHMS);
++
++        XMLCipher instance = new XMLCipher();
++
++        instance._algorithm = transformation;
++        instance._key = null;
++        instance._kek = null;
++
++
++        /* Create a canonicaliser - used when serialising DOM to octets
++         * prior to encryption (and for the reverse) */
++
++        try {
++            instance._canon = Canonicalizer.getInstance
++                    (Canonicalizer.ALGO_ID_C14N_WITH_COMMENTS);
++
++        } catch (InvalidCanonicalizerException ice) {
++            throw new XMLEncryptionException("empty", ice);
++        }
++
++        String jceAlgorithm = JCEMapper.translateURItoJCEID(transformation);
++
++        try {
++            instance._contextCipher = cipher;
++            //Cipher.getInstance(jceAlgorithm);
++            logger.log(java.util.logging.Level.FINE, "cihper.algoritm = " +
++                    instance._contextCipher.getAlgorithm());
++        }catch(Exception ex) {
++            throw new XMLEncryptionException("empty", ex);
++        }
++
++        return (instance);
++    }
+ 
+     /**
+      * Returns an <code>XMLCipher</code> that implements the specified
+@@ -396,7 +394,7 @@
+     public static XMLCipher getProviderInstance(String transformation, String provider)
+             throws XMLEncryptionException {
+         // sanity checks
+-        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Getting XMLCipher...");
++        logger.log(java.util.logging.Level.FINE, "Getting XMLCipher...");
+         if (null == transformation)
+             logger.log(java.util.logging.Level.SEVERE, "Transformation unexpectedly null...");
+         if(null == provider)
+@@ -429,9 +427,9 @@
+ 
+             instance._contextCipher = Cipher.getInstance(jceAlgorithm, provider);
+ 
+-            if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "cipher._algorithm = " +
++            logger.log(java.util.logging.Level.FINE, "cipher._algorithm = " +
+                 instance._contextCipher.getAlgorithm());
+-            if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "provider.name = " + provider);
++            logger.log(java.util.logging.Level.FINE, "provider.name = " + provider);
+         } catch (NoSuchAlgorithmException nsae) {
+             throw new XMLEncryptionException("empty", nsae);
+         } catch (NoSuchProviderException nspre) {
+@@ -490,7 +488,7 @@
+     public static XMLCipher getInstance()
+             throws XMLEncryptionException {
+         // sanity checks
+-        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Getting XMLCipher for no transformation...");
++        logger.log(java.util.logging.Level.FINE, "Getting XMLCipher for no transformation...");
+ 
+                 XMLCipher instance = new XMLCipher();
+ 
+@@ -532,7 +530,7 @@
+             throws XMLEncryptionException {
+         // sanity checks
+ 
+-        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Getting XMLCipher, provider but no transformation");
++        logger.log(java.util.logging.Level.FINE, "Getting XMLCipher, provider but no transformation");
+         if(null == provider)
+             logger.log(java.util.logging.Level.SEVERE, "Provider unexpectedly null..");
+         if("" == provider)
+@@ -578,7 +576,7 @@
+      */
+     public void init(int opmode, Key key) throws XMLEncryptionException {
+         // sanity checks
+-        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Initializing XMLCipher...");
++        logger.log(java.util.logging.Level.FINE, "Initializing XMLCipher...");
+ 
+                 _ek = null;
+                 _ed = null;
+@@ -586,18 +584,18 @@
+                 switch (opmode) {
+ 
+                 case ENCRYPT_MODE :
+-                        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "opmode = ENCRYPT_MODE");
++                        logger.log(java.util.logging.Level.FINE, "opmode = ENCRYPT_MODE");
+                         _ed = createEncryptedData(CipherData.VALUE_TYPE, "NO VALUE YET");
+                         break;
+                 case DECRYPT_MODE :
+-                        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "opmode = DECRYPT_MODE");
++                        logger.log(java.util.logging.Level.FINE, "opmode = DECRYPT_MODE");
+                         break;
+                 case WRAP_MODE :
+-                        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "opmode = WRAP_MODE");
++                        logger.log(java.util.logging.Level.FINE, "opmode = WRAP_MODE");
+                         _ek = createEncryptedKey(CipherData.VALUE_TYPE, "NO VALUE YET");
+                         break;
+                 case UNWRAP_MODE :
+-                        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "opmode = UNWRAP_MODE");
++                        logger.log(java.util.logging.Level.FINE, "opmode = UNWRAP_MODE");
+                         break;
+                 default :
+                         logger.log(java.util.logging.Level.SEVERE, "Mode unexpectedly invalid");
+@@ -622,7 +620,7 @@
+         public EncryptedData getEncryptedData() {
+ 
+                 // Sanity checks
+-                if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Returning EncryptedData");
++                logger.log(java.util.logging.Level.FINE, "Returning EncryptedData");
+                 return _ed;
+ 
+         }
+@@ -640,7 +638,7 @@
+         public EncryptedKey getEncryptedKey() {
+ 
+                 // Sanity checks
+-                if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Returning EncryptedKey");
++                logger.log(java.util.logging.Level.FINE, "Returning EncryptedKey");
+                 return _ek;
+         }
+ 
+@@ -750,11 +748,11 @@
+      */
+ 
+     private Document encryptElement(Element element) throws Exception{
+-        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Encrypting element...");
++        logger.log(java.util.logging.Level.FINE, "Encrypting element...");
+         if(null == element)
+             logger.log(java.util.logging.Level.SEVERE, "Element unexpectedly null...");
+         if(_cipherMode != ENCRYPT_MODE)
+-            if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "XMLCipher unexpectedly not in ENCRYPT_MODE...");
++            logger.log(java.util.logging.Level.FINE, "XMLCipher unexpectedly not in ENCRYPT_MODE...");
+ 
+                 if (_algorithm == null) {
+                 throw new XMLEncryptionException("XMLCipher instance without transformation specified");
+@@ -785,11 +783,11 @@
+      */
+     private Document encryptElementContent(Element element) throws
+             /* XMLEncryption */Exception {
+-        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Encrypting element content...");
++        logger.log(java.util.logging.Level.FINE, "Encrypting element content...");
+         if(null == element)
+             logger.log(java.util.logging.Level.SEVERE, "Element unexpectedly null...");
+         if(_cipherMode != ENCRYPT_MODE)
+-            if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "XMLCipher unexpectedly not in ENCRYPT_MODE...");
++            logger.log(java.util.logging.Level.FINE, "XMLCipher unexpectedly not in ENCRYPT_MODE...");
+ 
+                 if (_algorithm == null) {
+                 throw new XMLEncryptionException("XMLCipher instance without transformation specified");
+@@ -815,7 +813,7 @@
+      */
+     public Document doFinal(Document context, Document source) throws
+             /* XMLEncryption */Exception {
+-        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Processing source document...");
++        logger.log(java.util.logging.Level.FINE, "Processing source document...");
+         if(null == context)
+             logger.log(java.util.logging.Level.SEVERE, "Context document unexpectedly null...");
+         if(null == source)
+@@ -855,7 +853,7 @@
+      */
+     public Document doFinal(Document context, Element element) throws
+             /* XMLEncryption */Exception {
+-        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Processing source element...");
++        logger.log(java.util.logging.Level.FINE, "Processing source element...");
+         if(null == context)
+             logger.log(java.util.logging.Level.SEVERE, "Context document unexpectedly null...");
+         if(null == element)
+@@ -898,7 +896,7 @@
+      */
+     public Document doFinal(Document context, Element element, boolean content)
+             throws /* XMLEncryption*/ Exception {
+-        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Processing source element...");
++        logger.log(java.util.logging.Level.FINE, "Processing source element...");
+         if(null == context)
+             logger.log(java.util.logging.Level.SEVERE, "Context document unexpectedly null...");
+         if(null == element)
+@@ -954,6 +952,34 @@
+ 
+     /**
+      * Returns an <code>EncryptedData</code> interface. Use this operation if
++     * you want to have full control over the serialization of the element
++     * or element content.
++     *
++     * This does not change the source document in any way.
++     *
++     * @param context the context <code>Document</code>.
++     * @param type a URI identifying type information about the plaintext form
++     *    of the encrypted content (may be <code>null</code>)
++     * @param serializedData the serialized data
++     * @return the <code>EncryptedData</code>
++     * @throws Exception
++     */
++    public EncryptedData encryptData(Document context, String type,
++        InputStream serializedData) throws Exception {
++
++        logger.log(java.util.logging.Level.FINE, "Encrypting element...");
++        if (null == context)
++            logger.log(java.util.logging.Level.SEVERE, "Context document unexpectedly null...");
++        if (null == serializedData)
++            logger.log(java.util.logging.Level.SEVERE, "Serialized data unexpectedly null...");
++        if (_cipherMode != ENCRYPT_MODE)
++            logger.log(java.util.logging.Level.FINE, "XMLCipher unexpectedly not in ENCRYPT_MODE...");
++
++        return encryptData(context, null, type, serializedData);
++    }
++
++    /**
++     * Returns an <code>EncryptedData</code> interface. Use this operation if
+      * you want to have full control over the contents of the
+      * <code>EncryptedData</code> structure.
+      *
+@@ -966,160 +992,60 @@
+      * @return the <code>EncryptedData</code>
+      * @throws Exception
+      */
+-    public EncryptedData encryptData(Document context, Element element, boolean contentMode) throws
+-            /* XMLEncryption */ Exception {
+-                if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Encrypting element...");
+-                if (null == context)
+-                        logger.log(java.util.logging.Level.SEVERE, "Context document unexpectedly null...");
+-                if (null == element)
+-                        logger.log(java.util.logging.Level.SEVERE, "Element unexpectedly null...");
+-                if (_cipherMode != ENCRYPT_MODE)
+-                        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "XMLCipher unexpectedly not in ENCRYPT_MODE...");
+-
+-                _contextDocument = context;
+-
+-                if (_algorithm == null) {
+-                        throw new XMLEncryptionException("XMLCipher instance without transformation specified");
+-                }
+-
+-                String serializedOctets = null;
+-                if (contentMode) {
+-                        NodeList children = element.getChildNodes();
+-                        if ((null != children)) {
+-                                serializedOctets = _serializer.serialize(children);
+-                        } else {
+-                                Object exArgs[] = { "Element has no content." };
+-                                throw new XMLEncryptionException("empty", exArgs);
+-                        }
+-                } else {
+-                        serializedOctets = _serializer.serialize(element);
+-                }
+-                if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Serialized octets:\n" + serializedOctets);
+-
+-        byte[] encryptedBytes = null;
+-
+-                // Now create the working cipher if none was created already
+-                Cipher c;
+-                if (_contextCipher == null) {
+-                        String jceAlgorithm =
+-                                JCEMapper.translateURItoJCEID(_algorithm);
+-
+-                        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "alg = " + jceAlgorithm);
+-
+-                        try {
+-                            if (_requestedJCEProvider == null)
+-                                c = Cipher.getInstance(jceAlgorithm);
+-                            else
+-                                c = Cipher.getInstance(jceAlgorithm, _requestedJCEProvider);
+-                        } catch (NoSuchAlgorithmException nsae) {
+-                                throw new XMLEncryptionException("empty", nsae);
+-                        } catch (NoSuchProviderException nspre) {
+-                                throw new XMLEncryptionException("empty", nspre);
+-                        } catch (NoSuchPaddingException nspae) {
+-                                throw new XMLEncryptionException("empty", nspae);
+-                        }
+-                }
+-                else {
+-                        c = _contextCipher;
+-                }
+-                // Now perform the encryption
+-
+-                try {
+-                        // Should internally generate an IV
+-                        // todo - allow user to set an IV
+-                        c.init(_cipherMode, _key);
+-                } catch (InvalidKeyException ike) {
+-                        throw new XMLEncryptionException("empty", ike);
+-                }
+-
+-        try {
+-            encryptedBytes =
+-                c.doFinal(serializedOctets.getBytes("UTF-8"));
+-
+-            if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Expected cipher.outputSize = " +
+-                Integer.toString(c.getOutputSize(
+-                    serializedOctets.getBytes().length)));
+-            if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Actual cipher.outputSize = " +
+-                Integer.toString(encryptedBytes.length));
+-        } catch (IllegalStateException ise) {
+-            throw new XMLEncryptionException("empty", ise);
+-        } catch (IllegalBlockSizeException ibse) {
+-            throw new XMLEncryptionException("empty", ibse);
+-        } catch (BadPaddingException bpe) {
+-            throw new XMLEncryptionException("empty", bpe);
+-        } catch (UnsupportedEncodingException uee) {
+-                        throw new XMLEncryptionException("empty", uee);
+-                }
+-
+-                // Now build up to a properly XML Encryption encoded octet stream
+-                // IvParameterSpec iv;
+-
+-                byte[] iv = c.getIV();
+-                byte[] finalEncryptedBytes =
+-                        new byte[iv.length + encryptedBytes.length];
+-                System.arraycopy(iv, 0, finalEncryptedBytes, 0,
+-                                                 iv.length);
+-                System.arraycopy(encryptedBytes, 0, finalEncryptedBytes,
+-                                                 iv.length,
+-                                                 encryptedBytes.length);
+-
+-        String base64EncodedEncryptedOctets = Base64.encode(finalEncryptedBytes);
+-
+-        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Encrypted octets:\n" + base64EncodedEncryptedOctets);
+-        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Encrypted octets length = " +
+-            base64EncodedEncryptedOctets.length());
+-
+-                try {
+-                        CipherData cd = _ed.getCipherData();
+-                        CipherValue cv = cd.getCipherValue();
+-                        // cv.setValue(base64EncodedEncryptedOctets.getBytes());
+-                        cv.setValue(base64EncodedEncryptedOctets);
+-
+-                        if (contentMode) {
+-                                _ed.setType(
+-                                        new URI(EncryptionConstants.TYPE_CONTENT).toString());
+-                        } else {
+-                                _ed.setType(
+-                                        new URI(EncryptionConstants.TYPE_ELEMENT).toString());
+-                        }
+-                        EncryptionMethod method =
+-                                _factory.newEncryptionMethod(new URI(_algorithm).toString());
+-                        _ed.setEncryptionMethod(method);
+-                } catch (URI.MalformedURIException mfue) {
+-                        throw new XMLEncryptionException("empty", mfue);
+-                }
+-        return (_ed);
+-    }
+-
+-
+-
+-    public EncryptedData encryptData(Document context, byte [] serializedOctets, boolean contentMode) throws
+-            /* XMLEncryption */ Exception {
++    public EncryptedData encryptData(
++        Document context, Element element, boolean contentMode)
++        throws /* XMLEncryption */ Exception {
++
+         logger.log(java.util.logging.Level.FINE, "Encrypting element...");
+         if (null == context)
+             logger.log(java.util.logging.Level.SEVERE, "Context document unexpectedly null...");
+-        if (null == serializedOctets)
+-            logger.log(java.util.logging.Level.SEVERE, "Canonicalized Data is unexpectedly null...");
++        if (null == element)
++            logger.log(java.util.logging.Level.SEVERE, "Element unexpectedly null...");
+         if (_cipherMode != ENCRYPT_MODE)
+             logger.log(java.util.logging.Level.FINE, "XMLCipher unexpectedly not in ENCRYPT_MODE...");
+ 
++        if (contentMode) {
++            return encryptData
++                (context, element, EncryptionConstants.TYPE_CONTENT, null);
++        } else {
++            return encryptData
++                (context, element, EncryptionConstants.TYPE_ELEMENT, null);
++        }
++    }
++
++    private EncryptedData encryptData(
++        Document context, Element element, String type,
++        InputStream serializedData) throws /* XMLEncryption */ Exception {
++
+         _contextDocument = context;
+ 
+         if (_algorithm == null) {
+-            throw new XMLEncryptionException("XMLCipher instance without transformation specified");
++            throw new XMLEncryptionException
++                ("XMLCipher instance without transformation specified");
+         }
+ 
+-
+-        logger.log(java.util.logging.Level.FINE, "Serialized octets:\n" + serializedOctets);
++        String serializedOctets = null;
++        if (serializedData == null) {
++            if (type == EncryptionConstants.TYPE_CONTENT) {
++                NodeList children = element.getChildNodes();
++                if (null != children) {
++                    serializedOctets = _serializer.serialize(children);
++                } else {
++                    Object exArgs[] = { "Element has no content." };
++                    throw new XMLEncryptionException("empty", exArgs);
++                }
++            } else {
++                serializedOctets = _serializer.serialize(element);
++            }
++            logger.log(java.util.logging.Level.FINE, "Serialized octets:\n" + serializedOctets);
++        }
+ 
+         byte[] encryptedBytes = null;
+ 
+         // Now create the working cipher if none was created already
+         Cipher c;
+         if (_contextCipher == null) {
+-            String jceAlgorithm =
+-                    JCEMapper.translateURItoJCEID(_algorithm);
+-
++            String jceAlgorithm = JCEMapper.translateURItoJCEID(_algorithm);
+             logger.log(java.util.logging.Level.FINE, "alg = " + jceAlgorithm);
+ 
+             try {
+@@ -1148,41 +1074,47 @@
+         }
+ 
+         try {
+-            encryptedBytes =
+-                    c.doFinal(serializedOctets);
+-
+-            logger.log(java.util.logging.Level.FINE, "Expected cipher.outputSize = " +
++            if (serializedData != null) {
++                int numBytes;
++                byte[] buf = new byte[8192];
++                ByteArrayOutputStream baos = new ByteArrayOutputStream();
++                while ((numBytes = serializedData.read(buf)) != -1) {
++                    byte[] data = c.update(buf, 0, numBytes);
++                    baos.write(data);
++                }
++                baos.write(c.doFinal());
++                encryptedBytes = baos.toByteArray();
++            } else {
++                encryptedBytes = c.doFinal(serializedOctets.getBytes("UTF-8"));
++                logger.log(java.util.logging.Level.FINE, "Expected cipher.outputSize = " +
+                     Integer.toString(c.getOutputSize(
+-                    serializedOctets.length)));
++                        serializedOctets.getBytes().length)));
++            }
+             logger.log(java.util.logging.Level.FINE, "Actual cipher.outputSize = " +
+-                    Integer.toString(encryptedBytes.length));
++                Integer.toString(encryptedBytes.length));
+         } catch (IllegalStateException ise) {
+             throw new XMLEncryptionException("empty", ise);
+         } catch (IllegalBlockSizeException ibse) {
+             throw new XMLEncryptionException("empty", ibse);
+         } catch (BadPaddingException bpe) {
+             throw new XMLEncryptionException("empty", bpe);
+-        } catch (Exception uee) {
++        } catch (UnsupportedEncodingException uee) {
+             throw new XMLEncryptionException("empty", uee);
+         }
+ 
+         // Now build up to a properly XML Encryption encoded octet stream
+         // IvParameterSpec iv;
+-
+         byte[] iv = c.getIV();
+         byte[] finalEncryptedBytes =
+                 new byte[iv.length + encryptedBytes.length];
+-        System.arraycopy(iv, 0, finalEncryptedBytes, 0,
+-                iv.length);
+-        System.arraycopy(encryptedBytes, 0, finalEncryptedBytes,
+-                iv.length,
+-                encryptedBytes.length);
+-
++        System.arraycopy(iv, 0, finalEncryptedBytes, 0, iv.length);
++        System.arraycopy(encryptedBytes, 0, finalEncryptedBytes, iv.length,
++                         encryptedBytes.length);
+         String base64EncodedEncryptedOctets = Base64.encode(finalEncryptedBytes);
+ 
+         logger.log(java.util.logging.Level.FINE, "Encrypted octets:\n" + base64EncodedEncryptedOctets);
+         logger.log(java.util.logging.Level.FINE, "Encrypted octets length = " +
+-                base64EncodedEncryptedOctets.length());
++            base64EncodedEncryptedOctets.length());
+ 
+         try {
+             CipherData cd = _ed.getCipherData();
+@@ -1190,15 +1122,11 @@
+             // cv.setValue(base64EncodedEncryptedOctets.getBytes());
+             cv.setValue(base64EncodedEncryptedOctets);
+ 
+-            if (contentMode) {
+-                _ed.setType(
+-                        new URI(EncryptionConstants.TYPE_CONTENT).toString());
+-            } else {
+-                _ed.setType(
+-                        new URI(EncryptionConstants.TYPE_ELEMENT).toString());
++            if (type != null) {
++                _ed.setType(new URI(type).toString());
+             }
+             EncryptionMethod method =
+-                    _factory.newEncryptionMethod(new URI(_algorithm).toString());
++                _factory.newEncryptionMethod(new URI(_algorithm).toString());
+             _ed.setEncryptionMethod(method);
+         } catch (URI.MalformedURIException mfue) {
+             throw new XMLEncryptionException("empty", mfue);
+@@ -1206,7 +1134,6 @@
+         return (_ed);
+     }
+ 
+-
+     /**
+      * Returns an <code>EncryptedData</code> interface. Use this operation if
+      * you want to load an <code>EncryptedData</code> structure from a DOM
+@@ -1219,7 +1146,7 @@
+      */
+     public EncryptedData loadEncryptedData(Document context, Element element)
+                 throws XMLEncryptionException {
+-        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Loading encrypted element...");
++        logger.log(java.util.logging.Level.FINE, "Loading encrypted element...");
+         if(null == context)
+             logger.log(java.util.logging.Level.SEVERE, "Context document unexpectedly null...");
+         if(null == element)
+@@ -1246,13 +1173,13 @@
+ 
+     public EncryptedKey loadEncryptedKey(Document context, Element element)
+                 throws XMLEncryptionException {
+-        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Loading encrypted key...");
++        logger.log(java.util.logging.Level.FINE, "Loading encrypted key...");
+         if(null == context)
+             logger.log(java.util.logging.Level.SEVERE, "Context document unexpectedly null...");
+         if(null == element)
+             logger.log(java.util.logging.Level.SEVERE, "Element unexpectedly null...");
+         if(_cipherMode != UNWRAP_MODE && _cipherMode != DECRYPT_MODE)
+-            if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "XMLCipher unexpectedly not in UNWRAP_MODE or DECRYPT_MODE...");
++            logger.log(java.util.logging.Level.FINE, "XMLCipher unexpectedly not in UNWRAP_MODE or DECRYPT_MODE...");
+ 
+         _contextDocument = context;
+         _ek = _factory.newEncryptedKey(element);
+@@ -1290,12 +1217,12 @@
+     public EncryptedKey encryptKey(Document doc, Key key) throws
+             XMLEncryptionException {
+ 
+-        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Encrypting key ...");
++        logger.log(java.util.logging.Level.FINE, "Encrypting key ...");
+ 
+         if(null == key)
+             logger.log(java.util.logging.Level.SEVERE, "Key unexpectedly null...");
+         if(_cipherMode != WRAP_MODE)
+-            if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "XMLCipher unexpectedly not in WRAP_MODE...");
++            logger.log(java.util.logging.Level.FINE, "XMLCipher unexpectedly not in WRAP_MODE...");
+ 
+                 if (_algorithm == null) {
+ 
+@@ -1313,7 +1240,7 @@
+                         String jceAlgorithm =
+                                 JCEMapper.translateURItoJCEID(_algorithm);
+ 
+-                        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "alg = " + jceAlgorithm);
++                        logger.log(java.util.logging.Level.FINE, "alg = " + jceAlgorithm);
+ 
+                         try {
+                             if (_requestedJCEProvider == null)
+@@ -1345,8 +1272,8 @@
+ 
+         String base64EncodedEncryptedOctets = Base64.encode(encryptedBytes);
+ 
+-        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Encrypted key octets:\n" + base64EncodedEncryptedOctets);
+-        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Encrypted key octets length = " +
++        logger.log(java.util.logging.Level.FINE, "Encrypted key octets:\n" + base64EncodedEncryptedOctets);
++        logger.log(java.util.logging.Level.FINE, "Encrypted key octets length = " +
+             base64EncodedEncryptedOctets.length());
+ 
+                 CipherValue cv = _ek.getCipherData().getCipherValue();
+@@ -1376,10 +1303,10 @@
+         public Key decryptKey(EncryptedKey encryptedKey, String algorithm) throws
+                     XMLEncryptionException {
+ 
+-        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Decrypting key from previously loaded EncryptedKey...");
++        logger.log(java.util.logging.Level.FINE, "Decrypting key from previously loaded EncryptedKey...");
+ 
+         if(_cipherMode != UNWRAP_MODE)
+-            if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "XMLCipher unexpectedly not in UNWRAP_MODE...");
++            logger.log(java.util.logging.Level.FINE, "XMLCipher unexpectedly not in UNWRAP_MODE...");
+ 
+                 if (algorithm == null) {
+                         throw new XMLEncryptionException("Cannot decrypt a key without knowing the algorithm");
+@@ -1387,7 +1314,7 @@
+ 
+                 if (_key == null) {
+ 
+-                        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Trying to find a KEK via key resolvers");
++                        logger.log(java.util.logging.Level.FINE, "Trying to find a KEK via key resolvers");
+ 
+                         KeyInfo ki = encryptedKey.getKeyInfo();
+                         if (ki != null) {
+@@ -1418,7 +1345,7 @@
+                                 JCEMapper.translateURItoJCEID(
+                                         encryptedKey.getEncryptionMethod().getAlgorithm());
+ 
+-                        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "JCE Algorithm = " + jceAlgorithm);
++                        logger.log(java.util.logging.Level.FINE, "JCE Algorithm = " + jceAlgorithm);
+ 
+                         try {
+                             if (_requestedJCEProvider == null)
+@@ -1448,7 +1375,7 @@
+                         throw new XMLEncryptionException("empty", nsae);
+                 }
+ 
+-                if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Decryption of key type " + algorithm + " OK");
++                logger.log(java.util.logging.Level.FINE, "Decryption of key type " + algorithm + " OK");
+ 
+                 return ret;
+ 
+@@ -1478,14 +1405,9 @@
+      *
+      * @param node the <code>Node</code> to clear.
+      */
+-    private void removeContent(Node node) {
+-        NodeList list = node.getChildNodes();
+-        if (list.getLength() > 0) {
+-            Node n = list.item(0);
+-            if (null != n) {
+-                n.getParentNode().removeChild(n);
+-            }
+-            removeContent(node);
++    private static void removeContent(Node node) {
++       while (node.hasChildNodes()) {
++            node.removeChild(node.getFirstChild());
+         }
+     }
+ 
+@@ -1499,7 +1421,7 @@
+     private Document decryptElement(Element element) throws
+             XMLEncryptionException {
+ 
+-        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Decrypting element...");
++        logger.log(java.util.logging.Level.FINE, "Decrypting element...");
+ 
+         if(_cipherMode != DECRYPT_MODE)
+             logger.log(java.util.logging.Level.SEVERE, "XMLCipher unexpectedly not in DECRYPT_MODE...");
+@@ -1512,7 +1434,7 @@
+                 }
+ 
+ 
+-        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Decrypted octets:\n" + octets);
++        logger.log(java.util.logging.Level.FINE, "Decrypted octets:\n" + octets);
+ 
+         Node sourceParent =  element.getParentNode();
+ 
+@@ -1573,7 +1495,7 @@
+         public byte[] decryptToByteArray(Element element)
+                 throws XMLEncryptionException {
+ 
+-        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Decrypting to ByteArray...");
++        logger.log(java.util.logging.Level.FINE, "Decrypting to ByteArray...");
+ 
+         if(_cipherMode != DECRYPT_MODE)
+             logger.log(java.util.logging.Level.SEVERE, "XMLCipher unexpectedly not in DECRYPT_MODE...");
+@@ -2226,7 +2148,7 @@
+         AgreementMethod newAgreementMethod(Element element) throws
+                 XMLEncryptionException {
+             if (null == element) {
+-                //complain
++                throw new NullPointerException("element is null");
+             }
+ 
+             String algorithm = element.getAttributeNS(null,
+@@ -2292,7 +2214,7 @@
+         CipherData newCipherData(Element element) throws
+                 XMLEncryptionException {
+             if (null == element) {
+-                // complain
++                throw new NullPointerException("element is null");
+             }
+ 
+             int type = 0;
+@@ -2352,7 +2274,7 @@
+                                 (Element) transformsElements.item(0);
+ 
+                         if (transformsElement != null) {
+-                                if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Creating a DSIG based Transforms element");
++                                logger.log(java.util.logging.Level.FINE, "Creating a DSIG based Transforms element");
+                                 try {
+                                         result.setTransforms(new TransformsImpl(transformsElement));
+                                 }
+@@ -2411,34 +2333,28 @@
+                         XMLEncryptionException {
+             EncryptedData result = null;
+ 
+-                        NodeList dataElements = element.getElementsByTagNameNS(
+-                    EncryptionConstants.EncryptionSpecNS,
+-                    EncryptionConstants._TAG_CIPHERDATA);
+-
+-                        // Need to get the last CipherData found, as earlier ones will
+-                        // be for elements in the KeyInfo lists
++            NodeList dataElements = element.getElementsByTagNameNS(
++                EncryptionConstants.EncryptionSpecNS,
++                EncryptionConstants._TAG_CIPHERDATA);
++
++            // Need to get the last CipherData found, as earlier ones will
++            // be for elements in the KeyInfo lists
+ 
+             Element dataElement =
+-                                (Element) dataElements.item(dataElements.getLength() - 1);
++                (Element) dataElements.item(dataElements.getLength() - 1);
+ 
+             CipherData data = newCipherData(dataElement);
+ 
+             result = newEncryptedData(data);
+ 
+-            try {
+-                result.setId(element.getAttributeNS(
+-                    null, EncryptionConstants._ATT_ID));
+-                result.setType(new URI(
+-                    element.getAttributeNS(
+-                        null, EncryptionConstants._ATT_TYPE)).toString());
+-                result.setMimeType(element.getAttributeNS(
+-                    null, EncryptionConstants._ATT_MIMETYPE));
+-                result.setEncoding(new URI(
+-                    element.getAttributeNS(
+-                        null, Constants._ATT_ENCODING)).toString());
+-            } catch (URI.MalformedURIException mfue) {
+-                // do nothing
+-            }
++            result.setId(element.getAttributeNS(
++                null, EncryptionConstants._ATT_ID));
++            result.setType(
++                element.getAttributeNS(null, EncryptionConstants._ATT_TYPE));
++            result.setMimeType(element.getAttributeNS(
++                null, EncryptionConstants._ATT_MIMETYPE));
++            result.setEncoding(
++                element.getAttributeNS(null, Constants._ATT_ENCODING));
+ 
+             Element encryptionMethodElement =
+                 (Element) element.getElementsByTagNameNS(
+@@ -2450,18 +2366,18 @@
+             }
+ 
+             // BFL 16/7/03 - simple implementation
+-                        // TODO: Work out how to handle relative URI
++            // TODO: Work out how to handle relative URI
+ 
+             Element keyInfoElement =
+                 (Element) element.getElementsByTagNameNS(
+                     Constants.SignatureSpecNS, Constants._TAG_KEYINFO).item(0);
+             if (null != keyInfoElement) {
+-                                try {
+-                                        result.setKeyInfo(new KeyInfo(keyInfoElement, null));
+-                                } catch (XMLSecurityException xse) {
+-                                        throw new XMLEncryptionException("Error loading Key Info",
+-                                                                                                         xse);
+-                                }
++                try {
++                    result.setKeyInfo(new KeyInfo(keyInfoElement, null));
++                } catch (XMLSecurityException xse) {
++                    throw new XMLEncryptionException("Error loading Key Info",
++                                                     xse);
++                }
+             }
+ 
+             // TODO: Implement
+@@ -2511,31 +2427,25 @@
+         EncryptedKey newEncryptedKey(Element element) throws
+                 XMLEncryptionException {
+             EncryptedKey result = null;
+-                        NodeList dataElements = element.getElementsByTagNameNS(
+-                    EncryptionConstants.EncryptionSpecNS,
+-                    EncryptionConstants._TAG_CIPHERDATA);
++            NodeList dataElements = element.getElementsByTagNameNS(
++                EncryptionConstants.EncryptionSpecNS,
++                EncryptionConstants._TAG_CIPHERDATA);
+             Element dataElement =
+-                                (Element) dataElements.item(dataElements.getLength() - 1);
++                (Element) dataElements.item(dataElements.getLength() - 1);
+ 
+             CipherData data = newCipherData(dataElement);
+             result = newEncryptedKey(data);
+ 
+-            try {
+-                result.setId(element.getAttributeNS(
+-                    null, EncryptionConstants._ATT_ID));
+-                result.setType(new URI(
+-                    element.getAttributeNS(
+-                        null, EncryptionConstants._ATT_TYPE)).toString());
+-                result.setMimeType(element.getAttributeNS(
+-                    null, EncryptionConstants._ATT_MIMETYPE));
+-                result.setEncoding(new URI(
+-                    element.getAttributeNS(
+-                        null, Constants._ATT_ENCODING)).toString());
+-                result.setRecipient(element.getAttributeNS(
+-                    null, EncryptionConstants._ATT_RECIPIENT));
+-            } catch (URI.MalformedURIException mfue) {
+-                // do nothing
+-            }
++            result.setId(element.getAttributeNS(
++                null, EncryptionConstants._ATT_ID));
++            result.setType(
++                element.getAttributeNS(null, EncryptionConstants._ATT_TYPE));
++            result.setMimeType(element.getAttributeNS(
++                null, EncryptionConstants._ATT_MIMETYPE));
++            result.setEncoding(
++                element.getAttributeNS(null, Constants._ATT_ENCODING));
++            result.setRecipient(element.getAttributeNS(
++                null, EncryptionConstants._ATT_RECIPIENT));
+ 
+             Element encryptionMethodElement =
+                 (Element) element.getElementsByTagNameNS(
+@@ -2550,12 +2460,12 @@
+                 (Element) element.getElementsByTagNameNS(
+                     Constants.SignatureSpecNS, Constants._TAG_KEYINFO).item(0);
+             if (null != keyInfoElement) {
+-                                try {
+-                                        result.setKeyInfo(new KeyInfo(keyInfoElement, null));
+-                                } catch (XMLSecurityException xse) {
+-                                        throw new XMLEncryptionException("Error loading Key Info",
+-                                                                                                         xse);
+-                                }
++                try {
++                    result.setKeyInfo(new KeyInfo(keyInfoElement, null));
++                } catch (XMLSecurityException xse) {
++                    throw new XMLEncryptionException
++                        ("Error loading Key Info", xse);
++                }
+             }
+ 
+             // TODO: Implement
+@@ -2581,7 +2491,8 @@
+                     EncryptionConstants.EncryptionSpecNS,
+                     EncryptionConstants._TAG_CARRIEDKEYNAME).item(0);
+             if (null != carriedNameElement) {
+-                result.setCarriedName(carriedNameElement.getNodeValue());
++                result.setCarriedName
++                    (carriedNameElement.getFirstChild().getNodeValue());
+             }
+ 
+             return (result);
+@@ -2680,13 +2591,8 @@
+         EncryptionProperty newEncryptionProperty(Element element) {
+             EncryptionProperty result = newEncryptionProperty();
+ 
+-            try {
+-                result.setTarget(new URI(
+-                    element.getAttributeNS(
+-                        null, EncryptionConstants._ATT_TARGET)).toString());
+-            } catch (URI.MalformedURIException mfue) {
+-                // do nothing
+-            }
++            result.setTarget(
++                element.getAttributeNS(null, EncryptionConstants._ATT_TARGET));
+             result.setId(element.getAttributeNS(
+                 null, EncryptionConstants._ATT_ID));
+             // TODO: Make this lot work...
+@@ -2943,7 +2849,7 @@
+                 } catch (URI.MalformedURIException mfue) {
+                     //complain
+                 }
+-                algorithm = tmpAlgorithm.toString();
++                algorithmURI = tmpAlgorithm.toString();
+             }
+ 
+             // <element name="AgreementMethod" type="xenc:AgreementMethodType"/>
+@@ -3183,7 +3089,7 @@
+                     _contextDocument, EncryptionConstants.EncryptionSpecNS,
+                     EncryptionConstants._TAG_CIPHERVALUE);
+                 result.appendChild(_contextDocument.createTextNode(
+-                    new String(cipherValue)));
++                    cipherValue));
+ 
+                 return (result);
+             }
+@@ -3247,8 +3153,7 @@
+                 }
+                 if (null != super.getType()) {
+                     result.setAttributeNS(
+-                        null, EncryptionConstants._ATT_TYPE,
+-                        super.getType().toString());
++                        null, EncryptionConstants._ATT_TYPE, super.getType());
+                 }
+                 if (null != super.getMimeType()) {
+                     result.setAttributeNS(
+@@ -3258,7 +3163,7 @@
+                 if (null != super.getEncoding()) {
+                     result.setAttributeNS(
+                         null, EncryptionConstants._ATT_ENCODING,
+-                        super.getEncoding().toString());
++                        super.getEncoding());
+                 }
+                 if (null != super.getEncryptionMethod()) {
+                     result.appendChild(((EncryptionMethodImpl)
+@@ -3383,8 +3288,7 @@
+                 }
+                 if (null != super.getType()) {
+                     result.setAttributeNS(
+-                        null, EncryptionConstants._ATT_TYPE,
+-                        super.getType().toString());
++                        null, EncryptionConstants._ATT_TYPE, super.getType());
+                 }
+                 if (null != super.getMimeType()) {
+                     result.setAttributeNS(null,
+@@ -3392,7 +3296,7 @@
+                 }
+                 if (null != super.getEncoding()) {
+                     result.setAttributeNS(null, Constants._ATT_ENCODING,
+-                        super.getEncoding().toString());
++                        super.getEncoding());
+                 }
+                 if (null != getRecipient()) {
+                     result.setAttributeNS(null,
+@@ -3468,13 +3372,17 @@
+              * @param type
+              */
+             public void setType(String type) {
+-                URI tmpType = null;
+-                try {
+-                    tmpType = new URI(type);
+-                } catch (URI.MalformedURIException mfue) {
+-                    // complain
++                if (type == null || type.length() == 0) {
++                    this.type = null;
++                } else {
++                    URI tmpType = null;
++                    try {
++                        tmpType = new URI(type);
++                    } catch (URI.MalformedURIException mfue) {
++                        // complain
++                    }
++                    this.type = tmpType.toString();
+                 }
+-                this.type = tmpType.toString();
+             }
+             /**
+              *
+@@ -3502,13 +3410,17 @@
+              * @param encoding
+              */
+             public void setEncoding(String encoding) {
+-                URI tmpEncoding = null;
+-                try {
+-                    tmpEncoding = new URI(encoding);
+-                } catch (URI.MalformedURIException mfue) {
+-                    // complain
++                if (encoding == null || encoding.length() == 0) {
++                    this.encoding = null;
++                } else {
++                    URI tmpEncoding = null;
++                    try {
++                        tmpEncoding = new URI(encoding);
++                    } catch (URI.MalformedURIException mfue) {
++                        // complain
++                    }
++                    this.encoding = tmpEncoding.toString();
+                 }
+-                this.encoding = tmpEncoding.toString();
+             }
+             /**
+              *
+@@ -3635,7 +3547,7 @@
+                     _contextDocument, EncryptionConstants.EncryptionSpecNS,
+                     EncryptionConstants._TAG_ENCRYPTIONMETHOD);
+                 result.setAttributeNS(null, EncryptionConstants._ATT_ALGORITHM,
+-                    algorithm.toString());
++                    algorithm);
+                 if (keySize > 0) {
+                     result.appendChild(
+                         ElementProxy.createElementForFamily(_contextDocument,
+@@ -3735,8 +3647,7 @@
+         private class EncryptionPropertyImpl implements EncryptionProperty {
+             private String target = null;
+             private String id = null;
+-            private String attributeName = null;
+-            private String attributeValue = null;
++            private HashMap attributeMap = new HashMap();
+             private List encryptionInformation = null;
+ 
+             /**
+@@ -3752,13 +3663,24 @@
+             }
+             /** @inheritDoc */
+             public void setTarget(String target) {
+-                URI tmpTarget = null;
+-                try {
+-                    tmpTarget = new URI(target);
+-                } catch (URI.MalformedURIException mfue) {
+-                    // complain
++                if (target == null || target.length() == 0) {
++                    this.target = null;
++                } else if (target.startsWith("#")) {
++                    /*
++                     * This is a same document URI reference. Do not parse,
++                     * because com.sun.org.apache.xml.internal.utils.URI considers this an
++                     * illegal URI because it has no scheme.
++                     */
++                    this.target = target;
++                } else {
++                    URI tmpTarget = null;
++                    try {
++                        tmpTarget = new URI(target);
++                    } catch (URI.MalformedURIException mfue) {
++                        // complain
++                    }
++                    this.target = tmpTarget.toString();
+                 }
+-                this.target = tmpTarget.toString();
+             }
+             /** @inheritDoc */
+             public String getId() {
+@@ -3770,12 +3692,11 @@
+             }
+             /** @inheritDoc */
+             public String getAttribute(String attribute) {
+-                return (attributeValue);
++                return (String) attributeMap.get(attribute);
+             }
+             /** @inheritDoc */
+             public void setAttribute(String attribute, String value) {
+-                attributeName = attribute;
+-                attributeValue = value;
++                attributeMap.put(attribute, value);
+             }
+             /** @inheritDoc */
+             public Iterator getEncryptionInformation() {
+@@ -3805,7 +3726,7 @@
+                     EncryptionConstants._TAG_ENCRYPTIONPROPERTY);
+                 if (null != target) {
+                     result.setAttributeNS(null, EncryptionConstants._ATT_TARGET,
+-                        target.toString());
++                        target);
+                 }
+                 if (null != id) {
+                     result.setAttributeNS(null, EncryptionConstants._ATT_ID,
+@@ -3839,7 +3760,13 @@
+                          * @param doc
+                          */
+                         public TransformsImpl(Document doc) {
+-                                super(doc);
++                                if (doc == null) {
++                                 throw new RuntimeException("Document is null");
++                              }
++
++                              this._doc = doc;
++                              this._constructionElement =  createElementForFamilyLocal(this._doc,
++                                          this.getBaseNamespace(), this.getBaseLocalName());
+                         }
+                         /**
+              *
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/XMLCipherInput.java b/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/XMLCipherInput.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/XMLCipherInput.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/XMLCipherInput.java
+@@ -108,84 +108,78 @@
+                 return null;
+         }
+ 
+-        /**
+-         * Internal method to get bytes in decryption mode
++    /**
++     * Internal method to get bytes in decryption mode
+      * @return the decripted bytes
+      * @throws XMLEncryptionException
+-         */
++     */
++    private byte[] getDecryptBytes() throws XMLEncryptionException {
+ 
+-        private byte[] getDecryptBytes() throws XMLEncryptionException {
+-
+-                String base64EncodedEncryptedOctets = null;
++        String base64EncodedEncryptedOctets = null;
+ 
+         if (_cipherData.getDataType() == CipherData.REFERENCE_TYPE) {
+-                        // Fun time!
+-                        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Found a reference type CipherData");
+-                        CipherReference cr = _cipherData.getCipherReference();
++            // Fun time!
++            logger.log(java.util.logging.Level.FINE, "Found a reference type CipherData");
++            CipherReference cr = _cipherData.getCipherReference();
+ 
+-                        // Need to wrap the uri in an Attribute node so that we can
+-                        // Pass to the resource resolvers
++            // Need to wrap the uri in an Attribute node so that we can
++            // Pass to the resource resolvers
+ 
+-                        Attr uriAttr = cr.getURIAsAttr();
+-                        XMLSignatureInput input = null;
++            Attr uriAttr = cr.getURIAsAttr();
++            XMLSignatureInput input = null;
+ 
+-                        try {
+-                                ResourceResolver resolver =
+-                                        ResourceResolver.getInstance(uriAttr, null);
+-                                input = resolver.resolve(uriAttr, null);
+-                        } catch (ResourceResolverException ex) {
+-                                throw new XMLEncryptionException("empty", ex);
+-                        }
++            try {
++                ResourceResolver resolver =
++                    ResourceResolver.getInstance(uriAttr, null);
++                input = resolver.resolve(uriAttr, null);
++            } catch (ResourceResolverException ex) {
++                throw new XMLEncryptionException("empty", ex);
++            }
+ 
+-                        if (input != null) {
+-                                if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Managed to resolve URI \"" + cr.getURI() + "\"");
+-                        }
+-                        else {
+-                                if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Failed to resolve URI \"" + cr.getURI() + "\"");
+-                        }
++            if (input != null) {
++                logger.log(java.util.logging.Level.FINE, "Managed to resolve URI \"" + cr.getURI() + "\"");
++            } else {
++                logger.log(java.util.logging.Level.FINE, "Failed to resolve URI \"" + cr.getURI() + "\"");
++            }
+ 
+-                        // Lets see if there are any transforms
+-                        Transforms transforms = cr.getTransforms();
+-                        if (transforms != null) {
+-                                if (logger.isLoggable(java.util.logging.Level.FINE))                                  logger.log(java.util.logging.Level.FINE, "Have transforms in cipher reference");
+-                                try {
+-                                    com.sun.org.apache.xml.internal.security.transforms.Transforms dsTransforms =
+-                                                transforms.getDSTransforms();
+-                                    input =     dsTransforms.performTransforms(input);
+-                                } catch (TransformationException ex) {
+-                                        throw new XMLEncryptionException("empty", ex);
+-                                }
+-                        }
++            // Lets see if there are any transforms
++            Transforms transforms = cr.getTransforms();
++            if (transforms != null) {
++                logger.log(java.util.logging.Level.FINE, "Have transforms in cipher reference");
++                try {
++                    com.sun.org.apache.xml.internal.security.transforms.Transforms dsTransforms =
++                        transforms.getDSTransforms();
++                    input = dsTransforms.performTransforms(input);
++                } catch (TransformationException ex) {
++                    throw new XMLEncryptionException("empty", ex);
++                }
++            }
+ 
+-                        try {
+-                                return input.getBytes();
+-                        }
+-                        catch (IOException ex) {
+-                                throw new XMLEncryptionException("empty", ex);
+-                        } catch (CanonicalizationException ex) {
+-                                throw new XMLEncryptionException("empty", ex);
+-                        }
++            try {
++                return input.getBytes();
++            } catch (IOException ex) {
++                throw new XMLEncryptionException("empty", ex);
++            } catch (CanonicalizationException ex) {
++                throw new XMLEncryptionException("empty", ex);
++            }
+ 
+-            // retrieve the cipher text
++        // retrieve the cipher text
+         } else if (_cipherData.getDataType() == CipherData.VALUE_TYPE) {
+-            CipherValue cv = _cipherData.getCipherValue();
+-            base64EncodedEncryptedOctets = new String(cv.getValue());
++            base64EncodedEncryptedOctets =
++                _cipherData.getCipherValue().getValue();
+         } else {
+-                        throw new XMLEncryptionException("CipherData.getDataType() returned unexpected value");
+-                }
++            throw new XMLEncryptionException("CipherData.getDataType() returned unexpected value");
++        }
+ 
+-        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Encrypted octets:\n" + base64EncodedEncryptedOctets);
++        logger.log(java.util.logging.Level.FINE, "Encrypted octets:\n" + base64EncodedEncryptedOctets);
+ 
+         byte[] encryptedBytes = null;
+-
+         try {
+-                        encryptedBytes = Base64.decode(base64EncodedEncryptedOctets);
++            encryptedBytes = Base64.decode(base64EncodedEncryptedOctets);
+         } catch (Base64DecodingException bde) {
+             throw new XMLEncryptionException("empty", bde);
+         }
+ 
+-                return (encryptedBytes);
+-
+-        }
+-
++        return (encryptedBytes);
++    }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/ContentHandlerAlreadyRegisteredException.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/ContentHandlerAlreadyRegisteredException.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/ContentHandlerAlreadyRegisteredException.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/ContentHandlerAlreadyRegisteredException.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -28,7 +27,7 @@
+ 
+ /**
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class ContentHandlerAlreadyRegisteredException
+         extends XMLSecurityException {
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/KeyInfo.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/KeyInfo.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/KeyInfo.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/KeyInfo.java
+@@ -25,6 +25,8 @@
+ import java.security.PublicKey;
+ import java.security.cert.X509Certificate;
+ import java.util.ArrayList;
++import java.util.Collections;
++import java.util.Iterator;
+ import java.util.List;
+ 
+ import javax.crypto.SecretKey;
+@@ -88,15 +90,22 @@
+  * The <CODE>containsXXX()</CODE> methods return <I>whether</I> the KeyInfo
+  * contains the corresponding type.
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class KeyInfo extends SignatureElementProxy {
+ 
+    /** {@link java.util.logging} logging facility */
+     static java.util.logging.Logger log =
+         java.util.logging.Logger.getLogger(KeyInfo.class.getName());
++    List x509Datas=null;
++    List encryptedKeys=null;
+ 
+-
++    static final List nullList;
++    static {
++        List list = new ArrayList();
++        list.add(null);
++        nullList = Collections.unmodifiableList(list);
++    }
+ 
+    /**
+     * Constructor KeyInfo
+@@ -108,7 +117,6 @@
+ 
+       XMLUtils.addReturnToElement(this._constructionElement);
+ 
+-
+    }
+ 
+    /**
+@@ -119,8 +127,8 @@
+     * @throws XMLSecurityException
+     */
+    public KeyInfo(Element element, String BaseURI) throws XMLSecurityException {
+-
+       super(element, BaseURI);
++     // _storageResolvers.add(null);
+ 
+    }
+ 
+@@ -131,7 +139,7 @@
+     */
+    public void setId(String Id) {
+ 
+-      if ((this._state == MODE_SIGN) && (Id != null)) {
++      if ((Id != null)) {
+          this._constructionElement.setAttributeNS(null, Constants._ATT_ID, Id);
+          IdResolver.registerElementById(this._constructionElement, Id);
+       }
+@@ -162,10 +170,8 @@
+     */
+    public void add(KeyName keyname) {
+ 
+-      if (this._state == MODE_SIGN) {
+          this._constructionElement.appendChild(keyname.getElement());
+          XMLUtils.addReturnToElement(this._constructionElement);
+-      }
+    }
+ 
+    /**
+@@ -219,11 +225,8 @@
+     * @param keyvalue
+     */
+    public void add(KeyValue keyvalue) {
+-
+-      if (this._state == MODE_SIGN) {
+          this._constructionElement.appendChild(keyvalue.getElement());
+          XMLUtils.addReturnToElement(this._constructionElement);
+-      }
+    }
+ 
+    /**
+@@ -241,11 +244,8 @@
+     * @param mgmtdata
+     */
+    public void add(MgmtData mgmtdata) {
+-
+-      if (this._state == MODE_SIGN) {
+          this._constructionElement.appendChild(mgmtdata.getElement());
+          XMLUtils.addReturnToElement(this._constructionElement);
+-      }
+    }
+ 
+    /**
+@@ -254,11 +254,8 @@
+     * @param pgpdata
+     */
+    public void add(PGPData pgpdata) {
+-
+-      if (this._state == MODE_SIGN) {
+          this._constructionElement.appendChild(pgpdata.getElement());
+          XMLUtils.addReturnToElement(this._constructionElement);
+-      }
+    }
+ 
+    /**
+@@ -279,11 +276,8 @@
+     * @param retrievalmethod
+     */
+    public void add(RetrievalMethod retrievalmethod) {
+-
+-      if (this._state == MODE_SIGN) {
+          this._constructionElement.appendChild(retrievalmethod.getElement());
+          XMLUtils.addReturnToElement(this._constructionElement);
+-      }
+    }
+ 
+    /**
+@@ -292,11 +286,8 @@
+     * @param spkidata
+     */
+    public void add(SPKIData spkidata) {
+-
+-      if (this._state == MODE_SIGN) {
+          this._constructionElement.appendChild(spkidata.getElement());
+          XMLUtils.addReturnToElement(this._constructionElement);
+-      }
+    }
+ 
+    /**
+@@ -305,11 +296,11 @@
+     * @param x509data
+     */
+    public void add(X509Data x509data) {
+-
+-      if (this._state == MODE_SIGN) {
++          if (x509Datas==null)
++                  x509Datas=new ArrayList();
++          x509Datas.add(x509data);
+          this._constructionElement.appendChild(x509data.getElement());
+          XMLUtils.addReturnToElement(this._constructionElement);
+-      }
+    }
+ 
+         /**
+@@ -321,12 +312,11 @@
+ 
+         public void add(EncryptedKey encryptedKey)
+                 throws XMLEncryptionException {
+-
+-                if (this._state == MODE_SIGN) {
++                        if (encryptedKeys==null)
++                                encryptedKeys=new ArrayList();
++                        encryptedKeys.add(encryptedKey);
+                         XMLCipher cipher = XMLCipher.getInstance();
+                         this._constructionElement.appendChild(cipher.martial(encryptedKey));
+-                }
+-
+         }
+ 
+    /**
+@@ -335,11 +325,8 @@
+     * @param element
+     */
+    public void addUnknownElement(Element element) {
+-
+-      if (this._state == MODE_SIGN) {
+          this._constructionElement.appendChild(element);
+          XMLUtils.addReturnToElement(this._constructionElement);
+-      }
+    }
+ 
+    /**
+@@ -403,6 +390,9 @@
+     *@return the number of the X509Data tags
+     */
+    public int lengthX509Data() {
++           if (x509Datas!=null) {
++                   return x509Datas.size();
++           }
+       return this.length(Constants.SignatureSpecNS, Constants._TAG_X509DATA);
+    }
+ 
+@@ -550,7 +540,9 @@
+     * @throws XMLSecurityException
+     */
+    public X509Data itemX509Data(int i) throws XMLSecurityException {
+-
++           if (x509Datas!=null) {
++                   return (X509Data) x509Datas.get(i);
++           }
+       Element e = XMLUtils.selectDsNode(this._constructionElement.getFirstChild(),
+                                                 Constants._TAG_X509DATA,i);
+ 
+@@ -569,7 +561,9 @@
+         */
+ 
+         public EncryptedKey itemEncryptedKey(int i) throws XMLSecurityException {
+-
++                if (encryptedKeys!=null) {
++                        return (EncryptedKey) encryptedKeys.get(i);
++                }
+                 Element e =
+                         XMLUtils.selectXencNode(this._constructionElement.getFirstChild(),
+                                                                                   EncryptionConstants._TAG_ENCRYPTEDKEY,i);
+@@ -707,20 +701,20 @@
+       PublicKey pk = this.getPublicKeyFromInternalResolvers();
+ 
+       if (pk != null) {
+-         if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "I could find a key using the per-KeyInfo key resolvers");
++         log.log(java.util.logging.Level.FINE, "I could find a key using the per-KeyInfo key resolvers");
+ 
+          return pk;
+       }
+-      if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "I couldn't find a key using the per-KeyInfo key resolvers");
++      log.log(java.util.logging.Level.FINE, "I couldn't find a key using the per-KeyInfo key resolvers");
+ 
+       pk = this.getPublicKeyFromStaticResolvers();
+ 
+       if (pk != null) {
+-         if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "I could find a key using the system-wide key resolvers");
++         log.log(java.util.logging.Level.FINE, "I could find a key using the system-wide key resolvers");
+ 
+          return pk;
+       }
+-      if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "I couldn't find a key using the system-wide key resolvers");
++      log.log(java.util.logging.Level.FINE, "I couldn't find a key using the system-wide key resolvers");
+ 
+       return null;
+    }
+@@ -732,46 +726,29 @@
+     * @throws KeyResolverException
+     */
+    PublicKey getPublicKeyFromStaticResolvers() throws KeyResolverException {
+-
+-      for (int i = 0; i < KeyResolver.length(); i++) {
+-         KeyResolver keyResolver = KeyResolver.item(i);
++          int length=KeyResolver.length();
++          int storageLength=this._storageResolvers.size();
++          Iterator it= KeyResolver.iterator();
++      for (int i = 0; i < length; i++) {
++         KeyResolverSpi keyResolver = (KeyResolverSpi) it.next();
+          Node currentChild=this._constructionElement.getFirstChild();
++         String uri= this.getBaseURI();
+          while (currentChild!=null)      {
+             if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
+-               if (this._storageResolvers.size() == 0) {
+-
+-                  // if we do not have storage resolvers, we verify with null
+-                  StorageResolver storage = null;
+-
+-                  if (keyResolver.canResolve((Element) currentChild,
+-                                             this.getBaseURI(), storage)) {
+-                     PublicKey pk =
+-                        keyResolver.resolvePublicKey((Element) currentChild,
+-                                                     this.getBaseURI(),
+-                                                     storage);
+-
+-                     if (pk != null) {
+-                        return pk;
+-                     }
+-                  }
+-               } else {
+-                  for (int k = 0; k < this._storageResolvers.size(); k++) {
++                  for (int k = 0; k < storageLength; k++) {
+                      StorageResolver storage =
+                         (StorageResolver) this._storageResolvers.get(k);
+ 
+-                     if (keyResolver.canResolve((Element) currentChild,
+-                                                this.getBaseURI(), storage)) {
+-                        PublicKey pk =
+-                           keyResolver.resolvePublicKey((Element) currentChild,
+-                                                        this.getBaseURI(),
++                     PublicKey pk =
++                           keyResolver.engineLookupAndResolvePublicKey((Element) currentChild,
++                                                       uri,
+                                                         storage);
+ 
+-                        if (pk != null) {
+-                           return pk;
+-                        }
++                     if (pk != null) {
++                         KeyResolver.hit(it);
++                         return pk;
+                      }
+                   }
+-               }
+             }
+             currentChild=currentChild.getNextSibling();
+          }
+@@ -786,50 +763,27 @@
+     * @throws KeyResolverException
+     */
+    PublicKey getPublicKeyFromInternalResolvers() throws KeyResolverException {
+-
+-      for (int i = 0; i < this.lengthInternalKeyResolver(); i++) {
++          int length=lengthInternalKeyResolver();
++          int storageLength=this._storageResolvers.size();
++      for (int i = 0; i < length; i++) {
+          KeyResolverSpi keyResolver = this.itemInternalKeyResolver(i);
+-         if (true)
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Try " + keyResolver.getClass().getName());
++         if (log.isLoggable(java.util.logging.Level.FINE))
++                log.log(java.util.logging.Level.FINE, "Try " + keyResolver.getClass().getName());
+ 
+          Node currentChild=this._constructionElement.getFirstChild();
++         String uri=this.getBaseURI();
+          while (currentChild!=null)      {
+             if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
+-               if (this._storageResolvers.size() == 0) {
+-
+-                  // if we do not have storage resolvers, we verify with null
+-                  StorageResolver storage = null;
+-
+-                  if (keyResolver.engineCanResolve((Element) currentChild,
+-                                                   this.getBaseURI(),
+-                                                   storage)) {
+-                     PublicKey pk =
+-                        keyResolver
+-                           .engineResolvePublicKey((Element) currentChild, this
+-                              .getBaseURI(), storage);
++               for (int k = 0; k < storageLength; k++) {
++                   StorageResolver storage =
++                      (StorageResolver) this._storageResolvers.get(k);
++                   PublicKey pk = keyResolver
++                           .engineLookupAndResolvePublicKey((Element) currentChild, uri, storage);
+ 
+                      if (pk != null) {
+-                        return pk;
++                         return pk;
+                      }
+                   }
+-               } else {
+-                  for (int k = 0; k < this._storageResolvers.size(); k++) {
+-                     StorageResolver storage =
+-                        (StorageResolver) this._storageResolvers.get(k);
+-
+-                     if (keyResolver.engineCanResolve((Element) currentChild,
+-                                                      this.getBaseURI(),
+-                                                      storage)) {
+-                        PublicKey pk = keyResolver
+-                           .engineResolvePublicKey((Element) currentChild, this
+-                              .getBaseURI(), storage);
+-
+-                        if (pk != null) {
+-                           return pk;
+-                        }
+-                     }
+-                  }
+-               }
+             }
+             currentChild=currentChild.getNextSibling();
+          }
+@@ -850,12 +804,12 @@
+       X509Certificate cert = this.getX509CertificateFromInternalResolvers();
+ 
+       if (cert != null) {
+-         if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE,
++         log.log(java.util.logging.Level.FINE,
+             "I could find a X509Certificate using the per-KeyInfo key resolvers");
+ 
+          return cert;
+       }
+-      if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE,
++      log.log(java.util.logging.Level.FINE,
+             "I couldn't find a X509Certificate using the per-KeyInfo key resolvers");
+ 
+ 
+@@ -863,12 +817,12 @@
+       cert = this.getX509CertificateFromStaticResolvers();
+ 
+       if (cert != null) {
+-         if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE,
++         log.log(java.util.logging.Level.FINE,
+             "I could find a X509Certificate using the system-wide key resolvers");
+ 
+          return cert;
+       }
+-      if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE,
++      log.log(java.util.logging.Level.FINE,
+             "I couldn't find a X509Certificate using the system-wide key resolvers");
+ 
+ 
+@@ -885,53 +839,44 @@
+     */
+    X509Certificate getX509CertificateFromStaticResolvers()
+            throws KeyResolverException {
+-      if (true)
+-        if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Start getX509CertificateFromStaticResolvers() with "
++      if (log.isLoggable(java.util.logging.Level.FINE))
++        log.log(java.util.logging.Level.FINE, "Start getX509CertificateFromStaticResolvers() with "
+                 + KeyResolver.length() + " resolvers");
++      String uri=this.getBaseURI();
++      int length= KeyResolver.length();
++      int storageLength=this._storageResolvers.size();
++      Iterator it = KeyResolver.iterator();
++      for (int i = 0; i <length; i++) {
++         KeyResolverSpi keyResolver = (KeyResolverSpi) it.next();
++         X509Certificate cert= applyCurrentResolver(uri, storageLength, keyResolver);
++         if (cert!=null) {
++                 KeyResolver.hit(it);
++                 return cert;
++         }
++      }
++      return null;
++   }
+ 
+-      for (int i = 0; i < KeyResolver.length(); i++) {
+-         KeyResolver keyResolver = KeyResolver.item(i);
+-         Node currentChild=this._constructionElement.getFirstChild();
+-         while (currentChild!=null)      {
+-            if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
+-               if (this._storageResolvers.size() == 0) {
++   private X509Certificate applyCurrentResolver(String uri, int storageLength, KeyResolverSpi keyResolver) throws KeyResolverException {
++           Node currentChild=this._constructionElement.getFirstChild();
++           while (currentChild!=null)      {
++                   if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
++               for (int k = 0; k < storageLength; k++) {
++                   StorageResolver storage =
++                      (StorageResolver) this._storageResolvers.get(k);
+ 
+-                  // if we do not have storage resolvers, we verify with null
+-                  StorageResolver storage = null;
++                   X509Certificate cert = keyResolver
++                        .engineLookupResolveX509Certificate((Element) currentChild, uri,
++                                        storage);
+ 
+-                  if (keyResolver.canResolve((Element) currentChild,
+-                                             this.getBaseURI(), storage)) {
+-                     X509Certificate cert =
+-                        keyResolver
+-                           .resolveX509Certificate((Element) currentChild, this
+-                              .getBaseURI(), storage);
+-
+-                     if (cert != null) {
+-                        return cert;
+-                     }
+-                  }
+-               } else {
+-                  for (int k = 0; k < this._storageResolvers.size(); k++) {
+-                     StorageResolver storage =
+-                        (StorageResolver) this._storageResolvers.get(k);
+-
+-                     if (keyResolver.canResolve((Element) currentChild,
+-                                                this.getBaseURI(), storage)) {
+-                        X509Certificate cert = keyResolver
+-                           .resolveX509Certificate((Element) currentChild, this
+-                              .getBaseURI(), storage);
+-
+-                        if (cert != null) {
+-                           return cert;
+-                        }
+-                     }
++                   if (cert != null) {
++                       return cert;
+                   }
+                }
+             }
+             currentChild=currentChild.getNextSibling();
+          }
+-      }
+-      return null;
++         return null;
+    }
+ 
+    /**
+@@ -942,55 +887,18 @@
+     */
+    X509Certificate getX509CertificateFromInternalResolvers()
+            throws KeyResolverException {
+-      if (true)
+-        if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Start getX509CertificateFromInternalResolvers() with "
++      if (log.isLoggable(java.util.logging.Level.FINE))
++        log.log(java.util.logging.Level.FINE, "Start getX509CertificateFromInternalResolvers() with "
+                 + this.lengthInternalKeyResolver() + " resolvers");
+-
++      String uri=this.getBaseURI();
++      int storageLength=this._storageResolvers.size();
+       for (int i = 0; i < this.lengthInternalKeyResolver(); i++) {
+          KeyResolverSpi keyResolver = this.itemInternalKeyResolver(i);
+-         if (true)
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Try " + keyResolver.getClass().getName());
+-
+-         Node currentChild=this._constructionElement.getFirstChild();
+-         while (currentChild!=null)      {
+-            if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
+-               if (this._storageResolvers.size() == 0) {
+-
+-                  // if we do not have storage resolvers, we verify with null
+-                  StorageResolver storage = null;
+-
+-                  if (keyResolver.engineCanResolve((Element) currentChild,
+-                                                   this.getBaseURI(),
+-                                                   storage)) {
+-                     X509Certificate cert =
+-                        keyResolver.engineResolveX509Certificate(
+-                           (Element) currentChild, this.getBaseURI(), storage);
+-
+-                     if (cert != null) {
+-                        return cert;
+-                     }
+-                  }
+-               } else {
+-                  for (int k = 0; k < this._storageResolvers.size(); k++) {
+-                     StorageResolver storage =
+-                        (StorageResolver) this._storageResolvers.get(k);
+-
+-                     if (keyResolver.engineCanResolve((Element) currentChild,
+-                                                      this.getBaseURI(),
+-                                                      storage)) {
+-                        X509Certificate cert =
+-                           keyResolver.engineResolveX509Certificate(
+-                              (Element) currentChild, this.getBaseURI(),
+-                              storage);
+-
+-                        if (cert != null) {
+-                           return cert;
+-                        }
+-                     }
+-                  }
+-               }
+-            }
+-            currentChild=currentChild.getNextSibling();
++         if (log.isLoggable(java.util.logging.Level.FINE))
++                log.log(java.util.logging.Level.FINE, "Try " + keyResolver.getClass().getName());
++         X509Certificate cert= applyCurrentResolver(uri, storageLength, keyResolver);
++         if (cert!=null) {
++                 return cert;
+          }
+       }
+ 
+@@ -1006,21 +914,21 @@
+       SecretKey sk = this.getSecretKeyFromInternalResolvers();
+ 
+       if (sk != null) {
+-         if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "I could find a secret key using the per-KeyInfo key resolvers");
++         log.log(java.util.logging.Level.FINE, "I could find a secret key using the per-KeyInfo key resolvers");
+ 
+          return sk;
+       }
+-      if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "I couldn't find a secret key using the per-KeyInfo key resolvers");
++      log.log(java.util.logging.Level.FINE, "I couldn't find a secret key using the per-KeyInfo key resolvers");
+ 
+ 
+       sk = this.getSecretKeyFromStaticResolvers();
+ 
+       if (sk != null) {
+-         if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "I could find a secret key using the system-wide key resolvers");
++         log.log(java.util.logging.Level.FINE, "I could find a secret key using the system-wide key resolvers");
+ 
+          return sk;
+       }
+-      if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "I couldn't find a secret key using the system-wide key resolvers");
++      log.log(java.util.logging.Level.FINE, "I couldn't find a secret key using the system-wide key resolvers");
+ 
+ 
+       return null;
+@@ -1034,47 +942,29 @@
+     */
+ 
+    SecretKey getSecretKeyFromStaticResolvers() throws KeyResolverException {
+-
+-      for (int i = 0; i < KeyResolver.length(); i++) {
+-         KeyResolver keyResolver = KeyResolver.item(i);
++          final int length=KeyResolver.length();
++          int storageLength=this._storageResolvers.size();
++          Iterator it = KeyResolver.iterator();
++      for (int i = 0; i < length; i++) {
++         KeyResolverSpi keyResolver = (KeyResolverSpi) it.next();
+ 
+          Node currentChild=this._constructionElement.getFirstChild();
++         String uri=this.getBaseURI();
+          while (currentChild!=null)      {
+             if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
+-               if (this._storageResolvers.size() == 0) {
++                  for (int k = 0; k < storageLength; k++) {
++                     StorageResolver storage =
++                        (StorageResolver) this._storageResolvers.get(k);
+ 
+-                  // if we do not have storage resolvers, we verify with null
+-                  StorageResolver storage = null;
+-
+-                  if (keyResolver.canResolve((Element) currentChild,
+-                                             this.getBaseURI(), storage)) {
+-                     SecretKey sk  =
+-                        keyResolver.resolveSecretKey((Element) currentChild,
+-                                                     this.getBaseURI(),
+-                                                     storage);
++                     SecretKey sk =
++                           keyResolver.engineLookupAndResolveSecretKey((Element) currentChild,
++                                                        uri,
++                                                        storage);
+ 
+                      if (sk != null) {
+                         return sk;
+                      }
+                   }
+-               } else {
+-                  for (int k = 0; k < this._storageResolvers.size(); k++) {
+-                     StorageResolver storage =
+-                        (StorageResolver) this._storageResolvers.get(k);
+-
+-                     if (keyResolver.canResolve((Element) currentChild,
+-                                                this.getBaseURI(), storage)) {
+-                        SecretKey sk =
+-                           keyResolver.resolveSecretKey((Element) currentChild,
+-                                                        this.getBaseURI(),
+-                                                        storage);
+-
+-                        if (sk != null) {
+-                           return sk;
+-                        }
+-                     }
+-                  }
+-               }
+             }
+             currentChild=currentChild.getNextSibling();
+          }
+@@ -1090,51 +980,28 @@
+     */
+ 
+    SecretKey getSecretKeyFromInternalResolvers() throws KeyResolverException {
+-
++           int storageLength=this._storageResolvers.size();
+       for (int i = 0; i < this.lengthInternalKeyResolver(); i++) {
+          KeyResolverSpi keyResolver = this.itemInternalKeyResolver(i);
+-         if (true)
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Try " + keyResolver.getClass().getName());
++         if (log.isLoggable(java.util.logging.Level.FINE))
++                log.log(java.util.logging.Level.FINE, "Try " + keyResolver.getClass().getName());
+ 
+          Node currentChild=this._constructionElement.getFirstChild();
++         String uri=this.getBaseURI();
+          while (currentChild!=null)      {
+             if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
+-               if (this._storageResolvers.size() == 0) {
++               for (int k = 0; k < storageLength; k++) {
++                     StorageResolver storage =
++                        (StorageResolver) this._storageResolvers.get(k);
+ 
+-                  // if we do not have storage resolvers, we verify with null
+-                  StorageResolver storage = null;
+-
+-                  if (keyResolver.engineCanResolve((Element) currentChild,
+-                                                   this.getBaseURI(),
+-                                                   storage)) {
+-                     SecretKey sk =
+-                        keyResolver
+-                           .engineResolveSecretKey((Element) currentChild, this
+-                              .getBaseURI(), storage);
++                     SecretKey sk = keyResolver
++                           .engineLookupAndResolveSecretKey((Element) currentChild, uri, storage);
+ 
+                      if (sk != null) {
+                         return sk;
+                      }
+-                  }
+-               } else {
+-                  for (int k = 0; k < this._storageResolvers.size(); k++) {
+-                     StorageResolver storage =
+-                        (StorageResolver) this._storageResolvers.get(k);
+-
+-                     if (keyResolver.engineCanResolve((Element) currentChild,
+-                                                      this.getBaseURI(),
+-                                                      storage)) {
+-                        SecretKey sk = keyResolver
+-                           .engineResolveSecretKey((Element) currentChild, this
+-                              .getBaseURI(), storage);
+-
+-                        if (sk != null) {
+-                           return sk;
+-                        }
+-                     }
+-                  }
+-               }
+-            }
++                }
++             }
+             currentChild=currentChild.getNextSibling();
+          }
+       }
+@@ -1145,7 +1012,7 @@
+    /**
+     * Stores the individual (per-KeyInfo) {@link KeyResolver}s
+     */
+-   List _internalKeyResolvers = new ArrayList();
++   List _internalKeyResolvers = null;
+ 
+    /**
+     * This method is used to add a custom {@link KeyResolverSpi} to a KeyInfo
+@@ -1154,6 +1021,9 @@
+     * @param realKeyResolver
+     */
+    public void registerInternalKeyResolver(KeyResolverSpi realKeyResolver) {
++           if (_internalKeyResolvers==null) {
++                   _internalKeyResolvers=new ArrayList();
++           }
+       this._internalKeyResolvers.add(realKeyResolver);
+    }
+ 
+@@ -1162,6 +1032,8 @@
+     * @return the length of the key
+     */
+    int lengthInternalKeyResolver() {
++           if (_internalKeyResolvers==null)
++                   return 0;
+       return this._internalKeyResolvers.size();
+    }
+ 
+@@ -1176,7 +1048,7 @@
+    }
+ 
+    /** Field _storageResolvers */
+-   List _storageResolvers = new ArrayList();
++   List _storageResolvers = nullList;
+ 
+    /**
+     * Method addStorageResolver
+@@ -1184,19 +1056,11 @@
+     * @param storageResolver
+     */
+    public void addStorageResolver(StorageResolver storageResolver) {
++           if  (_storageResolvers == nullList  ){
++                   _storageResolvers=new ArrayList();
++           }
++         this._storageResolvers.add(storageResolver);
+ 
+-      if (storageResolver != null) {
+-         this._storageResolvers.add(storageResolver);
+-      }
+-   }
+-
+-   /**
+-    * Method getStorageResolvers
+-    *
+-    * @return the internalStorages
+-    */
+-   List getStorageResolvers() {
+-      return this._storageResolvers;
+    }
+ 
+    //J-
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/KeyUtils.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/KeyUtils.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/KeyUtils.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/KeyUtils.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -36,7 +35,7 @@
+ /**
+  * Utility class for for <CODE>com.sun.org.apache.xml.internal.security.keys</CODE> package.
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class KeyUtils {
+ 
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/KeyInfoContent.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/KeyInfoContent.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/KeyInfoContent.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/KeyInfoContent.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -28,7 +27,7 @@
+ /**
+  * Empty interface just to identify Elements that can be cildren of ds:KeyInfo.
+  *
+- * @author $Author: blautenb $
++ * @author $Author: mullan $
+  */
+ public interface KeyInfoContent {
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/KeyName.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/KeyName.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/KeyName.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/KeyName.java
+@@ -20,25 +20,18 @@
+  */
+ package com.sun.org.apache.xml.internal.security.keys.content;
+ 
+-
+-
+ import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
+ import com.sun.org.apache.xml.internal.security.utils.Constants;
+ import com.sun.org.apache.xml.internal.security.utils.SignatureElementProxy;
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+ 
+-
+ /**
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class KeyName extends SignatureElementProxy implements KeyInfoContent {
+ 
+-   /** {@link java.util.logging} logging facility */
+-    static java.util.logging.Logger log =
+-        java.util.logging.Logger.getLogger(KeyName.class.getName());
+-
+    /**
+     * Constructor KeyName
+     *
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/KeyValue.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/KeyValue.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/KeyValue.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/KeyValue.java
+@@ -20,11 +20,8 @@
+  */
+ package com.sun.org.apache.xml.internal.security.keys.content;
+ 
+-
+-
+ import java.security.PublicKey;
+ 
+-
+ import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
+ import com.sun.org.apache.xml.internal.security.keys.content.keyvalues.DSAKeyValue;
+ import com.sun.org.apache.xml.internal.security.keys.content.keyvalues.RSAKeyValue;
+@@ -34,140 +31,131 @@
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+ 
+-
+ /**
+  * The KeyValue element contains a single public key that may be useful in
+  * validating the signature. Structured formats for defining DSA (REQUIRED)
+  * and RSA (RECOMMENDED) public keys are defined in Signature Algorithms
+  * (section 6.4). The KeyValue element may include externally defined public
+- * keys values represented as PCDATA or element types from an external namespace.
++ * keys values represented as PCDATA or element types from an external
++ * namespace.
+  *
+- * @author $Author: vishal $
++ * @author $Author: mullan $
+  */
+ public class KeyValue extends SignatureElementProxy implements KeyInfoContent {
+ 
+-   /** {@link java.util.logging} logging facility */
+-    static java.util.logging.Logger log =
+-        java.util.logging.Logger.getLogger(KeyValue.class.getName());
++    /**
++     * Constructor KeyValue
++     *
++     * @param doc
++     * @param dsaKeyValue
++     */
++    public KeyValue(Document doc, DSAKeyValue dsaKeyValue) {
+ 
+-   /**
+-    * Constructor KeyValue
+-    *
+-    * @param doc
+-    * @param dsaKeyValue
+-    */
+-   public KeyValue(Document doc, DSAKeyValue dsaKeyValue) {
++        super(doc);
+ 
+-      super(doc);
++        XMLUtils.addReturnToElement(this._constructionElement);
++        this._constructionElement.appendChild(dsaKeyValue.getElement());
++        XMLUtils.addReturnToElement(this._constructionElement);
++    }
+ 
+-      XMLUtils.addReturnToElement(this._constructionElement);
+-      this._constructionElement.appendChild(dsaKeyValue.getElement());
+-      XMLUtils.addReturnToElement(this._constructionElement);
+-   }
++    /**
++     * Constructor KeyValue
++     *
++     * @param doc
++     * @param rsaKeyValue
++     */
++    public KeyValue(Document doc, RSAKeyValue rsaKeyValue) {
+ 
+-   /**
+-    * Constructor KeyValue
+-    *
+-    * @param doc
+-    * @param rsaKeyValue
+-    */
+-   public KeyValue(Document doc, RSAKeyValue rsaKeyValue) {
++        super(doc);
+ 
+-      super(doc);
++        XMLUtils.addReturnToElement(this._constructionElement);
++        this._constructionElement.appendChild(rsaKeyValue.getElement());
++        XMLUtils.addReturnToElement(this._constructionElement);
++    }
+ 
+-      XMLUtils.addReturnToElement(this._constructionElement);
+-      this._constructionElement.appendChild(rsaKeyValue.getElement());
+-      XMLUtils.addReturnToElement(this._constructionElement);
+-   }
++    /**
++     * Constructor KeyValue
++     *
++     * @param doc
++     * @param unknownKeyValue
++     */
++    public KeyValue(Document doc, Element unknownKeyValue) {
+ 
+-   /**
+-    * Constructor KeyValue
+-    *
+-    * @param doc
+-    * @param unknownKeyValue
+-    */
+-   public KeyValue(Document doc, Element unknownKeyValue) {
++        super(doc);
+ 
+-      super(doc);
++        XMLUtils.addReturnToElement(this._constructionElement);
++        this._constructionElement.appendChild(unknownKeyValue);
++        XMLUtils.addReturnToElement(this._constructionElement);
++    }
+ 
+-      XMLUtils.addReturnToElement(this._constructionElement);
+-      this._constructionElement.appendChild(unknownKeyValue);
+-      XMLUtils.addReturnToElement(this._constructionElement);
+-   }
++    /**
++     * Constructor KeyValue
++     *
++     * @param doc
++     * @param pk
++     */
++    public KeyValue(Document doc, PublicKey pk) {
+ 
+-   /**
+-    * Constructor KeyValue
+-    *
+-    * @param doc
+-    * @param pk
+-    */
+-   public KeyValue(Document doc, PublicKey pk) {
++        super(doc);
+ 
+-      super(doc);
++        XMLUtils.addReturnToElement(this._constructionElement);
+ 
+-      XMLUtils.addReturnToElement(this._constructionElement);
++        if (pk instanceof java.security.interfaces.DSAPublicKey) {
++            DSAKeyValue dsa = new DSAKeyValue(this._doc, pk);
+ 
+-      if (pk instanceof java.security.interfaces.DSAPublicKey) {
+-         DSAKeyValue dsa = new DSAKeyValue(this._doc, pk);
++            this._constructionElement.appendChild(dsa.getElement());
++            XMLUtils.addReturnToElement(this._constructionElement);
++        } else if (pk instanceof java.security.interfaces.RSAPublicKey) {
++            RSAKeyValue rsa = new RSAKeyValue(this._doc, pk);
+ 
+-         this._constructionElement.appendChild(dsa.getElement());
+-         XMLUtils.addReturnToElement(this._constructionElement);
+-      } else if (pk instanceof java.security.interfaces.RSAPublicKey) {
+-         RSAKeyValue rsa = new RSAKeyValue(this._doc, pk);
++            this._constructionElement.appendChild(rsa.getElement());
++            XMLUtils.addReturnToElement(this._constructionElement);
++        }
++    }
+ 
+-         this._constructionElement.appendChild(rsa.getElement());
+-         XMLUtils.addReturnToElement(this._constructionElement);
+-      }
+-   }
++    /**
++     * Constructor KeyValue
++     *
++     * @param element
++     * @param BaseURI
++     * @throws XMLSecurityException
++     */
++    public KeyValue(Element element, String BaseURI)
++           throws XMLSecurityException {
++        super(element, BaseURI);
++    }
+ 
+-   /**
+-    * Constructor KeyValue
+-    *
+-    * @param element
+-    * @param BaseURI
+-    * @throws XMLSecurityException
+-    */
+-   public KeyValue(Element element, String BaseURI)
+-           throws XMLSecurityException {
+-      super(element, BaseURI);
+-   }
++    /**
++     * Method getPublicKey
++     *
++     * @return the public key
++     * @throws XMLSecurityException
++     */
++    public PublicKey getPublicKey() throws XMLSecurityException {
+ 
+-   /**
+-    * Method getPublicKey
+-    *
+-    * @return the public key
+-    * @throws XMLSecurityException
+-    */
+-   public PublicKey getPublicKey() throws XMLSecurityException {
++        Element rsa = XMLUtils.selectDsNode
++            (this._constructionElement.getFirstChild(),
++             Constants._TAG_RSAKEYVALUE,0);
+ 
++        if (rsa != null) {
++            RSAKeyValue kv = new RSAKeyValue(rsa, this._baseURI);
++            return kv.getPublicKey();
++        }
+ 
+-         Element rsa = XMLUtils.selectDsNode(this._constructionElement.getFirstChild(),
+-                                        Constants._TAG_RSAKEYVALUE,0);
++        Element dsa = XMLUtils.selectDsNode
++            (this._constructionElement.getFirstChild(),
++             Constants._TAG_DSAKEYVALUE,0);
+ 
+-         if (rsa != null) {
+-            RSAKeyValue kv = new RSAKeyValue(rsa,
+-                                             this._baseURI);
++        if (dsa != null) {
++            DSAKeyValue kv = new DSAKeyValue(dsa, this._baseURI);
++            return kv.getPublicKey();
++        }
+ 
+-            return kv.getPublicKey();
+-         }
++        return null;
++    }
+ 
+-         Element dsa = XMLUtils.selectDsNode(this._constructionElement,
+-                         Constants._TAG_DSAKEYVALUE,0);
+-
+-
+-         if (dsa != null) {
+-            DSAKeyValue kv = new DSAKeyValue(dsa,
+-                                             this._baseURI);
+-
+-            return kv.getPublicKey();
+-         }
+-
+-
+-      return null;
+-   }
+-
+-   /** @inheritDoc */
+-   public String getBaseLocalName() {
+-      return Constants._TAG_KEYVALUE;
+-   }
++    /** @inheritDoc */
++    public String getBaseLocalName() {
++        return Constants._TAG_KEYVALUE;
++    }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/MgmtData.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/MgmtData.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/MgmtData.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/MgmtData.java
+@@ -20,25 +20,18 @@
+  */
+ package com.sun.org.apache.xml.internal.security.keys.content;
+ 
+-
+-
+ import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
+ import com.sun.org.apache.xml.internal.security.utils.Constants;
+ import com.sun.org.apache.xml.internal.security.utils.SignatureElementProxy;
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+ 
+-
+ /**
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class MgmtData extends SignatureElementProxy implements KeyInfoContent {
+ 
+-   /** {@link java.util.logging} logging facility */
+-    static java.util.logging.Logger log =
+-        java.util.logging.Logger.getLogger(MgmtData.class.getName());
+-
+    /**
+     * Constructor MgmtData
+     *
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/PGPData.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/PGPData.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/PGPData.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/PGPData.java
+@@ -20,25 +20,18 @@
+  */
+ package com.sun.org.apache.xml.internal.security.keys.content;
+ 
+-
+-
+ import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
+ import com.sun.org.apache.xml.internal.security.utils.Constants;
+ import com.sun.org.apache.xml.internal.security.utils.SignatureElementProxy;
+ import org.w3c.dom.Element;
+ 
+-
+ /**
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  * $todo$ Implement
+  */
+ public class PGPData extends SignatureElementProxy implements KeyInfoContent {
+ 
+-   /** {@link java.util.logging} logging facility */
+-    static java.util.logging.Logger log =
+-        java.util.logging.Logger.getLogger(PGPData.class.getName());
+-
+    /**
+     * Constructor PGPData
+     *
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/RetrievalMethod.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/RetrievalMethod.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/RetrievalMethod.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/RetrievalMethod.java
+@@ -20,9 +20,6 @@
+  */
+ package com.sun.org.apache.xml.internal.security.keys.content;
+ 
+-
+-
+-
+ import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
+ import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException;
+ import com.sun.org.apache.xml.internal.security.transforms.Transforms;
+@@ -33,17 +30,13 @@
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+ 
+-
+ /**
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class RetrievalMethod extends SignatureElementProxy
+         implements KeyInfoContent {
+ 
+-   /** {@link java.util.logging} logging facility */
+-    static java.util.logging.Logger log =
+-        java.util.logging.Logger.getLogger(RetrievalMethod.class.getName());
+    //J-
+     /** DSA retrieval */
+    public static final String TYPE_DSA     = Constants.SignatureSpecNS + "DSAKeyValue";
+@@ -133,7 +126,7 @@
+ 
+       try {
+        Element transformsElem =
+-             XMLUtils.selectDsNode(this._constructionElement,
++             XMLUtils.selectDsNode(this._constructionElement.getFirstChild(),
+                                                 Constants
+                                                    ._TAG_TRANSFORMS, 0);
+ 
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/SPKIData.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/SPKIData.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/SPKIData.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/SPKIData.java
+@@ -20,25 +20,18 @@
+  */
+ package com.sun.org.apache.xml.internal.security.keys.content;
+ 
+-
+-
+ import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
+ import com.sun.org.apache.xml.internal.security.utils.Constants;
+ import com.sun.org.apache.xml.internal.security.utils.SignatureElementProxy;
+ import org.w3c.dom.Element;
+ 
+-
+ /**
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  * $todo$ implement
+  */
+ public class SPKIData extends SignatureElementProxy implements KeyInfoContent {
+ 
+-   /** {@link java.util.logging} logging facility */
+-    static java.util.logging.Logger log =
+-        java.util.logging.Logger.getLogger(SPKIData.class.getName());
+-
+    /**
+     * Constructor SPKIData
+     *
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/X509Data.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/X509Data.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/X509Data.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/X509Data.java
+@@ -41,7 +41,7 @@
+ 
+ /**
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class X509Data extends SignatureElementProxy implements KeyInfoContent {
+ 
+@@ -72,60 +72,17 @@
+            throws XMLSecurityException {
+ 
+       super(element, BaseURI);
+-
+-      boolean noElements=true;
+       Node sibling=this._constructionElement.getFirstChild();
+       while (sibling!=null) {
+          if (sibling.getNodeType()!=Node.ELEMENT_NODE) {
+                 sibling=sibling.getNextSibling();
+             continue;
+          }
+-        noElements=false;
+-         Element currentElem = (Element) sibling;
+-         sibling=sibling.getNextSibling();
+-         String localname = currentElem.getLocalName();
+-
+-         if (currentElem.getNamespaceURI().equals(Constants.SignatureSpecNS)) {
+-            if (localname.equals(Constants._TAG_X509ISSUERSERIAL)) {
+-               XMLX509IssuerSerial is = new XMLX509IssuerSerial(currentElem,
+-                                           BaseURI);
+-
+-               this.add(is);
+-            } else if (localname.equals(Constants._TAG_X509SKI)) {
+-               XMLX509SKI ski = new XMLX509SKI(currentElem, BaseURI);
+-
+-               this.add(ski);
+-            } else if (localname.equals(Constants._TAG_X509SUBJECTNAME)) {
+-               XMLX509SubjectName sn = new XMLX509SubjectName(currentElem,
+-                                          BaseURI);
+-
+-               this.add(sn);
+-            } else if (localname.equals(Constants._TAG_X509CERTIFICATE)) {
+-               XMLX509Certificate cert = new XMLX509Certificate(currentElem,
+-                                            BaseURI);
+-
+-               this.add(cert);
+-            } else if (localname.equals(Constants._TAG_X509CRL)) {
+-               XMLX509CRL crl = new XMLX509CRL(currentElem, BaseURI);
+-
+-               this.add(crl);
+-            } else {
+-               log.log(java.util.logging.Level.WARNING, "Found a " + currentElem.getTagName() + " element in "
+-                        + Constants._TAG_X509DATA);
+-               this.addUnknownElement(currentElem);
+-            }
+-         } else {
+-            log.log(java.util.logging.Level.WARNING, "Found a " + currentElem.getTagName() + " element in "
+-                     + Constants._TAG_X509DATA);
+-            this.addUnknownElement(currentElem);
+-         }
++         return;
+       }
+-      if (noElements) {
+-        Object exArgs[] = { "Elements", Constants._TAG_X509DATA };
+-
+-        throw new XMLSecurityException("xml.WrongContent", exArgs);
+-     }
+-
++      /* No Elements found */
++      Object exArgs[] = { "Elements", Constants._TAG_X509DATA };
++      throw new XMLSecurityException("xml.WrongContent", exArgs);
+    }
+ 
+    /**
+@@ -169,11 +126,9 @@
+     */
+    public void add(XMLX509IssuerSerial xmlX509IssuerSerial) {
+ 
+-      if (this._state == MODE_SIGN) {
+          this._constructionElement
+             .appendChild(xmlX509IssuerSerial.getElement());
+          XMLUtils.addReturnToElement(this._constructionElement);
+-      }
+    }
+ 
+    /**
+@@ -202,11 +157,8 @@
+     * @param xmlX509SKI
+     */
+    public void add(XMLX509SKI xmlX509SKI) {
+-
+-      if (this._state == MODE_SIGN) {
+          this._constructionElement.appendChild(xmlX509SKI.getElement());
+          XMLUtils.addReturnToElement(this._constructionElement);
+-      }
+    }
+ 
+    /**
+@@ -233,11 +185,8 @@
+     * @param xmlX509SubjectName
+     */
+    public void add(XMLX509SubjectName xmlX509SubjectName) {
+-
+-      if (this._state == MODE_SIGN) {
+          this._constructionElement.appendChild(xmlX509SubjectName.getElement());
+          XMLUtils.addReturnToElement(this._constructionElement);
+-      }
+    }
+ 
+    /**
+@@ -266,11 +215,8 @@
+     * @param xmlX509Certificate
+     */
+    public void add(XMLX509Certificate xmlX509Certificate) {
+-
+-      if (this._state == MODE_SIGN) {
+          this._constructionElement.appendChild(xmlX509Certificate.getElement());
+          XMLUtils.addReturnToElement(this._constructionElement);
+-      }
+    }
+ 
+    /**
+@@ -288,11 +234,8 @@
+     * @param xmlX509CRL
+     */
+    public void add(XMLX509CRL xmlX509CRL) {
+-
+-      if (this._state == MODE_SIGN) {
+          this._constructionElement.appendChild(xmlX509CRL.getElement());
+          XMLUtils.addReturnToElement(this._constructionElement);
+-      }
+    }
+ 
+    /**
+@@ -301,11 +244,8 @@
+     * @param element
+     */
+    public void addUnknownElement(Element element) {
+-
+-      if (this._state == MODE_SIGN) {
+          this._constructionElement.appendChild(element);
+          XMLUtils.addReturnToElement(this._constructionElement);
+-      }
+    }
+ 
+    /**
+@@ -479,7 +419,7 @@
+     * TODO implement
+     **/
+    public Element itemUnknownElement(int i) {
+-          if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "itemUnknownElement not implemented:"+i);
++          log.log(java.util.logging.Level.FINE, "itemUnknownElement not implemented:"+i);
+       return null;
+    }
+ 
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/keyvalues/DSAKeyValue.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/keyvalues/DSAKeyValue.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/keyvalues/DSAKeyValue.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/keyvalues/DSAKeyValue.java
+@@ -20,8 +20,6 @@
+  */
+ package com.sun.org.apache.xml.internal.security.keys.content.keyvalues;
+ 
+-
+-
+ import java.math.BigInteger;
+ import java.security.Key;
+ import java.security.KeyFactory;
+@@ -39,18 +37,13 @@
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+ 
+-
+ /**
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class DSAKeyValue extends SignatureElementProxy
+         implements KeyValueContent {
+ 
+-   /** {@link java.util.logging} logging facility */
+-    static java.util.logging.Logger log =
+-        java.util.logging.Logger.getLogger(DSAKeyValue.class.getName());
+-
+    /**
+     * Constructor DSAKeyValue
+     *
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/keyvalues/KeyValueContent.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/keyvalues/KeyValueContent.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/keyvalues/KeyValueContent.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/keyvalues/KeyValueContent.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -32,7 +31,7 @@
+  *
+  *
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  *
+  */
+ public interface KeyValueContent {
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/keyvalues/RSAKeyValue.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/keyvalues/RSAKeyValue.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/keyvalues/RSAKeyValue.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/keyvalues/RSAKeyValue.java
+@@ -20,8 +20,6 @@
+  */
+ package com.sun.org.apache.xml.internal.security.keys.content.keyvalues;
+ 
+-
+-
+ import java.math.BigInteger;
+ import java.security.Key;
+ import java.security.KeyFactory;
+@@ -39,19 +37,13 @@
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+ 
+-
+ /**
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class RSAKeyValue extends SignatureElementProxy
+         implements KeyValueContent {
+ 
+-   /** {@link java.util.logging} logging facility */
+-    static java.util.logging.Logger log =
+-        java.util.logging.Logger.getLogger(
+-                        RSAKeyValue.class.getName());
+-
+    /**
+     * Constructor RSAKeyValue
+     *
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/x509/XMLX509CRL.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/x509/XMLX509CRL.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/x509/XMLX509CRL.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/x509/XMLX509CRL.java
+@@ -20,30 +20,20 @@
+  */
+ package com.sun.org.apache.xml.internal.security.keys.content.x509;
+ 
+-
+-
+ import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
+ import com.sun.org.apache.xml.internal.security.utils.Constants;
+ import com.sun.org.apache.xml.internal.security.utils.SignatureElementProxy;
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+ 
+-
+ /**
+  *
+- *
+- *
+- *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  *
+  */
+ public class XMLX509CRL extends SignatureElementProxy
+         implements XMLX509DataContent {
+ 
+-   /** {@link java.util.logging} logging facility */
+-    static java.util.logging.Logger log =
+-        java.util.logging.Logger.getLogger(XMLX509CRL.class.getName());
+-
+    /**
+     * Constructor XMLX509CRL
+     *
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/x509/XMLX509Certificate.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/x509/XMLX509Certificate.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/x509/XMLX509Certificate.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/x509/XMLX509Certificate.java
+@@ -20,8 +20,6 @@
+  */
+ package com.sun.org.apache.xml.internal.security.keys.content.x509;
+ 
+-
+-
+ import java.io.ByteArrayInputStream;
+ import java.security.PublicKey;
+ import java.security.cert.CertificateException;
+@@ -34,18 +32,13 @@
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+ 
+-
+ /**
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class XMLX509Certificate extends SignatureElementProxy
+         implements XMLX509DataContent {
+ 
+-   /** {@link java.util.logging} logging facility */
+-    static java.util.logging.Logger log =
+-        java.util.logging.Logger.getLogger(XMLX509Certificate.class.getName());
+-
+    /** Field JCA_CERT_ID */
+    public static final String JCA_CERT_ID = "X.509";
+ 
+@@ -146,23 +139,25 @@
+       return null;
+    }
+ 
+-   /** @inheritDoc */
+-   public boolean equals(Object obj) {
++    /** @inheritDoc */
++    public boolean equals(Object obj) {
+ 
+-      try {
+-         if (!obj.getClass().getName().equals(this.getClass().getName())) {
++        if (obj == null) {
+             return false;
+-         }
++        }
++        if (!this.getClass().getName().equals(obj.getClass().getName())) {
++            return false;
++        }
++        XMLX509Certificate other = (XMLX509Certificate) obj;
++        try {
+ 
+-         XMLX509Certificate other = (XMLX509Certificate) obj;
+-
+-         /** $todo$ or should be create X509Certificates and use the equals() from the Certs */
+-         return java.security.MessageDigest.isEqual(other.getCertificateBytes(),
+-                                        this.getCertificateBytes());
+-      } catch (XMLSecurityException ex) {
+-         return false;
+-      }
+-   }
++            /** $todo$ or should be create X509Certificates and use the equals() from the Certs */
++            return java.security.MessageDigest.isEqual
++                (other.getCertificateBytes(), this.getCertificateBytes());
++        } catch (XMLSecurityException ex) {
++            return false;
++        }
++    }
+ 
+    /** @inheritDoc */
+    public String getBaseLocalName() {
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/x509/XMLX509DataContent.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/x509/XMLX509DataContent.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/x509/XMLX509DataContent.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/x509/XMLX509DataContent.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -28,7 +27,7 @@
+ /**
+  * Just used for tagging contents that are allowed inside a ds:X509Data Element.
+  *
+- * @author $Author: blautenb $
++ * @author $Author: mullan $
+  */
+ public interface XMLX509DataContent {
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/x509/XMLX509IssuerSerial.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/x509/XMLX509IssuerSerial.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/x509/XMLX509IssuerSerial.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/x509/XMLX509IssuerSerial.java
+@@ -20,8 +20,6 @@
+  */
+ package com.sun.org.apache.xml.internal.security.keys.content.x509;
+ 
+-
+-
+ import java.math.BigInteger;
+ import java.security.cert.X509Certificate;
+ 
+@@ -33,148 +31,139 @@
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+ 
+-
+ /**
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class XMLX509IssuerSerial extends SignatureElementProxy
+         implements XMLX509DataContent {
+ 
+-   /** {@link java.util.logging} logging facility */
++    /** {@link java.util.logging} logging facility */
+     static java.util.logging.Logger log =
+         java.util.logging.Logger.getLogger(
+                     XMLX509IssuerSerial.class.getName());
+ 
+-   /**
+-    * Constructor XMLX509IssuerSerial
+-    *
+-    * @param element
+-    * @param BaseURI
+-    * @throws XMLSecurityException
+-    */
+-   public XMLX509IssuerSerial(Element element, String BaseURI)
++    /**
++     * Constructor XMLX509IssuerSerial
++     *
++     * @param element
++     * @param baseURI
++     * @throws XMLSecurityException
++     */
++    public XMLX509IssuerSerial(Element element, String baseURI)
+            throws XMLSecurityException {
+-      super(element, BaseURI);
+-   }
++        super(element, baseURI);
++    }
+ 
+-   /**
+-    * Constructor XMLX509IssuerSerial
+-    *
+-    * @param doc
+-    * @param X509IssuerName
+-    * @param X509SerialNumber
+-    */
+-   public XMLX509IssuerSerial(Document doc, String X509IssuerName,
+-                              BigInteger X509SerialNumber) {
++    /**
++     * Constructor XMLX509IssuerSerial
++     *
++     * @param doc
++     * @param x509IssuerName
++     * @param x509SerialNumber
++     */
++    public XMLX509IssuerSerial(Document doc, String x509IssuerName,
++                               BigInteger x509SerialNumber) {
+ 
+-      super(doc);
++        super(doc);
++        XMLUtils.addReturnToElement(this._constructionElement);
++        addTextElement(x509IssuerName, Constants._TAG_X509ISSUERNAME);
++        addTextElement(x509SerialNumber.toString(), Constants._TAG_X509SERIALNUMBER);
++    }
+ 
+-      XMLUtils.addReturnToElement(this._constructionElement);
+-      this.addTextElement(X509IssuerName, Constants._TAG_X509ISSUERNAME);
+-      XMLUtils.addReturnToElement(this._constructionElement);
+-      this.addTextElement(X509SerialNumber.toString(), Constants._TAG_X509SERIALNUMBER);
+-   }
++    /**
++     * Constructor XMLX509IssuerSerial
++     *
++     * @param doc
++     * @param x509IssuerName
++     * @param x509SerialNumber
++     */
++    public XMLX509IssuerSerial(Document doc, String x509IssuerName,
++                               String x509SerialNumber) {
++        this(doc, x509IssuerName, new BigInteger(x509SerialNumber));
++    }
+ 
+-   /**
+-    * Constructor XMLX509IssuerSerial
+-    *
+-    * @param doc
+-    * @param X509IssuerName
+-    * @param X509SerialNumber
+-    */
+-   public XMLX509IssuerSerial(Document doc, String X509IssuerName,
+-                              String X509SerialNumber) {
+-      this(doc, X509IssuerName, new BigInteger(X509SerialNumber));
+-   }
++    /**
++     * Constructor XMLX509IssuerSerial
++     *
++     * @param doc
++     * @param x509IssuerName
++     * @param x509SerialNumber
++     */
++    public XMLX509IssuerSerial(Document doc, String x509IssuerName,
++                               int x509SerialNumber) {
++        this(doc, x509IssuerName,
++             new BigInteger(Integer.toString(x509SerialNumber)));
++    }
+ 
+-   /**
+-    * Constructor XMLX509IssuerSerial
+-    *
+-    * @param doc
+-    * @param X509IssuerName
+-    * @param X509SerialNumber
+-    */
+-   public XMLX509IssuerSerial(Document doc, String X509IssuerName,
+-                              int X509SerialNumber) {
+-      this(doc, X509IssuerName,
+-           new BigInteger(Integer.toString(X509SerialNumber)));
+-   }
++    /**
++     * Constructor XMLX509IssuerSerial
++     *
++     * @param doc
++     * @param x509certificate
++     */
++    public XMLX509IssuerSerial(Document doc, X509Certificate x509certificate) {
+ 
+-   /**
+-    * Constructor XMLX509IssuerSerial
+-    *
+-    * @param doc
+-    * @param x509certificate
+-    */
+-   public XMLX509IssuerSerial(Document doc, X509Certificate x509certificate) {
++        this(doc,
++             RFC2253Parser.normalize(x509certificate.getIssuerDN().getName()),
++             x509certificate.getSerialNumber());
++    }
+ 
+-      this(doc,
+-           RFC2253Parser.normalize(x509certificate.getIssuerDN().getName()),
+-           x509certificate.getSerialNumber());
+-   }
++    /**
++     * Method getSerialNumber
++     *
++     * @return the serial number
++     */
++    public BigInteger getSerialNumber() {
+ 
+-   /**
+-    * Method getSerialNumber
+-    *
+-    *
+-    * @return the serial number
+-    */
+-   public BigInteger getSerialNumber() {
++        String text = this.getTextFromChildElement
++            (Constants._TAG_X509SERIALNUMBER, Constants.SignatureSpecNS);
++        if (log.isLoggable(java.util.logging.Level.FINE))
++            log.log(java.util.logging.Level.FINE, "X509SerialNumber text: " + text);
+ 
+-      String text =
+-         this.getTextFromChildElement(Constants._TAG_X509SERIALNUMBER,
+-                                      Constants.SignatureSpecNS);
+-      if (true)
+-        if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "In dem X509SerialNumber wurde gefunden: " + text);
++        return new BigInteger(text);
++    }
+ 
+-      return new BigInteger(text);
+-   }
++    /**
++     * Method getSerialNumberInteger
++     *
++     * @return the serial number as plain int
++     */
++    public int getSerialNumberInteger() {
++        return this.getSerialNumber().intValue();
++    }
+ 
+-   /**
+-    * Method getSerialNumberInteger
+-    *
+-    *
+-    * @return the serial number as plain int
+-    */
+-   public int getSerialNumberInteger() {
+-      return this.getSerialNumber().intValue();
+-   }
++    /**
++     * Method getIssuerName
++     *
++     * @return the issuer name
++     */
++    public String getIssuerName()  {
+ 
+-   /**
+-    * Method getIssuerName
+-    *
+-    *
+-    * @return the issuer name
+-    */
+-   public String getIssuerName()  {
++        return RFC2253Parser
++           .normalize(this
++              .getTextFromChildElement(Constants._TAG_X509ISSUERNAME,
++                                       Constants.SignatureSpecNS));
++    }
+ 
+-      return RFC2253Parser
+-         .normalize(this
+-            .getTextFromChildElement(Constants._TAG_X509ISSUERNAME,
+-                                     Constants.SignatureSpecNS));
+-   }
++    /** @inheritDoc */
++    public boolean equals(Object obj) {
+ 
+-   /** @inheritDoc */
+-   public boolean equals(Object obj) {
++        if (obj == null) {
++            return false;
++        }
++        if (!this.getClass().getName().equals(obj.getClass().getName())) {
++            return false;
++        }
+ 
+-      if (!obj.getClass().getName().equals(this.getClass().getName())) {
+-         return false;
+-      }
++        XMLX509IssuerSerial other = (XMLX509IssuerSerial) obj;
+ 
+-      XMLX509IssuerSerial other = (XMLX509IssuerSerial) obj;
++        return this.getSerialNumber().equals(other.getSerialNumber())
++               && this.getIssuerName().equals(other.getIssuerName());
++    }
+ 
+-
+-      if (other.getSerialNumber().equals(this.getSerialNumber())
+-                 && other.getIssuerName().equals(this.getIssuerName())) {
+-           return true;
+-      }
+-
+-       return false;
+-   }
+-
+-   /** @inheritDoc */
+-   public String getBaseLocalName() {
+-      return Constants._TAG_X509ISSUERSERIAL;
+-   }
++    /** @inheritDoc */
++    public String getBaseLocalName() {
++        return Constants._TAG_X509ISSUERSERIAL;
++    }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/x509/XMLX509SKI.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/x509/XMLX509SKI.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/x509/XMLX509SKI.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/x509/XMLX509SKI.java
+@@ -20,8 +20,6 @@
+  */
+ package com.sun.org.apache.xml.internal.security.keys.content.x509;
+ 
+-
+-
+ import java.io.IOException;
+ import java.io.ByteArrayInputStream;
+ import java.io.InputStream;
+@@ -36,192 +34,143 @@
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+ 
+-import sun.security.util.DerValue;
+-
+-
+ /**
+  * Handles SubjectKeyIdentifier (SKI) for X.509v3.
+  *
+- * @author $Author: raul $
+- * @see <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/security/cert/X509Extension.html">Interface X509Extension</A>
++ * @author $Author: mullan $
++ * @see <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/security/cert/X509Extension.html">Interface X509Extension</A>
+  */
+ public class XMLX509SKI extends SignatureElementProxy
+         implements XMLX509DataContent {
+ 
+-   /** {@link java.util.logging} logging facility */
++    /** {@link java.util.logging} logging facility */
+     static java.util.logging.Logger log =
+         java.util.logging.Logger.getLogger(XMLX509SKI.class.getName());
+ 
+-   /**
+-    * <CODE>SubjectKeyIdentifier (id-ce-subjectKeyIdentifier) (2.5.29.14)</CODE>:
+-    * This extension identifies the public key being certified. It enables
+-    * distinct keys used by the same subject to be differentiated
+-    * (e.g., as key updating occurs).
+-    * <BR />
+-    * A key identifer shall be unique with respect to all key identifiers
+-    * for the subject with which it is used. This extension is always non-critical.
+-    */
+-   public static final String SKI_OID = "2.5.29.14";
++    /**
++     * <CODE>SubjectKeyIdentifier (id-ce-subjectKeyIdentifier) (2.5.29.14)</CODE>:
++     * This extension identifies the public key being certified. It enables
++     * distinct keys used by the same subject to be differentiated
++     * (e.g., as key updating occurs).
++     * <BR />
++     * A key identifer shall be unique with respect to all key identifiers
++     * for the subject with which it is used. This extension is always non-critical.
++     */
++    public static final String SKI_OID = "2.5.29.14";
+ 
+-   /**
+-    * Constructor X509SKI
+-    *
+-    * @param doc
+-    * @param skiBytes
+-    */
+-   public XMLX509SKI(Document doc, byte[] skiBytes) {
++    /**
++     * Constructor X509SKI
++     *
++     * @param doc
++     * @param skiBytes
++     */
++    public XMLX509SKI(Document doc, byte[] skiBytes) {
++        super(doc);
++        this.addBase64Text(skiBytes);
++    }
+ 
+-      super(doc);
++    /**
++     * Constructor XMLX509SKI
++     *
++     * @param doc
++     * @param x509certificate
++     * @throws XMLSecurityException
++     */
++    public XMLX509SKI(Document doc, X509Certificate x509certificate)
++           throws XMLSecurityException {
++        super(doc);
++        this.addBase64Text(XMLX509SKI.getSKIBytesFromCert(x509certificate));
++    }
+ 
+-      this.addBase64Text(skiBytes);
+-   }
++    /**
++     * Constructor XMLX509SKI
++     *
++     * @param element
++     * @param BaseURI
++     * @throws XMLSecurityException
++     */
++    public XMLX509SKI(Element element, String BaseURI)
++           throws XMLSecurityException {
++        super(element, BaseURI);
++    }
+ 
+-   /**
+-    * Constructor XMLX509SKI
+-    *
+-    * @param doc
+-    * @param x509certificate
+-    * @throws XMLSecurityException
+-    */
+-   public XMLX509SKI(Document doc, X509Certificate x509certificate)
+-           throws XMLSecurityException {
++    /**
++     * Method getSKIBytes
++     *
++     * @return the skibytes
++     * @throws XMLSecurityException
++     */
++    public byte[] getSKIBytes() throws XMLSecurityException {
++        return this.getBytesFromTextChild();
++    }
+ 
+-      super(doc);
++    /**
++     * Method getSKIBytesFromCert
++     *
++     * @param cert
++     * @return ski bytes from the given certificate
++     *
++     * @throws XMLSecurityException
++     * @see java.security.cert.X509Extension#getExtensionValue(java.lang.String)
++     */
++    public static byte[] getSKIBytesFromCert(X509Certificate cert)
++        throws XMLSecurityException {
+ 
+-      this.addBase64Text(XMLX509SKI.getSKIBytesFromCert(x509certificate));
+-   }
+-
+-   /**
+-    * Constructor XMLX509SKI
+-    *
+-    * @param element
+-    * @param BaseURI
+-    * @throws XMLSecurityException
+-    */
+-   public XMLX509SKI(Element element, String BaseURI)
+-           throws XMLSecurityException {
+-      super(element, BaseURI);
+-   }
+-
+-   /**
+-    * Method getSKIBytes
+-    *
+-    * @return the skibytes
+-    * @throws XMLSecurityException
+-    */
+-   public byte[] getSKIBytes() throws XMLSecurityException {
+-      return this.getBytesFromTextChild();
+-   }
+-
+-   /**
+-    * Method getSKIBytesFromCert
+-    *
+-    * @param cert
+-    * @return sky bytes from the given certificate
+-    *
+-    * @throws XMLSecurityException
+-    * @see java.security.cert.X509Extension#getExtensionValue(java.lang.String)
+-    */
+-   public static byte[] getSKIBytesFromCert(X509Certificate cert)
+-           throws XMLSecurityException {
+-
+-      try {
+-
+-         /*
+-          * Gets the DER-encoded OCTET string for the extension value (extnValue)
+-          * identified by the passed-in oid String. The oid string is
+-          * represented by a set of positive whole numbers separated by periods.
+-          */
+-         byte[] derEncodedValue = cert.getExtensionValue(XMLX509SKI.SKI_OID);
+-
+-         if (cert.getVersion() < 3) {
++        if (cert.getVersion() < 3) {
+             Object exArgs[] = { new Integer(cert.getVersion()) };
+-
+             throw new XMLSecurityException("certificate.noSki.lowVersion",
+                                            exArgs);
+-         }
++        }
+ 
+-          byte[] extensionValue = null;
++        /*
++         * Gets the DER-encoded OCTET string for the extension value
++         * (extnValue) identified by the passed-in oid String. The oid
++         * string is represented by a set of positive whole numbers
++         * separated by periods.
++         */
++        byte[] extensionValue = cert.getExtensionValue(XMLX509SKI.SKI_OID);
++        if (extensionValue == null) {
++            throw new XMLSecurityException("certificate.noSki.null");
++        }
+ 
+-          /**
+-           * Use sun.security.util.DerValue if it is present.
+-           */
+-          try {
+-                  DerValue dervalue = new DerValue(derEncodedValue);
+-                  if (dervalue == null) {
+-                      throw new XMLSecurityException("certificate.noSki.null");
+-                  }
+-                  if (dervalue.tag != DerValue.tag_OctetString) {
+-                      throw new XMLSecurityException("certificate.noSki.notOctetString");
+-                  }
+-                  extensionValue = dervalue.getOctetString();
+-          } catch (NoClassDefFoundError e) {
+-          }
++        /**
++         * Strip away first four bytes from the extensionValue
++         * The first two bytes are the tag and length of the extensionValue
++         * OCTET STRING, and the next two bytes are the tag and length of
++         * the skid OCTET STRING.
++         */
++        byte skidValue[] = new byte[extensionValue.length - 4];
+ 
+-          /**
+-           * Fall back to org.bouncycastle.asn1.DERInputStream
+-           */
+-          if (extensionValue == null) {
+-              try {
+-                  Class clazz = Class.forName("org.bouncycastle.asn1.DERInputStream");
+-                  if (clazz != null) {
+-                      Constructor constructor = clazz.getConstructor(new Class[]{InputStream.class});
+-                      InputStream is = (InputStream) constructor.newInstance(new Object[]{new ByteArrayInputStream(derEncodedValue)});
+-                      Method method = clazz.getMethod("readObject", new Class[]{});
+-                      Object obj = method.invoke(is, new Object[]{});
+-                      if (obj == null) {
+-                          throw new XMLSecurityException("certificate.noSki.null");
+-                      }
+-                      Class clazz2 = Class.forName("org.bouncycastle.asn1.ASN1OctetString");
+-                      if (!clazz2.isInstance(obj)) {
+-                          throw new XMLSecurityException("certificate.noSki.notOctetString");
+-                      }
+-                      Method method2 = clazz2.getMethod("getOctets", new Class[]{});
+-                      extensionValue = (byte[]) method2.invoke(obj, new Object[]{});
+-                  }
+-              } catch (Throwable t) {
+-              }
+-          }
++        System.arraycopy(extensionValue, 4, skidValue, 0, skidValue.length);
+ 
+-         /**
+-          * Strip away first two bytes from the DerValue (tag and length)
+-          */
+-         byte abyte0[] = new byte[extensionValue.length - 2];
++        if (log.isLoggable(java.util.logging.Level.FINE)) {
++            log.log(java.util.logging.Level.FINE, "Base64 of SKI is " + Base64.encode(skidValue));
++        }
+ 
+-         System.arraycopy(extensionValue, 2, abyte0, 0, abyte0.length);
++        return skidValue;
++    }
+ 
+-         /*
+-         byte abyte0[] = new byte[derEncodedValue.length - 4];
+-         System.arraycopy(derEncodedValue, 4, abyte0, 0, abyte0.length);
+-         */
+-         if (true)
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Base64 of SKI is " + Base64.encode(abyte0));
++    /** @inheritDoc */
++    public boolean equals(Object obj) {
++        if (obj == null) {
++            return false;
++        }
++        if (!this.getClass().getName().equals(obj.getClass().getName())) {
++            return false;
++        }
+ 
+-         return abyte0;
+-      } catch (IOException ex) {
+-         throw new XMLSecurityException("generic.EmptyMessage", ex);
+-      }
+-   }
++        XMLX509SKI other = (XMLX509SKI) obj;
+ 
+-   /** @inheritDoc */
+-   public boolean equals(Object obj) {
++        try {
++            return java.security.MessageDigest.isEqual(other.getSKIBytes(),
++                                        this.getSKIBytes());
++        } catch (XMLSecurityException ex) {
++            return false;
++        }
++    }
+ 
+-      if (!obj.getClass().getName().equals(this.getClass().getName())) {
+-         return false;
+-      }
+-
+-      XMLX509SKI other = (XMLX509SKI) obj;
+-
+-      try {
+-         return java.security.MessageDigest.isEqual(other.getSKIBytes(),
+-                                        this.getSKIBytes());
+-      } catch (XMLSecurityException ex) {
+-         return false;
+-      }
+-   }
+-
+-   /** @inheritDoc */
+-   public String getBaseLocalName() {
+-      return Constants._TAG_X509SKI;
+-   }
++    /** @inheritDoc */
++    public String getBaseLocalName() {
++        return Constants._TAG_X509SKI;
++    }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/x509/XMLX509SubjectName.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/x509/XMLX509SubjectName.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/x509/XMLX509SubjectName.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/x509/XMLX509SubjectName.java
+@@ -20,8 +20,6 @@
+  */
+ package com.sun.org.apache.xml.internal.security.keys.content.x509;
+ 
+-
+-
+ import java.security.cert.X509Certificate;
+ 
+ import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
+@@ -33,15 +31,11 @@
+ 
+ /**
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class XMLX509SubjectName extends SignatureElementProxy
+         implements XMLX509DataContent {
+ 
+-   /** {@link java.util.logging} logging facility */
+-    static java.util.logging.Logger log =
+-        java.util.logging.Logger.getLogger(XMLX509SubjectName.class.getName());
+-
+    /**
+     * Constructor X509SubjectName
+     *
+@@ -88,23 +82,21 @@
+       return RFC2253Parser.normalize(this.getTextFromTextChild());
+    }
+ 
+-   /** @inheritDoc */
+-   public boolean equals(Object obj) {
++    /** @inheritDoc */
++    public boolean equals(Object obj) {
++        if (obj == null) {
++            return false;
++        }
+ 
+-      if (!obj.getClass().getName().equals(this.getClass().getName())) {
+-         return false;
+-      }
++        if (!this.getClass().getName().equals(obj.getClass().getName())) {
++            return false;
++        }
+ 
+-      XMLX509SubjectName other = (XMLX509SubjectName) obj;
+-      String otherSubject = other.getSubjectName();
+-      String thisSubject = this.getSubjectName();
++        XMLX509SubjectName other = (XMLX509SubjectName) obj;
++        String otherSubject = other.getSubjectName();
++        String thisSubject = this.getSubjectName();
+ 
+-      if (otherSubject.equals(thisSubject)) {
+-            return true;
+-      }
+-
+-       return false;
+-
++        return thisSubject.equals(otherSubject);
+    }
+ 
+    /** @inheritDoc */
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/InvalidKeyResolverException.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/InvalidKeyResolverException.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/InvalidKeyResolverException.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/InvalidKeyResolverException.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -29,7 +28,7 @@
+ /**
+  *
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class InvalidKeyResolverException extends XMLSecurityException {
+ 
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolver.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolver.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolver.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolver.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -26,6 +25,7 @@
+ import java.security.PublicKey;
+ import java.security.cert.X509Certificate;
+ import java.util.ArrayList;
++import java.util.Iterator;
+ import java.util.List;
+ 
+ import javax.crypto.SecretKey;
+@@ -39,7 +39,8 @@
+  * KeyResolver is factory class for subclass of KeyResolverSpi that
+  * represent child element of KeyInfo.
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
++ * @version %I%, %G%
+  */
+ public class KeyResolver {
+ 
+@@ -72,6 +73,7 @@
+                   InstantiationException {
+       this._resolverSpi =
+          (KeyResolverSpi) Class.forName(className).newInstance();
++      this._resolverSpi.setGlobalResolver(true);
+    }
+ 
+    /**
+@@ -83,21 +85,17 @@
+       return KeyResolver._resolverVector.size();
+    }
+ 
+-   /**
+-    * Method item
+-    *
+-    * @param i
+-    * @return the number i resolver registerd
+-    * @throws KeyResolverException
+-    */
+-   public static KeyResolver item(int i) throws KeyResolverException {
+-
+-           KeyResolver resolver = (KeyResolver) KeyResolver._resolverVector.get(i);
+-      if (resolver==null) {
+-         throw new KeyResolverException("utils.resolver.noClass");
+-      }
+-
+-      return resolver;
++   public static void hit(Iterator hintI) {
++           ResolverIterator hint = (ResolverIterator) hintI;
++           int i = hint.i;
++           if (i!=1 && hint.res ==_resolverVector) {
++                   List resolverVector=(List)((ArrayList)_resolverVector).clone();
++                Object ob=resolverVector.remove(i-1);
++                resolverVector.add(0,ob);
++                 _resolverVector=resolverVector;
++         } else {
++                 //System.out.println("KeyResolver hitting");
++         }
+    }
+ 
+    /**
+@@ -106,17 +104,19 @@
+     * @param element
+     * @param BaseURI
+     * @param storage
+-    * @return the instance that happends to implement the thing.
++    * @return The certificate represented by the element.
+     *
+     * @throws KeyResolverException
+     */
+-   public static final KeyResolver getInstance(
++   public static final X509Certificate getX509Certificate(
+            Element element, String BaseURI, StorageResolver storage)
+               throws KeyResolverException {
+ 
+-      for (int i = 0; i < KeyResolver._resolverVector.size(); i++) {
++          // use the old vector to not be hit by updates
++          List resolverVector = KeyResolver._resolverVector;
++      for (int i = 0; i < resolverVector.size(); i++) {
+                   KeyResolver resolver=
+-            (KeyResolver) KeyResolver._resolverVector.get(i);
++            (KeyResolver) resolverVector.get(i);
+ 
+                   if (resolver==null) {
+             Object exArgs[] = {
+@@ -127,11 +127,63 @@
+ 
+             throw new KeyResolverException("utils.resolver.noClass", exArgs);
+          }
+-         if (true)
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "check resolvability by class " + resolver.getClass());
++         if (log.isLoggable(java.util.logging.Level.FINE))
++                log.log(java.util.logging.Level.FINE, "check resolvability by class " + resolver.getClass());
+ 
+-         if (resolver.canResolve(element, BaseURI, storage)) {
+-            return resolver;
++         X509Certificate cert=resolver.resolveX509Certificate(element, BaseURI, storage);
++         if (cert!=null) {
++            return cert;
++         }
++      }
++
++      Object exArgs[] = {
++         (((element != null) && (element.getNodeType() == Node.ELEMENT_NODE))
++          ? element.getTagName()
++          : "null") };
++
++      throw new KeyResolverException("utils.resolver.noClass", exArgs);
++   }
++   /**
++    * Method getInstance
++    *
++    * @param element
++    * @param BaseURI
++    * @param storage
++    * @return the public key contained in the element
++    *
++    * @throws KeyResolverException
++    */
++   public static final PublicKey getPublicKey(
++           Element element, String BaseURI, StorageResolver storage)
++              throws KeyResolverException {
++
++          List resolverVector = KeyResolver._resolverVector;
++      for (int i = 0; i < resolverVector.size(); i++) {
++                  KeyResolver resolver=
++            (KeyResolver) resolverVector.get(i);
++
++                  if (resolver==null) {
++            Object exArgs[] = {
++               (((element != null)
++                 && (element.getNodeType() == Node.ELEMENT_NODE))
++                ? element.getTagName()
++                : "null") };
++
++            throw new KeyResolverException("utils.resolver.noClass", exArgs);
++         }
++         if (log.isLoggable(java.util.logging.Level.FINE))
++                log.log(java.util.logging.Level.FINE, "check resolvability by class " + resolver.getClass());
++
++         PublicKey cert=resolver.resolvePublicKey(element, BaseURI, storage);
++         if (cert!=null) {
++                 if (i!=0 && resolverVector==_resolverVector) {
++                         //update resolver.
++                         resolverVector=(List)((ArrayList)_resolverVector).clone();
++                                 Object ob=resolverVector.remove(i);
++                                 resolverVector.add(0,ob);
++                                 _resolverVector=resolverVector;
++                 }
++                 return cert;
+          }
+       }
+ 
+@@ -182,34 +234,6 @@
+       KeyResolver._resolverVector.add(0, className);
+    }
+ 
+-   /*
+-    * Method resolve
+-    *
+-    * @param element
+-    *
+-    * @throws KeyResolverException
+-    */
+-
+-   /**
+-    * Method resolveStatic
+-    *
+-    * @param element
+-    * @param BaseURI
+-    * @param storage
+-    * @return resolve from the static register an element
+-    *
+-    * @throws KeyResolverException
+-    */
+-   public static PublicKey resolveStatic(
+-           Element element, String BaseURI, StorageResolver storage)
+-              throws KeyResolverException {
+-
+-      KeyResolver myResolver = KeyResolver.getInstance(element, BaseURI,
+-                                  storage);
+-
+-      return myResolver.resolvePublicKey(element, BaseURI, storage);
+-   }
+-
+    /**
+     * Method resolve
+     *
+@@ -223,7 +247,7 @@
+    public PublicKey resolvePublicKey(
+            Element element, String BaseURI, StorageResolver storage)
+               throws KeyResolverException {
+-      return this._resolverSpi.engineResolvePublicKey(element, BaseURI, storage);
++      return this._resolverSpi.engineLookupAndResolvePublicKey(element, BaseURI, storage);
+    }
+ 
+    /**
+@@ -239,7 +263,7 @@
+    public X509Certificate resolveX509Certificate(
+            Element element, String BaseURI, StorageResolver storage)
+               throws KeyResolverException {
+-      return this._resolverSpi.engineResolveX509Certificate(element, BaseURI,
++      return this._resolverSpi.engineLookupResolveX509Certificate(element, BaseURI,
+               storage);
+    }
+ 
+@@ -253,7 +277,7 @@
+    public SecretKey resolveSecretKey(
+            Element element, String BaseURI, StorageResolver storage)
+               throws KeyResolverException {
+-      return this._resolverSpi.engineResolveSecretKey(element, BaseURI,
++      return this._resolverSpi.engineLookupAndResolveSecretKey(element, BaseURI,
+               storage);
+    }
+ 
+@@ -277,14 +301,6 @@
+       return this._resolverSpi.engineGetProperty(key);
+    }
+ 
+-   /**
+-    * Method getPropertyKeys
+-    *
+-    * @return the properties key registerd in this resolver
+-    */
+-   public String[] getPropertyKeys() {
+-      return this._resolverSpi.engineGetPropertyKeys();
+-   }
+ 
+    /**
+     * Method understandsProperty
+@@ -296,18 +312,6 @@
+       return this._resolverSpi.understandsProperty(propertyToTest);
+    }
+ 
+-   /**
+-    * Method canResolve
+-    *
+-    * @param element
+-    * @param BaseURI
+-    * @param storage
+-    * @return true if can resolve the key in the element
+-    */
+-   public boolean canResolve(Element element, String BaseURI,
+-                             StorageResolver storage) {
+-      return this._resolverSpi.engineCanResolve(element, BaseURI, storage);
+-   }
+ 
+    /**
+     * Method resolverClassName
+@@ -317,4 +321,37 @@
+    public String resolverClassName() {
+       return this._resolverSpi.getClass().getName();
+    }
++
++   static class ResolverIterator implements Iterator {
++           List res;
++                Iterator it;
++                int i;
++           public ResolverIterator(List list) {
++                res = list;
++                it = res.iterator();
++        }
++                public boolean hasNext() {
++                        // TODO Auto-generated method stub
++                        return it.hasNext();
++                }
++
++                public Object next() {
++                        i++;
++                        KeyResolver resolver = (KeyResolver) it.next();
++                      if (resolver==null) {
++                         throw new RuntimeException("utils.resolver.noClass");
++                      }
++
++                      return resolver._resolverSpi;
++                }
++
++                public void remove() {
++                        // TODO Auto-generated method stub
++
++                }
++
++        };
++        public static Iterator iterator() {
++                return new ResolverIterator(_resolverVector);
++   }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolverException.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolverException.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolverException.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolverException.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -31,7 +30,7 @@
+  *
+  *
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  *
+  */
+ public class KeyResolverException extends XMLSecurityException {
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolverSpi.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolverSpi.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolverSpi.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolverSpi.java
+@@ -20,17 +20,15 @@
+  */
+ package com.sun.org.apache.xml.internal.security.keys.keyresolver;
+ 
+-
+-
+ import java.security.PublicKey;
+ import java.security.cert.X509Certificate;
++import java.util.HashMap;
+ 
+ import javax.crypto.SecretKey;
+ 
+ import com.sun.org.apache.xml.internal.security.keys.storage.StorageResolver;
+ import org.w3c.dom.Element;
+ 
+-
+ /**
+  * This class is abstract class for a child KeyInfo Elemnet.
+  *
+@@ -41,14 +39,10 @@
+  *   JAVACLASS="MyPackage.MyKeyValueImpl"//gt;
+  * </PRE>
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
++ * @version $Revision: 1.5 $
+  */
+ public abstract class KeyResolverSpi {
+-
+-   /** {@link java.util.logging} logging facility */
+-    static java.util.logging.Logger log =
+-        java.util.logging.Logger.getLogger(KeyResolverSpi.class.getName());
+-
+    /**
+     * This method helps the {@link com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolver} to decide whether a
+     * {@link com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolverSpi} is able to perform the requested action.
+@@ -56,10 +50,12 @@
+     * @param element
+     * @param BaseURI
+     * @param storage
+-    * @return true if can resolve the key in the element
++    * @return
+     */
+-   abstract public boolean engineCanResolve(Element element, String BaseURI,
+-                                            StorageResolver storage);
++   public boolean engineCanResolve(Element element, String BaseURI,
++                                                    StorageResolver storage) {
++           throw new UnsupportedOperationException();
++   }
+ 
+    /**
+     * Method engineResolvePublicKey
+@@ -71,9 +67,60 @@
+     *
+     * @throws KeyResolverException
+     */
+-   abstract public PublicKey engineResolvePublicKey(
++   public PublicKey engineResolvePublicKey(
+       Element element, String BaseURI, StorageResolver storage)
+-         throws KeyResolverException;
++         throws KeyResolverException {
++           throw new UnsupportedOperationException();
++    };
++
++   /**
++    * Method engineResolvePublicKey
++    *
++    * @param element
++    * @param BaseURI
++    * @param storage
++    * @return resolved public key from the registered from the element.
++    *
++    * @throws KeyResolverException
++    */
++    public PublicKey engineLookupAndResolvePublicKey(
++      Element element, String BaseURI, StorageResolver storage)
++         throws KeyResolverException {
++        KeyResolverSpi tmp = cloneIfNeeded();
++        if (!tmp.engineCanResolve(element, BaseURI, storage))
++                return null;
++            return tmp.engineResolvePublicKey(element, BaseURI, storage);
++    }
++
++    private KeyResolverSpi cloneIfNeeded() throws KeyResolverException {
++        KeyResolverSpi tmp=this;
++        if (globalResolver) {
++                try {
++                        tmp = (KeyResolverSpi) getClass().newInstance();
++                } catch (InstantiationException e) {
++                        throw new KeyResolverException("",e);
++                } catch (IllegalAccessException e) {
++                        throw new KeyResolverException("",e);
++                }
++        }
++        return tmp;
++    }
++
++    /**
++     * Method engineResolveCertificate
++     *
++     * @param element
++     * @param BaseURI
++     * @param storage
++     * @return resolved X509Certificate key from the registered from the elements
++     *
++     * @throws KeyResolverException
++     */
++    public X509Certificate engineResolveX509Certificate(
++       Element element, String BaseURI, StorageResolver storage)
++          throws KeyResolverException{
++                   throw new UnsupportedOperationException();
++    };
+ 
+    /**
+     * Method engineResolveCertificate
+@@ -85,9 +132,30 @@
+     *
+     * @throws KeyResolverException
+     */
+-   abstract public X509Certificate engineResolveX509Certificate(
++    public X509Certificate engineLookupResolveX509Certificate(
+       Element element, String BaseURI, StorageResolver storage)
+-         throws KeyResolverException;
++         throws KeyResolverException {
++        KeyResolverSpi tmp = cloneIfNeeded();
++        if (!tmp.engineCanResolve(element, BaseURI, storage))
++                return null;
++        return tmp.engineResolveX509Certificate(element, BaseURI, storage);
++
++    }
++    /**
++     * Method engineResolveSecretKey
++     *
++     * @param element
++     * @param BaseURI
++     * @param storage
++     * @return resolved SecretKey key from the registered from the elements
++     *
++     * @throws KeyResolverException
++     */
++    public SecretKey engineResolveSecretKey(
++       Element element, String BaseURI, StorageResolver storage)
++          throws KeyResolverException{
++                   throw new UnsupportedOperationException();
++    };
+ 
+    /**
+     * Method engineResolveSecretKey
+@@ -99,12 +167,19 @@
+     *
+     * @throws KeyResolverException
+     */
+-   abstract public SecretKey engineResolveSecretKey(
++   public SecretKey engineLookupAndResolveSecretKey(
+       Element element, String BaseURI, StorageResolver storage)
+-         throws KeyResolverException;
++         throws KeyResolverException {
++           KeyResolverSpi tmp = cloneIfNeeded();
++           if (!tmp.engineCanResolve(element, BaseURI, storage))
++                   return null;
++                return tmp.engineResolveSecretKey(element, BaseURI, storage);
++   }
+ 
+    /** Field _properties */
+-   protected java.util.Map _properties = new java.util.HashMap(10);
++   protected java.util.Map _properties = null;
++
++   protected boolean globalResolver=false;
+ 
+    /**
+     * Method engineSetProperty
+@@ -113,19 +188,8 @@
+     * @param value
+     */
+    public void engineSetProperty(String key, String value) {
+-
+-      java.util.Iterator i = this._properties.keySet().iterator();
+-
+-      while (i.hasNext()) {
+-         String c = (String) i.next();
+-
+-         if (c.equals(key)) {
+-            key = c;
+-
+-            break;
+-         }
+-      }
+-
++           if (_properties==null)
++                   _properties=new HashMap();
+       this._properties.put(key, value);
+    }
+ 
+@@ -136,49 +200,26 @@
+     * @return obtain the property appointed by key
+     */
+    public String engineGetProperty(String key) {
+-
+-      java.util.Iterator i = this._properties.keySet().iterator();
+-
+-      while (i.hasNext()) {
+-         String c = (String) i.next();
+-
+-         if (c.equals(key)) {
+-            key = c;
+-
+-            break;
+-         }
+-      }
++           if (_properties==null)
++                   return null;
+ 
+       return (String) this._properties.get(key);
+    }
+ 
+    /**
+-    * Method engineGetPropertyKeys
+-    *
+-    * @return the keys of properties known by this resolver
+-    */
+-   public String[] engineGetPropertyKeys() {
+-      return new String[0];
+-   }
+-
+-   /**
+     * Method understandsProperty
+     *
+     * @param propertyToTest
+     * @return true if understood the property
+     */
+    public boolean understandsProperty(String propertyToTest) {
++           if (_properties==null)
++                   return false;
+ 
+-      String[] understood = this.engineGetPropertyKeys();
++      return  this._properties.get(propertyToTest)!=null;
++   }
++   public void setGlobalResolver(boolean globalResolver) {
++        this.globalResolver = globalResolver;
++   }
+ 
+-      if (understood != null) {
+-         for (int i = 0; i < understood.length; i++) {
+-            if (understood[i].equals(propertyToTest)) {
+-               return true;
+-            }
+-         }
+-      }
+-
+-      return false;
+-   }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/DSAKeyValueResolver.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/DSAKeyValueResolver.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/DSAKeyValueResolver.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/DSAKeyValueResolver.java
+@@ -37,46 +37,10 @@
+ 
+ /**
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class DSAKeyValueResolver extends KeyResolverSpi {
+ 
+-   /** Field _dsaKeyElement */
+-   private Element _dsaKeyElement = null;
+-
+-   /** @inheritDoc */
+-   public boolean engineCanResolve(Element element, String BaseURI,
+-                                   StorageResolver storage) {
+-
+-      if (element == null) {
+-         return false;
+-      }
+-
+-      boolean isKeyValue = XMLUtils.elementIsInSignatureSpace(element,
+-                              Constants._TAG_KEYVALUE);
+-      boolean isDSAKeyValue = XMLUtils.elementIsInSignatureSpace(element,
+-                                 Constants._TAG_DSAKEYVALUE);
+-
+-      if (isKeyValue) {
+-
+-            this._dsaKeyElement =
+-                XMLUtils.selectDsNode(element.getFirstChild(),Constants._TAG_DSAKEYVALUE,0);
+-
+-            if (this._dsaKeyElement != null) {
+-               return true;
+-            }
+-      } else if (isDSAKeyValue) {
+-
+-         // this trick is needed to allow the RetrievalMethodResolver to eat a
+-         // ds:DSAKeyValue directly (without KeyValue)
+-         this._dsaKeyElement = element;
+-
+-         return true;
+-      }
+-
+-      return false;
+-   }
+-
+    /**
+     * Method engineResolvePublicKey
+     *
+@@ -85,20 +49,30 @@
+     * @param storage
+     * @return null if no {@link PublicKey} could be obtained
+     */
+-   public PublicKey engineResolvePublicKey(
++   public PublicKey engineLookupAndResolvePublicKey(
+            Element element, String BaseURI, StorageResolver storage) {
++            if (element == null) {
++                 return null;
++            }
++            Element dsaKeyElement=null;
++            boolean isKeyValue = XMLUtils.elementIsInSignatureSpace(element,
++                                      Constants._TAG_KEYVALUE);
++            if (isKeyValue) {
++                dsaKeyElement =
++                        XMLUtils.selectDsNode(element.getFirstChild(),Constants._TAG_DSAKEYVALUE,0);
++       } else if (XMLUtils.elementIsInSignatureSpace(element,
++               Constants._TAG_DSAKEYVALUE)) {
++                 // this trick is needed to allow the RetrievalMethodResolver to eat a
++                 // ds:DSAKeyValue directly (without KeyValue)
++                 dsaKeyElement = element;
++            }
+ 
+-      if (this._dsaKeyElement == null) {
+-         boolean weCanResolve = this.engineCanResolve(element, BaseURI,
+-                                   storage);
+-
+-         if (!weCanResolve || (this._dsaKeyElement == null)) {
+-            return null;
+-         }
++      if (dsaKeyElement == null) {
++                    return null;
+       }
+ 
+       try {
+-         DSAKeyValue dsaKeyValue = new DSAKeyValue(this._dsaKeyElement,
++         DSAKeyValue dsaKeyValue = new DSAKeyValue(dsaKeyElement,
+                                                    BaseURI);
+          PublicKey pk = dsaKeyValue.getPublicKey();
+ 
+@@ -112,13 +86,13 @@
+ 
+ 
+    /** @inheritDoc */
+-   public X509Certificate engineResolveX509Certificate(
++   public X509Certificate engineLookupResolveX509Certificate(
+            Element element, String BaseURI, StorageResolver storage) {
+       return null;
+    }
+ 
+    /** @inheritDoc */
+-   public javax.crypto.SecretKey engineResolveSecretKey(
++   public javax.crypto.SecretKey engineLookupAndResolveSecretKey(
+            Element element, String BaseURI, StorageResolver storage){
+       return null;
+    }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/EncryptedKeyResolver.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/EncryptedKeyResolver.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/EncryptedKeyResolver.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/EncryptedKeyResolver.java
+@@ -56,7 +56,6 @@
+                         RSAKeyValueResolver.class.getName());
+ 
+ 
+-        Key _key;
+         Key _kek;
+         String _algorithm;
+ 
+@@ -66,7 +65,6 @@
+          * @param algorithm
+          */
+         public EncryptedKeyResolver(String algorithm) {
+-                _key = null;
+                 _kek = null;
+         _algorithm=algorithm;
+         }
+@@ -78,64 +76,49 @@
+          */
+ 
+         public EncryptedKeyResolver(String algorithm, Key kek) {
+-                _key = null;
+                 _algorithm = algorithm;
+                 _kek = kek;
+ 
+         }
+ 
+-        /**
+-         * Method engineCanResolve
+-         *
+-         * @param element
+-         * @param BaseURI
+-         * @param storage
+-         * @return true if can resolve the key in the element
+-         *
+-         */
+-
+-        public boolean engineCanResolve(Element element, String BaseURI,
+-                                   StorageResolver storage) {
+-          if (true)
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "EncryptedKeyResolver - Can I resolve " + element.getTagName());
+-
+-      if (element == null) {
+-         return false;
+-      }
+-
+-      boolean isEncryptedKey = XMLUtils.elementIsInEncryptionSpace(element,
+-                              EncryptionConstants._TAG_ENCRYPTEDKEY);
+-
+-      if (isEncryptedKey) {
+-                  if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Passed an Encrypted Key");
+-                  try {
+-                          XMLCipher cipher = XMLCipher.getInstance();
+-                          cipher.init(XMLCipher.UNWRAP_MODE, _kek);
+-                          EncryptedKey ek = cipher.loadEncryptedKey(element);
+-                          _key = cipher.decryptKey(ek, _algorithm);
+-                  }
+-                  catch (Exception e) {}
+-      }
+-
+-      return (_key != null);
+-   }
+-
+     /** @inheritDoc */
+-   public PublicKey engineResolvePublicKey(
++   public PublicKey engineLookupAndResolvePublicKey(
+            Element element, String BaseURI, StorageResolver storage) {
+ 
+            return null;
+    }
+ 
+    /** @inheritDoc */
+-   public X509Certificate engineResolveX509Certificate(
++   public X509Certificate engineLookupResolveX509Certificate(
+            Element element, String BaseURI, StorageResolver storage) {
+       return null;
+    }
+ 
+    /** @inheritDoc */
+-   public javax.crypto.SecretKey engineResolveSecretKey(
++   public javax.crypto.SecretKey engineLookupAndResolveSecretKey(
+            Element element, String BaseURI, StorageResolver storage) {
+-      return (SecretKey) _key;
++           SecretKey key=null;
++           if (log.isLoggable(java.util.logging.Level.FINE))
++                        log.log(java.util.logging.Level.FINE, "EncryptedKeyResolver - Can I resolve " + element.getTagName());
++
++              if (element == null) {
++                 return null;
++              }
++
++              boolean isEncryptedKey = XMLUtils.elementIsInEncryptionSpace(element,
++                                      EncryptionConstants._TAG_ENCRYPTEDKEY);
++
++              if (isEncryptedKey) {
++                          log.log(java.util.logging.Level.FINE, "Passed an Encrypted Key");
++                          try {
++                                  XMLCipher cipher = XMLCipher.getInstance();
++                                  cipher.init(XMLCipher.UNWRAP_MODE, _kek);
++                                  EncryptedKey ek = cipher.loadEncryptedKey(element);
++                                  key = (SecretKey) cipher.decryptKey(ek, _algorithm);
++                          }
++                          catch (Exception e) {}
++              }
++
++      return key;
+    }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/RSAKeyValueResolver.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/RSAKeyValueResolver.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/RSAKeyValueResolver.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/RSAKeyValueResolver.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -38,7 +37,7 @@
+ 
+ /**
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class RSAKeyValueResolver extends KeyResolverSpi {
+ 
+@@ -48,75 +47,55 @@
+                         RSAKeyValueResolver.class.getName());
+ 
+    /** Field _rsaKeyElement */
+-   private Element _rsaKeyElement = null;
++
+ 
+    /** @inheritDoc */
+-   public boolean engineCanResolve(Element element, String BaseURI,
+-                                   StorageResolver storage) {
+-          if (true)
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Can I resolve " + element.getTagName());
+-
++   public PublicKey engineLookupAndResolvePublicKey(
++           Element element, String BaseURI, StorageResolver storage) {
++           if (log.isLoggable(java.util.logging.Level.FINE))
++                        log.log(java.util.logging.Level.FINE, "Can I resolve " + element.getTagName());
+       if (element == null) {
+-         return false;
++         return null;
+       }
+ 
+-      boolean isKeyValue = XMLUtils.elementIsInSignatureSpace(element,
+-                              Constants._TAG_KEYVALUE);
+-      boolean isRSAKeyValue = XMLUtils.elementIsInSignatureSpace(element,
+-                                 Constants._TAG_RSAKEYVALUE);
+-
+-      if (isKeyValue) {
+-            this._rsaKeyElement = XMLUtils.selectDsNode(element.getFirstChild(),
+-                    Constants._TAG_RSAKEYVALUE, 0);
+-
+-            if (this._rsaKeyElement != null) {
+-               return true;
+-            }
+-      } else if (isRSAKeyValue) {
+-
++          boolean isKeyValue = XMLUtils.elementIsInSignatureSpace(element,
++                                              Constants._TAG_KEYVALUE);
++          Element rsaKeyElement=null;
++          if (isKeyValue) {
++                   rsaKeyElement = XMLUtils.selectDsNode(element.getFirstChild(),
++                                    Constants._TAG_RSAKEYVALUE, 0);
++          } else if (XMLUtils.elementIsInSignatureSpace(element,
++              Constants._TAG_RSAKEYVALUE)) {
+          // this trick is needed to allow the RetrievalMethodResolver to eat a
+          // ds:RSAKeyValue directly (without KeyValue)
+-         this._rsaKeyElement = element;
++         rsaKeyElement = element;
++          }
+ 
+-         return true;
+-      }
+ 
+-      return false;
+-   }
+-
+-   /** @inheritDoc */
+-   public PublicKey engineResolvePublicKey(
+-           Element element, String BaseURI, StorageResolver storage) {
+-
+-      if (this._rsaKeyElement == null) {
+-         boolean weCanResolve = this.engineCanResolve(element, BaseURI,
+-                                   storage);
+-
+-         if (!weCanResolve || (this._rsaKeyElement == null)) {
+-            return null;
+-         }
++      if (rsaKeyElement == null) {
++         return null;
+       }
+ 
+       try {
+-         RSAKeyValue rsaKeyValue = new RSAKeyValue(this._rsaKeyElement,
++         RSAKeyValue rsaKeyValue = new RSAKeyValue(rsaKeyElement,
+                                                    BaseURI);
+ 
+          return rsaKeyValue.getPublicKey();
+       } catch (XMLSecurityException ex) {
+-         if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "XMLSecurityException", ex);
++         log.log(java.util.logging.Level.FINE, "XMLSecurityException", ex);
+       }
+ 
+       return null;
+    }
+ 
+    /** @inheritDoc */
+-   public X509Certificate engineResolveX509Certificate(
++   public X509Certificate engineLookupResolveX509Certificate(
+            Element element, String BaseURI, StorageResolver storage) {
+       return null;
+    }
+ 
+    /** @inheritDoc */
+-   public javax.crypto.SecretKey engineResolveSecretKey(
++   public javax.crypto.SecretKey engineLookupAndResolveSecretKey(
+            Element element, String BaseURI, StorageResolver storage) {
+       return null;
+    }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/RetrievalMethodResolver.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/RetrievalMethodResolver.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/RetrievalMethodResolver.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/RetrievalMethodResolver.java
+@@ -28,7 +28,15 @@
+ import java.security.cert.CertificateException;
+ import java.security.cert.CertificateFactory;
+ import java.security.cert.X509Certificate;
++import java.util.ArrayList;
++import java.util.Iterator;
++import java.util.List;
++import java.util.ListIterator;
++import java.util.Set;
+ 
++import javax.xml.parsers.ParserConfigurationException;
++
++import com.sun.org.apache.xml.internal.security.c14n.CanonicalizationException;
+ import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
+ import com.sun.org.apache.xml.internal.security.keys.content.RetrievalMethod;
+ import com.sun.org.apache.xml.internal.security.keys.content.x509.XMLX509Certificate;
+@@ -44,6 +52,7 @@
+ import org.w3c.dom.Attr;
+ import org.w3c.dom.Element;
+ import org.w3c.dom.Node;
++import org.xml.sax.SAXException;
+ 
+ 
+ /**
+@@ -55,7 +64,7 @@
+  * RetrievalMethodResolver cannot handle itself, resolving of the extracted
+  * element is delegated back to the KeyResolver mechanism.
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $ modified by Dave Garcia
+  */
+ public class RetrievalMethodResolver extends KeyResolverSpi {
+ 
+@@ -65,26 +74,6 @@
+                         RetrievalMethodResolver.class.getName());
+ 
+    /**
+-    * Method engineCanResolve
+-    * @inheritDoc
+-    * @param element
+-    * @param BaseURI
+-    * @param storage
+-    *
+-    */
+-   public boolean engineCanResolve(Element element, String BaseURI,
+-                                   StorageResolver storage) {
+-
+-      if
+-         (!XMLUtils.elementIsInSignatureSpace(element,
+-                 Constants._TAG_RETRIEVALMETHOD)) {
+-         return false;
+-      }
+-
+-      return true;
+-   }
+-
+-   /**
+     * Method engineResolvePublicKey
+     * @inheritDoc
+     * @param element
+@@ -92,82 +81,59 @@
+     * @param storage
+     *
+     */
+-   public PublicKey engineResolvePublicKey(
++   public PublicKey engineLookupAndResolvePublicKey(
+            Element element, String BaseURI, StorageResolver storage)
+               {
++           if  (!XMLUtils.elementIsInSignatureSpace(element,
++               Constants._TAG_RETRIEVALMETHOD)) {
++                   return null;
++           }
+ 
+       try {
+-         RetrievalMethod rm = new RetrievalMethod(element, BaseURI);
+-         Attr uri = rm.getURIAttr();
++                   //Create a retrieval method over the given element
++                   RetrievalMethod rm = new RetrievalMethod(element, BaseURI);
++               String type = rm.getType();
++                   XMLSignatureInput resource=resolveInput(rm,BaseURI);
++           if (RetrievalMethod.TYPE_RAWX509.equals(type)) {
++                //a raw certificate, direct parsing is done!
++                X509Certificate cert=getRawCertificate(resource);
++                                if (cert != null) {
++                                 return cert.getPublicKey();
++                            }
++                                return null;
++            };
++                        Element e = obtainRefrenceElement(resource);
++                        return resolveKey(e,BaseURI,storage);
++          } catch (XMLSecurityException ex) {
++         log.log(java.util.logging.Level.FINE, "XMLSecurityException", ex);
++      } catch (CertificateException ex) {
++         log.log(java.util.logging.Level.FINE, "CertificateException", ex);
++      } catch (IOException ex) {
++         log.log(java.util.logging.Level.FINE, "IOException", ex);
++      } catch (ParserConfigurationException e) {
++                  log.log(java.util.logging.Level.FINE, "ParserConfigurationException", e);
++          } catch (SAXException e) {
++                 log.log(java.util.logging.Level.FINE, "SAXException", e);
++          }
++      return null;
++   }
+ 
+-         // type can be null because it's optional
+-         String type = rm.getType();
+-         Transforms transforms = rm.getTransforms();
+-         ResourceResolver resRes = ResourceResolver.getInstance(uri, BaseURI);
+-
+-         if (resRes != null) {
+-            XMLSignatureInput resource = resRes.resolve(uri, BaseURI);
+-            if (true)
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Before applying Transforms, resource has "
+-                      + resource.getBytes().length + "bytes");
+-
+-            if (transforms != null) {
+-               if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "We have Transforms");
+-
+-               resource = transforms.performTransforms(resource);
+-            }
+-            if (true) {
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "After applying Transforms, resource has "
+-                      + resource.getBytes().length + "bytes");
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Resolved to resource " + resource.getSourceURI());
+-            }
+-
+-            byte inputBytes[] = resource.getBytes();
+-
+-            if ((type != null) && type.equals(RetrievalMethod.TYPE_RAWX509)) {
+-
+-               // if the resource stores a raw certificate, we have to handle it
+-               CertificateFactory certFact =
+-                  CertificateFactory
+-                     .getInstance(XMLX509Certificate.JCA_CERT_ID);
+-               X509Certificate cert =
+-                  (X509Certificate) certFact
+-                     .generateCertificate(new ByteArrayInputStream(inputBytes));
+-
+-               if (cert != null) {
+-                  return cert.getPublicKey();
+-               }
+-            } else {
+-
+-               // otherwise, we parse the resource, create an Element and delegate
+-                if (true)
+-                        if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "we have to parse " + inputBytes.length + " bytes");
+-
+-               Element e = this.getDocFromBytes(inputBytes);
+-               if (true)
+-                    if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Now we have a {" + e.getNamespaceURI() + "}"
+-                         + e.getLocalName() + " Element");
+-
+-               if (e != null) {
+-                  KeyResolver newKeyResolver = KeyResolver.getInstance(getFirstElementChild(e),
+-                                                  BaseURI, storage);
+-
+-                  if (newKeyResolver != null) {
+-                     return newKeyResolver.resolvePublicKey(getFirstElementChild(e), BaseURI,
+-                                                            storage);
+-                  }
+-               }
+-            }
+-         }
+-      } catch (XMLSecurityException ex) {
+-         if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "XMLSecurityException", ex);
+-      } catch (CertificateException ex) {
+-         if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "CertificateException", ex);
+-      } catch (IOException ex) {
+-         if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "IOException", ex);
+-      }
+-
+-      return null;
++   static private Element obtainRefrenceElement(XMLSignatureInput resource) throws CanonicalizationException, ParserConfigurationException, IOException, SAXException, KeyResolverException {
++           Element e;
++           if (resource.isElement()){
++                   e=(Element) resource.getSubNode();
++           } else if (resource.isNodeSet()) {
++                   //Retrieved resource is a nodeSet
++                   e=getDocumentElement(resource.getNodeSet());
++           } else {
++                   //Retrieved resource is an inputStream
++                   byte inputBytes[] = resource.getBytes();
++                   e = getDocFromBytes(inputBytes);
++                   //otherwise, we parse the resource, create an Element and delegate
++                   if (log.isLoggable(java.util.logging.Level.FINE))
++                           log.log(java.util.logging.Level.FINE, "we have to parse " + inputBytes.length + " bytes");
++           }
++           return e;
+    }
+ 
+    /**
+@@ -178,85 +144,100 @@
+     * @param storage
+     *
+     */
+-   public X509Certificate engineResolveX509Certificate(
++   public X509Certificate engineLookupResolveX509Certificate(
+            Element element, String BaseURI, StorageResolver storage)
+               {
++           if  (!XMLUtils.elementIsInSignatureSpace(element,
++               Constants._TAG_RETRIEVALMETHOD)) {
++                   return null;
++           }
+ 
+-      try {
++           try {
+          RetrievalMethod rm = new RetrievalMethod(element, BaseURI);
+-         Attr uri = rm.getURIAttr();
+-         Transforms transforms = rm.getTransforms();
+-         if (true)
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Asked to resolve URI " + uri);
++                 String type = rm.getType();
++                 XMLSignatureInput resource=resolveInput(rm,BaseURI);
++                 if (RetrievalMethod.TYPE_RAWX509.equals(type)) {
++                X509Certificate cert=getRawCertificate(resource);
++            return cert;
++                 }
++                 Element e = obtainRefrenceElement(resource);
++                 return resolveCertificate(e,BaseURI,storage);
++      } catch (XMLSecurityException ex) {
++         log.log(java.util.logging.Level.FINE, "XMLSecurityException", ex);
++      } catch (CertificateException ex) {
++         log.log(java.util.logging.Level.FINE, "CertificateException", ex);
++      } catch (IOException ex) {
++         log.log(java.util.logging.Level.FINE, "IOException", ex);
++          } catch (ParserConfigurationException e) {
++                  log.log(java.util.logging.Level.FINE, "ParserConfigurationException", e);
++          } catch (SAXException e) {
++                 log.log(java.util.logging.Level.FINE, "SAXException", e);
++          }
++      return null;
++   }
+ 
+-         ResourceResolver resRes = ResourceResolver.getInstance(uri, BaseURI);
++   /**
++    * Retrieves a x509Certificate from the given information
++    * @param e
++    * @param BaseURI
++    * @param storage
++    * @return
++    * @throws KeyResolverException
++    */
++   static private X509Certificate resolveCertificate(Element e,String BaseURI,StorageResolver storage) throws KeyResolverException{
++                  if (log.isLoggable(java.util.logging.Level.FINE))
++                          log.log(java.util.logging.Level.FINE, "Now we have a {" + e.getNamespaceURI() + "}"+ e.getLocalName() + " Element");
++                  //An element has been provided
++          if (e != null) {
++                          return KeyResolver.getX509Certificate(e,BaseURI, storage);
++                  }
++                  return null;
++   }
+ 
+-         if (resRes != null) {
+-            XMLSignatureInput resource = resRes.resolve(uri, BaseURI);
+-            if (true)
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Before applying Transforms, resource has "
+-                      + resource.getBytes().length + "bytes");
++   /**
++    * Retrieves a x509Certificate from the given information
++    * @param e
++    * @param BaseURI
++    * @param storage
++    * @return
++    * @throws KeyResolverException
++    */
++   static private PublicKey resolveKey(Element e,String BaseURI,StorageResolver storage) throws KeyResolverException{
++                  if (log.isLoggable(java.util.logging.Level.FINE))
++                          log.log(java.util.logging.Level.FINE, "Now we have a {" + e.getNamespaceURI() + "}"+ e.getLocalName() + " Element");
++                  //An element has been provided
++          if (e != null) {
++                          return KeyResolver.getPublicKey(e,BaseURI, storage);
++                  }
++                  return null;
++   }
+ 
+-            if (transforms != null) {
+-               if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "We have Transforms");
+-
+-               resource = transforms.performTransforms(resource);
+-            }
+-
+-            if (true) {
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "After applying Transforms, resource has "
+-                      + resource.getBytes().length + "bytes");
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Resolved to resource " + resource.getSourceURI());
+-            }
+-
+-            byte inputBytes[] = resource.getBytes();
+-
+-            if ((rm.getType() != null)
+-                    && rm.getType().equals(RetrievalMethod.TYPE_RAWX509)) {
+-
+-               // if the resource stores a raw certificate, we have to handle it
+-               CertificateFactory certFact =
+-                  CertificateFactory
+-                     .getInstance(XMLX509Certificate.JCA_CERT_ID);
+-               X509Certificate cert =
+-                  (X509Certificate) certFact
+-                     .generateCertificate(new ByteArrayInputStream(inputBytes));
+-
+-               if (cert != null) {
+-                  return cert;
+-               }
+-            } else {
+-
+-               // otherwise, we parse the resource, create an Element and delegate
+-                if (true)
+-                        if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "we have to parse " + inputBytes.length + " bytes");
+-
+-               Element e = this.getDocFromBytes(inputBytes);
+-
+-               if (true)
+-                    if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Now we have a {" + e.getNamespaceURI() + "}"
+-                         + e.getLocalName() + " Element");
+-
+-               if (e != null) {
+-                  KeyResolver newKeyResolver = KeyResolver.getInstance(getFirstElementChild(e),
+-                                                  BaseURI, storage);
+-
+-                  if (newKeyResolver != null) {
+-                     return newKeyResolver.resolveX509Certificate(getFirstElementChild(e), BaseURI,
+-                             storage);
+-                  }
+-               }
+-            }
+-         }
+-      } catch (XMLSecurityException ex) {
+-         if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "XMLSecurityException", ex);
+-      } catch (CertificateException ex) {
+-         if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "CertificateException", ex);
+-      } catch (IOException ex) {
+-         if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "IOException", ex);
+-      }
+-
+-      return null;
++   static private X509Certificate getRawCertificate(XMLSignatureInput resource) throws CanonicalizationException, IOException, CertificateException{
++           byte inputBytes[] = resource.getBytes();
++       // if the resource stores a raw certificate, we have to handle it
++       CertificateFactory certFact =CertificateFactory.getInstance(XMLX509Certificate.JCA_CERT_ID);
++       X509Certificate cert =(X509Certificate) certFact.generateCertificate(new ByteArrayInputStream(inputBytes));
++       return cert;
++   }
++   /**
++    * Resolves the input from the given retrieval method
++    * @return
++    * @throws XMLSecurityException
++    */
++   static private XMLSignatureInput resolveInput(RetrievalMethod rm,String BaseURI) throws XMLSecurityException{
++       Attr uri = rm.getURIAttr();
++           //Apply the trnasforms
++       Transforms transforms = rm.getTransforms();
++       ResourceResolver resRes = ResourceResolver.getInstance(uri, BaseURI);
++       if (resRes != null) {
++          XMLSignatureInput resource = resRes.resolve(uri, BaseURI);
++          if (transforms != null) {
++                  log.log(java.util.logging.Level.FINE, "We have Transforms");
++                          resource = transforms.performTransforms(resource);
++          }
++                  return resource;
++       }
++           return null;
+    }
+ 
+    /**
+@@ -266,18 +247,13 @@
+     * @return the Document Element after parsing bytes
+     * @throws KeyResolverException if something goes wrong
+     */
+-   Element getDocFromBytes(byte[] bytes) throws KeyResolverException {
+-
++   static Element getDocFromBytes(byte[] bytes) throws KeyResolverException {
+       try {
+-         javax.xml.parsers.DocumentBuilderFactory dbf =
+-            javax.xml.parsers.DocumentBuilderFactory.newInstance();
+-
++         javax.xml.parsers.DocumentBuilderFactory dbf =javax.xml.parsers.DocumentBuilderFactory.newInstance();
+          dbf.setNamespaceAware(true);
+-
+          javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
+          org.w3c.dom.Document doc =
+             db.parse(new java.io.ByteArrayInputStream(bytes));
+-
+          return doc.getDocumentElement();
+       } catch (org.xml.sax.SAXException ex) {
+          throw new KeyResolverException("empty", ex);
+@@ -296,16 +272,43 @@
+     * @param storage
+     *
+     */
+-   public javax.crypto.SecretKey engineResolveSecretKey(
++   public javax.crypto.SecretKey engineLookupAndResolveSecretKey(
+            Element element, String BaseURI, StorageResolver storage)
+    {
+       return null;
+    }
+-   static Element getFirstElementChild(Element e){
+-            Node n=e.getFirstChild();
+-            while (n!=null && n.getNodeType()!=Node.ELEMENT_NODE) {
+-                n=n.getNextSibling();
+-            }
+-                return (Element)n;
++
++   static Element getDocumentElement(Set set) {
++           Iterator it=set.iterator();
++           Element e=null;
++           while (it.hasNext()) {
++                   Node currentNode=(Node)it.next();
++                   if (currentNode != null && currentNode.getNodeType() == Node.ELEMENT_NODE) {
++                           e=(Element)currentNode;
++                           break;
++                   }
++
++           }
++           List parents=new ArrayList(10);
++
++                //Obtain all the parents of the elemnt
++                while (e != null) {
++                        parents.add(e);
++                        Node n=e.getParentNode();
++                        if (n == null || n.getNodeType() != Node.ELEMENT_NODE) {
++                                break;
++                        }
++                        e=(Element)n;
++                }
++                //Visit them in reverse order.
++                ListIterator it2=parents.listIterator(parents.size()-1);
++                Element ele=null;
++                while (it2.hasPrevious()) {
++                        ele=(Element)it2.previous();
++                        if (set.contains(ele)) {
++                                return ele;
++                        }
++        }
++                return null;
+    }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/X509CertificateResolver.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/X509CertificateResolver.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/X509CertificateResolver.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/X509CertificateResolver.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -41,7 +40,7 @@
+  * Resolves Certificates which are directly contained inside a
+  * <CODE>ds:X509Certificate</CODE> Element.
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class X509CertificateResolver extends KeyResolverSpi {
+ 
+@@ -49,47 +48,7 @@
+     static java.util.logging.Logger log =
+         java.util.logging.Logger.getLogger(X509CertificateResolver.class.getName());
+ 
+-   /** Field _dsaKeyElement */
+-   Element[] _x509CertKeyElements = null;
+ 
+-   /**
+-    * Method engineCanResolve
+-    * @inheritDoc
+-    * @param element
+-    * @param BaseURI
+-    * @param storage
+-    *
+-    */
+-   public boolean engineCanResolve(Element element, String BaseURI,
+-                                   StorageResolver storage) {
+-          if (true)
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Can I resolve " + element.getTagName() + "?");
+-
+-      if (!XMLUtils.elementIsInSignatureSpace(element,
+-                 Constants._TAG_X509DATA)) {
+-         if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "I can't");
+-
+-         return false;
+-      }
+-
+-
+-         this._x509CertKeyElements = XMLUtils.selectDsNodes(element.getFirstChild(),
+-                 Constants._TAG_X509CERTIFICATE);
+-
+-         if ((this._x509CertKeyElements != null)
+-                 && (this._x509CertKeyElements.length > 0)) {
+-            if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Yes Sir, I can");
+-
+-            return true;
+-         }
+-
+-      if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "I can't");
+-
+-      return false;
+-   }
+-
+-   /** Field _x509certObject[] */
+-   XMLX509Certificate _x509certObject[] = null;
+ 
+    /**
+     * Method engineResolvePublicKey
+@@ -100,11 +59,11 @@
+     *
+     * @throws KeyResolverException
+     */
+-   public PublicKey engineResolvePublicKey(
++   public PublicKey engineLookupAndResolvePublicKey(
+            Element element, String BaseURI, StorageResolver storage)
+               throws KeyResolverException {
+ 
+-      X509Certificate cert = this.engineResolveX509Certificate(element,
++      X509Certificate cert = this.engineLookupResolveX509Certificate(element,
+                                 BaseURI, storage);
+ 
+       if (cert != null) {
+@@ -123,43 +82,33 @@
+     *
+     * @throws KeyResolverException
+     */
+-   public X509Certificate engineResolveX509Certificate(
++   public X509Certificate engineLookupResolveX509Certificate(
+            Element element, String BaseURI, StorageResolver storage)
+               throws KeyResolverException {
+ 
+       try {
+-         if ((this._x509CertKeyElements == null)
+-                 || (this._x509CertKeyElements.length == 0)) {
+-            boolean weCanResolve = this.engineCanResolve(element, BaseURI,
+-                                      storage);
++          Element[] els=XMLUtils.selectDsNodes(element.getFirstChild(),
++                  Constants._TAG_X509CERTIFICATE);
++         if ((els == null) || (els.length == 0)) {
++                 Element el=XMLUtils.selectDsNode(element.getFirstChild(),
++                     Constants._TAG_X509DATA,0);
++             if (el!=null) {
++                 return engineLookupResolveX509Certificate(el, BaseURI, storage);
++             }
++                 return null;
++         }
+ 
+-            if (!weCanResolve || (this._x509CertKeyElements == null)
+-                    || (this._x509CertKeyElements.length == 0)) {
+-               return null;
++         // populate Object array
++         for (int i = 0; i < els.length; i++) {
++                 XMLX509Certificate xmlCert=new XMLX509Certificate(els[i], BaseURI);
++                 X509Certificate cert = xmlCert.getX509Certificate();
++            if (cert!=null) {
++                return cert;
+             }
+          }
+-
+-         this._x509certObject =
+-            new XMLX509Certificate[this._x509CertKeyElements.length];
+-
+-         // populate Object array
+-         for (int i = 0; i < this._x509CertKeyElements.length; i++) {
+-            this._x509certObject[i] =
+-               new XMLX509Certificate(this._x509CertKeyElements[i]
+-                  , BaseURI);
+-         }
+-
+-         for (int i = 0; i < this._x509certObject.length; i++) {
+-            X509Certificate cert = this._x509certObject[i].getX509Certificate();
+-
+-            if (cert != null) {
+-               return cert;
+-            }
+-         }
+-
+          return null;
+       } catch (XMLSecurityException ex) {
+-         if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "XMLSecurityException", ex);
++         log.log(java.util.logging.Level.FINE, "XMLSecurityException", ex);
+ 
+          throw new KeyResolverException("generic.EmptyMessage", ex);
+       }
+@@ -173,7 +122,7 @@
+     * @param storage
+     *
+     */
+-   public javax.crypto.SecretKey engineResolveSecretKey(
++   public javax.crypto.SecretKey engineLookupAndResolveSecretKey(
+            Element element, String BaseURI, StorageResolver storage)
+    {
+       return null;
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/X509IssuerSerialResolver.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/X509IssuerSerialResolver.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/X509IssuerSerialResolver.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/X509IssuerSerialResolver.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -39,7 +38,7 @@
+ 
+ /**
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class X509IssuerSerialResolver extends KeyResolverSpi {
+ 
+@@ -48,44 +47,13 @@
+         java.util.logging.Logger.getLogger(
+                     X509IssuerSerialResolver.class.getName());
+ 
+-    /** @inheritDoc */
+-   public boolean engineCanResolve(Element element, String BaseURI,
+-                                   StorageResolver storage) {
+-      if (true)
+-        if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Can I resolve " + element.getTagName() + "?");
+-
+-      X509Data x509data = null;
+-      try {
+-         x509data = new X509Data(element, BaseURI);
+-      } catch (XMLSignatureException ex) {
+-         if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "I can't");
+-
+-         return false;
+-      } catch (XMLSecurityException ex) {
+-         if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "I can't");
+-
+-         return false;
+-      }
+-
+-      if (x509data == null) {
+-         if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "I can't");
+-         return false;
+-      }
+-
+-      if (x509data.containsIssuerSerial()) {
+-            return true;
+-      }
+-
+-      if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "I can't");
+-      return false;
+-   }
+ 
+    /** @inheritDoc */
+-   public PublicKey engineResolvePublicKey(
++   public PublicKey engineLookupAndResolvePublicKey(
+            Element element, String BaseURI, StorageResolver storage)
+               throws KeyResolverException {
+ 
+-      X509Certificate cert = this.engineResolveX509Certificate(element,
++      X509Certificate cert = this.engineLookupResolveX509Certificate(element,
+                                 BaseURI, storage);
+ 
+       if (cert != null) {
+@@ -96,10 +64,31 @@
+    }
+ 
+    /** @inheritDoc */
+-   public X509Certificate engineResolveX509Certificate(
++   public X509Certificate engineLookupResolveX509Certificate(
+            Element element, String BaseURI, StorageResolver storage)
+               throws KeyResolverException {
++         if (log.isLoggable(java.util.logging.Level.FINE))
++                log.log(java.util.logging.Level.FINE, "Can I resolve " + element.getTagName() + "?");
+ 
++          X509Data x509data = null;
++          try {
++             x509data = new X509Data(element, BaseURI);
++           } catch (XMLSignatureException ex) {
++              log.log(java.util.logging.Level.FINE, "I can't");
++         return null;
++           } catch (XMLSecurityException ex) {
++              log.log(java.util.logging.Level.FINE, "I can't");
++          return null;
++           }
++
++           if (x509data == null) {
++              log.log(java.util.logging.Level.FINE, "I can't");
++              return null;
++           }
++
++           if (!x509data.containsIssuerSerial()) {
++                    return null;
++           }
+       try {
+          if (storage == null) {
+             Object exArgs[] = { Constants._TAG_X509ISSUERSERIAL };
+@@ -107,53 +96,52 @@
+                new KeyResolverException("KeyResolver.needStorageResolver",
+                                         exArgs);
+ 
+-            if (log.isLoggable(java.util.logging.Level.INFO))                                  log.log(java.util.logging.Level.INFO, "", ex);
++            log.log(java.util.logging.Level.INFO, "", ex);
+             throw ex;
+          }
+ 
+-         X509Data x509data = new X509Data(element, BaseURI);
+          int noOfISS = x509data.lengthIssuerSerial();
+ 
+          while (storage.hasNext()) {
+             X509Certificate cert = storage.next();
+             XMLX509IssuerSerial certSerial = new XMLX509IssuerSerial(element.getOwnerDocument(), cert);
+ 
+-            if (true) {
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Found Certificate Issuer: "
++            if (log.isLoggable(java.util.logging.Level.FINE)) {
++                log.log(java.util.logging.Level.FINE, "Found Certificate Issuer: "
+                       + certSerial.getIssuerName());
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Found Certificate Serial: "
++                log.log(java.util.logging.Level.FINE, "Found Certificate Serial: "
+                       + certSerial.getSerialNumber().toString());
+             }
+ 
+             for (int i=0; i<noOfISS; i++) {
+                XMLX509IssuerSerial xmliss = x509data.itemIssuerSerial(i);
+ 
+-               if (true) {
+-                    if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Found Element Issuer:     "
++               if (log.isLoggable(java.util.logging.Level.FINE)) {
++                    log.log(java.util.logging.Level.FINE, "Found Element Issuer:     "
+                          + xmliss.getIssuerName());
+-                    if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Found Element Serial:     "
++                    log.log(java.util.logging.Level.FINE, "Found Element Serial:     "
+                          + xmliss.getSerialNumber().toString());
+                }
+ 
+                if (certSerial.equals(xmliss)) {
+-                  if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "match !!! ");
++                  log.log(java.util.logging.Level.FINE, "match !!! ");
+ 
+                   return cert;
+                }
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "no match...");
++                log.log(java.util.logging.Level.FINE, "no match...");
+             }
+          }
+ 
+          return null;
+       } catch (XMLSecurityException ex) {
+-         if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "XMLSecurityException", ex);
++         log.log(java.util.logging.Level.FINE, "XMLSecurityException", ex);
+ 
+          throw new KeyResolverException("generic.EmptyMessage", ex);
+       }
+    }
+ 
+    /** @inheritDoc */
+-   public javax.crypto.SecretKey engineResolveSecretKey(
++   public javax.crypto.SecretKey engineLookupAndResolveSecretKey(
+            Element element, String BaseURI, StorageResolver storage) {
+       return null;
+    }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/X509SKIResolver.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/X509SKIResolver.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/X509SKIResolver.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/X509SKIResolver.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -40,7 +39,7 @@
+ /**
+  *
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class X509SKIResolver extends KeyResolverSpi {
+ 
+@@ -48,50 +47,6 @@
+     static java.util.logging.Logger log =
+         java.util.logging.Logger.getLogger(X509SKIResolver.class.getName());
+ 
+-   /** Field _x509childNodes */
+-   private Element _x509childNodes[] = null;
+-
+-   /** Field _x509childObject[] */
+-   private XMLX509SKI _x509childObject[] = null;
+-
+-   /**
+-    * Method engineCanResolve
+-    * @inheritDoc
+-    * @param element
+-    * @param BaseURI
+-    * @param storage
+-    *
+-    */
+-   public boolean engineCanResolve(Element element, String BaseURI,
+-                                   StorageResolver storage) {
+-      if (true) {
+-        if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Can I resolve " + element.getTagName() + "?");
+-      }
+-
+-         if (!XMLUtils.elementIsInSignatureSpace(element,
+-                 Constants._TAG_X509DATA)) {
+-         if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "I can't");
+-
+-         return false;
+-      }
+-
+-
+-
+-
+-         this._x509childNodes = XMLUtils.selectDsNodes(element,
+-                  Constants._TAG_X509SKI);
+-
+-         if ((this._x509childNodes != null)
+-                 && (this._x509childNodes.length > 0)) {
+-            if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Yes Sir, I can");
+-
+-            return true;
+-         }
+-
+-      if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "I can't");
+-
+-      return false;
+-   }
+ 
+    /**
+     * Method engineResolvePublicKey
+@@ -102,11 +57,11 @@
+     * @return null if no {@link PublicKey} could be obtained
+     * @throws KeyResolverException
+     */
+-   public PublicKey engineResolvePublicKey(
++   public PublicKey engineLookupAndResolvePublicKey(
+            Element element, String BaseURI, StorageResolver storage)
+               throws KeyResolverException {
+ 
+-      X509Certificate cert = this.engineResolveX509Certificate(element,
++      X509Certificate cert = this.engineLookupResolveX509Certificate(element,
+                                 BaseURI, storage);
+ 
+       if (cert != null) {
+@@ -125,46 +80,55 @@
+     *
+     * @throws KeyResolverException
+     */
+-   public X509Certificate engineResolveX509Certificate(
++   public X509Certificate engineLookupResolveX509Certificate(
+            Element element, String BaseURI, StorageResolver storage)
+               throws KeyResolverException {
++           if (log.isLoggable(java.util.logging.Level.FINE)) {
++             log.log(java.util.logging.Level.FINE, "Can I resolve " + element.getTagName() + "?");
++           }
++           if (!XMLUtils.elementIsInSignatureSpace(element,
++              Constants._TAG_X509DATA)) {
++                 log.log(java.util.logging.Level.FINE, "I can't");
++                 return null;
++           }
++           /** Field _x509childObject[] */
++           XMLX509SKI x509childObject[] = null;
+ 
+-      try {
+-         if (this._x509childNodes == null) {
+-            boolean weCanResolve = this.engineCanResolve(element, BaseURI,
+-                                      storage);
++           Element x509childNodes[] = null;
++           x509childNodes = XMLUtils.selectDsNodes(element.getFirstChild(),
++                          Constants._TAG_X509SKI);
+ 
+-            if (!weCanResolve || (this._x509childNodes == null)) {
+-               return null;
+-            }
+-         }
+-
++           if (!((x509childNodes != null)
++                         && (x509childNodes.length > 0))) {
++                   log.log(java.util.logging.Level.FINE, "I can't");
++                return null;
++           }
++           try {
+          if (storage == null) {
+             Object exArgs[] = { Constants._TAG_X509SKI };
+             KeyResolverException ex =
+                new KeyResolverException("KeyResolver.needStorageResolver",
+                                         exArgs);
+ 
+-            if (log.isLoggable(java.util.logging.Level.INFO))                                  log.log(java.util.logging.Level.INFO, "", ex);
++            log.log(java.util.logging.Level.INFO, "", ex);
+ 
+             throw ex;
+          }
+ 
+-         this._x509childObject =
+-            new XMLX509SKI[this._x509childNodes.length];
++         x509childObject = new XMLX509SKI[x509childNodes.length];
+ 
+-         for (int i = 0; i < this._x509childNodes.length; i++) {
+-            this._x509childObject[i] =
+-               new XMLX509SKI(this._x509childNodes[i], BaseURI);
++         for (int i = 0; i < x509childNodes.length; i++) {
++            x509childObject[i] =
++               new XMLX509SKI(x509childNodes[i], BaseURI);
+          }
+ 
+          while (storage.hasNext()) {
+             X509Certificate cert = storage.next();
+             XMLX509SKI certSKI = new XMLX509SKI(element.getOwnerDocument(), cert);
+ 
+-            for (int i = 0; i < this._x509childObject.length; i++) {
+-               if (certSKI.equals(this._x509childObject[i])) {
+-                  if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Return PublicKey from "
++            for (int i = 0; i < x509childObject.length; i++) {
++               if (certSKI.equals(x509childObject[i])) {
++                  log.log(java.util.logging.Level.FINE, "Return PublicKey from "
+                             + cert.getSubjectDN().getName());
+ 
+                   return cert;
+@@ -186,7 +150,7 @@
+     * @param storage
+     *
+     */
+-   public javax.crypto.SecretKey engineResolveSecretKey(
++   public javax.crypto.SecretKey engineLookupAndResolveSecretKey(
+            Element element, String BaseURI, StorageResolver storage)
+     {
+       return null;
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/X509SubjectNameResolver.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/X509SubjectNameResolver.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/X509SubjectNameResolver.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/X509SubjectNameResolver.java
+@@ -38,7 +38,7 @@
+ 
+ /**
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class X509SubjectNameResolver extends KeyResolverSpi {
+ 
+@@ -47,50 +47,6 @@
+         java.util.logging.Logger.getLogger(
+                     X509SubjectNameResolver.class.getName());
+ 
+-   /** Field _x509childNodes */
+-   private Element[] _x509childNodes = null;
+-
+-   /** Field _x509childObject[] */
+-   private XMLX509SubjectName _x509childObject[] = null;
+-
+-   /**
+-    * Method engineCanResolve
+-    * @inheritDoc
+-    * @param element
+-    * @param BaseURI
+-    * @param storage
+-    *
+-    */
+-   public boolean engineCanResolve(Element element, String BaseURI,
+-                                   StorageResolver storage) {
+-      if (true)
+-        if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Can I resolve " + element.getTagName() + "?");
+-
+-
+-       if (!XMLUtils.elementIsInSignatureSpace(element,
+-                 Constants._TAG_X509DATA) ) {
+-         if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "I can't");
+-
+-         return false;
+-      }
+-
+-
+-
+-         this._x509childNodes = XMLUtils.selectDsNodes(element,
+-                 Constants._TAG_X509SUBJECTNAME);
+-
+-         if ((this._x509childNodes != null)
+-                 && (this._x509childNodes.length > 0)) {
+-            if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Yes Sir, I can");
+-
+-            return true;
+-         }
+-
+-
+-      if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "I can't");
+-
+-      return false;
+-   }
+ 
+    /**
+     * Method engineResolvePublicKey
+@@ -101,11 +57,11 @@
+     * @return null if no {@link PublicKey} could be obtained
+     * @throws KeyResolverException
+     */
+-   public PublicKey engineResolvePublicKey(
++   public PublicKey engineLookupAndResolvePublicKey(
+            Element element, String BaseURI, StorageResolver storage)
+               throws KeyResolverException {
+ 
+-      X509Certificate cert = this.engineResolveX509Certificate(element,
++      X509Certificate cert = this.engineLookupResolveX509Certificate(element,
+                                 BaseURI, storage);
+ 
+       if (cert != null) {
+@@ -124,37 +80,46 @@
+     *
+     * @throws KeyResolverException
+     */
+-   public X509Certificate engineResolveX509Certificate(
++   public X509Certificate engineLookupResolveX509Certificate(
+            Element element, String BaseURI, StorageResolver storage)
+               throws KeyResolverException {
++           if (log.isLoggable(java.util.logging.Level.FINE))
++                log.log(java.util.logging.Level.FINE, "Can I resolve " + element.getTagName() + "?");
++           Element[] x509childNodes = null;
++           XMLX509SubjectName x509childObject[] = null;
++
++           if (!XMLUtils.elementIsInSignatureSpace(element,
++                         Constants._TAG_X509DATA) ) {
++                        log.log(java.util.logging.Level.FINE, "I can't");
++                 return null;
++           }
++       x509childNodes = XMLUtils.selectDsNodes(element.getFirstChild(),
++                 Constants._TAG_X509SUBJECTNAME);
++
++        if (!((x509childNodes != null)
++                && (x509childNodes.length > 0))) {
++                    log.log(java.util.logging.Level.FINE, "I can't");
++                    return null;
++            }
+ 
+       try {
+-         if (this._x509childNodes == null) {
+-            boolean weCanResolve = this.engineCanResolve(element, BaseURI,
+-                                      storage);
+-
+-            if (!weCanResolve || (this._x509childNodes == null)) {
+-               return null;
+-            }
+-         }
+-
+          if (storage == null) {
+             Object exArgs[] = { Constants._TAG_X509SUBJECTNAME };
+             KeyResolverException ex =
+                new KeyResolverException("KeyResolver.needStorageResolver",
+                                         exArgs);
+ 
+-            if (log.isLoggable(java.util.logging.Level.INFO))                                  log.log(java.util.logging.Level.INFO, "", ex);
++            log.log(java.util.logging.Level.INFO, "", ex);
+ 
+             throw ex;
+          }
+ 
+-         this._x509childObject =
+-            new XMLX509SubjectName[this._x509childNodes.length];
++         x509childObject =
++            new XMLX509SubjectName[x509childNodes.length];
+ 
+-         for (int i = 0; i < this._x509childNodes.length; i++) {
+-            this._x509childObject[i] =
+-               new XMLX509SubjectName(this._x509childNodes[i],
++         for (int i = 0; i < x509childNodes.length; i++) {
++            x509childObject[i] =
++               new XMLX509SubjectName(x509childNodes[i],
+                                       BaseURI);
+          }
+ 
+@@ -163,24 +128,24 @@
+             XMLX509SubjectName certSN =
+                new XMLX509SubjectName(element.getOwnerDocument(), cert);
+ 
+-            if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Found Certificate SN: " + certSN.getSubjectName());
++            log.log(java.util.logging.Level.FINE, "Found Certificate SN: " + certSN.getSubjectName());
+ 
+-            for (int i = 0; i < this._x509childObject.length; i++) {
+-               if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Found Element SN:     "
+-                         + this._x509childObject[i].getSubjectName());
++            for (int i = 0; i < x509childObject.length; i++) {
++               log.log(java.util.logging.Level.FINE, "Found Element SN:     "
++                         + x509childObject[i].getSubjectName());
+ 
+-               if (certSN.equals(this._x509childObject[i])) {
+-                  if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "match !!! ");
++               if (certSN.equals(x509childObject[i])) {
++                  log.log(java.util.logging.Level.FINE, "match !!! ");
+ 
+                   return cert;
+                }
+-               if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "no match...");
++               log.log(java.util.logging.Level.FINE, "no match...");
+             }
+          }
+ 
+          return null;
+       } catch (XMLSecurityException ex) {
+-         if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "XMLSecurityException", ex);
++         log.log(java.util.logging.Level.FINE, "XMLSecurityException", ex);
+ 
+          throw new KeyResolverException("generic.EmptyMessage", ex);
+       }
+@@ -194,7 +159,7 @@
+     * @param storage
+     *
+     */
+-   public javax.crypto.SecretKey engineResolveSecretKey(
++   public javax.crypto.SecretKey engineLookupAndResolveSecretKey(
+            Element element, String BaseURI, StorageResolver storage)
+    {
+       return null;
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/StorageResolver.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/StorageResolver.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/StorageResolver.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/StorageResolver.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -21,8 +20,6 @@
+  */
+ package com.sun.org.apache.xml.internal.security.keys.storage;
+ 
+-
+-
+ import java.security.KeyStore;
+ import java.security.cert.X509Certificate;
+ import java.util.ArrayList;
+@@ -36,7 +33,7 @@
+ /**
+  * This class collects customized resolvers for Certificates.
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class StorageResolver {
+ 
+@@ -45,7 +42,7 @@
+         java.util.logging.Logger.getLogger(StorageResolver.class.getName());
+ 
+    /** Field _storageResolvers */
+-   List _storageResolvers = new ArrayList();
++   List _storageResolvers = null;
+ 
+    /** Field _iterator */
+    Iterator _iterator = null;
+@@ -71,7 +68,8 @@
+     * @param resolver
+     */
+    public void add(StorageResolverSpi resolver) {
+-
++           if (_storageResolvers==null)
++                   _storageResolvers=new ArrayList();
+       this._storageResolvers.add(resolver);
+ 
+       this._iterator = null;
+@@ -126,6 +124,8 @@
+    public Iterator getIterator() {
+ 
+       if (this._iterator == null) {
++         if (_storageResolvers==null)
++                   _storageResolvers=new ArrayList();
+          this._iterator = new StorageResolverIterator(this._storageResolvers.iterator());
+       }
+ 
+@@ -140,6 +140,8 @@
+    public boolean hasNext() {
+ 
+       if (this._iterator == null) {
++          if (_storageResolvers==null)
++                   _storageResolvers=new ArrayList();
+          this._iterator = new StorageResolverIterator(this._storageResolvers.iterator());
+       }
+ 
+@@ -158,15 +160,13 @@
+    /**
+     * Class StorageResolverIterator
+     *
+-    * @author $Author: raul $
++    * @author $Author: mullan $
++    * @version $Revision: 1.5 $
+     */
+-   class StorageResolverIterator implements Iterator {
++   static class StorageResolverIterator implements Iterator {
+ 
+       /** Field _resolvers */
+-           Iterator _resolvers = null;
+-
+-      /** Field _currentResolver */
+-      int _currentResolver = 0;
++      Iterator _resolvers = null;
+ 
+       /**
+        * Constructor FilesystemIterator
+@@ -179,17 +179,16 @@
+ 
+       /** @inheritDoc */
+       public boolean hasNext() {
+-                  return _resolvers.hasNext();
++          return _resolvers.hasNext();
+       }
+ 
+       /** @inheritDoc */
+       public Object next() {
+-                  return _resolvers.next();
++          return _resolvers.next();
+       }
+ 
+       /**
+        * Method remove
+-       *
+        */
+       public void remove() {
+          throw new UnsupportedOperationException(
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/StorageResolverException.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/StorageResolverException.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/StorageResolverException.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/StorageResolverException.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -28,7 +27,7 @@
+ 
+ /**
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class StorageResolverException extends XMLSecurityException {
+ 
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/StorageResolverSpi.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/StorageResolverSpi.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/StorageResolverSpi.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/StorageResolverSpi.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -28,7 +27,7 @@
+ 
+ /**
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public abstract class StorageResolverSpi {
+ 
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/implementations/CertsInFilesystemDirectoryResolver.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/implementations/CertsInFilesystemDirectoryResolver.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/implementations/CertsInFilesystemDirectoryResolver.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/implementations/CertsInFilesystemDirectoryResolver.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -21,8 +20,6 @@
+  */
+ package com.sun.org.apache.xml.internal.security.keys.storage.implementations;
+ 
+-
+-
+ import java.io.File;
+ import java.io.FileInputStream;
+ import java.io.FileNotFoundException;
+@@ -40,12 +37,11 @@
+ import com.sun.org.apache.xml.internal.security.keys.storage.StorageResolverSpi;
+ import com.sun.org.apache.xml.internal.security.utils.Base64;
+ 
+-
+ /**
+  * This {@link StorageResolverSpi} makes all raw (binary) {@link X509Certificate}s
+  * which reside as files in a single directory available to the {@link com.sun.org.apache.xml.internal.security.keys.storage.StorageResolver}.
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class CertsInFilesystemDirectoryResolver extends StorageResolverSpi {
+ 
+@@ -131,20 +127,20 @@
+             dn = cert.getSubjectDN().getName();
+             added = true;
+          } catch (FileNotFoundException ex) {
+-            if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Could not add certificate from file " + filename, ex);
++            log.log(java.util.logging.Level.FINE, "Could not add certificate from file " + filename, ex);
+          } catch (IOException ex) {
+-            if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Could not add certificate from file " + filename, ex);
++            log.log(java.util.logging.Level.FINE, "Could not add certificate from file " + filename, ex);
+          } catch (CertificateNotYetValidException ex) {
+-            if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Could not add certificate from file " + filename, ex);
++            log.log(java.util.logging.Level.FINE, "Could not add certificate from file " + filename, ex);
+          } catch (CertificateExpiredException ex) {
+-            if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Could not add certificate from file " + filename, ex);
++            log.log(java.util.logging.Level.FINE, "Could not add certificate from file " + filename, ex);
+          } catch (CertificateException ex) {
+-            if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Could not add certificate from file " + filename, ex);
++            log.log(java.util.logging.Level.FINE, "Could not add certificate from file " + filename, ex);
+          }
+ 
+          if (added) {
+-            if (true)
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Added certificate: " + dn);
++            if (log.isLoggable(java.util.logging.Level.FINE))
++                log.log(java.util.logging.Level.FINE, "Added certificate: " + dn);
+          }
+       }
+    }
+@@ -157,9 +153,10 @@
+    /**
+     * Class FilesystemIterator
+     *
+-    * @author $Author: raul $
++    * @author $Author: mullan $
++    * @version $Revision: 1.5 $
+     */
+-   class FilesystemIterator implements Iterator {
++   private static class FilesystemIterator implements Iterator {
+ 
+       /** Field _certs */
+       List _certs = null;
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/implementations/KeyStoreResolver.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/implementations/KeyStoreResolver.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/implementations/KeyStoreResolver.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/implementations/KeyStoreResolver.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -21,8 +20,6 @@
+  */
+ package com.sun.org.apache.xml.internal.security.keys.storage.implementations;
+ 
+-
+-
+ import java.security.KeyStore;
+ import java.security.KeyStoreException;
+ import java.security.cert.X509Certificate;
+@@ -37,7 +34,7 @@
+  * Makes the Certificates from a JAVA {@link KeyStore} object available to the
+  * {@link com.sun.org.apache.xml.internal.security.keys.storage.StorageResolver}.
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class KeyStoreResolver extends StorageResolverSpi {
+ 
+@@ -66,9 +63,10 @@
+    /**
+     * Class KeyStoreIterator
+     *
+-    * @author $Author: raul $
++    * @author $Author: mullan $
++    * @version $Revision: 1.5 $
+     */
+-   class KeyStoreIterator implements Iterator {
++   static class KeyStoreIterator implements Iterator {
+ 
+       /** Field _keyStore */
+       KeyStore _keyStore = null;
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/implementations/SingleCertificateResolver.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/implementations/SingleCertificateResolver.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/implementations/SingleCertificateResolver.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/implementations/SingleCertificateResolver.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -21,8 +20,6 @@
+  */
+ package com.sun.org.apache.xml.internal.security.keys.storage.implementations;
+ 
+-
+-
+ import java.security.cert.X509Certificate;
+ import java.util.Iterator;
+ 
+@@ -33,7 +30,7 @@
+  * This {@link StorageResolverSpi} makes a single {@link X509Certificate}
+  * available to the {@link com.sun.org.apache.xml.internal.security.keys.storage.StorageResolver}.
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class SingleCertificateResolver extends StorageResolverSpi {
+ 
+@@ -61,9 +58,10 @@
+    /**
+     * Class InternalIterator
+     *
+-    * @author $Author: raul $
++    * @author $Author: mullan $
++    * @version $Revision: 1.5 $
+     */
+-   class InternalIterator implements Iterator {
++   static class InternalIterator implements Iterator {
+ 
+       /** Field _alreadyReturned */
+       boolean _alreadyReturned = false;
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/resource/config.xml b/src/share/classes/com/sun/org/apache/xml/internal/security/resource/config.xml
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/config.xml
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/config.xml
+@@ -14,6 +14,10 @@
+                               JAVACLASS="com.sun.org.apache.xml.internal.security.c14n.implementations.Canonicalizer20010315ExclOmitComments"/>
+       <CanonicalizationMethod URI="http://www.w3.org/2001/10/xml-exc-c14n#WithComments"
+                               JAVACLASS="com.sun.org.apache.xml.internal.security.c14n.implementations.Canonicalizer20010315ExclWithComments"/>
++      <CanonicalizationMethod URI="http://www.w3.org/2006/12/xml-c14n11"
++                              JAVACLASS="com.sun.org.apache.xml.internal.security.c14n.implementations.Canonicalizer11_OmitComments"/>
++      <CanonicalizationMethod URI="http://www.w3.org/2006/12/xml-c14n11#WithComments"
++                              JAVACLASS="com.sun.org.apache.xml.internal.security.c14n.implementations.Canonicalizer11_WithComments"/>
+    </CanonicalizationMethods>
+    <TransformAlgorithms>
+       <!-- Base64 -->
+@@ -25,6 +29,12 @@
+       <!-- c14n with comments -->
+       <TransformAlgorithm URI="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"
+                           JAVACLASS="com.sun.org.apache.xml.internal.security.transforms.implementations.TransformC14NWithComments" />
++      <!-- c14n 1.1 omitting comments -->
++      <TransformAlgorithm URI="http://www.w3.org/2006/12/xml-c14n11"
++                          JAVACLASS="com.sun.org.apache.xml.internal.security.transforms.implementations.TransformC14N11" />
++      <!-- c14n 1.1 with comments -->
++      <TransformAlgorithm URI="http://www.w3.org/2006/12/xml-c14n11#WithComments"
++                          JAVACLASS="com.sun.org.apache.xml.internal.security.transforms.implementations.TransformC14N11_WithComments" />
+       <!-- exclusive c14n omitting comments -->
+       <TransformAlgorithm URI="http://www.w3.org/2001/10/xml-exc-c14n#"
+                           JAVACLASS="com.sun.org.apache.xml.internal.security.transforms.implementations.TransformC14NExclusive" />
+@@ -66,6 +76,8 @@
+                           JAVACLASS="com.sun.org.apache.xml.internal.security.algorithms.implementations.SignatureBaseRSA$SignatureRSASHA384" />
+       <SignatureAlgorithm URI="http://www.w3.org/2001/04/xmldsig-more#rsa-sha512"
+                           JAVACLASS="com.sun.org.apache.xml.internal.security.algorithms.implementations.SignatureBaseRSA$SignatureRSASHA512" />
++      <SignatureAlgorithm URI="http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1"
++                          JAVACLASS="com.sun.org.apache.xml.internal.security.algorithms.implementations.SignatureECDSA$SignatureECDSASHA1" />
+ 
+       <SignatureAlgorithm URI="http://www.w3.org/2001/04/xmldsig-more#hmac-md5"
+                           JAVACLASS="com.sun.org.apache.xml.internal.security.algorithms.implementations.IntegrityHmac$IntegrityHmacMD5" />
+@@ -166,6 +178,13 @@
+                     RequirementLevel="OPTIONAL"
+                     SpecificationURL="http://www.ietf.org/internet-drafts/draft-eastlake-xmldsig-uri-02.txt"
+                     JCEName="SHA512withRSA"/>
++                    
++         <Algorithm URI="http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1"
++                    Description="ECDSA Signature with SHA-1 message digest"
++                    AlgorithmClass="Signature"
++                    RequirementLevel="OPTIONAL"
++                    SpecificationURL="http://www.ietf.org/internet-drafts/draft-eastlake-xmldsig-uri-02.txt"
++                    JCEName="ECDSAwithSHA1"/>
+ 
+          <!-- MAC Algorithms -->
+          <Algorithm URI="http://www.w3.org/2001/04/xmldsig-more#hmac-md5"
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xmldsig-core-schema.dtd b/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xmldsig-core-schema.dtd
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xmldsig-core-schema.dtd
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xmldsig-core-schema.dtd
+@@ -3,7 +3,7 @@
+     Joseph Reagle $last changed 20001215$
+ 
+     http://www.w3.org/2000/09/xmldsig#
+-    $Revision: 1.1 $ on $Date: 2002/02/08 20:32:26 $ by $Author: reagle $
++    $Revision: 1.6 $ on $Date: 2008/07/24 16:15:03 $ by $Author: mullan $
+ 
+     Copyright 2001 The Internet Society and W3C (Massachusetts Institute
+     of Technology, Institut National de Recherche en Informatique et en
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xmldsig-core-schema.xsd b/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xmldsig-core-schema.xsd
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xmldsig-core-schema.xsd
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xmldsig-core-schema.xsd
+@@ -11,7 +11,7 @@
+ 
+ <!-- Schema for XML Signatures
+     http://www.w3.org/2000/09/xmldsig#
+-    $Revision: 1.1 $ on $Date: 2002/02/08 20:32:26 $ by $Author: reagle $
++    $Revision: 1.6 $ on $Date: 2008/07/24 16:15:03 $ by $Author: mullan $
+ 
+     Copyright 2001 The Internet Society and W3C (Massachusetts Institute
+     of Technology, Institut National de Recherche en Informatique et en
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/InvalidDigestValueException.java b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/InvalidDigestValueException.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/InvalidDigestValueException.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/InvalidDigestValueException.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/InvalidSignatureValueException.java b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/InvalidSignatureValueException.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/InvalidSignatureValueException.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/InvalidSignatureValueException.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Manifest.java b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Manifest.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Manifest.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Manifest.java
+@@ -68,14 +68,11 @@
+    /** Field verificationResults[] */
+    private boolean verificationResults[] = null;
+ 
+-   /** Field _signedContents */
+-   List _signedContents = new ArrayList();
+-
+    /** Field _resolverProperties */
+-   HashMap _resolverProperties = new HashMap(10);
++   HashMap _resolverProperties = null;
+ 
+    /** Field _perManifestResolvers */
+-   List _perManifestResolvers = new ArrayList();
++   List _perManifestResolvers = null;
+ 
+    /**
+     * Consturts {@link Manifest}
+@@ -144,8 +141,6 @@
+            String BaseURI, String referenceURI, Transforms transforms, String digestURI, String ReferenceId, String ReferenceType)
+               throws XMLSignatureException {
+ 
+-      if (this._state == MODE_SIGN) {
+-
+          // the this._doc is handed implicitly by the this.getOwnerDocument()
+          Reference ref = new Reference(this._doc, BaseURI, referenceURI, this,
+                                        transforms, digestURI);
+@@ -164,7 +159,6 @@
+          // add the Element of the Reference object to the Manifest/SignedInfo
+          this._constructionElement.appendChild(ref.getElement());
+          XMLUtils.addReturnToElement(this._constructionElement);
+-      }
+    }
+ 
+    /**
+@@ -178,7 +172,6 @@
+    public void generateDigestValues()
+            throws XMLSignatureException, ReferenceNotInitializedException {
+ 
+-      if (this._state == MODE_SIGN) {
+          for (int i = 0; i < this.getLength(); i++) {
+ 
+             // update the cached Reference object, the Element content is automatically updated
+@@ -186,7 +179,6 @@
+ 
+             currentRef.generateDigestValue();
+          }
+-      }
+    }
+ 
+    /**
+@@ -208,11 +200,6 @@
+     */
+    public Reference item(int i) throws XMLSecurityException {
+ 
+-      if (this._state == MODE_SIGN) {
+-
+-         // we already have real objects
+-         return (Reference) this._references.get(i);
+-      }
+          if (this._references.get(i) == null) {
+ 
+             // not yet constructed, so _we_ have to
+@@ -232,7 +219,7 @@
+     */
+    public void setId(String Id) {
+ 
+-      if ((this._state == MODE_SIGN) && (Id != null)) {
++      if (Id != null) {
+          this._constructionElement.setAttributeNS(null, Constants._ATT_ID, Id);
+          IdResolver.registerElementById(this._constructionElement, Id);
+       }
+@@ -294,9 +281,9 @@
+             XMLUtils.selectDsNodes(this._constructionElement.getFirstChild(),
+                          Constants._TAG_REFERENCE);
+       }
+-          if (true) {
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "verify " +_referencesEl.length + " References");
+-        if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "I am " + (followManifests
++          if (log.isLoggable(java.util.logging.Level.FINE)) {
++                log.log(java.util.logging.Level.FINE, "verify " +_referencesEl.length + " References");
++        log.log(java.util.logging.Level.FINE, "I am " + (followManifests
+                            ? ""
+                            : "not") + " requested to follow nested Manifests");
+       }
+@@ -325,13 +312,13 @@
+             if (!currentRefVerified) {
+                verify = false;
+             }
+-            if (true)
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "The Reference has Type " + currentRef.getType());
++            if (log.isLoggable(java.util.logging.Level.FINE))
++                log.log(java.util.logging.Level.FINE, "The Reference has Type " + currentRef.getType());
+ 
+             // was verification successful till now and do we want to verify the Manifest?
+             if (verify && followManifests
+                     && currentRef.typeIsReferenceToManifest()) {
+-               if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "We have to follow a nested Manifest");
++               log.log(java.util.logging.Level.FINE, "We have to follow a nested Manifest");
+ 
+                 try {
+                   XMLSignatureInput signedManifestNodes =
+@@ -381,7 +368,7 @@
+ 
+                      log.log(java.util.logging.Level.WARNING, "The nested Manifest was invalid (bad)");
+                   } else {
+-                     if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "The nested Manifest was valid (good)");
++                     log.log(java.util.logging.Level.FINE, "The nested Manifest was valid (good)");
+                   }
+                } catch (IOException ex) {
+                   throw new ReferenceNotInitializedException("empty", ex);
+@@ -458,9 +445,13 @@
+     */
+    public void addResourceResolver(ResourceResolver resolver) {
+ 
+-      if (resolver != null) {
+-         this._perManifestResolvers.add(resolver);
++      if (resolver == null) {
++          return;
+       }
++      if (_perManifestResolvers==null)
++          _perManifestResolvers = new ArrayList();
++      this._perManifestResolvers.add(resolver);
++
+    }
+ 
+    /**
+@@ -470,9 +461,13 @@
+     */
+    public void addResourceResolver(ResourceResolverSpi resolverSpi) {
+ 
+-      if (resolverSpi != null) {
+-         this._perManifestResolvers.add(new ResourceResolver(resolverSpi));
++      if (resolverSpi == null) {
++          return;
+       }
++      if (_perManifestResolvers==null)
++                  _perManifestResolvers = new ArrayList();
++      this._perManifestResolvers.add(new ResourceResolver(resolverSpi));
++
+    }
+ 
+    /**
+@@ -483,6 +478,9 @@
+     * @param value the value
+     */
+    public void setResolverProperty(String key, String value) {
++           if (_resolverProperties==null) {
++                   _resolverProperties=new HashMap(10);
++           }
+       this._resolverProperties.put(key, value);
+    }
+ 
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/MissingResourceFailureException.java b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/MissingResourceFailureException.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/MissingResourceFailureException.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/MissingResourceFailureException.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/NodeFilter.java b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/NodeFilter.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/NodeFilter.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/NodeFilter.java
+@@ -31,8 +31,23 @@
+         /**
+          * Tells if a node must be outputed in c14n.
+          * @param n
+-         * @return true if node must be outputed, false otherwise.
++         * @return 1 if the node should be outputed.
++         *                 0 if node must not be outputed,
++         *                -1 if the node and all it's child must not be output.
++         *
+          */
+-        public boolean isNodeInclude(Node n);
++        public int isNodeInclude(Node n);
++        /**
++         * Tells if a node must be outputed in a c14n.
++         * The caller must assured that this method is always call
++         * in document order. The implementations can use this
++         * restriction to optimize the transformation.
++         * @param n
++         * @param level the relative level in the tree
++         * @return 1 if the node should be outputed.
++         *                 0 if node must not be outputed,
++         *                -1 if the node and all it's child must not be output.
++         */
++        public int isNodeIncludeDO(Node n, int level);
+ 
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/ObjectContainer.java b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/ObjectContainer.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/ObjectContainer.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/ObjectContainer.java
+@@ -20,8 +20,6 @@
+  */
+ package com.sun.org.apache.xml.internal.security.signature;
+ 
+-
+-
+ import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
+ import com.sun.org.apache.xml.internal.security.utils.Constants;
+ import com.sun.org.apache.xml.internal.security.utils.IdResolver;
+@@ -35,16 +33,11 @@
+  * Handles <code><ds:Object></code> elements
+  * <code>Object<code> {@link Element} supply facility which can contain any kind data
+  *
+- *
+  * @author Christian Geuer-Pollmann
+  * $todo$ if we remove childen, the boolean values are not updated
+  */
+ public class ObjectContainer extends SignatureElementProxy {
+ 
+-   /** {@link java.util.logging} logging facility */
+-   static java.util.logging.Logger log =
+-       java.util.logging.Logger.getLogger(ObjectContainer.class.getName());
+-
+    /**
+     * Constructs {@link ObjectContainer}
+     *
+@@ -75,7 +68,7 @@
+     */
+    public void setId(String Id) {
+ 
+-      if ((this._state == MODE_SIGN) && (Id != null)) {
++      if ((Id != null)) {
+          this._constructionElement.setAttributeNS(null, Constants._ATT_ID, Id);
+          IdResolver.registerElementById(this._constructionElement, Id);
+       }
+@@ -97,7 +90,7 @@
+     */
+    public void setMimeType(String MimeType) {
+ 
+-      if ((this._state == MODE_SIGN) && (MimeType != null)) {
++      if ( (MimeType != null)) {
+          this._constructionElement.setAttributeNS(null, Constants._ATT_MIMETYPE,
+                                                 MimeType);
+       }
+@@ -119,7 +112,7 @@
+     */
+    public void setEncoding(String Encoding) {
+ 
+-      if ((this._state == MODE_SIGN) && (Encoding != null)) {
++      if ((Encoding != null)) {
+          this._constructionElement.setAttributeNS(null, Constants._ATT_ENCODING,
+                                                 Encoding);
+       }
+@@ -135,18 +128,16 @@
+    }
+ 
+    /**
+-    * Adds childe Node
++    * Adds child Node
+     *
+-    * @param node childe Node
++    * @param node child Node
+     * @return the new node in the tree.
+     */
+    public Node appendChild(Node node) {
+ 
+       Node result = null;
+ 
+-      if (this._state == MODE_SIGN) {
+-         result = this._constructionElement.appendChild(node);
+-      }
++      result = this._constructionElement.appendChild(node);
+ 
+       return result;
+    }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Reference.java b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Reference.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Reference.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Reference.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -25,6 +24,8 @@
+ 
+ import java.io.IOException;
+ import java.io.OutputStream;
++import java.security.AccessController;
++import java.security.PrivilegedAction;
+ import java.util.HashSet;
+ import java.util.Set;
+ 
+@@ -102,6 +103,32 @@
+  */
+ public class Reference extends SignatureElementProxy {
+ 
++   /**
++    * Look up useC14N11 system property. If true, an explicit C14N11 transform
++    * will be added if necessary when generating the signature. See section
++    * 3.1.1 of http://www.w3.org/2007/xmlsec/Drafts/xmldsig-core/ for more info.
++    */
++   private static boolean useC14N11 =
++      AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
++         public Boolean run() {
++            return Boolean.getBoolean
++               ("com.sun.org.apache.xml.internal.security.useC14N11");
++         }
++      });
++
++/*
++   static {
++      try {
++         useC14N11 = Boolean.getBoolean("com.sun.org.apache.xml.internal.security.useC14N11");
++      } catch (Exception e) {
++         // ignore exceptions
++      }
++   }
++*/
++
++   /** Field CacheSignedNodes */
++   public final static boolean CacheSignedNodes = false;
++
+    /** {@link java.util.logging} logging facility */
+     static java.util.logging.Logger log =
+         java.util.logging.Logger.getLogger(Reference.class.getName());
+@@ -118,6 +145,12 @@
+    XMLSignatureInput _transformsOutput;
+    //J+
+ 
++private Transforms transforms;
++
++private Element digestMethodElem;
++
++private Element digestValueElement;
++
+    /**
+     * Constructor Reference
+     *
+@@ -148,6 +181,7 @@
+       // this._manifest.appendChild(this._doc.createTextNode("\n"));
+ 
+       if (transforms != null) {
++          this.transforms=transforms;
+          this._constructionElement.appendChild(transforms.getElement());
+          XMLUtils.addReturnToElement(this._constructionElement);
+       }
+@@ -156,11 +190,12 @@
+             MessageDigestAlgorithm.getInstance(this._doc,
+                                                messageDigestAlgorithm);
+ 
+-         this._constructionElement.appendChild(mda.getElement());
++         digestMethodElem=mda.getElement();
++         this._constructionElement.appendChild(digestMethodElem);
+          XMLUtils.addReturnToElement(this._constructionElement);
+       }
+       {
+-         Element digestValueElement =
++         digestValueElement =
+             XMLUtils.createElementInSignatureSpace(this._doc,
+                                                    Constants._TAG_DIGESTVALUE);
+ 
+@@ -182,7 +217,15 @@
+            throws XMLSecurityException {
+ 
+       super(element, BaseURI);
+-
++      this._baseURI=BaseURI;
++      Element el=XMLUtils.getNextElement(element.getFirstChild());
++      if (Constants._TAG_TRANSFORMS.equals(el.getLocalName()) &&
++                  Constants.SignatureSpecNS.equals(el.getNamespaceURI())) {
++          transforms = new Transforms(el,this._baseURI);
++          el=XMLUtils.getNextElement(el.getNextSibling());
++      }
++      digestMethodElem = el;
++      digestValueElement =XMLUtils.getNextElement(digestMethodElem.getNextSibling());;
+       this._manifest = manifest;
+    }
+ 
+@@ -197,9 +240,6 @@
+    public MessageDigestAlgorithm getMessageDigestAlgorithm()
+            throws XMLSignatureException {
+ 
+-      Element digestMethodElem = XMLUtils.selectDsNode(this._constructionElement.getFirstChild(),
+-            Constants._TAG_DIGESTMETHOD,0);
+-
+       if (digestMethodElem == null) {
+          return null;
+       }
+@@ -221,7 +261,7 @@
+     */
+    public void setURI(String URI) {
+ 
+-      if ((this._state == MODE_SIGN) && (URI != null)) {
++      if ( URI != null) {
+          this._constructionElement.setAttributeNS(null, Constants._ATT_URI,
+                                                   URI);
+       }
+@@ -243,7 +283,7 @@
+     */
+    public void setId(String Id) {
+ 
+-      if ((this._state == MODE_SIGN) && (Id != null)) {
++      if ( Id != null ) {
+          this._constructionElement.setAttributeNS(null, Constants._ATT_ID, Id);
+          IdResolver.registerElementById(this._constructionElement, Id);
+       }
+@@ -265,7 +305,7 @@
+     */
+    public void setType(String Type) {
+ 
+-      if ((this._state == MODE_SIGN) && (Type != null)) {
++      if (Type != null) {
+          this._constructionElement.setAttributeNS(null, Constants._ATT_TYPE,
+                                                   Type);
+       }
+@@ -291,8 +331,7 @@
+     */
+    public boolean typeIsReferenceToObject() {
+ 
+-      if ((this.getType() != null)
+-              && this.getType().equals(Reference.OBJECT_URI)) {
++      if (Reference.OBJECT_URI.equals(this.getType())) {
+          return true;
+       }
+ 
+@@ -309,8 +348,7 @@
+     */
+    public boolean typeIsReferenceToManifest() {
+ 
+-      if ((this.getType() != null)
+-              && this.getType().equals(Reference.MANIFEST_URI)) {
++      if (Reference.MANIFEST_URI.equals(this.getType())) {
+          return true;
+       }
+ 
+@@ -324,10 +362,6 @@
+     */
+    private void setDigestValueElement(byte[] digestValue)
+    {
+-
+-      if (this._state == MODE_SIGN) {
+-         Element digestValueElement =XMLUtils.selectDsNode(this._constructionElement.getFirstChild(),
+-                 Constants._TAG_DIGESTVALUE,0);
+          Node n=digestValueElement.getFirstChild();
+          while (n!=null) {
+                digestValueElement.removeChild(n);
+@@ -338,7 +372,6 @@
+          Text t = this._doc.createTextNode(base64codedValue);
+ 
+          digestValueElement.appendChild(t);
+-      }
+    }
+ 
+    /**
+@@ -349,11 +382,7 @@
+     */
+    public void generateDigestValue()
+            throws XMLSignatureException, ReferenceNotInitializedException {
+-
+-      if (this._state == MODE_SIGN) {
+-
+-         this.setDigestValueElement(this.calculateDigest());
+-      }
++      this.setDigestValueElement(this.calculateDigest(false));
+    }
+ 
+    /**
+@@ -608,9 +637,12 @@
+           * but only preserve the octets, the memory footprint is dramatically
+           * reduced.
+           */
++         if (!Reference.CacheSignedNodes) {
+ 
+-         this._transformsOutput = output;
++            this._transformsOutput = output;//new XMLSignatureInput(output.getBytes());
+ 
++            //this._transformsOutput.setSourceURI(output.getSourceURI());
++         }
+          return output;
+       } catch (XMLSecurityException ex) {
+          throw new ReferenceNotInitializedException("empty", ex);
+@@ -630,16 +662,7 @@
+            throws XMLSignatureException, InvalidTransformException,
+                   TransformationException, XMLSecurityException {
+ 
+-      Element transformsElement = XMLUtils.selectDsNode(this._constructionElement.getFirstChild(),
+-            Constants._TAG_TRANSFORMS,0);
+-
+-      if (transformsElement != null) {
+-         Transforms transforms = new Transforms(transformsElement,
+-                                                this._baseURI);
+-
+-         return transforms;
+-      }
+-       return null;
++      return transforms;
+    }
+ 
+    /**
+@@ -667,13 +690,14 @@
+ 
+ 
+    /**
+-    * Method resolverResult
++    * Method calculateDigest
+     *
++    * @param validating true if validating the reference
+     * @return reference Calculate the digest of this reference.
+     * @throws ReferenceNotInitializedException
+     * @throws XMLSignatureException
+     */
+-   private byte[] calculateDigest()
++   private byte[] calculateDigest(boolean validating)
+            throws ReferenceNotInitializedException, XMLSignatureException {
+ 
+       try {
+@@ -684,7 +708,20 @@
+          DigesterOutputStream diOs=new DigesterOutputStream(mda);
+          OutputStream os=new UnsyncBufferedOutputStream(diOs);
+          XMLSignatureInput output=this.dereferenceURIandPerformTransforms(os);
+-         output.updateOutputStream(os);
++         // if signing and c14n11 property == true explicitly add
++         // C14N11 transform if needed
++         if (this.useC14N11 && !validating &&
++             !output.isOutputStreamSet() && !output.isOctetStream()) {
++             if (transforms == null) {
++                 transforms = new Transforms(this._doc);
++                 this._constructionElement.insertBefore
++                     (transforms.getElement(), digestMethodElem);
++             }
++             transforms.addTransform(Transforms.TRANSFORM_C14N11_OMIT_COMMENTS);
++             output.updateOutputStream(os, true);
++         } else {
++             output.updateOutputStream(os);
++         }
+          os.flush();
+          //this.getReferencedBytes(diOs);
+          //mda.update(data);
+@@ -694,7 +731,7 @@
+          throw new ReferenceNotInitializedException("empty", ex);
+       } catch (IOException ex) {
+          throw new ReferenceNotInitializedException("empty", ex);
+-        }
++      }
+    }
+ 
+    /**
+@@ -702,12 +739,10 @@
+     *
+     * @return the digest value.
+     * @throws Base64DecodingException if Reference contains no proper base64 encoded data.
+-        * @throws XMLSecurityException if the Reference does not contain a DigestValue element
++    * @throws XMLSecurityException if the Reference does not contain a DigestValue element
+     */
+    public byte[] getDigestValue() throws Base64DecodingException, XMLSecurityException {
+-      Element digestValueElem = XMLUtils.selectDsNode(this._constructionElement.getFirstChild()
+-            ,Constants._TAG_DIGESTVALUE,0);
+-          if (digestValueElem == null) {
++      if (digestValueElement == null) {
+                   // The required element is not in the XML!
+                   Object[] exArgs ={ Constants._TAG_DIGESTVALUE,
+                                                          Constants.SignatureSpecNS };
+@@ -715,7 +750,7 @@
+                                         "signature.Verification.NoSignatureElement",
+                                         exArgs);
+           }
+-      byte[] elemDig = Base64.decode(digestValueElem);
++      byte[] elemDig = Base64.decode(digestValueElement);
+       return elemDig;
+    }
+ 
+@@ -731,13 +766,15 @@
+            throws ReferenceNotInitializedException, XMLSecurityException {
+ 
+       byte[] elemDig = this.getDigestValue();
+-      byte[] calcDig = this.calculateDigest();
++      byte[] calcDig = this.calculateDigest(true);
+       boolean equal = MessageDigestAlgorithm.isEqual(elemDig, calcDig);
+ 
+       if (!equal) {
+          log.log(java.util.logging.Level.WARNING, "Verification failed for URI \"" + this.getURI() + "\"");
++         log.log(java.util.logging.Level.WARNING, "Expected Digest: " + Base64.encode(elemDig));
++         log.log(java.util.logging.Level.WARNING, "Actual Digest: " + Base64.encode(calcDig));
+       } else {
+-         if (log.isLoggable(java.util.logging.Level.INFO))                                  log.log(java.util.logging.Level.INFO, "Verification successful for URI \"" + this.getURI() + "\"");
++         log.log(java.util.logging.Level.INFO, "Verification successful for URI \"" + this.getURI() + "\"");
+       }
+ 
+       return equal;
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/ReferenceNotInitializedException.java b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/ReferenceNotInitializedException.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/ReferenceNotInitializedException.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/ReferenceNotInitializedException.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/SignatureProperties.java b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/SignatureProperties.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/SignatureProperties.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/SignatureProperties.java
+@@ -20,8 +20,6 @@
+  */
+ package com.sun.org.apache.xml.internal.security.signature;
+ 
+-
+-
+ import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
+ import com.sun.org.apache.xml.internal.security.utils.Constants;
+ import com.sun.org.apache.xml.internal.security.utils.IdResolver;
+@@ -42,10 +40,6 @@
+  */
+ public class SignatureProperties extends SignatureElementProxy {
+ 
+-   /** {@link java.util.logging} logging facility */
+-    static java.util.logging.Logger log =
+-        java.util.logging.Logger.getLogger(SignatureProperties.class.getName());
+-
+    /**
+     * Constructor SignatureProperties
+     *
+@@ -115,7 +109,7 @@
+     */
+    public void setId(String Id) {
+ 
+-      if ((this._state == MODE_SIGN) && (Id != null)) {
++      if ((Id != null)) {
+          this._constructionElement.setAttributeNS(null, Constants._ATT_ID, Id);
+          IdResolver.registerElementById(this._constructionElement, Id);
+       }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/SignatureProperty.java b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/SignatureProperty.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/SignatureProperty.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/SignatureProperty.java
+@@ -30,18 +30,13 @@
+ 
+ /**
+  * Handles <code><ds:SignatureProperty></code> elements
+- * Addittional information item concerning the generation of the signature(s) can
++ * Additional information item concerning the generation of the signature(s) can
+  * be placed in this Element
+  *
+  * @author Christian Geuer-Pollmann
+  */
+ public class SignatureProperty extends SignatureElementProxy {
+ 
+-   /** {@link java.util.logging} logging facility */
+-    static java.util.logging.Logger log =
+-        java.util.logging.Logger.getLogger(
+-                            SignatureProperty.class.getName());
+-
+    /**
+     * Constructs{@link SignatureProperty} using specified <code>Target</code> attribute
+     *
+@@ -85,7 +80,7 @@
+     */
+    public void setId(String Id) {
+ 
+-      if ((this._state == MODE_SIGN) && (Id != null)) {
++      if ((Id != null)) {
+          this._constructionElement.setAttributeNS(null, Constants._ATT_ID, Id);
+          IdResolver.registerElementById(this._constructionElement, Id);
+       }
+@@ -107,7 +102,7 @@
+     */
+    public void setTarget(String Target) {
+ 
+-      if ((this._state == MODE_SIGN) && (Target != null)) {
++      if ((Target != null)) {
+          this._constructionElement.setAttributeNS(null, Constants._ATT_TARGET, Target);
+       }
+    }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/SignedInfo.java b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/SignedInfo.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/SignedInfo.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/SignedInfo.java
+@@ -20,12 +20,9 @@
+  */
+ package com.sun.org.apache.xml.internal.security.signature;
+ 
+-
+-
+ import java.io.ByteArrayInputStream;
+ import java.io.IOException;
+ import java.io.OutputStream;
+-
+ import javax.crypto.SecretKey;
+ import javax.crypto.spec.SecretKeySpec;
+ import javax.xml.parsers.ParserConfigurationException;
+@@ -43,165 +40,174 @@
+ import org.w3c.dom.Node;
+ import org.xml.sax.SAXException;
+ 
+-
+ /**
+  * Handles <code><ds:SignedInfo></code> elements
+  * This <code>SignedInfo<code> element includes the canonicalization algorithm,
+- * a signature algorithm, and one or more references
++ * a signature algorithm, and one or more references.
++ *
+  * @author Christian Geuer-Pollmann
+  */
+ public class SignedInfo extends Manifest {
+ 
+-   /** Field _signatureAlgorithm */
+-   private SignatureAlgorithm _signatureAlgorithm = null;
++    /** Field _signatureAlgorithm */
++    private SignatureAlgorithm _signatureAlgorithm = null;
+ 
+-   /** Field _c14nizedBytes           */
+-   private byte[] _c14nizedBytes = null;
++    /** Field _c14nizedBytes           */
++    private byte[] _c14nizedBytes = null;
+ 
+-   /**
+-    * Overwrites {@link Manifest#addDocument} because it creates another Element.
+-    *
+-    * @param doc the {@link Document} in which <code>XMLsignature</code> will be placed
+-    * @throws XMLSecurityException
+-    */
+-   public SignedInfo(Document doc) throws XMLSecurityException {
+-      this(doc, XMLSignature.ALGO_ID_SIGNATURE_DSA, Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS);
+-   }
++    private Element c14nMethod;
++    private Element signatureMethod;
+ 
+-   /**
+-    * Constructs {@link SignedInfo} using given Canoicaliztion algorithm and Signature algorithm
+-    *
+-    * @param doc <code>SignedInfo</code> is placed in this document
+-    * @param CanonicalizationMethodURI URI representation of the Canonicalization method
+-    * @param SignatureMethodURI URI representation of the Digest and Signature algorithm
+-    * @throws XMLSecurityException
+-    */
+-   public SignedInfo(
+-           Document doc, String SignatureMethodURI, String CanonicalizationMethodURI)
++    /**
++     * Overwrites {@link Manifest#addDocument} because it creates another
++     * Element.
++     *
++     * @param doc the {@link Document} in which <code>XMLsignature</code> will
++     *    be placed
++     * @throws XMLSecurityException
++     */
++    public SignedInfo(Document doc) throws XMLSecurityException {
++        this(doc, XMLSignature.ALGO_ID_SIGNATURE_DSA,
++             Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS);
++    }
++
++    /**
++     * Constructs {@link SignedInfo} using given Canonicalization algorithm and
++     * Signature algorithm.
++     *
++     * @param doc <code>SignedInfo</code> is placed in this document
++     * @param signatureMethodURI URI representation of the Digest and
++     *    Signature algorithm
++     * @param canonicalizationMethodURI URI representation of the
++     *    Canonicalization method
++     * @throws XMLSecurityException
++     */
++    public SignedInfo(Document doc, String signatureMethodURI,
++        String canonicalizationMethodURI)
+               throws XMLSecurityException {
+-      this(doc, SignatureMethodURI, 0, CanonicalizationMethodURI);
+-   }
++        this(doc, signatureMethodURI, 0, canonicalizationMethodURI);
++    }
+ 
+-   /**
+-    * Constructor SignedInfo
+-    *
+-    * @param doc
+-    * @param CanonicalizationMethodURI
+-    * @param SignatureMethodURI
+-    * @param HMACOutputLength
+-    * @throws XMLSecurityException
+-    */
+-   public SignedInfo(
+-           Document doc, String SignatureMethodURI, int HMACOutputLength, String CanonicalizationMethodURI)
++    /**
++     * Constructor SignedInfo
++     *
++     * @param doc <code>SignedInfo</code> is placed in this document
++     * @param signatureMethodURI URI representation of the Digest and
++     *    Signature algorithm
++     * @param hMACOutputLength
++     * @param canonicalizationMethodURI URI representation of the
++     *    Canonicalization method
++     * @throws XMLSecurityException
++     */
++    public SignedInfo(Document doc, String signatureMethodURI,
++        int hMACOutputLength, String canonicalizationMethodURI)
+               throws XMLSecurityException {
+ 
+-      super(doc);
++        super(doc);
+ 
+-      // XMLUtils.addReturnToElement(this._constructionElement);
+-      {
+-         Element canonElem = XMLUtils.createElementInSignatureSpace(this._doc,
++        c14nMethod = XMLUtils.createElementInSignatureSpace(this._doc,
+                                 Constants._TAG_CANONICALIZATIONMETHOD);
+ 
+-         canonElem.setAttributeNS(null, Constants._ATT_ALGORITHM,
+-                                CanonicalizationMethodURI);
+-         this._constructionElement.appendChild(canonElem);
+-         XMLUtils.addReturnToElement(this._constructionElement);
+-      }
+-      {
+-         if (HMACOutputLength > 0) {
++        c14nMethod.setAttributeNS(null, Constants._ATT_ALGORITHM,
++                                  canonicalizationMethodURI);
++        this._constructionElement.appendChild(c14nMethod);
++        XMLUtils.addReturnToElement(this._constructionElement);
++
++        if (hMACOutputLength > 0) {
+             this._signatureAlgorithm = new SignatureAlgorithm(this._doc,
+-                    SignatureMethodURI, HMACOutputLength);
+-         } else {
++                    signatureMethodURI, hMACOutputLength);
++        } else {
+             this._signatureAlgorithm = new SignatureAlgorithm(this._doc,
+-                    SignatureMethodURI);
+-         }
++                    signatureMethodURI);
++        }
+ 
+-         this._constructionElement
+-            .appendChild(this._signatureAlgorithm.getElement());
+-         XMLUtils.addReturnToElement(this._constructionElement);
+-      }
+-   }
++        signatureMethod = this._signatureAlgorithm.getElement();
++        this._constructionElement.appendChild(signatureMethod);
++        XMLUtils.addReturnToElement(this._constructionElement);
++    }
+ 
+-   /**
+-    * @param doc
+-    * @param SignatureMethodElem
+-    * @param CanonicalizationMethodElem
+-    * @throws XMLSecurityException
+-    */
+-   public SignedInfo(
+-           Document doc, Element SignatureMethodElem, Element CanonicalizationMethodElem)
+-              throws XMLSecurityException {
++    /**
++     * @param doc
++     * @param signatureMethodElem
++     * @param canonicalizationMethodElem
++     * @throws XMLSecurityException
++     */
++    public SignedInfo(Document doc, Element signatureMethodElem,
++        Element canonicalizationMethodElem) throws XMLSecurityException {
+ 
+-      super(doc);
++        super(doc);
++        // Check this?
++        this.c14nMethod = canonicalizationMethodElem;
++        this._constructionElement.appendChild(c14nMethod);
++        XMLUtils.addReturnToElement(this._constructionElement);
+ 
+-      this._constructionElement.appendChild(CanonicalizationMethodElem);
+-      XMLUtils.addReturnToElement(this._constructionElement);
++        this._signatureAlgorithm =
++            new SignatureAlgorithm(signatureMethodElem, null);
+ 
+-      this._signatureAlgorithm = new SignatureAlgorithm(SignatureMethodElem, null);
++        signatureMethod = this._signatureAlgorithm.getElement();
++        this._constructionElement.appendChild(signatureMethod);
+ 
+-      this._constructionElement
+-         .appendChild(this._signatureAlgorithm.getElement());
+-      XMLUtils.addReturnToElement(this._constructionElement);
+-   }
++        XMLUtils.addReturnToElement(this._constructionElement);
++    }
+ 
+-   /**
+-    * Build a {@link SignedInfo} from an {@link Element}
+-    *
+-    * @param element <code>SignedInfo</code>
+-    * @param BaseURI the URI of the resource where the XML instance was stored
+-    * @throws XMLSecurityException
+-    * @see <A HREF="http://lists.w3.org/Archives/Public/w3c-ietf-xmldsig/2001OctDec/0033.html">Question</A>
+-    * @see <A HREF="http://lists.w3.org/Archives/Public/w3c-ietf-xmldsig/2001OctDec/0054.html">Answer</A>
+-    */
+-   public SignedInfo(Element element, String BaseURI)
++    /**
++     * Build a {@link SignedInfo} from an {@link Element}
++     *
++     * @param element <code>SignedInfo</code>
++     * @param baseURI the URI of the resource where the XML instance was stored
++     * @throws XMLSecurityException
++     * @see <A HREF="http://lists.w3.org/Archives/Public/w3c-ietf-xmldsig/2001OctDec/0033.html">Question</A>
++     * @see <A HREF="http://lists.w3.org/Archives/Public/w3c-ietf-xmldsig/2001OctDec/0054.html">Answer</A>
++     */
++    public SignedInfo(Element element, String baseURI)
+            throws XMLSecurityException {
+ 
+-      // Parse the Reference children and Id attribute in the Manifest
+-      super(element, BaseURI);
++        // Parse the Reference children and Id attribute in the Manifest
++        super(element, baseURI);
+ 
+-      /* canonicalize ds:SignedInfo, reparse it into a new document
+-       * and replace the original not-canonicalized ds:SignedInfo by
+-       * the re-parsed canonicalized one.
+-       */
+-      String c14nMethodURI=this.getCanonicalizationMethodURI();
+-     if (!(c14nMethodURI.equals("http://www.w3.org/TR/2001/REC-xml-c14n-20010315") ||
+-                c14nMethodURI.equals("http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments") ||
+-                        c14nMethodURI.equals("http://www.w3.org/2001/10/xml-exc-c14n#") ||
+-                        c14nMethodURI.equals("http://www.w3.org/2001/10/xml-exc-c14n#WithComments"))) {
+-        //The c14n is not a secure one and can rewrite the URIs or like that reparse the SignedInfo to be sure
+-      try {
+-         Canonicalizer c14nizer =
+-            Canonicalizer.getInstance(this.getCanonicalizationMethodURI());
++        /* canonicalize ds:SignedInfo, reparse it into a new document
++         * and replace the original not-canonicalized ds:SignedInfo by
++         * the re-parsed canonicalized one.
++         */
++        c14nMethod = XMLUtils.getNextElement(element.getFirstChild());
++        String c14nMethodURI = this.getCanonicalizationMethodURI();
++        if (!(c14nMethodURI.equals(Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS) ||
++              c14nMethodURI.equals(Canonicalizer.ALGO_ID_C14N_WITH_COMMENTS) ||
++              c14nMethodURI.equals(Canonicalizer.ALGO_ID_C14N_EXCL_OMIT_COMMENTS) ||
++              c14nMethodURI.equals(Canonicalizer.ALGO_ID_C14N_EXCL_WITH_COMMENTS))) {
++            // the c14n is not a secure one and can rewrite the URIs or like
++            // that reparse the SignedInfo to be sure
++            try {
++                Canonicalizer c14nizer =
++                Canonicalizer.getInstance(this.getCanonicalizationMethodURI());
+ 
+-         this._c14nizedBytes =
+-            c14nizer.canonicalizeSubtree(this._constructionElement);
+-         javax.xml.parsers.DocumentBuilderFactory dbf =
+-            javax.xml.parsers.DocumentBuilderFactory.newInstance();
++                this._c14nizedBytes =
++                    c14nizer.canonicalizeSubtree(this._constructionElement);
++                javax.xml.parsers.DocumentBuilderFactory dbf =
++                    javax.xml.parsers.DocumentBuilderFactory.newInstance();
++                dbf.setNamespaceAware(true);
++                javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
++                org.w3c.dom.Document newdoc =
++                    db.parse(new ByteArrayInputStream(this._c14nizedBytes));
++                Node imported =
++                    this._doc.importNode(newdoc.getDocumentElement(), true);
+ 
+-         dbf.setNamespaceAware(true);
++                this._constructionElement.getParentNode().replaceChild(imported,
++                    this._constructionElement);
+ 
+-         javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
+-         org.w3c.dom.Document newdoc =
+-            db.parse(new ByteArrayInputStream(this._c14nizedBytes));
+-         Node imported = this._doc.importNode(newdoc.getDocumentElement(),
+-                                              true);
+-
+-         this._constructionElement.getParentNode().replaceChild(imported,
+-                 this._constructionElement);
+-
+-         this._constructionElement = (Element) imported;
+-      } catch (ParserConfigurationException ex) {
+-         throw new XMLSecurityException("empty", ex);
+-      } catch (IOException ex) {
+-         throw new XMLSecurityException("empty", ex);
+-      } catch (SAXException ex) {
+-         throw new XMLSecurityException("empty", ex);
+-      }
+-      }
+-      this._signatureAlgorithm =
+-         new SignatureAlgorithm(this.getSignatureMethodElement(),
+-                                this.getBaseURI());
+-   }
++                this._constructionElement = (Element) imported;
++            } catch (ParserConfigurationException ex) {
++                throw new XMLSecurityException("empty", ex);
++            } catch (IOException ex) {
++                throw new XMLSecurityException("empty", ex);
++            } catch (SAXException ex) {
++                throw new XMLSecurityException("empty", ex);
++            }
++        }
++        signatureMethod = XMLUtils.getNextElement(c14nMethod.getNextSibling());
++        this._signatureAlgorithm =
++            new SignatureAlgorithm(signatureMethod, this.getBaseURI());
++    }
+ 
+    /**
+     * Tests core validation process
+@@ -294,12 +300,8 @@
+     */
+    public String getCanonicalizationMethodURI() {
+ 
+-    Element el= XMLUtils.selectDsNode(this._constructionElement.getFirstChild(),
+-     Constants._TAG_CANONICALIZATIONMETHOD,0);
+-     if (el==null) {
+-        return null;
+-     }
+-     return el.getAttributeNS(null, Constants._ATT_ALGORITHM);
++
++     return c14nMethod.getAttributeNS(null, Constants._ATT_ALGORITHM);
+    }
+ 
+    /**
+@@ -324,8 +326,7 @@
+     *
+     */
+    public Element getSignatureMethodElement() {
+-      return XMLUtils.selectDsNode(this._constructionElement.getFirstChild(),
+-        Constants._TAG_SIGNATUREMETHOD,0);
++           return signatureMethod;
+    }
+ 
+    /**
+@@ -343,6 +344,9 @@
+                                   .getJCEAlgorithmString());
+    }
+ 
++   protected SignatureAlgorithm getSignatureAlgorithm() {
++           return _signatureAlgorithm;
++   }
+    /**
+     * Method getBaseLocalName
+     * @inheritDoc
+@@ -354,21 +358,16 @@
+ 
+    public String getInclusiveNamespaces() {
+ 
+-    Element el= XMLUtils.selectDsNode(this._constructionElement.getFirstChild(),
+-     Constants._TAG_CANONICALIZATIONMETHOD,0);
+-     if (el==null) {
+-        return null;
+-     }
+ 
+-     String c14nMethodURI = el.getAttributeNS(null, Constants._ATT_ALGORITHM);
++
++     String c14nMethodURI = c14nMethod.getAttributeNS(null, Constants._ATT_ALGORITHM);
+      if(!(c14nMethodURI.equals("http://www.w3.org/2001/10/xml-exc-c14n#") ||
+                         c14nMethodURI.equals("http://www.w3.org/2001/10/xml-exc-c14n#WithComments"))) {
+                 return null;
+             }
+ 
+-     Element inclusiveElement = XMLUtils.selectNode(
+-             el.getFirstChild(),InclusiveNamespaces.ExclusiveCanonicalizationNamespace,
+-        InclusiveNamespaces._TAG_EC_INCLUSIVENAMESPACES,0);
++     Element inclusiveElement = XMLUtils.getNextElement(
++                 c14nMethod.getFirstChild());
+ 
+      if(inclusiveElement != null)
+      {
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java
+@@ -75,7 +75,7 @@
+  * <li>sign and checkSignatureValue methods are used to sign and validate the
+  * signature. </li></ul>
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public final class XMLSignature extends SignatureElementProxy {
+ 
+@@ -115,6 +115,10 @@
+    public static final String ALGO_ID_MAC_HMAC_SHA384 = Constants.MoreAlgorithmsSpecNS + "hmac-sha384";
+    /** HMAC - Optional HMAC-SHA512 */
+    public static final String ALGO_ID_MAC_HMAC_SHA512 = Constants.MoreAlgorithmsSpecNS + "hmac-sha512";
++   /**Signature - Optional ECDSAwithSHA1 */
++   public static final String ALGO_ID_SIGNATURE_ECDSA_SHA1 = "http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1";
++
++
+    //J+
+ 
+    /** ds:Signature.ds:SignedInfo element */
+@@ -130,6 +134,8 @@
+     */
+    private boolean _followManifestsDuringValidation = false;
+ 
++private Element signatureValueElement;
++
+   /**
+     * This creates a new <CODE>ds:Signature</CODE> Element and adds an empty
+     * <CODE>ds:SignedInfo</CODE>.
+@@ -195,6 +201,15 @@
+ 
+       super(doc);
+ 
++      String xmlnsDsPrefix =
++         getDefaultPrefixBindings(Constants.SignatureSpecNS);
++      if (xmlnsDsPrefix == null) {
++         this._constructionElement.setAttributeNS
++            (Constants.NamespaceSpecNS, "xmlns", Constants.SignatureSpecNS);
++      } else {
++         this._constructionElement.setAttributeNS
++            (Constants.NamespaceSpecNS, xmlnsDsPrefix, Constants.SignatureSpecNS);
++      }
+       XMLUtils.addReturnToElement(this._constructionElement);
+ 
+       this._baseURI = BaseURI;
+@@ -206,7 +221,7 @@
+       XMLUtils.addReturnToElement(this._constructionElement);
+ 
+       // create an empty SignatureValue; this is filled by setSignatureValueElement
+-      Element signatureValueElement =
++      signatureValueElement =
+          XMLUtils.createElementInSignatureSpace(this._doc,
+                                                 Constants._TAG_SIGNATUREVALUE);
+ 
+@@ -227,6 +242,15 @@
+ 
+       super(doc);
+ 
++      String xmlnsDsPrefix =
++         getDefaultPrefixBindings(Constants.SignatureSpecNS);
++      if (xmlnsDsPrefix == null) {
++         this._constructionElement.setAttributeNS
++            (Constants.NamespaceSpecNS, "xmlns", Constants.SignatureSpecNS);
++      } else {
++         this._constructionElement.setAttributeNS
++            (Constants.NamespaceSpecNS, xmlnsDsPrefix, Constants.SignatureSpecNS);
++      }
+       XMLUtils.addReturnToElement(this._constructionElement);
+ 
+       this._baseURI = BaseURI;
+@@ -236,7 +260,7 @@
+       XMLUtils.addReturnToElement(this._constructionElement);
+ 
+       // create an empty SignatureValue; this is filled by setSignatureValueElement
+-      Element signatureValueElement =
++      signatureValueElement =
+          XMLUtils.createElementInSignatureSpace(this._doc,
+                                                 Constants._TAG_SIGNATUREVALUE);
+ 
+@@ -259,8 +283,8 @@
+       super(element, BaseURI);
+ 
+       // check out SignedInfo child
+-      Element signedInfoElem = XMLUtils.selectDsNode(this._constructionElement.getFirstChild(),
+-                                  Constants._TAG_SIGNEDINFO,0);
++      Element signedInfoElem = XMLUtils.getNextElement(element.getFirstChild());// XMLUtils.selectDsNode(this._constructionElement.getFirstChild(),
++                                  //Constants._TAG_SIGNEDINFO,0);
+ 
+       // check to see if it is there
+       if (signedInfoElem == null) {
+@@ -274,8 +298,8 @@
+       this._signedInfo = new SignedInfo(signedInfoElem, BaseURI);
+ 
+       // check out SignatureValue child
+-      Element signatureValueElement = XMLUtils.selectDsNode(this._constructionElement.getFirstChild(),
+-                                         Constants._TAG_SIGNATUREVALUE,0);
++      this.signatureValueElement =XMLUtils.getNextElement(signedInfoElem.getNextSibling()); //XMLUtils.selectDsNode(this._constructionElement.getFirstChild(),
++                                       //  Constants._TAG_SIGNATUREVALUE,0);
+ 
+       // check to see if it exists
+       if (signatureValueElement == null) {
+@@ -286,11 +310,12 @@
+       }
+ 
+       // <element ref="ds:KeyInfo" minOccurs="0"/>
+-      Element keyInfoElem =XMLUtils.selectDsNode(this._constructionElement.getFirstChild(),
+-                               Constants._TAG_KEYINFO,0);
++      Element keyInfoElem = XMLUtils.getNextElement(signatureValueElement.getNextSibling());//XMLUtils.selectDsNode(this._constructionElement.getFirstChild(),
++                              // Constants._TAG_KEYINFO,0);
+ 
+       // If it exists use it, but it's not mandatory
+-      if (keyInfoElem != null) {
++      if ((keyInfoElem != null) && (keyInfoElem.getNamespaceURI().equals(Constants.SignatureSpecNS) &&
++                  keyInfoElem.getLocalName().equals(Constants._TAG_KEYINFO)) ) {
+          this._keyInfo = new KeyInfo(keyInfoElem, BaseURI);
+       }
+    }
+@@ -302,7 +327,7 @@
+     */
+    public void setId(String Id) {
+ 
+-      if ((this._state == MODE_SIGN) && (Id != null)) {
++      if ( (Id != null)) {
+          this._constructionElement.setAttributeNS(null, Constants._ATT_ID, Id);
+          IdResolver.registerElementById(this._constructionElement, Id);
+       }
+@@ -336,9 +361,7 @@
+    public byte[] getSignatureValue() throws XMLSignatureException {
+ 
+       try {
+-         Element signatureValueElem = XMLUtils.selectDsNode(this._constructionElement.getFirstChild(),
+-                                         Constants._TAG_SIGNATUREVALUE,0);
+-         byte[] signatureValue = Base64.decode(signatureValueElem);
++          byte[] signatureValue = Base64.decode(signatureValueElement);
+ 
+          return signatureValue;
+       } catch (Base64DecodingException ex) {
+@@ -346,33 +369,28 @@
+       }
+    }
+ 
+-   /**
+-    * Base64 encodes and sets the bytes as the content of the SignatureValue
+-    * Node.
+-    *
+-    * @param bytes bytes to be used by SignatureValue before Base64 encoding
+-    */
+-   private void setSignatureValueElement(byte[] bytes)
+-   {
++    /**
++     * Base64 encodes and sets the bytes as the content of the SignatureValue
++     * Node.
++     *
++     * @param bytes bytes to be used by SignatureValue before Base64 encoding
++     */
++    private void setSignatureValueElement(byte[] bytes) {
+ 
+-      if (this._state == MODE_SIGN) {
+-         Element signatureValueElem = XMLUtils.selectDsNode(this._constructionElement.getFirstChild(),
+-                                         Constants._TAG_SIGNATUREVALUE,0);
+-         while (signatureValueElem.hasChildNodes()) {
+-            signatureValueElem.removeChild(signatureValueElem.getFirstChild());
+-         }
++        while (signatureValueElement.hasChildNodes()) {
++            signatureValueElement.removeChild
++                (signatureValueElement.getFirstChild());
++        }
+ 
+-         String base64codedValue = Base64.encode(bytes);
++        String base64codedValue = Base64.encode(bytes);
+ 
+-         if (base64codedValue.length() > 76) {
++        if (base64codedValue.length() > 76 && !XMLUtils.ignoreLineBreaks()) {
+             base64codedValue = "\n" + base64codedValue + "\n";
+-         }
++        }
+ 
+-         Text t = this._doc.createTextNode(base64codedValue);
+-
+-         signatureValueElem.appendChild(t);
+-      }
+-   }
++        Text t = this._doc.createTextNode(base64codedValue);
++        signatureValueElement.appendChild(t);
++    }
+ 
+    /**
+     * Returns the KeyInfo child. If we are in signing mode and the KeyInfo
+@@ -385,7 +403,7 @@
+    public KeyInfo getKeyInfo() {
+ 
+       // check to see if we are signing and if we have to create a keyinfo
+-      if ((this._state == MODE_SIGN) && (this._keyInfo == null)) {
++      if ( (this._keyInfo == null)) {
+ 
+          // create the KeyInfo
+          this._keyInfo = new KeyInfo(this._doc);
+@@ -401,8 +419,7 @@
+                // add it before the object
+                this._constructionElement.insertBefore(keyInfoElement,
+                                                       firstObject);
+-               this._constructionElement
+-                  .insertBefore(this._doc.createTextNode("\n"), firstObject);
++               XMLUtils.addReturnBeforeChild(this._constructionElement, firstObject);
+             } else {
+ 
+                // add it as the last element to the signature
+@@ -425,17 +442,17 @@
+    public void appendObject(ObjectContainer object)
+            throws XMLSignatureException {
+ 
+-      try {
+-         if (this._state != MODE_SIGN) {
+-            throw new XMLSignatureException(
+-               "signature.operationOnlyBeforeSign");
+-         }
++      //try {
++         //if (this._state != MODE_SIGN) {
++           // throw new XMLSignatureException(
++             //  "signature.operationOnlyBeforeSign");
++         //}
+ 
+          this._constructionElement.appendChild(object.getElement());
+          XMLUtils.addReturnToElement(this._constructionElement);
+-      } catch (XMLSecurityException ex) {
+-         throw new XMLSignatureException("empty", ex);
+-      }
++      //} catch (XMLSecurityException ex) {
++        // throw new XMLSignatureException("empty", ex);
++      //}
+    }
+ 
+    /**
+@@ -481,23 +498,13 @@
+       }
+ 
+       try {
+-         if (this._state == MODE_SIGN) {
+-
+-            // XMLUtils.indentSignature(this._constructionElement, "   ", 0);
+-            // get the SignatureMethodElement
+-            Element signatureMethodElement =
+-               this._signedInfo.getSignatureMethodElement();
+-
++        // if (this._state == MODE_SIGN) {
+             //Create a SignatureAlgorithm object
+-            SignatureAlgorithm sa =
+-               new SignatureAlgorithm(signatureMethodElement,
+-                                      this.getBaseURI());
+-
++                SignedInfo si = this.getSignedInfo();
++            SignatureAlgorithm sa = si.getSignatureAlgorithm();
+             // initialize SignatureAlgorithm for signing
+             sa.initSign(signingKey);
+ 
+-            SignedInfo si = this.getSignedInfo();
+-
+             // generate digest values for all References in this SignedInfo
+             si.generateDigestValues();
+             OutputStream so=new UnsyncBufferedOutputStream(new SignerOutputStream(sa));
+@@ -513,7 +520,7 @@
+ 
+             // set them on the SignateValue element
+             this.setSignatureValueElement(jcebytes);
+-         }
++         //}
+       } catch (CanonicalizationException ex) {
+          throw new XMLSignatureException("empty", ex);
+       } catch (InvalidCanonicalizerException ex) {
+@@ -584,50 +591,45 @@
+ 
+          throw new XMLSignatureException("empty", exArgs);
+       }
+-
+       // all references inside the signedinfo need to be dereferenced and
+       // digested again to see if the outcome matches the stored value in the
+       // SignedInfo.
+       // If _followManifestsDuringValidation is true it will do the same for
+       // References inside a Manifest.
+       try {
+-         if (!this.getSignedInfo()
+-                 .verify(this._followManifestsDuringValidation)) {
+-            return false;
+-         }
+-
++         SignedInfo si=this.getSignedInfo();
+          //create a SignatureAlgorithms from the SignatureMethod inside
+          //SignedInfo. This is used to validate the signature.
+-         SignatureAlgorithm sa =
+-            new SignatureAlgorithm(this.getSignedInfo()
+-               .getSignatureMethodElement(), this.getBaseURI());
+-         if (true) {
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "SignatureMethodURI = " + sa.getAlgorithmURI());
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "jceSigAlgorithm    = " + sa.getJCEAlgorithmString());
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "jceSigProvider     = " + sa.getJCEProviderName());
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "PublicKey = " + pk);
++         SignatureAlgorithm sa =si.getSignatureAlgorithm();
++         if (log.isLoggable(java.util.logging.Level.FINE)) {
++                log.log(java.util.logging.Level.FINE, "SignatureMethodURI = " + sa.getAlgorithmURI());
++                log.log(java.util.logging.Level.FINE, "jceSigAlgorithm    = " + sa.getJCEAlgorithmString());
++                log.log(java.util.logging.Level.FINE, "jceSigProvider     = " + sa.getJCEProviderName());
++                log.log(java.util.logging.Level.FINE, "PublicKey = " + pk);
+          }
+          sa.initVerify(pk);
+ 
+          // Get the canonicalized (normalized) SignedInfo
+          SignerOutputStream so=new SignerOutputStream(sa);
+          OutputStream bos=new UnsyncBufferedOutputStream(so);
+-         this._signedInfo.signInOctectStream(bos);
++         si.signInOctectStream(bos);
+          try {
+-                        bos.close();
+-                } catch (IOException e) {
+-                        //Imposible
+-                }
++                bos.close();
++         } catch (IOException e) {
++                //Imposible
++         }
+ 
+          //retrieve the byte[] from the stored signature
+          byte sigBytes[] = this.getSignatureValue();
+ 
+-
+          //Have SignatureAlgorithm sign the input bytes and compare them to the
+          //bytes that were stored in the signature.
+-         boolean verify = sa.verify(sigBytes);
++         if (!sa.verify(sigBytes)) {
++            log.log(java.util.logging.Level.WARNING, "Signature verification failed.");
++            return false;
++         }
+ 
+-         return verify;
++         return si.verify(this._followManifestsDuringValidation);
+       } catch (XMLSecurityException ex) {
+          throw new XMLSignatureException("empty", ex);
+       }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignatureException.java b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignatureException.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignatureException.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignatureException.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignatureInput.java b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignatureInput.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignatureInput.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignatureInput.java
+@@ -2,9 +2,8 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+- * Copyright  1999-2004 The Apache Software Foundation.
++ * Copyright  1999-2008 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.
+@@ -21,8 +20,6 @@
+  */
+ package com.sun.org.apache.xml.internal.security.signature;
+ 
+-
+-
+ import java.io.ByteArrayInputStream;
+ import java.io.ByteArrayOutputStream;
+ import java.io.IOException;
+@@ -39,7 +36,9 @@
+ import javax.xml.parsers.ParserConfigurationException;
+ 
+ import com.sun.org.apache.xml.internal.security.c14n.CanonicalizationException;
++import com.sun.org.apache.xml.internal.security.c14n.implementations.CanonicalizerBase;
+ import com.sun.org.apache.xml.internal.security.c14n.implementations.Canonicalizer20010315OmitComments;
++import com.sun.org.apache.xml.internal.security.c14n.implementations.Canonicalizer11_OmitComments;
+ import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityRuntimeException;
+ import com.sun.org.apache.xml.internal.security.utils.JavaUtils;
+ import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
+@@ -47,463 +46,483 @@
+ import org.w3c.dom.Node;
+ import org.xml.sax.SAXException;
+ 
+-
+ /**
+  * Class XMLSignatureInput
+  *
+  * @author Christian Geuer-Pollmann
+  * $todo$ check whether an XMLSignatureInput can be _both_, octet stream _and_ node set?
+  */
+-public class XMLSignatureInput  implements Cloneable {
+-         static java.util.logging.Logger log =
+-                java.util.logging.Logger.getLogger(XMLSignatureInput.class.getName());
++public class XMLSignatureInput implements Cloneable {
++    static java.util.logging.Logger log =
++        java.util.logging.Logger.getLogger
++            (XMLSignatureInput.class.getName());
+ 
+-        /*
++    /*
+      * The XMLSignature Input can be either:
+      *   A byteArray like with/or without InputStream.
+-     *   Or a  nodeSet like defined either:
+-     *                     * as a collection of nodes
+-     *                     * or as subnode excluding or not commets and excluding or
+-     *                            not other nodes.
+-         */
+-   /**
+-    * Some InputStreams do not support the {@link java.io.InputStream#reset}
+-    * method, so we read it in completely and work on our Proxy.
+-    */
+-   InputStream _inputOctetStreamProxy = null;
+-   /**
+-    * The original NodeSet for this XMLSignatureInput
+-    */
+-   Set _inputNodeSet = null;
+-   /**
+-    * The original Element
+-    */
+-   Node _subNode=null;
+-   /**
+-    * Exclude Node *for enveloped transformations*
+-    */
+-   Node excludeNode=null;
+-   /**
+-    *
+-    */
+-   boolean excludeComments=false;
++     *   Or a nodeSet like defined either:
++     *       * as a collection of nodes
++     *       * or as subnode excluding or not commets and excluding or
++     *         not other nodes.
++     */
+ 
+-   boolean isNodeSet=false;
+-   /**
+-    * A cached bytes
+-    */
+-   byte []bytes=null;
++    /**
++     * Some InputStreams do not support the {@link java.io.InputStream#reset}
++     * method, so we read it in completely and work on our Proxy.
++     */
++    InputStream _inputOctetStreamProxy = null;
++    /**
++     * The original NodeSet for this XMLSignatureInput
++     */
++    Set _inputNodeSet = null;
++    /**
++     * The original Element
++     */
++    Node _subNode=null;
++    /**
++     * Exclude Node *for enveloped transformations*
++     */
++    Node excludeNode=null;
++    /**
++     *
++     */
++    boolean excludeComments=false;
+ 
+-   /**
+-    * Some Transforms may require explicit MIME type, charset (IANA registered "character set"), or other such information concerning the data they are receiving from an earlier Transform or the source data, although no Transform algorithm specified in this document needs such explicit information. Such data characteristics are provided as parameters to the Transform algorithm and should be described in the specification for the algorithm.
+-    */
+-   private String _MIMEType = null;
++    boolean isNodeSet=false;
++    /**
++     * A cached bytes
++     */
++    byte []bytes=null;
+ 
+-   /**
+-    * Field _SourceURI
+-    */
+-   private String _SourceURI = null;
++    /**
++     * Some Transforms may require explicit MIME type, charset (IANA registered "character set"), or other such information concerning the data they are receiving from an earlier Transform or the source data, although no Transform algorithm specified in this document needs such explicit information. Such data characteristics are provided as parameters to the Transform algorithm and should be described in the specification for the algorithm.
++     */
++    private String _MIMEType = null;
+ 
+-   /**
+-    * Node Filter list.
+-    */
+-   List nodeFilters=new ArrayList();
++    /**
++     * Field _SourceURI
++     */
++    private String _SourceURI = null;
+ 
+-   boolean needsToBeExpanded=false;
+-   /**
+-    * Check if the structured is needed to be circumbented.
+-    * @return true if so.
+-    */
+-   public boolean isNeedsToBeExpanded() {
+-           return needsToBeExpanded;
+-   }
++    /**
++     * Node Filter list.
++     */
++    List nodeFilters=new ArrayList();
+ 
+-   /**
+-    * Set if the structured is needed to be circumbented.
+-    * @param needsToBeExpanded true if so.
+-    */
+-   public void setNeedsToBeExpanded(boolean needsToBeExpanded) {
++    boolean needsToBeExpanded=false;
++    OutputStream outputStream=null;
++
++    /**
++     * Check if the structured is needed to be circumbented.
++     * @return true if so.
++     */
++    public boolean isNeedsToBeExpanded() {
++        return needsToBeExpanded;
++    }
++
++    /**
++     * Set if the structured is needed to be circumbented.
++     * @param needsToBeExpanded true if so.
++     */
++    public void setNeedsToBeExpanded(boolean needsToBeExpanded) {
+         this.needsToBeExpanded = needsToBeExpanded;
+-   }
+-   OutputStream outputStream=null;
++    }
+ 
+-   /**
+-    * Construct a XMLSignatureInput from an octet array.
+-    * <p>
+-    * This is a comfort method, which internally converts the byte[] array into an InputStream
+-    * <p>NOTE: no defensive copy</p>
+-    * @param inputOctets an octet array which including XML document or node
+-    */
+-   public XMLSignatureInput(byte[] inputOctets) {
++    /**
++     * Construct a XMLSignatureInput from an octet array.
++     * <p>
++     * This is a comfort method, which internally converts the byte[] array into
++     * an InputStream
++     * <p>NOTE: no defensive copy</p>
++     * @param inputOctets an octet array which including XML document or node
++     */
++    public XMLSignatureInput(byte[] inputOctets) {
+ 
+-      // NO  defensive copy
++        // NO  defensive copy
+ 
+-      //this._inputOctetStreamProxy = new ByteArrayInputStream(inputOctets);
+-      this.bytes=inputOctets;
+-   }
++        //this._inputOctetStreamProxy = new ByteArrayInputStream(inputOctets);
++        this.bytes=inputOctets;
++    }
+ 
++    /**
++     * Constructs a <code>XMLSignatureInput</code> from an octet stream. The
++     * stream is directly read.
++     *
++     * @param inputOctetStream
++     */
++    public XMLSignatureInput(InputStream inputOctetStream)  {
++        this._inputOctetStreamProxy=inputOctetStream;
+ 
+-      /**
+-    * Constructs a <code>XMLSignatureInput</code> from an octet stream. The
+-    * stream is directly read.
+-    *
+-    * @param inputOctetStream
+-    */
+-   public XMLSignatureInput(InputStream inputOctetStream)  {
+-          this._inputOctetStreamProxy=inputOctetStream;
++        //this(JavaUtils.getBytesFromStream(inputOctetStream));
++    }
+ 
+-      //this(JavaUtils.getBytesFromStream(inputOctetStream));
++    /**
++     * Construct a XMLSignatureInput from a String.
++     * <p>
++     * This is a comfort method, which internally converts the String into a byte
++     * [] array using the {@link java.lang.String#getBytes()} method.
++     * @deprecated
++     * @param inputStr the input String which including XML document or node
++     */
++    public XMLSignatureInput(String inputStr) {
++        this(inputStr.getBytes());
++    }
+ 
+-   }
++    /**
++     * Construct a XMLSignatureInput from a String with a given encoding.
++     * <p>
++     * This is a comfort method, which internally converts the String into a byte
++     * [] array using the {@link java.lang.String#getBytes()} method.
++     *
++     * @deprecated
++     * @param inputStr the input String with encoding <code>encoding</code>
++     * @param encoding the encoding of <code>inputStr</code>
++     * @throws UnsupportedEncodingException
++     */
++    public XMLSignatureInput(String inputStr, String encoding)
++           throws UnsupportedEncodingException {
++        this(inputStr.getBytes(encoding));
++    }
+ 
+-   /**
+-    * Construct a XMLSignatureInput from a String.
+-    * <p>
+-    * This is a comfort method, which internally converts the String into a byte[] array using the {@link java.lang.String#getBytes()} method.
+-    * @deprecated
+-    * @param inputStr the input String which including XML document or node
+-    */
+-   public XMLSignatureInput(String inputStr) {
+-      this(inputStr.getBytes());
+-   }
++    /**
++     * Construct a XMLSignatureInput from a subtree rooted by rootNode. This
++     * method included the node and <I>all</I> his descendants in the output.
++     *
++     * @param rootNode
++     */
++    public XMLSignatureInput(Node rootNode)
++    {
++        this._subNode = rootNode;
++    }
+ 
+-   /**
+-    * Construct a XMLSignatureInput from a String with a given encoding.
+-    * <p>
+-    * This is a comfort method, which internally converts the String into a byte[] array using the {@link java.lang.String#getBytes()} method.
+-    *
+-    * @deprecated
+-    * @param inputStr the input String with encoding <code>encoding</code>
+-    * @param encoding the encoding of <code>inputStr</code>
+-    * @throws UnsupportedEncodingException
+-    */
+-   public XMLSignatureInput(String inputStr, String encoding)
+-           throws UnsupportedEncodingException {
+-      this(inputStr.getBytes(encoding));
+-   }
++    /**
++     * Constructor XMLSignatureInput
++     *
++     * @param inputNodeSet
++     * @param usedXPathAPI
++     */
++    public XMLSignatureInput(Set inputNodeSet) {
++        this._inputNodeSet = inputNodeSet;
++    }
+ 
+-   /**
+-    * Construct a XMLSignatureInput from a subtree rooted by rootNode. This
+-    * method included the node and <I>all</I> his descendants in the output.
+-    *
+-    * @param rootNode
+-    */
+-   public XMLSignatureInput(Node rootNode)
+-   {
+-      this._subNode = rootNode;
+-   }
++    /**
++     * Returns the node set from input which was specified as the parameter of
++     * {@link XMLSignatureInput} constructor
++     *
++     * @return the node set
++     * @throws SAXException
++     * @throws IOException
++     * @throws ParserConfigurationException
++     * @throws CanonicalizationException
++     */
++    public Set getNodeSet() throws CanonicalizationException,
++        ParserConfigurationException, IOException, SAXException {
++        return getNodeSet(false);
++    }
+ 
+-   /**
+-    * Constructor XMLSignatureInput
+-    *
+-    * @param inputNodeSet
+-    * @param usedXPathAPI
+-    */
+-   public XMLSignatureInput(Set inputNodeSet) {
+-       this._inputNodeSet = inputNodeSet;
+-   }
+-
+-   /**
+-    * Returns the node set from input which was specified as the parameter of {@link XMLSignatureInput} constructor
+-    *
+-    * @return the node set
+-    * @throws SAXException
+-    * @throws IOException
+-    * @throws ParserConfigurationException
+-    * @throws CanonicalizationException
+-    * @throws CanonicalizationException
+-    * @throws IOException
+-    * @throws ParserConfigurationException
+-    * @throws SAXException
+-    */
+-   public Set getNodeSet() throws CanonicalizationException, ParserConfigurationException, IOException, SAXException {
+-              return getNodeSet(false);
+-   }
+-   /**
+-    * Returns the node set from input which was specified as the parameter of {@link XMLSignatureInput} constructor
+-    * @param circunvent
+-    *
+-    * @return the node set
+-    * @throws SAXException
+-    * @throws IOException
+-    * @throws ParserConfigurationException
+-    * @throws CanonicalizationException
+-    * @throws CanonicalizationException
+-    * @throws IOException
+-    * @throws ParserConfigurationException
+-    * @throws SAXException
+-    */
+-   public Set getNodeSet(boolean circunvent)
++    /**
++     * Returns the node set from input which was specified as the parameter of
++     * {@link XMLSignatureInput} constructor
++     * @param circumvent
++     *
++     * @return the node set
++     * @throws SAXException
++     * @throws IOException
++     * @throws ParserConfigurationException
++     * @throws CanonicalizationException
++     */
++    public Set getNodeSet(boolean circumvent)
+            throws ParserConfigurationException, IOException, SAXException,
+                   CanonicalizationException {
+-      if (this._inputNodeSet!=null) {
+-          return this._inputNodeSet;
+-      }
+-          if (this.isElement()) {
++        if (this._inputNodeSet!=null) {
++            return this._inputNodeSet;
++        }
++        if ((this._inputOctetStreamProxy==null)&& (this._subNode!=null) ) {
+ 
+-                    if (circunvent) {
+-                        XMLUtils.circumventBug2650(XMLUtils.getOwnerDocument(_subNode));
++            if (circumvent) {
++                XMLUtils.circumventBug2650(XMLUtils.getOwnerDocument(_subNode));
+             }
+             this._inputNodeSet = new HashSet();
+             XMLUtils.getSet(_subNode,this._inputNodeSet, excludeNode, this.excludeComments);
+ 
+-                    return this._inputNodeSet;
+-          }
+-       else if (this.isOctetStream()) {
+-         convertToNodes();
+-         HashSet result=new HashSet();
+-         XMLUtils.getSet(_subNode, result,null,false);
++            return this._inputNodeSet;
++        } else if (this.isOctetStream()) {
++            convertToNodes();
++            HashSet result=new HashSet();
++            XMLUtils.getSet(_subNode, result,null,false);
+             //this._inputNodeSet=result;
+             return result;
+-      }
++        }
+ 
+-      throw new RuntimeException(
+-         "getNodeSet() called but no input data present");
+-   }
++        throw new RuntimeException(
++            "getNodeSet() called but no input data present");
++    }
+ 
+-   /**
+-    * Returns the Octect stream(byte Stream) from input which was specified as the parameter of {@link XMLSignatureInput} constructor
+-    *
+-    * @return the Octect stream(byte Stream) from input which was specified as the parameter of {@link XMLSignatureInput} constructor
+-    * @throws IOException
+-    */
+-   public InputStream getOctetStream()
+-           throws IOException  {
++    /**
++     * Returns the Octect stream(byte Stream) from input which was specified as
++     * the parameter of {@link XMLSignatureInput} constructor
++     *
++     * @return the Octect stream(byte Stream) from input which was specified as
++     * the parameter of {@link XMLSignatureInput} constructor
++     * @throws IOException
++     */
++    public InputStream getOctetStream() throws IOException  {
+ 
+-      return getResetableInputStream();
++        return getResetableInputStream();
++    }
+ 
+-   }
+-   /**
++    /**
+      * @return real octect stream
+      */
+     public InputStream getOctetStreamReal () {
+-       return this._inputOctetStreamProxy;
+-   }
+-   /**
+-    * Returns the byte array from input which was specified as the parameter of {@link XMLSignatureInput} constructor
+-    *
+-    * @return the byte[] from input which was specified as the parameter of {@link XMLSignatureInput} constructor
+-    *
+-    * @throws CanonicalizationException
+-    * @throws IOException
+-    */
+-   public byte[] getBytes()
+-           throws IOException, CanonicalizationException {
+-    if (bytes!=null) {
+-        return bytes;
+-      }
+-          InputStream is = getResetableInputStream();
+-          if (is!=null) {
+-        //reseatable can read again bytes.
+-                if (bytes==null) {
+-            is.reset();
+-            bytes=JavaUtils.getBytesFromStream(is);
+-                }
+-                return bytes;
+-      }
+-         Canonicalizer20010315OmitComments c14nizer =
+-                        new Canonicalizer20010315OmitComments();
++        return this._inputOctetStreamProxy;
++    }
++
++    /**
++     * Returns the byte array from input which was specified as the parameter of
++     * {@link XMLSignatureInput} constructor
++     *
++     * @return the byte[] from input which was specified as the parameter of
++     * {@link XMLSignatureInput} constructor
++     *
++     * @throws CanonicalizationException
++     * @throws IOException
++     */
++    public byte[] getBytes() throws IOException, CanonicalizationException {
++        if (bytes!=null) {
++            return bytes;
++        }
++        InputStream is = getResetableInputStream();
++        if (is!=null) {
++            //resetable can read again bytes.
++            if (bytes==null) {
++                is.reset();
++                bytes=JavaUtils.getBytesFromStream(is);
++            }
++            return bytes;
++        }
++        Canonicalizer20010315OmitComments c14nizer =
++                new Canonicalizer20010315OmitComments();
+         bytes=c14nizer.engineCanonicalize(this);
+         return bytes;
+-   }
++    }
+ 
++    /**
++     * Determines if the object has been set up with a Node set
++     *
++     * @return true if the object has been set up with a Node set
++     */
++    public boolean isNodeSet() {
++        return (( (this._inputOctetStreamProxy == null)
++              && (this._inputNodeSet != null) ) || isNodeSet);
++    }
+ 
+-   /**
+-    * Determines if the object has been set up with a Node set
+-    *
+-    * @return true is the object has been set up with a Node set
+-    */
+-   public boolean isNodeSet() {
+-      return (( (this._inputOctetStreamProxy == null)
+-              && (this._inputNodeSet != null) ) || isNodeSet);
+-   }
+-   /**
+-    * Determines if the object has been set up with an Element
+-    *
+-    * @return true is the object has been set up with a Node set
+-    */
+-   public boolean isElement() {
+-                return ((this._inputOctetStreamProxy==null)&& (this._subNode!=null)
+-                                && (this._inputNodeSet==null) && !isNodeSet
+-                                );
+-   }
++    /**
++     * Determines if the object has been set up with an Element
++     *
++     * @return true if the object has been set up with a Node set
++     */
++    public boolean isElement() {
++        return ((this._inputOctetStreamProxy==null)&& (this._subNode!=null)
++                && (this._inputNodeSet==null) && !isNodeSet);
++    }
+ 
+-   /**
+-    * Determines if the object has been set up with an octet stream
+-    *
+-    * @return true is the object has been set up with an octet stream
+-    */
+-   public boolean isOctetStream() {
+-      return ( ((this._inputOctetStreamProxy != null) || bytes!=null)
++    /**
++     * Determines if the object has been set up with an octet stream
++     *
++     * @return true if the object has been set up with an octet stream
++     */
++    public boolean isOctetStream() {
++        return ( ((this._inputOctetStreamProxy != null) || bytes!=null)
+               && ((this._inputNodeSet == null) && _subNode ==null));
+-   }
++    }
+ 
+-   /**
+-    * Determines if the object has been set up with a ByteArray
+-    *
+-    * @return true is the object has been set up with an octet stream
+-    */
+-   public boolean isByteArray() {
+-      return ( (bytes!=null)
++    /**
++     * Determines if {@link #setOutputStream} has been called with a
++     * non-null OutputStream.
++     *
++     * @return true if {@link #setOutputStream} has been called with a
++     * non-null OutputStream
++     */
++    public boolean isOutputStreamSet() {
++        return outputStream != null;
++    }
++
++    /**
++     * Determines if the object has been set up with a ByteArray
++     *
++     * @return true is the object has been set up with an octet stream
++     */
++    public boolean isByteArray() {
++        return ( (bytes!=null)
+               && ((this._inputNodeSet == null) && _subNode ==null));
+-   }
++    }
+ 
+-   /**
+-    * Is the object correctly set up?
+-    *
+-    * @return true if the object has been set up correctly
+-    */
+-   public boolean isInitialized() {
+-      return (this.isOctetStream() || this.isNodeSet());
+-   }
++    /**
++     * Is the object correctly set up?
++     *
++     * @return true if the object has been set up correctly
++     */
++    public boolean isInitialized() {
++        return (this.isOctetStream() || this.isNodeSet());
++    }
+ 
+-   /**
+-    * Returns MIMEType
+-    *
+-    * @return MIMEType
+-    */
+-   public String getMIMEType() {
+-      return this._MIMEType;
+-   }
++    /**
++     * Returns MIMEType
++     *
++     * @return MIMEType
++     */
++    public String getMIMEType() {
++        return this._MIMEType;
++    }
+ 
+-   /**
+-    * Sets MIMEType
+-    *
+-    * @param MIMEType
+-    */
+-   public void setMIMEType(String MIMEType) {
+-      this._MIMEType = MIMEType;
+-   }
++    /**
++     * Sets MIMEType
++     *
++     * @param MIMEType
++     */
++    public void setMIMEType(String MIMEType) {
++        this._MIMEType = MIMEType;
++    }
+ 
+-   /**
+-    * Return SourceURI
+-    *
+-    * @return SourceURI
+-    */
+-   public String getSourceURI() {
+-      return this._SourceURI;
+-   }
++    /**
++     * Return SourceURI
++     *
++     * @return SourceURI
++     */
++    public String getSourceURI() {
++        return this._SourceURI;
++    }
+ 
+-   /**
+-    * Sets SourceURI
+-    *
+-    * @param SourceURI
+-    */
+-   public void setSourceURI(String SourceURI) {
+-      this._SourceURI = SourceURI;
+-   }
++    /**
++     * Sets SourceURI
++     *
++     * @param SourceURI
++     */
++    public void setSourceURI(String SourceURI) {
++        this._SourceURI = SourceURI;
++    }
+ 
+-
+-   /**
+-    * Method toString
+-    * @inheritDoc
+-    *
+-    */
+-   public String toString() {
+-
+-      if (this.isNodeSet()) {
+-         return "XMLSignatureInput/NodeSet/" + this._inputNodeSet.size()
++    /**
++     * Method toString
++     * @inheritDoc
++     */
++    public String toString() {
++        if (this.isNodeSet()) {
++            return "XMLSignatureInput/NodeSet/" + this._inputNodeSet.size()
+                    + " nodes/" + this.getSourceURI();
+-      }
+-      if (this.isElement()) {
+-        return "XMLSignatureInput/Element/" + this._subNode
+-        + " exclude "+ this.excludeNode + " comments:" +
+-        this.excludeComments
+-        +"/" + this.getSourceURI();
+-      }
+-         try {
++        }
++        if (this.isElement()) {
++            return "XMLSignatureInput/Element/" + this._subNode
++                + " exclude "+ this.excludeNode + " comments:" +
++                this.excludeComments +"/" + this.getSourceURI();
++        }
++        try {
+             return "XMLSignatureInput/OctetStream/" + this.getBytes().length
+                    + " octets/" + this.getSourceURI();
+-         } catch (Exception ex) {
++        } catch (IOException iex) {
+             return "XMLSignatureInput/OctetStream//" + this.getSourceURI();
+-         }
++        } catch (CanonicalizationException cex) {
++            return "XMLSignatureInput/OctetStream//" + this.getSourceURI();
++        }
++    }
+ 
+-   }
++    /**
++     * Method getHTMLRepresentation
++     *
++     * @throws XMLSignatureException
++     * @return The HTML representation for this XMLSignature
++     */
++    public String getHTMLRepresentation() throws XMLSignatureException {
+ 
+-   /**
+-    * Method getHTMLRepresentation
+-    *
+-    * @throws XMLSignatureException
+-    * @return The HTML representation for this XMLSignature
+-    */
+-   public String getHTMLRepresentation() throws XMLSignatureException {
++        XMLSignatureInputDebugger db = new XMLSignatureInputDebugger(this);
+ 
+-      XMLSignatureInputDebugger db = new XMLSignatureInputDebugger(this);
++        return db.getHTMLRepresentation();
++    }
+ 
+-      return db.getHTMLRepresentation();
+-   }
+-
+-   /**
+-    * Method getHTMLRepresentation
+-    *
+-    * @param inclusiveNamespaces
+-    * @throws XMLSignatureException
+-    * @return The HTML representation for this XMLSignature
+-    */
+-   public String getHTMLRepresentation(Set inclusiveNamespaces)
++    /**
++     * Method getHTMLRepresentation
++     *
++     * @param inclusiveNamespaces
++     * @throws XMLSignatureException
++     * @return The HTML representation for this XMLSignature
++     */
++    public String getHTMLRepresentation(Set inclusiveNamespaces)
+            throws XMLSignatureException {
+ 
+-      XMLSignatureInputDebugger db = new XMLSignatureInputDebugger( this,
++        XMLSignatureInputDebugger db = new XMLSignatureInputDebugger( this,
+                                         inclusiveNamespaces);
+ 
+-      return db.getHTMLRepresentation();
+-   }
++        return db.getHTMLRepresentation();
++    }
+ 
+-   /**
+-    * Gets the exclude node of this XMLSignatureInput
+-    * @return Returns the excludeNode.
+-    */
++    /**
++     * Gets the exclude node of this XMLSignatureInput
++     * @return Returns the excludeNode.
++     */
+     public Node getExcludeNode() {
+-           return excludeNode;
++        return excludeNode;
+     }
+ 
+     /**
+      * Sets the exclude node of this XMLSignatureInput
+      * @param excludeNode The excludeNode to set.
+      */
+-     public void setExcludeNode(Node excludeNode) {
+-            this.excludeNode = excludeNode;
+-     }
++    public void setExcludeNode(Node excludeNode) {
++        this.excludeNode = excludeNode;
++    }
+ 
+-     /**
+-      * Gets the node of this XMLSignatureInput
+-      * @return The excludeNode set.
+-      */
+-     public Node getSubNode() {
+-            return _subNode;
+-     }
+-     /**
+-      * @return Returns the excludeComments.
+-      */
+-     public boolean isExcludeComments() {
++    /**
++     * Gets the node of this XMLSignatureInput
++     * @return The excludeNode set.
++     */
++    public Node getSubNode() {
++        return _subNode;
++    }
++
++    /**
++     * @return Returns the excludeComments.
++     */
++    public boolean isExcludeComments() {
+         return excludeComments;
+-     }
+-     /**
+-      * @param excludeComments The excludeComments to set.
+-      */
+-     public void setExcludeComments(boolean excludeComments) {
++    }
++
++    /**
++     * @param excludeComments The excludeComments to set.
++     */
++    public void setExcludeComments(boolean excludeComments) {
+         this.excludeComments = excludeComments;
+-     }
++    }
+ 
+-        /**
+-         * @param diOs
+-         * @throws IOException
+-         * @throws CanonicalizationException
+-         */
+-        public void updateOutputStream(OutputStream diOs) throws CanonicalizationException, IOException {
++    /**
++     * @param diOs
++     * @throws IOException
++     * @throws CanonicalizationException
++     */
++    public void updateOutputStream(OutputStream diOs)
++    throws CanonicalizationException, IOException {
++        updateOutputStream(diOs, false);
++    }
++
++    public void updateOutputStream(OutputStream diOs, boolean c14n11)
++    throws CanonicalizationException, IOException {
+         if (diOs==outputStream) {
+-                return;
++            return;
+         }
+         if (bytes!=null) {
+             diOs.write(bytes);
+             return;
+-         }else if (_inputOctetStreamProxy==null) {
+-             Canonicalizer20010315OmitComments c14nizer =
+-                    new Canonicalizer20010315OmitComments();
+-             c14nizer.setWriter(diOs);
++        } else if (_inputOctetStreamProxy==null) {
++            CanonicalizerBase c14nizer = null;
++            if (c14n11) {
++                c14nizer = new Canonicalizer11_OmitComments();
++            } else {
++                c14nizer = new Canonicalizer20010315OmitComments();
++            }
++            c14nizer.setWriter(diOs);
+             c14nizer.engineCanonicalize(this);
+             return;
+-          } else {
++        } else {
+             InputStream is = getResetableInputStream();
+             if (bytes!=null) {
+                 //already read write it, can be rea.
+@@ -516,25 +535,22 @@
+             while ((num=is.read(bytesT))>0) {
+                 diOs.write(bytesT,0,num);
+             }
++        }
++    }
+ 
+-          }
++    /**
++     * @param os
++     */
++    public void setOutputStream(OutputStream os) {
++        outputStream=os;
++    }
+ 
+-        }
+-
+-
+-        /**
+-         * @param os
+-         */
+-        public void setOutputStream(OutputStream os) {
+-                outputStream=os;
+-
+-        }
+     protected InputStream getResetableInputStream() throws IOException{
+         if ((_inputOctetStreamProxy instanceof ByteArrayInputStream) ) {
+             if (!_inputOctetStreamProxy.markSupported()) {
+                 throw new RuntimeException("Accepted as Markable but not truly been"+_inputOctetStreamProxy);
+             }
+-           return _inputOctetStreamProxy;
++            return _inputOctetStreamProxy;
+         }
+         if (bytes!=null) {
+             _inputOctetStreamProxy=new ByteArrayInputStream(bytes);
+@@ -543,7 +559,7 @@
+         if (_inputOctetStreamProxy ==null)
+             return null;
+         if (_inputOctetStreamProxy.markSupported()) {
+-            if (log.isLoggable(java.util.logging.Level.INFO))                                  log.log(java.util.logging.Level.INFO, "Mark Suported but not used as reset");
++            log.log(java.util.logging.Level.INFO, "Mark Suported but not used as reset");
+         }
+         bytes=JavaUtils.getBytesFromStream(_inputOctetStreamProxy);
+         _inputOctetStreamProxy.close();
+@@ -551,66 +567,63 @@
+         return _inputOctetStreamProxy;
+     }
+ 
++    /**
++     * @param filter
++     */
++    public void addNodeFilter(NodeFilter filter) {
++        if (isOctetStream()) {
++            try {
++                convertToNodes();
++            } catch (Exception e) {
++                throw new XMLSecurityRuntimeException("signature.XMLSignatureInput.nodesetReference",e);
++            }
++        }
++        nodeFilters.add(filter);
++    }
+ 
+-        /**
+-         * @param filter
+-         */
+-        public void addNodeFilter(NodeFilter filter) {
+-                if (isOctetStream()) {
+-                        try {
+-                                convertToNodes();
+-                        } catch (Exception e) {
+-                                throw new XMLSecurityRuntimeException("signature.XMLSignatureInput.nodesetReference",e);
+-                        }
+-                }
+-                nodeFilters.add(filter);
++    /**
++     * @return the node filters
++     */
++    public List getNodeFilters() {
++        // TODO Auto-generated method stub
++        return nodeFilters;
++    }
+ 
+-        }
++    /**
++     * @param b
++     */
++    public void setNodeSet(boolean b) {
++        isNodeSet=b;
++    }
+ 
+-        /**
+-         * @return the node filters
+-         */
+-        public List getNodeFilters() {
+-                // TODO Auto-generated method stub
+-                return nodeFilters;
+-        }
+-
+-        /**
+-         * @param b
+-         */
+-        public void setNodeSet(boolean b) {
+-                isNodeSet=b;
+-
+-        }
+-
+-        void convertToNodes() throws CanonicalizationException, ParserConfigurationException, IOException, SAXException{
+-                DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
++    void convertToNodes() throws CanonicalizationException,
++        ParserConfigurationException, IOException, SAXException {
++        DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
+         dfactory.setValidating(false);
+         dfactory.setNamespaceAware(true);
+         DocumentBuilder db = dfactory.newDocumentBuilder();
+         // select all nodes, also the comments.
+         try {
+-           db.setErrorHandler(new com.sun.org.apache.xml.internal.security.utils
+-              .IgnoreAllErrorHandler());
++            db.setErrorHandler(new com.sun.org.apache.xml.internal.security.utils
++               .IgnoreAllErrorHandler());
+ 
+-           Document doc = db.parse(this.getOctetStream());
++            Document doc = db.parse(this.getOctetStream());
+ 
+-           XMLUtils.circumventBug2650(doc);
+-           this._subNode=doc.getDocumentElement();
++            this._subNode=doc.getDocumentElement();
+         } catch (SAXException ex) {
+ 
+-           // if a not-wellformed nodeset exists, put a container around it...
+-           ByteArrayOutputStream baos = new ByteArrayOutputStream();
++            // if a not-wellformed nodeset exists, put a container around it...
++            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ 
+-           baos.write("<container>".getBytes());
+-           baos.write(this.getBytes());
+-           baos.write("</container>".getBytes());
++            baos.write("<container>".getBytes());
++            baos.write(this.getBytes());
++            baos.write("</container>".getBytes());
+ 
+-           byte result[] = baos.toByteArray();
+-           Document document = db.parse(new ByteArrayInputStream(result));
+-           this._subNode=document.getDocumentElement().getFirstChild().getFirstChild();
++            byte result[] = baos.toByteArray();
++            Document document = db.parse(new ByteArrayInputStream(result));
++            this._subNode=document.getDocumentElement().getFirstChild().getFirstChild();
+         }
+         this._inputOctetStreamProxy=null;
+         this.bytes=null;
+-        }
++    }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignatureInputDebugger.java b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignatureInputDebugger.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignatureInputDebugger.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignatureInputDebugger.java
+@@ -39,7 +39,8 @@
+ /**
+  * Class XMLSignatureInputDebugger
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
++ * @version $Revision: 1.3 $
+  */
+ public class XMLSignatureInputDebugger {
+ 
+@@ -599,23 +600,23 @@
+ 
+                 length = data.length();
+ 
+-                if ((data != null) && (length > 0)) {
+-                        this._writer.write(" ");
++                if (length > 0) {
++                    this._writer.write(" ");
+ 
+-                        for (int i = 0; i < length; i++) {
+-                                char c = data.charAt(i);
++                    for (int i = 0; i < length; i++) {
++                        char c = data.charAt(i);
+ 
+-                                switch (c) {
++                        switch (c) {
+ 
+-                                case 0x0D:
+-                                        this._writer.write("&#xD;");
+-                                        break;
++                            case 0x0D:
++                                this._writer.write("&#xD;");
++                                break;
+ 
+-                                default:
+-                                        this._writer.write(c);
+-                                        break;
+-                                }
++                            default:
++                                this._writer.write(c);
++                                break;
+                         }
++                    }
+                 }
+ 
+                 this._writer.write("?>");
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/InvalidTransformException.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/InvalidTransformException.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/InvalidTransformException.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/InvalidTransformException.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/Transform.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/Transform.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/Transform.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/Transform.java
+@@ -20,14 +20,11 @@
+  */
+ package com.sun.org.apache.xml.internal.security.transforms;
+ 
+-
+-
+ import java.io.IOException;
+ import java.io.OutputStream;
+-import java.util.HashMap;
+ import java.security.AccessController;
+ import java.security.PrivilegedAction;
+-
++import java.util.HashMap;
+ import javax.xml.parsers.ParserConfigurationException;
+ 
+ import com.sun.org.apache.xml.internal.security.c14n.CanonicalizationException;
+@@ -38,17 +35,17 @@
+ import com.sun.org.apache.xml.internal.security.utils.Constants;
+ import com.sun.org.apache.xml.internal.security.utils.HelperNodeList;
+ import com.sun.org.apache.xml.internal.security.utils.SignatureElementProxy;
++import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+ import org.w3c.dom.NodeList;
+ import org.xml.sax.SAXException;
+ 
+-
+ /**
+  * Implements the behaviour of the <code>ds:Transform</code> element.
+  *
+- * This <code>Transform</code>(Factory) class role as the Factory and Proxy of
+- * implemanting class that have the functionality of <a
++ * This <code>Transform</code>(Factory) class acts as the Factory and Proxy of
++ * the implementing class that supports the functionality of <a
+  * href=http://www.w3.org/TR/xmldsig-core/#sec-TransformAlg>a Transform
+  * algorithm</a>.
+  * Implements the Factory and Proxy pattern for ds:Transform algorithms.
+@@ -60,322 +57,311 @@
+  */
+ public final class Transform extends SignatureElementProxy {
+ 
+-   /** {@link java.util.logging} logging facility */
++    /** {@link java.util.logging} logging facility */
+     static java.util.logging.Logger log =
+         java.util.logging.Logger.getLogger(Transform.class.getName());
+ 
+-   /** Field _alreadyInitialized */
+-   static boolean _alreadyInitialized = false;
++    /** Field _alreadyInitialized */
++    private static boolean alreadyInitialized = false;
+ 
+-   /** All available Transform classes are registered here */
+-   static HashMap _transformHash = null;
++    /** All available Transform classes are registered here */
++    private static HashMap transformClassHash = null;
+ 
+-   /** Field transformSpi */
+-   protected TransformSpi transformSpi = null;
++    private static HashMap transformSpiHash = new HashMap();
+ 
+-   /**
+-    * Constructs {@link Transform}
+-    *
+-    * @param doc the {@link Document} in which <code>Transform</code> will be placed
+-    * @param algorithmURI URI representation of
+-    * <code>Transform algorithm</code> will be specified as parameter of
+-    * {@link #getInstance(Document, String)}, when generate. </br>
+-    * @param contextNodes the child node list of <code>Transform</code> element
+-    * @throws InvalidTransformException
+-    */
+-   public Transform(Document doc, String algorithmURI, NodeList contextNodes)
+-           throws InvalidTransformException {
++    private TransformSpi transformSpi = null;
+ 
+-      super(doc);
++    /**
++     * Constructs {@link Transform}
++     *
++     * @param doc the {@link Document} in which <code>Transform</code> will be
++     * placed
++     * @param algorithmURI URI representation of
++     * <code>Transform algorithm</code> which will be specified as parameter of
++     * {@link #getInstance(Document, String)}, when generated. </br>
++     * @param contextNodes the child node list of <code>Transform</code> element
++     * @throws InvalidTransformException
++     */
++    public Transform(Document doc, String algorithmURI, NodeList contextNodes)
++        throws InvalidTransformException {
+ 
+-      try {
+-         this._constructionElement.setAttributeNS(null, Constants._ATT_ALGORITHM,
+-                                                algorithmURI);
++        super(doc);
+ 
+-         Class implementingClass =
+-            Transform.getImplementingClass(algorithmURI);
++        this._constructionElement.setAttributeNS
++            (null, Constants._ATT_ALGORITHM, algorithmURI);
+ 
+-         if(implementingClass == null) {
++        transformSpi = getTransformSpi(algorithmURI);
++        if (transformSpi == null) {
+              Object exArgs[] = { algorithmURI };
+-
+              throw new InvalidTransformException(
+                 "signature.Transform.UnknownTransform", exArgs);
+-         }
+-         if (true) {
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Create URI \"" + algorithmURI + "\" class \""
+-                   + implementingClass + "\"");
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "The NodeList is " + contextNodes);
+-         }
++        }
+ 
+-         // create the custom Transform object
+-         this.transformSpi =
+-            (TransformSpi) implementingClass.newInstance();
++        if (log.isLoggable(java.util.logging.Level.FINE)) {
++            log.log(java.util.logging.Level.FINE, "Create URI \"" + algorithmURI + "\" class \""
++                   + transformSpi.getClass() + "\"");
++            log.log(java.util.logging.Level.FINE, "The NodeList is " + contextNodes);
++        }
+ 
+-         this.transformSpi.setTransform(this);
++        // give it to the current document
++        if (contextNodes != null) {
++            for (int i = 0; i < contextNodes.getLength(); i++) {
++               this._constructionElement.appendChild
++                   (contextNodes.item(i).cloneNode(true));
++            }
++        }
++    }
+ 
+-         // give it to the current document
+-         if (contextNodes != null) {
+-            /*
+-            while (contextNodes.getLength() > 0) {
+-               this._constructionElement.appendChild(contextNodes.item(0));
+-            }
+-            */
++    /**
++     * This constructor can only be called from the {@link Transforms} object,
++     * so it's protected.
++     *
++     * @param element <code>ds:Transform</code> element
++     * @param BaseURI the URI of the resource where the XML instance was stored
++     * @throws InvalidTransformException
++     * @throws TransformationException
++     * @throws XMLSecurityException
++     */
++    public Transform(Element element, String BaseURI)
++        throws InvalidTransformException, TransformationException,
++               XMLSecurityException {
+ 
+-            for (int i = 0; i < contextNodes.getLength(); i++) {
+-               this._constructionElement.appendChild(contextNodes.item(i).cloneNode(true));
+-            }
++        super(element, BaseURI);
+ 
+-         }
+-      } catch (IllegalAccessException ex) {
+-         Object exArgs[] = { algorithmURI };
++        // retrieve Algorithm Attribute from ds:Transform
++        String algorithmURI = element.getAttributeNS(null, Constants._ATT_ALGORITHM);
+ 
+-         throw new InvalidTransformException(
+-            "signature.Transform.UnknownTransform", exArgs, ex);
+-      } catch (InstantiationException ex) {
+-         Object exArgs[] = { algorithmURI };
++        if (algorithmURI == null || algorithmURI.length() == 0) {
++            Object exArgs[] = { Constants._ATT_ALGORITHM,
++                                Constants._TAG_TRANSFORM };
++            throw new TransformationException("xml.WrongContent", exArgs);
++        }
+ 
+-         throw new InvalidTransformException(
+-            "signature.Transform.UnknownTransform", exArgs, ex);
+-      }
+-   }
++        transformSpi = getTransformSpi(algorithmURI);
++        if (transformSpi == null) {
++            Object exArgs[] = { algorithmURI };
++            throw new InvalidTransformException(
++                "signature.Transform.UnknownTransform", exArgs);
++        }
++    }
+ 
+-   /**
+-    * This constructor can only be called from the {@link Transforms} object, so
+-    * it's protected.
+-    *
+-    * @param element <code>ds:Transform</code> element
+-    * @param BaseURI the URI of the resource where the XML instance was stored
+-    * @throws InvalidTransformException
+-    * @throws TransformationException
+-    * @throws XMLSecurityException
+-    */
+-   public Transform(Element element, String BaseURI)
+-           throws InvalidTransformException, TransformationException,
+-                  XMLSecurityException {
++    /**
++     * Generates a Transform object that implements the specified
++     * <code>Transform algorithm</code> URI.
++     *
++     * @param algorithmURI <code>Transform algorithm</code> URI representation,
++     * such as specified in
++     * <a href=http://www.w3.org/TR/xmldsig-core/#sec-TransformAlg>Transform algorithm </a>
++     * @param doc the proxy {@link Document}
++     * @return <code>{@link Transform}</code> object
++     * @throws InvalidTransformException
++     */
++    public static Transform getInstance(
++        Document doc, String algorithmURI) throws InvalidTransformException {
++        return getInstance(doc, algorithmURI, (NodeList) null);
++    }
+ 
+-      super(element, BaseURI);
++    /**
++     * Generates a Transform object that implements the specified
++     * <code>Transform algorithm</code> URI.
++     *
++     * @param algorithmURI <code>Transform algorithm</code> URI representation,
++     * such as specified in
++     * <a href=http://www.w3.org/TR/xmldsig-core/#sec-TransformAlg>Transform algorithm </a>
++     * @param contextChild the child element of <code>Transform</code> element
++     * @param doc the proxy {@link Document}
++     * @return <code>{@link Transform}</code> object
++     * @throws InvalidTransformException
++     */
++    public static Transform getInstance(
++        Document doc, String algorithmURI, Element contextChild)
++        throws InvalidTransformException {
+ 
+-      // retrieve Algorithm Attribute from ds:Transform
+-      String AlgorithmURI = element.getAttributeNS(null, Constants._ATT_ALGORITHM);
++        HelperNodeList contextNodes = new HelperNodeList();
+ 
+-      if ((AlgorithmURI == null) || (AlgorithmURI.length() == 0)) {
+-         Object exArgs[] = { Constants._ATT_ALGORITHM,
+-                             Constants._TAG_TRANSFORM };
++        XMLUtils.addReturnToElement(doc, contextNodes);
++        contextNodes.appendChild(contextChild);
++        XMLUtils.addReturnToElement(doc, contextNodes);
+ 
+-         throw new TransformationException("xml.WrongContent", exArgs);
+-      }
++        return getInstance(doc, algorithmURI, contextNodes);
++    }
+ 
+-      try {
+-         Class implementingClass = (Class) _transformHash.get(AlgorithmURI);
+-         this.transformSpi =
+-            (TransformSpi) implementingClass.newInstance();
++    /**
++     * Generates a Transform object that implements the specified
++     * <code>Transform algorithm</code> URI.
++     *
++     * @param algorithmURI <code>Transform algorithm</code> URI form, such as
++     * specified in <a href=http://www.w3.org/TR/xmldsig-core/#sec-TransformAlg>
++     * Transform algorithm </a>
++     * @param contextNodes the child node list of <code>Transform</code> element
++     * @param doc the proxy {@link Document}
++     * @return <code>{@link Transform}</code> object
++     * @throws InvalidTransformException
++     */
++    public static Transform getInstance(
++        Document doc, String algorithmURI, NodeList contextNodes)
++        throws InvalidTransformException {
++        return new Transform(doc, algorithmURI, contextNodes);
++    }
+ 
+-         this.transformSpi.setTransform(this);
+-      } catch (IllegalAccessException e) {
+-         Object exArgs[] = { AlgorithmURI };
++    /**
++     * Initalizes for this {@link Transform}.
++     */
++    public static void init() {
++        if (!alreadyInitialized) {
++            transformClassHash = new HashMap(10);
++            // make sure builtin algorithms are all registered first
++            com.sun.org.apache.xml.internal.security.Init.init();
++            alreadyInitialized = true;
++        }
++    }
+ 
+-         throw new InvalidTransformException(
+-            "signature.Transform.UnknownTransform", exArgs);
+-      } catch (InstantiationException e) {
+-         Object exArgs[] = { AlgorithmURI };
++    /**
++     * Registers implementing class of the Transform algorithm with algorithmURI
++     *
++     * @param algorithmURI algorithmURI URI representation of
++     * <code>Transform algorithm</code> will be specified as parameter of
++     * {@link #getInstance(Document, String)}, when generate. </br>
++     * @param implementingClass <code>implementingClass</code> the implementing
++     * class of {@link TransformSpi}
++     * @throws AlgorithmAlreadyRegisteredException if specified algorithmURI
++     * is already registered
++     */
++    public static void register(String algorithmURI, String implementingClass)
++        throws AlgorithmAlreadyRegisteredException {
+ 
+-         throw new InvalidTransformException(
+-            "signature.Transform.UnknownTransform", exArgs);
+-      } catch (NullPointerException e) {
+-                  Object exArgs[] = { AlgorithmURI };
+-
+-                 throw new InvalidTransformException(
+-                    "signature.Transform.UnknownTransform", exArgs);
+-        }
+-   }
+-
+-   /**
+-    * Generates a Transform object that implements the specified <code>Transform algorithm</code> URI.
+-    *
+-    * @param algorithmURI <code>Transform algorithm</code> URI representation, such as specified in <a href=http://www.w3.org/TR/xmldsig-core/#sec-TransformAlg>Transform algorithm </a>
+-    * @param doc the proxy {@link Document}
+-    * @return <code>{@link Transform}</code> object
+-    * @throws InvalidTransformException
+-    */
+-   public static final Transform getInstance(
+-           Document doc, String algorithmURI) throws InvalidTransformException {
+-      return Transform.getInstance(doc, algorithmURI, (NodeList) null);
+-   }
+-
+-   /**
+-    * Generates a Transform object that implements the specified <code>Transform algorithm</code> URI.
+-    *
+-    * @param algorithmURI <code>Transform algorithm</code> URI representation, such as specified in <a href=http://www.w3.org/TR/xmldsig-core/#sec-TransformAlg>Transform algorithm </a>
+-    * @param contextChild the child element of <code>Transform</code> element
+-    * @param doc the proxy {@link Document}
+-    * @return <code>{@link Transform}</code> object
+-    * @throws InvalidTransformException
+-    */
+-   public static final Transform getInstance(
+-           Document doc, String algorithmURI, Element contextChild)
+-              throws InvalidTransformException {
+-
+-      HelperNodeList contextNodes = new HelperNodeList();
+-
+-      contextNodes.appendChild(doc.createTextNode("\n"));
+-      contextNodes.appendChild(contextChild);
+-      contextNodes.appendChild(doc.createTextNode("\n"));
+-
+-      return Transform.getInstance(doc, algorithmURI, contextNodes);
+-   }
+-
+-   /**
+-    * Generates a Transform object that implements the specified <code>Transform algorithm</code> URI.
+-    *
+-    * @param algorithmURI <code>Transform algorithm</code> URI form, such as specified in <a href=http://www.w3.org/TR/xmldsig-core/#sec-TransformAlg>Transform algorithm </a>
+-    * @param contextNodes the child node list of <code>Transform</code> element
+-    * @param doc the proxy {@link Document}
+-    * @return <code>{@link Transform}</code> object
+-    * @throws InvalidTransformException
+-    */
+-   public static final Transform getInstance(
+-           Document doc, String algorithmURI, NodeList contextNodes)
+-              throws InvalidTransformException {
+-      return new Transform(doc, algorithmURI, contextNodes);
+-   }
+-
+-   /**
+-    * Initalizes for this {@link Transform}
+-    *
+-    */
+-   public static void init() {
+-
+-      if (!_alreadyInitialized) {
+-         _transformHash = new HashMap(10);
+-         // make sure builtin algorithms are all registered first
+-         com.sun.org.apache.xml.internal.security.Init.init();
+-         _alreadyInitialized = true;
+-      }
+-   }
+-
+-   /**
+-    * Registers implementing class of the Transform algorithm with algorithmURI
+-    *
+-    * @param algorithmURI algorithmURI URI representation of <code>Transform algorithm</code>
+-    *  will be specified as parameter of {@link #getInstance(Document, String)}, when generate. </br>
+-    * @param implementingClass <code>implementingClass</code> the implementing class of {@link TransformSpi}
+-    * @throws AlgorithmAlreadyRegisteredException if specified algorithmURI is already registered
+-    */
+-   public static void register(String algorithmURI, String implementingClass)
+-           throws AlgorithmAlreadyRegisteredException {
+-
+-      {
+-
+-         // are we already registered?
+-         Class registeredClass = Transform.getImplementingClass(algorithmURI);
+-
+-         if ((registeredClass != null) ) {
++        // are we already registered?
++        Class registeredClass = getImplementingClass(algorithmURI);
++        if ((registeredClass != null) ) {
+             Object exArgs[] = { algorithmURI, registeredClass };
+-
+             throw new AlgorithmAlreadyRegisteredException(
+                "algorithm.alreadyRegistered", exArgs);
+-         }
++        }
+ 
+-         ClassLoader cl = Thread.currentThread().getContextClassLoader();
++        ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ 
+-         try {
+-             Transform._transformHash.put
+-                 (algorithmURI, Class.forName(implementingClass, true, cl));
+-         } catch (ClassNotFoundException e) {
+-             throw new RuntimeException(e);
+-         }
+-      }
+-   }
++        try {
++            transformClassHash.put
++                (algorithmURI, Class.forName(implementingClass, true, cl));
++        } catch (ClassNotFoundException e) {
++            throw new RuntimeException(e);
++        }
++    }
+ 
+-   /**
+-    * Returns the URI representation of Transformation algorithm
+-    *
+-    * @return the URI representation of Transformation algorithm
+-    */
+-   public final String getURI() {
+-      return this._constructionElement.getAttributeNS(null, Constants._ATT_ALGORITHM);
+-   }
++    /**
++     * Returns the URI representation of Transformation algorithm
++     *
++     * @return the URI representation of Transformation algorithm
++     */
++    public String getURI() {
++        return this._constructionElement.getAttributeNS
++            (null, Constants._ATT_ALGORITHM);
++    }
+ 
+-   /**
+-    * Transforms the input, and generats {@link XMLSignatureInput} as output.
+-    * @param input input {@link XMLSignatureInput} which can supplied Octect Stream and NodeSet as Input of Transformation
+-    *
+-    * @return the {@link XMLSignatureInput} class as the result of transformation
+-    * @throws CanonicalizationException
+-    * @throws IOException
+-    * @throws InvalidCanonicalizerException
+-    * @throws TransformationException
+-    */
+-   public XMLSignatureInput performTransform(XMLSignatureInput input)
+-           throws IOException, CanonicalizationException,
+-                  InvalidCanonicalizerException, TransformationException {
++    /**
++     * Transforms the input, and generates {@link XMLSignatureInput} as output.
++     *
++     * @param input input {@link XMLSignatureInput} which can supplied Octet
++     * Stream and NodeSet as Input of Transformation
++     * @return the {@link XMLSignatureInput} class as the result of
++     * transformation
++     * @throws CanonicalizationException
++     * @throws IOException
++     * @throws InvalidCanonicalizerException
++     * @throws TransformationException
++     */
++    public XMLSignatureInput performTransform(XMLSignatureInput input)
++         throws IOException, CanonicalizationException,
++                InvalidCanonicalizerException, TransformationException {
+ 
+-      XMLSignatureInput result = null;
++        XMLSignatureInput result = null;
+ 
+-      try {
+-         result = transformSpi.enginePerformTransform(input);
+-      } catch (ParserConfigurationException ex) {
+-         Object exArgs[] = { this.getURI(), "ParserConfigurationException" };
++        try {
++            result = transformSpi.enginePerformTransform(input, this);
++        } catch (ParserConfigurationException ex) {
++            Object exArgs[] = { this.getURI(), "ParserConfigurationException" };
++            throw new CanonicalizationException(
++                "signature.Transform.ErrorDuringTransform", exArgs, ex);
++        } catch (SAXException ex) {
++            Object exArgs[] = { this.getURI(), "SAXException" };
++            throw new CanonicalizationException(
++                "signature.Transform.ErrorDuringTransform", exArgs, ex);
++        }
+ 
+-         throw new CanonicalizationException(
+-            "signature.Transform.ErrorDuringTransform", exArgs, ex);
+-      } catch (SAXException ex) {
+-         Object exArgs[] = { this.getURI(), "SAXException" };
++        return result;
++    }
+ 
+-         throw new CanonicalizationException(
+-            "signature.Transform.ErrorDuringTransform", exArgs, ex);
+-      }
++    /**
++     * Transforms the input, and generates {@link XMLSignatureInput} as output.
++     *
++     * @param input input {@link XMLSignatureInput} which can supplied Octet
++     * Stream and NodeSet as Input of Transformation
++     * @param os where to output the result of the last transformation
++     * @return the {@link XMLSignatureInput} class as the result of
++     * transformation
++     * @throws CanonicalizationException
++     * @throws IOException
++     * @throws InvalidCanonicalizerException
++     * @throws TransformationException
++     */
++    public XMLSignatureInput performTransform(XMLSignatureInput input,
++        OutputStream os) throws IOException, CanonicalizationException,
++        InvalidCanonicalizerException, TransformationException {
+ 
+-      return result;
+-   }
++        XMLSignatureInput result = null;
+ 
+-   /**
+-    * Transforms the input, and generats {@link XMLSignatureInput} as output.
+-    * @param input input {@link XMLSignatureInput} which can supplied Octect Stream and NodeSet as Input of Transformation
+-    * @param os where to output the result of the last transformation
+-    *
+-    * @return the {@link XMLSignatureInput} class as the result of transformation
+-    * @throws CanonicalizationException
+-    * @throws IOException
+-    * @throws InvalidCanonicalizerException
+-    * @throws TransformationException
+-    */
+-   public XMLSignatureInput performTransform(XMLSignatureInput input, OutputStream os)
+-   throws IOException, CanonicalizationException,
+-          InvalidCanonicalizerException, TransformationException {
++        try {
++            result = transformSpi.enginePerformTransform(input, os, this);
++        } catch (ParserConfigurationException ex) {
++            Object exArgs[] = { this.getURI(), "ParserConfigurationException" };
++            throw new CanonicalizationException(
++                "signature.Transform.ErrorDuringTransform", exArgs, ex);
++        } catch (SAXException ex) {
++            Object exArgs[] = { this.getURI(), "SAXException" };
++            throw new CanonicalizationException(
++                "signature.Transform.ErrorDuringTransform", exArgs, ex);
++        }
+ 
+-            XMLSignatureInput result = null;
++        return result;
++    }
+ 
+-            try {
+-                result = transformSpi.enginePerformTransform(input,os);
+-            } catch (ParserConfigurationException ex) {
+-                Object exArgs[] = { this.getURI(), "ParserConfigurationException" };
++    /**
++     * Method getImplementingClass
++     *
++     * @param URI
++     * @return The name of the class implementing the URI.
++     */
++    private static Class getImplementingClass(String URI) {
++        return (Class) transformClassHash.get(URI);
++    }
+ 
+-                throw new CanonicalizationException(
+-                                "signature.Transform.ErrorDuringTransform", exArgs, ex);
+-            } catch (SAXException ex) {
+-                Object exArgs[] = { this.getURI(), "SAXException" };
++    private static TransformSpi getTransformSpi(String URI)
++        throws InvalidTransformException {
++        try {
++            Object value = transformSpiHash.get(URI);
++            if (value != null) {
++                return (TransformSpi) value;
++            }
++            Class cl = (Class) transformClassHash.get(URI);
++            if (cl != null) {
++                TransformSpi tr = (TransformSpi) cl.newInstance();
++                transformSpiHash.put(URI, tr);
++                return tr;
++            }
++        } catch (InstantiationException ex) {
++            Object exArgs[] = { URI };
++            throw new InvalidTransformException(
++                "signature.Transform.UnknownTransform", exArgs, ex);
++        } catch (IllegalAccessException ex) {
++            Object exArgs[] = { URI };
++            throw new InvalidTransformException(
++                "signature.Transform.UnknownTransform", exArgs, ex);
++        }
++        return null;
++    }
+ 
+-                throw new CanonicalizationException(
+-                                "signature.Transform.ErrorDuringTransform", exArgs, ex);
+-            }
+-
+-            return result;
+-   }
+-
+-   /**
+-    * Method getImplementingClass
+-    *
+-    * @param URI
+-    * @return The name of the class implementing the URI.
+-    */
+-   private static Class getImplementingClass(String URI) {
+-       return (Class)Transform._transformHash.get(URI);
+-   }
+-
+-
+-   /** @inheritDoc */
+-   public String getBaseLocalName() {
+-      return Constants._TAG_TRANSFORM;
+-   }
++    /** @inheritDoc */
++    public String getBaseLocalName() {
++        return Constants._TAG_TRANSFORM;
++    }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/TransformParam.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/TransformParam.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/TransformParam.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/TransformParam.java
+@@ -23,7 +23,7 @@
+ 
+ /**
+  *
+- * @author $Author: blautenb $
++ * @author $Author: mullan $
+  */
+ 
+ public interface TransformParam {
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/TransformSpi.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/TransformSpi.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/TransformSpi.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/TransformSpi.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -21,11 +20,8 @@
+  */
+ package com.sun.org.apache.xml.internal.security.transforms;
+ 
+-
+-
+ import java.io.IOException;
+ import java.io.OutputStream;
+-
+ import javax.xml.parsers.ParserConfigurationException;
+ 
+ import com.sun.org.apache.xml.internal.security.c14n.CanonicalizationException;
+@@ -33,68 +29,109 @@
+ import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
+ import org.xml.sax.SAXException;
+ 
+-
+ /**
+  * Base class which all Transform algorithms extend. The common methods that
+- * have to be overridden are the {@link #enginePerformTransform(XMLSignatureInput)} method.
++ * have to be overridden are the
++ * {@link #enginePerformTransform(XMLSignatureInput, Transform)} method.
+  *
+  * @author Christian Geuer-Pollmann
+  */
+ public abstract class TransformSpi {
++    /**
++     * For API compatibility not thread safe.
++     * @deprecated
++     */
++    protected Transform _transformObject = null;
++    /**
++     * Set the transform object.
++     * Depeprecated For API compatibility.
++     * @param transform the Transform
++     * @deprecated
++     */
++    protected void setTransform(Transform transform) {
++        this._transformObject = transform;
++    }
++    /**
++     * The mega method which MUST be implemented by the Transformation Algorithm.
++     *
++     * @param input {@link XMLSignatureInput} as the input of transformation
++     * @param os where to output this transformation.
++     * @param _transformObject the Transform
++     * @return {@link XMLSignatureInput} as the result of transformation
++     * @throws CanonicalizationException
++     * @throws IOException
++     * @throws InvalidCanonicalizerException
++     * @throws ParserConfigurationException
++     * @throws SAXException
++     * @throws TransformationException
++     */
++    protected XMLSignatureInput enginePerformTransform(
++        XMLSignatureInput input, OutputStream os, Transform _transformObject)
++        throws IOException,
++               CanonicalizationException, InvalidCanonicalizerException,
++               TransformationException, ParserConfigurationException,
++               SAXException {
++        return enginePerformTransform(input, _transformObject);
++    }
++    /**
++     * The mega method which MUST be implemented by the Transformation Algorithm.
++     * In order to be compatible with preexisting Transform implementations,
++     * by default this implementation invokes the deprecated, thread-unsafe
++     * methods. Subclasses should override this with a thread-safe
++     * implementation.
++     *
++     * @param input {@link XMLSignatureInput} as the input of transformation
++     * @param _transformObject the Transform
++     * @return {@link XMLSignatureInput} as the result of transformation
++     * @throws CanonicalizationException
++     * @throws IOException
++     * @throws InvalidCanonicalizerException
++     * @throws ParserConfigurationException
++     * @throws SAXException
++     * @throws TransformationException
++     */
++    protected XMLSignatureInput enginePerformTransform(
++        XMLSignatureInput input, Transform _transformObject)
++        throws IOException,
++               CanonicalizationException, InvalidCanonicalizerException,
++               TransformationException, ParserConfigurationException,
++               SAXException {
++        //Default implementation overide with a much better
++        try {
++                TransformSpi tmp = (TransformSpi) getClass().newInstance();
++            tmp.setTransform(_transformObject);
++            return tmp.enginePerformTransform(input);
++        } catch (InstantiationException e) {
++            throw new TransformationException("",e);
++        } catch (IllegalAccessException e) {
++            throw new TransformationException("",e);
++        }
++    }
+ 
+-   /** {@link java.util.logging} logging facility */
+-    static java.util.logging.Logger log =
+-        java.util.logging.Logger.getLogger(TransformSpi.class.getName());
+-
+-   protected Transform _transformObject = null;
+-   protected void setTransform(Transform transform) {
+-      this._transformObject = transform;
+-   }
+-
+-   /**
+-    * The mega method which MUST be implemented by the Transformation Algorithm.
+-    *
+-    * @param input {@link XMLSignatureInput} as the input of transformation
+-    * @param os where to output this transformation.
+-    * @return {@link XMLSignatureInput} as the result of transformation
+-    * @throws CanonicalizationException
+-    * @throws IOException
+-    * @throws InvalidCanonicalizerException
+-    * @throws ParserConfigurationException
+-    * @throws SAXException
+-    * @throws TransformationException
+-    */
+-   protected XMLSignatureInput enginePerformTransform(
+-      XMLSignatureInput input, OutputStream os)
+-         throws IOException,
+-                CanonicalizationException, InvalidCanonicalizerException,
+-                TransformationException, ParserConfigurationException,
+-                SAXException {
+-            return enginePerformTransform(input);
+-   }
+-   /**
+-    * The mega method which MUST be implemented by the Transformation Algorithm.
+-    *
+-    * @param input {@link XMLSignatureInput} as the input of transformation
+-    * @return {@link XMLSignatureInput} as the result of transformation
+-    * @throws CanonicalizationException
+-    * @throws IOException
+-    * @throws InvalidCanonicalizerException
+-    * @throws ParserConfigurationException
+-    * @throws SAXException
+-    * @throws TransformationException
+-    */
+-   protected abstract XMLSignatureInput enginePerformTransform(
+-      XMLSignatureInput input)
+-         throws IOException,
+-                CanonicalizationException, InvalidCanonicalizerException,
+-                TransformationException, ParserConfigurationException,
+-                SAXException;
+-
+-   /**
+-    * Returns the URI representation of <code>Transformation algorithm</code>
+-    *
+-    * @return the URI representation of <code>Transformation algorithm</code>
+-    */
+-   protected abstract String engineGetURI();
++    /**
++     * The mega method which MUST be implemented by the Transformation Algorithm.
++     * @deprecated
++     * @param input {@link XMLSignatureInput} as the input of transformation
++     * @return {@link XMLSignatureInput} as the result of transformation
++     * @throws CanonicalizationException
++     * @throws IOException
++     * @throws InvalidCanonicalizerException
++     * @throws ParserConfigurationException
++     * @throws SAXException
++     * @throws TransformationException
++     */
++    protected XMLSignatureInput enginePerformTransform(
++        XMLSignatureInput input)
++        throws IOException,
++               CanonicalizationException, InvalidCanonicalizerException,
++               TransformationException, ParserConfigurationException,
++               SAXException {
++        throw new UnsupportedOperationException();
++    }
++    /**
++     * Returns the URI representation of <code>Transformation algorithm</code>
++     *
++     * @return the URI representation of <code>Transformation algorithm</code>
++     */
++    protected abstract String engineGetURI();
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/TransformationException.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/TransformationException.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/TransformationException.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/TransformationException.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/Transforms.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/Transforms.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/Transforms.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/Transforms.java
+@@ -3,7 +3,7 @@
+  * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * Copyright  1999-2004 The Apache Software Foundation.
++ * Copyright  1999-2008 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.
+@@ -20,8 +20,6 @@
+  */
+ package com.sun.org.apache.xml.internal.security.transforms;
+ 
+-
+-
+ import java.io.IOException;
+ import java.io.OutputStream;
+ 
+@@ -39,11 +37,13 @@
+ import org.w3c.dom.Element;
+ import org.w3c.dom.NodeList;
+ 
+-
+ /**
+- * Holder of the {@link com.sun.org.apache.xml.internal.security.transforms.Transform} steps to be performed on the data.
+- * The input to the first Transform is the result of dereferencing the <code>URI</code> attribute of the <code>Reference</code> element.
+- * The output from the last Transform is the input for the <code>DigestMethod algorithm</code>
++ * Holder of the {@link com.sun.org.apache.xml.internal.security.transforms.Transform} steps to
++ * be performed on the data.
++ * The input to the first Transform is the result of dereferencing the
++ * <code>URI</code> attribute of the <code>Reference</code> element.
++ * The output from the last Transform is the input for the
++ * <code>DigestMethod algorithm</code>
+  *
+  * @author Christian Geuer-Pollmann
+  * @see Transform
+@@ -51,252 +51,273 @@
+  */
+ public class Transforms extends SignatureElementProxy {
+ 
+-   /** {@link java.util.logging} logging facility */
++    /** {@link java.util.logging} logging facility */
+     static java.util.logging.Logger log =
+         java.util.logging.Logger.getLogger(Transforms.class.getName());
+-   //J-
+-   /** Canonicalization - Required Canonical XML (omits comments) */
+-   public static final String TRANSFORM_C14N_OMIT_COMMENTS = Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS;
+-   /** Canonicalization - Recommended Canonical XML with Comments */
+-   public static final String TRANSFORM_C14N_WITH_COMMENTS = Canonicalizer.ALGO_ID_C14N_WITH_COMMENTS;
+-   /** Canonicalization - Required Exclusive Canonicalization (omits comments) */
+-   public static final String TRANSFORM_C14N_EXCL_OMIT_COMMENTS = Canonicalizer.ALGO_ID_C14N_EXCL_OMIT_COMMENTS;
+-   /** Canonicalization - Recommended Exclusive Canonicalization with Comments */
+-   public static final String TRANSFORM_C14N_EXCL_WITH_COMMENTS = Canonicalizer.ALGO_ID_C14N_EXCL_WITH_COMMENTS;
+-   /** Transform - Optional XSLT */
+-   public static final String TRANSFORM_XSLT = "http://www.w3.org/TR/1999/REC-xslt-19991116";
+-   /** Transform - Required base64 decoding */
+-   public static final String TRANSFORM_BASE64_DECODE = Constants.SignatureSpecNS + "base64";
+-   /** Transform - Recommended XPath */
+-   public static final String TRANSFORM_XPATH = "http://www.w3.org/TR/1999/REC-xpath-19991116";
+-   /** Transform - Required Enveloped Signature */
+-   public static final String TRANSFORM_ENVELOPED_SIGNATURE = Constants.SignatureSpecNS + "enveloped-signature";
+-   /** Transform - XPointer */
+-   public static final String TRANSFORM_XPOINTER = "http://www.w3.org/TR/2001/WD-xptr-20010108";
+-   /** Transform - XPath Filter v2.0 */
+-   public static final String TRANSFORM_XPATH2FILTER04 = "http://www.w3.org/2002/04/xmldsig-filter2";
+-   /** Transform - XPath Filter */
+-   public static final String TRANSFORM_XPATH2FILTER = "http://www.w3.org/2002/06/xmldsig-filter2";
+-   /** Transform - XPath Filter  CHGP private*/
+-   public static final String TRANSFORM_XPATHFILTERCHGP = "http://www.nue.et-inf.uni-siegen.de/~geuer-pollmann/#xpathFilter";
+-   //J+
+-   Element []transforms;
+-   /**
+-    * Consturcts {@link Transforms}
+-    *
+-    * @param doc the {@link Document} in which <code>XMLsignature</code> will be placed
+-    */
+-   public Transforms(Document doc) {
++    /** Canonicalization - Required Canonical XML (omits comments) */
++    public static final String TRANSFORM_C14N_OMIT_COMMENTS
++        = Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS;
++    /** Canonicalization - Recommended Canonical XML with Comments */
++    public static final String TRANSFORM_C14N_WITH_COMMENTS
++        = Canonicalizer.ALGO_ID_C14N_WITH_COMMENTS;
++    /** Canonicalization - Required Canonical XML 1.1 (omits comments) */
++    public static final String TRANSFORM_C14N11_OMIT_COMMENTS
++        = Canonicalizer.ALGO_ID_C14N11_OMIT_COMMENTS;
++    /** Canonicalization - Recommended Canonical XML 1.1 with Comments */
++    public static final String TRANSFORM_C14N11_WITH_COMMENTS
++        = Canonicalizer.ALGO_ID_C14N11_WITH_COMMENTS;
++    /** Canonicalization - Required Exclusive Canonicalization (omits comments) */
++    public static final String TRANSFORM_C14N_EXCL_OMIT_COMMENTS
++        = Canonicalizer.ALGO_ID_C14N_EXCL_OMIT_COMMENTS;
++    /** Canonicalization - Recommended Exclusive Canonicalization with Comments */
++    public static final String TRANSFORM_C14N_EXCL_WITH_COMMENTS
++        = Canonicalizer.ALGO_ID_C14N_EXCL_WITH_COMMENTS;
++    /** Transform - Optional XSLT */
++    public static final String TRANSFORM_XSLT
++        = "http://www.w3.org/TR/1999/REC-xslt-19991116";
++    /** Transform - Required base64 decoding */
++    public static final String TRANSFORM_BASE64_DECODE
++        = Constants.SignatureSpecNS + "base64";
++    /** Transform - Recommended XPath */
++    public static final String TRANSFORM_XPATH
++        = "http://www.w3.org/TR/1999/REC-xpath-19991116";
++    /** Transform - Required Enveloped Signature */
++    public static final String TRANSFORM_ENVELOPED_SIGNATURE
++        = Constants.SignatureSpecNS + "enveloped-signature";
++    /** Transform - XPointer */
++    public static final String TRANSFORM_XPOINTER
++        = "http://www.w3.org/TR/2001/WD-xptr-20010108";
++    /** Transform - XPath Filter v2.0 */
++    public static final String TRANSFORM_XPATH2FILTER04
++        = "http://www.w3.org/2002/04/xmldsig-filter2";
++    /** Transform - XPath Filter */
++    public static final String TRANSFORM_XPATH2FILTER
++        = "http://www.w3.org/2002/06/xmldsig-filter2";
++    /** Transform - XPath Filter  CHGP private */
++    public static final String TRANSFORM_XPATHFILTERCHGP
++        = "http://www.nue.et-inf.uni-siegen.de/~geuer-pollmann/#xpathFilter";
+ 
+-      super(doc);
++    Element []transforms;
+ 
+-      XMLUtils.addReturnToElement(this._constructionElement);
+-   }
++    protected Transforms() { };
+ 
+-   /**
+-    * Consturcts {@link Transforms} from {@link Element} which is <code>Transforms</code> Element
+-    *
+-    * @param element  is <code>Transforms</code> element
+-    * @param BaseURI the URI where the XML instance was stored
+-    * @throws DOMException
+-    * @throws InvalidTransformException
+-    * @throws TransformationException
+-    * @throws XMLSecurityException
+-    * @throws XMLSignatureException
+-    */
+-   public Transforms(Element element, String BaseURI)
++    /**
++     * Constructs {@link Transforms}.
++     *
++     * @param doc the {@link Document} in which <code>XMLSignature</code> will
++     * be placed
++     */
++    public Transforms(Document doc) {
++        super(doc);
++        XMLUtils.addReturnToElement(this._constructionElement);
++    }
++
++    /**
++     * Constructs {@link Transforms} from {@link Element} which is
++     * <code>Transforms</code> Element
++     *
++     * @param element  is <code>Transforms</code> element
++     * @param BaseURI the URI where the XML instance was stored
++     * @throws DOMException
++     * @throws InvalidTransformException
++     * @throws TransformationException
++     * @throws XMLSecurityException
++     * @throws XMLSignatureException
++     */
++    public Transforms(Element element, String BaseURI)
+            throws DOMException, XMLSignatureException,
+                   InvalidTransformException, TransformationException,
+                   XMLSecurityException {
+ 
+-      super(element, BaseURI);
++        super(element, BaseURI);
+ 
+-      int numberOfTransformElems = this.getLength();
++        int numberOfTransformElems = this.getLength();
+ 
+-      if (numberOfTransformElems == 0) {
++        if (numberOfTransformElems == 0) {
+ 
+-         // At least ont Transform element must be present. Bad.
+-         Object exArgs[] = { Constants._TAG_TRANSFORM,
+-                             Constants._TAG_TRANSFORMS };
++            // At least one Transform element must be present. Bad.
++            Object exArgs[] = { Constants._TAG_TRANSFORM,
++                                Constants._TAG_TRANSFORMS };
+ 
+-         throw new TransformationException("xml.WrongContent", exArgs);
+-      }
+-   }
++            throw new TransformationException("xml.WrongContent", exArgs);
++        }
++    }
+ 
+-   /**
+-    * Adds the <code>Transform</code> with the specified <code>Transform algorithm URI</code>
+-    *
+-    * @param transformURI the URI form of transform that indicates which transformation is applied to data
+-    * @throws TransformationException
+-    */
+-   public void addTransform(String transformURI)
++    /**
++     * Adds the <code>Transform</code> with the specified <code>Transform
++     * algorithm URI</code>
++     *
++     * @param transformURI the URI form of transform that indicates which
++     * transformation is applied to data
++     * @throws TransformationException
++     */
++    public void addTransform(String transformURI)
+            throws TransformationException {
+ 
+-      try {
+-         if (true)
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Transforms.addTransform(" + transformURI + ")");
++        try {
++            if (log.isLoggable(java.util.logging.Level.FINE))
++                log.log(java.util.logging.Level.FINE, "Transforms.addTransform(" + transformURI + ")");
+ 
+-         Transform transform = Transform.getInstance(this._doc, transformURI);
++            Transform transform =
++                Transform.getInstance(this._doc, transformURI);
+ 
+-         this.addTransform(transform);
+-      } catch (InvalidTransformException ex) {
+-         throw new TransformationException("empty", ex);
+-      }
+-   }
++            this.addTransform(transform);
++        } catch (InvalidTransformException ex) {
++            throw new TransformationException("empty", ex);
++        }
++    }
+ 
+-   /**
+-    * Adds the <code>Transform</code> with the specified <code>Transform algorithm URI</code>
+-    *
+-    * @param transformURI the URI form of transform that indicates which transformation is applied to data
+-    * @param contextElement
+-    * @throws TransformationException
+-    * @see Transform#getInstance(Document doc, String algorithmURI, Element childElement)
+-    */
+-   public void addTransform(String transformURI, Element contextElement)
++    /**
++     * Adds the <code>Transform</code> with the specified <code>Transform
++     * algorithm URI</code>
++     *
++     * @param transformURI the URI form of transform that indicates which
++     * transformation is applied to data
++     * @param contextElement
++     * @throws TransformationException
++     * @see Transform#getInstance(Document doc, String algorithmURI, Element childElement)
++     */
++    public void addTransform(String transformURI, Element contextElement)
+            throws TransformationException {
+ 
+-      try {
+-         if (true)
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Transforms.addTransform(" + transformURI + ")");
++        try {
++            if (log.isLoggable(java.util.logging.Level.FINE))
++                log.log(java.util.logging.Level.FINE, "Transforms.addTransform(" + transformURI + ")");
+ 
+-         Transform transform = Transform.getInstance(this._doc, transformURI,
+-                                                     contextElement);
++            Transform transform =
++                Transform.getInstance(this._doc, transformURI, contextElement);
+ 
+-         this.addTransform(transform);
+-      } catch (InvalidTransformException ex) {
+-         throw new TransformationException("empty", ex);
+-      }
+-   }
++            this.addTransform(transform);
++        } catch (InvalidTransformException ex) {
++            throw new TransformationException("empty", ex);
++        }
++    }
+ 
+-   /**
+-    * Adds the <code>Transform</code> with the specified <code>Transform algorithm URI</code>
+-    *
+-    * @param transformURI the URI form of transform that indicates which transformation is applied to data
+-    * @param contextNodes
+-    * @throws TransformationException
+-    * @see Transform#getInstance(Document doc, String algorithmURI, NodeList contextNodes)
+-    */
+-   public void addTransform(String transformURI, NodeList contextNodes)
++    /**
++     * Adds the <code>Transform</code> with the specified <code>Transform
++     * algorithm URI</code>.
++     *
++     * @param transformURI the URI form of transform that indicates which
++     * transformation is applied to data
++     * @param contextNodes
++     * @throws TransformationException
++     * @see Transform#getInstance(Document doc, String algorithmURI, NodeList contextNodes)
++     */
++    public void addTransform(String transformURI, NodeList contextNodes)
+            throws TransformationException {
+ 
+-      try {
+-         Transform transform = Transform.getInstance(this._doc, transformURI,
+-                                                     contextNodes);
++        try {
++            Transform transform =
++                Transform.getInstance(this._doc, transformURI, contextNodes);
++            this.addTransform(transform);
++        } catch (InvalidTransformException ex) {
++            throw new TransformationException("empty", ex);
++        }
++    }
+ 
+-         this.addTransform(transform);
+-      } catch (InvalidTransformException ex) {
+-         throw new TransformationException("empty", ex);
+-      }
+-   }
++    /**
++     * Adds a user-provided Transform step.
++     *
++     * @param transform {@link Transform} object
++     */
++    private void addTransform(Transform transform) {
++        if (log.isLoggable(java.util.logging.Level.FINE))
++            log.log(java.util.logging.Level.FINE, "Transforms.addTransform(" + transform.getURI() + ")");
+ 
+-   /**
+-    * Adds a user-provided Transform step.
+-    *
+-    * @param transform {@link Transform} object
+-    */
+-   private void addTransform(Transform transform) {
+-      if (true)
+-        if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Transforms.addTransform(" + transform.getURI() + ")");
++        Element transformElement = transform.getElement();
+ 
+-      Element transformElement = transform.getElement();
++        this._constructionElement.appendChild(transformElement);
++        XMLUtils.addReturnToElement(this._constructionElement);
++    }
+ 
+-      this._constructionElement.appendChild(transformElement);
+-      XMLUtils.addReturnToElement(this._constructionElement);
+-   }
++    /**
++     * Applies all included <code>Transform</code>s to xmlSignatureInput and
++     * returns the result of these transformations.
++     *
++     * @param xmlSignatureInput the input for the <code>Transform</code>s
++     * @return the result of the <code>Transforms</code>
++     * @throws TransformationException
++     */
++    public XMLSignatureInput performTransforms(
++        XMLSignatureInput xmlSignatureInput) throws TransformationException {
++        return performTransforms(xmlSignatureInput, null);
++    }
+ 
+-   /**
+-    * Applies all included <code>Transform</code>s to xmlSignatureInput and returns the result of these transformations.
+-    *
+-    * @param xmlSignatureInput the input for the <code>Transform</code>s
+-    * @return the result of the <code>Transforms</code>
+-    * @throws TransformationException
+-    */
+-   public XMLSignatureInput performTransforms(
+-           XMLSignatureInput xmlSignatureInput) throws TransformationException {
+-             return performTransforms(xmlSignatureInput,null);
+-   }
++    /**
++     * Applies all included <code>Transform</code>s to xmlSignatureInput and
++     * returns the result of these transformations.
++     *
++     * @param xmlSignatureInput the input for the <code>Transform</code>s
++     * @param os where to output the last transformation.
++     * @return the result of the <code>Transforms</code>
++     * @throws TransformationException
++     */
++    public XMLSignatureInput performTransforms(
++        XMLSignatureInput xmlSignatureInput, OutputStream os)
++        throws TransformationException {
+ 
+-   /**
+-    * Applies all included <code>Transform</code>s to xmlSignatureInput and returns the result of these transformations.
+-    *
+-    * @param xmlSignatureInput the input for the <code>Transform</code>s
+-    * @param os where to output the last transformation.
+-    * @return the result of the <code>Transforms</code>
+-    * @throws TransformationException
+-    */
+-    public XMLSignatureInput performTransforms(
+-            XMLSignatureInput xmlSignatureInput,OutputStream os) throws TransformationException {
++        try {
++            int last=this.getLength()-1;
++            for (int i = 0; i < last; i++) {
++                Transform t = this.item(i);
++                if (log.isLoggable(java.util.logging.Level.FINE)) {
++                    log.log(java.util.logging.Level.FINE, "Perform the (" + i + ")th " + t.getURI()
++                        + " transform");
++                }
++                xmlSignatureInput = t.performTransform(xmlSignatureInput);
++            }
++            if (last>=0) {
++                Transform t = this.item(last);
++                xmlSignatureInput = t.performTransform(xmlSignatureInput, os);
++            }
+ 
+-      try {
+-        int last=this.getLength()-1;
+-         for (int i = 0; i < last; i++) {
+-            Transform t = this.item(i);
+-            if (true) {
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Preform the (" + i + ")th " + t.getURI() + " transform");
++            return xmlSignatureInput;
++        } catch (IOException ex) {
++            throw new TransformationException("empty", ex);
++        } catch (CanonicalizationException ex) {
++            throw new TransformationException("empty", ex);
++        } catch (InvalidCanonicalizerException ex) {
++            throw new TransformationException("empty", ex);
++        }
++    }
++
++    /**
++     * Return the nonnegative number of transformations.
++     *
++     * @return the number of transformations
++     */
++    public int getLength()
++    {
++        if (transforms == null) {
++            transforms = XMLUtils.selectDsNodes
++                (this._constructionElement.getFirstChild(), "Transform");
++        }
++        return transforms.length;
++    }
++
++    /**
++     * Return the <it>i</it><sup>th</sup> <code>{@link Transform}</code>.
++     * Valid <code>i</code> values are 0 to <code>{@link #getLength}-1</code>.
++     *
++     * @param i index of {@link Transform} to return
++     * @return the <it>i</it><sup>th</sup> Transform
++     * @throws TransformationException
++     */
++    public Transform item(int i) throws TransformationException {
++
++        try {
++            if (transforms == null) {
++                transforms = XMLUtils.selectDsNodes
++                    (this._constructionElement.getFirstChild(), "Transform");
+             }
+-                        xmlSignatureInput = t.performTransform(xmlSignatureInput);
+-         }
+-         if (last>=0) {
+-                        Transform t = this.item(last);
+-            xmlSignatureInput = t.performTransform(xmlSignatureInput, os);
+-         }
++            return new Transform(transforms[i], this._baseURI);
++        } catch (XMLSecurityException ex) {
++            throw new TransformationException("empty", ex);
++        }
++    }
+ 
+-
+-         return xmlSignatureInput;
+-      } catch (IOException ex) {
+-         throw new TransformationException("empty", ex);
+-      // } catch (ParserConfigurationException ex) { throw new TransformationException("empty", ex);
+-      // } catch (SAXException ex) { throw new TransformationException("empty", ex);
+-      } catch (CanonicalizationException ex) {
+-         throw new TransformationException("empty", ex);
+-      } catch (InvalidCanonicalizerException ex) {
+-         throw new TransformationException("empty", ex);
+-      }
+-   }
+-
+-   /**
+-    * Return the nonnegative number of transformations.
+-    *
+-    * @return the number of transformations
+-    */
+-   public int getLength()
+-   {
+-                /*Element nscontext = XMLUtils.createDSctx(this._doc, "ds",
+-                                                      Constants.SignatureSpecNS);
+-             NodeList transformElems =
+-                XPathAPI.selectNodeList(this._constructionElement,
+-                                        "./ds:Transform", nscontext);
+-             return transformElems.getLength();*/
+-       if (transforms==null) {
+-        transforms=XMLUtils.selectDsNodes(this._constructionElement.getFirstChild(),
+-           "Transform");
+-       }
+-       return transforms.length;
+-  }
+-
+-   /**
+-    * Return the <it>i</it><sup>th</sup> <code>{@link Transform}</code>.
+-    * Valid <code>i</code> values are 0 to <code>{@link #getLength}-1</code>.
+-    *
+-    * @param i index of {@link Transform} to return
+-    * @return the <it>i</it><sup>th</sup> transforms
+-    * @throws TransformationException
+-    */
+-   public Transform item(int i) throws TransformationException {
+-
+-                try {
+-                        if (transforms==null) {
+-                                transforms=XMLUtils.selectDsNodes(this._constructionElement.getFirstChild(),
+-                                "Transform");
+-                        }
+-                        return new Transform(transforms[i], this._baseURI);
+-                } catch (XMLSecurityException ex) {
+-                        throw new TransformationException("empty", ex);
+-                }
+-   }
+-
+-   /** @inheritDoc */
+-   public String getBaseLocalName() {
+-      return Constants._TAG_TRANSFORMS;
+-   }
++    /** @inheritDoc */
++    public String getBaseLocalName() {
++        return Constants._TAG_TRANSFORMS;
++    }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/FuncHereContext.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/FuncHereContext.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/FuncHereContext.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/FuncHereContext.java
+@@ -62,7 +62,7 @@
+  * -scott
+  * </PRE>
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  * @see com.sun.org.apache.xml.internal.security.transforms.implementations.FuncHere
+  * @see com.sun.org.apache.xml.internal.security.utils.XPathFuncHereAPI
+  * @see <A HREF="http://www.w3.org/Signature/Drafts/xmldsig-core/Overview.html#function-here">XML Signature - The here() function</A>
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformBase64Decode.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformBase64Decode.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformBase64Decode.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformBase64Decode.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -33,6 +32,7 @@
+ import com.sun.org.apache.xml.internal.security.c14n.CanonicalizationException;
+ import com.sun.org.apache.xml.internal.security.exceptions.Base64DecodingException;
+ import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
++import com.sun.org.apache.xml.internal.security.transforms.Transform;
+ import com.sun.org.apache.xml.internal.security.transforms.TransformSpi;
+ import com.sun.org.apache.xml.internal.security.transforms.TransformationException;
+ import com.sun.org.apache.xml.internal.security.transforms.Transforms;
+@@ -43,7 +43,6 @@
+ import org.w3c.dom.Text;
+ import org.xml.sax.SAXException;
+ 
+-
+ /**
+  * Implements the <CODE>http://www.w3.org/2000/09/xmldsig#base64</CODE> decoding
+  * transform.
+@@ -95,13 +94,15 @@
+     * @throws IOException
+     * @throws TransformationException
+     */
+-   protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input)
++   protected XMLSignatureInput enginePerformTransform
++        (XMLSignatureInput input, Transform _transformObject)
+            throws IOException, CanonicalizationException,
+                   TransformationException {
+-        return enginePerformTransform(input,null);
++        return enginePerformTransform(input, null, _transformObject);
+    }
++
+     protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input,
+-            OutputStream os)
++            OutputStream os, Transform _transformObject)
+     throws IOException, CanonicalizationException,
+            TransformationException {
+          try {
+@@ -116,7 +117,7 @@
+                 byte[] decodedBytes = Base64.decode(sb.toString());
+                 return new XMLSignatureInput(decodedBytes);
+          }
+-                Base64.decode(sb.toString().getBytes(),os);
++                Base64.decode(sb.toString(),os);
+             XMLSignatureInput output=new XMLSignatureInput((byte[])null);
+             output.setOutputStream(os);
+             return output;
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformC14N.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformC14N.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformC14N.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformC14N.java
+@@ -20,17 +20,15 @@
+  */
+ package com.sun.org.apache.xml.internal.security.transforms.implementations;
+ 
+-
+-
+ import java.io.OutputStream;
+ 
+ import com.sun.org.apache.xml.internal.security.c14n.CanonicalizationException;
+ import com.sun.org.apache.xml.internal.security.c14n.implementations.Canonicalizer20010315OmitComments;
+ import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
++import com.sun.org.apache.xml.internal.security.transforms.Transform;
+ import com.sun.org.apache.xml.internal.security.transforms.TransformSpi;
+ import com.sun.org.apache.xml.internal.security.transforms.Transforms;
+ 
+-
+ /**
+  * Implements the <CODE>http://www.w3.org/TR/2001/REC-xml-c14n-20010315</CODE>
+  * transform.
+@@ -54,18 +52,19 @@
+    /**
+     *  @inheritDoc
+     */
+-   protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input)
++   protected XMLSignatureInput enginePerformTransform
++        (XMLSignatureInput input, Transform _transformObject)
+            throws CanonicalizationException {
+-            return enginePerformTransform(input,null);
++            return enginePerformTransform(input, null, _transformObject);
+    }
+-    protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input,OutputStream os)
++
++    protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input,OutputStream os, Transform _transformObject)
+     throws CanonicalizationException {
+          Canonicalizer20010315OmitComments c14n = new Canonicalizer20010315OmitComments();
+          if (os!=null) {
+                 c14n.setWriter(os);
+          }
+          byte[] result = null;
+-         input.setNeedsToBeExpanded(true);
+          result=c14n.engineCanonicalize(input);
+          XMLSignatureInput output=new XMLSignatureInput(result);
+          if (os!=null) {
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformC14N11.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformC14N11.java
+new file mode 100644
+--- /dev/null
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformC14N11.java
+@@ -0,0 +1,65 @@
++/*
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
++ */
++/*
++ * Copyright 2008 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      http://www.apache.org/licenses/LICENSE-2.0
++ *
++ *  Unless required by applicable law or agreed to in writing, software
++ *  distributed under the License is distributed on an "AS IS" BASIS,
++ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ *  See the License for the specific language governing permissions and
++ *  limitations under the License.
++ *
++ */
++package com.sun.org.apache.xml.internal.security.transforms.implementations;
++
++import java.io.OutputStream;
++
++import com.sun.org.apache.xml.internal.security.c14n.CanonicalizationException;
++import com.sun.org.apache.xml.internal.security.c14n.implementations.Canonicalizer11_OmitComments;
++import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
++import com.sun.org.apache.xml.internal.security.transforms.Transform;
++import com.sun.org.apache.xml.internal.security.transforms.TransformSpi;
++import com.sun.org.apache.xml.internal.security.transforms.Transforms;
++
++/**
++ * Implements the <CODE>http://www.w3.org/2006/12/xml-c14n11</CODE>
++ * (C14N 1.1) transform.
++ *
++ * @author Sean Mullan
++ */
++public class TransformC14N11 extends TransformSpi {
++
++    protected String engineGetURI() {
++        return Transforms.TRANSFORM_C14N11_OMIT_COMMENTS;
++    }
++
++    protected XMLSignatureInput enginePerformTransform
++        (XMLSignatureInput input, Transform transform)
++        throws CanonicalizationException {
++        return enginePerformTransform(input, null, transform);
++    }
++
++    protected XMLSignatureInput enginePerformTransform
++        (XMLSignatureInput input, OutputStream os, Transform transform)
++        throws CanonicalizationException {
++        Canonicalizer11_OmitComments c14n = new Canonicalizer11_OmitComments();
++        if (os != null) {
++            c14n.setWriter(os);
++        }
++        byte[] result = null;
++        result = c14n.engineCanonicalize(input);
++        XMLSignatureInput output = new XMLSignatureInput(result);
++        if (os != null) {
++            output.setOutputStream(os);
++        }
++        return output;
++    }
++}
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformC14N11_WithComments.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformC14N11_WithComments.java
+new file mode 100644
+--- /dev/null
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformC14N11_WithComments.java
+@@ -0,0 +1,67 @@
++/*
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
++ */
++/*
++ * Copyright 2008 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      http://www.apache.org/licenses/LICENSE-2.0
++ *
++ *  Unless required by applicable law or agreed to in writing, software
++ *  distributed under the License is distributed on an "AS IS" BASIS,
++ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ *  See the License for the specific language governing permissions and
++ *  limitations under the License.
++ *
++ */
++package com.sun.org.apache.xml.internal.security.transforms.implementations;
++
++import java.io.OutputStream;
++
++import com.sun.org.apache.xml.internal.security.c14n.CanonicalizationException;
++import com.sun.org.apache.xml.internal.security.c14n.implementations.Canonicalizer11_WithComments;
++import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
++import com.sun.org.apache.xml.internal.security.transforms.Transform;
++import com.sun.org.apache.xml.internal.security.transforms.TransformSpi;
++import com.sun.org.apache.xml.internal.security.transforms.Transforms;
++
++/**
++ * Implements the <CODE>http://www.w3.org/2006/12/xml-c14n-11#WithComments</CODE>
++ * (C14N 1.1 With Comments) transform.
++ *
++ * @author Sean Mullan
++ */
++public class TransformC14N11_WithComments extends TransformSpi {
++
++    protected String engineGetURI() {
++        return Transforms.TRANSFORM_C14N11_WITH_COMMENTS;
++    }
++
++    protected XMLSignatureInput enginePerformTransform
++        (XMLSignatureInput input, Transform transform)
++        throws CanonicalizationException {
++        return enginePerformTransform(input, null, transform);
++    }
++
++    protected XMLSignatureInput enginePerformTransform
++        (XMLSignatureInput input, OutputStream os, Transform transform)
++        throws CanonicalizationException {
++
++        Canonicalizer11_WithComments c14n = new Canonicalizer11_WithComments();
++        if (os != null) {
++            c14n.setWriter(os);
++        }
++
++        byte[] result = null;
++        result = c14n.engineCanonicalize(input);
++        XMLSignatureInput output = new XMLSignatureInput(result);
++        if (os != null) {
++            output.setOutputStream(os);
++        }
++        return output;
++    }
++}
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformC14NExclusive.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformC14NExclusive.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformC14NExclusive.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformC14NExclusive.java
+@@ -20,25 +20,24 @@
+  */
+ package com.sun.org.apache.xml.internal.security.transforms.implementations;
+ 
+-
+-
+ import java.io.OutputStream;
+ 
+ import com.sun.org.apache.xml.internal.security.c14n.CanonicalizationException;
+ import com.sun.org.apache.xml.internal.security.c14n.implementations.Canonicalizer20010315ExclOmitComments;
+ import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
+ import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
++import com.sun.org.apache.xml.internal.security.transforms.Transform;
+ import com.sun.org.apache.xml.internal.security.transforms.TransformSpi;
+ import com.sun.org.apache.xml.internal.security.transforms.Transforms;
+ import com.sun.org.apache.xml.internal.security.transforms.params.InclusiveNamespaces;
+ import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
+ import org.w3c.dom.Element;
+ 
+-
+ /**
+  * Class TransformC14NExclusive
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
++ * @version $Revision: 1.5 $
+  */
+ public class TransformC14NExclusive extends TransformSpi {
+ 
+@@ -46,7 +45,6 @@
+    public static final String implementedTransformURI =
+       Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS;
+ 
+-
+    /**
+     * Method engineGetURI
+     *
+@@ -63,27 +61,29 @@
+     * @return the transformed of the input
+     * @throws CanonicalizationException
+     */
+-   protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input)
++   protected XMLSignatureInput enginePerformTransform
++        (XMLSignatureInput input, Transform _transformObject)
+            throws CanonicalizationException {
+-            return enginePerformTransform(input,null);
++            return enginePerformTransform(input, null, _transformObject);
+    }
+-    protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input,OutputStream os)
++
++    protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input,OutputStream os, Transform _transformObject)
+     throws CanonicalizationException {
+       try {
+          String inclusiveNamespaces = null;
+ 
+-         if (this._transformObject
++         if (_transformObject
+                  .length(InclusiveNamespaces
+                     .ExclusiveCanonicalizationNamespace, InclusiveNamespaces
+                     ._TAG_EC_INCLUSIVENAMESPACES) == 1) {
+             Element inclusiveElement =
+                 XMLUtils.selectNode(
+-               this._transformObject.getElement().getFirstChild(),
++               _transformObject.getElement().getFirstChild(),
+                   InclusiveNamespaces.ExclusiveCanonicalizationNamespace,
+                   InclusiveNamespaces._TAG_EC_INCLUSIVENAMESPACES,0);
+ 
+             inclusiveNamespaces = new InclusiveNamespaces(inclusiveElement,
+-                    this._transformObject.getBaseURI()).getInclusiveNamespaces();
++                    _transformObject.getBaseURI()).getInclusiveNamespaces();
+          }
+ 
+          Canonicalizer20010315ExclOmitComments c14n =
+@@ -92,7 +92,6 @@
+             c14n.setWriter(os);
+          }
+          byte []result;
+-         input.setNeedsToBeExpanded(true);
+          result =c14n.engineCanonicalize(input, inclusiveNamespaces);
+ 
+          XMLSignatureInput output=new XMLSignatureInput(result);
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformC14NExclusiveWithComments.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformC14NExclusiveWithComments.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformC14NExclusiveWithComments.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformC14NExclusiveWithComments.java
+@@ -20,21 +20,19 @@
+  */
+ package com.sun.org.apache.xml.internal.security.transforms.implementations;
+ 
+-
+-
+ import java.io.OutputStream;
+ 
+ import com.sun.org.apache.xml.internal.security.c14n.CanonicalizationException;
+ import com.sun.org.apache.xml.internal.security.c14n.implementations.Canonicalizer20010315ExclWithComments;
+ import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
+ import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
++import com.sun.org.apache.xml.internal.security.transforms.Transform;
+ import com.sun.org.apache.xml.internal.security.transforms.TransformSpi;
+ import com.sun.org.apache.xml.internal.security.transforms.Transforms;
+ import com.sun.org.apache.xml.internal.security.transforms.params.InclusiveNamespaces;
+ import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
+ import org.w3c.dom.Element;
+ 
+-
+ /**
+  * Implements the <CODE>http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments</CODE>
+  * transform.
+@@ -47,7 +45,6 @@
+    public static final String implementedTransformURI =
+       Transforms.TRANSFORM_C14N_EXCL_WITH_COMMENTS;
+ 
+-
+    /**
+     * Method engineGetURI
+     *@inheritDoc
+@@ -60,27 +57,29 @@
+    /**
+     * @inheritDoc
+     */
+-   protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input)
++   protected XMLSignatureInput enginePerformTransform
++        (XMLSignatureInput input, Transform _transformObject)
+            throws CanonicalizationException {
+-            return enginePerformTransform(input,null);
++            return enginePerformTransform(input, null, _transformObject);
+    }
+-    protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input,OutputStream os)
++
++    protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input,OutputStream os, Transform _transformObject)
+     throws CanonicalizationException {
+      try {
+         String inclusiveNamespaces = null;
+ 
+-        if (this._transformObject
++        if (_transformObject
+                 .length(InclusiveNamespaces
+                    .ExclusiveCanonicalizationNamespace, InclusiveNamespaces
+                    ._TAG_EC_INCLUSIVENAMESPACES) == 1) {
+            Element inclusiveElement =
+                XMLUtils.selectNode(
+-              this._transformObject.getElement().getFirstChild(),
++              _transformObject.getElement().getFirstChild(),
+                  InclusiveNamespaces.ExclusiveCanonicalizationNamespace,
+                  InclusiveNamespaces._TAG_EC_INCLUSIVENAMESPACES,0);
+ 
+            inclusiveNamespaces = new InclusiveNamespaces(inclusiveElement,
+-                   this._transformObject.getBaseURI()).getInclusiveNamespaces();
++                   _transformObject.getBaseURI()).getInclusiveNamespaces();
+         }
+ 
+         Canonicalizer20010315ExclWithComments c14n =
+@@ -88,7 +87,6 @@
+         if (os!=null) {
+            c14n.setWriter( os);
+         }
+-        input.setNeedsToBeExpanded(true);
+         byte []result;
+         result =c14n.engineCanonicalize(input, inclusiveNamespaces);
+         XMLSignatureInput output=new XMLSignatureInput(result);
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformC14NWithComments.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformC14NWithComments.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformC14NWithComments.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformC14NWithComments.java
+@@ -20,17 +20,15 @@
+  */
+ package com.sun.org.apache.xml.internal.security.transforms.implementations;
+ 
+-
+-
+ import java.io.OutputStream;
+ 
+ import com.sun.org.apache.xml.internal.security.c14n.CanonicalizationException;
+ import com.sun.org.apache.xml.internal.security.c14n.implementations.Canonicalizer20010315WithComments;
+ import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
++import com.sun.org.apache.xml.internal.security.transforms.Transform;
+ import com.sun.org.apache.xml.internal.security.transforms.TransformSpi;
+ import com.sun.org.apache.xml.internal.security.transforms.Transforms;
+ 
+-
+ /**
+  * Implements the <CODE>http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments</CODE>
+  * transform.
+@@ -43,18 +41,20 @@
+    public static final String implementedTransformURI =
+       Transforms.TRANSFORM_C14N_WITH_COMMENTS;
+ 
+-
+    /** @inheritDoc */
+    protected String engineGetURI() {
+       return implementedTransformURI;
+    }
++
+    /** @inheritDoc */
+-   protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input)
+-   throws CanonicalizationException {
+-            return enginePerformTransform(input,null);
++   protected XMLSignatureInput enginePerformTransform
++        (XMLSignatureInput input, Transform _transformObject)
++        throws CanonicalizationException {
++            return enginePerformTransform(input, null, _transformObject);
+    }
++
+    /** @inheritDoc */
+-   protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input,OutputStream os)
++   protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input,OutputStream os, Transform _transformObject)
+            throws CanonicalizationException {
+ 
+         Canonicalizer20010315WithComments c14n = new Canonicalizer20010315WithComments();
+@@ -63,7 +63,6 @@
+         }
+ 
+          byte[] result = null;
+-         input.setNeedsToBeExpanded(true);
+          result=c14n.engineCanonicalize(input);
+          XMLSignatureInput output=new XMLSignatureInput(result);
+          if (os!=null) {
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformEnvelopedSignature.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformEnvelopedSignature.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformEnvelopedSignature.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformEnvelopedSignature.java
+@@ -20,10 +20,9 @@
+  */
+ package com.sun.org.apache.xml.internal.security.transforms.implementations;
+ 
+-
+-
+ import com.sun.org.apache.xml.internal.security.signature.NodeFilter;
+ import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
++import com.sun.org.apache.xml.internal.security.transforms.Transform;
+ import com.sun.org.apache.xml.internal.security.transforms.TransformSpi;
+ import com.sun.org.apache.xml.internal.security.transforms.TransformationException;
+ import com.sun.org.apache.xml.internal.security.transforms.Transforms;
+@@ -32,7 +31,6 @@
+ import org.w3c.dom.Element;
+ import org.w3c.dom.Node;
+ 
+-
+ /**
+  * Implements the <CODE>http://www.w3.org/2000/09/xmldsig#enveloped-signature</CODE>
+  * transform.
+@@ -57,7 +55,7 @@
+    /**
+     * @inheritDoc
+     */
+-   protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input)
++   protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input, Transform _transformObject)
+            throws TransformationException {
+ 
+ 
+@@ -74,14 +72,7 @@
+           * (including comments) in the node-set representing the octet stream.
+           */
+ 
+-         /*
+-         if (input.isOctetStream()) {
+-            input.setNodesetXPath(Canonicalizer.XPATH_C14N_WITH_COMMENTS);
+-         }
+-         */
+-
+-         Element transformElement = this._transformObject.getElement();
+-         Node signatureElement = transformElement;
++         Node signatureElement = _transformObject.getElement();
+ 
+ 
+          signatureElement = searchSignatureElement(signatureElement);
+@@ -124,18 +115,24 @@
+             }
+             return signatureElement;
+     }
+-    class EnvelopedNodeFilter implements NodeFilter {
++    static class EnvelopedNodeFilter implements NodeFilter {
+         Node exclude;
+         EnvelopedNodeFilter(Node n) {
+-                exclude=n;
++            exclude=n;
+         }
+-                /**
+-                 * @see com.sun.org.apache.xml.internal.security.signature.NodeFilter#isNodeInclude(org.w3c.dom.Node)
+-                 */
+-                public boolean isNodeInclude(Node n) {
+-                        // TODO Optimize me.
+-                        return !XMLUtils.isDescendantOrSelf(exclude,n);
+-                }
+-
++    public int isNodeIncludeDO(Node n, int level) {
++        if ((n==exclude))
++                        return -1;
++        return 1;
++    }
++        /**
++         * @see com.sun.org.apache.xml.internal.security.signature.NodeFilter#isNodeInclude(org.w3c.dom.Node)
++         */
++        public int isNodeInclude(Node n) {
++                if ((n==exclude) || XMLUtils.isDescendantOrSelf(exclude,n))
++                        return -1;
++                return 1;
++            //return !XMLUtils.isDescendantOrSelf(exclude,n);
++        }
+     }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformXPath.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformXPath.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformXPath.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformXPath.java
+@@ -20,13 +20,12 @@
+  */
+ package com.sun.org.apache.xml.internal.security.transforms.implementations;
+ 
+-
+-
+ import javax.xml.transform.TransformerException;
+ 
+ import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityRuntimeException;
+ import com.sun.org.apache.xml.internal.security.signature.NodeFilter;
+ import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
++import com.sun.org.apache.xml.internal.security.transforms.Transform;
+ import com.sun.org.apache.xml.internal.security.transforms.TransformSpi;
+ import com.sun.org.apache.xml.internal.security.transforms.TransformationException;
+ import com.sun.org.apache.xml.internal.security.transforms.Transforms;
+@@ -40,7 +39,6 @@
+ import org.w3c.dom.Element;
+ import org.w3c.dom.Node;
+ 
+-
+ /**
+  * Class TransformXPath
+  *
+@@ -53,15 +51,10 @@
+  */
+ public class TransformXPath extends TransformSpi {
+ 
+-   /** {@link java.util.logging} logging facility */
+-    static java.util.logging.Logger log =
+-        java.util.logging.Logger.getLogger(TransformXPath.class.getName());
+-
+    /** Field implementedTransformURI */
+    public static final String implementedTransformURI =
+       Transforms.TRANSFORM_XPATH;
+ 
+-
+    /**
+     * Method engineGetURI
+     *
+@@ -78,7 +71,7 @@
+     *
+     * @throws TransformationException
+     */
+-   protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input)
++   protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input, Transform _transformObject)
+            throws TransformationException {
+ 
+       try {
+@@ -94,12 +87,12 @@
+           * The evaluation of this expression includes all of the document's nodes
+           * (including comments) in the node-set representing the octet stream.
+           */
+-                  CachedXPathAPIHolder.setDoc(this._transformObject.getElement().getOwnerDocument());
++                  CachedXPathAPIHolder.setDoc(_transformObject.getElement().getOwnerDocument());
+ 
+ 
+ 
+          Element xpathElement =XMLUtils.selectDsNode(
+-            this._transformObject.getElement().getFirstChild(),
++            _transformObject.getElement().getFirstChild(),
+                Constants._TAG_XPATH,0);
+ 
+          if (xpathElement == null) {
+@@ -129,42 +122,47 @@
+     * @return true if needs to be circunvent for bug.
+     */
+     private boolean needsCircunvent(String str) {
+-        return true;
+-        //return str.contains("namespace");
++        //return true;
++        //return false;
++        return (str.indexOf("namespace") != -1) || (str.indexOf("name()") != -1);
++    }
+ 
+-    }
+-    class XPathNodeFilter implements NodeFilter {
+-         PrefixResolverDefault prefixResolver;
+-         CachedXPathFuncHereAPI xPathFuncHereAPI =
+-             new CachedXPathFuncHereAPI(CachedXPathAPIHolder.getCachedXPathAPI());
+-          ;
++    static class XPathNodeFilter implements NodeFilter {
++        PrefixResolverDefault prefixResolver;
++        CachedXPathFuncHereAPI xPathFuncHereAPI =
++            new CachedXPathFuncHereAPI(CachedXPathAPIHolder.getCachedXPathAPI());
+         Node xpathnode;
+         String str;
+         XPathNodeFilter(Element xpathElement,
+                         Node xpathnode, String str) {
+-                this.xpathnode=xpathnode;
+-                this.str=str;
+-                prefixResolver =new PrefixResolverDefault(xpathElement);
++            this.xpathnode=xpathnode;
++            this.str=str;
++            prefixResolver =new PrefixResolverDefault(xpathElement);
+         }
+ 
+-
+-                /**
+-                 * @see com.sun.org.apache.xml.internal.security.signature.NodeFilter#isNodeInclude(org.w3c.dom.Node)
+-                 */
+-                public boolean isNodeInclude(Node currentNode) {
+-                        XObject includeInResult;
+-                        try {
+-                                includeInResult = xPathFuncHereAPI.eval(currentNode,
+-                                        xpathnode, str,prefixResolver);
+-                                return includeInResult.bool();
+-                        } catch (TransformerException e) {
++        /**
++         * @see com.sun.org.apache.xml.internal.security.signature.NodeFilter#isNodeInclude(org.w3c.dom.Node)
++         */
++        public int isNodeInclude(Node currentNode) {
++            XObject includeInResult;
++            try {
++                includeInResult = xPathFuncHereAPI.eval(currentNode,
++                                xpathnode, str,prefixResolver);
++                if (includeInResult.bool())
++                        return 1;
++                return 0;
++            } catch (TransformerException e) {
+                 Object[] eArgs = {currentNode};
+-                                throw new XMLSecurityRuntimeException("signature.Transform.node", eArgs, e);
+-                        }
+-                        catch (Exception e) {
++                throw new XMLSecurityRuntimeException
++                    ("signature.Transform.node", eArgs, e);
++            } catch (Exception e) {
+                 Object[] eArgs = {currentNode, new Short(currentNode.getNodeType())};
+-                                throw new XMLSecurityRuntimeException("signature.Transform.nodeAndType",eArgs, e);
+-                        }
+-                }
++                throw new XMLSecurityRuntimeException
++                    ("signature.Transform.nodeAndType",eArgs, e);
++            }
++        }
++        public int isNodeIncludeDO(Node n, int level) {
++                return isNodeInclude(n);
++        }
+     }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformXPath2Filter.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformXPath2Filter.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformXPath2Filter.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformXPath2Filter.java
+@@ -24,7 +24,10 @@
+ 
+ import java.io.IOException;
+ import java.util.ArrayList;
++import java.util.HashSet;
++import java.util.Iterator;
+ import java.util.List;
++import java.util.Set;
+ 
+ import javax.xml.parsers.ParserConfigurationException;
+ import javax.xml.transform.TransformerException;
+@@ -34,6 +37,7 @@
+ import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
+ import com.sun.org.apache.xml.internal.security.signature.NodeFilter;
+ import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
++import com.sun.org.apache.xml.internal.security.transforms.Transform;
+ import com.sun.org.apache.xml.internal.security.transforms.TransformSpi;
+ import com.sun.org.apache.xml.internal.security.transforms.TransformationException;
+ import com.sun.org.apache.xml.internal.security.transforms.Transforms;
+@@ -88,9 +92,9 @@
+     *
+     * @throws TransformationException
+     */
+-   protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input)
++   protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input, Transform _transformObject)
+            throws TransformationException {
+-          CachedXPathAPIHolder.setDoc(this._transformObject.getElement().getOwnerDocument());
++          CachedXPathAPIHolder.setDoc(_transformObject.getElement().getOwnerDocument());
+       try {
+           List unionNodes=new ArrayList();
+            List substractNodes=new ArrayList();
+@@ -101,7 +105,7 @@
+ 
+ 
+          Element []xpathElements =XMLUtils.selectNodes(
+-                this._transformObject.getElement().getFirstChild(),
++                _transformObject.getElement().getFirstChild(),
+                    XPath2FilterContainer.XPathFilter2NS,
+                    XPath2FilterContainer._TAG_XPATH2);
+          int noOfSteps = xpathElements.length;
+@@ -122,7 +126,7 @@
+ 
+          for (int i = 0; i < noOfSteps; i++) {
+             Element xpathElement =XMLUtils.selectNode(
+-               this._transformObject.getElement().getFirstChild(),
++               _transformObject.getElement().getFirstChild(),
+                   XPath2FilterContainer.XPathFilter2NS,
+                   XPath2FilterContainer._TAG_XPATH2,i);
+             XPath2FilterContainer xpathContainer =
+@@ -143,9 +147,9 @@
+              }
+          }
+ 
+-         input.setNeedsToBeExpanded(true);
+ 
+-         input.addNodeFilter(new XPath2NodeFilter(unionNodes,substractNodes,intersectNodes));
++         input.addNodeFilter(new XPath2NodeFilter(convertNodeListToSet(unionNodes),
++                         convertNodeListToSet(substractNodes),convertNodeListToSet(intersectNodes)));
+          input.setNodeSet(true);
+          return input;
+       } catch (TransformerException ex) {
+@@ -166,37 +170,110 @@
+          throw new TransformationException("empty", ex);
+       }
+    }
++   static Set convertNodeListToSet(List l){
++           Set result=new HashSet();
++           for (int j=0;j<l.size();j++) {
++                   NodeList rootNodes=(NodeList) l.get(j);
++               int length = rootNodes.getLength();
++
++               for (int i = 0; i < length; i++) {
++                    Node rootNode = rootNodes.item(i);
++                    result.add(rootNode);
++
++                 }
++
++           }
++           return result;
++   }
+ }
+ 
+ class XPath2NodeFilter implements NodeFilter {
+-        XPath2NodeFilter(List unionNodes, List substractNodes,
+-                        List intersectNodes) {
++        boolean hasUnionNodes;
++        boolean hasSubstractNodes;
++        boolean hasIntersectNodes;
++        XPath2NodeFilter(Set unionNodes, Set substractNodes,
++                        Set intersectNodes) {
+                 this.unionNodes=unionNodes;
++                hasUnionNodes=!unionNodes.isEmpty();
+                 this.substractNodes=substractNodes;
++                hasSubstractNodes=!substractNodes.isEmpty();
+                 this.intersectNodes=intersectNodes;
++                hasIntersectNodes=!intersectNodes.isEmpty();
+         }
+-        List unionNodes=new ArrayList();
+-        List substractNodes=new ArrayList();
+-        List intersectNodes=new ArrayList();
++        Set unionNodes;
++        Set substractNodes;
++        Set intersectNodes;
+ 
+ 
+    /**
+     * @see com.sun.org.apache.xml.internal.security.signature.NodeFilter#isNodeInclude(org.w3c.dom.Node)
+     */
+-   public boolean isNodeInclude(Node currentNode) {
+-           boolean notIncluded=false;
+-           if (rooted(currentNode,substractNodes)) {
+-                   notIncluded=true;
+-           } else if (!rooted(currentNode,intersectNodes)) {
+-                   notIncluded=true;
+-           }
+-           if (notIncluded && rooted(currentNode,unionNodes)) {
+-                   notIncluded=false;
++   public int isNodeInclude(Node currentNode) {
++           int result=1;
++
++           if (hasSubstractNodes && rooted(currentNode, substractNodes)) {
++                      result = -1;
++           } else if (hasIntersectNodes && !rooted(currentNode, intersectNodes)) {
++                   result = 0;
+            }
+ 
+-      return !notIncluded;
++          //TODO OPTIMIZE
++      if (result==1)
++          return 1;
++      if (hasUnionNodes) {
++          if (rooted(currentNode, unionNodes)) {
++                   return 1;
++          }
++          result=0;
++      }
++      return result;
+ 
+    }
++   int inSubstract=-1;
++   int inIntersect=-1;
++   int inUnion=-1;
++   public int isNodeIncludeDO(Node n, int level) {
++           int result=1;
++           if (hasSubstractNodes) {
++                   if ((inSubstract==-1) || (level<=inSubstract)) {
++                           if (inList(n,  substractNodes)) {
++                                   inSubstract=level;
++                           } else {
++                                   inSubstract=-1;
++                           }
++                   }
++                   if (inSubstract!=-1){
++                           result=-1;
++                   }
++           }
++           if (result!=-1){
++                   if (hasIntersectNodes) {
++                   if ((inIntersect==-1) || (level<=inIntersect)) {
++                           if (!inList(n,  intersectNodes)) {
++                                   inIntersect=-1;
++                                   result=0;
++                           } else {
++                                   inIntersect=level;
++                           }
++                   }
++                   }
++           }
++
++          if (level<=inUnion)
++                   inUnion=-1;
++      if (result==1)
++          return 1;
++      if (hasUnionNodes) {
++          if ((inUnion==-1) && inList(n,  unionNodes)) {
++                  inUnion=level;
++          }
++          if (inUnion!=-1)
++                  return 1;
++          result=0;
++      }
++
++      return result;
++   }
+ 
+    /**
+     * Method rooted
+@@ -205,20 +282,28 @@
+     *
+     * @return if rooted bye the rootnodes
+     */
+-   boolean rooted(Node currentNode, List nodeList ) {
+-           for (int j=0;j<nodeList.size();j++) {
+-                   NodeList rootNodes=(NodeList) nodeList.get(j);
+-      int length = rootNodes.getLength();
+-
+-      for (int i = 0; i < length; i++) {
+-         Node rootNode = rootNodes.item(i);
+-
+-         if (XMLUtils.isDescendantOrSelf(rootNode,currentNode)) {
+-            return true;
+-         }
+-      }
+-
++   static boolean  rooted(Node currentNode, Set nodeList ) {
++           if (nodeList.contains(currentNode)) {
++                   return true;
++           }
++           Iterator it=nodeList.iterator();
++           while (it.hasNext()) {
++                        Node rootNode = (Node) it.next();
++                        if (XMLUtils.isDescendantOrSelf(rootNode,currentNode)) {
++                                   return true;
++                        }
+            }
+            return false;
+    }
++
++      /**
++       * Method rooted
++       * @param currentNode
++       * @param nodeList
++       *
++       * @return if rooted bye the rootnodes
++       */
++      static boolean  inList(Node currentNode, Set nodeList ) {
++              return nodeList.contains(currentNode);
++      }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformXPointer.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformXPointer.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformXPointer.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformXPointer.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -25,6 +24,7 @@
+ 
+ 
+ import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
++import com.sun.org.apache.xml.internal.security.transforms.Transform;
+ import com.sun.org.apache.xml.internal.security.transforms.TransformSpi;
+ import com.sun.org.apache.xml.internal.security.transforms.TransformationException;
+ import com.sun.org.apache.xml.internal.security.transforms.Transforms;
+@@ -56,7 +56,7 @@
+     * @throws TransformationException
+     *
+     */
+-   protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input)
++   protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input, Transform _transformObject)
+            throws  TransformationException {
+ 
+       Object exArgs[] = { implementedTransformURI };
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformXSLT.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformXSLT.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformXSLT.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformXSLT.java
+@@ -2,9 +2,8 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+- * Copyright  1999-2004 The Apache Software Foundation.
++ * Copyright 1999-2007 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.
+@@ -21,14 +20,12 @@
+  */
+ package com.sun.org.apache.xml.internal.security.transforms.implementations;
+ 
+-
+-
+ import java.io.ByteArrayInputStream;
+ import java.io.ByteArrayOutputStream;
+ import java.io.IOException;
+ import java.io.OutputStream;
++import java.lang.reflect.Method;
+ 
+-import javax.xml.XMLConstants;
+ import javax.xml.transform.Source;
+ import javax.xml.transform.Transformer;
+ import javax.xml.transform.TransformerConfigurationException;
+@@ -40,13 +37,13 @@
+ 
+ import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
+ import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
++import com.sun.org.apache.xml.internal.security.transforms.Transform;
+ import com.sun.org.apache.xml.internal.security.transforms.TransformSpi;
+ import com.sun.org.apache.xml.internal.security.transforms.TransformationException;
+ import com.sun.org.apache.xml.internal.security.transforms.Transforms;
+ import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
+ import org.w3c.dom.Element;
+ 
+-
+ /**
+  * Class TransformXSLT
+  *
+@@ -65,6 +62,17 @@
+    static final String defaultXSLTSpecNSprefix = "xslt";
+    static final String XSLTSTYLESHEET          = "stylesheet";
+ 
++   // check for secure processing feature
++   private static Class xClass = null;
++   static {
++      try {
++         xClass = Class.forName("javax.xml.XMLConstants");
++      } catch (Exception e) {}
++   }
++
++   static java.util.logging.Logger log =
++      java.util.logging.Logger.getLogger(
++         TransformXSLT.class.getName());
+ 
+    /**
+     * Method engineGetURI
+@@ -83,16 +91,22 @@
+     * @throws IOException
+     * @throws TransformationException
+     */
+-   protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input)
++   protected XMLSignatureInput enginePerformTransform
++        (XMLSignatureInput input, Transform _transformObject)
+            throws IOException,
+                   TransformationException {
+-        return enginePerformTransform(input,null);
++        return enginePerformTransform(input, null, _transformObject);
+    }
+-    protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input,OutputStream baos)
++
++    protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input,OutputStream baos, Transform _transformObject)
+     throws IOException,
+            TransformationException {
++      if (xClass == null) {
++         Object exArgs[] = { "SECURE_PROCESSING_FEATURE not supported" };
++         throw new TransformationException("generic.EmptyMessage", exArgs);
++      }
+       try {
+-         Element transformElement = this._transformObject.getElement();
++         Element transformElement = _transformObject.getElement();
+ 
+          Element _xsltElement =
+             XMLUtils.selectNode(transformElement.getFirstChild(),
+@@ -105,8 +119,10 @@
+          }
+ 
+          TransformerFactory tFactory = TransformerFactory.newInstance();
++         Class c = tFactory.getClass();
++         Method m = c.getMethod("setFeature", new Class[] {String.class, boolean.class});
+          // Process XSLT stylesheets in a secure manner
+-         tFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
++         m.invoke(tFactory, new Object[] {"http://javax.xml.XMLConstants/feature/secure-processing", Boolean.TRUE});
+ 
+          /*
+           * This transform requires an octet stream as input. If the actual
+@@ -139,12 +155,25 @@
+          }
+ 
+          Transformer transformer = tFactory.newTransformer(stylesheet);
++
++         // Force Xalan to use \n as line separator on all OSes. This
++         // avoids OS specific signature validation failures due to line
++         // separator differences in the transformed output. Unfortunately,
++         // this is not a standard JAXP property so will not work with non-Xalan
++         // implementations.
++         try {
++            transformer.setOutputProperty
++               ("{http://xml.apache.org/xalan}line-separator", "\n");
++         } catch (Exception e) {
++            log.log(java.util.logging.Level.WARNING, "Unable to set Xalan line-separator property: "
++               + e.getMessage());
++         }
++
+          if (baos==null) {
+-                    ByteArrayOutputStream baos1 = new ByteArrayOutputStream();
+-               StreamResult outputTarget = new StreamResult(baos1);
+-               transformer.transform(xmlSource, outputTarget);
+-               return new XMLSignatureInput(baos1.toByteArray());
+-
++            ByteArrayOutputStream baos1 = new ByteArrayOutputStream();
++            StreamResult outputTarget = new StreamResult(baos1);
++            transformer.transform(xmlSource, outputTarget);
++            return new XMLSignatureInput(baos1.toByteArray());
+          }
+          StreamResult outputTarget = new StreamResult(baos);
+ 
+@@ -164,6 +193,18 @@
+          Object exArgs[] = { ex.getMessage() };
+ 
+          throw new TransformationException("generic.EmptyMessage", exArgs, ex);
++      } catch (NoSuchMethodException ex) {
++         Object exArgs[] = { ex.getMessage() };
++
++         throw new TransformationException("generic.EmptyMessage", exArgs, ex);
++      } catch (IllegalAccessException ex) {
++         Object exArgs[] = { ex.getMessage() };
++
++         throw new TransformationException("generic.EmptyMessage", exArgs, ex);
++      } catch (java.lang.reflect.InvocationTargetException ex) {
++         Object exArgs[] = { ex.getMessage() };
++
++         throw new TransformationException("generic.EmptyMessage", exArgs, ex);
+       }
+    }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/params/XPath2FilterContainer.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/params/XPath2FilterContainer.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/params/XPath2FilterContainer.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/params/XPath2FilterContainer.java
+@@ -26,6 +26,7 @@
+ import com.sun.org.apache.xml.internal.security.transforms.TransformParam;
+ import com.sun.org.apache.xml.internal.security.utils.ElementProxy;
+ import com.sun.org.apache.xml.internal.security.utils.HelperNodeList;
++import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+ import org.w3c.dom.Node;
+@@ -36,7 +37,7 @@
+  * Implements the parameters for the <A
+  * HREF="http://www.w3.org/TR/xmldsig-filter2/">XPath Filter v2.0</A>.
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  * @see <A HREF="http://www.w3.org/TR/xmldsig-filter2/">XPath Filter v2.0 (TR)</A>
+  * @see <A HREF="http://www.w3.org/Signature/Drafts/xmldsig-xfilter2/">XPath Filter v2.0 (editors copy)</A>
+  */
+@@ -188,7 +189,7 @@
+ 
+       HelperNodeList nl = new HelperNodeList();
+ 
+-      nl.appendChild(doc.createTextNode("\n"));
++      XMLUtils.addReturnToElement(doc, nl);
+ 
+       for (int i = 0; i < params.length; i++) {
+          String type = params[i][0];
+@@ -207,7 +208,7 @@
+          XPath2FilterContainer c = new XPath2FilterContainer(doc, xpath, type);
+ 
+          nl.appendChild(c.getElement());
+-         nl.appendChild(doc.createTextNode("\n"));
++         XMLUtils.addReturnToElement(doc, nl);
+       }
+ 
+       return nl;
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/params/XPath2FilterContainer04.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/params/XPath2FilterContainer04.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/params/XPath2FilterContainer04.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/params/XPath2FilterContainer04.java
+@@ -25,6 +25,7 @@
+ import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
+ import com.sun.org.apache.xml.internal.security.transforms.TransformParam;
+ import com.sun.org.apache.xml.internal.security.utils.ElementProxy;
++import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+ import org.w3c.dom.Node;
+@@ -35,7 +36,7 @@
+  * Implements the parameters for the <A
+  * HREF="http://www.w3.org/TR/xmldsig-filter2/">XPath Filter v2.0</A>.
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  * @see <A HREF="http://www.w3.org/TR/xmldsig-filter2/">XPath Filter v2.0 (TR)</A>
+  * @see <A HREF="http://www.w3.org/Signature/Drafts/xmldsig-xfilter2/">XPath Filter v2.0 (editors copy)</A>
+  */
+@@ -87,8 +88,9 @@
+ 
+       if ((xpath2filter.length() > 2)
+               && (!Character.isWhitespace(xpath2filter.charAt(0)))) {
+-         this._constructionElement.appendChild(doc.createTextNode("\n"
+-                 + xpath2filter + "\n"));
++         XMLUtils.addReturnToElement(this._constructionElement);
++         this._constructionElement.appendChild(doc.createTextNode(xpath2filter));
++         XMLUtils.addReturnToElement(this._constructionElement);
+       } else {
+          this._constructionElement
+             .appendChild(doc.createTextNode(xpath2filter));
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/params/XPathFilterCHGPContainer.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/params/XPathFilterCHGPContainer.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/params/XPathFilterCHGPContainer.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/params/XPathFilterCHGPContainer.java
+@@ -36,7 +36,7 @@
+  * Implements the parameters for a custom Transform which has a better performance
+  * thatn the xfilter2.
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class XPathFilterCHGPContainer extends ElementProxy
+         implements TransformParam {
+@@ -104,7 +104,7 @@
+          includeButSearchElem
+             .appendChild(this._doc
+                .createTextNode(indentXPathText(includeButSearch)));
+-         this._constructionElement.appendChild(doc.createTextNode("\n"));
++         XMLUtils.addReturnToElement(this._constructionElement);
+          this._constructionElement.appendChild(includeButSearchElem);
+       }
+ 
+@@ -118,7 +118,7 @@
+          excludeButSearchElem
+             .appendChild(this._doc
+                .createTextNode(indentXPathText(excludeButSearch)));
+-         this._constructionElement.appendChild(doc.createTextNode("\n"));
++         XMLUtils.addReturnToElement(this._constructionElement);
+          this._constructionElement.appendChild(excludeButSearchElem);
+       }
+ 
+@@ -129,11 +129,11 @@
+ 
+          excludeElem
+             .appendChild(this._doc.createTextNode(indentXPathText(exclude)));
+-         this._constructionElement.appendChild(doc.createTextNode("\n"));
++         XMLUtils.addReturnToElement(this._constructionElement);
+          this._constructionElement.appendChild(excludeElem);
+       }
+ 
+-      this._constructionElement.appendChild(doc.createTextNode("\n"));
++      XMLUtils.addReturnToElement(this._constructionElement);
+    }
+ 
+    /**
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/Base64.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/Base64.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/Base64.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/Base64.java
+@@ -20,24 +20,17 @@
+  */
+ package com.sun.org.apache.xml.internal.security.utils;
+ 
+-
+-
+ import java.io.BufferedReader;
+ import java.io.IOException;
+ import java.io.InputStream;
+ import java.io.OutputStream;
+-import java.io.StringReader;
+ import java.math.BigInteger;
+ 
+-import javax.xml.parsers.DocumentBuilder;
+-import javax.xml.parsers.DocumentBuilderFactory;
+-
+ import com.sun.org.apache.xml.internal.security.exceptions.Base64DecodingException;
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+ import org.w3c.dom.Node;
+ import org.w3c.dom.Text;
+-import org.xml.sax.InputSource;
+ 
+ 
+ /**
+@@ -53,17 +46,10 @@
+  */
+ public class Base64 {
+ 
+-   /** {@link java.util.logging} logging facility */
+-    static java.util.logging.Logger log =
+-        java.util.logging.Logger.getLogger(Base64.class.getName());
+-
+ 
+    /** Field BASE64DEFAULTLENGTH */
+    public static final int BASE64DEFAULTLENGTH = 76;
+ 
+-   /** Field _base64length */
+-   static int _base64length = Base64.BASE64DEFAULTLENGTH;
+-
+    private Base64() {
+      // we don't allow instantiation
+    }
+@@ -79,7 +65,7 @@
+     * @param bitlen <code>int<code> the desired length in bits of the representation
+     * @return a byte array with <code>bitlen</code> bits of <code>big</code>
+     */
+-   static byte[] getBytes(BigInteger big, int bitlen) {
++   static final byte[] getBytes(BigInteger big, int bitlen) {
+ 
+       //round bitlen
+       bitlen = ((bitlen + 7) >> 3) << 3;
+@@ -121,7 +107,7 @@
+     * @param big
+     * @return String with Base64 encoding
+     */
+-   public static String encode(BigInteger big) {
++   public static final String encode(BigInteger big) {
+       return encode(getBytes(big, big.bitLength()));
+    }
+ 
+@@ -136,7 +122,7 @@
+     * @param bitlen <code>int<code> the desired length in bits of the representation
+     * @return a byte array with <code>bitlen</code> bits of <code>big</code>
+     */
+-   public static byte[] encode(BigInteger big, int bitlen) {
++   public static final  byte[] encode(BigInteger big, int bitlen) {
+ 
+       //round bitlen
+       bitlen = ((bitlen + 7) >> 3) << 3;
+@@ -179,7 +165,7 @@
+     * @return the biginter obtained from the node
+     * @throws Base64DecodingException
+     */
+-   public static BigInteger decodeBigIntegerFromElement(Element element) throws Base64DecodingException
++   public static final BigInteger decodeBigIntegerFromElement(Element element) throws Base64DecodingException
+    {
+       return new BigInteger(1, Base64.decode(element));
+    }
+@@ -191,7 +177,7 @@
+     * @return the biginter obtained from the text node
+     * @throws Base64DecodingException
+     */
+-   public static BigInteger decodeBigIntegerFromText(Text text) throws Base64DecodingException
++   public static final BigInteger decodeBigIntegerFromText(Text text) throws Base64DecodingException
+    {
+       return new BigInteger(1, Base64.decode(text.getData()));
+    }
+@@ -203,7 +189,7 @@
+     * @param element
+     * @param biginteger
+     */
+-   public static void fillElementWithBigInteger(Element element,
++   public static final void fillElementWithBigInteger(Element element,
+            BigInteger biginteger) {
+ 
+       String encodedInt = encode(biginteger);
+@@ -229,7 +215,7 @@
+     * $todo$ not tested yet
+     * @throws Base64DecodingException
+     */
+-   public static byte[] decode(Element element) throws Base64DecodingException {
++   public static final byte[] decode(Element element) throws Base64DecodingException {
+ 
+       Node sibling = element.getFirstChild();
+       StringBuffer sb = new StringBuffer();
+@@ -255,7 +241,7 @@
+     * @return an Element with the base64 encoded in the text.
+     *
+     */
+-   public static Element encodeToElement(Document doc, String localName,
++   public static final Element encodeToElement(Document doc, String localName,
+                                          byte[] bytes) {
+ 
+       Element el = XMLUtils.createElementInSignatureSpace(doc, localName);
+@@ -275,20 +261,23 @@
+     * @throws Base64DecodingException
+     *
+     */
+-   public static byte[] decode(byte[] base64) throws Base64DecodingException  {
+-         return decodeInternal(base64);
++   public final static byte[] decode(byte[] base64) throws Base64DecodingException  {
++         return decodeInternal(base64, -1);
+    }
+ 
+ 
+ 
+    /**
+-    * Encode a byte array and fold lines at the standard 76th character.
++    * Encode a byte array and fold lines at the standard 76th character unless
++    * ignore line breaks property is set.
+     *
+     * @param binaryData <code>byte[]<code> to be base64 encoded
+     * @return the <code>String<code> with encoded data
+     */
+-   public static String encode(byte[] binaryData) {
+-        return encode(binaryData,BASE64DEFAULTLENGTH);
++   public static final String encode(byte[] binaryData) {
++      return XMLUtils.ignoreLineBreaks()
++         ? encode(binaryData, Integer.MAX_VALUE)
++         : encode(binaryData, BASE64DEFAULTLENGTH);
+    }
+ 
+    /**
+@@ -302,7 +291,7 @@
+     * @throws IOException
+     * @throws Base64DecodingException
+     */
+-   public static byte[] decode(BufferedReader reader)
++   public final static byte[] decode(BufferedReader reader)
+            throws IOException, Base64DecodingException {
+ 
+       UnsyncByteArrayOutputStream baos = new UnsyncByteArrayOutputStream();
+@@ -317,28 +306,6 @@
+       return baos.toByteArray();
+    }
+ 
+-   /**
+-    * Method main
+-    *
+-    *
+-    * @param args
+-    *
+-    * @throws Exception
+-    */
+-   public static void main(String[] args) throws Exception {
+-
+-      DocumentBuilderFactory docBuilderFactory =
+-         DocumentBuilderFactory.newInstance();
+-      DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
+-      String testString1 =
+-         "<container><base64 value=\"Should be 'Hallo'\">SGFsbG8=</base64></container>";
+-      InputSource inputSource = new InputSource(new StringReader(testString1));
+-      Document doc = docBuilder.parse(inputSource);
+-      Element base64Elem =
+-         (Element) doc.getDocumentElement().getChildNodes().item(0);
+-
+-      System.out.println(new String(decode(base64Elem)));
+-   }
+    static private final int  BASELENGTH         = 255;
+    static private final int  LOOKUPLENGTH       = 64;
+    static private final int  TWENTYFOURBITGROUP = 24;
+@@ -347,7 +314,6 @@
+    static private final int  FOURBYTE           = 4;
+    static private final int  SIGN               = -128;
+    static private final char PAD                = '=';
+-   static private final boolean fDebug          = false;
+    static final private byte [] base64Alphabet        = new byte[BASELENGTH];
+    static final private char [] lookUpBase64Alphabet  = new char[LOOKUPLENGTH];
+ 
+@@ -406,7 +372,7 @@
+     * @param length <code>int<code> length of wrapped lines; No wrapping if less than 4.
+     * @return a <code>String</code> with encoded data
+     */
+-    public static String encode(byte[] binaryData,int length) {
++    public static final String  encode(byte[] binaryData,int length) {
+ 
+         if (length<4) {
+                 length=Integer.MAX_VALUE;
+@@ -434,9 +400,7 @@
+        int encodedIndex = 0;
+        int dataIndex   = 0;
+        int i           = 0;
+-       if (fDebug) {
+-           System.out.println("number of triplets = " + numberTriplets );
+-       }
++
+ 
+        for (int line = 0; line < numberLines; line++) {
+            for (int quartet = 0; quartet < 19; quartet++) {
+@@ -444,9 +408,6 @@
+                b2 = binaryData[dataIndex++];
+                b3 = binaryData[dataIndex++];
+ 
+-               if (fDebug) {
+-                   System.out.println( "b1= " + b1 +", b2= " + b2 + ", b3= " + b3 );
+-               }
+ 
+                l  = (byte)(b2 & 0x0f);
+                k  = (byte)(b1 & 0x03);
+@@ -456,11 +417,6 @@
+                byte val2 = ((b2 & SIGN)==0)?(byte)(b2>>4):(byte)((b2)>>4^0xf0);
+                byte val3 = ((b3 & SIGN)==0)?(byte)(b3>>6):(byte)((b3)>>6^0xfc);
+ 
+-               if (fDebug) {
+-                   System.out.println( "val2 = " + val2 );
+-                   System.out.println( "k4   = " + (k<<4));
+-                   System.out.println( "vak  = " + (val2 | (k<<4)));
+-               }
+ 
+                encodedData[encodedIndex++] = lookUpBase64Alphabet[ val1 ];
+                encodedData[encodedIndex++] = lookUpBase64Alphabet[ val2 | ( k<<4 )];
+@@ -477,9 +433,6 @@
+            b2 = binaryData[dataIndex++];
+            b3 = binaryData[dataIndex++];
+ 
+-           if (fDebug) {
+-               System.out.println( "b1= " + b1 +", b2= " + b2 + ", b3= " + b3 );
+-           }
+ 
+            l  = (byte)(b2 & 0x0f);
+            k  = (byte)(b1 & 0x03);
+@@ -489,11 +442,6 @@
+            byte val2 = ((b2 & SIGN)==0)?(byte)(b2>>4):(byte)((b2)>>4^0xf0);
+            byte val3 = ((b3 & SIGN)==0)?(byte)(b3>>6):(byte)((b3)>>6^0xfc);
+ 
+-           if (fDebug) {
+-               System.out.println( "val2 = " + val2 );
+-               System.out.println( "k4   = " + (k<<4));
+-               System.out.println( "vak  = " + (val2 | (k<<4)));
+-           }
+ 
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[ val1 ];
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[ val2 | ( k<<4 )];
+@@ -505,11 +453,7 @@
+        if (fewerThan24bits == EIGHTBIT) {
+            b1 = binaryData[dataIndex];
+            k = (byte) ( b1 &0x03 );
+-           if (fDebug) {
+-               System.out.println("b1=" + b1);
+-               System.out.println("b1<<2 = " + (b1>>2) );
+-           }
+-           byte val1 = ((b1 & SIGN)==0)?(byte)(b1>>2):(byte)((b1)>>2^0xc0);
++          byte val1 = ((b1 & SIGN)==0)?(byte)(b1>>2):(byte)((b1)>>2^0xc0);
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[ val1 ];
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[ k<<4 ];
+            encodedData[encodedIndex++] = PAD;
+@@ -534,23 +478,38 @@
+        return new String(encodedData);
+    }
+ 
+-   /**
+-    * Decodes Base64 data into octects
+-    *
+-    * @param encoded Byte array containing Base64 data
+-    * @return Array containind decoded data.
+-    * @throws Base64DecodingException
+-    */
+-   public final static byte[] decode(String encoded) throws Base64DecodingException {
++    /**
++     * Decodes Base64 data into octects
++     *
++     * @param encoded String containing base64 encoded data
++     * @return byte array containing the decoded data
++     * @throws Base64DecodingException if there is a problem decoding the data
++     */
++    public final static byte[] decode(String encoded) throws Base64DecodingException {
+ 
+-       if (encoded == null)
+-           return null;
++        if (encoded == null)
++                return null;
++        byte []bytes=new byte[encoded.length()];
++        int len=getBytesInternal(encoded, bytes);
++        return decodeInternal(bytes, len);
++        }
+ 
+-       return decodeInternal(encoded.getBytes());
+-   }
+-   protected final static byte[] decodeInternal(byte[] base64Data) throws Base64DecodingException {
++    protected static final int getBytesInternal(String s,byte[] result) {
++        int length=s.length();
++
++        int newSize=0;
++        for (int i = 0; i < length; i++) {
++            byte dataS=(byte)s.charAt(i);
++            if (!isWhiteSpace(dataS))
++                result[newSize++] = dataS;
++        }
++        return newSize;
++
++    }
++   protected final static byte[] decodeInternal(byte[] base64Data, int len) throws Base64DecodingException {
+        // remove white spaces
+-       int len = removeWhiteSpace(base64Data);
++           if (len==-1)
++          len = removeWhiteSpace(base64Data);
+ 
+        if (len%FOURBYTE != 0) {
+            throw new Base64DecodingException("decoding.divisible.four");
+@@ -629,7 +588,20 @@
+        }
+        return decodedData;
+    }
+-
++   /**
++    * Decodes Base64 data into  outputstream
++    *
++    * @param base64Data String containing Base64 data
++    * @param os the outputstream
++    * @throws IOException
++    * @throws Base64DecodingException
++    */
++   public final static void decode(String base64Data,
++        OutputStream os) throws Base64DecodingException, IOException {
++           byte[] bytes=new byte[base64Data.length()];
++           int len=getBytesInternal(base64Data, bytes);
++           decode(bytes,os,len);
++   }
+    /**
+     * Decodes Base64 data into  outputstream
+     *
+@@ -640,8 +612,14 @@
+     */
+    public final static void decode(byte[] base64Data,
+         OutputStream os) throws Base64DecodingException, IOException {
+-    // remove white spaces
+-    int len = removeWhiteSpace(base64Data);
++            decode(base64Data,os,-1);
++   }
++   protected final static void decode(byte[] base64Data,
++                        OutputStream os,int len) throws Base64DecodingException, IOException {
++
++        // remove white spaces
++    if (len==-1)
++       len = removeWhiteSpace(base64Data);
+ 
+     if (len%FOURBYTE != 0) {
+         throw new Base64DecodingException("decoding.divisible.four");
+@@ -798,7 +776,7 @@
+     * @param data  the byte array of base64 data (with WS)
+     * @return      the new length
+     */
+-   protected static int removeWhiteSpace(byte[] data) {
++   protected static final int removeWhiteSpace(byte[] data) {
+        if (data == null)
+            return 0;
+ 
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/CachedXPathAPIHolder.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/CachedXPathAPIHolder.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/CachedXPathAPIHolder.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/CachedXPathAPIHolder.java
+@@ -23,35 +23,33 @@
+ import com.sun.org.apache.xpath.internal.CachedXPathAPI;
+ import org.w3c.dom.Document;
+ 
+-
+ /**
+  * @author Raul Benito
+  */
+ public class CachedXPathAPIHolder {
+-         static java.util.logging.Logger log =
+-                java.util.logging.Logger.getLogger(CachedXPathAPIHolder.class.getName());
+ 
+     static ThreadLocal  local=new ThreadLocal();
+     static ThreadLocal localDoc=new ThreadLocal();
+ 
+-        /**
+-         * Sets the doc for the xpath transformation. Resets the cache if needed
+-         * @param doc
+-         */
+-        public static void setDoc(Document doc) {
+-       if (localDoc.get()!=doc) {
++    /**
++     * Sets the doc for the xpath transformation. Resets the cache if needed
++     * @param doc
++     */
++    public static void setDoc(Document doc) {
++        if (localDoc.get()!=doc) {
+             CachedXPathAPI cx=(CachedXPathAPI)local.get();
+             if (cx==null) {
+-               cx=new CachedXPathAPI();
+-               local.set(cx);
+-               localDoc.set(doc);
+-               return;
++                cx=new CachedXPathAPI();
++                local.set(cx);
++                localDoc.set(doc);
++                return;
+             }
+             //Different docs reset.
+             cx.getXPathContext().reset();
+             localDoc.set(doc);
+         }
+-        }
++    }
++
+     /**
+      * @return the cachexpathapi for this thread
+      */
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/CachedXPathFuncHereAPI.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/CachedXPathFuncHereAPI.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/CachedXPathFuncHereAPI.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/CachedXPathFuncHereAPI.java
+@@ -45,7 +45,7 @@
+ 
+ /**
+  *
+- * @author $Author: dims $
++ * @author $Author: mullan $
+  */
+ public class CachedXPathFuncHereAPI {
+ 
+@@ -291,6 +291,7 @@
+                                       .getDocumentElement()
+                                    : namespaceNode);
+ 
++      // only check if string points to different object (for performance)
+       if (str!=xpathStr) {
+         if (str.indexOf("here()")>0) {
+             _context.reset();
+@@ -340,6 +341,7 @@
+       //    XPathContext should be done away with.)
+       // Create the XPath object.
+       //String str = CachedXPathFuncHereAPI.getStrFromNode(xpathnode);
++    // only check if string points to different object (for performance)
+     if (str!=xpathStr) {
+         if (str.indexOf("here()")>0) {
+             _context.reset();
+@@ -421,7 +423,7 @@
+ 
+     private static void fixupFunctionTable() {
+         boolean installed = false;
+-        if (log.isLoggable(java.util.logging.Level.INFO))                                  log.log(java.util.logging.Level.INFO, "Registering Here function");
++        log.log(java.util.logging.Level.INFO, "Registering Here function");
+         /**
+          * Try to register our here() implementation as internal function.
+          */
+@@ -434,7 +436,7 @@
+                 installed = true;
+             }
+         } catch (Throwable t) {
+-            if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Error installing function using the static installFunction method", t);
++            log.log(java.util.logging.Level.FINE, "Error installing function using the static installFunction method", t);
+         }
+         if(!installed) {
+             try {
+@@ -445,15 +447,15 @@
+                 installFunction.invoke(_funcTable, params);
+                 installed = true;
+             } catch (Throwable t) {
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Error installing function using the static installFunction method", t);
++                log.log(java.util.logging.Level.FINE, "Error installing function using the static installFunction method", t);
+             }
+         }
+-        if (true) {
++        if (log.isLoggable(java.util.logging.Level.FINE)) {
+             if (installed) {
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Registered class " + FuncHere.class.getName()
++                log.log(java.util.logging.Level.FINE, "Registered class " + FuncHere.class.getName()
+                         + " for XPath function 'here()' function in internal table");
+             } else {
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Unable to register class " + FuncHere.class.getName()
++                log.log(java.util.logging.Level.FINE, "Unable to register class " + FuncHere.class.getName()
+                         + " for XPath function 'here()' function in internal table");
+             }
+         }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/ClassLoaderUtils.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/ClassLoaderUtils.java
+new file mode 100644
+--- /dev/null
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/ClassLoaderUtils.java
+@@ -0,0 +1,277 @@
++/*
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
++ */
++/**
++ * Licensed to the Apache Software Foundation (ASF) under one
++ * or more contributor license agreements. See the NOTICE file
++ * distributed with this work for additional information
++ * regarding copyright ownership. The ASF licenses this file
++ * to you under the Apache License, Version 2.0 (the
++ * "License"); you may not use this file except in compliance
++ * with the License. You may obtain a copy of the License at
++ *
++ * http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing,
++ * software distributed under the License is distributed on an
++ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
++ * KIND, either express or implied. See the License for the
++ * specific language governing permissions and limitations
++ * under the License.
++ */
++
++package com.sun.org.apache.xml.internal.security.utils;
++
++import java.io.IOException;
++import java.io.InputStream;
++import java.net.URL;
++import java.util.ArrayList;
++import java.util.Enumeration;
++import java.util.List;
++
++/**
++ * This class is extremely useful for loading resources and classes in a fault
++ * tolerant manner that works across different applications servers. Do not
++ * touch this unless you're a grizzled classloading guru veteran who is going to
++ * verify any change on 6 different application servers.
++ */
++public final class ClassLoaderUtils {
++
++    /** {@link org.apache.commons.logging} logging facility */
++    private static final java.util.logging.Logger log =
++        java.util.logging.Logger.getLogger(ClassLoaderUtils.class.getName());
++
++    private ClassLoaderUtils() {
++    }
++
++    /**
++     * Load a given resource. <p/> This method will try to load the resource
++     * using the following methods (in order):
++     * <ul>
++     * <li>From Thread.currentThread().getContextClassLoader()
++     * <li>From ClassLoaderUtil.class.getClassLoader()
++     * <li>callingClass.getClassLoader()
++     * </ul>
++     *
++     * @param resourceName The name of the resource to load
++     * @param callingClass The Class object of the calling object
++     */
++    public static URL getResource(String resourceName, Class<?> callingClass) {
++        URL url = Thread.currentThread().getContextClassLoader().getResource(resourceName);
++        if (url == null && resourceName.startsWith("/")) {
++            //certain classloaders need it without the leading /
++            url =
++                Thread.currentThread().getContextClassLoader().getResource(
++                    resourceName.substring(1)
++                );
++        }
++
++        ClassLoader cluClassloader = ClassLoaderUtils.class.getClassLoader();
++        if (cluClassloader == null) {
++            cluClassloader = ClassLoader.getSystemClassLoader();
++        }
++        if (url == null) {
++            url = cluClassloader.getResource(resourceName);
++        }
++        if (url == null && resourceName.startsWith("/")) {
++            //certain classloaders need it without the leading /
++            url = cluClassloader.getResource(resourceName.substring(1));
++        }
++
++        if (url == null) {
++            ClassLoader cl = callingClass.getClassLoader();
++
++            if (cl != null) {
++                url = cl.getResource(resourceName);
++            }
++        }
++
++        if (url == null) {
++            url = callingClass.getResource(resourceName);
++        }
++
++        if ((url == null) && (resourceName != null) && (resourceName.charAt(0) != '/')) {
++            return getResource('/' + resourceName, callingClass);
++        }
++
++        return url;
++    }
++
++    /**
++     * Load a given resources. <p/> This method will try to load the resources
++     * using the following methods (in order):
++     * <ul>
++     * <li>From Thread.currentThread().getContextClassLoader()
++     * <li>From ClassLoaderUtil.class.getClassLoader()
++     * <li>callingClass.getClassLoader()
++     * </ul>
++     *
++     * @param resourceName The name of the resource to load
++     * @param callingClass The Class object of the calling object
++     */
++    public static List<URL> getResources(String resourceName, Class<?> callingClass) {
++        List<URL> ret = new ArrayList<URL>();
++        Enumeration<URL> urls = new Enumeration<URL>() {
++            public boolean hasMoreElements() {
++                return false;
++            }
++            public URL nextElement() {
++                return null;
++            }
++
++        };
++        try {
++            urls = Thread.currentThread().getContextClassLoader().getResources(resourceName);
++        } catch (IOException e) {
++            if (log.isLoggable(java.util.logging.Level.FINE)) {
++                log.log(java.util.logging.Level.FINE, e.getMessage(), e);
++            }
++            //ignore
++        }
++        if (!urls.hasMoreElements() && resourceName.startsWith("/")) {
++            //certain classloaders need it without the leading /
++            try {
++                urls =
++                    Thread.currentThread().getContextClassLoader().getResources(
++                        resourceName.substring(1)
++                    );
++            } catch (IOException e) {
++                if (log.isLoggable(java.util.logging.Level.FINE)) {
++                    log.log(java.util.logging.Level.FINE, e.getMessage(), e);
++                }
++                // ignore
++            }
++        }
++
++        ClassLoader cluClassloader = ClassLoaderUtils.class.getClassLoader();
++        if (cluClassloader == null) {
++            cluClassloader = ClassLoader.getSystemClassLoader();
++        }
++        if (!urls.hasMoreElements()) {
++            try {
++                urls = cluClassloader.getResources(resourceName);
++            } catch (IOException e) {
++                if (log.isLoggable(java.util.logging.Level.FINE)) {
++                    log.log(java.util.logging.Level.FINE, e.getMessage(), e);
++                }
++                // ignore
++            }
++        }
++        if (!urls.hasMoreElements() && resourceName.startsWith("/")) {
++            //certain classloaders need it without the leading /
++            try {
++                urls = cluClassloader.getResources(resourceName.substring(1));
++            } catch (IOException e) {
++                if (log.isLoggable(java.util.logging.Level.FINE)) {
++                    log.log(java.util.logging.Level.FINE, e.getMessage(), e);
++                }
++                // ignore
++            }
++        }
++
++        if (!urls.hasMoreElements()) {
++            ClassLoader cl = callingClass.getClassLoader();
++
++            if (cl != null) {
++                try {
++                    urls = cl.getResources(resourceName);
++                } catch (IOException e) {
++                    if (log.isLoggable(java.util.logging.Level.FINE)) {
++                        log.log(java.util.logging.Level.FINE, e.getMessage(), e);
++                    }
++                    // ignore
++                }
++            }
++        }
++
++        if (!urls.hasMoreElements()) {
++            URL url = callingClass.getResource(resourceName);
++            if (url != null) {
++                ret.add(url);
++            }
++        }
++        while (urls.hasMoreElements()) {
++            ret.add(urls.nextElement());
++        }
++
++
++        if (ret.isEmpty() && (resourceName != null) && (resourceName.charAt(0) != '/')) {
++            return getResources('/' + resourceName, callingClass);
++        }
++        return ret;
++    }
++
++
++    /**
++     * This is a convenience method to load a resource as a stream. <p/> The
++     * algorithm used to find the resource is given in getResource()
++     *
++     * @param resourceName The name of the resource to load
++     * @param callingClass The Class object of the calling object
++     */
++    public static InputStream getResourceAsStream(String resourceName, Class<?> callingClass) {
++        URL url = getResource(resourceName, callingClass);
++
++        try {
++            return (url != null) ? url.openStream() : null;
++        } catch (IOException e) {
++            if (log.isLoggable(java.util.logging.Level.FINE)) {
++                log.log(java.util.logging.Level.FINE, e.getMessage(), e);
++            }
++            return null;
++        }
++    }
++
++    /**
++     * Load a class with a given name. <p/> It will try to load the class in the
++     * following order:
++     * <ul>
++     * <li>From Thread.currentThread().getContextClassLoader()
++     * <li>Using the basic Class.forName()
++     * <li>From ClassLoaderUtil.class.getClassLoader()
++     * <li>From the callingClass.getClassLoader()
++     * </ul>
++     *
++     * @param className The name of the class to load
++     * @param callingClass The Class object of the calling object
++     * @throws ClassNotFoundException If the class cannot be found anywhere.
++     */
++    public static Class<?> loadClass(String className, Class<?> callingClass)
++        throws ClassNotFoundException {
++        try {
++            ClassLoader cl = Thread.currentThread().getContextClassLoader();
++
++            if (cl != null) {
++                return cl.loadClass(className);
++            }
++        } catch (ClassNotFoundException e) {
++            if (log.isLoggable(java.util.logging.Level.FINE)) {
++                log.log(java.util.logging.Level.FINE, e.getMessage(), e);
++            }
++            //ignore
++        }
++        return loadClass2(className, callingClass);
++    }
++
++    private static Class<?> loadClass2(String className, Class<?> callingClass)
++        throws ClassNotFoundException {
++        try {
++            return Class.forName(className);
++        } catch (ClassNotFoundException ex) {
++            try {
++                if (ClassLoaderUtils.class.getClassLoader() != null) {
++                    return ClassLoaderUtils.class.getClassLoader().loadClass(className);
++                }
++            } catch (ClassNotFoundException exc) {
++                if (callingClass != null && callingClass.getClassLoader() != null) {
++                    return callingClass.getClassLoader().loadClass(className);
++                }
++            }
++            if (log.isLoggable(java.util.logging.Level.FINE)) {
++                log.log(java.util.logging.Level.FINE, ex.getMessage(), ex);
++            }
++            throw ex;
++        }
++    }
++}
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/Constants.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/Constants.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/Constants.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/Constants.java
+@@ -20,11 +20,8 @@
+  */
+ package com.sun.org.apache.xml.internal.security.utils;
+ 
+-
+-
+ import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
+ 
+-
+ /**
+  * Provides all constants and some translation functions for i18n.
+  *
+@@ -32,14 +29,10 @@
+  * <A HREF="http://www.w3.org/TR/xmldsig-core/#sec-TransformAlg">XML
+  * Signature specification</A>.
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class Constants {
+ 
+-   /** {@link java.util.logging} logging facility */
+-   static java.util.logging.Logger log =
+-        java.util.logging.Logger.getLogger(Constants.class.getName());
+-
+    /** Field configurationFile */
+    public static final String configurationFile = "data/websig.conf";
+ 
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/DigesterOutputStream.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/DigesterOutputStream.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/DigesterOutputStream.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/DigesterOutputStream.java
+@@ -3,7 +3,7 @@
+  * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * Copyright  1999-2004 The Apache Software Foundation.
++ * Copyright 1999-2008 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.
+@@ -29,34 +29,40 @@
+  *
+  */
+ public class DigesterOutputStream extends ByteArrayOutputStream {
+-    final static byte none[]="error".getBytes();
+     final MessageDigestAlgorithm mda;
+-        /**
+-         * @param mda
+-         */
+-        public DigesterOutputStream(MessageDigestAlgorithm mda) {
++    static java.util.logging.Logger log =
++        java.util.logging.Logger.getLogger
++        (DigesterOutputStream.class.getName());
++
++    /**
++     * @param mda
++     */
++    public DigesterOutputStream(MessageDigestAlgorithm mda) {
+         this.mda=mda;
+-        }
++    }
+ 
+     /** @inheritDoc */
+-        public byte[] toByteArray() {
+-                return none;
+-        }
+-
+-        /** @inheritDoc */
+-        public void write(byte[] arg0) {
+-                mda.update(arg0);
+-        }
++    public void write(byte[] arg0) {
++        write(arg0, 0, arg0.length);
++    }
+ 
+     /** @inheritDoc */
+-        public void write(int arg0) {
+-                mda.update((byte)arg0);
+-        }
++    public void write(int arg0) {
++        mda.update((byte)arg0);
++    }
+ 
+     /** @inheritDoc */
+-        public void write(byte[] arg0, int arg1, int arg2) {
+-                mda.update(arg0, arg1, arg2);
++    public void write(byte[] arg0, int arg1, int arg2) {
++        if (log.isLoggable(java.util.logging.Level.FINE)) {
++            log.log(java.util.logging.Level.FINE, "Pre-digested input:");
++            StringBuffer sb = new StringBuffer(arg2);
++            for (int i=arg1; i<(arg1+arg2); i++) {
++                sb.append((char) arg0[i]);
++            }
++            log.log(java.util.logging.Level.FINE, sb.toString());
+         }
++        mda.update(arg0, arg1, arg2);
++    }
+ 
+     /**
+      * @return the digest value
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/ElementChecker.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/ElementChecker.java
+new file mode 100644
+--- /dev/null
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/ElementChecker.java
+@@ -0,0 +1,17 @@
++package com.sun.org.apache.xml.internal.security.utils;
++
++import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
++import org.w3c.dom.Element;
++import org.w3c.dom.Node;
++
++public interface ElementChecker {
++         /**
++          * Check that the elemnt is the one expect
++          *
++          * @throws XMLSecurityException
++          */
++           public void guaranteeThatElementInCorrectSpace(ElementProxy expected, Element actual)
++                   throws XMLSecurityException;
++
++           public boolean isNamespaceElement(Node el, String type, String ns);
++}
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/ElementCheckerImpl.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/ElementCheckerImpl.java
+new file mode 100644
+--- /dev/null
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/ElementCheckerImpl.java
+@@ -0,0 +1,60 @@
++package com.sun.org.apache.xml.internal.security.utils;
++
++import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
++import org.w3c.dom.Element;
++import org.w3c.dom.Node;
++
++public abstract class ElementCheckerImpl implements ElementChecker {
++        public boolean isNamespaceElement(Node el, String type, String ns) {
++                if ((el == null) ||
++                   ns!=el.getNamespaceURI() || !el.getLocalName().equals(type)){
++                   return false;
++                }
++
++                return true;
++        }
++        /** A checker for DOM that interns NS */
++        public static class InternedNsChecker extends ElementCheckerImpl{
++                public void guaranteeThatElementInCorrectSpace(ElementProxy expected,
++                                Element actual) throws XMLSecurityException {
++
++                      String localnameSHOULDBE = expected.getBaseLocalName();
++                      String namespaceSHOULDBE = expected.getBaseNamespace();
++
++                      String localnameIS = actual.getLocalName();
++                      String namespaceIS = actual.getNamespaceURI();
++                      if ((namespaceSHOULDBE!=namespaceIS) ||
++                       !localnameSHOULDBE.equals(localnameIS) ) {
++                         Object exArgs[] = { namespaceIS +":"+ localnameIS,
++                           namespaceSHOULDBE +":"+ localnameSHOULDBE};
++                         throw new XMLSecurityException("xml.WrongElement", exArgs);
++                      }
++                }
++        }
++
++        /** A checker for DOM that interns NS */
++        public static class FullChecker extends ElementCheckerImpl {
++                public void guaranteeThatElementInCorrectSpace(ElementProxy expected,
++                                Element actual) throws XMLSecurityException {
++
++                      String localnameSHOULDBE = expected.getBaseLocalName();
++                      String namespaceSHOULDBE = expected.getBaseNamespace();
++
++                      String localnameIS = actual.getLocalName();
++                      String namespaceIS = actual.getNamespaceURI();
++                      if ((!namespaceSHOULDBE.equals(namespaceIS)) ||
++                       !localnameSHOULDBE.equals(localnameIS) ) {
++                         Object exArgs[] = { namespaceIS +":"+ localnameIS,
++                           namespaceSHOULDBE +":"+ localnameSHOULDBE};
++                         throw new XMLSecurityException("xml.WrongElement", exArgs);
++                      }
++                }
++        }
++
++        /** An empty checker if schema checking is used */
++        public static class EmptyChecker extends ElementCheckerImpl {
++                public void guaranteeThatElementInCorrectSpace(ElementProxy expected,
++                                Element actual) throws XMLSecurityException {
++                }
++        }
++}
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/ElementProxy.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/ElementProxy.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/ElementProxy.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/ElementProxy.java
+@@ -3,7 +3,7 @@
+  * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * Copyright  1999-2004 The Apache Software Foundation.
++ * Copyright 1999-2008 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.
+@@ -46,26 +46,6 @@
+    /** {@link java.util.logging} logging facility */
+     static java.util.logging.Logger log =
+         java.util.logging.Logger.getLogger(ElementProxy.class.getName());
+-   //J-
+-    /** The element has been created by the code **/
+-   public static final int MODE_CREATE  = 0;
+-   /** The element has been readed from a DOM tree by the code **/
+-   public static final int MODE_PROCESS = 1;
+-   /** The element isn't known if it is readen or created **/
+-   public static final int MODE_UNKNOWN = 2;
+-
+-   /** The element is going to be signed **/
+-   public static final int MODE_SIGN    = MODE_CREATE;
+-   /** The element is going to be verified **/
+-   public static final int MODE_VERIFY  = MODE_PROCESS;
+-
+-   /** The element is going to be encrypted **/
+-   public static final int MODE_ENCRYPT = MODE_CREATE;
+-   /** The element is going to be decrypted **/
+-   public static final int MODE_DECRYPT = MODE_PROCESS;
+-
+-   protected int _state = MODE_UNKNOWN;
+-   //J+
+ 
+    /**
+     * Returns the namespace of the Elements of the sub-class.
+@@ -95,11 +75,6 @@
+     *
+     */
+    public ElementProxy() {
+-
+-      this._doc = null;
+-      this._state = ElementProxy.MODE_UNKNOWN;
+-      this._baseURI = null;
+-      this._constructionElement = null;
+    }
+ 
+    /**
+@@ -108,18 +83,43 @@
+     * @param doc
+     */
+    public ElementProxy(Document doc) {
+-
+-      this();
+-
+       if (doc == null) {
+          throw new RuntimeException("Document is null");
+       }
+ 
+       this._doc = doc;
+-      this._state = ElementProxy.MODE_CREATE;
+-      this._constructionElement = ElementProxy.createElementForFamily(this._doc,
+-              this.getBaseNamespace(), this.getBaseLocalName());
++      this._constructionElement = createElementForFamilyLocal(this._doc,
++                  this.getBaseNamespace(), this.getBaseLocalName());
+    }
++   protected Element createElementForFamilyLocal(Document doc, String namespace,
++           String localName) {
++                  Element result = null;
++              if (namespace == null) {
++                 result = doc.createElementNS(null, localName);
++              } else {
++                  String baseName=this.getBaseNamespace();
++                  String prefix=ElementProxy.getDefaultPrefix(baseName);
++                 if ((prefix == null) || (prefix.length() == 0)) {
++                    result = doc.createElementNS(namespace, localName);
++
++                    result.setAttributeNS(Constants.NamespaceSpecNS, "xmlns",
++                                          namespace);
++                 } else {
++                         String tagName=null;
++                         String defaultPrefixNaming=ElementProxy.getDefaultPrefixBindings(baseName);
++                         StringBuffer sb=new StringBuffer(prefix);
++                         sb.append(':');
++                         sb.append(localName);
++                         tagName=sb.toString();
++                    result = doc.createElementNS(namespace, tagName );
++
++                    result.setAttributeNS(Constants.NamespaceSpecNS,  defaultPrefixNaming,
++                                          namespace);
++                 }
++              }
++              return result;
++}
++
+ 
+    /**
+     * This method creates an Element in a given namespace with a given localname.
+@@ -150,7 +150,7 @@
+          } else {
+             result = doc.createElementNS(namespace, prefix + ":" + localName);
+ 
+-            result.setAttributeNS(Constants.NamespaceSpecNS, "xmlns:" + prefix,
++            result.setAttributeNS(Constants.NamespaceSpecNS,  ElementProxy.getDefaultPrefixBindings(namespace),
+                                   namespace);
+          }
+       }
+@@ -171,15 +171,12 @@
+       if (element == null) {
+          throw new XMLSecurityException("ElementProxy.nullElement");
+       }
+-      if (true) {
+-      }
+ 
+-      if (true) {
+-        if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "setElement(" + element.getTagName() + ", \"" + BaseURI + "\"");
++      if (log.isLoggable(java.util.logging.Level.FINE)) {
++        log.log(java.util.logging.Level.FINE, "setElement(" + element.getTagName() + ", \"" + BaseURI + "\"");
+       }
+ 
+       this._doc = element.getOwnerDocument();
+-      this._state = ElementProxy.MODE_PROCESS;
+       this._constructionElement = element;
+       this._baseURI = BaseURI;
+    }
+@@ -193,20 +190,16 @@
+     */
+    public ElementProxy(Element element, String BaseURI)
+            throws XMLSecurityException {
+-
+-      this();
+-
+       if (element == null) {
+          throw new XMLSecurityException("ElementProxy.nullElement");
+       }
+ 
+-      if (true) {
+-        if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "setElement(\"" + element.getTagName() + "\", \"" + BaseURI
++      if (log.isLoggable(java.util.logging.Level.FINE)) {
++        log.log(java.util.logging.Level.FINE, "setElement(\"" + element.getTagName() + "\", \"" + BaseURI
+                 + "\")");
+       }
+ 
+       this._doc = element.getOwnerDocument();
+-      this._state = ElementProxy.MODE_PROCESS;
+       this._constructionElement = element;
+       this._baseURI = BaseURI;
+ 
+@@ -256,25 +249,18 @@
+       return this._baseURI;
+    }
+ 
++   static ElementChecker checker = new ElementCheckerImpl.InternedNsChecker();
++
+    /**
+     * Method guaranteeThatElementInCorrectSpace
+     *
+     * @throws XMLSecurityException
+     */
+-   public void guaranteeThatElementInCorrectSpace()
++   void guaranteeThatElementInCorrectSpace()
+            throws XMLSecurityException {
+ 
+-      String localnameSHOULDBE = this.getBaseLocalName();
+-      String namespaceSHOULDBE = this.getBaseNamespace();
++          checker.guaranteeThatElementInCorrectSpace(this,this._constructionElement);
+ 
+-      String localnameIS = this._constructionElement.getLocalName();
+-      String namespaceIS = this._constructionElement.getNamespaceURI();
+-      if ( !localnameSHOULDBE.equals(localnameIS) ||
+-        !namespaceSHOULDBE.equals(namespaceIS)) {
+-         Object exArgs[] = { namespaceIS +":"+ localnameIS,
+-           namespaceSHOULDBE +":"+ localnameSHOULDBE};
+-         throw new XMLSecurityException("xml.WrongElement", exArgs);
+-      }
+    }
+ 
+    /**
+@@ -308,7 +294,9 @@
+          Element e = Base64.encodeToElement(this._doc, localname, bytes);
+ 
+          this._constructionElement.appendChild(e);
+-         this._constructionElement.appendChild(this._doc.createTextNode("\n"));
++         if (!XMLUtils.ignoreLineBreaks()) {
++            this._constructionElement.appendChild(this._doc.createTextNode("\n"));
++         }
+       }
+    }
+ 
+@@ -336,8 +324,9 @@
+    public void addBase64Text(byte[] bytes) {
+ 
+       if (bytes != null) {
+-         Text t = this._doc.createTextNode("\n" + Base64.encode(bytes) + "\n");
+-
++         Text t = XMLUtils.ignoreLineBreaks()
++             ? this._doc.createTextNode(Base64.encode(bytes))
++             : this._doc.createTextNode("\n" + Base64.encode(bytes) + "\n");
+          this._constructionElement.appendChild(t);
+       }
+    }
+@@ -375,7 +364,7 @@
+ 
+    /**
+     * Method getBytesFromChildElement
+-    *
++    * @deprecated
+     * @param localname
+     * @param namespace
+     * @return the bytes
+@@ -416,28 +405,24 @@
+    /**
+     * Method getBytesFromTextChild
+     *
+-    * @return The base64 bytes from the first text child of this element
++    * @return The base64 bytes from the text children of this element
+     * @throws XMLSecurityException
+     */
+    public byte[] getBytesFromTextChild() throws XMLSecurityException {
+-
+-         Text t = (Text)this._constructionElement.getFirstChild();
+-
+-
+-         return Base64.decode(t.getData());
++      return Base64.decode
++         (XMLUtils.getFullTextChildrenFromElement(this._constructionElement));
+    }
+ 
+    /**
+     * Method getTextFromTextChild
+     *
+-    * @return the Text obtained concatening all the the text nodes of this element
++    * @return the Text obtained by concatenating all the text nodes of this
++    *    element
+     */
+    public String getTextFromTextChild() {
+       return XMLUtils.getFullTextChildrenFromElement(this._constructionElement);
+    }
+ 
+-
+-
+    /**
+     * Method length
+     *
+@@ -451,7 +436,7 @@
+             while (sibling!=null) {
+                 if (localname.equals(sibling.getLocalName())
+                                 &&
+-                                        namespace.equals(sibling.getNamespaceURI())) {
++                                        namespace==sibling.getNamespaceURI() ) {
+                         number++;
+                 }
+                 sibling=sibling.getNextSibling();
+@@ -509,39 +494,49 @@
+ 
+    /** Field _prefixMappings */
+    static HashMap _prefixMappings = new HashMap();
++   static HashMap _prefixMappingsBindings = new HashMap();
+ 
+-   /**
+-    * Method setDefaultPrefix
+-    *
+-    * @param namespace
+-    * @param prefix
+-    * @throws XMLSecurityException
+-    */
+-   public static void setDefaultPrefix(String namespace, String prefix)
+-           throws XMLSecurityException {
++    /**
++     * Method setDefaultPrefix
++     *
++     * @param namespace
++     * @param prefix
++     * @throws XMLSecurityException
++     */
++    public static void setDefaultPrefix(String namespace, String prefix)
++        throws XMLSecurityException {
+ 
+         if (ElementProxy._prefixMappings.containsValue(prefix)) {
+ 
+-                Object storedNamespace=ElementProxy._prefixMappings.get(namespace);
+-         if (!storedNamespace.equals(prefix)) {
++            Object storedNamespace=ElementProxy._prefixMappings.get(namespace);
++            if (!storedNamespace.equals(prefix)) {
+                 Object exArgs[] = { prefix, namespace, storedNamespace };
+ 
+                 throw new XMLSecurityException("prefix.AlreadyAssigned", exArgs);
+-         }
+-    }
+-      ElementProxy._prefixMappings.put(namespace, prefix);
++            }
++        }
++        if (Constants.SignatureSpecNS.equals(namespace)) {
++            XMLUtils.dsPrefix=prefix;
++        }
++        ElementProxy._prefixMappings.put(namespace, prefix.intern());
++        if (prefix.length() == 0) {
++            ElementProxy._prefixMappingsBindings.put(namespace, "xmlns");
++        } else {
++            ElementProxy._prefixMappingsBindings.put(namespace, ("xmlns:"+prefix).intern());
++        }
+    }
+ 
+-   /**
+-    * Method getDefaultPrefix
+-    *
+-    * @param namespace
+-    * @return the default prefix bind to this element.
+-    */
+-   public static String getDefaultPrefix(String namespace) {
++    /**
++     * Method getDefaultPrefix
++     *
++     * @param namespace
++     * @return the default prefix bind to this element.
++     */
++    public static String getDefaultPrefix(String namespace) {
++        return (String) ElementProxy._prefixMappings.get(namespace);
++    }
+ 
+-      String prefix = (String) ElementProxy._prefixMappings.get(namespace);
+-
+-      return prefix;
+-   }
++    public static String getDefaultPrefixBindings(String namespace) {
++        return (String) ElementProxy._prefixMappingsBindings.get(namespace);
++    }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/EncryptionConstants.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/EncryptionConstants.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/EncryptionConstants.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/EncryptionConstants.java
+@@ -27,7 +27,7 @@
+ 
+ /**
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class EncryptionConstants {
+    //J-
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/EncryptionElementProxy.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/EncryptionElementProxy.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/EncryptionElementProxy.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/EncryptionElementProxy.java
+@@ -31,7 +31,7 @@
+  * This is the base object for all objects which map directly to an Element from
+  * the xenc spec.
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public abstract class EncryptionElementProxy extends ElementProxy {
+ 
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/HelperNodeList.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/HelperNodeList.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/HelperNodeList.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/HelperNodeList.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -21,30 +20,21 @@
+  */
+ package com.sun.org.apache.xml.internal.security.utils;
+ 
+-
+-
+ import java.util.ArrayList;
+ 
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Node;
+ import org.w3c.dom.NodeList;
+ 
+-
+ /**
+  *
+- *
+  * @author Christian Geuer-Pollmann
+  *
+  */
+ public class HelperNodeList implements NodeList {
+ 
+-   /** {@link java.util.logging} logging facility */
+-    static java.util.logging.Logger log =
+-    java.util.logging.Logger.getLogger(HelperNodeList.class.getName());
+-
+    /** Field nodes */
+    ArrayList nodes = new ArrayList(20);
+-
+    boolean _allNodesMustHaveSameParent = false;
+ 
+    /**
+@@ -70,7 +60,7 @@
+     */
+    public Node item(int index) {
+ 
+-      // if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "item(" + index + ") of " + this.getLength() + " nodes");
++      // log.log(java.util.logging.Level.FINE, "item(" + index + ") of " + this.getLength() + " nodes");
+ 
+       return (Node) nodes.get(index);
+    }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/I18n.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/I18n.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/I18n.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/I18n.java
+@@ -20,18 +20,13 @@
+  */
+ package com.sun.org.apache.xml.internal.security.utils;
+ 
+-
+-
+ import java.text.MessageFormat;
+ import java.util.Locale;
+ import java.util.ResourceBundle;
+ 
+-
+ /**
+  * The Internationalization (I18N) pack.
+  *
+- *
+- *
+  * @author Christian Geuer-Pollmann
+  */
+ public class I18n {
+@@ -50,8 +45,8 @@
+ 
+    /** Field resourceBundle */
+    private static ResourceBundle resourceBundle =
+-      ResourceBundle.getBundle
+-        (Constants.exceptionMessagesResourceBundleBase, Locale.US);
++       ResourceBundle.getBundle
++         (Constants.exceptionMessagesResourceBundleBase, Locale.US);
+ 
+    /** Field alreadyInitialized */
+    private static boolean alreadyInitialized = false;
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/IdResolver.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/IdResolver.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/IdResolver.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/IdResolver.java
+@@ -20,18 +20,16 @@
+  */
+ package com.sun.org.apache.xml.internal.security.utils;
+ 
+-
+-
++import java.lang.ref.WeakReference;
++import java.util.Arrays;
++import java.util.WeakHashMap;
+ 
+ import org.w3c.dom.Attr;
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
++import org.w3c.dom.NamedNodeMap;
+ import org.w3c.dom.Node;
+ 
+-import java.util.Arrays;
+-import java.util.WeakHashMap;
+-import java.lang.ref.WeakReference;
+-
+ 
+ /**
+  * Purpose of this class is to enable the XML Parser to keep track of ID
+@@ -45,193 +43,242 @@
+  * ID: We know that all <CODE>@Id</CODE> attributes in an Element from the XML
+  * Signature namespace are of type <CODE>ID</CODE>.
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  * @see <A HREF="http://www.xml.com/lpt/a/2001/11/07/id.html">"Identity Crisis" on xml.com</A>
+  */
+ public class IdResolver {
+ 
+-   /** {@link java.util.logging} logging facility */
+-    static java.util.logging.Logger log =
++    /** {@link java.util.logging} logging facility */
++    private static java.util.logging.Logger log =
+         java.util.logging.Logger.getLogger(IdResolver.class.getName());
+ 
+-   static WeakHashMap docMap = new WeakHashMap();
++    private static WeakHashMap docMap = new WeakHashMap();
+ 
+-   /**
+-    * Constructor IdResolver
+-    *
+-    */
+-   private IdResolver() {
++    /**
++     * Constructor IdResolver
++     *
++     */
++    private IdResolver() {
++       // we don't allow instantiation
++    }
+ 
+-      // we don't allow instantiation
+-   }
++    /**
++     * Method registerElementById
++     *
++     * @param element the element to register
++     * @param idValue the value of the ID attribute
++     */
++    public static void registerElementById(Element element, String idValue) {
++        Document doc = element.getOwnerDocument();
++        WeakHashMap elementMap = (WeakHashMap) docMap.get(doc);
++        if(elementMap == null) {
++            elementMap = new WeakHashMap();
++            docMap.put(doc, elementMap);
++        }
++        elementMap.put(idValue, new WeakReference(element));
++    }
+ 
+-   /**
+-    * Method registerElementById
+-    *
+-    * @param element
+-    * @param idValue
+-    */
+-   public static void registerElementById(Element element, String idValue) {
+-      Document doc = element.getOwnerDocument();
+-      WeakHashMap elementMap = (WeakHashMap) docMap.get(doc);
+-      if(elementMap == null) {
+-          elementMap = new WeakHashMap();
+-          docMap.put(doc, elementMap);
+-      }
+-      elementMap.put(idValue, new WeakReference(element));
+-   }
++    /**
++     * Method registerElementById
++     *
++     * @param element the element to register
++     * @param id the ID attribute
++     */
++    public static void registerElementById(Element element, Attr id) {
++        IdResolver.registerElementById(element, id.getNodeValue());
++    }
+ 
+-   /**
+-    * Method registerElementById
+-    *
+-    * @param element
+-    * @param id
+-    */
+-   public static void registerElementById(Element element, Attr id) {
+-      IdResolver.registerElementById(element, id.getNodeValue());
+-   }
++    /**
++     * Method getElementById
++     *
++     * @param doc the document
++     * @param id the value of the ID
++     * @return the element obtained by the id, or null if it is not found.
++     */
++    public static Element getElementById(Document doc, String id) {
+ 
+-   /**
+-    * Method getElementById
+-    *
+-    * @param doc
+-    * @param id
+-    * @return the element obtained by the Id, or null if it is not found.
+-    */
+-   public static Element getElementById(Document doc, String id) {
++        Element result = IdResolver.getElementByIdType(doc, id);
+ 
+-      Element result = null;
+-
+-      result = IdResolver.getElementByIdType(doc, id);
+-
+-      if (result != null) {
+-         if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE,
++        if (result != null) {
++            log.log(java.util.logging.Level.FINE,
+             "I could find an Element using the simple getElementByIdType method: "
+             + result.getTagName());
+ 
+-         return result;
+-      }
++            return result;
++        }
+ 
+-       result = IdResolver.getElementByIdUsingDOM(doc, id);
++        result = IdResolver.getElementByIdUsingDOM(doc, id);
+ 
+-       if (result != null) {
+-          if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE,
++        if (result != null) {
++            log.log(java.util.logging.Level.FINE,
+              "I could find an Element using the simple getElementByIdUsingDOM method: "
+             + result.getTagName());
+ 
+-         return result;
+-      }
+-       // this must be done so that Xalan can catch ALL namespaces
+-       //XMLUtils.circumventBug2650(doc);
+-      result = IdResolver.getElementBySearching(doc, id);
++            return result;
++        }
++        // this must be done so that Xalan can catch ALL namespaces
++        //XMLUtils.circumventBug2650(doc);
++        result = IdResolver.getElementBySearching(doc, id);
+ 
+-      if (result != null) {
+-                  IdResolver.registerElementById(result, id);
++        if (result != null) {
++            IdResolver.registerElementById(result, id);
+ 
+-         return result;
+-      }
++            return result;
++        }
+ 
+-      return null;
+-   }
++        return null;
++    }
+ 
+ 
+     /**
+      * Method getElementByIdUsingDOM
+      *
+-     * @param doc
+-     * @param id
+-     * @return the element obtained by the Id, or null if it is not found.
++     * @param doc the document
++     * @param id the value of the ID
++     * @return the element obtained by the id, or null if it is not found.
+      */
+     private static Element getElementByIdUsingDOM(Document doc, String id) {
+-        if (true)
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "getElementByIdUsingDOM() Search for ID " + id);
++        if (log.isLoggable(java.util.logging.Level.FINE))
++            log.log(java.util.logging.Level.FINE, "getElementByIdUsingDOM() Search for ID " + id);
+         return doc.getElementById(id);
+     }
+ 
+-   /**
+-    * Method getElementByIdType
+-    *
+-    * @param doc
+-    * @param id
+-    * @return the element obtained by the Id, or null if it is not found.
+-    */
+-   private static Element getElementByIdType(Document doc, String id) {
+-          if (true)
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "getElementByIdType() Search for ID " + id);
+-       WeakHashMap elementMap = (WeakHashMap) docMap.get(doc);
+-       if (elementMap != null) {
+-           WeakReference weakReference = (WeakReference) elementMap.get(id);
+-           if (weakReference != null)
+-           {
++    /**
++     * Method getElementByIdType
++     *
++     * @param doc the document
++     * @param id the value of the ID
++     * @return the element obtained by the id, or null if it is not found.
++     */
++    private static Element getElementByIdType(Document doc, String id) {
++        if (log.isLoggable(java.util.logging.Level.FINE))
++            log.log(java.util.logging.Level.FINE, "getElementByIdType() Search for ID " + id);
++        WeakHashMap elementMap = (WeakHashMap) docMap.get(doc);
++        if (elementMap != null) {
++            WeakReference weakReference = (WeakReference) elementMap.get(id);
++            if (weakReference != null) {
+                 return (Element) weakReference.get();
+-           }
+-       }
+-       return null;
+-   }
++            }
++        }
++        return null;
++    }
+ 
++    private static java.util.List names;
++    private static int namesLength;
++    static {
++        String namespaces[]={
++            Constants.SignatureSpecNS,
++            EncryptionConstants.EncryptionSpecNS,
++            "http://schemas.xmlsoap.org/soap/security/2000-12",
++            "http://www.w3.org/2002/03/xkms#",
++            "urn:oasis:names:tc:SAML:1.0:assertion",
++            "urn:oasis:names:tc:SAML:1.0:protocol"
++        };
++        names = Arrays.asList(namespaces);
++        namesLength = names.size();
++    }
+ 
+-   static java.util.List names;
+-   static {
+-           String namespaces[]={ Constants.SignatureSpecNS,
+-                           EncryptionConstants.EncryptionSpecNS,
+-                           "http://schemas.xmlsoap.org/soap/security/2000-12",
+-                           "http://www.w3.org/2002/03/xkms#"
+-                   };
+-           names=Arrays.asList(namespaces);
+-   }
+ 
++    private static Element getElementBySearching(Node root,String id) {
++        Element []els=new Element[namesLength + 1];
++        getEl(root,id,els);
++        for (int i=0;i<els.length;i++) {
++            if (els[i]!=null) {
++                return els[i];
++            }
++        }
++        return null;
++    }
+ 
+-   private static Element getElementBySearching(Node root,String id) {
+-           Element []els=new Element[5];
+-           getElementBySearching(root,id,els);
+-           for (int i=0;i<els.length;i++) {
+-                   if (els[i]!=null) {
+-                           return els[i];
+-                   }
+-           }
+-           return null;
++    private static int getEl(Node currentNode,String id,Element []els) {
++        Node sibling=null;
++        Node parentNode=null;
++        do {
++                switch (currentNode.getNodeType()) {
++                case Node.DOCUMENT_FRAGMENT_NODE :
++                case Node.DOCUMENT_NODE :
++                        sibling= currentNode.getFirstChild();
++                        break;
+ 
+-   }
+-   private static int getElementBySearching(Node root,String id,Element []els) {
+-           switch (root.getNodeType()) {
+-           case Node.ELEMENT_NODE:
+-                   Element el=(Element)root;
+-                   if (el.hasAttributes()) {
+-                           int index=names.indexOf(el.getNamespaceURI());
+-                           if (index<0) {
+-                                   index=4;
+-                           }
+-                           if (el.getAttribute("Id").equals(id)) {
+-                                   els[index]=el;
+-                                   if (index==0) {
+-                                           return 1;
+-                                   }
+-                           } else if ( el.getAttribute("id").equals(id) ) {
+-                                   if (index!=2) {
+-                                           index=4;
+-                                   }
+-                                   els[index]=el;
+-                           } else if ( el.getAttribute("ID").equals(id) ) {
+-                                   if (index!=3) {
+-                                           index=4;
+-                                   }
+-                                   els[index]=el;
+-                           } else if ((index==3)&&(
+-                                   el.getAttribute("OriginalRequestID").equals(id) ||
+-                                   el.getAttribute("RequestID").equals(id) ||
+-                                   el.getAttribute("ResponseID" ).equals(id))) {
+-                                   els[3]=el;
+-                           }
+-                   }
+-                case Node.DOCUMENT_NODE:
+-                        Node sibling=root.getFirstChild();
+-                        while (sibling!=null) {
+-                                if (getElementBySearching(sibling,id,els)==1)
++
++                case Node.ELEMENT_NODE :
++                        Element currentElement = (Element) currentNode;
++                        if (isElement(currentElement, id, els)==1)
++                                return 1;
++                        sibling= currentNode.getFirstChild();
++                        if (sibling==null) {
++                            if (parentNode != null) {
++                                        sibling= currentNode.getNextSibling();
++                                    }
++                        } else {
++                                parentNode=currentElement;
++                        }
++                        break;
++        } while (sibling==null  && parentNode!=null) {
++                        sibling=parentNode.getNextSibling();
++                        parentNode=parentNode.getParentNode();
++                        if (parentNode != null && parentNode.getNodeType() != Node.ELEMENT_NODE) {
++                                parentNode=null;
++                        }
++                }
++                if (sibling==null)
++                        return 1;
++                currentNode=sibling;
++                sibling=currentNode.getNextSibling();
++        } while(true);
++
++    }
++    public static int isElement(Element el, String id,Element[] els) {
++        if (!el.hasAttributes()) {
++                return 0;
++        }
++        NamedNodeMap ns=el.getAttributes();
++        int elementIndex=names.indexOf(el.getNamespaceURI());
++            elementIndex=(elementIndex<0) ? namesLength : elementIndex;
++        for (int length=ns.getLength(), i=0; i<length; i++) {
++                Attr n=(Attr)ns.item(i);
++                String s=n.getNamespaceURI();
++
++                    int index=s==null ? elementIndex : names.indexOf(n.getNamespaceURI());
++                    index=(index<0) ? namesLength : index;
++                    String name=n.getLocalName();
++                    if (name.length()>2)
++                        continue;
++                    String value=n.getNodeValue();
++                    if (name.charAt(0)=='I') {
++                        char ch=name.charAt(1);
++                        if (ch=='d' && value.equals(id)) {
++                                els[index]=el;
++                                if (index==0) {
+                                         return 1;
+-                                sibling=sibling.getNextSibling();
++                                }
++                        } else if (ch=='D' &&value.endsWith(id)) {
++                                if (index!=3) {
++                                    index=namesLength;
++                                }
++                                els[index]=el;
+                         }
+-           }
+-           return 0;
+-   }
+-
++                    } else if ( "id".equals(name) && value.equals(id) ) {
++                        if (index!=2) {
++                                index=namesLength;
++                        }
++                        els[index]=el;
++                    }
++        }
++        //For an element namespace search for importants
++        if ((elementIndex==3)&&(
++                    el.getAttribute("OriginalRequestID").equals(id) ||
++                    el.getAttribute("RequestID").equals(id) ||
++                    el.getAttribute("ResponseID").equals(id))) {
++                    els[3]=el;
++        } else if ((elementIndex==4)&&(
++                    el.getAttribute("AssertionID").equals(id))) {
++                    els[4]=el;
++        } else if ((elementIndex==5)&&(
++                    el.getAttribute("RequestID").equals(id) ||
++                    el.getAttribute("ResponseID").equals(id))) {
++                    els[5]=el;
++                 }
++        return 0;
++    }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/JavaUtils.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/JavaUtils.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/JavaUtils.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/JavaUtils.java
+@@ -20,8 +20,6 @@
+  */
+ package com.sun.org.apache.xml.internal.security.utils;
+ 
+-
+-
+ import java.io.File;
+ import java.io.FileInputStream;
+ import java.io.FileNotFoundException;
+@@ -29,99 +27,105 @@
+ import java.io.IOException;
+ import java.io.InputStream;
+ 
+-
+ /**
+  * A collection of different, general-purpose methods for JAVA-specific things
+  * @author Christian Geuer-Pollmann
+- *
+  */
+ public class JavaUtils {
+ 
+-   /** {@link java.util.logging} logging facility */
++    /** {@link java.util.logging} logging facility */
+     static java.util.logging.Logger log =
+         java.util.logging.Logger.getLogger(JavaUtils.class.getName());
+ 
+-   private JavaUtils() {
+-     // we don't allow instantiation
+-   }
+-   /**
+-    * Method getBytesFromFile
+-    *
+-    * @param fileName
+-    * @return the bytes readed from the file
+-    *
+-    * @throws FileNotFoundException
+-    * @throws IOException
+-    */
+-   public static byte[] getBytesFromFile(String fileName)
+-           throws FileNotFoundException, IOException {
++    private JavaUtils() {
++        // we don't allow instantiation
++    }
+ 
+-      byte refBytes[] = null;
++    /**
++     * Method getBytesFromFile
++     *
++     * @param fileName
++     * @return the bytes readed from the file
++     *
++     * @throws FileNotFoundException
++     * @throws IOException
++     */
++    public static byte[] getBytesFromFile(String fileName)
++        throws FileNotFoundException, IOException {
+ 
+-      {
+-         FileInputStream fisRef = new FileInputStream(fileName);
+-         UnsyncByteArrayOutputStream baos = new UnsyncByteArrayOutputStream();
+-         byte buf[] = new byte[1024];
+-         int len;
++        byte refBytes[] = null;
+ 
+-         while ((len = fisRef.read(buf)) > 0) {
++        FileInputStream fisRef = new FileInputStream(fileName);
++        try {
++            UnsyncByteArrayOutputStream baos = new UnsyncByteArrayOutputStream();
++            byte buf[] = new byte[1024];
++            int len;
++
++            while ((len = fisRef.read(buf)) > 0) {
++                baos.write(buf, 0, len);
++            }
++
++            refBytes = baos.toByteArray();
++        } finally {
++            fisRef.close();
++        }
++
++        return refBytes;
++    }
++
++    /**
++     * Method writeBytesToFilename
++     *
++     * @param filename
++     * @param bytes
++     */
++    public static void writeBytesToFilename(String filename, byte[] bytes) {
++
++        FileOutputStream fos = null;
++        try {
++            if (filename != null && bytes != null) {
++                File f = new File(filename);
++
++                fos = new FileOutputStream(f);
++
++                fos.write(bytes);
++                fos.close();
++            } else {
++                log.log(java.util.logging.Level.FINE, "writeBytesToFilename got null byte[] pointed");
++            }
++        } catch (IOException ex) {
++            if (fos != null) {
++                try {
++                    fos.close();
++                } catch (IOException ioe) {}
++            }
++        }
++    }
++
++    /**
++     * This method reads all bytes from the given InputStream till EOF and
++     * returns them as a byte array.
++     *
++     * @param inputStream
++     * @return the bytes readed from the stream
++     *
++     * @throws FileNotFoundException
++     * @throws IOException
++     */
++    public static byte[] getBytesFromStream(InputStream inputStream)
++        throws IOException {
++
++        byte refBytes[] = null;
++
++        UnsyncByteArrayOutputStream baos = new UnsyncByteArrayOutputStream();
++        byte buf[] = new byte[1024];
++        int len;
++
++        while ((len = inputStream.read(buf)) > 0) {
+             baos.write(buf, 0, len);
+-         }
++        }
+ 
+-         refBytes = baos.toByteArray();
+-      }
+-
+-      return refBytes;
+-   }
+-
+-   /**
+-    * Method writeBytesToFilename
+-    *
+-    * @param filename
+-    * @param bytes
+-    */
+-   public static void writeBytesToFilename(String filename, byte[] bytes) {
+-
+-      try {
+-         if (filename != null && bytes != null) {
+-            File f = new File(filename);
+-
+-            FileOutputStream fos = new FileOutputStream(f);
+-
+-            fos.write(bytes);
+-            fos.close();
+-         } else {
+-            if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "writeBytesToFilename got null byte[] pointed");
+-         }
+-      } catch (Exception ex) {}
+-   }
+-
+-   /**
+-    * This method reads all bytes from the given InputStream till EOF and returns
+-    * them as a byte array.
+-    *
+-    * @param inputStream
+-    * @return the bytes readed from the stream
+-    *
+-    * @throws FileNotFoundException
+-    * @throws IOException
+-    */
+-   public static byte[] getBytesFromStream(InputStream inputStream) throws IOException {
+-
+-      byte refBytes[] = null;
+-
+-      {
+-         UnsyncByteArrayOutputStream baos = new UnsyncByteArrayOutputStream();
+-         byte buf[] = new byte[1024];
+-         int len;
+-
+-         while ((len = inputStream.read(buf)) > 0) {
+-            baos.write(buf, 0, len);
+-         }
+-
+-         refBytes = baos.toByteArray();
+-      }
+-
+-      return refBytes;
+-   }
++        refBytes = baos.toByteArray();
++        return refBytes;
++    }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/RFC2253Parser.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/RFC2253Parser.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/RFC2253Parser.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/RFC2253Parser.java
+@@ -28,7 +28,7 @@
+ 
+ /**
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class RFC2253Parser {
+ 
+@@ -158,7 +158,13 @@
+          return str;
+       }
+       String attrType = normalizeAT(str.substring(0, i));
+-      String attrValue = normalizeV(str.substring(i + 1));
++      // only normalize if value is a String
++      String attrValue = null;
++      if (attrType.charAt(0) >= '0' && attrType.charAt(0) <= '9') {
++          attrValue = str.substring(i + 1);
++      } else {
++          attrValue = normalizeV(str.substring(i + 1));
++      }
+ 
+       return attrType + "=" + attrValue;
+ 
+@@ -474,7 +480,7 @@
+    static String trim(String str) {
+ 
+       String trimed = str.trim();
+-      int i = str.indexOf(trimed.substring(0)) + trimed.length();
++      int i = str.indexOf(trimed) + trimed.length();
+ 
+       if ((str.length() > i) && trimed.endsWith("\\")
+               &&!trimed.endsWith("\\\\")) {
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/SignatureElementProxy.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/SignatureElementProxy.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/SignatureElementProxy.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/SignatureElementProxy.java
+@@ -30,19 +30,25 @@
+ /**
+  * Class SignatureElementProxy
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
++ * @version $Revision: 1.5 $
+  */
+ public abstract class SignatureElementProxy extends ElementProxy {
+-
++        protected SignatureElementProxy() {
++        };
+    /**
+     * Constructor SignatureElementProxy
+     *
+     * @param doc
+     */
+    public SignatureElementProxy(Document doc) {
+-      super(doc);
+-      //this._constructionElement.setAttributeNS(Constants.NamespaceSpecNS,"xmlns:ds",
+-        //          Constants.SignatureSpecNS);
++              if (doc == null) {
++                 throw new RuntimeException("Document is null");
++              }
++
++              this._doc = doc;
++              this._constructionElement =  XMLUtils.createElementInSignatureSpace(this._doc,
++                           this.getBaseLocalName());
+    }
+ 
+    /**
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/SignerOutputStream.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/SignerOutputStream.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/SignerOutputStream.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/SignerOutputStream.java
+@@ -3,7 +3,7 @@
+  * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * Copyright  1999-2004 The Apache Software Foundation.
++ * Copyright 1999-2008 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.
+@@ -30,8 +30,11 @@
+  *
+  */
+ public class SignerOutputStream extends ByteArrayOutputStream {
+-    final static byte none[]="error".getBytes();
+     final SignatureAlgorithm sa;
++    static java.util.logging.Logger log =
++        java.util.logging.Logger.getLogger
++        (SignerOutputStream.class.getName());
++
+     /**
+      * @param sa
+      */
+@@ -40,21 +43,18 @@
+     }
+ 
+     /** @inheritDoc */
+-    public byte[] toByteArray() {
+-        return none;
+-    }
+-
+-    /** @inheritDoc */
+     public void write(byte[] arg0)  {
++        super.write(arg0, 0, arg0.length);
+         try {
+-                        sa.update(arg0);
+-                } catch (XMLSignatureException e) {
++            sa.update(arg0);
++        } catch (XMLSignatureException e) {
+             throw new RuntimeException(""+e);
+-                }
++        }
+     }
+ 
+     /** @inheritDoc */
+     public void write(int arg0) {
++        super.write(arg0);
+         try {
+             sa.update((byte)arg0);
+         } catch (XMLSignatureException e) {
+@@ -64,12 +64,19 @@
+ 
+     /** @inheritDoc */
+     public void write(byte[] arg0, int arg1, int arg2) {
++        super.write(arg0, arg1, arg2);
++        if (log.isLoggable(java.util.logging.Level.FINE)) {
++            log.log(java.util.logging.Level.FINE, "Canonicalized SignedInfo:");
++            StringBuffer sb = new StringBuffer(arg2);
++            for (int i=arg1; i<(arg1+arg2); i++) {
++                sb.append((char) arg0[i]);
++            }
++            log.log(java.util.logging.Level.FINE, sb.toString());
++        }
+         try {
+             sa.update(arg0,arg1,arg2);
+         } catch (XMLSignatureException e) {
+             throw new RuntimeException(""+e);
+         }
+     }
+-
+-
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/UnsyncBufferedOutputStream.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/UnsyncBufferedOutputStream.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/UnsyncBufferedOutputStream.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/UnsyncBufferedOutputStream.java
+@@ -30,14 +30,21 @@
+  */
+ public class UnsyncBufferedOutputStream extends OutputStream {
+         final OutputStream out;
++
++        final byte[] buf;
+         static final int size=8*1024;
+-        final byte[] buf=new byte[size];
++        private static ThreadLocal bufCahce = new ThreadLocal() {
++        protected synchronized Object initialValue() {
++            return new byte[size];
++        }
++    };
+         int pointer=0;
+         /**
+          * Creates a buffered output stream without synchronization
+          * @param out the outputstream to buffer
+          */
+         public UnsyncBufferedOutputStream(OutputStream out) {
++                buf=(byte[])bufCahce.get();
+                 this.out=out;
+         }
+ 
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/UnsyncByteArrayOutputStream.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/UnsyncByteArrayOutputStream.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/UnsyncByteArrayOutputStream.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/UnsyncByteArrayOutputStream.java
+@@ -20,17 +20,25 @@
+  */
+ package com.sun.org.apache.xml.internal.security.utils;
+ 
+-import java.io.ByteArrayOutputStream;
++import java.io.OutputStream;
+ 
+ /**
+  * A simple Unsynced ByteArryOutputStream
+  * @author raul
+  *
+  */
+-public class UnsyncByteArrayOutputStream extends ByteArrayOutputStream {
+-        int size=4*1024;
+-        byte []buf=new byte[size];
+-        int pos;
++public class UnsyncByteArrayOutputStream extends OutputStream  {
++        private static ThreadLocal bufCahce = new ThreadLocal() {
++        protected synchronized Object initialValue() {
++            return new byte[8*1024];
++        }
++    };
++    byte[] buf;
++        int size=8*1024;//buf.length;
++        int pos=0;
++        public UnsyncByteArrayOutputStream() {
++                buf=(byte[])bufCahce.get();
++        }
+         /** @inheritDoc */
+         public void write(byte[] arg0) {
+                 int newPos=pos+arg0.length;
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/XMLUtils.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/XMLUtils.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/XMLUtils.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/XMLUtils.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -25,8 +24,12 @@
+ 
+ import java.io.IOException;
+ import java.io.OutputStream;
++import java.security.AccessController;
++import java.security.PrivilegedAction;
++import java.util.HashMap;
+ import java.util.HashSet;
+ import java.util.Iterator;
++import java.util.Map;
+ import java.util.Set;
+ 
+ import com.sun.org.apache.xml.internal.security.c14n.CanonicalizationException;
+@@ -49,6 +52,14 @@
+  */
+ public class XMLUtils {
+ 
++   private static boolean ignoreLineBreaks =
++      AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
++         public Boolean run() {
++            return Boolean.getBoolean
++               ("com.sun.org.apache.xml.internal.security.ignoreLineBreaks");
++         }
++      });
++
+    /**
+     * Constructor XMLUtils
+     *
+@@ -57,7 +68,13 @@
+ 
+       // we don't allow instantiation
+    }
++   public static Element getNextElement(Node el) {
++           while ((el!=null) && (el.getNodeType()!=Node.ELEMENT_NODE)) {
++                   el=el.getNextSibling();
++           }
++           return (Element)el;
+ 
++   }
+ 
+    /**
+     * @param rootNode
+@@ -212,6 +229,8 @@
+    }
+ 
+ 
++   static  String dsPrefix=null;
++   static Map namePrefixes=new HashMap();
+    /**
+     * Creates an Element in the XML Signature specification namespace.
+     *
+@@ -226,28 +245,20 @@
+          throw new RuntimeException("Document is null");
+       }
+ 
+-      String ds = Constants.getSignatureSpecNSprefix();
+-
+-      if ((ds == null) || (ds.length() == 0)) {
+-         Element element = doc.createElementNS(Constants.SignatureSpecNS,
+-                                               elementName);
+-
+-         element.setAttributeNS(Constants.NamespaceSpecNS, "xmlns",
+-                                Constants.SignatureSpecNS);
+-
+-         return element;
++      if ((dsPrefix == null) || (dsPrefix.length() == 0)) {
++         return doc.createElementNS(Constants.SignatureSpecNS, elementName);
+       }
+-         Element element = doc.createElementNS(Constants.SignatureSpecNS,
+-                                               ds + ":" + elementName);
+-
+-         element.setAttributeNS(Constants.NamespaceSpecNS, "xmlns:" + ds,
+-                                Constants.SignatureSpecNS);
+-
+-         return element;
+-
++      String namePrefix=(String) namePrefixes.get(elementName);
++      if (namePrefix==null) {
++          StringBuffer tag=new StringBuffer(dsPrefix);
++          tag.append(':');
++          tag.append(elementName);
++          namePrefix=tag.toString();
++          namePrefixes.put(elementName,namePrefix);
++      }
++      return doc.createElementNS(Constants.SignatureSpecNS, namePrefix);
+    }
+ 
+-
+    /**
+     * Returns true if the element is in XML Signature namespace and the local
+     * name equals the supplied one.
+@@ -258,17 +269,7 @@
+     */
+    public static boolean elementIsInSignatureSpace(Element element,
+            String localName) {
+-
+-      if ((element == null) ||
+-          !Constants.SignatureSpecNS.equals(element.getNamespaceURI()) ){
+-         return false;
+-      }
+-
+-      if (!element.getLocalName().equals(localName)) {
+-         return false;
+-      }
+-
+-      return true;
++      return ElementProxy.checker.isNamespaceElement(element, localName, Constants.SignatureSpecNS);
+    }
+ 
+    /**
+@@ -281,18 +282,7 @@
+     */
+    public static boolean elementIsInEncryptionSpace(Element element,
+            String localName) {
+-
+-      if ((element == null) ||
+-            !EncryptionConstants.EncryptionSpecNS.equals(element.getNamespaceURI())
+-          ){
+-         return false;
+-      }
+-
+-      if (!element.getLocalName().equals(localName)) {
+-         return false;
+-      }
+-
+-      return true;
++           return ElementProxy.checker.isNamespaceElement(element, localName, EncryptionConstants.EncryptionSpecNS);
+    }
+ 
+    /**
+@@ -352,32 +342,28 @@
+                                        + (npe == null ? "" : npe.getMessage()) + "\"");
+     }
+ 
++    /**
++     * Method createDSctx
++     *
++     * @param doc
++     * @param prefix
++     * @param namespace
++     * @return the element.
++     */
++    public static Element createDSctx(Document doc, String prefix,
++                                      String namespace) {
+ 
++       if ((prefix == null) || (prefix.trim().length() == 0)) {
++          throw new IllegalArgumentException("You must supply a prefix");
++       }
+ 
+-   /**
+-    * Method createDSctx
+-    *
+-    * @param doc
+-    * @param prefix
+-    * @param namespace
+-    * @return the element.
+-    */
+-   public static Element createDSctx(Document doc, String prefix,
+-                                     String namespace) {
++       Element ctx = doc.createElementNS(null, "namespaceContext");
+ 
+-      if ((prefix == null) || (prefix.trim().length() == 0)) {
+-         throw new IllegalArgumentException("You must supply a prefix");
+-      }
++       ctx.setAttributeNS(Constants.NamespaceSpecNS, "xmlns:" + prefix.trim(),
++                          namespace);
+ 
+-      Element ctx = doc.createElementNS(null, "namespaceContext");
+-
+-      ctx.setAttributeNS(Constants.NamespaceSpecNS, "xmlns:" + prefix.trim(),
+-                         namespace);
+-
+-      return ctx;
+-   }
+-
+-
++       return ctx;
++    }
+ 
+    /**
+     * Method addReturnToElement
+@@ -386,9 +372,23 @@
+     */
+    public static void addReturnToElement(Element e) {
+ 
+-      Document doc = e.getOwnerDocument();
++      if (!ignoreLineBreaks) {
++         Document doc = e.getOwnerDocument();
++         e.appendChild(doc.createTextNode("\n"));
++      }
++   }
+ 
+-      e.appendChild(doc.createTextNode("\n"));
++   public static void addReturnToElement(Document doc, HelperNodeList nl) {
++      if (!ignoreLineBreaks) {
++         nl.appendChild(doc.createTextNode("\n"));
++      }
++   }
++
++   public static void addReturnBeforeChild(Element e, Node child) {
++      if (!ignoreLineBreaks) {
++         Document doc = e.getOwnerDocument();
++         e.insertBefore(doc.createTextNode("\n"), child);
++      }
+    }
+ 
+    /**
+@@ -470,7 +470,7 @@
+ 
+                 for (int i = 0; i < attributesLength; i++) {
+                         Attr currentAttr = (Attr) attributes.item(i);
+-                        if (!namespaceNs.equals(currentAttr.getNamespaceURI()))
++                        if (namespaceNs!=currentAttr.getNamespaceURI())
+                                 continue;
+                         if (childElement.hasAttributeNS(namespaceNs,
+                                                         currentAttr.getLocalName())) {
+@@ -511,8 +511,7 @@
+     */
+    public static Element selectDsNode(Node sibling, String nodeName, int number) {
+         while (sibling!=null) {
+-                if (nodeName.equals(sibling.getLocalName())
+-                                && Constants.SignatureSpecNS.equals(sibling.getNamespaceURI())) {
++                if (ElementProxy.checker.isNamespaceElement(sibling, nodeName, Constants.SignatureSpecNS )) {
+                         if (number==0){
+                                 return (Element)sibling;
+                         }
+@@ -532,8 +531,7 @@
+ 
+    public static Element selectXencNode(Node sibling, String nodeName, int number) {
+         while (sibling!=null) {
+-                if (nodeName.equals(sibling.getLocalName())
+-                                && EncryptionConstants.EncryptionSpecNS.equals(sibling.getNamespaceURI())) {
++                if (ElementProxy.checker.isNamespaceElement(sibling, nodeName, EncryptionConstants.EncryptionSpecNS )) {
+                         if (number==0){
+                                 return (Element)sibling;
+                         }
+@@ -591,8 +589,7 @@
+     */
+    public static Element selectNode(Node sibling, String uri,String nodeName, int number) {
+         while (sibling!=null) {
+-                if (nodeName.equals(sibling.getLocalName())
+-                                && uri.equals(sibling.getNamespaceURI())) {
++                if (ElementProxy.checker.isNamespaceElement(sibling, nodeName, uri)) {
+                         if (number==0){
+                                 return (Element)sibling;
+                         }
+@@ -611,7 +608,6 @@
+    public static Element[] selectDsNodes(Node sibling,String nodeName) {
+      return selectNodes(sibling,Constants.SignatureSpecNS,nodeName);
+    }
+-
+    /**
+     * @param sibling
+     * @param uri
+@@ -624,8 +620,7 @@
+         int curr=0;
+         //List list=new ArrayList();
+         while (sibling!=null) {
+-                if (nodeName.equals(sibling.getLocalName())
+-                                && uri.equals(sibling.getNamespaceURI())) {
++                if (ElementProxy.checker.isNamespaceElement(sibling, nodeName, uri)) {
+                         a[curr++]=(Element)sibling;
+                         if (size<=curr) {
+                                 int cursize= size<<2;
+@@ -694,4 +689,8 @@
+          }
+       }
+    }
++
++    public static boolean ignoreLineBreaks() {
++        return ignoreLineBreaks;
++    }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/XPathFuncHereAPI.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/XPathFuncHereAPI.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/XPathFuncHereAPI.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/XPathFuncHereAPI.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -53,7 +52,7 @@
+  * XPaths using the low-level API, and then just use the XPaths
+  * over and over.
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  * @see <a href="http://www.w3.org/TR/xpath">XPath Specification</a>
+  */
+ public class XPathFuncHereAPI {
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolver.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolver.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolver.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolver.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -21,8 +20,6 @@
+  */
+ package com.sun.org.apache.xml.internal.security.utils.resolver;
+ 
+-
+-
+ import java.util.ArrayList;
+ import java.util.List;
+ import java.util.Map;
+@@ -30,7 +27,6 @@
+ import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
+ import org.w3c.dom.Attr;
+ 
+-
+ /**
+  * During reference validation, we have to retrieve resources from somewhere.
+  * This is done by retrieving a Resolver. The resolver needs two arguments: The
+@@ -48,7 +44,7 @@
+  * <LI> Die erste Implementierung, die die Aufgabe erf??llt, f??hrt die Aufl??sung durch.
+  * </UL>
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class ResourceResolver {
+ 
+@@ -62,8 +58,7 @@
+    /** these are the system-wide resolvers */
+    static List _resolverVector = null;
+ 
+-   /** Field _individualResolverVector */
+-   List _individualResolverVector = null;
++   static boolean allThreadSafeInList=true;
+ 
+    /** Field transformSpi */
+    protected ResourceResolverSpi _resolverSpi = null;
+@@ -92,6 +87,7 @@
+       this._resolverSpi = resourceResolver;
+    }
+ 
++
+    /**
+     * Method getInstance
+     *
+@@ -107,13 +103,32 @@
+       for (int i = 0; i < length; i++) {
+                   ResourceResolver resolver =
+             (ResourceResolver) ResourceResolver._resolverVector.get(i);
++                  ResourceResolver resolverTmp=null;
++                  try {
++                        resolverTmp =  allThreadSafeInList || resolver._resolverSpi.engineIsThreadSafe() ? resolver :
++                                        new ResourceResolver((ResourceResolverSpi)resolver._resolverSpi.getClass().newInstance());
++                  } catch (InstantiationException e) {
++                          throw new ResourceResolverException("",e,uri,BaseURI);
++                  } catch (IllegalAccessException e) {
++                          throw new ResourceResolverException("",e,uri,BaseURI);
++                  }
+ 
++         if (log.isLoggable(java.util.logging.Level.FINE))
++                log.log(java.util.logging.Level.FINE, "check resolvability by class " + resolver._resolverSpi.getClass().getName());
+ 
+-         if (true)
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "check resolvability by class " + resolver.getClass().getName());
++         if ((resolver != null) && resolverTmp.canResolve(uri, BaseURI)) {
++                 if (i!=0) {
++                 //update resolver.
++                         //System.out.println("Swaping");
++                         List resolverVector=(List)((ArrayList)_resolverVector).clone();
++                         resolverVector.remove(i);
++                         resolverVector.add(0,resolver);
++                         _resolverVector=resolverVector;
++                 } else {
++                         //System.out.println("hitting");
++                 }
+ 
+-         if ((resolver != null) && resolver.canResolve(uri, BaseURI)) {
+-            return resolver;
++            return resolverTmp;
+          }
+       }
+ 
+@@ -137,9 +152,10 @@
+    public static final ResourceResolver getInstance(
+            Attr uri, String BaseURI, List individualResolvers)
+               throws ResourceResolverException {
+-      if (true) {
+-        if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "I was asked to create a ResourceResolver and got " + individualResolvers.size());
+-        if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, " extra resolvers to my existing " + ResourceResolver._resolverVector.size() + " system-wide resolvers");
++      if (log.isLoggable(java.util.logging.Level.FINE)) {
++
++        log.log(java.util.logging.Level.FINE, "I was asked to create a ResourceResolver and got " + (individualResolvers==null? 0 : individualResolvers.size()) );
++        log.log(java.util.logging.Level.FINE, " extra resolvers to my existing " + ResourceResolver._resolverVector.size() + " system-wide resolvers");
+       }
+ 
+       // first check the individual Resolvers
+@@ -151,8 +167,8 @@
+ 
+             if (resolver != null) {
+                String currentClass = resolver._resolverSpi.getClass().getName();
+-               if (true)
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "check resolvability by class " + currentClass);
++               if (log.isLoggable(java.util.logging.Level.FINE))
++                log.log(java.util.logging.Level.FINE, "check resolvability by class " + currentClass);
+ 
+                if (resolver.canResolve(uri, BaseURI)) {
+                   return resolver;
+@@ -175,39 +191,46 @@
+       }
+    }
+ 
+-   /**
+-    * Method register
+-    *
+-    * @param className
+-    */
+-   public static void register(String className) {
+-            ResourceResolver resolver = null;
++    /**
++     * Registers a ResourceResolverSpi class. This method logs a warning if
++     * the class cannot be registered.
++     *
++     * @param className the name of the ResourceResolverSpi class to be
++     *    registered
++     */
++    public static void register(String className) {
++        register(className, false);
++    }
+ 
++    /**
++     * Registers a ResourceResolverSpi class at the beginning of the provider
++     * list. This method logs a warning if the class cannot be registered.
++     *
++     * @param className the name of the ResourceResolverSpi class to be
++     *    registered
++     */
++    public static void registerAtStart(String className) {
++        register(className, true);
++    }
++
++    private static void register(String className, boolean start) {
+         try {
+-           resolver = new ResourceResolver(className);
+-                   ResourceResolver._resolverVector.add(resolver);
++            ResourceResolver resolver = new ResourceResolver(className);
++            if (start) {
++                ResourceResolver._resolverVector.add(0, resolver);
++                log.log(java.util.logging.Level.FINE, "registered resolver");
++            } else {
++                ResourceResolver._resolverVector.add(resolver);
++            }
++            if (!resolver._resolverSpi.engineIsThreadSafe()) {
++                allThreadSafeInList=false;
++        }
+         } catch (Exception e) {
+-//                      Object exArgs[] = { ((uri != null)
+-//                    ? uri.getNodeValue()
+-//                    : "null"), BaseURI };
+-//
+-//                      throw new ResourceResolverException("utils.resolver.noClass",
+-//                                   exArgs, e, uri, BaseURI);
+-                        log.log(java.util.logging.Level.WARNING, "Error loading resolver " + className +" disabling it");
++            log.log(java.util.logging.Level.WARNING, "Error loading resolver " + className +" disabling it");
+         } catch (NoClassDefFoundError e) {
+-                        log.log(java.util.logging.Level.WARNING, "Error loading resolver " + className +" disabling it");
++            log.log(java.util.logging.Level.WARNING, "Error loading resolver " + className +" disabling it");
+         }
+-
+-   }
+-
+-   /**
+-    * Method registerAtStart
+-    *
+-    * @param className
+-    */
+-   public static void registerAtStart(String className) {
+-      ResourceResolver._resolverVector.add(0, className);
+-   }
++    }
+ 
+    /**
+     * Method resolve
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolverException.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolverException.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolverException.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolverException.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -31,7 +30,7 @@
+  * This Exception is thrown if something related to the
+  * {@link com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolver} goes wrong.
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class ResourceResolverException extends XMLSecurityException {
+ 
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolverSpi.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolverSpi.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolverSpi.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolverSpi.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -22,6 +21,7 @@
+ package com.sun.org.apache.xml.internal.security.utils.resolver;
+ 
+ 
++import java.util.HashMap;
+ import java.util.Map;
+ 
+ import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
+@@ -31,7 +31,7 @@
+ /**
+  * During reference validation, we have to retrieve resources from somewhere.
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public abstract class ResourceResolverSpi {
+ 
+@@ -41,7 +41,7 @@
+                     ResourceResolverSpi.class.getName());
+ 
+    /** Field _properties */
+-   protected java.util.Map _properties = new java.util.HashMap(10);
++   protected java.util.Map _properties = null;
+ 
+    /**
+     * This is the workhorse method used to resolve resources.
+@@ -62,19 +62,9 @@
+     * @param value
+     */
+    public void engineSetProperty(String key, String value) {
+-
+-      java.util.Iterator i = this._properties.keySet().iterator();
+-
+-      while (i.hasNext()) {
+-         String c = (String) i.next();
+-
+-         if (c.equals(key)) {
+-            key = c;
+-
+-            break;
+-         }
+-      }
+-
++          if (_properties==null) {
++                  _properties=new HashMap();
++          }
+       this._properties.put(key, value);
+    }
+ 
+@@ -85,19 +75,9 @@
+     * @return the value of the property
+     */
+    public String engineGetProperty(String key) {
+-
+-      java.util.Iterator i = this._properties.keySet().iterator();
+-
+-      while (i.hasNext()) {
+-         String c = (String) i.next();
+-
+-         if (c.equals(key)) {
+-            key = c;
+-
+-            break;
+-         }
+-      }
+-
++          if (_properties==null) {
++                        return null;
++          }
+       return (String) this._properties.get(key);
+    }
+ 
+@@ -106,9 +86,22 @@
+     * @param properties
+     */
+    public void engineAddProperies(Map properties) {
+-      this._properties.putAll(properties);
++          if (properties!=null) {
++                  if (_properties==null) {
++                          _properties=new HashMap();
++                  }
++                  this._properties.putAll(properties);
++          }
+    }
+-
++   /**
++    * Tells if the implementation does can be reused by several threads safely.
++    * It normally means that the implemantation does not have any member, or there is
++    * member change betwen engineCanResolve & engineResolve invocations. Or it mantians all
++    * member info in ThreadLocal methods.
++    */
++   public boolean engineIsThreadSafe() {
++           return false;
++   }
+    /**
+     * This method helps the {@link ResourceResolver} to decide whether a
+     * {@link ResourceResolverSpi} is able to perform the requested action.
+@@ -174,8 +167,8 @@
+                                   && (ch3 != '/'));
+ 
+          if (isDosFilename) {
+-            if (true)
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Found DOS filename: " + str);
++            if (log.isLoggable(java.util.logging.Level.FINE))
++                log.log(java.util.logging.Level.FINE, "Found DOS filename: " + str);
+          }
+       }
+ 
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverAnonymous.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverAnonymous.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverAnonymous.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverAnonymous.java
+@@ -32,14 +32,10 @@
+ 
+ /**
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ 
+ public class ResolverAnonymous extends ResourceResolverSpi {
+-   /** {@link java.util.logging} logging facility */
+-    static java.util.logging.Logger log =
+-        java.util.logging.Logger.getLogger(
+-                        ResolverAnonymous.class.getName());
+ 
+    private XMLSignatureInput _input = null;
+ 
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverDirectHTTP.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverDirectHTTP.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverDirectHTTP.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverDirectHTTP.java
+@@ -2,7 +2,6 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-
+ /*
+  * Copyright  1999-2004 The Apache Software Foundation.
+  *
+@@ -67,11 +66,12 @@
+                             ResolverDirectHTTP.class.getName());
+ 
+    /** Field properties[] */
+-   static final String properties[] = { "http.proxy.host", "http.proxy.port",
+-                                        "http.proxy.username",
+-                                        "http.proxy.password",
+-                                        "http.basic.username",
+-                                        "http.basic.password" };
++   private static final String properties[] =
++        { "http.proxy.host", "http.proxy.port",
++          "http.proxy.username",
++          "http.proxy.password",
++          "http.basic.username",
++          "http.basic.password" };
+ 
+    /** Field HttpProxyHost */
+    private static final int HttpProxyHost = 0;
+@@ -91,6 +91,9 @@
+    /** Field HttpProxyPass */
+    private static final int HttpBasicPass = 5;
+ 
++   public boolean engineIsThreadSafe() {
++           return true;
++   }
+    /**
+     * Method resolve
+     *
+@@ -117,15 +120,14 @@
+             useProxy = true;
+          }
+ 
+-         // switch on proxy usage
+          String oldProxySet = null;
+          String oldProxyHost = null;
+          String oldProxyPort = null;
++         // switch on proxy usage
+          if (useProxy) {
+             if (log.isLoggable(java.util.logging.Level.FINE)) {
+-               log.log(java.util.logging.Level.FINE,
+-                  "Use of HTTP proxy enabled: " + proxyHost + ":"
+-                  + proxyPort);
++                log.log(java.util.logging.Level.FINE, "Use of HTTP proxy enabled: " + proxyHost + ":"
++                      + proxyPort);
+             }
+             oldProxySet = System.getProperty("http.proxySet");
+             oldProxyHost = System.getProperty("http.proxyHost");
+@@ -215,11 +217,8 @@
+             summarized += read;
+          }
+ 
+-         if (log.isLoggable(java.util.logging.Level.FINE)) {
+-            log.log(java.util.logging.Level.FINE,
+-               "Fetched " + summarized + " bytes from URI "
+-               + uriNew.toString());
+-         }
++         log.log(java.util.logging.Level.FINE, "Fetched " + summarized + " bytes from URI "
++                   + uriNew.toString());
+ 
+          XMLSignatureInput result = new XMLSignatureInput(baos.toByteArray());
+ 
+@@ -253,39 +252,36 @@
+     */
+    public boolean engineCanResolve(Attr uri, String BaseURI) {
+       if (uri == null) {
+-         if (log.isLoggable(java.util.logging.Level.FINE)) {
+-            log.log(java.util.logging.Level.FINE, "quick fail, uri == null");
+-         }
++         log.log(java.util.logging.Level.FINE, "quick fail, uri == null");
++
+          return false;
+       }
+ 
+       String uriNodeValue = uri.getNodeValue();
+ 
+       if (uriNodeValue.equals("") || (uriNodeValue.charAt(0)=='#')) {
+-         if (log.isLoggable(java.util.logging.Level.FINE)) {
+-            log.log(java.util.logging.Level.FINE,
+-               "quick fail for empty URIs and local ones");
+-         }
++         log.log(java.util.logging.Level.FINE, "quick fail for empty URIs and local ones");
++
+          return false;
+       }
+ 
+       if (log.isLoggable(java.util.logging.Level.FINE)) {
+-         log.log(java.util.logging.Level.FINE,
+-               "I was asked whether I can resolve " + uriNodeValue);
++         log.log(java.util.logging.Level.FINE, "I was asked whether I can resolve " + uriNodeValue);
+       }
++
+       if ( uriNodeValue.startsWith("http:") ||
+-                                 BaseURI.startsWith("http:")) {
++                                (BaseURI!=null && BaseURI.startsWith("http:") )) {
+          if (log.isLoggable(java.util.logging.Level.FINE)) {
+-            log.log(java.util.logging.Level.FINE,
+-                  "I state that I can resolve " + uriNodeValue);
++            log.log(java.util.logging.Level.FINE, "I state that I can resolve " + uriNodeValue);
+          }
++
+          return true;
+       }
+ 
+       if (log.isLoggable(java.util.logging.Level.FINE)) {
+-         log.log(java.util.logging.Level.FINE,
+-            "I state that I can't resolve " + uriNodeValue);
++         log.log(java.util.logging.Level.FINE, "I state that I can't resolve " + uriNodeValue);
+       }
++
+       return false;
+    }
+ 
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverFragment.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverFragment.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverFragment.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverFragment.java
+@@ -34,7 +34,7 @@
+ /**
+  * This resolver is used for resolving same-document URIs like URI="" of URI="#id".
+  *
+- * @author $Author: dims $
++ * @author $Author: mullan $
+  * @see <A HREF="http://www.w3.org/TR/xmldsig-core/#sec-ReferenceProcessingModel">The Reference processing model in the XML Signature spec</A>
+  * @see <A HREF="http://www.w3.org/TR/xmldsig-core/#sec-Same-Document">Same-Document URI-References in the XML Signature spec</A>
+  * @see <A HREF="http://www.ietf.org/rfc/rfc2396.txt">Section 4.2 of RFC 2396</A>
+@@ -45,7 +45,9 @@
+     static java.util.logging.Logger log =
+         java.util.logging.Logger.getLogger(
+                             ResolverFragment.class.getName());
+-
++   public boolean engineIsThreadSafe() {
++           return true;
++   }
+    /**
+     * Method engineResolve
+     *
+@@ -72,7 +74,7 @@
+           * resource containing the signature
+           */
+ 
+-         if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "ResolverFragment with empty URI (means complete document)");
++         log.log(java.util.logging.Level.FINE, "ResolverFragment with empty URI (means complete document)");
+          selectedElem = doc;
+       } else {
+ 
+@@ -93,14 +95,14 @@
+             throw new ResourceResolverException(
+                "signature.Verification.MissingID", exArgs, uri, BaseURI);
+          }
+-         if (true)
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Try to catch an Element with ID " + id + " and Element was " + selectedElem);
++         if (log.isLoggable(java.util.logging.Level.FINE))
++                log.log(java.util.logging.Level.FINE, "Try to catch an Element with ID " + id + " and Element was " + selectedElem);
+       }
+ 
+       XMLSignatureInput result = new XMLSignatureInput(selectedElem);
+       result.setExcludeComments(true);
+ 
+-      //if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "We return a nodeset with " + resultSet.size() + " nodes");
++      //log.log(java.util.logging.Level.FINE, "We return a nodeset with " + resultSet.size() + " nodes");
+       result.setMIMEType("text/xml");
+           result.setSourceURI((BaseURI != null) ? BaseURI.concat(uri.getNodeValue()) :
+                   uri.getNodeValue());
+@@ -117,21 +119,24 @@
+    public boolean engineCanResolve(Attr uri, String BaseURI) {
+ 
+       if (uri == null) {
+-         if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Quick fail for null uri");
++         log.log(java.util.logging.Level.FINE, "Quick fail for null uri");
+          return false;
+       }
+ 
+       String uriNodeValue = uri.getNodeValue();
+ 
+-      if (uriNodeValue.equals("")
+-              || ((uriNodeValue.charAt(0)=='#')
+-                  &&!uriNodeValue.startsWith("#xpointer("))) {
+-         if (true)
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "State I can resolve reference: \"" + uriNodeValue + "\"");
++      if  (uriNodeValue.equals("") ||
++             (
++            (uriNodeValue.charAt(0)=='#')
++              && !((uriNodeValue.charAt(1)=='x') && uriNodeValue.startsWith("#xpointer("))
++              )
++           ){
++         if (log.isLoggable(java.util.logging.Level.FINE))
++                log.log(java.util.logging.Level.FINE, "State I can resolve reference: \"" + uriNodeValue + "\"");
+          return true;
+       }
+-      if (true)
+-        if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Do not seem to be able to resolve reference: \"" + uriNodeValue + "\"");
++      if (log.isLoggable(java.util.logging.Level.FINE))
++        log.log(java.util.logging.Level.FINE, "Do not seem to be able to resolve reference: \"" + uriNodeValue + "\"");
+       return false;
+    }
+ 
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverLocalFilesystem.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverLocalFilesystem.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverLocalFilesystem.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverLocalFilesystem.java
+@@ -20,8 +20,6 @@
+  */
+ package com.sun.org.apache.xml.internal.security.utils.resolver.implementations;
+ 
+-
+-
+ import java.io.FileInputStream;
+ 
+ import com.sun.org.apache.xml.internal.utils.URI;
+@@ -30,11 +28,10 @@
+ import com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolverSpi;
+ import org.w3c.dom.Attr;
+ 
+-
+ /**
+  * A simple ResourceResolver for requests into the local filesystem.
+  *
+- * @author $Author: raul $
++ * @author $Author: mullan $
+  */
+ public class ResolverLocalFilesystem extends ResourceResolverSpi {
+ 
+@@ -43,6 +40,9 @@
+         java.util.logging.Logger.getLogger(
+                     ResolverLocalFilesystem.class.getName());
+ 
++    public boolean engineIsThreadSafe() {
++           return true;
++   }
+    /**
+     * @inheritDoc
+     */
+@@ -50,7 +50,7 @@
+            throws ResourceResolverException {
+ 
+      try {
+-        URI uriNew = new URI(new URI(BaseURI), uri.getNodeValue());
++        URI uriNew = getNewURI(uri.getNodeValue(), BaseURI);
+ 
+         // if the URI contains a fragment, ignore it
+         URI uriNewNoFrag = new URI(uriNew);
+@@ -72,6 +72,7 @@
+       }
+    }
+ 
++   private static int FILE_URI_LENGTH="file:/".length();
+    /**
+     * Method translateUriToFilename
+     *
+@@ -80,7 +81,7 @@
+     */
+    private static String translateUriToFilename(String uri) {
+ 
+-      String subStr = uri.substring("file:/".length());
++      String subStr = uri.substring(FILE_URI_LENGTH);
+ 
+       if (subStr.indexOf("%20") > -1)
+       {
+@@ -121,26 +122,36 @@
+ 
+       String uriNodeValue = uri.getNodeValue();
+ 
+-      if (uriNodeValue.equals("") || (uriNodeValue.charAt(0)=='#')) {
++      if (uriNodeValue.equals("") || (uriNodeValue.charAt(0)=='#') ||
++          uriNodeValue.startsWith("http:")) {
+          return false;
+       }
+ 
+       try {
+                  //URI uriNew = new URI(new URI(BaseURI), uri.getNodeValue());
+-                 if (true)
+-                        if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "I was asked whether I can resolve " + uriNodeValue/*uriNew.toString()*/);
++                 if (log.isLoggable(java.util.logging.Level.FINE))
++                        log.log(java.util.logging.Level.FINE, "I was asked whether I can resolve " + uriNodeValue/*uriNew.toString()*/);
+ 
+                  if ( uriNodeValue.startsWith("file:") ||
+                                          BaseURI.startsWith("file:")/*uriNew.getScheme().equals("file")*/) {
+-                    if (true)
+-                        if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "I state that I can resolve " + uriNodeValue/*uriNew.toString()*/);
++                    if (log.isLoggable(java.util.logging.Level.FINE))
++                        log.log(java.util.logging.Level.FINE, "I state that I can resolve " + uriNodeValue/*uriNew.toString()*/);
+ 
+                     return true;
+                  }
+       } catch (Exception e) {}
+ 
+-      if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "But I can't");
++      log.log(java.util.logging.Level.FINE, "But I can't");
+ 
+       return false;
+    }
++
++   private static URI getNewURI(String uri, String BaseURI)
++           throws URI.MalformedURIException {
++
++      if ((BaseURI == null) || "".equals(BaseURI)) {
++         return new URI(uri);
++      }
++      return new URI(new URI(BaseURI), uri);
++   }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverXPointer.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverXPointer.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverXPointer.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverXPointer.java
+@@ -44,7 +44,7 @@
+  * nodes of the parse tree (all descendants, plus all attributes,
+  * plus all namespaces nodes).
+  *
+- * @author $Author: dims $
++ * @author $Author: mullan $
+  */
+ public class ResolverXPointer extends ResourceResolverSpi {
+ 
+@@ -53,6 +53,9 @@
+         java.util.logging.Logger.getLogger(
+                             ResolverXPointer.class.getName());
+ 
++    public boolean engineIsThreadSafe() {
++           return true;
++   }
+    /**
+     * @inheritDoc
+     */
+@@ -70,7 +73,7 @@
+             String id = getXPointerId(uriStr);
+             resultNode =IdResolver.getElementById(doc, id);
+ 
+-            // if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Use #xpointer(id('" + id + "')) on element " + selectedElem);
++            // log.log(java.util.logging.Level.FINE, "Use #xpointer(id('" + id + "')) on element " + selectedElem);
+ 
+             if (resultNode == null) {
+                Object exArgs[] = { id };
+@@ -148,14 +151,14 @@
+                                                      uri.length()
+                                                      - 2);
+ 
+-         // if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "idPlusDelim=" + idPlusDelim);
++         // log.log(java.util.logging.Level.FINE, "idPlusDelim=" + idPlusDelim);
+                  int idLen=idPlusDelim.length() -1;
+          if (((idPlusDelim.charAt(0) == '"') && (idPlusDelim
+                  .charAt(idLen) == '"')) || ((idPlusDelim
+                  .charAt(0) == '\'') && (idPlusDelim
+                  .charAt(idLen) == '\''))) {
+-            if (true)
+-                if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Id="
++            if (log.isLoggable(java.util.logging.Level.FINE))
++                log.log(java.util.logging.Level.FINE, "Id="
+                       + idPlusDelim.substring(1, idLen));
+ 
+             return true;
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/DigesterOutputStream.java b/src/share/classes/org/jcp/xml/dsig/internal/DigesterOutputStream.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/DigesterOutputStream.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/DigesterOutputStream.java
+@@ -19,7 +19,10 @@
+  *
+  */
+ /*
+- * $Id: DigesterOutputStream.java,v 1.1.2.2 2005/08/12 18:15:35 mullan Exp $
++ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
++ */
++/*
++ * $Id: DigesterOutputStream.java,v 1.2 2008/07/24 15:20:31 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal;
+ 
+@@ -35,10 +38,11 @@
+ /**
+  * This class has been modified slightly to use java.security.MessageDigest
+  * objects as input, rather than
+- * org.apache.xml.security.algorithms.MessageDigestAlgorithm objects.
++ * com.sun.org.apache.xml.internal.security.algorithms.MessageDigestAlgorithm objects.
+  * It also optionally caches the input bytes.
+  *
+  * @author raul
++ * @author Sean Mullan
+  */
+ public class DigesterOutputStream extends OutputStream {
+     private boolean buffer = false;
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/MacOutputStream.java b/src/share/classes/org/jcp/xml/dsig/internal/MacOutputStream.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/MacOutputStream.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/MacOutputStream.java
+@@ -24,15 +24,14 @@
+ import javax.crypto.Mac;
+ 
+ /**
+- * Derived from Apache sources and changed to use Mac objects
+- * objects instead of org.apache.xml.security.algorithms.SignatureAlgorithm
+- * objects.
++ * Derived from Apache sources and changed to use Mac objects instead of
++ * com.sun.org.apache.xml.internal.security.algorithms.SignatureAlgorithm objects.
+  *
+  * @author raul
++ * @author Sean Mullan
+  *
+  */
+ public class MacOutputStream extends ByteArrayOutputStream {
+-    private final static byte none[]="error".getBytes();
+     private final Mac mac;
+ 
+     public MacOutputStream(Mac mac) {
+@@ -40,22 +39,20 @@
+     }
+ 
+     /** @inheritDoc */
+-    public byte[] toByteArray() {
+-        return none;
+-    }
+-
+-    /** @inheritDoc */
+     public void write(byte[] arg0)  {
++        super.write(arg0, 0, arg0.length);
+         mac.update(arg0);
+     }
+ 
+     /** @inheritDoc */
+     public void write(int arg0) {
+-        mac.update((byte)arg0);
++        super.write(arg0);
++        mac.update((byte) arg0);
+     }
+ 
+     /** @inheritDoc */
+     public void write(byte[] arg0, int arg1, int arg2) {
+-        mac.update(arg0,arg1,arg2);
++        super.write(arg0, arg1, arg2);
++        mac.update(arg0, arg1, arg2);
+     }
+ }
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/SignerOutputStream.java b/src/share/classes/org/jcp/xml/dsig/internal/SignerOutputStream.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/SignerOutputStream.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/SignerOutputStream.java
+@@ -19,7 +19,10 @@
+  *
+  */
+ /*
+- * $Id: SignerOutputStream.java,v 1.1.2.2 2005/08/12 18:01:58 mullan Exp $
++ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
++ */
++/*
++ * $Id: SignerOutputStream.java,v 1.2 2008/07/24 15:20:31 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal;
+ 
+@@ -29,10 +32,11 @@
+ 
+ /**
+  * Derived from Apache sources and changed to use java.security.Signature
+- * objects as input instead of org.apache.xml.security.algorithms.SignatureAlgorithm
++ * objects as input instead of com.sun.org.apache.xml.internal.security.algorithms.SignatureAlgorithm
+  * objects.
+  *
+  * @author raul
++ * @author Sean Mullan
+  */
+ public class SignerOutputStream extends ByteArrayOutputStream {
+     private final Signature sig;
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java
+@@ -1,29 +1,28 @@
+ /*
+- * Copyright (c) 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: ApacheCanonicalizer.java,v 1.17 2005/09/19 18:20:04 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: ApacheCanonicalizer.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+@@ -53,6 +52,10 @@
+ 
+ public abstract class ApacheCanonicalizer extends TransformService {
+ 
++    static {
++        com.sun.org.apache.xml.internal.security.Init.init();
++    }
++
+     private static Logger log = Logger.getLogger("org.jcp.xml.dsig.internal.dom");
+     protected Canonicalizer apacheCanonicalizer;
+     private Transform apacheTransform;
+@@ -235,13 +238,9 @@
+         }
+ 
+         try {
+-            if (os != null) {
+-                in = apacheTransform.performTransform(in, os);
+-                if (!in.isNodeSet() && !in.isElement()) {
+-                    return null;
+-                }
+-            } else {
+-                in = apacheTransform.performTransform(in);
++            in = apacheTransform.performTransform(in, os);
++            if (!in.isNodeSet() && !in.isElement()) {
++                return null;
+             }
+             if (in.isOctetStream()) {
+                 return new ApacheOctetStreamData(in);
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheData.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheData.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheData.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheData.java
+@@ -1,29 +1,28 @@
+ /*
+- * Copyright (c) 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: ApacheData.java,v 1.4 2005/05/10 18:15:31 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: ApacheData.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheNodeSetData.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheNodeSetData.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheNodeSetData.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheNodeSetData.java
+@@ -1,29 +1,28 @@
+ /*
+- * Copyright (c) 2005, 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: ApacheNodeSetData.java,v 1.4 2005/05/10 18:15:31 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: ApacheNodeSetData.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+@@ -83,7 +82,7 @@
+             boolean skipNode = false;
+             while (it.hasNext() && !skipNode) {
+                 NodeFilter nf = (NodeFilter) it.next();
+-                if (!nf.isNodeInclude(currentNode)) {
++                if (nf.isNodeInclude(currentNode)!=1) {
+                     skipNode = true;
+                 }
+             }
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheOctetStreamData.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheOctetStreamData.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheOctetStreamData.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheOctetStreamData.java
+@@ -1,29 +1,28 @@
+ /*
+- * Copyright (c) 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: ApacheOctetStreamData.java,v 1.4 2005/05/10 18:15:31 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: ApacheOctetStreamData.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheTransform.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheTransform.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheTransform.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheTransform.java
+@@ -1,29 +1,28 @@
+ /*
+- * Copyright (c) 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: ApacheTransform.java,v 1.23 2005/09/15 14:29:03 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: ApacheTransform.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+@@ -54,6 +53,10 @@
+  */
+ public abstract class ApacheTransform extends TransformService {
+ 
++    static {
++        com.sun.org.apache.xml.internal.security.Init.init();
++    }
++
+     private static Logger log = Logger.getLogger("org.jcp.xml.dsig.internal.dom");
+     private Transform apacheTransform;
+     protected Document ownerDoc;
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMBase64Transform.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMBase64Transform.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMBase64Transform.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMBase64Transform.java
+@@ -1,29 +1,28 @@
+ /*
+- * Copyright (c) 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: DOMBase64Transform.java,v 1.14 2005/05/10 18:15:31 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: DOMBase64Transform.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMCanonicalXMLC14N11Method.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMCanonicalXMLC14N11Method.java
+new file mode 100644
+--- /dev/null
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMCanonicalXMLC14N11Method.java
+@@ -0,0 +1,79 @@
++/*
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
++ */
++/*
++ * Copyright 2008 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.
++ *
++ */
++/*
++ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
++ */
++/*
++ * $Id: DOMCanonicalXMLC14N11Method.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
++ */
++package org.jcp.xml.dsig.internal.dom;
++
++import javax.xml.crypto.*;
++import javax.xml.crypto.dsig.*;
++import javax.xml.crypto.dsig.spec.TransformParameterSpec;
++
++import java.security.InvalidAlgorithmParameterException;
++
++import com.sun.org.apache.xml.internal.security.c14n.Canonicalizer;
++import com.sun.org.apache.xml.internal.security.c14n.InvalidCanonicalizerException;
++
++/**
++ * DOM-based implementation of CanonicalizationMethod for Canonical XML 1.1
++ * (with or without comments). Uses Apache XML-Sec Canonicalizer.
++ *
++ * @author Sean Mullan
++ */
++public final class DOMCanonicalXMLC14N11Method extends ApacheCanonicalizer {
++
++    public static final String C14N_11 = "http://www.w3.org/2006/12/xml-c14n11";
++    public static final String C14N_11_WITH_COMMENTS
++        = "http://www.w3.org/2006/12/xml-c14n11#WithComments";
++
++    public void init(TransformParameterSpec params)
++        throws InvalidAlgorithmParameterException {
++        if (params != null) {
++            throw new InvalidAlgorithmParameterException("no parameters " +
++                "should be specified for Canonical XML 1.1 algorithm");
++        }
++    }
++
++    public Data transform(Data data, XMLCryptoContext xc)
++        throws TransformException {
++
++        // ignore comments if dereferencing same-document URI that requires
++        // you to omit comments, even if the Transform says otherwise -
++        // this is to be compliant with section 4.3.3.3 of W3C Rec.
++        if (data instanceof DOMSubTreeData) {
++            DOMSubTreeData subTree = (DOMSubTreeData) data;
++            if (subTree.excludeComments()) {
++                try {
++                    apacheCanonicalizer = Canonicalizer.getInstance(C14N_11);
++                } catch (InvalidCanonicalizerException ice) {
++                    throw new TransformException
++                        ("Couldn't find Canonicalizer for: " +
++                         C14N_11 + ": " + ice.getMessage(), ice);
++                }
++            }
++        }
++
++        return canonicalize(data, xc);
++    }
++}
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMCanonicalXMLC14NMethod.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMCanonicalXMLC14NMethod.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMCanonicalXMLC14NMethod.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMCanonicalXMLC14NMethod.java
+@@ -1,29 +1,28 @@
+ /*
+- * Copyright (c) 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: DOMCanonicalXMLC14NMethod.java,v 1.24.4.1 2005/08/12 15:27:49 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: DOMCanonicalXMLC14NMethod.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMCanonicalizationMethod.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMCanonicalizationMethod.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMCanonicalizationMethod.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMCanonicalizationMethod.java
+@@ -1,34 +1,34 @@
+ /*
+- * Copyright (c) 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: DOMCanonicalizationMethod.java,v 1.25 2005/05/10 18:15:31 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: DOMCanonicalizationMethod.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+ import java.io.OutputStream;
+ import java.security.InvalidAlgorithmParameterException;
++import java.security.Provider;
+ 
+ import org.w3c.dom.Element;
+ 
+@@ -60,9 +60,9 @@
+      *
+      * @param cmElem a CanonicalizationMethod element
+      */
+-    public DOMCanonicalizationMethod(Element cmElem, XMLCryptoContext context)
+-        throws MarshalException{
+-        super(cmElem, context);
++    public DOMCanonicalizationMethod(Element cmElem, XMLCryptoContext context,
++        Provider provider) throws MarshalException {
++        super(cmElem, context, provider);
+     }
+ 
+     /**
+@@ -75,7 +75,7 @@
+      *     additional context (may be <code>null</code> if not applicable)
+      * @return the canonicalized data
+      * @throws NullPointerException if <code>data</code> is <code>null</code>
+-     * @throws XMLSignatureException if an unexpected error occurs while
++     * @throws TransformException if an unexpected error occurs while
+      *    canonicalizing the data
+      */
+     public Data canonicalize(Data data, XMLCryptoContext xc)
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMCryptoBinary.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMCryptoBinary.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMCryptoBinary.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMCryptoBinary.java
+@@ -1,29 +1,28 @@
+ /*
+- * Copyright (c) 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: DOMCryptoBinary.java,v 1.14 2005/05/12 19:28:29 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: DOMCryptoBinary.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMDigestMethod.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMDigestMethod.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMDigestMethod.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMDigestMethod.java
+@@ -1,29 +1,28 @@
+ /*
+- * Copyright (c) 2005, 2007, Oracle and/or its affiliates. All rights reserved.
+- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+- *
+- * This code is free software; you can redistribute 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: DOMDigestMethod.java,v 1.17 2005/05/10 18:15:32 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: DOMDigestMethod.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+@@ -127,7 +126,7 @@
+ 
+     /**
+      * Unmarshals <code>DigestMethodParameterSpec</code> from the specified
+-     * <code>Element</code>. By default, this method throws an exception since
++     * <code>Element</code>.  By default, this method throws an exception since
+      * most DigestMethod algorithms do not have parameters. Subclasses should
+      * override it if they have parameters.
+      *
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMEnvelopedTransform.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMEnvelopedTransform.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMEnvelopedTransform.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMEnvelopedTransform.java
+@@ -1,29 +1,28 @@
+ /*
+- * Copyright (c) 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: DOMEnvelopedTransform.java,v 1.16 2005/05/10 18:15:32 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: DOMEnvelopedTransform.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMExcC14NMethod.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMExcC14NMethod.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMExcC14NMethod.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMExcC14NMethod.java
+@@ -1,29 +1,28 @@
+ /*
+- * Copyright (c) 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: DOMExcC14NMethod.java,v 1.28 2005/09/23 20:20:41 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: DOMExcC14NMethod.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+@@ -104,7 +103,7 @@
+         Element excElem = DOMUtils.createElement
+             (ownerDoc, "InclusiveNamespaces",
+              CanonicalizationMethod.EXCLUSIVE, prefix);
+-        if (prefix == null) {
++        if (prefix == null || prefix.length() == 0) {
+             excElem.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns",
+                 CanonicalizationMethod.EXCLUSIVE);
+         } else {
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMHMACSignatureMethod.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMHMACSignatureMethod.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMHMACSignatureMethod.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMHMACSignatureMethod.java
+@@ -1,29 +1,28 @@
++/*
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
++ */
++/*
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
+ /*
+  * Copyright (c) 2005, 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
+- * 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.
+  */
+ /*
+- * $Id: DOMHMACSignatureMethod.java,v 1.17 2005/09/15 14:29:04 mullan Exp $
++ * $Id: DOMHMACSignatureMethod.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfo.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfo.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfo.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfo.java
+@@ -1,29 +1,28 @@
+ /*
+- * Copyright (c) 2005, 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: DOMKeyInfo.java,v 1.19 2005/05/12 19:28:30 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: DOMKeyInfo.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+@@ -33,6 +32,7 @@
+ import javax.xml.crypto.dsig.keyinfo.KeyInfo;
+ import javax.xml.crypto.dom.*;
+ 
++import java.security.Provider;
+ import java.util.*;
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+@@ -82,10 +82,10 @@
+     /**
+      * Creates a <code>DOMKeyInfo</code> from XML.
+      *
+-     * @param input XML input
++     * @param kiElem KeyInfo element
+      */
+-    public DOMKeyInfo(Element kiElem, XMLCryptoContext context)
+-        throws MarshalException {
++    public DOMKeyInfo(Element kiElem, XMLCryptoContext context,
++        Provider provider) throws MarshalException {
+         // get Id attribute, if specified
+         id = DOMUtils.getAttributeValue(kiElem, "Id");
+ 
+@@ -112,7 +112,10 @@
+             } else if (localName.equals("KeyValue")) {
+                 content.add(new DOMKeyValue(childElem));
+             } else if (localName.equals("RetrievalMethod")) {
+-                content.add(new DOMRetrievalMethod(childElem, context));
++                content.add
++                    (new DOMRetrievalMethod(childElem, context, provider));
++            } else if (localName.equals("PGPData")) {
++                content.add(new DOMPGPData(childElem));
+             } else { //may be MgmtData, SPKIData or element from other namespace
+                 content.add(new javax.xml.crypto.dom.DOMStructure((childElem)));
+             }
+@@ -139,7 +142,7 @@
+         Element kiElem = DOMUtils.createElement
+             (DOMUtils.getOwnerDocument(pNode), "KeyInfo",
+              XMLSignature.XMLNS, dsPrefix);
+-        if (dsPrefix == null) {
++        if (dsPrefix == null || dsPrefix.length() == 0) {
+             kiElem.setAttributeNS
+                 ("http://www.w3.org/2000/xmlns/", "xmlns", XMLSignature.XMLNS);
+         } else {
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java
+@@ -1,34 +1,34 @@
+ /*
+- * Copyright (c) 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: DOMKeyInfoFactory.java,v 1.24 2005/09/23 20:18:50 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: DOMKeyInfoFactory.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+ import java.math.BigInteger;
+-import java.security.*;
++import java.security.KeyException;
++import java.security.PublicKey;
+ import java.util.List;
+ import javax.xml.crypto.*;
+ import javax.xml.crypto.dsig.*;
+@@ -45,7 +45,6 @@
+  */
+ public final class DOMKeyInfoFactory extends KeyInfoFactory {
+ 
+-
+     public DOMKeyInfoFactory() { }
+ 
+     public KeyInfo newKeyInfo(List content) {
+@@ -135,7 +134,7 @@
+                 "support DOM Level 2 and be namespace aware");
+         }
+         if (tag.equals("KeyInfo")) {
+-            return new DOMKeyInfo(element, null);
++            return new DOMKeyInfo(element, null, getProvider());
+         } else {
+             throw new MarshalException("invalid KeyInfo tag: " + tag);
+         }
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyName.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyName.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyName.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyName.java
+@@ -1,29 +1,28 @@
+ /*
+- * Copyright (c) 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: DOMKeyName.java,v 1.12 2005/05/10 18:15:32 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: DOMKeyName.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java
+@@ -1,29 +1,28 @@
+ /*
+- * Copyright (c) 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: DOMKeyValue.java,v 1.18 2005/05/10 18:15:33 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: DOMKeyValue.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java
+@@ -1,29 +1,28 @@
+ /*
+- * Copyright (c) 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: DOMManifest.java,v 1.16 2005/05/12 19:28:31 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: DOMManifest.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+@@ -31,6 +30,7 @@
+ import javax.xml.crypto.dom.DOMCryptoContext;
+ import javax.xml.crypto.dsig.*;
+ 
++import java.security.Provider;
+ import java.util.*;
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+@@ -83,13 +83,13 @@
+      *
+      * @param manElem a Manifest element
+      */
+-    public DOMManifest(Element manElem, XMLCryptoContext context)
+-        throws MarshalException {
++    public DOMManifest(Element manElem, XMLCryptoContext context,
++        Provider provider) throws MarshalException {
+         this.id = DOMUtils.getAttributeValue(manElem, "Id");
+         Element refElem = DOMUtils.getFirstChildElement(manElem);
+         List refs = new ArrayList();
+         while (refElem != null) {
+-            refs.add(new DOMReference(refElem, context));
++            refs.add(new DOMReference(refElem, context, provider));
+             refElem = DOMUtils.getNextSiblingElement(refElem);
+         }
+         this.references = Collections.unmodifiableList(refs);
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMPGPData.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMPGPData.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMPGPData.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMPGPData.java
+@@ -1,29 +1,28 @@
+ /*
+- * Copyright (c) 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: DOMPGPData.java,v 1.18 2005/05/12 19:28:31 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: DOMPGPData.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java
+@@ -1,28 +1,26 @@
+ /*
+- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
++ */
++/*
++ * Copyright 2005 The Apache Software Foundation.
+  *
+- * This code is free software; you can redistribute 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.
++ *  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
+  *
+- * This code is distributed in the hope that it will be useful, but WITHOUT
+- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+- * version 2 for more details (a copy is included in the LICENSE file that
+- * accompanied this code).
++ *      http://www.apache.org/licenses/LICENSE-2.0
+  *
+- * You should have received a copy of the GNU General Public License version
+- * 2 along with this work; if not, write to the Free Software Foundation,
+- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++ *  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.
+  *
+- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+- * or visit www.oracle.com if you need additional information or have any
+- * questions.
+  */
+-
++/*
++ * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
++ */
+ /*
+  * ===========================================================================
+  *
+@@ -31,7 +29,7 @@
+  * ===========================================================================
+  */
+ /*
+- * $Id: DOMReference.java,v 1.40 2005/09/19 18:27:04 mullan Exp $
++ * $Id: DOMReference.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+@@ -67,13 +65,27 @@
+ public final class DOMReference extends DOMStructure
+     implements Reference, DOMURIReference {
+ 
++   /**
++    * Look up useC14N11 system property. If true, an explicit C14N11 transform
++    * will be added if necessary when generating the signature. See section
++    * 3.1.1 of http://www.w3.org/2007/xmlsec/Drafts/xmldsig-core/ for more info.
++    *
++    * If true, overrides the same property if set in the XMLSignContext.
++    */
++    private static boolean useC14N11 =
++        AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
++            public Boolean run() {
++                return Boolean.getBoolean
++                    ("com.sun.org.apache.xml.internal.security.useC14N11");
++            }
++        });
++
+     private static Logger log = Logger.getLogger("org.jcp.xml.dsig.internal.dom");
+ 
+     private final DigestMethod digestMethod;
+     private final String id;
+-    private final List appliedTransforms;
+     private final List transforms;
+-    private final List allTransforms;
++    private List allTransforms;
+     private final Data appliedTransformData;
+     private Attr here;
+     private final String uri;
+@@ -87,6 +99,7 @@
+     private Data derefData;
+     private InputStream dis;
+     private MessageDigest md;
++    private Provider provider;
+ 
+     /**
+      * Creates a <code>Reference</code> from the specified parameters.
+@@ -104,24 +117,25 @@
+      *    not of type <code>Transform</code>
+      */
+     public DOMReference(String uri, String type, DigestMethod dm,
+-        List transforms, String id) {
+-        this(uri, type, dm, null, null, transforms, id, null);
+-    }
+-
+-    public DOMReference(String uri, String type, DigestMethod dm,
+-        List appliedTransforms, Data result, List transforms, String id) {
+-        this(uri, type, dm, appliedTransforms, result, transforms, id, null);
++        List transforms, String id, Provider provider) {
++        this(uri, type, dm, null, null, transforms, id, null, provider);
+     }
+ 
+     public DOMReference(String uri, String type, DigestMethod dm,
+         List appliedTransforms, Data result, List transforms, String id,
+-        byte[] digestValue){
++        Provider provider) {
++        this(uri, type, dm, appliedTransforms,
++             result, transforms, id, null, provider);
++    }
++
++    public DOMReference(String uri, String type, DigestMethod dm,
++        List appliedTransforms, Data result, List transforms, String id,
++        byte[] digestValue, Provider provider) {
+         if (dm == null) {
+             throw new NullPointerException("DigestMethod must be non-null");
+         }
+-        if (appliedTransforms == null || appliedTransforms.isEmpty()) {
+-            this.appliedTransforms = Collections.EMPTY_LIST;
+-        } else {
++        this.allTransforms = new ArrayList();
++        if (appliedTransforms != null) {
+             List transformsCopy = new ArrayList(appliedTransforms);
+             for (int i = 0, size = transformsCopy.size(); i < size; i++) {
+                 if (!(transformsCopy.get(i) instanceof Transform)) {
+@@ -129,10 +143,9 @@
+                         ("appliedTransforms["+i+"] is not a valid type");
+                 }
+             }
+-            this.appliedTransforms =
+-                Collections.unmodifiableList(transformsCopy);
++            this.allTransforms = transformsCopy;
+         }
+-        if (transforms == null || transforms.isEmpty()) {
++        if (transforms == null) {
+             this.transforms = Collections.EMPTY_LIST;
+         } else {
+             List transformsCopy = new ArrayList(transforms);
+@@ -142,11 +155,9 @@
+                         ("transforms["+i+"] is not a valid type");
+                 }
+             }
+-            this.transforms = Collections.unmodifiableList(transformsCopy);
++            this.transforms = transformsCopy;
++            this.allTransforms.addAll(transformsCopy);
+         }
+-        List all = new ArrayList(this.appliedTransforms);
+-        all.addAll(this.transforms);
+-        this.allTransforms = Collections.unmodifiableList(all);
+         this.digestMethod = dm;
+         this.uri = uri;
+         if ((uri != null) && (!uri.equals(""))) {
+@@ -163,6 +174,7 @@
+             this.digested = true;
+         }
+         this.appliedTransformData = result;
++        this.provider = provider;
+     }
+ 
+     /**
+@@ -170,15 +182,16 @@
+      *
+      * @param refElem a Reference element
+      */
+-    public DOMReference(Element refElem, XMLCryptoContext context)
+-        throws MarshalException {
++    public DOMReference(Element refElem, XMLCryptoContext context,
++        Provider provider) throws MarshalException {
+         // unmarshal Transforms, if specified
+         Element nextSibling = DOMUtils.getFirstChildElement(refElem);
+         List transforms = new ArrayList(5);
+         if (nextSibling.getLocalName().equals("Transforms")) {
+             Element transformElem = DOMUtils.getFirstChildElement(nextSibling);
+             while (transformElem != null) {
+-                transforms.add(new DOMTransform(transformElem, context));
++                transforms.add
++                    (new DOMTransform(transformElem, context, provider));
+                 transformElem = DOMUtils.getNextSiblingElement(transformElem);
+             }
+             nextSibling = DOMUtils.getNextSiblingElement(nextSibling);
+@@ -203,15 +216,10 @@
+         this.type = DOMUtils.getAttributeValue(refElem, "Type");
+         this.here = refElem.getAttributeNodeNS(null, "URI");
+         this.refElem = refElem;
+-
+-        if (transforms.isEmpty()) {
+-            this.transforms = Collections.EMPTY_LIST;
+-        } else {
+-            this.transforms = Collections.unmodifiableList(transforms);
+-        }
+-        this.appliedTransforms = Collections.EMPTY_LIST;
++        this.transforms = transforms;
+         this.allTransforms = transforms;
+         this.appliedTransformData = null;
++        this.provider = provider;
+     }
+ 
+     public DigestMethod getDigestMethod() {
+@@ -231,7 +239,7 @@
+     }
+ 
+     public List getTransforms() {
+-        return allTransforms;
++        return Collections.unmodifiableList(allTransforms);
+     }
+ 
+     public byte[] getDigestValue() {
+@@ -259,17 +267,13 @@
+         DOMUtils.setAttribute(refElem, "Type", type);
+ 
+         // create and append Transforms element
+-        if (!transforms.isEmpty() || !appliedTransforms.isEmpty()) {
++        if (!allTransforms.isEmpty()) {
+             Element transformsElem = DOMUtils.createElement
+                 (ownerDoc, "Transforms", XMLSignature.XMLNS, dsPrefix);
+             refElem.appendChild(transformsElem);
+-            for (int i = 0, size = appliedTransforms.size(); i < size; i++) {
++            for (int i = 0, size = allTransforms.size(); i < size; i++) {
+                 DOMStructure transform =
+-                    (DOMStructure) appliedTransforms.get(i);
+-                transform.marshal(transformsElem, dsPrefix, context);
+-            }
+-            for (int i = 0, size = transforms.size(); i < size; i++) {
+-                DOMStructure transform = (DOMStructure) transforms.get(i);
++                    (DOMStructure) allTransforms.get(i);
+                 transform.marshal(transformsElem, dsPrefix, context);
+             }
+         }
+@@ -416,21 +420,62 @@
+         try {
+             if (data != null) {
+                 XMLSignatureInput xi;
++                // explicitly use C14N 1.1 when generating signature
++                // first check system property, then context property
++                boolean c14n11 = useC14N11;
++                String c14nalg = CanonicalizationMethod.INCLUSIVE;
++                if (context instanceof XMLSignContext) {
++                    if (!c14n11) {
++                        Boolean prop = (Boolean) context.getProperty
++                            ("com.sun.org.apache.xml.internal.security.useC14N11");
++                        c14n11 = (prop != null && prop.booleanValue() == true);
++                        if (c14n11) {
++                            c14nalg = "http://www.w3.org/2006/12/xml-c14n11";
++                        }
++                    } else {
++                        c14nalg = "http://www.w3.org/2006/12/xml-c14n11";
++                    }
++                }
+                 if (data instanceof ApacheData) {
+                     xi = ((ApacheData) data).getXMLSignatureInput();
+                 } else if (data instanceof OctetStreamData) {
+                     xi = new XMLSignatureInput
+                         (((OctetStreamData)data).getOctetStream());
+                 } else if (data instanceof NodeSetData) {
+-                    TransformService spi = TransformService.getInstance
+-                        (CanonicalizationMethod.INCLUSIVE, "DOM");
++                    TransformService spi = null;
++                    try {
++                        spi = TransformService.getInstance(c14nalg, "DOM");
++                    } catch (NoSuchAlgorithmException nsae) {
++                        spi = TransformService.getInstance
++                            (c14nalg, "DOM", provider);
++                    }
+                     data = spi.transform(data, context);
+                     xi = new XMLSignatureInput
+                         (((OctetStreamData)data).getOctetStream());
+                 } else {
+                     throw new XMLSignatureException("unrecognized Data type");
+                 }
+-                xi.updateOutputStream(os);
++                if (context instanceof XMLSignContext && c14n11
++                    && !xi.isOctetStream() && !xi.isOutputStreamSet()) {
++                    DOMTransform t = new DOMTransform
++                        (TransformService.getInstance(c14nalg, "DOM"));
++                    Element transformsElem = null;
++                    String dsPrefix = DOMUtils.getSignaturePrefix(context);
++                    if (allTransforms.isEmpty()) {
++                        transformsElem = DOMUtils.createElement(
++                            refElem.getOwnerDocument(),
++                            "Transforms", XMLSignature.XMLNS, dsPrefix);
++                        refElem.insertBefore(transformsElem,
++                            DOMUtils.getFirstChildElement(refElem));
++                    } else {
++                        transformsElem = DOMUtils.getFirstChildElement(refElem);
++                    }
++                    t.marshal(transformsElem, dsPrefix, (DOMCryptoContext) context);
++                    allTransforms.add(t);
++                    xi.updateOutputStream(os, true);
++                } else {
++                    xi.updateOutputStream(os);
++                }
+             }
+             os.flush();
+             if (cache != null && cache.booleanValue() == true) {
+@@ -466,7 +511,7 @@
+             Arrays.equals(digestValue, oref.getDigestValue());
+ 
+         return (digestMethod.equals(oref.getDigestMethod()) && idsEqual &&
+-            urisEqual && typesEqual && transforms.equals(oref.getTransforms()));
++            urisEqual && typesEqual && allTransforms.equals(oref.getTransforms()));
+     }
+ 
+     boolean isDigested() {
+@@ -486,7 +531,7 @@
+                     };
+                 } catch (Exception e) {
+                     // log a warning
+-                    log.log(Level.WARNING,
++                            log.log(Level.WARNING,
+                         "cannot cache dereferenced data: " + e);
+                     return null;
+                 }
+@@ -499,7 +544,7 @@
+                   (xsi.getOctetStream(), xsi.getSourceURI(), xsi.getMIMEType());
+                 } catch (IOException ioe) {
+                     // log a warning
+-                    log.log(Level.WARNING,
++                            log.log(Level.WARNING,
+                         "cannot cache dereferenced data: " + ioe);
+                     return null;
+                 }
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java
+@@ -1,28 +1,26 @@
++/*
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
++ */
++/*
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
+ /*
+  * Copyright (c) 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.
+  */
+-
+ /*
+  * ===========================================================================
+  *
+@@ -31,13 +29,14 @@
+  * ===========================================================================
+  */
+ /*
+- * $Id: DOMRetrievalMethod.java,v 1.24 2005/05/12 19:28:32 mullan Exp $
++ * $Id: DOMRetrievalMethod.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+ import java.io.ByteArrayInputStream;
+ import java.net.URI;
+ import java.net.URISyntaxException;
++import java.security.Provider;
+ import java.util.*;
+ import javax.xml.crypto.*;
+ import javax.xml.crypto.dsig.*;
+@@ -116,8 +115,8 @@
+      *
+      * @param rmElem a RetrievalMethod element
+      */
+-    public DOMRetrievalMethod(Element rmElem, XMLCryptoContext context)
+-        throws MarshalException {
++    public DOMRetrievalMethod(Element rmElem, XMLCryptoContext context,
++        Provider provider) throws MarshalException {
+         // get URI and Type attributes
+         uri = DOMUtils.getAttributeValue(rmElem, "URI");
+         type = DOMUtils.getAttributeValue(rmElem, "Type");
+@@ -132,7 +131,8 @@
+             Element transformElem =
+                 DOMUtils.getFirstChildElement(transformsElem);
+             while (transformElem != null) {
+-                transforms.add(new DOMTransform(transformElem, context));
++                transforms.add
++                    (new DOMTransform(transformElem, context, provider));
+                 transformElem = DOMUtils.getNextSiblingElement(transformElem);
+             }
+         }
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureMethod.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureMethod.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureMethod.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureMethod.java
+@@ -1,32 +1,28 @@
+ /*
+- * Copyright (c) 2005, 2007, Oracle and/or its affiliates. All rights reserved.
+- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+- *
+- * This code is free software; you can redistribute 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * Copyright  1999-2004 The Apache Software Foundation.
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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: DOMSignatureMethod.java,v 1.20.4.1 2005/08/12 14:23:49 mullan Exp $
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: DOMSignatureMethod.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+@@ -226,7 +222,11 @@
+         }
+         if (signature == null) {
+             try {
+-                signature = Signature.getInstance(getSignatureAlgorithm());
++                Provider p = (Provider) context.getProperty
++                    ("org.jcp.xml.dsig.internal.dom.SignatureProvider");
++                signature = (p == null)
++                    ? Signature.getInstance(getSignatureAlgorithm())
++                    : Signature.getInstance(getSignatureAlgorithm(), p);
+             } catch (NoSuchAlgorithmException nsae) {
+                 throw new XMLSignatureException(nsae);
+             }
+@@ -274,7 +274,11 @@
+         }
+         if (signature == null) {
+             try {
+-                signature = Signature.getInstance(getSignatureAlgorithm());
++                Provider p = (Provider) context.getProperty
++                    ("org.jcp.xml.dsig.internal.dom.SignatureProvider");
++                signature = (p == null)
++                    ? Signature.getInstance(getSignatureAlgorithm())
++                    : Signature.getInstance(getSignatureAlgorithm(), p);
+             } catch (NoSuchAlgorithmException nsae) {
+                 throw new XMLSignatureException(nsae);
+             }
+@@ -302,7 +306,7 @@
+ 
+     /**
+      * Marshals the algorithm-specific parameters to an Element and
+-     * appends it to the specified parent element.  By default, this method
++     * appends it to the specified parent element. By default, this method
+      * throws an exception since most SignatureMethod algorithms do not have
+      * parameters. Subclasses should override it if they have parameters.
+      *
+@@ -360,7 +364,6 @@
+     private static byte[] convertASN1toXMLDSIG(byte asn1Bytes[])
+         throws IOException {
+ 
+-        // THIS CODE IS COPIED FROM APACHE (see copyright at top of file)
+         byte rLength = asn1Bytes[3];
+         int i;
+ 
+@@ -401,7 +404,6 @@
+     private static byte[] convertXMLDSIGtoASN1(byte xmldsigBytes[])
+         throws IOException {
+ 
+-        // THIS CODE IS COPIED FROM APACHE (see copyright at top of file)
+         if (xmldsigBytes.length != 40) {
+             throw new IOException("Invalid XMLDSIG format of DSA signature");
+         }
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java
+@@ -1,29 +1,28 @@
+ /*
+- * Copyright (c) 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: DOMSignatureProperties.java,v 1.12 2005/05/12 19:28:32 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: DOMSignatureProperties.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java
+@@ -1,29 +1,28 @@
+ /*
+- * Copyright (c) 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: DOMSignatureProperty.java,v 1.14 2005/05/12 19:28:32 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: DOMSignatureProperty.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java
+@@ -1,29 +1,28 @@
+ /*
+- * Copyright (c) 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: DOMSignedInfo.java,v 1.30 2005/09/23 20:14:07 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: DOMSignedInfo.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+@@ -37,6 +36,7 @@
+ import java.io.IOException;
+ import java.io.InputStreamReader;
+ import java.io.OutputStream;
++import java.security.Provider;
+ import java.util.*;
+ import java.util.logging.Level;
+ import java.util.logging.Logger;
+@@ -126,8 +126,8 @@
+      *
+      * @param siElem a SignedInfo element
+      */
+-    public DOMSignedInfo(Element siElem, XMLCryptoContext context)
+-        throws MarshalException {
++    public DOMSignedInfo(Element siElem, XMLCryptoContext context,
++        Provider provider) throws MarshalException {
+         localSiElem = siElem;
+         ownerDoc = siElem.getOwnerDocument();
+ 
+@@ -136,7 +136,8 @@
+ 
+         // unmarshal CanonicalizationMethod
+         Element cmElem = DOMUtils.getFirstChildElement(siElem);
+-        canonicalizationMethod = new DOMCanonicalizationMethod(cmElem, context);
++        canonicalizationMethod = new DOMCanonicalizationMethod
++            (cmElem, context, provider);
+ 
+         // unmarshal SignatureMethod
+         Element smElem = DOMUtils.getNextSiblingElement(cmElem);
+@@ -146,7 +147,7 @@
+         ArrayList refList = new ArrayList(5);
+         Element refElem = DOMUtils.getNextSiblingElement(smElem);
+         while (refElem != null) {
+-            refList.add(new DOMReference(refElem, context));
++            refList.add(new DOMReference(refElem, context, provider));
+             refElem = DOMUtils.getNextSiblingElement(refElem);
+         }
+         references = Collections.unmodifiableList(refList);
+@@ -188,9 +189,8 @@
+ 
+         DOMSubTreeData subTree = new DOMSubTreeData(localSiElem, true);
+ 
+-        OctetStreamData data = null;
+         try {
+-            data = (OctetStreamData) ((DOMCanonicalizationMethod)
++            Data data = ((DOMCanonicalizationMethod)
+                 canonicalizationMethod).canonicalize(subTree, context, os);
+         } catch (TransformException te) {
+             throw new XMLSignatureException(te);
+@@ -205,9 +205,11 @@
+             char[] siBytes = new char[signedInfoBytes.length];
+             try {
+                 isr.read(siBytes);
+-            } catch (IOException ioex) {} //ignore since this is logging code
+-            log.log(Level.FINE, "Canonicalized SignedInfo:\n"
+-                + new String(siBytes));
++                log.log(Level.FINE, "Canonicalized SignedInfo:\n"
++                    + new String(siBytes));
++            } catch (IOException ioex) {
++                log.log(Level.FINE, "IOException reading SignedInfo bytes");
++            }
+             log.log(Level.FINE, "Data to be signed/verified:"
+                 + Base64.encode(signedInfoBytes));
+         }
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMStructure.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMStructure.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMStructure.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMStructure.java
+@@ -1,29 +1,28 @@
+ /*
+- * Copyright (c) 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: DOMStructure.java,v 1.11 2005/05/10 18:15:34 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: DOMStructure.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSubTreeData.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSubTreeData.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSubTreeData.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSubTreeData.java
+@@ -1,29 +1,28 @@
+ /*
+- * Copyright (c) 2005, 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: DOMSubTreeData.java,v 1.2 2005/09/15 14:29:04 mullan Exp $
++ * Copyright 2006 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      http://www.apache.org/licenses/LICENSE-2.0
++ *
++ *  Unless required by applicable law or agreed to in writing, software
++ *  distributed under the License is distributed on an "AS IS" BASIS,
++ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ *  See the License for the specific language governing permissions and
++ *  limitations under the License.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: DOMSubTreeData.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMTransform.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMTransform.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMTransform.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMTransform.java
+@@ -1,35 +1,35 @@
+ /*
+- * Copyright (c) 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: DOMTransform.java,v 1.25 2005/05/10 18:15:34 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: DOMTransform.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+ import java.io.OutputStream;
+ import java.security.InvalidAlgorithmParameterException;
+ import java.security.NoSuchAlgorithmException;
++import java.security.Provider;
+ import java.security.spec.AlgorithmParameterSpec;
+ 
+ import org.w3c.dom.Document;
+@@ -68,14 +68,17 @@
+      *
+      * @param transElem a Transform element
+      */
+-    public DOMTransform(Element transElem, XMLCryptoContext context)
+-        throws MarshalException {
+-        Document ownerDoc = transElem.getOwnerDocument();
++    public DOMTransform(Element transElem, XMLCryptoContext context,
++        Provider provider) throws MarshalException {
+         String algorithm = DOMUtils.getAttributeValue(transElem, "Algorithm");
+         try {
+             spi = TransformService.getInstance(algorithm, "DOM");
+-        } catch (NoSuchAlgorithmException e) {
+-            throw new MarshalException(e);
++        } catch (NoSuchAlgorithmException e1) {
++            try {
++                spi = TransformService.getInstance(algorithm, "DOM", provider);
++            } catch (NoSuchAlgorithmException e2) {
++                throw new MarshalException(e2);
++            }
+         }
+         try {
+             spi.init(new javax.xml.crypto.dom.DOMStructure(transElem), context);
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMURIDereferencer.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMURIDereferencer.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMURIDereferencer.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMURIDereferencer.java
+@@ -1,29 +1,28 @@
+ /*
+- * Copyright (c) 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: DOMURIDereferencer.java,v 1.19 2005/09/23 20:09:34 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: DOMURIDereferencer.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+@@ -83,11 +82,9 @@
+             // this is a bit of a hack to check for registered
+             // IDRefs and manually register them with Apache's IdResolver
+             // map which includes builtin schema knowledge of DSig/Enc IDs
+-            if (context instanceof XMLSignContext) {
+-                Node referencedElem = dcc.getElementById(id);
+-                if (referencedElem != null) {
+-                    IdResolver.registerElementById((Element) referencedElem, id);
+-                }
++            Node referencedElem = dcc.getElementById(id);
++            if (referencedElem != null) {
++                IdResolver.registerElementById((Element) referencedElem, id);
+             }
+         }
+ 
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMUtils.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMUtils.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMUtils.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMUtils.java
+@@ -1,29 +1,28 @@
+ /*
+- * Copyright (c) 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: DOMUtils.java,v 1.18 2005/05/12 19:28:34 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: DOMUtils.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+@@ -77,7 +76,8 @@
+      */
+     public static Element createElement(Document doc, String tag, String nsURI,
+         String prefix) {
+-        String qName = prefix == null ? tag : prefix + ":" + tag;
++        String qName = (prefix == null || prefix.length() == 0)
++                       ? tag : prefix + ":" + tag;
+         return doc.createElementNS(nsURI, qName);
+     }
+ 
+@@ -327,6 +327,7 @@
+             XPathType type = (XPathType) types.get(i);
+             XPathType otype = (XPathType) otypes.get(i);
+             if (!type.getExpression().equals(otype.getExpression()) ||
++                !type.getNamespaceMap().equals(otype.getNamespaceMap()) ||
+                 type.getFilter() != otype.getFilter()) {
+                 return false;
+             }
+@@ -341,8 +342,8 @@
+ 
+     private static boolean paramsEqual(XPathFilterParameterSpec spec1,
+         XPathFilterParameterSpec spec2) {
+-
+-        return spec1.getXPath().equals(spec2.getXPath());
++        return (spec1.getXPath().equals(spec2.getXPath()) &&
++            spec1.getNamespaceMap().equals(spec2.getNamespaceMap()));
+     }
+ 
+     private static boolean paramsEqual(XSLTTransformParameterSpec spec1,
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java
+@@ -1,29 +1,28 @@
+ /*
+- * Copyright (c) 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: DOMX509Data.java,v 1.20 2005/05/12 19:28:34 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: DOMX509Data.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+@@ -53,7 +52,7 @@
+ public final class DOMX509Data extends DOMStructure implements X509Data {
+ 
+     private final List content;
+-    private CertificateFactory cf; //FIX - make this static?
++    private CertificateFactory cf;
+ 
+     /**
+      * Creates a DOMX509Data.
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509IssuerSerial.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509IssuerSerial.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509IssuerSerial.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509IssuerSerial.java
+@@ -1,29 +1,28 @@
+ /*
+- * Copyright (c) 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: DOMX509IssuerSerial.java,v 1.13 2005/05/10 18:15:35 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: DOMX509IssuerSerial.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java
+@@ -1,29 +1,28 @@
+ /*
+- * Copyright (c) 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: DOMXMLObject.java,v 1.16 2005/05/12 19:28:35 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: DOMXMLObject.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+@@ -31,6 +30,7 @@
+ import javax.xml.crypto.dom.DOMCryptoContext;
+ import javax.xml.crypto.dsig.*;
+ 
++import java.security.Provider;
+ import java.util.*;
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+@@ -87,8 +87,8 @@
+      * @param objElem an Object element
+      * @throws MarshalException if there is an error when unmarshalling
+      */
+-    public DOMXMLObject(Element objElem, XMLCryptoContext context)
+-        throws MarshalException {
++    public DOMXMLObject(Element objElem, XMLCryptoContext context,
++        Provider provider) throws MarshalException {
+         // unmarshal attributes
+         this.encoding = DOMUtils.getAttributeValue(objElem, "Encoding");
+         this.id = DOMUtils.getAttributeValue(objElem, "Id");
+@@ -103,7 +103,7 @@
+                 Element childElem = (Element) child;
+                 String tag = childElem.getLocalName();
+                 if (tag.equals("Manifest")) {
+-                    content.add(new DOMManifest(childElem, context));
++                    content.add(new DOMManifest(childElem, context, provider));
+                     continue;
+                 } else if (tag.equals("SignatureProperties")) {
+                     content.add(new DOMSignatureProperties(childElem));
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java
+@@ -1,28 +1,26 @@
++/*
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
++ */
++/*
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
+ /*
+  * Copyright (c) 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.
+  */
+-
+ /*
+  * ===========================================================================
+  *
+@@ -31,7 +29,7 @@
+  * ===========================================================================
+  */
+ /*
+- * $Id: DOMXMLSignature.java,v 1.42 2005/09/23 20:29:04 mullan Exp $
++ * $Id: DOMXMLSignature.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+@@ -45,6 +43,7 @@
+ import java.io.*;
+ import java.security.InvalidKeyException;
+ import java.security.Key;
++import java.security.Provider;
+ import java.util.Collections;
+ import java.util.ArrayList;
+ import java.util.HashMap;
+@@ -128,8 +127,8 @@
+      * @param sigElem Signature element
+      * @throws MarshalException if XMLSignature cannot be unmarshalled
+      */
+-    public DOMXMLSignature(Element sigElem, XMLCryptoContext context)
+-        throws MarshalException {
++    public DOMXMLSignature(Element sigElem, XMLCryptoContext context,
++        Provider provider) throws MarshalException {
+         localSigElem = sigElem;
+         ownerDoc = localSigElem.getOwnerDocument();
+ 
+@@ -138,7 +137,7 @@
+ 
+         // unmarshal SignedInfo
+         Element siElem = DOMUtils.getFirstChildElement(localSigElem);
+-        si = new DOMSignedInfo(siElem, context);
++        si = new DOMSignedInfo(siElem, context, provider);
+ 
+         // unmarshal SignatureValue
+         Element sigValElem = DOMUtils.getNextSiblingElement(siElem);
+@@ -147,7 +146,7 @@
+         // unmarshal KeyInfo, if specified
+         Element nextSibling = DOMUtils.getNextSiblingElement(sigValElem);
+         if (nextSibling != null && nextSibling.getLocalName().equals("KeyInfo")) {
+-            ki = new DOMKeyInfo(nextSibling, context);
++            ki = new DOMKeyInfo(nextSibling, context, provider);
+             nextSibling = DOMUtils.getNextSiblingElement(nextSibling);
+         }
+ 
+@@ -157,7 +156,8 @@
+         } else {
+             List tempObjects = new ArrayList();
+             while (nextSibling != null) {
+-                tempObjects.add(new DOMXMLObject(nextSibling, context));
++                tempObjects.add
++                    (new DOMXMLObject(nextSibling, context, provider));
+                 nextSibling = DOMUtils.getNextSiblingElement(nextSibling);
+             }
+             objects = Collections.unmodifiableList(tempObjects);
+@@ -201,9 +201,7 @@
+             (ownerDoc, "Signature", XMLSignature.XMLNS, dsPrefix);
+ 
+         // append xmlns attribute
+-        //XXX I think this is supposed to be automatically inserted when
+-        //XXX serializing a DOM2 tree, but doesn't seem to work with JAXP/Xalan
+-        if (dsPrefix == null) {
++        if (dsPrefix == null || dsPrefix.length() == 0) {
+             sigElem.setAttributeNS
+                 ("http://www.w3.org/2000/xmlns/", "xmlns", XMLSignature.XMLNS);
+         } else {
+@@ -301,7 +299,7 @@
+                             Reference ref = (Reference) manRefs.get(k);
+                             boolean refValid = ref.validate(vc);
+                             if (log.isLoggable(Level.FINE)) {
+-                               log.log(Level.FINE, "Manifest ref["
++                                log.log(Level.FINE, "Manifest ref["
+                                     + ref.getURI() + "] is valid: " + refValid);
+                             }
+                             validateMans &= refValid;
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java
+@@ -1,29 +1,28 @@
+ /*
+- * Copyright (c) 2005, 2007, Oracle and/or its affiliates. All rights reserved.
+- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+- *
+- * This code is free software; you can redistribute 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: DOMXMLSignatureFactory.java,v 1.21 2005/09/23 19:59:11 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: DOMXMLSignatureFactory.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+@@ -33,7 +32,8 @@
+ import javax.xml.crypto.dsig.keyinfo.*;
+ import javax.xml.crypto.dsig.spec.*;
+ 
+-import java.security.*;
++import java.security.InvalidAlgorithmParameterException;
++import java.security.NoSuchAlgorithmException;
+ import java.security.spec.AlgorithmParameterSpec;
+ import java.util.List;
+ import org.w3c.dom.Document;
+@@ -67,7 +67,7 @@
+ 
+     public Reference newReference(String uri, DigestMethod dm, List transforms,
+         String type, String id) {
+-        return new DOMReference(uri, type, dm, transforms, id);
++        return new DOMReference(uri, type, dm, transforms, id, getProvider());
+     }
+ 
+     public Reference newReference(String uri, DigestMethod dm,
+@@ -83,7 +83,7 @@
+             throw new NullPointerException("result cannot be null");
+         }
+         return new DOMReference
+-            (uri, type, dm, appliedTransforms, result, transforms, id);
++            (uri, type, dm, appliedTransforms, result, transforms, id, getProvider());
+     }
+ 
+     public Reference newReference(String uri, DigestMethod dm, List transforms,
+@@ -92,7 +92,7 @@
+             throw new NullPointerException("digestValue cannot be null");
+         }
+         return new DOMReference
+-            (uri, type, dm, null, null, transforms, id, digestValue);
++            (uri, type, dm, null, null, transforms, id, digestValue, getProvider());
+     }
+ 
+     public SignedInfo newSignedInfo(CanonicalizationMethod cm,
+@@ -170,7 +170,7 @@
+                 "support DOM Level 2 and be namespace aware");
+         }
+         if (tag.equals("Signature")) {
+-            return new DOMXMLSignature(element, context);
++            return new DOMXMLSignature(element, context, getProvider());
+         } else {
+             throw new MarshalException("invalid Signature tag: " + tag);
+         }
+@@ -235,7 +235,12 @@
+     public Transform newTransform(String algorithm,
+         TransformParameterSpec params) throws NoSuchAlgorithmException,
+         InvalidAlgorithmParameterException {
+-        TransformService spi = TransformService.getInstance(algorithm, "DOM");
++        TransformService spi;
++        try {
++            spi = TransformService.getInstance(algorithm, "DOM");
++        } catch (NoSuchAlgorithmException nsae) {
++            spi = TransformService.getInstance(algorithm, "DOM", getProvider());
++        }
+         spi.init(params);
+         return new DOMTransform(spi);
+     }
+@@ -243,7 +248,12 @@
+     public Transform newTransform(String algorithm,
+         XMLStructure params) throws NoSuchAlgorithmException,
+         InvalidAlgorithmParameterException {
+-        TransformService spi = TransformService.getInstance(algorithm, "DOM");
++        TransformService spi;
++        try {
++            spi = TransformService.getInstance(algorithm, "DOM");
++        } catch (NoSuchAlgorithmException nsae) {
++            spi = TransformService.getInstance(algorithm, "DOM", getProvider());
++        }
+         if (params == null) {
+             spi.init(null);
+         } else {
+@@ -255,7 +265,12 @@
+     public CanonicalizationMethod newCanonicalizationMethod(String algorithm,
+         C14NMethodParameterSpec params) throws NoSuchAlgorithmException,
+         InvalidAlgorithmParameterException {
+-        TransformService spi = TransformService.getInstance(algorithm, "DOM");
++        TransformService spi;
++        try {
++            spi = TransformService.getInstance(algorithm, "DOM");
++        } catch (NoSuchAlgorithmException nsae) {
++            spi = TransformService.getInstance(algorithm, "DOM", getProvider());
++        }
+         spi.init(params);
+         return new DOMCanonicalizationMethod(spi);
+     }
+@@ -263,7 +278,12 @@
+     public CanonicalizationMethod newCanonicalizationMethod(String algorithm,
+         XMLStructure params) throws NoSuchAlgorithmException,
+         InvalidAlgorithmParameterException {
+-        TransformService spi = TransformService.getInstance(algorithm, "DOM");
++        TransformService spi;
++        try {
++            spi = TransformService.getInstance(algorithm, "DOM");
++        } catch (NoSuchAlgorithmException nsae) {
++            spi = TransformService.getInstance(algorithm, "DOM", getProvider());
++        }
+         if (params == null) {
+             spi.init(null);
+         } else {
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathFilter2Transform.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathFilter2Transform.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathFilter2Transform.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathFilter2Transform.java
+@@ -1,28 +1,23 @@
+ /*
+- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
++ */
++/*
++ * Copyright 2005 The Apache Software Foundation.
+  *
+- * This code is free software; you can redistribute 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.
++ *  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
+  *
+- * This code is distributed in the hope that it will be useful, but WITHOUT
+- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+- * version 2 for more details (a copy is included in the LICENSE file that
+- * accompanied this code).
++ *      http://www.apache.org/licenses/LICENSE-2.0
+  *
+- * You should have received a copy of the GNU General Public License version
+- * 2 along with this work; if not, write to the Free Software Foundation,
+- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++ *  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.
+  *
+- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+- * or visit www.oracle.com if you need additional information or have any
+- * questions.
+  */
+-
+ /*
+  * ===========================================================================
+  *
+@@ -31,7 +26,10 @@
+  * ===========================================================================
+  */
+ /*
+- * $Id: DOMXPathFilter2Transform.java,v 1.18 2005/09/19 18:30:30 mullan Exp $
++ * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: DOMXPathFilter2Transform.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+@@ -129,7 +127,8 @@
+         XPathFilter2ParameterSpec xp =
+             (XPathFilter2ParameterSpec) getParameterSpec();
+         String prefix = DOMUtils.getNSPrefix(context, Transform.XPATH2);
+-        String qname = (prefix == null) ? "xmlns" : "xmlns:" + prefix;
++        String qname = (prefix == null || prefix.length() == 0)
++                       ? "xmlns" : "xmlns:" + prefix;
+         List list = xp.getXPathList();
+         for (int i = 0, size = list.size(); i < size; i++) {
+             XPathType xpathType = (XPathType) list.get(i);
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathTransform.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathTransform.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathTransform.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathTransform.java
+@@ -1,29 +1,28 @@
+ /*
+- * Copyright (c) 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: DOMXPathTransform.java,v 1.16 2005/05/12 19:28:35 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: DOMXPathTransform.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXSLTTransform.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXSLTTransform.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXSLTTransform.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXSLTTransform.java
+@@ -1,29 +1,28 @@
+ /*
+- * Copyright (c) 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: DOMXSLTTransform.java,v 1.15 2005/05/10 18:15:36 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: DOMXSLTTransform.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/Utils.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/Utils.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/Utils.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/Utils.java
+@@ -1,29 +1,28 @@
+ /*
+- * Copyright (c) 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.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
+  */
+ /*
+- * $Id: Utils.java,v 1.14 2005/09/23 19:49:20 mullan Exp $
++ * Copyright 2005 The Apache Software Foundation.
++ *
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ *
++ *      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.
++ *
++ */
++/*
++ * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: Utils.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/XMLDSigRI.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/XMLDSigRI.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/XMLDSigRI.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/XMLDSigRI.java
+@@ -1,28 +1,23 @@
+ /*
+- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
++ */
++/*
++ * Copyright 2005 The Apache Software Foundation.
+  *
+- * This code is free software; you can redistribute 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.
++ *  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
+  *
+- * This code is distributed in the hope that it will be useful, but WITHOUT
+- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+- * version 2 for more details (a copy is included in the LICENSE file that
+- * accompanied this code).
++ *      http://www.apache.org/licenses/LICENSE-2.0
+  *
+- * You should have received a copy of the GNU General Public License version
+- * 2 along with this work; if not, write to the Free Software Foundation,
+- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++ *  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.
+  *
+- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+- * or visit www.oracle.com if you need additional information or have any
+- * questions.
+  */
+-
+ /*
+  * ===========================================================================
+  *
+@@ -31,7 +26,10 @@
+  * ===========================================================================
+  */
+ /*
+- * $Id: XMLDSigRI.java,v 1.7 2005/05/12 19:28:36 mullan Exp $
++ * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
++ */
++/*
++ * $Id: XMLDSigRI.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
+  */
+ package org.jcp.xml.dsig.internal.dom;
+ 
+@@ -86,6 +84,22 @@
+                 CanonicalizationMethod.INCLUSIVE_WITH_COMMENTS +
+                 " MechanismType", "DOM");
+ 
++        // Inclusive C14N 1.1
++        map.put((String)"TransformService." +
++                "http://www.w3.org/2006/12/xml-c14n11",
++                "org.jcp.xml.dsig.internal.dom.DOMCanonicalXMLC14N11Method");
++        map.put((String)"TransformService." +
++                "http://www.w3.org/2006/12/xml-c14n11" +
++                " MechanismType", "DOM");
++
++        // InclusiveWithComments C14N 1.1
++        map.put((String)"TransformService." +
++                "http://www.w3.org/2006/12/xml-c14n11#WithComments",
++                "org.jcp.xml.dsig.internal.dom.DOMCanonicalXMLC14N11Method");
++        map.put((String)"TransformService." +
++                "http://www.w3.org/2006/12/xml-c14n11#WithComments" +
++                " MechanismType", "DOM");
++
+         // Exclusive C14N
+         map.put((String) "TransformService." + CanonicalizationMethod.EXCLUSIVE,
+                 "org.jcp.xml.dsig.internal.dom.DOMExcC14NMethod");
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/package.html b/src/share/classes/org/jcp/xml/dsig/internal/package.html
+deleted file mode 100644
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/package.html
++++ /dev/null
+@@ -1,5 +0,0 @@
+-<html>
+-<body>
+-Contains the classes of the Reference Implementation of JSR 105.
+-</body>
+-</html>
+diff --git a/test/javax/xml/crypto/dsig/GenerationTests.java b/test/javax/xml/crypto/dsig/GenerationTests.java
+--- jdk/test/javax/xml/crypto/dsig/GenerationTests.java
++++ jdk/test/javax/xml/crypto/dsig/GenerationTests.java
+@@ -90,6 +90,7 @@
+     private static Certificate signingCert;
+     private static KeyStore ks;
+     private final static String DIR = System.getProperty("test.src", ".");
++//    private final static String DIR = ".";
+     private final static String DATA_DIR =
+         DIR + System.getProperty("file.separator") + "data";
+     private final static String KEYSTORE =
+@@ -200,6 +201,9 @@
+         DOMSignContext dsc = new DOMSignContext(signingKey, envelope);
+ 
+         sig.sign(dsc);
++//      StringWriter sw = new StringWriter();
++//      dumpDocument(doc, sw);
++//      System.out.println(sw.toString());
+ 
+         DOMValidateContext dvc = new DOMValidateContext
+             (kvks, envelope.getFirstChild());

Added: trunk/java/openjdk6/files/icedtea/openjdk/6501644-icu_sync.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/openjdk/6501644-icu_sync.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/openjdk/6501644-icu_sync.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,8066 @@
+# HG changeset patch
+# User andrew
+# Date 1365739093 -3600
+# Node ID e8ed86062291305172267be90dcec2acef7c15a8
+# Parent  c7ddbf756d7f35d6e782eb91b86ce2938de44fb8
+6501644: sync LayoutEngine *code* structure to match ICU
+Reviewed-by: prr
+
+diff --git a/make/sun/font/Makefile b/make/sun/font/Makefile
+--- jdk/make/sun/font/Makefile
++++ jdk/make/sun/font/Makefile
+@@ -209,3 +209,7 @@
+ 	    -I$(PLATFORM_SRC)/native/sun/java2d/d3d
+ endif
+ 
++# Make the Layout Engine build standalone
++CPPFLAGS += -DLE_STANDALONE
++
++
+diff --git a/src/share/native/sun/font/layout/AlternateSubstSubtables.cpp b/src/share/native/sun/font/layout/AlternateSubstSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/AlternateSubstSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/AlternateSubstSubtables.cpp
+@@ -37,6 +37,8 @@
+ #include "GlyphIterator.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ le_uint32 AlternateSubstitutionSubtable::process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const
+ {
+     // NOTE: For now, we'll just pick the first alternative...
+@@ -64,3 +66,5 @@
+ 
+     return 0;
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/AlternateSubstSubtables.h b/src/share/native/sun/font/layout/AlternateSubstSubtables.h
+--- jdk/src/share/native/sun/font/layout/AlternateSubstSubtables.h
++++ jdk/src/share/native/sun/font/layout/AlternateSubstSubtables.h
+@@ -32,12 +32,19 @@
+ #ifndef __ALTERNATESUBSTITUTIONSUBTABLES_H
+ #define __ALTERNATESUBSTITUTIONSUBTABLES_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "LEGlyphFilter.h"
+ #include "OpenTypeTables.h"
+ #include "GlyphSubstitutionTables.h"
+ #include "GlyphIterator.h"
+ 
++U_NAMESPACE_BEGIN
++
+ struct AlternateSetTable
+ {
+     le_uint16 glyphCount;
+@@ -52,4 +59,5 @@
+     le_uint32 process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter = NULL) const;
+ };
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/AnchorTables.cpp b/src/share/native/sun/font/layout/AnchorTables.cpp
+--- jdk/src/share/native/sun/font/layout/AnchorTables.cpp
++++ jdk/src/share/native/sun/font/layout/AnchorTables.cpp
+@@ -35,6 +35,8 @@
+ #include "AnchorTables.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ void AnchorTable::getAnchor(LEGlyphID glyphID, const LEFontInstance *fontInstance,
+                             LEPoint &anchor) const
+ {
+@@ -124,3 +126,6 @@
+ 
+     fontInstance->pixelsToUnits(pixels, anchor);
+ }
++
++U_NAMESPACE_END
++
+diff --git a/src/share/native/sun/font/layout/AnchorTables.h b/src/share/native/sun/font/layout/AnchorTables.h
+--- jdk/src/share/native/sun/font/layout/AnchorTables.h
++++ jdk/src/share/native/sun/font/layout/AnchorTables.h
+@@ -32,10 +32,17 @@
+ #ifndef __ANCHORTABLES_H
+ #define __ANCHORTABLES_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "LEFontInstance.h"
+ #include "OpenTypeTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ struct AnchorTable
+ {
+     le_uint16  anchorFormat;
+@@ -66,5 +73,7 @@
+     void getAnchor(const LEFontInstance *fontInstance, LEPoint &anchor) const;
+ };
+ 
++U_NAMESPACE_END
++#endif
+ 
+-#endif
++
+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
+@@ -49,23 +49,25 @@
+ #include "ArabicShaping.h"
+ #include "CanonShaping.h"
+ 
++U_NAMESPACE_BEGIN
++
+ le_bool CharSubstitutionFilter::accept(LEGlyphID glyph) const
+ {
+     return fFontInstance->canDisplay((LEUnicode) glyph);
+ }
+ 
+-ArabicOpenTypeLayoutEngine::ArabicOpenTypeLayoutEngine(
+-    const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-    le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable)
++UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ArabicOpenTypeLayoutEngine)
++
++ArabicOpenTypeLayoutEngine::ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
++                        le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable)
+     : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable)
+ {
+     fFeatureMap = ArabicShaping::getFeatureMap(fFeatureMapCount);
+     fFeatureOrder = TRUE;
+ }
+ 
+-ArabicOpenTypeLayoutEngine::ArabicOpenTypeLayoutEngine(
+-    const LEFontInstance *fontInstance,
+-    le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags)
++ArabicOpenTypeLayoutEngine::ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
++                                                       le_int32 typoFlags)
+     : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags)
+ {
+     fFeatureMap = ArabicShaping::getFeatureMap(fFeatureMapCount);
+@@ -86,9 +88,8 @@
+ // Input: characters
+ // Output: characters, char indices, tags
+ // Returns: output character count
+-le_int32 ArabicOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[],
+-    le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
+-    LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success)
++le_int32 ArabicOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
++        LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success)
+ {
+     if (LE_FAILURE(success)) {
+         return 0;
+@@ -124,8 +125,8 @@
+     return count;
+ }
+ 
+-void ArabicOpenTypeLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset,
+-    le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success)
++void ArabicOpenTypeLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse,
++                                                      LEGlyphStorage &glyphStorage, LEErrorCode &success)
+ {
+     if (LE_FAILURE(success)) {
+         return;
+@@ -137,24 +138,20 @@
+     }
+ 
+     if (fGPOSTable != NULL) {
+-        OpenTypeLayoutEngine::adjustGlyphPositions(chars, offset, count,
+-            reverse, glyphStorage, success);
++        OpenTypeLayoutEngine::adjustGlyphPositions(chars, offset, count, reverse, glyphStorage, success);
+     } else if (fGDEFTable != NULL) {
+         GDEFMarkFilter filter(fGDEFTable);
+ 
+         adjustMarkGlyphs(glyphStorage, &filter, success);
+     } else {
+-        GlyphDefinitionTableHeader *gdefTable =
+-            (GlyphDefinitionTableHeader *) CanonShaping::glyphDefinitionTable;
++        GlyphDefinitionTableHeader *gdefTable = (GlyphDefinitionTableHeader *) CanonShaping::glyphDefinitionTable;
+         GDEFMarkFilter filter(gdefTable);
+ 
+         adjustMarkGlyphs(&chars[offset], count, reverse, glyphStorage, &filter, success);
+     }
+ }
+ 
+-UnicodeArabicOpenTypeLayoutEngine::UnicodeArabicOpenTypeLayoutEngine(
+-    const LEFontInstance *fontInstance,
+-    le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags)
++UnicodeArabicOpenTypeLayoutEngine::UnicodeArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags)
+     : ArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags | LE_CHAR_FILTER_FEATURE_FLAG)
+ {
+     fGSUBTable = (const GlyphSubstitutionTableHeader *) CanonShaping::glyphSubstitutionTable;
+@@ -168,8 +165,7 @@
+ }
+ 
+ // "glyphs", "indices" -> glyphs, indices
+-le_int32 UnicodeArabicOpenTypeLayoutEngine::glyphPostProcessing(
+-    LEGlyphStorage &tempGlyphStorage, LEGlyphStorage &glyphStorage, LEErrorCode &success)
++le_int32 UnicodeArabicOpenTypeLayoutEngine::glyphPostProcessing(LEGlyphStorage &tempGlyphStorage, LEGlyphStorage &glyphStorage, LEErrorCode &success)
+ {
+     if (LE_FAILURE(success)) {
+         return 0;
+@@ -192,17 +188,14 @@
+ 
+     glyphStorage.adoptCharIndicesArray(tempGlyphStorage);
+ 
+-    ArabicOpenTypeLayoutEngine::mapCharsToGlyphs(tempChars, 0, tempGlyphCount, FALSE,
+-        TRUE, glyphStorage, success);
++    ArabicOpenTypeLayoutEngine::mapCharsToGlyphs(tempChars, 0, tempGlyphCount, FALSE, TRUE, glyphStorage, success);
+ 
+     LE_DELETE_ARRAY(tempChars);
+ 
+     return tempGlyphCount;
+ }
+ 
+-void UnicodeArabicOpenTypeLayoutEngine::mapCharsToGlyphs(const LEUnicode chars[],
+-    le_int32 offset, le_int32 count, le_bool reverse, le_bool /*mirror*/,
+-    LEGlyphStorage &glyphStorage, LEErrorCode &success)
++void UnicodeArabicOpenTypeLayoutEngine::mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, le_bool /*mirror*/, LEGlyphStorage &glyphStorage, LEErrorCode &success)
+ {
+     if (LE_FAILURE(success)) {
+         return;
+@@ -227,9 +220,8 @@
+     }
+ }
+ 
+-void UnicodeArabicOpenTypeLayoutEngine::adjustGlyphPositions(const LEUnicode chars[],
+-    le_int32 offset, le_int32 count, le_bool reverse,
+-    LEGlyphStorage &glyphStorage, LEErrorCode &success)
++void UnicodeArabicOpenTypeLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse,
++                                                      LEGlyphStorage &glyphStorage, LEErrorCode &success)
+ {
+     if (LE_FAILURE(success)) {
+         return;
+@@ -244,3 +236,6 @@
+ 
+     adjustMarkGlyphs(&chars[offset], count, reverse, glyphStorage, &filter, success);
+ }
++
++U_NAMESPACE_END
++
+diff --git a/src/share/native/sun/font/layout/ArabicLayoutEngine.h b/src/share/native/sun/font/layout/ArabicLayoutEngine.h
+--- jdk/src/share/native/sun/font/layout/ArabicLayoutEngine.h
++++ jdk/src/share/native/sun/font/layout/ArabicLayoutEngine.h
+@@ -43,6 +43,8 @@
+ #include "GlyphDefinitionTables.h"
+ #include "GlyphPositioningTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ /**
+  * This class implements OpenType layout for Arabic fonts. It overrides
+  * the characerProcessing method to assign the correct OpenType feature
+@@ -71,8 +73,8 @@
+      *
+      * @internal
+      */
+-    ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode,
+-        le_int32 languageCode, le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable);
++    ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
++                            le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable);
+ 
+     /**
+      * This constructor is used when the font requires a "canned" GSUB table which can't be known
+@@ -87,8 +89,8 @@
+      *
+      * @internal
+      */
+-    ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode,
+-        le_int32 languageCode, le_int32 typoFlags);
++    ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
++                               le_int32 typoFlags);
+ 
+     /**
+      * The destructor, virtual for correct polymorphic invocation.
+@@ -97,6 +99,20 @@
+      */
+     virtual ~ArabicOpenTypeLayoutEngine();
+ 
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for the actual class.
++     *
++     * @stable ICU 2.8
++     */
++    virtual UClassID getDynamicClassID() const;
++
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for this class.
++     *
++     * @stable ICU 2.8
++     */
++    static UClassID getStaticClassID();
++
+ protected:
+ 
+     /**
+@@ -108,8 +124,7 @@
+      * @param offset - the index of the first character to process
+      * @param count - the number of characters to process
+      * @param max - the number of characters in the input context
+-     * @param rightToLeft - <code>TRUE</code> if the characters are in a
+-     *     right to left directional run
++     * @param rightToLeft - <code>TRUE</code> if the characters are in a right to left directional run
+      *
+      * Output parameters:
+      * @param outChars - the output character arrayt
+@@ -121,9 +136,8 @@
+      *
+      * @internal
+      */
+-    virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset,
+-        le_int32 count, le_int32 max, le_bool rightToLeft,
+-        LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
++    virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
++            LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
+ 
+     /**
+      * This method applies the GPOS table if it is present, otherwise it ensures that all vowel
+@@ -142,11 +156,9 @@
+      *
+      * @internal
+      */
+-    virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset,
+-        le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success);
++    virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success);
+ 
+-    // static void adjustMarkGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count,
+-    // le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success);
++    // static void adjustMarkGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success);
+ 
+ };
+ 
+@@ -178,8 +190,8 @@
+      *
+      * @internal
+      */
+-    UnicodeArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance,
+-        le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags);
++    UnicodeArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
++                le_int32 typoFlags);
+ 
+     /**
+      * The destructor, virtual for correct polymorphic invocation.
+@@ -208,8 +220,7 @@
+      *
+      * @internal
+      */
+-    virtual le_int32 glyphPostProcessing(LEGlyphStorage &tempGlyphStorage,
+-        LEGlyphStorage &glyphStorage, LEErrorCode &success);
++    virtual le_int32 glyphPostProcessing(LEGlyphStorage &tempGlyphStorage, LEGlyphStorage &glyphStorage, LEErrorCode &success);
+ 
+     /**
+      * This method copies the input characters into the output glyph index array,
+@@ -227,8 +238,7 @@
+      *
+      * @internal
+      */
+-    virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset,
+-        le_int32 count, le_bool reverse, le_bool mirror,
++    virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, le_bool mirror,
+         LEGlyphStorage &glyphStorage, LEErrorCode &success);
+ 
+     /**
+@@ -245,8 +255,9 @@
+      *
+      * @internal
+      */
+-    virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset,
+-        le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success);
++    virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success);
+ };
+ 
++U_NAMESPACE_END
+ #endif
++
+diff --git a/src/share/native/sun/font/layout/ArabicShaping.cpp b/src/share/native/sun/font/layout/ArabicShaping.cpp
+--- jdk/src/share/native/sun/font/layout/ArabicShaping.cpp
++++ jdk/src/share/native/sun/font/layout/ArabicShaping.cpp
+@@ -35,6 +35,8 @@
+ #include "LEGlyphStorage.h"
+ #include "ClassDefinitionTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ // This table maps Unicode joining types to
+ // ShapeTypes.
+ const ArabicShaping::ShapeType ArabicShaping::shapeTypes[] =
+@@ -102,9 +104,7 @@
+ #define markFeatureMask 0x00040000UL
+ #define mkmkFeatureMask 0x00020000UL
+ 
+-#define ISOL_FEATURES (isolFeatureMask | ligaFeatureMask | msetFeatureMask | \
+-    markFeatureMask | ccmpFeatureMask | rligFeatureMask | caltFeatureMask | \
+-    dligFeatureMask | cswhFeatureMask | cursFeatureMask | kernFeatureMask | mkmkFeatureMask)
++#define ISOL_FEATURES (isolFeatureMask | ligaFeatureMask | msetFeatureMask | markFeatureMask | ccmpFeatureMask | rligFeatureMask | caltFeatureMask | dligFeatureMask | cswhFeatureMask | cursFeatureMask | kernFeatureMask | mkmkFeatureMask)
+ 
+ #define SHAPE_MASK 0xF0000000UL
+ 
+@@ -226,3 +226,5 @@
+         adjustTags(erout, 2, glyphStorage);
+     }
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/ArabicShaping.h b/src/share/native/sun/font/layout/ArabicShaping.h
+--- jdk/src/share/native/sun/font/layout/ArabicShaping.h
++++ jdk/src/share/native/sun/font/layout/ArabicShaping.h
+@@ -32,12 +32,19 @@
+ #ifndef __ARABICSHAPING_H
+ #define __ARABICSHAPING_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "OpenTypeTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ class LEGlyphStorage;
+ 
+-class ArabicShaping {
++class ArabicShaping /* not : public UObject because all methods are static */ {
+ public:
+     // Joining types
+     enum JoiningTypes
+@@ -74,8 +81,8 @@
+ 
+     typedef le_int32 ShapeType;
+ 
+-    static void shape(const LEUnicode *chars, le_int32 offset, le_int32 charCount,
+-        le_int32 charMax, le_bool rightToLeft, LEGlyphStorage &glyphStorage);
++    static void shape(const LEUnicode *chars, le_int32 offset, le_int32 charCount, le_int32 charMax,
++                      le_bool rightToLeft, LEGlyphStorage &glyphStorage);
+ 
+     static const FeatureMap *getFeatureMap(le_int32 &count);
+ 
+@@ -88,8 +95,8 @@
+     static const le_uint8 shapingTypeTable[];
+     static const ShapeType shapeTypes[];
+ 
+-    static void adjustTags(le_int32 outIndex, le_int32 shapeOffset,
+-        LEGlyphStorage &glyphStorage);
++    static void adjustTags(le_int32 outIndex, le_int32 shapeOffset, LEGlyphStorage &glyphStorage);
+ };
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/AttachmentPosnSubtables.h b/src/share/native/sun/font/layout/AttachmentPosnSubtables.h
+--- jdk/src/share/native/sun/font/layout/AttachmentPosnSubtables.h
++++ jdk/src/share/native/sun/font/layout/AttachmentPosnSubtables.h
+@@ -32,12 +32,19 @@
+ #ifndef __ATTACHMENTPOSITIONINGSUBTABLES_H
+ #define __ATTACHMENTPOSITIONINGSUBTABLES_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "OpenTypeTables.h"
+ #include "GlyphPositioningTables.h"
+ #include "ValueRecords.h"
+ #include "GlyphIterator.h"
+ 
++U_NAMESPACE_BEGIN
++
+ struct AttachmentPositioningSubtable : GlyphPositioningSubtable
+ {
+     Offset    baseCoverageTableOffset;
+@@ -55,4 +62,6 @@
+     return getGlyphCoverage(baseCoverageTableOffset, baseGlyphID);
+ }
+ 
++U_NAMESPACE_END
+ #endif
++
+diff --git a/src/share/native/sun/font/layout/CanonData.cpp b/src/share/native/sun/font/layout/CanonData.cpp
+--- jdk/src/share/native/sun/font/layout/CanonData.cpp
++++ jdk/src/share/native/sun/font/layout/CanonData.cpp
+@@ -36,6 +36,8 @@
+ #include "LETypes.h"
+ #include "CanonShaping.h"
+ 
++U_NAMESPACE_BEGIN
++
+ const le_uint8 CanonShaping::glyphSubstitutionTable[] = {
+     0x00, 0x01, 0x00, 0x00, 0x00, 0x0A, 0x01, 0x58, 0x02, 0x86, 0x00, 0x12, 0x61, 0x72, 0x61, 0x62,
+     0x00, 0x6E, 0x62, 0x65, 0x6E, 0x67, 0x00, 0x82, 0x63, 0x79, 0x72, 0x6C, 0x00, 0x8E, 0x64, 0x65,
+@@ -3773,3 +3775,5 @@
+     0x00, 0xDC, 0xD1, 0x85, 0xD1, 0x89, 0x00, 0xE6, 0xD1, 0x8A, 0xD1, 0x8B, 0x00, 0xDC, 0xD1, 0xAA,
+     0xD1, 0xAD, 0x00, 0xE6, 0xD2, 0x42, 0xD2, 0x44, 0x00, 0xE6
+ };
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/CanonShaping.cpp b/src/share/native/sun/font/layout/CanonShaping.cpp
+--- jdk/src/share/native/sun/font/layout/CanonShaping.cpp
++++ jdk/src/share/native/sun/font/layout/CanonShaping.cpp
+@@ -35,8 +35,9 @@
+ #include "GlyphDefinitionTables.h"
+ #include "ClassDefinitionTables.h"
+ 
+-void CanonShaping::sortMarks(le_int32 *indices,
+-    const le_int32 *combiningClasses, le_int32 index, le_int32 limit)
++U_NAMESPACE_BEGIN
++
++void CanonShaping::sortMarks(le_int32 *indices, const le_int32 *combiningClasses, le_int32 index, le_int32 limit)
+ {
+     for (le_int32 j = index + 1; j < limit; j += 1) {
+         le_int32 i;
+@@ -55,13 +56,11 @@
+     }
+ }
+ 
+-void CanonShaping::reorderMarks(const LEUnicode *inChars, le_int32 charCount,
+-    le_bool rightToLeft, LEUnicode *outChars, LEGlyphStorage &glyphStorage)
++void CanonShaping::reorderMarks(const LEUnicode *inChars, le_int32 charCount, le_bool rightToLeft,
++                                LEUnicode *outChars, LEGlyphStorage &glyphStorage)
+ {
+-    const GlyphDefinitionTableHeader *gdefTable =
+-        (const GlyphDefinitionTableHeader *) glyphDefinitionTable;
+-    const ClassDefinitionTable *classTable =
+-        gdefTable->getMarkAttachClassDefinitionTable();
++    const GlyphDefinitionTableHeader *gdefTable = (const GlyphDefinitionTableHeader *) glyphDefinitionTable;
++    const ClassDefinitionTable *classTable = gdefTable->getMarkAttachClassDefinitionTable();
+     le_int32 *combiningClasses = LE_NEW_ARRAY(le_int32, charCount);
+     le_int32 *indices = LE_NEW_ARRAY(le_int32, charCount);
+     LEErrorCode status = LE_NO_ERROR;
+@@ -103,3 +102,5 @@
+     LE_DELETE_ARRAY(indices);
+     LE_DELETE_ARRAY(combiningClasses);
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/CanonShaping.h b/src/share/native/sun/font/layout/CanonShaping.h
+--- jdk/src/share/native/sun/font/layout/CanonShaping.h
++++ jdk/src/share/native/sun/font/layout/CanonShaping.h
+@@ -34,20 +34,22 @@
+ 
+ #include "LETypes.h"
+ 
++U_NAMESPACE_BEGIN
++
+ class LEGlyphStorage;
+ 
+-class CanonShaping
++class CanonShaping /* not : public UObject because all members are static */
+ {
+ public:
+     static const le_uint8 glyphSubstitutionTable[];
+     static const le_uint8 glyphDefinitionTable[];
+ 
+-    static void reorderMarks(const LEUnicode *inChars, le_int32 charCount,
+-        le_bool rightToLeft, LEUnicode *outChars, LEGlyphStorage &glyphStorage);
++    static void reorderMarks(const LEUnicode *inChars, le_int32 charCount, le_bool rightToLeft,
++                                   LEUnicode *outChars, LEGlyphStorage &glyphStorage);
+ 
+ private:
+-    static void sortMarks(le_int32 *indices, const le_int32 *combiningClasses,
+-        le_int32 index, le_int32 limit);
++    static void sortMarks(le_int32 *indices, const le_int32 *combiningClasses, le_int32 index, le_int32 limit);
+ };
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/CharSubstitutionFilter.h b/src/share/native/sun/font/layout/CharSubstitutionFilter.h
+--- jdk/src/share/native/sun/font/layout/CharSubstitutionFilter.h
++++ jdk/src/share/native/sun/font/layout/CharSubstitutionFilter.h
+@@ -35,6 +35,8 @@
+ #include "LETypes.h"
+ #include "LEGlyphFilter.h"
+ 
++U_NAMESPACE_BEGIN
++
+ class LEFontInstance;
+ 
+ /**
+@@ -43,7 +45,7 @@
+  *
+  * @internal
+  */
+-class CharSubstitutionFilter : public LEGlyphFilter
++class CharSubstitutionFilter : public UMemory, public LEGlyphFilter
+ {
+ private:
+     /**
+@@ -98,4 +100,7 @@
+     le_bool accept(LEGlyphID glyph) const;
+ };
+ 
++U_NAMESPACE_END
+ #endif
++
++
+diff --git a/src/share/native/sun/font/layout/ClassDefinitionTables.cpp b/src/share/native/sun/font/layout/ClassDefinitionTables.cpp
+--- jdk/src/share/native/sun/font/layout/ClassDefinitionTables.cpp
++++ jdk/src/share/native/sun/font/layout/ClassDefinitionTables.cpp
+@@ -35,6 +35,8 @@
+ #include "ClassDefinitionTables.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ le_int32 ClassDefinitionTable::getGlyphClass(LEGlyphID glyphID) const
+ {
+     switch(SWAPW(classFormat)) {
+@@ -139,3 +141,5 @@
+ 
+     return FALSE;
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/ClassDefinitionTables.h b/src/share/native/sun/font/layout/ClassDefinitionTables.h
+--- jdk/src/share/native/sun/font/layout/ClassDefinitionTables.h
++++ jdk/src/share/native/sun/font/layout/ClassDefinitionTables.h
+@@ -32,9 +32,16 @@
+ #ifndef __CLASSDEFINITIONTABLES_H
+ #define __CLASSDEFINITIONTABLES_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "OpenTypeTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ struct ClassDefinitionTable
+ {
+     le_uint16 classFormat;
+@@ -69,4 +76,5 @@
+     le_bool hasGlyphClass(le_int32 glyphClass) const;
+ };
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/ContextualGlyphInsertion.h b/src/share/native/sun/font/layout/ContextualGlyphInsertion.h
+--- jdk/src/share/native/sun/font/layout/ContextualGlyphInsertion.h
++++ jdk/src/share/native/sun/font/layout/ContextualGlyphInsertion.h
+@@ -32,12 +32,19 @@
+ #ifndef __CONTEXTUALGLYPHINSERTION_H
+ #define __CONTEXTUALGLYPHINSERTION_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "LayoutTables.h"
+ #include "StateTables.h"
+ #include "MorphTables.h"
+ #include "MorphStateTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ struct ContextualGlyphInsertionHeader : MorphStateTableHeader
+ {
+ };
+@@ -60,4 +67,5 @@
+     ByteOffset markedInsertionListOffset;
+ };
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/ContextualGlyphSubstProc.cpp b/src/share/native/sun/font/layout/ContextualGlyphSubstProc.cpp
+--- jdk/src/share/native/sun/font/layout/ContextualGlyphSubstProc.cpp
++++ jdk/src/share/native/sun/font/layout/ContextualGlyphSubstProc.cpp
+@@ -39,6 +39,10 @@
+ #include "LEGlyphStorage.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
++UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ContextualGlyphSubstitutionProcessor)
++
+ ContextualGlyphSubstitutionProcessor::ContextualGlyphSubstitutionProcessor(const MorphSubtableHeader *morphSubtableHeader)
+   : StateTableProcessor(morphSubtableHeader)
+ {
+@@ -57,8 +61,7 @@
+     markGlyph = 0;
+ }
+ 
+-ByteOffset ContextualGlyphSubstitutionProcessor::processStateEntry(LEGlyphStorage &glyphStorage,
+-    le_int32 &currGlyph, EntryTableIndex index)
++ByteOffset ContextualGlyphSubstitutionProcessor::processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index)
+ {
+     const ContextualGlyphSubstitutionStateEntry *entry = &entryTable[index];
+     ByteOffset newState = SWAPW(entry->newStateOffset);
+@@ -97,3 +100,5 @@
+ void ContextualGlyphSubstitutionProcessor::endStateTable()
+ {
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/ContextualGlyphSubstProc.h b/src/share/native/sun/font/layout/ContextualGlyphSubstProc.h
+--- jdk/src/share/native/sun/font/layout/ContextualGlyphSubstProc.h
++++ jdk/src/share/native/sun/font/layout/ContextualGlyphSubstProc.h
+@@ -32,12 +32,19 @@
+ #ifndef __CONTEXTUALGLYPHSUBSTITUTIONPROCESSOR_H
+ #define __CONTEXTUALGLYPHSUBSTITUTIONPROCESSOR_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "MorphTables.h"
+ #include "SubtableProcessor.h"
+ #include "StateTableProcessor.h"
+ #include "ContextualGlyphSubstitution.h"
+ 
++U_NAMESPACE_BEGIN
++
+ class LEGlyphStorage;
+ 
+ class ContextualGlyphSubstitutionProcessor : public StateTableProcessor
+@@ -52,6 +59,20 @@
+     ContextualGlyphSubstitutionProcessor(const MorphSubtableHeader *morphSubtableHeader);
+     virtual ~ContextualGlyphSubstitutionProcessor();
+ 
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for the actual class.
++     *
++     * @stable ICU 2.8
++     */
++    virtual UClassID getDynamicClassID() const;
++
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for this class.
++     *
++     * @stable ICU 2.8
++     */
++    static UClassID getStaticClassID();
++
+ private:
+     ContextualGlyphSubstitutionProcessor();
+ 
+@@ -62,6 +83,8 @@
+     le_int32 markGlyph;
+ 
+     const ContextualGlyphSubstitutionHeader *contextualGlyphSubstitutionHeader;
++
+ };
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/ContextualGlyphSubstitution.h b/src/share/native/sun/font/layout/ContextualGlyphSubstitution.h
+--- jdk/src/share/native/sun/font/layout/ContextualGlyphSubstitution.h
++++ jdk/src/share/native/sun/font/layout/ContextualGlyphSubstitution.h
+@@ -32,11 +32,18 @@
+ #ifndef __CONTEXTUALGLYPHSUBSTITUTION_H
+ #define __CONTEXTUALGLYPHSUBSTITUTION_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "LayoutTables.h"
+ #include "StateTables.h"
+ #include "MorphTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ struct ContextualGlyphSubstitutionHeader : MorphStateTableHeader
+ {
+     ByteOffset  substitutionTableOffset;
+@@ -55,4 +62,5 @@
+     WordOffset currOffset;
+ };
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/ContextualSubstSubtables.cpp b/src/share/native/sun/font/layout/ContextualSubstSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/ContextualSubstSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/ContextualSubstSubtables.cpp
+@@ -24,7 +24,6 @@
+  */
+ 
+ /*
+- *
+  * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
+  *
+  */
+@@ -39,6 +38,8 @@
+ #include "CoverageTables.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ /*
+     NOTE: This could be optimized somewhat by keeping track
+     of the previous sequenceIndex in the loop and doing next()
+@@ -350,7 +351,7 @@
+ 
+ // NOTE: This could be a #define, but that seems to confuse
+ // the Visual Studio .NET 2003 compiler on the calls to the
+-// GlyphIterator constructor.  It somehow can't decide if
++// GlyphIterator constructor. It somehow can't decide if
+ // emptyFeatureList matches an le_uint32 or an le_uint16...
+ static const FeatureMask emptyFeatureList = 0x00000000UL;
+ 
+@@ -542,3 +543,5 @@
+ 
+     return 0;
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/ContextualSubstSubtables.h b/src/share/native/sun/font/layout/ContextualSubstSubtables.h
+--- jdk/src/share/native/sun/font/layout/ContextualSubstSubtables.h
++++ jdk/src/share/native/sun/font/layout/ContextualSubstSubtables.h
+@@ -32,6 +32,11 @@
+ #ifndef __CONTEXTUALSUBSTITUTIONSUBTABLES_H
+ #define __CONTEXTUALSUBSTITUTIONSUBTABLES_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "LEFontInstance.h"
+ #include "OpenTypeTables.h"
+@@ -39,6 +44,8 @@
+ #include "GlyphIterator.h"
+ #include "LookupProcessor.h"
+ 
++U_NAMESPACE_BEGIN
++
+ struct SubstitutionLookupRecord
+ {
+     le_uint16  sequenceIndex;
+@@ -218,4 +225,5 @@
+     le_uint32  process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
+ };
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/CoverageTables.cpp b/src/share/native/sun/font/layout/CoverageTables.cpp
+--- jdk/src/share/native/sun/font/layout/CoverageTables.cpp
++++ jdk/src/share/native/sun/font/layout/CoverageTables.cpp
+@@ -35,6 +35,8 @@
+ #include "CoverageTables.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ le_int32 CoverageTable::getGlyphCoverage(LEGlyphID glyphID) const
+ {
+     switch(SWAPW(coverageFormat))
+@@ -106,3 +108,5 @@
+ 
+     return startCoverageIndex + (ttGlyphID - firstInRange);
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/CoverageTables.h b/src/share/native/sun/font/layout/CoverageTables.h
+--- jdk/src/share/native/sun/font/layout/CoverageTables.h
++++ jdk/src/share/native/sun/font/layout/CoverageTables.h
+@@ -32,9 +32,16 @@
+ #ifndef __COVERAGETABLES_H
+ #define __COVERAGETABLES_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "OpenTypeTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ struct CoverageTable
+ {
+     le_uint16 coverageFormat;
+@@ -58,5 +65,5 @@
+     le_int32 getGlyphCoverage(LEGlyphID glyphID) const;
+ };
+ 
+-
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/CursiveAttachmentSubtables.cpp b/src/share/native/sun/font/layout/CursiveAttachmentSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/CursiveAttachmentSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/CursiveAttachmentSubtables.cpp
+@@ -37,6 +37,8 @@
+ #include "OpenTypeUtilities.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ le_uint32 CursiveAttachmentSubtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
+ {
+     LEGlyphID glyphID       = glyphIterator->getCurrGlyphID();
+@@ -68,3 +70,5 @@
+ 
+     return 1;
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/CursiveAttachmentSubtables.h b/src/share/native/sun/font/layout/CursiveAttachmentSubtables.h
+--- jdk/src/share/native/sun/font/layout/CursiveAttachmentSubtables.h
++++ jdk/src/share/native/sun/font/layout/CursiveAttachmentSubtables.h
+@@ -32,10 +32,17 @@
+ #ifndef __CURSIVEATTACHMENTSUBTABLES_H
+ #define __CURSIVEATTACHMENTSUBTABLES_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "OpenTypeTables.h"
+ #include "GlyphPositioningTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ class LEFontInstance;
+ class GlyphIterator;
+ 
+@@ -53,4 +60,7 @@
+     le_uint32  process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
+ };
+ 
++U_NAMESPACE_END
+ #endif
++
++
+diff --git a/src/share/native/sun/font/layout/DefaultCharMapper.h b/src/share/native/sun/font/layout/DefaultCharMapper.h
+--- jdk/src/share/native/sun/font/layout/DefaultCharMapper.h
++++ jdk/src/share/native/sun/font/layout/DefaultCharMapper.h
+@@ -24,7 +24,6 @@
+  */
+ 
+ /*
+- *
+  * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
+  *
+  */
+@@ -32,9 +31,16 @@
+ #ifndef __DEFAULTCHARMAPPER_H
+ #define __DEFAULTCHARMAPPER_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "LEFontInstance.h"
+ 
++U_NAMESPACE_BEGIN
++
+ /**
+  * This class is an instance of LECharMapper which
+  * implements control character filtering and bidi
+@@ -42,7 +48,7 @@
+  *
+  * @see LECharMapper
+  */
+-class DefaultCharMapper : public LECharMapper
++class DefaultCharMapper : public UMemory, public LECharMapper
+ {
+ private:
+     le_bool fFilterControls;
+@@ -77,4 +83,5 @@
+     LEUnicode32 mapChar(LEUnicode32 ch) const;
+ };
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/DeviceTables.cpp b/src/share/native/sun/font/layout/DeviceTables.cpp
+--- jdk/src/share/native/sun/font/layout/DeviceTables.cpp
++++ jdk/src/share/native/sun/font/layout/DeviceTables.cpp
+@@ -25,6 +25,7 @@
+ 
+ /*
+  *
++ *
+  * (C) Copyright IBM Corp. 1998 - 2005 - All Rights Reserved
+  *
+  */
+@@ -34,6 +35,8 @@
+ #include "DeviceTables.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ const le_uint16 DeviceTable::fieldMasks[]    = {0x0003, 0x000F, 0x00FF};
+ const le_uint16 DeviceTable::fieldSignBits[] = {0x0002, 0x0008, 0x0080};
+ const le_uint16 DeviceTable::fieldBits[]     = {     2,      4,      8};
+@@ -62,3 +65,5 @@
+ 
+     return result;
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/DeviceTables.h b/src/share/native/sun/font/layout/DeviceTables.h
+--- jdk/src/share/native/sun/font/layout/DeviceTables.h
++++ jdk/src/share/native/sun/font/layout/DeviceTables.h
+@@ -25,6 +25,7 @@
+ 
+ /*
+  *
++ *
+  * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
+  *
+  */
+@@ -32,10 +33,15 @@
+ #ifndef __DEVICETABLES_H
+ #define __DEVICETABLES_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "OpenTypeTables.h"
+-#include "GlyphIterator.h"
+-#include "GlyphPositionAdjustments.h"
++
++U_NAMESPACE_BEGIN
+ 
+ struct DeviceTable
+ {
+@@ -52,5 +58,7 @@
+     static const le_uint16 fieldBits[];
+ };
+ 
++U_NAMESPACE_END
++#endif
+ 
+-#endif
++
+diff --git a/src/share/native/sun/font/layout/ExtensionSubtables.cpp b/src/share/native/sun/font/layout/ExtensionSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/ExtensionSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/ExtensionSubtables.cpp
+@@ -25,7 +25,8 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 2003 - All Rights Reserved
++ *
++ * (C) Copyright IBM Corp. 2002 - All Rights Reserved
+  *
+  */
+ 
+@@ -37,6 +38,9 @@
+ #include "GlyphIterator.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
++
+ // FIXME: should look at the format too... maybe have a sub-class for it?
+ le_uint32 ExtensionSubtable::process(const LookupProcessor *lookupProcessor, le_uint16 lookupType,
+                                       GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
+@@ -52,3 +56,5 @@
+ 
+     return 0;
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/ExtensionSubtables.h b/src/share/native/sun/font/layout/ExtensionSubtables.h
+--- jdk/src/share/native/sun/font/layout/ExtensionSubtables.h
++++ jdk/src/share/native/sun/font/layout/ExtensionSubtables.h
+@@ -25,6 +25,7 @@
+ 
+ /*
+  *
++ *
+  * (C) Copyright IBM Corp. 2002-2003 - All Rights Reserved
+  *
+  */
+@@ -32,12 +33,19 @@
+ #ifndef __EXTENSIONSUBTABLES_H
+ #define __EXTENSIONSUBTABLES_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "OpenTypeTables.h"
+ #include "GlyphSubstitutionTables.h"
+ #include "LookupProcessor.h"
+ #include "GlyphIterator.h"
+ 
++U_NAMESPACE_BEGIN
++
+ struct ExtensionSubtable //: GlyphSubstitutionSubtable
+ {
+     le_uint16 substFormat;
+@@ -48,4 +56,5 @@
+                       GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
+ };
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/Features.cpp b/src/share/native/sun/font/layout/Features.cpp
+--- jdk/src/share/native/sun/font/layout/Features.cpp
++++ jdk/src/share/native/sun/font/layout/Features.cpp
+@@ -25,6 +25,7 @@
+ 
+ /*
+  *
++ *
+  * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved
+  *
+  */
+@@ -35,6 +36,8 @@
+ #include "Features.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ const FeatureTable *FeatureListTable::getFeatureTable(le_uint16 featureIndex, LETag *featureTag) const
+ {
+     if (featureIndex >= SWAPW(featureCount)) {
+@@ -79,3 +82,5 @@
+     return 0;
+ #endif
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/Features.h b/src/share/native/sun/font/layout/Features.h
+--- jdk/src/share/native/sun/font/layout/Features.h
++++ jdk/src/share/native/sun/font/layout/Features.h
+@@ -32,9 +32,16 @@
+ #ifndef __FEATURES_H
+ #define __FEATURES_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "OpenTypeTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ struct FeatureRecord
+ {
+     ATag        featureTag;
+@@ -53,9 +60,10 @@
+     le_uint16           featureCount;
+     FeatureRecord       featureRecordArray[ANY_NUMBER];
+ 
+-    const FeatureTable *getFeatureTable(le_uint16 featureIndex, LETag *featureTag) const;
++    const FeatureTable  *getFeatureTable(le_uint16 featureIndex, LETag *featureTag) const;
+ 
+     const FeatureTable *getFeatureTable(LETag featureTag) const;
+ };
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/GDEFMarkFilter.cpp b/src/share/native/sun/font/layout/GDEFMarkFilter.cpp
+--- jdk/src/share/native/sun/font/layout/GDEFMarkFilter.cpp
++++ jdk/src/share/native/sun/font/layout/GDEFMarkFilter.cpp
+@@ -34,6 +34,8 @@
+ #include "GDEFMarkFilter.h"
+ #include "GlyphDefinitionTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ GDEFMarkFilter::GDEFMarkFilter(const GlyphDefinitionTableHeader *gdefTable)
+ {
+     classDefTable = gdefTable->getGlyphClassDefinitionTable();
+@@ -50,3 +52,5 @@
+ 
+     return glyphClass == gcdMarkGlyph;
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/GDEFMarkFilter.h b/src/share/native/sun/font/layout/GDEFMarkFilter.h
+--- jdk/src/share/native/sun/font/layout/GDEFMarkFilter.h
++++ jdk/src/share/native/sun/font/layout/GDEFMarkFilter.h
+@@ -32,11 +32,18 @@
+ #ifndef __GDEFMARKFILTER__H
+ #define __GDEFMARKFILTER__H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "LEGlyphFilter.h"
+ #include "GlyphDefinitionTables.h"
+ 
+-class GDEFMarkFilter : public LEGlyphFilter
++U_NAMESPACE_BEGIN
++
++class GDEFMarkFilter : public UMemory, public LEGlyphFilter
+ {
+ private:
+     const GlyphClassDefinitionTable *classDefTable;
+@@ -51,5 +58,5 @@
+     virtual le_bool accept(LEGlyphID glyph) const;
+ };
+ 
+-
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/GXLayoutEngine.cpp b/src/share/native/sun/font/layout/GXLayoutEngine.cpp
+--- jdk/src/share/native/sun/font/layout/GXLayoutEngine.cpp
++++ jdk/src/share/native/sun/font/layout/GXLayoutEngine.cpp
+@@ -23,6 +23,7 @@
+  *
+  */
+ 
++
+ /*
+  *
+  * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
+@@ -36,8 +37,11 @@
+ 
+ #include "MorphTables.h"
+ 
+-GXLayoutEngine::GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode,
+-    le_int32 languageCode, const MorphTableHeader *morphTable)
++U_NAMESPACE_BEGIN
++
++UOBJECT_DEFINE_RTTI_IMPLEMENTATION(GXLayoutEngine)
++
++GXLayoutEngine::GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const MorphTableHeader *morphTable)
+     : LayoutEngine(fontInstance, scriptCode, languageCode, 0), fMorphTable(morphTable)
+ {
+     // nothing else to do?
+@@ -49,9 +53,7 @@
+ }
+ 
+ // apply 'mort' table
+-le_int32 GXLayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset,
+-    le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage,
+-    LEErrorCode &success)
++le_int32 GXLayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success)
+ {
+     if (LE_FAILURE(success)) {
+         return 0;
+@@ -74,9 +76,8 @@
+ }
+ 
+ // apply positional tables
+-void GXLayoutEngine::adjustGlyphPositions(const LEUnicode chars[],
+-    le_int32 offset, le_int32 count, le_bool /*reverse*/,
+-    LEGlyphStorage &/*glyphStorage*/, LEErrorCode &success)
++void GXLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool /*reverse*/,
++                                          LEGlyphStorage &/*glyphStorage*/, LEErrorCode &success)
+ {
+     if (LE_FAILURE(success)) {
+         return;
+@@ -89,3 +90,5 @@
+ 
+     // FIXME: no positional processing yet...
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/GXLayoutEngine.h b/src/share/native/sun/font/layout/GXLayoutEngine.h
+--- jdk/src/share/native/sun/font/layout/GXLayoutEngine.h
++++ jdk/src/share/native/sun/font/layout/GXLayoutEngine.h
+@@ -23,6 +23,7 @@
+  *
+  */
+ 
++
+ /*
+  *
+  * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved
+@@ -37,6 +38,8 @@
+ 
+ #include "MorphTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ class LEFontInstance;
+ class LEGlyphStorage;
+ 
+@@ -70,8 +73,7 @@
+      *
+      * @internal
+      */
+-    GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode,
+-        le_int32 languageCode, const MorphTableHeader *morphTable);
++    GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const MorphTableHeader *morphTable);
+ 
+     /**
+      * The destructor, virtual for correct polymorphic invocation.
+@@ -80,6 +82,20 @@
+      */
+     virtual ~GXLayoutEngine();
+ 
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for the actual class.
++     *
++     * @stable ICU 2.8
++     */
++    virtual UClassID getDynamicClassID() const;
++
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for this class.
++     *
++     * @stable ICU 2.8
++     */
++    static UClassID getStaticClassID();
++
+ protected:
+ 
+     /**
+@@ -99,10 +115,8 @@
+      * @param offset - the index of the first character to process
+      * @param count - the number of characters to process
+      * @param max - the number of characters in the input context
+-     * @param rightToLeft - <code>TRUE</code> if the text is in a
+-     *    right to left directional run
+-     * @param glyphStorage - the glyph storage object. The glyph
+-     *    and char index arrays will be set.
++     * @param rightToLeft - <code>TRUE</code> if the text is in a right to left directional run
++     * @param glyphStorage - the glyph storage object. The glyph and char index arrays will be set.
+      *
+      * Output parameters:
+      * @param success - set to an error code if the operation fails
+@@ -111,8 +125,7 @@
+      *
+      * @internal
+      */
+-    virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset,
+-        le_int32 count, le_int32 max, le_bool rightToLeft,
++    virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
+         LEGlyphStorage &glyphStorage, LEErrorCode &success);
+ 
+     /**
+@@ -120,16 +133,18 @@
+      * 'kern', 'trak', 'bsln', 'opbd' and 'just' tables.
+      *
+      * Input parameters:
+-     * @param glyphStorage - the object holding the glyph storage.
+-     *     The positions will be updated as needed.
++     * @param glyphStorage - the object holding the glyph storage. The positions will be updated as needed.
+      *
+      * Output parameters:
+      * @param success - set to an error code if the operation fails
+      *
+      * @internal
+      */
+-    virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset,
+-        le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success);
++    virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse,
++                                      LEGlyphStorage &glyphStorage, LEErrorCode &success);
++
+ };
+ 
++U_NAMESPACE_END
+ #endif
++
+diff --git a/src/share/native/sun/font/layout/GlyphDefinitionTables.cpp b/src/share/native/sun/font/layout/GlyphDefinitionTables.cpp
+--- jdk/src/share/native/sun/font/layout/GlyphDefinitionTables.cpp
++++ jdk/src/share/native/sun/font/layout/GlyphDefinitionTables.cpp
+@@ -34,6 +34,8 @@
+ #include "GlyphDefinitionTables.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ const GlyphClassDefinitionTable *GlyphDefinitionTableHeader::getGlyphClassDefinitionTable() const
+ {
+     return (const GlyphClassDefinitionTable *) ((char *) this + SWAPW(glyphClassDefOffset));
+@@ -53,3 +55,5 @@
+ {
+     return (const MarkAttachClassDefinitionTable *) ((char *) this + SWAPW(MarkAttachClassDefOffset));
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/GlyphDefinitionTables.h b/src/share/native/sun/font/layout/GlyphDefinitionTables.h
+--- jdk/src/share/native/sun/font/layout/GlyphDefinitionTables.h
++++ jdk/src/share/native/sun/font/layout/GlyphDefinitionTables.h
+@@ -32,10 +32,17 @@
+ #ifndef __GLYPHDEFINITIONTABLES_H
+ #define __GLYPHDEFINITIONTABLES_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "OpenTypeTables.h"
+ #include "ClassDefinitionTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ typedef ClassDefinitionTable GlyphClassDefinitionTable;
+ 
+ enum GlyphClassDefinitions
+@@ -110,4 +117,5 @@
+     const MarkAttachClassDefinitionTable *getMarkAttachClassDefinitionTable() const;
+ };
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/GlyphIterator.cpp b/src/share/native/sun/font/layout/GlyphIterator.cpp
+--- jdk/src/share/native/sun/font/layout/GlyphIterator.cpp
++++ jdk/src/share/native/sun/font/layout/GlyphIterator.cpp
+@@ -38,11 +38,10 @@
+ #include "Lookups.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
+ 
+-GlyphIterator::GlyphIterator(LEGlyphStorage &theGlyphStorage,
+-    GlyphPositionAdjustments *theGlyphPositionAdjustments,
+-    le_bool rightToLeft, le_uint16 theLookupFlags, FeatureMask theFeatureMask,
+-    const GlyphDefinitionTableHeader *theGlyphDefinitionTableHeader)
++GlyphIterator::GlyphIterator(LEGlyphStorage &theGlyphStorage, GlyphPositionAdjustments *theGlyphPositionAdjustments, le_bool rightToLeft, le_uint16 theLookupFlags,
++                             FeatureMask theFeatureMask, const GlyphDefinitionTableHeader *theGlyphDefinitionTableHeader)
+   : direction(1), position(-1), nextLimit(-1), prevLimit(-1),
+     glyphStorage(theGlyphStorage), glyphPositionAdjustments(theGlyphPositionAdjustments),
+     srcIndex(-1), destIndex(-1), lookupFlags(theLookupFlags), featureMask(theFeatureMask),
+@@ -262,8 +261,8 @@
+     glyphPositionAdjustments->setBaseOffset(position, baseOffset);
+ }
+ 
+-void GlyphIterator::adjustCurrGlyphPositionAdjustment(float xPlacementAdjust,
+-    float yPlacementAdjust, float xAdvanceAdjust, float yAdvanceAdjust)
++void GlyphIterator::adjustCurrGlyphPositionAdjustment(float xPlacementAdjust, float yPlacementAdjust,
++                                                      float xAdvanceAdjust, float yAdvanceAdjust)
+ {
+     if (direction < 0) {
+         if (position <= nextLimit || position >= prevLimit) {
+@@ -281,8 +280,8 @@
+     glyphPositionAdjustments->adjustYAdvance(position, yAdvanceAdjust);
+ }
+ 
+-void GlyphIterator::setCurrGlyphPositionAdjustment(float xPlacementAdjust,
+-    float yPlacementAdjust, float xAdvanceAdjust, float yAdvanceAdjust)
++void GlyphIterator::setCurrGlyphPositionAdjustment(float xPlacementAdjust, float yPlacementAdjust,
++                                                      float xAdvanceAdjust, float yAdvanceAdjust)
+ {
+     if (direction < 0) {
+         if (position <= nextLimit || position >= prevLimit) {
+@@ -484,10 +483,11 @@
+ 
+     do {
+         newPosition -= direction;
+-    } while (newPosition != prevLimit && glyphStorage[newPosition] != 0xFFFE &&
+-        filterGlyph(newPosition));
++    } while (newPosition != prevLimit && glyphStorage[newPosition] != 0xFFFE && filterGlyph(newPosition));
+ 
+     position = newPosition;
+ 
+     return position != prevLimit;
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/GlyphIterator.h b/src/share/native/sun/font/layout/GlyphIterator.h
+--- jdk/src/share/native/sun/font/layout/GlyphIterator.h
++++ jdk/src/share/native/sun/font/layout/GlyphIterator.h
+@@ -32,26 +32,24 @@
+ #ifndef __GLYPHITERATOR_H
+ #define __GLYPHITERATOR_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "OpenTypeTables.h"
+ #include "GlyphDefinitionTables.h"
+ 
+-struct InsertionRecord
+-{
+-    InsertionRecord *next;
+-    le_int32 position;
+-    le_int32 count;
+-    LEGlyphID glyphs[ANY_NUMBER];
+-};
++U_NAMESPACE_BEGIN
+ 
+ class LEGlyphStorage;
+ class GlyphPositionAdjustments;
+ 
+-class GlyphIterator {
++class GlyphIterator : public UMemory {
+ public:
+-    GlyphIterator(LEGlyphStorage &theGlyphStorage, GlyphPositionAdjustments *theGlyphPositionAdjustments,
+-        le_bool rightToLeft, le_uint16 theLookupFlags, FeatureMask theFeatureMask,
+-        const GlyphDefinitionTableHeader *theGlyphDefinitionTableHeader);
++    GlyphIterator(LEGlyphStorage &theGlyphStorage, GlyphPositionAdjustments *theGlyphPositionAdjustments, le_bool rightToLeft, le_uint16 theLookupFlags,
++        FeatureMask theFeatureMask, const GlyphDefinitionTableHeader *theGlyphDefinitionTableHeader);
+ 
+     GlyphIterator(GlyphIterator &that);
+ 
+@@ -122,4 +120,5 @@
+     GlyphIterator &operator=(const GlyphIterator &other); // forbid copying of this class
+ };
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/GlyphLookupTables.cpp b/src/share/native/sun/font/layout/GlyphLookupTables.cpp
+--- jdk/src/share/native/sun/font/layout/GlyphLookupTables.cpp
++++ jdk/src/share/native/sun/font/layout/GlyphLookupTables.cpp
+@@ -35,6 +35,8 @@
+ #include "GlyphLookupTables.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ le_bool GlyphLookupTableHeader::coversScript(LETag scriptTag) const
+ {
+     const ScriptListTable *scriptListTable = (const ScriptListTable *) ((char *)this + SWAPW(scriptListOffset));
+@@ -51,3 +53,5 @@
+     // Note: don't have to SWAPW langSysTable->featureCount to check for non-zero.
+     return langSysTable != NULL && langSysTable->featureCount != 0;
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/GlyphLookupTables.h b/src/share/native/sun/font/layout/GlyphLookupTables.h
+--- jdk/src/share/native/sun/font/layout/GlyphLookupTables.h
++++ jdk/src/share/native/sun/font/layout/GlyphLookupTables.h
+@@ -32,9 +32,16 @@
+ #ifndef __GLYPHLOOKUPTABLES_H
+ #define __GLYPHLOOKUPTABLES_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "OpenTypeTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ struct GlyphLookupTableHeader
+ {
+     fixed32 version;
+@@ -46,4 +53,7 @@
+     le_bool coversScriptAndLanguage(LETag scriptTag, LETag languageTag, le_bool exactMatch = FALSE) const;
+ };
+ 
++U_NAMESPACE_END
++
+ #endif
++
+diff --git a/src/share/native/sun/font/layout/GlyphPositionAdjustments.cpp b/src/share/native/sun/font/layout/GlyphPositionAdjustments.cpp
+--- jdk/src/share/native/sun/font/layout/GlyphPositionAdjustments.cpp
++++ jdk/src/share/native/sun/font/layout/GlyphPositionAdjustments.cpp
+@@ -34,6 +34,8 @@
+ #include "LEGlyphStorage.h"
+ #include "LEFontInstance.h"
+ 
++U_NAMESPACE_BEGIN
++
+ #define CHECK_ALLOCATE_ARRAY(array, type, size) \
+     if (array == NULL) { \
+         array = (type *) new type[size]; \
+@@ -185,3 +187,5 @@
+ 
+     return NULL;
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/GlyphPositionAdjustments.h b/src/share/native/sun/font/layout/GlyphPositionAdjustments.h
+--- jdk/src/share/native/sun/font/layout/GlyphPositionAdjustments.h
++++ jdk/src/share/native/sun/font/layout/GlyphPositionAdjustments.h
+@@ -32,16 +32,23 @@
+ #ifndef __GLYPHPOSITIONADJUSTMENTS_H
+ #define __GLYPHPOSITIONADJUSTMENTS_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "OpenTypeTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ class LEGlyphStorage;
+ class LEFontInstance;
+ 
+-class GlyphPositionAdjustments
++class GlyphPositionAdjustments : public UMemory
+ {
+ private:
+-    class Adjustment {
++    class Adjustment : public UMemory {
+     public:
+ 
+         inline Adjustment();
+@@ -78,7 +85,7 @@
+         // allow copying of this class because all of its fields are simple types
+     };
+ 
+-    class EntryExitPoint
++    class EntryExitPoint : public UMemory
+     {
+     public:
+         inline EntryExitPoint();
+@@ -144,14 +151,11 @@
+     inline void adjustXAdvance(le_int32 index, float xAdjustment);
+     inline void adjustYAdvance(le_int32 index, float yAdjustment);
+ 
+-    void setEntryPoint(le_int32 index, LEPoint &newEntryPoint,
+-        le_bool baselineIsLogicalEnd);
+-    void setExitPoint(le_int32 index, LEPoint &newExitPoint,
+-        le_bool baselineIsLogicalEnd);
++    void setEntryPoint(le_int32 index, LEPoint &newEntryPoint, le_bool baselineIsLogicalEnd);
++    void setExitPoint(le_int32 index, LEPoint &newExitPoint, le_bool baselineIsLogicalEnd);
+     void setCursiveGlyph(le_int32 index, le_bool baselineIsLogicalEnd);
+ 
+-    void applyCursiveAdjustments(LEGlyphStorage &glyphStorage, le_bool rightToLeft,
+-        const LEFontInstance *fontInstance);
++    void applyCursiveAdjustments(LEGlyphStorage &glyphStorage, le_bool rightToLeft, const LEFontInstance *fontInstance);
+ };
+ 
+ inline GlyphPositionAdjustments::Adjustment::Adjustment()
+@@ -160,10 +164,8 @@
+     // nothing else to do!
+ }
+ 
+-inline GlyphPositionAdjustments::Adjustment::Adjustment(float xPlace, float yPlace,
+-    float xAdv, float yAdv, le_int32 baseOff)
+-  : xPlacement(xPlace), yPlacement(yPlace), xAdvance(xAdv), yAdvance(yAdv),
+-    baseOffset(baseOff)
++inline GlyphPositionAdjustments::Adjustment::Adjustment(float xPlace, float yPlace, float xAdv, float yAdv, le_int32 baseOff)
++  : xPlacement(xPlace), yPlacement(yPlace), xAdvance(xAdv), yAdvance(yAdv), baseOffset(baseOff)
+ {
+     // nothing else to do!
+ }
+@@ -246,7 +248,7 @@
+ inline GlyphPositionAdjustments::EntryExitPoint::EntryExitPoint()
+     : fFlags(0)
+ {
+-    fEntryPoint.fX = fEntryPoint.fY = fExitPoint.fX = fEntryPoint.fY = 0;
++    fEntryPoint.fX = fEntryPoint.fY = fExitPoint.fX = fExitPoint.fY = 0;
+ }
+ 
+ inline GlyphPositionAdjustments::EntryExitPoint::~EntryExitPoint()
+@@ -264,12 +266,10 @@
+     return (fFlags & EEF_BASELINE_IS_LOGICAL_END) != 0;
+ }
+ 
+-inline void GlyphPositionAdjustments::EntryExitPoint::setEntryPoint(
+-    LEPoint &newEntryPoint, le_bool baselineIsLogicalEnd)
++inline void GlyphPositionAdjustments::EntryExitPoint::setEntryPoint(LEPoint &newEntryPoint, le_bool baselineIsLogicalEnd)
+ {
+     if (baselineIsLogicalEnd) {
+-        fFlags |= (EEF_HAS_ENTRY_POINT | EEF_IS_CURSIVE_GLYPH |
+-        EEF_BASELINE_IS_LOGICAL_END);
++        fFlags |= (EEF_HAS_ENTRY_POINT | EEF_IS_CURSIVE_GLYPH | EEF_BASELINE_IS_LOGICAL_END);
+     } else {
+         fFlags |= (EEF_HAS_ENTRY_POINT | EEF_IS_CURSIVE_GLYPH);
+     }
+@@ -277,12 +277,10 @@
+     fEntryPoint = newEntryPoint;
+ }
+ 
+-inline void GlyphPositionAdjustments::EntryExitPoint::setExitPoint(
+-    LEPoint &newExitPoint, le_bool baselineIsLogicalEnd)
++inline void GlyphPositionAdjustments::EntryExitPoint::setExitPoint(LEPoint &newExitPoint, le_bool baselineIsLogicalEnd)
+ {
+     if (baselineIsLogicalEnd) {
+-        fFlags |= (EEF_HAS_EXIT_POINT | EEF_IS_CURSIVE_GLYPH |
+-            EEF_BASELINE_IS_LOGICAL_END);
++        fFlags |= (EEF_HAS_EXIT_POINT | EEF_IS_CURSIVE_GLYPH | EEF_BASELINE_IS_LOGICAL_END);
+     } else {
+         fFlags |= (EEF_HAS_EXIT_POINT | EEF_IS_CURSIVE_GLYPH);
+     }
+@@ -290,8 +288,7 @@
+     fExitPoint  = newExitPoint;
+ }
+ 
+-inline void GlyphPositionAdjustments::EntryExitPoint::setCursiveGlyph(
+-    le_bool baselineIsLogicalEnd)
++inline void GlyphPositionAdjustments::EntryExitPoint::setCursiveGlyph(le_bool baselineIsLogicalEnd)
+ {
+     if (baselineIsLogicalEnd) {
+         fFlags |= (EEF_IS_CURSIVE_GLYPH | EEF_BASELINE_IS_LOGICAL_END);
+@@ -386,4 +383,5 @@
+     return fEntryExitPoints != NULL;
+ }
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/GlyphPositioningTables.cpp b/src/share/native/sun/font/layout/GlyphPositioningTables.cpp
+--- jdk/src/share/native/sun/font/layout/GlyphPositioningTables.cpp
++++ jdk/src/share/native/sun/font/layout/GlyphPositioningTables.cpp
+@@ -24,7 +24,6 @@
+  */
+ 
+ /*
+- *
+  * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
+  *
+  */
+@@ -40,18 +39,18 @@
+ #include "LEGlyphStorage.h"
+ #include "GlyphPositionAdjustments.h"
+ 
+-void GlyphPositioningTableHeader::process(LEGlyphStorage &glyphStorage,
+-    GlyphPositionAdjustments *glyphPositionAdjustments, le_bool rightToLeft,
+-    LETag scriptTag, LETag languageTag,
+-    const GlyphDefinitionTableHeader *glyphDefinitionTableHeader,
+-    const LEFontInstance *fontInstance,
+-    const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder) const
++U_NAMESPACE_BEGIN
++
++void GlyphPositioningTableHeader::process(LEGlyphStorage &glyphStorage, GlyphPositionAdjustments *glyphPositionAdjustments, le_bool rightToLeft,
++                                          LETag scriptTag, LETag languageTag,
++                                          const GlyphDefinitionTableHeader *glyphDefinitionTableHeader,
++                                          const LEFontInstance *fontInstance, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder) const
+ {
+-    GlyphPositioningLookupProcessor processor(this, scriptTag, languageTag, featureMap,
+-        featureMapCount, featureOrder);
++    GlyphPositioningLookupProcessor processor(this, scriptTag, languageTag, featureMap, featureMapCount, featureOrder);
+ 
+-    processor.process(glyphStorage, glyphPositionAdjustments, rightToLeft,
+-                      glyphDefinitionTableHeader, fontInstance);
++    processor.process(glyphStorage, glyphPositionAdjustments, rightToLeft, glyphDefinitionTableHeader, fontInstance);
+ 
+     glyphPositionAdjustments->applyCursiveAdjustments(glyphStorage, rightToLeft, fontInstance);
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/GlyphPositioningTables.h b/src/share/native/sun/font/layout/GlyphPositioningTables.h
+--- jdk/src/share/native/sun/font/layout/GlyphPositioningTables.h
++++ jdk/src/share/native/sun/font/layout/GlyphPositioningTables.h
+@@ -24,7 +24,6 @@
+  */
+ 
+ /*
+- *
+  * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
+  *
+  */
+@@ -32,11 +31,18 @@
+ #ifndef __GLYPHPOSITIONINGTABLES_H
+ #define __GLYPHPOSITIONINGTABLES_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "OpenTypeTables.h"
+ #include "Lookups.h"
+ #include "GlyphLookupTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ class  LEFontInstance;
+ class  LEGlyphStorage;
+ class  LEGlyphFilter;
+@@ -45,12 +51,10 @@
+ 
+ struct GlyphPositioningTableHeader : public GlyphLookupTableHeader
+ {
+-    void    process(LEGlyphStorage &glyphStorage,
+-                GlyphPositionAdjustments *glyphPositionAdjustments,
++    void    process(LEGlyphStorage &glyphStorage, GlyphPositionAdjustments *glyphPositionAdjustments,
+                 le_bool rightToLeft, LETag scriptTag, LETag languageTag,
+                 const GlyphDefinitionTableHeader *glyphDefinitionTableHeader,
+-                const LEFontInstance *fontInstance,
+-                const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder) const;
++                const LEFontInstance *fontInstance, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder) const;
+ };
+ 
+ enum GlyphPositioningSubtableTypes
+@@ -68,4 +72,5 @@
+ 
+ typedef LookupSubtable GlyphPositioningSubtable;
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/GlyphPosnLookupProc.cpp b/src/share/native/sun/font/layout/GlyphPosnLookupProc.cpp
+--- jdk/src/share/native/sun/font/layout/GlyphPosnLookupProc.cpp
++++ jdk/src/share/native/sun/font/layout/GlyphPosnLookupProc.cpp
+@@ -24,7 +24,6 @@
+  */
+ 
+ /*
+- *
+  * (C) Copyright IBM Corp. 1998 - 2005 - All Rights Reserved
+  *
+  */
+@@ -50,6 +49,8 @@
+ #include "GlyphPosnLookupProc.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ // Aside from the names, the contextual positioning subtables are
+ // the same as the contextual substitution subtables.
+ typedef ContextualSubstitutionSubtable ContextualPositioningSubtable;
+@@ -57,8 +58,7 @@
+ 
+ GlyphPositioningLookupProcessor::GlyphPositioningLookupProcessor(
+         const GlyphPositioningTableHeader *glyphPositioningTableHeader,
+-        LETag scriptTag, LETag languageTag,
+-        const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder)
++        LETag scriptTag, LETag languageTag, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder)
+     : LookupProcessor(
+                       (char *) glyphPositioningTableHeader,
+                       SWAPW(glyphPositioningTableHeader->scriptListOffset),
+@@ -166,3 +166,5 @@
+ GlyphPositioningLookupProcessor::~GlyphPositioningLookupProcessor()
+ {
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/GlyphPosnLookupProc.h b/src/share/native/sun/font/layout/GlyphPosnLookupProc.h
+--- jdk/src/share/native/sun/font/layout/GlyphPosnLookupProc.h
++++ jdk/src/share/native/sun/font/layout/GlyphPosnLookupProc.h
+@@ -24,7 +24,6 @@
+  */
+ 
+ /*
+- *
+  * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
+  *
+  */
+@@ -32,6 +31,11 @@
+ #ifndef __GLYPHPOSITIONINGLOOKUPPROCESSOR_H
+ #define __GLYPHPOSITIONINGLOOKUPPROCESSOR_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "LEFontInstance.h"
+ #include "OpenTypeTables.h"
+@@ -42,12 +46,13 @@
+ #include "GlyphIterator.h"
+ #include "LookupProcessor.h"
+ 
++U_NAMESPACE_BEGIN
++
+ class GlyphPositioningLookupProcessor : public LookupProcessor
+ {
+ public:
+     GlyphPositioningLookupProcessor(const GlyphPositioningTableHeader *glyphPositioningTableHeader,
+-        LETag scriptTag, LETag languageTag,
+-        const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder);
++        LETag scriptTag, LETag languageTag, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder);
+ 
+     virtual ~GlyphPositioningLookupProcessor();
+ 
+@@ -63,4 +68,5 @@
+     GlyphPositioningLookupProcessor &operator=(const GlyphPositioningLookupProcessor &other); // forbid copying of this class
+ };
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/GlyphSubstLookupProc.cpp b/src/share/native/sun/font/layout/GlyphSubstLookupProc.cpp
+--- jdk/src/share/native/sun/font/layout/GlyphSubstLookupProc.cpp
++++ jdk/src/share/native/sun/font/layout/GlyphSubstLookupProc.cpp
+@@ -48,17 +48,17 @@
+ #include "GlyphSubstLookupProc.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ GlyphSubstitutionLookupProcessor::GlyphSubstitutionLookupProcessor(
+         const GlyphSubstitutionTableHeader *glyphSubstitutionTableHeader,
+-        LETag scriptTag, LETag languageTag, const LEGlyphFilter *filter,
+-        const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder)
++        LETag scriptTag, LETag languageTag, const LEGlyphFilter *filter, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder)
+     : LookupProcessor(
+                       (char *) glyphSubstitutionTableHeader,
+                       SWAPW(glyphSubstitutionTableHeader->scriptListOffset),
+                       SWAPW(glyphSubstitutionTableHeader->featureListOffset),
+                       SWAPW(glyphSubstitutionTableHeader->lookupListOffset),
+-                      scriptTag, languageTag, featureMap, featureMapCount, featureOrder)
+-    , fFilter(filter)
++                      scriptTag, languageTag, featureMap, featureMapCount, featureOrder), fFilter(filter)
+ {
+     // anything?
+ }
+@@ -143,3 +143,5 @@
+ GlyphSubstitutionLookupProcessor::~GlyphSubstitutionLookupProcessor()
+ {
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/GlyphSubstLookupProc.h b/src/share/native/sun/font/layout/GlyphSubstLookupProc.h
+--- jdk/src/share/native/sun/font/layout/GlyphSubstLookupProc.h
++++ jdk/src/share/native/sun/font/layout/GlyphSubstLookupProc.h
+@@ -24,7 +24,6 @@
+  */
+ 
+ /*
+- *
+  * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
+  *
+  */
+@@ -32,6 +31,11 @@
+ #ifndef __GLYPHSUBSTITUTIONLOOKUPPROCESSOR_H
+ #define __GLYPHSUBSTITUTIONLOOKUPPROCESSOR_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "LEGlyphFilter.h"
+ #include "LEFontInstance.h"
+@@ -43,12 +47,13 @@
+ #include "GlyphIterator.h"
+ #include "LookupProcessor.h"
+ 
++U_NAMESPACE_BEGIN
++
+ class GlyphSubstitutionLookupProcessor : public LookupProcessor
+ {
+ public:
+     GlyphSubstitutionLookupProcessor(const GlyphSubstitutionTableHeader *glyphSubstitutionTableHeader,
+-        LETag scriptTag, LETag languageTag, const LEGlyphFilter *filter,
+-        const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder);
++        LETag scriptTag, LETag languageTag, const LEGlyphFilter *filter, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder);
+ 
+     virtual ~GlyphSubstitutionLookupProcessor();
+ 
+@@ -65,4 +70,5 @@
+     GlyphSubstitutionLookupProcessor &operator=(const GlyphSubstitutionLookupProcessor &other); // forbid copying of this class
+ };
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/GlyphSubstitutionTables.cpp b/src/share/native/sun/font/layout/GlyphSubstitutionTables.cpp
+--- jdk/src/share/native/sun/font/layout/GlyphSubstitutionTables.cpp
++++ jdk/src/share/native/sun/font/layout/GlyphSubstitutionTables.cpp
+@@ -40,14 +40,15 @@
+ #include "LEGlyphStorage.h"
+ #include "LESwaps.h"
+ 
+-le_int32 GlyphSubstitutionTableHeader::process(LEGlyphStorage &glyphStorage,
+-    le_bool rightToLeft, LETag scriptTag, LETag languageTag,
+-    const GlyphDefinitionTableHeader *glyphDefinitionTableHeader,
+-    const LEGlyphFilter *filter, const FeatureMap *featureMap,
+-    le_int32 featureMapCount, le_bool featureOrder) const
++U_NAMESPACE_BEGIN
++
++le_int32 GlyphSubstitutionTableHeader::process(LEGlyphStorage &glyphStorage, le_bool rightToLeft, LETag scriptTag, LETag languageTag,
++                                           const GlyphDefinitionTableHeader *glyphDefinitionTableHeader,
++                                           const LEGlyphFilter *filter, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder) const
+ {
+-    GlyphSubstitutionLookupProcessor processor(this, scriptTag, languageTag, filter, featureMap,
+-        featureMapCount, featureOrder);
++    GlyphSubstitutionLookupProcessor processor(this, scriptTag, languageTag, filter, featureMap, featureMapCount, featureOrder);
+ 
+     return processor.process(glyphStorage, NULL, rightToLeft, glyphDefinitionTableHeader, NULL);
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/GlyphSubstitutionTables.h b/src/share/native/sun/font/layout/GlyphSubstitutionTables.h
+--- jdk/src/share/native/sun/font/layout/GlyphSubstitutionTables.h
++++ jdk/src/share/native/sun/font/layout/GlyphSubstitutionTables.h
+@@ -32,22 +32,27 @@
+ #ifndef __GLYPHSUBSTITUTIONTABLES_H
+ #define __GLYPHSUBSTITUTIONTABLES_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "OpenTypeTables.h"
+ #include "Lookups.h"
+ #include "GlyphLookupTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ class  LEGlyphStorage;
+ class  LEGlyphFilter;
+ struct GlyphDefinitionTableHeader;
+ 
+ struct GlyphSubstitutionTableHeader : public GlyphLookupTableHeader
+ {
+-    le_int32 process(LEGlyphStorage &glyphStorage,
+-        le_bool rightToLeft, LETag scriptTag, LETag languageTag,
+-        const GlyphDefinitionTableHeader *glyphDefinitionTableHeader,
+-        const LEGlyphFilter *filter, const FeatureMap *featureMap,
+-        le_int32 featureMapCount, le_bool featureOrder) const;
++    le_int32    process(LEGlyphStorage &glyphStorage, le_bool rightToLeft, LETag scriptTag, LETag languageTag,
++                        const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, const LEGlyphFilter *filter,
++                        const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder) const;
+ };
+ 
+ enum GlyphSubstitutionSubtableTypes
+@@ -64,4 +69,5 @@
+ 
+ typedef LookupSubtable GlyphSubstitutionSubtable;
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/HanLayoutEngine.cpp b/src/share/native/sun/font/layout/HanLayoutEngine.cpp
+--- jdk/src/share/native/sun/font/layout/HanLayoutEngine.cpp
++++ jdk/src/share/native/sun/font/layout/HanLayoutEngine.cpp
+@@ -24,7 +24,6 @@
+  */
+ 
+ /*
+- *
+  * HanLayoutEngine.cpp: OpenType processing for Han fonts.
+  *
+  * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved.
+@@ -41,6 +40,10 @@
+ #include "LEGlyphStorage.h"
+ #include "OpenTypeTables.h"
+ 
++U_NAMESPACE_BEGIN
++
++UOBJECT_DEFINE_RTTI_IMPLEMENTATION(HanOpenTypeLayoutEngine)
++
+ #define loclFeatureTag LE_LOCL_FEATURE_TAG
+ #define smplFeatureTag LE_SMPL_FEATURE_TAG
+ #define tradFeatureTag LE_TRAD_FEATURE_TAG
+@@ -60,9 +63,8 @@
+ 
+ #define features (loclFeatureMask)
+ 
+-HanOpenTypeLayoutEngine::HanOpenTypeLayoutEngine(const LEFontInstance *fontInstance,
+-    le_int32 scriptCode,  le_int32 languageCode, le_int32 typoFlags,
+-    const GlyphSubstitutionTableHeader *gsubTable)
++HanOpenTypeLayoutEngine::HanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
++                        le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable)
+     : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable)
+ {
+     fFeatureMap      = featureMap;
+@@ -74,9 +76,8 @@
+     // nothing to do
+ }
+ 
+-le_int32 HanOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[],
+-    le_int32 offset, le_int32 count, le_int32 max, le_bool /*rightToLeft*/,
+-    LEUnicode *&/*outChars*/, LEGlyphStorage &glyphStorage, LEErrorCode &success)
++le_int32 HanOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool /*rightToLeft*/,
++        LEUnicode *&/*outChars*/, LEGlyphStorage &glyphStorage, LEErrorCode &success)
+ {
+     if (LE_FAILURE(success)) {
+         return 0;
+@@ -104,3 +105,5 @@
+ 
+     return count;
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/HanLayoutEngine.h b/src/share/native/sun/font/layout/HanLayoutEngine.h
+--- jdk/src/share/native/sun/font/layout/HanLayoutEngine.h
++++ jdk/src/share/native/sun/font/layout/HanLayoutEngine.h
+@@ -23,8 +23,8 @@
+  *
+  */
+ 
++
+ /*
+- *
+  * HanLayoutEngine.h: OpenType processing for Han fonts.
+  *
+  * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved.
+@@ -40,6 +40,8 @@
+ 
+ #include "GlyphSubstitutionTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ class LEGlyphStorage;
+ 
+ /**
+@@ -69,9 +71,8 @@
+      *
+      * @internal
+      */
+-    HanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode,
+-        le_int32 languageCode,
+-        le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable);
++    HanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
++                            le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable);
+ 
+ 
+     /**
+@@ -81,6 +82,20 @@
+      */
+     virtual ~HanOpenTypeLayoutEngine();
+ 
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for the actual class.
++     *
++     * @stable ICU 2.8
++     */
++    virtual UClassID getDynamicClassID() const;
++
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for this class.
++     *
++     * @stable ICU 2.8
++     */
++    static UClassID getStaticClassID();
++
+ protected:
+ 
+     /**
+@@ -92,10 +107,8 @@
+      * @param offset - the index of the first character to process
+      * @param count - the number of characters to process
+      * @param max - the number of characters in the input context
+-     * @param rightToLeft - <code>TRUE</code> if the characters are in a
+-     *    right to left directional run
+-     * @param glyphStorage - the object holding the glyph storage. The char
+-     *    index and auxillary data arrays will be set.
++     * @param rightToLeft - <code>TRUE</code> if the characters are in a right to left directional run
++     * @param glyphStorage - the object holding the glyph storage. The char index and auxillary data arrays will be set.
+      *
+      * Output parameters:
+      * @param outChars - the output character arrayt
+@@ -107,9 +120,10 @@
+      *
+      * @internal
+      */
+-    virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset,
+-        le_int32 count, le_int32 max, le_bool rightToLeft,
+-        LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
++    virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
++            LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
++
+ };
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/IndicClassTables.cpp b/src/share/native/sun/font/layout/IndicClassTables.cpp
+--- jdk/src/share/native/sun/font/layout/IndicClassTables.cpp
++++ jdk/src/share/native/sun/font/layout/IndicClassTables.cpp
+@@ -35,6 +35,8 @@
+ #include "OpenTypeUtilities.h"
+ #include "IndicReordering.h"
+ 
++U_NAMESPACE_BEGIN
++
+ // Split matra table indices
+ #define _x1  (1 << CF_INDEX_SHIFT)
+ #define _x2  (2 << CF_INDEX_SHIFT)
+@@ -385,3 +387,5 @@
+ 
+     return classTable->getWorstCaseExpansion();
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/IndicLayoutEngine.cpp b/src/share/native/sun/font/layout/IndicLayoutEngine.cpp
+--- jdk/src/share/native/sun/font/layout/IndicLayoutEngine.cpp
++++ jdk/src/share/native/sun/font/layout/IndicLayoutEngine.cpp
+@@ -45,20 +45,20 @@
+ 
+ #include "IndicReordering.h"
+ 
+-IndicOpenTypeLayoutEngine::IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance,
+-    le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags,
+-    const GlyphSubstitutionTableHeader *gsubTable)
+-    : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable),
+-    fMPreFixups(NULL)
++U_NAMESPACE_BEGIN
++
++UOBJECT_DEFINE_RTTI_IMPLEMENTATION(IndicOpenTypeLayoutEngine)
++
++IndicOpenTypeLayoutEngine::IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
++                    le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable)
++    : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable), fMPreFixups(NULL)
+ {
+     fFeatureMap = IndicReordering::getFeatureMap(fFeatureMapCount);
+     fFeatureOrder = TRUE;
+ }
+ 
+-IndicOpenTypeLayoutEngine::IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance,
+-    le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags)
+-    : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags),
+-    fMPreFixups(NULL)
++IndicOpenTypeLayoutEngine::IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags)
++    : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags), fMPreFixups(NULL)
+ {
+     fFeatureMap = IndicReordering::getFeatureMap(fFeatureMapCount);
+     fFeatureOrder = TRUE;
+@@ -71,9 +71,8 @@
+ 
+ // Input: characters, tags
+ // Output: glyphs, char indices
+-le_int32 IndicOpenTypeLayoutEngine::glyphProcessing(const LEUnicode chars[],
+-    le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
+-    LEGlyphStorage &glyphStorage, LEErrorCode &success)
++le_int32 IndicOpenTypeLayoutEngine::glyphProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
++                    LEGlyphStorage &glyphStorage, LEErrorCode &success)
+ {
+     if (LE_FAILURE(success)) {
+         return 0;
+@@ -84,8 +83,7 @@
+         return 0;
+     }
+ 
+-    le_int32 retCount = OpenTypeLayoutEngine::glyphProcessing(chars, offset, count, max,
+-        rightToLeft, glyphStorage, success);
++    le_int32 retCount = OpenTypeLayoutEngine::glyphProcessing(chars, offset, count, max, rightToLeft, glyphStorage, success);
+ 
+     if (LE_FAILURE(success)) {
+         return 0;
+@@ -99,9 +97,8 @@
+ // Input: characters
+ // Output: characters, char indices, tags
+ // Returns: output character count
+-le_int32 IndicOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[],
+-    le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
+-    LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success)
++le_int32 IndicOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
++        LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success)
+ {
+     if (LE_FAILURE(success)) {
+         return 0;
+@@ -131,9 +128,10 @@
+ 
+     // NOTE: assumes this allocates featureTags...
+     // (probably better than doing the worst case stuff here...)
+-    le_int32 outCharCount = IndicReordering::reorder(&chars[offset], count, fScriptCode,
+-        outChars, glyphStorage, &fMPreFixups);
++    le_int32 outCharCount = IndicReordering::reorder(&chars[offset], count, fScriptCode, outChars, glyphStorage, &fMPreFixups);
++
+     glyphStorage.adoptGlyphCount(outCharCount);
+-
+     return outCharCount;
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/IndicLayoutEngine.h b/src/share/native/sun/font/layout/IndicLayoutEngine.h
+--- jdk/src/share/native/sun/font/layout/IndicLayoutEngine.h
++++ jdk/src/share/native/sun/font/layout/IndicLayoutEngine.h
+@@ -43,6 +43,8 @@
+ #include "GlyphDefinitionTables.h"
+ #include "GlyphPositioningTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ class MPreFixups;
+ class LEGlyphStorage;
+ 
+@@ -77,9 +79,8 @@
+      *
+      * @internal
+      */
+-    IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance,
+-        le_int32 scriptCode, le_int32 languageCode,
+-        le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable);
++    IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
++                            le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable);
+ 
+     /**
+      * This constructor is used when the font requires a "canned" GSUB table which can't be known
+@@ -94,8 +95,8 @@
+      *
+      * @internal
+      */
+-    IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance,
+-        le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags);
++    IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
++                              le_int32 typoFlags);
+ 
+     /**
+      * The destructor, virtual for correct polymorphic invocation.
+@@ -104,6 +105,20 @@
+      */
+    virtual ~IndicOpenTypeLayoutEngine();
+ 
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for the actual class.
++     *
++     * @stable ICU 2.8
++     */
++    virtual UClassID getDynamicClassID() const;
++
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for this class.
++     *
++     * @stable ICU 2.8
++     */
++    static UClassID getStaticClassID();
++
+ protected:
+ 
+     /**
+@@ -117,10 +132,9 @@
+      * @param offset - the index of the first character to process
+      * @param count - the number of characters to process
+      * @param max - the number of characters in the input context
+-     * @param rightToLeft - <code>TRUE</code> if the characters are in a
+-     *    right to left directional run
+-     * @param glyphStorage - the glyph storage object. The glyph and character
+-     *    index arrays will be set. The auxillary data array will be set to the feature tags.
++     * @param rightToLeft - <code>TRUE</code> if the characters are in a right to left directional run
++     * @param glyphStorage - the glyph storage object. The glyph and character index arrays will be set.
++     *                       the auxillary data array will be set to the feature tags.
+      *
+      * Output parameters:
+      * @param success - set to an error code if the operation fails
+@@ -129,9 +143,8 @@
+      *
+      * @internal
+      */
+-    virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset,
+-        le_int32 count, le_int32 max, le_bool rightToLeft,
+-        LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
++    virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
++            LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
+ 
+     /**
+      * This method does character to glyph mapping, applies the GSUB table and applies
+@@ -147,11 +160,9 @@
+      * @param offset - the index of the first character to process
+      * @param count - the number of characters to process
+      * @param max - the number of characters in the input context
+-     * @param rightToLeft - <code>TRUE</code> if the characters are in a
+-     *    right to left directional run
++     * @param rightToLeft - <code>TRUE</code> if the characters are in a right to left directional run
+      * @param featureTags - the feature tag array
+-     * @param glyphStorage - the glyph storage object. The glyph and char
+-     *    index arrays will be set.
++     * @param glyphStorage - the glyph storage object. The glyph and char index arrays will be set.
+      *
+      * Output parameters:
+      * @param success - set to an error code if the operation fails
+@@ -163,12 +174,14 @@
+      *
+      * @internal
+      */
+-    virtual le_int32 glyphProcessing(const LEUnicode chars[], le_int32 offset,
+-        le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage,
+-        LEErrorCode &success);
++    virtual le_int32 glyphProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
++            LEGlyphStorage &glyphStorage, LEErrorCode &success);
+ 
+ private:
++
+     MPreFixups *fMPreFixups;
+ };
+ 
++U_NAMESPACE_END
+ #endif
++
+diff --git a/src/share/native/sun/font/layout/IndicRearrangement.h b/src/share/native/sun/font/layout/IndicRearrangement.h
+--- jdk/src/share/native/sun/font/layout/IndicRearrangement.h
++++ jdk/src/share/native/sun/font/layout/IndicRearrangement.h
+@@ -32,12 +32,19 @@
+ #ifndef __INDICREARRANGEMENT_H
+ #define __INDICREARRANGEMENT_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "LayoutTables.h"
+ #include "StateTables.h"
+ #include "MorphTables.h"
+ #include "MorphStateTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ struct IndicRearrangementSubtableHeader : MorphStateTableHeader
+ {
+ };
+@@ -78,4 +85,6 @@
+ {
+ };
+ 
++U_NAMESPACE_END
+ #endif
++
+diff --git a/src/share/native/sun/font/layout/IndicRearrangementProcessor.cpp b/src/share/native/sun/font/layout/IndicRearrangementProcessor.cpp
+--- jdk/src/share/native/sun/font/layout/IndicRearrangementProcessor.cpp
++++ jdk/src/share/native/sun/font/layout/IndicRearrangementProcessor.cpp
+@@ -39,6 +39,10 @@
+ #include "LEGlyphStorage.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
++UOBJECT_DEFINE_RTTI_IMPLEMENTATION(IndicRearrangementProcessor)
++
+ IndicRearrangementProcessor::IndicRearrangementProcessor(const MorphSubtableHeader *morphSubtableHeader)
+   : StateTableProcessor(morphSubtableHeader)
+ {
+@@ -56,8 +60,7 @@
+     lastGlyph = 0;
+ }
+ 
+-ByteOffset IndicRearrangementProcessor::processStateEntry(LEGlyphStorage &glyphStorage,
+-    le_int32 &currGlyph, EntryTableIndex index)
++ByteOffset IndicRearrangementProcessor::processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index)
+ {
+     const IndicRearrangementStateEntry *entry = &entryTable[index];
+     ByteOffset newState = SWAPW(entry->newStateOffset);
+@@ -416,3 +419,5 @@
+         break;
+     }
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/IndicRearrangementProcessor.h b/src/share/native/sun/font/layout/IndicRearrangementProcessor.h
+--- jdk/src/share/native/sun/font/layout/IndicRearrangementProcessor.h
++++ jdk/src/share/native/sun/font/layout/IndicRearrangementProcessor.h
+@@ -32,12 +32,19 @@
+ #ifndef __INDICREARRANGEMENTPROCESSOR_H
+ #define __INDICREARRANGEMENTPROCESSOR_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "MorphTables.h"
+ #include "SubtableProcessor.h"
+ #include "StateTableProcessor.h"
+ #include "IndicRearrangement.h"
+ 
++U_NAMESPACE_BEGIN
++
+ class LEGlyphStorage;
+ 
+ class IndicRearrangementProcessor : public StateTableProcessor
+@@ -54,12 +61,28 @@
+     IndicRearrangementProcessor(const MorphSubtableHeader *morphSubtableHeader);
+     virtual ~IndicRearrangementProcessor();
+ 
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for the actual class.
++     *
++     * @stable ICU 2.8
++     */
++    virtual UClassID getDynamicClassID() const;
++
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for this class.
++     *
++     * @stable ICU 2.8
++     */
++    static UClassID getStaticClassID();
++
+ protected:
+     le_int32 firstGlyph;
+     le_int32 lastGlyph;
+ 
+     const IndicRearrangementStateEntry *entryTable;
+     const IndicRearrangementSubtableHeader *indicRearrangementSubtableHeader;
++
+ };
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/IndicReordering.cpp b/src/share/native/sun/font/layout/IndicReordering.cpp
+--- jdk/src/share/native/sun/font/layout/IndicReordering.cpp
++++ jdk/src/share/native/sun/font/layout/IndicReordering.cpp
+@@ -36,6 +36,8 @@
+ #include "LEGlyphStorage.h"
+ #include "MPreFixups.h"
+ 
++U_NAMESPACE_BEGIN
++
+ #define initFeatureTag LE_INIT_FEATURE_TAG
+ #define nuktFeatureTag LE_NUKT_FEATURE_TAG
+ #define akhnFeatureTag LE_AKHN_FEATURE_TAG
+@@ -71,7 +73,7 @@
+ #define distFeatureMask 0x00020000UL
+ #define initFeatureMask 0x00010000UL
+ 
+-class ReorderingOutput {
++class ReorderingOutput : public UMemory {
+ private:
+     le_int32   fOutIndex;
+     LEUnicode *fOutChars;
+@@ -187,8 +189,7 @@
+         fOutIndex += 1;
+     }
+ 
+-    le_bool noteMatra(const IndicClassTable *classTable, LEUnicode matra, le_uint32 matraIndex,
+-        FeatureMask matraFeatures, le_bool wordStart)
++    le_bool noteMatra(const IndicClassTable *classTable, LEUnicode matra, le_uint32 matraIndex, FeatureMask matraFeatures, le_bool wordStart)
+     {
+         IndicClassTable::CharClass matraClass = classTable->getCharClass(matra);
+ 
+@@ -219,13 +220,12 @@
+         return FALSE;
+     }
+ 
+-    void noteVowelModifier(const IndicClassTable *classTable, LEUnicode vowelModifier,
+-        le_uint32 vowelModifierIndex, FeatureMask vowelModifierFeatures)
++    void noteVowelModifier(const IndicClassTable *classTable, LEUnicode vowelModifier, le_uint32 vowelModifierIndex, FeatureMask vowelModifierFeatures)
+     {
+         IndicClassTable::CharClass vmClass = classTable->getCharClass(vowelModifier);
+ 
+         fVMIndex = vowelModifierIndex;
+-        fVMFeatures = vowelModifierFeatures;
++        fVMFeatures  = vowelModifierFeatures;
+ 
+         if (IndicClassTable::isVowelModifier(vmClass)) {
+            switch (vmClass & CF_POS_MASK) {
+@@ -244,13 +244,12 @@
+         }
+     }
+ 
+-    void noteStressMark(const IndicClassTable *classTable, LEUnicode stressMark,
+-        le_uint32 stressMarkIndex, FeatureMask stressMarkFeatures)
++    void noteStressMark(const IndicClassTable *classTable, LEUnicode stressMark, le_uint32 stressMarkIndex, FeatureMask stressMarkFeatures)
+     {
+        IndicClassTable::CharClass smClass = classTable->getCharClass(stressMark);
+ 
+         fSMIndex = stressMarkIndex;
+-        fSMFeatures = stressMarkFeatures;
++        fSMFeatures  = stressMarkFeatures;
+ 
+         if (IndicClassTable::isStressMark(smClass)) {
+             switch (smClass & CF_POS_MASK) {
+@@ -360,9 +359,7 @@
+ };
+ 
+ // TODO: Find better names for these!
+-#define tagArray4 (nuktFeatureMask | akhnFeatureMask | vatuFeatureMask | presFeatureMask | \
+-    blwsFeatureMask | abvsFeatureMask | pstsFeatureMask | halnFeatureMask | \
+-    blwmFeatureMask | abvmFeatureMask | distFeatureMask)
++#define tagArray4 (nuktFeatureMask | akhnFeatureMask | vatuFeatureMask | presFeatureMask | blwsFeatureMask | abvsFeatureMask | pstsFeatureMask | halnFeatureMask | blwmFeatureMask | abvmFeatureMask | distFeatureMask)
+ #define tagArray3 (pstfFeatureMask | tagArray4)
+ #define tagArray2 (halfFeatureMask | tagArray3)
+ #define tagArray1 (blwfFeatureMask | tagArray2)
+@@ -415,8 +412,7 @@
+     return featureMap;
+ }
+ 
+-le_int32 IndicReordering::findSyllable(const IndicClassTable *classTable,
+-    const LEUnicode *chars, le_int32 prev, le_int32 charCount)
++le_int32 IndicReordering::findSyllable(const IndicClassTable *classTable, const LEUnicode *chars, le_int32 prev, le_int32 charCount)
+ {
+     le_int32 cursor = prev;
+     le_int8 state = 0;
+@@ -752,3 +748,5 @@
+         delete mpreFixups;
+     }
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/IndicReordering.h b/src/share/native/sun/font/layout/IndicReordering.h
+--- jdk/src/share/native/sun/font/layout/IndicReordering.h
++++ jdk/src/share/native/sun/font/layout/IndicReordering.h
+@@ -32,9 +32,16 @@
+ #ifndef __INDICREORDERING_H
+ #define __INDICREORDERING_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "OpenTypeTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ // Characters that get refered to by name...
+ #define C_SIGN_ZWNJ           0x200C
+ #define C_SIGN_ZWJ            0x200D
+@@ -140,7 +147,7 @@
+     static const IndicClassTable *getScriptClassTable(le_int32 scriptCode);
+ };
+ 
+-class IndicReordering {
++class IndicReordering /* not : public UObject because all methods are static */ {
+ public:
+     static le_int32 getWorstCaseExpansion(le_int32 scriptCode);
+ 
+@@ -156,8 +163,7 @@
+     // do not instantiate
+     IndicReordering();
+ 
+-    static le_int32 findSyllable(const IndicClassTable *classTable, const LEUnicode *chars,
+-        le_int32 prev, le_int32 charCount);
++    static le_int32 findSyllable(const IndicClassTable *classTable, const LEUnicode *chars, le_int32 prev, le_int32 charCount);
+ 
+ };
+ 
+@@ -305,4 +311,5 @@
+     return hasBelowBaseForm(getCharClass(ch));
+ }
+ 
++U_NAMESPACE_END
+ #endif
+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
+@@ -25,6 +25,7 @@
+ 
+ /*
+  *
++ *
+  * (C) Copyright IBM Corp. 2004-2005 - All Rights Reserved
+  *
+  */
+@@ -39,6 +40,8 @@
+ 
+ #define DEBUG 0
+ 
++U_NAMESPACE_BEGIN
++
+ struct PairInfo {
+   le_uint32 key;   // sigh, MSVC compiler gags on union here
+   le_int16  value; // fword, kern value in funits
+@@ -191,6 +194,12 @@
+     float adjust = 0;
+     for (int i = 1, e = storage.getGlyphCount(); i < e; ++i) {
+       key = key << 16 | (storage[i] & 0xffff);
++
++      // argh, to do a binary search, we need to have the pair list in sorted order
++      // but it is not in sorted order on win32 platforms because of the endianness difference
++      // so either I have to swap the element each time I examine it, or I have to swap
++      // all the elements ahead of time and store them in the font
++
+       const PairInfo* p = pairs;
+       const PairInfo* tp = (const PairInfo*)(p + rangeShift);
+       if (key > tp->key) {
+@@ -238,3 +247,6 @@
+     storage.adjustPosition(storage.getGlyphCount(), adjust, 0, success);
+   }
+ }
++
++U_NAMESPACE_END
++
+diff --git a/src/share/native/sun/font/layout/KernTable.h b/src/share/native/sun/font/layout/KernTable.h
+--- jdk/src/share/native/sun/font/layout/KernTable.h
++++ jdk/src/share/native/sun/font/layout/KernTable.h
+@@ -25,6 +25,7 @@
+ 
+ /*
+  *
++ *
+  * (C) Copyright IBM Corp. 2004-2005 - All Rights Reserved
+  *
+  */
+@@ -37,9 +38,12 @@
+ #endif
+ 
+ #include "LETypes.h"
++//#include "LEFontInstance.h"
++//#include "LEGlyphStorage.h"
+ 
+ #include <stdio.h>
+ 
++U_NAMESPACE_BEGIN
+ struct PairInfo;
+ class  LEFontInstance;
+ class  LEGlyphStorage;
+@@ -67,4 +71,6 @@
+   void process(LEGlyphStorage& storage);
+ };
+ 
++U_NAMESPACE_END
++
+ #endif
+diff --git a/src/share/native/sun/font/layout/KhmerLayoutEngine.cpp b/src/share/native/sun/font/layout/KhmerLayoutEngine.cpp
+--- jdk/src/share/native/sun/font/layout/KhmerLayoutEngine.cpp
++++ jdk/src/share/native/sun/font/layout/KhmerLayoutEngine.cpp
+@@ -23,8 +23,8 @@
+  *
+  */
+ 
++
+ /*
+- *
+  * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
+  *
+  * This file is a modification of the ICU file IndicLayoutEngine.cpp
+@@ -38,17 +38,20 @@
+ #include "LEGlyphStorage.h"
+ #include "KhmerReordering.h"
+ 
+-KhmerOpenTypeLayoutEngine::KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance,
+-    le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags,
+-    const GlyphSubstitutionTableHeader *gsubTable)
++U_NAMESPACE_BEGIN
++
++UOBJECT_DEFINE_RTTI_IMPLEMENTATION(KhmerOpenTypeLayoutEngine)
++
++KhmerOpenTypeLayoutEngine::KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
++                    le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable)
+     : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable)
+ {
+     fFeatureMap   = KhmerReordering::getFeatureMap(fFeatureMapCount);
+     fFeatureOrder = TRUE;
+ }
+ 
+-KhmerOpenTypeLayoutEngine::KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance,
+-    le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags)
++KhmerOpenTypeLayoutEngine::KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
++                                                     le_int32 typoFlags)
+     : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags)
+ {
+     fFeatureMap   = KhmerReordering::getFeatureMap(fFeatureMapCount);
+@@ -63,16 +66,14 @@
+ // Input: characters
+ // Output: characters, char indices, tags
+ // Returns: output character count
+-le_int32 KhmerOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[],
+-    le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
+-    LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success)
++le_int32 KhmerOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
++        LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success)
+ {
+     if (LE_FAILURE(success)) {
+         return 0;
+     }
+ 
+-    if (chars == NULL || offset < 0 || count < 0 || max < 0 ||
+-        offset >= max || offset + count > max) {
++    if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || offset + count > max) {
+         success = LE_ILLEGAL_ARGUMENT_ERROR;
+         return 0;
+     }
+@@ -96,9 +97,10 @@
+ 
+     // NOTE: assumes this allocates featureTags...
+     // (probably better than doing the worst case stuff here...)
+-    le_int32 outCharCount = KhmerReordering::reorder(&chars[offset], count,
+-        fScriptCode, outChars, glyphStorage);
++    le_int32 outCharCount = KhmerReordering::reorder(&chars[offset], count, fScriptCode, outChars, glyphStorage);
+ 
+     glyphStorage.adoptGlyphCount(outCharCount);
+     return outCharCount;
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/KhmerLayoutEngine.h b/src/share/native/sun/font/layout/KhmerLayoutEngine.h
+--- jdk/src/share/native/sun/font/layout/KhmerLayoutEngine.h
++++ jdk/src/share/native/sun/font/layout/KhmerLayoutEngine.h
+@@ -23,6 +23,7 @@
+  *
+  */
+ 
++
+ /*
+  *
+  * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
+@@ -45,19 +46,18 @@
+ // #include "GlyphDefinitionTables.h"
+ // #include "GlyphPositioningTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ // class MPreFixups;
+ // class LEGlyphStorage;
+ 
+ /**
+  * This class implements OpenType layout for Khmer OpenType fonts, as
+- * specified by Microsoft in "Creating and Supporting OpenType Fonts
+- * for Khmer Scripts"
+- * (http://www.microsoft.com/typography/otspec/indicot/default.htm)
+- * TODO: change url
++ * specified by Microsoft in "Creating and Supporting OpenType Fonts for
++ * Khmer Scripts" (http://www.microsoft.com/typography/otspec/indicot/default.htm) TODO: change url
+  *
+- * This class overrides the characterProcessing method to do Khmer
+- * character processing and reordering (See the MS spec. for more
+- * details)
++ * This class overrides the characterProcessing method to do Khmer character processing
++ * and reordering (See the MS spec. for more details)
+  *
+  * @internal
+  */
+@@ -65,11 +65,10 @@
+ {
+ public:
+     /**
+-     * This is the main constructor. It constructs an instance of
+-     * KhmerOpenTypeLayoutEngine for a particular font, script and
+-     * language. It takes the GSUB table as a parameter since
+-     * LayoutEngine::layoutEngineFactory has to read the GSUB table to
+-     * know that it has an Khmer OpenType font.
++     * This is the main constructor. It constructs an instance of KhmerOpenTypeLayoutEngine for
++     * a particular font, script and language. It takes the GSUB table as a parameter since
++     * LayoutEngine::layoutEngineFactory has to read the GSUB table to know that it has an
++     * Khmer OpenType font.
+      *
+      * @param fontInstance - the font
+      * @param scriptCode - the script
+@@ -82,14 +81,12 @@
+      *
+      * @internal
+      */
+-    KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance,
+-        le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags,
+-        const GlyphSubstitutionTableHeader *gsubTable);
++    KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
++                            le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable);
+ 
+     /**
+-     * This constructor is used when the font requires a "canned" GSUB
+-     * table which can't be known until after this constructor has
+-     * been invoked.
++     * This constructor is used when the font requires a "canned" GSUB table which can't be known
++     * until after this constructor has been invoked.
+      *
+      * @param fontInstance - the font
+      * @param scriptCode - the script
+@@ -100,8 +97,8 @@
+      *
+      * @internal
+      */
+-    KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance,
+-        le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags);
++    KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
++                              le_int32 typoFlags);
+ 
+     /**
+      * The destructor, virtual for correct polymorphic invocation.
+@@ -110,25 +107,35 @@
+      */
+    virtual ~KhmerOpenTypeLayoutEngine();
+ 
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for the actual class.
++     *
++     * @stable ICU 2.8
++     */
++    virtual UClassID getDynamicClassID() const;
++
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for this class.
++     *
++     * @stable ICU 2.8
++     */
++    static UClassID getStaticClassID();
++
+ protected:
+ 
+     /**
+-     * This method does Khmer OpenType character processing. It
+-     * assigns the OpenType feature tags to the characters, and may
+-     * generate output characters which have been reordered.  It may
+-     * also split some vowels, resulting in more output characters
+-     * than input characters.
++     * This method does Khmer OpenType character processing. It assigns the OpenType feature
++     * tags to the characters, and may generate output characters which have been reordered.
++     * It may also split some vowels, resulting in more output characters than input characters.
+      *
+      * Input parameters:
+      * @param chars - the input character context
+      * @param offset - the index of the first character to process
+      * @param count - the number of characters to process
+      * @param max - the number of characters in the input context
+-     * @param rightToLeft - <code>TRUE</code> if the characters are in
+-     * a right to left directional run
+-     * @param glyphStorage - the glyph storage object. The glyph and
+-     * character index arrays will be set.  the auxillary data array
+-     * will be set to the feature tags.
++     * @param rightToLeft - <code>TRUE</code> if the characters are in a right to left directional run
++     * @param glyphStorage - the glyph storage object. The glyph and character index arrays will be set.
++     *                       the auxillary data array will be set to the feature tags.
+      *
+      * Output parameters:
+      * @param success - set to an error code if the operation fails
+@@ -137,9 +144,11 @@
+      *
+      * @internal
+      */
+-    virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset,
+-        le_int32 count, le_int32 max, le_bool rightToLeft,
+-        LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
++    virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
++            LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
++
+ };
+ 
++U_NAMESPACE_END
+ #endif
++
+diff --git a/src/share/native/sun/font/layout/KhmerReordering.cpp b/src/share/native/sun/font/layout/KhmerReordering.cpp
+--- jdk/src/share/native/sun/font/layout/KhmerReordering.cpp
++++ jdk/src/share/native/sun/font/layout/KhmerReordering.cpp
+@@ -37,6 +37,9 @@
+ #include "KhmerReordering.h"
+ #include "LEGlyphStorage.h"
+ 
++
++U_NAMESPACE_BEGIN
++
+ // Characters that get refered to by name...
+ enum
+ {
+@@ -53,35 +56,23 @@
+ 
+ enum
+ {
+-    // simple classes, they are used in the statetable (in this file)
+-    // to control the length of a syllable they are also used to know
+-    // where a character should be placed (location in reference to
+-    // the base character) and also to know if a character, when
+-    // independtly displayed, should be displayed with a dotted-circle
+-    // to indicate error in syllable construction
+-
++    // simple classes, they are used in the statetable (in this file) to control the length of a syllable
++    // they are also used to know where a character should be placed (location in reference to the base character)
++    // and also to know if a character, when independtly displayed, should be displayed with a dotted-circle to
++    // indicate error in syllable construction
+     _xx = KhmerClassTable::CC_RESERVED,
+-    _sa = KhmerClassTable::CC_SIGN_ABOVE | KhmerClassTable::CF_DOTTED_CIRCLE
+-          | KhmerClassTable::CF_POS_ABOVE,
+-    _sp = KhmerClassTable::CC_SIGN_AFTER | KhmerClassTable::CF_DOTTED_CIRCLE
+-          | KhmerClassTable::CF_POS_AFTER,
++    _sa = KhmerClassTable::CC_SIGN_ABOVE | KhmerClassTable::CF_DOTTED_CIRCLE | KhmerClassTable::CF_POS_ABOVE,
++    _sp = KhmerClassTable::CC_SIGN_AFTER | KhmerClassTable::CF_DOTTED_CIRCLE| KhmerClassTable::CF_POS_AFTER,
+     _c1 = KhmerClassTable::CC_CONSONANT | KhmerClassTable::CF_CONSONANT,
+     _c2 = KhmerClassTable::CC_CONSONANT2 | KhmerClassTable::CF_CONSONANT,
+     _c3 = KhmerClassTable::CC_CONSONANT3 | KhmerClassTable::CF_CONSONANT,
+-    _rb = KhmerClassTable::CC_ROBAT | KhmerClassTable::CF_POS_ABOVE
+-          | KhmerClassTable::CF_DOTTED_CIRCLE,
+-    _cs = KhmerClassTable::CC_CONSONANT_SHIFTER | KhmerClassTable::CF_DOTTED_CIRCLE
+-          | KhmerClassTable::CF_SHIFTER,
+-    _dl = KhmerClassTable::CC_DEPENDENT_VOWEL | KhmerClassTable::CF_POS_BEFORE
+-          | KhmerClassTable::CF_DOTTED_CIRCLE,
+-    _db = KhmerClassTable::CC_DEPENDENT_VOWEL | KhmerClassTable::CF_POS_BELOW
+-          | KhmerClassTable::CF_DOTTED_CIRCLE,
+-    _da = KhmerClassTable::CC_DEPENDENT_VOWEL | KhmerClassTable::CF_POS_ABOVE
+-          | KhmerClassTable::CF_DOTTED_CIRCLE | KhmerClassTable::CF_ABOVE_VOWEL,
+-    _dr = KhmerClassTable::CC_DEPENDENT_VOWEL | KhmerClassTable::CF_POS_AFTER
+-          | KhmerClassTable::CF_DOTTED_CIRCLE,
+-    _co = KhmerClassTable::CC_COENG | KhmerClassTable::CF_COENG
+-          | KhmerClassTable::CF_DOTTED_CIRCLE,
++    _rb = KhmerClassTable::CC_ROBAT | KhmerClassTable::CF_POS_ABOVE | KhmerClassTable::CF_DOTTED_CIRCLE,
++    _cs = KhmerClassTable::CC_CONSONANT_SHIFTER | KhmerClassTable::CF_DOTTED_CIRCLE | KhmerClassTable::CF_SHIFTER,
++    _dl = KhmerClassTable::CC_DEPENDENT_VOWEL | KhmerClassTable::CF_POS_BEFORE | KhmerClassTable::CF_DOTTED_CIRCLE,
++    _db = KhmerClassTable::CC_DEPENDENT_VOWEL | KhmerClassTable::CF_POS_BELOW | KhmerClassTable::CF_DOTTED_CIRCLE,
++    _da = KhmerClassTable::CC_DEPENDENT_VOWEL | KhmerClassTable::CF_POS_ABOVE | KhmerClassTable::CF_DOTTED_CIRCLE | KhmerClassTable::CF_ABOVE_VOWEL,
++    _dr = KhmerClassTable::CC_DEPENDENT_VOWEL | KhmerClassTable::CF_POS_AFTER | KhmerClassTable::CF_DOTTED_CIRCLE,
++    _co = KhmerClassTable::CC_COENG | KhmerClassTable::CF_COENG | KhmerClassTable::CF_DOTTED_CIRCLE,
+ 
+     // split vowel
+     _va = _da | KhmerClassTable::CF_SPLIT_VOWEL,
+@@ -90,13 +81,10 @@
+ 
+ 
+ // Character class tables
+-
+-// _xx character does not combine into syllable, such as numbers,
+-//     puntuation marks, non-Khmer signs...
++// _xx character does not combine into syllable, such as numbers, puntuation marks, non-Khmer signs...
+ // _sa Sign placed above the base
+ // _sp Sign placed after the base
+-// _c1 Consonant of type 1 or independent vowel (independent vowels
+-//     behave as type 1 consonants)
++// _c1 Consonant of type 1 or independent vowel (independent vowels behave as type 1 consonants)
+ // _c2 Consonant of type 2 (only RO)
+ // _c3 Consonant of type 3
+ // _rb Khmer sign robat u17CC. combining mark for subscript consonants
+@@ -105,13 +93,10 @@
+ // _db Dependent vowel placed below the base
+ // _da Dependent vowel placed above the base
+ // _dr Dependent vowel placed behind the base (right of the base)
+-// _co Khmer combining mark COENG u17D2, combines with the consonant
+-//     or independent vowel following it to create a subscript consonant
+-//     or independent vowel
+-// _va Khmer split vowel in wich the first part is before the base and
+-//     the second one above the base
+-// _vr Khmer split vowel in wich the first part is before the base and
+-//     the second one behind (right of) the base
++// _co Khmer combining mark COENG u17D2, combines with the consonant or independent vowel following
++//     it to create a subscript consonant or independent vowel
++// _va Khmer split vowel in wich the first part is before the base and the second one above the base
++// _vr Khmer split vowel in wich the first part is before the base and the second one behind (right of) the base
+ 
+ static const KhmerClassTable::CharClass khmerCharClasses[] =
+ {
+@@ -129,19 +114,19 @@
+ //
+ 
+ //
+-// The range of characters defined in the above table is defined
+-// here. FOr Khmer 1780 to 17DF Even if the Khmer range is bigger, all
+-// other characters are not combinable, and therefore treated as _xx
++// The range of characters defined in the above table is defined here. FOr Khmer 1780 to 17DF
++// Even if the Khmer range is bigger, all other characters are not combinable, and therefore treated
++// as _xx
+ static const KhmerClassTable khmerClassTable = {0x1780, 0x17df, khmerCharClasses};
+ 
+ 
+-// Below we define how a character in the input string is either in
+-// the khmerCharClasses table (in which case we get its type back), a
+-// ZWJ or ZWNJ (two characters that may appear within the syllable,
+-// but are not in the table) we also get their type back, or an
+-// unknown object in which case we get _xx (CC_RESERVED) back
++// Below we define how a character in the input string is either in the khmerCharClasses table
++// (in which case we get its type back), a ZWJ or ZWNJ (two characters that may appear
++// within the syllable, but are not in the table) we also get their type back, or an unknown object
++// in which case we get _xx (CC_RESERVED) back
+ KhmerClassTable::CharClass KhmerClassTable::getCharClass(LEUnicode ch) const
+ {
++
+     if (ch == C_SIGN_ZWJ) {
+         return CC_ZERO_WIDTH_J_MARK;
+     }
+@@ -164,13 +149,14 @@
+ 
+ 
+ 
+-class ReorderingOutput {
++class ReorderingOutput : public UMemory {
+ private:
+     le_int32 fOutIndex;
+     LEUnicode *fOutChars;
+ 
+     LEGlyphStorage &fGlyphStorage;
+ 
++
+ public:
+     ReorderingOutput(LEUnicode *outChars, LEGlyphStorage &glyphStorage)
+         : fOutIndex(0), fOutChars(outChars), fGlyphStorage(glyphStorage)
+@@ -232,18 +218,11 @@
+ #define abvmFeatureMask 0x00100000UL
+ #define mkmkFeatureMask 0x00080000UL
+ 
+-#define tagPref    (prefFeatureMask | presFeatureMask | \
+-    cligFeatureMask | distFeatureMask)
+-#define tagAbvf    (abvfFeatureMask | abvsFeatureMask | \
+-    cligFeatureMask | distFeatureMask | abvmFeatureMask | mkmkFeatureMask)
+-#define tagPstf    (blwfFeatureMask | blwsFeatureMask | prefFeatureMask | \
+-    presFeatureMask | pstfFeatureMask | pstsFeatureMask | cligFeatureMask | \
+-    distFeatureMask | blwmFeatureMask)
+-#define tagBlwf    (blwfFeatureMask | blwsFeatureMask | cligFeatureMask | \
+-    distFeatureMask | blwmFeatureMask | mkmkFeatureMask)
+-#define tagDefault (prefFeatureMask | blwfFeatureMask | presFeatureMask | \
+-    blwsFeatureMask | cligFeatureMask | distFeatureMask | abvmFeatureMask | \
+-    blwmFeatureMask | mkmkFeatureMask)
++#define tagPref    (prefFeatureMask | presFeatureMask | cligFeatureMask | distFeatureMask)
++#define tagAbvf    (abvfFeatureMask | abvsFeatureMask | cligFeatureMask | distFeatureMask | abvmFeatureMask | mkmkFeatureMask)
++#define tagPstf    (blwfFeatureMask | blwsFeatureMask | prefFeatureMask | presFeatureMask | pstfFeatureMask | pstsFeatureMask | cligFeatureMask | distFeatureMask | blwmFeatureMask)
++#define tagBlwf    (blwfFeatureMask | blwsFeatureMask | cligFeatureMask | distFeatureMask | blwmFeatureMask | mkmkFeatureMask)
++#define tagDefault (prefFeatureMask | blwfFeatureMask | presFeatureMask | blwsFeatureMask | cligFeatureMask | distFeatureMask | abvmFeatureMask | blwmFeatureMask | mkmkFeatureMask)
+ 
+ 
+ 
+@@ -274,35 +253,32 @@
+ // The stateTable is used to calculate the end (the length) of a well
+ // formed Khmer Syllable.
+ //
+-// Each horizontal line is ordered exactly the same way as the values
+-// in KhmerClassTable CharClassValues in KhmerReordering.h This
+-// coincidence of values allows the follow up of the table.
++// Each horizontal line is ordered exactly the same way as the values in KhmerClassTable
++// CharClassValues in KhmerReordering.h This coincidence of values allows the
++// follow up of the table.
+ //
+-// Each line corresponds to a state, which does not necessarily need
+-// to be a type of component... for example, state 2 is a base, with
+-// is always a first character in the syllable, but the state could be
+-// produced a consonant of any type when it is the first character
+-// that is analysed (in ground state).
++// Each line corresponds to a state, which does not necessarily need to be a type
++// of component... for example, state 2 is a base, with is always a first character
++// in the syllable, but the state could be produced a consonant of any type when
++// it is the first character that is analysed (in ground state).
+ //
+ // Differentiating 3 types of consonants is necessary in order to
+ // forbid the use of certain combinations, such as having a second
+-// coeng after a coeng RO.
+-// The inexistent possibility of having a type 3 after another type 3
+-// is permitted, eliminating it would very much complicate the table,
+-// and it does not create typing problems, as the case above.
++// coeng after a coeng RO,
++// The inexistent possibility of having a type 3 after another type 3 is permitted,
++// eliminating it would very much complicate the table, and it does not create typing
++// problems, as the case above.
+ //
+-// The table is quite complex, in order to limit the number of coeng
+-// consonants to 2 (by means of the table).
++// The table is quite complex, in order to limit the number of coeng consonants
++// to 2 (by means of the table).
+ //
+ // There a peculiarity, as far as Unicode is concerned:
+ // - The consonant-shifter is considered in two possible different
+-//   locations, the one considered in Unicode 3.0 and the one considered
+-//   in Unicode 4.0. (there is a backwards compatibility problem in this
+-//   standard).
++//   locations, the one considered in Unicode 3.0 and the one considered in
++//   Unicode 4.0. (there is a backwards compatibility problem in this standard).
+ 
+ 
+-// xx    independent character, such as a number, punctuation sign or
+-//       non-khmer char
++// xx    independent character, such as a number, punctuation sign or non-khmer char
+ //
+ // c1    Khmer consonant of type 1 or an independent vowel
+ //       that is, a letter in which the subscript for is only under the
+@@ -320,10 +296,9 @@
+ //
+ // co    coeng character (u17D2)
+ //
+-// dv    dependent vowel (including split vowels, they are treated in the
+-//       same way).  even if dv is not defined above, the component that is
+-//       really tested for is KhmerClassTable::CC_DEPENDENT_VOWEL, which is
+-//       common to all dependent vowels
++// dv    dependent vowel (including split vowels, they are treated in the same way).
++//       even if dv is not defined above, the component that is really tested for is
++//       KhmerClassTable::CC_DEPENDENT_VOWEL, which is common to all dependent vowels
+ //
+ // zwj   Zero Width joiner
+ //
+@@ -352,8 +327,7 @@
+     {-1, -1, -1, -1, 12, 13, -1, -1, 16, 17,  1, 14}, //  8 - First consonant of type 2 after coeng
+     {-1, -1, -1, -1, 12, 13, -1, 10, 16, 17,  1, 14}, //  9 - First consonant or type 3 after ceong
+     {-1, 11, 11, 11, -1, -1, -1, -1, -1, -1, -1, -1}, // 10 - Second Coeng (no register shifter before)
+-    {-1, -1, -1, -1, 15, -1, -1, -1, 16, 17,  1, 14}, // 11 - Second coeng consonant
+-                                                      //      (or ind. vowel) no register shifter before
++    {-1, -1, -1, -1, 15, -1, -1, -1, 16, 17,  1, 14}, // 11 - Second coeng consonant (or ind. vowel) no register shifter before
+     {-1, -1,  1, -1, -1, 13, -1, -1, 16, -1, -1, -1}, // 12 - Second ZWNJ before a register shifter
+     {-1, -1, -1, -1, 15, -1, -1, -1, 16, 17,  1, 14}, // 13 - Second register shifter
+     {-1, -1, -1, -1, -1, -1, -1, -1, 16, -1, -1, -1}, // 14 - ZWJ before vowel
+@@ -363,6 +337,7 @@
+     {-1, -1, -1, -1, -1, -1, -1, 19, -1, -1, -1, -1}, // 18 - ZWJ after vowel
+     {-1,  1, -1,  1, -1, -1, -1, -1, -1, -1, -1, -1}, // 19 - Third coeng
+     {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,  1, -1}, // 20 - dependent vowel after a Robat
++
+ };
+ 
+ 
+@@ -377,15 +352,13 @@
+ // Given an input string of characters and a location in which to start looking
+ // calculate, using the state table, which one is the last character of the syllable
+ // that starts in the starting position.
+-le_int32 KhmerReordering::findSyllable(const KhmerClassTable *classTable,
+-    const LEUnicode *chars, le_int32 prev, le_int32 charCount)
++le_int32 KhmerReordering::findSyllable(const KhmerClassTable *classTable, const LEUnicode *chars, le_int32 prev, le_int32 charCount)
+ {
+     le_int32 cursor = prev;
+     le_int8 state = 0;
+ 
+     while (cursor < charCount) {
+-        KhmerClassTable::CharClass charClass = (classTable->getCharClass(chars[cursor])
+-            & KhmerClassTable::CF_CLASS_MASK);
++        KhmerClassTable::CharClass charClass = (classTable->getCharClass(chars[cursor]) & KhmerClassTable::CF_CLASS_MASK);
+ 
+         state = khmerStateTable[state][charClass];
+ 
+@@ -402,8 +375,8 @@
+ 
+ // This is the real reordering function as applied to the Khmer language
+ 
+-le_int32 KhmerReordering::reorder(const LEUnicode *chars, le_int32 charCount,
+-    le_int32 /*scriptCode*/, LEUnicode *outChars, LEGlyphStorage &glyphStorage)
++le_int32 KhmerReordering::reorder(const LEUnicode *chars, le_int32 charCount, le_int32 /*scriptCode*/,
++                                  LEUnicode *outChars, LEGlyphStorage &glyphStorage)
+ {
+     const KhmerClassTable *classTable = KhmerClassTable::getKhmerClassTable();
+ 
+@@ -442,8 +415,7 @@
+             // and because CC_CONSONANT2 is enough to identify it, as it is the only consonant
+             // with this flag
+             if ( (charClass & KhmerClassTable::CF_COENG) && (i + 1 < syllable) &&
+-                 ( (classTable->getCharClass(chars[i + 1]) &
+-                    KhmerClassTable::CF_CLASS_MASK) == KhmerClassTable::CC_CONSONANT2) )
++                 ( (classTable->getCharClass(chars[i + 1]) & KhmerClassTable::CF_CLASS_MASK) == KhmerClassTable::CC_CONSONANT2) )
+             {
+                     coengRo = i;
+             }
+@@ -455,16 +427,15 @@
+             output.writeChar(C_RO, coengRo + 1, tagPref);
+         }
+ 
+-        // shall we add a dotted circle?  If in the position in which
+-        // the base should be (first char in the string) there is a
+-        // character that has the Dotted circle flag (a character that
+-        // cannot be a base) then write a dotted circle
++        // shall we add a dotted circle?
++        // If in the position in which the base should be (first char in the string) there is
++        // a character that has the Dotted circle flag (a character that cannot be a base)
++        // then write a dotted circle
+         if (classTable->getCharClass(chars[prev]) & KhmerClassTable::CF_DOTTED_CIRCLE) {
+             output.writeChar(C_DOTTED_CIRCLE, prev, tagDefault);
+         }
+ 
+-        // copy what is left to the output, skipping before vowels and
+-        // coeng Ro if they are present
++        // copy what is left to the output, skipping before vowels and coeng Ro if they are present
+         for (i = prev; i < syllable; i += 1) {
+             charClass = classTable->getCharClass(chars[i]);
+ 
+@@ -515,30 +486,14 @@
+                     // and there is an extra rule for C_VOWEL_AA + C_SIGN_NIKAHIT also for two
+                     // different positions, right after the shifter or after a vowel (Unicode 4)
+                     if ( (charClass & KhmerClassTable::CF_SHIFTER) && (i + 1 < syllable) ) {
+-                        if (classTable->getCharClass(chars[i + 1]) & KhmerClassTable::CF_ABOVE_VOWEL ) {
+-                            output.writeChar(chars[i], i, tagBlwf);
+-                            break;
+-                        }
+-                        if (i + 2 < syllable &&
+-                            ( (classTable->getCharClass(chars[i + 1]) &
+-                               KhmerClassTable::CF_CLASS_MASK) == C_VOWEL_AA) &&
+-                            ( (classTable->getCharClass(chars[i + 2]) &
+-                               KhmerClassTable::CF_CLASS_MASK) == C_SIGN_NIKAHIT) )
+-                        {
+-                            output.writeChar(chars[i], i, tagBlwf);
+-                            break;
+-                        }
+-                        if (i + 3 < syllable && (classTable->getCharClass(chars[i + 3]) &
+-                            KhmerClassTable::CF_ABOVE_VOWEL) )
+-                        {
+-                            output.writeChar(chars[i], i, tagBlwf);
+-                            break;
+-                        }
+-                        if (i + 4 < syllable &&
+-                            ( (classTable->getCharClass(chars[i + 3]) &
+-                               KhmerClassTable::CF_CLASS_MASK) == C_VOWEL_AA) &&
+-                            ( (classTable->getCharClass(chars[i + 4]) &
+-                               KhmerClassTable::CF_CLASS_MASK) == C_SIGN_NIKAHIT) )
++                        if ((classTable->getCharClass(chars[i + 1]) & KhmerClassTable::CF_ABOVE_VOWEL)
++                            || (i + 2 < syllable
++                                && ( (classTable->getCharClass(chars[i + 1]) & KhmerClassTable::CF_CLASS_MASK) == C_VOWEL_AA)
++                                && ( (classTable->getCharClass(chars[i + 2]) & KhmerClassTable::CF_CLASS_MASK) == C_SIGN_NIKAHIT))
++                            || (i + 3 < syllable && (classTable->getCharClass(chars[i + 3]) & KhmerClassTable::CF_ABOVE_VOWEL))
++                            || (i + 4 < syllable
++                                && ( (classTable->getCharClass(chars[i + 3]) & KhmerClassTable::CF_CLASS_MASK) == C_VOWEL_AA)
++                                && ( (classTable->getCharClass(chars[i + 4]) & KhmerClassTable::CF_CLASS_MASK) == C_SIGN_NIKAHIT) ) )
+                         {
+                             output.writeChar(chars[i], i, tagBlwf);
+                             break;
+@@ -556,3 +511,6 @@
+ 
+     return output.getOutputIndex();
+ }
++
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/KhmerReordering.h b/src/share/native/sun/font/layout/KhmerReordering.h
+--- jdk/src/share/native/sun/font/layout/KhmerReordering.h
++++ jdk/src/share/native/sun/font/layout/KhmerReordering.h
+@@ -24,7 +24,6 @@
+  */
+ 
+ /*
+- *
+  * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
+  *
+  * This file is a modification of the ICU file IndicReordering.h
+@@ -35,80 +34,60 @@
+ #ifndef __KHMERREORDERING_H
+ #define __KHMERREORDERING_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "OpenTypeTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ class LEGlyphStorage;
+ 
+ // Vocabulary
+-
+-// Base ->
+-//     A consonant or an independent vowel in its full (not
+-//     subscript) form. It is the center of the syllable, it can be
+-//     souranded by coeng (subscript) consonants, vowels, split
+-//     vowels, signs... but there is only one base in a syllable, it
+-//     has to be coded as the first character of the syllable.
+-// split vowel ->
+-//     vowel that has two parts placed separately (e.g. Before and
+-//     after the consonant).  Khmer language has five of them. Khmer
+-//     split vowels either have one part before the base and one after
+-//     the base or they have a part before the base and a part above
+-//     the base.  The first part of all Khmer split vowels is the same
+-//     character, identical to the glyph of Khmer dependent vowel SRA
+-//     EI
+-// coeng ->
+-//     modifier used in Khmer to construct coeng (subscript)
+-//     consonants differently than indian languages, the coeng
+-//     modifies the consonant that follows it, not the one preceding
+-//     it Each consonant has two forms, the base form and the
+-//     subscript form the base form is the normal one (using the
+-//     consonants code-point), the subscript form is displayed when
+-//     the combination coeng + consonant is encountered.
+-// Consonant of type 1 ->
+-//     A consonant which has subscript for that only occupies space
+-//     under a base consonant
+-// Consonant of type 2 ->
+-//     Its subscript form occupies space under and before the base
+-//     (only one, RO)
+-// Consonant of Type 3 ->
+-//     Its subscript form occupies space under and after the base
+-//     (KHO, CHHO, THHO, BA, YO, SA)
+-// Consonant shifter ->
+-//     Khmer has to series of consonants. The same dependent vowel has
+-//     different sounds if it is attached to a consonant of the first
+-//     series or a consonant of the second series Most consonants have
+-//     an equivalent in the other series, but some of theme exist only
+-//     in one series (for example SA). If we want to use the consonant
+-//     SA with a vowel sound that can only be done with a vowel sound
+-//     that corresponds to a vowel accompanying a consonant of the
+-//     other series, then we need to use a consonant shifter: TRIISAP
+-//     or MUSIKATOAN x17C9 y x17CA. TRIISAP changes a first series
+-//     consonant to second series sound and MUSIKATOAN a second series
+-//     consonant to have a first series vowel sound.  Consonant
+-//     shifter are both normally supercript marks, but, when they are
+-//     followed by a superscript, they change shape and take the form
+-//     of subscript dependent vowel SRA U.  If they are in the same
+-//     syllable as a coeng consonant, Unicode 3.0 says that they
+-//     should be typed before the coeng. Unicode 4.0 breaks the
+-//     standard and says that it should be placed after the coeng
+-//     consonant.
+-// Dependent vowel ->
+-//     In khmer dependent vowels can be placed above, below, before or
+-//     after the base Each vowel has its own position. Only one vowel
+-//     per syllable is allowed.
+-// Signs ->
+-//     Khmer has above signs and post signs. Only one above sign
+-//     and/or one post sign are Allowed in a syllable.
++//     Base ->         A consonant or an independent vowel in its full (not subscript) form. It is the
++//                     center of the syllable, it can be souranded by coeng (subscript) consonants, vowels,
++//                     split vowels, signs... but there is only one base in a syllable, it has to be coded as
++//                     the first character of the syllable.
++//     split vowel --> vowel that has two parts placed separately (e.g. Before and after the consonant).
++//                     Khmer language has five of them. Khmer split vowels either have one part before the
++//                     base and one after the base or they have a part before the base and a part above the base.
++//                     The first part of all Khmer split vowels is the same character, identical to
++//                     the glyph of Khmer dependent vowel SRA EI
++//     coeng -->  modifier used in Khmer to construct coeng (subscript) consonants
++//                Differently than indian languages, the coeng modifies the consonant that follows it,
++//                not the one preceding it  Each consonant has two forms, the base form and the subscript form
++//                the base form is the normal one (using the consonants code-point), the subscript form is
++//                displayed when the combination coeng + consonant is encountered.
++//     Consonant of type 1 -> A consonant which has subscript for that only occupies space under a base consonant
++//     Consonant of type 2.-> Its subscript form occupies space under and before the base (only one, RO)
++//     Consonant of Type 3 -> Its subscript form occupies space under and after the base (KHO, CHHO, THHO, BA, YO, SA)
++//     Consonant shifter -> Khmer has to series of consonants. The same dependent vowel has different sounds
++//                          if it is attached to a consonant of the first series or a consonant of the second series
++//                          Most consonants have an equivalent in the other series, but some of theme exist only in
++//                          one series (for example SA). If we want to use the consonant SA with a vowel sound that
++//                          can only be done with a vowel sound that corresponds to a vowel accompanying a consonant
++//                          of the other series, then we need to use a consonant shifter: TRIISAP or MUSIKATOAN
++//                          x17C9 y x17CA. TRIISAP changes a first series consonant to second series sound and
++//                          MUSIKATOAN a second series consonant to have a first series vowel sound.
++//                          Consonant shifter are both normally supercript marks, but, when they are followed by a
++//                          superscript, they change shape and take the form of subscript dependent vowel SRA U.
++//                          If they are in the same syllable as a coeng consonant, Unicode 3.0 says that they
++//                          should be typed before the coeng. Unicode 4.0 breaks the standard and says that it should
++//                          be placed after the coeng consonant.
++//     Dependent vowel ->   In khmer dependent vowels can be placed above, below, before or after the base
++//                          Each vowel has its own position. Only one vowel per syllable is allowed.
++//     Signs            ->  Khmer has above signs and post signs. Only one above sign and/or one post sign are
++//                          Allowed in a syllable.
++//
+ //
+ 
+-// This list must include all types of components that can be used
+-// inside a syllable
+-struct KhmerClassTable
++struct KhmerClassTable    // This list must include all types of components that can be used inside a syllable
+ {
+-    // order is important here! This order must be the same that is
+-    // found in each horizontal line in the statetable for Khmer (file
+-    // KhmerReordering.cpp).
+-    enum CharClassValues
++    enum CharClassValues  // order is important here! This order must be the same that is found in each horizontal
++                          // line in the statetable for Khmer (file KhmerReordering.cpp).
+     {
+         CC_RESERVED             =  0,
+         CC_CONSONANT            =  1, // consonant of type 1 or independent vowel
+@@ -116,8 +95,7 @@
+         CC_CONSONANT3           =  3, // Consonant of type 3
+         CC_ZERO_WIDTH_NJ_MARK   =  4, // Zero Width non joiner character (0x200C)
+         CC_CONSONANT_SHIFTER    =  5,
+-        CC_ROBAT                =  6, // Khmer special diacritic accent
+-                                      // -treated differently in state table
++        CC_ROBAT                =  6, // Khmer special diacritic accent -treated differently in state table
+         CC_COENG                =  7, // Subscript consonant combining character
+         CC_DEPENDENT_VOWEL      =  8,
+         CC_SIGN_ABOVE           =  9,
+@@ -131,10 +109,8 @@
+         CF_CLASS_MASK    = 0x0000FFFF,
+ 
+         CF_CONSONANT     = 0x01000000,  // flag to speed up comparing
+-        CF_SPLIT_VOWEL   = 0x02000000,  // flag for a split vowel -> the first part
+-                                        // is added in front of the syllable
+-        CF_DOTTED_CIRCLE = 0x04000000,  // add a dotted circle if a character with
+-                                        // this flag is the first in a syllable
++        CF_SPLIT_VOWEL   = 0x02000000,  // flag for a split vowel -> the first part is added in front of the syllable
++        CF_DOTTED_CIRCLE = 0x04000000,  // add a dotted circle if a character with this flag is the first in a syllable
+         CF_COENG         = 0x08000000,  // flag to speed up comparing
+         CF_SHIFTER       = 0x10000000,  // flag to speed up comparing
+         CF_ABOVE_VOWEL   = 0x20000000,  // flag to speed up comparing
+@@ -161,10 +137,10 @@
+ };
+ 
+ 
+-class KhmerReordering {
++class KhmerReordering /* not : public UObject because all methods are static */ {
+ public:
+-    static le_int32 reorder(const LEUnicode *theChars, le_int32 charCount,
+-        le_int32 scriptCode, LEUnicode *outChars, LEGlyphStorage &glyphStorage);
++    static le_int32 reorder(const LEUnicode *theChars, le_int32 charCount, le_int32 scriptCode,
++        LEUnicode *outChars, LEGlyphStorage &glyphStorage);
+ 
+     static const FeatureMap *getFeatureMap(le_int32 &count);
+ 
+@@ -172,8 +148,10 @@
+     // do not instantiate
+     KhmerReordering();
+ 
+-    static le_int32 findSyllable(const KhmerClassTable *classTable,
+-        const LEUnicode *chars, le_int32 prev, le_int32 charCount);
++    static le_int32 findSyllable(const KhmerClassTable *classTable, const LEUnicode *chars, le_int32 prev, le_int32 charCount);
++
+ };
+ 
++
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/LEFontInstance.cpp b/src/share/native/sun/font/layout/LEFontInstance.cpp
+--- jdk/src/share/native/sun/font/layout/LEFontInstance.cpp
++++ jdk/src/share/native/sun/font/layout/LEFontInstance.cpp
+@@ -24,7 +24,6 @@
+  */
+ 
+ /*
+- *
+  *******************************************************************************
+  *
+  *   Copyright (C) 1999-2005, International Business Machines
+@@ -42,6 +41,10 @@
+ #include "LEFontInstance.h"
+ #include "LEGlyphStorage.h"
+ 
++U_NAMESPACE_BEGIN
++
++UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LEFontInstance)
++
+ const LEFontInstance *LEFontInstance::getSubFont(const LEUnicode chars[], le_int32 *offset, le_int32 limit,
+                                                        le_int32 script, LEErrorCode &success) const
+ {
+@@ -59,7 +62,7 @@
+ }
+ 
+ void LEFontInstance::mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count,
+-    le_bool reverse, const LECharMapper *mapper, LEGlyphStorage &glyphStorage) const
++                                      le_bool reverse, const LECharMapper *mapper, LEGlyphStorage &glyphStorage) const
+ {
+     le_int32 i, out = 0, dir = 1;
+ 
+@@ -100,3 +103,5 @@
+ 
+     return mapCharToGlyph(mappedChar);
+ }
++U_NAMESPACE_END
++
+diff --git a/src/share/native/sun/font/layout/LEFontInstance.h b/src/share/native/sun/font/layout/LEFontInstance.h
+--- jdk/src/share/native/sun/font/layout/LEFontInstance.h
++++ jdk/src/share/native/sun/font/layout/LEFontInstance.h
+@@ -34,6 +34,12 @@
+ #define __LEFONTINSTANCE_H
+ 
+ #include "LETypes.h"
++/**
++ * \file
++ * \brief C++ API: Layout Engine Font Instance object
++ */
++
++U_NAMESPACE_BEGIN
+ 
+ /**
+  * Instances of this class are used by <code>LEFontInstance::mapCharsToGlyphs</code> and
+@@ -44,7 +50,7 @@
+  *
+  * @stable ICU 3.2
+  */
+-class LECharMapper
++class LECharMapper /* not : public UObject because this is an interface/mixin class */
+ {
+ public:
+     /**
+@@ -97,7 +103,7 @@
+  *
+  * @draft ICU 3.0
+  */
+-class LEFontInstance
++class U_LAYOUT_API LEFontInstance : public UObject
+ {
+ public:
+ 
+@@ -160,8 +166,7 @@
+      *
+      * @stable ICU 3.2
+      */
+-    virtual const LEFontInstance *getSubFont(const LEUnicode chars[], le_int32 *offset,
+-        le_int32 limit, le_int32 script, LEErrorCode &success) const;
++    virtual const LEFontInstance *getSubFont(const LEUnicode chars[], le_int32 *offset, le_int32 limit, le_int32 script, LEErrorCode &success) const;
+ 
+     //
+     // Font file access
+@@ -238,8 +243,7 @@
+      *
+      * @draft ICU 3.0
+      */
+-    virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count,
+-        le_bool reverse, const LECharMapper *mapper, LEGlyphStorage &glyphStorage) const;
++    virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, const LECharMapper *mapper, LEGlyphStorage &glyphStorage) const;
+ 
+     /**
+      * This method maps a single character to a glyph index, using the
+@@ -502,6 +506,21 @@
+      * @stable ICU 3.2
+      */
+     virtual le_int32 getLineHeight() const;
++
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for the actual class.
++     *
++     * @stable ICU 3.2
++     */
++    virtual UClassID getDynamicClassID() const;
++
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for this class.
++     *
++     * @stable ICU 3.2
++     */
++    static UClassID getStaticClassID();
++
+ };
+ 
+ inline le_bool LEFontInstance::canDisplay(LEUnicode32 ch) const
+@@ -562,4 +581,7 @@
+     return getAscent() + getDescent() + getLeading();
+ }
+ 
++U_NAMESPACE_END
+ #endif
++
++
+diff --git a/src/share/native/sun/font/layout/LEGlyphFilter.h b/src/share/native/sun/font/layout/LEGlyphFilter.h
+--- jdk/src/share/native/sun/font/layout/LEGlyphFilter.h
++++ jdk/src/share/native/sun/font/layout/LEGlyphFilter.h
+@@ -34,14 +34,15 @@
+ 
+ #include "LETypes.h"
+ 
++U_NAMESPACE_BEGIN
++
+ /**
+  * This is a helper class that is used to
+  * recognize a set of glyph indices.
+  *
+  * @internal
+  */
+-class LEGlyphFilter
+-{
++class LEGlyphFilter /* not : public UObject because this is an interface/mixin class */ {
+ public:
+     /**
+      * Destructor.
+@@ -63,4 +64,5 @@
+     virtual le_bool accept(LEGlyphID glyph) const = 0;
+ };
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/LEGlyphStorage.cpp b/src/share/native/sun/font/layout/LEGlyphStorage.cpp
+--- jdk/src/share/native/sun/font/layout/LEGlyphStorage.cpp
++++ jdk/src/share/native/sun/font/layout/LEGlyphStorage.cpp
+@@ -24,7 +24,6 @@
+  */
+ 
+ /*
+- *
+  **********************************************************************
+  *   Copyright (C) 1998-2005, International Business Machines
+  *   Corporation and others.  All Rights Reserved.
+@@ -35,6 +34,10 @@
+ #include "LEInsertionList.h"
+ #include "LEGlyphStorage.h"
+ 
++U_NAMESPACE_BEGIN
++
++UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LEGlyphStorage)
++
+ LEGlyphStorage::LEGlyphStorage()
+     : fGlyphCount(0), fGlyphs(NULL), fCharIndices(NULL), fPositions(NULL),
+       fAuxData(NULL), fInsertionList(NULL), fSrcIndex(0), fDestIndex(0)
+@@ -603,3 +606,6 @@
+ 
+     return FALSE;
+ }
++
++U_NAMESPACE_END
++
+diff --git a/src/share/native/sun/font/layout/LEGlyphStorage.h b/src/share/native/sun/font/layout/LEGlyphStorage.h
+--- jdk/src/share/native/sun/font/layout/LEGlyphStorage.h
++++ jdk/src/share/native/sun/font/layout/LEGlyphStorage.h
+@@ -24,7 +24,6 @@
+  */
+ 
+ /*
+- *
+  **********************************************************************
+  *   Copyright (C) 1998-2005, International Business Machines
+  *   Corporation and others.  All Rights Reserved.
+@@ -38,6 +37,13 @@
+ #include "LEInsertionList.h"
+ 
+ /**
++ * \file
++ * \brief C++ API: This class encapsulates the per-glyph storage used by the ICU LayoutEngine.
++ */
++
++U_NAMESPACE_BEGIN
++
++/**
+  * This class encapsulates the per-glyph storage used by the ICU LayoutEngine.
+  * For each glyph it holds the glyph ID, the index of the backing store character
+  * which produced the glyph, the X and Y position of the glyph and an auxillary data
+@@ -50,7 +56,7 @@
+  *
+  * @draft ICU 3.6
+  */
+-class U_LAYOUT_API LEGlyphStorage : protected LEInsertionCallback
++class U_LAYOUT_API LEGlyphStorage : public UObject, protected LEInsertionCallback
+ {
+ private:
+     /**
+@@ -112,35 +118,37 @@
+ 
+ protected:
+     /**
+-     * This implements <code>LEInsertionCallback</code>. The
+-     * <code>LEInsertionList</code> will call this method once for
+-     * each insertion.
++     * This implements <code>LEInsertionCallback</code>. The <code>LEInsertionList</code>
++     * will call this method once for each insertion.
+      *
+      * @param atPosition the position of the insertion
+      * @param count the number of glyphs being inserted
+      * @param newGlyphs the address of the new glyph IDs
+      *
+-     * @return <code>true</code> if <code>LEInsertionList</code>
+-     * should stop processing the insertion list after this insertion.
++     * @return <code>true</code> if <code>LEInsertionList</code> should stop
++     *         processing the insertion list after this insertion.
+      *
+      * @see LEInsertionList.h
+      *
+      * @draft ICU 3.0
+      */
+-    virtual le_bool applyInsertion(le_int32 atPosition, le_int32 count,
+-        LEGlyphID newGlyphs[]);
++    virtual le_bool applyInsertion(le_int32 atPosition, le_int32 count, LEGlyphID newGlyphs[]);
+ 
+ public:
+ 
+     /**
+-     * Allocates an empty <code>LEGlyphStorage</code> object. You must
+-     * call <code>allocateGlyphArray, allocatePositions and
+-     * allocateAuxData</code> to allocate the data.
++     * Allocates an empty <code>LEGlyphStorage</code> object. You must call
++     * <code>allocateGlyphArray, allocatePositions and allocateAuxData</code>
++     * to allocate the data.
++     *
++     * @draft ICU 3.0
+      */
+     LEGlyphStorage();
+ 
+     /**
+      * The destructor. This will deallocate all of the arrays.
++     *
++     * @draft ICU 3.0
+      */
+     ~LEGlyphStorage();
+ 
+@@ -154,9 +162,9 @@
+     inline le_int32 getGlyphCount() const;
+ 
+     /**
+-     * This method copies the glyph array into a caller supplied
+-     * array.  The caller must ensure that the array is large enough
+-     * to hold all the glyphs.
++     * This method copies the glyph array into a caller supplied array.
++     * The caller must ensure that the array is large enough to hold all
++     * the glyphs.
+      *
+      * @param glyphs - the destiniation glyph array
+      * @param success - set to an error code if the operation fails
+@@ -166,10 +174,10 @@
+     void getGlyphs(LEGlyphID glyphs[], LEErrorCode &success) const;
+ 
+     /**
+-     * This method copies the glyph array into a caller supplied
+-     * array, ORing in extra bits. (This functionality is needed by
+-     * the JDK, which uses 32 bits pre glyph idex, with the high 16
+-     * bits encoding the composite font slot number)
++     * This method copies the glyph array into a caller supplied array,
++     * ORing in extra bits. (This functionality is needed by the JDK,
++     * which uses 32 bits pre glyph idex, with the high 16 bits encoding
++     * the composite font slot number)
+      *
+      * @param glyphs - the destination (32 bit) glyph array
+      * @param extraBits - this value will be ORed with each glyph index
+@@ -177,13 +185,12 @@
+      *
+      * @draft ICU 3.0
+      */
+-    void getGlyphs(le_uint32 glyphs[], le_uint32 extraBits,
+-        LEErrorCode &success) const;
++    void getGlyphs(le_uint32 glyphs[], le_uint32 extraBits, LEErrorCode &success) const;
+ 
+     /**
+-     * This method copies the character index array into a caller
+-     * supplied array.  The caller must ensure that the array is large
+-     * enough to hold a character index for each glyph.
++     * This method copies the character index array into a caller supplied array.
++     * The caller must ensure that the array is large enough to hold a
++     * character index for each glyph.
+      *
+      * @param charIndices - the destiniation character index array
+      * @param success - set to an error code if the operation fails
+@@ -193,9 +200,9 @@
+     void getCharIndices(le_int32 charIndices[], LEErrorCode &success) const;
+ 
+     /**
+-     * This method copies the character index array into a caller
+-     * supplied array.  The caller must ensure that the array is large
+-     * enough to hold a character index for each glyph.
++     * This method copies the character index array into a caller supplied array.
++     * The caller must ensure that the array is large enough to hold a
++     * character index for each glyph.
+      *
+      * @param charIndices - the destiniation character index array
+      * @param indexBase - an offset which will be added to each index
+@@ -203,14 +210,13 @@
+      *
+      * @draft ICU 3.0
+      */
+-    void getCharIndices(le_int32 charIndices[], le_int32 indexBase,
+-        LEErrorCode &success) const;
++    void getCharIndices(le_int32 charIndices[], le_int32 indexBase, LEErrorCode &success) const;
+ 
+     /**
+-     * This method copies the position array into a caller supplied
+-     * array.  The caller must ensure that the array is large enough
+-     * to hold an X and Y position for each glyph, plus an extra X and
+-     * Y for the advance of the last glyph.
++     * This method copies the position array into a caller supplied array.
++     * The caller must ensure that the array is large enough to hold an
++     * X and Y position for each glyph, plus an extra X and Y for the
++     * advance of the last glyph.
+      *
+      * @param positions - the destiniation position array
+      * @param success - set to an error code if the operation fails
+@@ -233,33 +239,27 @@
+      *
+      * @draft ICU 3.0
+      */
+-    void getGlyphPosition(le_int32 glyphIndex, float &x, float &y,
+-        LEErrorCode &success) const;
++    void getGlyphPosition(le_int32 glyphIndex, float &x, float &y, LEErrorCode &success) const;
+ 
+     /**
+-     * This method allocates the glyph array, the char indices array
+-     * and the insertion list. You must call this method before using
+-     * the object. This method also initializes the char indices
++     * This method allocates the glyph array, the char indices array and the insertion list. You
++     * must call this method before using the object. This method also initializes the char indices
+      * array.
+-     * @param initialGlyphCount the initial size of the glyph and char
+-     *     indices arrays.
+-     * @param rightToLeft <code>true</code> if the original input text
+-     *     is right to left.
+-     * @param success set to an error code if the storage cannot be
+-     *     allocated of if the initial glyph count is not positive.
++     *
++     * @param initialGlyphCount the initial size of the glyph and char indices arrays.
++     * @param rightToLeft <code>true</code> if the original input text is right to left.
++     * @param success set to an error code if the storage cannot be allocated of if the initial
++     *        glyph count is not positive.
+      *
+      * @draft ICU 3.0
+      */
+-    void allocateGlyphArray(le_int32 initialGlyphCount, le_bool rightToLeft,
+-        LEErrorCode &success);
++    void allocateGlyphArray(le_int32 initialGlyphCount, le_bool rightToLeft, LEErrorCode &success);
+ 
+     /**
+-     * This method allocates the storage for the glyph positions. It
+-     * allocates one extra X, Y position pair for the position just
+-     * after the last glyph.
++     * This method allocates the storage for the glyph positions. It allocates one extra X, Y
++     * position pair for the position just after the last glyph.
+      *
+-     * @param success set to an error code if the positions array
+-     *     cannot be allocated.
++     * @param success set to an error code if the positions array cannot be allocated.
+      *
+      * @return the number of X, Y position pairs allocated.
+      *
+@@ -270,8 +270,7 @@
+     /**
+      * This method allocates the storage for the auxillary glyph data.
+      *
+-     * @param success set to an error code if the aulillary data array
+-     *     cannot be allocated.
++     * @param success set to an error code if the aulillary data array cannot be allocated.
+      *
+      * @return the size of the auxillary data array.
+      *
+@@ -282,10 +281,8 @@
+     /**
+      * Copy the entire auxillary data array.
+      *
+-     * @param auxData the auxillary data array will be copied to this
+-     *     address
+-     * @param success set to an error code if the data cannot be
+-     *     copied
++     * @param auxData the auxillary data array will be copied to this address
++     * @param success set to an error code if the data cannot be copied
+      *
+      * @draft ICU 3.6
+      */
+@@ -295,8 +292,7 @@
+      * Get the glyph ID for a particular glyph.
+      *
+      * @param glyphIndex the index into the glyph array
+-     * @param success set to an error code if the glyph ID cannot be
+-     *     retrieved.
++     * @param success set to an error code if the glyph ID cannot be retrieved.
+      *
+      * @return the glyph ID
+      *
+@@ -308,8 +304,7 @@
+      * Get the char index for a particular glyph.
+      *
+      * @param glyphIndex the index into the glyph array
+-     * @param success set to an error code if the char index cannot be
+-     *     retrieved.
++     * @param success set to an error code if the char index cannot be retrieved.
+      *
+      * @return the character index
+      *
+@@ -322,8 +317,7 @@
+      * Get the auxillary data for a particular glyph.
+      *
+      * @param glyphIndex the index into the glyph array
+-     * @param success set to an error code if the auxillary data
+-     *     cannot be retrieved.
++     * @param success set to an error code if the auxillary data cannot be retrieved.
+      *
+      * @return the auxillary data
+      *
+@@ -345,11 +339,10 @@
+ 
+     /**
+      * Call this method to replace a single glyph in the glyph array
+-     * with multiple glyphs. This method uses the
+-     * <code>LEInsertionList</code> to do the insertion. It returns
+-     * the address of storage where the new glyph IDs can be
+-     * stored. They will not actually be inserted into the glyph array
+-     * until <code>applyInsertions</code> is called.
++     * with multiple glyphs. This method uses the <code>LEInsertionList</code>
++     * to do the insertion. It returns the address of storage where the new
++     * glyph IDs can be stored. They will not actually be inserted into the
++     * glyph array until <code>applyInsertions</code> is called.
+      *
+      * @param atIndex the index of the glyph to be replaced
+      * @param insertCount the number of glyphs to replace it with
+@@ -381,26 +374,22 @@
+      *
+      * @param glyphIndex the index of the glyph
+      * @param glyphID the new glyph ID
+-     * @param success will be set to an error code if the glyph ID
+-     *     cannot be set.
++     * @param success will be set to an error code if the glyph ID cannot be set.
+      *
+      * @draft ICU 3.0
+      */
+-    void setGlyphID(le_int32 glyphIndex, LEGlyphID glyphID,
+-        LEErrorCode &success);
++    void setGlyphID(le_int32 glyphIndex, LEGlyphID glyphID, LEErrorCode &success);
+ 
+     /**
+      * Set the char index for a particular glyph.
+      *
+      * @param glyphIndex the index of the glyph
+      * @param charIndex the new char index
+-     * @param success will be set to an error code if the char index
+-     *     cannot be set.
++     * @param success will be set to an error code if the char index cannot be set.
+      *
+      * @draft ICU 3.0
+      */
+-    void setCharIndex(le_int32 glyphIndex, le_int32 charIndex,
+-        LEErrorCode &success);
++    void setCharIndex(le_int32 glyphIndex, le_int32 charIndex, LEErrorCode &success);
+ 
+     /**
+      * Set the X, Y position for a particular glyph.
+@@ -408,13 +397,11 @@
+      * @param glyphIndex the index of the glyph
+      * @param x the new X position
+      * @param y the new Y position
+-     * @param success will be set to an error code if the position
+-     *     cannot be set.
++     * @param success will be set to an error code if the position cannot be set.
+      *
+      * @draft ICU 3.0
+      */
+-    void setPosition(le_int32 glyphIndex, float x, float y,
+-        LEErrorCode &success);
++    void setPosition(le_int32 glyphIndex, float x, float y, LEErrorCode &success);
+ 
+     /**
+      * Adjust the X, Y position for a particular glyph.
+@@ -422,21 +409,18 @@
+      * @param glyphIndex the index of the glyph
+      * @param xAdjust the adjustment to the glyph's X position
+      * @param yAdjust the adjustment to the glyph's Y position
+-     * @param success will be set to an error code if the glyph's
+-     *     position cannot be adjusted.
++     * @param success will be set to an error code if the glyph's position cannot be adjusted.
+      *
+      * @draft ICU 3.0
+      */
+-    void adjustPosition(le_int32 glyphIndex, float xAdjust, float yAdjust,
+-        LEErrorCode &success);
++    void adjustPosition(le_int32 glyphIndex, float xAdjust, float yAdjust, LEErrorCode &success);
+ 
+     /**
+      * Set the auxillary data for a particular glyph.
+      *
+      * @param glyphIndex the index of the glyph
+      * @param auxData the new auxillary data
+-     * @param success will be set to an error code if the auxillary
+-     *     data cannot be set.
++     * @param success will be set to an error code if the auxillary data cannot be set.
+      *
+      * @draft ICU 3.6
+      */
+@@ -511,14 +495,28 @@
+     void adoptGlyphCount(le_int32 newGlyphCount);
+ 
+     /**
+-     * This method frees the glyph, character index, position and
+-     * auxillary data arrays so that the LayoutEngine can be reused to
+-     * layout a different characer array. (This method is also called
++     * This method frees the glyph, character index, position  and
++     * auxillary data arrays so that the LayoutEngine can be reused
++     * to layout a different characer array. (This method is also called
+      * by the destructor)
+      *
+      * @draft ICU 3.0
+      */
+     void reset();
++
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for the actual class.
++     *
++     * @draft ICU 3.0
++     */
++    virtual UClassID getDynamicClassID() const;
++
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for this class.
++     *
++     * @draft ICU 3.0
++     */
++    static UClassID getStaticClassID();
+ };
+ 
+ inline le_int32 LEGlyphStorage::getGlyphCount() const
+@@ -531,4 +529,7 @@
+     return fGlyphs[glyphIndex];
+ }
+ 
++
++U_NAMESPACE_END
+ #endif
++
+diff --git a/src/share/native/sun/font/layout/LEInsertionList.cpp b/src/share/native/sun/font/layout/LEInsertionList.cpp
+--- jdk/src/share/native/sun/font/layout/LEInsertionList.cpp
++++ jdk/src/share/native/sun/font/layout/LEInsertionList.cpp
+@@ -24,7 +24,6 @@
+  */
+ 
+ /*
+- *
+  **********************************************************************
+  *   Copyright (C) 1998-2004, International Business Machines
+  *   Corporation and others.  All Rights Reserved.
+@@ -34,6 +33,8 @@
+ #include "LETypes.h"
+ #include "LEInsertionList.h"
+ 
++U_NAMESPACE_BEGIN
++
+ #define ANY_NUMBER 1
+ 
+ struct InsertionRecord
+@@ -44,6 +45,8 @@
+     LEGlyphID glyphs[ANY_NUMBER];
+ };
+ 
++UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LEInsertionList)
++
+ LEInsertionList::LEInsertionList(le_bool rightToLeft)
+ : head(NULL), tail(NULL), growAmount(0), append(rightToLeft)
+ {
+@@ -106,3 +109,5 @@
+ 
+     return FALSE;
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/LEInsertionList.h b/src/share/native/sun/font/layout/LEInsertionList.h
+--- jdk/src/share/native/sun/font/layout/LEInsertionList.h
++++ jdk/src/share/native/sun/font/layout/LEInsertionList.h
+@@ -24,7 +24,6 @@
+  */
+ 
+ /*
+- *
+  **********************************************************************
+  *   Copyright (C) 1998-2004, International Business Machines
+  *   Corporation and others.  All Rights Reserved.
+@@ -36,6 +35,8 @@
+ 
+ #include "LETypes.h"
+ 
++U_NAMESPACE_BEGIN
++
+ struct InsertionRecord;
+ 
+ /**
+@@ -78,7 +79,7 @@
+  *
+  * @internal
+  */
+-class LEInsertionList
++class LEInsertionList : public UObject
+ {
+ public:
+     /**
+@@ -140,6 +141,20 @@
+      */
+     void reset();
+ 
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for the actual class.
++     *
++     * @stable ICU 2.8
++     */
++    virtual UClassID getDynamicClassID() const;
++
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for this class.
++     *
++     * @stable ICU 2.8
++     */
++    static UClassID getStaticClassID();
++
+ private:
+ 
+     /**
+@@ -174,4 +189,6 @@
+     le_bool  append;
+ };
+ 
++U_NAMESPACE_END
+ #endif
++
+diff --git a/src/share/native/sun/font/layout/LELanguages.h b/src/share/native/sun/font/layout/LELanguages.h
+--- jdk/src/share/native/sun/font/layout/LELanguages.h
++++ jdk/src/share/native/sun/font/layout/LELanguages.h
+@@ -25,10 +25,12 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 1998-2004. All Rights Reserved.
++ * (C) Copyright IBM Corp. 1998-2005. All Rights Reserved.
+  *
+  * WARNING: THIS FILE IS MACHINE GENERATED. DO NOT HAND EDIT IT UNLESS
+  * YOU REALLY KNOW WHAT YOU'RE DOING.
++ *
++ * Generated on: 07/19/2005 01:01:08 PM PDT
+  */
+ 
+ #ifndef __LELANGUAGES_H
+@@ -37,11 +39,18 @@
+ #include "LETypes.h"
+ 
+ /**
++ * \file
++ * \brief C++ API: List of language codes for LayoutEngine
++ */
++
++U_NAMESPACE_BEGIN
++
++/**
+  * A provisional list of language codes. For now,
+  * this is just a list of languages which the LayoutEngine
+  * supports.
+  *
+- * @draft ICU 3.0
++ * @draft ICU 3.4
+  */
+ 
+ enum LanguageCodes {
+@@ -79,4 +88,5 @@
+     languageCodeCount = 30
+ };
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/LEScripts.h b/src/share/native/sun/font/layout/LEScripts.h
+--- jdk/src/share/native/sun/font/layout/LEScripts.h
++++ jdk/src/share/native/sun/font/layout/LEScripts.h
+@@ -25,17 +25,23 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 1998-2004. All Rights Reserved.
++ * (C) Copyright IBM Corp. 1998-2005. All Rights Reserved.
+  *
+  * WARNING: THIS FILE IS MACHINE GENERATED. DO NOT HAND EDIT IT UNLESS
+  * YOU REALLY KNOW WHAT YOU'RE DOING.
+- *
+  */
+ 
+ #ifndef __LESCRIPTS_H
+ #define __LESCRIPTS_H
+ 
+ #include "LETypes.h"
++/**
++ * \file
++ * \brief C++ API: Constants for Unicode script values
++ */
++
++
++U_NAMESPACE_BEGIN
+ 
+ /**
+  * Constants for Unicode script values, generated using
+@@ -104,4 +110,5 @@
+     scriptCodeCount = 55
+ };
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/LEStandalone.h b/src/share/native/sun/font/layout/LEStandalone.h
+new file mode 100644
+--- /dev/null
++++ jdk/src/share/native/sun/font/layout/LEStandalone.h
+@@ -0,0 +1,132 @@
++/*
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute 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.
++ *
++ */
++
++#ifndef __LESTANDALONE
++#define __LESTANDALONE
++
++/* Definitions to make Layout Engine work away from ICU. */
++#ifndef U_NAMESPACE_BEGIN
++#define U_NAMESPACE_BEGIN
++#endif
++
++#ifndef U_NAMESPACE_END
++#define U_NAMESPACE_END
++#endif
++
++/* RTTI Definition */
++typedef const char *UClassID;
++#ifndef UOBJECT_DEFINE_RTTI_IMPLEMENTATION
++#define UOBJECT_DEFINE_RTTI_IMPLEMENTATION(x) UClassID x::getStaticClassID(){static char z=0; return (UClassID)&z; } UClassID x::getDynamicClassID() const{return x::getStaticClassID(); }
++#endif
++
++/* UMemory's functions aren't used by the layout engine. */
++struct UMemory {};
++/* UObject's functions aren't used by the layout engine. */
++struct UObject {};
++
++/* String handling */
++#include <stdlib.h>
++#include <string.h>
++
++/**
++ * A convenience macro to test for the success of a LayoutEngine call.
++ *
++ * @stable ICU 2.4
++ */
++#define LE_SUCCESS(code) ((code)<=LE_NO_ERROR)
++
++/**
++ * A convenience macro to test for the failure of a LayoutEngine call.
++ *
++ * @stable ICU 2.4
++ */
++#define LE_FAILURE(code) ((code)>LE_NO_ERROR)
++
++
++#ifndef _LP64
++typedef long le_int32;
++typedef unsigned long le_uint32;
++#else
++typedef int le_int32;
++typedef unsigned int le_uint32;
++#endif
++
++#define HAVE_LE_INT32 1
++#define HAVE_LE_UINT32 1
++
++typedef unsigned short UChar;
++typedef le_uint32 UChar32;
++
++typedef short le_int16;
++#define HAVE_LE_INT16 1
++
++typedef unsigned short le_uint16;
++#define HAVE_LE_UINT16
++
++typedef signed char le_int8;
++#define HAVE_LE_INT8
++
++typedef unsigned char le_uint8;
++#define HAVE_LE_UINT8
++
++typedef char UBool;
++
++/**
++ * Error codes returned by the LayoutEngine.
++ *
++ * @stable ICU 2.4
++ */
++enum LEErrorCode {
++    /* informational */
++    LE_NO_SUBFONT_WARNING           = -127, // U_USING_DEFAULT_WARNING,
++
++    /* success */
++    LE_NO_ERROR                     = 0, // U_ZERO_ERROR,
++
++    /* failures */
++    LE_ILLEGAL_ARGUMENT_ERROR       = 1, // U_ILLEGAL_ARGUMENT_ERROR,
++    LE_MEMORY_ALLOCATION_ERROR      = 7, // U_MEMORY_ALLOCATION_ERROR,
++    LE_INDEX_OUT_OF_BOUNDS_ERROR    = 8, //U_INDEX_OUTOFBOUNDS_ERROR,
++    LE_NO_LAYOUT_ERROR              = 16, // U_UNSUPPORTED_ERROR,
++    LE_INTERNAL_ERROR               = 5, // U_INTERNAL_PROGRAM_ERROR,
++    LE_FONT_FILE_NOT_FOUND_ERROR    = 4, // U_FILE_ACCESS_ERROR,
++    LE_MISSING_FONT_TABLE_ERROR     = 2  // U_MISSING_RESOURCE_ERROR
++};
++#define HAVE_LEERRORCODE
++
++#define U_LAYOUT_API
++
++#define uprv_malloc malloc
++#define uprv_free free
++#define uprv_memcpy memcpy
++#define uprv_realloc realloc
++
++#if !defined(U_IS_BIG_ENDIAN)
++    #ifdef _LITTLE_ENDIAN
++        #define U_IS_BIG_ENDIAN 0
++    #endif
++#endif
++
++#endif
+diff --git a/src/share/native/sun/font/layout/LESwaps.h b/src/share/native/sun/font/layout/LESwaps.h
+--- jdk/src/share/native/sun/font/layout/LESwaps.h
++++ jdk/src/share/native/sun/font/layout/LESwaps.h
+@@ -26,7 +26,7 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved
++ * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
+  *
+  */
+ 
+@@ -35,11 +35,12 @@
+ 
+ #include "LETypes.h"
+ 
+-#if !defined(U_IS_BIG_ENDIAN)
+-    #ifdef _LITTLE_ENDIAN
+-        #define U_IS_BIG_ENDIAN 0
+-    #endif
+-#endif
++/**
++ * \file
++ * \brief C++ API: Endian independent access to data for LayoutEngine
++ */
++
++U_NAMESPACE_BEGIN
+ 
+ /**
+  * A convenience macro which invokes the swapWord member function
+@@ -47,7 +48,6 @@
+  *
+  * @stable ICU 2.8
+  */
+-
+ #if defined(U_IS_BIG_ENDIAN)
+     #if U_IS_BIG_ENDIAN
+         #define SWAPW(value) (value)
+@@ -64,7 +64,6 @@
+  *
+  * @stable ICU 2.8
+  */
+-
+ #if defined(U_IS_BIG_ENDIAN)
+     #if U_IS_BIG_ENDIAN
+         #define SWAPL(value) (value)
+@@ -86,8 +85,7 @@
+  *
+  * @stable ICU 2.8
+  */
+-class LESwaps
+-{
++class U_LAYOUT_API LESwaps /* not : public UObject because all methods are static */ {
+ public:
+ 
+ #if !defined(U_IS_BIG_ENDIAN)
+@@ -144,4 +142,5 @@
+     LESwaps() {} // private - forbid instantiation
+ };
+ 
++U_NAMESPACE_END
+ #endif
+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
+@@ -23,7 +23,6 @@
+  *
+  */
+ 
+-
+ /*
+  *
+  * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
+@@ -33,73 +32,97 @@
+ #ifndef __LETYPES_H
+ #define __LETYPES_H
+ 
++/**
++ * If LE_Standalone is defined, it must exist and contain
++ * definitions for some core ICU defines.
++ */
++#ifdef LE_STANDALONE
++#include "LEStandalone.h"
++#endif
++
++#ifdef LE_STANDALONE
++/* Stand-alone Layout Engine- without ICU. */
++#include "LEStandalone.h"
+ #define LE_USE_CMEMORY
++#else
++#if !defined(LE_USE_CMEMORY) && (defined(U_LAYOUT_IMPLEMENTATION) || defined(U_LAYOUTEX_IMPLEMENTATION) || defined(U_STATIC_IMPLEMENTATION) || defined(U_COMBINED_IMPLEMENTATION))
++#define LE_USE_CMEMORY
++#endif
+ 
++#include "unicode/utypes.h"
++#include "unicode/uobject.h"
+ #ifdef LE_USE_CMEMORY
+ #include "cmemory.h"
+ #endif
++#endif /* not standalone */
+ 
+-#ifndef _LP64
+-typedef long le_int32;
+-typedef unsigned long le_uint32;
+-#else
+-typedef int le_int32;
+-typedef unsigned int le_uint32;
+-#endif
++U_NAMESPACE_BEGIN
+ 
+-typedef short le_int16;
+-typedef unsigned short le_uint16;
+-typedef signed char le_int8;
+-typedef unsigned char le_uint8;
+-typedef char le_bool;
++/*!
++ * \file
++ * \brief Basic definitions for the ICU LayoutEngine
++ */
+ 
+-typedef char UClassID;
+-
+-#if 0
+ /**
+  * A type used for signed, 32-bit integers.
+  *
+  * @stable ICU 2.4
+  */
++#ifndef HAVE_LE_INT32
+ typedef int32_t le_int32;
++#endif
+ 
+ /**
+  * A type used for unsigned, 32-bit integers.
+  *
+  * @stable ICU 2.4
+  */
++#ifndef HAVE_LE_UINT32
+ typedef uint32_t le_uint32;
++#endif
+ 
+ /**
+  * A type used for signed, 16-bit integers.
+  *
+  * @stable ICU 2.4
+  */
++#ifndef HAVE_LE_INT16
+ typedef int16_t le_int16;
++#endif
+ 
++#ifndef HAVE_LE_UINT16
+ /**
+  * A type used for unsigned, 16-bit integers.
+  *
+  * @stable ICU 2.4
+  */
+ typedef uint16_t le_uint16;
++#endif
+ 
++#ifndef HAVE_LE_INT8
+ /**
+  * A type used for signed, 8-bit integers.
+  *
+  * @stable ICU 2.4
+  */
+ typedef int8_t le_int8;
+-
++#endif
++ 
++#ifndef HAVE_LE_UINT8
+ /**
+  * A type used for unsigned, 8-bit integers.
+  *
+  * @stable ICU 2.4
+  */
+ typedef uint8_t le_uint8;
++#endif
+ 
+-typedef char le_bool;
+-#endif
++/**
++* A type used for boolean values.
++*
++* @stable ICU 2.4
++*/
++typedef UBool le_bool;
+ 
+ #ifndef TRUE
+ /**
+@@ -292,21 +315,21 @@
+  *
+  * @stable ICU 2.4
+  */
+-typedef le_uint16 LEUnicode16;
++typedef UChar LEUnicode16;
+ 
+ /**
+  * Used to represent 32-bit Unicode code points.
+  *
+  * @stable ICU 2.4
+  */
+-typedef le_uint32 LEUnicode32;
++typedef UChar32 LEUnicode32;
+ 
+ /**
+  * Used to represent 16-bit Unicode code points.
+  *
+  * @deprecated since ICU 2.4. Use LEUnicode16 instead
+  */
+-typedef le_uint16 LEUnicode;
++typedef UChar LEUnicode;
+ 
+ /**
+  * Used to hold a pair of (x, y) values which represent a point.
+@@ -353,7 +376,7 @@
+  *
+  * @internal
+  */
+-#define LE_ARRAY_COPY(dst, src, count) memcpy((void *) (dst), (void *) (src), (count) * sizeof (src)[0])
++#define LE_ARRAY_COPY(dst, src, count) uprv_memcpy((void *) (dst), (void *) (src), (count) * sizeof (src)[0])
+ 
+ /**
+  * Allocate an array of basic types. This is used to isolate the rest of
+@@ -361,7 +384,7 @@
+  *
+  * @internal
+  */
+-#define LE_NEW_ARRAY(type, count) (type *) malloc((count) * sizeof(type))
++#define LE_NEW_ARRAY(type, count) (type *) uprv_malloc((count) * sizeof(type))
+ 
+ /**
+  * Re-allocate an array of basic types. This is used to isolate the rest of
+@@ -369,7 +392,7 @@
+  *
+  * @internal
+  */
+-#define LE_GROW_ARRAY(array, newSize) realloc((void *) (array), (newSize) * sizeof (array)[0])
++#define LE_GROW_ARRAY(array, newSize) uprv_realloc((void *) (array), (newSize) * sizeof (array)[0])
+ 
+  /**
+  * Free an array of basic types. This is used to isolate the rest of
+@@ -377,7 +400,7 @@
+  *
+  * @internal
+  */
+-#define LE_DELETE_ARRAY(array) free((void *) (array))
++#define LE_DELETE_ARRAY(array) uprv_free((void *) (array))
+ #endif
+ 
+ /**
+@@ -595,22 +618,24 @@
+  *
+  * @stable ICU 2.4
+  */
++#ifndef HAVE_LEERRORCODE
+ enum LEErrorCode {
+     /* informational */
+-    LE_NO_SUBFONT_WARNING           = -127, // U_USING_DEFAULT_WARNING,
++    LE_NO_SUBFONT_WARNING          = U_USING_DEFAULT_WARNING, /**< The font does not contain subfonts. */
+ 
+     /* success */
+-    LE_NO_ERROR                     = 0, // U_ZERO_ERROR,
++    LE_NO_ERROR                     = U_ZERO_ERROR, /**< No error, no warning. */
+ 
+     /* failures */
+-    LE_ILLEGAL_ARGUMENT_ERROR       = 1, // U_ILLEGAL_ARGUMENT_ERROR,
+-    LE_MEMORY_ALLOCATION_ERROR      = 7, // U_MEMORY_ALLOCATION_ERROR,
+-    LE_INDEX_OUT_OF_BOUNDS_ERROR    = 8, //U_INDEX_OUTOFBOUNDS_ERROR,
+-    LE_NO_LAYOUT_ERROR              = 16, // U_UNSUPPORTED_ERROR,
+-    LE_INTERNAL_ERROR               = 5, // U_INTERNAL_PROGRAM_ERROR,
+-    LE_FONT_FILE_NOT_FOUND_ERROR    = 4, // U_FILE_ACCESS_ERROR,
+-    LE_MISSING_FONT_TABLE_ERROR     = 2  // U_MISSING_RESOURCE_ERROR
++    LE_ILLEGAL_ARGUMENT_ERROR       = U_ILLEGAL_ARGUMENT_ERROR,  /**< An illegal argument was detected. */
++    LE_MEMORY_ALLOCATION_ERROR      = U_MEMORY_ALLOCATION_ERROR, /**< Memory allocation error. */
++    LE_INDEX_OUT_OF_BOUNDS_ERROR    = U_INDEX_OUTOFBOUNDS_ERROR, /**< Trying to access an index that is out of bounds. */
++    LE_NO_LAYOUT_ERROR              = U_UNSUPPORTED_ERROR,       /**< You must call layoutChars() first. */
++    LE_INTERNAL_ERROR               = U_INTERNAL_PROGRAM_ERROR,  /**< An internal error was encountered. */
++    LE_FONT_FILE_NOT_FOUND_ERROR    = U_FILE_ACCESS_ERROR,       /**< The requested font file cannot be opened. */
++    LE_MISSING_FONT_TABLE_ERROR     = U_MISSING_RESOURCE_ERROR   /**< The requested font table does not exist. */
+ };
++#endif
+ 
+ #ifndef XP_CPLUSPLUS
+ /**
+@@ -626,7 +651,9 @@
+  *
+  * @stable ICU 2.4
+  */
+-#define LE_SUCCESS(code) ((code)<=LE_NO_ERROR)
++#ifndef LE_FAILURE
++#define LE_SUCCESS(code) (U_SUCCESS((UErrorCode)code))
++#endif
+ 
+ enum LEFeatureENUMs {
+  LE_Kerning_FEATURE_ENUM = 0,
+@@ -648,7 +675,11 @@
+  *
+  * @stable ICU 2.4
+  */
+-#define LE_FAILURE(code) ((code)>LE_NO_ERROR)
++#ifndef LE_FAILURE
++#define LE_FAILURE(code) (U_FAILURE((UErrorCode)code))
++#endif
+ 
+-#define U_LAYOUT_API
++U_NAMESPACE_END
+ #endif
++
++
+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
+@@ -23,6 +23,7 @@
+  *
+  */
+ 
++
+ /*
+  *
+  * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
+@@ -41,6 +42,7 @@
+ #include "IndicLayoutEngine.h"
+ #include "KhmerLayoutEngine.h"
+ #include "ThaiLayoutEngine.h"
++//#include "TibetanLayoutEngine.h"
+ #include "GXLayoutEngine.h"
+ #include "ScriptAndLanguageTags.h"
+ #include "CharSubstitutionFilter.h"
+@@ -56,6 +58,8 @@
+ 
+ #include "KernTable.h"
+ 
++U_NAMESPACE_BEGIN
++
+ const LEUnicode32 DefaultCharMapper::controlChars[] = {
+     0x0009, 0x000A, 0x000D,
+     /*0x200C, 0x200D,*/ 0x200E, 0x200F,
+@@ -102,9 +106,7 @@
+     }
+ 
+     if (fMirror) {
+-        le_int32 index = OpenTypeUtilities::search((le_uint32) ch,
+-                                                   (le_uint32 *)DefaultCharMapper::mirroredChars,
+-                                                   DefaultCharMapper::mirroredCharsCount);
++        le_int32 index = OpenTypeUtilities::search((le_uint32) ch, (le_uint32 *)DefaultCharMapper::mirroredChars, DefaultCharMapper::mirroredCharsCount);
+ 
+         if (mirroredChars[index] == ch) {
+             return DefaultCharMapper::srahCderorrim[index];
+@@ -133,6 +135,9 @@
+     // nothing to do
+ }
+ 
++
++UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LayoutEngine)
++
+ #define ccmpFeatureTag  LE_CCMP_FEATURE_TAG
+ 
+ #define ccmpFeatureMask 0x80000000UL
+@@ -146,10 +151,9 @@
+ 
+ static const le_int32 canonFeatureMapCount = LE_ARRAY_SIZE(canonFeatureMap);
+ 
+-LayoutEngine::LayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode,
+-    le_int32 languageCode, le_int32 typoFlags)
+-  : fGlyphStorage(NULL), fFontInstance(fontInstance), fScriptCode(scriptCode),
+-    fLanguageCode(languageCode), fTypoFlags(typoFlags)
++LayoutEngine::LayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags)
++  : fGlyphStorage(NULL), fFontInstance(fontInstance), fScriptCode(scriptCode), fLanguageCode(languageCode),
++    fTypoFlags(typoFlags)
+ {
+     fGlyphStorage = new LEGlyphStorage();
+ }
+@@ -159,8 +163,7 @@
+     return fGlyphStorage->getGlyphCount();
+ }
+ 
+-void LayoutEngine::getCharIndices(le_int32 charIndices[], le_int32 indexBase,
+-    LEErrorCode &success) const
++void LayoutEngine::getCharIndices(le_int32 charIndices[], le_int32 indexBase, LEErrorCode &success) const
+ {
+     fGlyphStorage->getCharIndices(charIndices, indexBase, success);
+ }
+@@ -171,8 +174,7 @@
+ }
+ 
+ // Copy the glyphs into caller's (32-bit) glyph array, OR in extraBits
+-void LayoutEngine::getGlyphs(le_uint32 glyphs[], le_uint32 extraBits,
+-    LEErrorCode &success) const
++void LayoutEngine::getGlyphs(le_uint32 glyphs[], le_uint32 extraBits, LEErrorCode &success) const
+ {
+     fGlyphStorage->getGlyphs(glyphs, extraBits, success);
+ }
+@@ -219,15 +221,13 @@
+     fGlyphStorage->getGlyphPositions(positions, success);
+ }
+ 
+-void LayoutEngine::getGlyphPosition(le_int32 glyphIndex, float &x, float &y,
+-    LEErrorCode &success) const
++void LayoutEngine::getGlyphPosition(le_int32 glyphIndex, float &x, float &y, LEErrorCode &success) const
+ {
+     fGlyphStorage->getGlyphPosition(glyphIndex, x, y, success);
+ }
+ 
+-le_int32 LayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset,
+-    le_int32 count, le_int32 max, le_bool rightToLeft, LEUnicode *&outChars,
+-    LEGlyphStorage &glyphStorage, LEErrorCode &success)
++le_int32 LayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
++                LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success)
+ {
+     if (LE_FAILURE(success)) {
+         return 0;
+@@ -238,12 +238,7 @@
+         return 0;
+     }
+ 
+-    if ((fTypoFlags & 0x4) == 0) { // no canonical processing
+-        return count;
+-    }
+-
+-    const GlyphSubstitutionTableHeader *canonGSUBTable =
+-        (GlyphSubstitutionTableHeader *) CanonShaping::glyphSubstitutionTable;
++    const GlyphSubstitutionTableHeader *canonGSUBTable = (GlyphSubstitutionTableHeader *) CanonShaping::glyphSubstitutionTable;
+     LETag scriptTag  = OpenTypeLayoutEngine::getScriptTag(fScriptCode);
+     LETag langSysTag = OpenTypeLayoutEngine::getLangSysTag(fLanguageCode);
+     le_int32 i, dir = 1, out = 0, outCharCount = count;
+@@ -257,16 +252,15 @@
+                 // We could just do the mark reordering for all scripts, but most
+                 // of them probably don't need it...
+                 if (fScriptCode == hebrScriptCode) {
+-                    reordered = LE_NEW_ARRAY(LEUnicode, count);
++                        reordered = LE_NEW_ARRAY(LEUnicode, count);
+ 
+-                    if (reordered == NULL) {
+-                        success = LE_MEMORY_ALLOCATION_ERROR;
+-                        return 0;
+-                    }
++                        if (reordered == NULL) {
++                                success = LE_MEMORY_ALLOCATION_ERROR;
++                                return 0;
++                        }
+ 
+-                    CanonShaping::reorderMarks(&chars[offset], count, rightToLeft,
+-                        reordered, glyphStorage);
+-                    inChars = reordered;
++                        CanonShaping::reorderMarks(&chars[offset], count, rightToLeft, reordered, glyphStorage);
++                        inChars = reordered;
+                 }
+ 
+         glyphStorage.allocateGlyphArray(count, rightToLeft, success);
+@@ -290,8 +284,7 @@
+                         LE_DELETE_ARRAY(reordered);
+                 }
+ 
+-        outCharCount = canonGSUBTable->process(glyphStorage, rightToLeft, scriptTag,
+-            langSysTag, NULL, substitutionFilter, canonFeatureMap, canonFeatureMapCount, FALSE);
++        outCharCount = canonGSUBTable->process(glyphStorage, rightToLeft, scriptTag, langSysTag, NULL, substitutionFilter, canonFeatureMap, canonFeatureMapCount, FALSE);
+ 
+         out = (rightToLeft? outCharCount - 1 : 0);
+ 
+@@ -306,35 +299,26 @@
+     return outCharCount;
+ }
+ 
+-
+-le_int32 LayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset,
+-    le_int32 count, le_int32 max, le_bool rightToLeft,
+-    LEGlyphStorage &glyphStorage, LEErrorCode &success)
++le_int32 LayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
++                                            LEGlyphStorage &glyphStorage, LEErrorCode &success)
+ {
+     if (LE_FAILURE(success)) {
+         return 0;
+     }
+ 
+-    if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max ||
+-        offset + count > max) {
+-
++    if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || offset + count > max) {
+         success = LE_ILLEGAL_ARGUMENT_ERROR;
+         return 0;
+     }
+ 
+     LEUnicode *outChars = NULL;
+-    le_int32 outCharCount = characterProcessing(chars, offset, count, max,
+-        rightToLeft, outChars, glyphStorage, success);
++    le_int32 outCharCount = characterProcessing(chars, offset, count, max, rightToLeft, outChars, glyphStorage, success);
+ 
+     if (outChars != NULL) {
+-        mapCharsToGlyphs(outChars, 0, outCharCount, rightToLeft, rightToLeft,
+-            glyphStorage, success);
+-        // FIXME: a subclass may have allocated this, in which case this delete
+-        // might not work...
+-        LE_DELETE_ARRAY(outChars);
++        mapCharsToGlyphs(outChars, 0, outCharCount, rightToLeft, rightToLeft, glyphStorage, success);
++        LE_DELETE_ARRAY(outChars); // FIXME: a subclass may have allocated this, in which case this delete might not work...
+     } else {
+-        mapCharsToGlyphs(chars, offset, count, rightToLeft, rightToLeft,
+-            glyphStorage, success);
++        mapCharsToGlyphs(chars, offset, count, rightToLeft, rightToLeft, glyphStorage, success);
+     }
+ 
+     return glyphStorage.getGlyphCount();
+@@ -342,8 +326,7 @@
+ 
+ // Input: glyphs
+ // Output: positions
+-void LayoutEngine::positionGlyphs(LEGlyphStorage &glyphStorage,
+-    float x, float y, LEErrorCode &success)
++void LayoutEngine::positionGlyphs(LEGlyphStorage &glyphStorage, float x, float y, LEErrorCode &success)
+ {
+     if (LE_FAILURE(success)) {
+         return;
+@@ -370,9 +353,8 @@
+     glyphStorage.setPosition(glyphCount, x, y, success);
+ }
+ 
+-void LayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset,
+-    le_int32 count, le_bool reverse,
+-    LEGlyphStorage &glyphStorage, LEErrorCode &success)
++void LayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse,
++                                        LEGlyphStorage &glyphStorage, LEErrorCode &success)
+ {
+     if (LE_FAILURE(success)) {
+         return;
+@@ -399,8 +381,7 @@
+     return;
+ }
+ 
+-void LayoutEngine::adjustMarkGlyphs(LEGlyphStorage &glyphStorage,
+-    LEGlyphFilter *markFilter, LEErrorCode &success)
++void LayoutEngine::adjustMarkGlyphs(LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter, LEErrorCode &success)
+ {
+     float xAdjust = 0;
+     le_int32 p, glyphCount = glyphStorage.getGlyphCount();
+@@ -436,9 +417,7 @@
+     glyphStorage.adjustPosition(glyphCount, xAdjust, 0, success);
+ }
+ 
+-void LayoutEngine::adjustMarkGlyphs(const LEUnicode chars[], le_int32 charCount,
+-    le_bool reverse, LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter,
+-    LEErrorCode &success)
++void LayoutEngine::adjustMarkGlyphs(const LEUnicode chars[], le_int32 charCount, le_bool reverse, LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter, LEErrorCode &success)
+ {
+     float xAdjust = 0;
+     le_int32 c = 0, direction = 1, p;
+@@ -485,9 +464,8 @@
+     return fFontInstance->getFontTable(tableTag);
+ }
+ 
+-void LayoutEngine::mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset,
+-    le_int32 count, le_bool reverse, le_bool mirror,
+-    LEGlyphStorage &glyphStorage, LEErrorCode &success)
++void LayoutEngine::mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, le_bool mirror,
++                                    LEGlyphStorage &glyphStorage, LEErrorCode &success)
+ {
+     if (LE_FAILURE(success)) {
+         return;
+@@ -497,32 +475,27 @@
+ 
+     DefaultCharMapper charMapper(TRUE, mirror);
+ 
+-    fFontInstance->mapCharsToGlyphs(chars, offset, count, reverse,
+-        &charMapper, glyphStorage);
++    fFontInstance->mapCharsToGlyphs(chars, offset, count, reverse, &charMapper, glyphStorage);
+ }
+ 
+ // Input: characters, font?
+ // Output: glyphs, positions, char indices
+ // Returns: number of glyphs
+-le_int32 LayoutEngine::layoutChars(const LEUnicode chars[], le_int32 offset,
+-    le_int32 count, le_int32 max, le_bool rightToLeft,
+-    float x, float y, LEErrorCode &success)
++le_int32 LayoutEngine::layoutChars(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
++                              float x, float y, LEErrorCode &success)
+ {
+     if (LE_FAILURE(success)) {
+         return 0;
+     }
+ 
+-    if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max ||
+-        offset + count > max) {
+-
++    if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || offset + count > max) {
+         success = LE_ILLEGAL_ARGUMENT_ERROR;
+         return 0;
+     }
+ 
+     le_int32 glyphCount;
+ 
+-    glyphCount = computeGlyphs(chars, offset, count, max, rightToLeft,
+-        *fGlyphStorage, success);
++    glyphCount = computeGlyphs(chars, offset, count, max, rightToLeft, *fGlyphStorage, success);
+     positionGlyphs(*fGlyphStorage, x, y, success);
+     adjustGlyphPositions(chars, offset, count, rightToLeft, *fGlyphStorage, success);
+ 
+@@ -534,17 +507,13 @@
+     fGlyphStorage->reset();
+ }
+ 
+-LayoutEngine *LayoutEngine::layoutEngineFactory(const LEFontInstance *fontInstance,
+-    le_int32 scriptCode, le_int32 languageCode, LEErrorCode &success)
++LayoutEngine *LayoutEngine::layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, LEErrorCode &success)
+ {
+   // 3 -> kerning and ligatures
+-  return LayoutEngine::layoutEngineFactory(fontInstance, scriptCode,
+-        languageCode, LE_DEFAULT_FEATURE_FLAG, success);
++  return LayoutEngine::layoutEngineFactory(fontInstance, scriptCode, languageCode, LE_DEFAULT_FEATURE_FLAG, success);
+ }
+ 
+-LayoutEngine *LayoutEngine::layoutEngineFactory(const LEFontInstance *fontInstance,
+-    le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags,
+-    LEErrorCode &success)
++LayoutEngine *LayoutEngine::layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags, LEErrorCode &success)
+ {
+     static const le_uint32 gsubTableTag = LE_GSUB_TABLE_TAG;
+     static const le_uint32 mortTableTag = LE_MORT_TABLE_TAG;
+@@ -553,18 +522,12 @@
+         return NULL;
+     }
+ 
+-    // code2000 has GPOS kern feature tags for latn script
+-
+-    const GlyphSubstitutionTableHeader *gsubTable =
+-        (const GlyphSubstitutionTableHeader *) fontInstance->getFontTable(gsubTableTag);
++    const GlyphSubstitutionTableHeader *gsubTable = (const GlyphSubstitutionTableHeader *) fontInstance->getFontTable(gsubTableTag);
+     LayoutEngine *result = NULL;
+     LETag scriptTag   = 0x00000000;
+     LETag languageTag = 0x00000000;
+ 
+-    if (gsubTable != NULL &&
+-        gsubTable->coversScript(scriptTag =
+-            OpenTypeLayoutEngine::getScriptTag(scriptCode))) {
+-
++    if (gsubTable != NULL && gsubTable->coversScript(scriptTag = OpenTypeLayoutEngine::getScriptTag(scriptCode))) {
+         switch (scriptCode) {
+         case bengScriptCode:
+         case devaScriptCode:
+@@ -576,13 +539,11 @@
+         case tamlScriptCode:
+         case teluScriptCode:
+         case sinhScriptCode:
+-            result = new IndicOpenTypeLayoutEngine(fontInstance, scriptCode,
+-             languageCode, typoFlags, gsubTable);
++            result = new IndicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable);
+             break;
+ 
+         case arabScriptCode:
+-            result = new ArabicOpenTypeLayoutEngine(fontInstance, scriptCode,
+-             languageCode, typoFlags, gsubTable);
++            result = new ArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable);
+             break;
+ 
+         case haniScriptCode:
+@@ -594,33 +555,33 @@
+             case zhtLanguageCode:
+             case zhsLanguageCode:
+                 if (gsubTable->coversScriptAndLanguage(scriptTag, languageTag, TRUE)) {
+-                    result = new HanOpenTypeLayoutEngine(fontInstance, scriptCode,
+-                        languageCode, typoFlags, gsubTable);
++                    result = new HanOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable);
+                     break;
+                 }
+ 
+                 // note: falling through to default case.
+             default:
+-                result = new OpenTypeLayoutEngine(fontInstance, scriptCode,
+-                 languageCode, typoFlags, gsubTable);
++                result = new OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable);
+                 break;
+             }
+ 
+             break;
++#if 0
++        case tibtScriptCode:
++             result = new TibetanOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable);
++            break;
++#endif
+ 
+         case khmrScriptCode:
+-            result = new KhmerOpenTypeLayoutEngine(fontInstance, scriptCode,
+-                languageCode, typoFlags, gsubTable);
++            result = new KhmerOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable);
+             break;
+ 
+         default:
+-            result = new OpenTypeLayoutEngine(fontInstance, scriptCode,
+-             languageCode, typoFlags, gsubTable);
++            result = new OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable);
+             break;
+         }
+     } else {
+-        const MorphTableHeader *morphTable =
+-          (MorphTableHeader *) fontInstance->getFontTable(mortTableTag);
++        const MorphTableHeader *morphTable = (MorphTableHeader *) fontInstance->getFontTable(mortTableTag);
+ 
+         if (morphTable != NULL && SWAPL(morphTable->version)==0x00010000) {
+             result = new GXLayoutEngine(fontInstance, scriptCode, languageCode, morphTable);
+@@ -637,16 +598,18 @@
+             case teluScriptCode:
+             case sinhScriptCode:
+             {
+-                result = new IndicOpenTypeLayoutEngine(fontInstance, scriptCode,
+-                languageCode, typoFlags);
++                result = new IndicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags);
+                 break;
+             }
+ 
+             case arabScriptCode:
+-                result = new UnicodeArabicOpenTypeLayoutEngine(fontInstance, scriptCode,
+-                    languageCode, typoFlags);
++            //case hebrScriptCode:
++                result = new UnicodeArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags);
+                 break;
+ 
++            //case hebrScriptCode:
++            //    return new HebrewOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags);
++
+             case thaiScriptCode:
+                 result = new ThaiLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags);
+                 break;
+@@ -668,3 +631,5 @@
+ LayoutEngine::~LayoutEngine() {
+     delete fGlyphStorage;
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/LayoutEngine.h b/src/share/native/sun/font/layout/LayoutEngine.h
+--- jdk/src/share/native/sun/font/layout/LayoutEngine.h
++++ jdk/src/share/native/sun/font/layout/LayoutEngine.h
+@@ -23,6 +23,7 @@
+  *
+  */
+ 
++
+ /*
+  *
+  * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
+@@ -34,63 +35,61 @@
+ 
+ #include "LETypes.h"
+ 
+-#include <string.h>
++/**
++ * \file
++ * \brief C++ API: Virtual base class for complex text layout.
++ */
++
++U_NAMESPACE_BEGIN
+ 
+ class LEFontInstance;
+ class LEGlyphFilter;
+ class LEGlyphStorage;
+ 
+ /**
+- * This is a virtual base class used to do complex text layout. The
+- * text must all be in a single font, script, and language. An
+- * instance of a LayoutEngine can be created by calling the
+- * layoutEngineFactory method. Fonts are identified by instances of
+- * the LEFontInstance class. Script and language codes are identified
++ * This is a virtual base class used to do complex text layout. The text must all
++ * be in a single font, script, and language. An instance of a LayoutEngine can be
++ * created by calling the layoutEngineFactory method. Fonts are identified by
++ * instances of the LEFontInstance class. Script and language codes are identified
+  * by integer codes, which are defined in ScriptAndLanuageTags.h.
+  *
+- * Note that this class is not public API. It is declared public so
+- * that it can be exported from the library that it is a part of.
++ * Note that this class is not public API. It is declared public so that it can be
++ * exported from the library that it is a part of.
+  *
+- * The input to the layout process is an array of characters in
+- * logical order, and a starting X, Y position for the text. The
+- * output is an array of glyph indices, an array of character indices
+- * for the glyphs, and an array of glyph positions.  These arrays are
+- * protected members of LayoutEngine which can be retreived by a
+- * public method. The reset method can be called to free these arrays
+- * so that the LayoutEngine can be reused.
++ * The input to the layout process is an array of characters in logical order,
++ * and a starting X, Y position for the text. The output is an array of glyph indices,
++ * an array of character indices for the glyphs, and an array of glyph positions.
++ * These arrays are protected members of LayoutEngine which can be retreived by a
++ * public method. The reset method can be called to free these arrays so that the
++ * LayoutEngine can be reused.
+  *
+- * The layout process is done in three steps. There is a protected
+- * virtual method for each step. These methods have a default
+- * implementation which only does character to glyph mapping and
+- * default positioning using the glyph's advance widths. Subclasses
+- * can override these methods for more advanced layout.  There is a
+- * public method which invokes the steps in the correct order.
++ * The layout process is done in three steps. There is a protected virtual method
++ * for each step. These methods have a default implementation which only does
++ * character to glyph mapping and default positioning using the glyph's advance
++ * widths. Subclasses can override these methods for more advanced layout.
++ * There is a public method which invokes the steps in the correct order.
+  *
+  * The steps are:
+  *
+- * 1) Glyph processing - character to glyph mapping and any other
+- *    glyph processing such as ligature substitution and contextual
+- *    forms.
++ * 1) Glyph processing - character to glyph mapping and any other glyph processing
++ *    such as ligature substitution and contextual forms.
+  *
+- * 2) Glyph positioning - position the glyphs based on their advance
+- *    widths.
++ * 2) Glyph positioning - position the glyphs based on their advance widths.
+  *
+- * 3) Glyph position adjustments - adjustment of glyph positions for
+- *    kerning, accent placement, etc.
++ * 3) Glyph position adjustments - adjustment of glyph positions for kerning,
++ *    accent placement, etc.
+  *
+- * NOTE: in all methods below, output parameters are references to
+- * pointers so the method can allocate and free the storage as
+- * needed. All storage allocated in this way is owned by the object
+- * which created it, and will be freed when it is no longer needed, or
+- * when the object's destructor is invoked.
++ * NOTE: in all methods below, output parameters are references to pointers so
++ * the method can allocate and free the storage as needed. All storage allocated
++ * in this way is owned by the object which created it, and will be freed when it
++ * is no longer needed, or when the object's destructor is invoked.
+  *
+  * @see LEFontInstance
+  * @see ScriptAndLanguageTags.h
+  *
+  * @stable ICU 2.8
+  */
+-class U_LAYOUT_API LayoutEngine
+-{
++class U_LAYOUT_API LayoutEngine : public UObject {
+ protected:
+     /**
+      * The object which holds the glyph storage
+@@ -134,21 +133,21 @@
+     le_int32 fTypoFlags;
+ 
+     /**
+-     * This constructs an instance for a given font, script and
+-     * language. Subclass constructors
++     * This constructs an instance for a given font, script and language. Subclass constructors
+      * must call this constructor.
+      *
+      * @param fontInstance - the font for the text
+      * @param scriptCode - the script for the text
+      * @param languageCode - the language for the text
++     * @param typoFlags - the typographic control flags for the text.  Set bit 1 if kerning
++     * is desired, set bit 2 if ligature formation is desired.  Others are reserved.
+      *
+      * @see LEFontInstance
+      * @see ScriptAndLanguageTags.h
+      *
+      * @internal
+      */
+-    LayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode,
+-        le_int32 languageCode, le_int32 typoFlags);
++    LayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags);
+ 
+     /**
+      * This overrides the default no argument constructor to make it
+@@ -160,11 +159,10 @@
+     LayoutEngine();
+ 
+     /**
+-     * This method does any required pre-processing to the input
+-     * characters. It may generate output characters that differ from
+-     * the input charcters due to insertions, deletions, or
+-     * reorderings. In such cases, it will also generate an output
+-     * character index array reflecting these changes.
++     * This method does any required pre-processing to the input characters. It
++     * may generate output characters that differ from the input charcters due to
++     * insertions, deletions, or reorderings. In such cases, it will also generate an
++     * output character index array reflecting these changes.
+      *
+      * Subclasses must override this method.
+      *
+@@ -173,44 +171,36 @@
+      * @param offset - the index of the first character to process
+      * @param count - the number of characters to process
+      * @param max - the number of characters in the input context
+-     * @param rightToLeft - TRUE if the characters are in a right to
+-     *     left directional run
+-     * @param outChars - the output character array, if different from
+-     *     the input
+-     * @param glyphStorage - the object that holds the per-glyph
+-     *     storage. The character index array may be set.
++     * @param rightToLeft - TRUE if the characters are in a right to left directional run
++     * @param outChars - the output character array, if different from the input
++     * @param glyphStorage - the object that holds the per-glyph storage. The character index array may be set.
+      * @param success - set to an error code if the operation fails
+-     * @return the output character count (input character count if no
+-     *     change)
++     *
++     * @return the output character count (input character count if no change)
+      *
+      * @internal
+      */
+-    virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset,
+-        le_int32 count, le_int32 max, le_bool rightToLeft,
+-        LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
++    virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
++            LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
+ 
+     /**
+-     * This method does the glyph processing. It converts an array of
+-     * characters into an array of glyph indices and character
+-     * indices. The characters to be processed are passed in a
+-     * surrounding context. The context is specified as a starting
+-     * address and a maximum character count. An offset and a count
+-     * are used to specify the characters to be processed.
++     * This method does the glyph processing. It converts an array of characters
++     * into an array of glyph indices and character indices. The characters to be
++     * processed are passed in a surrounding context. The context is specified as
++     * a starting address and a maximum character count. An offset and a count are
++     * used to specify the characters to be processed.
+      *
+-     * The default implementation of this method only does character
+-     * to glyph mapping.  Subclasses needing more elaborate glyph
+-     * processing must override this method.
++     * The default implementation of this method only does character to glyph mapping.
++     * Subclasses needing more elaborate glyph processing must override this method.
+      *
+      * Input parameters:
+      * @param chars - the character context
+      * @param offset - the offset of the first character to process
+      * @param count - the number of characters to process
+      * @param max - the number of characters in the context.
+-     * @param rightToLeft - TRUE if the text is in a right to left
+-     *            directional run
+-     * @param glyphStorage - the object which holds the per-glyph
+-     *            storage. The glyph and char indices arrays will be
+-     *            set.
++     * @param rightToLeft - TRUE if the text is in a right to left directional run
++     * @param glyphStorage - the object which holds the per-glyph storage. The glyph and char indices arrays
++     *                       will be set.
+      *
+      * Output parameters:
+      * @param success - set to an error code if the operation fails
+@@ -219,60 +209,50 @@
+      *
+      * @internal
+      */
+-    virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset,
+-        le_int32 count, le_int32 max, le_bool rightToLeft,
+-        LEGlyphStorage &glyphStorage, LEErrorCode &success);
++    virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success);
+ 
+     /**
+-     * This method does basic glyph positioning. The default
+-     * implementation positions the glyphs based on their advance
+-     * widths. This is sufficient for most uses. It is not expected
+-     * that many subclasses will override this method.
++     * This method does basic glyph positioning. The default implementation positions
++     * the glyphs based on their advance widths. This is sufficient for most uses. It
++     * is not expected that many subclasses will override this method.
+      *
+      * Input parameters:
+-     * @param glyphStorage - the object which holds the per-glyph storage.
+-     *            The glyph position array will be set.
++     * @param glyphStorage - the object which holds the per-glyph storage. The glyph position array will be set.
+      * @param x - the starting X position
+      * @param y - the starting Y position
+      * @param success - set to an error code if the operation fails
+      *
+      * @internal
+      */
+-    virtual void positionGlyphs(LEGlyphStorage &glyphStorage,
+-                     float x, float y, LEErrorCode &success);
++    virtual void positionGlyphs(LEGlyphStorage &glyphStorage, float x, float y, LEErrorCode &success);
+ 
+     /**
+-     * This method does positioning adjustments like accent
+-     * positioning and kerning. The default implementation does
+-     * nothing. Subclasses needing position adjustments must override
+-     * this method.
++     * This method does positioning adjustments like accent positioning and
++     * kerning. The default implementation does nothing. Subclasses needing
++     * position adjustments must override this method.
+      *
+-     * Note that this method has both characters and glyphs as input
+-     * so that it can use the character codes to determine glyph types
+-     * if that information isn't directly available. (e.g. Some Arabic
+-     * OpenType fonts don't have a GDEF table)
++     * Note that this method has both characters and glyphs as input so that
++     * it can use the character codes to determine glyph types if that information
++     * isn't directly available. (e.g. Some Arabic OpenType fonts don't have a GDEF
++     * table)
+      *
+      * @param chars - the input character context
+      * @param offset - the offset of the first character to process
+      * @param count - the number of characters to process
+-     * @param reverse - <code>TRUE</code> if the glyphs in the glyph
+-     *     array have been reordered
+-     * @param glyphStorage - the object which holds the per-glyph
+-     *     storage. The glyph positions will be adjusted as needed.
+-     * @param success - output parameter set to an error code if the
+-     *     operation fails
++     * @param reverse - <code>TRUE</code> if the glyphs in the glyph array have been reordered
++     * @param glyphStorage - the object which holds the per-glyph storage. The glyph positions will be
++     *                       adjusted as needed.
++     * @param success - output parameter set to an error code if the operation fails
+      *
+      * @internal
+      */
+-    virtual void adjustGlyphPositions(const LEUnicode chars[],
+-        le_int32 offset, le_int32 count, le_bool reverse,
+-        LEGlyphStorage &glyphStorage, LEErrorCode &success);
++    virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success);
+ 
+     /**
+-     * This method gets a table from the font associated with the
+-     * text. The default implementation gets the table from the font
+-     * instance. Subclasses which need to get the tables some other
+-     * way must override this method.
++     * This method gets a table from the font associated with
++     * the text. The default implementation gets the table from
++     * the font instance. Subclasses which need to get the tables
++     * some other way must override this method.
+      *
+      * @param tableTag - the four byte table tag.
+      *
+@@ -283,127 +263,106 @@
+     virtual const void *getFontTable(LETag tableTag) const;
+ 
+     /**
+-     * This method does character to glyph mapping. The default
+-     * implementation uses the font instance to do the mapping. It
+-     * will allocate the glyph and character index arrays if they're
+-     * not already allocated. If it allocates the character index
+-     * array, it will fill it it.
++     * This method does character to glyph mapping. The default implementation
++     * uses the font instance to do the mapping. It will allocate the glyph and
++     * character index arrays if they're not already allocated. If it allocates the
++     * character index array, it will fill it it.
+      *
+-     * This method supports right to left text with the ability to
+-     * store the glyphs in reverse order, and by supporting character
+-     * mirroring, which will replace a character which has a left and
+-     * right form, such as parens, with the opposite form before
+-     * mapping it to a glyph index.
++     * This method supports right to left
++     * text with the ability to store the glyphs in reverse order, and by supporting
++     * character mirroring, which will replace a character which has a left and right
++     * form, such as parens, with the opposite form before mapping it to a glyph index.
+      *
+      * Input parameters:
+      * @param chars - the input character context
+      * @param offset - the offset of the first character to be mapped
+      * @param count - the number of characters to be mapped
+-     * @param reverse - if <code>TRUE</code>, the output will be in
+-     *            reverse order
++     * @param reverse - if <code>TRUE</code>, the output will be in reverse order
+      * @param mirror - if <code>TRUE</code>, do character mirroring
+-     * @param glyphStorage - the object which holds the per-glyph
+-     *            storage. The glyph and char indices arrays will be
+-     *            filled in.
++     * @param glyphStorage - the object which holds the per-glyph storage. The glyph and char
++     *                       indices arrays will be filled in.
+      * @param success - set to an error code if the operation fails
+      *
+      * @see LEFontInstance
+      *
+      * @internal
+      */
+-    virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset,
+-        le_int32 count, le_bool reverse, le_bool mirror,
+-        LEGlyphStorage &glyphStorage, LEErrorCode &success);
++    virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, le_bool mirror, LEGlyphStorage &glyphStorage, LEErrorCode &success);
+ 
+     /**
+-     * This is a convenience method that forces the advance width of
+-     * mark glyphs to be zero, which is required for proper selection
+-     * and highlighting.
++     * This is a convenience method that forces the advance width of mark
++     * glyphs to be zero, which is required for proper selection and highlighting.
+      *
+-     * @param glyphStorage - the object containing the per-glyph
+-     *     storage. The positions array will be modified.
++     * @param glyphStorage - the object containing the per-glyph storage. The positions array will be modified.
+      * @param markFilter - used to identify mark glyphs
+-     * @param success - output parameter set to an error code if the
+-     *     operation fails
++     * @param success - output parameter set to an error code if the operation fails
+      *
+      * @see LEGlyphFilter
+      *
+      * @internal
+      */
+-    static void adjustMarkGlyphs(LEGlyphStorage &glyphStorage,
+-        LEGlyphFilter *markFilter, LEErrorCode &success);
++    static void adjustMarkGlyphs(LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter, LEErrorCode &success);
+ 
+ 
+     /**
+-     * This is a convenience method that forces the advance width of
+-     * mark glyphs to be zero, which is required for proper selection
+-     * and highlighting.  This method uses the input characters to
+-     * identify marks. This is required in cases where the font does
+-     * not contain enough information to identify them based on the
+-     * glyph IDs.
++     * This is a convenience method that forces the advance width of mark
++     * glyphs to be zero, which is required for proper selection and highlighting.
++     * This method uses the input characters to identify marks. This is required in
++     * cases where the font does not contain enough information to identify them based
++     * on the glyph IDs.
+      *
+      * @param chars - the array of input characters
+      * @param charCount - the number of input characers
+-     * @param glyphStorage - the object containing the per-glyph
+-     *     storage. The positions array will be modified.
+-     * @param reverse - <code>TRUE</code> if the glyph array has been
+-     *     reordered
++     * @param glyphStorage - the object containing the per-glyph storage. The positions array will be modified.
++     * @param reverse - <code>TRUE</code> if the glyph array has been reordered
+      * @param markFilter - used to identify mark glyphs
+-     * @param success - output parameter set to an error code if the
+-     *     operation fails
++     * @param success - output parameter set to an error code if the operation fails
+      *
+      * @see LEGlyphFilter
+      *
+      * @internal
+      */
+-    static void adjustMarkGlyphs(const LEUnicode chars[],
+-        le_int32 charCount, le_bool reverse,
+-        LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter,
+-        LEErrorCode &success);
++    static void adjustMarkGlyphs(const LEUnicode chars[], le_int32 charCount, le_bool reverse, LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter, LEErrorCode &success);
++
+ 
+ public:
+     /**
+      * The destructor. It will free any storage allocated for the
+      * glyph, character index and position arrays by calling the reset
+-     * method. It is declared virtual so that it will be invoked by
+-     * the subclass destructors.
++     * method. It is declared virtual so that it will be invoked by the
++     * subclass destructors.
+      *
+      * @stable ICU 2.8
+      */
+     virtual ~LayoutEngine();
+ 
+     /**
+-     * This method will invoke the layout steps in their correct order
+-     * by calling the 32 bit versions of the computeGlyphs and
+-     * positionGlyphs methods.(It doesn't * call the
+-     * adjustGlyphPositions method because that doesn't apply for
+-     * default * processing.) It will compute the glyph, character
+-     * index and position arrays.
++     * This method will invoke the layout steps in their correct order by calling
++     * the computeGlyphs, positionGlyphs and adjustGlyphPosition methods.. It will
++     * compute the glyph, character index and position arrays.
+      *
+      * @param chars - the input character context
+      * @param offset - the offset of the first character to process
+      * @param count - the number of characters to process
+      * @param max - the number of characters in the input context
+-     * @param rightToLeft - true if the characers are in a right to
+-     *            left directional run
++     * @param rightToLeft - TRUE if the characers are in a right to left directional run
+      * @param x - the initial X position
+      * @param y - the initial Y position
+-     * @param success - output parameter set to an error code if the
+-     *            operation fails
++     * @param success - output parameter set to an error code if the operation fails
++     *
+      * @return the number of glyphs in the glyph array
+      *
+-     * Note: the glyph, character index and position array can be
+-     * accessed using the getter method below.
++     * Note; the glyph, character index and position array can be accessed
++     * using the getter method below.
++     *
++     * @stable ICU 2.8
+      */
+-    le_int32 layoutChars(const LEUnicode chars[], le_int32 offset,
+-        le_int32 count, le_int32 max, le_bool rightToLeft, float x,
+-        float y, LEErrorCode &success);
++    virtual le_int32 layoutChars(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, float x, float y, LEErrorCode &success);
+ 
+     /**
+-     * This method returns the number of glyphs in the glyph
+-     * array. Note that the number of glyphs will be greater than or
+-     * equal to the number of characters used to create the
+-     * LayoutEngine.
++     * This method returns the number of glyphs in the glyph array. Note
++     * that the number of glyphs will be greater than or equal to the number
++     * of characters used to create the LayoutEngine.
+      *
+      * @return the number of glyphs in the glyph array
+      *
+@@ -412,9 +371,9 @@
+     le_int32 getGlyphCount() const;
+ 
+     /**
+-     * This method copies the glyph array into a caller supplied
+-     * array.  The caller must ensure that the array is large enough
+-     * to hold all the glyphs.
++     * This method copies the glyph array into a caller supplied array.
++     * The caller must ensure that the array is large enough to hold all
++     * the glyphs.
+      *
+      * @param glyphs - the destiniation glyph array
+      * @param success - set to an error code if the operation fails
+@@ -424,10 +383,10 @@
+     void getGlyphs(LEGlyphID glyphs[], LEErrorCode &success) const;
+ 
+     /**
+-     * This method copies the glyph array into a caller supplied
+-     * array, ORing in extra bits. (This functionality is needed by
+-     * the JDK, which uses 32 bits pre glyph idex, with the high 16
+-     * bits encoding the composite font slot number)
++     * This method copies the glyph array into a caller supplied array,
++     * ORing in extra bits. (This functionality is needed by the JDK,
++     * which uses 32 bits pre glyph idex, with the high 16 bits encoding
++     * the composite font slot number)
+      *
+      * @param glyphs - the destination (32 bit) glyph array
+      * @param extraBits - this value will be ORed with each glyph index
+@@ -435,13 +394,12 @@
+      *
+      * @stable ICU 2.8
+      */
+-    virtual void getGlyphs(le_uint32 glyphs[], le_uint32 extraBits,
+-        LEErrorCode &success) const;
++    virtual void getGlyphs(le_uint32 glyphs[], le_uint32 extraBits, LEErrorCode &success) const;
+ 
+     /**
+-     * This method copies the character index array into a caller
+-     * supplied array.  The caller must ensure that the array is large
+-     * enough to hold a character index for each glyph.
++     * This method copies the character index array into a caller supplied array.
++     * The caller must ensure that the array is large enough to hold a
++     * character index for each glyph.
+      *
+      * @param charIndices - the destiniation character index array
+      * @param success - set to an error code if the operation fails
+@@ -451,9 +409,9 @@
+     void getCharIndices(le_int32 charIndices[], LEErrorCode &success) const;
+ 
+     /**
+-     * This method copies the character index array into a caller
+-     * supplied array.  The caller must ensure that the array is large
+-     * enough to hold a character index for each glyph.
++     * This method copies the character index array into a caller supplied array.
++     * The caller must ensure that the array is large enough to hold a
++     * character index for each glyph.
+      *
+      * @param charIndices - the destiniation character index array
+      * @param indexBase - an offset which will be added to each index
+@@ -461,14 +419,13 @@
+      *
+      * @stable ICU 2.8
+      */
+-    void getCharIndices(le_int32 charIndices[], le_int32 indexBase,
+-        LEErrorCode &success) const;
++    void getCharIndices(le_int32 charIndices[], le_int32 indexBase, LEErrorCode &success) const;
+ 
+     /**
+-     * This method copies the position array into a caller supplied
+-     * array.  The caller must ensure that the array is large enough
+-     * to hold an X and Y position for each glyph, plus an extra X and
+-     * Y for the advance of the last glyph.
++     * This method copies the position array into a caller supplied array.
++     * The caller must ensure that the array is large enough to hold an
++     * X and Y position for each glyph, plus an extra X and Y for the
++     * advance of the last glyph.
+      *
+      * @param positions - the destiniation position array
+      * @param success - set to an error code if the operation fails
+@@ -491,8 +448,7 @@
+      *
+      * @stable ICU 2.8
+      */
+-    void getGlyphPosition(le_int32 glyphIndex, float &x, float &y,
+-        LEErrorCode &success) const;
++    void getGlyphPosition(le_int32 glyphIndex, float &x, float &y, LEErrorCode &success) const;
+ 
+     /**
+      * This method frees the glyph, character index and position arrays
+@@ -511,8 +467,7 @@
+      * @param fontInstance - the font of the text
+      * @param scriptCode - the script of the text
+      * @param languageCode - the language of the text
+-     * @param success - output parameter set to an error code if the
+-     *     operation fails
++     * @param success - output parameter set to an error code if the operation fails
+      *
+      * @return a LayoutEngine which can layout text in the given font.
+      *
+@@ -520,17 +475,30 @@
+      *
+      * @stable ICU 2.8
+      */
+-    static LayoutEngine *layoutEngineFactory(const LEFontInstance *fontInstance,
+-        le_int32 scriptCode, le_int32 languageCode, LEErrorCode &success);
++    static LayoutEngine *layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, LEErrorCode &success);
+ 
+     /**
+      * Override of existing call that provides flags to control typography.
+      * @draft ICU 3.4
+      */
+-    static LayoutEngine *layoutEngineFactory(
+-        const LEFontInstance *fontInstance,
+-        le_int32 scriptCode, le_int32 languageCode,
+-        le_int32 typo_flags, LEErrorCode &success);
++    static LayoutEngine *layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typo_flags, LEErrorCode &success);
++
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for the actual class.
++     *
++     * @stable ICU 2.8
++     */
++    virtual UClassID getDynamicClassID() const;
++
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for this class.
++     *
++     * @stable ICU 2.8
++     */
++    static UClassID getStaticClassID();
++
+ };
+ 
++U_NAMESPACE_END
+ #endif
++
+diff --git a/src/share/native/sun/font/layout/LayoutTables.h b/src/share/native/sun/font/layout/LayoutTables.h
+--- jdk/src/share/native/sun/font/layout/LayoutTables.h
++++ jdk/src/share/native/sun/font/layout/LayoutTables.h
+@@ -32,11 +32,20 @@
+ #ifndef __LAYOUTTABLES_H
+ #define __LAYOUTTABLES_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ 
++U_NAMESPACE_BEGIN
++
+ #define ANY_NUMBER 1
+ 
+ typedef le_int16 ByteOffset;
+ typedef le_int16 WordOffset;
+ 
++U_NAMESPACE_END
+ #endif
++
+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
+@@ -39,10 +39,14 @@
+ #include "LEGlyphStorage.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ #define ExtendedComplement(m) ((le_int32) (~((le_uint32) (m))))
+ #define SignBit(m) ((ExtendedComplement(m) >> 1) & (le_int32)(m))
+ #define SignExtend(v,m) (((v) & SignBit(m))? ((v) | ExtendedComplement(m)): (v))
+ 
++UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LigatureSubstitutionProcessor)
++
+ LigatureSubstitutionProcessor::LigatureSubstitutionProcessor(const MorphSubtableHeader *morphSubtableHeader)
+   : StateTableProcessor(morphSubtableHeader)
+ {
+@@ -63,8 +67,7 @@
+     m = -1;
+ }
+ 
+-ByteOffset LigatureSubstitutionProcessor::processStateEntry(LEGlyphStorage &glyphStorage,
+-    le_int32 &currGlyph, EntryTableIndex index)
++ByteOffset LigatureSubstitutionProcessor::processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index)
+ {
+     const LigatureSubstitutionStateEntry *entry = &entryTable[index];
+     ByteOffset newState = SWAPW(entry->newStateOffset);
+@@ -162,3 +165,5 @@
+ void LigatureSubstitutionProcessor::endStateTable()
+ {
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/LigatureSubstProc.h b/src/share/native/sun/font/layout/LigatureSubstProc.h
+--- jdk/src/share/native/sun/font/layout/LigatureSubstProc.h
++++ jdk/src/share/native/sun/font/layout/LigatureSubstProc.h
+@@ -32,12 +32,19 @@
+ #ifndef __LIGATURESUBSTITUTIONPROCESSOR_H
+ #define __LIGATURESUBSTITUTIONPROCESSOR_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "MorphTables.h"
+ #include "SubtableProcessor.h"
+ #include "StateTableProcessor.h"
+ #include "LigatureSubstitution.h"
+ 
++U_NAMESPACE_BEGIN
++
+ class LEGlyphStorage;
+ 
+ #define nComponents 16
+@@ -54,6 +61,20 @@
+     LigatureSubstitutionProcessor(const MorphSubtableHeader *morphSubtableHeader);
+     virtual ~LigatureSubstitutionProcessor();
+ 
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for the actual class.
++     *
++     * @stable ICU 2.8
++     */
++    virtual UClassID getDynamicClassID() const;
++
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for this class.
++     *
++     * @stable ICU 2.8
++     */
++    static UClassID getStaticClassID();
++
+ private:
+     LigatureSubstitutionProcessor();
+ 
+@@ -68,6 +89,8 @@
+     le_int16 m;
+ 
+     const LigatureSubstitutionHeader *ligatureSubstitutionHeader;
++
+ };
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/LigatureSubstSubtables.cpp b/src/share/native/sun/font/layout/LigatureSubstSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/LigatureSubstSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/LigatureSubstSubtables.cpp
+@@ -25,6 +25,7 @@
+ 
+ /*
+  *
++ *
+  * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved
+  *
+  */
+@@ -37,6 +38,8 @@
+ #include "GlyphIterator.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ le_uint32 LigatureSubstitutionSubtable::process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const
+ {
+     LEGlyphID glyph = glyphIterator->getCurrGlyphID();
+@@ -92,3 +95,5 @@
+ 
+     return 0;
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/LigatureSubstSubtables.h b/src/share/native/sun/font/layout/LigatureSubstSubtables.h
+--- jdk/src/share/native/sun/font/layout/LigatureSubstSubtables.h
++++ jdk/src/share/native/sun/font/layout/LigatureSubstSubtables.h
+@@ -32,12 +32,19 @@
+ #ifndef __LIGATURESUBSTITUTIONSUBTABLES_H
+ #define __LIGATURESUBSTITUTIONSUBTABLES_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "LEGlyphFilter.h"
+ #include "OpenTypeTables.h"
+ #include "GlyphSubstitutionTables.h"
+ #include "GlyphIterator.h"
+ 
++U_NAMESPACE_BEGIN
++
+ struct LigatureSetTable
+ {
+     le_uint16 ligatureCount;
+@@ -59,4 +66,5 @@
+     le_uint32  process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter = NULL) const;
+ };
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/LigatureSubstitution.h b/src/share/native/sun/font/layout/LigatureSubstitution.h
+--- jdk/src/share/native/sun/font/layout/LigatureSubstitution.h
++++ jdk/src/share/native/sun/font/layout/LigatureSubstitution.h
+@@ -32,12 +32,19 @@
+ #ifndef __LIGATURESUBSTITUTION_H
+ #define __LIGATURESUBSTITUTION_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "LayoutTables.h"
+ #include "StateTables.h"
+ #include "MorphTables.h"
+ #include "MorphStateTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ struct LigatureSubstitutionHeader : MorphStateTableHeader
+ {
+     ByteOffset ligatureActionTableOffset;
+@@ -65,4 +72,5 @@
+     lafComponentOffsetMask  = 0x3FFFFFFF
+ };
+ 
++U_NAMESPACE_END
+ #endif
+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
+@@ -42,6 +42,8 @@
+ #include "LEGlyphStorage.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ le_uint32 LookupProcessor::applyLookupTable(const LookupTable *lookupTable, GlyphIterator *glyphIterator,
+                                          const LEFontInstance *fontInstance) const
+ {
+@@ -65,10 +67,9 @@
+     return 1;
+ }
+ 
+-le_int32 LookupProcessor::process(LEGlyphStorage &glyphStorage,
+-    GlyphPositionAdjustments *glyphPositionAdjustments,
+-    le_bool rightToLeft, const GlyphDefinitionTableHeader *glyphDefinitionTableHeader,
+-    const LEFontInstance *fontInstance) const
++le_int32 LookupProcessor::process(LEGlyphStorage &glyphStorage, GlyphPositionAdjustments *glyphPositionAdjustments,
++                              le_bool rightToLeft, const GlyphDefinitionTableHeader *glyphDefinitionTableHeader,
++                              const LEFontInstance *fontInstance) const
+ {
+     le_int32 glyphCount = glyphStorage.getGlyphCount();
+ 
+@@ -140,8 +141,7 @@
+ 
+ LookupProcessor::LookupProcessor(const char *baseAddress,
+         Offset scriptListOffset, Offset featureListOffset, Offset lookupListOffset,
+-        LETag scriptTag, LETag languageTag, const FeatureMap *featureMap,
+-        le_int32 featureMapCount, le_bool orderFeatures)
++        LETag scriptTag, LETag languageTag, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool orderFeatures)
+     : lookupListTable(NULL), featureListTable(NULL), lookupSelectArray(NULL), lookupSelectCount(0),
+       lookupOrderArray(NULL), lookupOrderCount(0)
+ {
+@@ -309,3 +309,5 @@
+     LE_DELETE_ARRAY(lookupOrderArray);
+     LE_DELETE_ARRAY(lookupSelectArray);
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/LookupProcessor.h b/src/share/native/sun/font/layout/LookupProcessor.h
+--- jdk/src/share/native/sun/font/layout/LookupProcessor.h
++++ jdk/src/share/native/sun/font/layout/LookupProcessor.h
+@@ -25,6 +25,7 @@
+ 
+ /*
+  *
++ *
+  * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
+  *
+  */
+@@ -32,9 +33,18 @@
+ #ifndef __LOOKUPPROCESSOR_H
+ #define __LOOKUPPROCESSOR_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "LEFontInstance.h"
+ #include "OpenTypeTables.h"
++//#include "Lookups.h"
++//#include "Features.h"
++
++U_NAMESPACE_BEGIN
+ 
+ class  LEFontInstance;
+ class  LEGlyphStorage;
+@@ -46,13 +56,10 @@
+ struct LookupSubtable;
+ struct LookupTable;
+ 
+-class LookupProcessor
+-{
++class LookupProcessor : public UMemory {
+ public:
+-    le_int32 process(LEGlyphStorage &glyphStorage,
+-        GlyphPositionAdjustments *glyphPositionAdjustments,
+-        le_bool rightToLeft, const GlyphDefinitionTableHeader *glyphDefinitionTableHeader,
+-        const LEFontInstance *fontInstance) const;
++    le_int32 process(LEGlyphStorage &glyphStorage, GlyphPositionAdjustments *glyphPositionAdjustments,
++                 le_bool rightToLeft, const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, const LEFontInstance *fontInstance) const;
+ 
+     le_uint32 applyLookupTable(const LookupTable *lookupTable, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
+ 
+@@ -64,19 +71,18 @@
+     virtual ~LookupProcessor();
+ 
+ protected:
+-    LookupProcessor(const char *baseAddress,
++     LookupProcessor(const char *baseAddress,
+         Offset scriptListOffset, Offset featureListOffset, Offset lookupListOffset,
+-        LETag scriptTag, LETag languageTag, const FeatureMap *featureMap,
+-        le_int32 featureMapCount, le_bool orderFeatures);
++        LETag scriptTag, LETag languageTag, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool orderFeatures);
+ 
+-    LookupProcessor();
++   LookupProcessor();
+ 
+     le_int32 selectLookups(const FeatureTable *featureTable, FeatureMask featureMask, le_int32 order);
+ 
+     const LookupListTable   *lookupListTable;
+     const FeatureListTable  *featureListTable;
+ 
+-    FeatureMask             *lookupSelectArray;
++    FeatureMask            *lookupSelectArray;
+     le_uint32               lookupSelectCount;
+ 
+     le_uint16               *lookupOrderArray;
+@@ -88,4 +94,5 @@
+     LookupProcessor &operator=(const LookupProcessor &other); // forbid copying of this class
+ };
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/LookupTables.cpp b/src/share/native/sun/font/layout/LookupTables.cpp
+--- jdk/src/share/native/sun/font/layout/LookupTables.cpp
++++ jdk/src/share/native/sun/font/layout/LookupTables.cpp
+@@ -34,6 +34,8 @@
+ #include "LookupTables.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ /*
+     These are the rolled-up versions of the uniform binary search.
+     Someday, if we need more performance, we can un-roll them.
+@@ -104,3 +106,5 @@
+ 
+     return NULL;
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/LookupTables.h b/src/share/native/sun/font/layout/LookupTables.h
+--- jdk/src/share/native/sun/font/layout/LookupTables.h
++++ jdk/src/share/native/sun/font/layout/LookupTables.h
+@@ -32,9 +32,16 @@
+ #ifndef __LOOKUPTABLES_H
+ #define __LOOKUPTABLES_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "LayoutTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ enum LookupTableFormat
+ {
+     ltfSimpleArray      = 0,
+@@ -104,4 +111,5 @@
+     LookupValue valueArray[ANY_NUMBER];
+ };
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/Lookups.cpp b/src/share/native/sun/font/layout/Lookups.cpp
+--- jdk/src/share/native/sun/font/layout/Lookups.cpp
++++ jdk/src/share/native/sun/font/layout/Lookups.cpp
+@@ -35,6 +35,8 @@
+ #include "CoverageTables.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ const LookupTable *LookupListTable::getLookupTable(le_uint16 lookupTableIndex) const
+ {
+     if (lookupTableIndex >= SWAPW(lookupCount)) {
+@@ -63,3 +65,5 @@
+ 
+     return coverageTable->getGlyphCoverage(glyphID);
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/Lookups.h b/src/share/native/sun/font/layout/Lookups.h
+--- jdk/src/share/native/sun/font/layout/Lookups.h
++++ jdk/src/share/native/sun/font/layout/Lookups.h
+@@ -32,9 +32,16 @@
+ #ifndef __LOOKUPS_H
+ #define __LOOKUPS_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "OpenTypeTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ enum LookupFlags
+ {
+     lfBaselineIsLogicalEnd  = 0x0001,  // The MS spec. calls this flag "RightToLeft" but this name is more accurate
+@@ -79,6 +86,5 @@
+     return getGlyphCoverage(coverageTableOffset, glyphID);
+ }
+ 
+-
+-
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/MPreFixups.cpp b/src/share/native/sun/font/layout/MPreFixups.cpp
+--- jdk/src/share/native/sun/font/layout/MPreFixups.cpp
++++ jdk/src/share/native/sun/font/layout/MPreFixups.cpp
+@@ -33,6 +33,8 @@
+ #include "LEGlyphStorage.h"
+ #include "MPreFixups.h"
+ 
++U_NAMESPACE_BEGIN
++
+ struct FixupData
+ {
+     le_int32 fBaseIndex;
+@@ -92,7 +94,7 @@
+ 
+         for (i = 0; i < mpreCount; i += 1) {
+             mpreSave[i]  = glyphStorage[mpreIndex + i];
+-            indexSave[i] = glyphStorage.getCharIndex(mpreIndex + i, success);
++            indexSave[i] = glyphStorage.getCharIndex(mpreIndex + i, success); //charIndices[mpreIndex + i];
+         }
+ 
+         for (i = 0; i < moveCount; i += 1) {
+@@ -112,3 +114,5 @@
+         LE_DELETE_ARRAY(mpreSave);
+     }
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/MPreFixups.h b/src/share/native/sun/font/layout/MPreFixups.h
+--- jdk/src/share/native/sun/font/layout/MPreFixups.h
++++ jdk/src/share/native/sun/font/layout/MPreFixups.h
+@@ -32,14 +32,22 @@
+ #ifndef __MPREFIXUPS_H
+ #define __MPREFIXUPS_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ 
++U_NAMESPACE_BEGIN
++
+ class LEGlyphStorage;
+ 
+ // Might want to make this a private member...
+ struct FixupData;
+ 
+-class MPreFixups {
++class MPreFixups : public UMemory
++{
+ public:
+     MPreFixups(le_int32 charCount);
+    ~MPreFixups();
+@@ -53,4 +61,7 @@
+     le_int32   fFixupCount;
+ };
+ 
++U_NAMESPACE_END
+ #endif
++
++
+diff --git a/src/share/native/sun/font/layout/MarkArrays.cpp b/src/share/native/sun/font/layout/MarkArrays.cpp
+--- jdk/src/share/native/sun/font/layout/MarkArrays.cpp
++++ jdk/src/share/native/sun/font/layout/MarkArrays.cpp
+@@ -36,6 +36,8 @@
+ #include "MarkArrays.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ le_int32 MarkArray::getMarkClass(LEGlyphID glyphID, le_int32 coverageIndex, const LEFontInstance *fontInstance,
+                               LEPoint &anchor) const
+ {
+@@ -58,3 +60,5 @@
+ 
+     return markClass;
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/MarkArrays.h b/src/share/native/sun/font/layout/MarkArrays.h
+--- jdk/src/share/native/sun/font/layout/MarkArrays.h
++++ jdk/src/share/native/sun/font/layout/MarkArrays.h
+@@ -32,10 +32,17 @@
+ #ifndef __MARKARRAYS_H
+ #define __MARKARRAYS_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "LEFontInstance.h"
+ #include "OpenTypeTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ struct MarkRecord
+ {
+     le_uint16   markClass;
+@@ -51,4 +58,7 @@
+         LEPoint &anchor) const;
+ };
+ 
++U_NAMESPACE_END
+ #endif
++
++
+diff --git a/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp b/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp
+@@ -40,6 +40,8 @@
+ #include "GlyphIterator.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ LEGlyphID MarkToBasePositioningSubtable::findBaseGlyph(GlyphIterator *glyphIterator) const
+ {
+     if (glyphIterator->prev()) {
+@@ -106,7 +108,6 @@
+     glyphIterator->setCurrGlyphBaseOffset(baseIterator.getCurrStreamPosition());
+ 
+     if (glyphIterator->isRightToLeft()) {
+-        // dlf flip advance to local coordinate system
+         glyphIterator->setCurrGlyphPositionAdjustment(anchorDiffX, anchorDiffY, -markAdvance.fX, -markAdvance.fY);
+     } else {
+         LEPoint baseAdvance;
+@@ -114,9 +115,10 @@
+         fontInstance->getGlyphAdvance(baseGlyph, pixels);
+         fontInstance->pixelsToUnits(pixels, baseAdvance);
+ 
+-        // flip advances to local coordinate system
+         glyphIterator->setCurrGlyphPositionAdjustment(anchorDiffX - baseAdvance.fX, anchorDiffY - baseAdvance.fY, -markAdvance.fX, -markAdvance.fY);
+     }
+ 
+     return 1;
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/MarkToBasePosnSubtables.h b/src/share/native/sun/font/layout/MarkToBasePosnSubtables.h
+--- jdk/src/share/native/sun/font/layout/MarkToBasePosnSubtables.h
++++ jdk/src/share/native/sun/font/layout/MarkToBasePosnSubtables.h
+@@ -32,6 +32,11 @@
+ #ifndef __MARKTOBASEPOSITIONINGSUBTABLES_H
+ #define __MARKTOBASEPOSITIONINGSUBTABLES_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "LEFontInstance.h"
+ #include "OpenTypeTables.h"
+@@ -39,6 +44,8 @@
+ #include "AttachmentPosnSubtables.h"
+ #include "GlyphIterator.h"
+ 
++U_NAMESPACE_BEGIN
++
+ struct MarkToBasePositioningSubtable : AttachmentPositioningSubtable
+ {
+     le_int32   process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
+@@ -56,4 +63,6 @@
+     BaseRecord baseRecordArray[ANY_NUMBER];
+ };
+ 
++U_NAMESPACE_END
+ #endif
++
+diff --git a/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.cpp b/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.cpp
+@@ -39,6 +39,8 @@
+ #include "GlyphIterator.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ LEGlyphID MarkToLigaturePositioningSubtable::findLigatureGlyph(GlyphIterator *glyphIterator) const
+ {
+     if (glyphIterator->prev()) {
+@@ -117,9 +119,10 @@
+         fontInstance->getGlyphAdvance(ligatureGlyph, pixels);
+         fontInstance->pixelsToUnits(pixels, ligatureAdvance);
+ 
+-        glyphIterator->setCurrGlyphPositionAdjustment(anchorDiffX - ligatureAdvance.fX,
+-            anchorDiffY - ligatureAdvance.fY, -markAdvance.fX, -markAdvance.fY);
++        glyphIterator->setCurrGlyphPositionAdjustment(anchorDiffX - ligatureAdvance.fX, anchorDiffY - ligatureAdvance.fY, -markAdvance.fX, -markAdvance.fY);
+     }
+ 
+     return 1;
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.h b/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.h
+--- jdk/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.h
++++ jdk/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.h
+@@ -32,6 +32,11 @@
+ #ifndef __MARKTOLIGATUREPOSITIONINGSUBTABLES_H
+ #define __MARKTOLIGATUREPOSITIONINGSUBTABLES_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "LEFontInstance.h"
+ #include "OpenTypeTables.h"
+@@ -39,6 +44,8 @@
+ #include "AttachmentPosnSubtables.h"
+ #include "GlyphIterator.h"
+ 
++U_NAMESPACE_BEGIN
++
+ struct MarkToLigaturePositioningSubtable : AttachmentPositioningSubtable
+ {
+     le_int32   process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
+@@ -62,4 +69,6 @@
+     Offset ligatureAttachTableOffsetArray[ANY_NUMBER];
+ };
+ 
++U_NAMESPACE_END
+ #endif
++
+diff --git a/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.cpp b/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.cpp
+@@ -40,6 +40,8 @@
+ #include "GlyphIterator.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ LEGlyphID MarkToMarkPositioningSubtable::findMark2Glyph(GlyphIterator *glyphIterator) const
+ {
+     if (glyphIterator->findMark2Glyph()) {
+@@ -88,7 +90,7 @@
+     const AnchorTable *anchorTable = (const AnchorTable *) ((char *) mark2Array + anchorTableOffset);
+     LEPoint mark2Anchor, markAdvance, pixels;
+ 
+-    if (anchorTableOffset == 0) { // jb4729
++    if (anchorTableOffset == 0) {
+         // this seems to mean that the marks don't attach...
+         return 0;
+     }
+@@ -111,9 +113,10 @@
+         fontInstance->getGlyphAdvance(mark2Glyph, pixels);
+         fontInstance->pixelsToUnits(pixels, mark2Advance);
+ 
+-        glyphIterator->setCurrGlyphPositionAdjustment(anchorDiffX - mark2Advance.fX,
+-            anchorDiffY - mark2Advance.fY, -markAdvance.fX, -markAdvance.fY);
++        glyphIterator->setCurrGlyphPositionAdjustment(anchorDiffX - mark2Advance.fX, anchorDiffY - mark2Advance.fY, -markAdvance.fX, -markAdvance.fY);
+     }
+ 
+     return 1;
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.h b/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.h
+--- jdk/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.h
++++ jdk/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.h
+@@ -32,6 +32,11 @@
+ #ifndef __MARKTOMARKPOSITIONINGSUBTABLES_H
+ #define __MARKTOMARKPOSITIONINGSUBTABLES_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "LEFontInstance.h"
+ #include "OpenTypeTables.h"
+@@ -39,6 +44,8 @@
+ #include "AttachmentPosnSubtables.h"
+ #include "GlyphIterator.h"
+ 
++U_NAMESPACE_BEGIN
++
+ struct MarkToMarkPositioningSubtable : AttachmentPositioningSubtable
+ {
+     le_int32   process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
+@@ -56,4 +63,6 @@
+     Mark2Record mark2RecordArray[ANY_NUMBER];
+ };
+ 
++U_NAMESPACE_END
+ #endif
++
+diff --git a/src/share/native/sun/font/layout/MirroredCharData.cpp b/src/share/native/sun/font/layout/MirroredCharData.cpp
+--- jdk/src/share/native/sun/font/layout/MirroredCharData.cpp
++++ jdk/src/share/native/sun/font/layout/MirroredCharData.cpp
+@@ -36,6 +36,8 @@
+ #include "LETypes.h"
+ #include "DefaultCharMapper.h"
+ 
++U_NAMESPACE_BEGIN
++
+ const LEUnicode32 DefaultCharMapper::mirroredChars[] = {
+     0x0028, 0x0029, 0x003C, 0x003E, 0x005B, 0x005D, 0x007B, 0x007D,
+     0x00AB, 0x00BB, 0x2039, 0x203A, 0x2045, 0x2046, 0x207D, 0x207E,
+@@ -127,3 +129,5 @@
+ };
+ 
+ const le_int32 DefaultCharMapper::mirroredCharsCount = 332;
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/MorphStateTables.h b/src/share/native/sun/font/layout/MorphStateTables.h
+--- jdk/src/share/native/sun/font/layout/MorphStateTables.h
++++ jdk/src/share/native/sun/font/layout/MorphStateTables.h
+@@ -32,14 +32,22 @@
+ #ifndef __MORPHSTATETABLES_H
+ #define __MORPHSTATETABLES_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "LayoutTables.h"
+ #include "MorphTables.h"
+ #include "StateTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ struct MorphStateTableHeader : MorphSubtableHeader
+ {
+     StateTableHeader stHeader;
+ };
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/MorphTables.cpp b/src/share/native/sun/font/layout/MorphTables.cpp
+--- jdk/src/share/native/sun/font/layout/MorphTables.cpp
++++ jdk/src/share/native/sun/font/layout/MorphTables.cpp
+@@ -42,6 +42,8 @@
+ #include "LEGlyphStorage.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ void MorphTableHeader::process(LEGlyphStorage &glyphStorage) const
+ {
+     const ChainHeader *chainHeader = chains;
+@@ -114,3 +116,5 @@
+         delete processor;
+     }
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/MorphTables.h b/src/share/native/sun/font/layout/MorphTables.h
+--- jdk/src/share/native/sun/font/layout/MorphTables.h
++++ jdk/src/share/native/sun/font/layout/MorphTables.h
+@@ -32,9 +32,16 @@
+ #ifndef __MORPHTABLES_H
+ #define __MORPHTABLES_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "LayoutTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ class LEGlyphStorage;
+ 
+ typedef le_uint32 FeatureFlags;
+@@ -98,4 +105,6 @@
+     void process(LEGlyphStorage &glyphStorage) const;
+ };
+ 
++U_NAMESPACE_END
+ #endif
++
+diff --git a/src/share/native/sun/font/layout/MultipleSubstSubtables.cpp b/src/share/native/sun/font/layout/MultipleSubstSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/MultipleSubstSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/MultipleSubstSubtables.cpp
+@@ -37,6 +37,8 @@
+ #include "GlyphIterator.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ le_uint32 MultipleSubstitutionSubtable::process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const
+ {
+     LEGlyphID glyph = glyphIterator->getCurrGlyphID();
+@@ -106,3 +108,5 @@
+ 
+     return 0;
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/MultipleSubstSubtables.h b/src/share/native/sun/font/layout/MultipleSubstSubtables.h
+--- jdk/src/share/native/sun/font/layout/MultipleSubstSubtables.h
++++ jdk/src/share/native/sun/font/layout/MultipleSubstSubtables.h
+@@ -32,12 +32,19 @@
+ #ifndef __MULTIPLESUBSTITUTIONSUBTABLES_H
+ #define __MULTIPLESUBSTITUTIONSUBTABLES_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "LEGlyphFilter.h"
+ #include "OpenTypeTables.h"
+ #include "GlyphSubstitutionTables.h"
+ #include "GlyphIterator.h"
+ 
++U_NAMESPACE_BEGIN
++
+ struct SequenceTable
+ {
+     le_uint16 glyphCount;
+@@ -52,4 +59,5 @@
+     le_uint32 process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter = NULL) const;
+ };
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/NonContextualGlyphSubst.h b/src/share/native/sun/font/layout/NonContextualGlyphSubst.h
+--- jdk/src/share/native/sun/font/layout/NonContextualGlyphSubst.h
++++ jdk/src/share/native/sun/font/layout/NonContextualGlyphSubst.h
+@@ -25,6 +25,7 @@
+ 
+ /*
+  *
++ *
+  * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved
+  *
+  */
+@@ -32,14 +33,23 @@
+ #ifndef __NONCONTEXTUALGLYPHSUBSTITUTION_H
+ #define __NONCONTEXTUALGLYPHSUBSTITUTION_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "LayoutTables.h"
+ #include "LookupTables.h"
+ #include "MorphTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ struct NonContextualGlyphSubstitutionHeader : MorphSubtableHeader
+ {
+     LookupTable table;
+ };
+ 
++U_NAMESPACE_END
+ #endif
++
+diff --git a/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.cpp b/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.cpp
+--- jdk/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.cpp
++++ jdk/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.cpp
+@@ -41,6 +41,8 @@
+ #include "TrimmedArrayProcessor.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ NonContextualGlyphSubstitutionProcessor::NonContextualGlyphSubstitutionProcessor()
+ {
+ }
+@@ -79,3 +81,5 @@
+         return NULL;
+     }
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.h b/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.h
+--- jdk/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.h
++++ jdk/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.h
+@@ -32,11 +32,18 @@
+ #ifndef __NONCONTEXTUALGLYPHSUBSTITUTIONPROCESSOR_H
+ #define __NONCONTEXTUALGLYPHSUBSTITUTIONPROCESSOR_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "MorphTables.h"
+ #include "SubtableProcessor.h"
+ #include "NonContextualGlyphSubst.h"
+ 
++U_NAMESPACE_BEGIN
++
+ class LEGlyphStorage;
+ 
+ class NonContextualGlyphSubstitutionProcessor : public SubtableProcessor
+@@ -57,4 +64,5 @@
+     NonContextualGlyphSubstitutionProcessor &operator=(const NonContextualGlyphSubstitutionProcessor &other); // forbid copying of this class
+ };
+ 
++U_NAMESPACE_END
+ #endif
+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
+@@ -47,6 +47,10 @@
+ 
+ #include "GDEFMarkFilter.h"
+ 
++U_NAMESPACE_BEGIN
++
++UOBJECT_DEFINE_RTTI_IMPLEMENTATION(OpenTypeLayoutEngine)
++
+ #define ccmpFeatureTag LE_CCMP_FEATURE_TAG
+ #define ligaFeatureTag LE_LIGA_FEATURE_TAG
+ #define cligFeatureTag LE_CLIG_FEATURE_TAG
+@@ -78,7 +82,7 @@
+     {ccmpFeatureTag, ccmpFeatureMask},
+     {ligaFeatureTag, ligaFeatureMask},
+     {cligFeatureTag, cligFeatureMask},
+-    {kernFeatureTag, kernFeatureMask},
++        {kernFeatureTag, kernFeatureMask},
+     {paltFeatureTag, paltFeatureMask},
+     {markFeatureTag, markFeatureMask},
+     {mkmkFeatureTag, mkmkFeatureMask}
+@@ -86,19 +90,15 @@
+ 
+ static const le_int32 featureMapCount = LE_ARRAY_SIZE(featureMap);
+ 
+-OpenTypeLayoutEngine::OpenTypeLayoutEngine(const LEFontInstance *fontInstance,
+-    le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags,
+-    const GlyphSubstitutionTableHeader *gsubTable)
+-    : LayoutEngine(fontInstance, scriptCode, languageCode, typoFlags),
+-    fFeatureMask(minimalFeatures), fFeatureMap(featureMap),
+-    fFeatureMapCount(featureMapCount), fFeatureOrder(FALSE),
+-    fGSUBTable(gsubTable), fGDEFTable(NULL), fGPOSTable(NULL),
+-    fSubstitutionFilter(NULL)
++OpenTypeLayoutEngine::OpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
++                        le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable)
++    : LayoutEngine(fontInstance, scriptCode, languageCode, typoFlags), fFeatureMask(minimalFeatures),
++      fFeatureMap(featureMap), fFeatureMapCount(featureMapCount), fFeatureOrder(FALSE),
++      fGSUBTable(gsubTable), fGDEFTable(NULL), fGPOSTable(NULL), fSubstitutionFilter(NULL)
+ {
+     static const le_uint32 gdefTableTag = LE_GDEF_TABLE_TAG;
+     static const le_uint32 gposTableTag = LE_GPOS_TABLE_TAG;
+-    const GlyphPositioningTableHeader *gposTable =
+-        (const GlyphPositioningTableHeader *) getFontTable(gposTableTag);
++    const GlyphPositioningTableHeader *gposTable = (const GlyphPositioningTableHeader *) getFontTable(gposTableTag);
+ 
+     applyTypoFlags();
+ 
+@@ -128,11 +128,10 @@
+     LayoutEngine::reset();
+ }
+ 
+-OpenTypeLayoutEngine::OpenTypeLayoutEngine(const LEFontInstance *fontInstance,
+-    le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags)
+-    : LayoutEngine(fontInstance, scriptCode, languageCode, typoFlags),
+-    fFeatureOrder(FALSE), fGSUBTable(NULL), fGDEFTable(NULL),
+-    fGPOSTable(NULL), fSubstitutionFilter(NULL)
++OpenTypeLayoutEngine::OpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
++                                           le_int32 typoFlags)
++    : LayoutEngine(fontInstance, scriptCode, languageCode, typoFlags), fFeatureOrder(FALSE),
++      fGSUBTable(NULL), fGDEFTable(NULL), fGPOSTable(NULL), fSubstitutionFilter(NULL)
+ {
+     applyTypoFlags();
+     setScriptAndLanguageTags();
+@@ -171,9 +170,8 @@
+     fLangSysTag = getLangSysTag(fLanguageCode);
+ }
+ 
+-le_int32 OpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[],
+-    le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
+- LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success)
++le_int32 OpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
++                LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success)
+ {
+     if (LE_FAILURE(success)) {
+         return 0;
+@@ -184,8 +182,7 @@
+         return 0;
+     }
+ 
+-    le_int32 outCharCount = LayoutEngine::characterProcessing(chars, offset, count,
+-         max, rightToLeft, outChars, glyphStorage, success);
++    le_int32 outCharCount = LayoutEngine::characterProcessing(chars, offset, count, max, rightToLeft, outChars, glyphStorage, success);
+ 
+     if (LE_FAILURE(success)) {
+         return 0;
+@@ -203,16 +200,14 @@
+ 
+ // Input: characters, tags
+ // Output: glyphs, char indices
+-le_int32 OpenTypeLayoutEngine::glyphProcessing(const LEUnicode chars[], le_int32 offset,
+-    le_int32 count, le_int32 max, le_bool rightToLeft,
+-    LEGlyphStorage &glyphStorage, LEErrorCode &success)
++le_int32 OpenTypeLayoutEngine::glyphProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
++                                               LEGlyphStorage &glyphStorage, LEErrorCode &success)
+ {
+     if (LE_FAILURE(success)) {
+         return 0;
+     }
+ 
+-    if (chars == NULL || offset < 0 || count < 0 || max < 0 ||
+-         offset >= max || offset + count > max) {
++    if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || offset + count > max) {
+         success = LE_ILLEGAL_ARGUMENT_ERROR;
+         return 0;
+     }
+@@ -224,16 +219,14 @@
+     }
+ 
+     if (fGSUBTable != NULL) {
+-        count = fGSUBTable->process(glyphStorage, rightToLeft,
+-            fScriptTag, fLangSysTag, fGDEFTable, fSubstitutionFilter,
+-            fFeatureMap, fFeatureMapCount, fFeatureOrder);
++        count = fGSUBTable->process(glyphStorage, rightToLeft, fScriptTag, fLangSysTag, fGDEFTable, fSubstitutionFilter,
++                                    fFeatureMap, fFeatureMapCount, fFeatureOrder);
+     }
+ 
+     return count;
+ }
+ 
+-le_int32 OpenTypeLayoutEngine::glyphPostProcessing(LEGlyphStorage &tempGlyphStorage,
+-    LEGlyphStorage &glyphStorage, LEErrorCode &success)
++le_int32 OpenTypeLayoutEngine::glyphPostProcessing(LEGlyphStorage &tempGlyphStorage, LEGlyphStorage &glyphStorage, LEErrorCode &success)
+ {
+     if (LE_FAILURE(success)) {
+         return 0;
+@@ -247,9 +240,7 @@
+     return glyphStorage.getGlyphCount();
+ }
+ 
+-le_int32 OpenTypeLayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset,
+-    le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage,
+-    LEErrorCode &success)
++le_int32 OpenTypeLayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success)
+ {
+     LEUnicode *outChars = NULL;
+     LEGlyphStorage fakeGlyphStorage;
+@@ -259,25 +250,19 @@
+         return 0;
+     }
+ 
+-    if (chars == NULL || offset < 0 || count < 0 || max < 0 ||
+-         offset >= max || offset + count > max) {
++    if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || offset + count > max) {
+         success = LE_ILLEGAL_ARGUMENT_ERROR;
+         return 0;
+     }
+ 
+-    outCharCount = characterProcessing(chars, offset, count, max, rightToLeft,
+-        outChars, fakeGlyphStorage, success);
++    outCharCount = characterProcessing(chars, offset, count, max, rightToLeft, outChars, fakeGlyphStorage, success);
+ 
+     if (outChars != NULL) {
+-        fakeGlyphCount = glyphProcessing(outChars, 0, outCharCount, outCharCount,
+-            rightToLeft, fakeGlyphStorage, success);
+-        // FIXME: a subclass may have allocated this, in which case
+-        // this delete might not work...
+-        LE_DELETE_ARRAY(outChars);
++        fakeGlyphCount = glyphProcessing(outChars, 0, outCharCount, outCharCount, rightToLeft, fakeGlyphStorage, success);
++        LE_DELETE_ARRAY(outChars); // FIXME: a subclass may have allocated this, in which case this delete might not work...
+         //adjustGlyphs(outChars, 0, outCharCount, rightToLeft, fakeGlyphs, fakeGlyphCount);
+     } else {
+-        fakeGlyphCount = glyphProcessing(chars, offset, count, max, rightToLeft,
+-            fakeGlyphStorage, success);
++        fakeGlyphCount = glyphProcessing(chars, offset, count, max, rightToLeft, fakeGlyphStorage, success);
+         //adjustGlyphs(chars, offset, count, rightToLeft, fakeGlyphs, fakeGlyphCount);
+     }
+ 
+@@ -287,8 +272,8 @@
+ }
+ 
+ // apply GPOS table, if any
+-void OpenTypeLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset,
+-    le_int32 count, le_bool reverse,  LEGlyphStorage &glyphStorage, LEErrorCode &success)
++void OpenTypeLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse,
++                                                LEGlyphStorage &glyphStorage, LEErrorCode &success)
+ {
+     if (LE_FAILURE(success)) {
+         return;
+@@ -324,8 +309,8 @@
+         }
+ #endif
+ 
+-        fGPOSTable->process(glyphStorage, adjustments, reverse, fScriptTag, fLangSysTag,
+-            fGDEFTable, fFontInstance, fFeatureMap, fFeatureMapCount, fFeatureOrder);
++        fGPOSTable->process(glyphStorage, adjustments, reverse, fScriptTag, fLangSysTag, fGDEFTable, fFontInstance,
++                            fFeatureMap, fFeatureMapCount, fFeatureOrder);
+ 
+         float xAdjust = 0, yAdjust = 0;
+ 
+@@ -360,4 +345,12 @@
+ 
+         delete adjustments;
+     }
++
++#if 0
++    // Don't know why this is here...
++    LE_DELETE_ARRAY(fFeatureTags);
++    fFeatureTags = NULL;
++#endif
+ }
++
++U_NAMESPACE_END
+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
+@@ -23,9 +23,7 @@
+  *
+  */
+ 
+-
+ /*
+- *
+  * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
+  *
+  */
+@@ -42,6 +40,8 @@
+ #include "GlyphDefinitionTables.h"
+ #include "GlyphPositioningTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ /**
+  * OpenTypeLayoutEngine implements complex text layout for OpenType fonts - that is
+  * fonts which have GSUB and GPOS tables associated with them. In order to do this,
+@@ -87,7 +87,7 @@
+      * @internal
+      */
+     OpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                         le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable);
++                            le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable);
+ 
+     /**
+      * This constructor is used when the font requires a "canned" GSUB table which can't be known
+@@ -95,11 +95,12 @@
+      *
+      * @param fontInstance - the font
+      * @param scriptCode - the script
+-     * @param languageCode - the language
++     * @param langaugeCode - the language
+      *
+      * @internal
+      */
+-    OpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags);
++    OpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
++                         le_int32 typoFlags);
+ 
+     /**
+      * The destructor, virtual for correct polymorphic invocation.
+@@ -132,6 +133,20 @@
+      */
+     static LETag getLangSysTag(le_int32 languageCode);
+ 
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for the actual class.
++     *
++     * @stable ICU 2.8
++     */
++    virtual UClassID getDynamicClassID() const;
++
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for this class.
++     *
++     * @stable ICU 2.8
++     */
++    static UClassID getStaticClassID();
++
+ private:
+ 
+     /**
+@@ -259,9 +274,8 @@
+      *
+      * @internal
+      */
+-    virtual le_int32 characterProcessing(const LEUnicode /*chars*/[], le_int32 offset,
+-        le_int32 count, le_int32 max, le_bool /*rightToLeft*/,
+-        LEUnicode *&/*outChars*/, LEGlyphStorage &glyphStorage, LEErrorCode &success);
++    virtual le_int32 characterProcessing(const LEUnicode /*chars*/[], le_int32 offset, le_int32 count, le_int32 max, le_bool /*rightToLeft*/,
++            LEUnicode *&/*outChars*/, LEGlyphStorage &glyphStorage, LEErrorCode &success);
+ 
+     /**
+      * This method does character to glyph mapping, and applies the GSUB table. The
+@@ -292,9 +306,8 @@
+      *
+      * @internal
+      */
+-    virtual le_int32 glyphProcessing(const LEUnicode chars[], le_int32 offset,
+-        le_int32 count, le_int32 max, le_bool rightToLeft,
+-        LEGlyphStorage &glyphStorage, LEErrorCode &success);
++    virtual le_int32 glyphProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
++            LEGlyphStorage &glyphStorage, LEErrorCode &success);
+ 
+     /**
+      * This method does any processing necessary to convert "fake"
+@@ -321,8 +334,7 @@
+      *
+      * @internal
+      */
+-    virtual le_int32 glyphPostProcessing(LEGlyphStorage &tempGlyphStorage,
+-        LEGlyphStorage &glyphStorage, LEErrorCode &success);
++    virtual le_int32 glyphPostProcessing(LEGlyphStorage &tempGlyphStorage, LEGlyphStorage &glyphStorage, LEErrorCode &success);
+ 
+     /**
+      * This method applies the characterProcessing, glyphProcessing and glyphPostProcessing
+@@ -346,8 +358,7 @@
+      *
+      * @internal
+      */
+-    virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count,
+-        le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success);
++    virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success);
+ 
+     /**
+      * This method uses the GPOS table, if there is one, to adjust the glyph positions.
+@@ -364,8 +375,7 @@
+      *
+      * @internal
+      */
+-    virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count,
+-        le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success);
++    virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success);
+ 
+     /**
+      * This method frees the feature tag array so that the
+@@ -377,4 +387,6 @@
+     virtual void reset();
+ };
+ 
++U_NAMESPACE_END
+ #endif
++
+diff --git a/src/share/native/sun/font/layout/OpenTypeTables.h b/src/share/native/sun/font/layout/OpenTypeTables.h
+--- jdk/src/share/native/sun/font/layout/OpenTypeTables.h
++++ jdk/src/share/native/sun/font/layout/OpenTypeTables.h
+@@ -32,8 +32,15 @@
+ #ifndef __OPENTYPETABLES_H
+ #define __OPENTYPETABLES_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ 
++U_NAMESPACE_BEGIN
++
+ #define ANY_NUMBER 1
+ 
+ typedef le_uint16 Offset;
+@@ -62,4 +69,5 @@
+     FeatureMask mask;
+ };
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/OpenTypeUtilities.cpp b/src/share/native/sun/font/layout/OpenTypeUtilities.cpp
+--- jdk/src/share/native/sun/font/layout/OpenTypeUtilities.cpp
++++ jdk/src/share/native/sun/font/layout/OpenTypeUtilities.cpp
+@@ -34,6 +34,8 @@
+ #include "OpenTypeUtilities.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ //
+ // Finds the high bit by binary searching
+ // through the bits in n.
+@@ -192,3 +194,7 @@
+         array[i + 1] = v;
+     }
+ }
++
++
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/OpenTypeUtilities.h b/src/share/native/sun/font/layout/OpenTypeUtilities.h
+--- jdk/src/share/native/sun/font/layout/OpenTypeUtilities.h
++++ jdk/src/share/native/sun/font/layout/OpenTypeUtilities.h
+@@ -32,10 +32,17 @@
+ #ifndef __OPENTYPEUTILITIES_H
+ #define __OPENTYPEUTILITIES_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "OpenTypeTables.h"
+ 
+-class OpenTypeUtilities {
++U_NAMESPACE_BEGIN
++
++class OpenTypeUtilities /* not : public UObject because all methods are static */ {
+ public:
+     static le_int8 highBit(le_int32 value);
+     static Offset getTagOffset(LETag tag, const TagAndOffsetRecord *records, le_int32 recordCount);
+@@ -48,4 +55,5 @@
+     OpenTypeUtilities() {} // private - forbid instantiation
+ };
+ 
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/PairPositioningSubtables.cpp b/src/share/native/sun/font/layout/PairPositioningSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/PairPositioningSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/PairPositioningSubtables.cpp
+@@ -39,6 +39,8 @@
+ #include "OpenTypeUtilities.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ le_uint32 PairPositioningSubtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
+ {
+     switch(SWAPW(subtableFormat))
+@@ -82,8 +84,7 @@
+         const PairValueRecord *pairValueRecord = NULL;
+ 
+         if (pairValueCount != 0) {
+-            pairValueRecord = findPairValueRecord((TTGlyphID) LE_GET_GLYPH(secondGlyph),
+-                pairSetTable->pairValueRecordArray, pairValueCount, recordSize);
++            pairValueRecord = findPairValueRecord((TTGlyphID) LE_GET_GLYPH(secondGlyph), pairSetTable->pairValueRecordArray, pairValueCount, recordSize);
+         }
+ 
+         if (pairValueRecord == NULL) {
+@@ -91,8 +92,7 @@
+         }
+ 
+         if (valueFormat1 != 0) {
+-            pairValueRecord->valueRecord1.adjustPosition(SWAPW(valueFormat1), (char *) this,
+-                tempIterator, fontInstance);
++            pairValueRecord->valueRecord1.adjustPosition(SWAPW(valueFormat1), (char *) this, tempIterator, fontInstance);
+         }
+ 
+         if (valueFormat2 != 0) {
+@@ -171,3 +171,5 @@
+ 
+     return NULL;
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/PairPositioningSubtables.h b/src/share/native/sun/font/layout/PairPositioningSubtables.h
+--- jdk/src/share/native/sun/font/layout/PairPositioningSubtables.h
++++ jdk/src/share/native/sun/font/layout/PairPositioningSubtables.h
+@@ -32,6 +32,11 @@
+ #ifndef __PAIRPOSITIONINGSUBTABLES_H
+ #define __PAIRPOSITIONINGSUBTABLES_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "LEFontInstance.h"
+ #include "OpenTypeTables.h"
+@@ -39,6 +44,8 @@
+ #include "ValueRecords.h"
+ #include "GlyphIterator.h"
+ 
++U_NAMESPACE_BEGIN
++
+ // NOTE: ValueRecord has a variable size
+ struct PairValueRecord
+ {
+@@ -96,4 +103,7 @@
+     le_uint32  process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
+ };
+ 
++U_NAMESPACE_END
+ #endif
++
++
+diff --git a/src/share/native/sun/font/layout/ScriptAndLanguage.cpp b/src/share/native/sun/font/layout/ScriptAndLanguage.cpp
+--- jdk/src/share/native/sun/font/layout/ScriptAndLanguage.cpp
++++ jdk/src/share/native/sun/font/layout/ScriptAndLanguage.cpp
+@@ -25,6 +25,7 @@
+ 
+ /*
+  *
++ *
+  * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved
+  *
+  */
+@@ -35,6 +36,8 @@
+ #include "ScriptAndLanguage.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ const LangSysTable *ScriptTable::findLanguage(LETag languageTag, le_bool exactMatch) const
+ {
+     le_uint16 count = SWAPW(langSysCount);
+@@ -79,3 +82,5 @@
+ 
+     return scriptTable->findLanguage(languageTag, exactMatch);
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/ScriptAndLanguage.h b/src/share/native/sun/font/layout/ScriptAndLanguage.h
+--- jdk/src/share/native/sun/font/layout/ScriptAndLanguage.h
++++ jdk/src/share/native/sun/font/layout/ScriptAndLanguage.h
+@@ -32,9 +32,16 @@
+ #ifndef __SCRIPTANDLANGUAGE_H
+ #define __SCRIPTANDLANGUAGE_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "OpenTypeTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ typedef TagAndOffsetRecord LangSysRecord;
+ 
+ struct LangSysTable
+@@ -65,4 +72,6 @@
+     const LangSysTable  *findLanguage(LETag scriptTag, LETag languageTag, le_bool exactMatch = FALSE) const;
+ };
+ 
++U_NAMESPACE_END
+ #endif
++
+diff --git a/src/share/native/sun/font/layout/ScriptAndLanguageTags.cpp b/src/share/native/sun/font/layout/ScriptAndLanguageTags.cpp
+--- jdk/src/share/native/sun/font/layout/ScriptAndLanguageTags.cpp
++++ jdk/src/share/native/sun/font/layout/ScriptAndLanguageTags.cpp
+@@ -35,6 +35,8 @@
+ #include "ScriptAndLanguageTags.h"
+ #include "OpenTypeLayoutEngine.h"
+ 
++U_NAMESPACE_BEGIN
++
+ const LETag OpenTypeLayoutEngine::scriptTags[] = {
+     zyyyScriptTag, /* 'zyyy' (COMMON) */
+     qaaiScriptTag, /* 'qaai' (INHERITED) */
+@@ -125,3 +127,5 @@
+     zhsLanguageTag, /* 'ZHS' (Chinese (Simplified)) */
+     zhtLanguageTag  /* 'ZHT' (Chinese (Traditional)) */
+ };
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/ScriptAndLanguageTags.h b/src/share/native/sun/font/layout/ScriptAndLanguageTags.h
+--- jdk/src/share/native/sun/font/layout/ScriptAndLanguageTags.h
++++ jdk/src/share/native/sun/font/layout/ScriptAndLanguageTags.h
+@@ -36,6 +36,13 @@
+ 
+ #include "LETypes.h"
+ 
++U_NAMESPACE_BEGIN
++
++/**
++ * \file
++ * \internal
++ */
++
+ const LETag zyyyScriptTag = 0x7A797979; /* 'zyyy' (COMMON) */
+ const LETag qaaiScriptTag = 0x71616169; /* 'qaai' (INHERITED) */
+ const LETag arabScriptTag = 0x61726162; /* 'arab' (ARABIC) */
+@@ -126,4 +133,6 @@
+ const LETag zhsLanguageTag = 0x5A485320; /* 'ZHS' (Chinese (Simplified)) */
+ const LETag zhtLanguageTag = 0x5A485420; /* 'ZHT' (Chinese (Traditional)) */
+ 
++
++U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp b/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp
+--- jdk/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp
++++ jdk/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp
+@@ -38,6 +38,10 @@
+ #include "LEGlyphStorage.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
++UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SegmentArrayProcessor)
++
+ SegmentArrayProcessor::SegmentArrayProcessor()
+ {
+ }
+@@ -77,3 +81,5 @@
+         }
+     }
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/SegmentArrayProcessor.h b/src/share/native/sun/font/layout/SegmentArrayProcessor.h
+--- jdk/src/share/native/sun/font/layout/SegmentArrayProcessor.h
++++ jdk/src/share/native/sun/font/layout/SegmentArrayProcessor.h
+@@ -32,12 +32,19 @@
+ #ifndef __SEGMENTARRAYPROCESSOR_H
+ #define __SEGMENTARRAYPROCESSOR_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "MorphTables.h"
+ #include "SubtableProcessor.h"
+ #include "NonContextualGlyphSubst.h"
+ #include "NonContextualGlyphSubstProc.h"
+ 
++U_NAMESPACE_BEGIN
++
+ class LEGlyphStorage;
+ 
+ class SegmentArrayProcessor : public NonContextualGlyphSubstitutionProcessor
+@@ -49,11 +56,28 @@
+ 
+     virtual ~SegmentArrayProcessor();
+ 
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for the actual class.
++     *
++     * @stable ICU 2.8
++     */
++    virtual UClassID getDynamicClassID() const;
++
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for this class.
++     *
++     * @stable ICU 2.8
++     */
++    static UClassID getStaticClassID();
++
+ private:
+     SegmentArrayProcessor();
+ 
+ protected:
+     const SegmentArrayLookupTable *segmentArrayLookupTable;
++
+ };
+ 
++U_NAMESPACE_END
+ #endif
++
+diff --git a/src/share/native/sun/font/layout/SegmentSingleProcessor.cpp b/src/share/native/sun/font/layout/SegmentSingleProcessor.cpp
+--- jdk/src/share/native/sun/font/layout/SegmentSingleProcessor.cpp
++++ jdk/src/share/native/sun/font/layout/SegmentSingleProcessor.cpp
+@@ -38,6 +38,10 @@
+ #include "LEGlyphStorage.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
++UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SegmentSingleProcessor)
++
+ SegmentSingleProcessor::SegmentSingleProcessor()
+ {
+ }
+@@ -71,3 +75,5 @@
+         }
+     }
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/SegmentSingleProcessor.h b/src/share/native/sun/font/layout/SegmentSingleProcessor.h
+--- jdk/src/share/native/sun/font/layout/SegmentSingleProcessor.h
++++ jdk/src/share/native/sun/font/layout/SegmentSingleProcessor.h
+@@ -32,12 +32,19 @@
+ #ifndef __SEGMENTSINGLEPROCESSOR_H
+ #define __SEGMENTSINGLEPROCESSOR_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "MorphTables.h"
+ #include "SubtableProcessor.h"
+ #include "NonContextualGlyphSubst.h"
+ #include "NonContextualGlyphSubstProc.h"
+ 
++U_NAMESPACE_BEGIN
++
+ class LEGlyphStorage;
+ 
+ class SegmentSingleProcessor : public NonContextualGlyphSubstitutionProcessor
+@@ -49,11 +56,28 @@
+ 
+     virtual ~SegmentSingleProcessor();
+ 
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for the actual class.
++     *
++     * @stable ICU 2.8
++     */
++    virtual UClassID getDynamicClassID() const;
++
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for this class.
++     *
++     * @stable ICU 2.8
++     */
++    static UClassID getStaticClassID();
++
+ private:
+     SegmentSingleProcessor();
+ 
+ protected:
+     const SegmentSingleLookupTable *segmentSingleLookupTable;
++
+ };
+ 
++U_NAMESPACE_END
+ #endif
++
+diff --git a/src/share/native/sun/font/layout/ShapingTypeData.cpp b/src/share/native/sun/font/layout/ShapingTypeData.cpp
+--- jdk/src/share/native/sun/font/layout/ShapingTypeData.cpp
++++ jdk/src/share/native/sun/font/layout/ShapingTypeData.cpp
+@@ -36,6 +36,8 @@
+ #include "LETypes.h"
+ #include "ArabicShaping.h"
+ 
++U_NAMESPACE_BEGIN
++
+ const le_uint8 ArabicShaping::shapingTypeTable[] = {
+     0x00, 0x02, 0x00, 0xAD, 0x00, 0xAD, 0x00, 0xAD, 0x00, 0x05, 0x03, 0x00, 0x03, 0x6F, 0x00, 0x05,
+     0x04, 0x83, 0x04, 0x86, 0x00, 0x05, 0x04, 0x88, 0x04, 0x89, 0x00, 0x05, 0x05, 0x91, 0x05, 0xB9,
+@@ -104,3 +106,5 @@
+     0xFE, 0x20, 0xFE, 0x23, 0x00, 0x05, 0xFE, 0xFF, 0xFE, 0xFF, 0x00, 0x05, 0xFF, 0xF9, 0xFF, 0xFB,
+     0x00, 0x05
+ };
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/SimpleArrayProcessor.cpp b/src/share/native/sun/font/layout/SimpleArrayProcessor.cpp
+--- jdk/src/share/native/sun/font/layout/SimpleArrayProcessor.cpp
++++ jdk/src/share/native/sun/font/layout/SimpleArrayProcessor.cpp
+@@ -38,6 +38,10 @@
+ #include "LEGlyphStorage.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
++UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SimpleArrayProcessor)
++
+ SimpleArrayProcessor::SimpleArrayProcessor()
+ {
+ }
+@@ -68,3 +72,5 @@
+         }
+     }
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/SimpleArrayProcessor.h b/src/share/native/sun/font/layout/SimpleArrayProcessor.h
+--- jdk/src/share/native/sun/font/layout/SimpleArrayProcessor.h
++++ jdk/src/share/native/sun/font/layout/SimpleArrayProcessor.h
+@@ -32,12 +32,19 @@
+ #ifndef __SIMPLEARRAYPROCESSOR_H
+ #define __SIMPLEARRAYPROCESSOR_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "MorphTables.h"
+ #include "SubtableProcessor.h"
+ #include "NonContextualGlyphSubst.h"
+ #include "NonContextualGlyphSubstProc.h"
+ 
++U_NAMESPACE_BEGIN
++
+ class LEGlyphStorage;
+ 
+ class SimpleArrayProcessor : public NonContextualGlyphSubstitutionProcessor
+@@ -49,11 +56,28 @@
+ 
+     virtual ~SimpleArrayProcessor();
+ 
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for the actual class.
++     *
++     * @stable ICU 2.8
++     */
++    virtual UClassID getDynamicClassID() const;
++
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for this class.
++     *
++     * @stable ICU 2.8
++     */
++    static UClassID getStaticClassID();
++
+ private:
+     SimpleArrayProcessor();
+ 
+ protected:
+     const SimpleArrayLookupTable *simpleArrayLookupTable;
++
+ };
+ 
++U_NAMESPACE_END
+ #endif
++
+diff --git a/src/share/native/sun/font/layout/SinglePositioningSubtables.cpp b/src/share/native/sun/font/layout/SinglePositioningSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/SinglePositioningSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/SinglePositioningSubtables.cpp
+@@ -38,6 +38,8 @@
+ #include "GlyphIterator.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ le_uint32 SinglePositioningSubtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
+ {
+     switch(SWAPW(subtableFormat))
+@@ -84,11 +86,12 @@
+     le_int16 coverageIndex = (le_int16) getGlyphCoverage(glyph);
+ 
+     if (coverageIndex >= 0) {
+-        valueRecordArray[0].adjustPosition(coverageIndex, SWAPW(valueFormat), (const char *) this,
+-            *glyphIterator, fontInstance);
++        valueRecordArray[0].adjustPosition(coverageIndex, SWAPW(valueFormat), (const char *) this, *glyphIterator, fontInstance);
+ 
+         return 1;
+     }
+ 
+     return 0;
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/SinglePositioningSubtables.h b/src/share/native/sun/font/layout/SinglePositioningSubtables.h
+--- jdk/src/share/native/sun/font/layout/SinglePositioningSubtables.h
++++ jdk/src/share/native/sun/font/layout/SinglePositioningSubtables.h
+@@ -32,6 +32,11 @@
+ #ifndef __SINGLEPOSITIONINGSUBTABLES_H
+ #define __SINGLEPOSITIONINGSUBTABLES_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "LEFontInstance.h"
+ #include "OpenTypeTables.h"
+@@ -39,6 +44,8 @@
+ #include "ValueRecords.h"
+ #include "GlyphIterator.h"
+ 
++U_NAMESPACE_BEGIN
++
+ struct SinglePositioningSubtable : GlyphPositioningSubtable
+ {
+     le_uint32  process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
+@@ -61,4 +68,7 @@
+     le_uint32  process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
+ };
+ 
++U_NAMESPACE_END
+ #endif
++
++
+diff --git a/src/share/native/sun/font/layout/SingleSubstitutionSubtables.cpp b/src/share/native/sun/font/layout/SingleSubstitutionSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/SingleSubstitutionSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/SingleSubstitutionSubtables.cpp
+@@ -37,6 +37,8 @@
+ #include "GlyphIterator.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ le_uint32 SingleSubstitutionSubtable::process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const
+ {
+     switch(SWAPW(subtableFormat))
+@@ -98,3 +100,5 @@
+ 
+     return 0;
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/SingleSubstitutionSubtables.h b/src/share/native/sun/font/layout/SingleSubstitutionSubtables.h
+--- jdk/src/share/native/sun/font/layout/SingleSubstitutionSubtables.h
++++ jdk/src/share/native/sun/font/layout/SingleSubstitutionSubtables.h
+@@ -32,12 +32,19 @@
+ #ifndef __SINGLESUBSTITUTIONSUBTABLES_H
+ #define __SINGLESUBSTITUTIONSUBTABLES_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "LEGlyphFilter.h"
+ #include "OpenTypeTables.h"
+ #include "GlyphSubstitutionTables.h"
+ #include "GlyphIterator.h"
+ 
++U_NAMESPACE_BEGIN
++
+ struct SingleSubstitutionSubtable : GlyphSubstitutionSubtable
+ {
+     le_uint32  process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter = NULL) const;
+@@ -58,4 +65,7 @@
+     le_uint32  process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter = NULL) const;
+ };
+ 
++U_NAMESPACE_END
+ #endif
++
++
+diff --git a/src/share/native/sun/font/layout/SingleTableProcessor.cpp b/src/share/native/sun/font/layout/SingleTableProcessor.cpp
+--- jdk/src/share/native/sun/font/layout/SingleTableProcessor.cpp
++++ jdk/src/share/native/sun/font/layout/SingleTableProcessor.cpp
+@@ -38,6 +38,10 @@
+ #include "LEGlyphStorage.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
++UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SingleTableProcessor)
++
+ SingleTableProcessor::SingleTableProcessor()
+ {
+ }
+@@ -68,3 +72,5 @@
+         }
+     }
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/SingleTableProcessor.h b/src/share/native/sun/font/layout/SingleTableProcessor.h
+--- jdk/src/share/native/sun/font/layout/SingleTableProcessor.h
++++ jdk/src/share/native/sun/font/layout/SingleTableProcessor.h
+@@ -32,12 +32,19 @@
+ #ifndef __SINGLETABLEPROCESSOR_H
+ #define __SINGLETABLEPROCESSOR_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "MorphTables.h"
+ #include "SubtableProcessor.h"
+ #include "NonContextualGlyphSubst.h"
+ #include "NonContextualGlyphSubstProc.h"
+ 
++U_NAMESPACE_BEGIN
++
+ class LEGlyphStorage;
+ 
+ class SingleTableProcessor : public NonContextualGlyphSubstitutionProcessor
+@@ -49,11 +56,27 @@
+ 
+     virtual ~SingleTableProcessor();
+ 
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for the actual class.
++     *
++     * @stable ICU 2.8
++     */
++    virtual UClassID getDynamicClassID() const;
++
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for this class.
++     *
++     * @stable ICU 2.8
++     */
++    static UClassID getStaticClassID();
++
+ private:
+     SingleTableProcessor();
+ 
+ protected:
+     const SingleTableLookupTable *singleTableLookupTable;
++
+ };
+ 
++U_NAMESPACE_END
+ #endif
+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
+@@ -38,6 +38,8 @@
+ #include "LEGlyphStorage.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ StateTableProcessor::StateTableProcessor()
+ {
+ }
+@@ -101,3 +103,5 @@
+ 
+     endStateTable();
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/StateTableProcessor.h b/src/share/native/sun/font/layout/StateTableProcessor.h
+--- jdk/src/share/native/sun/font/layout/StateTableProcessor.h
++++ jdk/src/share/native/sun/font/layout/StateTableProcessor.h
+@@ -32,11 +32,18 @@
+ #ifndef __STATETABLEPROCESSOR_H
+ #define __STATETABLEPROCESSOR_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "MorphTables.h"
+ #include "MorphStateTables.h"
+ #include "SubtableProcessor.h"
+ 
++U_NAMESPACE_BEGIN
++
+ class LEGlyphStorage;
+ 
+ class StateTableProcessor : public SubtableProcessor
+@@ -72,4 +79,5 @@
+     StateTableProcessor &operator=(const StateTableProcessor &other); // forbid copying of this class
+ };
+ 
++U_NAMESPACE_END
+ #endif
+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
+@@ -32,6 +32,11 @@
+ #ifndef __STATETABLES_H
+ #define __STATETABLES_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "LayoutTables.h"
+ 
+@@ -70,6 +75,8 @@
+ #define LE_STATE_PATIENCE_INCR(x)    if((x)!=le_patience_curr) ++le_patience_count;
+ 
+ 
++U_NAMESPACE_BEGIN
++
+ struct StateTableHeader
+ {
+     le_int16 stateSize;
+@@ -113,4 +120,6 @@
+     le_int16    flags;
+ };
+ 
++U_NAMESPACE_END
+ #endif
++
+diff --git a/src/share/native/sun/font/layout/SubstitutionLookups.cpp b/src/share/native/sun/font/layout/SubstitutionLookups.cpp
+--- jdk/src/share/native/sun/font/layout/SubstitutionLookups.cpp
++++ jdk/src/share/native/sun/font/layout/SubstitutionLookups.cpp
+@@ -39,6 +39,8 @@
+ #include "CoverageTables.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ /*
+     NOTE: This could be optimized somewhat by keeping track
+     of the previous sequenceIndex in the loop and doing next()
+@@ -65,3 +67,5 @@
+         lookupProcessor->applySingleLookup(lookupListIndex, &tempIterator, fontInstance);
+     }
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/SubstitutionLookups.h b/src/share/native/sun/font/layout/SubstitutionLookups.h
+--- jdk/src/share/native/sun/font/layout/SubstitutionLookups.h
++++ jdk/src/share/native/sun/font/layout/SubstitutionLookups.h
+@@ -32,6 +32,11 @@
+ #ifndef __SUBSTITUTIONLOOKUPS_H
+ #define __SUBSTITUTIONLOOKUPS_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "LEFontInstance.h"
+ #include "OpenTypeTables.h"
+@@ -39,6 +44,8 @@
+ #include "GlyphIterator.h"
+ #include "LookupProcessor.h"
+ 
++U_NAMESPACE_BEGIN
++
+ struct SubstitutionLookupRecord
+ {
+     le_uint16  sequenceIndex;
+@@ -56,4 +63,6 @@
+         le_int32 position);
+ };
+ 
++U_NAMESPACE_END
+ #endif
++
+diff --git a/src/share/native/sun/font/layout/SubtableProcessor.cpp b/src/share/native/sun/font/layout/SubtableProcessor.cpp
+--- jdk/src/share/native/sun/font/layout/SubtableProcessor.cpp
++++ jdk/src/share/native/sun/font/layout/SubtableProcessor.cpp
+@@ -34,6 +34,8 @@
+ #include "SubtableProcessor.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ SubtableProcessor::SubtableProcessor()
+ {
+ }
+@@ -50,3 +52,5 @@
+ SubtableProcessor::~SubtableProcessor()
+ {
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/SubtableProcessor.h b/src/share/native/sun/font/layout/SubtableProcessor.h
+--- jdk/src/share/native/sun/font/layout/SubtableProcessor.h
++++ jdk/src/share/native/sun/font/layout/SubtableProcessor.h
+@@ -32,13 +32,19 @@
+ #ifndef __SUBTABLEPROCESSOR_H
+ #define __SUBTABLEPROCESSOR_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "MorphTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ class LEGlyphStorage;
+ 
+-class SubtableProcessor
+-{
++class SubtableProcessor : public UMemory {
+ public:
+     virtual void process(LEGlyphStorage &glyphStorage) = 0;
+     virtual ~SubtableProcessor();
+@@ -60,4 +66,6 @@
+     SubtableProcessor &operator=(const SubtableProcessor &other); // forbid copying of this class
+ };
+ 
++U_NAMESPACE_END
+ #endif
++
+diff --git a/src/share/native/sun/font/layout/ThaiLayoutEngine.cpp b/src/share/native/sun/font/layout/ThaiLayoutEngine.cpp
+--- jdk/src/share/native/sun/font/layout/ThaiLayoutEngine.cpp
++++ jdk/src/share/native/sun/font/layout/ThaiLayoutEngine.cpp
+@@ -38,8 +38,11 @@
+ 
+ #include "ThaiShaping.h"
+ 
+-ThaiLayoutEngine::ThaiLayoutEngine(const LEFontInstance *fontInstance,
+-    le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags)
++U_NAMESPACE_BEGIN
++
++UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ThaiLayoutEngine)
++
++ThaiLayoutEngine::ThaiLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags)
+     : LayoutEngine(fontInstance, scriptCode, languageCode, typoFlags)
+ {
+     fErrorChar = 0x25CC;
+@@ -73,16 +76,13 @@
+ // Output: glyphs, char indices
+ // Returns: the glyph count
+ // NOTE: this assumes that ThaiShaping::compose will allocate the outChars array...
+-le_int32 ThaiLayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset,
+-    le_int32 count, le_int32 max, le_bool /*rightToLeft*/,
+-    LEGlyphStorage &glyphStorage, LEErrorCode &success)
++le_int32 ThaiLayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool /*rightToLeft*/, LEGlyphStorage &glyphStorage, LEErrorCode &success)
+ {
+     if (LE_FAILURE(success)) {
+         return 0;
+     }
+ 
+-    if (chars == NULL || offset < 0 || count < 0 || max < 0 ||
+-        offset >= max || offset + count > max) {
++    if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || offset + count > max) {
+         success = LE_ILLEGAL_ARGUMENT_ERROR;
+         return 0;
+     }
+@@ -107,8 +107,7 @@
+         return 0;
+     }
+ 
+-    glyphCount = ThaiShaping::compose(chars, offset, count, fGlyphSet, fErrorChar,
+-        outChars, glyphStorage);
++    glyphCount = ThaiShaping::compose(chars, offset, count, fGlyphSet, fErrorChar, outChars, glyphStorage);
+     mapCharsToGlyphs(outChars, 0, glyphCount, FALSE, FALSE, glyphStorage, success);
+ 
+     LE_DELETE_ARRAY(outChars);
+@@ -116,3 +115,5 @@
+     glyphStorage.adoptGlyphCount(glyphCount);
+     return glyphCount;
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/ThaiLayoutEngine.h b/src/share/native/sun/font/layout/ThaiLayoutEngine.h
+--- jdk/src/share/native/sun/font/layout/ThaiLayoutEngine.h
++++ jdk/src/share/native/sun/font/layout/ThaiLayoutEngine.h
+@@ -39,6 +39,8 @@
+ 
+ #include "ThaiShaping.h"
+ 
++U_NAMESPACE_BEGIN
++
+ class LEGlyphStorage;
+ 
+ /**
+@@ -66,8 +68,7 @@
+      *
+      * @internal
+      */
+-    ThaiLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode,
+-        le_int32 languageCode, le_int32 typoFlags);
++    ThaiLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags);
+ 
+     /**
+      * The destructor, virtual for correct polymorphic invocation.
+@@ -76,6 +77,20 @@
+      */
+     virtual ~ThaiLayoutEngine();
+ 
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for the actual class.
++     *
++     * @stable ICU 2.8
++     */
++    virtual UClassID getDynamicClassID() const;
++
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for this class.
++     *
++     * @stable ICU 2.8
++     */
++    static UClassID getStaticClassID();
++
+ protected:
+     /**
+      * A small integer indicating which Thai encoding
+@@ -109,10 +124,8 @@
+      * @param offset - the index of the first character to process
+      * @param count - the number of characters to process
+      * @param max - the number of characters in the input context
+-     * @param rightToLeft - <code>TRUE</code> if the text is in a
+-     *    right to left directional run
+-     * @param glyphStorage - the glyph storage object. The glyph and
+-     *    char index arrays will be set.
++     * @param rightToLeft - <code>TRUE</code> if the text is in a right to left directional run
++     * @param glyphStorage - the glyph storage object. The glyph and char index arrays will be set.
+      *
+      * Output parameters:
+      * @param success - set to an error code if the operation fails
+@@ -123,10 +136,11 @@
+      *
+      * @internal
+      */
+-    virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset,
+-        le_int32 count, le_int32 max, le_bool rightToLeft,
++    virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
+         LEGlyphStorage &glyphStorage, LEErrorCode &success);
+ 
+ };
+ 
++U_NAMESPACE_END
+ #endif
++
+diff --git a/src/share/native/sun/font/layout/ThaiShaping.cpp b/src/share/native/sun/font/layout/ThaiShaping.cpp
+--- jdk/src/share/native/sun/font/layout/ThaiShaping.cpp
++++ jdk/src/share/native/sun/font/layout/ThaiShaping.cpp
+@@ -35,6 +35,8 @@
+ #include "LEGlyphStorage.h"
+ #include "ThaiShaping.h"
+ 
++U_NAMESPACE_BEGIN
++
+ enum {
+     CH_SPACE        = 0x0020,
+     CH_YAMAKKAN     = 0x0E4E,
+@@ -248,9 +250,8 @@
+      return transition.nextState;
+ }
+ 
+-le_uint8 ThaiShaping::getNextState(LEUnicode ch, le_uint8 prevState, le_int32 inputIndex,
+-    le_uint8 glyphSet, LEUnicode errorChar,
+-    le_uint8 &charClass, LEUnicode *output, LEGlyphStorage &glyphStorage, le_int32 &outputIndex)
++le_uint8 ThaiShaping::getNextState(LEUnicode ch, le_uint8 prevState, le_int32 inputIndex, le_uint8 glyphSet, LEUnicode errorChar,
++                              le_uint8 &charClass, LEUnicode *output, LEGlyphStorage &glyphStorage, le_int32 &outputIndex)
+ {
+     StateTransition transition;
+ 
+@@ -327,3 +328,5 @@
+ 
+     return outputIndex;
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/ThaiShaping.h b/src/share/native/sun/font/layout/ThaiShaping.h
+--- jdk/src/share/native/sun/font/layout/ThaiShaping.h
++++ jdk/src/share/native/sun/font/layout/ThaiShaping.h
+@@ -32,13 +32,20 @@
+ #ifndef __THAISHAPING_H
+ #define __THAISHAPING_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "LEGlyphFilter.h"
+ #include "OpenTypeTables.h"
+ 
++U_NAMESPACE_BEGIN
++
+ class LEGlyphStorage;
+ 
+-class ThaiShaping {
++class ThaiShaping /* not : public UObject because all methods are static */ {
+ public:
+ 
+     enum {
+@@ -120,4 +127,7 @@
+     return thaiStateTable[state][currClass];
+ }
+ 
++U_NAMESPACE_END
+ #endif
++
++
+diff --git a/src/share/native/sun/font/layout/ThaiStateTables.cpp b/src/share/native/sun/font/layout/ThaiStateTables.cpp
+--- jdk/src/share/native/sun/font/layout/ThaiStateTables.cpp
++++ jdk/src/share/native/sun/font/layout/ThaiStateTables.cpp
+@@ -25,6 +25,7 @@
+ 
+ /*
+  *
++ *
+  * (C) Copyright IBM Corp. 1999-2003 - All Rights Reserved
+  *
+  * WARNING: THIS FILE IS MACHINE GENERATED. DO NOT HAND EDIT IT UNLESS
+@@ -35,6 +36,8 @@
+ #include "LETypes.h"
+ #include "ThaiShaping.h"
+ 
++U_NAMESPACE_BEGIN
++
+ const le_uint8 ThaiShaping::classTable[] = {
+     //       0    1    2    3    4    5    6    7    8    9    A    B    C    D    E    F
+     //       -------------------------------------------------------------------------------
+@@ -105,3 +108,5 @@
+     /*50*/ {{ 0, tA}, { 1, tA}, {18, tA}, {35, tA}, { 0, tA}, { 0, tS}, { 0, tS}, { 0, tA}, { 0, tR}, { 0, tR}, { 0, tR}, {51, tC}, { 0, tR}, { 0, tC}, { 0, tR}, { 0, tR}, { 0, tR}, { 0, tR}, { 0, tR}},
+     /*51*/ {{ 0, tA}, { 1, tA}, {18, tA}, {35, tA}, { 0, tA}, { 0, tS}, { 0, tA}, { 0, tA}, { 0, tR}, { 0, tR}, { 0, tR}, { 0, tR}, { 0, tR}, { 0, tR}, { 0, tR}, { 0, tR}, { 0, tR}, { 0, tR}, { 0, tR}}
+ };
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/TrimmedArrayProcessor.cpp b/src/share/native/sun/font/layout/TrimmedArrayProcessor.cpp
+--- jdk/src/share/native/sun/font/layout/TrimmedArrayProcessor.cpp
++++ jdk/src/share/native/sun/font/layout/TrimmedArrayProcessor.cpp
+@@ -38,6 +38,10 @@
+ #include "LEGlyphStorage.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
++UOBJECT_DEFINE_RTTI_IMPLEMENTATION(TrimmedArrayProcessor)
++
+ TrimmedArrayProcessor::TrimmedArrayProcessor()
+ {
+ }
+@@ -72,3 +76,5 @@
+         }
+     }
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/TrimmedArrayProcessor.h b/src/share/native/sun/font/layout/TrimmedArrayProcessor.h
+--- jdk/src/share/native/sun/font/layout/TrimmedArrayProcessor.h
++++ jdk/src/share/native/sun/font/layout/TrimmedArrayProcessor.h
+@@ -32,12 +32,19 @@
+ #ifndef __TRIMMEDARRAYPROCESSOR_H
+ #define __TRIMMEDARRAYPROCESSOR_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "MorphTables.h"
+ #include "SubtableProcessor.h"
+ #include "NonContextualGlyphSubst.h"
+ #include "NonContextualGlyphSubstProc.h"
+ 
++U_NAMESPACE_BEGIN
++
+ class LEGlyphStorage;
+ 
+ class TrimmedArrayProcessor : public NonContextualGlyphSubstitutionProcessor
+@@ -49,6 +56,20 @@
+ 
+     virtual ~TrimmedArrayProcessor();
+ 
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for the actual class.
++     *
++     * @stable ICU 2.8
++     */
++    virtual UClassID getDynamicClassID() const;
++
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for this class.
++     *
++     * @stable ICU 2.8
++     */
++    static UClassID getStaticClassID();
++
+ private:
+     TrimmedArrayProcessor();
+ 
+@@ -56,6 +77,9 @@
+     TTGlyphID firstGlyph;
+     TTGlyphID lastGlyph;
+     const TrimmedArrayLookupTable *trimmedArrayLookupTable;
++
+ };
+ 
++U_NAMESPACE_END
+ #endif
++
+diff --git a/src/share/native/sun/font/layout/ValueRecords.cpp b/src/share/native/sun/font/layout/ValueRecords.cpp
+--- jdk/src/share/native/sun/font/layout/ValueRecords.cpp
++++ jdk/src/share/native/sun/font/layout/ValueRecords.cpp
+@@ -37,6 +37,8 @@
+ #include "GlyphIterator.h"
+ #include "LESwaps.h"
+ 
++U_NAMESPACE_BEGIN
++
+ #define Nibble(value, nibble) ((value >> (nibble * 4)) & 0xF)
+ #define NibbleBits(value, nibble) (bitsInNibble[Nibble(value, nibble)])
+ 
+@@ -161,8 +163,8 @@
+         xPlacementAdjustment, yPlacementAdjustment, xAdvanceAdjustment, yAdvanceAdjustment);
+ }
+ 
+-void ValueRecord::adjustPosition(le_int16 index, ValueFormat valueFormat, const char *base,
+-    GlyphIterator &glyphIterator, const LEFontInstance *fontInstance) const
++void ValueRecord::adjustPosition(le_int16 index, ValueFormat valueFormat, const char *base, GlyphIterator &glyphIterator,
++                                 const LEFontInstance *fontInstance) const
+ {
+     float xPlacementAdjustment = 0;
+     float yPlacementAdjustment = 0;
+@@ -323,3 +325,5 @@
+ 
+     return getFieldCount(valueFormat & beforeMasks[field]);
+ }
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/ValueRecords.h b/src/share/native/sun/font/layout/ValueRecords.h
+--- jdk/src/share/native/sun/font/layout/ValueRecords.h
++++ jdk/src/share/native/sun/font/layout/ValueRecords.h
+@@ -32,11 +32,18 @@
+ #ifndef __VALUERECORDS_H
+ #define __VALUERECORDS_H
+ 
++/**
++ * \file
++ * \internal
++ */
++
+ #include "LETypes.h"
+ #include "LEFontInstance.h"
+ #include "OpenTypeTables.h"
+ #include "GlyphIterator.h"
+ 
++U_NAMESPACE_BEGIN
++
+ typedef le_uint16 ValueFormat;
+ typedef le_int16 ValueRecordField;
+ 
+@@ -84,5 +91,7 @@
+     vfbAnyDevice    = vfbXPlaDevice + vfbYPlaDevice + vfbXAdvDevice + vfbYAdvDevice
+ };
+ 
++U_NAMESPACE_END
++#endif
+ 
+-#endif
++

Added: trunk/java/openjdk6/files/icedtea/openjdk/6669869-queries_per_appcontext.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/openjdk/6669869-queries_per_appcontext.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/openjdk/6669869-queries_per_appcontext.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,355 @@
+# 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");
++        }
++    }
++}

Added: trunk/java/openjdk6/files/icedtea/openjdk/6786028-wcag_bold_tags.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/openjdk/6786028-wcag_bold_tags.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/openjdk/6786028-wcag_bold_tags.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,2923 @@
+# HG changeset patch
+# User bpatel
+# Date 1231460819 28800
+# Node ID a50f3556d6954decf0897aa984c8ba43def77b9e
+# Parent  4ab5d66aaf2b9e5c09ab54748f6e2615b7818b12
+6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
+Reviewed-by: jjg
+
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java
+@@ -71,7 +71,7 @@
+             member.position().line() != classdoc.position().line()) {
+             writer.printSrcLink(member, member.name());
+         } else {
+-            bold(member.name());
++            strong(member.name());
+         }
+         writeParameters(member);
+         writeExceptions(member);
+@@ -87,10 +87,10 @@
+     protected void writeSummaryLink(int context, ClassDoc cd, ProgramElementDoc member) {
+         ExecutableMemberDoc emd = (ExecutableMemberDoc)member;
+         String name = emd.name();
+-        writer.bold();
++        writer.strong();
+         writer.printDocLink(context, cd, (MemberDoc) emd,
+             name, false);
+-        writer.boldEnd();
++        writer.strongEnd();
+         writer.displayLength = name.length();
+         writeParameters(emd, false);
+     }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java
+@@ -78,12 +78,12 @@
+     }
+ 
+     /**
+-     * Print the text "Index" in bold format in the navigation bar.
++     * Print the text "Index" in strong format in the navigation bar.
+      */
+     protected void navLinkIndex() {
+         navCellRevStart();
+         fontStyle("NavBarFont1Rev");
+-        boldText("doclet.Index");
++        strongText("doclet.Index");
+         fontEnd();
+         navCellEnd();
+     }
+@@ -98,7 +98,7 @@
+     protected void generateContents(Character unicode, List memberlist) {
+         anchor("_" + unicode + "_");
+         h2();
+-        bold(unicode.toString());
++        strong(unicode.toString());
+         h2End();
+         dl();
+         for (int i = 0; i < memberlist.size(); i++) {
+@@ -195,14 +195,14 @@
+     protected void printComment(ProgramElementDoc element) {
+         Tag[] tags;
+         if (Util.isDeprecated(element)) {
+-            boldText("doclet.Deprecated"); space();
++            strongText("doclet.Deprecated"); space();
+             if ((tags = element.tags("deprecated")).length > 0)
+                 printInlineDeprecatedComment(element, tags[0]);
+         } else {
+             ClassDoc cont = element.containingClass();
+             while (cont != null) {
+                 if (Util.isDeprecated(cont)) {
+-                    boldText("doclet.Deprecated"); space();
++                    strongText("doclet.Deprecated"); space();
+                     break;
+                 }
+                 cont = cont.containingClass();
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java
+@@ -98,8 +98,8 @@
+         writer.displayLength++;
+     }
+ 
+-    protected void bold(String str) {
+-        writer.bold(str);
++    protected void strong(String str) {
++        writer.strong(str);
+         writer.displayLength += str.length();
+     }
+ 
+@@ -321,7 +321,7 @@
+         if (deprmembers.size() > 0) {
+             writer.tableIndexSummary();
+             writer.tableHeaderStart("#CCCCFF");
+-            writer.boldText(headingKey);
++            writer.strongText(headingKey);
+             writer.tableHeaderEnd();
+             for (int i = 0; i < deprmembers.size(); i++) {
+                 ProgramElementDoc member =(ProgramElementDoc)deprmembers.get(i);
+@@ -363,7 +363,7 @@
+                 if (cd != null && !(pgmdoc instanceof ConstructorDoc)
+                                && !(pgmdoc instanceof ClassDoc)) {
+                     // Add class context
+-                    writer.bold(cd.name() + ".");
++                    writer.strong(cd.name() + ".");
+                 }
+                 writeSummaryLink(
+                     pgmdoc instanceof ClassDoc ?
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java
+@@ -137,13 +137,13 @@
+     }
+ 
+     /**
+-     * Highlight "Overview" in the bold format, in the navigation bar as this
++     * Highlight "Overview" in the strong format, in the navigation bar as this
+      * is the overview page.
+      */
+     protected void navLinkContents() {
+         navCellRevStart();
+         fontStyle("NavBarFont1Rev");
+-        boldText("doclet.Overview");
++        strongText("doclet.Overview");
+         fontEnd();
+         navCellEnd();
+     }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java
+@@ -173,7 +173,7 @@
+      */
+     protected void printPartialInfo(ClassDoc cd) {
+         li("circle");
+-        printPreQualifiedBoldClassLink(LinkInfoImpl.CONTEXT_TREE, cd);
++        printPreQualifiedStrongClassLink(LinkInfoImpl.CONTEXT_TREE, cd);
+     }
+ 
+     /**
+@@ -193,7 +193,7 @@
+     protected void navLinkTree() {
+         navCellRevStart();
+         fontStyle("NavBarFont1Rev");
+-        boldText("doclet.Tree");
++        strongText("doclet.Tree");
+         fontEnd();
+         navCellEnd();
+     }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java
+@@ -160,7 +160,7 @@
+      */
+     protected void printAllClassesTableHeader() {
+         fontSizeStyle("+1", "FrameHeadingFont");
+-        boldText("doclet.All_Classes");
++        strongText("doclet.All_Classes");
+         fontEnd();
+         br();
+         table();
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java
+@@ -65,7 +65,7 @@
+     public void writeDefaultValueInfo(MemberDoc member) {
+         writer.dl();
+         writer.dt();
+-        writer.bold(ConfigurationImpl.getInstance().
++        writer.strong(ConfigurationImpl.getInstance().
+             getText("doclet.Default"));
+         writer.dd();
+         writer.print(((AnnotationTypeElementDoc) member).defaultValue());
+@@ -84,7 +84,7 @@
+      * {@inheritDoc}
+      */
+     public void printSummaryLabel(ClassDoc cd) {
+-        writer.boldText("doclet.Annotation_Type_Optional_Member_Summary");
++        writer.strongText("doclet.Annotation_Type_Optional_Member_Summary");
+     }
+ 
+     /**
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java
+@@ -131,7 +131,7 @@
+         if (configuration().linksource) {
+             writer.printSrcLink(member, member.name());
+         } else {
+-            bold(member.name());
++            strong(member.name());
+         }
+         writer.preEnd();
+         writer.dl();
+@@ -183,7 +183,7 @@
+      * {@inheritDoc}
+      */
+     public void printSummaryLabel(ClassDoc cd) {
+-        writer.boldText("doclet.Annotation_Type_Required_Member_Summary");
++        writer.strongText("doclet.Annotation_Type_Required_Member_Summary");
+     }
+ 
+     /**
+@@ -210,9 +210,9 @@
+      * {@inheritDoc}
+      */
+     protected void writeSummaryLink(int context, ClassDoc cd, ProgramElementDoc member) {
+-        writer.bold();
++        writer.strong();
+         writer.printDocLink(context, (MemberDoc) member, member.name(), false);
+-        writer.boldEnd();
++        writer.strongEnd();
+     }
+ 
+     /**
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java
+@@ -84,7 +84,7 @@
+     protected void navLinkClass() {
+         navCellRevStart();
+         fontStyle("NavBarFont1Rev");
+-        boldText("doclet.Class");
++        strongText("doclet.Class");
+         fontEnd();
+         navCellEnd();
+     }
+@@ -176,7 +176,7 @@
+         if (configuration().linksource) {
+             printSrcLink(annotationType, name);
+         } else {
+-            bold(name);
++            strong(name);
+         }
+         dlEnd();
+         preEnd();
+@@ -220,7 +220,7 @@
+         hr();
+         Tag[] deprs = annotationType.tags("deprecated");
+         if (Util.isDeprecated(annotationType)) {
+-            boldText("doclet.Deprecated");
++            strongText("doclet.Deprecated");
+             if (deprs.length > 0) {
+                 Tag[] commentTags = deprs[0].inlineTags();
+                 if (commentTags.length > 0) {
+@@ -330,9 +330,9 @@
+             dl();
+             dt();
+             if (annotationType.isInterface()) {
+-                boldText("doclet.Enclosing_Interface");
++                strongText("doclet.Enclosing_Interface");
+             } else {
+-                boldText("doclet.Enclosing_Class");
++                strongText("doclet.Enclosing_Class");
+             }
+             dd();
+             printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS, outerClass,
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java
+@@ -394,7 +394,7 @@
+         hr();
+         center();
+         h2();
+-        boldText("doclet.ClassUse_Title", cltype, clname);
++        strongText("doclet.ClassUse_Title", cltype, clname);
+         h2End();
+         centerEnd();
+     }
+@@ -436,7 +436,7 @@
+     protected void navLinkClassUse() {
+         navCellRevStart();
+         fontStyle("NavBarFont1Rev");
+-        boldText("doclet.navClassUse");
++        strongText("doclet.navClassUse");
+         fontEnd();
+         navCellEnd();
+     }
+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
+@@ -91,7 +91,7 @@
+     protected void navLinkClass() {
+         navCellRevStart();
+         fontStyle("NavBarFont1Rev");
+-        boldText("doclet.Class");
++        strongText("doclet.Class");
+         fontEnd();
+         navCellEnd();
+     }
+@@ -185,7 +185,7 @@
+         if (configuration().linksource) {
+             printSrcLink(classDoc, name);
+         } else {
+-            bold(name);
++            strong(name);
+         }
+         if (!isInterface) {
+             Type superclass = Util.getFirstVisibleSuperClass(classDoc,
+@@ -258,7 +258,7 @@
+         hr();
+         Tag[] deprs = classDoc.tags("deprecated");
+         if (Util.isDeprecated(classDoc)) {
+-            boldText("doclet.Deprecated");
++            strongText("doclet.Deprecated");
+             if (deprs.length > 0) {
+                 Tag[] commentTags = deprs[0].inlineTags();
+                 if (commentTags.length > 0) {
+@@ -307,9 +307,9 @@
+                     classDoc, false));
+             if (configuration.shouldExcludeQualifier(
+                     classDoc.containingPackage().name())) {
+-                bold(type.asClassDoc().name() + typeParameters);
++                strong(type.asClassDoc().name() + typeParameters);
+             } else {
+-                bold(type.asClassDoc().qualifiedName() + typeParameters);
++                strong(type.asClassDoc().qualifiedName() + typeParameters);
+             }
+         } else {
+             print(getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS_TREE_PARENT,
+@@ -359,7 +359,7 @@
+             if (subclasses.size() > 0) {
+                 dl();
+                 dt();
+-                boldText("doclet.Subclasses");
++                strongText("doclet.Subclasses");
+                 writeClassLinks(LinkInfoImpl.CONTEXT_SUBCLASSES,
+                     subclasses);
+             }
+@@ -375,7 +375,7 @@
+             if (subInterfaces.size() > 0) {
+                 dl();
+                 dt();
+-                boldText("doclet.Subinterfaces");
++                strongText("doclet.Subinterfaces");
+                 writeClassLinks(LinkInfoImpl.CONTEXT_SUBINTERFACES,
+                     subInterfaces);
+             }
+@@ -397,7 +397,7 @@
+         if (implcl.size() > 0) {
+             dl();
+             dt();
+-            boldText("doclet.Implementing_Classes");
++            strongText("doclet.Implementing_Classes");
+             writeClassLinks(LinkInfoImpl.CONTEXT_IMPLEMENTED_CLASSES,
+                 implcl);
+         }
+@@ -413,7 +413,7 @@
+         if (classDoc.isClass() && interfaceArray.size() > 0) {
+             dl();
+             dt();
+-            boldText("doclet.All_Implemented_Interfaces");
++            strongText("doclet.All_Implemented_Interfaces");
+             writeClassLinks(LinkInfoImpl.CONTEXT_IMPLEMENTED_INTERFACES,
+                 interfaceArray);
+         }
+@@ -429,7 +429,7 @@
+         if (classDoc.isInterface() && interfaceArray.size() > 0) {
+             dl();
+             dt();
+-            boldText("doclet.All_Superinterfaces");
++            strongText("doclet.All_Superinterfaces");
+             writeClassLinks(LinkInfoImpl.CONTEXT_SUPER_INTERFACES,
+                 interfaceArray);
+         }
+@@ -570,9 +570,9 @@
+             dl();
+             dt();
+             if (outerClass.isInterface()) {
+-                boldText("doclet.Enclosing_Interface");
++                strongText("doclet.Enclosing_Interface");
+             } else {
+-                boldText("doclet.Enclosing_Class");
++                strongText("doclet.Enclosing_Class");
+             }
+             dd();
+             printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS, outerClass,
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java
+@@ -92,7 +92,7 @@
+      * {@inheritDoc}
+      */
+     public void writeContentsHeader() {
+-        bold(configuration.getText("doclet.Contents"));
++        strong(configuration.getText("doclet.Contents"));
+         ul();
+     }
+ 
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java
+@@ -144,7 +144,7 @@
+         if (configuration().linksource) {
+             writer.printSrcLink(constructor, constructor.name());
+         } else {
+-            bold(constructor.name());
++            strong(constructor.name());
+         }
+         writeParameters(constructor);
+         writeExceptions(constructor);
+@@ -220,7 +220,7 @@
+     }
+ 
+     public void printSummaryLabel(ClassDoc cd) {
+-        writer.boldText("doclet.Constructor_Summary");
++        writer.strongText("doclet.Constructor_Summary");
+     }
+ 
+     public void printSummaryAnchor(ClassDoc cd) {
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java
+@@ -111,7 +111,7 @@
+              throws IOException {
+         writeHeader();
+ 
+-        bold(configuration.getText("doclet.Contents"));
++        strong(configuration.getText("doclet.Contents"));
+         ul();
+         for (int i = 0; i < DeprecatedAPIListBuilder.NUM_TYPES; i++) {
+             writeIndexLink(deprapi, i);
+@@ -156,7 +156,7 @@
+         hr();
+         center();
+         h2();
+-        boldText("doclet.Deprecated_API");
++        strongText("doclet.Deprecated_API");
+         h2End();
+         centerEnd();
+ 
+@@ -180,7 +180,7 @@
+     protected void navLinkDeprecated() {
+         navCellRevStart();
+         fontStyle("NavBarFont1Rev");
+-        boldText("doclet.navDeprecated");
++        strongText("doclet.navDeprecated");
+         fontEnd();
+         navCellEnd();
+     }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java
+@@ -143,7 +143,7 @@
+         if (configuration().linksource) {
+             writer.printSrcLink(enumConstant, enumConstant.name());
+         } else {
+-            bold(enumConstant.name());
++            strong(enumConstant.name());
+         }
+         writer.preEnd();
+         writer.dl();
+@@ -201,7 +201,7 @@
+     }
+ 
+     public void printSummaryLabel(ClassDoc cd) {
+-        writer.boldText("doclet.Enum_Constant_Summary");
++        writer.strongText("doclet.Enum_Constant_Summary");
+     }
+ 
+     public void printSummaryAnchor(ClassDoc cd) {
+@@ -216,9 +216,9 @@
+     }
+ 
+     protected void writeSummaryLink(int context, ClassDoc cd, ProgramElementDoc member) {
+-        writer.bold();
++        writer.strong();
+         writer.printDocLink(context, (MemberDoc) member, member.name(), false);
+-        writer.boldEnd();
++        writer.strongEnd();
+     }
+ 
+     protected void writeInheritedSummaryLink(ClassDoc cd,
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java
+@@ -153,7 +153,7 @@
+         if (configuration().linksource) {
+             writer.printSrcLink(field, field.name());
+         } else {
+-            bold(field.name());
++            strong(field.name());
+         }
+         writer.preEnd();
+         writer.dl();
+@@ -190,7 +190,7 @@
+                             holder.typeName() : holder.qualifiedTypeName(),
+                         false));
+                 writer.dd();
+-                writer.bold(configuration().getText(holder.isClass()?
++                writer.strong(configuration().getText(holder.isClass()?
+                    "doclet.Description_From_Class" :
+                     "doclet.Description_From_Interface", classlink));
+                 writer.ddEnd();
+@@ -237,7 +237,7 @@
+     }
+ 
+     public void printSummaryLabel(ClassDoc cd) {
+-        writer.boldText("doclet.Field_Summary");
++        writer.strongText("doclet.Field_Summary");
+     }
+ 
+     public void printSummaryAnchor(ClassDoc cd) {
+@@ -251,18 +251,18 @@
+     public void printInheritedSummaryLabel(ClassDoc cd) {
+         String classlink = writer.getPreQualifiedClassLink(
+             LinkInfoImpl.CONTEXT_MEMBER, cd, false);
+-        writer.bold();
++        writer.strong();
+         String key = cd.isClass()?
+             "doclet.Fields_Inherited_From_Class" :
+             "doclet.Fields_Inherited_From_Interface";
+         writer.printText(key, classlink);
+-        writer.boldEnd();
++        writer.strongEnd();
+     }
+ 
+     protected void writeSummaryLink(int context, ClassDoc cd, ProgramElementDoc member) {
+-        writer.bold();
++        writer.strong();
+         writer.printDocLink(context, cd , (MemberDoc) member, member.name(), false);
+-        writer.boldEnd();
++        writer.strongEnd();
+     }
+ 
+     protected void writeInheritedSummaryLink(ClassDoc cd,
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java
+@@ -223,7 +223,7 @@
+     protected void navLinkHelp() {
+         navCellRevStart();
+         fontStyle("NavBarFont1Rev");
+-        boldText("doclet.Help");
++        strongText("doclet.Help");
+         fontEnd();
+         navCellEnd();
+     }
+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
+@@ -183,21 +183,21 @@
+      * @param where Position in the file
+      * @param target Name of the target frame.
+      * @param label Tag for the link.
+-     * @param bold Whether the label should be bold or not?
++     * @param strong Whether the label should be strong or not?
+      */
+     public void printNoFramesTargetHyperLink(String link, String where,
+                                                String target, String label,
+-                                               boolean bold) {
++                                               boolean strong) {
+         script();
+         println("  <!--");
+         println("  if(window==top) {");
+         println("    document.writeln('"
+-            + getHyperLink(link, where, label, bold, "", "", target) + "');");
++            + getHyperLink(link, where, label, strong, "", "", target) + "');");
+         println("  }");
+         println("  //-->");
+         scriptEnd();
+         noScript();
+-        println("  " + getHyperLink(link, where, label, bold, "", "", target));
++        println("  " + getHyperLink(link, where, label, strong, "", "", target));
+         noScriptEnd();
+         println(DocletConstants.NL);
+     }
+@@ -958,10 +958,10 @@
+      *
+      * @param pkg the package to link to.
+      * @param label the label for the link.
+-     * @param isBold true if the label should be bold.
++     * @param isStrong true if the label should be strong.
+      */
+-    public void printPackageLink(PackageDoc pkg, String label, boolean isBold) {
+-        print(getPackageLink(pkg, label, isBold));
++    public void printPackageLink(PackageDoc pkg, String label, boolean isStrong) {
++        print(getPackageLink(pkg, label, isStrong));
+     }
+ 
+     /**
+@@ -969,12 +969,12 @@
+      *
+      * @param pkg the package to link to.
+      * @param label the label for the link.
+-     * @param isBold true if the label should be bold.
++     * @param isStrong true if the label should be strong.
+      * @param style  the font of the package link label.
+      */
+-    public void printPackageLink(PackageDoc pkg, String label, boolean isBold,
++    public void printPackageLink(PackageDoc pkg, String label, boolean isStrong,
+             String style) {
+-        print(getPackageLink(pkg, label, isBold, style));
++        print(getPackageLink(pkg, label, isStrong, style));
+     }
+ 
+     /**
+@@ -982,12 +982,12 @@
+      *
+      * @param pkg the package to link to.
+      * @param label the label for the link.
+-     * @param isBold true if the label should be bold.
++     * @param isStrong true if the label should be strong.
+      * @return the link to the given package.
+      */
+     public String getPackageLink(PackageDoc pkg, String label,
+-                                 boolean isBold) {
+-        return getPackageLink(pkg, label, isBold, "");
++                                 boolean isStrong) {
++        return getPackageLink(pkg, label, isStrong, "");
+     }
+ 
+     /**
+@@ -995,11 +995,11 @@
+      *
+      * @param pkg the package to link to.
+      * @param label the label for the link.
+-     * @param isBold true if the label should be bold.
++     * @param isStrong true if the label should be strong.
+      * @param style  the font of the package link label.
+      * @return the link to the given package.
+      */
+-    public String getPackageLink(PackageDoc pkg, String label, boolean isBold,
++    public String getPackageLink(PackageDoc pkg, String label, boolean isStrong,
+             String style) {
+         boolean included = pkg != null && pkg.isIncluded();
+         if (! included) {
+@@ -1013,11 +1013,11 @@
+         }
+         if (included || pkg == null) {
+             return getHyperLink(pathString(pkg, "package-summary.html"),
+-                                "", label, isBold, style);
++                                "", label, isStrong, style);
+         } else {
+             String crossPkgLink = getCrossPackageLink(Util.getPackageName(pkg));
+             if (crossPkgLink != null) {
+-                return getHyperLink(crossPkgLink, "", label, isBold, style);
++                return getHyperLink(crossPkgLink, "", label, isStrong, style);
+             } else {
+                 return label;
+             }
+@@ -1087,12 +1087,12 @@
+      * @param refMemName the name of the member being referenced.  This should
+      * be null or empty string if no member is being referenced.
+      * @param label the label for the external link.
+-     * @param bold true if the link should be bold.
++     * @param strong true if the link should be strong.
+      * @param style the style of the link.
+      * @param code true if the label should be code font.
+      */
+     public String getCrossClassLink(String qualifiedClassName, String refMemName,
+-                                    String label, boolean bold, String style,
++                                    String label, boolean strong, String style,
+                                     boolean code) {
+         String className = "",
+             packageName = qualifiedClassName == null ? "" : qualifiedClassName;
+@@ -1113,7 +1113,7 @@
+                                 className + ".html?is-external=true"),
+                     refMemName == null ? "" : refMemName,
+                     label == null || label.length() == 0 ? defaultLabel : label,
+-                    bold, style,
++                    strong, style,
+                     configuration.getText("doclet.Href_Class_Or_Interface_Title", packageName),
+                     "");
+             }
+@@ -1152,26 +1152,26 @@
+      * link label.
+      *
+      * @param cd the class to link to.
+-     * @param isBold true if the link should be bold.
++     * @param isStrong true if the link should be strong.
+      * @return the link with the package portion of the label in plain text.
+      */
+     public String getPreQualifiedClassLink(int context,
+-            ClassDoc cd, boolean isBold) {
++            ClassDoc cd, boolean isStrong) {
+         String classlink = "";
+         PackageDoc pd = cd.containingPackage();
+         if(pd != null && ! configuration.shouldExcludeQualifier(pd.name())) {
+             classlink = getPkgName(cd);
+         }
+-        classlink += getLink(new LinkInfoImpl(context, cd, cd.name(), isBold));
++        classlink += getLink(new LinkInfoImpl(context, cd, cd.name(), isStrong));
+         return classlink;
+     }
+ 
+ 
+     /**
+-     * Print Class link, with only class name as the bold link and prefixing
++     * Print Class link, with only class name as the strong link and prefixing
+      * plain package name.
+      */
+-    public void printPreQualifiedBoldClassLink(int context, ClassDoc cd) {
++    public void printPreQualifiedStrongClassLink(int context, ClassDoc cd) {
+         print(getPreQualifiedClassLink(context, cd, true));
+     }
+ 
+@@ -1187,16 +1187,16 @@
+         print(configuration.getText(key, a1, a2));
+     }
+ 
+-    public void boldText(String key) {
+-        bold(configuration.getText(key));
++    public void strongText(String key) {
++        strong(configuration.getText(key));
+     }
+ 
+-    public void boldText(String key, String a1) {
+-        bold(configuration.getText(key, a1));
++    public void strongText(String key, String a1) {
++        strong(configuration.getText(key, a1));
+     }
+ 
+-    public void boldText(String key, String a1, String a2) {
+-        bold(configuration.getText(key, a1, a2));
++    public void strongText(String key, String a1, String a2) {
++        strong(configuration.getText(key, a1, a2));
+     }
+ 
+     /**
+@@ -1205,11 +1205,11 @@
+      * @param context the id of the context where the link will be printed.
+      * @param doc the member being linked to.
+      * @param label the label for the link.
+-     * @param bold true if the link should be bold.
++     * @param strong true if the link should be strong.
+      */
+     public void printDocLink(int context, MemberDoc doc, String label,
+-            boolean bold) {
+-        print(getDocLink(context, doc, label, bold));
++            boolean strong) {
++        print(getDocLink(context, doc, label, strong));
+     }
+ 
+     /**
+@@ -1221,11 +1221,11 @@
+      *                 inheriting comments.
+      * @param doc the member being linked to.
+      * @param label the label for the link.
+-     * @param bold true if the link should be bold.
++     * @param strong true if the link should be strong.
+      */
+     public void printDocLink(int context, ClassDoc classDoc, MemberDoc doc,
+-            String label, boolean bold) {
+-        print(getDocLink(context, classDoc, doc, label, bold));
++            String label, boolean strong) {
++        print(getDocLink(context, classDoc, doc, label, strong));
+     }
+ 
+     /**
+@@ -1234,12 +1234,12 @@
+      * @param context the id of the context where the link will be printed.
+      * @param doc the member being linked to.
+      * @param label the label for the link.
+-     * @param bold true if the link should be bold.
++     * @param strong true if the link should be strong.
+      * @return the link for the given member.
+      */
+     public String getDocLink(int context, MemberDoc doc, String label,
+-                boolean bold) {
+-        return getDocLink(context, doc.containingClass(), doc, label, bold);
++                boolean strong) {
++        return getDocLink(context, doc.containingClass(), doc, label, strong);
+     }
+ 
+     /**
+@@ -1251,21 +1251,21 @@
+      *                 inheriting comments.
+      * @param doc the member being linked to.
+      * @param label the label for the link.
+-     * @param bold true if the link should be bold.
++     * @param strong true if the link should be strong.
+      * @return the link for the given member.
+      */
+     public String getDocLink(int context, ClassDoc classDoc, MemberDoc doc,
+-        String label, boolean bold) {
++        String label, boolean strong) {
+         if (! (doc.isIncluded() ||
+             Util.isLinkable(classDoc, configuration()))) {
+             return label;
+         } else if (doc instanceof ExecutableMemberDoc) {
+             ExecutableMemberDoc emd = (ExecutableMemberDoc)doc;
+             return getLink(new LinkInfoImpl(context, classDoc,
+-                getAnchor(emd), label, bold));
++                getAnchor(emd), label, strong));
+         } else if (doc instanceof MemberDoc) {
+             return getLink(new LinkInfoImpl(context, classDoc,
+-                doc.name(), label, bold));
++                doc.name(), label, strong));
+         } else {
+             return label;
+         }
+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
+@@ -100,7 +100,7 @@
+                 fieldType));
+         }
+         print(fieldDimensions + ' ');
+-        bold(fieldName);
++        strong(fieldName);
+         writer.preEnd();
+         writer.dl();
+     }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java
+@@ -81,7 +81,7 @@
+                                 !(linkInfo.classDoc.name() + ".html").equals(m_writer.filename)) {
+                         linkOutput.append(m_writer.getHyperLink(filename,
+                             classLinkInfo.where, label.toString(),
+-                            classLinkInfo.isBold, classLinkInfo.styleName,
++                            classLinkInfo.isStrong, classLinkInfo.styleName,
+                             title, classLinkInfo.target));
+                         if (noLabel && !classLinkInfo.excludeTypeParameterLinks) {
+                             linkOutput.append(getTypeParameterLinks(linkInfo).toString());
+@@ -92,7 +92,7 @@
+         } else {
+             String crossLink = m_writer.getCrossClassLink(
+                 classDoc.qualifiedName(), classLinkInfo.where,
+-                label.toString(), classLinkInfo.isBold, classLinkInfo.styleName,
++                label.toString(), classLinkInfo.isStrong, classLinkInfo.styleName,
+                 true);
+             if (crossLink != null) {
+                 linkOutput.append(crossLink);
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java
+@@ -235,15 +235,15 @@
+      * @param classDoc   the class to link to.
+      * @param where      the value of the marker #.
+      * @param label      the label for the link.
+-     * @param isBold       true if the link should be bold.
++     * @param isStrong       true if the link should be strong.
+      * @param styleName  String style of text defined in style sheet.
+      */
+     public LinkInfoImpl (int context, ClassDoc classDoc, String where, String label,
+-            boolean isBold, String styleName){
++            boolean isStrong, String styleName){
+         this.classDoc = classDoc;
+         this.where = where;
+         this.label = label;
+-        this.isBold = isBold;
++        this.isStrong = isStrong;
+         this.styleName = styleName;
+         setContext(context);
+     }
+@@ -255,14 +255,14 @@
+      * @param classDoc   the class to link to.
+      * @param where      the value of the marker #.
+      * @param label      the label for the link.
+-     * @param isBold       true if the link should be bold.
++     * @param isStrong       true if the link should be strong.
+      */
+     public LinkInfoImpl (int context, ClassDoc classDoc, String where, String label,
+-            boolean isBold){
++            boolean isStrong){
+         this.classDoc = classDoc;
+         this.where = where;
+         this.label = label;
+-        this.isBold = isBold;
++        this.isStrong = isStrong;
+         setContext(context);
+     }
+ 
+@@ -283,12 +283,12 @@
+      *
+      * @param context               the context of the link.
+      * @param executableMemberDoc   the member to link to.
+-     * @param isBold                true if the link should be bold.
++     * @param isStrong                true if the link should be strong.
+      */
+     public LinkInfoImpl (int context, ExecutableMemberDoc executableMemberDoc,
+-            boolean isBold){
++            boolean isStrong){
+         this.executableMemberDoc = executableMemberDoc;
+-        this.isBold = isBold;
++        this.isStrong = isStrong;
+         setContext(context);
+     }
+ 
+@@ -297,11 +297,11 @@
+      *
+      * @param context    the context of the link.
+      * @param classDoc   the class to link to.
+-     * @param isBold       true if the link should be bold.
++     * @param isStrong       true if the link should be strong.
+      */
+-    public LinkInfoImpl (int context, ClassDoc classDoc,  boolean isBold){
++    public LinkInfoImpl (int context, ClassDoc classDoc,  boolean isStrong){
+         this.classDoc = classDoc;
+-        this.isBold = isBold;
++        this.isStrong = isStrong;
+         setContext(context);
+     }
+ 
+@@ -335,13 +335,13 @@
+      * @param context    the context of the link.
+      * @param type       the class to link to.
+      * @param label      the label for the link.
+-     * @param isBold     true if the link should be bold.
++     * @param isStrong     true if the link should be strong.
+      */
+     public LinkInfoImpl (int context, Type type, String label,
+-            boolean isBold){
++            boolean isStrong){
+         this.type = type;
+         this.label = label;
+-        this.isBold = isBold;
++        this.isStrong = isStrong;
+         setContext(context);
+     }
+ 
+@@ -351,13 +351,13 @@
+      * @param context    the context of the link.
+      * @param classDoc   the class to link to.
+      * @param label      the label for the link.
+-     * @param isBold       true if the link should be bold.
++     * @param isStrong       true if the link should be strong.
+      */
+     public LinkInfoImpl (int context, ClassDoc classDoc, String label,
+-            boolean isBold){
++            boolean isStrong){
+         this.classDoc = classDoc;
+         this.label = label;
+-        this.isBold = isBold;
++        this.isStrong = isStrong;
+         setContext(context);
+     }
+ 
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java
+@@ -167,7 +167,7 @@
+         if (configuration().linksource) {
+             writer.printSrcLink(method, method.name());
+         } else {
+-            bold(method.name());
++            strong(method.name());
+         }
+         writeParameters(method);
+         writeExceptions(method);
+@@ -210,7 +210,7 @@
+                             holder.typeName() : holder.qualifiedTypeName(),
+                         false));
+                 writer.dd();
+-                writer.boldText(holder.asClassDoc().isClass()?
++                writer.strongText(holder.asClassDoc().isClass()?
+                         "doclet.Description_From_Class":
+                         "doclet.Description_From_Interface",
+                     classlink);
+@@ -259,7 +259,7 @@
+     }
+ 
+     public void printSummaryLabel(ClassDoc cd) {
+-        writer.boldText("doclet.Method_Summary");
++        writer.strongText("doclet.Method_Summary");
+     }
+ 
+     public void printSummaryAnchor(ClassDoc cd) {
+@@ -274,12 +274,12 @@
+     public void printInheritedSummaryLabel(ClassDoc cd) {
+         String classlink = writer.getPreQualifiedClassLink(
+             LinkInfoImpl.CONTEXT_MEMBER, cd, false);
+-        writer.bold();
++        writer.strong();
+         String key = cd.isClass()?
+             "doclet.Methods_Inherited_From_Class" :
+             "doclet.Methods_Inherited_From_Interface";
+         writer.printText(key, classlink);
+-        writer.boldEnd();
++        writer.strongEnd();
+     }
+ 
+     protected void printSummaryType(ProgramElementDoc member) {
+@@ -317,7 +317,7 @@
+                 writer.getLink(new LinkInfoImpl(context, overriddenType)));
+             String name = method.name();
+             writer.dt();
+-            writer.boldText(label);
++            writer.strongText(label);
+             writer.dd();
+             String methLink = writer.codeText(
+                 writer.getLink(
+@@ -363,7 +363,7 @@
+                 writer.getLink(new LinkInfoImpl(
+                     LinkInfoImpl.CONTEXT_METHOD_SPECIFIED_BY, intfac)));
+             writer.dt();
+-            writer.boldText("doclet.Specified_By");
++            writer.strongText("doclet.Specified_By");
+             writer.dd();
+             methlink = writer.codeText(writer.getDocLink(
+                 LinkInfoImpl.CONTEXT_MEMBER, implementedMeth,
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java
+@@ -149,7 +149,7 @@
+     }
+ 
+     public void printSummaryLabel(ClassDoc cd) {
+-        writer.boldText("doclet.Nested_Class_Summary");
++        writer.strongText("doclet.Nested_Class_Summary");
+     }
+ 
+     public void printSummaryAnchor(ClassDoc cd) {
+@@ -164,18 +164,18 @@
+     public void printInheritedSummaryLabel(ClassDoc cd) {
+         String clslink = writer.getPreQualifiedClassLink(
+             LinkInfoImpl.CONTEXT_MEMBER, cd, false);
+-        writer.bold();
++        writer.strong();
+         writer.printText(cd.isInterface() ?
+             "doclet.Nested_Classes_Interface_Inherited_From_Interface" :
+             "doclet.Nested_Classes_Interfaces_Inherited_From_Class",
+             clslink);
+-        writer.boldEnd();
++        writer.strongEnd();
+     }
+ 
+     protected void writeSummaryLink(int context, ClassDoc cd, ProgramElementDoc member) {
+-        writer.bold();
++        writer.strong();
+         writer.printLink(new LinkInfoImpl(context, (ClassDoc)member, false));
+-        writer.boldEnd();
++        writer.strongEnd();
+     }
+ 
+     protected void writeInheritedSummaryLink(ClassDoc cd,
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java
+@@ -87,7 +87,7 @@
+     }
+ 
+     /**
+-     * Print the "-packagesheader" string in bold format, at top of the page,
++     * Print the "-packagesheader" string in strong format, at top of the page,
+      * if it is not the empty string.  Otherwise print the "-header" string.
+      * Despite the name, there is actually no navigation bar for this page.
+      */
+@@ -95,9 +95,9 @@
+         printTableHeader(true);
+         fontSizeStyle("+1", "FrameTitleFont");
+         if (configuration.packagesheader.length() > 0) {
+-            bold(replaceDocRootDir(configuration.packagesheader));
++            strong(replaceDocRootDir(configuration.packagesheader));
+         } else {
+-            bold(replaceDocRootDir(configuration.header));
++            strong(replaceDocRootDir(configuration.header));
+         }
+         fontEnd();
+         printTableFooter(true);
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java
+@@ -102,9 +102,9 @@
+         if(pkg != null && pkg.name().length() > 0) {
+             trBgcolorStyle("white", "TableRowColor");
+             summaryRow(20);
+-            bold();
++            strong();
+             printPackageLink(pkg, Util.getPackageName(pkg), false);
+-            boldEnd();
++            strongEnd();
+             summaryRowEnd();
+             summaryRow(0);
+             printSummaryComment(pkg);
+@@ -138,7 +138,7 @@
+         if (root.inlineTags().length > 0) {
+             printSummaryComment(root);
+             p();
+-            bold(configuration.getText("doclet.See"));
++            strong(configuration.getText("doclet.See"));
+             br();
+             printNbsps();
+             printHyperLink("", "overview_description",
+@@ -153,7 +153,7 @@
+     protected void printIndexHeader(String text) {
+         tableIndexSummary();
+         tableHeaderStart("#CCCCFF");
+-        bold(text);
++        strong(text);
+         tableHeaderEnd();
+     }
+ 
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java
+@@ -144,7 +144,7 @@
+     protected void printLinkToMainTree() {
+         dl();
+         dt();
+-        boldText("doclet.Package_Hierarchies");
++        strongText("doclet.Package_Hierarchies");
+         dd();
+         navLinkMainTree(configuration.getText("doclet.All_Packages"));
+         dlEnd();
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java
+@@ -178,9 +178,9 @@
+ 
+         trBgcolorStyle("white", "TableRowColor");
+         summaryRow(0);
+-        bold();
++        strong();
+         printHyperLink(path, packageName, usedClass.name(), true);
+-        boldEnd();
++        strongEnd();
+         println(); br();
+         printNbsps();
+         printIndexComment(usedClass);
+@@ -219,7 +219,7 @@
+         hr();
+         center();
+         h2();
+-        boldText("doclet.ClassUse_Title", packageLabel, name);
++        strongText("doclet.ClassUse_Title", packageLabel, name);
+         h2End();
+         centerEnd();
+     }
+@@ -251,7 +251,7 @@
+     protected void navLinkClassUse() {
+         navCellRevStart();
+         fontStyle("NavBarFont1Rev");
+-        boldText("doclet.navClassUse");
++        strongText("doclet.navClassUse");
+         fontEnd();
+         navCellEnd();
+     }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java
+@@ -123,14 +123,14 @@
+                 }
+                 trBgcolorStyle("white", "TableRowColor");
+                 summaryRow(15);
+-                bold();
++                strong();
+                 printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_PACKAGE,
+                     classes[i], false));
+-                boldEnd();
++                strongEnd();
+                 summaryRowEnd();
+                 summaryRow(0);
+                 if (Util.isDeprecated(classes[i])) {
+-                    boldText("doclet.Deprecated");
++                    strongText("doclet.Deprecated");
+                     if (classes[i].tags("deprecated").length > 0) {
+                         space();
+                         printSummaryDeprecatedComment(classes[i],
+@@ -155,7 +155,7 @@
+      */
+     protected void printFirstRow(String label) {
+         tableHeaderStart("#CCCCFF");
+-        bold(label);
++        strong(label);
+         tableHeaderEnd();
+     }
+ 
+@@ -194,7 +194,7 @@
+         if (packageDoc.inlineTags().length > 0 && ! configuration.nocomment) {
+             printSummaryComment(packageDoc);
+             p();
+-            bold(configuration.getText("doclet.See"));
++            strong(configuration.getText("doclet.See"));
+             br();
+             printNbsps();
+             printHyperLink("", "package_description",
+@@ -268,7 +268,7 @@
+     protected void navLinkPackage() {
+         navCellRevStart();
+         fontStyle("NavBarFont1Rev");
+-        boldText("doclet.Package");
++        strongText("doclet.Package");
+         fontEnd();
+         navCellEnd();
+     }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java
+@@ -73,9 +73,9 @@
+         tableHeader();
+         thAlign("center");
+         font("+2");
+-        boldText("doclet.Package");
++        strongText("doclet.Package");
+         print(' ');
+-        bold(packageName);
++        strong(packageName);
+         tableFooter();
+     }
+ 
+@@ -86,7 +86,7 @@
+      * @param serialUID the serial UID to print.
+      */
+     public void writeSerialUIDInfo(String header, String serialUID) {
+-        bold(header + " ");
++        strong(header + " ");
+         println(serialUID);
+         p();
+     }
+@@ -131,7 +131,7 @@
+         tableHeader();
+         thAlignColspan("left", 2);
+         font("+2");
+-        bold(className);
++        strong(className);
+         tableFooter();
+         p();
+     }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java
+@@ -81,7 +81,7 @@
+     public void printTableHeadingBackground(String str) {
+         tableIndexDetail();
+         tableHeaderStart("#CCCCFF", 1);
+-        bold(str);
++        strong(str);
+         tableHeaderEnd();
+         tableEnd();
+     }
+@@ -117,7 +117,7 @@
+     protected void printIndexComment(Doc member, Tag[] firstSentenceTags) {
+         Tag[] deprs = member.tags("deprecated");
+         if (Util.isDeprecated((ProgramElementDoc) member)) {
+-            boldText("doclet.Deprecated");
++            strongText("doclet.Deprecated");
+             space();
+             if (deprs.length > 0) {
+                 printInlineDeprecatedComment(member, deprs[0]);
+@@ -126,7 +126,7 @@
+         } else {
+             ClassDoc cd = ((ProgramElementDoc)member).containingClass();
+             if (cd != null && Util.isDeprecated(cd)) {
+-                boldText("doclet.Deprecated"); space();
++                strongText("doclet.Deprecated"); space();
+             }
+         }
+         printSummaryComment(member, firstSentenceTags);
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java
+@@ -69,9 +69,9 @@
+         Tag[] deprs = doc.tags("deprecated");
+         if (doc instanceof ClassDoc) {
+             if (Util.isDeprecated((ProgramElementDoc) doc)) {
+-                output.append("<B>" +
++                output.append("<STRONG>" +
+                     ConfigurationImpl.getInstance().
+-                        getText("doclet.Deprecated") + "</B> ");
++                        getText("doclet.Deprecated") + "</STRONG> ");
+                 if (deprs.length > 0) {
+                     Tag[] commentTags = deprs[0].inlineTags();
+                     if (commentTags.length > 0) {
+@@ -86,9 +86,9 @@
+         } else {
+             MemberDoc member = (MemberDoc) doc;
+             if (Util.isDeprecated((ProgramElementDoc) doc)) {
+-                output.append("<DD><B>" +
++                output.append("<DD><STRONG>" +
+                     ConfigurationImpl.getInstance().
+-                            getText("doclet.Deprecated") + "</B> ");
++                            getText("doclet.Deprecated") + "</STRONG> ");
+                 if (deprs.length > 0) {
+                     output.append("<I>");
+                     output.append(commentTagsToOutput(null, doc,
+@@ -101,9 +101,9 @@
+                 }
+             } else {
+                 if (Util.isDeprecated(member.containingClass())) {
+-                    output.append("<DD><B>" +
++                    output.append("<DD><STRONG>" +
+                     ConfigurationImpl.getInstance().
+-                            getText("doclet.Deprecated") + "</B> ");
++                            getText("doclet.Deprecated") + "</STRONG> ");
+                 }
+             }
+         }
+@@ -123,7 +123,7 @@
+     public TagletOutput getParamHeader(String header) {
+         StringBuffer result = new StringBuffer();
+         result.append("<DT>");
+-        result.append("<B>" +  header + "</B>");
++        result.append("<STRONG>" +  header + "</STRONG>");
+         return new TagletOutputImpl(result.toString());
+     }
+ 
+@@ -141,8 +141,8 @@
+      */
+     public TagletOutput returnTagOutput(Tag returnTag) {
+         TagletOutput result = new TagletOutputImpl(DocletConstants.NL + "<DT>" +
+-            "<B>" + htmlWriter.configuration.getText("doclet.Returns") +
+-            "</B>" + "<DD>" +
++            "<STRONG>" + htmlWriter.configuration.getText("doclet.Returns") +
++            "</STRONG>" + "<DD>" +
+             htmlWriter.commentTagsToString(returnTag, null, returnTag.inlineTags(),
+             false));
+         return result;
+@@ -189,7 +189,7 @@
+         if (result != null && result.length() > 0) {
+             return result + ", " + DocletConstants.NL;
+         } else {
+-            return "<DT><B>" + htmlWriter.configuration().getText("doclet.See_Also") + "</B><DD>";
++            return "<DT><STRONG>" + htmlWriter.configuration().getText("doclet.See_Also") + "</STRONG><DD>";
+         }
+      }
+ 
+@@ -197,7 +197,7 @@
+      * {@inheritDoc}
+      */
+     public TagletOutput simpleTagOutput(Tag[] simpleTags, String header) {
+-        String result = "<DT><B>" + header + "</B></DT>" + DocletConstants.NL +
++        String result = "<DT><STRONG>" + header + "</STRONG></DT>" + DocletConstants.NL +
+             "  <DD>";
+         for (int i = 0; i < simpleTags.length; i++) {
+             if (i > 0) {
+@@ -212,7 +212,7 @@
+      * {@inheritDoc}
+      */
+     public TagletOutput simpleTagOutput(Tag simpleTag, String header) {
+-        return new TagletOutputImpl("<DT><B>" + header + "</B></DT>" + "  <DD>"
++        return new TagletOutputImpl("<DT><STRONG>" + header + "</STRONG></DT>" + "  <DD>"
+             + htmlWriter.commentTagsToString(simpleTag, null, simpleTag.inlineTags(), false)
+             + "</DD>" + DocletConstants.NL);
+     }
+@@ -221,8 +221,8 @@
+      * {@inheritDoc}
+      */
+     public TagletOutput getThrowsHeader() {
+-        return new TagletOutputImpl(DocletConstants.NL + "<DT>" + "<B>" +
+-            htmlWriter.configuration().getText("doclet.Throws") + "</B>");
++        return new TagletOutputImpl(DocletConstants.NL + "<DT>" + "<STRONG>" +
++            htmlWriter.configuration().getText("doclet.Throws") + "</STRONG>");
+     }
+ 
+     /**
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java
+@@ -119,7 +119,7 @@
+         if (!classesonly) {
+             dl();
+             dt();
+-            boldText("doclet.Package_Hierarchies");
++            strongText("doclet.Package_Hierarchies");
+             dd();
+             for (int i = 0; i < packages.length; i++) {
+                 if (packages[i].name().length() == 0) {
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
+@@ -83,11 +83,11 @@
+      * @param where Position of the link in the file. Character '#' is not
+      * needed.
+      * @param label Tag for the link.
+-     * @param bold  Boolean that sets label to bold.
++     * @param strong  Boolean that sets label to strong.
+      */
+     public void printHyperLink(String link, String where,
+-                               String label, boolean bold) {
+-        print(getHyperLink(link, where, label, bold, "", "", ""));
++                               String label, boolean strong) {
++        print(getHyperLink(link, where, label, strong, "", "", ""));
+     }
+ 
+     /**
+@@ -109,13 +109,13 @@
+      * @param where      Position of the link in the file. Character '#' is not
+      * needed.
+      * @param label      Tag for the link.
+-     * @param bold       Boolean that sets label to bold.
++     * @param strong       Boolean that sets label to strong.
+      * @param stylename  String style of text defined in style sheet.
+      */
+     public void printHyperLink(String link, String where,
+-                               String label, boolean bold,
++                               String label, boolean strong,
+                                String stylename) {
+-        print(getHyperLink(link, where, label, bold, stylename, "", ""));
++        print(getHyperLink(link, where, label, strong, stylename, "", ""));
+     }
+ 
+     /**
+@@ -125,12 +125,12 @@
+      * @param where      Position of the link in the file. Character '#' is not
+      * needed.
+      * @param label      Tag for the link.
+-     * @param bold       Boolean that sets label to bold.
++     * @param strong       Boolean that sets label to strong.
+      * @return String    Hyper Link.
+      */
+     public String getHyperLink(String link, String where,
+-                               String label, boolean bold) {
+-        return getHyperLink(link, where, label, bold, "", "", "");
++                               String label, boolean strong) {
++        return getHyperLink(link, where, label, strong, "", "", "");
+     }
+ 
+     /**
+@@ -140,14 +140,14 @@
+      * @param where      Position of the link in the file. Character '#' is not
+      *                   needed.
+      * @param label      Tag for the link.
+-     * @param bold       Boolean that sets label to bold.
++     * @param strong       Boolean that sets label to strong.
+      * @param stylename  String style of text defined in style sheet.
+      * @return String    Hyper Link.
+      */
+     public String getHyperLink(String link, String where,
+-                               String label, boolean bold,
++                               String label, boolean strong,
+                                String stylename) {
+-        return getHyperLink(link, where, label, bold, stylename, "", "");
++        return getHyperLink(link, where, label, strong, stylename, "", "");
+     }
+ 
+     /**
+@@ -157,14 +157,14 @@
+      * @param where      Position of the link in the file. Character '#' is not
+      *                   needed.
+      * @param label      Tag for the link.
+-     * @param bold       Boolean that sets label to bold.
++     * @param strong       Boolean that sets label to strong.
+      * @param stylename  String style of text defined in style sheet.
+      * @param title      String that describes the link's content for accessibility.
+      * @param target     Target frame.
+      * @return String    Hyper Link.
+      */
+     public String getHyperLink(String link, String where,
+-                               String label, boolean bold,
++                               String label, boolean strong,
+                                String stylename, String title, String target) {
+         StringBuffer retlink = new StringBuffer();
+         retlink.append("<A HREF=\"");
+@@ -186,12 +186,12 @@
+             retlink.append(stylename);
+             retlink.append("\">");
+         }
+-        if (bold) {
+-            retlink.append("<B>");
++        if (strong) {
++            retlink.append("<STRONG>");
+         }
+         retlink.append(label);
+-        if (bold) {
+-            retlink.append("</B>");
++        if (strong) {
++            retlink.append("</STRONG>");
+         }
+         if (stylename != null && stylename.length() != 0) {
+             retlink.append("</FONT>");
+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
+@@ -433,46 +433,46 @@
+     }
+ 
+     /**
+-     * Get the "<B>" string.
++     * Get the "<STRONG>" string.
+      *
+-     * @return String Return String "<B>";
++     * @return String Return String "<STRONG>";
+      */
+-    public String getBold() {
+-        return "<B>";
++    public String getStrong() {
++        return "<STRONG>";
+     }
+ 
+     /**
+-     * Get the "</B>" string.
++     * Get the "</STRONG>" string.
+      *
+-     * @return String Return String "</B>";
++     * @return String Return String "</STRONG>";
+      */
+-    public String getBoldEnd() {
+-        return "</B>";
++    public String getStrongEnd() {
++        return "</STRONG>";
+     }
+ 
+     /**
+-     * Print <B> tag.
++     * Print <STRONG> tag.
+      */
+-    public void bold() {
+-        print("<B>");
++    public void strong() {
++        print("<STRONG>");
+     }
+ 
+     /**
+-     * Print </B> tag.
++     * Print </STRONG> tag.
+      */
+-    public void boldEnd() {
+-        print("</B>");
++    public void strongEnd() {
++        print("</STRONG>");
+     }
+ 
+     /**
+-     * Print text passed, in bold format using <B> and </B> tags.
++     * Print text passed, in strong format using <STRONG> and </STRONG> tags.
+      *
+-     * @param text String to be printed in between <B> and </B> tags.
++     * @param text String to be printed in between <STRONG> and </STRONG> tags.
+      */
+-    public void bold(String text) {
+-        bold();
++    public void strong(String text) {
++        strong();
+         print(text);
+-        boldEnd();
++        strongEnd();
+     }
+ 
+     /**
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkInfo.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkInfo.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkInfo.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkInfo.java
+@@ -69,9 +69,9 @@
+     public String label;
+ 
+     /**
+-     * True if the link should be bolded.
++     * True if the link should be strong.
+      */
+-    public boolean isBold = false;
++    public boolean isStrong = false;
+ 
+     /**
+      * True if we should include the type in the link label.  False otherwise.
+diff --git a/test/com/sun/javadoc/AccessAsciiArt/AccessAsciiArt.java b/test/com/sun/javadoc/AccessAsciiArt/AccessAsciiArt.java
+--- langtools/test/com/sun/javadoc/AccessAsciiArt/AccessAsciiArt.java
++++ langtools/test/com/sun/javadoc/AccessAsciiArt/AccessAsciiArt.java
+@@ -94,7 +94,7 @@
+ 
+             // Test the third line of the class tree
+             {
+-"          <IMG SRC=\"../../resources/inherit.gif\" ALT=\"extended by \"><B>p1.subpkg.SSC</B>",
++"          <IMG SRC=\"../../resources/inherit.gif\" ALT=\"extended by \"><STRONG>p1.subpkg.SSC</STRONG>",
+                      TMPDEST_DIR1 + "p1" + FS + "subpkg" + FS +"SSC.html" },
+ 
+         };
+diff --git a/test/com/sun/javadoc/AuthorDD/AuthorDD.java b/test/com/sun/javadoc/AuthorDD/AuthorDD.java
+--- langtools/test/com/sun/javadoc/AuthorDD/AuthorDD.java
++++ langtools/test/com/sun/javadoc/AuthorDD/AuthorDD.java
+@@ -86,12 +86,12 @@
+ 
+              // Test single @since tag:
+ 
+-            { "<DT><B>Since:</B></DT>"+NL+"  <DD>JDK 1.0</DD>",
++            { "<DT><STRONG>Since:</STRONG></DT>"+NL+"  <DD>JDK 1.0</DD>",
+                                   BUGID + FS + "p1" + FS + "C1.html" },
+ 
+             // Test multiple @author tags:
+ 
+-            { "<DT><B>Author:</B></DT>"+NL+"  <DD>Doug Kramer, Jamie, Neal</DD>"+NL,
++            { "<DT><STRONG>Author:</STRONG></DT>"+NL+"  <DD>Doug Kramer, Jamie, Neal</DD>"+NL,
+                                   BUGID + FS + "p1" + FS + "C1.html" },
+ 
+         };
+diff --git a/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java b/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java
+--- langtools/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java
++++ langtools/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java
+@@ -48,7 +48,7 @@
+             "<A HREF=\"http://java.sun.com/j2se/1.4/docs/api/java/math/BigInteger.html?is-external=true#gcd(java.math.BigInteger)\" " +
+                 "title=\"class or interface in java.math\"><CODE>Link to external member gcd</CODE></A>"},
+         {BUG_ID + FS + "C.html",
+-            "<B>Overrides:</B><DD><CODE>toString</CODE> in class <CODE>java.lang.Object</CODE>"}
++            "<STRONG>Overrides:</STRONG><DD><CODE>toString</CODE> in class <CODE>java.lang.Object</CODE>"}
+     };
+     private static final String[][] NEGATED_TEST = NO_TEST;
+     private static final String[] ARGS =
+diff --git a/test/com/sun/javadoc/testClassTree/TestClassTree.java b/test/com/sun/javadoc/testClassTree/TestClassTree.java
+--- langtools/test/com/sun/javadoc/testClassTree/TestClassTree.java
++++ langtools/test/com/sun/javadoc/testClassTree/TestClassTree.java
+@@ -49,12 +49,12 @@
+     private static final String[][] TEST = {
+         {BUG_ID + FS + "pkg" + FS + "package-tree.html",
+             "<LI TYPE=\"circle\">pkg.<A HREF=\"../pkg/ParentClass.html\" " +
+-            "title=\"class in pkg\"><B>ParentClass</B></A><UL>"},
++            "title=\"class in pkg\"><STRONG>ParentClass</STRONG></A><UL>"},
+ 
+         {BUG_ID + FS + "pkg" + FS + "package-tree.html",
+             "Annotation Type Hierarchy" + NL + "</H2>" + NL + "<UL>" + NL +
+             "<LI TYPE=\"circle\">pkg.<A HREF=\"../pkg/AnnotationType.html\" " +
+-            "title=\"annotation in pkg\"><B>AnnotationType</B></A> " +
++            "title=\"annotation in pkg\"><STRONG>AnnotationType</STRONG></A> " +
+             "(implements java.lang.annotation.Annotation)" + NL + "</UL>"},
+ 
+         {BUG_ID + FS + "pkg" + FS + "package-tree.html",
+@@ -65,7 +65,7 @@
+             "<LI TYPE=\"circle\">java.lang.Object<UL>" + NL +
+             "<LI TYPE=\"circle\">java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable)" + NL +
+             "<UL>" + NL +
+-            "<LI TYPE=\"circle\">pkg.<A HREF=\"../pkg/Coin.html\" title=\"enum in pkg\"><B>Coin</B></A></UL>" + NL +
++            "<LI TYPE=\"circle\">pkg.<A HREF=\"../pkg/Coin.html\" title=\"enum in pkg\"><STRONG>Coin</STRONG></A></UL>" + NL +
+             "</UL>" + NL +
+             "</UL>"
+         },
+@@ -73,7 +73,7 @@
+     private static final String[][] NEGATED_TEST = {
+         {BUG_ID + FS + "pkg" + FS + "package-tree.html",
+             "<LI TYPE=\"circle\">class pkg.<A HREF=\"../pkg/ParentClass.html\" " +
+-            "title=\"class in pkg\"><B>ParentClass</B></A><UL>"}
++            "title=\"class in pkg\"><STRONG>ParentClass</STRONG></A><UL>"}
+         };
+ 
+     /**
+diff --git a/test/com/sun/javadoc/testConstructorIndent/TestConstructorIndent.java b/test/com/sun/javadoc/testConstructorIndent/TestConstructorIndent.java
+--- langtools/test/com/sun/javadoc/testConstructorIndent/TestConstructorIndent.java
++++ langtools/test/com/sun/javadoc/testConstructorIndent/TestConstructorIndent.java
+@@ -46,7 +46,7 @@
+     //Input for string search tests.
+     private static final String[][] TEST = {
+         {BUG_ID + FS + "C.html", "<DL>"+NL+"<DD>This is just a simple constructor."+ NL +
+-            "<P>"+NL+"<DL>"+NL+"<DT><B>Parameters:</B><DD><CODE>i</CODE> - a param.</DL>"+NL +
++            "<P>"+NL+"<DL>"+NL+"<DT><STRONG>Parameters:</STRONG><DD><CODE>i</CODE> - a param.</DL>"+NL +
+             "</DL>"
+         }
+     };
+diff --git a/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java b/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java
+--- langtools/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java
++++ langtools/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java
+@@ -76,25 +76,25 @@
+         {TARGET_FILE, "pkg.DeprecatedClassByAnnotation.method()"},
+         {TARGET_FILE, "pkg.DeprecatedClassByAnnotation.field"},
+ 
+-        {TARGET_FILE2, "<B>Deprecated.</B>" + NL +
++        {TARGET_FILE2, "<STRONG>Deprecated.</STRONG>" + NL +
+                 "<P>" + NL +
+             "<DL>" + NL +
+             "<DT><PRE><FONT SIZE=\"-1\">@Deprecated" + NL +
+-            "</FONT>public class <B>DeprecatedClassByAnnotation</B>"},
++            "</FONT>public class <STRONG>DeprecatedClassByAnnotation</STRONG>"},
+ 
+-        {TARGET_FILE2, "public int <B>field</B></PRE>" + NL +
++        {TARGET_FILE2, "public int <STRONG>field</STRONG></PRE>" + NL +
+             "<DL>" + NL +
+-            "<DD><B>Deprecated.</B> <DL>"},
++            "<DD><STRONG>Deprecated.</STRONG> <DL>"},
+ 
+         {TARGET_FILE2, "<FONT SIZE=\"-1\">@Deprecated" + NL +
+-            "</FONT>public <B>DeprecatedClassByAnnotation</B>()</PRE>" + NL +
++            "</FONT>public <STRONG>DeprecatedClassByAnnotation</STRONG>()</PRE>" + NL +
+             "<DL>" + NL +
+-            "<DD><B>Deprecated.</B>"},
++            "<DD><STRONG>Deprecated.</STRONG>"},
+ 
+         {TARGET_FILE2, "<FONT SIZE=\"-1\">@Deprecated" + NL +
+-            "</FONT>public void <B>method</B>()</PRE>" + NL +
++            "</FONT>public void <STRONG>method</STRONG>()</PRE>" + NL +
+             "<DL>" + NL +
+-            "<DD><B>Deprecated.</B>"},
++            "<DD><STRONG>Deprecated.</STRONG>"},
+     };
+ 
+     private static final String[][] NEGATED_TEST = NO_TEST;
+diff --git a/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java b/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java
+--- langtools/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java
++++ langtools/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java
+@@ -39,13 +39,13 @@
+     private static final String BUG_ID = "4857717";
+     private static final String[][] TEST = {
+         {BUG_ID + FS + "pkg" + FS + "XReader.html",
+-            "<B>Overrides:</B><DD><CODE><A HREF=\"" +
++            "<STRONG>Overrides:</STRONG><DD><CODE><A HREF=\"" +
+             "http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterReader.html?is-external=true#read()\"" +
+                 " title=\"class or interface in java.io\">read</A></CODE> in class " +
+                 "<CODE><A HREF=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterReader.html?is-external=true\"" +
+                 " title=\"class or interface in java.io\">FilterReader</A>"},
+         {BUG_ID + FS + "pkg" + FS + "XReader.html",
+-            "<B>Specified by:</B><DD><CODE><A HREF=\"" +
++            "<STRONG>Specified by:</STRONG><DD><CODE><A HREF=\"" +
+             "http://java.sun.com/j2se/1.4.1/docs/api/java/io/DataInput.html?is-external=true#readInt()\"" +
+             " title=\"class or interface in java.io\">readInt</A></CODE> in interface " +
+             "<CODE><A HREF=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/DataInput.html?is-external=true\"" +
+diff --git a/test/com/sun/javadoc/testHeadings/TestHeadings.java b/test/com/sun/javadoc/testHeadings/TestHeadings.java
+--- langtools/test/com/sun/javadoc/testHeadings/TestHeadings.java
++++ langtools/test/com/sun/javadoc/testHeadings/TestHeadings.java
+@@ -48,16 +48,16 @@
+         //Package summary
+         {BUG_ID + FS + "pkg1" + FS + "package-summary.html",
+             "<TH ALIGN=\"left\" COLSPAN=\"2\"><FONT SIZE=\"+2\">" + NL +
+-            "<B>Class Summary</B></FONT></TH>"
++            "<STRONG>Class Summary</STRONG></FONT></TH>"
+         },
+ 
+         // Class documentation
+         {BUG_ID + FS + "pkg1" + FS + "C1.html",
+             "<TH ALIGN=\"left\" COLSPAN=\"2\"><FONT SIZE=\"+2\">" + NL +
+-            "<B>Field Summary</B></FONT></TH>"
++            "<STRONG>Field Summary</STRONG></FONT></TH>"
+         },
+         {BUG_ID + FS + "pkg1" + FS + "C1.html",
+-            "<TH ALIGN=\"left\"><B>Methods inherited from class " +            "java.lang.Object</B></TH>"
++            "<TH ALIGN=\"left\"><STRONG>Methods inherited from class " +            "java.lang.Object</STRONG></TH>"
+         },
+ 
+         // Class use documentation
+@@ -76,7 +76,7 @@
+         // Deprecated
+         {BUG_ID + FS + "deprecated-list.html",
+             "<TH ALIGN=\"left\" COLSPAN=\"2\"><FONT SIZE=\"+2\">" + NL +
+-            "<B>Deprecated Methods</B></FONT></TH>"
++            "<STRONG>Deprecated Methods</STRONG></FONT></TH>"
+         },
+ 
+         // Constant values
+@@ -90,20 +90,20 @@
+         // Serialized Form
+         {BUG_ID + FS + "serialized-form.html",
+             "<TH ALIGN=\"center\"><FONT SIZE=\"+2\">" + NL +
+-            "<B>Package</B> <B>pkg1</B></FONT></TH>"
++            "<STRONG>Package</STRONG> <STRONG>pkg1</STRONG></FONT></TH>"
+         },
+         {BUG_ID + FS + "serialized-form.html",
+             "<TH ALIGN=\"left\" COLSPAN=\"2\"><FONT SIZE=\"+2\">" + NL +
+-            "<B>Class <A HREF=\"pkg1/C1.html\" " +            "title=\"class in pkg1\">pkg1.C1</A> extends java.lang.Object " +            "implements Serializable</B></FONT></TH>"
++            "<STRONG>Class <A HREF=\"pkg1/C1.html\" " +            "title=\"class in pkg1\">pkg1.C1</A> extends java.lang.Object " +            "implements Serializable</STRONG></FONT></TH>"
+         },
+         {BUG_ID + FS + "serialized-form.html",
+             "<TH ALIGN=\"left\" COLSPAN=\"1\"><FONT SIZE=\"+2\">" + NL +
+-            "<B>Serialized Fields</B></FONT></TH>"
++            "<STRONG>Serialized Fields</STRONG></FONT></TH>"
+         },
+ 
+         // Overview Frame
+         {BUG_ID + FS + "overview-frame.html",
+-            "<TH ALIGN=\"left\" NOWRAP><FONT size=\"+1\" " +            "CLASS=\"FrameTitleFont\">" + NL + "<B>Test Files</B></FONT></TH>"
++            "<TH ALIGN=\"left\" NOWRAP><FONT size=\"+1\" " +            "CLASS=\"FrameTitleFont\">" + NL + "<STRONG>Test Files</STRONG></FONT></TH>"
+         },
+         {BUG_ID + FS + "overview-frame.html",
+             "<TITLE>" + NL +
+diff --git a/test/com/sun/javadoc/testHelpOption/TestHelpOption.java b/test/com/sun/javadoc/testHelpOption/TestHelpOption.java
+--- langtools/test/com/sun/javadoc/testHelpOption/TestHelpOption.java
++++ langtools/test/com/sun/javadoc/testHelpOption/TestHelpOption.java
+@@ -91,7 +91,8 @@
+ 
+     private static final String[][] TEST2 = {
+         {BUG_ID + FS + "TestHelpOption.html",
+-            "<A HREF=\"help-doc.html\"><FONT CLASS=\"NavBarFont1\">" +
+            "<B>Help</B></FONT></A>"
++            "<A HREF=\"help-doc.html\"><FONT CLASS=\"NavBarFont1\">" +
++            "<STRONG>Help</STRONG></FONT></A>"
+         },
+     };
+     private static final String[][] NEGATED_TEST2 = NO_TEST;
+diff --git a/test/com/sun/javadoc/testHref/TestHref.java b/test/com/sun/javadoc/testHref/TestHref.java
+--- langtools/test/com/sun/javadoc/testHref/TestHref.java
++++ langtools/test/com/sun/javadoc/testHref/TestHref.java
+@@ -67,7 +67,7 @@
+         },
+         //@see test.
+         {BUG_ID + FS + "pkg" + FS + "C2.html",
+-            "See Also:</B><DD><A HREF=\"../pkg/C1.html#method(int, int, java.util.ArrayList)\">"
++            "See Also:</STRONG><DD><A HREF=\"../pkg/C1.html#method(int, int, java.util.ArrayList)\">"
+         },
+ 
+         //Header does not link to the page itself.
+@@ -77,7 +77,7 @@
+ 
+         //Signature does not link to the page itself.
+         {BUG_ID + FS + "pkg" + FS + "C4.html",
+-            "public abstract class <B>C4<E extends C4<E>></B>"
++            "public abstract class <STRONG>C4<E extends C4<E>></STRONG>"
+         },
+     };
+     private static final String[][] NEGATED_TEST =
+diff --git a/test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java b/test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java
+new file mode 100644
+--- /dev/null
++++ langtools/test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java
+@@ -0,0 +1,82 @@
++/*
++ * Copyright 1999-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.
++ */
++
++/*
++ * @test
++ * @bug 6786028
++ * @summary This test verifys the use of <strong> HTML tag instead of <B> by Javadoc std doclet.
++ * @author Bhavesh Patel
++ * @library ../lib/
++ * @build JavadocTester
++ * @build TestHtmlStrongTag
++ * @run main TestHtmlStrongTag
++ */
++
++public class TestHtmlStrongTag extends JavadocTester {
++
++    private static final String BUG_ID = "6786028";
++    private static final String[][] TEST1 = {
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<STRONG>Method Summary</STRONG>"},
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<STRONG>See Also:</STRONG>"},
++        {BUG_ID + FS + "pkg1" + FS + "package-summary.html", "<STRONG>Class Summary</STRONG>"}};
++    private static final String[][] NEGATED_TEST1 = {
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<B>"}};
++    private static final String[][] TEST2 = {
++        {BUG_ID + FS + "pkg2" + FS + "C2.html", "<STRONG>Method Summary</STRONG>"},
++        {BUG_ID + FS + "pkg2" + FS + "C2.html", "<B>Comments:</B>"},
++        {BUG_ID + FS + "pkg1" + FS + "package-summary.html", "<STRONG>Class Summary</STRONG>"}};
++
++    private static final String[] ARGS1 =
++        new String[] {
++            "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1"};
++    private static final String[] ARGS2 =
++        new String[] {
++            "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg2"};
++
++    /**
++     * The entry point of the test.
++     * @param args the array of command line arguments.
++     */
++    public static void main(String[] args) {
++        TestHtmlStrongTag tester = new TestHtmlStrongTag();
++        run(tester, ARGS1, TEST1, NEGATED_TEST1);
++        run(tester, ARGS2, TEST2, NO_TEST);
++        tester.printSummary();
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public String getBugId() {
++        return BUG_ID;
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public String getBugName() {
++        return getClass().getName();
++    }
++}
+diff --git a/test/com/sun/javadoc/testHtmlStrongTag/pkg1/C1.java b/test/com/sun/javadoc/testHtmlStrongTag/pkg1/C1.java
+new file mode 100644
+--- /dev/null
++++ langtools/test/com/sun/javadoc/testHtmlStrongTag/pkg1/C1.java
+@@ -0,0 +1,36 @@
++/*
++ * Copyright 1999-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 pkg1;
++
++/**
++ * @see java.lang.Object#wait(long, int)
++ */
++public class C1 {
++
++    public void method(int param1, int param2) {
++
++    }
++}
+diff --git a/test/com/sun/javadoc/testHtmlStrongTag/pkg2/C2.java b/test/com/sun/javadoc/testHtmlStrongTag/pkg2/C2.java
+new file mode 100644
+--- /dev/null
++++ langtools/test/com/sun/javadoc/testHtmlStrongTag/pkg2/C2.java
+@@ -0,0 +1,31 @@
++/*
++ * Copyright 1999-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 pkg2;
++
++/**
++ * <B>Comments:</B> Class 2
++ */
++public class C2 {}
+diff --git a/test/com/sun/javadoc/testIndex/TestIndex.java b/test/com/sun/javadoc/testIndex/TestIndex.java
+--- langtools/test/com/sun/javadoc/testIndex/TestIndex.java
++++ langtools/test/com/sun/javadoc/testIndex/TestIndex.java
+@@ -54,27 +54,27 @@
+ 
+         //Test index-all.html
+         {BUG_ID + FS + "index-all.html",
+-            "<A HREF=\"./pkg/C.html\" title=\"class in pkg\"><B>C</B></A>" +
++            "<A HREF=\"./pkg/C.html\" title=\"class in pkg\"><STRONG>C</STRONG></A>" +
+             " - Class in <A HREF=\"./pkg/package-summary.html\">pkg</A>"},
+         {BUG_ID + FS + "index-all.html",
+             "<A HREF=\"./pkg/Interface.html\" title=\"interface in pkg\">" +
+-            "<B>Interface</B></A> - Interface in " +
++            "<STRONG>Interface</STRONG></A> - Interface in " +
+             "<A HREF=\"./pkg/package-summary.html\">pkg</A>"},
+         {BUG_ID + FS + "index-all.html",
+             "<A HREF=\"./pkg/AnnotationType.html\" title=\"annotation in pkg\">" +
+-            "<B>AnnotationType</B></A> - Annotation Type in " +
++            "<STRONG>AnnotationType</STRONG></A> - Annotation Type in " +
+             "<A HREF=\"./pkg/package-summary.html\">pkg</A>"},
+         {BUG_ID + FS + "index-all.html",
+             "<A HREF=\"./pkg/Coin.html\" title=\"enum in pkg\">" +
+-            "<B>Coin</B></A> - Enum in " +
++            "<STRONG>Coin</STRONG></A> - Enum in " +
+             "<A HREF=\"./pkg/package-summary.html\">pkg</A>"},
+         {BUG_ID + FS + "index-all.html",
+             "Class in <A HREF=\"./package-summary.html\"><Unnamed></A>"},
+         {BUG_ID + FS + "index-all.html",
+-            "<DT><A HREF=\"./pkg/C.html#Java\"><B>Java</B></A> - " + NL +
++            "<DT><A HREF=\"./pkg/C.html#Java\"><STRONG>Java</STRONG></A> - " + NL +
+             "Static variable in class pkg.<A HREF=\"./pkg/C.html\" title=\"class in pkg\">C</A>" + NL +
+             "<DD> " + NL +
+-            "<DT><A HREF=\"./pkg/C.html#JDK\"><B>JDK</B></A> - " + NL +
++            "<DT><A HREF=\"./pkg/C.html#JDK\"><STRONG>JDK</STRONG></A> - " + NL +
+             "Static variable in class pkg.<A HREF=\"./pkg/C.html\" title=\"class in pkg\">C</A>" + NL +
+             "<DD> "},
+     };
+diff --git a/test/com/sun/javadoc/testInterface/TestInterface.java b/test/com/sun/javadoc/testInterface/TestInterface.java
+--- langtools/test/com/sun/javadoc/testInterface/TestInterface.java
++++ langtools/test/com/sun/javadoc/testInterface/TestInterface.java
+@@ -48,14 +48,14 @@
+     //Input for string search tests.
+     private static final String[][] TEST = {
+         {BUG_ID + FS + "pkg" + FS + "Interface.html",
+-            "int <B>method</B>()"},
++            "int <STRONG>method</STRONG>()"},
+         {BUG_ID + FS + "pkg" + FS + "Interface.html",
+-            "static final int <B>field</B>"},
++            "static final int <STRONG>field</STRONG>"},
+ 
+ 
+         // Make sure known implementing class list is correct and omits type parameters.
+         {BUG_ID + FS + "pkg" + FS + "Interface.html",
+-            "<DT><B>All Known Implementing Classes:</B> " +
++            "<DT><STRONG>All Known Implementing Classes:</STRONG> " +
+             "<DD><A HREF=\"../pkg/Child.html\" " +
+             "title=\"class in pkg\">Child</A>, " +
+             "<A HREF=\"../pkg/Parent.html\" title=\"class in pkg\">" +
+@@ -63,34 +63,34 @@
+ 
+          // Make sure "All Implemented Interfaces": has substituted type parameters
+          {BUG_ID + FS + "pkg" + FS + "Child.html",
+-            "<B>All Implemented Interfaces:</B> <DD><A HREF=\"../pkg/Interface.html\" title=\"interface in pkg\">Interface</A><T>"
++            "<STRONG>All Implemented Interfaces:</STRONG> <DD><A HREF=\"../pkg/Interface.html\" title=\"interface in pkg\">Interface</A><T>"
+          },
+          //Make sure Class Tree has substituted type parameters.
+          {BUG_ID + FS + "pkg" + FS + "Child.html",
+             "<PRE>" + NL +
+             "java.lang.Object" + NL +
+             "  <IMG SRC=\"../resources/inherit.gif\" ALT=\"extended by \"><A HREF=\"../pkg/Parent.html\" title=\"class in pkg\">pkg.Parent</A><T>" + NL +
+-            "      <IMG SRC=\"../resources/inherit.gif\" ALT=\"extended by \"><B>pkg.Child<T></B>" + NL +
++            "      <IMG SRC=\"../resources/inherit.gif\" ALT=\"extended by \"><STRONG>pkg.Child<T></STRONG>" + NL +
+             "</PRE>"
+          },
+          //Make sure "Direct Know Subclasses" omits type parameters
+         {BUG_ID + FS + "pkg" + FS + "Parent.html",
+-            "<B>Direct Known Subclasses:</B> <DD><A HREF=\"../pkg/Child.html\" title=\"class in pkg\">Child</A>"
++            "<STRONG>Direct Known Subclasses:</STRONG> <DD><A HREF=\"../pkg/Child.html\" title=\"class in pkg\">Child</A>"
+         },
+         //Make sure "Specified By" has substituted type parameters.
+         {BUG_ID + FS + "pkg" + FS + "Child.html",
+-            "<B>Specified by:</B><DD><CODE><A HREF=\"../pkg/Interface.html#method()\">method</A></CODE> in interface <CODE><A HREF=\"../pkg/Interface.html\" title=\"interface in pkg\">Interface</A><<A HREF=\"../pkg/Child.html\" title=\"type parameter in Child\">T</A>></CODE>"
++            "<STRONG>Specified by:</STRONG><DD><CODE><A HREF=\"../pkg/Interface.html#method()\">method</A></CODE> in interface <CODE><A HREF=\"../pkg/Interface.html\" title=\"interface in pkg\">Interface</A><<A HREF=\"../pkg/Child.html\" title=\"type parameter in Child\">T</A>></CODE>"
+          },
+         //Make sure "Overrides" has substituted type parameters.
+         {BUG_ID + FS + "pkg" + FS + "Child.html",
+-            "<B>Overrides:</B><DD><CODE><A HREF=\"../pkg/Parent.html#method()\">method</A></CODE> in class <CODE><A HREF=\"../pkg/Parent.html\" title=\"class in pkg\">Parent</A><<A HREF=\"../pkg/Child.html\" title=\"type parameter in Child\">T</A>></CODE>"
++            "<STRONG>Overrides:</STRONG><DD><CODE><A HREF=\"../pkg/Parent.html#method()\">method</A></CODE> in class <CODE><A HREF=\"../pkg/Parent.html\" title=\"class in pkg\">Parent</A><<A HREF=\"../pkg/Child.html\" title=\"type parameter in Child\">T</A>></CODE>"
+          },
+     };
+     private static final String[][] NEGATED_TEST = {
+         {BUG_ID + FS + "pkg" + FS + "Interface.html",
+-            "public int <B>method</B>()"},
++            "public int <STRONG>method</STRONG>()"},
+         {BUG_ID + FS + "pkg" + FS + "Interface.html",
+-            "public static final int <B>field</B>"},
++            "public static final int <STRONG>field</STRONG>"},
+     };
+ 
+     /**
+diff --git a/test/com/sun/javadoc/testJavascript/TestJavascript.java b/test/com/sun/javadoc/testJavascript/TestJavascript.java
+--- langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java
++++ langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java
+@@ -45,9 +45,9 @@
+     //Input for string search tests.
+     private static final String[][] TEST = {
+         {BUG_ID + FS + "pkg" + FS + "C.html",
+-            "<A HREF=\"../index.html?pkg/C.html\" target=\"_top\"><B>FRAMES</B></A>"},
++            "<A HREF=\"../index.html?pkg/C.html\" target=\"_top\"><STRONG>FRAMES</STRONG></A>"},
+         {BUG_ID + FS + "TestJavascript.html",
+-            "<A HREF=\"index.html?TestJavascript.html\" target=\"_top\"><B>FRAMES</B></A>"},
++            "<A HREF=\"index.html?TestJavascript.html\" target=\"_top\"><STRONG>FRAMES</STRONG></A>"},
+         {BUG_ID + FS + "index.html",
+             "<SCRIPT type=\"text/javascript\">" + NL +
+                         "    targetPage = \"\" + window.location.search;" + NL +
+diff --git a/test/com/sun/javadoc/testLinkOption/TestLinkOption.java b/test/com/sun/javadoc/testLinkOption/TestLinkOption.java
+--- langtools/test/com/sun/javadoc/testLinkOption/TestLinkOption.java
++++ langtools/test/com/sun/javadoc/testLinkOption/TestLinkOption.java
+@@ -63,7 +63,7 @@
+             "title=\"class or interface in java.lang\">Object</A> p3)"
+         },
+         {BUG_ID + "-1" + FS + "java" + FS + "lang" + FS + "StringBuilderChild.html",
+-                "public abstract class <B>StringBuilderChild</B><DT>extends <A HREF=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true\" title=\"class or interface in java.lang\">Object</A>"
++                "public abstract class <STRONG>StringBuilderChild</STRONG><DT>extends <A HREF=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true\" title=\"class or interface in java.lang\">Object</A>"
+         },
+ 
+     };
+diff --git a/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java b/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java
+--- langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java
++++ langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java
+@@ -59,7 +59,7 @@
+             " Link to another inner class: <A HREF=\"../pkg/C.InnerC2.html\" title=\"class in pkg\"><CODE>C.InnerC2</CODE></A>"
+         },
+         {BUG_ID + FS + "pkg" + FS + "C.InnerC2.html",
+-            "Enclosing class:</B><DD><A HREF=\"../pkg/C.html\" title=\"class in pkg\">C</A>"
++            "Enclosing class:</STRONG><DD><A HREF=\"../pkg/C.html\" title=\"class in pkg\">C</A>"
+         },
+     };
+     private static final String[][] NEGATED_TEST = {
+diff --git a/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java b/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java
+--- langtools/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java
++++ langtools/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java
+@@ -64,13 +64,17 @@
+ 
+         // New labels as of 1.5.0
+         {BUG_ID + FS + "pkg" + FS + "SubClass.html",
+-         "<B>Nested classes/interfaces inherited from class pkg." +
+         "<A HREF=\"../pkg/BaseClass.html\" title=\"class in pkg\">" +
+         "BaseClass</A></B>"},
++         "<STRONG>Nested classes/interfaces inherited from class pkg." +
++         "<A HREF=\"../pkg/BaseClass.html\" title=\"class in pkg\">" +
++         "BaseClass</A></STRONG>"},
+         {BUG_ID + FS + "pkg" + FS + "SubClass.html",
+-         "<B>Nested classes/interfaces inherited from interface pkg." +
+         "<A HREF=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">" +
+         "BaseInterface</A></B>"},
++         "<STRONG>Nested classes/interfaces inherited from interface pkg." +
++         "<A HREF=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">" +
++         "BaseInterface</A></STRONG>"},
+ 
+          // Test overriding/implementing methods with generic parameters.
+                  {BUG_ID + FS + "pkg" + FS + "BaseClass.html",
+-         "<DT><B>Specified by:</B><DD><CODE><A HREF=\"../pkg/BaseInterface.html#getAnnotation(java.lang.Class)\">getAnnotation</A></CODE> in interface <CODE><A HREF=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">BaseInterface</A></CODE></DL>"},
++         "<DT><STRONG>Specified by:</STRONG><DD><CODE><A HREF=\"../pkg/BaseInterface.html#getAnnotation(java.lang.Class)\">getAnnotation</A></CODE> in interface <CODE><A HREF=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">BaseInterface</A></CODE></DL>"},
+ 
+          // Test diamond inheritence member summary (6256068)
+                  {BUG_ID + FS + "diamond" + FS + "Z.html",
+diff --git a/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java b/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java
+--- langtools/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java
++++ langtools/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java
+@@ -50,14 +50,14 @@
+         {BUG_ID + FS + "pkg" + FS + "PublicChild.html",
+             "<CODE> <A HREF=\"../pkg/PublicChild.html\" " +
+             "title=\"class in pkg\">PublicChild</A></CODE></FONT></TD>" + NL +
+-            "<TD><CODE><B><A HREF=\"../pkg/PublicChild.html#" +
+-            "returnTypeTest()\">returnTypeTest</A></B>()</CODE>"
++            "<TD><CODE><STRONG><A HREF=\"../pkg/PublicChild.html#" +
++            "returnTypeTest()\">returnTypeTest</A></STRONG>()</CODE>"
+         },
+         // Check return type in member detail.
+         {BUG_ID + FS + "pkg" + FS + "PublicChild.html",
+             "public <A HREF=\"../pkg/PublicChild.html\" " +
+             "title=\"class in pkg\">PublicChild</A> " +
+-            "<B>returnTypeTest</B>()"
++            "<STRONG>returnTypeTest</STRONG>()"
+         },
+ 
+          // Legacy anchor dimensions (6290760)
+diff --git a/test/com/sun/javadoc/testNavagation/TestNavagation.java b/test/com/sun/javadoc/testNavagation/TestNavagation.java
+--- langtools/test/com/sun/javadoc/testNavagation/TestNavagation.java
++++ langtools/test/com/sun/javadoc/testNavagation/TestNavagation.java
+@@ -47,17 +47,17 @@
+     private static final String[][] TEST = {
+         {BUG_ID + FS + "pkg" + FS + "A.html", " PREV CLASS "},
+         {BUG_ID + FS + "pkg" + FS + "A.html",
+-            "<A HREF=\"../pkg/C.html\" title=\"class in pkg\"><B>NEXT CLASS</B></A>"},
++            "<A HREF=\"../pkg/C.html\" title=\"class in pkg\"><STRONG>NEXT CLASS</STRONG></A>"},
+         {BUG_ID + FS + "pkg" + FS + "C.html",
+-            "<A HREF=\"../pkg/A.html\" title=\"annotation in pkg\"><B>PREV CLASS</B></A>"},
++            "<A HREF=\"../pkg/A.html\" title=\"annotation in pkg\"><STRONG>PREV CLASS</STRONG></A>"},
+         {BUG_ID + FS + "pkg" + FS + "C.html",
+-            "<A HREF=\"../pkg/E.html\" title=\"enum in pkg\"><B>NEXT CLASS</B></A>"},
++            "<A HREF=\"../pkg/E.html\" title=\"enum in pkg\"><STRONG>NEXT CLASS</STRONG></A>"},
+         {BUG_ID + FS + "pkg" + FS + "E.html",
+-            "<A HREF=\"../pkg/C.html\" title=\"class in pkg\"><B>PREV CLASS</B></A>"},
++            "<A HREF=\"../pkg/C.html\" title=\"class in pkg\"><STRONG>PREV CLASS</STRONG></A>"},
+         {BUG_ID + FS + "pkg" + FS + "E.html",
+-            "<A HREF=\"../pkg/I.html\" title=\"interface in pkg\"><B>NEXT CLASS</B></A>"},
++            "<A HREF=\"../pkg/I.html\" title=\"interface in pkg\"><STRONG>NEXT CLASS</STRONG></A>"},
+         {BUG_ID + FS + "pkg" + FS + "I.html",
+-            "<A HREF=\"../pkg/E.html\" title=\"enum in pkg\"><B>PREV CLASS</B></A>"},
++            "<A HREF=\"../pkg/E.html\" title=\"enum in pkg\"><STRONG>PREV CLASS</STRONG></A>"},
+         {BUG_ID + FS + "pkg" + FS + "I.html", " NEXT CLASS"},
+         // Test for 4664607
+         {BUG_ID + FS + "pkg" + FS + "I.html",
+diff --git a/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java b/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java
+--- langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java
++++ langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java
+@@ -54,14 +54,14 @@
+             {BUG_ID + FS + "pkg" + FS + "Coin.html", "Enum Coin</H2>"},
+             //Make sure enum signature is correct.
+             {BUG_ID + FS + "pkg" + FS + "Coin.html", "public enum "+
+-                "<B>Coin</B><DT>extends java.lang.Enum<" +
++                "<STRONG>Coin</STRONG><DT>extends java.lang.Enum<" +
+                 "<A HREF=\"../pkg/Coin.html\" title=\"enum in pkg\">Coin</A>>"
+             },
+             //Check for enum constant section
+-            {BUG_ID + FS + "pkg" + FS + "Coin.html", "<B>Enum Constant Summary</B>"},
++            {BUG_ID + FS + "pkg" + FS + "Coin.html", "<STRONG>Enum Constant Summary</STRONG>"},
+             //Detail for enum constant
+             {BUG_ID + FS + "pkg" + FS + "Coin.html",
+-                "<B><A HREF=\"../pkg/Coin.html#Dime\">Dime</A></B>"},
++                "<STRONG><A HREF=\"../pkg/Coin.html#Dime\">Dime</A></STRONG>"},
+             //Automatically insert documentation for values() and valueOf().
+             {BUG_ID + FS + "pkg" + FS + "Coin.html",
+                 "Returns an array containing the constants of this enum type,"},
+@@ -79,11 +79,11 @@
+                 "Class TypeParameters<E></H2>"},
+             //Check class type parameters section.
+             {BUG_ID + FS + "pkg" + FS + "TypeParameters.html",
+-                "<DT><B>Type Parameters:</B><DD><CODE>E</CODE> - " +
++                "<DT><STRONG>Type Parameters:</STRONG><DD><CODE>E</CODE> - " +
+                 "the type parameter for this class."},
+             //Type parameters in @see/@link
+             {BUG_ID + FS + "pkg" + FS + "TypeParameters.html",
+-                "<DT><B>See Also:</B><DD><A HREF=\"../pkg/TypeParameters.html\" " +
++                "<DT><STRONG>See Also:</STRONG><DD><A HREF=\"../pkg/TypeParameters.html\" " +
+                     "title=\"class in pkg\"><CODE>TypeParameters</CODE></A></DL>"},
+             //Method that uses class type parameter.
+             {BUG_ID + FS + "pkg" + FS + "TypeParameters.html",
+@@ -91,13 +91,13 @@
+                     "parameter in TypeParameters\">E</A> param)"},
+             //Method type parameter section.
+             {BUG_ID + FS + "pkg" + FS + "TypeParameters.html",
+-                "<B>Type Parameters:</B><DD><CODE>T</CODE> - This is the first " +
++                "<STRONG>Type Parameters:</STRONG><DD><CODE>T</CODE> - This is the first " +
+                     "type parameter.<DD><CODE>V</CODE> - This is the second type " +
+                     "parameter."},
+             //Signature of method with type parameters
+             {BUG_ID + FS + "pkg" + FS + "TypeParameters.html",
+                 "public <T extends java.util.List,V> " +
+-                    "java.lang.String[] <B>methodThatHasTypeParameters</B>"},
++                    "java.lang.String[] <STRONG>methodThatHasTypeParameters</STRONG>"},
+             //Wildcard testing.
+             {BUG_ID + FS + "pkg" + FS + "Wildcards.html",
+                 "<A HREF=\"../pkg/TypeParameters.html\" title=\"class in pkg\">" +
+@@ -116,18 +116,18 @@
+ 
+             //Signature of subclass that has type parameters.
+             {BUG_ID + FS + "pkg" + FS + "TypeParameterSubClass.html",
+-                "public class <B>TypeParameterSubClass<T extends java.lang.String>" +
+-                "</B><DT>extends <A HREF=\"../pkg/TypeParameterSuperClass.html\" " +
++                "public class <STRONG>TypeParameterSubClass<T extends java.lang.String>" +
++                "</STRONG><DT>extends <A HREF=\"../pkg/TypeParameterSuperClass.html\" " +
+                 "title=\"class in pkg\">TypeParameterSuperClass</A><T>"},
+ 
+             //Interface generic parameter substitution
+             //Signature of subclass that has type parameters.
+             {BUG_ID + FS + "pkg" + FS + "TypeParameters.html",
+-                "<B>All Implemented Interfaces:</B> <DD><A HREF=\"../pkg/SubInterface.html\" title=\"interface in pkg\">SubInterface</A><E>, <A HREF=\"../pkg/SuperInterface.html\" title=\"interface in pkg\">SuperInterface</A><E></DD>"},
++                "<STRONG>All Implemented Interfaces:</STRONG> <DD><A HREF=\"../pkg/SubInterface.html\" title=\"interface in pkg\">SubInterface</A><E>, <A HREF=\"../pkg/SuperInterface.html\" title=\"interface in pkg\">SuperInterface</A><E></DD>"},
+             {BUG_ID + FS + "pkg" + FS + "SuperInterface.html",
+-                "<B>All Known Subinterfaces:</B> <DD><A HREF=\"../pkg/SubInterface.html\" title=\"interface in pkg\">SubInterface</A><V></DD>"},
++                "<STRONG>All Known Subinterfaces:</STRONG> <DD><A HREF=\"../pkg/SubInterface.html\" title=\"interface in pkg\">SubInterface</A><V></DD>"},
+             {BUG_ID + FS + "pkg" + FS + "SubInterface.html",
+-                "<B>All Superinterfaces:</B> <DD><A HREF=\"../pkg/SuperInterface.html\" title=\"interface in pkg\">SuperInterface</A><V></DD>"},
++                "<STRONG>All Superinterfaces:</STRONG> <DD><A HREF=\"../pkg/SuperInterface.html\" title=\"interface in pkg\">SuperInterface</A><V></DD>"},
+ 
+             //=================================
+             // VAR ARG TESTING
+@@ -155,18 +155,18 @@
+                 "Annotation Type AnnotationType</H2>"},
+             //Make sure the signature is correct.
+             {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
+-                "public @interface <B>AnnotationType</B>"},
++                "public @interface <STRONG>AnnotationType</STRONG>"},
+             //Make sure member summary headings are correct.
+             {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
+-                "<B>Required Element Summary</B>"},
++                "<STRONG>Required Element Summary</STRONG>"},
+             {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
+-                "<B>Optional Element Summary</B>"},
++                "<STRONG>Optional Element Summary</STRONG>"},
+             //Make sure element detail heading is correct
+             {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
+                 "Element Detail"},
+             //Make sure default annotation type value is printed when necessary.
+             {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
+-                "<B>Default:</B><DD>\"unknown\"</DD>"},
++                "<STRONG>Default:</STRONG><DD>\"unknown\"</DD>"},
+ 
+             //=================================
+             // ANNOTATION TYPE USAGE TESTING
+@@ -182,40 +182,40 @@
+                 "<FONT SIZE=\"-1\">" +
+                 "<A HREF=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</A>(<A HREF=\"../pkg/AnnotationType.html#optional()\">optional</A>=\"Class Annotation\","+NL +
+                 "                <A HREF=\"../pkg/AnnotationType.html#required()\">required</A>=1994)"+NL +
+-                "</FONT>public class <B>AnnotationTypeUsage</B><DT>extends java.lang.Object</DL>"},
++                "</FONT>public class <STRONG>AnnotationTypeUsage</STRONG><DT>extends java.lang.Object</DL>"},
+ 
+             //FIELD
+             {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
+                 "<FONT SIZE=\"-1\">" +
+                 "<A HREF=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</A>(<A HREF=\"../pkg/AnnotationType.html#optional()\">optional</A>=\"Field Annotation\","+NL +
+                 "                <A HREF=\"../pkg/AnnotationType.html#required()\">required</A>=1994)"+NL +
+-                "</FONT>public int <B>field</B>"},
++                "</FONT>public int <STRONG>field</STRONG>"},
+ 
+             //CONSTRUCTOR
+             {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
+                 "<FONT SIZE=\"-1\">" +
+                 "<A HREF=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</A>(<A HREF=\"../pkg/AnnotationType.html#optional()\">optional</A>=\"Constructor Annotation\","+NL +
+                 "                <A HREF=\"../pkg/AnnotationType.html#required()\">required</A>=1994)"+NL +
+-                "</FONT>public <B>AnnotationTypeUsage</B>()"},
++                "</FONT>public <STRONG>AnnotationTypeUsage</STRONG>()"},
+ 
+             //METHOD
+             {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
+                 "<FONT SIZE=\"-1\">" +
+                 "<A HREF=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</A>(<A HREF=\"../pkg/AnnotationType.html#optional()\">optional</A>=\"Method Annotation\","+NL +
+                 "                <A HREF=\"../pkg/AnnotationType.html#required()\">required</A>=1994)"+NL +
+-                "</FONT>public void <B>method</B>()"},
++                "</FONT>public void <STRONG>method</STRONG>()"},
+ 
+             //METHOD PARAMS
+             {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
+                 "<PRE>" + NL +
+-                "public void <B>methodWithParams</B>(<FONT SIZE=\"-1\"><A HREF=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</A>(<A HREF=\"../pkg/AnnotationType.html#optional()\">optional</A>=\"Parameter Annotation\",<A HREF=\"../pkg/AnnotationType.html#required()\">required</A>=1994)</FONT>" + NL +
++                "public void <STRONG>methodWithParams</STRONG>(<FONT SIZE=\"-1\"><A HREF=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</A>(<A HREF=\"../pkg/AnnotationType.html#optional()\">optional</A>=\"Parameter Annotation\",<A HREF=\"../pkg/AnnotationType.html#required()\">required</A>=1994)</FONT>" + NL +
+                 "                             int documented," + NL +
+                 "                             int undocmented)</PRE>"},
+ 
+             //CONSTRUCTOR PARAMS
+             {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
+                 "<PRE>" + NL +
+-                                "public <B>AnnotationTypeUsage</B>(<FONT SIZE=\"-1\"><A HREF=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</A>(<A HREF=\"../pkg/AnnotationType.html#optional()\">optional</A>=\"Constructor Param Annotation\",<A HREF=\"../pkg/AnnotationType.html#required()\">required</A>=1994)</FONT>" + NL +
++                                "public <STRONG>AnnotationTypeUsage</STRONG>(<FONT SIZE=\"-1\"><A HREF=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</A>(<A HREF=\"../pkg/AnnotationType.html#optional()\">optional</A>=\"Constructor Param Annotation\",<A HREF=\"../pkg/AnnotationType.html#required()\">required</A>=1994)</FONT>" + NL +
+                                 "                           int documented," + NL +
+                 "                           int undocmented)</PRE>"},
+ 
+@@ -270,7 +270,7 @@
+             {BUG_ID + FS + "pkg1" + FS + "B.html",
+                 "<PRE><FONT SIZE=\"-1\"><A HREF=\"../pkg1/A.html\" title=\"annotation in pkg1\">@A</A>"},
+             {BUG_ID + FS + "pkg1" + FS + "B.html",
+-                "</FONT>public interface <B>B</B></DL>" + NL +
++                "</FONT>public interface <STRONG>B</STRONG></DL>" + NL +
+                     "</PRE>"},
+ 
+ 
+@@ -278,7 +278,7 @@
+             // Handle multiple bounds.
+             //==============================================================
+             {BUG_ID + FS + "pkg" + FS + "MultiTypeParameters.html",
+-                "public <T extends java.lang.Number & java.lang.Runnable> T <B>foo</B>(T t)"},
++                "public <T extends java.lang.Number & java.lang.Runnable> T <STRONG>foo</STRONG>(T t)"},
+ 
+             //==============================================================
+             // Test Class-Use Documenation for Type Parameters.
+@@ -289,13 +289,13 @@
+                  "<TH ALIGN=\"left\" COLSPAN=\"2\">Classes in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo</A></FONT></TH>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html",
+-                "<TD><CODE><B><A HREF=\"../../pkg2/ClassUseTest1.html\" title=\"class in pkg2\">ClassUseTest1<T extends Foo & Foo2></A></B></CODE>"
++                "<TD><CODE><STRONG><A HREF=\"../../pkg2/ClassUseTest1.html\" title=\"class in pkg2\">ClassUseTest1<T extends Foo & Foo2></A></STRONG></CODE>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html",
+                 "<TH ALIGN=\"left\" COLSPAN=\"2\">Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo</A></FONT></TH>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html",
+-                "<TD><CODE><B>ClassUseTest1.</B><B><A HREF=\"../../pkg2/ClassUseTest1.html#method(T)\">method</A></B>(T t)</CODE>"
++                "<TD><CODE><STRONG>ClassUseTest1.</STRONG><STRONG><A HREF=\"../../pkg2/ClassUseTest1.html#method(T)\">method</A></STRONG>(T t)</CODE>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html",
+                 "<TH ALIGN=\"left\" COLSPAN=\"2\">Fields in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo</A></FONT></TH>"
+@@ -315,13 +315,13 @@
+             "<TH ALIGN=\"left\" COLSPAN=\"2\">Classes in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/Foo2.html\" title=\"interface in pkg2\">Foo2</A></FONT></TH>"
+            },
+            {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html",
+-            "<TD><CODE><B><A HREF=\"../../pkg2/ClassUseTest1.html\" title=\"class in pkg2\">ClassUseTest1<T extends Foo & Foo2></A></B></CODE>"
++            "<TD><CODE><STRONG><A HREF=\"../../pkg2/ClassUseTest1.html\" title=\"class in pkg2\">ClassUseTest1<T extends Foo & Foo2></A></STRONG></CODE>"
+            },
+            {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html",
+                "<TH ALIGN=\"left\" COLSPAN=\"2\">Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/Foo2.html\" title=\"interface in pkg2\">Foo2</A></FONT></TH>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html",
+-               "<TD><CODE><B>ClassUseTest1.</B><B><A HREF=\"../../pkg2/ClassUseTest1.html#method(T)\">method</A></B>(T t)</CODE>"
++               "<TD><CODE><STRONG>ClassUseTest1.</STRONG><STRONG><A HREF=\"../../pkg2/ClassUseTest1.html#method(T)\">method</A></STRONG>(T t)</CODE>"
+             },
+ 
+             //ClassUseTest2: <T extends ParamTest<Foo3>>
+@@ -329,13 +329,13 @@
+               "<TH ALIGN=\"left\" COLSPAN=\"2\">Classes in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest</A></FONT></TH>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
+-              "<TD><CODE><B><A HREF=\"../../pkg2/ClassUseTest2.html\" title=\"class in pkg2\">ClassUseTest2<T extends ParamTest<<A HREF=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3</A>>></A></B></CODE>"
++              "<TD><CODE><STRONG><A HREF=\"../../pkg2/ClassUseTest2.html\" title=\"class in pkg2\">ClassUseTest2<T extends ParamTest<<A HREF=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3</A>>></A></STRONG></CODE>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
+               "<TH ALIGN=\"left\" COLSPAN=\"2\">Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest</A></FONT></TH>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
+-              "<TD><CODE><B>ClassUseTest2.</B><B><A HREF=\"../../pkg2/ClassUseTest2.html#method(T)\">method</A></B>(T t)</CODE>"
++              "<TD><CODE><STRONG>ClassUseTest2.</STRONG><STRONG><A HREF=\"../../pkg2/ClassUseTest2.html#method(T)\">method</A></STRONG>(T t)</CODE>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
+               "<TH ALIGN=\"left\" COLSPAN=\"2\">Fields in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> declared as <A HREF=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest</A></FONT></TH>"
+@@ -354,13 +354,13 @@
+                 "<TH ALIGN=\"left\" COLSPAN=\"2\">Classes in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3</A></FONT></TH>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html",
+-                "<TD><CODE><B><A HREF=\"../../pkg2/ClassUseTest2.html\" title=\"class in pkg2\">ClassUseTest2<T extends ParamTest<<A HREF=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3</A>>></A></B></CODE>"
++                "<TD><CODE><STRONG><A HREF=\"../../pkg2/ClassUseTest2.html\" title=\"class in pkg2\">ClassUseTest2<T extends ParamTest<<A HREF=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3</A>>></A></STRONG></CODE>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html",
+                 "<TH ALIGN=\"left\" COLSPAN=\"2\">Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3</A></FONT></TH>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html",
+-                "<TD><CODE><B>ClassUseTest2.</B><B><A HREF=\"../../pkg2/ClassUseTest2.html#method(T)\">method</A></B>(T t)</CODE>"
++                "<TD><CODE><STRONG>ClassUseTest2.</STRONG><STRONG><A HREF=\"../../pkg2/ClassUseTest2.html#method(T)\">method</A></STRONG>(T t)</CODE>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html",
+                 "<TH ALIGN=\"left\" COLSPAN=\"2\">Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> that return types with arguments of type <A HREF=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3</A></FONT></TH>"
+@@ -374,13 +374,13 @@
+                 "<TH ALIGN=\"left\" COLSPAN=\"2\">Classes in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">ParamTest2</A></FONT></TH>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
+-                "<TD><CODE><B><A HREF=\"../../pkg2/ClassUseTest3.html\" title=\"class in pkg2\">ClassUseTest3<T extends ParamTest2<java.util.List<? extends Foo4>>></A></B></CODE>"
++                "<TD><CODE><STRONG><A HREF=\"../../pkg2/ClassUseTest3.html\" title=\"class in pkg2\">ClassUseTest3<T extends ParamTest2<java.util.List<? extends Foo4>>></A></STRONG></CODE>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
+                 "<TH ALIGN=\"left\" COLSPAN=\"2\">Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">ParamTest2</A></FONT></TH>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
+-                "<TD><CODE><B>ClassUseTest3.</B><B><A HREF=\"../../pkg2/ClassUseTest3.html#method(T)\">method</A></B>(T t)</CODE>"
++                "<TD><CODE><STRONG>ClassUseTest3.</STRONG><STRONG><A HREF=\"../../pkg2/ClassUseTest3.html#method(T)\">method</A></STRONG>(T t)</CODE>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
+                 "<TH ALIGN=\"left\" COLSPAN=\"2\">Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">ParamTest2</A></FONT></TH>"
+@@ -393,13 +393,13 @@
+                 "<TH ALIGN=\"left\" COLSPAN=\"2\">Classes in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</A></FONT></TH>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
+-                "<TD><CODE><B><A HREF=\"../../pkg2/ClassUseTest3.html\" title=\"class in pkg2\">ClassUseTest3<T extends ParamTest2<java.util.List<? extends Foo4>>></A></B></CODE>"
++                "<TD><CODE><STRONG><A HREF=\"../../pkg2/ClassUseTest3.html\" title=\"class in pkg2\">ClassUseTest3<T extends ParamTest2<java.util.List<? extends Foo4>>></A></STRONG></CODE>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
+                 "<TH ALIGN=\"left\" COLSPAN=\"2\">Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</A></FONT></TH>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
+-                "<TD><CODE><B>ClassUseTest3.</B><B><A HREF=\"../../pkg2/ClassUseTest3.html#method(T)\">method</A></B>(T t)</CODE>"
++                "<TD><CODE><STRONG>ClassUseTest3.</STRONG><STRONG><A HREF=\"../../pkg2/ClassUseTest3.html#method(T)\">method</A></STRONG>(T t)</CODE>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
+                 "<TH ALIGN=\"left\" COLSPAN=\"2\">Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> that return types with arguments of type <A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</A></FONT></TH>"
+@@ -415,13 +415,13 @@
+                 "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
+                 "<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\"><FONT SIZE=\"-1\">" + NL +
+                 "<CODE> void</CODE></FONT></TD>" + NL +
+-                "<TD><CODE><B>ClassUseTest3.</B><B><A HREF=\"../../pkg2/ClassUseTest3.html#method(java.util.Set)\">method</A></B>(java.util.Set<<A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</A>> p)</CODE>"
++                "<TD><CODE><STRONG>ClassUseTest3.</STRONG><STRONG><A HREF=\"../../pkg2/ClassUseTest3.html#method(java.util.Set)\">method</A></STRONG>(java.util.Set<<A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</A>> p)</CODE>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
+                 "<TH ALIGN=\"left\" COLSPAN=\"2\">Constructor parameters in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type arguments of type <A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</A></FONT></TH>" + NL +
+                 "</TR>" + NL +
+                 "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
+-                "<TD><CODE><B><A HREF=\"../../pkg2/ClassUseTest3.html#ClassUseTest3(java.util.Set)\">ClassUseTest3</A></B>(java.util.Set<<A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</A>> p)</CODE>"
++                "<TD><CODE><STRONG><A HREF=\"../../pkg2/ClassUseTest3.html#ClassUseTest3(java.util.Set)\">ClassUseTest3</A></STRONG>(java.util.Set<<A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</A>> p)</CODE>"
+             },
+ 
+             //=================================
+@@ -432,7 +432,7 @@
+                 "Packages with annotations of type <A HREF=\"../../pkg/AnnotationType.html\" title=\"annotation in pkg\">AnnotationType</A></FONT></TH>" + NL +
+                 "</TR>" + NL +
+                 "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
+-                "<TD><A HREF=\"../../pkg/package-summary.html\"><B>pkg</B></A></TD>"
++                "<TD><A HREF=\"../../pkg/package-summary.html\"><STRONG>pkg</STRONG></A></TD>"
+             },
+ 
+             {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "AnnotationType.html",
+@@ -441,7 +441,7 @@
+                 "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
+                 "<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\"><FONT SIZE=\"-1\">" + NL +
+                 "<CODE> class</CODE></FONT></TD>" + NL +
+-                "<TD><CODE><B><A HREF=\"../../pkg/AnnotationTypeUsage.html\" title=\"class in pkg\">AnnotationTypeUsage</A></B></CODE>"
++                "<TD><CODE><STRONG><A HREF=\"../../pkg/AnnotationTypeUsage.html\" title=\"class in pkg\">AnnotationTypeUsage</A></STRONG></CODE>"
+             },
+ 
+             {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "AnnotationType.html",
+@@ -450,7 +450,7 @@
+                 "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
+                 "<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\"><FONT SIZE=\"-1\">" + NL +
+                 "<CODE> int</CODE></FONT></TD>" + NL +
+-                "<TD><CODE><B>AnnotationTypeUsage.</B><B><A HREF=\"../../pkg/AnnotationTypeUsage.html#field\">field</A></B></CODE>"
++                "<TD><CODE><STRONG>AnnotationTypeUsage.</STRONG><STRONG><A HREF=\"../../pkg/AnnotationTypeUsage.html#field\">field</A></STRONG></CODE>"
+             },
+ 
+             {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "AnnotationType.html",
+@@ -459,7 +459,7 @@
+                 "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
+                 "<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\"><FONT SIZE=\"-1\">" + NL +
+                 "<CODE> void</CODE></FONT></TD>" + NL +
+-                "<TD><CODE><B>AnnotationTypeUsage.</B><B><A HREF=\"../../pkg/AnnotationTypeUsage.html#method()\">method</A></B>()</CODE>"
++                "<TD><CODE><STRONG>AnnotationTypeUsage.</STRONG><STRONG><A HREF=\"../../pkg/AnnotationTypeUsage.html#method()\">method</A></STRONG>()</CODE>"
+             },
+ 
+             {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "AnnotationType.html",
+@@ -468,7 +468,7 @@
+                 "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
+                 "<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\"><FONT SIZE=\"-1\">" + NL +
+                 "<CODE> void</CODE></FONT></TD>" + NL +
+-                "<TD><CODE><B>AnnotationTypeUsage.</B><B><A HREF=\"../../pkg/AnnotationTypeUsage.html#methodWithParams(int, int)\">methodWithParams</A></B>(int documented," + NL +
++                "<TD><CODE><STRONG>AnnotationTypeUsage.</STRONG><STRONG><A HREF=\"../../pkg/AnnotationTypeUsage.html#methodWithParams(int, int)\">methodWithParams</A></STRONG>(int documented," + NL +
+                 "                 int undocmented)</CODE>"
+             },
+ 
+@@ -476,14 +476,14 @@
+                 "Constructors in <A HREF=\"../../pkg/package-summary.html\">pkg</A> with annotations of type <A HREF=\"../../pkg/AnnotationType.html\" title=\"annotation in pkg\">AnnotationType</A></FONT></TH>" + NL +
+                 "</TR>" + NL +
+                 "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
+-                "<TD><CODE><B><A HREF=\"../../pkg/AnnotationTypeUsage.html#AnnotationTypeUsage()\">AnnotationTypeUsage</A></B>()</CODE>"
++                "<TD><CODE><STRONG><A HREF=\"../../pkg/AnnotationTypeUsage.html#AnnotationTypeUsage()\">AnnotationTypeUsage</A></STRONG>()</CODE>"
+             },
+ 
+             {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "AnnotationType.html",
+                 "Constructor parameters in <A HREF=\"../../pkg/package-summary.html\">pkg</A> with annotations of type <A HREF=\"../../pkg/AnnotationType.html\" title=\"annotation in pkg\">AnnotationType</A></FONT></TH>" + NL +
+                 "</TR>" + NL +
+                 "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
+-                "<TD><CODE><B><A HREF=\"../../pkg/AnnotationTypeUsage.html#AnnotationTypeUsage(int, int)\">AnnotationTypeUsage</A></B>(int documented," + NL +
++                "<TD><CODE><STRONG><A HREF=\"../../pkg/AnnotationTypeUsage.html#AnnotationTypeUsage(int, int)\">AnnotationTypeUsage</A></STRONG>(int documented," + NL +
+                 "                    int undocmented)</CODE>"
+             },
+ 
+@@ -491,13 +491,13 @@
+             // TYPE PARAMETER IN INDEX
+             //=================================
+             {BUG_ID + FS + "index-all.html",
+-                "<A HREF=\"./pkg2/Foo.html#method(java.util.Vector)\"><B>method(Vector<Object>)</B></A>"
++                "<A HREF=\"./pkg2/Foo.html#method(java.util.Vector)\"><STRONG>method(Vector<Object>)</STRONG></A>"
+             },
+             //=================================
+             // TYPE PARAMETER IN INDEX
+             //=================================
+             {BUG_ID + FS + "index-all.html",
+-                "<A HREF=\"./pkg2/Foo.html#method(java.util.Vector)\"><B>method(Vector<Object>)</B></A>"
++                "<A HREF=\"./pkg2/Foo.html#method(java.util.Vector)\"><STRONG>method(Vector<Object>)</STRONG></A>"
+             },
+         };
+     private static final String[][] NEGATED_TEST = {
+@@ -505,7 +505,7 @@
+         // ENUM TESTING
+         //=================================
+         //NO constructor section
+-        {BUG_ID + FS + "pkg" + FS + "Coin.html", "<B>Constructor Summary</B>"},
++        {BUG_ID + FS + "pkg" + FS + "Coin.html", "<STRONG>Constructor Summary</STRONG>"},
+         //=================================
+         // TYPE PARAMETER TESTING
+         //=================================
+@@ -525,28 +525,28 @@
+             "<FONT SIZE=\"-1\">" + NL +
+             "<A HREF=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</A>(<A HREF=\"../pkg/AnnotationType.html#optional\">optional</A>=\"Class Annotation\"," + NL +
+             "                <A HREF=\"../pkg/AnnotationType.html#required\">required</A>=1994)" + NL +
+-            "</FONT>public class <B>AnnotationTypeUsage</B><DT>extends java.lang.Object</DL>"},
++            "</FONT>public class <STRONG>AnnotationTypeUsage</STRONG><DT>extends java.lang.Object</DL>"},
+ 
+         //FIELD
+         {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
+             "<FONT SIZE=\"-1\">" + NL +
+             "<A HREF=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</A>(<A HREF=\"../pkg/AnnotationType.html#optional\">optional</A>=\"Field Annotation\"," + NL +
+             "                <A HREF=\"../pkg/AnnotationType.html#required\">required</A>=1994)" + NL +
+-            "</FONT>public int <B>field</B>"},
++            "</FONT>public int <STRONG>field</STRONG>"},
+ 
+         //CONSTRUCTOR
+         {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
+             "<FONT SIZE=\"-1\">" + NL +
+             "<A HREF=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</A>(<A HREF=\"../pkg/AnnotationType.html#optional\">optional</A>=\"Constructor Annotation\"," + NL +
+             "                <A HREF=\"../pkg/AnnotationType.html#required\">required</A>=1994)" + NL +
+-            "</FONT>public <B>AnnotationTypeUsage</B>()"},
++            "</FONT>public <STRONG>AnnotationTypeUsage</STRONG>()"},
+ 
+         //METHOD
+         {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
+             "<FONT SIZE=\"-1\">" + NL +
+             "<A HREF=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</A>(<A HREF=\"../pkg/AnnotationType.html#optional\">optional</A>=\"Method Annotation\"," + NL +
+             "                <A HREF=\"../pkg/AnnotationType.html#required\">required</A>=1994)" + NL +
+-            "</FONT>public void <B>method</B>()"},
++            "</FONT>public void <STRONG>method</STRONG>()"},
+ 
+         //=================================
+         // Make sure annotation types do not
+diff --git a/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java b/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java
+--- langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java
++++ langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java
+@@ -46,9 +46,9 @@
+     //Input for string search tests.
+     private static final String[][] TEST = {
+         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
+-            "<B>Description copied from class: <CODE>" +
++            "<STRONG>Description copied from class: <CODE>" +
+             "<A HREF=\"../pkg1/BaseClass.html#overridenMethodWithDocsToCopy()\">" +
+-            "BaseClass</A></CODE></B>"
++            "BaseClass</A></CODE></STRONG>"
+         }
+     };
+     private static final String[][] NEGATED_TEST = NO_TEST;
+diff --git a/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethods.java b/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethods.java
+--- langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethods.java
++++ langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethods.java
+@@ -40,11 +40,11 @@
+     private static final String[][] TEST = {
+         //The public method should be overriden
+         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
+-         "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"},
++         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"},
+ 
+         //The public method in different package should be overriden
+         {BUG_ID + FS + "pkg2" + FS + "SubClass.html",
+-         "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"}
++         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"}
+     };
+ 
+     private static final String[][] NEGATED_TEST = {
+@@ -52,20 +52,20 @@
+         //The package private method should be overriden since the base and sub class are in the same
+         //package.  However, the link should not show up because the package private methods are not documented.
+         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
+-         "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"},
++         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"},
+ 
+         //The private method in should not be overriden
+         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
+-         "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"},
++         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"},
+ 
+         //The private method in different package should not be overriden
+         {BUG_ID + FS + "pkg2" + FS + "SubClass.html",
+-         "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"},
++         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"},
+ 
+         //The package private method should not be overriden since the base and sub class are in
+         //different packages.
+         {BUG_ID + FS + "pkg2" + FS + "SubClass.html",
+-         "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"}
++         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"}
+     };
+ 
+     private static final String[] ARGS =
+diff --git a/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java b/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java
+--- langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java
++++ langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java
+@@ -40,32 +40,32 @@
+     private static final String[][] TEST = {
+         //The public method should be overriden
+         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
+-         "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"},
++         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"},
+ 
+         //The public method in different package should be overriden
+         {BUG_ID + FS + "pkg2" + FS + "SubClass.html",
+-         "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"},
++         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"},
+ 
+         //The package private method should be overriden since the base and sub class are in the same
+         //package.
+         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
+-         "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"}
++         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"}
+     };
+ 
+     private static final String[][] NEGATED_TEST = {
+ 
+         //The private method in should not be overriden
+         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
+-         "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"},
++         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"},
+ 
+         //The private method in different package should not be overriden
+         {BUG_ID + FS + "pkg2" + FS + "SubClass.html",
+-         "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"},
++         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"},
+ 
+         //The package private method should not be overriden since the base and sub class are in
+         //different packages.
+         {BUG_ID + FS + "pkg2" + FS + "SubClass.html",
+-         "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"},
++         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"},
+     };
+ 
+     private static final String[] ARGS =
+diff --git a/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPrivateFlag.java b/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPrivateFlag.java
+--- langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPrivateFlag.java
++++ langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPrivateFlag.java
+@@ -40,32 +40,32 @@
+     private static final String[][] TEST = {
+         //The public method should be overriden
+         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
+-         "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"},
++         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"},
+ 
+         //The package private method should be overriden since the base and sub class are in the same
+         //package.
+         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
+-         "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"},
++         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"},
+ 
+         //The public method in different package should be overriden
+         {BUG_ID + FS + "pkg2" + FS + "SubClass.html",
+-         "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"},
++         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"},
+     };
+ 
+     private static final String[][] NEGATED_TEST = {
+ 
+         //The private method in should not be overriden
+         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
+-         "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"},
++         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"},
+ 
+         //The private method in different package should not be overriden
+         {BUG_ID + FS + "pkg2" + FS + "SubClass.html",
+-         "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"},
++         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"},
+ 
+         //The package private method should not be overriden since the base and sub class are in
+         //different packages.
+         {BUG_ID + FS + "pkg2" + FS + "SubClass.html",
+-         "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"}
++         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"}
+ 
+ 
+     };
+diff --git a/test/com/sun/javadoc/testPackagePage/TestPackagePage.java b/test/com/sun/javadoc/testPackagePage/TestPackagePage.java
+--- langtools/test/com/sun/javadoc/testPackagePage/TestPackagePage.java
++++ langtools/test/com/sun/javadoc/testPackagePage/TestPackagePage.java
+@@ -43,23 +43,24 @@
+         },
+         //With just one package, all general pages link to the single package page.
+         {BUG_ID + "-1" + FS + "com" + FS + "pkg" + FS + "C.html",
+-            "<A HREF=\"../../com/pkg/package-summary.html\">" +
+            "<FONT CLASS=\"NavBarFont1\"><B>Package</B></FONT></A>"
++            "<A HREF=\"../../com/pkg/package-summary.html\">" +
++            "<FONT CLASS=\"NavBarFont1\"><STRONG>Package</STRONG></FONT></A>"
+         },
+         {BUG_ID + "-1" + FS + "com" + FS + "pkg" + FS + "package-tree.html",
+             "<A HREF=\"../../com/pkg/package-summary.html\">" +
+-            "<FONT CLASS=\"NavBarFont1\"><B>Package</B></FONT></A>"
++            "<FONT CLASS=\"NavBarFont1\"><STRONG>Package</STRONG></FONT></A>"
+         },
+         {BUG_ID + "-1" + FS + "deprecated-list.html",
+             "<A HREF=\"com/pkg/package-summary.html\">" +
+-            "<FONT CLASS=\"NavBarFont1\"><B>Package</B></FONT></A>"
++            "<FONT CLASS=\"NavBarFont1\"><STRONG>Package</STRONG></FONT></A>"
+         },
+         {BUG_ID + "-1" + FS + "index-all.html",
+             "<A HREF=\"./com/pkg/package-summary.html\">" +
+-            "<FONT CLASS=\"NavBarFont1\"><B>Package</B></FONT></A>"
++            "<FONT CLASS=\"NavBarFont1\"><STRONG>Package</STRONG></FONT></A>"
+         },
+         {BUG_ID + "-1" + FS + "help-doc.html",
+             "<A HREF=\"com/pkg/package-summary.html\">" +
+-            "<FONT CLASS=\"NavBarFont1\"><B>Package</B></FONT></A>"
++            "<FONT CLASS=\"NavBarFont1\"><STRONG>Package</STRONG></FONT></A>"
+         },
+     };
+ 
+diff --git a/test/com/sun/javadoc/testParamTaglet/TestParamTaglet.java b/test/com/sun/javadoc/testParamTaglet/TestParamTaglet.java
+--- langtools/test/com/sun/javadoc/testParamTaglet/TestParamTaglet.java
++++ langtools/test/com/sun/javadoc/testParamTaglet/TestParamTaglet.java
+@@ -48,12 +48,12 @@
+     private static final String[][] TEST = {
+         //Regular param tags.
+         {BUG_ID + FS + "pkg" + FS + "C.html",
+-            "<B>Parameters:</B><DD><CODE>param1</CODE> - testing 1 2 3." +
++            "<STRONG>Parameters:</STRONG><DD><CODE>param1</CODE> - testing 1 2 3." +
+                 "<DD><CODE>param2</CODE> - testing 1 2 3."
+         },
+         //Param tags that don't match with any real parameters.
+         {BUG_ID + FS + "pkg" + FS + "C.html",
+-            "<B>Parameters:</B><DD><CODE><I>p1</I></CODE> - testing 1 2 3." +
++            "<STRONG>Parameters:</STRONG><DD><CODE><I>p1</I></CODE> - testing 1 2 3." +
+                 "<DD><CODE><I>p2</I></CODE> - testing 1 2 3."
+         },
+         //{@inherit} doc misuse does not cause doclet to throw exception.
+diff --git a/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java b/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java
+--- langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java
++++ langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java
+@@ -85,22 +85,22 @@
+             "<PRE>" + NL +
+                 "java.lang.Object" + NL +
+                 "  <IMG SRC=\"../resources/inherit.gif\" " +
+-                "ALT=\"extended by \"><B>pkg.PublicChild</B>" + NL +
++                "ALT=\"extended by \"><STRONG>pkg.PublicChild</STRONG>" + NL +
+             "</PRE>"
+         },
+ 
+         // Method is documented as though it is declared in the inheriting method.
+         {BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html",
+-            "public void <B>methodInheritedFromParent</B>(int p1)"
++            "public void <STRONG>methodInheritedFromParent</STRONG>(int p1)"
+         },
+ 
+         //Make sure implemented interfaces from private superclass are inherited
+         {BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html",
+-            "<B>All Known Implementing Classes:</B> <DD><A HREF=\"../pkg/PublicChild.html\" " +
++            "<STRONG>All Known Implementing Classes:</STRONG> <DD><A HREF=\"../pkg/PublicChild.html\" " +
+             "title=\"class in pkg\">PublicChild</A>"},
+ 
+         {BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html",
+-            "<B>All Implemented Interfaces:</B> <DD><A HREF=\"../pkg/PublicInterface.html\" " +
++            "<STRONG>All Implemented Interfaces:</STRONG> <DD><A HREF=\"../pkg/PublicInterface.html\" " +
+             "title=\"interface in pkg\">PublicInterface</A>"},
+ 
+         //Generic interface method test.
+@@ -110,12 +110,12 @@
+     private static final String[][] NEGATED_TEST1 = {
+        // Should not document that a method overrides method from private class.
+       {BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html",
+-        "<B>Overrides:</B>"},
++        "<STRONG>Overrides:</STRONG>"},
+       // Should not document that a method specified by private interface.
+       {BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html",
+-        "<B>Specified by:</B>"},
++        "<STRONG>Specified by:</STRONG>"},
+       {BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html",
+-        "<B>Specified by:</B>"},
++        "<STRONG>Specified by:</STRONG>"},
+       // Should not mention that any documentation was copied.
+       {BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html",
+         "Description copied from"},
+@@ -137,7 +137,7 @@
+         //Do not inherit private interface method with generic parameters.
+         //This method has been implemented.
+         {BUG_ID + "-1" + FS + "pkg2" + FS + "C.html",
+-            "<B><A HREF=\"../pkg2/I.html#hello(T)\">hello</A></B>"},
++            "<STRONG><A HREF=\"../pkg2/I.html#hello(T)\">hello</A></STRONG>"},
+     };
+ 
+     // Test output when -private flag is used.
+@@ -174,14 +174,14 @@
+         },
+         // Should document that a method overrides method from private class.
+        {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
+-            "<B>Overrides:</B><DD><CODE>" +
++            "<STRONG>Overrides:</STRONG><DD><CODE>" +
+             "<A HREF=\"../pkg/PrivateParent.html#methodOverridenFromParent(char[], int, T, V, java.util.List)\">" +
+             "methodOverridenFromParent</A></CODE> in class <CODE>" +
+             "<A HREF=\"../pkg/PrivateParent.html\" title=\"class in pkg\">" +
+             "PrivateParent</A></CODE></DL>"},
+        // Should document that a method is specified by private interface.
+        {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
+-            "<B>Specified by:</B><DD><CODE>" +
++            "<STRONG>Specified by:</STRONG><DD><CODE>" +
+             "<A HREF=\"../pkg/PrivateInterface.html#methodInterface(int)\">" +
+             "methodInterface</A></CODE> in interface <CODE>" +
+             "<A HREF=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">" +
+@@ -209,12 +209,12 @@
+ 
+       //Make sure implemented interfaces from private superclass are inherited
+       {BUG_ID + "-2" + FS + "pkg" + FS + "PublicInterface.html",
+-        "<B>All Known Implementing Classes:</B> <DD><A HREF=\"../pkg/PrivateParent.html\" " +
++        "<STRONG>All Known Implementing Classes:</STRONG> <DD><A HREF=\"../pkg/PrivateParent.html\" " +
+         "title=\"class in pkg\">PrivateParent</A>, " +
+         "<A HREF=\"../pkg/PublicChild.html\" title=\"class in pkg\">PublicChild</A>"},
+ 
+       {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
+-        "<B>All Implemented Interfaces:</B> <DD><A HREF=\"../pkg/PrivateInterface.html\" " +
++        "<STRONG>All Implemented Interfaces:</STRONG> <DD><A HREF=\"../pkg/PrivateInterface.html\" " +
+         "title=\"interface in pkg\">PrivateInterface</A>, " +
+         "<A HREF=\"../pkg/PublicInterface.html\" title=\"interface in pkg\">" +
+         "PublicInterface</A>"},
+@@ -222,10 +222,13 @@
+       //Since private flag is used, we can document that private interface method
+       //with generic parameters has been implemented.
+       {BUG_ID + "-2" + FS + "pkg2" + FS + "C.html",
+-            "<B>Description copied from interface: " +
+            "<CODE><A HREF=\"../pkg2/I.html#hello(T)\">I</A></CODE></B>"},
++            "<STRONG>Description copied from interface: " +
++            "<CODE><A HREF=\"../pkg2/I.html#hello(T)\">I</A></CODE></STRONG>"},
+ 
+       {BUG_ID + "-2" + FS + "pkg2" + FS + "C.html",
+-            "<B>Specified by:</B><DD><CODE><A HREF=\"../pkg2/I.html#hello(T)\">" +
+            "hello</A></CODE> in interface <CODE><A HREF=\"../pkg2/I.html\" " +
+            "title=\"interface in pkg2\">I</A>"},
++            "<STRONG>Specified by:</STRONG><DD><CODE><A HREF=\"../pkg2/I.html#hello(T)\">" +
++            "hello</A></CODE> in interface <CODE><A HREF=\"../pkg2/I.html\" " +
++            "title=\"interface in pkg2\">I</A>"},
+     };
+     private static final String[][] NEGATED_TEST2 = NO_TEST;
+ 
+diff --git a/test/com/sun/javadoc/testSerializedForm/TestSerializedForm.java b/test/com/sun/javadoc/testSerializedForm/TestSerializedForm.java
+--- langtools/test/com/sun/javadoc/testSerializedForm/TestSerializedForm.java
++++ langtools/test/com/sun/javadoc/testSerializedForm/TestSerializedForm.java
+@@ -47,11 +47,11 @@
+ 
+     private static final String[][] TEST = {
+         {BUG_ID + FS + "serialized-form.html",
+-            "protected java.lang.Object <B>readResolve</B>()"},
++            "protected java.lang.Object <STRONG>readResolve</STRONG>()"},
+         {BUG_ID + FS + "serialized-form.html",
+-            "protected java.lang.Object <B>writeReplace</B>()"},
++            "protected java.lang.Object <STRONG>writeReplace</STRONG>()"},
+         {BUG_ID + FS + "serialized-form.html",
+-            "protected java.lang.Object <B>readObjectNoData</B>()"},
++            "protected java.lang.Object <STRONG>readObjectNoData</STRONG>()"},
+         {BUG_ID + FS + "serialized-form.html",
+             "See Also"},
+     };
+diff --git a/test/com/sun/javadoc/testSimpleTag/TestSimpleTag.java b/test/com/sun/javadoc/testSimpleTag/TestSimpleTag.java
+--- langtools/test/com/sun/javadoc/testSimpleTag/TestSimpleTag.java
++++ langtools/test/com/sun/javadoc/testSimpleTag/TestSimpleTag.java
+@@ -42,13 +42,13 @@
+     private static final String[][] TEST =
+         new String[][] {
+             {"./" + BUG_ID + "/C.html",
+-                "<B>Todo:</B>"},
++                "<STRONG>Todo:</STRONG>"},
+             {"./" + BUG_ID + "/C.html",
+-                "<B>EJB Beans:</B>"},
++                "<STRONG>EJB Beans:</STRONG>"},
+             {"./" + BUG_ID + "/C.html",
+-                "<B>Regular Tag:</B>"},
++                "<STRONG>Regular Tag:</STRONG>"},
+             {"./" + BUG_ID + "/C.html",
+-                "<B>Back-Slash-Tag:</B>"},
++                "<STRONG>Back-Slash-Tag:</STRONG>"},
+         };
+ 
+     private static final String[] ARGS = new String[] {
+diff --git a/test/com/sun/javadoc/testSummaryHeading/TestSummaryHeading.java b/test/com/sun/javadoc/testSummaryHeading/TestSummaryHeading.java
+--- langtools/test/com/sun/javadoc/testSummaryHeading/TestSummaryHeading.java
++++ langtools/test/com/sun/javadoc/testSummaryHeading/TestSummaryHeading.java
+@@ -46,7 +46,7 @@
+ 
+     //Input for string search tests.
+     private static final String[][] TEST = {
+-        {BUG_ID + FS + "C.html",  "<B>Method Summary</B>"}
++        {BUG_ID + FS + "C.html",  "<STRONG>Method Summary</STRONG>"}
+     };
+     private static final String[][] NEGATED_TEST = NO_TEST;
+ 
+diff --git a/test/com/sun/javadoc/testThrowsHead/TestThrowsHead.java b/test/com/sun/javadoc/testThrowsHead/TestThrowsHead.java
+--- langtools/test/com/sun/javadoc/testThrowsHead/TestThrowsHead.java
++++ langtools/test/com/sun/javadoc/testThrowsHead/TestThrowsHead.java
+@@ -38,7 +38,7 @@
+ 
+     private static final String BUG_ID = "4530727";
+     private static final String[][] TEST = {
+-        {BUG_ID + FS + "C.html", "<DT><B>Throws:</B>"}
++        {BUG_ID + FS + "C.html", "<DT><STRONG>Throws:</STRONG>"}
+     };
+     private static final String[][] NEGATED_TEST = NO_TEST;
+     private static final String[] ARGS = new String[] {
+diff --git a/test/com/sun/javadoc/testValueTag/TestValueTag.java b/test/com/sun/javadoc/testValueTag/TestValueTag.java
+--- langtools/test/com/sun/javadoc/testValueTag/TestValueTag.java
++++ langtools/test/com/sun/javadoc/testValueTag/TestValueTag.java
+@@ -88,7 +88,7 @@
+             "Result: <A HREF=\"../pkg2/Class3.html#TEST_17_PASSES\">\"Test 17 passes\"</A>"},
+         //Test @value tag used with custom tag.
+         {BUG_ID + FS + "pkg1" + FS + "CustomTagUsage.html",
+-            "<DT><B>Todo:</B></DT>" + NL +
++            "<DT><STRONG>Todo:</STRONG></DT>" + NL +
+                 "  <DD>the value of this constant is 55.</DD>"},
+         //Test @value warning printed when used with non-constant.
+         {WARNING_OUTPUT,"warning - @value tag (which references nonConstant) " +

Added: trunk/java/openjdk6/files/icedtea/openjdk/6786682-wcag_lang.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/openjdk/6786682-wcag_lang.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/openjdk/6786682-wcag_lang.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,274 @@
+# 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 {}

Added: trunk/java/openjdk6/files/icedtea/openjdk/6786688-wcag_table.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/openjdk/6786688-wcag_table.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/openjdk/6786688-wcag_table.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,2828 @@
+# HG changeset patch
+# User andrew
+# Date 1371572266 18000
+# Node ID 694e895f2b866d36ed7f8d4ea08ec64677d3fba1
+# Parent  9cad0410f52a47fdd3b294a10f076e7456a47e9a
+6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
+Reviewed-by: jjg
+
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java
+@@ -60,7 +60,11 @@
+ 
+     /*** abstracts ***/
+ 
+-    public abstract void printSummaryLabel(ClassDoc cd);
++    public abstract void printSummaryLabel();
++
++    public abstract void printTableSummary();
++
++    public abstract void printSummaryTableHeader(ProgramElementDoc member);
+ 
+     public abstract void printInheritedSummaryLabel(ClassDoc cd);
+ 
+@@ -342,12 +346,13 @@
+      * format for listing the API. Call methods from the sub-class to complete
+      * the generation.
+      */
+-    protected void printDeprecatedAPI(List deprmembers, String headingKey) {
++    protected void printDeprecatedAPI(List<Doc> deprmembers, String headingKey, String tableSummary, String[] tableHeader) {
+         if (deprmembers.size() > 0) {
+-            writer.tableIndexSummary();
+-            writer.tableHeaderStart("#CCCCFF");
+-            writer.strongText(headingKey);
+-            writer.tableHeaderEnd();
++            writer.tableIndexSummary(tableSummary);
++            writer.tableCaptionStart();
++            writer.printText(headingKey);
++            writer.tableCaptionEnd();
++            writer.summaryTableHeader(tableHeader, "col");
+             for (int i = 0; i < deprmembers.size(); i++) {
+                 ProgramElementDoc member =(ProgramElementDoc)deprmembers.get(i);
+                 writer.trBgcolorStyle("white", "TableRowColor");
+@@ -370,19 +375,26 @@
+     /**
+      * Print use info.
+      */
+-    protected void printUseInfo(Object mems, String heading) {
++    protected void printUseInfo(List<? extends ProgramElementDoc> mems, String heading, String tableSummary) {
+         if (mems == null) {
+             return;
+         }
+         List members = (List)mems;
++        boolean printedUseTableHeader = false;
+         if (members.size() > 0) {
+-            writer.tableIndexSummary();
+-            writer.tableUseInfoHeaderStart("#CCCCFF");
++            writer.tableIndexSummary(tableSummary);
++            writer.tableSubCaptionStart();
+             writer.print(heading);
+-            writer.tableHeaderEnd();
++            writer.tableCaptionEnd();
+             for (Iterator it = members.iterator(); it.hasNext(); ) {
+                 ProgramElementDoc pgmdoc = (ProgramElementDoc)it.next();
+                 ClassDoc cd = pgmdoc.containingClass();
++                if (!printedUseTableHeader) {
++                    // Passing ProgramElementDoc helps decides printing
++                    // interface or class header in case of nested classes.
++                    this.printSummaryTableHeader(pgmdoc);
++                    printedUseTableHeader = true;
++                }
+ 
+                 writer.printSummaryLinkType(this, pgmdoc);
+                 if (cd != null && !(pgmdoc instanceof ConstructorDoc)
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java
+@@ -35,6 +35,7 @@
+  * generate overview-frame.html as well as overview-summary.html.
+  *
+  * @author Atul M Dambalkar
++ * @author Bhavesh Patel (Modified)
+  */
+ public abstract class AbstractPackageIndexWriter extends HtmlDocletWriter {
+ 
+@@ -61,7 +62,7 @@
+ 
+     protected abstract void printOverviewHeader();
+ 
+-    protected abstract void printIndexHeader(String text);
++    protected abstract void printIndexHeader(String text, String tableSummary);
+ 
+     protected abstract void printIndexRow(PackageDoc pkg);
+ 
+@@ -101,7 +102,10 @@
+      * Generate the frame or non-frame package index.
+      */
+     protected void generateIndex() {
+-        printIndexContents(packages, "doclet.Package_Summary");
++        printIndexContents(packages, "doclet.Package_Summary",
++                configuration.getText("doclet.Member_Table_Summary",
++                configuration.getText("doclet.Package_Summary"),
++                configuration.getText("doclet.packages")));
+     }
+ 
+     /**
+@@ -111,10 +115,10 @@
+      * @param packages Array of packages to be documented.
+      * @param text     String which will be used as the heading.
+      */
+-    protected void printIndexContents(PackageDoc[] packages, String text) {
++    protected void printIndexContents(PackageDoc[] packages, String text, String tableSummary) {
+         if (packages.length > 0) {
+             Arrays.sort(packages);
+-            printIndexHeader(text);
++            printIndexHeader(text, tableSummary);
+             printAllClassesPackagesLink();
+             for(int i = 0; i < packages.length; i++) {
+                 if (packages[i] != null) {
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java
+@@ -34,6 +34,7 @@
+  * Writes annotation type optional member documentation in HTML format.
+  *
+  * @author Jamie Ho
++ * @author Bhavesh Patel (Modified)
+  */
+ public class AnnotationTypeOptionalMemberWriterImpl extends
+         AnnotationTypeRequiredMemberWriterImpl
+@@ -89,8 +90,27 @@
+     /**
+      * {@inheritDoc}
+      */
+-    public void printSummaryLabel(ClassDoc cd) {
+-        writer.strongText("doclet.Annotation_Type_Optional_Member_Summary");
++    public void printSummaryLabel() {
++        writer.printText("doclet.Annotation_Type_Optional_Member_Summary");
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public void printTableSummary() {
++        writer.tableIndexSummary(configuration().getText("doclet.Member_Table_Summary",
++                configuration().getText("doclet.Annotation_Type_Optional_Member_Summary"),
++                configuration().getText("doclet.annotation_type_optional_members")));
++    }
++
++    public void printSummaryTableHeader(ProgramElementDoc member) {
++        String[] header = new String[] {
++            writer.getModifierTypeHeader(),
++            configuration().getText("doclet.0_and_1",
++                    configuration().getText("doclet.Annotation_Type_Optional_Member"),
++                    configuration().getText("doclet.Description"))
++        };
++        writer.summaryTableHeader(header, "col");
+     }
+ 
+     /**
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java
+@@ -34,6 +34,7 @@
+  * Writes annotation type required member documentation in HTML format.
+  *
+  * @author Jamie Ho
++ * @author Bhavesh Patel (Modified)
+  */
+ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
+     implements AnnotationTypeRequiredMemberWriter, MemberSummaryWriter {
+@@ -178,8 +179,27 @@
+     /**
+      * {@inheritDoc}
+      */
+-    public void printSummaryLabel(ClassDoc cd) {
+-        writer.strongText("doclet.Annotation_Type_Required_Member_Summary");
++    public void printSummaryLabel() {
++        writer.printText("doclet.Annotation_Type_Required_Member_Summary");
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public void printTableSummary() {
++        writer.tableIndexSummary(configuration().getText("doclet.Member_Table_Summary",
++                configuration().getText("doclet.Annotation_Type_Required_Member_Summary"),
++                configuration().getText("doclet.annotation_type_required_members")));
++    }
++
++    public void printSummaryTableHeader(ProgramElementDoc member) {
++        String[] header = new String[] {
++            writer.getModifierTypeHeader(),
++            configuration().getText("doclet.0_and_1",
++                    configuration().getText("doclet.Annotation_Type_Required_Member"),
++                    configuration().getText("doclet.Description"))
++        };
++        writer.summaryTableHeader(header, "col");
+     }
+ 
+     /**
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java
+@@ -34,6 +34,7 @@
+  * Generate class usage information.
+  *
+  * @author Robert G. Field
++ * @author Bhavesh Patel (Modified)
+  */
+ public class ClassUseWriter extends SubWriterHolderWriter {
+ 
+@@ -65,6 +66,13 @@
+     final ConstructorWriterImpl constrSubWriter;
+     final FieldWriterImpl fieldSubWriter;
+     final NestedClassWriterImpl classSubWriter;
++    // Summary for various use tables.
++    final String classUseTableSummary;
++    final String subclassUseTableSummary;
++    final String subinterfaceUseTableSummary;
++    final String fieldUseTableSummary;
++    final String methodUseTableSummary;
++    final String constructorUseTableSummary;
+ 
+ 
+     /**
+@@ -116,6 +124,18 @@
+         constrSubWriter = new ConstructorWriterImpl(this);
+         fieldSubWriter = new FieldWriterImpl(this);
+         classSubWriter = new NestedClassWriterImpl(this);
++        classUseTableSummary = configuration.getText("doclet.Use_Table_Summary",
++                configuration.getText("doclet.classes"));
++        subclassUseTableSummary = configuration.getText("doclet.Use_Table_Summary",
++                configuration.getText("doclet.subclasses"));
++        subinterfaceUseTableSummary = configuration.getText("doclet.Use_Table_Summary",
++                configuration.getText("doclet.subinterfaces"));
++        fieldUseTableSummary = configuration.getText("doclet.Use_Table_Summary",
++                configuration.getText("doclet.fields"));
++        methodUseTableSummary = configuration.getText("doclet.Use_Table_Summary",
++                configuration.getText("doclet.methods"));
++        constructorUseTableSummary = configuration.getText("doclet.Use_Table_Summary",
++                configuration.getText("doclet.constructors"));
+     }
+ 
+     /**
+@@ -213,12 +233,13 @@
+     }
+ 
+     protected void generatePackageList() throws IOException {
+-        tableIndexSummary();
+-        tableHeaderStart("#CCCCFF");
++        tableIndexSummary(useTableSummary);
++        tableCaptionStart();
+         printText("doclet.ClassUse_Packages.that.use.0",
+             getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc,
+                 false)));
+-        tableHeaderEnd();
++        tableCaptionEnd();
++        summaryTableHeader(packageTableHeader, "col");
+ 
+         for (Iterator it = pkgSet.iterator(); it.hasNext();) {
+             PackageDoc pkg = (PackageDoc)it.next();
+@@ -234,12 +255,13 @@
+                pkgToPackageAnnotations == null ||
+                pkgToPackageAnnotations.size() == 0)
+             return;
+-        tableIndexSummary();
+-        tableHeaderStart("#CCCCFF");
++        tableIndexSummary(useTableSummary);
++        tableCaptionStart();
+         printText("doclet.ClassUse_PackageAnnotation",
+             getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc,
+                 false)));
+-        tableHeaderEnd();
++        tableCaptionEnd();
++        summaryTableHeader(packageTableHeader, "col");
+         for (Iterator it = pkgToPackageAnnotations.iterator(); it.hasNext();) {
+             PackageDoc pkg = (PackageDoc)it.next();
+             trBgcolorStyle("white", "TableRowColor");
+@@ -300,83 +322,68 @@
+             LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc, false));
+         String pkgLink = getPackageLink(pkg, Util.getPackageName(pkg), false);
+         classSubWriter.printUseInfo(pkgToClassAnnotations.get(pkg.name()),
+-            configuration.getText("doclet.ClassUse_Annotation", classLink,
+-            pkgLink));
+-
++                configuration.getText("doclet.ClassUse_Annotation", classLink,
++                pkgLink), classUseTableSummary);
+         classSubWriter.printUseInfo(pkgToClassTypeParameter.get(pkg.name()),
+-            configuration.getText("doclet.ClassUse_TypeParameter", classLink,
+-            pkgLink));
++                configuration.getText("doclet.ClassUse_TypeParameter", classLink,
++                pkgLink), classUseTableSummary);
+         classSubWriter.printUseInfo(pkgToSubclass.get(pkg.name()),
+-            configuration.getText("doclet.ClassUse_Subclass", classLink,
+-            pkgLink));
++                configuration.getText("doclet.ClassUse_Subclass", classLink,
++                pkgLink), subclassUseTableSummary);
+         classSubWriter.printUseInfo(pkgToSubinterface.get(pkg.name()),
+-                                    configuration.getText("doclet.ClassUse_Subinterface",
+-                                            classLink,
+-                                            pkgLink));
++                configuration.getText("doclet.ClassUse_Subinterface", classLink,
++                pkgLink), subinterfaceUseTableSummary);
+         classSubWriter.printUseInfo(pkgToImplementingClass.get(pkg.name()),
+-                                    configuration.getText("doclet.ClassUse_ImplementingClass",
+-                                            classLink,
+-                                            pkgLink));
++                configuration.getText("doclet.ClassUse_ImplementingClass", classLink,
++                pkgLink), classUseTableSummary);
+         fieldSubWriter.printUseInfo(pkgToField.get(pkg.name()),
+-                                    configuration.getText("doclet.ClassUse_Field",
+-                                            classLink,
+-                                            pkgLink));
++                configuration.getText("doclet.ClassUse_Field", classLink,
++                pkgLink), fieldUseTableSummary);
+         fieldSubWriter.printUseInfo(pkgToFieldAnnotations.get(pkg.name()),
+-            configuration.getText("doclet.ClassUse_FieldAnnotations",
+-            classLink,
+-            pkgLink));
++                configuration.getText("doclet.ClassUse_FieldAnnotations", classLink,
++                pkgLink), fieldUseTableSummary);
+         fieldSubWriter.printUseInfo(pkgToFieldTypeParameter.get(pkg.name()),
+-            configuration.getText("doclet.ClassUse_FieldTypeParameter",
+-            classLink,
+-            pkgLink));
++                configuration.getText("doclet.ClassUse_FieldTypeParameter", classLink,
++                pkgLink), fieldUseTableSummary);
+         methodSubWriter.printUseInfo(pkgToMethodAnnotations.get(pkg.name()),
+-            configuration.getText("doclet.ClassUse_MethodAnnotations", classLink,
+-            pkgLink));
++                configuration.getText("doclet.ClassUse_MethodAnnotations", classLink,
++                pkgLink), methodUseTableSummary);
+         methodSubWriter.printUseInfo(pkgToMethodParameterAnnotations.get(pkg.name()),
+-            configuration.getText("doclet.ClassUse_MethodParameterAnnotations", classLink,
+-            pkgLink));
++                configuration.getText("doclet.ClassUse_MethodParameterAnnotations", classLink,
++                pkgLink), methodUseTableSummary);
+         methodSubWriter.printUseInfo(pkgToMethodTypeParameter.get(pkg.name()),
+-            configuration.getText("doclet.ClassUse_MethodTypeParameter", classLink,
+-            pkgLink));
++                configuration.getText("doclet.ClassUse_MethodTypeParameter", classLink,
++                pkgLink), methodUseTableSummary);
+         methodSubWriter.printUseInfo(pkgToMethodReturn.get(pkg.name()),
+-                                     configuration.getText("doclet.ClassUse_MethodReturn",
+-                                             classLink,
+-                                             pkgLink));
++                configuration.getText("doclet.ClassUse_MethodReturn", classLink,
++                pkgLink), methodUseTableSummary);
+         methodSubWriter.printUseInfo(pkgToMethodReturnTypeParameter.get(pkg.name()),
+-            configuration.getText("doclet.ClassUse_MethodReturnTypeParameter", classLink,
+-            pkgLink));
++                configuration.getText("doclet.ClassUse_MethodReturnTypeParameter", classLink,
++                pkgLink), methodUseTableSummary);
+         methodSubWriter.printUseInfo(pkgToMethodArgs.get(pkg.name()),
+-                                     configuration.getText("doclet.ClassUse_MethodArgs",
+-                                             classLink,
+-                                             pkgLink));
++                configuration.getText("doclet.ClassUse_MethodArgs", classLink,
++                pkgLink), methodUseTableSummary);
+         methodSubWriter.printUseInfo(pkgToMethodArgTypeParameter.get(pkg.name()),
+-            configuration.getText("doclet.ClassUse_MethodArgsTypeParameters",
+-            classLink,
+-            pkgLink));
++                configuration.getText("doclet.ClassUse_MethodArgsTypeParameters", classLink,
++                pkgLink), methodUseTableSummary);
+         methodSubWriter.printUseInfo(pkgToMethodThrows.get(pkg.name()),
+-                                     configuration.getText("doclet.ClassUse_MethodThrows",
+-                                             classLink,
+-                                             pkgLink));
++                configuration.getText("doclet.ClassUse_MethodThrows", classLink,
++                pkgLink), methodUseTableSummary);
+         constrSubWriter.printUseInfo(pkgToConstructorAnnotations.get(pkg.name()),
+-            configuration.getText("doclet.ClassUse_ConstructorAnnotations",
+-                classLink,
+-                pkgLink));
++                configuration.getText("doclet.ClassUse_ConstructorAnnotations", classLink,
++                pkgLink), constructorUseTableSummary);
+         constrSubWriter.printUseInfo(pkgToConstructorParameterAnnotations.get(pkg.name()),
+-            configuration.getText("doclet.ClassUse_ConstructorParameterAnnotations",
+-                classLink,
+-                pkgLink));
++                configuration.getText("doclet.ClassUse_ConstructorParameterAnnotations", classLink,
++                pkgLink), constructorUseTableSummary);
+         constrSubWriter.printUseInfo(pkgToConstructorArgs.get(pkg.name()),
+-                                     configuration.getText("doclet.ClassUse_ConstructorArgs",
+-                                             classLink,
+-                                             pkgLink));
++                configuration.getText("doclet.ClassUse_ConstructorArgs", classLink,
++                pkgLink), constructorUseTableSummary);
+         constrSubWriter.printUseInfo(pkgToConstructorArgTypeParameter.get(pkg.name()),
+-            configuration.getText("doclet.ClassUse_ConstructorArgsTypeParameters",
+-            classLink,
+-            pkgLink));
++                configuration.getText("doclet.ClassUse_ConstructorArgsTypeParameters", classLink,
++                pkgLink), constructorUseTableSummary);
+         constrSubWriter.printUseInfo(pkgToConstructorThrows.get(pkg.name()),
+-                                     configuration.getText("doclet.ClassUse_ConstructorThrows",
+-                                             classLink,
+-                                             pkgLink));
++                configuration.getText("doclet.ClassUse_ConstructorThrows", classLink,
++                pkgLink), constructorUseTableSummary);
+     }
+ 
+     /**
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java
+@@ -35,6 +35,7 @@
+  * Write the Constants Summary Page in HTML format.
+  *
+  * @author Jamie Ho
++ * @author Bhavesh Patel (Modified)
+  * @since 1.4
+  */
+ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter
+@@ -50,6 +51,10 @@
+      */
+     private ClassDoc currentClassDoc;
+ 
++    private final String constantsTableSummary;
++
++    private final String[] constantsTableHeader;
++
+     /**
+      * Construct a ConstantsSummaryWriter.
+      * @param configuration the configuration used in this run
+@@ -59,6 +64,13 @@
+             throws IOException {
+         super(configuration, ConfigurationImpl.CONSTANTS_FILE_NAME);
+         this.configuration = configuration;
++        constantsTableSummary = configuration.getText("doclet.Constants_Table_Summary",
++                configuration.getText("doclet.Constants_Summary"));
++        constantsTableHeader = new String[] {
++            getModifierTypeHeader(),
++            configuration.getText("doclet.ConstantField"),
++            configuration.getText("doclet.Value")
++        };
+     }
+ 
+     /**
+@@ -151,12 +163,11 @@
+      * @param classStr the heading to print.
+      */
+     protected void writeClassName(String classStr) {
+-        table(1, 3, 0);
+-        trBgcolorStyle("#EEEEFF", "TableSubHeadingColor");
+-        thAlignColspan("left", 3);
++        table(1, 3, 0, constantsTableSummary);
++        tableSubCaptionStart();
+         write(classStr);
+-        thEnd();
+-        trEnd();
++        tableCaptionEnd();
++        summaryTableHeader(constantsTableHeader, "col");
+     }
+ 
+     private void tableFooter(boolean isHeader) {
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java
+@@ -37,6 +37,7 @@
+  *
+  * @author Robert Field
+  * @author Atul M Dambalkar
++ * @author Bhavesh Patel (Modified)
+  */
+ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
+     implements ConstructorWriter, MemberSummaryWriter {
+@@ -211,8 +212,34 @@
+         this.foundNonPubConstructor = foundNonPubConstructor;
+     }
+ 
+-    public void printSummaryLabel(ClassDoc cd) {
+-        writer.strongText("doclet.Constructor_Summary");
++    public void printSummaryLabel() {
++        writer.printText("doclet.Constructor_Summary");
++    }
++
++    public void printTableSummary() {
++        writer.tableIndexSummary(configuration().getText("doclet.Member_Table_Summary",
++                configuration().getText("doclet.Constructor_Summary"),
++                configuration().getText("doclet.constructors")));
++    }
++
++    public void printSummaryTableHeader(ProgramElementDoc member) {
++        String[] header;
++        if (foundNonPubConstructor) {
++            header = new String[] {
++                configuration().getText("doclet.Modifier"),
++                configuration().getText("doclet.0_and_1",
++                        configuration().getText("doclet.Constructor"),
++                        configuration().getText("doclet.Description"))
++            };
++        }
++        else {
++            header = new String[] {
++                configuration().getText("doclet.0_and_1",
++                        configuration().getText("doclet.Constructor"),
++                        configuration().getText("doclet.Description"))
++            };
++        }
++        writer.summaryTableHeader(header, "col");
+     }
+ 
+     public void printSummaryAnchor(ClassDoc cd) {
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java
+@@ -35,6 +35,7 @@
+  *
+  * @see java.util.List
+  * @author Atul M Dambalkar
++ * @author Bhavesh Patel (Modified)
+  */
+ public class DeprecatedListWriter extends SubWriterHolderWriter {
+ 
+@@ -55,6 +56,28 @@
+         "doclet.Deprecated_Annotation_Type_Members"
+     };
+ 
++    private static final String[] SUMMARY_KEYS = new String[] {
++        "doclet.deprecated_interfaces", "doclet.deprecated_classes",
++        "doclet.deprecated_enums", "doclet.deprecated_exceptions",
++        "doclet.deprecated_errors",
++        "doclet.deprecated_annotation_types",
++        "doclet.deprecated_fields",
++        "doclet.deprecated_methods", "doclet.deprecated_constructors",
++        "doclet.deprecated_enum_constants",
++        "doclet.deprecated_annotation_type_members"
++    };
++
++    private static final String[] HEADER_KEYS = new String[] {
++        "doclet.Interface", "doclet.Class",
++        "doclet.Enum", "doclet.Exceptions",
++        "doclet.Errors",
++        "doclet.AnnotationType",
++        "doclet.Field",
++        "doclet.Method", "doclet.Constructor",
++        "doclet.Enum_Constant",
++        "doclet.Annotation_Type_Member"
++    };
++
+     private AbstractMemberWriter[] writers;
+ 
+     private ConfigurationImpl configuration;
+@@ -119,11 +142,20 @@
+         ulEnd();
+         println();
+ 
++        String memberTableSummary;
++        String[] memberTableHeader = new String[1];
+         for (int i = 0; i < DeprecatedAPIListBuilder.NUM_TYPES; i++) {
+             if (deprapi.hasDocumentation(i)) {
+                 writeAnchor(deprapi, i);
++                memberTableSummary =
++                        configuration.getText("doclet.Member_Table_Summary",
++                        configuration.getText(HEADING_KEYS[i]),
++                        configuration.getText(SUMMARY_KEYS[i]));
++                memberTableHeader[0] = configuration.getText("doclet.0_and_1",
++                        configuration.getText(HEADER_KEYS[i]),
++                        configuration.getText("doclet.Description"));
+                 writers[i].printDeprecatedAPI(deprapi.getList(i),
+-                    HEADING_KEYS[i]);
++                    HEADING_KEYS[i], memberTableSummary, memberTableHeader);
+             }
+         }
+         printDeprecatedFooter();
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java
+@@ -35,6 +35,7 @@
+  * Writes enum constant documentation in HTML format.
+  *
+  * @author Jamie Ho
++ * @author Bhavesh Patel (Modified)
+  */
+ public class EnumConstantWriterImpl extends AbstractMemberWriter
+     implements EnumConstantWriter, MemberSummaryWriter {
+@@ -194,8 +195,23 @@
+         return VisibleMemberMap.ENUM_CONSTANTS;
+     }
+ 
+-    public void printSummaryLabel(ClassDoc cd) {
+-        writer.strongText("doclet.Enum_Constant_Summary");
++    public void printSummaryLabel() {
++        writer.printText("doclet.Enum_Constant_Summary");
++    }
++
++    public void printTableSummary() {
++        writer.tableIndexSummary(configuration().getText("doclet.Member_Table_Summary",
++                configuration().getText("doclet.Enum_Constant_Summary"),
++                configuration().getText("doclet.enum_constants")));
++    }
++
++    public void printSummaryTableHeader(ProgramElementDoc member) {
++        String[] header = new String[] {
++            configuration().getText("doclet.0_and_1",
++                    configuration().getText("doclet.Enum_Constant"),
++                    configuration().getText("doclet.Description"))
++        };
++        writer.summaryTableHeader(header, "col");
+     }
+ 
+     public void printSummaryAnchor(ClassDoc cd) {
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java
+@@ -37,6 +37,7 @@
+  * @author Robert Field
+  * @author Atul M Dambalkar
+  * @author Jamie Ho (rewrite)
++ * @author Bhavesh Patel (Modified)
+  */
+ public class FieldWriterImpl extends AbstractMemberWriter
+     implements FieldWriter, MemberSummaryWriter {
+@@ -236,8 +237,24 @@
+         return VisibleMemberMap.FIELDS;
+     }
+ 
+-    public void printSummaryLabel(ClassDoc cd) {
+-        writer.strongText("doclet.Field_Summary");
++    public void printSummaryLabel() {
++        writer.printText("doclet.Field_Summary");
++    }
++
++    public void printTableSummary() {
++        writer.tableIndexSummary(configuration().getText("doclet.Member_Table_Summary",
++                configuration().getText("doclet.Field_Summary"),
++                configuration().getText("doclet.fields")));
++    }
++
++    public void printSummaryTableHeader(ProgramElementDoc member) {
++        String[] header = new String[] {
++            writer.getModifierTypeHeader(),
++            configuration().getText("doclet.0_and_1",
++                    configuration().getText("doclet.Field"),
++                    configuration().getText("doclet.Description"))
++        };
++        writer.summaryTableHeader(header, "col");
+     }
+ 
+     public void printSummaryAnchor(ClassDoc cd) {
+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
+@@ -785,6 +785,15 @@
+     }
+ 
+     /**
++     * Print the Html table tag for the index summary tables.
++     *
++     * @param summary the summary for the table tag summary attribute.
++     */
++    public void tableIndexSummary(String summary) {
++        table(1, "100%", 3, 0, summary);
++    }
++
++    /**
+      * Same as {@link #tableIndexSummary()}.
+      */
+     public void tableIndexDetail() {
+@@ -800,6 +809,40 @@
+     }
+ 
+     /**
++     * Print table caption.
++     */
++    public void tableCaptionStart() {
++        captionStyle("TableCaption");
++    }
++
++    /**
++     * Print table sub-caption.
++     */
++    public void tableSubCaptionStart() {
++        captionStyle("TableSubCaption");
++    }
++
++    /**
++     * Print table caption end tags.
++     */
++    public void tableCaptionEnd() {
++        captionEnd();
++    }
++
++    /**
++     * Print summary table header.
++     */
++    public void summaryTableHeader(String[] header, String scope) {
++        tr();
++        for ( int i=0; i < header.length; i++ ) {
++            thScopeNoWrap("TableHeader", scope);
++            print(header[i]);
++            thEnd();
++        }
++        trEnd();
++    }
++
++    /**
+      * Prine table header information about color, column span and the font.
+      *
+      * @param color Background color.
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java
+@@ -38,6 +38,7 @@
+  * @author Robert Field
+  * @author Atul M Dambalkar
+  * @author Jamie Ho (rewrite)
++ * @author Bhavesh Patel (Modified)
+  */
+ public class MethodWriterImpl extends AbstractExecutableMemberWriter
+         implements MethodWriter, MemberSummaryWriter {
+@@ -255,8 +256,24 @@
+         return VisibleMemberMap.METHODS;
+     }
+ 
+-    public void printSummaryLabel(ClassDoc cd) {
+-        writer.strongText("doclet.Method_Summary");
++    public void printSummaryLabel() {
++        writer.printText("doclet.Method_Summary");
++    }
++
++    public void printTableSummary() {
++        writer.tableIndexSummary(configuration().getText("doclet.Member_Table_Summary",
++                configuration().getText("doclet.Method_Summary"),
++                configuration().getText("doclet.methods")));
++    }
++
++    public void printSummaryTableHeader(ProgramElementDoc member) {
++        String[] header = new String[] {
++            writer.getModifierTypeHeader(),
++            configuration().getText("doclet.0_and_1",
++                    configuration().getText("doclet.Method"),
++                    configuration().getText("doclet.Description"))
++        };
++        writer.summaryTableHeader(header, "col");
+     }
+ 
+     public void printSummaryAnchor(ClassDoc cd) {
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java
+@@ -37,6 +37,7 @@
+  * @author Robert Field
+  * @author Atul M Dambalkar
+  * @author Jamie Ho (rewrite)
++ * @author Bhavesh Patel (Modified)
+  */
+ public class NestedClassWriterImpl extends AbstractMemberWriter
+     implements MemberSummaryWriter {
+@@ -147,8 +148,35 @@
+         return VisibleMemberMap.INNERCLASSES;
+     }
+ 
+-    public void printSummaryLabel(ClassDoc cd) {
+-        writer.strongText("doclet.Nested_Class_Summary");
++    public void printSummaryLabel() {
++        writer.printText("doclet.Nested_Class_Summary");
++    }
++
++    public void printTableSummary() {
++        writer.tableIndexSummary(configuration().getText("doclet.Member_Table_Summary",
++                configuration().getText("doclet.Nested_Class_Summary"),
++                configuration().getText("doclet.nested_classes")));
++    }
++
++    public void printSummaryTableHeader(ProgramElementDoc member) {
++        String[] header;
++        if (member.isInterface()) {
++            header = new String[] {
++                writer.getModifierTypeHeader(),
++                configuration().getText("doclet.0_and_1",
++                        configuration().getText("doclet.Interface"),
++                        configuration().getText("doclet.Description"))
++            };
++        }
++        else {
++            header = new String[] {
++                writer.getModifierTypeHeader(),
++                configuration().getText("doclet.0_and_1",
++                        configuration().getText("doclet.Class"),
++                        configuration().getText("doclet.Description"))
++            };
++        }
++        writer.summaryTableHeader(header, "col");
+     }
+ 
+     public void printSummaryAnchor(ClassDoc cd) {
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java
+@@ -114,7 +114,7 @@
+      *
+      * @param text Text string will not be used in this method.
+      */
+-    protected void printIndexHeader(String text) {
++    protected void printIndexHeader(String text, String tableSummary) {
+         printTableHeader(false);
+     }
+ 
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java
+@@ -36,6 +36,7 @@
+  * with the "pacakge-summary.html" file for the clicked package.
+  *
+  * @author Atul M Dambalkar
++ * @author Bhavesh Patel (Modified)
+  */
+ public class PackageIndexWriter extends AbstractPackageIndexWriter {
+ 
+@@ -124,7 +125,10 @@
+             if (list != null && list.size() > 0) {
+                 printIndexContents((PackageDoc[])list.
+                                        toArray(new PackageDoc[list.size()]),
+-                                    groupname);
++                        groupname,
++                        configuration.getText("doclet.Member_Table_Summary",
++                        groupname,
++                        configuration.getText("doclet.packages")));
+             }
+         }
+     }
+@@ -150,11 +154,12 @@
+     /**
+      * Print Html tags for the table for this package index.
+      */
+-    protected void printIndexHeader(String text) {
+-        tableIndexSummary();
+-        tableHeaderStart("#CCCCFF");
+-        strong(text);
+-        tableHeaderEnd();
++    protected void printIndexHeader(String text, String tableSummary) {
++        tableIndexSummary(tableSummary);
++        tableCaptionStart();
++        print(text);
++        tableCaptionEnd();
++        summaryTableHeader(packageTableHeader, "col");
+     }
+ 
+     /**
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java
+@@ -34,6 +34,7 @@
+  * Generate package usage information.
+  *
+  * @author Robert G. Field
++ * @author Bhavesh Patel (Modified)
+  */
+ public class PackageUseWriter extends SubWriterHolderWriter {
+ 
+@@ -131,11 +132,12 @@
+     }
+ 
+     protected void generatePackageList() throws IOException {
+-        tableIndexSummary();
+-        tableHeaderStart("#CCCCFF");
++        tableIndexSummary(useTableSummary);
++        tableCaptionStart();
+         printText("doclet.ClassUse_Packages.that.use.0",
+             getPackageLink(pkgdoc, Util.getPackageName(pkgdoc), false));
+-        tableHeaderEnd();
++        tableCaptionEnd();
++        summaryTableHeader(packageTableHeader, "col");
+         Iterator it = usingPackageToUsedClasses.keySet().iterator();
+         while (it.hasNext()) {
+             PackageDoc pkg = configuration.root.packageNamed((String)it.next());
+@@ -147,6 +149,11 @@
+     }
+ 
+     protected void generateClassList() throws IOException {
++        String[] classTableHeader = new String[] {
++            configuration.getText("doclet.0_and_1",
++                    configuration.getText("doclet.Class"),
++                    configuration.getText("doclet.Description"))
++        };
+         Iterator itp = usingPackageToUsedClasses.keySet().iterator();
+         while (itp.hasNext()) {
+             String packageName = (String)itp.next();
+@@ -154,12 +161,14 @@
+             if (usingPackage != null) {
+                 anchor(usingPackage.name());
+             }
+-            tableIndexSummary();
+-            tableHeaderStart("#CCCCFF");
++            tableIndexSummary(configuration.getText("doclet.Use_Table_Summary",
++                    configuration.getText("doclet.classes")));
++            tableCaptionStart();
+             printText("doclet.ClassUse_Classes.in.0.used.by.1",
+                 getPackageLink(pkgdoc, Util.getPackageName(pkgdoc), false),
+                 getPackageLink(usingPackage,Util.getPackageName(usingPackage), false));
+-            tableHeaderEnd();
++            tableCaptionEnd();
++            summaryTableHeader(classTableHeader, "col");
+             Iterator itc =
+                 ((Collection)usingPackageToUsedClasses.get(packageName))
+                 .iterator();
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java
+@@ -38,6 +38,7 @@
+  * class-kind will update the frame with the clicked class-kind page.
+  *
+  * @author Atul M Dambalkar
++ * @author Bhavesh Patel (Modified)
+  */
+ public class PackageWriterImpl extends HtmlDocletWriter
+     implements PackageSummaryWriter {
+@@ -107,14 +108,15 @@
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeClassesSummary(ClassDoc[] classes, String label) {
++    public void writeClassesSummary(ClassDoc[] classes, String label, String tableSummary, String[] tableHeader) {
+         if(classes.length > 0) {
+             Arrays.sort(classes);
+-            tableIndexSummary();
++            tableIndexSummary(tableSummary);
+             boolean printedHeading = false;
+             for (int i = 0; i < classes.length; i++) {
+                 if (!printedHeading) {
+-                    printFirstRow(label);
++                    printTableCaption(label);
++                    printFirstRow(tableHeader);
+                     printedHeading = true;
+                 }
+                 if (!Util.isCoreClass(classes[i]) ||
+@@ -149,14 +151,23 @@
+     }
+ 
+     /**
++     * Print the table caption for the class-listing.
++     *
++     * @param label label for the Class kind listing.
++     */
++    protected void printTableCaption(String label) {
++        tableCaptionStart();
++        print(label);
++        tableCaptionEnd();
++    }
++
++    /**
+      * Print the table heading for the class-listing.
+      *
+-     * @param label Label for the Class kind listing.
++     * @param tableHeader table header string for the Class listing.
+      */
+-    protected void printFirstRow(String label) {
+-        tableHeaderStart("#CCCCFF");
+-        strong(label);
+-        tableHeaderEnd();
++    protected void printFirstRow(String[] tableHeader) {
++        summaryTableHeader(tableHeader, "col");
+     }
+ 
+     /**
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/StylesheetWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/StylesheetWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/StylesheetWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/StylesheetWriter.java
+@@ -33,6 +33,7 @@
+  * Writes the style sheet for the doclet output.
+  *
+  * @author Atul M Dambalkar
++ * @author Bhavesh Patel (Modified)
+  */
+ public class StylesheetWriter extends HtmlDocletWriter {
+ 
+@@ -115,6 +116,13 @@
+         println("background-color:#FFFFFF; color:#000000}");
+         print(".NavBarCell3    { font-family: Arial, Helvetica, sans-serif; ");
+         println("background-color:#FFFFFF; color:#000000}");
++
++        print("/* "); printText("doclet.Style_line_12"); println(" */");
++        print(".TableCaption     { background: #CCCCFF; color:#000000; text-align: left; font-size: 150%; font-weight: bold; border-left: 2px ridge; border-right: 2px ridge; border-top: 2px ridge; padding-left: 5px; }");
++        print(" /* "); printText("doclet.Style_line_5"); println(" */");
++        print(".TableSubCaption  { background: #EEEEFF; color:#000000; text-align: left; font-weight: bold; border-left: 2px ridge; border-right: 2px ridge; border-top: 2px ridge; padding-left: 5px; }");
++        print(" /* "); printText("doclet.Style_line_6"); println(" */");
++        print(".TableHeader     { text-align: center; font-size: 80%; font-weight: bold; }");
+         println("");
+ 
+     }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java
+@@ -43,6 +43,7 @@
+  *
+  * @author Robert Field
+  * @author Atul M Dambalkar
++ * @author Bhavesh Patel (Modified)
+  */
+ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
+ 
+@@ -72,10 +73,11 @@
+ 
+     public void printSummaryHeader(AbstractMemberWriter mw, ClassDoc cd) {
+         mw.printSummaryAnchor(cd);
+-        tableIndexSummary();
+-        tableHeaderStart("#CCCCFF");
+-        mw.printSummaryLabel(cd);
+-        tableHeaderEnd();
++        mw.printTableSummary();
++        tableCaptionStart();
++        mw.printSummaryLabel();
++        tableCaptionEnd();
++        mw.printSummaryTableHeader(cd);
+     }
+ 
+     public void printTableHeadingBackground(String str) {
+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
+@@ -37,6 +37,7 @@
+  *
+  * @since 1.2
+  * @author Atul M Dambalkar
++ * @author Bhavesh Patel (Modified)
+  */
+ public class HtmlWriter extends PrintWriter {
+ 
+@@ -67,6 +68,21 @@
+     protected boolean memberDetailsListPrinted;
+ 
+     /**
++     * Header for tables displaying packages and description..
++     */
++    protected final String[] packageTableHeader;
++
++    /**
++     * Summary for use tables displaying class and package use.
++     */
++    protected final String useTableSummary;
++
++    /**
++     * Column header for class docs displaying Modifier and Type header.
++     */
++    protected final String modifierTypeHeader;
++
++    /**
+      * Constructor.
+      *
+      * @param path The directory path to be created for this file
+@@ -86,6 +102,15 @@
+         this.configuration = configuration;
+         htmlFilename = filename;
+         this.memberDetailsListPrinted = false;
++        packageTableHeader = new String[] {
++            configuration.getText("doclet.Package"),
++            configuration.getText("doclet.Description")
++        };
++        useTableSummary = configuration.getText("doclet.Use_Table_Summary",
++                configuration.getText("doclet.packages"));
++        modifierTypeHeader = configuration.getText("doclet.0_and_1",
++                configuration.getText("doclet.Modifier"),
++                configuration.getText("doclet.Type"));
+     }
+ 
+     /**
+@@ -803,6 +828,26 @@
+     }
+ 
+     /**
++     * Print HTML <TABLE BORDER="border" WIDTH="width"
++     * CELLPADDING="cellpadding" CELLSPACING="cellspacing" SUMMARY="summary"> tag.
++     *
++     * @param border       Border size.
++     * @param width        Width of the table.
++     * @param cellpadding  Cellpadding for the table cells.
++     * @param cellspacing  Cellspacing for the table cells.
++     * @param summary      Table summary.
++     */
++    public void table(int border, String width, int cellpadding,
++                      int cellspacing, String summary) {
++        println(DocletConstants.NL +
++                "<TABLE BORDER=\"" + border +
++                "\" WIDTH=\"" + width +
++                "\" CELLPADDING=\"" + cellpadding +
++                "\" CELLSPACING=\"" + cellspacing +
++                "\" SUMMARY=\"" + summary + "\">");
++    }
++
++    /**
+      * Print HTML <TABLE BORDER="border" CELLPADDING="cellpadding"
+      * CELLSPACING="cellspacing"> tag.
+      *
+@@ -819,6 +864,23 @@
+     }
+ 
+     /**
++     * Print HTML <TABLE BORDER="border" CELLPADDING="cellpadding"
++     * CELLSPACING="cellspacing" SUMMARY="summary"> tag.
++     *
++     * @param border       Border size.
++     * @param cellpadding  Cellpadding for the table cells.
++     * @param cellspacing  Cellspacing for the table cells.
++     * @param summary      Table summary.
++     */
++    public void table(int border, int cellpadding, int cellspacing, String summary) {
++        println(DocletConstants.NL +
++                "<TABLE BORDER=\"" + border +
++                "\" CELLPADDING=\"" + cellpadding +
++                "\" CELLSPACING=\"" + cellspacing +
++                "\" SUMMARY=\"" + summary + "\">");
++    }
++
++    /**
+      * Print HTML <TABLE BORDER="border" WIDTH="width">
+      *
+      * @param border       Border size.
+@@ -913,6 +975,23 @@
+     }
+ 
+     /**
++     * Print <CAPTION CLASS="stylename"> tag. Adds a newline character
++     * at the end.
++     *
++     * @param stylename style to be applied.
++     */
++    public void captionStyle(String stylename) {
++        println("<CAPTION CLASS=\"" + stylename + "\">");
++    }
++
++    /**
++     * Print </CAPTION> tag. Add a newline character at the end.
++     */
++    public void captionEnd() {
++        println("</CAPTION>");
++    }
++
++    /**
+      * Print <TR BGCOLOR="color" CLASS="stylename"> tag. Adds a newline character
+      * at the end.
+      *
+@@ -953,6 +1032,23 @@
+     }
+ 
+     /**
++     * Print <TH CLASS="stylename" SCOPE="scope" NOWRAP> tag.
++     *
++     * @param stylename style to be applied.
++     * @param scope the scope attribute.
++     */
++    public void thScopeNoWrap(String stylename, String scope) {
++        print("<TH CLASS=\"" + stylename + "\" SCOPE=\"" + scope + "\" NOWRAP>");
++    }
++
++    /*
++     * Returns a header for Modifier and Type column of a table.
++     */
++    public String getModifierTypeHeader() {
++        return modifierTypeHeader;
++    }
++
++    /**
+      * Print <TH align="align" COLSPAN=i> tag.
+      *
+      * @param align the align attribute.
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties b/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties
+@@ -83,6 +83,17 @@
+ doclet.Deprecated_Methods=Deprecated Methods
+ doclet.Deprecated_Enum_Constants=Deprecated Enum Constants
+ doclet.Deprecated_Annotation_Type_Members=Deprecated Annotation Type Elements
++doclet.deprecated_classes=deprecated classes
++doclet.deprecated_enums=deprecated enums
++doclet.deprecated_interfaces=deprecated interfaces
++doclet.deprecated_exceptions=deprecated exceptions
++doclet.deprecated_annotation_types=deprecated annotation types
++doclet.deprecated_errors=deprecated errors
++doclet.deprecated_fields=deprecated fields
++doclet.deprecated_constructors=deprecated constructors
++doclet.deprecated_methods=deprecated methods
++doclet.deprecated_enum_constants=deprecated enum constants
++doclet.deprecated_annotation_type_members=deprecated annotation type elements
+ doclet.Frame_Output=Frame Output
+ doclet.Docs_generated_by_Javadoc=Documentation generated by Javadoc.
+ doclet.Generated_Docs_Untitled=Generated Documentation (Untitled)
+@@ -171,6 +182,7 @@
+ doclet.Style_line_9=Example of smaller, sans-serif font in frames
+ doclet.Style_line_10=Navigation bar fonts and colors
+ doclet.Style_line_11=Dark Blue
++doclet.Style_line_12=Table caption style
+ doclet.ClassUse_Packages.that.use.0=Packages that use {0}
+ doclet.ClassUse_Uses.of.0.in.1=Uses of {0} in {1}
+ doclet.ClassUse_Classes.in.0.used.by.1=Classes in {0} used by {1}
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/PackageSummaryWriter.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/PackageSummaryWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/PackageSummaryWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/PackageSummaryWriter.java
+@@ -64,7 +64,7 @@
+      * @param classes the array of classes to document.
+      * @param label the label for this table.
+      */
+-    public abstract void writeClassesSummary(ClassDoc[] classes, String label);
++    public abstract void writeClassesSummary(ClassDoc[] classes, String label, String tableSummary, String[] tableHeader);
+ 
+     /**
+      * Write the header for the summary.
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java
+@@ -40,6 +40,7 @@
+  * Do not use it as an API
+  *
+  * @author Jamie Ho
++ * @author Bhavesh Patel (Modified)
+  * @since 1.5
+  */
+ public class PackageSummaryBuilder extends AbstractBuilder {
+@@ -184,7 +185,15 @@
+          * Build the summary for the classes in this package.
+          */
+         public void buildClassSummary() {
+-                ClassDoc[] classes =
++            String classTableSummary =
++                    configuration.getText("doclet.Member_Table_Summary",
++                    configuration.getText("doclet.Class_Summary"),
++                    configuration.getText("doclet.classes"));
++            String[] classTableHeader = new String[] {
++                configuration.getText("doclet.Class"),
++                configuration.getText("doclet.Description")
++            };
++            ClassDoc[] classes =
+                         packageDoc.isIncluded()
+                                 ? packageDoc.ordinaryClasses()
+                                 : configuration.classDocCatalog.ordinaryClasses(
+@@ -192,7 +201,8 @@
+                 if (classes.length > 0) {
+                         packageWriter.writeClassesSummary(
+                                 classes,
+-                                configuration.getText("doclet.Class_Summary"));
++                                configuration.getText("doclet.Class_Summary"),
++                                classTableSummary, classTableHeader);
+                 }
+         }
+ 
+@@ -200,7 +210,15 @@
+          * Build the summary for the interfaces in this package.
+          */
+         public void buildInterfaceSummary() {
+-                ClassDoc[] interfaces =
++            String interfaceTableSummary =
++                    configuration.getText("doclet.Member_Table_Summary",
++                    configuration.getText("doclet.Interface_Summary"),
++                    configuration.getText("doclet.interfaces"));
++            String[] interfaceTableHeader = new String[] {
++                configuration.getText("doclet.Interface"),
++                configuration.getText("doclet.Description")
++            };
++            ClassDoc[] interfaces =
+                         packageDoc.isIncluded()
+                                 ? packageDoc.interfaces()
+                                 : configuration.classDocCatalog.interfaces(
+@@ -208,7 +226,8 @@
+                 if (interfaces.length > 0) {
+                         packageWriter.writeClassesSummary(
+                                 interfaces,
+-                                configuration.getText("doclet.Interface_Summary"));
++                                configuration.getText("doclet.Interface_Summary"),
++                                interfaceTableSummary, interfaceTableHeader);
+                 }
+         }
+ 
+@@ -216,7 +235,15 @@
+          * Build the summary for the enums in this package.
+          */
+         public void buildAnnotationTypeSummary() {
+-                ClassDoc[] annotationTypes =
++            String annotationtypeTableSummary =
++                    configuration.getText("doclet.Member_Table_Summary",
++                    configuration.getText("doclet.Annotation_Types_Summary"),
++                    configuration.getText("doclet.annotationtypes"));
++            String[] annotationtypeTableHeader = new String[] {
++                configuration.getText("doclet.AnnotationType"),
++                configuration.getText("doclet.Description")
++            };
++            ClassDoc[] annotationTypes =
+                         packageDoc.isIncluded()
+                                 ? packageDoc.annotationTypes()
+                                 : configuration.classDocCatalog.annotationTypes(
+@@ -224,7 +251,8 @@
+                 if (annotationTypes.length > 0) {
+                         packageWriter.writeClassesSummary(
+                                 annotationTypes,
+-                                configuration.getText("doclet.Annotation_Types_Summary"));
++                                configuration.getText("doclet.Annotation_Types_Summary"),
++                                annotationtypeTableSummary, annotationtypeTableHeader);
+                 }
+         }
+ 
+@@ -232,7 +260,15 @@
+          * Build the summary for the enums in this package.
+          */
+         public void buildEnumSummary() {
+-                ClassDoc[] enums =
++            String enumTableSummary =
++                    configuration.getText("doclet.Member_Table_Summary",
++                    configuration.getText("doclet.Enum_Summary"),
++                    configuration.getText("doclet.enums"));
++            String[] enumTableHeader = new String[] {
++                configuration.getText("doclet.Enum"),
++                configuration.getText("doclet.Description")
++            };
++            ClassDoc[] enums =
+                         packageDoc.isIncluded()
+                                 ? packageDoc.enums()
+                                 : configuration.classDocCatalog.enums(
+@@ -240,7 +276,8 @@
+                 if (enums.length > 0) {
+                         packageWriter.writeClassesSummary(
+                                 enums,
+-                                configuration.getText("doclet.Enum_Summary"));
++                                configuration.getText("doclet.Enum_Summary"),
++                                enumTableSummary, enumTableHeader);
+                 }
+         }
+ 
+@@ -248,7 +285,15 @@
+          * Build the summary for the exceptions in this package.
+          */
+         public void buildExceptionSummary() {
+-                ClassDoc[] exceptions =
++            String exceptionTableSummary =
++                    configuration.getText("doclet.Member_Table_Summary",
++                    configuration.getText("doclet.Exception_Summary"),
++                    configuration.getText("doclet.exceptions"));
++            String[] exceptionTableHeader = new String[] {
++                configuration.getText("doclet.Exception"),
++                configuration.getText("doclet.Description")
++            };
++            ClassDoc[] exceptions =
+                         packageDoc.isIncluded()
+                                 ? packageDoc.exceptions()
+                                 : configuration.classDocCatalog.exceptions(
+@@ -256,7 +301,8 @@
+                 if (exceptions.length > 0) {
+                         packageWriter.writeClassesSummary(
+                                 exceptions,
+-                                configuration.getText("doclet.Exception_Summary"));
++                                configuration.getText("doclet.Exception_Summary"),
++                                exceptionTableSummary, exceptionTableHeader);
+                 }
+         }
+ 
+@@ -264,7 +310,15 @@
+          * Build the summary for the errors in this package.
+          */
+         public void buildErrorSummary() {
+-                ClassDoc[] errors =
++            String errorTableSummary =
++                    configuration.getText("doclet.Member_Table_Summary",
++                    configuration.getText("doclet.Error_Summary"),
++                    configuration.getText("doclet.errors"));
++            String[] errorTableHeader = new String[] {
++                configuration.getText("doclet.Error"),
++                configuration.getText("doclet.Description")
++            };
++            ClassDoc[] errors =
+                         packageDoc.isIncluded()
+                                 ? packageDoc.errors()
+                                 : configuration.classDocCatalog.errors(
+@@ -272,7 +326,8 @@
+                 if (errors.length > 0) {
+                         packageWriter.writeClassesSummary(
+                                 errors,
+-                                configuration.getText("doclet.Error_Summary"));
++                                configuration.getText("doclet.Error_Summary"),
++                                errorTableSummary, errorTableHeader);
+                 }
+         }
+ 
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties
+@@ -82,6 +82,7 @@
+ doclet.Errors=Errors
+ doclet.Classes=Classes
+ doclet.Packages=Packages
++doclet.packages=packages
+ doclet.All_Classes=All Classes
+ doclet.All_Superinterfaces=All Superinterfaces:
+ doclet.All_Implemented_Interfaces=All Implemented Interfaces:
+@@ -92,14 +93,20 @@
+ doclet.Class=Class
+ doclet.AnnotationType=Annotation Type
+ doclet.annotationtype=annotation type
++doclet.annotationtypes=annotation types
+ doclet.Enum=Enum
+ doclet.enum=enum
++doclet.enums=enums
+ doclet.interface=interface
++doclet.interfaces=interfaces
+ doclet.class=class
++doclet.classes=classes
+ doclet.Error=Error
+ doclet.error=error
++doclet.errors=errors
+ doclet.Exception=Exception
+ doclet.exception=exception
++doclet.exceptions=exceptions
+ doclet.extended_by=extended by
+ doclet.extends=extends
+ doclet.Package_private=(package private)
+@@ -125,6 +132,32 @@
+ doclet.value_tag_invalid_constant=@value tag (which references {0}) can only be used in constants.
+ doclet.dest_dir_create=Creating destination directory: "{0}"
+ doclet.in={0} in {1}
++doclet.Use_Table_Summary=Use table, listing {0}, and an explanation
++doclet.Constants_Table_Summary={0} table, listing constant fields, and values
++doclet.Member_Table_Summary={0} table, listing {1}, and an explanation
++doclet.fields=fields
++doclet.constructors=constructors
++doclet.methods=methods
++doclet.annotation_type_optional_members=optional elements
++doclet.annotation_type_required_members=required elements
++doclet.enum_constants=enum constants
++doclet.nested_classes=nested classes
++doclet.subclasses=subclasses
++doclet.subinterfaces=subinterfaces
++doclet.Modifier=Modifier
++doclet.Type=Type
++doclet.Field=Field
++doclet.Constructor=Constructor
++doclet.Method=Method
++doclet.Annotation_Type_Optional_Member=Optional Element
++doclet.Annotation_Type_Required_Member=Required Element
++doclet.Annotation_Type_Member=Annotation Type Element
++doclet.Enum_Constant=Enum Constant
++doclet.Class=Class
++doclet.Description=Description
++doclet.ConstantField=Constant Field
++doclet.Value=Value
++doclet.0_and_1={0} and {1}
+ 
+ #Documentation for Enums
+ doclet.enum_values_doc=\n\
+diff --git a/test/com/sun/javadoc/testHeadings/TestHeadings.java b/test/com/sun/javadoc/testHeadings/TestHeadings.java
+--- langtools/test/com/sun/javadoc/testHeadings/TestHeadings.java
++++ langtools/test/com/sun/javadoc/testHeadings/TestHeadings.java
+@@ -47,14 +47,16 @@
+     private static final String[][] TEST = {
+         //Package summary
+         {BUG_ID + FS + "pkg1" + FS + "package-summary.html",
+-            "<TH ALIGN=\"left\" COLSPAN=\"2\"><FONT SIZE=\"+2\">" + NL +
+-            "<STRONG>Class Summary</STRONG></FONT></TH>"
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Class</TH>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
++            " NOWRAP>Description</TH>"
+         },
+ 
+         // Class documentation
+         {BUG_ID + FS + "pkg1" + FS + "C1.html",
+-            "<TH ALIGN=\"left\" COLSPAN=\"2\"><FONT SIZE=\"+2\">" + NL +
+-            "<STRONG>Field Summary</STRONG></FONT></TH>"
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Modifier and Type</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
++            " SCOPE=\"col\" NOWRAP>Field and Description</TH>"
+         },
+         {BUG_ID + FS + "pkg1" + FS + "C1.html",
+             "<TH ALIGN=\"left\"><STRONG>Methods inherited from class " +            "java.lang.Object</STRONG></TH>"
+@@ -62,29 +64,32 @@
+ 
+         // Class use documentation
+         {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html",
+-            "<TH ALIGN=\"left\" COLSPAN=\"2\"><FONT SIZE=\"+2\">" + NL +
+-            "Packages that use <A HREF=\"../../pkg1/C1.html\" " +            "title=\"class in pkg1\">C1</A></FONT></TH>"
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Package</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
++            " SCOPE=\"col\" NOWRAP>Description</TH>"
+         },
+         {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html",
+             "<TH ALIGN=\"left\" COLSPAN=\"2\"><FONT SIZE=\"+2\">" + NL +
+             "Uses of <A HREF=\"../../pkg1/C1.html\" " +            "title=\"class in pkg1\">C1</A> in " +            "<A HREF=\"../../pkg2/package-summary.html\">pkg2</A></FONT></TH>"
+         },
+         {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html",
+-            "<TH ALIGN=\"left\" COLSPAN=\"2\">Fields in " +            "<A HREF=\"../../pkg2/package-summary.html\">pkg2</A> " +            "declared as <A HREF=\"../../pkg1/C1.html\" " +            "title=\"class in pkg1\">C1</A></FONT></TH>"
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Modifier and Type</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
++            " SCOPE=\"col\" NOWRAP>Field and Description</TH>"
+         },
+ 
+         // Deprecated
+         {BUG_ID + FS + "deprecated-list.html",
+-            "<TH ALIGN=\"left\" COLSPAN=\"2\"><FONT SIZE=\"+2\">" + NL +
+-            "<STRONG>Deprecated Methods</STRONG></FONT></TH>"
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Method and Description</TH>"
+         },
+ 
+         // Constant values
+         {BUG_ID + FS + "constant-values.html",
+-            "<TH ALIGN=\"left\" COLSPAN=\"3\">pkg1.<A HREF=\"pkg1/C1.html\" " +            "title=\"class in pkg1\">C1</A></TH>"
+-        },
+-        {BUG_ID + FS + "constant-values.html",
+-            "<TH ALIGN=\"left\" COLSPAN=\"3\">pkg1.<A HREF=\"pkg1/C1.html\" " +            "title=\"class in pkg1\">C1</A></TH>"
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Modifier and Type</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
++            " SCOPE=\"col\" NOWRAP>Constant Field</TH>" + NL +
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>Value</TH>"
+         },
+ 
+         // Serialized Form
+diff --git a/test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java b/test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java
+--- langtools/test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java
++++ langtools/test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java
+@@ -38,14 +38,15 @@
+ 
+     private static final String BUG_ID = "6786028";
+     private static final String[][] TEST1 = {
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<STRONG>See Also:</STRONG>"}};
++    private static final String[][] NEGATED_TEST1 = {
+         {BUG_ID + FS + "pkg1" + FS + "C1.html", "<STRONG>Method Summary</STRONG>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<STRONG>See Also:</STRONG>"},
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<B>"},
+         {BUG_ID + FS + "pkg1" + FS + "package-summary.html", "<STRONG>Class Summary</STRONG>"}};
+-    private static final String[][] NEGATED_TEST1 = {
+-        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<B>"}};
+     private static final String[][] TEST2 = {
++        {BUG_ID + FS + "pkg2" + FS + "C2.html", "<B>Comments:</B>"}};
++    private static final String[][] NEGATED_TEST2 = {
+         {BUG_ID + FS + "pkg2" + FS + "C2.html", "<STRONG>Method Summary</STRONG>"},
+-        {BUG_ID + FS + "pkg2" + FS + "C2.html", "<B>Comments:</B>"},
+         {BUG_ID + FS + "pkg1" + FS + "package-summary.html", "<STRONG>Class Summary</STRONG>"}};
+ 
+     private static final String[] ARGS1 =
+@@ -62,7 +63,7 @@
+     public static void main(String[] args) {
+         TestHtmlStrongTag tester = new TestHtmlStrongTag();
+         run(tester, ARGS1, TEST1, NEGATED_TEST1);
+-        run(tester, ARGS2, TEST2, NO_TEST);
++        run(tester, ARGS2, TEST2, NEGATED_TEST2);
+         tester.printSummary();
+     }
+ 
+diff --git a/test/com/sun/javadoc/testHtmlTableTags/TestHtmlTableTags.java b/test/com/sun/javadoc/testHtmlTableTags/TestHtmlTableTags.java
+new file mode 100644
+--- /dev/null
++++ langtools/test/com/sun/javadoc/testHtmlTableTags/TestHtmlTableTags.java
+@@ -0,0 +1,478 @@
++/*
++ * 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      6786688
++ * @summary  HTML tables should have table summary, caption and table headers.
++ * @author   Bhavesh Patel
++ * @library  ../lib/
++ * @build    JavadocTester
++ * @build    TestHtmlTableTags
++ * @run main TestHtmlTableTags
++ */
++
++public class TestHtmlTableTags extends JavadocTester {
++
++    //Test information.
++    private static final String BUG_ID = "6786688";
++
++    //Javadoc arguments.
++    private static final String[] ARGS = new String[] {
++        "-d", BUG_ID, "-sourcepath", SRC_DIR, "-use", "pkg1", "pkg2"
++    };
++
++    //Input for string tests for HTML table tags.
++    private static final String[][] TABLE_TAGS_TEST = {
++        /*
++         * Test for validating summary for HTML tables
++         */
++
++        //Package summary
++        {BUG_ID + FS + "pkg1" + FS + "package-summary.html",
++            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
++            "CELLSPACING=\"0\" SUMMARY=\"Class Summary table, " +
++            "listing classes, and an explanation\">"
++        },
++        {BUG_ID + FS + "pkg1" + FS + "package-summary.html",
++            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
++            "CELLSPACING=\"0\" SUMMARY=\"Interface Summary table, " +
++            "listing interfaces, and an explanation\">"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "package-summary.html",
++            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
++            "CELLSPACING=\"0\" SUMMARY=\"Enum Summary table, " +
++            "listing enums, and an explanation\">"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "package-summary.html",
++            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
++            "CELLSPACING=\"0\" SUMMARY=\"Annotation Types Summary table, " +
++            "listing annotation types, and an explanation\">"
++        },
++        // Class documentation
++        {BUG_ID + FS + "pkg1" + FS + "C1.html",
++            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
++            "CELLSPACING=\"0\" SUMMARY=\"Field Summary table, " +
++            "listing fields, and an explanation\">"
++        },
++        {BUG_ID + FS + "pkg1" + FS + "C1.html",
++            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
++            "CELLSPACING=\"0\" SUMMARY=\"Method Summary table, " +
++            "listing methods, and an explanation\">"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "C2.html",
++            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
++            "CELLSPACING=\"0\" SUMMARY=\"Nested Class Summary table, " +
++            "listing nested classes, and an explanation\">"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "C2.html",
++            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
++            "CELLSPACING=\"0\" SUMMARY=\"Constructor Summary table, " +
++            "listing constructors, and an explanation\">"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "C2.ModalExclusionType.html",
++            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
++            "CELLSPACING=\"0\" SUMMARY=\"Enum Constant Summary table, " +
++            "listing enum constants, and an explanation\">"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "C3.html",
++            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
++            "CELLSPACING=\"0\" SUMMARY=\"Required Element Summary table, " +
++            "listing required elements, and an explanation\">"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "C4.html",
++            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
++            "CELLSPACING=\"0\" SUMMARY=\"Optional Element Summary table, " +
++            "listing optional elements, and an explanation\">"
++        },
++        // Class use documentation
++        {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "I1.html",
++            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
++            "CELLSPACING=\"0\" SUMMARY=\"Use table, " +
++            "listing packages, and an explanation\">"
++        },
++        {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html",
++            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
++            "CELLSPACING=\"0\" SUMMARY=\"Use table, " +
++            "listing fields, and an explanation\">"
++        },
++        {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html",
++            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
++            "CELLSPACING=\"0\" SUMMARY=\"Use table, " +
++            "listing methods, and an explanation\">"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.html",
++            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
++            "CELLSPACING=\"0\" SUMMARY=\"Use table, " +
++            "listing fields, and an explanation\">"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.html",
++            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
++            "CELLSPACING=\"0\" SUMMARY=\"Use table, " +
++            "listing methods, and an explanation\">"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.ModalExclusionType.html",
++            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
++            "CELLSPACING=\"0\" SUMMARY=\"Use table, " +
++            "listing packages, and an explanation\">"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.ModalExclusionType.html",
++            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
++            "CELLSPACING=\"0\" SUMMARY=\"Use table, " +
++            "listing methods, and an explanation\">"
++        },
++        // Package use documentation
++        {BUG_ID + FS + "pkg1" + FS + "package-use.html",
++            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
++            "CELLSPACING=\"0\" SUMMARY=\"Use table, " +
++            "listing packages, and an explanation\">"
++        },
++        {BUG_ID + FS + "pkg1" + FS + "package-use.html",
++            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
++            "CELLSPACING=\"0\" SUMMARY=\"Use table, " +
++            "listing classes, and an explanation\">"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "package-use.html",
++            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
++            "CELLSPACING=\"0\" SUMMARY=\"Use table, " +
++            "listing packages, and an explanation\">"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "package-use.html",
++            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
++            "CELLSPACING=\"0\" SUMMARY=\"Use table, " +
++            "listing classes, and an explanation\">"
++        },
++        // Deprecated
++        {BUG_ID + FS + "deprecated-list.html",
++            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
++            "CELLSPACING=\"0\" SUMMARY=\"Deprecated Fields table, " +
++            "listing deprecated fields, and an explanation\">"
++        },
++        {BUG_ID + FS + "deprecated-list.html",
++            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
++            "CELLSPACING=\"0\" SUMMARY=\"Deprecated Methods table, " +
++            "listing deprecated methods, and an explanation\">"
++        },
++        // Constant values
++        {BUG_ID + FS + "constant-values.html",
++            "<TABLE BORDER=\"1\" CELLPADDING=\"3\" CELLSPACING=\"0\" " +
++            "SUMMARY=\"Constant Field Values table, listing " +
++            "constant fields, and values\">"
++        },
++        // Overview Summary
++        {BUG_ID + FS + "overview-summary.html",
++            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
++            "CELLSPACING=\"0\" SUMMARY=\"Packages table, " +
++            "listing packages, and an explanation\">"
++        },
++
++        /*
++         * Test for validating caption for HTML tables
++         */
++
++        //Package summary
++        {BUG_ID + FS + "pkg1" + FS + "package-summary.html",
++            "<CAPTION CLASS=\"TableCaption\">" + NL +
++            "Class Summary</CAPTION>"
++        },
++        {BUG_ID + FS + "pkg1" + FS + "package-summary.html",
++            "<CAPTION CLASS=\"TableCaption\">" + NL +
++            "Interface Summary</CAPTION>"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "package-summary.html",
++            "<CAPTION CLASS=\"TableCaption\">" + NL +
++            "Enum Summary</CAPTION>"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "package-summary.html",
++            "<CAPTION CLASS=\"TableCaption\">" + NL +
++            "Annotation Types Summary</CAPTION>"
++        },
++        // Class documentation
++        {BUG_ID + FS + "pkg1" + FS + "C1.html",
++            "<CAPTION CLASS=\"TableCaption\">" + NL +
++            "Field Summary</CAPTION>"
++        },
++        {BUG_ID + FS + "pkg1" + FS + "C1.html",
++            "<CAPTION CLASS=\"TableCaption\">" + NL +
++            "Method Summary</CAPTION>"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "C2.html",
++            "<CAPTION CLASS=\"TableCaption\">" + NL +
++            "Nested Class Summary</CAPTION>"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "C2.html",
++            "<CAPTION CLASS=\"TableCaption\">" + NL +
++            "Constructor Summary</CAPTION>"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "C2.ModalExclusionType.html",
++            "<CAPTION CLASS=\"TableCaption\">" + NL +
++            "Enum Constant Summary</CAPTION>"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "C3.html",
++            "<CAPTION CLASS=\"TableCaption\">" + NL +
++            "Required Element Summary</CAPTION>"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "C4.html",
++            "<CAPTION CLASS=\"TableCaption\">" + NL +
++            "Optional Element Summary</CAPTION>"
++        },
++        // Class use documentation
++        {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "I1.html",
++            "<CAPTION CLASS=\"TableCaption\">" + NL +
++            "Packages that use <A HREF=\"../../pkg1/I1.html\" " +
++            "title=\"interface in pkg1\">I1</A></CAPTION>"
++        },
++        {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html",
++            "<CAPTION CLASS=\"TableSubCaption\">" + NL +
++            "Fields in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> " +
++            "declared as <A HREF=\"../../pkg1/C1.html\" title=\"class in pkg1\">" +
++            "C1</A></CAPTION>"
++        },
++        {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html",
++            "<CAPTION CLASS=\"TableSubCaption\">" + NL +
++            "Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> " +
++            "with parameters of type <A HREF=\"../../pkg1/C1.html\" " +
++            "title=\"class in pkg1\">C1</A></CAPTION>"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.html",
++            "<CAPTION CLASS=\"TableSubCaption\">" + NL +
++            "Fields in <A HREF=\"../../pkg1/package-summary.html\">pkg1</A> " +
++            "declared as <A HREF=\"../../pkg2/C2.html\" title=\"class in pkg2\">" +
++            "C2</A></CAPTION>"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.html",
++            "<CAPTION CLASS=\"TableSubCaption\">" + NL +
++            "Methods in <A HREF=\"../../pkg1/package-summary.html\">pkg1</A> " +
++            "with parameters of type <A HREF=\"../../pkg2/C2.html\" " +
++            "title=\"class in pkg2\">C2</A></CAPTION>"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.ModalExclusionType.html",
++            "<CAPTION CLASS=\"TableSubCaption\">" + NL +
++            "Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> " +
++            "that return <A HREF=\"../../pkg2/C2.ModalExclusionType.html\" " +
++            "title=\"enum in pkg2\">C2.ModalExclusionType</A></CAPTION>"
++        },
++        // Package use documentation
++        {BUG_ID + FS + "pkg1" + FS + "package-use.html",
++            "<CAPTION CLASS=\"TableCaption\">" + NL +
++            "Packages that use <A HREF=\"../pkg1/package-summary.html\">" +
++            "pkg1</A></CAPTION>"
++        },
++        {BUG_ID + FS + "pkg1" + FS + "package-use.html",
++            "<CAPTION CLASS=\"TableCaption\">" + NL +
++            "Classes in <A HREF=\"../pkg1/package-summary.html\">pkg1</A> " +
++            "used by <A HREF=\"../pkg1/package-summary.html\">pkg1</A></CAPTION>"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "package-use.html",
++            "<CAPTION CLASS=\"TableCaption\">" + NL +
++            "Packages that use <A HREF=\"../pkg2/package-summary.html\">" +
++            "pkg2</A></CAPTION>"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "package-use.html",
++            "<CAPTION CLASS=\"TableCaption\">" + NL +
++            "Classes in <A HREF=\"../pkg2/package-summary.html\">pkg2</A> " +
++            "used by <A HREF=\"../pkg1/package-summary.html\">pkg1</A></CAPTION>"
++        },
++        // Deprecated
++        {BUG_ID + FS + "deprecated-list.html",
++            "<CAPTION CLASS=\"TableCaption\">" + NL +
++            "Deprecated Fields</CAPTION>"
++        },
++        {BUG_ID + FS + "deprecated-list.html",
++            "<CAPTION CLASS=\"TableCaption\">" + NL +
++            "Deprecated Methods</CAPTION>"
++        },
++        // Constant values
++        {BUG_ID + FS + "constant-values.html",
++            "<CAPTION CLASS=\"TableSubCaption\">" + NL +
++            "pkg1.<A HREF=\"pkg1/C1.html\" title=\"class in pkg1\">C1</A></CAPTION>"
++        },
++        // Overview Summary
++        {BUG_ID + FS + "overview-summary.html",
++            "<CAPTION CLASS=\"TableCaption\">" + NL +
++            "Packages</CAPTION>"
++        },
++
++        /*
++         * Test for validating headers for HTML tables
++         */
++
++        //Package summary
++        {BUG_ID + FS + "pkg1" + FS + "package-summary.html",
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Class</TH>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
++            " NOWRAP>Description</TH>"
++        },
++        {BUG_ID + FS + "pkg1" + FS + "package-summary.html",
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Interface</TH>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
++            " NOWRAP>Description</TH>"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "package-summary.html",
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Enum</TH>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
++            " NOWRAP>Description</TH>"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "package-summary.html",
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Annotation Type</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
++            " SCOPE=\"col\" NOWRAP>Description</TH>"
++        },
++        // Class documentation
++        {BUG_ID + FS + "pkg1" + FS + "C1.html",
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Modifier and Type</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
++            " SCOPE=\"col\" NOWRAP>Field and Description</TH>"
++        },
++        {BUG_ID + FS + "pkg1" + FS + "C1.html",
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Modifier and Type</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
++            " SCOPE=\"col\" NOWRAP>Method and Description</TH>"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "C2.html",
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Modifier and Type</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
++            " SCOPE=\"col\" NOWRAP>Class and Description</TH>"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "C2.html",
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Constructor and Description</TH>"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "C2.ModalExclusionType.html",
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Enum Constant and Description</TH>"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "C3.html",
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Modifier and Type</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
++            " SCOPE=\"col\" NOWRAP>Required Element and Description</TH>"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "C4.html",
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Modifier and Type</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
++            " SCOPE=\"col\" NOWRAP>Optional Element and Description</TH>"
++        },
++        // Class use documentation
++        {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "I1.html",
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Package</TH>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
++            " NOWRAP>Description</TH>"
++        },
++        {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html",
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Modifier and Type</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
++            " SCOPE=\"col\" NOWRAP>Field and Description</TH>"
++        },
++        {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html",
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Modifier and Type</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
++            " SCOPE=\"col\" NOWRAP>Method and Description</TH>"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.html",
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Modifier and Type</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
++            " SCOPE=\"col\" NOWRAP>Field and Description</TH>"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.html",
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Modifier and Type</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
++            " SCOPE=\"col\" NOWRAP>Method and Description</TH>"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.ModalExclusionType.html",
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Package</TH>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
++            " NOWRAP>Description</TH>"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.ModalExclusionType.html",
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Modifier and Type</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
++            " SCOPE=\"col\" NOWRAP>Method and Description</TH>"
++        },
++        // Package use documentation
++        {BUG_ID + FS + "pkg1" + FS + "package-use.html",
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Package</TH>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
++            " NOWRAP>Description</TH>"
++        },
++        {BUG_ID + FS + "pkg1" + FS + "package-use.html",
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Class and Description</TH>"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "package-use.html",
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Package</TH>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
++            " NOWRAP>Description</TH>"
++        },
++        {BUG_ID + FS + "pkg2" + FS + "package-use.html",
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Class and Description</TH>"
++        },
++        // Deprecated
++        {BUG_ID + FS + "deprecated-list.html",
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Field and Description</TH>"
++        },
++        {BUG_ID + FS + "deprecated-list.html",
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Method and Description</TH>"
++        },
++        // Constant values
++        {BUG_ID + FS + "constant-values.html",
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Modifier and Type</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
++            " SCOPE=\"col\" NOWRAP>Constant Field</TH>" + NL +
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>Value</TH>"
++        },
++        // Overview Summary
++        {BUG_ID + FS + "overview-summary.html",
++            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
++            "Package</TH>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
++            " NOWRAP>Description</TH>"
++        }
++    };
++    private static final String[][] NEGATED_TEST = NO_TEST;
++
++    /**
++     * The entry point of the test.
++     * @param args the array of command line arguments.
++     */
++    public static void main(String[] args) {
++        TestHtmlTableTags tester = new TestHtmlTableTags();
++        run(tester, ARGS, TABLE_TAGS_TEST, NEGATED_TEST);
++        tester.printSummary();
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public String getBugId() {
++        return BUG_ID;
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public String getBugName() {
++        return getClass().getName();
++    }
++}
+diff --git a/test/com/sun/javadoc/testHtmlTableTags/pkg1/C1.java b/test/com/sun/javadoc/testHtmlTableTags/pkg1/C1.java
+new file mode 100644
+--- /dev/null
++++ langtools/test/com/sun/javadoc/testHtmlTableTags/pkg1/C1.java
+@@ -0,0 +1,81 @@
++/*
++ * 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.
++ */
++
++package pkg1;
++
++import pkg2.*;
++
++/**
++ * A test class.
++ *
++ * @author Bhavesh Patel
++ */
++public class C1 implements I1 {
++
++    /**
++     * Test field for class.
++     */
++    public C2 field;
++
++    /**
++     * Constant value.
++     */
++    public static final String CONSTANT1 = "C1";
++
++    /**
++     * A test constructor.
++     */
++    C1() {
++    }
++
++    /**
++     * Method thats does some processing.
++     *
++     * @param param some parameter that is passed.
++     * @return a sample object.
++     */
++    public C2 method(C2 param) {
++        return param;
++    }
++
++    /**
++     * Method that is implemented.
++     *
++     * @param a some random value.
++     * @param b some random value.
++     */
++    public void method1(int a, int b) {
++    }
++
++    /**
++     * Another inherited method.
++     * @param c some value.
++     */
++    public void method2(int c) {
++    }
++
++    /**
++     * @deprecated don't use this anymore.
++     */
++    public void deprecatedMethod() {}
++}
+diff --git a/test/com/sun/javadoc/testHtmlTableTags/pkg1/I1.java b/test/com/sun/javadoc/testHtmlTableTags/pkg1/I1.java
+new file mode 100644
+--- /dev/null
++++ langtools/test/com/sun/javadoc/testHtmlTableTags/pkg1/I1.java
+@@ -0,0 +1,48 @@
++/*
++ * 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.
++ */
++
++package pkg1;
++
++/**
++ * A sample interface used to test table tags.
++ *
++ * @author Bhavesh Patel
++ */
++public interface I1 {
++
++    /**
++     * A test method.
++     *
++     * @param a blah.
++     * @param b blah.
++     */
++    void method1(int a, int b);
++
++    /**
++     * Another test method.
++     *
++     * @param c blah.
++     */
++    void method2(int c);
++
++}
+diff --git a/test/com/sun/javadoc/testHtmlTableTags/pkg1/package-info.java b/test/com/sun/javadoc/testHtmlTableTags/pkg1/package-info.java
+new file mode 100644
+--- /dev/null
++++ langtools/test/com/sun/javadoc/testHtmlTableTags/pkg1/package-info.java
+@@ -0,0 +1,27 @@
++/*
++ * 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 package 1 used to test table tags.
++ */
++package pkg1;
+diff --git a/test/com/sun/javadoc/testHtmlTableTags/pkg2/C2.java b/test/com/sun/javadoc/testHtmlTableTags/pkg2/C2.java
+new file mode 100644
+--- /dev/null
++++ langtools/test/com/sun/javadoc/testHtmlTableTags/pkg2/C2.java
+@@ -0,0 +1,73 @@
++/*
++ * 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.
++ */
++
++package pkg2;
++
++import pkg1.*;
++
++/**
++ * Another test class.
++ *
++ * @author Bhavesh Patel
++ */
++public class C2 {
++
++    /**
++     * A test field.
++     */
++    public C1 field;
++
++    /**
++     * @deprecated don't use this field anymore.
++     */
++    public C1 dep_field;
++
++    /**
++     * A sample enum.
++     */
++    public static enum ModalExclusionType {
++        /**
++         * Test comment.
++         */
++        NO_EXCLUDE,
++        /**
++         * Another comment.
++         */
++        APPLICATION_EXCLUDE
++    };
++
++    /**
++     * A string constant.
++     */
++    public static final String CONSTANT1 = "C2";
++
++    /**
++     * A sample method.
++     *
++     * @param param some parameter.
++     * @return a test object.
++     */
++    public C1 method(C1 param) {
++        return param;
++    }
++}
+diff --git a/test/com/sun/javadoc/testHtmlTableTags/pkg2/C3.java b/test/com/sun/javadoc/testHtmlTableTags/pkg2/C3.java
+new file mode 100644
+--- /dev/null
++++ langtools/test/com/sun/javadoc/testHtmlTableTags/pkg2/C3.java
+@@ -0,0 +1,40 @@
++/*
++ * 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;
++
++import java.lang.annotation.*;
++
++/**
++ * Test Annotation class.
++ *
++ * @author Bhavesh Patel
++ */
++public @interface C3 {
++    /**
++     * Comment.
++     */
++    String[] value();
++}
+diff --git a/test/com/sun/javadoc/testHtmlTableTags/pkg2/C4.java b/test/com/sun/javadoc/testHtmlTableTags/pkg2/C4.java
+new file mode 100644
+--- /dev/null
++++ langtools/test/com/sun/javadoc/testHtmlTableTags/pkg2/C4.java
+@@ -0,0 +1,35 @@
++/*
++ * 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;
++
++import java.lang.annotation.*;
++
++/*
++ * A sample interface.
++ */
++public @interface C4 {
++    boolean value() default true;
++}
+diff --git a/test/com/sun/javadoc/testHtmlTableTags/pkg2/package-info.java b/test/com/sun/javadoc/testHtmlTableTags/pkg2/package-info.java
+new file mode 100644
+--- /dev/null
++++ langtools/test/com/sun/javadoc/testHtmlTableTags/pkg2/package-info.java
+@@ -0,0 +1,27 @@
++/*
++ * 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 package 2 used to test table tags.
++ */
++package pkg2;
+diff --git a/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java b/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java
+--- langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java
++++ langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java
+@@ -58,7 +58,8 @@
+                 "<A HREF=\"../pkg/Coin.html\" title=\"enum in pkg\">Coin</A>>"
+             },
+             //Check for enum constant section
+-            {BUG_ID + FS + "pkg" + FS + "Coin.html", "<STRONG>Enum Constant Summary</STRONG>"},
++            {BUG_ID + FS + "pkg" + FS + "Coin.html", "<CAPTION CLASS=\"TableCaption\">" + NL +
++                     "Enum Constant Summary</CAPTION>"},
+             //Detail for enum constant
+             {BUG_ID + FS + "pkg" + FS + "Coin.html",
+                 "<STRONG><A HREF=\"../pkg/Coin.html#Dime\">Dime</A></STRONG>"},
+@@ -158,9 +159,11 @@
+                 "public @interface <STRONG>AnnotationType</STRONG>"},
+             //Make sure member summary headings are correct.
+             {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
+-                "<STRONG>Required Element Summary</STRONG>"},
++                "<CAPTION CLASS=\"TableCaption\">" + NL +
++                "Required Element Summary</CAPTION>"},
+             {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
+-                "<STRONG>Optional Element Summary</STRONG>"},
++                "<CAPTION CLASS=\"TableCaption\">" + NL +
++                "Optional Element Summary</CAPTION>"},
+             //Make sure element detail heading is correct
+             {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
+                 "Element Detail"},
+@@ -286,39 +289,57 @@
+ 
+             //ClassUseTest1: <T extends Foo & Foo2>
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html",
+-                 "<TH ALIGN=\"left\" COLSPAN=\"2\">Classes in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo</A></FONT></TH>"
++                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
++                     "Classes in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
++                     "</A> with type parameters of type <A HREF=\"../../pkg2/Foo.html\" " +
++                     "title=\"class in pkg2\">Foo</A></CAPTION>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html",
+                 "<TD><CODE><STRONG><A HREF=\"../../pkg2/ClassUseTest1.html\" title=\"class in pkg2\">ClassUseTest1<T extends Foo & Foo2></A></STRONG></CODE>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html",
+-                "<TH ALIGN=\"left\" COLSPAN=\"2\">Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo</A></FONT></TH>"
++                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
++                     "Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
++                     "</A> with type parameters of type <A HREF=\"../../pkg2/Foo.html\" " +
++                     "title=\"class in pkg2\">Foo</A></CAPTION>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html",
+                 "<TD><CODE><STRONG>ClassUseTest1.</STRONG><STRONG><A HREF=\"../../pkg2/ClassUseTest1.html#method(T)\">method</A></STRONG>(T t)</CODE>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html",
+-                "<TH ALIGN=\"left\" COLSPAN=\"2\">Fields in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo</A></FONT></TH>"
++                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
++                     "Fields in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
++                     "</A> with type parameters of type <A HREF=\"../../pkg2/Foo.html\" " +
++                     "title=\"class in pkg2\">Foo</A></CAPTION>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html",
+                 "<A HREF=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest</A><<A HREF=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo</A>></CODE></FONT></TD>"
+             },
+ 
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
+-                "<TH ALIGN=\"left\" COLSPAN=\"2\">Fields in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> declared as <A HREF=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest</A></FONT></TH>"
++                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
++                     "Fields in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
++                     "</A> declared as <A HREF=\"../../pkg2/ParamTest.html\" " +
++                     "title=\"class in pkg2\">ParamTest</A></CAPTION>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
+                 "<A HREF=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest</A><<A HREF=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo</A>></CODE></FONT></TD>"
+             },
+ 
+            {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html",
+-            "<TH ALIGN=\"left\" COLSPAN=\"2\">Classes in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/Foo2.html\" title=\"interface in pkg2\">Foo2</A></FONT></TH>"
++                    "<CAPTION CLASS=\"TableSubCaption\">" + NL +
++                    "Classes in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
++                    "</A> with type parameters of type <A HREF=\"../../pkg2/Foo2.html\" " +
++                    "title=\"interface in pkg2\">Foo2</A></CAPTION>"
+            },
+            {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html",
+             "<TD><CODE><STRONG><A HREF=\"../../pkg2/ClassUseTest1.html\" title=\"class in pkg2\">ClassUseTest1<T extends Foo & Foo2></A></STRONG></CODE>"
+            },
+            {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html",
+-               "<TH ALIGN=\"left\" COLSPAN=\"2\">Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/Foo2.html\" title=\"interface in pkg2\">Foo2</A></FONT></TH>"
++                    "<CAPTION CLASS=\"TableSubCaption\">" + NL +
++                    "Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
++                    "</A> with type parameters of type <A HREF=\"../../pkg2/Foo2.html\" " +
++                    "title=\"interface in pkg2\">Foo2</A></CAPTION>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html",
+                "<TD><CODE><STRONG>ClassUseTest1.</STRONG><STRONG><A HREF=\"../../pkg2/ClassUseTest1.html#method(T)\">method</A></STRONG>(T t)</CODE>"
+@@ -326,44 +347,66 @@
+ 
+             //ClassUseTest2: <T extends ParamTest<Foo3>>
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
+-              "<TH ALIGN=\"left\" COLSPAN=\"2\">Classes in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest</A></FONT></TH>"
++                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
++                     "Classes in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
++                     "</A> with type parameters of type <A HREF=\"../../pkg2/ParamTest.html\" " +
++                     "title=\"class in pkg2\">ParamTest</A></CAPTION>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
+               "<TD><CODE><STRONG><A HREF=\"../../pkg2/ClassUseTest2.html\" title=\"class in pkg2\">ClassUseTest2<T extends ParamTest<<A HREF=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3</A>>></A></STRONG></CODE>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
+-              "<TH ALIGN=\"left\" COLSPAN=\"2\">Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest</A></FONT></TH>"
++                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
++                     "Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
++                     "</A> with type parameters of type <A HREF=\"../../pkg2/ParamTest.html\" " +
++                     "title=\"class in pkg2\">ParamTest</A></CAPTION>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
+               "<TD><CODE><STRONG>ClassUseTest2.</STRONG><STRONG><A HREF=\"../../pkg2/ClassUseTest2.html#method(T)\">method</A></STRONG>(T t)</CODE>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
+-              "<TH ALIGN=\"left\" COLSPAN=\"2\">Fields in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> declared as <A HREF=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest</A></FONT></TH>"
++                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
++                     "Fields in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
++                     "</A> declared as <A HREF=\"../../pkg2/ParamTest.html\" " +
++                     "title=\"class in pkg2\">ParamTest</A></CAPTION>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
+               "<A HREF=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest</A><<A HREF=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo</A>></CODE></FONT></TD>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
+-              "<TH ALIGN=\"left\" COLSPAN=\"2\">Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest</A></FONT></TH>"
++                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
++                     "Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
++                     "</A> with type parameters of type <A HREF=\"../../pkg2/ParamTest.html\" " +
++                     "title=\"class in pkg2\">ParamTest</A></CAPTION>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
+               "<T extends <A HREF=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest</A><<A HREF=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3</A>>>"
+             },
+ 
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html",
+-                "<TH ALIGN=\"left\" COLSPAN=\"2\">Classes in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3</A></FONT></TH>"
++                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
++                     "Classes in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
++                     "</A> with type parameters of type <A HREF=\"../../pkg2/Foo3.html\" " +
++                     "title=\"class in pkg2\">Foo3</A></CAPTION>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html",
+                 "<TD><CODE><STRONG><A HREF=\"../../pkg2/ClassUseTest2.html\" title=\"class in pkg2\">ClassUseTest2<T extends ParamTest<<A HREF=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3</A>>></A></STRONG></CODE>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html",
+-                "<TH ALIGN=\"left\" COLSPAN=\"2\">Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3</A></FONT></TH>"
++                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
++                     "Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
++                     "</A> with type parameters of type <A HREF=\"../../pkg2/Foo3.html\" " +
++                     "title=\"class in pkg2\">Foo3</A></CAPTION>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html",
+                 "<TD><CODE><STRONG>ClassUseTest2.</STRONG><STRONG><A HREF=\"../../pkg2/ClassUseTest2.html#method(T)\">method</A></STRONG>(T t)</CODE>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html",
+-                "<TH ALIGN=\"left\" COLSPAN=\"2\">Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> that return types with arguments of type <A HREF=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3</A></FONT></TH>"
++                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
++                     "Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
++                     "</A> that return types with arguments of type " +
++                     "<A HREF=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">" +
++                     "Foo3</A></CAPTION>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html",
+                 "<T extends <A HREF=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest</A><<A HREF=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3</A>>>"
+@@ -371,38 +414,61 @@
+ 
+             //ClassUseTest3: <T extends ParamTest2<List<? extends Foo4>>>
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
+-                "<TH ALIGN=\"left\" COLSPAN=\"2\">Classes in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">ParamTest2</A></FONT></TH>"
++                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
++                     "Classes in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
++                     "</A> with type parameters of type " +
++                     "<A HREF=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">" +
++                     "ParamTest2</A></CAPTION>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
+                 "<TD><CODE><STRONG><A HREF=\"../../pkg2/ClassUseTest3.html\" title=\"class in pkg2\">ClassUseTest3<T extends ParamTest2<java.util.List<? extends Foo4>>></A></STRONG></CODE>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
+-                "<TH ALIGN=\"left\" COLSPAN=\"2\">Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">ParamTest2</A></FONT></TH>"
++                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
++                     "Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
++                     "</A> with type parameters of type " +
++                     "<A HREF=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">" +
++                     "ParamTest2</A></CAPTION>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
+                 "<TD><CODE><STRONG>ClassUseTest3.</STRONG><STRONG><A HREF=\"../../pkg2/ClassUseTest3.html#method(T)\">method</A></STRONG>(T t)</CODE>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
+-                "<TH ALIGN=\"left\" COLSPAN=\"2\">Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">ParamTest2</A></FONT></TH>"
++                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
++                     "Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
++                     "</A> with type parameters of type " +
++                     "<A HREF=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">" +
++                     "ParamTest2</A></CAPTION>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
+                 "<T extends <A HREF=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">ParamTest2</A><java.util.List<? extends <A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</A>>>>"
+             },
+ 
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
+-                "<TH ALIGN=\"left\" COLSPAN=\"2\">Classes in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</A></FONT></TH>"
++                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
++                     "Classes in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
++                     "</A> with type parameters of type " +
++                     "<A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">" +
++                     "Foo4</A></CAPTION>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
+                 "<TD><CODE><STRONG><A HREF=\"../../pkg2/ClassUseTest3.html\" title=\"class in pkg2\">ClassUseTest3<T extends ParamTest2<java.util.List<? extends Foo4>>></A></STRONG></CODE>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
+-                "<TH ALIGN=\"left\" COLSPAN=\"2\">Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</A></FONT></TH>"
++                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
++                     "Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
++                     "</A> with type parameters of type <A HREF=\"../../pkg2/Foo4.html\" " +
++                     "title=\"class in pkg2\">Foo4</A></CAPTION>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
+                 "<TD><CODE><STRONG>ClassUseTest3.</STRONG><STRONG><A HREF=\"../../pkg2/ClassUseTest3.html#method(T)\">method</A></STRONG>(T t)</CODE>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
+-                "<TH ALIGN=\"left\" COLSPAN=\"2\">Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> that return types with arguments of type <A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</A></FONT></TH>"
++                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
++                     "Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
++                     "</A> that return types with arguments of type " +
++                     "<A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">" +
++                     "Foo4</A></CAPTION>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
+                 "<T extends <A HREF=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">ParamTest2</A><java.util.List<? extends <A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</A>>>>"
+@@ -410,81 +476,147 @@
+ 
+             //Type parameters in constructor and method args
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
+-                "<TH ALIGN=\"left\" COLSPAN=\"2\">Method parameters in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type arguments of type <A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</A></FONT></TH>" + NL +
+-                "</TR>" + NL +
+-                "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
+-                "<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\"><FONT SIZE=\"-1\">" + NL +
+-                "<CODE> void</CODE></FONT></TD>" + NL +
+-                "<TD><CODE><STRONG>ClassUseTest3.</STRONG><STRONG><A HREF=\"../../pkg2/ClassUseTest3.html#method(java.util.Set)\">method</A></STRONG>(java.util.Set<<A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</A>> p)</CODE>"
++                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
++                     "Method parameters in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
++                     "</A> with type arguments of type <A HREF=\"../../pkg2/Foo4.html\" " +
++                     "title=\"class in pkg2\">Foo4</A></CAPTION>" + NL +
++                     "<TR>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
++                     " NOWRAP>Modifier and Type" +
++                     "</TH>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
++                     " NOWRAP>Method and Description</TH>" + NL +
++                     "</TR>" + NL +
++                     "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
++                     "<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\"><FONT SIZE=\"-1\">" + NL +
++                     "<CODE> void</CODE></FONT></TD>" + NL +
++                     "<TD><CODE><STRONG>ClassUseTest3.</STRONG><STRONG>" +
++                     "<A HREF=\"../../pkg2/ClassUseTest3.html#method(java.util.Set)\">" +
++                     "method</A></STRONG>(java.util.Set<<A HREF=\"../../pkg2/Foo4.html\" " +
++                     "title=\"class in pkg2\">Foo4</A>> p)</CODE>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
+-                "<TH ALIGN=\"left\" COLSPAN=\"2\">Constructor parameters in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type arguments of type <A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</A></FONT></TH>" + NL +
+-                "</TR>" + NL +
+-                "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
+-                "<TD><CODE><STRONG><A HREF=\"../../pkg2/ClassUseTest3.html#ClassUseTest3(java.util.Set)\">ClassUseTest3</A></STRONG>(java.util.Set<<A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</A>> p)</CODE>"
++                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
++                     "Constructor parameters in <A HREF=\"../../pkg2/package-summary.html\">" +
++                     "pkg2</A> with type arguments of type <A HREF=\"../../pkg2/Foo4.html\" " +
++                     "title=\"class in pkg2\">Foo4</A></CAPTION>" + NL +
++                     "<TR>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
++                     " NOWRAP>Constructor and Description" +
++                     "</TH>" + NL + "</TR>" + NL +
++                     "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
++                     "<TD><CODE><STRONG><A HREF=\"../../pkg2/ClassUseTest3.html#ClassUseTest3" +
++                     "(java.util.Set)\">ClassUseTest3</A></STRONG>(java.util.Set<" +
++                     "<A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">" +
++                     "Foo4</A>> p)</CODE>"
+             },
+ 
+             //=================================
+             // Annotatation Type Usage
+             //=================================
+             {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "AnnotationType.html",
+-                "<FONT SIZE=\"+2\">" + NL +
+-                "Packages with annotations of type <A HREF=\"../../pkg/AnnotationType.html\" title=\"annotation in pkg\">AnnotationType</A></FONT></TH>" + NL +
+-                "</TR>" + NL +
+-                "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
+-                "<TD><A HREF=\"../../pkg/package-summary.html\"><STRONG>pkg</STRONG></A></TD>"
++                     "Packages with annotations of type " +
++                     "<A HREF=\"../../pkg/AnnotationType.html\" " +
++                     "title=\"annotation in pkg\">AnnotationType</A></CAPTION>" + NL +
++                     "<TR>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
++                     " NOWRAP>Package" +
++                     "</TH>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
++                     " NOWRAP>Description</TH>" + NL + "</TR>" + NL +
++                     "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
++                     "<TD><A HREF=\"../../pkg/package-summary.html\"><STRONG>pkg" +
++                     "</STRONG></A></TD>"
+             },
+ 
+             {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "AnnotationType.html",
+-                "Classes in <A HREF=\"../../pkg/package-summary.html\">pkg</A> with annotations of type <A HREF=\"../../pkg/AnnotationType.html\" title=\"annotation in pkg\">AnnotationType</A></FONT></TH>" + NL +
+-                "</TR>" + NL +
+-                "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
+-                "<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\"><FONT SIZE=\"-1\">" + NL +
+-                "<CODE> class</CODE></FONT></TD>" + NL +
+-                "<TD><CODE><STRONG><A HREF=\"../../pkg/AnnotationTypeUsage.html\" title=\"class in pkg\">AnnotationTypeUsage</A></STRONG></CODE>"
++                     "Classes in <A HREF=\"../../pkg/package-summary.html\">pkg" +
++                     "</A> with annotations of type <A HREF=\"../../pkg/AnnotationType.html\" " +
++                     "title=\"annotation in pkg\">AnnotationType</A></CAPTION>" + NL +
++                     "<TR>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
++                     " NOWRAP>Modifier and Type" +
++                     "</TH>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
++                     " NOWRAP>Class and Description</TH>" + NL +
++                     "</TR>" + NL +
++                     "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
++                     "<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\"><FONT SIZE=\"-1\">" + NL +
++                     "<CODE> class</CODE></FONT></TD>" + NL +
++                     "<TD><CODE><STRONG><A HREF=\"../../pkg/AnnotationTypeUsage.html\" " +
++                     "title=\"class in pkg\">AnnotationTypeUsage</A></STRONG></CODE>"
+             },
+ 
+             {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "AnnotationType.html",
+-                "Fields in <A HREF=\"../../pkg/package-summary.html\">pkg</A> with annotations of type <A HREF=\"../../pkg/AnnotationType.html\" title=\"annotation in pkg\">AnnotationType</A></FONT></TH>" + NL +
+-                "</TR>" + NL +
+-                "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
+-                "<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\"><FONT SIZE=\"-1\">" + NL +
+-                "<CODE> int</CODE></FONT></TD>" + NL +
+-                "<TD><CODE><STRONG>AnnotationTypeUsage.</STRONG><STRONG><A HREF=\"../../pkg/AnnotationTypeUsage.html#field\">field</A></STRONG></CODE>"
++                     "Fields in <A HREF=\"../../pkg/package-summary.html\">pkg" +
++                     "</A> with annotations of type <A HREF=\"../../pkg/AnnotationType.html\" " +
++                     "title=\"annotation in pkg\">AnnotationType</A></CAPTION>" + NL +
++                     "<TR>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
++                     " NOWRAP>Modifier and Type" +
++                     "</TH>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
++                     " NOWRAP>Field and Description</TH>" + NL +
++                     "</TR>" + NL +
++                     "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
++                     "<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\"><FONT SIZE=\"-1\">" + NL +
++                     "<CODE> int</CODE></FONT></TD>" + NL +
++                     "<TD><CODE><STRONG>AnnotationTypeUsage.</STRONG><STRONG>" +
++                     "<A HREF=\"../../pkg/AnnotationTypeUsage.html#field\">field" +
++                     "</A></STRONG></CODE>"
+             },
+ 
+             {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "AnnotationType.html",
+-                "Methods in <A HREF=\"../../pkg/package-summary.html\">pkg</A> with annotations of type <A HREF=\"../../pkg/AnnotationType.html\" title=\"annotation in pkg\">AnnotationType</A></FONT></TH>" + NL +
+-                "</TR>" + NL +
+-                "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
+-                "<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\"><FONT SIZE=\"-1\">" + NL +
+-                "<CODE> void</CODE></FONT></TD>" + NL +
+-                "<TD><CODE><STRONG>AnnotationTypeUsage.</STRONG><STRONG><A HREF=\"../../pkg/AnnotationTypeUsage.html#method()\">method</A></STRONG>()</CODE>"
++                     "Methods in <A HREF=\"../../pkg/package-summary.html\">pkg" +
++                     "</A> with annotations of type <A HREF=\"../../pkg/AnnotationType.html\" " +
++                     "title=\"annotation in pkg\">AnnotationType</A></CAPTION>" + NL +
++                     "<TR>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
++                     " NOWRAP>Modifier and Type" +
++                     "</TH>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
++                     " NOWRAP>Method and Description</TH>" + NL +
++                     "</TR>" + NL +
++                     "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
++                     "<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\"><FONT SIZE=\"-1\">" + NL +
++                     "<CODE> void</CODE></FONT></TD>" + NL +
++                     "<TD><CODE><STRONG>AnnotationTypeUsage.</STRONG><STRONG>" +
++                     "<A HREF=\"../../pkg/AnnotationTypeUsage.html#method()\">" +
++                     "method</A></STRONG>()</CODE>"
+             },
+ 
+             {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "AnnotationType.html",
+-                "Method parameters in <A HREF=\"../../pkg/package-summary.html\">pkg</A> with annotations of type <A HREF=\"../../pkg/AnnotationType.html\" title=\"annotation in pkg\">AnnotationType</A></FONT></TH>" + NL +
+-                "</TR>" + NL +
+-                "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
+-                "<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\"><FONT SIZE=\"-1\">" + NL +
+-                "<CODE> void</CODE></FONT></TD>" + NL +
+-                "<TD><CODE><STRONG>AnnotationTypeUsage.</STRONG><STRONG><A HREF=\"../../pkg/AnnotationTypeUsage.html#methodWithParams(int, int)\">methodWithParams</A></STRONG>(int documented," + NL +
+-                "                 int undocmented)</CODE>"
++                     "Method parameters in <A HREF=\"../../pkg/package-summary.html\">pkg" +
++                     "</A> with annotations of type <A HREF=\"../../pkg/AnnotationType.html\" " +
++                     "title=\"annotation in pkg\">AnnotationType</A></CAPTION>" + NL +
++                     "<TR>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
++                     " NOWRAP>Modifier and Type" +
++                     "</TH>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
++                     " NOWRAP>Method and Description</TH>" + NL +
++                     "</TR>" + NL +
++                     "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
++                     "<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\"><FONT SIZE=\"-1\">" + NL +
++                     "<CODE> void</CODE></FONT></TD>" + NL +
++                     "<TD><CODE><STRONG>AnnotationTypeUsage.</STRONG><STRONG>" +
++                     "<A HREF=\"../../pkg/AnnotationTypeUsage.html#methodWithParams" +
++                     "(int, int)\">methodWithParams</A></STRONG>(int documented," + NL +
++                     "                 int undocmented)</CODE>"
+             },
+ 
+             {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "AnnotationType.html",
+-                "Constructors in <A HREF=\"../../pkg/package-summary.html\">pkg</A> with annotations of type <A HREF=\"../../pkg/AnnotationType.html\" title=\"annotation in pkg\">AnnotationType</A></FONT></TH>" + NL +
+-                "</TR>" + NL +
+-                "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
+-                "<TD><CODE><STRONG><A HREF=\"../../pkg/AnnotationTypeUsage.html#AnnotationTypeUsage()\">AnnotationTypeUsage</A></STRONG>()</CODE>"
++                     "Constructors in <A HREF=\"../../pkg/package-summary.html\">pkg" +
++                     "</A> with annotations of type <A HREF=\"../../pkg/AnnotationType.html\" " +
++                     "title=\"annotation in pkg\">AnnotationType</A></CAPTION>" + NL +
++                     "<TR>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
++                     " NOWRAP>Constructor and Description" +
++                     "</TH>" + NL + "</TR>" + NL +
++                     "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
++                     "<TD><CODE><STRONG><A HREF=\"../../pkg/" +
++                     "AnnotationTypeUsage.html#AnnotationTypeUsage()\">" +
++                     "AnnotationTypeUsage</A></STRONG>()</CODE>"
+             },
+ 
+             {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "AnnotationType.html",
+-                "Constructor parameters in <A HREF=\"../../pkg/package-summary.html\">pkg</A> with annotations of type <A HREF=\"../../pkg/AnnotationType.html\" title=\"annotation in pkg\">AnnotationType</A></FONT></TH>" + NL +
+-                "</TR>" + NL +
+-                "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
+-                "<TD><CODE><STRONG><A HREF=\"../../pkg/AnnotationTypeUsage.html#AnnotationTypeUsage(int, int)\">AnnotationTypeUsage</A></STRONG>(int documented," + NL +
+-                "                    int undocmented)</CODE>"
++                     "Constructor parameters in <A HREF=\"../../pkg/package-summary.html\">pkg" +
++                     "</A> with annotations of type <A HREF=\"../../pkg/AnnotationType.html\" " +
++                     "title=\"annotation in pkg\">AnnotationType</A></CAPTION>" + NL +
++                     "<TR>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
++                     " NOWRAP>Constructor and Description" +
++                     "</TH>" + NL + "</TR>" + NL +
++                     "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
++                     "<TD><CODE><STRONG><A HREF=\"../../pkg/" +
++                     "AnnotationTypeUsage.html#AnnotationTypeUsage(int, int)\">" +
++                     "AnnotationTypeUsage</A></STRONG>(int documented," + NL +
++                     "                    int undocmented)</CODE>"
+             },
+ 
+             //=================================
+diff --git a/test/com/sun/javadoc/testSummaryHeading/TestSummaryHeading.java b/test/com/sun/javadoc/testSummaryHeading/TestSummaryHeading.java
+--- langtools/test/com/sun/javadoc/testSummaryHeading/TestSummaryHeading.java
++++ langtools/test/com/sun/javadoc/testSummaryHeading/TestSummaryHeading.java
+@@ -46,7 +46,8 @@
+ 
+     //Input for string search tests.
+     private static final String[][] TEST = {
+-        {BUG_ID + FS + "C.html",  "<STRONG>Method Summary</STRONG>"}
++        {BUG_ID + FS + "C.html",  "<CAPTION CLASS=\"TableCaption\">" + NL +
++                 "Method Summary</CAPTION>"}
+     };
+     private static final String[][] NEGATED_TEST = NO_TEST;
+ 

Added: trunk/java/openjdk6/files/icedtea/openjdk/6786690-wcag_dl.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/openjdk/6786690-wcag_dl.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/openjdk/6786690-wcag_dl.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,3230 @@
+# HG changeset patch
+# User andrew
+# Date 1371571959 18000
+# Node ID 9cad0410f52a47fdd3b294a10f076e7456a47e9a
+# Parent  9b884c583c41a545352b035d11d1ccacb96fbb2f
+6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
+Reviewed-by: jjg
+
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java
+@@ -25,11 +25,11 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
+-import com.sun.tools.doclets.internal.toolkit.util.*;
++import java.io.*;
++import java.util.*;
+ 
+ import com.sun.javadoc.*;
+-import java.io.*;
+-import java.util.*;
++import com.sun.tools.doclets.internal.toolkit.util.*;
+ 
+ /**
+  * Generate Index for all the Member Names with Indexing in
+@@ -100,18 +100,22 @@
+         h2();
+         strong(unicode.toString());
+         h2End();
+-        dl();
+-        for (int i = 0; i < memberlist.size(); i++) {
+-            Doc element = (Doc)memberlist.get(i);
+-            if (element instanceof MemberDoc) {
+-                printDescription((MemberDoc)element);
+-            } else if (element instanceof ClassDoc) {
+-                printDescription((ClassDoc)element);
+-            } else if (element instanceof PackageDoc) {
+-                printDescription((PackageDoc)element);
++        int memberListSize = memberlist.size();
++        // Display the list only if there are elements to be displayed.
++        if (memberListSize > 0) {
++            dl();
++            for (int i = 0; i < memberListSize; i++) {
++                Doc element = memberlist.get(i);
++                if (element instanceof MemberDoc) {
++                    printDescription((MemberDoc)element);
++                } else if (element instanceof ClassDoc) {
++                    printDescription((ClassDoc)element);
++                } else if (element instanceof PackageDoc) {
++                    printDescription((PackageDoc)element);
++                }
+             }
++            dlEnd();
+         }
+-        dlEnd();
+         hr();
+     }
+ 
+@@ -126,8 +130,10 @@
+         printPackageLink(pkg, Util.getPackageName(pkg), true);
+         print(" - ");
+         print(configuration.getText("doclet.package") + " " + pkg.name());
++        dtEnd();
+         dd();
+         printSummaryComment(pkg);
++        ddEnd();
+     }
+ 
+     /**
+@@ -140,8 +146,10 @@
+         printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_INDEX, cd, true));
+         print(" - ");
+         printClassInfo(cd);
++        dtEnd();
+         dd();
+         printComment(cd);
++        ddEnd();
+     }
+ 
+     /**
+@@ -178,8 +186,10 @@
+         println(" - ");
+         printMemberDesc(member);
+         println();
++        dtEnd();
+         dd();
+         printComment(member);
++        ddEnd();
+         println();
+     }
+ 
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java
+@@ -25,19 +25,20 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
++import java.lang.reflect.Modifier;
++import java.util.*;
++
++import com.sun.javadoc.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+ import com.sun.tools.doclets.internal.toolkit.taglets.*;
+ 
+-import com.sun.javadoc.*;
+-import java.util.*;
+-import java.lang.reflect.Modifier;
+-
+ /**
+  * The base class for member writers.
+  *
+  * @author Robert Field
+  * @author Atul M Dambalkar
+  * @author Jamie Ho (Re-write)
++ * @author Bhavesh Patel (Modified)
+  */
+ public abstract class AbstractMemberWriter {
+ 
+@@ -232,10 +233,26 @@
+         }
+     }
+ 
++    /**
++     * Print the deprecated output for the given member.
++     *
++     * @param member the member being documented.
++     */
++    protected void printDeprecated(ProgramElementDoc member) {
++        String output = (new DeprecatedTaglet()).getTagletOutput(member,
++            writer.getTagletWriterInstance(false)).toString().trim();
++        if (!output.isEmpty()) {
++            writer.printMemberDetailsListStartTag();
++            writer.print(output);
++        }
++    }
++
+     protected void printComment(ProgramElementDoc member) {
+         if (member.inlineTags().length > 0) {
++            writer.printMemberDetailsListStartTag();
+             writer.dd();
+             writer.printInlineComment(member);
++            writer.ddEnd();
+         }
+     }
+ 
+@@ -267,6 +284,14 @@
+     }
+ 
+     /**
++     * Write the member footer.
++     */
++    protected void printMemberFooter() {
++        writer.printMemberDetailsListEndTag();
++        assert !writer.getMemberDetailsListPrinted();
++    }
++
++    /**
+      * Forward to containing writer
+      */
+     public void printSummaryHeader(ClassDoc cd) {
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java
+@@ -25,10 +25,10 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
++import java.io.*;
++
++import com.sun.javadoc.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+-import com.sun.javadoc.*;
+-
+-import java.io.*;
+ 
+ /**
+  * Writes annotation type optional member documentation in HTML format.
+@@ -63,14 +63,20 @@
+      * {@inheritDoc}
+      */
+     public void writeDefaultValueInfo(MemberDoc member) {
+-        writer.dl();
+-        writer.dt();
+-        writer.strong(ConfigurationImpl.getInstance().
+-            getText("doclet.Default"));
+-        writer.dd();
+-        writer.print(((AnnotationTypeElementDoc) member).defaultValue());
+-        writer.ddEnd();
+-        writer.dlEnd();
++        if (((AnnotationTypeElementDoc) member).defaultValue() != null) {
++            writer.printMemberDetailsListStartTag();
++            writer.dd();
++            writer.dl();
++            writer.dt();
++            writer.strong(ConfigurationImpl.getInstance().
++                getText("doclet.Default"));
++            writer.dtEnd();
++            writer.dd();
++            writer.print(((AnnotationTypeElementDoc) member).defaultValue());
++            writer.ddEnd();
++            writer.dlEnd();
++            writer.ddEnd();
++        }
+     }
+ 
+     /**
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java
+@@ -25,11 +25,10 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
++import java.io.*;
++
++import com.sun.javadoc.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+-import com.sun.tools.doclets.internal.toolkit.taglets.*;
+-import com.sun.javadoc.*;
+-
+-import java.io.*;
+ 
+ /**
+  * Writes annotation type required member documentation in HTML format.
+@@ -134,17 +133,14 @@
+             strong(member.name());
+         }
+         writer.preEnd();
+-        writer.dl();
++        assert !writer.getMemberDetailsListPrinted();
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+     public void writeComments(MemberDoc member) {
+-        if (member.inlineTags().length > 0) {
+-            writer.dd();
+-            writer.printInlineComment(member);
+-        }
++        printComment(member);
+     }
+ 
+     /**
+@@ -160,7 +156,7 @@
+      * Write the annotation type member footer.
+      */
+     public void writeMemberFooter() {
+-        writer.dlEnd();
++        printMemberFooter();
+     }
+ 
+     /**
+@@ -267,9 +263,7 @@
+      * {@inheritDoc}
+      */
+     public void writeDeprecated(MemberDoc member) {
+-        print(((TagletOutputImpl)
+-            (new DeprecatedTaglet()).getTagletOutput(member,
+-            writer.getTagletWriterInstance(false))).toString());
++        printDeprecated(member);
+     }
+ 
+     private Type getType(MemberDoc member) {
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java
+@@ -25,10 +25,10 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
++import com.sun.javadoc.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+ import com.sun.tools.doclets.internal.toolkit.builders.*;
+-import com.sun.javadoc.*;
+ 
+ /**
+  * Generate the Class Information Page.
+@@ -165,8 +165,6 @@
+      * {@inheritDoc}
+      */
+     public void writeAnnotationTypeSignature(String modifiers) {
+-        dl();
+-        dt();
+         preNoNewLine();
+         writeAnnotationInfo(annotationType);
+         print(modifiers);
+@@ -178,7 +176,6 @@
+         } else {
+             strong(name);
+         }
+-        dlEnd();
+         preEnd();
+         p();
+     }
+@@ -334,6 +331,7 @@
+             } else {
+                 strongText("doclet.Enclosing_Class");
+             }
++            dtEnd();
+             dd();
+             printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS, outerClass,
+                 false));
+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
+@@ -25,12 +25,12 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
++import java.util.*;
++
++import com.sun.javadoc.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+ import com.sun.tools.doclets.internal.toolkit.builders.*;
+-import com.sun.javadoc.*;
+-
+-import java.util.*;
+ import com.sun.tools.doclets.internal.toolkit.taglets.*;
+ 
+ /**
+@@ -171,8 +171,6 @@
+      */
+     public void writeClassSignature(String modifiers) {
+         boolean isInterface = classDoc.isInterface();
+-        dl();
+-        dt();
+         preNoNewLine();
+         writeAnnotationInfo(classDoc);
+         print(modifiers);
+@@ -191,7 +189,7 @@
+             Type superclass = Util.getFirstVisibleSuperClass(classDoc,
+                 configuration());
+             if (superclass != null) {
+-                dt();
++                println();
+                 print("extends ");
+                 printLink(new LinkInfoImpl(
+                     LinkInfoImpl.CONTEXT_CLASS_SIGNATURE_PARENT_NAME,
+@@ -208,7 +206,7 @@
+                     continue;
+                 }
+                 if (counter == 0) {
+-                    dt();
++                    println();
+                     print(isInterface? "extends " : "implements ");
+                 } else {
+                     print(", ");
+@@ -219,7 +217,6 @@
+                 counter++;
+             }
+         }
+-        dlEnd();
+         preEnd();
+         p();
+     }
+@@ -342,6 +339,7 @@
+             TagletOutput output = (new ParamTaglet()).getTagletOutput(classDoc,
+                 getTagletWriterInstance(false));
+             print(output.toString());
++            dtEnd();
+             dlEnd();
+         }
+     }
+@@ -360,8 +358,10 @@
+                 dl();
+                 dt();
+                 strongText("doclet.Subclasses");
++                dtEnd();
+                 writeClassLinks(LinkInfoImpl.CONTEXT_SUBCLASSES,
+                     subclasses);
++                dlEnd();
+             }
+         }
+     }
+@@ -376,8 +376,10 @@
+                 dl();
+                 dt();
+                 strongText("doclet.Subinterfaces");
++                dtEnd();
+                 writeClassLinks(LinkInfoImpl.CONTEXT_SUBINTERFACES,
+                     subInterfaces);
++                dlEnd();
+             }
+         }
+     }
+@@ -398,8 +400,10 @@
+             dl();
+             dt();
+             strongText("doclet.Implementing_Classes");
++            dtEnd();
+             writeClassLinks(LinkInfoImpl.CONTEXT_IMPLEMENTED_CLASSES,
+                 implcl);
++            dlEnd();
+         }
+     }
+ 
+@@ -414,8 +418,10 @@
+             dl();
+             dt();
+             strongText("doclet.All_Implemented_Interfaces");
++            dtEnd();
+             writeClassLinks(LinkInfoImpl.CONTEXT_IMPLEMENTED_INTERFACES,
+                 interfaceArray);
++            dlEnd();
+         }
+     }
+ 
+@@ -430,8 +436,10 @@
+             dl();
+             dt();
+             strongText("doclet.All_Superinterfaces");
++            dtEnd();
+             writeClassLinks(LinkInfoImpl.CONTEXT_SUPER_INTERFACES,
+                 interfaceArray);
++            dlEnd();
+         }
+     }
+ 
+@@ -455,7 +463,6 @@
+             }
+         }
+         ddEnd();
+-        dlEnd();
+     }
+ 
+     protected void navLinkTree() {
+@@ -574,6 +581,7 @@
+             } else {
+                 strongText("doclet.Enclosing_Class");
+             }
++            dtEnd();
+             dd();
+             printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS, outerClass,
+                 false));
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java
+@@ -25,12 +25,12 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
++import java.io.*;
++import java.util.*;
++
++import com.sun.javadoc.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+-import com.sun.tools.doclets.internal.toolkit.taglets.*;
+-import com.sun.javadoc.*;
+-import java.util.*;
+-import java.io.*;
+ 
+ /**
+  * Writes constructor documentation.
+@@ -149,7 +149,7 @@
+         writeParameters(constructor);
+         writeExceptions(constructor);
+         writer.preEnd();
+-        writer.dl();
++        assert !writer.getMemberDetailsListPrinted();
+     }
+ 
+     /**
+@@ -158,12 +158,7 @@
+      * @param constructor the constructor being documented.
+      */
+     public void writeDeprecated(ConstructorDoc constructor) {
+-        String output = ((TagletOutputImpl)
+-            (new DeprecatedTaglet()).getTagletOutput(constructor,
+-            writer.getTagletWriterInstance(false))).toString();
+-        if (output != null && output.trim().length() > 0) {
+-            writer.print(output);
+-        }
++        printDeprecated(constructor);
+     }
+ 
+     /**
+@@ -172,10 +167,7 @@
+      * @param constructor the constructor being documented.
+      */
+     public void writeComments(ConstructorDoc constructor) {
+-        if (constructor.inlineTags().length > 0) {
+-            writer.dd();
+-            writer.printInlineComment(constructor);
+-        }
++        printComment(constructor);
+     }
+ 
+     /**
+@@ -191,7 +183,7 @@
+      * Write the constructor footer.
+      */
+     public void writeConstructorFooter() {
+-        writer.dlEnd();
++        printMemberFooter();
+     }
+ 
+     /**
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java
+@@ -25,12 +25,11 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
++import java.io.*;
++
++import com.sun.javadoc.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+-import com.sun.tools.doclets.internal.toolkit.taglets.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+-import com.sun.javadoc.*;
+-
+-import java.io.*;
+ 
+ /**
+  * Writes enum constant documentation in HTML format.
+@@ -146,26 +145,21 @@
+             strong(enumConstant.name());
+         }
+         writer.preEnd();
+-        writer.dl();
++        assert !writer.getMemberDetailsListPrinted();
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+     public void writeDeprecated(FieldDoc enumConstant) {
+-        print(((TagletOutputImpl)
+-            (new DeprecatedTaglet()).getTagletOutput(enumConstant,
+-            writer.getTagletWriterInstance(false))).toString());
++        printDeprecated(enumConstant);
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+     public void writeComments(FieldDoc enumConstant) {
+-        if (enumConstant.inlineTags().length > 0) {
+-            writer.dd();
+-            writer.printInlineComment(enumConstant);
+-        }
++        printComment(enumConstant);
+     }
+ 
+     /**
+@@ -179,7 +173,7 @@
+      * {@inheritDoc}
+      */
+     public void writeEnumConstantFooter() {
+-        writer.dlEnd();
++        printMemberFooter();
+     }
+ 
+     /**
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java
+@@ -25,12 +25,11 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
++import java.io.*;
++
++import com.sun.javadoc.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+-import com.sun.tools.doclets.internal.toolkit.taglets.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+-import com.sun.javadoc.*;
+-
+-import java.io.*;
+ 
+ /**
+  * Writes field documentation in HTML format.
+@@ -156,7 +155,7 @@
+             strong(field.name());
+         }
+         writer.preEnd();
+-        writer.dl();
++        assert !writer.getMemberDetailsListPrinted();
+     }
+ 
+     /**
+@@ -165,9 +164,7 @@
+      * @param field the field being documented.
+      */
+     public void writeDeprecated(FieldDoc field) {
+-        print(((TagletOutputImpl)
+-            (new DeprecatedTaglet()).getTagletOutput(field,
+-            writer.getTagletWriterInstance(false))).toString());
++        printDeprecated(field);
+     }
+ 
+     /**
+@@ -178,10 +175,12 @@
+     public void writeComments(FieldDoc field) {
+         ClassDoc holder = field.containingClass();
+         if (field.inlineTags().length > 0) {
++            writer.printMemberDetailsListStartTag();
+             if (holder.equals(classdoc) ||
+                 (! (holder.isPublic() || Util.isLinkable(holder, configuration())))) {
+                 writer.dd();
+                 writer.printInlineComment(field);
++                writer.ddEnd();
+             } else {
+                 String classlink = writer.codeText(
+                     writer.getDocLink(LinkInfoImpl.CONTEXT_FIELD_DOC_COPY,
+@@ -196,6 +195,7 @@
+                 writer.ddEnd();
+                 writer.dd();
+                 writer.printInlineComment(field);
++                writer.ddEnd();
+             }
+         }
+     }
+@@ -213,7 +213,7 @@
+      * Write the field footer.
+      */
+     public void writeFieldFooter() {
+-        writer.dlEnd();
++        printMemberFooter();
+     }
+ 
+     /**
+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
+@@ -24,17 +24,16 @@
+  */
+ 
+ package com.sun.tools.doclets.formats.html;
+-import com.sun.tools.doclets.formats.html.markup.*;
+ 
+-import com.sun.tools.doclets.internal.toolkit.*;
+-import com.sun.tools.doclets.internal.toolkit.util.*;
+-import com.sun.tools.doclets.internal.toolkit.taglets.*;
+-
+-import com.sun.javadoc.*;
+ import java.io.*;
+ import java.text.SimpleDateFormat;
+ import java.util.*;
+ 
++import com.sun.javadoc.*;
++import com.sun.tools.doclets.formats.html.markup.*;
++import com.sun.tools.doclets.internal.toolkit.*;
++import com.sun.tools.doclets.internal.toolkit.util.*;
++import com.sun.tools.doclets.internal.toolkit.taglets.*;
+ 
+ /**
+  * Class for the Html Format Code Generation specific to JavaDoc.
+@@ -44,6 +43,7 @@
+  * @since 1.2
+  * @author Atul M Dambalkar
+  * @author Robert Field
++ * @author Bhavesh Patel (Modified)
+  */
+ public class HtmlDocletWriter extends HtmlDocWriter {
+ 
+@@ -205,7 +205,13 @@
+     private void printMethodInfo(MethodDoc method) {
+         ClassDoc[] intfacs = method.containingClass().interfaces();
+         MethodDoc overriddenMethod = method.overriddenMethod();
+-        if (intfacs.length > 0 || overriddenMethod != null) {
++        // Check whether there is any implementation or overridden info to be
++        // printed. If no overridden or implementation info needs to be
++        // printed, do not print this section.
++        if ((intfacs.length > 0 &&
++                new ImplementedMethods(method, this.configuration).build().length > 0) ||
++                overriddenMethod != null) {
++            printMemberDetailsListStartTag();
+             dd();
+             printTagsInfoHeader();
+             MethodWriterImpl.printImplementsInfo(this, method);
+@@ -216,7 +222,6 @@
+             printTagsInfoFooter();
+             ddEnd();
+         }
+-        dd();
+     }
+ 
+     protected void printTags(Doc doc) {
+@@ -230,41 +235,35 @@
+         TagletWriter.genTagOuput(configuration.tagletManager, doc,
+             configuration.tagletManager.getCustomTags(doc),
+                 getTagletWriterInstance(false), output);
+-        if (output.toString().trim().length() > 0) {
++        String outputString = output.toString().trim();
++        // For RootDoc and ClassDoc, this section is not the definition description
++        // but the start of definition list.
++        if (!outputString.isEmpty()) {
++            if (!(doc instanceof RootDoc || doc instanceof ClassDoc)) {
++                printMemberDetailsListStartTag();
++                dd();
++            }
+             printTagsInfoHeader();
+-            print(output.toString());
++            print(outputString);
+             printTagsInfoFooter();
+-        } else if (! (doc instanceof ConstructorDoc ||
+-            doc instanceof RootDoc || doc instanceof ClassDoc)) {
+-            //To be consistent with 1.4.2 output.
+-            //I hate to do this but we have to pass the diff test to prove
+-            //nothing has broken.
+-            printTagsInfoHeader();
+-            printTagsInfoFooter();
++            if (!(doc instanceof RootDoc || doc instanceof ClassDoc))
++                ddEnd();
+         }
+     }
+ 
+     /**
+-     * Check whether there are any tags to be printed.
++     * Check whether there are any tags for Serialization Overview
++     * section to be printed.
+      *
+-     * @param doc the Doc object to check for tags.
++     * @param field the FieldDoc 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;
+-            }
+-        }
++    protected boolean hasSerializationOverviewTags(FieldDoc field) {
+         TagletOutputImpl output = new TagletOutputImpl("");
+-        TagletWriter.genTagOuput(configuration.tagletManager, doc,
+-            configuration.tagletManager.getCustomTags(doc),
++        TagletWriter.genTagOuput(configuration.tagletManager, field,
++            configuration.tagletManager.getCustomTags(field),
+                 getTagletWriterInstance(false), output);
+-        return (output.toString().trim().isEmpty());
++        return (!output.toString().trim().isEmpty());
+     }
+ 
+     /**
+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
+@@ -25,11 +25,12 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
++import java.util.*;
++
++import com.sun.javadoc.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.tools.doclets.internal.toolkit.taglets.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+-import com.sun.javadoc.*;
+-import java.util.*;
+ 
+ /**
+  * Generate serialized form for serializable fields.
+@@ -37,6 +38,7 @@
+  * <code>serialField</code> is processed.
+  *
+  * @author Joe Fialli
++ * @author Bhavesh Patel (Modified)
+  */
+ public class HtmlSerialFieldWriter extends FieldWriterImpl
+     implements SerializedFormWriter.SerialFieldWriter {
+@@ -75,7 +77,7 @@
+             writer.println();
+             if (heading.equals(
+                    configuration().getText("doclet.Serialized_Form_class"))) {
+-                writer.dl();
++                assert !writer.getMemberDetailsListPrinted();
+             }
+         } else {
+             writer.printTableHeadingBackground(heading);
+@@ -102,7 +104,7 @@
+         print(fieldDimensions + ' ');
+         strong(fieldName);
+         writer.preEnd();
+-        writer.dl();
++        assert !writer.getMemberDetailsListPrinted();
+     }
+ 
+     /**
+@@ -111,9 +113,7 @@
+      * @param field the field to document.
+      */
+     public void writeMemberDeprecatedInfo(FieldDoc field) {
+-        print(((TagletOutputImpl)
+-            (new DeprecatedTaglet()).getTagletOutput(field,
+-            writer.getTagletWriterInstance(false))).toString());
++        printDeprecated(field);
+     }
+ 
+     /**
+@@ -123,14 +123,17 @@
+      */
+     public void writeMemberDescription(FieldDoc field) {
+         if (field.inlineTags().length > 0) {
++            writer.printMemberDetailsListStartTag();
+             writer.dd();
+             writer.printInlineComment(field);
++            writer.ddEnd();
+         }
+         Tag[] tags = field.tags("serial");
+         if (tags.length > 0) {
+-            writer.dt();
++            writer.printMemberDetailsListStartTag();
+             writer.dd();
+             writer.printInlineComment(field, tags[0]);
++            writer.ddEnd();
+         }
+     }
+ 
+@@ -140,9 +143,14 @@
+      * @param serialFieldTag the field to document (represented by tag).
+      */
+     public void writeMemberDescription(SerialFieldTag serialFieldTag) {
+-        writer.dd();
+-        writer.print(serialFieldTag.description());
+-        writer.dlEnd();
++        String serialFieldTagDesc = serialFieldTag.description().trim();
++        if (!serialFieldTagDesc.isEmpty()) {
++            writer.dl();
++            writer.dd();
++            writer.print(serialFieldTagDesc);
++            writer.ddEnd();
++            writer.dlEnd();
++        }
+     }
+ 
+     /**
+@@ -151,33 +159,57 @@
+      * @param field the field to document.
+      */
+     public void writeMemberTags(FieldDoc field) {
+-        writer.dl();
+         TagletOutputImpl output = new TagletOutputImpl("");
+         TagletWriter.genTagOuput(configuration().tagletManager, field,
+             configuration().tagletManager.getCustomTags(field),
+                 writer.getTagletWriterInstance(false), output);
+-        if (output.toString().length() > 0) {
+-            print(output.toString());
++        String outputString = output.toString().trim();
++        if (!outputString.isEmpty()) {
++            writer.printMemberDetailsListStartTag();
++            writer.dd();
++            writer.dl();
++            print(outputString);
++            writer.dlEnd();
++            writer.ddEnd();
+         }
+-        writer.dlEnd();
+-    }
+-    public void writeMemberFooter(FieldDoc member) {
+-        writer.dlEnd();
+     }
+ 
+     /**
+-     * Check to see if member details should be printed. If
++     * Check to see if overview 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.
++     * for deprecation info, comment or tags, do not print overview details.
++     *
++     * @param field the field to check overview details for.
++     * @return true if overview details need to be printed
+      */
+-    public boolean shouldPrintMemberDetails(FieldDoc field) {
+-        if (!configuration().nocomment)
+-            if((field.inlineTags().length > 0) ||
+-                (field.tags("serial").length > 0) || (writer.hasTagsToPrint(field)))
++    public boolean shouldPrintOverview(FieldDoc field) {
++        if (!configuration().nocomment) {
++            if(!field.commentText().isEmpty() ||
++                    writer.hasSerializationOverviewTags(field))
+                 return true;
+-        if (!Util.isDeprecated(field))
++        }
++        if (field.tags("deprecated").length > 0)
+             return true;
+         return false;
+     }
++
++    public void writeMemberFooter() {
++        printMemberFooter();
++    }
++
++    /**
++     * Write the footer information. If the serilization overview section was
++     * printed, check for definition list and close list tag.
++     *
++     * @param heading the heading that was written.
++     */
++    public void writeFooter(String heading) {
++        if (printedOverallAnchor) {
++            if (heading.equals(
++                   configuration().getText("doclet.Serialized_Form_class"))) {
++                writer.printMemberDetailsListEndTag();
++                assert !writer.getMemberDetailsListPrinted();
++            }
++        }
++    }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java
+@@ -25,9 +25,9 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
++import com.sun.javadoc.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.tools.doclets.internal.toolkit.taglets.*;
+-import com.sun.javadoc.*;
+ 
+ /**
+  * Generate serialized form for Serializable/Externalizable methods.
+@@ -66,14 +66,12 @@
+         writeSignature(member);
+     }
+ 
+-    public void writeMemberFooter(MethodDoc member) {
+-        writer.dlEnd();
++    public void writeMemberFooter() {
++        printMemberFooter();
+     }
+ 
+     public void writeDeprecatedMemberInfo(MethodDoc member) {
+-        print(((TagletOutputImpl)
+-            (new DeprecatedTaglet()).getTagletOutput(member,
+-            writer.getTagletWriterInstance(false))).toString());
++        printDeprecated(member);
+     }
+ 
+     public void writeMemberDescription(MethodDoc member) {
+@@ -81,23 +79,27 @@
+     }
+ 
+     public void writeMemberTags(MethodDoc member) {
+-        writer.dd();
+-        writer.dl();
+         TagletOutputImpl output = new TagletOutputImpl("");
+         TagletManager tagletManager =
+             ConfigurationImpl.getInstance().tagletManager;
+         TagletWriter.genTagOuput(tagletManager, member,
+             tagletManager.getSerializedFormTags(),
+             writer.getTagletWriterInstance(false), output);
+-        print(output.toString());
++        String outputString = output.toString().trim();
++        if (!outputString.isEmpty()) {
++            writer.printMemberDetailsListStartTag();
++            writer.dd();
++            writer.dl();
++            print(outputString);
++            writer.dlEnd();
++            writer.ddEnd();
++        }
+         MethodDoc method = (MethodDoc)member;
+         if (method.name().compareTo("writeExternal") == 0
+                 && method.tags("serialData").length == 0) {
+             serialWarning(member.position(), "doclet.MissingSerialDataTag",
+                 method.containingClass().qualifiedName(), method.name());
+         }
+-        writer.ddEnd();
+-        writer.dlEnd();
+     }
+ 
+     protected void printTypeLinkNoDimension(Type type) {
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java
+@@ -25,13 +25,13 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
++import java.io.*;
++
++import com.sun.javadoc.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+ import com.sun.tools.doclets.internal.toolkit.taglets.*;
+ 
+-import java.io.*;
+-import com.sun.javadoc.*;
+-
+ /**
+  * Writes method documentation in HTML format.
+  *
+@@ -172,7 +172,7 @@
+         writeParameters(method);
+         writeExceptions(method);
+         writer.preEnd();
+-        writer.dl();
++        assert !writer.getMemberDetailsListPrinted();
+     }
+ 
+     /**
+@@ -181,12 +181,7 @@
+      * @param method the method being documented.
+      */
+     public void writeDeprecated(MethodDoc method) {
+-        String output = ((TagletOutputImpl)
+-            (new DeprecatedTaglet()).getTagletOutput(method,
+-            writer.getTagletWriterInstance(false))).toString();
+-        if (output != null && output.trim().length() > 0) {
+-            writer.print(output);
+-        }
++        printDeprecated(method);
+     }
+ 
+     /**
+@@ -197,11 +192,13 @@
+     public void writeComments(Type holder, MethodDoc method) {
+         ClassDoc holderClassDoc = holder.asClassDoc();
+         if (method.inlineTags().length > 0) {
++            writer.printMemberDetailsListStartTag();
+             if (holder.asClassDoc().equals(classdoc) ||
+                 (! (holderClassDoc.isPublic() ||
+                     Util.isLinkable(holderClassDoc, configuration())))) {
+                 writer.dd();
+                 writer.printInlineComment(method);
++                writer.ddEnd();
+             } else {
+                 String classlink = writer.codeText(
+                     writer.getDocLink(LinkInfoImpl.CONTEXT_METHOD_DOC_COPY,
+@@ -217,6 +214,7 @@
+                 writer.ddEnd();
+                 writer.dd();
+                 writer.printInlineComment(method);
++                writer.ddEnd();
+             }
+         }
+     }
+@@ -234,8 +232,7 @@
+      * Write the method footer.
+      */
+     public void writeMethodFooter() {
+-        writer.ddEnd();
+-        writer.dlEnd();
++        printMemberFooter();
+     }
+ 
+     /**
+@@ -318,6 +315,7 @@
+             String name = method.name();
+             writer.dt();
+             writer.strongText(label);
++            writer.dtEnd();
+             writer.dd();
+             String methLink = writer.codeText(
+                 writer.getLink(
+@@ -326,6 +324,7 @@
+                         writer.getAnchor(method), name, false)
+                 ));
+             writer.printText("doclet.in_class", methLink, overriddenTypeLink);
++            writer.ddEnd();
+         }
+     }
+ 
+@@ -364,11 +363,13 @@
+                     LinkInfoImpl.CONTEXT_METHOD_SPECIFIED_BY, intfac)));
+             writer.dt();
+             writer.strongText("doclet.Specified_By");
++            writer.dtEnd();
+             writer.dd();
+             methlink = writer.codeText(writer.getDocLink(
+                 LinkInfoImpl.CONTEXT_MEMBER, implementedMeth,
+                 implementedMeth.name(), false));
+             writer.printText("doclet.in_interface", methlink, intfaclink);
++            writer.ddEnd();
+         }
+ 
+     }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java
+@@ -25,11 +25,11 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
++import java.io.*;
++
++import com.sun.javadoc.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+-import com.sun.javadoc.*;
+-
+-import java.io.*;
+ 
+ /**
+  * Writes nested class documentation in HTML format.
+@@ -129,7 +129,6 @@
+             writer.println("");
+         }
+         writer.anchor(nestedClass.name());
+-        writer.dl();
+         writer.h3();
+         writer.print(nestedClass.name());
+         writer.h3End();
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java
+@@ -25,9 +25,10 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
++import java.io.*;
++
++import com.sun.javadoc.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+-import com.sun.javadoc.*;
+-import java.io.*;
+ 
+ /**
+  * Class to generate Tree page for a package. The name of the file generated is
+@@ -145,8 +146,10 @@
+         dl();
+         dt();
+         strongText("doclet.Package_Hierarchies");
++        dtEnd();
+         dd();
+         navLinkMainTree(configuration.getText("doclet.All_Packages"));
++        ddEnd();
+         dlEnd();
+         hr();
+     }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java
+@@ -25,17 +25,18 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
++import com.sun.javadoc.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder;
+ import com.sun.tools.doclets.internal.toolkit.taglets.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+-import com.sun.javadoc.*;
+ 
+ /**
+  * The taglet writer that writes HTML.
+  *
+  * @since 1.5
+  * @author Jamie Ho
++ * @author Bhavesh Patel (Modified)
+  */
+ 
+ public class TagletWriterImpl extends TagletWriter {
+@@ -99,11 +100,12 @@
+                     output.append(DocletConstants.NL + "<P>" +
+                         DocletConstants.NL);
+                 }
++                output.append("</DD>");
+             } else {
+                 if (Util.isDeprecated(member.containingClass())) {
+                     output.append("<DD><STRONG>" +
+                     ConfigurationImpl.getInstance().
+-                            getText("doclet.Deprecated") + "</STRONG> ");
++                            getText("doclet.Deprecated") + "</STRONG> </DD>");
+                 }
+             }
+         }
+@@ -123,7 +125,7 @@
+     public TagletOutput getParamHeader(String header) {
+         StringBuffer result = new StringBuffer();
+         result.append("<DT>");
+-        result.append("<STRONG>" +  header + "</STRONG>");
++        result.append("<STRONG>" +  header + "</STRONG></DT>");
+         return new TagletOutputImpl(result.toString());
+     }
+ 
+@@ -132,7 +134,7 @@
+      */
+     public TagletOutput paramTagOutput(ParamTag paramTag, String paramName) {
+         TagletOutput result = new TagletOutputImpl("<DD><CODE>" + paramName + "</CODE>"
+-         + " - " + htmlWriter.commentTagsToString(paramTag, null, paramTag.inlineTags(), false));
++         + " - " + htmlWriter.commentTagsToString(paramTag, null, paramTag.inlineTags(), false) + "</DD>");
+         return result;
+     }
+ 
+@@ -142,9 +144,9 @@
+     public TagletOutput returnTagOutput(Tag returnTag) {
+         TagletOutput result = new TagletOutputImpl(DocletConstants.NL + "<DT>" +
+             "<STRONG>" + htmlWriter.configuration.getText("doclet.Returns") +
+-            "</STRONG>" + "<DD>" +
++            "</STRONG>" + "</DT>" + "<DD>" +
+             htmlWriter.commentTagsToString(returnTag, null, returnTag.inlineTags(),
+-            false));
++            false) + "</DD>");
+         return result;
+     }
+ 
+@@ -174,22 +176,21 @@
+         }
+         if (holder.isClass() && ((ClassDoc)holder).isSerializable()) {
+             //Automatically add link to serialized form page for serializable classes.
+-            if (!(SerializedFormBuilder.serialInclude(holder) &&
++            if ((SerializedFormBuilder.serialInclude(holder) &&
+                       SerializedFormBuilder.serialInclude(((ClassDoc)holder).containingPackage()))) {
+-                return result.equals("") ? null : new TagletOutputImpl(result);
++                result = addSeeHeader(result);
++                result += htmlWriter.getHyperLink(htmlWriter.relativePath + "serialized-form.html",
++                        ((ClassDoc)holder).qualifiedName(), htmlWriter.configuration.getText("doclet.Serialized_Form"), false);
+             }
+-            result = addSeeHeader(result);
+-            result += htmlWriter.getHyperLink(htmlWriter.relativePath + "serialized-form.html",
+-                ((ClassDoc)holder).qualifiedName(), htmlWriter.configuration.getText("doclet.Serialized_Form"), false);
+         }
+-        return result.equals("") ? null : new TagletOutputImpl(result);
++        return result.equals("") ? null : new TagletOutputImpl(result + "</DD>");
+     }
+ 
+     private String addSeeHeader(String result) {
+         if (result != null && result.length() > 0) {
+             return result + ", " + DocletConstants.NL;
+         } else {
+-            return "<DT><STRONG>" + htmlWriter.configuration().getText("doclet.See_Also") + "</STRONG><DD>";
++            return "<DT><STRONG>" + htmlWriter.configuration().getText("doclet.See_Also") + "</STRONG></DT><DD>";
+         }
+      }
+ 
+@@ -205,7 +206,8 @@
+             }
+             result += htmlWriter.commentTagsToString(simpleTags[i], null, simpleTags[i].inlineTags(), false);
+         }
+-         return new TagletOutputImpl(result + "</DD>" + DocletConstants.NL);
++        result += "</DD>" + DocletConstants.NL;
++        return new TagletOutputImpl(result);
+     }
+ 
+     /**
+@@ -222,7 +224,7 @@
+      */
+     public TagletOutput getThrowsHeader() {
+         return new TagletOutputImpl(DocletConstants.NL + "<DT>" + "<STRONG>" +
+-            htmlWriter.configuration().getText("doclet.Throws") + "</STRONG>");
++            htmlWriter.configuration().getText("doclet.Throws") + "</STRONG></DT>");
+     }
+ 
+     /**
+@@ -241,6 +243,7 @@
+         if (text != null && text.toString().length() > 0) {
+             result += " - " + text;
+         }
++        result += "</DD>";
+         return new TagletOutputImpl(result);
+     }
+ 
+@@ -250,7 +253,7 @@
+     public TagletOutput throwsTagOutput(Type throwsType) {
+         return new TagletOutputImpl(DocletConstants.NL + "<DD>" +
+             htmlWriter.codeText(htmlWriter.getLink(
+-                new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER, throwsType))));
++                new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER, throwsType))) + "</DD>");
+     }
+ 
+     /**
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java
+@@ -25,9 +25,11 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
++import java.io.*;
++
++import com.sun.javadoc.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+-import com.sun.javadoc.*;
+-import java.io.*;
++
+ /**
+  * Generate Class Hierarchy page for all the Classes in this run.  Use
+  * ClassTree for building the Tree. The name of
+@@ -120,6 +122,7 @@
+             dl();
+             dt();
+             strongText("doclet.Package_Hierarchies");
++            dtEnd();
+             dd();
+             for (int i = 0; i < packages.length; i++) {
+                 if (packages[i].name().length() == 0) {
+@@ -131,6 +134,7 @@
+                     print(", ");
+                 }
+             }
++            ddEnd();
+             dlEnd();
+             hr();
+         }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
+@@ -245,6 +245,31 @@
+     }
+ 
+     /**
++     * Keep track of member details list. Print the definition list start tag
++     * if it is not printed yet.
++     */
++    public void printMemberDetailsListStartTag () {
++        if (!getMemberDetailsListPrinted()) {
++            dl();
++            memberDetailsListPrinted = true;
++        }
++    }
++
++    /**
++     * Print the definition list end tag if the list start tag was printed.
++     */
++    public void printMemberDetailsListEndTag () {
++        if (getMemberDetailsListPrinted()) {
++            dlEnd();
++            memberDetailsListPrinted = false;
++        }
++    }
++
++    public boolean getMemberDetailsListPrinted() {
++        return memberDetailsListPrinted;
++    }
++
++    /**
+      * Print the frameset version of the Html file header.
+      * Called only when generating an HTML frameset file.
+      *
+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
+@@ -25,9 +25,10 @@
+ 
+ package com.sun.tools.doclets.formats.html.markup;
+ 
++import java.io.*;
++
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+-import java.io.*;
+ 
+ /**
+  * Class for the Html format code generation.
+@@ -61,6 +62,11 @@
+     protected Configuration configuration;
+ 
+     /**
++     * The flag to indicate whether a member details list is printed or not.
++     */
++    protected boolean memberDetailsListPrinted;
++
++    /**
+      * Constructor.
+      *
+      * @param path The directory path to be created for this file
+@@ -79,6 +85,7 @@
+         super(Util.genWriter(configuration, path, filename, docencoding));
+         this.configuration = configuration;
+         htmlFilename = filename;
++        this.memberDetailsListPrinted = false;
+     }
+ 
+     /**
+@@ -529,7 +536,14 @@
+     }
+ 
+     /**
+-     * Print <DT> tag.
++     * Print </DT> tag.
++     */
++    public void dtEnd() {
++        print("</DT>");
++    }
++
++    /**
++     * Print <DD> tag.
+      */
+     public void dd() {
+         print("<DD>");
+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
+@@ -25,8 +25,9 @@
+ 
+ package com.sun.tools.doclets.internal.toolkit;
+ 
++import java.io.*;
++
+ import com.sun.javadoc.*;
+-import java.io.*;
+ 
+ /**
+  * The interface for writing serialized form output.
+@@ -147,22 +148,27 @@
+             String fieldDimensions, String fieldName);
+ 
+         /**
++         * Write the member footer.
++         */
++        public void writeMemberFooter();
++
++        /**
++         * Check to see if overview details should be printed. If
++         * nocomment option set or if there is no text to be printed
++         * for deprecation info, inline comment or tags,
++         * do not print overview details.
++         *
++         * @param field the field to check overview details for.
++         * @return true if overview details need to be printed
++         */
++        public boolean shouldPrintOverview(FieldDoc field);
++
++        /**
+          * Write the footer.
+          *
+-         * @param member the member to write the header for.
++         * @param heading the heading that was written.
+          */
+-        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);
++        public void writeFooter (String heading);
+     }
+ 
+     /**
+@@ -193,10 +199,8 @@
+ 
+         /**
+          * Write the footer.
+-         *
+-         * @param member the member to write the header for.
+          */
+-        public void writeMemberFooter(MethodDoc member);
++        public void writeMemberFooter();
+ 
+         /**
+          * Write the deprecated information for this 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
+@@ -25,13 +25,14 @@
+ 
+ package com.sun.tools.doclets.internal.toolkit.builders;
+ 
+-import com.sun.tools.doclets.internal.toolkit.util.*;
+-import com.sun.tools.doclets.internal.toolkit.*;
+-import com.sun.javadoc.*;
+ import java.io.*;
+ import java.lang.reflect.*;
+ import java.util.*;
+ 
++import com.sun.javadoc.*;
++import com.sun.tools.doclets.internal.toolkit.util.*;
++import com.sun.tools.doclets.internal.toolkit.*;
++
+ /**
+  * Builds the serialized form.
+  *
+@@ -40,6 +41,7 @@
+  * Do not use it as an API
+  *
+  * @author Jamie Ho
++ * @author Bhavesh Patel (Modified)
+  * @since 1.5
+  */
+ public class SerializedFormBuilder extends AbstractBuilder {
+@@ -379,7 +381,7 @@
+      * Build the method footer.
+      */
+     public void buildMethodFooter() {
+-        methodWriter.writeMemberFooter((MethodDoc) currentMember);
++        methodWriter.writeMemberFooter();
+     }
+ 
+     /**
+@@ -407,13 +409,17 @@
+             // information to be printed.
+             if (fieldWriter.shouldPrintMemberDetails(serialPersistentField)) {
+                 fieldWriter.writeHeader(
+-                    configuration.getText("doclet.Serialized_Form_class"));
++                        configuration.getText("doclet.Serialized_Form_class"));
+                 fieldWriter.writeMemberDeprecatedInfo(serialPersistentField);
+                 if (!configuration.nocomment) {
+                     fieldWriter.writeMemberDescription(serialPersistentField);
+                     fieldWriter.writeMemberTags(serialPersistentField);
+                 }
+                 fieldWriter.writeMemberFooter(serialPersistentField);
++                // Footer required to close the definition list tag
++                // for serialization overview.
++                fieldWriter.writeFooter(
++                        configuration.getText("doclet.Serialized_Form_class"));
+             }
+         }
+     }
+@@ -476,11 +482,11 @@
+     }
+ 
+     /**
+-     * Build the field footer.
++     * Build the field sub footer.
+      */
+-    public void buildFieldFooter() {
++    public void buildFieldSubFooter() {
+         if (! currentClass.definesSerializableFields()) {
+-            fieldWriter.writeMemberFooter((FieldDoc) currentMember);
++            fieldWriter.writeMemberFooter();
+         }
+     }
+ 
+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
+@@ -26,180 +26,180 @@
+ -->
+ 
+ 
+-<Doclet>
+-
+-    <PackageDoc>
+-        <PackageHeader/>
+-        <Summary>
+-            <SummaryHeader/>
+-            <InterfaceSummary/>
+-            <ClassSummary/>
+-            <EnumSummary/>
+-            <ExceptionSummary/>
+-            <ErrorSummary/>
+-            <AnnotationTypeSummary/>
+-            <SummaryFooter/>
+-        </Summary>
+-        <PackageDescription/>
+-        <PackageTags/>
+-        <PackageFooter/>
+-    </PackageDoc>
+-    
+-    <AnnotationTypeDoc>
+-        <AnnotationTypeHeader/>
+-        <DeprecationInfo/>
+-        <AnnotationTypeSignature/>
+-        <AnnotationTypeDescription/>
+-        <AnnotationTypeTagInfo/>
+-        <MemberSummary>
+-        	<AnnotationTypeRequiredMemberSummary/>
+-            <AnnotationTypeOptionalMemberSummary/>
+-        </MemberSummary>
+-        <AnnotationTypeRequiredMemberDetails>
+-            <Header/>
+-            <AnnotationTypeRequiredMember>
+-                <MemberHeader/>
+-                <Signature/>
+-                <DeprecationInfo/>
+-                <MemberComments/>
+-                <TagInfo/>
+-                <MemberFooter/>
+-            </AnnotationTypeRequiredMember>
+-        </AnnotationTypeRequiredMemberDetails>
+-        <AnnotationTypeOptionalMemberDetails>
+-            <AnnotationTypeOptionalMember>
+-                <MemberHeader/>
+-                <Signature/>
+-                <DeprecationInfo/>
+-                <MemberComments/>
+-                <TagInfo/>
+-                <DefaultValueInfo/>
+-                <MemberFooter/>
+-            </AnnotationTypeOptionalMember>
+-            <Footer/>
+-        </AnnotationTypeOptionalMemberDetails>        
+-        <AnnotationTypeFooter/>
+-    </AnnotationTypeDoc>
+-    
+-    <ClassDoc>
+-        <ClassHeader/>
+-        <ClassTree/>
+-        <TypeParamInfo/>
+-        <SuperInterfacesInfo/>
+-        <ImplementedInterfacesInfo/>        
+-        <SubClassInfo/>
+-        <SubInterfacesInfo/>
+-        <InterfaceUsageInfo/>
+-        <NestedClassInfo/>
+-        <DeprecationInfo/>
+-        <ClassSignature/>
+-        <ClassDescription/>
+-        <ClassTagInfo/>
+-        <MemberSummary>
+-            <NestedClassesSummary/>
+-            <NestedClassesInheritedSummary/>
+-            <EnumConstantsSummary/>
+-            <FieldsSummary/>
+-            <FieldsInheritedSummary/>  
+-            <ConstructorsSummary/>
+-            <MethodsSummary/>
+-            <MethodsInheritedSummary/>
+-        </MemberSummary>
+-        <EnumConstantsDetails>
+-            <Header/>
+-            <EnumConstant>
+-                <EnumConstantHeader/>
+-                <Signature/>
+-                <DeprecationInfo/>
+-                <EnumConstantComments/>
+-                <TagInfo/>
+-                <EnumConstantFooter/>
+-            </EnumConstant>
+-            <Footer/>
+-        </EnumConstantsDetails>
+-        <FieldDetails>
+-            <Header/>
+-            <FieldDoc>
+-                <FieldHeader/>
+-                <Signature/>
+-                <DeprecationInfo/>
+-                <FieldComments/>
+-                <TagInfo/>
+-                <FieldFooter/>
+-            </FieldDoc>
+-            <Footer/>
+-        </FieldDetails>
+-        <ConstructorDetails>
+-            <Header/>
+-            <ConstructorDoc>
+-                <ConstructorHeader/>
+-                <Signature/>
+-                <DeprecationInfo/>
+-                <ConstructorComments/>
+-                <TagInfo/>
+-                <ConstructorFooter/>
+-            </ConstructorDoc>
+-            <Footer/>
+-        </ConstructorDetails>
+-        <MethodDetails>
+-            <Header/>
+-            <MethodDoc>
+-                <MethodHeader/>
+-                <Signature/>
+-                <DeprecationInfo/>
+-                <MethodComments/>
+-                <TagInfo/>
+-                <MethodFooter/>
+-            </MethodDoc>
+-            <Footer/>
+-        </MethodDetails>
+-        <ClassFooter/>
+-    </ClassDoc>
+-    
+-    <ConstantSummary>
+-        <Header/>
+-        <Contents/>
+-        <ConstantSummaries>
+-            <PackageConstantSummary>
+-                <PackageHeader/>
+-                <ClassConstantSummary>
+-                    <ClassHeader/>
+-                    <ConstantMembers/>
+-                    <ClassFooter/>
+-                </ClassConstantSummary>     
+-            </PackageConstantSummary>
+-        </ConstantSummaries>    
+-        <Footer/>
+-    </ConstantSummary>
+-    
+-    <SerializedForm>
+-        <Header/>
+-        <SerializedFormSummaries>
+-            <PackageSerializedForm>
+-                <PackageHeader/>
+-                <ClassSerializedForm>
+-                    <ClassHeader/>
+-                    <SerialUIDInfo/>
+-                    <MethodHeader/>
+-                    <SerializableMethods>
+-                        <MethodSubHeader/>
+-                        <DeprecatedMethodInfo/>
+-                        <MethodInfo>
+-                            <MethodDescription/>
+-                            <MethodTags/>
+-                        </MethodInfo>
+-                        <MethodFooter/>
+-                    </SerializableMethods>
+-                    <FieldHeader/>
+-                    <SerializableFields>
+-                        <FieldSubHeader/>
+-                        <FieldDeprecationInfo/>
+-                        <FieldInfo/>
+-                        <FieldFooter/>
+-                    </SerializableFields>                  
+-                </ClassSerializedForm>
+-            </PackageSerializedForm>
+-        </SerializedFormSummaries>
+-        <Footer/>
+-    </SerializedForm>
+-</Doclet>
++<Doclet>
++
++    <PackageDoc>
++        <PackageHeader/>
++        <Summary>
++            <SummaryHeader/>
++            <InterfaceSummary/>
++            <ClassSummary/>
++            <EnumSummary/>
++            <ExceptionSummary/>
++            <ErrorSummary/>
++            <AnnotationTypeSummary/>
++            <SummaryFooter/>
++        </Summary>
++        <PackageDescription/>
++        <PackageTags/>
++        <PackageFooter/>
++    </PackageDoc>
++    
++    <AnnotationTypeDoc>
++        <AnnotationTypeHeader/>
++        <DeprecationInfo/>
++        <AnnotationTypeSignature/>
++        <AnnotationTypeDescription/>
++        <AnnotationTypeTagInfo/>
++        <MemberSummary>
++        	<AnnotationTypeRequiredMemberSummary/>
++            <AnnotationTypeOptionalMemberSummary/>
++        </MemberSummary>
++        <AnnotationTypeRequiredMemberDetails>
++            <Header/>
++           <AnnotationTypeRequiredMember>
++                <MemberHeader/>
++                <Signature/>
++                <DeprecationInfo/>
++                <MemberComments/>
++                <TagInfo/>
++                <MemberFooter/>
++            </AnnotationTypeRequiredMember>
++        </AnnotationTypeRequiredMemberDetails>
++        <AnnotationTypeOptionalMemberDetails>
++            <AnnotationTypeOptionalMember>
++                <MemberHeader/>
++                <Signature/>
++                <DeprecationInfo/>
++                <MemberComments/>
++                <TagInfo/>
++                <DefaultValueInfo/>
++                <MemberFooter/>
++            </AnnotationTypeOptionalMember>
++            <Footer/>
++        </AnnotationTypeOptionalMemberDetails>        
++        <AnnotationTypeFooter/>
++    </AnnotationTypeDoc>
++    
++    <ClassDoc>
++        <ClassHeader/>
++        <ClassTree/>
++        <TypeParamInfo/>
++        <SuperInterfacesInfo/>
++        <ImplementedInterfacesInfo/>        
++        <SubClassInfo/>
++        <SubInterfacesInfo/>
++        <InterfaceUsageInfo/>
++        <NestedClassInfo/>
++        <DeprecationInfo/>
++        <ClassSignature/>
++        <ClassDescription/>
++        <ClassTagInfo/>
++        <MemberSummary>
++            <NestedClassesSummary/>
++            <NestedClassesInheritedSummary/>
++            <EnumConstantsSummary/>
++            <FieldsSummary/>
++            <FieldsInheritedSummary/>  
++            <ConstructorsSummary/>
++            <MethodsSummary/>
++            <MethodsInheritedSummary/>
++        </MemberSummary>
++        <EnumConstantsDetails>
++           <Header/>
++            <EnumConstant>
++                <EnumConstantHeader/>
++                <Signature/>
++                <DeprecationInfo/>
++                <EnumConstantComments/>
++                <TagInfo/>
++                <EnumConstantFooter/>
++            </EnumConstant>
++            <Footer/>
++        </EnumConstantsDetails>
++        <FieldDetails>
++            <Header/>
++            <FieldDoc>
++                <FieldHeader/>
++                <Signature/>
++                <DeprecationInfo/>
++                <FieldComments/>
++                <TagInfo/>
++                <FieldFooter/>
++            </FieldDoc>
++            <Footer/>
++        </FieldDetails>
++        <ConstructorDetails>
++            <Header/>
++            <ConstructorDoc>
++                <ConstructorHeader/>
++                <Signature/>
++                <DeprecationInfo/>
++                <ConstructorComments/>
++                <TagInfo/>
++                <ConstructorFooter/>
++            </ConstructorDoc>
++            <Footer/>
++        </ConstructorDetails>
++        <MethodDetails>
++            <Header/>
++            <MethodDoc>
++                <MethodHeader/>
++                <Signature/>
++                <DeprecationInfo/>
++                <MethodComments/>
++                <TagInfo/>
++                <MethodFooter/>
++            </MethodDoc>
++            <Footer/>
++        </MethodDetails>
++        <ClassFooter/>
++    </ClassDoc>
++    
++    <ConstantSummary>
++        <Header/>
++        <Contents/>
++        <ConstantSummaries>
++            <PackageConstantSummary>
++                <PackageHeader/>
++                <ClassConstantSummary>
++                    <ClassHeader/>
++                    <ConstantMembers/>
++                    <ClassFooter/>
++                </ClassConstantSummary>     
++            </PackageConstantSummary>
++        </ConstantSummaries>    
++        <Footer/>
++    </ConstantSummary>
++    
++    <SerializedForm>
++        <Header/>
++        <SerializedFormSummaries>
++            <PackageSerializedForm>
++                <PackageHeader/>
++                <ClassSerializedForm>
++                    <ClassHeader/>
++                    <SerialUIDInfo/>
++                    <MethodHeader/>
++                    <SerializableMethods>
++                        <MethodSubHeader/>
++                        <DeprecatedMethodInfo/>
++                        <MethodInfo>
++                            <MethodDescription/>
++                            <MethodTags/>
++                        </MethodInfo>
++                        <MethodFooter/>
++                    </SerializableMethods>
++                    <FieldHeader/>
++                    <SerializableFields>
++                        <FieldSubHeader/>
++                        <FieldDeprecationInfo/>
++                        <FieldInfo/>
++                        <FieldSubFooter/>
++                    </SerializableFields>
++                </ClassSerializedForm>
++            </PackageSerializedForm>
++        </SerializedFormSummaries>
++        <Footer/>
++    </SerializedForm>
++</Doclet>
+diff --git a/test/com/sun/javadoc/AuthorDD/AuthorDD.java b/test/com/sun/javadoc/AuthorDD/AuthorDD.java
+--- langtools/test/com/sun/javadoc/AuthorDD/AuthorDD.java
++++ langtools/test/com/sun/javadoc/AuthorDD/AuthorDD.java
+@@ -91,7 +91,7 @@
+ 
+             // Test multiple @author tags:
+ 
+-            { "<DT><STRONG>Author:</STRONG></DT>"+NL+"  <DD>Doug Kramer, Jamie, Neal</DD>"+NL,
++            { "<DT><STRONG>Author:</STRONG></DT>"+NL+"  <DD>Doug Kramer, Jamie, Neal</DD>",
+                                   BUGID + FS + "p1" + FS + "C1.html" },
+ 
+         };
+diff --git a/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java b/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java
+--- langtools/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java
++++ langtools/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java
+@@ -48,7 +48,7 @@
+             "<A HREF=\"http://java.sun.com/j2se/1.4/docs/api/java/math/BigInteger.html?is-external=true#gcd(java.math.BigInteger)\" " +
+                 "title=\"class or interface in java.math\"><CODE>Link to external member gcd</CODE></A>"},
+         {BUG_ID + FS + "C.html",
+-            "<STRONG>Overrides:</STRONG><DD><CODE>toString</CODE> in class <CODE>java.lang.Object</CODE>"}
++            "<STRONG>Overrides:</STRONG></DT><DD><CODE>toString</CODE> in class <CODE>java.lang.Object</CODE>"}
+     };
+     private static final String[][] NEGATED_TEST = NO_TEST;
+     private static final String[] ARGS =
+diff --git a/test/com/sun/javadoc/testConstructorIndent/TestConstructorIndent.java b/test/com/sun/javadoc/testConstructorIndent/TestConstructorIndent.java
+--- langtools/test/com/sun/javadoc/testConstructorIndent/TestConstructorIndent.java
++++ langtools/test/com/sun/javadoc/testConstructorIndent/TestConstructorIndent.java
+@@ -45,9 +45,10 @@
+ 
+     //Input for string search tests.
+     private static final String[][] TEST = {
+-        {BUG_ID + FS + "C.html", "<DL>"+NL+"<DD>This is just a simple constructor."+ NL +
+-            "<P>"+NL+"<DL>"+NL+"<DT><STRONG>Parameters:</STRONG><DD><CODE>i</CODE> - a param.</DL>"+NL +
+-            "</DL>"
++        {BUG_ID + FS + "C.html", "<DL>" + NL + "<DD>This is just a simple constructor." + NL +
++            "<P>" + NL + "</DD>" + NL + "<DD><DL>" + NL + "<DT><STRONG>Parameters:</STRONG>" +
++            "</DT><DD><CODE>i</CODE> - a param.</DD></DL>" + NL +
++            "</DD>" + NL + "</DL>"
+         }
+     };
+     private static final String[][] NEGATED_TEST = NO_TEST;
+diff --git a/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java b/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java
+--- langtools/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java
++++ langtools/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java
+@@ -78,13 +78,12 @@
+ 
+         {TARGET_FILE2, "<STRONG>Deprecated.</STRONG>" + NL +
+                 "<P>" + NL +
+-            "<DL>" + NL +
+-            "<DT><PRE><FONT SIZE=\"-1\">@Deprecated" + NL +
++            "<PRE><FONT SIZE=\"-1\">@Deprecated" + NL +
+             "</FONT>public class <STRONG>DeprecatedClassByAnnotation</STRONG>"},
+ 
+         {TARGET_FILE2, "public int <STRONG>field</STRONG></PRE>" + NL +
+             "<DL>" + NL +
+-            "<DD><STRONG>Deprecated.</STRONG> <DL>"},
++            "<DD><STRONG>Deprecated.</STRONG> </DD></DL>"},
+ 
+         {TARGET_FILE2, "<FONT SIZE=\"-1\">@Deprecated" + NL +
+             "</FONT>public <STRONG>DeprecatedClassByAnnotation</STRONG>()</PRE>" + NL +
+diff --git a/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java b/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java
+--- langtools/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java
++++ langtools/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java
+@@ -39,13 +39,13 @@
+     private static final String BUG_ID = "4857717";
+     private static final String[][] TEST = {
+         {BUG_ID + FS + "pkg" + FS + "XReader.html",
+-            "<STRONG>Overrides:</STRONG><DD><CODE><A HREF=\"" +
++            "<STRONG>Overrides:</STRONG></DT><DD><CODE><A HREF=\"" +
+             "http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterReader.html?is-external=true#read()\"" +
+                 " title=\"class or interface in java.io\">read</A></CODE> in class " +
+                 "<CODE><A HREF=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterReader.html?is-external=true\"" +
+                 " title=\"class or interface in java.io\">FilterReader</A>"},
+         {BUG_ID + FS + "pkg" + FS + "XReader.html",
+-            "<STRONG>Specified by:</STRONG><DD><CODE><A HREF=\"" +
++            "<STRONG>Specified by:</STRONG></DT><DD><CODE><A HREF=\"" +
+             "http://java.sun.com/j2se/1.4.1/docs/api/java/io/DataInput.html?is-external=true#readInt()\"" +
+             " title=\"class or interface in java.io\">readInt</A></CODE> in interface " +
+             "<CODE><A HREF=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/DataInput.html?is-external=true\"" +
+diff --git a/test/com/sun/javadoc/testHref/TestHref.java b/test/com/sun/javadoc/testHref/TestHref.java
+--- langtools/test/com/sun/javadoc/testHref/TestHref.java
++++ langtools/test/com/sun/javadoc/testHref/TestHref.java
+@@ -67,7 +67,7 @@
+         },
+         //@see test.
+         {BUG_ID + FS + "pkg" + FS + "C2.html",
+-            "See Also:</STRONG><DD><A HREF=\"../pkg/C1.html#method(int, int, java.util.ArrayList)\">"
++            "See Also:</STRONG></DT><DD><A HREF=\"../pkg/C1.html#method(int, int, java.util.ArrayList)\">"
+         },
+ 
+         //Header does not link to the page itself.
+diff --git a/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java b/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java
+new file mode 100644
+--- /dev/null
++++ langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java
+@@ -0,0 +1,370 @@
++/*
++ * 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 6786690
++ * @summary This test verifies the nesting of definition list tags.
++ * @author Bhavesh Patel
++ * @library ../lib/
++ * @build JavadocTester
++ * @build TestHtmlDefinitionListTag
++ * @run main TestHtmlDefinitionListTag
++ */
++
++public class TestHtmlDefinitionListTag extends JavadocTester {
++
++    private static final String BUG_ID = "6786690";
++
++    // Test common to all runs of javadoc. The class signature should print
++    // properly enclosed definition list tags and the Annotation Type
++    // Optional Element should print properly nested definition list tags
++    // for default value.
++    private static final String[][] TEST_ALL = {
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<PRE>public class " +
++                 "<STRONG>C1</STRONG>" + NL + "extends " +
++                 "java.lang.Object" + NL + "implements " +
++                 "java.io.Serializable</PRE>"},
++        {BUG_ID + FS + "pkg1" + FS + "C4.html", "<DL>" + NL + "<DD><DL>" + NL +
++                 "<DT><STRONG>Default:</STRONG></DT><DD>true</DD>" + NL +
++                 "</DL>" + NL + "</DD>" + NL + "</DL>"}};
++
++    // Test for normal run of javadoc in which various ClassDocs and
++    // serialized form should have properly nested definition list tags
++    // enclosing comments, tags and deprecated information.
++    private static final String[][] TEST_CMNT_DEPR = {
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<DL>" + NL +
++                 "<DT><STRONG>Since:</STRONG></DT>" + NL +
++                 "  <DD>JDK1.0</DD>" + NL + "<DT><STRONG>See Also:</STRONG></DT><DD>" +
++                 "<A HREF=\"../pkg1/C2.html\" title=\"class in pkg1\">" +
++                 "<CODE>C2</CODE></A>, " + NL +
++                 "<A HREF=\"../serialized-form.html#pkg1.C1\">" +
++                 "Serialized Form</A></DD></DL>"},
++        {BUG_ID + FS + "pkg1" + FS + "C1.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>" +
++                 "<DD>This field indicates whether the C1 is undecorated." + NL +
++                 "<P>" + NL + "</DD>" + NL + "<DD><DL>" + NL + "<DT><STRONG>" +
++                 "Since:</STRONG></DT>" + NL + "  <DD>1.4</DD>" + NL + "<DT>" +
++                 "<STRONG>See Also:</STRONG></DT><DD>" +
++                 "<A HREF=\"../pkg1/C1.html#setUndecorated(boolean)\"><CODE>" +
++                 "setUndecorated(boolean)</CODE></A></DD></DL>" + NL +"</DD>" + NL +
++                 "</DL>"},
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<DL>" + NL +
++                 "<DD>Constructor." + NL + "<P>" + NL + "</DD>" + NL +
++                 "<DD><DL>" + NL + "<DT><STRONG>Parameters:</STRONG></DT><DD>" +
++                 "<CODE>title</CODE> - the title</DD><DD><CODE>test</CODE>" +
++                 " - boolean value</DD>" + NL + "<DT><STRONG>Throws:</STRONG></DT>" + NL +
++                 "<DD><CODE>java.lang.IllegalArgumentException</CODE>" +
++                 " - if the <code>owner</code>'s" + NL + "     <code>GraphicsConfiguration" +
++                 "</code> is not from a screen device</DD>" + NL +"<DD><CODE>" +
++                 "HeadlessException</CODE></DD></DL>" + NL + "</DD>" + NL +
++                 "</DL>"},
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<DL>" + NL +
++                 "<DD>Method comments." + NL + "<P>" + NL +
++                 "</DD>" + NL + "<DD><DL>" + NL + "<DT><STRONG>Parameters:" +
++                 "</STRONG></DT><DD><CODE>undecorated</CODE> - <code>true</code>" +
++                 " if no decorations are" + NL + "         to be enabled;" + NL +
++                 "         <code>false</code> if decorations are to be enabled." +
++                 "</DD><DT><STRONG>Since:</STRONG></DT>" + NL +
++                 "  <DD>1.4</DD>" + NL + "<DT><STRONG>See Also:</STRONG></DT>" +
++                 "<DD><A HREF=\"../pkg1/C1.html#readObject()\"><CODE>" +
++                 "readObject()</CODE></A></DD></DL>" + NL + "</DD>" + NL +
++                 "</DL>"},
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<DL>" + NL + "<DD><DL>" + NL +
++                 "<DT><STRONG>Throws:</STRONG></DT>" + NL + "<DD><CODE>" +
++                 "java.io.IOException</CODE></DD><DT><STRONG>See Also:" +
++                 "</STRONG></DT><DD>" +
++                 "<A HREF=\"../pkg1/C1.html#setUndecorated(boolean)\">" +
++                 "<CODE>setUndecorated(boolean)</CODE></A></DD></DL>" + NL +
++                 "</DD>" + NL + "</DL>"},
++        {BUG_ID + FS + "pkg1" + FS + "C1.ModalExclusionType.html", "<DL>" + NL +
++                 "<DD>No modal exclusion." + NL + "<P>" + NL +"</DD>" + NL +
++                 "</DL>"},
++        {BUG_ID + FS + "pkg1" + FS + "C2.html", "<DL>" + NL + "<DD>Constructor." + NL +
++                 "<P>" + NL +"</DD>" + NL + "</DL>"},
++        {BUG_ID + FS + "pkg1" + FS + "C2.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><DD>Set visible." + NL + "<P>" + NL + "</DD>" +NL +
++                 "<DD><DL>" + NL + "<DT><STRONG>Parameters:</STRONG></DT><DD>" +
++                 "<CODE>set</CODE> - boolean</DD><DT><STRONG>Since:</STRONG></DT>" + NL +
++                 "  <DD>1.4</DD></DL>" + NL + "</DD>" + NL + "</DL>"},
++        {BUG_ID + FS + "pkg1" + FS + "C3.html", "<DL>" + NL + "<DD>Comment." + NL +
++                 "<P>" + NL + "</DD>" + NL + "</DL>"},
++        {BUG_ID + FS + "serialized-form.html", "<DL>" + NL + "<DD><DL>" + NL +
++                 "<DT><STRONG>Throws:</STRONG></DT>" + NL + "<DD><CODE>" +
++                 "java.io.IOException</CODE></DD><DT><STRONG>See Also:</STRONG>" +
++                 "</DT><DD><A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
++                 "<CODE>C1.setUndecorated(boolean)</CODE></A></DD></DL>" + NL +
++                 "</DD>" + 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>" +
++                 "<DD>This field indicates whether the C1 is undecorated." + NL +
++                 "<P>" + NL + "</DD>" + NL + "<DD> </DD>" + NL +
++                 "<DD><DL>" + NL + "<DT><STRONG>Since:</STRONG></DT>" + NL +
++                 "  <DD>1.4</DD>" + NL + "<DT><STRONG>See Also:</STRONG>" +
++                 "</DT><DD><A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
++                 "<CODE>C1.setUndecorated(boolean)</CODE></A></DD></DL>" + NL +
++                 "</DD>" + 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><DD>Reads the object stream." + NL + "<P>" + NL +
++                 "</DD>" + NL + "<DD><DL>" + NL + "<DT><STRONG>Throws:" +
++                 "</STRONG></DT>" + NL + "<DD><CODE><code>" +
++                 "IOException</code></CODE></DD>" + NL +
++                 "<DD><CODE>java.io.IOException</CODE></DD></DL>" + NL +
++                 "</DD>" + NL + "</DL>"},
++        {BUG_ID + FS + "serialized-form.html", "<DL>" + NL +
++                 "<DD><STRONG>Deprecated.</STRONG> </DD><DD>" +
++                 "The name for this class." + NL + "<P>" + NL + "</DD>" + NL +
++                 "<DD> </DD>" + NL + "</DL>"}};
++
++    // Test with -nocomment option. The ClassDocs and serialized form should
++    // have properly nested definition list tags enclosing deprecated
++    // information and should not display definition lists for comments
++    // and tags.
++    private static final String[][] TEST_NOCMNT = {
++        {BUG_ID + FS + "pkg1" + FS + "C1.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></DL>"},
++        {BUG_ID + FS + "pkg1" + FS + "C2.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></DL>"},
++        {BUG_ID + FS + "pkg1" + FS + "C5.html", "<PRE>" + NL +
++                 "protected <STRONG>C5</STRONG>()</PRE>" + NL + "<DL>" + NL +
++                 "<DD><STRONG>Deprecated.</STRONG> </DD></DL>"},
++        {BUG_ID + FS + "pkg1" + FS + "C5.html", "<PRE>" + NL +
++                 "public void <STRONG>printInfo</STRONG>()</PRE>" + NL + "<DL>" + NL +
++                 "<DD><STRONG>Deprecated.</STRONG> </DD></DL>"},
++        {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></DD></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></DL>"},
++        {BUG_ID + FS + "serialized-form.html", "<PRE>" + NL + "int <STRONG>" +
++                 "publicKey</STRONG></PRE>" + NL + "<DL>" + NL + "<DD><STRONG>" +
++                 "Deprecated.</STRONG> </DD></DL>"}};
++
++    // Test with -nodeprecated option. The ClassDocs should have properly nested
++    // definition list tags enclosing comments and tags. The ClassDocs should not
++    // display definition list for deprecated information. The serialized form
++    // should display properly nested definition list tags for comments, tags
++    // and deprecated information.
++    private static final String[][] TEST_NODEPR = {
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<DL>" + NL +
++                 "<DT><STRONG>Since:</STRONG></DT>" + NL +
++                 "  <DD>JDK1.0</DD>" + NL + "<DT><STRONG>See Also:</STRONG></DT><DD>" +
++                 "<A HREF=\"../pkg1/C2.html\" title=\"class in pkg1\">" +
++                 "<CODE>C2</CODE></A>, " + NL +
++                 "<A HREF=\"../serialized-form.html#pkg1.C1\">" +
++                 "Serialized Form</A></DD></DL>"},
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<DL>" + NL +
++                 "<DD>Constructor." + NL + "<P>" + NL + "</DD>" + NL +
++                 "<DD><DL>" + NL + "<DT><STRONG>Parameters:</STRONG></DT><DD>" +
++                 "<CODE>title</CODE> - the title</DD><DD><CODE>test</CODE>" +
++                 " - boolean value</DD>" + NL + "<DT><STRONG>Throws:</STRONG></DT>" + NL +
++                 "<DD><CODE>java.lang.IllegalArgumentException</CODE>" +
++                 " - if the <code>owner</code>'s" + NL + "     <code>GraphicsConfiguration" +
++                 "</code> is not from a screen device</DD>" + NL +"<DD><CODE>" +
++                 "HeadlessException</CODE></DD></DL>" + NL + "</DD>" + NL +
++                 "</DL>"},
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<DL>" + NL +
++                 "<DD>Method comments." + NL + "<P>" + NL +
++                 "</DD>" + NL + "<DD><DL>" + NL + "<DT><STRONG>Parameters:" +
++                 "</STRONG></DT><DD><CODE>undecorated</CODE> - <code>true</code>" +
++                 " if no decorations are" + NL + "         to be enabled;" + NL +
++                 "         <code>false</code> if decorations are to be enabled." +
++                 "</DD><DT><STRONG>Since:</STRONG></DT>" + NL +
++                 "  <DD>1.4</DD>" + NL + "<DT><STRONG>See Also:</STRONG></DT>" +
++                 "<DD><A HREF=\"../pkg1/C1.html#readObject()\"><CODE>" +
++                 "readObject()</CODE></A></DD></DL>" + NL + "</DD>" + NL +
++                 "</DL>"},
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<DL>" + NL + "<DD><DL>" + NL +
++                 "<DT><STRONG>Throws:</STRONG></DT>" + NL + "<DD><CODE>" +
++                 "java.io.IOException</CODE></DD><DT><STRONG>See Also:" +
++                 "</STRONG></DT><DD>" +
++                 "<A HREF=\"../pkg1/C1.html#setUndecorated(boolean)\">" +
++                 "<CODE>setUndecorated(boolean)</CODE></A></DD></DL>" + NL +
++                 "</DD>" + NL + "</DL>"},
++        {BUG_ID + FS + "pkg1" + FS + "C1.ModalExclusionType.html", "<DL>" + NL +
++                 "<DD>No modal exclusion." + NL + "<P>" + NL +"</DD>" + NL +
++                 "</DL>"},
++        {BUG_ID + FS + "pkg1" + FS + "C2.html", "<DL>" + NL + "<DD>Constructor." + NL +
++                 "<P>" + NL +"</DD>" + NL + "</DL>"},
++        {BUG_ID + FS + "pkg1" + FS + "C3.html", "<DL>" + NL + "<DD>Comment." + NL +
++                 "<P>" + NL + "</DD>" + NL + "</DL>"},
++        {BUG_ID + FS + "serialized-form.html", "<DL>" + NL + "<DD><DL>" + NL +
++                 "<DT><STRONG>Throws:</STRONG></DT>" + NL + "<DD><CODE>" +
++                 "java.io.IOException</CODE></DD><DT><STRONG>See Also:</STRONG>" +
++                 "</DT><DD><A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
++                 "<CODE>C1.setUndecorated(boolean)</CODE></A></DD></DL>" + NL +
++                 "</DD>" + 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>" +
++                 "<DD>This field indicates whether the C1 is undecorated." + NL +
++                 "<P>" + NL + "</DD>" + NL + "<DD> </DD>" + NL +
++                 "<DD><DL>" + NL + "<DT><STRONG>Since:</STRONG></DT>" + NL +
++                 "  <DD>1.4</DD>" + NL + "<DT><STRONG>See Also:</STRONG>" +
++                 "</DT><DD><A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
++                 "<CODE>C1.setUndecorated(boolean)</CODE></A></DD></DL>" + NL +
++                 "</DD>" + 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><DD>Reads the object stream." + NL + "<P>" + NL +
++                 "</DD>" + NL + "<DD><DL>" + NL + "<DT><STRONG>Throws:" +
++                 "</STRONG></DT>" + NL + "<DD><CODE><code>" +
++                 "IOException</code></CODE></DD>" + NL +
++                 "<DD><CODE>java.io.IOException</CODE></DD></DL>" + NL +
++                 "</DD>" + NL + "</DL>"},
++        {BUG_ID + FS + "serialized-form.html", "<DL>" + NL +
++                 "<DD><STRONG>Deprecated.</STRONG> </DD><DD>" +
++                 "The name for this class." + NL + "<P>" + NL + "</DD>" + NL +
++                 "<DD> </DD>" + NL + "</DL>"}};
++
++    // Test with -nocomment and -nodeprecated options. The ClassDocs whould
++    // not display definition lists for any member details. The serialized
++    // form should display properly nested definition list tags for
++    // deprecated information only.
++    private static final String[][] TEST_NOCMNT_NODEPR = {
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<PRE>" + NL + "public void " +
++                 "<STRONG>readObject</STRONG>()" + NL + "                throws" +
++                 " java.io.IOException</PRE>" + NL + "<HR>"},
++        {BUG_ID + FS + "pkg1" + FS + "C2.html", "<PRE>" +NL + "public <STRONG>" +
++                 "C2</STRONG>()</PRE>" + NL + "<HR>"},
++        {BUG_ID + FS + "pkg1" + FS + "C1.ModalExclusionType.html", "<PRE>" + NL +
++                 "public static final " +
++                 "<A HREF=\"../pkg1/C1.ModalExclusionType.html\" " +
++                 "title=\"enum in pkg1\">C1.ModalExclusionType</A> <STRONG>" +
++                 "APPLICATION_EXCLUDE</STRONG></PRE>" + NL + "<HR>"},
++        {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></DD></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></DL>"},
++        {BUG_ID + FS + "serialized-form.html", "<PRE>" + NL + "int <STRONG>" +
++                 "publicKey</STRONG></PRE>" + NL + "<DL>" + NL + "<DD><STRONG>" +
++                 "Deprecated.</STRONG> </DD></DL>"}};
++
++    // Test for valid HTML generation which should not comprise of empty
++    // definition list tags.
++    private static final String[][] NEGATED_TEST = {
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<DL></DL>"},
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<DL>" + NL + "</DL>"},
++        {BUG_ID + FS + "pkg1" + FS + "C1.ModalExclusionType.html", "<DL></DL>"},
++        {BUG_ID + FS + "pkg1" + FS + "C1.ModalExclusionType.html", "<DL>" + NL + "</DL>"},
++        {BUG_ID + FS + "pkg1" + FS + "C2.html", "<DL></DL>"},
++        {BUG_ID + FS + "pkg1" + FS + "C2.html", "<DL>" + NL + "</DL>"},
++        {BUG_ID + FS + "pkg1" + FS + "C2.ModalType.html", "<DL></DL>"},
++        {BUG_ID + FS + "pkg1" + FS + "C2.ModalType.html", "<DL>" + NL + "</DL>"},
++        {BUG_ID + FS + "pkg1" + FS + "C3.html", "<DL></DL>"},
++        {BUG_ID + FS + "pkg1" + FS + "C3.html", "<DL>" + NL + "</DL>"},
++        {BUG_ID + FS + "pkg1" + FS + "C4.html", "<DL></DL>"},
++        {BUG_ID + FS + "pkg1" + FS + "C4.html", "<DL>" + NL + "</DL>"},
++        {BUG_ID + FS + "pkg1" + FS + "C5.html", "<DL></DL>"},
++        {BUG_ID + FS + "pkg1" + FS + "C5.html", "<DL>" + NL + "</DL>"},
++        {BUG_ID + FS + "overview-tree.html", "<DL></DL>"},
++        {BUG_ID + FS + "overview-tree.html", "<DL>" + NL + "</DL>"},
++        {BUG_ID + FS + "serialized-form.html", "<DL></DL>"},
++        {BUG_ID + FS + "serialized-form.html", "<DL>" + NL + "</DL>"}};
++
++    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) {
++        TestHtmlDefinitionListTag tester = new TestHtmlDefinitionListTag();
++        run(tester, ARGS1, TEST_ALL, NEGATED_TEST);
++        run(tester, ARGS1, TEST_CMNT_DEPR, NEGATED_TEST);
++        run(tester, ARGS2, TEST_ALL, NEGATED_TEST);
++        run(tester, ARGS2, TEST_NOCMNT, TEST_CMNT_DEPR);
++        run(tester, ARGS3, TEST_ALL, NEGATED_TEST);
++        run(tester, ARGS3, TEST_NODEPR, TEST_NOCMNT_NODEPR);
++        run(tester, ARGS4, TEST_ALL, NEGATED_TEST);
++        run(tester, ARGS4, TEST_NOCMNT_NODEPR, TEST_CMNT_DEPR);
++        tester.printSummary();
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public String getBugId() {
++        return BUG_ID;
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public String getBugName() {
++        return getClass().getName();
++    }
++}
+diff --git a/test/com/sun/javadoc/testHtmlDefinitionListTag/pkg1/C1.java b/test/com/sun/javadoc/testHtmlDefinitionListTag/pkg1/C1.java
+new file mode 100644
+--- /dev/null
++++ langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/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/testHtmlDefinitionListTag/pkg1/C2.java b/test/com/sun/javadoc/testHtmlDefinitionListTag/pkg1/C2.java
+new file mode 100644
+--- /dev/null
++++ langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/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/testHtmlDefinitionListTag/pkg1/C3.java b/test/com/sun/javadoc/testHtmlDefinitionListTag/pkg1/C3.java
+new file mode 100644
+--- /dev/null
++++ langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/pkg1/C3.java
+@@ -0,0 +1,42 @@
++/*
++ * 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.lang.annotation.*;
++
++/**
++ * Test Annotation class.
++ *
++ * @author Bhavesh Patel
++ * @since 1.5
++ */
++ at Retention(RetentionPolicy.SOURCE)
++public @interface C3 {
++    /**
++     * Comment.
++     */
++    String[] value();
++}
+diff --git a/test/com/sun/javadoc/testHtmlDefinitionListTag/pkg1/C4.java b/test/com/sun/javadoc/testHtmlDefinitionListTag/pkg1/C4.java
+new file mode 100644
+--- /dev/null
++++ langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/pkg1/C4.java
+@@ -0,0 +1,39 @@
++/*
++ * 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.lang.annotation.*;
++
++/*
++ * The @Inherited annotation has no effect when applied to an interface.
++ */
++ at Documented
++ at Retention(RetentionPolicy.RUNTIME)
++ at Target(ElementType.TYPE)
++ at Inherited
++public @interface C4 {
++    boolean value() default true;
++}
+diff --git a/test/com/sun/javadoc/testHtmlDefinitionListTag/pkg1/C5.java b/test/com/sun/javadoc/testHtmlDefinitionListTag/pkg1/C5.java
+new file mode 100644
+--- /dev/null
++++ langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/pkg1/C5.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.
++ */
++ at Deprecated
++public abstract class C5 implements Serializable {
++
++    /**
++     * The name for this class.
++     *
++     * @serial
++     */
++    private String name;
++
++    /**
++     * @serial
++     */
++    private int publicKey;
++
++    /**
++     * Constructor for serialization only.
++     */
++    protected C5() {
++
++    }
++
++    /**
++     * Prints general information.
++     *
++     */
++    public void printInfo() {
++
++    }
++}
+diff --git a/test/com/sun/javadoc/testIndex/TestIndex.java b/test/com/sun/javadoc/testIndex/TestIndex.java
+--- langtools/test/com/sun/javadoc/testIndex/TestIndex.java
++++ langtools/test/com/sun/javadoc/testIndex/TestIndex.java
+@@ -73,10 +73,10 @@
+         {BUG_ID + FS + "index-all.html",
+             "<DT><A HREF=\"./pkg/C.html#Java\"><STRONG>Java</STRONG></A> - " + NL +
+             "Static variable in class pkg.<A HREF=\"./pkg/C.html\" title=\"class in pkg\">C</A>" + NL +
+-            "<DD> " + NL +
++            "</DT><DD> </DD>" + NL + NL +
+             "<DT><A HREF=\"./pkg/C.html#JDK\"><STRONG>JDK</STRONG></A> - " + NL +
+             "Static variable in class pkg.<A HREF=\"./pkg/C.html\" title=\"class in pkg\">C</A>" + NL +
+-            "<DD> "},
++            "</DT><DD> </DD>"},
+     };
+     private static final String[][] NEGATED_TEST = NO_TEST;
+ 
+diff --git a/test/com/sun/javadoc/testInterface/TestInterface.java b/test/com/sun/javadoc/testInterface/TestInterface.java
+--- langtools/test/com/sun/javadoc/testInterface/TestInterface.java
++++ langtools/test/com/sun/javadoc/testInterface/TestInterface.java
+@@ -55,7 +55,7 @@
+ 
+         // Make sure known implementing class list is correct and omits type parameters.
+         {BUG_ID + FS + "pkg" + FS + "Interface.html",
+-            "<DT><STRONG>All Known Implementing Classes:</STRONG> " +
++            "<DT><STRONG>All Known Implementing Classes:</STRONG></DT> " +
+             "<DD><A HREF=\"../pkg/Child.html\" " +
+             "title=\"class in pkg\">Child</A>, " +
+             "<A HREF=\"../pkg/Parent.html\" title=\"class in pkg\">" +
+@@ -63,7 +63,9 @@
+ 
+          // Make sure "All Implemented Interfaces": has substituted type parameters
+          {BUG_ID + FS + "pkg" + FS + "Child.html",
+-            "<STRONG>All Implemented Interfaces:</STRONG> <DD><A HREF=\"../pkg/Interface.html\" title=\"interface in pkg\">Interface</A><T>"
++            "<STRONG>All Implemented Interfaces:</STRONG></DT> <DD>" +
++            "<A HREF=\"../pkg/Interface.html\" title=\"interface in pkg\">" +
++            "Interface</A><T>"
+          },
+          //Make sure Class Tree has substituted type parameters.
+          {BUG_ID + FS + "pkg" + FS + "Child.html",
+@@ -75,15 +77,15 @@
+          },
+          //Make sure "Direct Know Subclasses" omits type parameters
+         {BUG_ID + FS + "pkg" + FS + "Parent.html",
+-            "<STRONG>Direct Known Subclasses:</STRONG> <DD><A HREF=\"../pkg/Child.html\" title=\"class in pkg\">Child</A>"
++            "<STRONG>Direct Known Subclasses:</STRONG></DT> <DD><A HREF=\"../pkg/Child.html\" title=\"class in pkg\">Child</A>"
+         },
+         //Make sure "Specified By" has substituted type parameters.
+         {BUG_ID + FS + "pkg" + FS + "Child.html",
+-            "<STRONG>Specified by:</STRONG><DD><CODE><A HREF=\"../pkg/Interface.html#method()\">method</A></CODE> in interface <CODE><A HREF=\"../pkg/Interface.html\" title=\"interface in pkg\">Interface</A><<A HREF=\"../pkg/Child.html\" title=\"type parameter in Child\">T</A>></CODE>"
++            "<STRONG>Specified by:</STRONG></DT><DD><CODE><A HREF=\"../pkg/Interface.html#method()\">method</A></CODE> in interface <CODE><A HREF=\"../pkg/Interface.html\" title=\"interface in pkg\">Interface</A><<A HREF=\"../pkg/Child.html\" title=\"type parameter in Child\">T</A>></CODE>"
+          },
+         //Make sure "Overrides" has substituted type parameters.
+         {BUG_ID + FS + "pkg" + FS + "Child.html",
+-            "<STRONG>Overrides:</STRONG><DD><CODE><A HREF=\"../pkg/Parent.html#method()\">method</A></CODE> in class <CODE><A HREF=\"../pkg/Parent.html\" title=\"class in pkg\">Parent</A><<A HREF=\"../pkg/Child.html\" title=\"type parameter in Child\">T</A>></CODE>"
++            "<STRONG>Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg/Parent.html#method()\">method</A></CODE> in class <CODE><A HREF=\"../pkg/Parent.html\" title=\"class in pkg\">Parent</A><<A HREF=\"../pkg/Child.html\" title=\"type parameter in Child\">T</A>></CODE>"
+          },
+     };
+     private static final String[][] NEGATED_TEST = {
+diff --git a/test/com/sun/javadoc/testLinkOption/TestLinkOption.java b/test/com/sun/javadoc/testLinkOption/TestLinkOption.java
+--- langtools/test/com/sun/javadoc/testLinkOption/TestLinkOption.java
++++ langtools/test/com/sun/javadoc/testLinkOption/TestLinkOption.java
+@@ -63,7 +63,8 @@
+             "title=\"class or interface in java.lang\">Object</A> p3)"
+         },
+         {BUG_ID + "-1" + FS + "java" + FS + "lang" + FS + "StringBuilderChild.html",
+-                "public abstract class <STRONG>StringBuilderChild</STRONG><DT>extends <A HREF=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true\" title=\"class or interface in java.lang\">Object</A>"
++                "public abstract class <STRONG>StringBuilderChild</STRONG>" + NL +
++                "extends <A HREF=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true\" title=\"class or interface in java.lang\">Object</A>"
+         },
+ 
+     };
+diff --git a/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java b/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java
+--- langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java
++++ langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java
+@@ -59,7 +59,7 @@
+             " Link to another inner class: <A HREF=\"../pkg/C.InnerC2.html\" title=\"class in pkg\"><CODE>C.InnerC2</CODE></A>"
+         },
+         {BUG_ID + FS + "pkg" + FS + "C.InnerC2.html",
+-            "Enclosing class:</STRONG><DD><A HREF=\"../pkg/C.html\" title=\"class in pkg\">C</A>"
++            "Enclosing class:</STRONG></DT><DD><A HREF=\"../pkg/C.html\" title=\"class in pkg\">C</A>"
+         },
+     };
+     private static final String[][] NEGATED_TEST = {
+diff --git a/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java b/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java
+--- langtools/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java
++++ langtools/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java
+@@ -74,7 +74,7 @@
+ 
+          // Test overriding/implementing methods with generic parameters.
+                  {BUG_ID + FS + "pkg" + FS + "BaseClass.html",
+-         "<DT><STRONG>Specified by:</STRONG><DD><CODE><A HREF=\"../pkg/BaseInterface.html#getAnnotation(java.lang.Class)\">getAnnotation</A></CODE> in interface <CODE><A HREF=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">BaseInterface</A></CODE></DL>"},
++         "<DT><STRONG>Specified by:</STRONG></DT><DD><CODE><A HREF=\"../pkg/BaseInterface.html#getAnnotation(java.lang.Class)\">getAnnotation</A></CODE> in interface <CODE><A HREF=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">BaseInterface</A></CODE></DD>"+NL+"</DL>"},
+ 
+          // Test diamond inheritence member summary (6256068)
+                  {BUG_ID + FS + "diamond" + FS + "Z.html",
+diff --git a/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java b/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java
+--- langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java
++++ langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java
+@@ -54,7 +54,7 @@
+             {BUG_ID + FS + "pkg" + FS + "Coin.html", "Enum Coin</H2>"},
+             //Make sure enum signature is correct.
+             {BUG_ID + FS + "pkg" + FS + "Coin.html", "public enum "+
+-                "<STRONG>Coin</STRONG><DT>extends java.lang.Enum<" +
++                "<STRONG>Coin</STRONG>" + NL + "extends java.lang.Enum<" +
+                 "<A HREF=\"../pkg/Coin.html\" title=\"enum in pkg\">Coin</A>>"
+             },
+             //Check for enum constant section
+@@ -79,20 +79,20 @@
+                 "Class TypeParameters<E></H2>"},
+             //Check class type parameters section.
+             {BUG_ID + FS + "pkg" + FS + "TypeParameters.html",
+-                "<DT><STRONG>Type Parameters:</STRONG><DD><CODE>E</CODE> - " +
++                "<DT><STRONG>Type Parameters:</STRONG></DT><DD><CODE>E</CODE> - " +
+                 "the type parameter for this class."},
+             //Type parameters in @see/@link
+             {BUG_ID + FS + "pkg" + FS + "TypeParameters.html",
+-                "<DT><STRONG>See Also:</STRONG><DD><A HREF=\"../pkg/TypeParameters.html\" " +
+-                    "title=\"class in pkg\"><CODE>TypeParameters</CODE></A></DL>"},
++                "<DT><STRONG>See Also:</STRONG></DT><DD><A HREF=\"../pkg/TypeParameters.html\" " +
++                    "title=\"class in pkg\"><CODE>TypeParameters</CODE></A></DD></DL>"},
+             //Method that uses class type parameter.
+             {BUG_ID + FS + "pkg" + FS + "TypeParameters.html",
+                 "(<A HREF=\"../pkg/TypeParameters.html\" title=\"type " +
+                     "parameter in TypeParameters\">E</A> param)"},
+             //Method type parameter section.
+             {BUG_ID + FS + "pkg" + FS + "TypeParameters.html",
+-                "<STRONG>Type Parameters:</STRONG><DD><CODE>T</CODE> - This is the first " +
+-                    "type parameter.<DD><CODE>V</CODE> - This is the second type " +
++                "<STRONG>Type Parameters:</STRONG></DT><DD><CODE>T</CODE> - This is the first " +
++                    "type parameter.</DD><DD><CODE>V</CODE> - This is the second type " +
+                     "parameter."},
+             //Signature of method with type parameters
+             {BUG_ID + FS + "pkg" + FS + "TypeParameters.html",
+@@ -117,17 +117,17 @@
+             //Signature of subclass that has type parameters.
+             {BUG_ID + FS + "pkg" + FS + "TypeParameterSubClass.html",
+                 "public class <STRONG>TypeParameterSubClass<T extends java.lang.String>" +
+-                "</STRONG><DT>extends <A HREF=\"../pkg/TypeParameterSuperClass.html\" " +
++                "</STRONG>" + NL + "extends <A HREF=\"../pkg/TypeParameterSuperClass.html\" " +
+                 "title=\"class in pkg\">TypeParameterSuperClass</A><T>"},
+ 
+             //Interface generic parameter substitution
+             //Signature of subclass that has type parameters.
+             {BUG_ID + FS + "pkg" + FS + "TypeParameters.html",
+-                "<STRONG>All Implemented Interfaces:</STRONG> <DD><A HREF=\"../pkg/SubInterface.html\" title=\"interface in pkg\">SubInterface</A><E>, <A HREF=\"../pkg/SuperInterface.html\" title=\"interface in pkg\">SuperInterface</A><E></DD>"},
++                "<STRONG>All Implemented Interfaces:</STRONG></DT> <DD><A HREF=\"../pkg/SubInterface.html\" title=\"interface in pkg\">SubInterface</A><E>, <A HREF=\"../pkg/SuperInterface.html\" title=\"interface in pkg\">SuperInterface</A><E></DD>"},
+             {BUG_ID + FS + "pkg" + FS + "SuperInterface.html",
+-                "<STRONG>All Known Subinterfaces:</STRONG> <DD><A HREF=\"../pkg/SubInterface.html\" title=\"interface in pkg\">SubInterface</A><V></DD>"},
++                "<STRONG>All Known Subinterfaces:</STRONG></DT> <DD><A HREF=\"../pkg/SubInterface.html\" title=\"interface in pkg\">SubInterface</A><V></DD>"},
+             {BUG_ID + FS + "pkg" + FS + "SubInterface.html",
+-                "<STRONG>All Superinterfaces:</STRONG> <DD><A HREF=\"../pkg/SuperInterface.html\" title=\"interface in pkg\">SuperInterface</A><V></DD>"},
++                "<STRONG>All Superinterfaces:</STRONG></DT> <DD><A HREF=\"../pkg/SuperInterface.html\" title=\"interface in pkg\">SuperInterface</A><V></DD>"},
+ 
+             //=================================
+             // VAR ARG TESTING
+@@ -166,7 +166,7 @@
+                 "Element Detail"},
+             //Make sure default annotation type value is printed when necessary.
+             {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
+-                "<STRONG>Default:</STRONG><DD>\"unknown\"</DD>"},
++                "<STRONG>Default:</STRONG></DT><DD>\"unknown\"</DD>"},
+ 
+             //=================================
+             // ANNOTATION TYPE USAGE TESTING
+@@ -182,7 +182,8 @@
+                 "<FONT SIZE=\"-1\">" +
+                 "<A HREF=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</A>(<A HREF=\"../pkg/AnnotationType.html#optional()\">optional</A>=\"Class Annotation\","+NL +
+                 "                <A HREF=\"../pkg/AnnotationType.html#required()\">required</A>=1994)"+NL +
+-                "</FONT>public class <STRONG>AnnotationTypeUsage</STRONG><DT>extends java.lang.Object</DL>"},
++                "</FONT>public class <STRONG>AnnotationTypeUsage</STRONG>" + NL +
++                "extends java.lang.Object"},
+ 
+             //FIELD
+             {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
+@@ -270,8 +271,7 @@
+             {BUG_ID + FS + "pkg1" + FS + "B.html",
+                 "<PRE><FONT SIZE=\"-1\"><A HREF=\"../pkg1/A.html\" title=\"annotation in pkg1\">@A</A>"},
+             {BUG_ID + FS + "pkg1" + FS + "B.html",
+-                "</FONT>public interface <STRONG>B</STRONG></DL>" + NL +
+-                    "</PRE>"},
++                "</FONT>public interface <STRONG>B</STRONG></PRE>"},
+ 
+ 
+             //==============================================================
+@@ -525,7 +525,7 @@
+             "<FONT SIZE=\"-1\">" + NL +
+             "<A HREF=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</A>(<A HREF=\"../pkg/AnnotationType.html#optional\">optional</A>=\"Class Annotation\"," + NL +
+             "                <A HREF=\"../pkg/AnnotationType.html#required\">required</A>=1994)" + NL +
+-            "</FONT>public class <STRONG>AnnotationTypeUsage</STRONG><DT>extends java.lang.Object</DL>"},
++            "</FONT>public class <STRONG>AnnotationTypeUsage</STRONG></DT><DT>extends java.lang.Object</DT></DL>"},
+ 
+         //FIELD
+         {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
+diff --git a/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethods.java b/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethods.java
+--- langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethods.java
++++ langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethods.java
+@@ -40,11 +40,11 @@
+     private static final String[][] TEST = {
+         //The public method should be overriden
+         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
+-         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"},
++         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"},
+ 
+         //The public method in different package should be overriden
+         {BUG_ID + FS + "pkg2" + FS + "SubClass.html",
+-         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"}
++         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"}
+     };
+ 
+     private static final String[][] NEGATED_TEST = {
+@@ -52,20 +52,20 @@
+         //The package private method should be overriden since the base and sub class are in the same
+         //package.  However, the link should not show up because the package private methods are not documented.
+         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
+-         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"},
++         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"},
+ 
+         //The private method in should not be overriden
+         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
+-         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"},
++         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"},
+ 
+         //The private method in different package should not be overriden
+         {BUG_ID + FS + "pkg2" + FS + "SubClass.html",
+-         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"},
++         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"},
+ 
+         //The package private method should not be overriden since the base and sub class are in
+         //different packages.
+         {BUG_ID + FS + "pkg2" + FS + "SubClass.html",
+-         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"}
++         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"}
+     };
+ 
+     private static final String[] ARGS =
+diff --git a/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java b/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java
+--- langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java
++++ langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java
+@@ -40,32 +40,32 @@
+     private static final String[][] TEST = {
+         //The public method should be overriden
+         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
+-         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"},
++         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"},
+ 
+         //The public method in different package should be overriden
+         {BUG_ID + FS + "pkg2" + FS + "SubClass.html",
+-         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"},
++         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"},
+ 
+         //The package private method should be overriden since the base and sub class are in the same
+         //package.
+         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
+-         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"}
++         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"}
+     };
+ 
+     private static final String[][] NEGATED_TEST = {
+ 
+         //The private method in should not be overriden
+         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
+-         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"},
++         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"},
+ 
+         //The private method in different package should not be overriden
+         {BUG_ID + FS + "pkg2" + FS + "SubClass.html",
+-         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"},
++         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"},
+ 
+         //The package private method should not be overriden since the base and sub class are in
+         //different packages.
+         {BUG_ID + FS + "pkg2" + FS + "SubClass.html",
+-         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"},
++         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"},
+     };
+ 
+     private static final String[] ARGS =
+diff --git a/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPrivateFlag.java b/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPrivateFlag.java
+--- langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPrivateFlag.java
++++ langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPrivateFlag.java
+@@ -40,32 +40,32 @@
+     private static final String[][] TEST = {
+         //The public method should be overriden
+         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
+-         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"},
++         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"},
+ 
+         //The package private method should be overriden since the base and sub class are in the same
+         //package.
+         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
+-         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"},
++         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"},
+ 
+         //The public method in different package should be overriden
+         {BUG_ID + FS + "pkg2" + FS + "SubClass.html",
+-         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"},
++         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"},
+     };
+ 
+     private static final String[][] NEGATED_TEST = {
+ 
+         //The private method in should not be overriden
+         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
+-         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"},
++         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"},
+ 
+         //The private method in different package should not be overriden
+         {BUG_ID + FS + "pkg2" + FS + "SubClass.html",
+-         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"},
++         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"},
+ 
+         //The package private method should not be overriden since the base and sub class are in
+         //different packages.
+         {BUG_ID + FS + "pkg2" + FS + "SubClass.html",
+-         "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"}
++         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"}
+ 
+ 
+     };
+diff --git a/test/com/sun/javadoc/testParamTaglet/TestParamTaglet.java b/test/com/sun/javadoc/testParamTaglet/TestParamTaglet.java
+--- langtools/test/com/sun/javadoc/testParamTaglet/TestParamTaglet.java
++++ langtools/test/com/sun/javadoc/testParamTaglet/TestParamTaglet.java
+@@ -48,12 +48,12 @@
+     private static final String[][] TEST = {
+         //Regular param tags.
+         {BUG_ID + FS + "pkg" + FS + "C.html",
+-            "<STRONG>Parameters:</STRONG><DD><CODE>param1</CODE> - testing 1 2 3." +
++            "<STRONG>Parameters:</STRONG></DT><DD><CODE>param1</CODE> - testing 1 2 3.</DD>" +
+                 "<DD><CODE>param2</CODE> - testing 1 2 3."
+         },
+         //Param tags that don't match with any real parameters.
+         {BUG_ID + FS + "pkg" + FS + "C.html",
+-            "<STRONG>Parameters:</STRONG><DD><CODE><I>p1</I></CODE> - testing 1 2 3." +
++            "<STRONG>Parameters:</STRONG></DT><DD><CODE><I>p1</I></CODE> - testing 1 2 3.</DD>" +
+                 "<DD><CODE><I>p2</I></CODE> - testing 1 2 3."
+         },
+         //{@inherit} doc misuse does not cause doclet to throw exception.
+diff --git a/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java b/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java
+--- langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java
++++ langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java
+@@ -96,11 +96,11 @@
+ 
+         //Make sure implemented interfaces from private superclass are inherited
+         {BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html",
+-            "<STRONG>All Known Implementing Classes:</STRONG> <DD><A HREF=\"../pkg/PublicChild.html\" " +
++            "<STRONG>All Known Implementing Classes:</STRONG></DT> <DD><A HREF=\"../pkg/PublicChild.html\" " +
+             "title=\"class in pkg\">PublicChild</A>"},
+ 
+         {BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html",
+-            "<STRONG>All Implemented Interfaces:</STRONG> <DD><A HREF=\"../pkg/PublicInterface.html\" " +
++            "<STRONG>All Implemented Interfaces:</STRONG></DT> <DD><A HREF=\"../pkg/PublicInterface.html\" " +
+             "title=\"interface in pkg\">PublicInterface</A>"},
+ 
+         //Generic interface method test.
+@@ -174,18 +174,18 @@
+         },
+         // Should document that a method overrides method from private class.
+        {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
+-            "<STRONG>Overrides:</STRONG><DD><CODE>" +
++            "<STRONG>Overrides:</STRONG></DT><DD><CODE>" +
+             "<A HREF=\"../pkg/PrivateParent.html#methodOverridenFromParent(char[], int, T, V, java.util.List)\">" +
+             "methodOverridenFromParent</A></CODE> in class <CODE>" +
+             "<A HREF=\"../pkg/PrivateParent.html\" title=\"class in pkg\">" +
+-            "PrivateParent</A></CODE></DL>"},
++            "PrivateParent</A></CODE></DD>" + NL + "</DL>"},
+        // Should document that a method is specified by private interface.
+        {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
+-            "<STRONG>Specified by:</STRONG><DD><CODE>" +
++            "<STRONG>Specified by:</STRONG></DT><DD><CODE>" +
+             "<A HREF=\"../pkg/PrivateInterface.html#methodInterface(int)\">" +
+             "methodInterface</A></CODE> in interface <CODE>" +
+             "<A HREF=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">" +
+-            "PrivateInterface</A></CODE></DL>" + NL + "</DD>"},
++            "PrivateInterface</A></CODE></DD>" + NL + "</DL>" + NL + "</DD>"},
+        // Method inheritence from non-public superinterface.
+        {BUG_ID + "-2" + FS + "pkg" + FS + "PublicInterface.html",
+             "Methods inherited from interface " +
+@@ -209,12 +209,12 @@
+ 
+       //Make sure implemented interfaces from private superclass are inherited
+       {BUG_ID + "-2" + FS + "pkg" + FS + "PublicInterface.html",
+-        "<STRONG>All Known Implementing Classes:</STRONG> <DD><A HREF=\"../pkg/PrivateParent.html\" " +
++        "<STRONG>All Known Implementing Classes:</STRONG></DT> <DD><A HREF=\"../pkg/PrivateParent.html\" " +
+         "title=\"class in pkg\">PrivateParent</A>, " +
+         "<A HREF=\"../pkg/PublicChild.html\" title=\"class in pkg\">PublicChild</A>"},
+ 
+       {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
+-        "<STRONG>All Implemented Interfaces:</STRONG> <DD><A HREF=\"../pkg/PrivateInterface.html\" " +
++        "<STRONG>All Implemented Interfaces:</STRONG></DT> <DD><A HREF=\"../pkg/PrivateInterface.html\" " +
+         "title=\"interface in pkg\">PrivateInterface</A>, " +
+         "<A HREF=\"../pkg/PublicInterface.html\" title=\"interface in pkg\">" +
+         "PublicInterface</A>"},
+@@ -226,7 +226,7 @@
+             "<CODE><A HREF=\"../pkg2/I.html#hello(T)\">I</A></CODE></STRONG>"},
+ 
+       {BUG_ID + "-2" + FS + "pkg2" + FS + "C.html",
+-            "<STRONG>Specified by:</STRONG><DD><CODE><A HREF=\"../pkg2/I.html#hello(T)\">" +
++            "<STRONG>Specified by:</STRONG></DT><DD><CODE><A HREF=\"../pkg2/I.html#hello(T)\">" +
+             "hello</A></CODE> in interface <CODE><A HREF=\"../pkg2/I.html\" " +
+             "title=\"interface in pkg2\">I</A>"},
+     };
+diff --git a/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java b/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java
+--- langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java
++++ langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java
+@@ -41,39 +41,39 @@
+     // 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><DL>" + NL +
++                 "<DT><STRONG>Throws:</STRONG></DT>" + NL + "<DD><CODE>" +
++                 "java.io.IOException</CODE></DD><DT><STRONG>See Also:</STRONG>" +
++                 "</DT><DD><A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
++                 "<CODE>C1.setUndecorated(boolean)</CODE></A></DD></DL>" + NL +
++                 "</DD>" + NL + "</DL>"},
+         {BUG_ID + FS + "serialized-form.html", "<DL>" + NL +
+-                 "<DD><STRONG>Deprecated.</STRONG> <I>As of JDK version" +
+-                 " 1.5, replaced by" + 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>" +
++                 "<CODE>setUndecorated(boolean)</CODE></A>.</I></DD>" +
+                  "<DD>This field indicates whether the C1 is undecorated." + NL +
+-                 "<P>" + NL + "<DT><DD> <DL>" + NL +
+-                 "<DT><STRONG>Since:</STRONG></DT>" + NL +
++                 "<P>" + NL + "</DD>" + NL + "<DD> </DD>" + NL +
++                 "<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>"},
++                 "</DT><DD><A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
++                 "<CODE>C1.setUndecorated(boolean)</CODE></A></DD></DL>" + NL +
++                 "</DD>" + 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>"},
++                 "</DD><DD>Reads the object stream." + NL + "<P>" + NL +
++                 "</DD>" + NL + "<DD><DL>" + NL + "<DT><STRONG>Throws:" +
++                 "</STRONG></DT>" + NL + "<DD><CODE><code>" +
++                 "IOException</code></CODE></DD>" + NL +
++                 "<DD><CODE>java.io.IOException</CODE></DD></DL>" + NL +
++                 "</DD>" + 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>"}};
++                 "<DD><STRONG>Deprecated.</STRONG> </DD><DD>" +
++                 "The name for this class." + NL + "<P>" + NL + "</DD>" + NL +
++                 "<DD> </DD>" + NL + "</DL>"}};
+ 
+     // Test with -nocomment option. The serialized-form.html should
+     // not display the inline comments and tags but should display deprecation
+@@ -83,16 +83,16 @@
+                  "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>"},
++                 "setUndecorated(boolean)</CODE></A>.</I></DD></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>"},
++                 "</DD></DL>"},
+         {BUG_ID + FS + "serialized-form.html", "<PRE>" + NL + "int <STRONG>" +
+                  "publicKey</STRONG></PRE>" + NL + "<DL>" + NL + "<DD><STRONG>" +
+-                 "Deprecated.</STRONG> </DL>"}};
++                 "Deprecated.</STRONG> </DD></DL>"}};
+ 
+     // Test with -nodeprecated option. The serialized-form.html should
+     // ignore the -nodeprecated tag and display the deprecation info. This
+diff --git a/test/com/sun/javadoc/testThrowsTag/TestThrowsTag.java b/test/com/sun/javadoc/testThrowsTag/TestThrowsTag.java
+--- langtools/test/com/sun/javadoc/testThrowsTag/TestThrowsTag.java
++++ langtools/test/com/sun/javadoc/testThrowsTag/TestThrowsTag.java
+@@ -46,14 +46,14 @@
+     //Input for string search tests.
+     private static final String[][] TEST = {
+         {BUG_ID + FS + "pkg" + FS + "C.html",
+-            "<DD><CODE><A HREF=\"../pkg/T1.html\" title=\"class in pkg\">T1</A></CODE> - the first throws tag." + NL +
+-            "<DD><CODE><A HREF=\"../pkg/T2.html\" title=\"class in pkg\">T2</A></CODE> - the second throws tag." + NL +
+-            "<DD><CODE><A HREF=\"../pkg/T3.html\" title=\"class in pkg\">T3</A></CODE> - the third throws tag." + NL +
+-            "<DD><CODE><A HREF=\"../pkg/T4.html\" title=\"class in pkg\">T4</A></CODE> - the fourth throws tag." + NL +
+-            "<DD><CODE><A HREF=\"../pkg/T5.html\" title=\"class in pkg\">T5</A></CODE> - the first inherited throws tag." + NL +
+-            "<DD><CODE><A HREF=\"../pkg/T6.html\" title=\"class in pkg\">T6</A></CODE> - the second inherited throws tag." + NL +
+-            "<DD><CODE><A HREF=\"../pkg/T7.html\" title=\"class in pkg\">T7</A></CODE> - the third inherited throws tag." + NL +
+-            "<DD><CODE><A HREF=\"../pkg/T8.html\" title=\"class in pkg\">T8</A></CODE> - the fourth inherited throws tag."
++            "<DD><CODE><A HREF=\"../pkg/T1.html\" title=\"class in pkg\">T1</A></CODE> - the first throws tag.</DD>" + NL +
++            "<DD><CODE><A HREF=\"../pkg/T2.html\" title=\"class in pkg\">T2</A></CODE> - the second throws tag.</DD>" + NL +
++            "<DD><CODE><A HREF=\"../pkg/T3.html\" title=\"class in pkg\">T3</A></CODE> - the third throws tag.</DD>" + NL +
++            "<DD><CODE><A HREF=\"../pkg/T4.html\" title=\"class in pkg\">T4</A></CODE> - the fourth throws tag.</DD>" + NL +
++            "<DD><CODE><A HREF=\"../pkg/T5.html\" title=\"class in pkg\">T5</A></CODE> - the first inherited throws tag.</DD>" + NL +
++            "<DD><CODE><A HREF=\"../pkg/T6.html\" title=\"class in pkg\">T6</A></CODE> - the second inherited throws tag.</DD>" + NL +
++            "<DD><CODE><A HREF=\"../pkg/T7.html\" title=\"class in pkg\">T7</A></CODE> - the third inherited throws tag.</DD>" + NL +
++            "<DD><CODE><A HREF=\"../pkg/T8.html\" title=\"class in pkg\">T8</A></CODE> - the fourth inherited throws tag.</DD>"
+         },
+     };
+     private static final String[][] NEGATED_TEST = NO_TEST;

Added: trunk/java/openjdk6/files/icedtea/openjdk/6802694-no_deprecated.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/openjdk/6802694-no_deprecated.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/openjdk/6802694-no_deprecated.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,601 @@
+# 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.
++ */
++ at 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() {
++
++    }
++}

Added: trunk/java/openjdk6/files/icedtea/openjdk/6851834-handle_renames.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/openjdk/6851834-handle_renames.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/openjdk/6851834-handle_renames.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,605 @@
+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();
+-    }
+-}

Added: trunk/java/openjdk6/files/icedtea/openjdk/6851834-restructure.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/openjdk/6851834-restructure.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/openjdk/6851834-restructure.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,26855 @@
+# HG changeset patch
+# User andrew
+# Date 1371730814 18000
+# Node ID 5761891cfee48bc9382dd68e5e1bf164cff9bfbf
+# Parent  741c190d6989de395cb95895dc0320415af6b131
+# PLEASE SEE the other 6851834 patch which handles renames more generally
+6851834: Javadoc doclet needs a structured approach to generate the output HTML.
+Reviewed-by: jjg
+
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java
+@@ -26,12 +26,16 @@
+ package com.sun.tools.doclets.formats.html;
+ 
+ import com.sun.javadoc.*;
++import com.sun.tools.doclets.formats.html.markup.*;
++import com.sun.tools.doclets.internal.toolkit.*;
++import com.sun.tools.doclets.internal.toolkit.util.*;
+ 
+ /**
+  * Print method and constructor info.
+  *
+  * @author Robert Field
+  * @author Atul M Dambalkar
++ * @author Bhavesh Patel (Modified)
+  */
+ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWriter {
+ 
+@@ -45,82 +49,111 @@
+     }
+ 
+     /**
+-     * Write the type parameters for the executable member.
++     * Add the type parameters for the executable member.
+      *
+      * @param member the member to write type parameters for.
++     * @param htmltree the content tree to which the parameters will be added.
+      * @return the display length required to write this information.
+      */
+-    protected int writeTypeParameters(ExecutableMemberDoc member) {
++    protected int addTypeParameters(ExecutableMemberDoc member, Content htmltree) {
+         LinkInfoImpl linkInfo = new LinkInfoImpl(
+             LinkInfoImpl.CONTEXT_MEMBER_TYPE_PARAMS, member, false);
+         String typeParameters = writer.getTypeParameterLinks(linkInfo);
+         if (linkInfo.displayLength > 0) {
+-            writer.print(typeParameters + " ");
++            Content linkContent = new RawHtml(typeParameters);
++            htmltree.addContent(linkContent);
++            htmltree.addContent(writer.getSpace());
+             writer.displayLength += linkInfo.displayLength + 1;
+         }
+         return linkInfo.displayLength;
+     }
+ 
+-    protected void writeSignature(ExecutableMemberDoc member) {
+-        writer.displayLength = 0;
+-        writer.pre();
+-        writer.writeAnnotationInfo(member);
+-        printModifiers(member);
+-        writeTypeParameters(member);
+-        if (configuration().linksource &&
+-            member.position().line() != classdoc.position().line()) {
+-            writer.printSrcLink(member, member.name());
+-        } else {
+-            strong(member.name());
+-        }
+-        writeParameters(member);
+-        writeExceptions(member);
+-        writer.preEnd();
++    /**
++     * {@inheritDoc}
++     */
++    protected Content getDeprecatedLink(ProgramElementDoc member) {
++        ExecutableMemberDoc emd = (ExecutableMemberDoc)member;
++        return writer.getDocLink(LinkInfoImpl.CONTEXT_MEMBER, (MemberDoc) emd,
++                emd.qualifiedName() + emd.flatSignature());
+     }
+ 
+-    protected void writeDeprecatedLink(ProgramElementDoc member) {
++    /**
++     * Add the summary link for the member.
++     *
++     * @param context the id of the context where the link will be printed
++     * @param classDoc the classDoc that we should link to
++     * @param member the member being linked to
++     * @param tdSummary the content tree to which the link will be added
++     */
++    protected void addSummaryLink(int context, ClassDoc cd, ProgramElementDoc member,
++            Content tdSummary) {
+         ExecutableMemberDoc emd = (ExecutableMemberDoc)member;
+-        writer.printDocLink(LinkInfoImpl.CONTEXT_MEMBER, (MemberDoc) emd,
+-            emd.qualifiedName() + emd.flatSignature(), false);
++        String name = emd.name();
++        Content strong = HtmlTree.STRONG(new RawHtml(
++                writer.getDocLink(context, cd, (MemberDoc) emd,
++                name, false)));
++        Content code = HtmlTree.CODE(strong);
++        writer.displayLength = name.length();
++        addParameters(emd, false, code);
++        tdSummary.addContent(code);
+     }
+ 
+-    protected void writeSummaryLink(int context, ClassDoc cd, ProgramElementDoc member) {
+-        ExecutableMemberDoc emd = (ExecutableMemberDoc)member;
+-        String name = emd.name();
+-        writer.strong();
+-        writer.printDocLink(context, cd, (MemberDoc) emd,
+-            name, false);
+-        writer.strongEnd();
+-        writer.displayLength = name.length();
+-        writeParameters(emd, false);
++    /**
++     * Add the inherited summary link for the member.
++     *
++     * @param classDoc the classDoc that we should link to
++     * @param member the member being linked to
++     * @param linksTree the content tree to which the link will be added
++     */
++    protected void addInheritedSummaryLink(ClassDoc cd,
++            ProgramElementDoc member, Content linksTree) {
++        linksTree.addContent(new RawHtml(
++                writer.getDocLink(LinkInfoImpl.CONTEXT_MEMBER, cd, (MemberDoc) member,
++                member.name(), false)));
+     }
+ 
+-    protected void writeInheritedSummaryLink(ClassDoc cd,
+-            ProgramElementDoc member) {
+-        writer.printDocLink(LinkInfoImpl.CONTEXT_MEMBER, cd, (MemberDoc) member,
+-            member.name(), false);
+-    }
+-
+-    protected void writeParam(ExecutableMemberDoc member, Parameter param,
+-        boolean isVarArg) {
++    /**
++     * Add the parameter for the executable member.
++     *
++     * @param member the member to write parameter for.
++     * @param param the parameter that needs to be written.
++     * @param isVarArg true if this is a link to var arg.
++     * @param tree the content tree to which the parameter information will be added.
++     */
++    protected void addParam(ExecutableMemberDoc member, Parameter param,
++        boolean isVarArg, Content tree) {
+         if (param.type() != null) {
+-            writer.printLink(new LinkInfoImpl(
+-                LinkInfoImpl.CONTEXT_EXECUTABLE_MEMBER_PARAM, param.type(),
+-                isVarArg));
++            Content link = new RawHtml(writer.getLink(new LinkInfoImpl(
++                    LinkInfoImpl.CONTEXT_EXECUTABLE_MEMBER_PARAM, param.type(),
++                    isVarArg)));
++            tree.addContent(link);
+         }
+         if(param.name().length() > 0) {
+-            writer.space();
+-            writer.print(param.name());
++            tree.addContent(writer.getSpace());
++            tree.addContent(param.name());
+         }
+     }
+ 
+-    protected void writeParameters(ExecutableMemberDoc member) {
+-        writeParameters(member, true);
++    /**
++     * Add all the parameters for the executable member.
++     *
++     * @param member the member to write parameters for.
++     * @param tree the content tree to which the parameters information will be added.
++     */
++    protected void addParameters(ExecutableMemberDoc member, Content htmltree) {
++        addParameters(member, true, htmltree);
+     }
+ 
+-    protected void writeParameters(ExecutableMemberDoc member,
+-            boolean includeAnnotations) {
+-        print('(');
++    /**
++     * Add all the parameters for the executable member.
++     *
++     * @param member the member to write parameters for.
++     * @param includeAnnotations true if annotation information needs to be added.
++     * @param tree the content tree to which the parameters information will be added.
++     */
++    protected void addParameters(ExecutableMemberDoc member,
++            boolean includeAnnotations, Content htmltree) {
++        htmltree.addContent("(");
+         Parameter[] params = member.parameters();
+         String indent = makeSpace(writer.displayLength);
+         if (configuration().linksource) {
+@@ -132,58 +165,70 @@
+             Parameter param = params[paramstart];
+             if (!param.name().startsWith("this$")) {
+                 if (includeAnnotations) {
+-                        boolean foundAnnotations =
+-                                writer.writeAnnotationInfo(indent.length(), member, param);
+-                        if (foundAnnotations) {
+-                                writer.println();
+-                                writer.print(indent);
++                    boolean foundAnnotations =
++                            writer.addAnnotationInfo(indent.length(),
++                            member, param, htmltree);
++                    if (foundAnnotations) {
++                        htmltree.addContent(DocletConstants.NL);
++                        htmltree.addContent(indent);
+                     }
+                 }
+-                writeParam(member, param,
+-                    (paramstart == params.length - 1) && member.isVarArgs());
++                addParam(member, param,
++                    (paramstart == params.length - 1) && member.isVarArgs(), htmltree);
+                 break;
+             }
+         }
+ 
+         for (int i = paramstart + 1; i < params.length; i++) {
+-            writer.print(',');
+-            writer.println();
+-            writer.print(indent);
++            htmltree.addContent(",");
++            htmltree.addContent(DocletConstants.NL);
++            htmltree.addContent(indent);
+             if (includeAnnotations) {
+                 boolean foundAnnotations =
+-                    writer.writeAnnotationInfo(indent.length(), member, params[i]);
++                        writer.addAnnotationInfo(indent.length(), member, params[i],
++                        htmltree);
+                 if (foundAnnotations) {
+-                    writer.println();
+-                    writer.print(indent);
++                    htmltree.addContent(DocletConstants.NL);
++                    htmltree.addContent(indent);
+                 }
+             }
+-            writeParam(member, params[i], (i == params.length - 1) && member.isVarArgs());
++            addParam(member, params[i], (i == params.length - 1) && member.isVarArgs(),
++                    htmltree);
+         }
+-        writer.print(')');
++        htmltree.addContent(")");
+     }
+ 
+-    protected void writeExceptions(ExecutableMemberDoc member) {
++    /**
++     * Add exceptions for the executable member.
++     *
++     * @param member the member to write exceptions for.
++     * @param htmltree the content tree to which the exceptions information will be added.
++     */
++    protected void addExceptions(ExecutableMemberDoc member, Content htmltree) {
+         Type[] exceptions = member.thrownExceptionTypes();
+         if(exceptions.length > 0) {
+             LinkInfoImpl memberTypeParam = new LinkInfoImpl(
+-                LinkInfoImpl.CONTEXT_MEMBER, member, false);
++                    LinkInfoImpl.CONTEXT_MEMBER, member, false);
+             int retlen = getReturnTypeLength(member);
+             writer.getTypeParameterLinks(memberTypeParam);
+             retlen += memberTypeParam.displayLength == 0 ?
+                 0 : memberTypeParam.displayLength + 1;
+             String indent = makeSpace(modifierString(member).length() +
+-                member.name().length() + retlen - 4);
+-            writer.println();
+-            writer.print(indent);
+-            writer.print("throws ");
++                    member.name().length() + retlen - 4);
++            htmltree.addContent(DocletConstants.NL);
++            htmltree.addContent(indent);
++            htmltree.addContent("throws ");
+             indent += "       ";
+-            writer.printLink(new LinkInfoImpl(
+-                LinkInfoImpl.CONTEXT_MEMBER, exceptions[0]));
++            Content link = new RawHtml(writer.getLink(new LinkInfoImpl(
++                    LinkInfoImpl.CONTEXT_MEMBER, exceptions[0])));
++            htmltree.addContent(link);
+             for(int i = 1; i < exceptions.length; i++) {
+-                writer.println(",");
+-                writer.print(indent);
+-                writer.printLink(new LinkInfoImpl(
+-                    LinkInfoImpl.CONTEXT_MEMBER, exceptions[i]));
++                htmltree.addContent(",");
++                htmltree.addContent(DocletConstants.NL);
++                htmltree.addContent(indent);
++                Content exceptionLink = new RawHtml(writer.getLink(new LinkInfoImpl(
++                        LinkInfoImpl.CONTEXT_MEMBER, exceptions[i])));
++                htmltree.addContent(exceptionLink);
+             }
+         }
+     }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java
+@@ -30,6 +30,8 @@
+ 
+ import com.sun.javadoc.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
++import com.sun.tools.doclets.formats.html.markup.*;
++import com.sun.tools.doclets.internal.toolkit.*;
+ 
+ /**
+  * Generate Index for all the Member Names with Indexing in
+@@ -39,6 +41,7 @@
+  *
+  * @see    IndexBuilder
+  * @author Atul M Dambalkar
++ * @author Bhavesh Patel (Modified)
+  */
+ public class AbstractIndexWriter extends HtmlDocletWriter {
+ 
+@@ -78,175 +81,187 @@
+     }
+ 
+     /**
+-     * Print the text "Index" in strong format in the navigation bar.
++     * Get the index label for navigation bar.
++     *
++     * @return a content tree for the tree label
+      */
+-    protected void navLinkIndex() {
+-        navCellRevStart();
+-        fontStyle("NavBarFont1Rev");
+-        strongText("doclet.Index");
+-        fontEnd();
+-        navCellEnd();
++    protected Content getNavLinkIndex() {
++        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, indexLabel);
++        return li;
+     }
+ 
+     /**
+-     * Generate the member information for the unicode character along with the
++     * Add the member information for the unicode character along with the
+      * list of the members.
+      *
+-     * @param unicode Unicode for which member list information to be generated.
+-     * @param memberlist List of members for the unicode character.
++     * @param unicode Unicode for which member list information to be generated
++     * @param memberlist List of members for the unicode character
++     * @param contentTree the content tree to which the information will be added
+      */
+-    protected void generateContents(Character unicode, List memberlist) {
+-        anchor("_" + unicode + "_");
+-        h2();
+-        strong(unicode.toString());
+-        h2End();
++    protected void addContents(Character unicode, List<? extends Doc> memberlist,
++            Content contentTree) {
++        contentTree.addContent(getMarkerAnchor("_" + unicode + "_"));
++        Content headContent = new StringContent(unicode.toString());
++        Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, false,
++                HtmlStyle.title, headContent);
++        contentTree.addContent(heading);
+         int memberListSize = memberlist.size();
+         // Display the list only if there are elements to be displayed.
+         if (memberListSize > 0) {
+-            dl();
++            Content dl = new HtmlTree(HtmlTag.DL);
+             for (int i = 0; i < memberListSize; i++) {
+                 Doc element = memberlist.get(i);
+                 if (element instanceof MemberDoc) {
+-                    printDescription((MemberDoc)element);
++                    addDescription((MemberDoc)element, dl);
+                 } else if (element instanceof ClassDoc) {
+-                    printDescription((ClassDoc)element);
++                    addDescription((ClassDoc)element, dl);
+                 } else if (element instanceof PackageDoc) {
+-                    printDescription((PackageDoc)element);
++                    addDescription((PackageDoc)element, dl);
+                 }
+             }
+-            dlEnd();
++            contentTree.addContent(dl);
+         }
+-        hr();
+-    }
+-
+-
+-    /**
+-     * Print one line summary comment for the package.
+-     *
+-     * @param pkg PackageDoc passed.
+-     */
+-    protected void printDescription(PackageDoc pkg) {
+-        dt();
+-        printPackageLink(pkg, Util.getPackageName(pkg), true);
+-        print(" - ");
+-        print(configuration.getText("doclet.package") + " " + pkg.name());
+-        dtEnd();
+-        dd();
+-        printSummaryComment(pkg);
+-        ddEnd();
+     }
+ 
+     /**
+-     * Print one line summary comment for the class.
++     * Add one line summary comment for the package.
+      *
+-     * @param cd ClassDoc passed.
++     * @param pkg the package to be documented
++     * @param dlTree the content tree to which the description will be added
+      */
+-    protected void printDescription(ClassDoc cd) {
+-        dt();
+-        printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_INDEX, cd, true));
+-        print(" - ");
+-        printClassInfo(cd);
+-        dtEnd();
+-        dd();
+-        printComment(cd);
+-        ddEnd();
++    protected void addDescription(PackageDoc pkg, Content dlTree) {
++        Content link = getPackageLink(pkg, new StringContent(Util.getPackageName(pkg)));
++        Content dt = HtmlTree.DT(link);
++        dt.addContent(" - ");
++        dt.addContent(getResource("doclet.package"));
++        dt.addContent(" " + pkg.name());
++        dlTree.addContent(dt);
++        Content dd = new HtmlTree(HtmlTag.DD);
++        addSummaryComment(pkg, dd);
++        dlTree.addContent(dd);
+     }
+ 
+     /**
+-     * Print the classkind(class, interface, exception, error of the class
++     * Add one line summary comment for the class.
++     *
++     * @param cd the class being documented
++     * @param dlTree the content tree to which the description will be added
++     */
++    protected void addDescription(ClassDoc cd, Content dlTree) {
++        Content link = new RawHtml(
++                getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_INDEX, cd, true)));
++        Content dt = HtmlTree.DT(link);
++        dt.addContent(" - ");
++        addClassInfo(cd, dt);
++        dlTree.addContent(dt);
++        Content dd = new HtmlTree(HtmlTag.DD);
++        addComment(cd, dd);
++        dlTree.addContent(dd);
++    }
++
++    /**
++     * Add the classkind(class, interface, exception, error of the class
+      * passed.
+      *
+-     * @param cd ClassDoc.
++     * @param cd the class being documented
++     * @param contentTree the content tree to which the class info will be added
+      */
+-    protected void printClassInfo(ClassDoc cd) {
+-        print(configuration.getText("doclet.in",
+-            Util.getTypeName(configuration, cd, false),
+-            getPackageLink(cd.containingPackage(),
++    protected void addClassInfo(ClassDoc cd, Content contentTree) {
++        contentTree.addContent(getResource("doclet.in",
++                Util.getTypeName(configuration, cd, false),
++                getPackageLinkString(cd.containingPackage(),
+                 Util.getPackageName(cd.containingPackage()), false)));
+     }
+ 
+-
+     /**
+-     * Generate Description for Class, Field, Method or Constructor.
+-     * for Java.* Packages Class Members.
++     * Add description for Class, Field, Method or Constructor.
+      *
+-     * @param member MemberDoc for the member of the Class Kind.
+-     * @see com.sun.javadoc.MemberDoc
++     * @param member MemberDoc for the member of the Class Kind
++     * @param dlTree the content tree to which the description will be added
+      */
+-    protected void printDescription(MemberDoc member) {
++    protected void addDescription(MemberDoc member, Content dlTree) {
+         String name = (member instanceof ExecutableMemberDoc)?
+             member.name() + ((ExecutableMemberDoc)member).flatSignature() :
+             member.name();
+         if (name.indexOf("<") != -1 || name.indexOf(">") != -1) {
+                 name = Util.escapeHtmlChars(name);
+         }
+-        ClassDoc containing = member.containingClass();
+-        dt();
+-        printDocLink(LinkInfoImpl.CONTEXT_INDEX, member, name, true);
+-        println(" - ");
+-        printMemberDesc(member);
+-        println();
+-        dtEnd();
+-        dd();
+-        printComment(member);
+-        ddEnd();
+-        println();
++        Content span = HtmlTree.SPAN(HtmlStyle.strong,
++                getDocLink(LinkInfoImpl.CONTEXT_INDEX, member, name));
++        Content dt = HtmlTree.DT(span);
++        dt.addContent(" - ");
++        addMemberDesc(member, dt);
++        dlTree.addContent(dt);
++        Content dd = new HtmlTree(HtmlTag.DD);
++        addComment(member, dd);
++        dlTree.addContent(dd);
+     }
+ 
+-
+     /**
+-     * Print comment for each element in the index. If the element is deprecated
++     * Add comment for each element in the index. If the element is deprecated
+      * and it has a @deprecated tag, use that comment. Else if the containing
+      * class for this element is deprecated, then add the word "Deprecated." at
+      * the start and then print the normal comment.
+      *
+-     * @param element Index element.
++     * @param element Index element
++     * @param contentTree the content tree to which the comment will be added
+      */
+-    protected void printComment(ProgramElementDoc element) {
++    protected void addComment(ProgramElementDoc element, Content contentTree) {
+         Tag[] tags;
++        Content span = HtmlTree.SPAN(HtmlStyle.strong, deprecatedPhrase);
++        HtmlTree div = new HtmlTree(HtmlTag.DIV);
++        div.addStyle(HtmlStyle.block);
+         if (Util.isDeprecated(element)) {
+-            strongText("doclet.Deprecated"); space();
++            div.addContent(span);
+             if ((tags = element.tags("deprecated")).length > 0)
+-                printInlineDeprecatedComment(element, tags[0]);
++                addInlineDeprecatedComment(element, tags[0], div);
++            contentTree.addContent(div);
+         } else {
+             ClassDoc cont = element.containingClass();
+             while (cont != null) {
+                 if (Util.isDeprecated(cont)) {
+-                    strongText("doclet.Deprecated"); space();
++                    div.addContent(span);
++                    contentTree.addContent(div);
+                     break;
+                 }
+                 cont = cont.containingClass();
+             }
+-            printSummaryComment(element);
++            addSummaryComment(element, contentTree);
+         }
+     }
+ 
+     /**
+-     * Print description about the Static Varible/Method/Constructor for a
++     * Add description about the Static Varible/Method/Constructor for a
+      * member.
+      *
+-     * @param member MemberDoc for the member within the Class Kind.
+-     * @see com.sun.javadoc.MemberDoc
++     * @param member MemberDoc for the member within the Class Kind
++     * @param contentTree the content tree to which the member description will be added
+      */
+-    protected void printMemberDesc(MemberDoc member) {
++    protected void addMemberDesc(MemberDoc member, Content contentTree) {
+         ClassDoc containing = member.containingClass();
+-        String classdesc = Util.getTypeName(configuration, containing, true) + " " +
+-            getPreQualifiedClassLink(LinkInfoImpl.CONTEXT_INDEX, containing,
+-                false);
++        String classdesc = Util.getTypeName(
++                configuration, containing, true) + " ";
+         if (member.isField()) {
+             if (member.isStatic()) {
+-                printText("doclet.Static_variable_in", classdesc);
++                contentTree.addContent(
++                        getResource("doclet.Static_variable_in", classdesc));
+             } else {
+-                printText("doclet.Variable_in", classdesc);
++                contentTree.addContent(
++                        getResource("doclet.Variable_in", classdesc));
+             }
+         } else if (member.isConstructor()) {
+-            printText("doclet.Constructor_for", classdesc);
++            contentTree.addContent(
++                    getResource("doclet.Constructor_for", classdesc));
+         } else if (member.isMethod()) {
+             if (member.isStatic()) {
+-                printText("doclet.Static_method_in", classdesc);
++                contentTree.addContent(
++                        getResource("doclet.Static_method_in", classdesc));
+             } else {
+-                printText("doclet.Method_in", classdesc);
++                contentTree.addContent(
++                        getResource("doclet.Method_in", classdesc));
+             }
+         }
++        addPreQualifiedClassLink(LinkInfoImpl.CONTEXT_INDEX, containing,
++                false, contentTree);
+     }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java
+@@ -25,10 +25,11 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
++import java.util.*;
+ import java.lang.reflect.Modifier;
+-import java.util.*;
+-
+ import com.sun.javadoc.*;
++import com.sun.tools.doclets.formats.html.markup.*;
++import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+ import com.sun.tools.doclets.internal.toolkit.taglets.*;
+ 
+@@ -60,36 +61,125 @@
+ 
+     /*** abstracts ***/
+ 
+-    public abstract void printSummaryLabel();
++    /**
++     * Add the summary label for the member.
++     *
++     * @param memberTree the content tree to which the label will be added
++     */
++    public abstract void addSummaryLabel(Content memberTree);
+ 
+-    public abstract void printTableSummary();
++    /**
++     * Get the summary for the member summary table.
++     *
++     * @return a string for the table summary
++     */
++    public abstract String getTableSummary();
+ 
+-    public abstract void printSummaryTableHeader(ProgramElementDoc member);
++    /**
++     * Get the caption for the member summary table.
++     *
++     * @return a string for the table caption
++     */
++    public abstract String getCaption();
+ 
+-    public abstract void printInheritedSummaryLabel(ClassDoc cd);
++    /**
++     * Get the summary table header for the member.
++     *
++     * @param member the member to be documented
++     * @return the summary table header
++     */
++    public abstract String[] getSummaryTableHeader(ProgramElementDoc member);
+ 
+-    public abstract void printSummaryAnchor(ClassDoc cd);
++    /**
++     * Add inherited summary lable for the member.
++     *
++     * @param cd the class doc to which to link to
++     * @param inheritedTree the content tree to which the inherited summary label will be added
++     */
++    public abstract void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree);
+ 
+-    public abstract void printInheritedSummaryAnchor(ClassDoc cd);
++    /**
++     * Add the anchor for the summary section of the member.
++     *
++     * @param cd the class doc to be documented
++     * @param memberTree the content tree to which the summary anchor will be added
++     */
++    public abstract void addSummaryAnchor(ClassDoc cd, Content memberTree);
+ 
+-    protected abstract void printSummaryType(ProgramElementDoc member);
++    /**
++     * Add the anchor for the inherited summary section of the member.
++     *
++     * @param cd the class doc to be documented
++     * @param inheritedTree the content tree to which the inherited summary anchor will be added
++     */
++    public abstract void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree);
+ 
+-    protected void writeSummaryLink(ClassDoc cd, ProgramElementDoc member) {
+-        writeSummaryLink(LinkInfoImpl.CONTEXT_MEMBER, cd, member);
++    /**
++     * Add the summary type for the member.
++     *
++     * @param member the member to be documented
++     * @param tdSummaryType the content tree to which the type will be added
++     */
++    protected abstract void addSummaryType(ProgramElementDoc member,
++            Content tdSummaryType);
++
++    /**
++     * Add the summary link for the member.
++     *
++     * @param cd the class doc to be documented
++     * @param member the member to be documented
++     * @param tdSummary the content tree to which the link will be added
++     */
++    protected void addSummaryLink(ClassDoc cd, ProgramElementDoc member,
++            Content tdSummary) {
++        addSummaryLink(LinkInfoImpl.CONTEXT_MEMBER, cd, member, tdSummary);
+     }
+ 
+-    protected abstract void writeSummaryLink(int context,
+-                                             ClassDoc cd,
+-                                             ProgramElementDoc member);
++    /**
++     * Add the summary link for the member.
++     *
++     * @param context the id of the context where the link will be printed
++     * @param cd the class doc to be documented
++     * @param member the member to be documented
++     * @param tdSummary the content tree to which the summary link will be added
++     */
++    protected abstract void addSummaryLink(int context,
++            ClassDoc cd, ProgramElementDoc member, Content tdSummary);
+ 
+-    protected abstract void writeInheritedSummaryLink(ClassDoc cd,
+-                                                     ProgramElementDoc member);
++    /**
++     * Add the inherited summary link for the member.
++     *
++     * @param cd the class doc to be documented
++     * @param member the member to be documented
++     * @param linksTree the content tree to which the inherited summary link will be added
++     */
++    protected abstract void addInheritedSummaryLink(ClassDoc cd,
++            ProgramElementDoc member, Content linksTree);
+ 
+-    protected abstract void writeDeprecatedLink(ProgramElementDoc member);
++    /**
++     * Get the deprecated link.
++     *
++     * @param member the member being linked to
++     * @return a content tree representing the link
++     */
++    protected abstract Content getDeprecatedLink(ProgramElementDoc member);
+ 
+-    protected abstract void printNavSummaryLink(ClassDoc cd, boolean link);
++    /**
++     * Get the navigation summary link.
++     *
++     * @param cd the class doc to be documented
++     * @param link true if its a link else the label to be printed
++     * @return a content tree for the navigation summary link.
++     */
++    protected abstract Content getNavSummaryLink(ClassDoc cd, boolean link);
+ 
+-    protected abstract void printNavDetailLink(boolean link);
++    /**
++     * Add the navigation detail link.
++     *
++     * @param link true if its a link else the label to be printed
++     * @param liNav the content tree to which the navigation detail link will be added
++     */
++    protected abstract void addNavDetailLink(boolean link, Content liNav);
+ 
+     /***  ***/
+ 
+@@ -109,6 +199,17 @@
+     }
+ 
+     /**
++     * Add the member name to the content tree and modifies the display length.
++     *
++     * @param name the member name to be added to the content tree.
++     * @param htmltree the content tree to which the name will be added.
++     */
++    protected void addName(String name, Content htmltree) {
++        htmltree.addContent(name);
++        writer.displayLength += name.length();
++    }
++
++    /**
+      * Return a string describing the access modifier flags.
+      * Don't include native or synchronized.
+      *
+@@ -131,18 +232,24 @@
+         return type;
+     }
+ 
+-    protected void printModifiers(MemberDoc member) {
++    /**
++     * Add the modifier for the member.
++     *
++     * @param member the member for which teh modifier will be added.
++     * @param htmltree the content tree to which the modifier information will be added.
++     */
++    protected void addModifiers(MemberDoc member, Content htmltree) {
+         String mod = modifierString(member);
+         // According to JLS, we should not be showing public modifier for
+         // interface methods.
+         if ((member.isField() || member.isMethod()) &&
+             writer instanceof ClassWriterImpl &&
+-             ((ClassWriterImpl) writer).getClassDoc().isInterface()) {
++            ((ClassWriterImpl) writer).getClassDoc().isInterface()) {
+             mod = Util.replaceText(mod, "public", "").trim();
+         }
+         if(mod.length() > 0) {
+-            print(mod);
+-            print(' ');
++            htmltree.addContent(mod);
++            htmltree.addContent(writer.getSpace());
+         }
+     }
+ 
+@@ -158,66 +265,43 @@
+     }
+ 
+     /**
+-     * Print 'static' if static and type link.
++     * Add the modifier and type for the member in the member summary.
++     *
++     * @param member the member to add the type for
++     * @param type the type to add
++     * @param tdSummaryType the content tree to which the modified and type will be added
+      */
+-    protected void printStaticAndType(boolean isStatic, Type type) {
+-        writer.printTypeSummaryHeader();
+-        if (isStatic) {
+-            print("static");
+-        }
+-        writer.space();
+-        if (type != null) {
+-            writer.printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
+-                type));
+-        }
+-        writer.printTypeSummaryFooter();
+-    }
+-
+-    /**
+-     * Print the modifier and type for the member in the member summary.
+-     *
+-     * @param member the member to print the type for.
+-     * @param type   the type to print.
+-     */
+-    protected void printModifierAndType(ProgramElementDoc member, Type type) {
+-        writer.printTypeSummaryHeader();
+-        printModifier(member);
++    protected void addModifierAndType(ProgramElementDoc member, Type type,
++            Content tdSummaryType) {
++        HtmlTree code = new HtmlTree(HtmlTag.CODE);
++        addModifier(member, code);
+         if (type == null) {
+-            writer.space();
+             if (member.isClass()) {
+-                print("class");
++                code.addContent("class");
+             } else {
+-                print("interface");
++                code.addContent("interface");
+             }
++            code.addContent(writer.getSpace());
+         } else {
+             if (member instanceof ExecutableMemberDoc &&
+                     ((ExecutableMemberDoc) member).typeParameters().length > 0) {
+                 //Code to avoid ugly wrapping in member summary table.
+-                writer.table(0,0,0);
+-                writer.trAlignVAlign("right", "");
+-                writer.tdNowrap();
+-                writer.font("-1");
+-                writer.code();
+-                int displayLength = ((AbstractExecutableMemberWriter) this).
+-                writeTypeParameters((ExecutableMemberDoc) member);
++                int displayLength = ((AbstractExecutableMemberWriter) this).addTypeParameters(
++                        (ExecutableMemberDoc) member, code);
+                 if (displayLength > 10) {
+-                    writer.br();
++                    code.addContent(new HtmlTree(HtmlTag.BR));
+                 }
+-                writer.printLink(new LinkInfoImpl(
+-                    LinkInfoImpl.CONTEXT_SUMMARY_RETURN_TYPE, type));
+-                writer.codeEnd();
+-                writer.fontEnd();
+-                writer.tdEnd();
+-                writer.trEnd();
+-                writer.tableEnd();
++                code.addContent(new RawHtml(
++                        writer.getLink(new LinkInfoImpl(
++                        LinkInfoImpl.CONTEXT_SUMMARY_RETURN_TYPE, type))));
+             } else {
+-                writer.space();
+-                writer.printLink(new LinkInfoImpl(
+-                    LinkInfoImpl.CONTEXT_SUMMARY_RETURN_TYPE, type));
++                code.addContent(new RawHtml(
++                        writer.getLink(new LinkInfoImpl(
++                        LinkInfoImpl.CONTEXT_SUMMARY_RETURN_TYPE, type))));
+             }
+ 
+         }
+-        writer.printTypeSummaryFooter();
++        tdSummaryType.addContent(code);
+     }
+ 
+     private void printModifier(ProgramElementDoc member) {
+@@ -238,25 +322,53 @@
+     }
+ 
+     /**
+-     * Print the deprecated output for the given member.
++     * Add the modifier for the member.
++     *
++     * @param member the member to add the type for
++     * @param code the content tree to which the modified will be added
++     */
++    private void addModifier(ProgramElementDoc member, Content code) {
++        if (member.isProtected()) {
++            code.addContent("protected ");
++        } else if (member.isPrivate()) {
++            code.addContent("private ");
++        } else if (!member.isPublic()) { // Package private
++            code.addContent(configuration().getText("doclet.Package_private"));
++            code.addContent(" ");
++        }
++        if (member.isMethod() && ((MethodDoc)member).isAbstract()) {
++            code.addContent("abstract ");
++        }
++        if (member.isStatic()) {
++            code.addContent("static ");
++        }
++    }
++
++    /**
++     * Add the deprecated information for the given member.
+      *
+      * @param member the member being documented.
++     * @param contentTree the content tree to which the deprecated information will be added.
+      */
+-    protected void printDeprecated(ProgramElementDoc member) {
++    protected void addDeprecatedInfo(ProgramElementDoc member, Content contentTree) {
+         String output = (new DeprecatedTaglet()).getTagletOutput(member,
+             writer.getTagletWriterInstance(false)).toString().trim();
+         if (!output.isEmpty()) {
+-            writer.printMemberDetailsListStartTag();
+-            writer.print(output);
++            Content deprecatedContent = new RawHtml(output);
++            Content div = HtmlTree.DIV(HtmlStyle.block, deprecatedContent);
++            contentTree.addContent(div);
+         }
+     }
+ 
+-    protected void printComment(ProgramElementDoc member) {
++    /**
++     * Add the comment for the given member.
++     *
++     * @param member the member being documented.
++     * @param contentTree the content tree to which the comment will be added.
++     */
++    protected void addComment(ProgramElementDoc member, Content htmltree) {
+         if (member.inlineTags().length > 0) {
+-            writer.printMemberDetailsListStartTag();
+-            writer.dd();
+-            writer.printInlineComment(member);
+-            writer.ddEnd();
++            writer.addInlineComment(member, htmltree);
+         }
+     }
+ 
+@@ -264,67 +376,19 @@
+         return member.name();
+     }
+ 
+-    protected void printHead(MemberDoc member) {
+-        writer.h3();
+-        writer.print(member.name());
+-        writer.h3End();
+-    }
+-
+-    protected void printFullComment(ProgramElementDoc member) {
+-        if(configuration().nocomment){
+-            return;
+-        }
+-        writer.dl();
+-        print(((TagletOutputImpl)
+-            (new DeprecatedTaglet()).getTagletOutput(member,
+-            writer.getTagletWriterInstance(false))).toString());
+-        printCommentAndTags(member);
+-        writer.dlEnd();
+-    }
+-
+-    protected void printCommentAndTags(ProgramElementDoc member) {
+-        printComment(member);
+-        writer.printTags(member);
++    /**
++     * Get the header for the section.
++     *
++     * @param member the member being documented.
++     * @return a header content for the section.
++     */
++    protected Content getHead(MemberDoc member) {
++        Content memberContent = new RawHtml(member.name());
++        Content heading = HtmlTree.HEADING(HtmlConstants.MEMBER_HEADING, memberContent);
++        return heading;
+     }
+ 
+     /**
+-     * Write the member footer.
+-     */
+-    protected void printMemberFooter() {
+-        writer.printMemberDetailsListEndTag();
+-        assert !writer.getMemberDetailsListPrinted();
+-    }
+-
+-    /**
+-     * Forward to containing writer
+-     */
+-    public void printSummaryHeader(ClassDoc cd) {
+-        printedSummaryHeader = true;
+-        writer.printSummaryHeader(this, cd);
+-    }
+-
+-    /**
+-     * Forward to containing writer
+-     */
+-    public void printInheritedSummaryHeader(ClassDoc cd) {
+-        writer.printInheritedSummaryHeader(this, cd);
+-    }
+-
+-    /**
+-     * Forward to containing writer
+-     */
+-    public void printInheritedSummaryFooter(ClassDoc cd) {
+-        writer.printInheritedSummaryFooter(this, cd);
+-    }
+-
+-    /**
+-     * Forward to containing writer
+-     */
+-    public void printSummaryFooter(ClassDoc cd) {
+-        writer.printSummaryFooter(this, cd);
+-    }
+-
+-   /**
+     * Return true if the given <code>ProgramElement</code> is inherited
+     * by the class that is being documented.
+     *
+@@ -340,102 +404,134 @@
+         return true;
+     }
+ 
+-
+     /**
+-     * Generate the code for listing the deprecated APIs. Create the table
+-     * format for listing the API. Call methods from the sub-class to complete
+-     * the generation.
++     * Add deprecated information to the documentation tree
++     *
++     * @param deprmembers list of deprecated members
++     * @param headingKey the caption for the deprecated members table
++     * @param tableSummary the summary for the deprecated members table
++     * @param tableHeader table headers for the deprecated members table
++     * @param contentTree the content tree to which the deprecated members table will be added
+      */
+-    protected void printDeprecatedAPI(List<Doc> deprmembers, String headingKey, String tableSummary, String[] tableHeader) {
++    protected void addDeprecatedAPI(List<Doc> deprmembers, String headingKey,
++            String tableSummary, String[] tableHeader, Content contentTree) {
+         if (deprmembers.size() > 0) {
+-            writer.tableIndexSummary(tableSummary);
+-            writer.tableCaptionStart();
+-            writer.printText(headingKey);
+-            writer.tableCaptionEnd();
+-            writer.summaryTableHeader(tableHeader, "col");
++            Content table = HtmlTree.TABLE(0, 3, 0, tableSummary,
++                writer.getTableCaption(configuration().getText(headingKey)));
++            table.addContent(writer.getSummaryTableHeader(tableHeader, "col"));
++            Content tbody = new HtmlTree(HtmlTag.TBODY);
+             for (int i = 0; i < deprmembers.size(); i++) {
+                 ProgramElementDoc member =(ProgramElementDoc)deprmembers.get(i);
+-                writer.trBgcolorStyle("white", "TableRowColor");
+-                writer.summaryRow(0);
+-                writeDeprecatedLink(member);
+-                writer.br();
+-                writer.printNbsps();
++                HtmlTree td = HtmlTree.TD(HtmlStyle.colOne, getDeprecatedLink(member));
+                 if (member.tags("deprecated").length > 0)
+-                    writer.printInlineDeprecatedComment(member, member.tags("deprecated")[0]);
+-                writer.space();
+-                writer.summaryRowEnd();
+-                writer.trEnd();
++                    writer.addInlineDeprecatedComment(member,
++                            member.tags("deprecated")[0], td);
++                HtmlTree tr = HtmlTree.TR(td);
++                if (i%2 == 0)
++                    tr.addStyle(HtmlStyle.altColor);
++                else
++                    tr.addStyle(HtmlStyle.rowColor);
++                tbody.addContent(tr);
+             }
+-            writer.tableEnd();
+-            writer.space();
+-            writer.p();
++            table.addContent(tbody);
++            Content li = HtmlTree.LI(HtmlStyle.blockList, table);
++            Content ul = HtmlTree.UL(HtmlStyle.blockList, li);
++            contentTree.addContent(ul);
+         }
+     }
+ 
+     /**
+-     * Print use info.
++     * Add use information to the documentation tree.
++     *
++     * @param mems list of program elements for which the use information will be added
++     * @param heading the section heading
++     * @param tableSummary the summary for the use table
++     * @param contentTree the content tree to which the use information will be added
+      */
+-    protected void printUseInfo(List<? extends ProgramElementDoc> mems, String heading, String tableSummary) {
++    protected void addUseInfo(List<? extends ProgramElementDoc> mems,
++            String heading, String tableSummary, Content contentTree) {
+         if (mems == null) {
+             return;
+         }
+         List members = (List)mems;
+         boolean printedUseTableHeader = false;
+         if (members.size() > 0) {
+-            writer.tableIndexSummary(tableSummary);
+-            writer.tableSubCaptionStart();
+-            writer.print(heading);
+-            writer.tableCaptionEnd();
+-            for (Iterator it = members.iterator(); it.hasNext(); ) {
++            Content table = HtmlTree.TABLE(0, 3, 0, tableSummary,
++                    writer.getTableCaption(heading));
++            Content tbody = new HtmlTree(HtmlTag.TBODY);
++            Iterator<? extends ProgramElementDoc> it = members.iterator();
++            for (int i = 0; it.hasNext(); i++) {
+                 ProgramElementDoc pgmdoc = (ProgramElementDoc)it.next();
+                 ClassDoc cd = pgmdoc.containingClass();
+                 if (!printedUseTableHeader) {
+-                    // Passing ProgramElementDoc helps decides printing
+-                    // interface or class header in case of nested classes.
+-                    this.printSummaryTableHeader(pgmdoc);
++                    table.addContent(writer.getSummaryTableHeader(
++                            this.getSummaryTableHeader(pgmdoc), "col"));
+                     printedUseTableHeader = true;
+                 }
+-
+-                writer.printSummaryLinkType(this, pgmdoc);
++                HtmlTree tr = new HtmlTree(HtmlTag.TR);
++                if (i % 2 == 0) {
++                    tr.addStyle(HtmlStyle.altColor);
++                } else {
++                    tr.addStyle(HtmlStyle.rowColor);
++                }
++                HtmlTree tdFirst = new HtmlTree(HtmlTag.TD);
++                tdFirst.addStyle(HtmlStyle.colFirst);
++                writer.addSummaryType(this, pgmdoc, tdFirst);
++                tr.addContent(tdFirst);
++                HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
++                tdLast.addStyle(HtmlStyle.colLast);
+                 if (cd != null && !(pgmdoc instanceof ConstructorDoc)
+-                               && !(pgmdoc instanceof ClassDoc)) {
+-                    // Add class context
+-                    writer.strong(cd.name() + ".");
++                        && !(pgmdoc instanceof ClassDoc)) {
++                    HtmlTree name = new HtmlTree(HtmlTag.SPAN);
++                    name.addStyle(HtmlStyle.strong);
++                    name.addContent(cd.name() + ".");
++                    tdLast.addContent(name);
+                 }
+-                writeSummaryLink(
+-                    pgmdoc instanceof ClassDoc ?
+-                        LinkInfoImpl.CONTEXT_CLASS_USE : LinkInfoImpl.CONTEXT_MEMBER,
+-                    cd, pgmdoc);
+-                writer.printSummaryLinkComment(this, pgmdoc);
++                addSummaryLink(pgmdoc instanceof ClassDoc ?
++                    LinkInfoImpl.CONTEXT_CLASS_USE : LinkInfoImpl.CONTEXT_MEMBER,
++                    cd, pgmdoc, tdLast);
++                writer.addSummaryLinkComment(this, pgmdoc, tdLast);
++                tr.addContent(tdLast);
++                tbody.addContent(tr);
+             }
+-            writer.tableEnd();
+-            writer.space();
+-            writer.p();
++            table.addContent(tbody);
++            contentTree.addContent(table);
+         }
+     }
+ 
+-    protected void navDetailLink(List members) {
+-            printNavDetailLink(members.size() > 0? true: false);
++    /**
++     * Add the navigation detail link.
++     *
++     * @param members the members to be linked
++     * @param liNav the content tree to which the navigation detail link will be added
++     */
++    protected void addNavDetailLink(List<?> members, Content liNav) {
++        addNavDetailLink(members.size() > 0 ? true : false, liNav);
+     }
+ 
+-
+-    protected void navSummaryLink(List members,
+-            VisibleMemberMap visibleMemberMap) {
++    /**
++     * Add the navigation summary link.
++     *
++     * @param members members to be linked
++     * @param visibleMemberMap the visible inherited members map
++     * @param liNav the content tree to which the navigation summary link will be added
++     */
++    protected void addNavSummaryLink(List<?> members,
++            VisibleMemberMap visibleMemberMap, Content liNav) {
+         if (members.size() > 0) {
+-            printNavSummaryLink(null, true);
++            liNav.addContent(getNavSummaryLink(null, true));
+             return;
+-        } else {
+-            ClassDoc icd = classdoc.superclass();
+-            while (icd != null) {
+-                List inhmembers = visibleMemberMap.getMembersFor(icd);
+-                if (inhmembers.size() > 0) {
+-                    printNavSummaryLink(icd, true);
+-                    return;
+-                }
+-                icd = icd.superclass();
++        }
++        ClassDoc icd = classdoc.superclass();
++        while (icd != null) {
++            List<?> inhmembers = visibleMemberMap.getMembersFor(icd);
++            if (inhmembers.size() > 0) {
++                liNav.addContent(getNavSummaryLink(icd, true));
++                return;
+             }
++            icd = icd.superclass();
+         }
+-        printNavSummaryLink(null, false);
++        liNav.addContent(getNavSummaryLink(null, false));
+     }
+ 
+     protected void serialWarning(SourcePosition pos, String key, String a1, String a2) {
+@@ -453,12 +549,109 @@
+     }
+ 
+     /**
+-     * {@inheritDoc}
++     * Add the member summary for the given class.
++     *
++     * @param classDoc the class that is being documented
++     * @param member the member being documented
++     * @param firstSentenceTags the first sentence tags to be added to the summary
++     * @param tableTree the content tree to which the documentation will be added
++     * @param counter the counter for determing style for the table row
+      */
+-    public void writeMemberSummary(ClassDoc classDoc, ProgramElementDoc member,
+-        Tag[] firstSentenceTags, boolean isFirst, boolean isLast) {
+-        writer.printSummaryLinkType(this, member);
+-        writeSummaryLink(classDoc, member);
+-        writer.printSummaryLinkComment(this, member, firstSentenceTags);
++    public void addMemberSummary(ClassDoc classDoc, ProgramElementDoc member,
++            Tag[] firstSentenceTags, Content tableTree, int counter) {
++        HtmlTree tdSummaryType = new HtmlTree(HtmlTag.TD);
++        tdSummaryType.addStyle(HtmlStyle.colFirst);
++        writer.addSummaryType(this, member, tdSummaryType);
++        HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
++        setSummaryColumnStyle(tdSummary);
++        addSummaryLink(classDoc, member, tdSummary);
++        writer.addSummaryLinkComment(this, member, firstSentenceTags, tdSummary);
++        HtmlTree tr = HtmlTree.TR(tdSummaryType);
++        tr.addContent(tdSummary);
++        if (counter%2 == 0)
++            tr.addStyle(HtmlStyle.altColor);
++        else
++            tr.addStyle(HtmlStyle.rowColor);
++        tableTree.addContent(tr);
++    }
++
++    /**
++     * Set the style for the summary column.
++     *
++     * @param tdTree the column for which the style will be set
++     */
++    public void setSummaryColumnStyle(HtmlTree tdTree) {
++        tdTree.addStyle(HtmlStyle.colLast);
++    }
++
++    /**
++     * Add inherited member summary for the given class and member.
++     *
++     * @param classDoc the class the inherited member belongs to
++     * @param nestedClass the inherited member that is summarized
++     * @param isFirst true if this is the first member in the list
++     * @param isLast true if this is the last member in the list
++     * @param linksTree the content tree to which the summary will be added
++     */
++    public void addInheritedMemberSummary(ClassDoc classDoc,
++            ProgramElementDoc nestedClass, boolean isFirst, boolean isLast,
++            Content linksTree) {
++        writer.addInheritedMemberSummary(this, classDoc, nestedClass, isFirst,
++                linksTree);
++    }
++
++    /**
++     * Get the inherited summary header for the given class.
++     *
++     * @param classDoc the class the inherited member belongs to
++     * @return a content tree for the inherited summary header
++     */
++    public Content getInheritedSummaryHeader(ClassDoc classDoc) {
++        Content inheritedTree = writer.getMemberTreeHeader();
++        writer.addInheritedSummaryHeader(this, classDoc, inheritedTree);
++        return inheritedTree;
++    }
++
++    /**
++     * Get the inherited summary links tree.
++     *
++     * @return a content tree for the inherited summary links
++     */
++    public Content getInheritedSummaryLinksTree() {
++        return new HtmlTree(HtmlTag.CODE);
++    }
++
++    /**
++     * Get the summary table tree for the given class.
++     *
++     * @param classDoc the class for which the summary table is generated
++     * @return a content tree for the summary table
++     */
++    public Content getSummaryTableTree(ClassDoc classDoc) {
++        return writer.getSummaryTableTree(this, classDoc);
++    }
++
++    /**
++     * Get the member tree to be documented.
++     *
++     * @param memberTree the content tree of member to be documented
++     * @return a content tree that will be added to the class documentation
++     */
++    public Content getMemberTree(Content memberTree) {
++        return writer.getMemberTree(memberTree);
++    }
++
++    /**
++     * Get the member tree to be documented.
++     *
++     * @param memberTree the content tree of member to be documented
++     * @param isLastContent true if the content to be added is the last content
++     * @return a content tree that will be added to the class documentation
++     */
++    public Content getMemberTree(Content memberTree, boolean isLastContent) {
++        if (isLastContent)
++            return HtmlTree.UL(HtmlStyle.blockListLast, memberTree);
++        else
++            return HtmlTree.UL(HtmlStyle.blockList, memberTree);
+     }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java
+@@ -25,9 +25,11 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
+-import com.sun.javadoc.*;
+ import java.io.*;
+ import java.util.*;
++import com.sun.javadoc.*;
++import com.sun.tools.doclets.formats.html.markup.*;
++import com.sun.tools.doclets.internal.toolkit.*;
+ 
+ /**
+  * Abstract class to generate the overview files in
+@@ -56,105 +58,127 @@
+         packages = configuration.packages;
+     }
+ 
+-    protected abstract void printNavigationBarHeader();
+-
+-    protected abstract void printNavigationBarFooter();
+-
+-    protected abstract void printOverviewHeader();
+-
+-    protected abstract void printIndexHeader(String text, String tableSummary);
+-
+-    protected abstract void printIndexRow(PackageDoc pkg);
+-
+-    protected abstract void printIndexFooter();
++    /**
++     * Adds the navigation bar header to the documentation tree.
++     *
++     * @param body the document tree to which the navigation bar header will be added
++     */
++    protected abstract void addNavigationBarHeader(Content body);
+ 
+     /**
+-     * Generate the contants in the package index file. Call appropriate
++     * Adds the navigation bar footer to the documentation tree.
++     *
++     * @param body the document tree to which the navigation bar footer will be added
++     */
++    protected abstract void addNavigationBarFooter(Content body);
++
++    /**
++     * Adds the overview header to the documentation tree.
++     *
++     * @param body the document tree to which the overview header will be added
++     */
++    protected abstract void addOverviewHeader(Content body);
++
++    /**
++     * Adds the packages list to the documentation tree.
++     *
++     * @param packages an array of packagedoc objects
++     * @param text caption for the table
++     * @param tableSummary summary for the table
++     * @param body the document tree to which the packages list will be added
++     */
++    protected abstract void addPackagesList(PackageDoc[] packages, String text,
++            String tableSummary, Content body);
++
++    /**
++     * Generate and prints the contents in the package index file. Call appropriate
+      * methods from the sub-class in order to generate Frame or Non
+      * Frame format.
++     *
+      * @param title the title of the window.
+      * @param includeScript boolean set true if windowtitle script is to be included
+      */
+-    protected void generatePackageIndexFile(String title, boolean includeScript) throws IOException {
++    protected void buildPackageIndexFile(String title, boolean includeScript) throws IOException {
+         String windowOverview = configuration.getText(title);
+-        printHtmlHeader(windowOverview,
+-            configuration.metakeywords.getOverviewMetaKeywords(title,
+-                configuration.doctitle),
+-            includeScript);
+-        printNavigationBarHeader();
+-        printOverviewHeader();
+-
+-        generateIndex();
+-
+-        printOverview();
+-
+-        printNavigationBarFooter();
+-        printBodyHtmlEnd();
++        Content body = getBody(includeScript, getWindowTitle(windowOverview));
++        addNavigationBarHeader(body);
++        addOverviewHeader(body);
++        addIndex(body);
++        addOverview(body);
++        addNavigationBarFooter(body);
++        printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title,
++                configuration.doctitle), includeScript, body);
+     }
+ 
+     /**
+-     * Default to no overview, overwrite to add overview.
++     * Default to no overview, override to add overview.
++     *
++     * @param body the document tree to which the overview will be added
+      */
+-    protected void printOverview() throws IOException {
++    protected void addOverview(Content body) throws IOException {
+     }
+ 
+     /**
+-     * Generate the frame or non-frame package index.
++     * Adds the frame or non-frame package index to the documentation tree.
++     *
++     * @param body the document tree to which the index will be added
+      */
+-    protected void generateIndex() {
+-        printIndexContents(packages, "doclet.Package_Summary",
++    protected void addIndex(Content body) {
++        addIndexContents(packages, "doclet.Package_Summary",
+                 configuration.getText("doclet.Member_Table_Summary",
+                 configuration.getText("doclet.Package_Summary"),
+-                configuration.getText("doclet.packages")));
++                configuration.getText("doclet.packages")), body);
+     }
+ 
+     /**
+-     * Generate code for package index contents. Call appropriate methods from
+-     * the sub-classes.
++     * Adds package index contents. Call appropriate methods from
++     * the sub-classes. Adds it to the body HtmlTree
+      *
+-     * @param packages Array of packages to be documented.
+-     * @param text     String which will be used as the heading.
++     * @param packages array of packages to be documented
++     * @param text string which will be used as the heading
++     * @param tableSummary summary for the table
++     * @param body the document tree to which the index contents will be added
+      */
+-    protected void printIndexContents(PackageDoc[] packages, String text, String tableSummary) {
++    protected void addIndexContents(PackageDoc[] packages, String text,
++            String tableSummary, Content body) {
+         if (packages.length > 0) {
+             Arrays.sort(packages);
+-            printIndexHeader(text, tableSummary);
+-            printAllClassesPackagesLink();
+-            for(int i = 0; i < packages.length; i++) {
+-                if (packages[i] != null) {
+-                    printIndexRow(packages[i]);
+-                }
+-            }
+-            printIndexFooter();
++            addAllClassesLink(body);
++            addPackagesList(packages, text, tableSummary, body);
+         }
+     }
+ 
+     /**
+-     * Print the doctitle, if it is specified on the command line.
++     * Adds the doctitle to the documentation tree, if it is specified on the command line.
++     *
++     * @param body the document tree to which the title will be added
+      */
+-    protected void printConfigurationTitle() {
++    protected void addConfigurationTitle(Content body) {
+         if (configuration.doctitle.length() > 0) {
+-            center();
+-            h1(configuration.doctitle);
+-            centerEnd();
++            Content title = new RawHtml(configuration.doctitle);
++            Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING,
++                    HtmlStyle.title, title);
++            Content div = HtmlTree.DIV(HtmlStyle.header, heading);
++            body.addContent(div);
+         }
+     }
+ 
+     /**
+-     * Highlight "Overview" in the strong format, in the navigation bar as this
+-     * is the overview page.
++     * Returns highlighted "Overview", in the navigation bar as this is the
++     * overview page.
++     *
++     * @return a Content object to be added to the documentation tree
+      */
+-    protected void navLinkContents() {
+-        navCellRevStart();
+-        fontStyle("NavBarFont1Rev");
+-        strongText("doclet.Overview");
+-        fontEnd();
+-        navCellEnd();
++    protected Content getNavLinkContents() {
++        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, overviewLabel);
++        return li;
+     }
+ 
+     /**
+      * Do nothing. This will be overridden in PackageIndexFrameWriter.
++     *
++     * @param body the document tree to which the all classes link will be added
+      */
+-    protected void printAllClassesPackagesLink() {
++    protected void addAllClassesLink(Content body) {
+     }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java
+@@ -25,11 +25,12 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
+-import com.sun.tools.doclets.internal.toolkit.util.*;
+-
+-import com.sun.javadoc.*;
+ import java.io.*;
+ import java.util.*;
++import com.sun.tools.doclets.internal.toolkit.util.*;
++import com.sun.tools.doclets.internal.toolkit.*;
++import com.sun.tools.doclets.formats.html.markup.*;
++import com.sun.javadoc.*;
+ 
+ /**
+  * Abstract class to print the class hierarchy page for all the Classes. This
+@@ -46,6 +47,8 @@
+      */
+     protected final ClassTree classtree;
+ 
++    private static final String LI_CIRCLE  = "circle";
++
+     /**
+      * Constructor initilises classtree variable. This constructor will be used
+      * while generating global tree file "overview-tree.html".
+@@ -87,55 +90,64 @@
+     }
+ 
+     /**
+-     * Generate each level of the class tree. For each sub-class or
++     * Add each level of the class tree. For each sub-class or
+      * sub-interface indents the next level information.
+-     * Recurses itself to generate subclasses info.
+-     * To iterate is human, to recurse is divine - L. Peter Deutsch.
++     * Recurses itself to add subclasses info.
+      *
+-     * @param parent the superclass or superinterface of the list.
+-     * @param list list of the sub-classes at this level.
+-     * @param isEnum true if we are generating a tree for enums.
++     * @param parent the superclass or superinterface of the list
++     * @param list list of the sub-classes at this level
++     * @param isEnum true if we are generating a tree for enums
++     * @param contentTree the content tree to which the level information will be added
+      */
+-    protected void generateLevelInfo(ClassDoc parent, List list,
+-            boolean isEnum) {
+-        if (list.size() > 0) {
+-            ul();
+-            for (int i = 0; i < list.size(); i++) {
++    protected void addLevelInfo(ClassDoc parent, List<ClassDoc> list,
++            boolean isEnum, Content contentTree) {
++        int size = list.size();
++        if (size > 0) {
++            Content ul = new HtmlTree(HtmlTag.UL);
++            for (int i = 0; i < size; i++) {
+                 ClassDoc local = (ClassDoc)list.get(i);
+-                printPartialInfo(local);
+-                printExtendsImplements(parent, local);
+-                generateLevelInfo(local, classtree.subs(local, isEnum),
+-                    isEnum);   // Recurse
++                HtmlTree li = new HtmlTree(HtmlTag.LI);
++                li.addAttr(HtmlAttr.TYPE, LI_CIRCLE);
++                addPartialInfo(local, li);
++                addExtendsImplements(parent, local, li);
++                addLevelInfo(local, classtree.subs(local, isEnum),
++                        isEnum, li);   // Recurse
++                ul.addContent(li);
+             }
+-            ulEnd();
++            contentTree.addContent(ul);
+         }
+     }
+ 
+     /**
+-     * Generate the heading for the tree depending upon tree type if it's a
+-     * Class Tree or Interface tree and also print the tree.
++     * Add the heading for the tree depending upon tree type if it's a
++     * Class Tree or Interface tree.
+      *
+      * @param list List of classes which are at the most base level, all the
+-     * other classes in this run will derive from these classes.
+-     * @param heading Heading for the tree.
++     * other classes in this run will derive from these classes
++     * @param heading heading for the tree
++     * @param div the content tree to which the tree will be added
+      */
+-    protected void generateTree(List list, String heading) {
++    protected void addTree(List<ClassDoc> list, String heading, Content div) {
+         if (list.size() > 0) {
+             ClassDoc firstClassDoc = (ClassDoc)list.get(0);
+-            printTreeHeading(heading);
+-            generateLevelInfo(!firstClassDoc.isInterface()? firstClassDoc : null,
+-                list,
+-                list == classtree.baseEnums());
++            Content headingContent = getResource(heading);
++            div.addContent(HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true,
++                    headingContent));
++            addLevelInfo(!firstClassDoc.isInterface()? firstClassDoc : null,
++                    list, list == classtree.baseEnums(), div);
+         }
+     }
+ 
+     /**
+-     * Print the information regarding the classes which this class extends or
++     * Add information regarding the classes which this class extends or
+      * implements.
+      *
+-     * @param cd The classdoc under consideration.
++     * @param parent the parent class of the class being documented
++     * @param cd the classdoc under consideration
++     * @param contentTree the content tree to which the information will be added
+      */
+-    protected void printExtendsImplements(ClassDoc parent, ClassDoc cd) {
++    protected void addExtendsImplements(ClassDoc parent, ClassDoc cd,
++            Content contentTree) {
+         ClassDoc[] interfaces = cd.interfaces();
+         if (interfaces.length > (cd.isInterface()? 1 : 0)) {
+             Arrays.sort(interfaces);
+@@ -148,53 +160,43 @@
+                     }
+                     if (counter == 0) {
+                         if (cd.isInterface()) {
+-                            print(" (" + configuration.getText("doclet.also") + " extends ");
++                            contentTree.addContent(" (");
++                            contentTree.addContent(getResource("doclet.also"));
++                            contentTree.addContent(" extends ");
+                         } else {
+-                            print(" (implements ");
++                            contentTree.addContent(" (implements ");
+                         }
+                     } else {
+-                        print(", ");
++                        contentTree.addContent(", ");
+                     }
+-                    printPreQualifiedClassLink(LinkInfoImpl.CONTEXT_TREE,
+-                        interfaces[i]);
++                    addPreQualifiedClassLink(LinkInfoImpl.CONTEXT_TREE,
++                            interfaces[i], contentTree);
+                     counter++;
+                 }
+             }
+             if (counter > 0) {
+-                println(")");
++                contentTree.addContent(")");
+             }
+         }
+     }
+ 
+     /**
+-     * Print information about the class kind, if it's a "class" or "interface".
++     * Add information about the class kind, if it's a "class" or "interface".
+      *
+-     * @param cd classdoc.
++     * @param cd the class being documented
++     * @param contentTree the content tree to which the information will be added
+      */
+-    protected void printPartialInfo(ClassDoc cd) {
+-        li("circle");
+-        printPreQualifiedStrongClassLink(LinkInfoImpl.CONTEXT_TREE, cd);
++    protected void addPartialInfo(ClassDoc cd, Content contentTree) {
++        addPreQualifiedStrongClassLink(LinkInfoImpl.CONTEXT_TREE, cd, contentTree);
+     }
+ 
+     /**
+-     * Print the heading for the tree.
++     * Get the tree label for the navigation bar.
+      *
+-     * @param heading Heading for the tree.
++     * @return a content tree for the tree label
+      */
+-    protected void printTreeHeading(String heading) {
+-        h2();
+-        println(configuration.getText(heading));
+-        h2End();
+-    }
+-
+-    /**
+-     * Highlight "Tree" word in the navigation bar, since this is the tree page.
+-     */
+-    protected void navLinkTree() {
+-        navCellRevStart();
+-        fontStyle("NavBarFont1Rev");
+-        strongText("doclet.Tree");
+-        fontEnd();
+-        navCellEnd();
++    protected Content getNavLinkTree() {
++        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, treeLabel);
++        return li;
+     }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java
+@@ -25,11 +25,14 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
+-import com.sun.tools.doclets.internal.toolkit.util.*;
+-import com.sun.javadoc.*;
+ import java.io.*;
+ import java.util.*;
+ 
++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.*;
++
+ /**
+  * Generate the file with list of all the classes in this run. This page will be
+  * used in the left-hand bottom frame, when "All Classes" link is clicked in
+@@ -38,6 +41,7 @@
+  *
+  * @author Atul M Dambalkar
+  * @author Doug Kramer
++ * @author Bhavesh Patel (Modified)
+  */
+ public class AllClassesFrameWriter extends HtmlDocletWriter {
+ 
+@@ -57,6 +61,11 @@
+     protected IndexBuilder indexbuilder;
+ 
+     /**
++     * BR tag to be used within a document tree.
++     */
++    final HtmlTree BR = new HtmlTree(HtmlTag.BR);
++
++    /**
+      * Construct AllClassesFrameWriter object. Also initilises the indexbuilder
+      * variable in this class.
+      * @throws IOException
+@@ -84,12 +93,12 @@
+         try {
+             allclassgen = new AllClassesFrameWriter(configuration,
+                                                     filename, indexbuilder);
+-            allclassgen.generateAllClassesFile(true);
++            allclassgen.buildAllClassesFile(true);
+             allclassgen.close();
+             filename = OUTPUT_FILE_NAME_NOFRAMES;
+             allclassgen = new AllClassesFrameWriter(configuration,
+                                                     filename, indexbuilder);
+-            allclassgen.generateAllClassesFile(false);
++            allclassgen.buildAllClassesFile(false);
+             allclassgen.close();
+         } catch (IOException exc) {
+             configuration.standardmessage.
+@@ -100,30 +109,34 @@
+     }
+ 
+     /**
+-     * Print all the classes in table format in the file.
++     * Print all the classes in the file.
+      * @param wantFrames True if we want frames.
+      */
+-    protected void generateAllClassesFile(boolean wantFrames) throws IOException {
++    protected void buildAllClassesFile(boolean wantFrames) throws IOException {
+         String label = configuration.getText("doclet.All_Classes");
+-
+-        printHtmlHeader(label, null, false);
+-
+-        printAllClassesTableHeader();
+-        printAllClasses(wantFrames);
+-        printAllClassesTableFooter();
+-
+-        printBodyHtmlEnd();
++        Content body = getBody(false, getWindowTitle(label));
++        Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING,
++                HtmlStyle.bar, allclassesLabel);
++        body.addContent(heading);
++        Content ul = new HtmlTree(HtmlTag.UL);
++        // Generate the class links and add it to the tdFont tree.
++        addAllClasses(ul, wantFrames);
++        Content div = HtmlTree.DIV(HtmlStyle.indexContainer, ul);
++        body.addContent(div);
++        printHtmlDocument(null, false, body);
+     }
+ 
+     /**
+-     * Use the sorted index of all the classes and print all the classes.
++     * Use the sorted index of all the classes and add all the classes to the
++     * content list.
+      *
++     * @param content HtmlTree content to which all classes information will be added
+      * @param wantFrames True if we want frames.
+      */
+-    protected void printAllClasses(boolean wantFrames) {
++    protected void addAllClasses(Content content, boolean wantFrames) {
+         for (int i = 0; i < indexbuilder.elements().length; i++) {
+             Character unicode = (Character)((indexbuilder.elements())[i]);
+-            generateContents(indexbuilder.getMemberList(unicode), wantFrames);
++            addContents(indexbuilder.getMemberList(unicode), wantFrames, content);
+         }
+     }
+ 
+@@ -136,46 +149,25 @@
+      *
+      * @param classlist Sorted list of classes.
+      * @param wantFrames True if we want frames.
++     * @param content HtmlTree content to which the links will be added
+      */
+-    protected void generateContents(List classlist, boolean wantFrames) {
++    protected void addContents(List<Doc> classlist, boolean wantFrames,
++            Content content) {
+         for (int i = 0; i < classlist.size(); i++) {
+             ClassDoc cd = (ClassDoc)(classlist.get(i));
+             if (!Util.isCoreClass(cd)) {
+                 continue;
+             }
+             String label = italicsClassName(cd, false);
++            Content linkContent;
+             if(wantFrames){
+-                printLink(new LinkInfoImpl(LinkInfoImpl.ALL_CLASSES_FRAME, cd,
+-                    label, "classFrame")
+-                );
++                linkContent = new RawHtml(getLink(new LinkInfoImpl(
++                        LinkInfoImpl.ALL_CLASSES_FRAME, cd, label, "classFrame")));
+             } else {
+-                printLink(new LinkInfoImpl(cd, label));
++                linkContent = new RawHtml(getLink(new LinkInfoImpl(cd, label)));
+             }
+-            br();
++            Content li = HtmlTree.LI(linkContent);
++            content.addContent(li);
+         }
+     }
+-
+-    /**
+-     * Print the heading "All Classes" and also print Html table tag.
+-     */
+-    protected void printAllClassesTableHeader() {
+-        fontSizeStyle("+1", "FrameHeadingFont");
+-        strongText("doclet.All_Classes");
+-        fontEnd();
+-        br();
+-        table();
+-        tr();
+-        tdNowrap();
+-        fontStyle("FrameItemFont");
+-    }
+-
+-    /**
+-     * Print Html closing table tag.
+-     */
+-    protected void printAllClassesTableFooter() {
+-        fontEnd();
+-        tdEnd();
+-        trEnd();
+-        tableEnd();
+-    }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java
+@@ -28,6 +28,7 @@
+ import java.io.*;
+ 
+ import com.sun.javadoc.*;
++import com.sun.tools.doclets.formats.html.markup.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+ 
+ /**
+@@ -54,29 +55,26 @@
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeMemberSummaryHeader(ClassDoc classDoc) {
+-        writer.println("<!-- =========== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY =========== -->");
+-        writer.println();
+-        writer.printSummaryHeader(this, classDoc);
++    public Content getMemberSummaryHeader(ClassDoc classDoc,
++            Content memberSummaryTree) {
++        memberSummaryTree.addContent(
++                HtmlConstants.START_OF_ANNOTATION_TYPE_OPTIONAL_MEMBER_SUMMARY);
++        Content memberTree = writer.getMemberTreeHeader();
++        writer.addSummaryHeader(this, classDoc, memberTree);
++        return memberTree;
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeDefaultValueInfo(MemberDoc member) {
++    public void addDefaultValueInfo(MemberDoc member, Content annotationDocTree) {
+         if (((AnnotationTypeElementDoc) member).defaultValue() != null) {
+-            writer.printMemberDetailsListStartTag();
+-            writer.dd();
+-            writer.dl();
+-            writer.dt();
+-            writer.strong(ConfigurationImpl.getInstance().
+-                getText("doclet.Default"));
+-            writer.dtEnd();
+-            writer.dd();
+-            writer.print(((AnnotationTypeElementDoc) member).defaultValue());
+-            writer.ddEnd();
+-            writer.dlEnd();
+-            writer.ddEnd();
++            Content dt = HtmlTree.DT(writer.getResource("doclet.Default"));
++            Content dl = HtmlTree.DL(dt);
++            Content dd = HtmlTree.DD(new StringContent(
++                    ((AnnotationTypeElementDoc) member).defaultValue().toString()));
++            dl.addContent(dd);
++            annotationDocTree.addContent(dl);
+         }
+     }
+ 
+@@ -90,45 +88,58 @@
+     /**
+      * {@inheritDoc}
+      */
+-    public void printSummaryLabel() {
+-        writer.printText("doclet.Annotation_Type_Optional_Member_Summary");
++    public void addSummaryLabel(Content memberTree) {
++        Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
++                writer.getResource("doclet.Annotation_Type_Optional_Member_Summary"));
++        memberTree.addContent(label);
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void printTableSummary() {
+-        writer.tableIndexSummary(configuration().getText("doclet.Member_Table_Summary",
++    public String getTableSummary() {
++        return configuration().getText("doclet.Member_Table_Summary",
+                 configuration().getText("doclet.Annotation_Type_Optional_Member_Summary"),
+-                configuration().getText("doclet.annotation_type_optional_members")));
++                configuration().getText("doclet.annotation_type_optional_members"));
+     }
+ 
+-    public void printSummaryTableHeader(ProgramElementDoc member) {
++    /**
++     * {@inheritDoc}
++     */
++    public String getCaption() {
++        return configuration().getText("doclet.Annotation_Type_Optional_Members");
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public String[] getSummaryTableHeader(ProgramElementDoc member) {
+         String[] header = new String[] {
+             writer.getModifierTypeHeader(),
+             configuration().getText("doclet.0_and_1",
+                     configuration().getText("doclet.Annotation_Type_Optional_Member"),
+                     configuration().getText("doclet.Description"))
+         };
+-        writer.summaryTableHeader(header, "col");
++        return header;
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void printSummaryAnchor(ClassDoc cd) {
+-        writer.anchor("annotation_type_optional_element_summary");
++    public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
++        memberTree.addContent(writer.getMarkerAnchor(
++                "annotation_type_optional_element_summary"));
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    protected void printNavSummaryLink(ClassDoc cd, boolean link) {
++    protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
+         if (link) {
+-            writer.printHyperLink("", "annotation_type_optional_element_summary",
+-                    configuration().getText("doclet.navAnnotationTypeOptionalMember"));
++            return writer.getHyperLink("", "annotation_type_optional_element_summary",
++                    writer.getResource("doclet.navAnnotationTypeOptionalMember"));
+         } else {
+-            writer.printText("doclet.navAnnotationTypeOptionalMember");
++            return writer.getResource("doclet.navAnnotationTypeOptionalMember");
+         }
+     }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java
+@@ -28,6 +28,7 @@
+ import java.io.*;
+ 
+ import com.sun.javadoc.*;
++import com.sun.tools.doclets.formats.html.markup.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+ 
+ /**
+@@ -51,122 +52,102 @@
+     }
+ 
+     /**
+-     * Write the annotation type member summary header for the given class.
+-     *
+-     * @param classDoc the class the summary belongs to.
++     * {@inheritDoc}
+      */
+-    public void writeMemberSummaryHeader(ClassDoc classDoc) {
+-        writer.println("<!-- =========== ANNOTATION TYPE REQUIRED MEMBER SUMMARY =========== -->");
+-        writer.println();
+-        writer.printSummaryHeader(this, classDoc);
+-    }
+-
+-    /**
+-     * Write the annotation type member summary footer for the given class.
+-     *
+-     * @param classDoc the class the summary belongs to.
+-     */
+-    public void writeMemberSummaryFooter(ClassDoc classDoc) {
+-        writer.printSummaryFooter(this, classDoc);
++    public Content getMemberSummaryHeader(ClassDoc classDoc,
++            Content memberSummaryTree) {
++        memberSummaryTree.addContent(
++                HtmlConstants.START_OF_ANNOTATION_TYPE_REQUIRED_MEMBER_SUMMARY);
++        Content memberTree = writer.getMemberTreeHeader();
++        writer.addSummaryHeader(this, classDoc, memberTree);
++        return memberTree;
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeInheritedMemberSummaryHeader(ClassDoc classDoc) {
+-        //Not appliable.
++    public void addAnnotationDetailsTreeHeader(ClassDoc classDoc,
++            Content memberDetailsTree) {
++        if (!writer.printedAnnotationHeading) {
++            memberDetailsTree.addContent(writer.getMarkerAnchor(
++                    "annotation_type_element_detail"));
++            Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
++                    writer.annotationTypeDetailsLabel);
++            memberDetailsTree.addContent(heading);
++            writer.printedAnnotationHeading = true;
++        }
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeInheritedMemberSummary(ClassDoc classDoc,
+-        ProgramElementDoc member, boolean isFirst, boolean isLast) {
+-        //Not appliable.
++    public Content getAnnotationDocTreeHeader(MemberDoc member,
++            Content annotationDetailsTree) {
++        annotationDetailsTree.addContent(
++                writer.getMarkerAnchor(member.name() +
++                ((ExecutableMemberDoc) member).signature()));
++        Content annotationDocTree = writer.getMemberTreeHeader();
++        Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING);
++        heading.addContent(member.name());
++        annotationDocTree.addContent(heading);
++        return annotationDocTree;
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeInheritedMemberSummaryFooter(ClassDoc classDoc) {
+-        //Not appliable.
++    public Content getSignature(MemberDoc member) {
++        Content pre = new HtmlTree(HtmlTag.PRE);
++        writer.addAnnotationInfo(member, pre);
++        addModifiers(member, pre);
++        Content link = new RawHtml(
++                writer.getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
++                getType(member))));
++        pre.addContent(link);
++        pre.addContent(writer.getSpace());
++        if (configuration().linksource) {
++            Content memberName = new StringContent(member.name());
++            writer.addSrcLink(member, memberName, pre);
++        } else {
++            addName(member.name(), pre);
++        }
++        return pre;
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeHeader(ClassDoc classDoc, String header) {
+-        writer.println();
+-        writer.println("<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->");
+-        writer.println();
+-        writer.anchor("annotation_type_element_detail");
+-        writer.printTableHeadingBackground(header);
+-        writer.println();
++    public void addDeprecated(MemberDoc member, Content annotationDocTree) {
++        addDeprecatedInfo(member, annotationDocTree);
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeMemberHeader(MemberDoc member, boolean isFirst) {
+-        if (! isFirst) {
+-            writer.printMemberHeader();
+-            writer.println("");
+-        }
+-        writer.anchor(member.name() + ((ExecutableMemberDoc) member).signature());
+-        writer.h3();
+-        writer.print(member.name());
+-        writer.h3End();
++    public void addComments(MemberDoc member, Content annotationDocTree) {
++        addComment(member, annotationDocTree);
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeSignature(MemberDoc member) {
+-        writer.pre();
+-        writer.writeAnnotationInfo(member);
+-        printModifiers(member);
+-        writer.printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
+-            getType(member)));
+-        print(' ');
+-        if (configuration().linksource) {
+-            writer.printSrcLink(member, member.name());
+-        } else {
+-            strong(member.name());
+-        }
+-        writer.preEnd();
+-        assert !writer.getMemberDetailsListPrinted();
++    public void addTags(MemberDoc member, Content annotationDocTree) {
++        writer.addTagsInfo(member, annotationDocTree);
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeComments(MemberDoc member) {
+-        printComment(member);
++    public Content getAnnotationDetails(Content annotationDetailsTree) {
++        return getMemberTree(annotationDetailsTree);
+     }
+ 
+     /**
+-     * Write the tag output for the given member.
+-     *
+-     * @param member the member being documented.
++     * {@inheritDoc}
+      */
+-    public void writeTags(MemberDoc member) {
+-        writer.printTags(member);
+-    }
+-
+-    /**
+-     * Write the annotation type member footer.
+-     */
+-    public void writeMemberFooter() {
+-        printMemberFooter();
+-    }
+-
+-    /**
+-     * Write the footer for the annotation type member documentation.
+-     *
+-     * @param classDoc the class that the annotation type member belong to.
+-     */
+-    public void writeFooter(ClassDoc classDoc) {
+-        //No footer to write for annotation type member documentation
++    public Content getAnnotationDoc(Content annotationDocTree,
++            boolean isLastContent) {
++        return getMemberTree(annotationDocTree, isLastContent);
+     }
+ 
+     /**
+@@ -179,113 +160,120 @@
+     /**
+      * {@inheritDoc}
+      */
+-    public void printSummaryLabel() {
+-        writer.printText("doclet.Annotation_Type_Required_Member_Summary");
++    public void addSummaryLabel(Content memberTree) {
++        Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
++                writer.getResource("doclet.Annotation_Type_Required_Member_Summary"));
++        memberTree.addContent(label);
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void printTableSummary() {
+-        writer.tableIndexSummary(configuration().getText("doclet.Member_Table_Summary",
++    public String getTableSummary() {
++        return configuration().getText("doclet.Member_Table_Summary",
+                 configuration().getText("doclet.Annotation_Type_Required_Member_Summary"),
+-                configuration().getText("doclet.annotation_type_required_members")));
++                configuration().getText("doclet.annotation_type_required_members"));
+     }
+ 
+-    public void printSummaryTableHeader(ProgramElementDoc member) {
++    /**
++     * {@inheritDoc}
++     */
++    public String getCaption() {
++        return configuration().getText("doclet.Annotation_Type_Required_Members");
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public String[] getSummaryTableHeader(ProgramElementDoc member) {
+         String[] header = new String[] {
+             writer.getModifierTypeHeader(),
+             configuration().getText("doclet.0_and_1",
+                     configuration().getText("doclet.Annotation_Type_Required_Member"),
+                     configuration().getText("doclet.Description"))
+         };
+-        writer.summaryTableHeader(header, "col");
++        return header;
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void printSummaryAnchor(ClassDoc cd) {
+-        writer.anchor("annotation_type_required_element_summary");
++    public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
++        memberTree.addContent(writer.getMarkerAnchor(
++                "annotation_type_required_element_summary"));
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void printInheritedSummaryAnchor(ClassDoc cd) {
+-    }   // no such
+-
+-    /**
+-     * {@inheritDoc}
+-     */
+-    public void printInheritedSummaryLabel(ClassDoc cd) {
+-        // no such
++    public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    protected void writeSummaryLink(int context, ClassDoc cd, ProgramElementDoc member) {
+-        writer.strong();
+-        writer.printDocLink(context, (MemberDoc) member, member.name(), false);
+-        writer.strongEnd();
++    public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    protected void writeInheritedSummaryLink(ClassDoc cd,
+-            ProgramElementDoc member) {
++    protected void addSummaryLink(int context, ClassDoc cd, ProgramElementDoc member,
++            Content tdSummary) {
++        Content strong = HtmlTree.STRONG(new RawHtml(
++                writer.getDocLink(context, (MemberDoc) member, member.name(), false)));
++        Content code = HtmlTree.CODE(strong);
++        tdSummary.addContent(code);
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    protected void addInheritedSummaryLink(ClassDoc cd,
++            ProgramElementDoc member, Content linksTree) {
+         //Not applicable.
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    protected void printSummaryType(ProgramElementDoc member) {
++    protected void addSummaryType(ProgramElementDoc member, Content tdSummaryType) {
+         MemberDoc m = (MemberDoc)member;
+-        printModifierAndType(m, getType(m));
++        addModifierAndType(m, getType(m), tdSummaryType);
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    protected void writeDeprecatedLink(ProgramElementDoc member) {
+-        writer.printDocLink(LinkInfoImpl.CONTEXT_MEMBER,
+-            (MemberDoc) member, ((MemberDoc)member).qualifiedName(), false);
++    protected Content getDeprecatedLink(ProgramElementDoc member) {
++        return writer.getDocLink(LinkInfoImpl.CONTEXT_MEMBER,
++                (MemberDoc) member, ((MemberDoc)member).qualifiedName());
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    protected void printNavSummaryLink(ClassDoc cd, boolean link) {
++    protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
+         if (link) {
+-            writer.printHyperLink("", "annotation_type_required_element_summary",
+-                    configuration().getText("doclet.navAnnotationTypeRequiredMember"));
++            return writer.getHyperLink("", "annotation_type_required_element_summary",
++                    writer.getResource("doclet.navAnnotationTypeRequiredMember"));
+         } else {
+-            writer.printText("doclet.navAnnotationTypeRequiredMember");
++            return writer.getResource("doclet.navAnnotationTypeRequiredMember");
+         }
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    protected void printNavDetailLink(boolean link) {
++    protected void addNavDetailLink(boolean link, Content liNav) {
+         if (link) {
+-            writer.printHyperLink("", "annotation_type_element_detail",
+-                configuration().getText("doclet.navAnnotationTypeMember"));
++            liNav.addContent(writer.getHyperLink("", "annotation_type_element_detail",
++                    writer.getResource("doclet.navAnnotationTypeMember")));
+         } else {
+-            writer.printText("doclet.navAnnotationTypeMember");
++            liNav.addContent(writer.getResource("doclet.navAnnotationTypeMember"));
+         }
+     }
+ 
+-    /**
+-     * {@inheritDoc}
+-     */
+-    public void writeDeprecated(MemberDoc member) {
+-        printDeprecated(member);
+-    }
+-
+     private Type getType(MemberDoc member) {
+         if (member instanceof FieldDoc) {
+             return ((FieldDoc) member).type();
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java
+@@ -29,6 +29,7 @@
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+ import com.sun.tools.doclets.internal.toolkit.builders.*;
++import com.sun.tools.doclets.formats.html.markup.*;
+ 
+ /**
+  * Generate the Class Information Page.
+@@ -40,6 +41,7 @@
+  *
+  * @author Atul M Dambalkar
+  * @author Robert Field
++ * @author Bhavesh Patel (Modified)
+  */
+ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
+         implements AnnotationTypeWriter {
+@@ -69,126 +71,168 @@
+     }
+ 
+     /**
+-     * Print this package link
++     * Get this package link.
++     *
++     * @return a content tree for the package link
+      */
+-    protected void navLinkPackage() {
+-        navCellStart();
+-        printHyperLink("package-summary.html", "",
+-            configuration.getText("doclet.Package"), true, "NavBarFont1");
+-        navCellEnd();
++    protected Content getNavLinkPackage() {
++        Content linkContent = getHyperLink("package-summary.html", "",
++                packageLabel);
++        Content li = HtmlTree.LI(linkContent);
++        return li;
+     }
+ 
+     /**
+-     * Print class page indicator
++     * Get the class link.
++     *
++     * @return a content tree for the class link
+      */
+-    protected void navLinkClass() {
+-        navCellRevStart();
+-        fontStyle("NavBarFont1Rev");
+-        strongText("doclet.Class");
+-        fontEnd();
+-        navCellEnd();
++    protected Content getNavLinkClass() {
++        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, classLabel);
++        return li;
+     }
+ 
+     /**
+-     * Print class use link
++     * Get the class use link.
++     *
++     * @return a content tree for the class use link
+      */
+-    protected void navLinkClassUse() {
+-        navCellStart();
+-        printHyperLink("class-use/" + filename, "",
+-                       configuration.getText("doclet.navClassUse"), true, "NavBarFont1");
+-        navCellEnd();
++    protected Content getNavLinkClassUse() {
++        Content linkContent = getHyperLink("class-use/" + filename, "", useLabel);
++        Content li = HtmlTree.LI(linkContent);
++        return li;
+     }
+ 
+     /**
+-     * Print previous package link
++     * Get link to previous class.
++     *
++     * @return a content tree for the previous class link
+      */
+-    protected void navLinkPrevious() {
+-        if (prev == null) {
+-            printText("doclet.Prev_Class");
+-        } else {
+-            printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS,
+-                prev.asClassDoc(), "",
+-                configuration.getText("doclet.Prev_Class"), true));
++    public Content getNavLinkPrevious() {
++        Content li;
++        if (prev != null) {
++            Content prevLink = new RawHtml(getLink(new LinkInfoImpl(
++                    LinkInfoImpl.CONTEXT_CLASS, prev.asClassDoc(), "",
++                    configuration.getText("doclet.Prev_Class"), true)));
++            li = HtmlTree.LI(prevLink);
+         }
++        else
++            li = HtmlTree.LI(prevclassLabel);
++        return li;
+     }
+ 
+     /**
+-     * Print next package link
++     * Get link to next class.
++     *
++     * @return a content tree for the next class link
+      */
+-    protected void navLinkNext() {
+-        if (next == null) {
+-            printText("doclet.Next_Class");
+-        } else {
+-            printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS,
+-                next.asClassDoc(), "",
+-                configuration.getText("doclet.Next_Class"), true));
++    public Content getNavLinkNext() {
++        Content li;
++        if (next != null) {
++            Content nextLink = new RawHtml(getLink(new LinkInfoImpl(
++                    LinkInfoImpl.CONTEXT_CLASS, next.asClassDoc(), "",
++                    configuration.getText("doclet.Next_Class"), true)));
++            li = HtmlTree.LI(nextLink);
+         }
++        else
++            li = HtmlTree.LI(nextclassLabel);
++        return li;
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeHeader(String header) {
+-
++    public Content getHeader(String header) {
+         String pkgname = (annotationType.containingPackage() != null)?
+             annotationType.containingPackage().name(): "";
+         String clname = annotationType.name();
+-
+-        printHtmlHeader(clname,
+-            configuration.metakeywords.getMetaKeywords(annotationType), true);
+-        printTop();
+-        navLinks(true);
+-        hr();
+-        println("<!-- ======== START OF CLASS DATA ======== -->");
+-        h2();
++        Content bodyTree = getBody(true, getWindowTitle(clname));
++        addTop(bodyTree);
++        addNavLinks(true, bodyTree);
++        bodyTree.addContent(HtmlConstants.START_OF_CLASS_DATA);
++        HtmlTree div = new HtmlTree(HtmlTag.DIV);
++        div.addStyle(HtmlStyle.header);
+         if (pkgname.length() > 0) {
+-            font("-1"); print(pkgname); fontEnd(); br();
++            Content pkgNameContent = new StringContent(pkgname);
++            Content pkgNamePara = HtmlTree.P(HtmlStyle.subTitle, pkgNameContent);
++            div.addContent(pkgNamePara);
+         }
+-        print(header + getTypeParameterLinks(new LinkInfoImpl(
+-            LinkInfoImpl.CONTEXT_CLASS_HEADER,
+-            annotationType, false)));
+-        h2End();
++        LinkInfoImpl linkInfo = new LinkInfoImpl(
++                LinkInfoImpl.CONTEXT_CLASS_HEADER, annotationType, false);
++        Content headerContent = new StringContent(header);
++        Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, true,
++                HtmlStyle.title, headerContent);
++        heading.addContent(new RawHtml(getTypeParameterLinks(linkInfo)));
++        div.addContent(heading);
++        bodyTree.addContent(div);
++        return bodyTree;
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeFooter() {
+-        println("<!-- ========= END OF CLASS DATA ========= -->");
+-        hr();
+-        navLinks(false);
+-        printBottom();
+-        printBodyHtmlEnd();
++    public Content getAnnotationContentHeader() {
++        return getContentHeader();
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeAnnotationTypeSignature(String modifiers) {
+-        preNoNewLine();
+-        writeAnnotationInfo(annotationType);
+-        print(modifiers);
+-        String name = annotationType.name() +
+-            getTypeParameterLinks(new LinkInfoImpl(
+-                LinkInfoImpl.CONTEXT_CLASS_SIGNATURE, annotationType, false));
+-        if (configuration().linksource) {
+-            printSrcLink(annotationType, name);
+-        } else {
+-            strong(name);
+-        }
+-        preEnd();
+-        p();
++    public void addFooter(Content contentTree) {
++        contentTree.addContent(HtmlConstants.END_OF_CLASS_DATA);
++        addNavLinks(false, contentTree);
++        addBottom(contentTree);
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeAnnotationTypeDescription() {
++    public void printDocument(Content contentTree) {
++        printHtmlDocument(configuration.metakeywords.getMetaKeywords(annotationType),
++                true, contentTree);
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public Content getAnnotationInfoTreeHeader() {
++        return getMemberTreeHeader();
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public Content getAnnotationInfo(Content annotationInfoTree) {
++        return getMemberTree(HtmlStyle.description, annotationInfoTree);
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public void addAnnotationTypeSignature(String modifiers, Content annotationInfoTree) {
++        annotationInfoTree.addContent(new HtmlTree(HtmlTag.BR));
++        Content pre = new HtmlTree(HtmlTag.PRE);
++        addAnnotationInfo(annotationType, pre);
++        pre.addContent(modifiers);
++        LinkInfoImpl linkInfo = new LinkInfoImpl(
++                LinkInfoImpl.CONTEXT_CLASS_SIGNATURE, annotationType, false);
++        Content name = new RawHtml (annotationType.name() +
++                getTypeParameterLinks(linkInfo));
++        if (configuration().linksource) {
++            addSrcLink(annotationType, name, pre);
++        } else {
++            pre.addContent(HtmlTree.STRONG(name));
++        }
++        annotationInfoTree.addContent(pre);
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public void addAnnotationTypeDescription(Content annotationInfoTree) {
+         if(!configuration.nocomment) {
+-            // generate documentation for the class.
+             if (annotationType.inlineTags().length > 0) {
+-                printInlineComment(annotationType);
+-                p();
++                addInlineComment(annotationType, annotationInfoTree);
+             }
+         }
+     }
+@@ -196,148 +240,152 @@
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeAnnotationTypeTagInfo() {
+-        boolean needHr = annotationType.elements().length > 0;
++    public void addAnnotationTypeTagInfo(Content annotationInfoTree) {
+         if(!configuration.nocomment) {
+-            // Print Information about all the tags here
+-            printTags(annotationType);
+-            if (needHr) {
+-                hr();
+-            }
+-            p();
+-        } else if (needHr) {
+-            hr();
++            addTagsInfo(annotationType, annotationInfoTree);
+         }
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeAnnotationTypeDeprecationInfo() {
+-        hr();
++    public void addAnnotationTypeDeprecationInfo(Content annotationInfoTree) {
++        Content hr = new HtmlTree(HtmlTag.HR);
++        annotationInfoTree.addContent(hr);
+         Tag[] deprs = annotationType.tags("deprecated");
+         if (Util.isDeprecated(annotationType)) {
+-            strongText("doclet.Deprecated");
++            Content strong = HtmlTree.STRONG(deprecatedPhrase);
++            Content div = HtmlTree.DIV(HtmlStyle.block, strong);
+             if (deprs.length > 0) {
+                 Tag[] commentTags = deprs[0].inlineTags();
+                 if (commentTags.length > 0) {
+-
+-                    space();
+-                    printInlineDeprecatedComment(annotationType, deprs[0]);
++                    div.addContent(getSpace());
++                    addInlineDeprecatedComment(annotationType, deprs[0], div);
+                 }
+             }
+-            p();
++            annotationInfoTree.addContent(div);
+         }
+     }
+ 
+-    protected void navLinkTree() {
+-        navCellStart();
+-        printHyperLink("package-tree.html", "",
+-            configuration.getText("doclet.Tree"), true, "NavBarFont1");
+-        navCellEnd();
++    /**
++     * {@inheritDoc}
++     */
++    public void addAnnotationDetailsMarker(Content memberDetails) {
++        memberDetails.addContent(HtmlConstants.START_OF_ANNOTATION_TYPE_DETAILS);
+     }
+ 
+-    protected void printSummaryDetailLinks() {
++    /**
++     * {@inheritDoc}
++     */
++    protected Content getNavLinkTree() {
++        Content treeLinkContent = getHyperLink("package-tree.html",
++                "", treeLabel, "", "");
++        Content li = HtmlTree.LI(treeLinkContent);
++        return li;
++    }
++
++    /**
++     * Add summary details to the navigation bar.
++     *
++     * @param subDiv the content tree to which the summary detail links will be added
++     */
++    protected void addSummaryDetailLinks(Content subDiv) {
+         try {
+-            tr();
+-            tdVAlignClass("top", "NavBarCell3");
+-            font("-2");
+-            print("  ");
+-            navSummaryLinks();
+-            fontEnd();
+-            tdEnd();
+-
+-            tdVAlignClass("top", "NavBarCell3");
+-            font("-2");
+-            navDetailLinks();
+-            fontEnd();
+-            tdEnd();
+-            trEnd();
++            Content div = HtmlTree.DIV(getNavSummaryLinks());
++            div.addContent(getNavDetailLinks());
++            subDiv.addContent(div);
+         } catch (Exception e) {
+             e.printStackTrace();
+             throw new DocletAbortException();
+         }
+     }
+ 
+-    protected void navSummaryLinks() throws Exception {
+-        printText("doclet.Summary");
+-        space();
++    /**
++     * Get summary links for navigation bar.
++     *
++     * @return the content tree for the navigation summary links
++     */
++    protected Content getNavSummaryLinks() throws Exception {
++        Content li = HtmlTree.LI(summaryLabel);
++        li.addContent(getSpace());
++        Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
+         MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
+-            configuration.getBuilderFactory().getMemberSummaryBuilder(this);
+-        writeNavSummaryLink(memberSummaryBuilder,
+-            "doclet.navAnnotationTypeRequiredMember",
+-            VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED);
+-        navGap();
+-        writeNavSummaryLink(memberSummaryBuilder,
+-            "doclet.navAnnotationTypeOptionalMember",
+-            VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL);
++                configuration.getBuilderFactory().getMemberSummaryBuilder(this);
++        Content liNavReq = new HtmlTree(HtmlTag.LI);
++        addNavSummaryLink(memberSummaryBuilder,
++                "doclet.navAnnotationTypeRequiredMember",
++                VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED, liNavReq);
++        addNavGap(liNavReq);
++        ulNav.addContent(liNavReq);
++        Content liNavOpt = new HtmlTree(HtmlTag.LI);
++        addNavSummaryLink(memberSummaryBuilder,
++                "doclet.navAnnotationTypeOptionalMember",
++                VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL, liNavOpt);
++        ulNav.addContent(liNavOpt);
++        return ulNav;
+     }
+ 
+-    private void writeNavSummaryLink(MemberSummaryBuilder builder,
+-            String label, int type) {
++    /**
++     * Add the navigation summary link.
++     *
++     * @param builder builder for the member to be documented
++     * @param label the label for the navigation
++     * @param type type to be documented
++     * @param liNav the content tree to which the navigation summary link will be added
++     */
++    protected void addNavSummaryLink(MemberSummaryBuilder builder,
++            String label, int type, Content liNav) {
+         AbstractMemberWriter writer = ((AbstractMemberWriter) builder.
+-            getMemberSummaryWriter(type));
++                getMemberSummaryWriter(type));
+         if (writer == null) {
+-              printText(label);
++            liNav.addContent(getResource(label));
+         } else {
+-            writer.printNavSummaryLink(null,
+-                ! builder.getVisibleMemberMap(type).noVisibleMembers());
++            liNav.addContent(writer.getNavSummaryLink(null,
++                    ! builder.getVisibleMemberMap(type).noVisibleMembers()));
+         }
+     }
+ 
+     /**
+-     * Method navDetailLinks
++     * Get detail links for the navigation bar.
+      *
+-     * @throws   Exception
+-     *
++     * @return the content tree for the detail links
+      */
+-    protected void navDetailLinks() throws Exception {
+-        printText("doclet.Detail");
+-        space();
++    protected Content getNavDetailLinks() throws Exception {
++        Content li = HtmlTree.LI(detailLabel);
++        li.addContent(getSpace());
++        Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
+         MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
+-            configuration.getBuilderFactory().getMemberSummaryBuilder(this);
++                configuration.getBuilderFactory().getMemberSummaryBuilder(this);
+         AbstractMemberWriter writerOptional =
+-            ((AbstractMemberWriter) memberSummaryBuilder.
++                ((AbstractMemberWriter) memberSummaryBuilder.
+                 getMemberSummaryWriter(VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL));
+         AbstractMemberWriter writerRequired =
+-            ((AbstractMemberWriter) memberSummaryBuilder.
++                ((AbstractMemberWriter) memberSummaryBuilder.
+                 getMemberSummaryWriter(VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED));
+         if (writerOptional != null){
+-            writerOptional.printNavDetailLink(annotationType.elements().length > 0);
++            Content liNavOpt = new HtmlTree(HtmlTag.LI);
++            writerOptional.addNavDetailLink(annotationType.elements().length > 0, liNavOpt);
++            ulNav.addContent(liNavOpt);
+         } else if (writerRequired != null){
+-            writerRequired.printNavDetailLink(annotationType.elements().length > 0);
++            Content liNavReq = new HtmlTree(HtmlTag.LI);
++            writerRequired.addNavDetailLink(annotationType.elements().length > 0, liNavReq);
++            ulNav.addContent(liNavReq);
+         } else {
+-            printText("doclet.navAnnotationTypeMember");
++            Content liNav = HtmlTree.LI(getResource("doclet.navAnnotationTypeMember"));
++            ulNav.addContent(liNav);
+         }
+-    }
+-
+-    protected void navGap() {
+-        space();
+-        print('|');
+-        space();
++        return ulNav;
+     }
+ 
+     /**
+-     * If this is an inner class or interface, write the enclosing class or
+-     * interface.
++     * Add gap between navigation bar elements.
++     *
++     * @param liNav the content tree to which the gap will be added
+      */
+-    public void writeNestedClassInfo() {
+-        ClassDoc outerClass = annotationType.containingClass();
+-        if (outerClass != null) {
+-            dl();
+-            dt();
+-            if (annotationType.isInterface()) {
+-                strongText("doclet.Enclosing_Interface");
+-            } else {
+-                strongText("doclet.Enclosing_Class");
+-            }
+-            dtEnd();
+-            dd();
+-            printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS, outerClass,
+-                false));
+-            ddEnd();
+-            dlEnd();
+-        }
++    protected void addNavGap(Content liNav) {
++        liNav.addContent(getSpace());
++        liNav.addContent("|");
++        liNav.addContent(getSpace());
+     }
+ 
+     /**
+@@ -346,11 +394,4 @@
+     public AnnotationTypeDoc getAnnotationTypeDoc() {
+         return annotationType;
+     }
+-
+-    /**
+-     * {@inheritDoc}
+-     */
+-    public void completeMemberSummaryBuild() {
+-        p();
+-    }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java
+@@ -25,10 +25,12 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
+-import com.sun.tools.doclets.internal.toolkit.util.*;
+-import com.sun.javadoc.*;
+ import java.io.*;
+ import java.util.*;
++import com.sun.javadoc.*;
++import com.sun.tools.doclets.internal.toolkit.util.*;
++import com.sun.tools.doclets.formats.html.markup.*;
++import com.sun.tools.doclets.internal.toolkit.*;
+ 
+ /**
+  * Generate class usage information.
+@@ -207,257 +209,301 @@
+     }
+ 
+     /**
+-     * Print the class use list.
++     * Generate the class use list.
+      */
+     protected void generateClassUseFile() throws IOException {
+-
+-        printClassUseHeader();
+-
++        Content body = getClassUseHeader();
++        HtmlTree div = new HtmlTree(HtmlTag.DIV);
++        div.addStyle(HtmlStyle.classUseContainer);
+         if (pkgSet.size() > 0) {
+-            generateClassUse();
++            addClassUse(div);
+         } else {
+-            printText("doclet.ClassUse_No.usage.of.0",
+-                      classdoc.qualifiedName());
+-            p();
++            div.addContent(getResource("doclet.ClassUse_No.usage.of.0",
++                    classdoc.qualifiedName()));
+         }
+-
+-        printClassUseFooter();
+-    }
+-
+-    protected void generateClassUse() throws IOException {
+-        if (configuration.packages.length > 1) {
+-            generatePackageList();
+-            generatePackageAnnotationList();
+-        }
+-        generateClassList();
+-    }
+-
+-    protected void generatePackageList() throws IOException {
+-        tableIndexSummary(useTableSummary);
+-        tableCaptionStart();
+-        printText("doclet.ClassUse_Packages.that.use.0",
+-            getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc,
+-                false)));
+-        tableCaptionEnd();
+-        summaryTableHeader(packageTableHeader, "col");
+-
+-        for (Iterator it = pkgSet.iterator(); it.hasNext();) {
+-            PackageDoc pkg = (PackageDoc)it.next();
+-            generatePackageUse(pkg);
+-        }
+-        tableEnd();
+-        space();
+-        p();
+-    }
+-
+-    protected void generatePackageAnnotationList() throws IOException {
+-        if ((! classdoc.isAnnotationType()) ||
+-               pkgToPackageAnnotations == null ||
+-               pkgToPackageAnnotations.size() == 0)
+-            return;
+-        tableIndexSummary(useTableSummary);
+-        tableCaptionStart();
+-        printText("doclet.ClassUse_PackageAnnotation",
+-            getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc,
+-                false)));
+-        tableCaptionEnd();
+-        summaryTableHeader(packageTableHeader, "col");
+-        for (Iterator it = pkgToPackageAnnotations.iterator(); it.hasNext();) {
+-            PackageDoc pkg = (PackageDoc)it.next();
+-            trBgcolorStyle("white", "TableRowColor");
+-            summaryRow(0);
+-            //Just want an anchor here.
+-            printPackageLink(pkg, pkg.name(), true);
+-            summaryRowEnd();
+-            summaryRow(0);
+-            printSummaryComment(pkg);
+-            space();
+-            summaryRowEnd();
+-            trEnd();
+-        }
+-        tableEnd();
+-        space();
+-        p();
+-    }
+-
+-    protected void generateClassList() throws IOException {
+-        for (Iterator it = pkgSet.iterator(); it.hasNext();) {
+-            PackageDoc pkg = (PackageDoc)it.next();
+-            anchor(pkg.name());
+-            tableIndexSummary();
+-            tableHeaderStart("#CCCCFF");
+-            printText("doclet.ClassUse_Uses.of.0.in.1",
+-                getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS_USE_HEADER,
+-                    classdoc, false)),
+-                getPackageLink(pkg, Util.getPackageName(pkg), false));
+-            tableHeaderEnd();
+-            tableEnd();
+-            space();
+-            p();
+-            generateClassUse(pkg);
+-        }
++        body.addContent(div);
++        addNavLinks(false, body);
++        addBottom(body);
++        printHtmlDocument(null, true, body);
+     }
+ 
+     /**
+-     * Print the package use list.
++     * Add the class use documentation.
++     *
++     * @param contentTree the content tree to which the class use information will be added
+      */
+-    protected void generatePackageUse(PackageDoc pkg) throws IOException {
+-        trBgcolorStyle("white", "TableRowColor");
+-        summaryRow(0);
+-        //Just want an anchor here.
+-        printHyperLink("", pkg.name(), Util.getPackageName(pkg), true);
+-        summaryRowEnd();
+-        summaryRow(0);
+-        printSummaryComment(pkg);
+-        space();
+-        summaryRowEnd();
+-        trEnd();
++    protected void addClassUse(Content contentTree) throws IOException {
++        HtmlTree ul = new HtmlTree(HtmlTag.UL);
++        ul.addStyle(HtmlStyle.blockList);
++        if (configuration.packages.length > 1) {
++            addPackageList(ul);
++            addPackageAnnotationList(ul);
++        }
++        addClassList(ul);
++        contentTree.addContent(ul);
+     }
+ 
+     /**
+-     * Print the class use list.
++     * Add the packages list that use the given class.
++     *
++     * @param contentTree the content tree to which the packages list will be added
+      */
+-    protected void generateClassUse(PackageDoc pkg) throws IOException {
+-        String classLink = getLink(new LinkInfoImpl(
+-            LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc, false));
+-        String pkgLink = getPackageLink(pkg, Util.getPackageName(pkg), false);
+-        classSubWriter.printUseInfo(pkgToClassAnnotations.get(pkg.name()),
+-                configuration.getText("doclet.ClassUse_Annotation", classLink,
+-                pkgLink), classUseTableSummary);
+-        classSubWriter.printUseInfo(pkgToClassTypeParameter.get(pkg.name()),
+-                configuration.getText("doclet.ClassUse_TypeParameter", classLink,
+-                pkgLink), classUseTableSummary);
+-        classSubWriter.printUseInfo(pkgToSubclass.get(pkg.name()),
+-                configuration.getText("doclet.ClassUse_Subclass", classLink,
+-                pkgLink), subclassUseTableSummary);
+-        classSubWriter.printUseInfo(pkgToSubinterface.get(pkg.name()),
+-                configuration.getText("doclet.ClassUse_Subinterface", classLink,
+-                pkgLink), subinterfaceUseTableSummary);
+-        classSubWriter.printUseInfo(pkgToImplementingClass.get(pkg.name()),
+-                configuration.getText("doclet.ClassUse_ImplementingClass", classLink,
+-                pkgLink), classUseTableSummary);
+-        fieldSubWriter.printUseInfo(pkgToField.get(pkg.name()),
+-                configuration.getText("doclet.ClassUse_Field", classLink,
+-                pkgLink), fieldUseTableSummary);
+-        fieldSubWriter.printUseInfo(pkgToFieldAnnotations.get(pkg.name()),
+-                configuration.getText("doclet.ClassUse_FieldAnnotations", classLink,
+-                pkgLink), fieldUseTableSummary);
+-        fieldSubWriter.printUseInfo(pkgToFieldTypeParameter.get(pkg.name()),
+-                configuration.getText("doclet.ClassUse_FieldTypeParameter", classLink,
+-                pkgLink), fieldUseTableSummary);
+-        methodSubWriter.printUseInfo(pkgToMethodAnnotations.get(pkg.name()),
+-                configuration.getText("doclet.ClassUse_MethodAnnotations", classLink,
+-                pkgLink), methodUseTableSummary);
+-        methodSubWriter.printUseInfo(pkgToMethodParameterAnnotations.get(pkg.name()),
+-                configuration.getText("doclet.ClassUse_MethodParameterAnnotations", classLink,
+-                pkgLink), methodUseTableSummary);
+-        methodSubWriter.printUseInfo(pkgToMethodTypeParameter.get(pkg.name()),
+-                configuration.getText("doclet.ClassUse_MethodTypeParameter", classLink,
+-                pkgLink), methodUseTableSummary);
+-        methodSubWriter.printUseInfo(pkgToMethodReturn.get(pkg.name()),
+-                configuration.getText("doclet.ClassUse_MethodReturn", classLink,
+-                pkgLink), methodUseTableSummary);
+-        methodSubWriter.printUseInfo(pkgToMethodReturnTypeParameter.get(pkg.name()),
+-                configuration.getText("doclet.ClassUse_MethodReturnTypeParameter", classLink,
+-                pkgLink), methodUseTableSummary);
+-        methodSubWriter.printUseInfo(pkgToMethodArgs.get(pkg.name()),
+-                configuration.getText("doclet.ClassUse_MethodArgs", classLink,
+-                pkgLink), methodUseTableSummary);
+-        methodSubWriter.printUseInfo(pkgToMethodArgTypeParameter.get(pkg.name()),
+-                configuration.getText("doclet.ClassUse_MethodArgsTypeParameters", classLink,
+-                pkgLink), methodUseTableSummary);
+-        methodSubWriter.printUseInfo(pkgToMethodThrows.get(pkg.name()),
+-                configuration.getText("doclet.ClassUse_MethodThrows", classLink,
+-                pkgLink), methodUseTableSummary);
+-        constrSubWriter.printUseInfo(pkgToConstructorAnnotations.get(pkg.name()),
+-                configuration.getText("doclet.ClassUse_ConstructorAnnotations", classLink,
+-                pkgLink), constructorUseTableSummary);
+-        constrSubWriter.printUseInfo(pkgToConstructorParameterAnnotations.get(pkg.name()),
+-                configuration.getText("doclet.ClassUse_ConstructorParameterAnnotations", classLink,
+-                pkgLink), constructorUseTableSummary);
+-        constrSubWriter.printUseInfo(pkgToConstructorArgs.get(pkg.name()),
+-                configuration.getText("doclet.ClassUse_ConstructorArgs", classLink,
+-                pkgLink), constructorUseTableSummary);
+-        constrSubWriter.printUseInfo(pkgToConstructorArgTypeParameter.get(pkg.name()),
+-                configuration.getText("doclet.ClassUse_ConstructorArgsTypeParameters", classLink,
+-                pkgLink), constructorUseTableSummary);
+-        constrSubWriter.printUseInfo(pkgToConstructorThrows.get(pkg.name()),
+-                configuration.getText("doclet.ClassUse_ConstructorThrows", classLink,
+-                pkgLink), constructorUseTableSummary);
++    protected void addPackageList(Content contentTree) throws IOException {
++        Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary,
++                getTableCaption(configuration().getText(
++                "doclet.ClassUse_Packages.that.use.0",
++                getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc,
++                false)))));
++        table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
++        Content tbody = new HtmlTree(HtmlTag.TBODY);
++        Iterator<PackageDoc> it = pkgSet.iterator();
++        for (int i = 0; it.hasNext(); i++) {
++            PackageDoc pkg = it.next();
++            HtmlTree tr = new HtmlTree(HtmlTag.TR);
++            if (i % 2 == 0) {
++                tr.addStyle(HtmlStyle.altColor);
++            } else {
++                tr.addStyle(HtmlStyle.rowColor);
++            }
++            addPackageUse(pkg, tr);
++            tbody.addContent(tr);
++        }
++        table.addContent(tbody);
++        Content li = HtmlTree.LI(HtmlStyle.blockList, table);
++        contentTree.addContent(li);
+     }
+ 
+     /**
+-     * Print the header for the class use Listing.
++     * Add the package annotation list.
++     *
++     * @param contentTree the content tree to which the package annotation list will be added
+      */
+-    protected void printClassUseHeader() {
+-        String cltype = configuration.getText(classdoc.isInterface()?
+-                                    "doclet.Interface":
+-                                    "doclet.Class");
+-        String clname = classdoc.qualifiedName();
+-        printHtmlHeader(configuration.getText("doclet.Window_ClassUse_Header",
+-                            cltype, clname), null, true);
+-        printTop();
+-        navLinks(true);
+-        hr();
+-        center();
+-        h2();
+-        strongText("doclet.ClassUse_Title", cltype, clname);
+-        h2End();
+-        centerEnd();
++    protected void addPackageAnnotationList(Content contentTree) throws IOException {
++        if ((!classdoc.isAnnotationType()) ||
++                pkgToPackageAnnotations == null ||
++                pkgToPackageAnnotations.size() == 0) {
++            return;
++        }
++        Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary,
++                getTableCaption(configuration().getText(
++                "doclet.ClassUse_PackageAnnotation",
++                getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc,
++                false)))));
++        table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
++        Content tbody = new HtmlTree(HtmlTag.TBODY);
++        Iterator<PackageDoc> it = pkgToPackageAnnotations.iterator();
++        for (int i = 0; it.hasNext(); i++) {
++            PackageDoc pkg = it.next();
++            HtmlTree tr = new HtmlTree(HtmlTag.TR);
++            if (i % 2 == 0) {
++                tr.addStyle(HtmlStyle.altColor);
++            } else {
++                tr.addStyle(HtmlStyle.rowColor);
++            }
++            Content tdFirst = HtmlTree.TD(HtmlStyle.colFirst,
++                    getPackageLink(pkg, new StringContent(pkg.name())));
++            tr.addContent(tdFirst);
++            HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
++            tdLast.addStyle(HtmlStyle.colLast);
++            if (pkg != null) {
++                addSummaryComment(pkg, tdLast);
++            } else {
++                tdLast.addContent(getSpace());
++            }
++            tr.addContent(tdLast);
++            tbody.addContent(tr);
++        }
++        table.addContent(tbody);
++        Content li = HtmlTree.LI(HtmlStyle.blockList, table);
++        contentTree.addContent(li);
+     }
+ 
+     /**
+-     * Print the footer for the class use Listing.
++     * Add the class list that use the given class.
++     *
++     * @param contentTree the content tree to which the class list will be added
+      */
+-    protected void printClassUseFooter() {
+-        hr();
+-        navLinks(false);
+-        printBottom();
+-        printBodyHtmlEnd();
+-    }
+-
+-
+-    /**
+-     * Print this package link
+-     */
+-    protected void navLinkPackage() {
+-        navCellStart();
+-        printHyperLink("../package-summary.html", "",
+-                       configuration.getText("doclet.Package"), true, "NavBarFont1");
+-        navCellEnd();
++    protected void addClassList(Content contentTree) throws IOException {
++        HtmlTree ul = new HtmlTree(HtmlTag.UL);
++        ul.addStyle(HtmlStyle.blockList);
++        for (Iterator<PackageDoc> it = pkgSet.iterator(); it.hasNext();) {
++            PackageDoc pkg = it.next();
++            Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor(pkg.name()));
++            Content link = new RawHtml(
++                    configuration.getText("doclet.ClassUse_Uses.of.0.in.1",
++                    getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS_USE_HEADER,
++                    classdoc, false)),
++                    getPackageLinkString(pkg, Util.getPackageName(pkg), false)));
++            Content heading = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, link);
++            li.addContent(heading);
++            addClassUse(pkg, li);
++            ul.addContent(li);
++        }
++        Content li = HtmlTree.LI(HtmlStyle.blockList, ul);
++        contentTree.addContent(li);
+     }
+ 
+     /**
+-     * Print class page indicator
++     * Add the package use information.
++     *
++     * @param pkg the package that uses the given class
++     * @param contentTree the content tree to which the package use information will be added
+      */
+-    protected void navLinkClass() {
+-        navCellStart();
+-        printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc, "",
+-            configuration.getText("doclet.Class"), true, "NavBarFont1"));
+-        navCellEnd();
++    protected void addPackageUse(PackageDoc pkg, Content contentTree) throws IOException {
++        Content tdFirst = HtmlTree.TD(HtmlStyle.colFirst,
++                getHyperLink("", pkg.name(), new StringContent(Util.getPackageName(pkg))));
++        contentTree.addContent(tdFirst);
++        HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
++        tdLast.addStyle(HtmlStyle.colLast);
++        if (pkg != null)
++            addSummaryComment(pkg, tdLast);
++        else
++            tdLast.addContent(getSpace());
++        contentTree.addContent(tdLast);
+     }
+ 
+     /**
+-     * Print class use link
++     * Add the class use information.
++     *
++     * @param pkg the package that uses the given class
++     * @param contentTree the content tree to which the class use information will be added
+      */
+-    protected void navLinkClassUse() {
+-        navCellRevStart();
+-        fontStyle("NavBarFont1Rev");
+-        strongText("doclet.navClassUse");
+-        fontEnd();
+-        navCellEnd();
++    protected void addClassUse(PackageDoc pkg, Content contentTree) throws IOException {
++        String classLink = getLink(new LinkInfoImpl(
++            LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc, false));
++        String pkgLink = getPackageLinkString(pkg, Util.getPackageName(pkg), false);
++        classSubWriter.addUseInfo(pkgToClassAnnotations.get(pkg.name()),
++                configuration.getText("doclet.ClassUse_Annotation", classLink,
++                pkgLink), classUseTableSummary, contentTree);
++        classSubWriter.addUseInfo(pkgToClassTypeParameter.get(pkg.name()),
++                configuration.getText("doclet.ClassUse_TypeParameter", classLink,
++                pkgLink), classUseTableSummary, contentTree);
++        classSubWriter.addUseInfo(pkgToSubclass.get(pkg.name()),
++                configuration.getText("doclet.ClassUse_Subclass", classLink,
++                pkgLink), subclassUseTableSummary, contentTree);
++        classSubWriter.addUseInfo(pkgToSubinterface.get(pkg.name()),
++                configuration.getText("doclet.ClassUse_Subinterface", classLink,
++                pkgLink), subinterfaceUseTableSummary, contentTree);
++        classSubWriter.addUseInfo(pkgToImplementingClass.get(pkg.name()),
++                configuration.getText("doclet.ClassUse_ImplementingClass", classLink,
++                pkgLink), classUseTableSummary, contentTree);
++        fieldSubWriter.addUseInfo(pkgToField.get(pkg.name()),
++                configuration.getText("doclet.ClassUse_Field", classLink,
++                pkgLink), fieldUseTableSummary, contentTree);
++        fieldSubWriter.addUseInfo(pkgToFieldAnnotations.get(pkg.name()),
++                configuration.getText("doclet.ClassUse_FieldAnnotations", classLink,
++                pkgLink), fieldUseTableSummary, contentTree);
++        fieldSubWriter.addUseInfo(pkgToFieldTypeParameter.get(pkg.name()),
++                configuration.getText("doclet.ClassUse_FieldTypeParameter", classLink,
++                pkgLink), fieldUseTableSummary, contentTree);
++        methodSubWriter.addUseInfo(pkgToMethodAnnotations.get(pkg.name()),
++                configuration.getText("doclet.ClassUse_MethodAnnotations", classLink,
++                pkgLink), methodUseTableSummary, contentTree);
++        methodSubWriter.addUseInfo(pkgToMethodParameterAnnotations.get(pkg.name()),
++                configuration.getText("doclet.ClassUse_MethodParameterAnnotations", classLink,
++                pkgLink), methodUseTableSummary, contentTree);
++        methodSubWriter.addUseInfo(pkgToMethodTypeParameter.get(pkg.name()),
++                configuration.getText("doclet.ClassUse_MethodTypeParameter", classLink,
++                pkgLink), methodUseTableSummary, contentTree);
++        methodSubWriter.addUseInfo(pkgToMethodReturn.get(pkg.name()),
++                configuration.getText("doclet.ClassUse_MethodReturn", classLink,
++                pkgLink), methodUseTableSummary, contentTree);
++        methodSubWriter.addUseInfo(pkgToMethodReturnTypeParameter.get(pkg.name()),
++                configuration.getText("doclet.ClassUse_MethodReturnTypeParameter", classLink,
++                pkgLink), methodUseTableSummary, contentTree);
++        methodSubWriter.addUseInfo(pkgToMethodArgs.get(pkg.name()),
++                configuration.getText("doclet.ClassUse_MethodArgs", classLink,
++                pkgLink), methodUseTableSummary, contentTree);
++        methodSubWriter.addUseInfo(pkgToMethodArgTypeParameter.get(pkg.name()),
++                configuration.getText("doclet.ClassUse_MethodArgsTypeParameters", classLink,
++                pkgLink), methodUseTableSummary, contentTree);
++        methodSubWriter.addUseInfo(pkgToMethodThrows.get(pkg.name()),
++                configuration.getText("doclet.ClassUse_MethodThrows", classLink,
++                pkgLink), methodUseTableSummary, contentTree);
++        constrSubWriter.addUseInfo(pkgToConstructorAnnotations.get(pkg.name()),
++                configuration.getText("doclet.ClassUse_ConstructorAnnotations", classLink,
++                pkgLink), constructorUseTableSummary, contentTree);
++        constrSubWriter.addUseInfo(pkgToConstructorParameterAnnotations.get(pkg.name()),
++                configuration.getText("doclet.ClassUse_ConstructorParameterAnnotations", classLink,
++                pkgLink), constructorUseTableSummary, contentTree);
++        constrSubWriter.addUseInfo(pkgToConstructorArgs.get(pkg.name()),
++                configuration.getText("doclet.ClassUse_ConstructorArgs", classLink,
++                pkgLink), constructorUseTableSummary, contentTree);
++        constrSubWriter.addUseInfo(pkgToConstructorArgTypeParameter.get(pkg.name()),
++                configuration.getText("doclet.ClassUse_ConstructorArgsTypeParameters", classLink,
++                pkgLink), constructorUseTableSummary, contentTree);
++        constrSubWriter.addUseInfo(pkgToConstructorThrows.get(pkg.name()),
++                configuration.getText("doclet.ClassUse_ConstructorThrows", classLink,
++                pkgLink), constructorUseTableSummary, contentTree);
+     }
+ 
+-    protected void navLinkTree() {
+-        navCellStart();
+-        if (classdoc.containingPackage().isIncluded()) {
+-            printHyperLink("../package-tree.html", "",
+-                configuration.getText("doclet.Tree"), true, "NavBarFont1");
+-        } else {
+-            printHyperLink(relativePath + "overview-tree.html", "",
+-                configuration.getText("doclet.Tree"), true, "NavBarFont1");
+-        }
+-        navCellEnd();
++    /**
++     * Get the header for the class use Listing.
++     *
++     * @return a content tree representing the class use header
++     */
++    protected Content getClassUseHeader() {
++        String cltype = configuration.getText(classdoc.isInterface()?
++            "doclet.Interface":"doclet.Class");
++        String clname = classdoc.qualifiedName();
++        String title = configuration.getText("doclet.Window_ClassUse_Header",
++                cltype, clname);
++        Content bodyTree = getBody(true, getWindowTitle(title));
++        addTop(bodyTree);
++        addNavLinks(true, bodyTree);
++        Content headContent = getResource("doclet.ClassUse_Title", cltype, clname);
++        Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING,
++                true, HtmlStyle.title, headContent);
++        Content div = HtmlTree.DIV(HtmlStyle.header, heading);
++        bodyTree.addContent(div);
++        return bodyTree;
+     }
+ 
++    /**
++     * Get this package link.
++     *
++     * @return a content tree for the package link
++     */
++    protected Content getNavLinkPackage() {
++        Content linkContent = getHyperLink("../package-summary.html", "",
++                packageLabel);
++        Content li = HtmlTree.LI(linkContent);
++        return li;
++    }
++
++    /**
++     * Get class page link.
++     *
++     * @return a content tree for the class page link
++     */
++    protected Content getNavLinkClass() {
++        Content linkContent = new RawHtml(getLink(new LinkInfoImpl(
++                LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc, "",
++                configuration.getText("doclet.Class"), false)));
++        Content li = HtmlTree.LI(linkContent);
++        return li;
++    }
++
++    /**
++     * Get the use link.
++     *
++     * @return a content tree for the use link
++     */
++    protected Content getNavLinkClassUse() {
++        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, useLabel);
++        return li;
++    }
++
++    /**
++     * Get the tree link.
++     *
++     * @return a content tree for the tree link
++     */
++    protected Content getNavLinkTree() {
++        Content linkContent = classdoc.containingPackage().isIncluded() ?
++            getHyperLink("../package-tree.html", "", treeLabel) :
++            getHyperLink(relativePath + "overview-tree.html", "", treeLabel);
++        Content li = HtmlTree.LI(linkContent);
++        return li;
++    }
+ }
+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
+@@ -32,6 +32,7 @@
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+ import com.sun.tools.doclets.internal.toolkit.builders.*;
+ import com.sun.tools.doclets.internal.toolkit.taglets.*;
++import com.sun.tools.doclets.formats.html.markup.*;
+ 
+ /**
+  * Generate the Class Information Page.
+@@ -43,6 +44,7 @@
+  *
+  * @author Atul M Dambalkar
+  * @author Robert Field
++ * @author Bhavesh Patel (Modified)
+  */
+ public class ClassWriterImpl extends SubWriterHolderWriter
+         implements ClassWriter {
+@@ -76,124 +78,173 @@
+     }
+ 
+     /**
+-     * Print this package link
++     * Get this package link.
++     *
++     * @return a content tree for the package link
+      */
+-    protected void navLinkPackage() {
+-        navCellStart();
+-        printHyperLink("package-summary.html", "",
+-            configuration.getText("doclet.Package"), true, "NavBarFont1");
+-        navCellEnd();
++    protected Content getNavLinkPackage() {
++        Content linkContent = getHyperLink("package-summary.html", "",
++                packageLabel);
++        Content li = HtmlTree.LI(linkContent);
++        return li;
+     }
+ 
+     /**
+-     * Print class page indicator
++     * Get the class link.
++     *
++     * @return a content tree for the class link
+      */
+-    protected void navLinkClass() {
+-        navCellRevStart();
+-        fontStyle("NavBarFont1Rev");
+-        strongText("doclet.Class");
+-        fontEnd();
+-        navCellEnd();
++    protected Content getNavLinkClass() {
++        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, classLabel);
++        return li;
+     }
+ 
+     /**
+-     * Print class use link
++     * Get the class use link.
++     *
++     * @return a content tree for the class use link
+      */
+-    protected void navLinkClassUse() {
+-        navCellStart();
+-        printHyperLink("class-use/" + filename, "",
+-                       configuration.getText("doclet.navClassUse"), true, "NavBarFont1");
+-        navCellEnd();
++    protected Content getNavLinkClassUse() {
++        Content linkContent = getHyperLink("class-use/" + filename, "", useLabel);
++        Content li = HtmlTree.LI(linkContent);
++        return li;
+     }
+ 
+     /**
+-     * Print previous package link
++     * Get link to previous class.
++     *
++     * @return a content tree for the previous class link
+      */
+-    protected void navLinkPrevious() {
+-        if (prev == null) {
+-            printText("doclet.Prev_Class");
+-        } else {
+-            printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS, prev, "",
+-                configuration.getText("doclet.Prev_Class"), true));
++    public Content getNavLinkPrevious() {
++        Content li;
++        if (prev != null) {
++            Content prevLink = new RawHtml(getLink(new LinkInfoImpl(
++                    LinkInfoImpl.CONTEXT_CLASS, prev, "",
++                    configuration.getText("doclet.Prev_Class"), true)));
++            li = HtmlTree.LI(prevLink);
+         }
++        else
++            li = HtmlTree.LI(prevclassLabel);
++        return li;
+     }
+ 
+     /**
+-     * Print next package link
++     * Get link to next class.
++     *
++     * @return a content tree for the next class link
+      */
+-    protected void navLinkNext() {
+-        if (next == null) {
+-            printText("doclet.Next_Class");
+-        } else {
+-            printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS, next, "",
+-                configuration.getText("doclet.Next_Class"), true));
++    public Content getNavLinkNext() {
++        Content li;
++        if (next != null) {
++            Content nextLink = new RawHtml(getLink(new LinkInfoImpl(
++                    LinkInfoImpl.CONTEXT_CLASS, next, "",
++                    configuration.getText("doclet.Next_Class"), true)));
++            li = HtmlTree.LI(nextLink);
+         }
++        else
++            li = HtmlTree.LI(nextclassLabel);
++        return li;
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeHeader(String header) {
++    public Content getHeader(String header) {
+         String pkgname = (classDoc.containingPackage() != null)?
+             classDoc.containingPackage().name(): "";
+         String clname = classDoc.name();
+-        printHtmlHeader(clname,
+-            configuration.metakeywords.getMetaKeywords(classDoc), true);
+-        printTop();
+-        navLinks(true);
+-        hr();
+-        println("<!-- ======== START OF CLASS DATA ======== -->");
+-        h2();
++        Content bodyTree = getBody(true, getWindowTitle(clname));
++        addTop(bodyTree);
++        addNavLinks(true, bodyTree);
++        bodyTree.addContent(HtmlConstants.START_OF_CLASS_DATA);
++        HtmlTree div = new HtmlTree(HtmlTag.DIV);
++        div.addStyle(HtmlStyle.header);
+         if (pkgname.length() > 0) {
+-            font("-1"); print(pkgname); fontEnd(); br();
++            Content pkgNameContent = new StringContent(pkgname);
++            Content pkgNamePara = HtmlTree.P(HtmlStyle.subTitle, pkgNameContent);
++            div.addContent(pkgNamePara);
+         }
+         LinkInfoImpl linkInfo = new LinkInfoImpl( LinkInfoImpl.CONTEXT_CLASS_HEADER,
+-            classDoc, false);
++                classDoc, false);
+         //Let's not link to ourselves in the header.
+         linkInfo.linkToSelf = false;
+-        print(header + getTypeParameterLinks(linkInfo));
+-        h2End();
++        Content headerContent = new StringContent(header);
++        Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, true,
++                HtmlStyle.title, headerContent);
++        heading.addContent(new RawHtml(getTypeParameterLinks(linkInfo)));
++        div.addContent(heading);
++        bodyTree.addContent(div);
++        return bodyTree;
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeFooter() {
+-        println("<!-- ========= END OF CLASS DATA ========= -->");
+-        hr();
+-        navLinks(false);
+-        printBottom();
+-        printBodyHtmlEnd();
++    public Content getClassContentHeader() {
++        return getContentHeader();
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeClassSignature(String modifiers) {
++    public void addFooter(Content contentTree) {
++        contentTree.addContent(HtmlConstants.END_OF_CLASS_DATA);
++        addNavLinks(false, contentTree);
++        addBottom(contentTree);
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public void printDocument(Content contentTree) {
++        printHtmlDocument(configuration.metakeywords.getMetaKeywords(classDoc),
++                true, contentTree);
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public Content getClassInfoTreeHeader() {
++        return getMemberTreeHeader();
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public Content getClassInfo(Content classInfoTree) {
++        return getMemberTree(HtmlStyle.description, classInfoTree);
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public void addClassSignature(String modifiers, Content classInfoTree) {
+         boolean isInterface = classDoc.isInterface();
+-        preNoNewLine();
+-        writeAnnotationInfo(classDoc);
+-        print(modifiers);
++        classInfoTree.addContent(new HtmlTree(HtmlTag.BR));
++        Content pre = new HtmlTree(HtmlTag.PRE);
++        addAnnotationInfo(classDoc, pre);
++        pre.addContent(modifiers);
+         LinkInfoImpl linkInfo = new LinkInfoImpl(
+-            LinkInfoImpl.CONTEXT_CLASS_SIGNATURE, classDoc, false);
++                LinkInfoImpl.CONTEXT_CLASS_SIGNATURE, classDoc, false);
+         //Let's not link to ourselves in the signature.
+         linkInfo.linkToSelf = false;
+-        String name = classDoc.name() +
+-            getTypeParameterLinks(linkInfo);
++        Content name = new RawHtml (classDoc.name() +
++                getTypeParameterLinks(linkInfo));
+         if (configuration().linksource) {
+-            printSrcLink(classDoc, name);
++            addSrcLink(classDoc, name, pre);
+         } else {
+-            strong(name);
++            pre.addContent(HtmlTree.STRONG(name));
+         }
+         if (!isInterface) {
+             Type superclass = Util.getFirstVisibleSuperClass(classDoc,
+-                configuration());
++                    configuration());
+             if (superclass != null) {
+-                println();
+-                print("extends ");
+-                printLink(new LinkInfoImpl(
+-                    LinkInfoImpl.CONTEXT_CLASS_SIGNATURE_PARENT_NAME,
+-                    superclass));
++                pre.addContent("\n");
++                pre.addContent("extends ");
++                Content link = new RawHtml(getLink(new LinkInfoImpl(
++                        LinkInfoImpl.CONTEXT_CLASS_SIGNATURE_PARENT_NAME,
++                        superclass)));
++                pre.addContent(link);
+             }
+         }
+         Type[] implIntfacs = classDoc.interfaceTypes();
+@@ -202,34 +253,33 @@
+             for (int i = 0; i < implIntfacs.length; i++) {
+                 ClassDoc classDoc = implIntfacs[i].asClassDoc();
+                 if (! (classDoc.isPublic() ||
+-                    Util.isLinkable(classDoc, configuration()))) {
++                        Util.isLinkable(classDoc, configuration()))) {
+                     continue;
+                 }
+                 if (counter == 0) {
+-                    println();
+-                    print(isInterface? "extends " : "implements ");
++                    pre.addContent("\n");
++                    pre.addContent(isInterface? "extends " : "implements ");
+                 } else {
+-                    print(", ");
++                    pre.addContent(", ");
+                 }
+-                printLink(new LinkInfoImpl(
+-                    LinkInfoImpl.CONTEXT_CLASS_SIGNATURE_PARENT_NAME,
+-                    implIntfacs[i]));
++                Content link = new RawHtml(getLink(new LinkInfoImpl(
++                        LinkInfoImpl.CONTEXT_CLASS_SIGNATURE_PARENT_NAME,
++                        implIntfacs[i])));
++                pre.addContent(link);
+                 counter++;
+             }
+         }
+-        preEnd();
+-        p();
++        classInfoTree.addContent(pre);
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeClassDescription() {
++    public void addClassDescription(Content classInfoTree) {
+         if(!configuration.nocomment) {
+             // generate documentation for the class.
+             if (classDoc.inlineTags().length > 0) {
+-                printInlineComment(classDoc);
+-                p();
++                addInlineComment(classDoc, classInfoTree);
+             }
+         }
+     }
+@@ -237,131 +287,118 @@
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeClassTagInfo() {
++    public void addClassTagInfo(Content classInfoTree) {
+         if(!configuration.nocomment) {
+             // Print Information about all the tags here
+-            printTags(classDoc);
+-            hr();
+-            p();
++            addTagsInfo(classDoc, classInfoTree);
++        }
++    }
++
++    /**
++     * Get the class hierarchy tree for the given class.
++     *
++     * @param type the class to print the hierarchy for
++     * @return a content tree for class inheritence
++     */
++    private Content getClassInheritenceTree(Type type) {
++        Type sup;
++        HtmlTree classTreeUl = new HtmlTree(HtmlTag.UL);
++        classTreeUl.addStyle(HtmlStyle.inheritance);
++        Content liTree = null;
++        do {
++            sup = Util.getFirstVisibleSuperClass(
++                    type instanceof ClassDoc ? (ClassDoc) type : type.asClassDoc(),
++                    configuration());
++            if (sup != null) {
++                HtmlTree ul = new HtmlTree(HtmlTag.UL);
++                ul.addStyle(HtmlStyle.inheritance);
++                ul.addContent(getTreeForClassHelper(type));
++                if (liTree != null)
++                    ul.addContent(liTree);
++                Content li = HtmlTree.LI(ul);
++                liTree = li;
++                type = sup;
++            }
++            else
++                classTreeUl.addContent(getTreeForClassHelper(type));
++        }
++        while (sup != null);
++        if (liTree != null)
++            classTreeUl.addContent(liTree);
++        return classTreeUl;
++    }
++
++    /**
++     * Get the class helper tree for the given class.
++     *
++     * @param type the class to print the helper for
++     * @return a content tree for class helper
++     */
++    private Content getTreeForClassHelper(Type type) {
++        Content li = new HtmlTree(HtmlTag.LI);
++        if (type.equals(classDoc)) {
++            String typeParameters = getTypeParameterLinks(
++                    new LinkInfoImpl(LinkInfoImpl.CONTEXT_TREE,
++                    classDoc, false));
++            if (configuration.shouldExcludeQualifier(
++                    classDoc.containingPackage().name())) {
++                li.addContent(type.asClassDoc().name());
++                li.addContent(new RawHtml(typeParameters));
++            } else {
++                li.addContent(type.asClassDoc().qualifiedName());
++                li.addContent(new RawHtml(typeParameters));
++            }
+         } else {
+-            hr();
++            Content link = new RawHtml(getLink(new LinkInfoImpl(
++                    LinkInfoImpl.CONTEXT_CLASS_TREE_PARENT,
++                    type instanceof ClassDoc ? (ClassDoc) type : type,
++                    configuration.getClassName(type.asClassDoc()), false)));
++            li.addContent(link);
++        }
++        return li;
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public void addClassTree(Content classContentTree) {
++        if (!classDoc.isClass()) {
++            return;
++        }
++        classContentTree.addContent(getClassInheritenceTree(classDoc));
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public void addTypeParamInfo(Content classInfoTree) {
++        if (classDoc.typeParamTags().length > 0) {
++            TagletOutput output = (new ParamTaglet()).getTagletOutput(classDoc,
++                    getTagletWriterInstance(false));
++            Content typeParam = new RawHtml(output.toString());
++            Content dl = HtmlTree.DL(typeParam);
++            classInfoTree.addContent(dl);
+         }
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeClassDeprecationInfo() {
+-        hr();
+-        Tag[] deprs = classDoc.tags("deprecated");
+-        if (Util.isDeprecated(classDoc)) {
+-            strongText("doclet.Deprecated");
+-            if (deprs.length > 0) {
+-                Tag[] commentTags = deprs[0].inlineTags();
+-                if (commentTags.length > 0) {
+-                    space();
+-                    printInlineDeprecatedComment(classDoc, deprs[0]);
+-                }
+-            }
+-            p();
+-        }
+-    }
+-
+-    /**
+-     * Generate the indent and get the line image for the class tree.
+-     * For user accessibility, the image includes the alt attribute
+-     * "extended by".  (This method is not intended for a class
+-     * implementing an interface, where "implemented by" would be required.)
+-     *
+-     * indent  integer indicating the number of spaces to indent
+-     */
+-    private void writeStep(int indent) {
+-        print(spaces(4 * indent - 2));
+-        print("<IMG SRC=\"" + relativepathNoSlash + "/resources/inherit.gif\" " +
+-              "ALT=\"" + configuration.getText("doclet.extended_by") + " \">");
+-    }
+-
+-    /**
+-     * Print the class hierarchy tree for the given class.
+-     * @param type the class to print the hierarchy for.
+-     * @return return the amount that should be indented in
+-     * the next level of the tree.
+-     */
+-    private int writeTreeForClassHelper(Type type) {
+-        Type sup = Util.getFirstVisibleSuperClass(
+-            type instanceof ClassDoc ? (ClassDoc) type : type.asClassDoc(),
+-            configuration());
+-        int indent = 0;
+-        if (sup != null) {
+-            indent = writeTreeForClassHelper(sup);
+-            writeStep(indent);
+-        }
+-
+-        if (type.equals(classDoc)) {
+-            String typeParameters = getTypeParameterLinks(
+-                new LinkInfoImpl(
+-                    LinkInfoImpl.CONTEXT_TREE,
+-                    classDoc, false));
+-            if (configuration.shouldExcludeQualifier(
+-                    classDoc.containingPackage().name())) {
+-                strong(type.asClassDoc().name() + typeParameters);
+-            } else {
+-                strong(type.asClassDoc().qualifiedName() + typeParameters);
+-            }
+-        } else {
+-            print(getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS_TREE_PARENT,
+-                    type instanceof ClassDoc ? (ClassDoc) type : type,
+-                    configuration.getClassName(type.asClassDoc()), false)));
+-        }
+-        println();
+-        return indent + 1;
+-    }
+-
+-    /**
+-     * Print the class hierarchy tree for this class only.
+-     */
+-    public void writeClassTree() {
+-        if (! classDoc.isClass()) {
+-            return;
+-        }
+-        pre();
+-        writeTreeForClassHelper(classDoc);
+-        preEnd();
+-    }
+-
+-    /**
+-     * Write the type parameter information.
+-     */
+-    public void writeTypeParamInfo() {
+-        if (classDoc.typeParamTags().length > 0) {
+-            dl();
+-            dt();
+-            TagletOutput output = (new ParamTaglet()).getTagletOutput(classDoc,
+-                getTagletWriterInstance(false));
+-            print(output.toString());
+-            dtEnd();
+-            dlEnd();
+-        }
+-    }
+-
+-    /**
+-     * {@inheritDoc}
+-     */
+-    public void writeSubClassInfo() {
++    public void addSubClassInfo(Content classInfoTree) {
+         if (classDoc.isClass()) {
+             if (classDoc.qualifiedName().equals("java.lang.Object") ||
+-                classDoc.qualifiedName().equals("org.omg.CORBA.Object")) {
++                    classDoc.qualifiedName().equals("org.omg.CORBA.Object")) {
+                 return;    // Don't generate the list, too huge
+             }
+             List subclasses = classtree.subs(classDoc, false);
+             if (subclasses.size() > 0) {
+-                dl();
+-                dt();
+-                strongText("doclet.Subclasses");
+-                dtEnd();
+-                writeClassLinks(LinkInfoImpl.CONTEXT_SUBCLASSES,
+-                    subclasses);
+-                dlEnd();
++                Content label = getResource(
++                        "doclet.Subclasses");
++                Content dt = HtmlTree.DT(label);
++                Content dl = HtmlTree.DL(dt);
++                dl.addContent(getClassLinks(LinkInfoImpl.CONTEXT_SUBCLASSES,
++                        subclasses));
++                classInfoTree.addContent(dl);
+             }
+         }
+     }
+@@ -369,140 +406,196 @@
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeSubInterfacesInfo() {
++    public void addSubInterfacesInfo(Content classInfoTree) {
+         if (classDoc.isInterface()) {
+             List subInterfaces = classtree.allSubs(classDoc, false);
+             if (subInterfaces.size() > 0) {
+-                dl();
+-                dt();
+-                strongText("doclet.Subinterfaces");
+-                dtEnd();
+-                writeClassLinks(LinkInfoImpl.CONTEXT_SUBINTERFACES,
+-                    subInterfaces);
+-                dlEnd();
++                Content label = getResource(
++                        "doclet.Subinterfaces");
++                Content dt = HtmlTree.DT(label);
++                Content dl = HtmlTree.DL(dt);
++                dl.addContent(getClassLinks(LinkInfoImpl.CONTEXT_SUBINTERFACES,
++                        subInterfaces));
++                classInfoTree.addContent(dl);
+             }
+         }
+     }
+ 
+     /**
+-     * If this is the interface which are the classes, that implement this?
+-     */
+-    public void writeInterfaceUsageInfo () {
+-        if (! classDoc.isInterface()) {
+-            return;
+-        }
+-        if (classDoc.qualifiedName().equals("java.lang.Cloneable") ||
+-            classDoc.qualifiedName().equals("java.io.Serializable")) {
+-            return;   // Don't generate the list, too big
+-        }
+-        List implcl = classtree.implementingclasses(classDoc);
+-        if (implcl.size() > 0) {
+-            dl();
+-            dt();
+-            strongText("doclet.Implementing_Classes");
+-            dtEnd();
+-            writeClassLinks(LinkInfoImpl.CONTEXT_IMPLEMENTED_CLASSES,
+-                implcl);
+-            dlEnd();
+-        }
+-    }
+-
+-    /**
+      * {@inheritDoc}
+      */
+-    public void writeImplementedInterfacesInfo() {
+-        //NOTE:  we really should be using ClassDoc.interfaceTypes() here, but
+-        //       it doesn't walk up the tree like we want it to.
+-        List interfaceArray = Util.getAllInterfaces(classDoc, configuration);
+-        if (classDoc.isClass() && interfaceArray.size() > 0) {
+-            dl();
+-            dt();
+-            strongText("doclet.All_Implemented_Interfaces");
+-            dtEnd();
+-            writeClassLinks(LinkInfoImpl.CONTEXT_IMPLEMENTED_INTERFACES,
+-                interfaceArray);
+-            dlEnd();
++    public void addInterfaceUsageInfo (Content classInfoTree) {
++        if (! classDoc.isInterface()) {
++            return;
++        }
++        if (classDoc.qualifiedName().equals("java.lang.Cloneable") ||
++                classDoc.qualifiedName().equals("java.io.Serializable")) {
++            return;   // Don't generate the list, too big
++        }
++        List<ClassDoc> implcl = classtree.implementingclasses(classDoc);
++        if (implcl.size() > 0) {
++            Content label = getResource(
++                    "doclet.Implementing_Classes");
++            Content dt = HtmlTree.DT(label);
++            Content dl = HtmlTree.DL(dt);
++            dl.addContent(getClassLinks(LinkInfoImpl.CONTEXT_IMPLEMENTED_CLASSES,
++                    implcl));
++            classInfoTree.addContent(dl);
+         }
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeSuperInterfacesInfo() {
++    public void addImplementedInterfacesInfo(Content classInfoTree) {
++        //NOTE:  we really should be using ClassDoc.interfaceTypes() here, but
++        //       it doesn't walk up the tree like we want it to.
++        List<Type> interfaceArray = Util.getAllInterfaces(classDoc, configuration);
++        if (classDoc.isClass() && interfaceArray.size() > 0) {
++            Content label = getResource(
++                    "doclet.All_Implemented_Interfaces");
++            Content dt = HtmlTree.DT(label);
++            Content dl = HtmlTree.DL(dt);
++            dl.addContent(getClassLinks(LinkInfoImpl.CONTEXT_IMPLEMENTED_INTERFACES,
++                    interfaceArray));
++            classInfoTree.addContent(dl);
++        }
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public void addSuperInterfacesInfo(Content classInfoTree) {
+         //NOTE:  we really should be using ClassDoc.interfaceTypes() here, but
+         //       it doesn't walk up the tree like we want it to.
+         List interfaceArray = Util.getAllInterfaces(classDoc, configuration);
+         if (classDoc.isInterface() && interfaceArray.size() > 0) {
+-            dl();
+-            dt();
+-            strongText("doclet.All_Superinterfaces");
+-            dtEnd();
+-            writeClassLinks(LinkInfoImpl.CONTEXT_SUPER_INTERFACES,
+-                interfaceArray);
+-            dlEnd();
++            Content label = getResource(
++                    "doclet.All_Superinterfaces");
++            Content dt = HtmlTree.DT(label);
++            Content dl = HtmlTree.DL(dt);
++            dl.addContent(getClassLinks(LinkInfoImpl.CONTEXT_SUPER_INTERFACES,
++                    interfaceArray));
++            classInfoTree.addContent(dl);
+         }
+     }
+ 
+     /**
+-     * Generate links to the given classes.
++     * {@inheritDoc}
+      */
+-    private void writeClassLinks(int context, List list) {
++    public void addNestedClassInfo(Content classInfoTree) {
++        ClassDoc outerClass = classDoc.containingClass();
++        if (outerClass != null) {
++            Content label;
++            if (outerClass.isInterface()) {
++                label = getResource(
++                        "doclet.Enclosing_Interface");
++            } else {
++                label = getResource(
++                        "doclet.Enclosing_Class");
++            }
++            Content dt = HtmlTree.DT(label);
++            Content dl = HtmlTree.DL(dt);
++            Content dd = new HtmlTree(HtmlTag.DD);
++            dd.addContent(new RawHtml(getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS, outerClass,
++                    false))));
++            dl.addContent(dd);
++            classInfoTree.addContent(dl);
++        }
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public void addClassDeprecationInfo(Content classInfoTree) {
++        Content hr = new HtmlTree(HtmlTag.HR);
++        classInfoTree.addContent(hr);
++        Tag[] deprs = classDoc.tags("deprecated");
++        if (Util.isDeprecated(classDoc)) {
++            Content strong = HtmlTree.STRONG(deprecatedPhrase);
++            Content div = HtmlTree.DIV(HtmlStyle.block, strong);
++            if (deprs.length > 0) {
++                Tag[] commentTags = deprs[0].inlineTags();
++                if (commentTags.length > 0) {
++                    div.addContent(getSpace());
++                    addInlineDeprecatedComment(classDoc, deprs[0], div);
++                }
++            }
++            classInfoTree.addContent(div);
++        }
++    }
++
++    /**
++     * Get links to the given classes.
++     *
++     * @param context the id of the context where the link will be printed
++     * @param list the list of classes
++     * @return a content tree for the class list
++     */
++    private Content getClassLinks(int context, List<?> list) {
+         Object[] typeList = list.toArray();
+-        //Sort the list to be printed.
+-        print(' ');
+-        dd();
++        Content dd = new HtmlTree(HtmlTag.DD);
+         for (int i = 0; i < list.size(); i++) {
+             if (i > 0) {
+-                print(", ");
++                Content separator = new StringContent(", ");
++                dd.addContent(separator);
+             }
+             if (typeList[i] instanceof ClassDoc) {
+-                printLink(new LinkInfoImpl(context, (ClassDoc)(typeList[i])));
+-
++                Content link = new RawHtml(getLink(
++                        new LinkInfoImpl(context, (ClassDoc)(typeList[i]))));
++                dd.addContent(link);
+             } else {
+-                printLink(new LinkInfoImpl(context, (Type)(typeList[i])));
++                Content link = new RawHtml(getLink(
++                        new LinkInfoImpl(context, (Type)(typeList[i]))));
++                dd.addContent(link);
+             }
+         }
+-        ddEnd();
++        return dd;
+     }
+ 
+-    protected void navLinkTree() {
+-        navCellStart();
+-        printHyperLink("package-tree.html", "",
+-            configuration.getText("doclet.Tree"), true, "NavBarFont1");
+-        navCellEnd();
++    /**
++     * {@inheritDoc}
++     */
++    protected Content getNavLinkTree() {
++        Content treeLinkContent = getHyperLink("package-tree.html",
++                "", treeLabel, "", "");
++        Content li = HtmlTree.LI(treeLinkContent);
++        return li;
+     }
+ 
+-    protected void printSummaryDetailLinks() {
++    /**
++     * Add summary details to the navigation bar.
++     *
++     * @param subDiv the content tree to which the summary detail links will be added
++     */
++    protected void addSummaryDetailLinks(Content subDiv) {
+         try {
+-            tr();
+-            tdVAlignClass("top", "NavBarCell3");
+-            font("-2");
+-            print("  ");
+-            navSummaryLinks();
+-            fontEnd();
+-            tdEnd();
+-            tdVAlignClass("top", "NavBarCell3");
+-            font("-2");
+-            navDetailLinks();
+-            fontEnd();
+-            tdEnd();
+-            trEnd();
++            Content div = HtmlTree.DIV(getNavSummaryLinks());
++            div.addContent(getNavDetailLinks());
++            subDiv.addContent(div);
+         } catch (Exception e) {
+             e.printStackTrace();
+             throw new DocletAbortException();
+         }
+     }
+ 
+-    protected void navSummaryLinks() throws Exception {
+-        printText("doclet.Summary");
+-        space();
++    /**
++     * Get summary links for navigation bar.
++     *
++     * @return the content tree for the navigation summary links
++     */
++    protected Content getNavSummaryLinks() throws Exception {
++        Content li = HtmlTree.LI(summaryLabel);
++        li.addContent(getSpace());
++        Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
+         MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
+-            configuration.getBuilderFactory().getMemberSummaryBuilder(this);
++                configuration.getBuilderFactory().getMemberSummaryBuilder(this);
+         String[] navLinkLabels =  new String[] {
+             "doclet.navNested", "doclet.navEnum", "doclet.navField", "doclet.navConstructor",
+-                "doclet.navMethod"
++            "doclet.navMethod"
+         };
+         for (int i = 0; i < navLinkLabels.length; i++ ) {
++            Content liNav = new HtmlTree(HtmlTag.LI);
+             if (i == VisibleMemberMap.ENUM_CONSTANTS && ! classDoc.isEnum()) {
+                 continue;
+             }
+@@ -511,38 +604,41 @@
+             }
+             AbstractMemberWriter writer =
+                 ((AbstractMemberWriter) memberSummaryBuilder.
+-                    getMemberSummaryWriter(i));
++                getMemberSummaryWriter(i));
+             if (writer == null) {
+-                printText(navLinkLabels[i]);
++                liNav.addContent(getResource(navLinkLabels[i]));
+             } else {
+-                writer.navSummaryLink(
+-                    memberSummaryBuilder.members(i),
+-                    memberSummaryBuilder.getVisibleMemberMap(i));
++                writer.addNavSummaryLink(
++                        memberSummaryBuilder.members(i),
++                        memberSummaryBuilder.getVisibleMemberMap(i), liNav);
+             }
+             if (i < navLinkLabels.length-1) {
+-                navGap();
++                addNavGap(liNav);
+             }
++            ulNav.addContent(liNav);
+         }
++        return ulNav;
+     }
+ 
+     /**
+-     * Method navDetailLinks
++     * Get detail links for the navigation bar.
+      *
+-     * @throws   Exception
+-     *
++     * @return the content tree for the detail links
+      */
+-    protected void navDetailLinks() throws Exception {
+-        printText("doclet.Detail");
+-        space();
++    protected Content getNavDetailLinks() throws Exception {
++        Content li = HtmlTree.LI(detailLabel);
++        li.addContent(getSpace());
++        Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
+         MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
+-            configuration.getBuilderFactory().getMemberSummaryBuilder(this);
++                configuration.getBuilderFactory().getMemberSummaryBuilder(this);
+         String[] navLinkLabels =  new String[] {
+             "doclet.navNested", "doclet.navEnum", "doclet.navField", "doclet.navConstructor",
+-                "doclet.navMethod"
++            "doclet.navMethod"
+         };
+         for (int i = 1; i < navLinkLabels.length; i++ ) {
++            Content liNav = new HtmlTree(HtmlTag.LI);
+             AbstractMemberWriter writer =
+-                ((AbstractMemberWriter) memberSummaryBuilder.
++                    ((AbstractMemberWriter) memberSummaryBuilder.
+                     getMemberSummaryWriter(i));
+             if (i == VisibleMemberMap.ENUM_CONSTANTS && ! classDoc.isEnum()) {
+                 continue;
+@@ -551,43 +647,27 @@
+                 continue;
+             }
+             if (writer == null) {
+-                printText(navLinkLabels[i]);
++                liNav.addContent(getResource(navLinkLabels[i]));
+             } else {
+-                writer.navDetailLink(memberSummaryBuilder.members(i));
++                writer.addNavDetailLink(memberSummaryBuilder.members(i), liNav);
+             }
+             if (i < navLinkLabels.length - 1) {
+-                navGap();
++                addNavGap(liNav);
+             }
++            ulNav.addContent(liNav);
+         }
+-    }
+-
+-    protected void navGap() {
+-        space();
+-        print('|');
+-        space();
++        return ulNav;
+     }
+ 
+     /**
+-     * If this is an inner class or interface, write the enclosing class or
+-     * interface.
++     * Add gap between navigation bar elements.
++     *
++     * @param liNav the content tree to which the gap will be added
+      */
+-    public void writeNestedClassInfo() {
+-        ClassDoc outerClass = classDoc.containingClass();
+-        if (outerClass != null) {
+-            dl();
+-            dt();
+-            if (outerClass.isInterface()) {
+-                strongText("doclet.Enclosing_Interface");
+-            } else {
+-                strongText("doclet.Enclosing_Class");
+-            }
+-            dtEnd();
+-            dd();
+-            printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS, outerClass,
+-                false));
+-            ddEnd();
+-            dlEnd();
+-        }
++    protected void addNavGap(Content liNav) {
++        liNav.addContent(getSpace());
++        liNav.addContent("|");
++        liNav.addContent(getSpace());
+     }
+ 
+     /**
+@@ -598,11 +678,4 @@
+     public ClassDoc getClassDoc() {
+         return classDoc;
+     }
+-
+-    /**
+-     * {@inheritDoc}
+-     */
+-    public void completeMemberSummaryBuild() {
+-        p();
+-    }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java
+@@ -25,11 +25,12 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
++import java.io.*;
++import java.util.*;
++import com.sun.javadoc.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+-import com.sun.javadoc.*;
+-import java.io.*;
+-import java.util.*;
++import com.sun.tools.doclets.formats.html.markup.*;
+ 
+ /**
+  * Write the Constants Summary Page in HTML format.
+@@ -76,67 +77,106 @@
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeHeader() {
+-        printHtmlHeader(configuration.getText("doclet.Constants_Summary"),
+-            null, true);
+-        printTop();
+-        navLinks(true);
+-        hr();
+-
+-        center();
+-        h1(); printText("doclet.Constants_Summary"); h1End();
+-        centerEnd();
+-
+-        hr(4, "noshade");
++    public Content getHeader() {
++        String label = configuration.getText("doclet.Constants_Summary");
++        Content bodyTree = getBody(true, getWindowTitle(label));
++        addTop(bodyTree);
++        addNavLinks(true, bodyTree);
++        return bodyTree;
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeFooter() {
+-        hr();
+-        navLinks(false);
+-        printBottom();
+-        printBodyHtmlEnd();
++    public Content getContentsHeader() {
++        return new HtmlTree(HtmlTag.UL);
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeContentsHeader() {
+-        strong(configuration.getText("doclet.Contents"));
+-        ul();
++    public void addLinkToPackageContent(PackageDoc pkg, String parsedPackageName,
++            Set<String> printedPackageHeaders, Content contentListTree) {
++        String packageName = pkg.name();
++        //add link to summary
++        Content link;
++        if (packageName.length() == 0) {
++            link = getHyperLink("#" + DocletConstants.UNNAMED_PACKAGE_ANCHOR,
++                    "", defaultPackageLabel, "", "");
++        } else {
++            Content packageNameContent = getPackageLabel(parsedPackageName);
++            packageNameContent.addContent(".*");
++            link = getHyperLink("#" + parsedPackageName,
++                    "", packageNameContent, "", "");
++            printedPackageHeaders.add(parsedPackageName);
++        }
++        contentListTree.addContent(HtmlTree.LI(link));
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeContentsFooter() {
+-        ulEnd();
+-        println();
++    public Content getContentsList(Content contentListTree) {
++        Content titleContent = getResource(
++                "doclet.Constants_Summary");
++        Content pHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
++                HtmlStyle.title, titleContent);
++        Content div = HtmlTree.DIV(HtmlStyle.header, pHeading);
++        Content headingContent = getResource(
++                "doclet.Contents");
++        div.addContent(HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true,
++                headingContent));
++        div.addContent(contentListTree);
++        return div;
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeLinkToPackageContent(PackageDoc pkg, String parsedPackageName, Set printedPackageHeaders) {
+-        String packageName = pkg.name();
+-        //add link to summary
+-        li();
+-        if (packageName.length() == 0) {
+-            printHyperLink("#" + DocletConstants.UNNAMED_PACKAGE_ANCHOR,
+-                           DocletConstants.DEFAULT_PACKAGE_NAME);
+-        } else {
+-            printHyperLink("#" + parsedPackageName, parsedPackageName + ".*");
+-            printedPackageHeaders.add(parsedPackageName);
+-        }
+-        println();
++    public Content getConstantSummaries() {
++        HtmlTree summariesDiv = new HtmlTree(HtmlTag.DIV);
++        summariesDiv.addStyle(HtmlStyle.constantValuesContainer);
++        return summariesDiv;
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeConstantMembersHeader(ClassDoc cd) {
++    public void addPackageName(PackageDoc pkg, String parsedPackageName,
++            Content summariesTree) {
++        Content pkgNameContent;
++        if (parsedPackageName.length() == 0) {
++            summariesTree.addContent(getMarkerAnchor(
++                    DocletConstants.UNNAMED_PACKAGE_ANCHOR));
++            pkgNameContent = defaultPackageLabel;
++        } else {
++            summariesTree.addContent(getMarkerAnchor(
++                    parsedPackageName));
++            pkgNameContent = getPackageLabel(parsedPackageName);
++        }
++        Content headingContent = new StringContent(".*");
++        Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
++                pkgNameContent);
++        heading.addContent(headingContent);
++        summariesTree.addContent(heading);
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public Content getClassConstantHeader() {
++        HtmlTree ul = new HtmlTree(HtmlTag.UL);
++        ul.addStyle(HtmlStyle.blockList);
++        return ul;
++    }
++
++    /**
++     * Get the table caption and header for the constant summary table
++     *
++     * @param cd classdoc to be documented
++     * @return constant members header content
++     */
++    public Content getConstantMembersHeader(ClassDoc cd) {
+         //generate links backward only to public classes.
+         String classlink = (cd.isPublic() || cd.isProtected())?
+             getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CONSTANT_SUMMARY, cd,
+@@ -144,112 +184,120 @@
+             cd.qualifiedName();
+         String name = cd.containingPackage().name();
+         if (name.length() > 0) {
+-            writeClassName(name + "." + classlink);
++            return getClassName(name + "." + classlink);
+         } else {
+-            writeClassName(classlink);
++            return getClassName(classlink);
+         }
+     }
+ 
+     /**
++     * Get the class name in the table caption and the table header.
++     *
++     * @param classStr the class name to print.
++     * @return the table caption and header
++     */
++    protected Content getClassName(String classStr) {
++        Content table = HtmlTree.TABLE(0, 3, 0, constantsTableSummary,
++                getTableCaption(classStr));
++        table.addContent(getSummaryTableHeader(constantsTableHeader, "col"));
++        return table;
++    }
++
++    /**
+      * {@inheritDoc}
+      */
+-    public void writeConstantMembersFooter(ClassDoc cd) {
+-        tableFooter(false);
+-        p();
++    public void addConstantMembers(ClassDoc cd, List<FieldDoc> fields,
++            Content classConstantTree) {
++        currentClassDoc = cd;
++        Content tbody = new HtmlTree(HtmlTag.TBODY);
++        for (int i = 0; i < fields.size(); ++i) {
++            HtmlTree tr = new HtmlTree(HtmlTag.TR);
++            if (i%2 == 0)
++                tr.addStyle(HtmlStyle.altColor);
++            else
++                tr.addStyle(HtmlStyle.rowColor);
++            addConstantMember(fields.get(i), tr);
++            tbody.addContent(tr);
++        }
++        Content table = getConstantMembersHeader(cd);
++        table.addContent(tbody);
++        Content li = HtmlTree.LI(HtmlStyle.blockList, table);
++        classConstantTree.addContent(li);
+     }
+ 
+     /**
+-     * Print the class name in the table heading.
+-     * @param classStr the heading to print.
++     * Add the row for the constant summary table.
++     *
++     * @param member the field to be documented.
++     * @param trTree an htmltree object for the table row
+      */
+-    protected void writeClassName(String classStr) {
+-        table(1, 3, 0, constantsTableSummary);
+-        tableSubCaptionStart();
+-        write(classStr);
+-        tableCaptionEnd();
+-        summaryTableHeader(constantsTableHeader, "col");
++    private void addConstantMember(FieldDoc member, HtmlTree trTree) {
++        trTree.addContent(getTypeColumn(member));
++        trTree.addContent(getNameColumn(member));
++        trTree.addContent(getValue(member));
+     }
+ 
+-    private void tableFooter(boolean isHeader) {
+-        fontEnd();
+-        if (isHeader) {
+-            thEnd();
+-        } else {
+-            tdEnd();
++    /**
++     * Get the type column for the constant summary table row.
++     *
++     * @param member the field to be documented.
++     * @return the type column of the constant table row
++     */
++    private Content getTypeColumn(FieldDoc member) {
++        Content anchor = getMarkerAnchor(currentClassDoc.qualifiedName() +
++                "." + member.name());
++        Content tdType = HtmlTree.TD(HtmlStyle.colFirst, anchor);
++        Content code = new HtmlTree(HtmlTag.CODE);
++        StringTokenizer mods = new StringTokenizer(member.modifiers());
++        while(mods.hasMoreTokens()) {
++            Content modifier = new StringContent(mods.nextToken());
++            code.addContent(modifier);
++            code.addContent(getSpace());
+         }
+-        trEnd();
+-        tableEnd();
+-        p();
++        Content type = new RawHtml(getLink(new LinkInfoImpl(
++                LinkInfoImpl.CONTEXT_CONSTANT_SUMMARY, member.type())));
++        code.addContent(type);
++        tdType.addContent(code);
++        return tdType;
++    }
++
++    /**
++     * Get the name column for the constant summary table row.
++     *
++     * @param member the field to be documented.
++     * @return the name column of the constant table row
++     */
++    private Content getNameColumn(FieldDoc member) {
++        Content nameContent = new RawHtml(getDocLink(
++                LinkInfoImpl.CONTEXT_CONSTANT_SUMMARY, member, member.name(), false));
++        Content code = HtmlTree.CODE(nameContent);
++        return HtmlTree.TD(code);
++    }
++
++    /**
++     * Get the value column for the constant summary table row.
++     *
++     * @param member the field to be documented.
++     * @return the value column of the constant table row
++     */
++    private Content getValue(FieldDoc member) {
++        Content valueContent = new StringContent(member.constantValueExpression());
++        Content code = HtmlTree.CODE(valueContent);
++        return HtmlTree.TD(HtmlStyle.colLast, code);
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writePackageName(PackageDoc pkg, String parsedPackageName) {
+-        String pkgname;
+-        if (parsedPackageName.length() == 0) {
+-            anchor(DocletConstants.UNNAMED_PACKAGE_ANCHOR);
+-            pkgname = DocletConstants.DEFAULT_PACKAGE_NAME;
+-        } else {
+-            anchor(parsedPackageName);
+-            pkgname = parsedPackageName;
+-        }
+-        table(1, "100%", 3, 0);
+-        trBgcolorStyle("#CCCCFF", "TableHeadingColor");
+-        thAlign("left");
+-        font("+2");
+-        write(pkgname + ".*");
+-        tableFooter(true);
++    public void addFooter(Content contentTree) {
++        addNavLinks(false, contentTree);
++        addBottom(contentTree);
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeConstantMembers(ClassDoc cd, List fields) {
+-        currentClassDoc = cd;
+-        for (int i = 0; i < fields.size(); ++i) {
+-            writeConstantMember((FieldDoc)(fields.get(i)));
+-        }
+-    }
+-
+-    private void writeConstantMember(FieldDoc member) {
+-        trBgcolorStyle("white", "TableRowColor");
+-        anchor(currentClassDoc.qualifiedName() + "." + member.name());
+-        writeTypeColumn(member);
+-        writeNameColumn(member);
+-        writeValue(member);
+-        trEnd();
+-    }
+-
+-    private void writeTypeColumn(FieldDoc member) {
+-        tdAlign("right");
+-        font("-1");
+-        code();
+-        StringTokenizer mods = new StringTokenizer(member.modifiers());
+-        while(mods.hasMoreTokens()) {
+-            print(mods.nextToken() + " ");
+-        }
+-        printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CONSTANT_SUMMARY,
+-            member.type()));
+-        codeEnd();
+-        fontEnd();
+-        tdEnd();
+-    }
+-
+-    private void writeNameColumn(FieldDoc member) {
+-        tdAlign("left");
+-        code();
+-        printDocLink(LinkInfoImpl.CONTEXT_CONSTANT_SUMMARY, member,
+-            member.name(), false);
+-        codeEnd();
+-        tdEnd();
+-    }
+-
+-    private void writeValue(FieldDoc member) {
+-        tdAlign("right");
+-        code();
+-        print(Util.escapeHtmlChars(member.constantValueExpression()));
+-        codeEnd();
+-        tdEnd();
++    public void printDocument(Content contentTree) {
++        printHtmlDocument(null, true, contentTree);
+     }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java
+@@ -29,6 +29,7 @@
+ import java.util.*;
+ 
+ import com.sun.javadoc.*;
++import com.sun.tools.doclets.formats.html.markup.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+ 
+@@ -43,7 +44,6 @@
+     implements ConstructorWriter, MemberSummaryWriter {
+ 
+     private boolean foundNonPubConstructor = false;
+-    private boolean printedSummaryHeader = false;
+ 
+     /**
+      * Construct a new ConstructorWriterImpl.
+@@ -75,125 +75,112 @@
+     }
+ 
+     /**
+-     * Write the constructors summary header for the given class.
+-     *
+-     * @param classDoc the class the summary belongs to.
++     * {@inheritDoc}
+      */
+-    public void writeMemberSummaryHeader(ClassDoc classDoc) {
+-        printedSummaryHeader = true;
+-        writer.println();
+-        writer.println("<!-- ======== CONSTRUCTOR SUMMARY ======== -->");
+-        writer.println();
+-        writer.printSummaryHeader(this, classDoc);
++    public Content getMemberSummaryHeader(ClassDoc classDoc,
++            Content memberSummaryTree) {
++        memberSummaryTree.addContent(HtmlConstants.START_OF_CONSTRUCTOR_SUMMARY);
++        Content memberTree = writer.getMemberTreeHeader();
++        writer.addSummaryHeader(this, classDoc, memberTree);
++        return memberTree;
+     }
+ 
+     /**
+-     * Write the constructors summary footer for the given class.
+-     *
+-     * @param classDoc the class the summary belongs to.
++     * {@inheritDoc}
+      */
+-    public void writeMemberSummaryFooter(ClassDoc classDoc) {
+-        writer.printSummaryFooter(this, classDoc);
++    public Content getConstructorDetailsTreeHeader(ClassDoc classDoc,
++            Content memberDetailsTree) {
++        memberDetailsTree.addContent(HtmlConstants.START_OF_CONSTRUCTOR_DETAILS);
++        Content constructorDetailsTree = writer.getMemberTreeHeader();
++        constructorDetailsTree.addContent(writer.getMarkerAnchor("constructor_detail"));
++        Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
++                writer.constructorDetailsLabel);
++        constructorDetailsTree.addContent(heading);
++        return constructorDetailsTree;
+     }
+ 
+     /**
+-     * Write the header for the constructor documentation.
+-     *
+-     * @param classDoc the class that the constructors belong to.
++     * {@inheritDoc}
+      */
+-    public void writeHeader(ClassDoc classDoc, String header) {
+-        writer.println();
+-        writer.println("<!-- ========= CONSTRUCTOR DETAIL ======== -->");
+-        writer.println();
+-        writer.anchor("constructor_detail");
+-        writer.printTableHeadingBackground(header);
++    public Content getConstructorDocTreeHeader(ConstructorDoc constructor,
++            Content constructorDetailsTree) {
++        String erasureAnchor;
++        if ((erasureAnchor = getErasureAnchor(constructor)) != null) {
++            constructorDetailsTree.addContent(writer.getMarkerAnchor((erasureAnchor)));
++        }
++        constructorDetailsTree.addContent(
++                writer.getMarkerAnchor(writer.getAnchor(constructor)));
++        Content constructorDocTree = writer.getMemberTreeHeader();
++        Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING);
++        heading.addContent(constructor.name());
++        constructorDocTree.addContent(heading);
++        return constructorDocTree;
+     }
+ 
+     /**
+-     * Write the constructor header for the given constructor.
+-     *
+-     * @param constructor the constructor being documented.
+-     * @param isFirst the flag to indicate whether or not the constructor is the
+-     *        first to be documented.
++     * {@inheritDoc}
+      */
+-    public void writeConstructorHeader(ConstructorDoc constructor, boolean isFirst) {
+-        if (! isFirst) {
+-            writer.printMemberHeader();
++    public Content getSignature(ConstructorDoc constructor) {
++        writer.displayLength = 0;
++        Content pre = new HtmlTree(HtmlTag.PRE);
++        writer.addAnnotationInfo(constructor, pre);
++        addModifiers(constructor, pre);
++        if (configuration().linksource) {
++            Content constructorName = new StringContent(constructor.name());
++            writer.addSrcLink(constructor, constructorName, pre);
++        } else {
++            addName(constructor.name(), pre);
+         }
+-        writer.println();
+-        String erasureAnchor;
+-        if ((erasureAnchor = getErasureAnchor(constructor)) != null) {
+-            writer.anchor(erasureAnchor);
+-        }
+-        writer.anchor(constructor);
+-        writer.h3();
+-        writer.print(constructor.name());
+-        writer.h3End();
++        addParameters(constructor, pre);
++        addExceptions(constructor, pre);
++        return pre;
+     }
+ 
+     /**
+-     * Write the signature for the given constructor.
+-     *
+-     * @param constructor the constructor being documented.
++     * {@inheritDoc}
+      */
+-    public void writeSignature(ConstructorDoc constructor) {
+-        writer.displayLength = 0;
+-        writer.pre();
+-        writer.writeAnnotationInfo(constructor);
+-        printModifiers(constructor);
+-        //printReturnType((ConstructorDoc)constructor);
+-        if (configuration().linksource) {
+-            writer.printSrcLink(constructor, constructor.name());
+-        } else {
+-            strong(constructor.name());
+-        }
+-        writeParameters(constructor);
+-        writeExceptions(constructor);
+-        writer.preEnd();
+-        assert !writer.getMemberDetailsListPrinted();
++    @Override
++    public void setSummaryColumnStyle(HtmlTree tdTree) {
++        if (foundNonPubConstructor)
++            tdTree.addStyle(HtmlStyle.colLast);
++        else
++            tdTree.addStyle(HtmlStyle.colOne);
+     }
+ 
+     /**
+-     * Write the deprecated output for the given constructor.
+-     *
+-     * @param constructor the constructor being documented.
++     * {@inheritDoc}
+      */
+-    public void writeDeprecated(ConstructorDoc constructor) {
+-        printDeprecated(constructor);
++    public void addDeprecated(ConstructorDoc constructor, Content constructorDocTree) {
++        addDeprecatedInfo(constructor, constructorDocTree);
+     }
+ 
+     /**
+-     * Write the comments for the given constructor.
+-     *
+-     * @param constructor the constructor being documented.
++     * {@inheritDoc}
+      */
+-    public void writeComments(ConstructorDoc constructor) {
+-        printComment(constructor);
++    public void addComments(ConstructorDoc constructor, Content constructorDocTree) {
++        addComment(constructor, constructorDocTree);
+     }
+ 
+     /**
+-     * Write the tag output for the given constructor.
+-     *
+-     * @param constructor the constructor being documented.
++     * {@inheritDoc}
+      */
+-    public void writeTags(ConstructorDoc constructor) {
+-        writer.printTags(constructor);
++    public void addTags(ConstructorDoc constructor, Content constructorDocTree) {
++        writer.addTagsInfo(constructor, constructorDocTree);
+     }
+ 
+     /**
+-     * Write the constructor footer.
++     * {@inheritDoc}
+      */
+-    public void writeConstructorFooter() {
+-        printMemberFooter();
++    public Content getConstructorDetails(Content constructorDetailsTree) {
++        return getMemberTree(constructorDetailsTree);
+     }
+ 
+     /**
+-     * Write the footer for the constructor documentation.
+-     *
+-     * @param classDoc the class that the constructors belong to.
++     * {@inheritDoc}
+      */
+-    public void writeFooter(ClassDoc classDoc) {
+-        //No footer to write for constructor documentation
++    public Content getConstructorDoc(Content constructorDocTree,
++            boolean isLastContent) {
++        return getMemberTree(constructorDocTree, isLastContent);
+     }
+ 
+     /**
+@@ -212,17 +199,35 @@
+         this.foundNonPubConstructor = foundNonPubConstructor;
+     }
+ 
+-    public void printSummaryLabel() {
+-        writer.printText("doclet.Constructor_Summary");
++    /**
++     * {@inheritDoc}
++     */
++    public void addSummaryLabel(Content memberTree) {
++        Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
++                writer.getResource("doclet.Constructor_Summary"));
++        memberTree.addContent(label);
+     }
+ 
+-    public void printTableSummary() {
+-        writer.tableIndexSummary(configuration().getText("doclet.Member_Table_Summary",
++    /**
++     * {@inheritDoc}
++     */
++    public String getTableSummary() {
++        return configuration().getText("doclet.Member_Table_Summary",
+                 configuration().getText("doclet.Constructor_Summary"),
+-                configuration().getText("doclet.constructors")));
++                configuration().getText("doclet.constructors"));
+     }
+ 
+-    public void printSummaryTableHeader(ProgramElementDoc member) {
++    /**
++     * {@inheritDoc}
++     */
++    public String getCaption() {
++        return configuration().getText("doclet.Constructors");
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public String[] getSummaryTableHeader(ProgramElementDoc member) {
+         String[] header;
+         if (foundNonPubConstructor) {
+             header = new String[] {
+@@ -239,87 +244,73 @@
+                         configuration().getText("doclet.Description"))
+             };
+         }
+-        writer.summaryTableHeader(header, "col");
++        return header;
+     }
+ 
+-    public void printSummaryAnchor(ClassDoc cd) {
+-        writer.anchor("constructor_summary");
++    /**
++     * {@inheritDoc}
++     */
++    public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
++        memberTree.addContent(writer.getMarkerAnchor("constructor_summary"));
+     }
+ 
+-    public void printInheritedSummaryAnchor(ClassDoc cd) {
+-    }   // no such
++    /**
++     * {@inheritDoc}
++     */
++    public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
++    }
+ 
+-    public void printInheritedSummaryLabel(ClassDoc cd) {
+-        // no such
++    /**
++     * {@inheritDoc}
++     */
++    public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
+     }
+ 
+     public int getMemberKind() {
+         return VisibleMemberMap.CONSTRUCTORS;
+     }
+ 
+-    protected void navSummaryLink(List members) {
+-        printNavSummaryLink(classdoc,
+-                members.size() > 0? true: false);
+-    }
+-
+-    protected void printNavSummaryLink(ClassDoc cd, boolean link) {
++    /**
++     * {@inheritDoc}
++     */
++    protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
+         if (link) {
+-            writer.printHyperLink("", "constructor_summary",
+-                    ConfigurationImpl.getInstance().getText("doclet.navConstructor"));
++            return writer.getHyperLink("", "constructor_summary",
++                    writer.getResource("doclet.navConstructor"));
+         } else {
+-            writer.printText("doclet.navConstructor");
+-        }
+-    }
+-
+-    protected void printNavDetailLink(boolean link) {
+-        if (link) {
+-            writer.printHyperLink("", "constructor_detail",
+-                    ConfigurationImpl.getInstance().getText("doclet.navConstructor"));
+-        } else {
+-            writer.printText("doclet.navConstructor");
+-        }
+-    }
+-
+-    protected void printSummaryType(ProgramElementDoc member) {
+-        if (foundNonPubConstructor) {
+-            writer.printTypeSummaryHeader();
+-            if (member.isProtected()) {
+-                print("protected ");
+-            } else if (member.isPrivate()) {
+-                print("private ");
+-            } else if (member.isPublic()) {
+-                writer.space();
+-            } else {
+-                writer.printText("doclet.Package_private");
+-            }
+-            writer.printTypeSummaryFooter();
+-        }
+-    }
+-
+-    /**
+-     * Write the inherited member summary header for the given class.
+-     *
+-     * @param classDoc the class the summary belongs to.
+-     */
+-    public void writeInheritedMemberSummaryHeader(ClassDoc classDoc) {
+-        if(! printedSummaryHeader){
+-            //We don't want inherited summary to not be under heading.
+-            writeMemberSummaryHeader(classDoc);
+-            writeMemberSummaryFooter(classDoc);
+-            printedSummaryHeader = true;
++            return writer.getResource("doclet.navConstructor");
+         }
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeInheritedMemberSummary(ClassDoc classDoc,
+-        ProgramElementDoc member, boolean isFirst, boolean isLast) {}
++    protected void addNavDetailLink(boolean link, Content liNav) {
++        if (link) {
++            liNav.addContent(writer.getHyperLink("", "constructor_detail",
++                    writer.getResource("doclet.navConstructor")));
++        } else {
++            liNav.addContent(writer.getResource("doclet.navConstructor"));
++        }
++    }
+ 
+     /**
+-     * Write the inherited member summary footer for the given class.
+-     *
+-     * @param classDoc the class the summary belongs to.
++     * {@inheritDoc}
+      */
+-    public void writeInheritedMemberSummaryFooter(ClassDoc classDoc) {}
++    protected void addSummaryType(ProgramElementDoc member, Content tdSummaryType) {
++        if (foundNonPubConstructor) {
++            Content code = new HtmlTree(HtmlTag.CODE);
++            if (member.isProtected()) {
++                code.addContent("protected ");
++            } else if (member.isPrivate()) {
++                code.addContent("private ");
++            } else if (member.isPublic()) {
++                code.addContent(writer.getSpace());
++            } else {
++                code.addContent(
++                        configuration().getText("doclet.Package_private"));
++            }
++            tdSummaryType.addContent(code);
++        }
++    }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java
+@@ -25,9 +25,11 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
++import java.io.*;
++import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.tools.doclets.internal.toolkit.util.DeprecatedAPIListBuilder;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+-import java.io.*;
++import com.sun.tools.doclets.formats.html.markup.*;
+ 
+ /**
+  * Generate File to list all the deprecated classes and class members with the
+@@ -125,28 +127,21 @@
+     }
+ 
+     /**
+-     * Print the deprecated API list. Separately print all class kinds and
+-     * member kinds.
++     * Generate the deprecated API list.
+      *
+      * @param deprapi list of deprecated API built already.
+      */
+     protected void generateDeprecatedListFile(DeprecatedAPIListBuilder deprapi)
+-             throws IOException {
+-        writeHeader();
+-
+-        strong(configuration.getText("doclet.Contents"));
+-        ul();
+-        for (int i = 0; i < DeprecatedAPIListBuilder.NUM_TYPES; i++) {
+-            writeIndexLink(deprapi, i);
+-        }
+-        ulEnd();
+-        println();
+-
++            throws IOException {
++        Content body = getHeader();
++        body.addContent(getContentsList(deprapi));
+         String memberTableSummary;
+         String[] memberTableHeader = new String[1];
++        HtmlTree div = new HtmlTree(HtmlTag.DIV);
++        div.addStyle(HtmlStyle.contentContainer);
+         for (int i = 0; i < DeprecatedAPIListBuilder.NUM_TYPES; i++) {
+             if (deprapi.hasDocumentation(i)) {
+-                writeAnchor(deprapi, i);
++                addAnchor(deprapi, i, div);
+                 memberTableSummary =
+                         configuration.getText("doclet.Member_Table_Summary",
+                         configuration.getText(HEADING_KEYS[i]),
+@@ -154,66 +149,87 @@
+                 memberTableHeader[0] = configuration.getText("doclet.0_and_1",
+                         configuration.getText(HEADER_KEYS[i]),
+                         configuration.getText("doclet.Description"));
+-                writers[i].printDeprecatedAPI(deprapi.getList(i),
+-                    HEADING_KEYS[i], memberTableSummary, memberTableHeader);
++                writers[i].addDeprecatedAPI(deprapi.getList(i),
++                        HEADING_KEYS[i], memberTableSummary, memberTableHeader, div);
+             }
+         }
+-        printDeprecatedFooter();
++        body.addContent(div);
++        addNavLinks(false, body);
++        addBottom(body);
++        printHtmlDocument(null, true, body);
+     }
+ 
+-    private void writeIndexLink(DeprecatedAPIListBuilder builder,
+-            int type) {
++    /**
++     * Add the index link.
++     *
++     * @param builder the deprecated list builder
++     * @param type the type of list being documented
++     * @param contentTree the content tree to which the index link will be added
++     */
++    private void addIndexLink(DeprecatedAPIListBuilder builder,
++            int type, Content contentTree) {
+         if (builder.hasDocumentation(type)) {
+-            li();
+-            printHyperLink("#" + ANCHORS[type],
+-                configuration.getText(HEADING_KEYS[type]));
+-            println();
+-        }
+-    }
+-
+-    private void writeAnchor(DeprecatedAPIListBuilder builder, int type) {
+-        if (builder.hasDocumentation(type)) {
+-            anchor(ANCHORS[type]);
++            Content li = HtmlTree.LI(getHyperLink("#" + ANCHORS[type],
++                    getResource(HEADING_KEYS[type])));
++            contentTree.addContent(li);
+         }
+     }
+ 
+     /**
+-     * Print the navigation bar and header for the deprecated API Listing.
++     * Get the contents list.
++     *
++     * @param deprapi the deprecated list builder
++     * @return a content tree for the contents list
+      */
+-    protected void writeHeader() {
+-        printHtmlHeader(configuration.getText("doclet.Window_Deprecated_List"),
+-            null, true);
+-        printTop();
+-        navLinks(true);
+-        hr();
+-        center();
+-        h2();
+-        strongText("doclet.Deprecated_API");
+-        h2End();
+-        centerEnd();
+-
+-        hr(4, "noshade");
++    public Content getContentsList(DeprecatedAPIListBuilder deprapi) {
++        Content headContent = getResource("doclet.Deprecated_API");
++        Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
++                HtmlStyle.title, headContent);
++        Content div = HtmlTree.DIV(HtmlStyle.header, heading);
++        Content headingContent = getResource("doclet.Contents");
++        div.addContent(HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true,
++                headingContent));
++        Content ul = new HtmlTree(HtmlTag.UL);
++        for (int i = 0; i < DeprecatedAPIListBuilder.NUM_TYPES; i++) {
++            addIndexLink(deprapi, i, ul);
++        }
++        div.addContent(ul);
++        return div;
+     }
+ 
+     /**
+-     * Print the navigation bar and the footer for the deprecated API Listing.
++     * Add the anchor.
++     *
++     * @param builder the deprecated list builder
++     * @param type the type of list being documented
++     * @param contentTree the content tree to which the anchor will be added
+      */
+-    protected void printDeprecatedFooter() {
+-        hr();
+-        navLinks(false);
+-        printBottom();
+-        printBodyHtmlEnd();
++    private void addAnchor(DeprecatedAPIListBuilder builder, int type, Content htmlTree) {
++        if (builder.hasDocumentation(type)) {
++            htmlTree.addContent(getMarkerAnchor(ANCHORS[type]));
++        }
+     }
+ 
+     /**
+-     * Highlight the word "Deprecated" in the navigation bar as this is the same
+-     * page.
++     * Get the header for the deprecated API Listing.
++     *
++     * @return a content tree for the header
+      */
+-    protected void navLinkDeprecated() {
+-        navCellRevStart();
+-        fontStyle("NavBarFont1Rev");
+-        strongText("doclet.navDeprecated");
+-        fontEnd();
+-        navCellEnd();
++    public Content getHeader() {
++        String title = configuration.getText("doclet.Window_Deprecated_List");
++        Content bodyTree = getBody(true, getWindowTitle(title));
++        addTop(bodyTree);
++        addNavLinks(true, bodyTree);
++        return bodyTree;
++    }
++
++    /**
++     * Get the deprecated label.
++     *
++     * @return a content tree for the deprecated label
++     */
++    protected Content getNavLinkDeprecated() {
++        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, deprecatedLabel);
++        return li;
+     }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java
+@@ -28,6 +28,7 @@
+ import java.io.*;
+ 
+ import com.sun.javadoc.*;
++import com.sun.tools.doclets.formats.html.markup.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+ 
+@@ -40,8 +41,6 @@
+ public class EnumConstantWriterImpl extends AbstractMemberWriter
+     implements EnumConstantWriter, MemberSummaryWriter {
+ 
+-    private boolean printedSummaryHeader = false;
+-
+     public EnumConstantWriterImpl(SubWriterHolderWriter writer,
+         ClassDoc classdoc) {
+         super(writer, classdoc);
+@@ -52,136 +51,98 @@
+     }
+ 
+     /**
+-     * Write the enum constant summary header for the given class.
+-     *
+-     * @param classDoc the class the summary belongs to.
++     * {@inheritDoc}
+      */
+-    public void writeMemberSummaryHeader(ClassDoc classDoc) {
+-        printedSummaryHeader = true;
+-        writer.println("<!-- =========== ENUM CONSTANT SUMMARY =========== -->");
+-        writer.println();
+-        writer.printSummaryHeader(this, classDoc);
+-    }
+-
+-    /**
+-     * Write the enum constant summary footer for the given class.
+-     *
+-     * @param classDoc the class the summary belongs to.
+-     */
+-    public void writeMemberSummaryFooter(ClassDoc classDoc) {
+-        writer.printSummaryFooter(this, classDoc);
+-    }
+-
+-    /**
+-     * Write the inherited enum constant summary header for the given class.
+-     *
+-     * @param classDoc the class the summary belongs to.
+-     */
+-    public void writeInheritedMemberSummaryHeader(ClassDoc classDoc) {
+-        if(! printedSummaryHeader){
+-            //We don't want inherited summary to not be under heading.
+-            writeMemberSummaryHeader(classDoc);
+-            writeMemberSummaryFooter(classDoc);
+-            printedSummaryHeader = true;
+-        }
+-        writer.printInheritedSummaryHeader(this, classDoc);
++    public Content getMemberSummaryHeader(ClassDoc classDoc,
++            Content memberSummaryTree) {
++        memberSummaryTree.addContent(HtmlConstants.START_OF_ENUM_CONSTANT_SUMMARY);
++        Content memberTree = writer.getMemberTreeHeader();
++        writer.addSummaryHeader(this, classDoc, memberTree);
++        return memberTree;
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeInheritedMemberSummary(ClassDoc classDoc,
+-        ProgramElementDoc enumConstant, boolean isFirst, boolean isLast) {
+-        writer.printInheritedSummaryMember(this, classDoc, enumConstant, isFirst);
+-    }
+-
+-    /**
+-     * Write the inherited enum constant summary footer for the given class.
+-     *
+-     * @param classDoc the class the summary belongs to.
+-     */
+-    public void writeInheritedMemberSummaryFooter(ClassDoc classDoc) {
+-        writer.printInheritedSummaryFooter(this, classDoc);
++    public Content getEnumConstantsDetailsTreeHeader(ClassDoc classDoc,
++            Content memberDetailsTree) {
++        memberDetailsTree.addContent(HtmlConstants.START_OF_ENUM_CONSTANT_DETAILS);
++        Content enumConstantsDetailsTree = writer.getMemberTreeHeader();
++        enumConstantsDetailsTree.addContent(writer.getMarkerAnchor("enum_constant_detail"));
++        Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
++                writer.enumConstantsDetailsLabel);
++        enumConstantsDetailsTree.addContent(heading);
++        return enumConstantsDetailsTree;
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeHeader(ClassDoc classDoc, String header) {
+-        writer.println();
+-        writer.println("<!-- ============ ENUM CONSTANT DETAIL =========== -->");
+-        writer.println();
+-        writer.anchor("enum_constant_detail");
+-        writer.printTableHeadingBackground(header);
+-        writer.println();
++    public Content getEnumConstantsTreeHeader(FieldDoc enumConstant,
++            Content enumConstantsDetailsTree) {
++        enumConstantsDetailsTree.addContent(
++                writer.getMarkerAnchor(enumConstant.name()));
++        Content enumConstantsTree = writer.getMemberTreeHeader();
++        Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING);
++        heading.addContent(enumConstant.name());
++        enumConstantsTree.addContent(heading);
++        return enumConstantsTree;
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeEnumConstantHeader(FieldDoc enumConstant, boolean isFirst) {
+-        if (! isFirst) {
+-            writer.printMemberHeader();
+-            writer.println("");
++    public Content getSignature(FieldDoc enumConstant) {
++        Content pre = new HtmlTree(HtmlTag.PRE);
++        writer.addAnnotationInfo(enumConstant, pre);
++        addModifiers(enumConstant, pre);
++        Content enumConstantLink = new RawHtml(writer.getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
++                enumConstant.type())));
++        pre.addContent(enumConstantLink);
++        pre.addContent(" ");
++        if (configuration().linksource) {
++            Content enumConstantName = new StringContent(enumConstant.name());
++            writer.addSrcLink(enumConstant, enumConstantName, pre);
++        } else {
++            addName(enumConstant.name(), pre);
+         }
+-        writer.anchor(enumConstant.name());
+-        writer.h3();
+-        writer.print(enumConstant.name());
+-        writer.h3End();
++        return pre;
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeSignature(FieldDoc enumConstant) {
+-        writer.pre();
+-        writer.writeAnnotationInfo(enumConstant);
+-        printModifiers(enumConstant);
+-        writer.printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
+-            enumConstant.type()));
+-        print(' ');
+-        if (configuration().linksource) {
+-            writer.printSrcLink(enumConstant, enumConstant.name());
+-        } else {
+-            strong(enumConstant.name());
+-        }
+-        writer.preEnd();
+-        assert !writer.getMemberDetailsListPrinted();
++    public void addDeprecated(FieldDoc enumConstant, Content enumConstantsTree) {
++        addDeprecatedInfo(enumConstant, enumConstantsTree);
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeDeprecated(FieldDoc enumConstant) {
+-        printDeprecated(enumConstant);
++    public void addComments(FieldDoc enumConstant, Content enumConstantsTree) {
++        addComment(enumConstant, enumConstantsTree);
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeComments(FieldDoc enumConstant) {
+-        printComment(enumConstant);
++    public void addTags(FieldDoc enumConstant, Content enumConstantsTree) {
++        writer.addTagsInfo(enumConstant, enumConstantsTree);
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeTags(FieldDoc enumConstant) {
+-        writer.printTags(enumConstant);
++    public Content getEnumConstantsDetails(Content enumConstantsDetailsTree) {
++        return getMemberTree(enumConstantsDetailsTree);
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeEnumConstantFooter() {
+-        printMemberFooter();
+-    }
+-
+-    /**
+-     * {@inheritDoc}
+-     */
+-    public void writeFooter(ClassDoc classDoc) {
+-        //No footer to write for enum constant documentation
++    public Content getEnumConstants(Content enumConstantsTree,
++            boolean isLastContent) {
++        return getMemberTree(enumConstantsTree, isLastContent);
+     }
+ 
+     /**
+@@ -195,75 +156,127 @@
+         return VisibleMemberMap.ENUM_CONSTANTS;
+     }
+ 
+-    public void printSummaryLabel() {
+-        writer.printText("doclet.Enum_Constant_Summary");
++    /**
++     * {@inheritDoc}
++     */
++    public void addSummaryLabel(Content memberTree) {
++        Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
++                writer.getResource("doclet.Enum_Constant_Summary"));
++        memberTree.addContent(label);
+     }
+ 
+-    public void printTableSummary() {
+-        writer.tableIndexSummary(configuration().getText("doclet.Member_Table_Summary",
++    /**
++     * {@inheritDoc}
++     */
++    public String getTableSummary() {
++        return configuration().getText("doclet.Member_Table_Summary",
+                 configuration().getText("doclet.Enum_Constant_Summary"),
+-                configuration().getText("doclet.enum_constants")));
++                configuration().getText("doclet.enum_constants"));
+     }
+ 
+-    public void printSummaryTableHeader(ProgramElementDoc member) {
++    /**
++     * {@inheritDoc}
++     */
++    public String getCaption() {
++        return configuration().getText("doclet.Enum_Constants");
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public String[] getSummaryTableHeader(ProgramElementDoc member) {
+         String[] header = new String[] {
+             configuration().getText("doclet.0_and_1",
+                     configuration().getText("doclet.Enum_Constant"),
+                     configuration().getText("doclet.Description"))
+         };
+-        writer.summaryTableHeader(header, "col");
++        return header;
+     }
+ 
+-    public void printSummaryAnchor(ClassDoc cd) {
+-        writer.anchor("enum_constant_summary");
++    /**
++     * {@inheritDoc}
++     */
++    public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
++        memberTree.addContent(writer.getMarkerAnchor("enum_constant_summary"));
+     }
+ 
+-    public void printInheritedSummaryAnchor(ClassDoc cd) {
+-    }   // no such
+-
+-    public void printInheritedSummaryLabel(ClassDoc cd) {
+-        // no such
++    /**
++     * {@inheritDoc}
++     */
++    public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
+     }
+ 
+-    protected void writeSummaryLink(int context, ClassDoc cd, ProgramElementDoc member) {
+-        writer.strong();
+-        writer.printDocLink(context, (MemberDoc) member, member.name(), false);
+-        writer.strongEnd();
++    /**
++     * {@inheritDoc}
++     */
++    public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
+     }
+ 
+-    protected void writeInheritedSummaryLink(ClassDoc cd,
+-            ProgramElementDoc member) {
+-        writer.printDocLink(LinkInfoImpl.CONTEXT_MEMBER, (MemberDoc)member,
+-            member.name(), false);
++    /**
++     * {@inheritDoc}
++     */
++    protected void addSummaryLink(int context, ClassDoc cd, ProgramElementDoc member,
++            Content tdSummary) {
++        Content strong = HtmlTree.STRONG(new RawHtml(
++                writer.getDocLink(context, (MemberDoc) member, member.name(), false)));
++        Content code = HtmlTree.CODE(strong);
++        tdSummary.addContent(code);
+     }
+ 
+-    protected void printSummaryType(ProgramElementDoc member) {
++    /**
++     * {@inheritDoc}
++     */
++    @Override
++    public void setSummaryColumnStyle(HtmlTree tdTree) {
++        tdTree.addStyle(HtmlStyle.colOne);
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    protected void addInheritedSummaryLink(ClassDoc cd,
++            ProgramElementDoc member, Content linksTree) {
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    protected void addSummaryType(ProgramElementDoc member, Content tdSummaryType) {
+         //Not applicable.
+     }
+ 
+-    protected void writeDeprecatedLink(ProgramElementDoc member) {
+-        writer.printDocLink(LinkInfoImpl.CONTEXT_MEMBER,
+-            (MemberDoc) member, ((FieldDoc)member).qualifiedName(), false);
++    /**
++     * {@inheritDoc}
++     */
++    protected Content getDeprecatedLink(ProgramElementDoc member) {
++        return writer.getDocLink(LinkInfoImpl.CONTEXT_MEMBER,
++                (MemberDoc) member, ((FieldDoc)member).qualifiedName());
+     }
+ 
+-    protected void printNavSummaryLink(ClassDoc cd, boolean link) {
++    /**
++     * {@inheritDoc}
++     */
++    protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
+         if (link) {
+-            writer.printHyperLink("", (cd == null)?
+-                        "enum_constant_summary":
+-                        "enum_constants_inherited_from_class_" +
+-                        configuration().getClassName(cd),
+-                    configuration().getText("doclet.navEnum"));
++            return writer.getHyperLink("", (cd == null)?
++                "enum_constant_summary":
++                "enum_constants_inherited_from_class_" +
++                configuration().getClassName(cd),
++                writer.getResource("doclet.navEnum"));
+         } else {
+-            writer.printText("doclet.navEnum");
++            return writer.getResource("doclet.navEnum");
+         }
+     }
+ 
+-    protected void printNavDetailLink(boolean link) {
++    /**
++     * {@inheritDoc}
++     */
++    protected void addNavDetailLink(boolean link, Content liNav) {
+         if (link) {
+-            writer.printHyperLink("", "enum_constant_detail",
+-                configuration().getText("doclet.navEnum"));
++            liNav.addContent(writer.getHyperLink("", "enum_constant_detail",
++                    writer.getResource("doclet.navEnum")));
+         } else {
+-            writer.printText("doclet.navEnum");
++            liNav.addContent(writer.getResource("doclet.navEnum"));
+         }
+     }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java
+@@ -28,6 +28,7 @@
+ import java.io.*;
+ 
+ import com.sun.javadoc.*;
++import com.sun.tools.doclets.formats.html.markup.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+ 
+@@ -42,8 +43,6 @@
+ public class FieldWriterImpl extends AbstractMemberWriter
+     implements FieldWriter, MemberSummaryWriter {
+ 
+-    private boolean printedSummaryHeader = false;
+-
+     public FieldWriterImpl(SubWriterHolderWriter writer, ClassDoc classdoc) {
+         super(writer, classdoc);
+     }
+@@ -53,177 +52,118 @@
+     }
+ 
+     /**
+-     * Write the fields summary header for the given class.
+-     *
+-     * @param classDoc the class the summary belongs to.
++     * {@inheritDoc}
+      */
+-    public void writeMemberSummaryHeader(ClassDoc classDoc) {
+-        printedSummaryHeader = true;
+-        writer.println("<!-- =========== FIELD SUMMARY =========== -->");
+-        writer.println();
+-        writer.printSummaryHeader(this, classDoc);
+-    }
+-
+-    /**
+-     * Write the fields summary footer for the given class.
+-     *
+-     * @param classDoc the class the summary belongs to.
+-     */
+-    public void writeMemberSummaryFooter(ClassDoc classDoc) {
+-        writer.tableEnd();
+-        writer.space();
+-    }
+-
+-    /**
+-     * Write the inherited fields summary header for the given class.
+-     *
+-     * @param classDoc the class the summary belongs to.
+-     */
+-    public void writeInheritedMemberSummaryHeader(ClassDoc classDoc) {
+-        if(! printedSummaryHeader){
+-            //We don't want inherited summary to not be under heading.
+-            writeMemberSummaryHeader(classDoc);
+-            writeMemberSummaryFooter(classDoc);
+-            printedSummaryHeader = true;
+-        }
+-        writer.printInheritedSummaryHeader(this, classDoc);
++    public Content getMemberSummaryHeader(ClassDoc classDoc,
++            Content memberSummaryTree) {
++        memberSummaryTree.addContent(HtmlConstants.START_OF_FIELD_SUMMARY);
++        Content memberTree = writer.getMemberTreeHeader();
++        writer.addSummaryHeader(this, classDoc, memberTree);
++        return memberTree;
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeInheritedMemberSummary(ClassDoc classDoc,
+-        ProgramElementDoc field, boolean isFirst, boolean isLast) {
+-        writer.printInheritedSummaryMember(this, classDoc, field, isFirst);
++    public Content getFieldDetailsTreeHeader(ClassDoc classDoc,
++            Content memberDetailsTree) {
++        memberDetailsTree.addContent(HtmlConstants.START_OF_FIELD_DETAILS);
++        Content fieldDetailsTree = writer.getMemberTreeHeader();
++        fieldDetailsTree.addContent(writer.getMarkerAnchor("field_detail"));
++        Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
++                writer.fieldDetailsLabel);
++        fieldDetailsTree.addContent(heading);
++        return fieldDetailsTree;
+     }
+ 
+     /**
+-     * Write the inherited fields summary footer for the given class.
+-     *
+-     * @param classDoc the class the summary belongs to.
++     * {@inheritDoc}
+      */
+-    public void writeInheritedMemberSummaryFooter(ClassDoc classDoc) {
+-        writer.printInheritedSummaryFooter(this, classDoc);
++    public Content getFieldDocTreeHeader(FieldDoc field,
++            Content fieldDetailsTree) {
++        fieldDetailsTree.addContent(
++                writer.getMarkerAnchor(field.name()));
++        Content fieldDocTree = writer.getMemberTreeHeader();
++        Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING);
++        heading.addContent(field.name());
++        fieldDocTree.addContent(heading);
++        return fieldDocTree;
+     }
+ 
+     /**
+-     * Write the header for the field documentation.
+-     *
+-     * @param classDoc the class that the fields belong to.
++     * {@inheritDoc}
+      */
+-    public void writeHeader(ClassDoc classDoc, String header) {
+-        writer.println();
+-        writer.println("<!-- ============ FIELD DETAIL =========== -->");
+-        writer.println();
+-        writer.anchor("field_detail");
+-        writer.printTableHeadingBackground(header);
+-        writer.println();
++    public Content getSignature(FieldDoc field) {
++        Content pre = new HtmlTree(HtmlTag.PRE);
++        writer.addAnnotationInfo(field, pre);
++        addModifiers(field, pre);
++        Content fieldlink = new RawHtml(writer.getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
++                field.type())));
++        pre.addContent(fieldlink);
++        pre.addContent(" ");
++        if (configuration().linksource) {
++            Content fieldName = new StringContent(field.name());
++            writer.addSrcLink(field, fieldName, pre);
++        } else {
++            addName(field.name(), pre);
++        }
++        return pre;
+     }
+ 
+     /**
+-     * Write the field header for the given field.
+-     *
+-     * @param field the field being documented.
+-     * @param isFirst the flag to indicate whether or not the field is the
+-     *        first to be documented.
++     * {@inheritDoc}
+      */
+-    public void writeFieldHeader(FieldDoc field, boolean isFirst) {
+-        if (! isFirst) {
+-            writer.printMemberHeader();
+-            writer.println("");
+-        }
+-        writer.anchor(field.name());
+-        writer.h3();
+-        writer.print(field.name());
+-        writer.h3End();
++    public void addDeprecated(FieldDoc field, Content fieldDocTree) {
++        addDeprecatedInfo(field, fieldDocTree);
+     }
+ 
+     /**
+-     * Write the signature for the given field.
+-     *
+-     * @param field the field being documented.
++     * {@inheritDoc}
+      */
+-    public void writeSignature(FieldDoc field) {
+-        writer.pre();
+-        writer.writeAnnotationInfo(field);
+-        printModifiers(field);
+-        writer.printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
+-            field.type()));
+-        print(' ');
+-        if (configuration().linksource) {
+-            writer.printSrcLink(field, field.name());
+-        } else {
+-            strong(field.name());
+-        }
+-        writer.preEnd();
+-        assert !writer.getMemberDetailsListPrinted();
+-    }
+-
+-    /**
+-     * Write the deprecated output for the given field.
+-     *
+-     * @param field the field being documented.
+-     */
+-    public void writeDeprecated(FieldDoc field) {
+-        printDeprecated(field);
+-    }
+-
+-    /**
+-     * Write the comments for the given field.
+-     *
+-     * @param field the field being documented.
+-     */
+-    public void writeComments(FieldDoc field) {
++    public void addComments(FieldDoc field, Content fieldDocTree) {
+         ClassDoc holder = field.containingClass();
+         if (field.inlineTags().length > 0) {
+-            writer.printMemberDetailsListStartTag();
+             if (holder.equals(classdoc) ||
+-                (! (holder.isPublic() || Util.isLinkable(holder, configuration())))) {
+-                writer.dd();
+-                writer.printInlineComment(field);
+-                writer.ddEnd();
++                    (! (holder.isPublic() || Util.isLinkable(holder, configuration())))) {
++                writer.addInlineComment(field, fieldDocTree);
+             } else {
+-                String classlink = writer.codeText(
+-                    writer.getDocLink(LinkInfoImpl.CONTEXT_FIELD_DOC_COPY,
++                Content link = new RawHtml(
++                        writer.getDocLink(LinkInfoImpl.CONTEXT_FIELD_DOC_COPY,
+                         holder, field,
+                         holder.isIncluded() ?
+                             holder.typeName() : holder.qualifiedTypeName(),
+-                        false));
+-                writer.dd();
+-                writer.strong(configuration().getText(holder.isClass()?
+-                   "doclet.Description_From_Class" :
+-                    "doclet.Description_From_Interface", classlink));
+-                writer.ddEnd();
+-                writer.dd();
+-                writer.printInlineComment(field);
+-                writer.ddEnd();
++                            false));
++                Content codeLink = HtmlTree.CODE(link);
++                Content strong = HtmlTree.STRONG(holder.isClass()?
++                   writer.descfrmClassLabel : writer.descfrmInterfaceLabel);
++                strong.addContent(writer.getSpace());
++                strong.addContent(codeLink);
++                fieldDocTree.addContent(HtmlTree.DIV(HtmlStyle.block, strong));
++                writer.addInlineComment(field, fieldDocTree);
+             }
+         }
+     }
+ 
+     /**
+-     * Write the tag output for the given field.
+-     *
+-     * @param field the field being documented.
++     * {@inheritDoc}
+      */
+-    public void writeTags(FieldDoc field) {
+-        writer.printTags(field);
++    public void addTags(FieldDoc field, Content fieldDocTree) {
++        writer.addTagsInfo(field, fieldDocTree);
+     }
+ 
+     /**
+-     * Write the field footer.
++     * {@inheritDoc}
+      */
+-    public void writeFieldFooter() {
+-        printMemberFooter();
++    public Content getFieldDetails(Content fieldDetailsTree) {
++        return getMemberTree(fieldDetailsTree);
+     }
+ 
+     /**
+-     * Write the footer for the field documentation.
+-     *
+-     * @param classDoc the class that the fields belong to.
++     * {@inheritDoc}
+      */
+-    public void writeFooter(ClassDoc classDoc) {
+-        //No footer to write for field documentation
++    public Content getFieldDoc(Content fieldDocTree,
++            boolean isLastContent) {
++        return getMemberTree(fieldDocTree, isLastContent);
+     }
+ 
+     /**
+@@ -237,85 +177,136 @@
+         return VisibleMemberMap.FIELDS;
+     }
+ 
+-    public void printSummaryLabel() {
+-        writer.printText("doclet.Field_Summary");
++    /**
++     * {@inheritDoc}
++     */
++    public void addSummaryLabel(Content memberTree) {
++        Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
++                writer.getResource("doclet.Field_Summary"));
++        memberTree.addContent(label);
+     }
+ 
+-    public void printTableSummary() {
+-        writer.tableIndexSummary(configuration().getText("doclet.Member_Table_Summary",
++    /**
++     * {@inheritDoc}
++     */
++    public String getTableSummary() {
++        return configuration().getText("doclet.Member_Table_Summary",
+                 configuration().getText("doclet.Field_Summary"),
+-                configuration().getText("doclet.fields")));
++                configuration().getText("doclet.fields"));
+     }
+ 
+-    public void printSummaryTableHeader(ProgramElementDoc member) {
++    /**
++     * {@inheritDoc}
++     */
++    public String getCaption() {
++        return configuration().getText("doclet.Fields");
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public String[] getSummaryTableHeader(ProgramElementDoc member) {
+         String[] header = new String[] {
+             writer.getModifierTypeHeader(),
+             configuration().getText("doclet.0_and_1",
+                     configuration().getText("doclet.Field"),
+                     configuration().getText("doclet.Description"))
+         };
+-        writer.summaryTableHeader(header, "col");
++        return header;
+     }
+ 
+-    public void printSummaryAnchor(ClassDoc cd) {
+-        writer.anchor("field_summary");
++    /**
++     * {@inheritDoc}
++     */
++    public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
++        memberTree.addContent(writer.getMarkerAnchor("field_summary"));
+     }
+ 
+-    public void printInheritedSummaryAnchor(ClassDoc cd) {
+-        writer.anchor("fields_inherited_from_class_" + configuration().getClassName(cd));
++    /**
++     * {@inheritDoc}
++     */
++    public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
++        inheritedTree.addContent(writer.getMarkerAnchor(
++                "fields_inherited_from_class_" + configuration().getClassName(cd)));
+     }
+ 
+-    public void printInheritedSummaryLabel(ClassDoc cd) {
+-        String classlink = writer.getPreQualifiedClassLink(
+-            LinkInfoImpl.CONTEXT_MEMBER, cd, false);
+-        writer.strong();
+-        String key = cd.isClass()?
+-            "doclet.Fields_Inherited_From_Class" :
+-            "doclet.Fields_Inherited_From_Interface";
+-        writer.printText(key, classlink);
+-        writer.strongEnd();
++    /**
++     * {@inheritDoc}
++     */
++    public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
++        Content classLink = new RawHtml(writer.getPreQualifiedClassLink(
++                LinkInfoImpl.CONTEXT_MEMBER, cd, false));
++        Content label = new StringContent(cd.isClass() ?
++            configuration().getText("doclet.Fields_Inherited_From_Class") :
++            configuration().getText("doclet.Fields_Inherited_From_Interface"));
++        Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
++                label);
++        labelHeading.addContent(writer.getSpace());
++        labelHeading.addContent(classLink);
++        inheritedTree.addContent(labelHeading);
+     }
+ 
+-    protected void writeSummaryLink(int context, ClassDoc cd, ProgramElementDoc member) {
+-        writer.strong();
+-        writer.printDocLink(context, cd , (MemberDoc) member, member.name(), false);
+-        writer.strongEnd();
++    /**
++     * {@inheritDoc}
++     */
++    protected void addSummaryLink(int context, ClassDoc cd, ProgramElementDoc member,
++            Content tdSummary) {
++        Content strong = HtmlTree.STRONG(new RawHtml(
++                writer.getDocLink(context, cd , (MemberDoc) member, member.name(), false)));
++        Content code = HtmlTree.CODE(strong);
++        tdSummary.addContent(code);
+     }
+ 
+-    protected void writeInheritedSummaryLink(ClassDoc cd,
+-            ProgramElementDoc member) {
+-        writer.printDocLink(LinkInfoImpl.CONTEXT_MEMBER, cd, (MemberDoc)member,
+-            member.name(), false);
++    /**
++     * {@inheritDoc}
++     */
++    protected void addInheritedSummaryLink(ClassDoc cd,
++            ProgramElementDoc member, Content linksTree) {
++        linksTree.addContent(new RawHtml(
++                writer.getDocLink(LinkInfoImpl.CONTEXT_MEMBER, cd, (MemberDoc)member,
++                member.name(), false)));
+     }
+ 
+-    protected void printSummaryType(ProgramElementDoc member) {
++    /**
++     * {@inheritDoc}
++     */
++    protected void addSummaryType(ProgramElementDoc member, Content tdSummaryType) {
+         FieldDoc field = (FieldDoc)member;
+-        printModifierAndType(field, field.type());
++        addModifierAndType(field, field.type(), tdSummaryType);
+     }
+ 
+-    protected void writeDeprecatedLink(ProgramElementDoc member) {
+-        writer.printDocLink(LinkInfoImpl.CONTEXT_MEMBER,
+-            (MemberDoc) member, ((FieldDoc)member).qualifiedName(), false);
++    /**
++     * {@inheritDoc}
++     */
++    protected Content getDeprecatedLink(ProgramElementDoc member) {
++        return writer.getDocLink(LinkInfoImpl.CONTEXT_MEMBER,
++                (MemberDoc) member, ((FieldDoc)member).qualifiedName());
+     }
+ 
+-    protected void printNavSummaryLink(ClassDoc cd, boolean link) {
++    /**
++     * {@inheritDoc}
++     */
++    protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
+         if (link) {
+-            writer.printHyperLink("", (cd == null)?
+-                        "field_summary":
+-                        "fields_inherited_from_class_" +
+-                        configuration().getClassName(cd),
+-                    configuration().getText("doclet.navField"));
++            return writer.getHyperLink("", (cd == null)?
++                "field_summary":
++                "fields_inherited_from_class_" +
++                configuration().getClassName(cd),
++                writer.getResource("doclet.navField"));
+         } else {
+-            writer.printText("doclet.navField");
++            return writer.getResource("doclet.navField");
+         }
+     }
+ 
+-    protected void printNavDetailLink(boolean link) {
++    /**
++     * {@inheritDoc}
++     */
++    protected void addNavDetailLink(boolean link, Content liNav) {
+         if (link) {
+-            writer.printHyperLink("", "field_detail",
+-                configuration().getText("doclet.navField"));
++            liNav.addContent(writer.getHyperLink("", "field_detail",
++                    writer.getResource("doclet.navField")));
+         } else {
+-            writer.printText("doclet.navField");
++            liNav.addContent(writer.getResource("doclet.navField"));
+         }
+     }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java
+@@ -25,8 +25,10 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
++import java.io.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+-import java.io.*;
++import com.sun.tools.doclets.internal.toolkit.*;
++import com.sun.tools.doclets.formats.html.markup.*;
+ 
+ /**
+  * Generate the documentation in the Html "frame" format in the browser. The
+@@ -47,6 +49,8 @@
+      */
+     int noOfPackages;
+ 
++    private final String SCROLL_YES = "yes";
++
+     /**
+      * Constructor to construct FrameOutputWriter object.
+      *
+@@ -86,82 +90,93 @@
+      * as well as warning if browser is not supporting the Html frames.
+      */
+     protected void generateFrameFile() {
++        Content frameset = getFrameDetails();
+         if (configuration.windowtitle.length() > 0) {
+-            printFramesetHeader(configuration.windowtitle, configuration.notimestamp);
++            printFramesetDocument(configuration.windowtitle, configuration.notimestamp,
++                    frameset);
+         } else {
+-            printFramesetHeader(configuration.getText("doclet.Generated_Docs_Untitled"),
+-                                configuration.notimestamp);
++            printFramesetDocument(configuration.getText("doclet.Generated_Docs_Untitled"),
++                    configuration.notimestamp, frameset);
+         }
+-        printFrameDetails();
+-        printFrameFooter();
+     }
+ 
+     /**
+-     * Generate the code for issueing the warning for a non-frame capable web
++     * Add the code for issueing the warning for a non-frame capable web
+      * client. Also provide links to the non-frame version documentation.
++     *
++     * @param contentTree the content tree to which the non-frames information will be added
+      */
+-    protected void printFrameWarning() {
+-        noFrames();
+-        h2();
+-        printText("doclet.Frame_Alert");
+-        h2End();
+-        p();
+-        printText("doclet.Frame_Warning_Message");
+-        br();
+-        printText("doclet.Link_To");
+-        printHyperLink(configuration.topFile,
+-            configuration.getText("doclet.Non_Frame_Version"));
+-        println("");
+-        noFramesEnd();
++    protected void addFrameWarning(Content contentTree) {
++        Content noframes = new HtmlTree(HtmlTag.NOFRAMES);
++        Content noScript = HtmlTree.NOSCRIPT(
++                HtmlTree.DIV(getResource("doclet.No_Script_Message")));
++        noframes.addContent(noScript);
++        Content noframesHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
++                getResource("doclet.Frame_Alert"));
++        noframes.addContent(noframesHead);
++        Content p = HtmlTree.P(getResource("doclet.Frame_Warning_Message"));
++        noframes.addContent(p);
++        noframes.addContent(new HtmlTree(HtmlTag.BR));
++        noframes.addContent(getResource("doclet.Link_To"));
++        Content link = getHyperLink(configuration.topFile,
++                getResource("doclet.Non_Frame_Version"));
++        noframes.addContent(link);
++        contentTree.addContent(noframes);
+     }
+ 
+     /**
+-     * Print the frame sizes and their contents.
++     * Get the frame sizes and their contents.
++     *
++     * @return a content tree for the frame details
+      */
+-    protected void printFrameDetails() {
+-        // title attribute intentionally made empty so
+-        // 508 tests will not flag it as missing
+-        frameSet("cols=\"20%,80%\" title=\"\" onLoad=\"top.loadFrames()\"");
++    protected Content getFrameDetails() {
++        HtmlTree frameset = HtmlTree.FRAMESET("20%,80%", null, "Documentation frame",
++                "top.loadFrames()");
+         if (noOfPackages <= 1) {
+-            printAllClassesFrameTag();
++            addAllClassesFrameTag(frameset);
+         } else if (noOfPackages > 1) {
+-            frameSet("rows=\"30%,70%\" title=\"\" onLoad=\"top.loadFrames()\"");
+-            printAllPackagesFrameTag();
+-            printAllClassesFrameTag();
+-            frameSetEnd();
++            HtmlTree leftFrameset = HtmlTree.FRAMESET(null, "30%,70%", "Left frames",
++                "top.loadFrames()");
++            addAllPackagesFrameTag(leftFrameset);
++            addAllClassesFrameTag(leftFrameset);
++            frameset.addContent(leftFrameset);
+         }
+-        printClassFrameTag();
+-        printFrameWarning();
+-        frameSetEnd();
++        addClassFrameTag(frameset);
++        addFrameWarning(frameset);
++        return frameset;
+     }
+ 
+     /**
+-     * Print the FRAME tag for the frame that lists all packages
++     * Add the FRAME tag for the frame that lists all packages.
++     *
++     * @param contentTree the content tree to which the information will be added
+      */
+-    private void printAllPackagesFrameTag() {
+-        frame("src=\"overview-frame.html\" name=\"packageListFrame\""
+-            + " title=\"" + configuration.getText("doclet.All_Packages") + "\"");
++    private void addAllPackagesFrameTag(Content contentTree) {
++        HtmlTree frame = HtmlTree.FRAME("overview-frame.html", "packageListFrame",
++                configuration.getText("doclet.All_Packages"));
++        contentTree.addContent(frame);
+     }
+ 
+     /**
+-     * Print the FRAME tag for the frame that lists all classes
++     * Add the FRAME tag for the frame that lists all classes.
++     *
++     * @param contentTree the content tree to which the information will be added
+      */
+-    private void printAllClassesFrameTag() {
+-        frame("src=\"" + "allclasses-frame.html" + "\""
+-            + " name=\"packageFrame\""
+-            + " title=\"" + configuration.getText("doclet.All_classes_and_interfaces")
+-            + "\"");
++    private void addAllClassesFrameTag(Content contentTree) {
++        HtmlTree frame = HtmlTree.FRAME("allclasses-frame.html", "packageFrame",
++                configuration.getText("doclet.All_classes_and_interfaces"));
++        contentTree.addContent(frame);
+     }
+ 
+     /**
+-     * Print the FRAME tag for the frame that describes the class in detail
++     * Add the FRAME tag for the frame that describes the class in detail.
++     *
++     * @param contentTree the content tree to which the information will be added
+      */
+-    private void printClassFrameTag() {
+-        frame("src=\"" + configuration.topFile + "\""
+-            + " name=\"classFrame\""
+-            + " title=\""
+-            + configuration.getText("doclet.Package_class_and_interface_descriptions")
+-            + "\" scrolling=\"yes\"");
++    private void addClassFrameTag(Content contentTree) {
++        HtmlTree frame = HtmlTree.FRAME(configuration.topFile, "classFrame",
++                configuration.getText("doclet.Package_class_and_interface_descriptions"),
++                SCROLL_YES);
++        contentTree.addContent(frame);
+     }
+-
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java
+@@ -25,8 +25,10 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
++import java.io.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+-import java.io.*;
++import com.sun.tools.doclets.internal.toolkit.*;
++import com.sun.tools.doclets.formats.html.markup.*;
+ 
+ /**
+  * Generate the Help File for the generated API documentation. The help file
+@@ -72,159 +74,242 @@
+      * Generate the help file contents.
+      */
+     protected void generateHelpFile() {
+-        printHtmlHeader(configuration.getText("doclet.Window_Help_title"),
+-            null, true);
+-        printTop();
+-        navLinks(true);  hr();
+-
+-        printHelpFileContents();
+-
+-        navLinks(false);
+-        printBottom();
+-        printBodyHtmlEnd();
++        String title = configuration.getText("doclet.Window_Help_title");
++        Content body = getBody(true, getWindowTitle(title));
++        addTop(body);
++        addNavLinks(true, body);
++        addHelpFileContents(body);
++        addNavLinks(false, body);
++        addBottom(body);
++        printHtmlDocument(null, true, body);
+     }
+ 
+     /**
+-     * Print the help file contents from the resource file. While generating the
++     * Add the help file contents from the resource file to the content tree. While adding the
+      * help file contents it also keeps track of user options. If "-notree"
+-     * is used, then the "overview-tree.html" will not get generated and hence
+-     * help information also will not get generated.
++     * is used, then the "overview-tree.html" will not get added and hence
++     * help information also will not get added.
++     *
++     * @param contentTree the content tree to which the help file contents will be added
+      */
+-    protected void printHelpFileContents() {
+-        center(); h1(); printText("doclet.Help_line_1"); h1End(); centerEnd();
+-        printText("doclet.Help_line_2");
++    protected void addHelpFileContents(Content contentTree) {
++        Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false, HtmlStyle.title,
++                getResource("doclet.Help_line_1"));
++        Content div = HtmlTree.DIV(HtmlStyle.header, heading);
++        Content line2 = HtmlTree.P(HtmlStyle.subTitle,
++                getResource("doclet.Help_line_2"));
++        div.addContent(line2);
++        contentTree.addContent(div);
++        HtmlTree ul = new HtmlTree(HtmlTag.UL);
++        ul.addStyle(HtmlStyle.blockList);
+         if (configuration.createoverview) {
+-            h3(); printText("doclet.Overview"); h3End();
+-            blockquote(); p();
+-            printText("doclet.Help_line_3",
+-                getHyperLink("overview-summary.html",
+-                configuration.getText("doclet.Overview")));
+-            blockquoteEnd();
++            Content overviewHeading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
++                getResource("doclet.Overview"));
++            Content liOverview = HtmlTree.LI(HtmlStyle.blockList, overviewHeading);
++            Content line3 = getResource("doclet.Help_line_3",
++                    getHyperLinkString("overview-summary.html",
++                    configuration.getText("doclet.Overview")));
++            Content overviewPara = HtmlTree.P(line3);
++            liOverview.addContent(overviewPara);
++            ul.addContent(liOverview);
+         }
+-        h3(); printText("doclet.Package"); h3End();
+-        blockquote(); p(); printText("doclet.Help_line_4");
+-        ul();
+-        li(); printText("doclet.Interfaces_Italic");
+-        li(); printText("doclet.Classes");
+-        li(); printText("doclet.Enums");
+-        li(); printText("doclet.Exceptions");
+-        li(); printText("doclet.Errors");
+-        li(); printText("doclet.AnnotationTypes");
+-        ulEnd();
+-        blockquoteEnd();
+-        h3(); printText("doclet.Help_line_5"); h3End();
+-        blockquote(); p(); printText("doclet.Help_line_6");
+-        ul();
+-        li(); printText("doclet.Help_line_7");
+-        li(); printText("doclet.Help_line_8");
+-        li(); printText("doclet.Help_line_9");
+-        li(); printText("doclet.Help_line_10");
+-        li(); printText("doclet.Help_line_11");
+-        li(); printText("doclet.Help_line_12");
+-        p();
+-        li(); printText("doclet.Nested_Class_Summary");
+-        li(); printText("doclet.Field_Summary");
+-        li(); printText("doclet.Constructor_Summary");
+-        li(); printText("doclet.Method_Summary");
+-        p();
+-        li(); printText("doclet.Field_Detail");
+-        li(); printText("doclet.Constructor_Detail");
+-        li(); printText("doclet.Method_Detail");
+-        ulEnd();
+-        printText("doclet.Help_line_13");
+-        blockquoteEnd();
+-
++        Content packageHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
++                getResource("doclet.Package"));
++        Content liPackage = HtmlTree.LI(HtmlStyle.blockList, packageHead);
++        Content line4 = getResource("doclet.Help_line_4");
++        Content packagePara = HtmlTree.P(line4);
++        liPackage.addContent(packagePara);
++        HtmlTree ulPackage = new HtmlTree(HtmlTag.UL);
++        ulPackage.addContent(HtmlTree.LI(
++                getResource("doclet.Interfaces_Italic")));
++        ulPackage.addContent(HtmlTree.LI(
++                getResource("doclet.Classes")));
++        ulPackage.addContent(HtmlTree.LI(
++                getResource("doclet.Enums")));
++        ulPackage.addContent(HtmlTree.LI(
++                getResource("doclet.Exceptions")));
++        ulPackage.addContent(HtmlTree.LI(
++                getResource("doclet.Errors")));
++        ulPackage.addContent(HtmlTree.LI(
++                getResource("doclet.AnnotationTypes")));
++        liPackage.addContent(ulPackage);
++        ul.addContent(liPackage);
++        Content classHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
++                getResource("doclet.Help_line_5"));
++        Content liClass = HtmlTree.LI(HtmlStyle.blockList, classHead);
++        Content line6 = getResource("doclet.Help_line_6");
++        Content classPara = HtmlTree.P(line6);
++        liClass.addContent(classPara);
++        HtmlTree ul1 = new HtmlTree(HtmlTag.UL);
++        ul1.addContent(HtmlTree.LI(
++                getResource("doclet.Help_line_7")));
++        ul1.addContent(HtmlTree.LI(
++                getResource("doclet.Help_line_8")));
++        ul1.addContent(HtmlTree.LI(
++                getResource("doclet.Help_line_9")));
++        ul1.addContent(HtmlTree.LI(
++                getResource("doclet.Help_line_10")));
++        ul1.addContent(HtmlTree.LI(
++                getResource("doclet.Help_line_11")));
++        ul1.addContent(HtmlTree.LI(
++                getResource("doclet.Help_line_12")));
++        liClass.addContent(ul1);
++        HtmlTree ul2 = new HtmlTree(HtmlTag.UL);
++        ul2.addContent(HtmlTree.LI(
++                getResource("doclet.Nested_Class_Summary")));
++        ul2.addContent(HtmlTree.LI(
++                getResource("doclet.Field_Summary")));
++        ul2.addContent(HtmlTree.LI(
++                getResource("doclet.Constructor_Summary")));
++        ul2.addContent(HtmlTree.LI(
++                getResource("doclet.Method_Summary")));
++        liClass.addContent(ul2);
++        HtmlTree ul3 = new HtmlTree(HtmlTag.UL);
++        ul3.addContent(HtmlTree.LI(
++                getResource("doclet.Field_Detail")));
++        ul3.addContent(HtmlTree.LI(
++                getResource("doclet.Constructor_Detail")));
++        ul3.addContent(HtmlTree.LI(
++                getResource("doclet.Method_Detail")));
++        liClass.addContent(ul3);
++        Content line13 = getResource("doclet.Help_line_13");
++        Content para = HtmlTree.P(line13);
++        liClass.addContent(para);
++        ul.addContent(liClass);
+         //Annotation Types
+-        blockquoteEnd();
+-        h3(); printText("doclet.AnnotationType"); h3End();
+-        blockquote(); p(); printText("doclet.Help_annotation_type_line_1");
+-        ul();
+-        li(); printText("doclet.Help_annotation_type_line_2");
+-        li(); printText("doclet.Help_annotation_type_line_3");
+-        li(); printText("doclet.Annotation_Type_Required_Member_Summary");
+-        li(); printText("doclet.Annotation_Type_Optional_Member_Summary");
+-        li(); printText("doclet.Annotation_Type_Member_Detail");
+-        ulEnd();
+-        blockquoteEnd();
+-
++        Content aHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
++                getResource("doclet.AnnotationType"));
++        Content liAnnotation = HtmlTree.LI(HtmlStyle.blockList, aHead);
++        Content aline1 = getResource("doclet.Help_annotation_type_line_1");
++        Content aPara = HtmlTree.P(aline1);
++        liAnnotation.addContent(aPara);
++        HtmlTree aul = new HtmlTree(HtmlTag.UL);
++        aul.addContent(HtmlTree.LI(
++                getResource("doclet.Help_annotation_type_line_2")));
++        aul.addContent(HtmlTree.LI(
++                getResource("doclet.Help_annotation_type_line_3")));
++        aul.addContent(HtmlTree.LI(
++                getResource("doclet.Annotation_Type_Required_Member_Summary")));
++        aul.addContent(HtmlTree.LI(
++                getResource("doclet.Annotation_Type_Optional_Member_Summary")));
++        aul.addContent(HtmlTree.LI(
++                getResource("doclet.Annotation_Type_Member_Detail")));
++        liAnnotation.addContent(aul);
++        ul.addContent(liAnnotation);
+         //Enums
+-        blockquoteEnd();
+-        h3(); printText("doclet.Enum"); h3End();
+-        blockquote(); p(); printText("doclet.Help_enum_line_1");
+-        ul();
+-        li(); printText("doclet.Help_enum_line_2");
+-        li(); printText("doclet.Help_enum_line_3");
+-        li(); printText("doclet.Enum_Constant_Summary");
+-        li(); printText("doclet.Enum_Constant_Detail");
+-        ulEnd();
+-        blockquoteEnd();
+-
++        Content enumHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
++                getResource("doclet.Enum"));
++        Content liEnum = HtmlTree.LI(HtmlStyle.blockList, enumHead);
++        Content eline1 = getResource("doclet.Help_enum_line_1");
++        Content enumPara = HtmlTree.P(eline1);
++        liEnum.addContent(enumPara);
++        HtmlTree eul = new HtmlTree(HtmlTag.UL);
++        eul.addContent(HtmlTree.LI(
++                getResource("doclet.Help_enum_line_2")));
++        eul.addContent(HtmlTree.LI(
++                getResource("doclet.Help_enum_line_3")));
++        eul.addContent(HtmlTree.LI(
++                getResource("doclet.Enum_Constant_Summary")));
++        eul.addContent(HtmlTree.LI(
++                getResource("doclet.Enum_Constant_Detail")));
++        liEnum.addContent(eul);
++        ul.addContent(liEnum);
+         if (configuration.classuse) {
+-            h3(); printText("doclet.Help_line_14"); h3End();
+-            blockquote();
+-            printText("doclet.Help_line_15");
+-            blockquoteEnd();
++            Content useHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
++                    getResource("doclet.Help_line_14"));
++            Content liUse = HtmlTree.LI(HtmlStyle.blockList, useHead);
++            Content line15 = getResource("doclet.Help_line_15");
++            Content usePara = HtmlTree.P(line15);
++            liUse.addContent(usePara);
++            ul.addContent(liUse);
+         }
+         if (configuration.createtree) {
+-            h3(); printText("doclet.Help_line_16"); h3End();
+-            blockquote();
+-            printText("doclet.Help_line_17_with_tree_link",
+-                 getHyperLink("overview-tree.html",
+-                 configuration.getText("doclet.Class_Hierarchy")));
+-            ul();
+-            li(); printText("doclet.Help_line_18");
+-            li(); printText("doclet.Help_line_19");
+-            ulEnd();
+-            blockquoteEnd();
++            Content treeHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
++                    getResource("doclet.Help_line_16"));
++            Content liTree = HtmlTree.LI(HtmlStyle.blockList, treeHead);
++            Content line17 = getResource("doclet.Help_line_17_with_tree_link",
++                    getHyperLinkString("overview-tree.html",
++                    configuration.getText("doclet.Class_Hierarchy")));
++            Content treePara = HtmlTree.P(line17);
++            liTree.addContent(treePara);
++            HtmlTree tul = new HtmlTree(HtmlTag.UL);
++            tul.addContent(HtmlTree.LI(
++                    getResource("doclet.Help_line_18")));
++            tul.addContent(HtmlTree.LI(
++                    getResource("doclet.Help_line_19")));
++            liTree.addContent(tul);
++            ul.addContent(liTree);
+         }
+         if (!(configuration.nodeprecatedlist ||
+                   configuration.nodeprecated)) {
+-            h3(); printText("doclet.Deprecated_API"); h3End();
+-            blockquote();
+-            printText("doclet.Help_line_20_with_deprecated_api_link",
+-                getHyperLink("deprecated-list.html",
+-                configuration.getText("doclet.Deprecated_API")));
+-            blockquoteEnd();
++            Content dHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
++                    getResource("doclet.Deprecated_API"));
++            Content liDeprecated = HtmlTree.LI(HtmlStyle.blockList, dHead);
++            Content line20 = getResource("doclet.Help_line_20_with_deprecated_api_link",
++                    getHyperLinkString("deprecated-list.html",
++                    configuration.getText("doclet.Deprecated_API")));
++            Content dPara = HtmlTree.P(line20);
++            liDeprecated.addContent(dPara);
++            ul.addContent(liDeprecated);
+         }
+         if (configuration.createindex) {
+             String indexlink;
+             if (configuration.splitindex) {
+-                indexlink = getHyperLink("index-files/index-1.html",
+-                    configuration.getText("doclet.Index"));
++                indexlink = getHyperLinkString("index-files/index-1.html",
++                        configuration.getText("doclet.Index"));
+             } else {
+-                indexlink = getHyperLink("index-all.html",
+-                    configuration.getText("doclet.Index"));
++                indexlink = getHyperLinkString("index-all.html",
++                        configuration.getText("doclet.Index"));
+             }
+-            h3(); printText("doclet.Help_line_21"); h3End();
+-            blockquote();
+-            printText("doclet.Help_line_22", indexlink);
+-            blockquoteEnd();
++            Content indexHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
++                    getResource("doclet.Help_line_21"));
++            Content liIndex = HtmlTree.LI(HtmlStyle.blockList, indexHead);
++            Content line22 = getResource("doclet.Help_line_22", indexlink);
++            Content indexPara = HtmlTree.P(line22);
++            liIndex.addContent(indexPara);
++            ul.addContent(liIndex);
+         }
+-        h3(); printText("doclet.Help_line_23"); h3End();
+-        printText("doclet.Help_line_24");
+-        h3(); printText("doclet.Help_line_25"); h3End();
+-        printText("doclet.Help_line_26"); p();
+-
+-        h3(); printText("doclet.Serialized_Form"); h3End();
+-        printText("doclet.Help_line_27"); p();
+-
+-        h3(); printText("doclet.Constants_Summary"); h3End();
+-        printText("doclet.Help_line_28"); p();
+-
+-        font("-1"); em();
+-        printText("doclet.Help_line_29");
+-        emEnd(); fontEnd(); br();
+-        hr();
++        Content prevHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
++                getResource("doclet.Help_line_23"));
++        Content liPrev = HtmlTree.LI(HtmlStyle.blockList, prevHead);
++        Content line24 = getResource("doclet.Help_line_24");
++        Content prevPara = HtmlTree.P(line24);
++        liPrev.addContent(prevPara);
++        ul.addContent(liPrev);
++        Content frameHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
++                getResource("doclet.Help_line_25"));
++        Content liFrame = HtmlTree.LI(HtmlStyle.blockList, frameHead);
++        Content line26 = getResource("doclet.Help_line_26");
++        Content framePara = HtmlTree.P(line26);
++        liFrame.addContent(framePara);
++        ul.addContent(liFrame);
++        Content sHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
++                getResource("doclet.Serialized_Form"));
++        Content liSerial = HtmlTree.LI(HtmlStyle.blockList, sHead);
++        Content line27 = getResource("doclet.Help_line_27");
++        Content serialPara = HtmlTree.P(line27);
++        liSerial.addContent(serialPara);
++        ul.addContent(liSerial);
++        Content constHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
++                getResource("doclet.Constants_Summary"));
++        Content liConst = HtmlTree.LI(HtmlStyle.blockList, constHead);
++        Content line28 = getResource("doclet.Help_line_28");
++        Content constPara = HtmlTree.P(line28);
++        liConst.addContent(constPara);
++        ul.addContent(liConst);
++        Content divContent = HtmlTree.DIV(HtmlStyle.contentContainer, ul);
++        Content line29 = HtmlTree.EM(getResource("doclet.Help_line_29"));
++        divContent.addContent(line29);
++        contentTree.addContent(divContent);
+     }
+ 
+     /**
+-     * Highlight the word "Help" in the navigation bar as this is the help file.
++     * Get the help label.
++     *
++     * @return a content tree for the help label
+      */
+-    protected void navLinkHelp() {
+-        navCellRevStart();
+-        fontStyle("NavBarFont1Rev");
+-        strongText("doclet.Help");
+-        fontEnd();
+-        navCellEnd();
++    protected Content getNavLinkHelp() {
++        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, helpLabel);
++        return li;
+     }
+ }
+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,8 +144,11 @@
+             !configuration.nohelp) {
+             HelpWriter.generate(configuration);
+         }
++        // If a stylesheet file is not specified, copy the default stylesheet.
+         if (configuration.stylesheetfile.length() == 0) {
+-            StylesheetWriter.generate(configuration);
++            Util.copyFile(configuration, "stylesheet.css", Util.RESOURCESDIR,
++                    (configdestdir.isEmpty()) ?
++                        System.getProperty("user.dir") : configdestdir, false);
+         }
+     }
+ 
+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
+@@ -88,6 +88,11 @@
+     public ConfigurationImpl configuration;
+ 
+     /**
++     * To check whether annotation heading is printed or not.
++     */
++    protected boolean printedAnnotationHeading = false;
++
++    /**
+      * Constructor to construct the HtmlStandardWriter object.
+      *
+      * @param filename File to be generated.
+@@ -169,7 +174,7 @@
+             // Append slash if next character is not a slash
+             if (relativepathNoSlash.length() > 0 && previndex < htmlstr.length()
+                     && htmlstr.charAt(previndex) != '/') {
+-                buf.append(DirectoryManager.URL_FILE_SEPERATOR);
++                buf.append(DirectoryManager.URL_FILE_SEPARATOR);
+             }
+         }
+         return buf.toString();
+@@ -192,17 +197,47 @@
+         println("  <!--");
+         println("  if(window==top) {");
+         println("    document.writeln('"
+-            + getHyperLink(link, where, label, strong, "", "", target) + "');");
++            + getHyperLinkString(link, where, label, strong, "", "", target) + "');");
+         println("  }");
+         println("  //-->");
+         scriptEnd();
+         noScript();
+-        println("  " + getHyperLink(link, where, label, strong, "", "", target));
++        println("  " + getHyperLinkString(link, where, label, strong, "", "", target));
+         noScriptEnd();
+         println(DocletConstants.NL);
+     }
+ 
+-    private void printMethodInfo(MethodDoc method) {
++    /**
++     * Get the script to show or hide the All classes link.
++     *
++     * @param id id of the element to show or hide
++     * @return a content tree for the script
++     */
++    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";
++        Content scriptContent = new RawHtml(scriptCode);
++        script.addContent(scriptContent);
++        Content div = HtmlTree.DIV(script);
++        return div;
++    }
++
++    /**
++     * Add method information.
++     *
++     * @param method the method to be documented
++     * @param dl the content tree to which the method information will be added
++     */
++    private void addMethodInfo(MethodDoc method, Content dl) {
+         ClassDoc[] intfacs = method.containingClass().interfaces();
+         MethodDoc overriddenMethod = method.overriddenMethod();
+         // Check whether there is any implementation or overridden info to be
+@@ -211,44 +246,38 @@
+         if ((intfacs.length > 0 &&
+                 new ImplementedMethods(method, this.configuration).build().length > 0) ||
+                 overriddenMethod != null) {
+-            printMemberDetailsListStartTag();
+-            dd();
+-            printTagsInfoHeader();
+-            MethodWriterImpl.printImplementsInfo(this, method);
++            MethodWriterImpl.addImplementsInfo(this, method, dl);
+             if (overriddenMethod != null) {
+-                MethodWriterImpl.printOverridden(this,
+-                    method.overriddenType(), overriddenMethod);
++                MethodWriterImpl.addOverridden(this,
++                        method.overriddenType(), overriddenMethod, dl);
+             }
+-            printTagsInfoFooter();
+-            ddEnd();
+         }
+     }
+ 
+-    protected void printTags(Doc doc) {
+-        if(configuration.nocomment){
++    /**
++     * Adds the tags information.
++     *
++     * @param doc the doc for which the tags will be generated
++     * @param htmltree the documentation tree to which the tags will be added
++     */
++    protected void addTagsInfo(Doc doc, Content htmltree) {
++        if (configuration.nocomment) {
+             return;
+         }
++        Content dl = new HtmlTree(HtmlTag.DL);
+         if (doc instanceof MethodDoc) {
+-            printMethodInfo((MethodDoc) doc);
++            addMethodInfo((MethodDoc) doc, dl);
+         }
+         TagletOutputImpl output = new TagletOutputImpl("");
+         TagletWriter.genTagOuput(configuration.tagletManager, doc,
+             configuration.tagletManager.getCustomTags(doc),
+                 getTagletWriterInstance(false), output);
+         String outputString = output.toString().trim();
+-        // For RootDoc and ClassDoc, this section is not the definition description
+-        // but the start of definition list.
+         if (!outputString.isEmpty()) {
+-            if (!(doc instanceof RootDoc || doc instanceof ClassDoc)) {
+-                printMemberDetailsListStartTag();
+-                dd();
+-            }
+-            printTagsInfoHeader();
+-            print(outputString);
+-            printTagsInfoFooter();
+-            if (!(doc instanceof RootDoc || doc instanceof ClassDoc))
+-                ddEnd();
++            Content resultString = new RawHtml(outputString);
++            dl.addContent(resultString);
+         }
++        htmltree.addContent(dl);
+     }
+ 
+     /**
+@@ -284,17 +313,16 @@
+     }
+ 
+     /**
+-     * Print Package link, with target frame.
++     * Get Package link, with target frame.
+      *
+-     * @param pd The link will be to the "package-summary.html" page for this
+-     * package.
+-     * @param target Name of the target frame.
+-     * @param label Tag for the link.
++     * @param pd The link will be to the "package-summary.html" page for this package
++     * @param target name of the target frame
++     * @param label tag for the link
++     * @return a content for the target package link
+      */
+-    public void printTargetPackageLink(PackageDoc pd, String target,
+-        String label) {
+-        print(getHyperLink(pathString(pd, "package-summary.html"), "", label,
+-            false, "", "", target));
++    public Content getTargetPackageLink(PackageDoc pd, String target,
++            Content label) {
++        return getHyperLink(pathString(pd, "package-summary.html"), "", label, "", target);
+     }
+ 
+     /**
+@@ -358,6 +386,64 @@
+     }
+ 
+     /**
++     * Generates the HTML document tree and prints it out.
++     *
++     * @param metakeywords Array of String keywords for META tag. Each element
++     *                     of the array is assigned to a separate META tag.
++     *                     Pass in null for no array
++     * @param includeScript true if printing windowtitle script
++     *                      false for files that appear in the left-hand frames
++     * @param body the body htmltree to be included in the document
++     */
++    public void printHtmlDocument(String[] metakeywords, boolean includeScript,
++            Content body) {
++        Content htmlDocType = DocType.Transitional();
++        Content htmlComment = new Comment(configuration.getText("doclet.New_Page"));
++        Content head = new HtmlTree(HtmlTag.HEAD);
++        if (!configuration.notimestamp) {
++            Content headComment = new Comment("Generated by javadoc (version " +
++                    ConfigurationImpl.BUILD_DATE + ") on " + today());
++            head.addContent(headComment);
++        }
++        if (configuration.charset.length() > 0) {
++            Content meta = HtmlTree.META("Content-Type", "text/html",
++                    configuration.charset);
++            head.addContent(meta);
++        }
++        head.addContent(getTitle());
++        if (!configuration.notimestamp) {
++            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
++            Content meta = HtmlTree.META("date", dateFormat.format(new Date()));
++            head.addContent(meta);
++        }
++        if (metakeywords != null) {
++            for (int i=0; i < metakeywords.length; i++) {
++                Content meta = HtmlTree.META("keywords", metakeywords[i]);
++                head.addContent(meta);
++            }
++        }
++        head.addContent(getStyleSheetProperties());
++        Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(),
++                head, body);
++        Content htmlDocument = new HtmlDocument(htmlDocType,
++                htmlComment, htmlTree);
++        print(htmlDocument.toString());
++    }
++
++    /**
++     * Get the window title.
++     *
++     * @param title the title string to construct the complete window title
++     * @return the window title string
++     */
++    public String getWindowTitle(String title) {
++        if (configuration.windowtitle.length() > 0) {
++            title += " (" + configuration.windowtitle  + ")";
++        }
++        return title;
++    }
++
++    /**
+      * Print user specified header and the footer.
+      *
+      * @param header if true print the user provided header else print the
+@@ -378,6 +464,28 @@
+     }
+ 
+     /**
++     * Get user specified header and the footer.
++     *
++     * @param header if true print the user provided header else print the
++     * user provided footer.
++     */
++    public Content getUserHeaderFooter(boolean header) {
++        String content;
++        if (header) {
++            content = replaceDocRootDir(configuration.header);
++        } else {
++            if (configuration.footer.length() != 0) {
++                content = replaceDocRootDir(configuration.footer);
++            } else {
++                content = replaceDocRootDir(configuration.header);
++            }
++        }
++        Content rawContent = new RawHtml(content);
++        Content em = HtmlTree.EM(rawContent);
++        return em;
++    }
++
++    /**
+      * Print the user specified top.
+      */
+     public void printTop() {
+@@ -386,6 +494,16 @@
+     }
+ 
+     /**
++     * Adds the user specified top.
++     *
++     * @param body the content tree to which user specified top will be added
++     */
++    public void addTop(Content body) {
++        Content top = new RawHtml(replaceDocRootDir(configuration.top));
++        body.addContent(top);
++    }
++
++    /**
+      * Print the user specified bottom.
+      */
+     public void printBottom() {
+@@ -394,6 +512,18 @@
+     }
+ 
+     /**
++     * Adds the user specified bottom.
++     *
++     * @param body the content tree to which user specified bottom will be added
++     */
++    public void addBottom(Content body) {
++        Content bottom = new RawHtml(replaceDocRootDir(configuration.bottom));
++        Content small = HtmlTree.SMALL(bottom);
++        Content p = HtmlTree.P(HtmlStyle.legalCopy, small);
++        body.addContent(p);
++    }
++
++    /**
+      * Print the navigation bar for the Html page at the top and and the bottom.
+      *
+      * @param header If true print navigation bar at the top of the page else
+@@ -406,13 +536,13 @@
+                 println(DocletConstants.NL + "<!-- ========= START OF TOP NAVBAR ======= -->");
+                 anchor("navbar_top");
+                 println();
+-                print(getHyperLink("", "skip-navbar_top", "", false, "",
++                print(getHyperLinkString("", "skip-navbar_top", "", false, "",
+                     configuration.getText("doclet.Skip_navigation_links"), ""));
+             } else {
+                 println(DocletConstants.NL + "<!-- ======= START OF BOTTOM NAVBAR ====== -->");
+                 anchor("navbar_bottom");
+                 println();
+-                print(getHyperLink("", "skip-navbar_bottom", "", false, "",
++                print(getHyperLinkString("", "skip-navbar_bottom", "", false, "",
+                     configuration.getText("doclet.Skip_navigation_links"), ""));
+             }
+             table(0, "100%", 1, 0);
+@@ -516,6 +646,97 @@
+     }
+ 
+     /**
++     * Adds the navigation bar for the Html page at the top and and the bottom.
++     *
++     * @param header If true print navigation bar at the top of the page else
++     * @param body the HtmlTree to which the nav links will be added
++     */
++    protected void addNavLinks(boolean header, Content body) {
++        if (!configuration.nonavbar) {
++            String allClassesId = "allclasses_";
++            HtmlTree navDiv = new HtmlTree(HtmlTag.DIV);
++            if (header) {
++                body.addContent(HtmlConstants.START_OF_TOP_NAVBAR);
++                navDiv.addStyle(HtmlStyle.topNav);
++                allClassesId += "navbar_top";
++                Content a = getMarkerAnchor("navbar_top");
++                navDiv.addContent(a);
++                Content skipLinkContent = getHyperLink("",
++                        "skip-navbar_top", HtmlTree.EMPTY, configuration.getText(
++                        "doclet.Skip_navigation_links"), "");
++                navDiv.addContent(skipLinkContent);
++            } else {
++                body.addContent(HtmlConstants.START_OF_BOTTOM_NAVBAR);
++                navDiv.addStyle(HtmlStyle.bottomNav);
++                allClassesId += "navbar_bottom";
++                Content a = getMarkerAnchor("navbar_bottom");
++                navDiv.addContent(a);
++                Content skipLinkContent = getHyperLink("",
++                        "skip-navbar_bottom", HtmlTree.EMPTY, configuration.getText(
++                        "doclet.Skip_navigation_links"), "");
++                navDiv.addContent(skipLinkContent);
++            }
++            if (header) {
++                navDiv.addContent(getMarkerAnchor("navbar_top_firstrow"));
++            } else {
++                navDiv.addContent(getMarkerAnchor("navbar_bottom_firstrow"));
++            }
++            HtmlTree navList = new HtmlTree(HtmlTag.UL);
++            navList.addStyle(HtmlStyle.navList);
++            navList.addAttr(HtmlAttr.TITLE, "Navigation");
++            if (configuration.createoverview) {
++                navList.addContent(getNavLinkContents());
++            }
++            if (configuration.packages.length == 1) {
++                navList.addContent(getNavLinkPackage(configuration.packages[0]));
++            } else if (configuration.packages.length > 1) {
++                navList.addContent(getNavLinkPackage());
++            }
++            navList.addContent(getNavLinkClass());
++            if(configuration.classuse) {
++                navList.addContent(getNavLinkClassUse());
++            }
++            if(configuration.createtree) {
++                navList.addContent(getNavLinkTree());
++            }
++            if(!(configuration.nodeprecated ||
++                     configuration.nodeprecatedlist)) {
++                navList.addContent(getNavLinkDeprecated());
++            }
++            if(configuration.createindex) {
++                navList.addContent(getNavLinkIndex());
++            }
++            if (!configuration.nohelp) {
++                navList.addContent(getNavLinkHelp());
++            }
++            navDiv.addContent(navList);
++            Content aboutDiv = HtmlTree.DIV(HtmlStyle.aboutLanguage, getUserHeaderFooter(header));
++            navDiv.addContent(aboutDiv);
++            body.addContent(navDiv);
++            Content ulNav = HtmlTree.UL(HtmlStyle.navList, getNavLinkPrevious());
++            ulNav.addContent(getNavLinkNext());
++            Content subDiv = HtmlTree.DIV(HtmlStyle.subNav, ulNav);
++            Content ulFrames = HtmlTree.UL(HtmlStyle.navList, getNavShowLists());
++            ulFrames.addContent(getNavHideLists(filename));
++            subDiv.addContent(ulFrames);
++            HtmlTree ulAllClasses = HtmlTree.UL(HtmlStyle.navList, getNavLinkClassIndex());
++            ulAllClasses.addAttr(HtmlAttr.ID, allClassesId.toString());
++            subDiv.addContent(ulAllClasses);
++            subDiv.addContent(getAllClassesLinkScript(allClassesId.toString()));
++            addSummaryDetailLinks(subDiv);
++            if (header) {
++                subDiv.addContent(getMarkerAnchor("skip-navbar_top"));
++                body.addContent(subDiv);
++                body.addContent(HtmlConstants.END_OF_TOP_NAVBAR);
++            } else {
++                subDiv.addContent(getMarkerAnchor("skip-navbar_bottom"));
++                body.addContent(subDiv);
++                body.addContent(HtmlConstants.END_OF_BOTTOM_NAVBAR);
++            }
++        }
++    }
++
++    /**
+      * Print the word "NEXT" to indicate that no link is available.  Override
+      * this method to customize next link.
+      */
+@@ -524,6 +745,16 @@
+     }
+ 
+     /**
++     * Get the word "NEXT" to indicate that no link is available.  Override
++     * this method to customize next link.
++     *
++     * @return a content tree for the link
++     */
++    protected Content getNavLinkNext() {
++        return getNavLinkNext(null);
++    }
++
++    /**
+      * Print the word "PREV" to indicate that no link is available.  Override
+      * this method to customize prev link.
+      */
+@@ -532,12 +763,28 @@
+     }
+ 
+     /**
++     * Get the word "PREV" to indicate that no link is available.  Override
++     * this method to customize prev link.
++     *
++     * @return a content tree for the link
++     */
++    protected Content getNavLinkPrevious() {
++        return getNavLinkPrevious(null);
++    }
++
++    /**
+      * Do nothing. This is the default method.
+      */
+     protected void printSummaryDetailLinks() {
+     }
+ 
+     /**
++     * Do nothing. This is the default method.
++     */
++    protected void addSummaryDetailLinks(Content navDiv) {
++    }
++
++    /**
+      * Print link to the "overview-summary.html" page.
+      */
+     protected void navLinkContents() {
+@@ -548,6 +795,18 @@
+     }
+ 
+     /**
++     * Get link to the "overview-summary.html" page.
++     *
++     * @return a content tree for the link
++     */
++    protected Content getNavLinkContents() {
++        Content linkContent = getHyperLink(relativePath +
++                "overview-summary.html", "", overviewLabel, "", "");
++        Content li = HtmlTree.LI(linkContent);
++        return li;
++    }
++
++    /**
+      * Description for a cell in the navigation bar.
+      */
+     protected void navCellStart() {
+@@ -588,6 +847,19 @@
+     }
+ 
+     /**
++     * Get link to the "package-summary.html" page for the package passed.
++     *
++     * @param pkg Package to which link will be generated
++     * @return a content tree for the link
++     */
++    protected Content getNavLinkPackage(PackageDoc pkg) {
++        Content linkContent = getPackageLink(pkg,
++                packageLabel);
++        Content li = HtmlTree.LI(linkContent);
++        return li;
++    }
++
++    /**
+      * Print the word "Package" in the navigation bar cell, to indicate that
+      * link is not available here.
+      */
+@@ -600,6 +872,16 @@
+     }
+ 
+     /**
++     * Get the word "Package" , to indicate that link is not available here.
++     *
++     * @return a content tree for the link
++     */
++    protected Content getNavLinkPackage() {
++        Content li = HtmlTree.LI(packageLabel);
++        return li;
++    }
++
++    /**
+      * Print the word "Use" in the navigation bar cell, to indicate that link
+      * is not available.
+      */
+@@ -612,6 +894,16 @@
+     }
+ 
+     /**
++     * Get the word "Use", to indicate that link is not available.
++     *
++     * @return a content tree for the link
++     */
++    protected Content getNavLinkClassUse() {
++        Content li = HtmlTree.LI(useLabel);
++        return li;
++    }
++
++    /**
+      * Print link for previous file.
+      *
+      * @param prev File name for the prev link.
+@@ -626,6 +918,22 @@
+     }
+ 
+     /**
++     * Get link for previous file.
++     *
++     * @param prev File name for the prev link
++     * @return a content tree for the link
++     */
++    public Content getNavLinkPrevious(String prev) {
++        Content li;
++        if (prev != null) {
++            li = HtmlTree.LI(getHyperLink(prev, "", prevLabel, "", ""));
++        }
++        else
++            li = HtmlTree.LI(prevLabel);
++        return li;
++    }
++
++    /**
+      * Print link for next file.  If next is null, just print the label
+      * without linking it anywhere.
+      *
+@@ -641,16 +949,46 @@
+     }
+ 
+     /**
++     * Get link for next file.  If next is null, just print the label
++     * without linking it anywhere.
++     *
++     * @param next File name for the next link
++     * @return a content tree for the link
++     */
++    public Content getNavLinkNext(String next) {
++        Content li;
++        if (next != null) {
++            li = HtmlTree.LI(getHyperLink(next, "", nextLabel, "", ""));
++        }
++        else
++            li = HtmlTree.LI(nextLabel);
++        return li;
++    }
++
++    /**
+      * Print "FRAMES" link, to switch to the frame version of the output.
+      *
+      * @param link File to be linked, "index.html".
+      */
+     protected void navShowLists(String link) {
+-        print(getHyperLink(link + "?" + path + filename, "",
++        print(getHyperLinkString(link + "?" + path + filename, "",
+             configuration.getText("doclet.FRAMES"), true, "", "", "_top"));
+     }
+ 
+     /**
++     * Get "FRAMES" link, to switch to the frame version of the output.
++     *
++     * @param link File to be linked, "index.html"
++     * @return a content tree for the link
++     */
++    protected Content getNavShowLists(String link) {
++        Content framesContent = getHyperLink(link + "?" + path +
++                filename, "", framesLabel, "", "_top");
++        Content li = HtmlTree.LI(framesContent);
++        return li;
++    }
++
++    /**
+      * Print "FRAMES" link, to switch to the frame version of the output.
+      */
+     protected void navShowLists() {
+@@ -658,16 +996,37 @@
+     }
+ 
+     /**
++     * Get "FRAMES" link, to switch to the frame version of the output.
++     *
++     * @return a content tree for the link
++     */
++    protected Content getNavShowLists() {
++        return getNavShowLists(relativePath + "index.html");
++    }
++
++    /**
+      * Print "NO FRAMES" link, to switch to the non-frame version of the output.
+      *
+      * @param link File to be linked.
+      */
+     protected void navHideLists(String link) {
+-        print(getHyperLink(link, "", configuration.getText("doclet.NO_FRAMES"),
++        print(getHyperLinkString(link, "", configuration.getText("doclet.NO_FRAMES"),
+             true, "", "", "_top"));
+     }
+ 
+     /**
++     * Get "NO FRAMES" link, to switch to the non-frame version of the output.
++     *
++     * @param link File to be linked
++     * @return a content tree for the link
++     */
++    protected Content getNavHideLists(String link) {
++        Content noFramesContent = getHyperLink(link, "", noframesLabel, "", "_top");
++        Content li = HtmlTree.LI(noFramesContent);
++        return li;
++    }
++
++    /**
+      * Print "Tree" link in the navigation bar. If there is only one package
+      * specified on the command line, then the "Tree" link will be to the
+      * only "package-tree.html" file otherwise it will be to the
+@@ -687,10 +1046,39 @@
+     }
+ 
+     /**
+-     * Print "Tree" link to the "overview-tree.html" file.
++     * Get "Tree" link in the navigation bar. If there is only one package
++     * specified on the command line, then the "Tree" link will be to the
++     * only "package-tree.html" file otherwise it will be to the
++     * "overview-tree.html" file.
++     *
++     * @return a content tree for the link
+      */
+-    protected void navLinkMainTree(String label) {
+-        printHyperLink(relativePath + "overview-tree.html", label);
++    protected Content getNavLinkTree() {
++        Content treeLinkContent;
++        PackageDoc[] packages = configuration.root.specifiedPackages();
++        if (packages.length == 1 && configuration.root.specifiedClasses().length == 0) {
++            treeLinkContent = getHyperLink(pathString(packages[0],
++                    "package-tree.html"), "", treeLabel,
++                    "", "");
++        } else {
++            treeLinkContent = getHyperLink(relativePath + "overview-tree.html",
++                    "", treeLabel, "", "");
++        }
++        Content li = HtmlTree.LI(treeLinkContent);
++        return li;
++    }
++
++    /**
++     * Get the overview tree link for the main tree.
++     *
++     * @param label the label for the link
++     * @return a content tree for the link
++     */
++    protected Content getNavLinkMainTree(String label) {
++        Content mainTreeContent = getHyperLink(relativePath + "overview-tree.html",
++                new StringContent(label));
++        Content li = HtmlTree.LI(mainTreeContent);
++        return li;
+     }
+ 
+     /**
+@@ -706,6 +1094,16 @@
+     }
+ 
+     /**
++     * Get the word "Class", to indicate that class link is not available.
++     *
++     * @return a content tree for the link
++     */
++    protected Content getNavLinkClass() {
++        Content li = HtmlTree.LI(classLabel);
++        return li;
++    }
++
++    /**
+      * Print "Deprecated" API link in the navigation bar.
+      */
+     protected void navLinkDeprecated() {
+@@ -716,6 +1114,18 @@
+     }
+ 
+     /**
++     * Get "Deprecated" API link in the navigation bar.
++     *
++     * @return a content tree for the link
++     */
++    protected Content getNavLinkDeprecated() {
++        Content linkContent = getHyperLink(relativePath +
++                "deprecated-list.html", "", deprecatedLabel, "", "");
++        Content li = HtmlTree.LI(linkContent);
++        return li;
++    }
++
++    /**
+      * Print link for generated index. If the user has used "-splitindex"
+      * command line option, then link to file "index-files/index-1.html" is
+      * generated otherwise link to file "index-all.html" is generated.
+@@ -725,6 +1135,21 @@
+                 AllClassesFrameWriter.OUTPUT_FILE_NAME_NOFRAMES,
+             "", "", configuration.getText("doclet.All_Classes"), true);
+     }
++
++    /**
++     * Get link for generated index. If the user has used "-splitindex"
++     * command line option, then link to file "index-files/index-1.html" is
++     * generated otherwise link to file "index-all.html" is generated.
++     *
++     * @return a content tree for the link
++     */
++    protected Content getNavLinkClassIndex() {
++        Content allClassesContent = getHyperLink(relativePath +
++                AllClassesFrameWriter.OUTPUT_FILE_NAME_NOFRAMES, "",
++                allclassesLabel, "", "");
++        Content li = HtmlTree.LI(allClassesContent);
++        return li;
++    }
+     /**
+      * Print link for generated class index.
+      */
+@@ -741,6 +1166,20 @@
+     }
+ 
+     /**
++     * Get link for generated class index.
++     *
++     * @return a content tree for the link
++     */
++    protected Content getNavLinkIndex() {
++        Content linkContent = getHyperLink(relativePath +(configuration.splitindex?
++            DirectoryManager.getPath("index-files") + fileseparator: "") +
++            (configuration.splitindex?"index-1.html" : "index-all.html"), "",
++            indexLabel, "", "");
++        Content li = HtmlTree.LI(linkContent);
++        return li;
++    }
++
++    /**
+      * Print help file link. If user has provided a help file, then generate a
+      * link to the user given file, which is already copied to current or
+      * destination directory.
+@@ -762,6 +1201,29 @@
+     }
+ 
+     /**
++     * Get help file link. If user has provided a help file, then generate a
++     * link to the user given file, which is already copied to current or
++     * destination directory.
++     *
++     * @return a content tree for the link
++     */
++    protected Content getNavLinkHelp() {
++        String helpfilenm = configuration.helpfile;
++        if (helpfilenm.equals("")) {
++            helpfilenm = "help-doc.html";
++        } else {
++            int lastsep;
++            if ((lastsep = helpfilenm.lastIndexOf(File.separatorChar)) != -1) {
++                helpfilenm = helpfilenm.substring(lastsep + 1);
++            }
++        }
++        Content linkContent = getHyperLink(relativePath + helpfilenm, "",
++                helpLabel, "", "");
++        Content li = HtmlTree.LI(linkContent);
++        return li;
++    }
++
++    /**
+      * Print the word "Detail" in the navigation bar. No link is available.
+      */
+     protected void navDetail() {
+@@ -843,6 +1305,96 @@
+     }
+ 
+     /**
++     * Get summary table header.
++     *
++     * @param header the header for the table
++     * @param scope the scope of the headers
++     * @return a content tree for the header
++     */
++    public Content getSummaryTableHeader(String[] header, String scope) {
++        Content tr = new HtmlTree(HtmlTag.TR);
++        int size = header.length;
++        Content tableHeader;
++        if (size == 1) {
++            tableHeader = new StringContent(header[0]);
++            tr.addContent(HtmlTree.TH(HtmlStyle.colOne, scope, tableHeader));
++            return tr;
++        }
++        for (int i = 0; i < size; i++) {
++            tableHeader = new StringContent(header[i]);
++            if(i == 0)
++                tr.addContent(HtmlTree.TH(HtmlStyle.colFirst, scope, tableHeader));
++            else if(i == (size - 1))
++                tr.addContent(HtmlTree.TH(HtmlStyle.colLast, scope, tableHeader));
++            else
++                tr.addContent(HtmlTree.TH(scope, tableHeader));
++        }
++        return tr;
++    }
++
++    /**
++     * Get table caption.
++     *
++     * @param rawText the caption for the table which could be raw Html
++     * @return a content tree for the caption
++     */
++    public Content getTableCaption(String rawText) {
++        Content title = new RawHtml(rawText);
++        Content captionSpan = HtmlTree.SPAN(title);
++        Content space = getSpace();
++        Content tabSpan = HtmlTree.SPAN(HtmlStyle.tabEnd, space);
++        Content caption = HtmlTree.CAPTION(captionSpan);
++        caption.addContent(tabSpan);
++        return caption;
++    }
++
++    /**
++     * Get the marker anchor which will be added to the documentation tree.
++     *
++     * @param anchorName the anchor name attribute
++     * @return a content tree for the marker anchor
++     */
++    public Content getMarkerAnchor(String anchorName) {
++        return getMarkerAnchor(anchorName, null);
++    }
++
++    /**
++     * Get the marker anchor which will be added to the documentation tree.
++     *
++     * @param anchorName the anchor name attribute
++     * @param anchorContent the content that should be added to the anchor
++     * @return a content tree for the marker anchor
++     */
++    public Content getMarkerAnchor(String anchorName, Content anchorContent) {
++        if (anchorContent == null)
++            anchorContent = new Comment(" ");
++        Content markerAnchor = HtmlTree.A_NAME(anchorName, anchorContent);
++        return markerAnchor;
++    }
++
++    /**
++     * Returns a packagename content.
++     *
++     * @param packageDoc the package to check
++     * @return package name content
++     */
++    public Content getPackageName(PackageDoc packageDoc) {
++        return packageDoc == null || packageDoc.name().length() == 0 ?
++            defaultPackageLabel :
++            getPackageLabel(packageDoc.name());
++    }
++
++    /**
++     * Returns a package name label.
++     *
++     * @param parsedName the package name
++     * @return the package name content
++     */
++    public Content getPackageLabel(String packageName) {
++        return new StringContent(packageName);
++    }
++
++    /**
+      * Prine table header information about color, column span and the font.
+      *
+      * @param color Background color.
+@@ -1026,7 +1578,7 @@
+      * @param isStrong true if the label should be strong.
+      */
+     public void printPackageLink(PackageDoc pkg, String label, boolean isStrong) {
+-        print(getPackageLink(pkg, label, isStrong));
++        print(getPackageLinkString(pkg, label, isStrong));
+     }
+ 
+     /**
+@@ -1039,7 +1591,7 @@
+      */
+     public void printPackageLink(PackageDoc pkg, String label, boolean isStrong,
+             String style) {
+-        print(getPackageLink(pkg, label, isStrong, style));
++        print(getPackageLinkString(pkg, label, isStrong, style));
+     }
+ 
+     /**
+@@ -1050,9 +1602,9 @@
+      * @param isStrong true if the label should be strong.
+      * @return the link to the given package.
+      */
+-    public String getPackageLink(PackageDoc pkg, String label,
++    public String getPackageLinkString(PackageDoc pkg, String label,
+                                  boolean isStrong) {
+-        return getPackageLink(pkg, label, isStrong, "");
++        return getPackageLinkString(pkg, label, isStrong, "");
+     }
+ 
+     /**
+@@ -1064,7 +1616,7 @@
+      * @param style  the font of the package link label.
+      * @return the link to the given package.
+      */
+-    public String getPackageLink(PackageDoc pkg, String label, boolean isStrong,
++    public String getPackageLinkString(PackageDoc pkg, String label, boolean isStrong,
+             String style) {
+         boolean included = pkg != null && pkg.isIncluded();
+         if (! included) {
+@@ -1077,12 +1629,43 @@
+             }
+         }
+         if (included || pkg == null) {
+-            return getHyperLink(pathString(pkg, "package-summary.html"),
++            return getHyperLinkString(pathString(pkg, "package-summary.html"),
+                                 "", label, isStrong, style);
+         } else {
+             String crossPkgLink = getCrossPackageLink(Util.getPackageName(pkg));
+             if (crossPkgLink != null) {
+-                return getHyperLink(crossPkgLink, "", label, isStrong, style);
++                return getHyperLinkString(crossPkgLink, "", label, isStrong, style);
++            } else {
++                return label;
++            }
++        }
++    }
++
++    /**
++     * Return the link to the given package.
++     *
++     * @param pkg the package to link to.
++     * @param label the label for the link.
++     * @return a content tree for the package link.
++     */
++    public Content getPackageLink(PackageDoc pkg, Content label) {
++        boolean included = pkg != null && pkg.isIncluded();
++        if (! included) {
++            PackageDoc[] packages = configuration.packages;
++            for (int i = 0; i < packages.length; i++) {
++                if (packages[i].equals(pkg)) {
++                    included = true;
++                    break;
++                }
++            }
++        }
++        if (included || pkg == null) {
++            return getHyperLink(pathString(pkg, "package-summary.html"),
++                                "", label);
++        } else {
++            String crossPkgLink = getCrossPackageLink(Util.getPackageName(pkg));
++            if (crossPkgLink != null) {
++                return getHyperLink(crossPkgLink, "", label);
+             } else {
+                 return label;
+             }
+@@ -1110,6 +1693,29 @@
+     }
+ 
+     /**
++     * Add the link to the content tree.
++     *
++     * @param doc program element doc for which the link will be added
++     * @param label label for the link
++     * @param htmltree the content tree to which the link will be added
++     */
++    public void addSrcLink(ProgramElementDoc doc, Content label, Content htmltree) {
++        if (doc == null) {
++            return;
++        }
++        ClassDoc cd = doc.containingClass();
++        if (cd == null) {
++            //d must be a class doc since in has no containing class.
++            cd = (ClassDoc) doc;
++        }
++        String href = relativePath + DocletConstants.SOURCE_OUTPUT_DIR_NAME
++                + DirectoryManager.getDirectoryPath(cd.containingPackage())
++                + cd.name() + ".html#" + SourceToHTMLConverter.getAnchorName(doc);
++        Content linkContent = getHyperLink(href, "", label, "", "");
++        htmltree.addContent(linkContent);
++    }
++
++    /**
+      * Return the link to the given class.
+      *
+      * @param linkInfo the information about the link.
+@@ -1173,7 +1779,7 @@
+                 //the -link option.  There are ways to determine if an external package
+                 //exists, but no way to determine if the external class exists.  We just
+                 //have to assume that it does.
+-                return getHyperLink(
++                return getHyperLinkString(
+                     configuration.extern.getExternalLink(packageName, relativePath,
+                                 className + ".html?is-external=true"),
+                     refMemName == null ? "" : refMemName,
+@@ -1198,17 +1804,27 @@
+             "package-summary.html?is-external=true");
+     }
+ 
+-    public void printQualifiedClassLink(int context, ClassDoc cd) {
+-        printLink(new LinkInfoImpl(context, cd,
+-            configuration.getClassName(cd), ""));
++    /**
++     * Get the class link.
++     *
++     * @param context the id of the context where the link will be added
++     * @param cd the class doc to link to
++     * @return a content tree for the link
++     */
++    public Content getQualifiedClassLink(int context, ClassDoc cd) {
++        return new RawHtml(getLink(new LinkInfoImpl(context, cd,
++                configuration.getClassName(cd), "")));
+     }
+ 
+     /**
+-     * Print Class link, with only class name as the link and prefixing
+-     * plain package name.
++     * Add the class link.
++     *
++     * @param context the id of the context where the link will be added
++     * @param cd the class doc to link to
++     * @param contentTree the content tree to which the link will be added
+      */
+-    public void printPreQualifiedClassLink(int context, ClassDoc cd) {
+-        print(getPreQualifiedClassLink(context, cd, false));
++    public void addPreQualifiedClassLink(int context, ClassDoc cd, Content contentTree) {
++        addPreQualifiedClassLink(context, cd, false, contentTree);
+     }
+ 
+     /**
+@@ -1231,13 +1847,36 @@
+         return classlink;
+     }
+ 
++    /**
++     * Add the class link with the package portion of the label in
++     * plain text. If the qualifier is excluded, it will not be included in the
++     * link label.
++     *
++     * @param context the id of the context where the link will be added
++     * @param cd the class to link to
++     * @param isStrong true if the link should be strong
++     * @param contentTree the content tree to which the link with be added
++     */
++    public void addPreQualifiedClassLink(int context,
++            ClassDoc cd, boolean isStrong, Content contentTree) {
++        PackageDoc pd = cd.containingPackage();
++        if(pd != null && ! configuration.shouldExcludeQualifier(pd.name())) {
++            contentTree.addContent(getPkgName(cd));
++        }
++        contentTree.addContent(new RawHtml(getLink(new LinkInfoImpl(
++                context, cd, cd.name(), isStrong))));
++    }
+ 
+     /**
+-     * Print Class link, with only class name as the strong link and prefixing
++     * Add the class link, with only class name as the strong link and prefixing
+      * plain package name.
++     *
++     * @param context the id of the context where the link will be added
++     * @param cd the class to link to
++     * @param contentTree the content tree to which the link with be added
+      */
+-    public void printPreQualifiedStrongClassLink(int context, ClassDoc cd) {
+-        print(getPreQualifiedClassLink(context, cd, true));
++    public void addPreQualifiedStrongClassLink(int context, ClassDoc cd, Content contentTree) {
++        addPreQualifiedClassLink(context, cd, true, contentTree);
+     }
+ 
+     public void printText(String key) {
+@@ -1265,16 +1904,15 @@
+     }
+ 
+     /**
+-     * Print the link for the given member.
++     * Get the link for the given member.
+      *
+-     * @param context the id of the context where the link will be printed.
+-     * @param doc the member being linked to.
+-     * @param label the label for the link.
+-     * @param strong true if the link should be strong.
++     * @param context the id of the context where the link will be added
++     * @param doc the member being linked to
++     * @param label the label for the link
++     * @return a content tree for the doc link
+      */
+-    public void printDocLink(int context, MemberDoc doc, String label,
+-            boolean strong) {
+-        print(getDocLink(context, doc, label, strong));
++    public Content getDocLink(int context, MemberDoc doc, String label) {
++        return getDocLink(context, doc.containingClass(), doc, label);
+     }
+ 
+     /**
+@@ -1336,6 +1974,34 @@
+         }
+     }
+ 
++    /**
++     * Return the link for the given member.
++     *
++     * @param context the id of the context where the link will be added
++     * @param classDoc the classDoc that we should link to.  This is not
++     *                 necessarily equal to doc.containingClass().  We may be
++     *                 inheriting comments
++     * @param doc the member being linked to
++     * @param label the label for the link
++     * @return the link for the given member
++     */
++    public Content getDocLink(int context, ClassDoc classDoc, MemberDoc doc,
++        String label) {
++        if (! (doc.isIncluded() ||
++            Util.isLinkable(classDoc, configuration()))) {
++            return new StringContent(label);
++        } else if (doc instanceof ExecutableMemberDoc) {
++            ExecutableMemberDoc emd = (ExecutableMemberDoc)doc;
++            return new RawHtml(getLink(new LinkInfoImpl(context, classDoc,
++                getAnchor(emd), label, false)));
++        } else if (doc instanceof MemberDoc) {
++            return new RawHtml(getLink(new LinkInfoImpl(context, classDoc,
++                doc.name(), label, false)));
++        } else {
++            return new StringContent(label);
++        }
++    }
++
+     public void anchor(ExecutableMemberDoc emd) {
+         anchor(getAnchor(emd));
+     }
+@@ -1390,14 +2056,14 @@
+                 //@see is referencing an included package
+                 String packageName = isplaintext ? refPackage.name() :
+                     getCode() + refPackage.name() + getCodeEnd();
+-                result.append(getPackageLink(refPackage,
++                result.append(getPackageLinkString(refPackage,
+                     label.length() == 0 ? packageName : label, false));
+             } else {
+                 //@see is not referencing an included class or package.  Check for cross links.
+                 String classCrossLink, packageCrossLink = getCrossPackageLink(refClassName);
+                 if (packageCrossLink != null) {
+                     //Package cross link found
+-                    result.append(getHyperLink(packageCrossLink, "",
++                    result.append(getHyperLinkString(packageCrossLink, "",
+                         (label.length() == 0)? text : label, false));
+                 } else if ((classCrossLink = getCrossClassLink(refClassName,
+                         refMemName, label, false, "", ! isplaintext)) != null) {
+@@ -1456,18 +2122,61 @@
+         printCommentTags(doc, tag.inlineTags(), false, false);
+     }
+ 
++    /**
++     * Add the inline comment.
++     *
++     * @param doc the doc for which the inline comment will be added
++     * @param tag the inline tag to be added
++     * @param htmltree the content tree to which the comment will be added
++     */
++    public void addInlineComment(Doc doc, Tag tag, Content htmltree) {
++        addCommentTags(doc, tag.inlineTags(), false, false, htmltree);
++    }
++
+     public void printInlineDeprecatedComment(Doc doc, Tag tag) {
+         printCommentTags(doc, tag.inlineTags(), true, false);
+     }
+ 
++    /**
++     * Add the inline deprecated comment.
++     *
++     * @param doc the doc for which the inline deprecated comment will be added
++     * @param tag the inline tag to be added
++     * @param htmltree the content tree to which the comment will be added
++     */
++    public void addInlineDeprecatedComment(Doc doc, Tag tag, Content htmltree) {
++        addCommentTags(doc, tag.inlineTags(), true, false, htmltree);
++    }
++
+     public void printSummaryComment(Doc doc) {
+         printSummaryComment(doc, doc.firstSentenceTags());
+     }
+ 
++    /**
++     * Adds the summary content.
++     *
++     * @param doc the doc for which the summary will be generated
++     * @param htmltree the documentation tree to which the summary will be added
++     */
++    public void addSummaryComment(Doc doc, Content htmltree) {
++        addSummaryComment(doc, doc.firstSentenceTags(), htmltree);
++    }
++
+     public void printSummaryComment(Doc doc, Tag[] firstSentenceTags) {
+         printCommentTags(doc, firstSentenceTags, false, true);
+     }
+ 
++    /**
++     * Adds the summary content.
++     *
++     * @param doc the doc for which the summary will be generated
++     * @param firstSentenceTags the first sentence tags for the doc
++     * @param htmltree the documentation tree to which the summary will be added
++     */
++    public void addSummaryComment(Doc doc, Tag[] firstSentenceTags, Content htmltree) {
++        addCommentTags(doc, firstSentenceTags, false, true, htmltree);
++    }
++
+     public void printSummaryDeprecatedComment(Doc doc) {
+         printCommentTags(doc, doc.firstSentenceTags(), true, true);
+     }
+@@ -1476,11 +2185,25 @@
+         printCommentTags(doc, tag.firstSentenceTags(), true, true);
+     }
+ 
++    public void addSummaryDeprecatedComment(Doc doc, Tag tag, Content htmltree) {
++        addCommentTags(doc, tag.firstSentenceTags(), true, true, htmltree);
++    }
++
+     public void printInlineComment(Doc doc) {
+         printCommentTags(doc, doc.inlineTags(), false, false);
+         p();
+     }
+ 
++    /**
++     * Adds the inline comment.
++     *
++     * @param doc the doc for which the inline comments will be generated
++     * @param htmltree the documentation tree to which the inline comments will be added
++     */
++    public void addInlineComment(Doc doc, Content htmltree) {
++        addCommentTags(doc, doc.inlineTags(), false, false, htmltree);
++    }
++
+     public void printInlineDeprecatedComment(Doc doc) {
+         printCommentTags(doc, doc.inlineTags(), true, false);
+     }
+@@ -1503,6 +2226,36 @@
+     }
+ 
+     /**
++     * Adds the comment tags.
++     *
++     * @param doc the doc for which the comment tags will be generated
++     * @param tags the first sentence tags for the doc
++     * @param depr true if it is deprecated
++     * @param first true if the first sentenge tags should be added
++     * @param htmltree the documentation tree to which the comment tags will be added
++     */
++    private void addCommentTags(Doc doc, Tag[] tags, boolean depr,
++            boolean first, Content htmltree) {
++        if(configuration.nocomment){
++            return;
++        }
++        Content div;
++        Content result = new RawHtml(commentTagsToString(null, doc, tags, first));
++        if (depr) {
++            Content italic = HtmlTree.I(result);
++            div = HtmlTree.DIV(HtmlStyle.block, italic);
++            htmltree.addContent(div);
++        }
++        else {
++            div = HtmlTree.DIV(HtmlStyle.block, result);
++            htmltree.addContent(div);
++        }
++        if (tags.length == 0) {
++            htmltree.addContent(getSpace());
++        }
++    }
++
++    /**
+      * Converts inline tags and text to text strings, expanding the
+      * inline tags along the way.  Called wherever text can contain
+      * an inline tag, such as in comments or in free-form text arguments
+@@ -1612,8 +2365,8 @@
+             return text;
+         }
+ 
+-        if (! redirectPathFromRoot.endsWith(DirectoryManager.URL_FILE_SEPERATOR)) {
+-            redirectPathFromRoot += DirectoryManager.URL_FILE_SEPERATOR;
++        if (! redirectPathFromRoot.endsWith(DirectoryManager.URL_FILE_SEPARATOR)) {
++            redirectPathFromRoot += DirectoryManager.URL_FILE_SEPARATOR;
+         }
+ 
+         //Redirect all relative links.
+@@ -1739,6 +2492,27 @@
+     }
+ 
+     /**
++     * Returns a link to the stylesheet file.
++     *
++     * @return an HtmlTree for the lINK tag which provides the stylesheet location
++     */
++    public HtmlTree getStyleSheetProperties() {
++        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;
++    }
++
++    /**
+      * According to the Java Language Specifications, all the outer classes
+      * and static nested classes are core classes.
+      */
+@@ -1765,6 +2539,16 @@
+     }
+ 
+     /**
++     * Adds the annotatation types for the given doc.
++     *
++     * @param packageDoc the package to write annotations for
++     * @param htmltree the content tree to which the annotation types will be added
++     */
++    public void addAnnotationInfo(ProgramElementDoc doc, Content htmltree) {
++        addAnnotationInfo(doc, doc.annotations(), htmltree);
++    }
++
++    /**
+      * Write the annotatation types for the given doc and parameter.
+      *
+      * @param indent the number of spaced to indent the parameters.
+@@ -1776,6 +2560,30 @@
+     }
+ 
+     /**
++     * Adds the annotatation types for the given packageDoc.
++     *
++     * @param packageDoc the package to write annotations for.
++     * @param htmltree the documentation tree to which the annotation info will be
++     *        added
++     */
++    public void addAnnotationInfo(PackageDoc packageDoc, Content htmltree) {
++        addAnnotationInfo(packageDoc, packageDoc.annotations(), htmltree);
++    }
++
++    /**
++     * Add the annotatation types for the given doc and parameter.
++     *
++     * @param indent the number of spaces to indent the parameters.
++     * @param doc the doc to write annotations for.
++     * @param param the parameter to write annotations for.
++     * @param tree the content tree to which the annotation types will be added
++     */
++    public boolean addAnnotationInfo(int indent, Doc doc, Parameter param,
++            Content tree) {
++        return addAnnotationInfo(indent, doc, param.annotations(), false, tree);
++    }
++
++    /**
+      * Write the annotatation types for the given doc.
+      *
+      * @param doc the doc to write annotations for.
+@@ -1786,6 +2594,19 @@
+     }
+ 
+     /**
++     * Adds the annotatation types for the given doc.
++     *
++     * @param doc the doc to write annotations for.
++     * @param descList the array of {@link AnnotationDesc}.
++     * @param htmltree the documentation tree to which the annotation info will be
++     *        added
++     */
++    private void addAnnotationInfo(Doc doc, AnnotationDesc[] descList,
++            Content htmltree) {
++        addAnnotationInfo(0, doc, descList, true, htmltree);
++    }
++
++    /**
+      * Write the annotatation types for the given doc.
+      *
+      * @param indent the number of extra spaces to indent the annotations.
+@@ -1806,6 +2627,29 @@
+     }
+ 
+     /**
++     * Adds the annotatation types for the given doc.
++     *
++     * @param indent the number of extra spaces to indent the annotations.
++     * @param doc the doc to write annotations for.
++     * @param descList the array of {@link AnnotationDesc}.
++     * @param htmltree the documentation tree to which the annotation info will be
++     *        added
++     */
++    private boolean addAnnotationInfo(int indent, Doc doc,
++            AnnotationDesc[] descList, boolean lineBreak, Content htmltree) {
++        List<String> annotations = getAnnotations(indent, descList, lineBreak);
++        if (annotations.size() == 0) {
++            return false;
++        }
++        Content annotationContent;
++        for (Iterator<String> iter = annotations.iterator(); iter.hasNext();) {
++            annotationContent = new RawHtml(iter.next());
++            htmltree.addContent(annotationContent);
++        }
++        return true;
++    }
++
++   /**
+      * Return the string representations of the annotation types for
+      * the given doc.
+      *
+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
+@@ -31,6 +31,7 @@
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.tools.doclets.internal.toolkit.taglets.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
++import com.sun.tools.doclets.formats.html.markup.*;
+ 
+ /**
+  * Generate serialized form for serializable fields.
+@@ -46,8 +47,6 @@
+ 
+     private boolean printedOverallAnchor = false;
+ 
+-    private boolean printedFirstMember = false;
+-
+     public HtmlSerialFieldWriter(SubWriterHolderWriter writer,
+                                     ClassDoc classdoc) {
+         super(writer, classdoc);
+@@ -69,109 +68,143 @@
+         }
+     }
+ 
+-    public void writeHeader(String heading) {
+-        if (! printedOverallAnchor) {
+-            writer.anchor("serializedForm");
+-            printedOverallAnchor = true;
+-            writer.printTableHeadingBackground(heading);
+-            writer.println();
+-            if (heading.equals(
+-                   configuration().getText("doclet.Serialized_Form_class"))) {
+-                assert !writer.getMemberDetailsListPrinted();
+-            }
+-        } else {
+-            writer.printTableHeadingBackground(heading);
+-            writer.println();
+-        }
+-    }
+-
+-    public void writeMemberHeader(ClassDoc fieldType, String fieldTypeStr,
+-            String fieldDimensions, String fieldName) {
+-        if (printedFirstMember) {
+-            writer.printMemberHeader();
+-        }
+-        printedFirstMember = true;
+-        writer.h3();
+-        writer.print(fieldName);
+-        writer.h3End();
+-        writer.pre();
+-        if (fieldType == null) {
+-            writer.print(fieldTypeStr);
+-        } else {
+-            writer.printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_SERIAL_MEMBER,
+-                fieldType));
+-        }
+-        print(fieldDimensions + ' ');
+-        strong(fieldName);
+-        writer.preEnd();
+-        assert !writer.getMemberDetailsListPrinted();
++    /**
++     * Return the header for serializable fields section.
++     *
++     * @return a content tree for the header
++     */
++    public Content getSerializableFieldsHeader() {
++        HtmlTree ul = new HtmlTree(HtmlTag.UL);
++        ul.addStyle(HtmlStyle.blockList);
++        return ul;
+     }
+ 
+     /**
+-     * Write the deprecated information for this member.
++     * Return the header for serializable fields content section.
+      *
+-     * @param field the field to document.
++     * @param isLastContent true if the cotent being documented is the last content.
++     * @return a content tree for the header
+      */
+-    public void writeMemberDeprecatedInfo(FieldDoc field) {
+-        printDeprecated(field);
++    public Content getFieldsContentHeader(boolean isLastContent) {
++        HtmlTree li = new HtmlTree(HtmlTag.LI);
++        if (isLastContent)
++            li.addStyle(HtmlStyle.blockListLast);
++        else
++            li.addStyle(HtmlStyle.blockList);
++        return li;
+     }
+ 
+     /**
+-     * Write the description text for this member.
++     * Add serializable fields.
++     *
++     * @param heading the heading for the section
++     * @param serializableFieldsTree the tree to be added to the serializable fileds
++     *        content tree
++     * @return a content tree for the serializable fields content
++     */
++    public Content getSerializableFields(String heading, Content serializableFieldsTree) {
++        HtmlTree li = new HtmlTree(HtmlTag.LI);
++        li.addStyle(HtmlStyle.blockList);
++        if (serializableFieldsTree.isValid()) {
++            if (!printedOverallAnchor) {
++                li.addContent(writer.getMarkerAnchor("serializedForm"));
++                printedOverallAnchor = true;
++            }
++            Content headingContent = new StringContent(heading);
++            Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING,
++                    headingContent);
++            li.addContent(serialHeading);
++            li.addContent(serializableFieldsTree);
++        }
++        return li;
++    }
++
++    /**
++     * Add the member header.
++     *
++     * @param fieldsType the class document to be listed
++     * @param fieldTypeStr the string for the filed type to be documented
++     * @param fieldDimensions the dimensions of the field string to be added
++     * @param firldName name of the field to be added
++     * @param contentTree the content tree to which the member header will be added
++     */
++    public void addMemberHeader(ClassDoc fieldType, String fieldTypeStr,
++            String fieldDimensions, String fieldName, Content contentTree) {
++        Content nameContent = new RawHtml(fieldName);
++        Content heading = HtmlTree.HEADING(HtmlConstants.MEMBER_HEADING, nameContent);
++        contentTree.addContent(heading);
++        Content pre = new HtmlTree(HtmlTag.PRE);
++        if (fieldType == null) {
++            pre.addContent(fieldTypeStr);
++        } else {
++            Content fieldContent = new RawHtml(writer.getLink(new LinkInfoImpl(
++                    LinkInfoImpl.CONTEXT_SERIAL_MEMBER, fieldType)));
++            pre.addContent(fieldContent);
++        }
++        pre.addContent(fieldDimensions + " ");
++        pre.addContent(fieldName);
++        contentTree.addContent(pre);
++    }
++
++    /**
++     * Add the deprecated information for this member.
+      *
+      * @param field the field to document.
++     * @param contentTree the tree to which the deprecated info will be added
+      */
+-    public void writeMemberDescription(FieldDoc field) {
++    public void addMemberDeprecatedInfo(FieldDoc field, Content contentTree) {
++        addDeprecatedInfo(field, contentTree);
++    }
++
++    /**
++     * Add the description text for this member.
++     *
++     * @param field the field to document.
++     * @param contentTree the tree to which the deprecated info will be added
++     */
++    public void addMemberDescription(FieldDoc field, Content contentTree) {
+         if (field.inlineTags().length > 0) {
+-            writer.printMemberDetailsListStartTag();
+-            writer.dd();
+-            writer.printInlineComment(field);
+-            writer.ddEnd();
++            writer.addInlineComment(field, contentTree);
+         }
+         Tag[] tags = field.tags("serial");
+         if (tags.length > 0) {
+-            writer.printMemberDetailsListStartTag();
+-            writer.dd();
+-            writer.printInlineComment(field, tags[0]);
+-            writer.ddEnd();
++            writer.addInlineComment(field, tags[0], contentTree);
+         }
+     }
+ 
+     /**
+-     * Write the description text for this member represented by the tag.
++     * Add the description text for this member represented by the tag.
+      *
+-     * @param serialFieldTag the field to document (represented by tag).
++     * @param serialFieldTag the field to document (represented by tag)
++     * @param contentTree the tree to which the deprecated info will be added
+      */
+-    public void writeMemberDescription(SerialFieldTag serialFieldTag) {
++    public void addMemberDescription(SerialFieldTag serialFieldTag, Content contentTree) {
+         String serialFieldTagDesc = serialFieldTag.description().trim();
+         if (!serialFieldTagDesc.isEmpty()) {
+-            writer.dl();
+-            writer.dd();
+-            writer.print(serialFieldTagDesc);
+-            writer.ddEnd();
+-            writer.dlEnd();
++            Content serialFieldContent = new RawHtml(serialFieldTagDesc);
++            Content div = HtmlTree.DIV(HtmlStyle.block, serialFieldContent);
++            contentTree.addContent(div);
+         }
+     }
+ 
+     /**
+-     * Write the tag information for this member.
++     * Add the tag information for this member.
+      *
+      * @param field the field to document.
++     * @param contentTree the tree to which the member tags info will be added
+      */
+-    public void writeMemberTags(FieldDoc field) {
++    public void addMemberTags(FieldDoc field, Content contentTree) {
+         TagletOutputImpl output = new TagletOutputImpl("");
+         TagletWriter.genTagOuput(configuration().tagletManager, field,
+-            configuration().tagletManager.getCustomTags(field),
++                configuration().tagletManager.getCustomTags(field),
+                 writer.getTagletWriterInstance(false), output);
+         String outputString = output.toString().trim();
++        Content dlTags = new HtmlTree(HtmlTag.DL);
+         if (!outputString.isEmpty()) {
+-            writer.printMemberDetailsListStartTag();
+-            writer.dd();
+-            writer.dl();
+-            print(outputString);
+-            writer.dlEnd();
+-            writer.ddEnd();
++            Content tagContent = new RawHtml(outputString);
++            dlTags.addContent(tagContent);
+         }
++        contentTree.addContent(dlTags);
+     }
+ 
+     /**
+@@ -192,24 +225,4 @@
+             return true;
+         return false;
+     }
+-
+-    public void writeMemberFooter() {
+-        printMemberFooter();
+-    }
+-
+-    /**
+-     * Write the footer information. If the serilization overview section was
+-     * printed, check for definition list and close list tag.
+-     *
+-     * @param heading the heading that was written.
+-     */
+-    public void writeFooter(String heading) {
+-        if (printedOverallAnchor) {
+-            if (heading.equals(
+-                   configuration().getText("doclet.Serialized_Form_class"))) {
+-                writer.printMemberDetailsListEndTag();
+-                assert !writer.getMemberDetailsListPrinted();
+-            }
+-        }
+-    }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java
+@@ -28,57 +28,119 @@
+ import com.sun.javadoc.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.tools.doclets.internal.toolkit.taglets.*;
++import com.sun.tools.doclets.formats.html.markup.*;
+ 
+ /**
+  * Generate serialized form for Serializable/Externalizable methods.
+  * Documentation denoted by the <code>serialData</code> tag is processed.
+  *
+  * @author Joe Fialli
++ * @author Bhavesh Patel (Modified)
+  */
+ public class HtmlSerialMethodWriter extends MethodWriterImpl implements
+         SerializedFormWriter.SerialMethodWriter{
+ 
+-    private boolean printedFirstMember = false;
+-
+     public HtmlSerialMethodWriter(SubWriterHolderWriter writer,
+             ClassDoc classdoc) {
+         super(writer, classdoc);
+     }
+ 
+-    public void writeHeader(String heading) {
+-        writer.anchor("serialized_methods");
+-        writer.printTableHeadingBackground(heading);
+-        writer.p();
++    /**
++     * Return the header for serializable methods section.
++     *
++     * @return a content tree for the header
++     */
++    public Content getSerializableMethodsHeader() {
++        HtmlTree ul = new HtmlTree(HtmlTag.UL);
++        ul.addStyle(HtmlStyle.blockList);
++        return ul;
+     }
+ 
+-    public void writeNoCustomizationMsg(String msg) {
+-        writer.print(msg);
+-        writer.p();
++    /**
++     * Return the header for serializable methods content section.
++     *
++     * @param isLastContent true if the cotent being documented is the last content.
++     * @return a content tree for the header
++     */
++    public Content getMethodsContentHeader(boolean isLastContent) {
++        HtmlTree li = new HtmlTree(HtmlTag.LI);
++        if (isLastContent)
++            li.addStyle(HtmlStyle.blockListLast);
++        else
++            li.addStyle(HtmlStyle.blockList);
++        return li;
+     }
+ 
+-    public void writeMemberHeader(MethodDoc member) {
+-        if (printedFirstMember) {
+-            writer.printMemberHeader();
+-        }
+-        printedFirstMember = true;
+-        writer.anchor(member);
+-        printHead(member);
+-        writeSignature(member);
++    /**
++     * Add serializable methods.
++     *
++     * @param heading the heading for the section
++     * @param serializableMethodContent the tree to be added to the serializable methods
++     *        content tree
++     * @return a content tree for the serializable methods content
++     */
++    public Content getSerializableMethods(String heading, Content serializableMethodContent) {
++        Content li = HtmlTree.LI(HtmlStyle.blockList, writer.getMarkerAnchor(
++                "serialized_methods"));
++        Content headingContent = new StringContent(heading);
++        Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING,
++                headingContent);
++        li.addContent(serialHeading);
++        li.addContent(serializableMethodContent);
++        return li;
+     }
+ 
+-    public void writeMemberFooter() {
+-        printMemberFooter();
++    /**
++     * Return the no customization message.
++     *
++     * @param msg the message to be displayed
++     * @return no customization message content
++     */
++    public Content getNoCustomizationMsg(String msg) {
++        Content noCustomizationMsg = new StringContent(msg);
++        return noCustomizationMsg;
+     }
+ 
+-    public void writeDeprecatedMemberInfo(MethodDoc member) {
+-        printDeprecated(member);
++    /**
++     * Add the member header.
++     *
++     * @param member the method document to be listed
++     * @param methodsContentTree the content tree to which the member header will be added
++     */
++    public void addMemberHeader(MethodDoc member, Content methodsContentTree) {
++        methodsContentTree.addContent(writer.getMarkerAnchor(
++                writer.getAnchor(member)));
++        methodsContentTree.addContent(getHead(member));
++        methodsContentTree.addContent(getSignature(member));
+     }
+ 
+-    public void writeMemberDescription(MethodDoc member) {
+-        printComment(member);
++    /**
++     * Add the deprecated information for this member.
++     *
++     * @param member the method to document.
++     * @param methodsContentTree the tree to which the deprecated info will be added
++     */
++    public void addDeprecatedMemberInfo(MethodDoc member, Content methodsContentTree) {
++        addDeprecatedInfo(member, methodsContentTree);
+     }
+ 
+-    public void writeMemberTags(MethodDoc member) {
++    /**
++     * Add the description text for this member.
++     *
++     * @param member the method to document.
++     * @param methodsContentTree the tree to which the deprecated info will be added
++     */
++    public void addMemberDescription(MethodDoc member, Content methodsContentTree) {
++        addComment(member, methodsContentTree);
++    }
++
++    /**
++     * Add the tag information for this member.
++     *
++     * @param member the method to document.
++     * @param methodsContentTree the tree to which the member tags info will be added
++     */
++    public void addMemberTags(MethodDoc member, Content methodsContentTree) {
+         TagletOutputImpl output = new TagletOutputImpl("");
+         TagletManager tagletManager =
+             ConfigurationImpl.getInstance().tagletManager;
+@@ -86,14 +148,12 @@
+             tagletManager.getSerializedFormTags(),
+             writer.getTagletWriterInstance(false), output);
+         String outputString = output.toString().trim();
++        Content dlTags = new HtmlTree(HtmlTag.DL);
+         if (!outputString.isEmpty()) {
+-            writer.printMemberDetailsListStartTag();
+-            writer.dd();
+-            writer.dl();
+-            print(outputString);
+-            writer.dlEnd();
+-            writer.ddEnd();
++            Content tagContent = new RawHtml(outputString);
++            dlTags.addContent(tagContent);
+         }
++        methodsContentTree.addContent(dlTags);
+         MethodDoc method = (MethodDoc)member;
+         if (method.name().compareTo("writeExternal") == 0
+                 && method.tags("serialData").length == 0) {
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java
+@@ -79,7 +79,7 @@
+                 String filename = pathString(classLinkInfo);
+                 if (linkInfo.linkToSelf ||
+                                 !(linkInfo.classDoc.name() + ".html").equals(m_writer.filename)) {
+-                        linkOutput.append(m_writer.getHyperLink(filename,
++                        linkOutput.append(m_writer.getHyperLinkString(filename,
+                             classLinkInfo.where, label.toString(),
+                             classLinkInfo.isStrong, classLinkInfo.styleName,
+                             title, classLinkInfo.target));
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java
+@@ -28,9 +28,9 @@
+ import java.io.*;
+ 
+ import com.sun.javadoc.*;
++import com.sun.tools.doclets.formats.html.markup.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+-import com.sun.tools.doclets.internal.toolkit.taglets.*;
+ 
+ /**
+  * Writes method documentation in HTML format.
+@@ -43,8 +43,6 @@
+ public class MethodWriterImpl extends AbstractExecutableMemberWriter
+         implements MethodWriter, MemberSummaryWriter {
+ 
+-    private boolean printedSummaryHeader = false;
+-
+     /**
+      * Construct a new MethodWriterImpl.
+      *
+@@ -65,184 +63,127 @@
+     }
+ 
+     /**
+-     * Write the methods summary header for the given class.
+-     *
+-     * @param classDoc the class the summary belongs to.
++     * {@inheritDoc}
+      */
+-    public void writeMemberSummaryHeader(ClassDoc classDoc) {
+-        printedSummaryHeader = true;
+-        writer.println();
+-        writer.println("<!-- ========== METHOD SUMMARY =========== -->");
+-        writer.println();
+-        writer.printSummaryHeader(this, classDoc);
+-    }
+-
+-    /**
+-     * Write the methods summary footer for the given class.
+-     *
+-     * @param classDoc the class the summary belongs to.
+-     */
+-    public void writeMemberSummaryFooter(ClassDoc classDoc) {
+-        writer.printSummaryFooter(this, classDoc);
+-    }
+-
+-    /**
+-     * Write the inherited methods summary header for the given class.
+-     *
+-     * @param classDoc the class the summary belongs to.
+-     */
+-    public void writeInheritedMemberSummaryHeader(ClassDoc classDoc) {
+-        if(! printedSummaryHeader){
+-            //We don't want inherited summary to not be under heading.
+-            writeMemberSummaryHeader(classDoc);
+-            writeMemberSummaryFooter(classDoc);
+-            printedSummaryHeader = true;
+-        }
+-        writer.printInheritedSummaryHeader(this, classDoc);
++    public Content getMemberSummaryHeader(ClassDoc classDoc,
++            Content memberSummaryTree) {
++        memberSummaryTree.addContent(HtmlConstants.START_OF_METHOD_SUMMARY);
++        Content memberTree = writer.getMemberTreeHeader();
++        writer.addSummaryHeader(this, classDoc, memberTree);
++        return memberTree;
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeInheritedMemberSummary(ClassDoc classDoc,
+-        ProgramElementDoc method, boolean isFirst, boolean isLast) {
+-        writer.printInheritedSummaryMember(this, classDoc, method, isFirst);
++    public Content getMethodDetailsTreeHeader(ClassDoc classDoc,
++            Content memberDetailsTree) {
++        memberDetailsTree.addContent(HtmlConstants.START_OF_METHOD_DETAILS);
++        Content methodDetailsTree = writer.getMemberTreeHeader();
++        methodDetailsTree.addContent(writer.getMarkerAnchor("method_detail"));
++        Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
++                writer.methodDetailsLabel);
++        methodDetailsTree.addContent(heading);
++        return methodDetailsTree;
+     }
+ 
+     /**
+-     * Write the inherited methods summary footer for the given class.
+-     *
+-     * @param classDoc the class the summary belongs to.
++     * {@inheritDoc}
+      */
+-    public void writeInheritedMemberSummaryFooter(ClassDoc classDoc) {
+-        writer.printInheritedSummaryFooter(this, classDoc);        ;
++    public Content getMethodDocTreeHeader(MethodDoc method,
++            Content methodDetailsTree) {
++        String erasureAnchor;
++        if ((erasureAnchor = getErasureAnchor(method)) != null) {
++            methodDetailsTree.addContent(writer.getMarkerAnchor((erasureAnchor)));
++        }
++        methodDetailsTree.addContent(
++                writer.getMarkerAnchor(writer.getAnchor(method)));
++        Content methodDocTree = writer.getMemberTreeHeader();
++        Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING);
++        heading.addContent(method.name());
++        methodDocTree.addContent(heading);
++        return methodDocTree;
+     }
+ 
+     /**
+-     * Write the header for the method documentation.
++     * Get the signature for the given method.
+      *
+-     * @param classDoc the class that the methods belong to.
++     * @param method the method being documented.
++     * @return a content object for the signature
+      */
+-    public void writeHeader(ClassDoc classDoc, String header) {
+-        writer.println();
+-        writer.println("<!-- ============ METHOD DETAIL ========== -->");
+-        writer.println();
+-        writer.anchor("method_detail");
+-        writer.printTableHeadingBackground(header);
++    public Content getSignature(MethodDoc method) {
++        writer.displayLength = 0;
++        Content pre = new HtmlTree(HtmlTag.PRE);
++        writer.addAnnotationInfo(method, pre);
++        addModifiers(method, pre);
++        addTypeParameters(method, pre);
++        addReturnType(method, pre);
++        if (configuration().linksource) {
++            Content methodName = new StringContent(method.name());
++            writer.addSrcLink(method, methodName, pre);
++        } else {
++            addName(method.name(), pre);
++        }
++        addParameters(method, pre);
++        addExceptions(method, pre);
++        return pre;
+     }
+ 
+     /**
+-     * Write the method header for the given method.
+-     *
+-     * @param method the method being documented.
+-     * @param isFirst the flag to indicate whether or not the method is the
+-     *        first to be documented.
++     * {@inheritDoc}
+      */
+-    public void writeMethodHeader(MethodDoc method, boolean isFirst) {
+-        if (! isFirst) {
+-            writer.printMemberHeader();
+-        }
+-        writer.println();
+-        String erasureAnchor;
+-        if ((erasureAnchor = getErasureAnchor(method)) != null) {
+-            writer.anchor(erasureAnchor);
+-        }
+-        writer.anchor(method);
+-        writer.h3();
+-        writer.print(method.name());
+-        writer.h3End();
++    public void addDeprecated(MethodDoc method, Content methodDocTree) {
++        addDeprecatedInfo(method, methodDocTree);
+     }
+ 
+     /**
+-     * Write the signature for the given method.
+-     *
+-     * @param method the method being documented.
++     * {@inheritDoc}
+      */
+-    public void writeSignature(MethodDoc method) {
+-        writer.displayLength = 0;
+-        writer.pre();
+-        writer.writeAnnotationInfo(method);
+-        printModifiers(method);
+-        writeTypeParameters(method);
+-        printReturnType(method);
+-        if (configuration().linksource) {
+-            writer.printSrcLink(method, method.name());
+-        } else {
+-            strong(method.name());
+-        }
+-        writeParameters(method);
+-        writeExceptions(method);
+-        writer.preEnd();
+-        assert !writer.getMemberDetailsListPrinted();
+-    }
+-
+-    /**
+-     * Write the deprecated output for the given method.
+-     *
+-     * @param method the method being documented.
+-     */
+-    public void writeDeprecated(MethodDoc method) {
+-        printDeprecated(method);
+-    }
+-
+-    /**
+-     * Write the comments for the given method.
+-     *
+-     * @param method the method being documented.
+-     */
+-    public void writeComments(Type holder, MethodDoc method) {
++    public void addComments(Type holder, MethodDoc method, Content methodDocTree) {
+         ClassDoc holderClassDoc = holder.asClassDoc();
+         if (method.inlineTags().length > 0) {
+-            writer.printMemberDetailsListStartTag();
+             if (holder.asClassDoc().equals(classdoc) ||
+-                (! (holderClassDoc.isPublic() ||
++                    (! (holderClassDoc.isPublic() ||
+                     Util.isLinkable(holderClassDoc, configuration())))) {
+-                writer.dd();
+-                writer.printInlineComment(method);
+-                writer.ddEnd();
++                writer.addInlineComment(method, methodDocTree);
+             } else {
+-                String classlink = writer.codeText(
+-                    writer.getDocLink(LinkInfoImpl.CONTEXT_METHOD_DOC_COPY,
++                Content link = new RawHtml(
++                        writer.getDocLink(LinkInfoImpl.CONTEXT_METHOD_DOC_COPY,
+                         holder.asClassDoc(), method,
+                         holder.asClassDoc().isIncluded() ?
+                             holder.typeName() : holder.qualifiedTypeName(),
+-                        false));
+-                writer.dd();
+-                writer.strongText(holder.asClassDoc().isClass()?
+-                        "doclet.Description_From_Class":
+-                        "doclet.Description_From_Interface",
+-                    classlink);
+-                writer.ddEnd();
+-                writer.dd();
+-                writer.printInlineComment(method);
+-                writer.ddEnd();
++                            false));
++                Content codelLink = HtmlTree.CODE(link);
++                Content strong = HtmlTree.STRONG(holder.asClassDoc().isClass()?
++                    writer.descfrmClassLabel : writer.descfrmInterfaceLabel);
++                strong.addContent(writer.getSpace());
++                strong.addContent(codelLink);
++                methodDocTree.addContent(HtmlTree.DIV(HtmlStyle.block, strong));
++                writer.addInlineComment(method, methodDocTree);
+             }
+         }
+     }
+ 
+     /**
+-     * Write the tag output for the given method.
+-     *
+-     * @param method the method being documented.
++     * {@inheritDoc}
+      */
+-    public void writeTags(MethodDoc method) {
+-        writer.printTags(method);
++    public void addTags(MethodDoc method, Content methodDocTree) {
++        writer.addTagsInfo(method, methodDocTree);
+     }
+ 
+     /**
+-     * Write the method footer.
++     * {@inheritDoc}
+      */
+-    public void writeMethodFooter() {
+-        printMemberFooter();
++    public Content getMethodDetails(Content methodDetailsTree) {
++        return getMemberTree(methodDetailsTree);
+     }
+ 
+     /**
+-     * Write the footer for the method documentation.
+-     *
+-     * @param classDoc the class that the methods belong to.
++     * {@inheritDoc}
+      */
+-    public void writeFooter(ClassDoc classDoc) {
+-        //No footer to write for method documentation
++    public Content getMethodDoc(Content methodDocTree,
++            boolean isLastContent) {
++        return getMemberTree(methodDocTree, isLastContent);
+     }
+ 
+     /**
+@@ -256,53 +197,89 @@
+         return VisibleMemberMap.METHODS;
+     }
+ 
+-    public void printSummaryLabel() {
+-        writer.printText("doclet.Method_Summary");
++    /**
++     * {@inheritDoc}
++     */
++    public void addSummaryLabel(Content memberTree) {
++        Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
++                writer.getResource("doclet.Method_Summary"));
++        memberTree.addContent(label);
+     }
+ 
+-    public void printTableSummary() {
+-        writer.tableIndexSummary(configuration().getText("doclet.Member_Table_Summary",
++    /**
++     * {@inheritDoc}
++     */
++    public String getTableSummary() {
++        return configuration().getText("doclet.Member_Table_Summary",
+                 configuration().getText("doclet.Method_Summary"),
+-                configuration().getText("doclet.methods")));
++                configuration().getText("doclet.methods"));
+     }
+ 
+-    public void printSummaryTableHeader(ProgramElementDoc member) {
++    /**
++     * {@inheritDoc}
++     */
++    public String getCaption() {
++        return configuration().getText("doclet.Methods");
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public String[] getSummaryTableHeader(ProgramElementDoc member) {
+         String[] header = new String[] {
+             writer.getModifierTypeHeader(),
+             configuration().getText("doclet.0_and_1",
+                     configuration().getText("doclet.Method"),
+                     configuration().getText("doclet.Description"))
+         };
+-        writer.summaryTableHeader(header, "col");
++        return header;
+     }
+ 
+-    public void printSummaryAnchor(ClassDoc cd) {
+-        writer.anchor("method_summary");
++    /**
++     * {@inheritDoc}
++     */
++    public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
++        memberTree.addContent(writer.getMarkerAnchor("method_summary"));
+     }
+ 
+-    public void printInheritedSummaryAnchor(ClassDoc cd) {
+-        writer.anchor("methods_inherited_from_class_" +
+-            ConfigurationImpl.getInstance().getClassName(cd));
++    /**
++     * {@inheritDoc}
++     */
++    public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
++        inheritedTree.addContent(writer.getMarkerAnchor(
++                "methods_inherited_from_class_" +
++                configuration().getClassName(cd)));
+     }
+ 
+-    public void printInheritedSummaryLabel(ClassDoc cd) {
+-        String classlink = writer.getPreQualifiedClassLink(
+-            LinkInfoImpl.CONTEXT_MEMBER, cd, false);
+-        writer.strong();
+-        String key = cd.isClass()?
+-            "doclet.Methods_Inherited_From_Class" :
+-            "doclet.Methods_Inherited_From_Interface";
+-        writer.printText(key, classlink);
+-        writer.strongEnd();
++    /**
++     * {@inheritDoc}
++     */
++    public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
++        Content classLink = new RawHtml(writer.getPreQualifiedClassLink(
++                LinkInfoImpl.CONTEXT_MEMBER, cd, false));
++        Content label = new StringContent(cd.isClass() ?
++            configuration().getText("doclet.Methods_Inherited_From_Class") :
++            configuration().getText("doclet.Methods_Inherited_From_Interface"));
++        Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
++                label);
++        labelHeading.addContent(writer.getSpace());
++        labelHeading.addContent(classLink);
++        inheritedTree.addContent(labelHeading);
+     }
+ 
+-    protected void printSummaryType(ProgramElementDoc member) {
++    /**
++     * {@inheritDoc}
++     */
++    protected void addSummaryType(ProgramElementDoc member, Content tdSummaryType) {
+         MethodDoc meth = (MethodDoc)member;
+-        printModifierAndType(meth, meth.returnType());
++        addModifierAndType(meth, meth.returnType(), tdSummaryType);
+     }
+ 
+-    protected static void printOverridden(HtmlDocletWriter writer,
+-            Type overriddenType, MethodDoc method) {
++    /**
++     * {@inheritDoc}
++     */
++    protected static void addOverridden(HtmlDocletWriter writer,
++            Type overriddenType, MethodDoc method, Content dl) {
+         if(writer.configuration.nocomment){
+             return;
+         }
+@@ -317,31 +294,33 @@
+             //is not visible so don't document this.
+             return;
+         }
+-        String label = "doclet.Overrides";
++        Content label = writer.overridesLabel;
+         int context = LinkInfoImpl.CONTEXT_METHOD_OVERRIDES;
+ 
+         if (method != null) {
+             if(overriddenType.asClassDoc().isAbstract() && method.isAbstract()){
+                 //Abstract method is implemented from abstract class,
+                 //not overridden
+-                label = "doclet.Specified_By";
++                label = writer.specifiedByLabel;
+                 context = LinkInfoImpl.CONTEXT_METHOD_SPECIFIED_BY;
+             }
+-            String overriddenTypeLink = writer.codeText(
+-                writer.getLink(new LinkInfoImpl(context, overriddenType)));
++            Content dt = HtmlTree.DT(HtmlTree.STRONG(label));
++            dl.addContent(dt);
++            Content overriddenTypeLink = new RawHtml(
++                    writer.getLink(new LinkInfoImpl(context, overriddenType)));
++            Content codeOverridenTypeLink = HtmlTree.CODE(overriddenTypeLink);
+             String name = method.name();
+-            writer.dt();
+-            writer.strongText(label);
+-            writer.dtEnd();
+-            writer.dd();
+-            String methLink = writer.codeText(
+-                writer.getLink(
++            Content methlink = new RawHtml(writer.getLink(
+                     new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
+-                        overriddenType.asClassDoc(),
+-                        writer.getAnchor(method), name, false)
+-                ));
+-            writer.printText("doclet.in_class", methLink, overriddenTypeLink);
+-            writer.ddEnd();
++                    overriddenType.asClassDoc(),
++                    writer.getAnchor(method), name, false)));
++            Content codeMethLink = HtmlTree.CODE(methlink);
++            Content dd = HtmlTree.DD(codeMethLink);
++            dd.addContent(writer.getSpace());
++            dd.addContent(writer.getResource("doclet.in_class"));
++            dd.addContent(writer.getSpace());
++            dd.addContent(codeOverridenTypeLink);
++            dl.addContent(dd);
+         }
+     }
+ 
+@@ -363,61 +342,78 @@
+         }
+     }
+ 
+-    protected static void printImplementsInfo(HtmlDocletWriter writer,
+-            MethodDoc method) {
++    /**
++     * {@inheritDoc}
++     */
++    protected static void addImplementsInfo(HtmlDocletWriter writer,
++            MethodDoc method, Content dl) {
+         if(writer.configuration.nocomment){
+             return;
+         }
+         ImplementedMethods implementedMethodsFinder =
+-            new ImplementedMethods(method, writer.configuration);
++                new ImplementedMethods(method, writer.configuration);
+         MethodDoc[] implementedMethods = implementedMethodsFinder.build();
+         for (int i = 0; i < implementedMethods.length; i++) {
+             MethodDoc implementedMeth = implementedMethods[i];
+             Type intfac = implementedMethodsFinder.getMethodHolder(implementedMeth);
+-            String methlink = "";
+-            String intfaclink = writer.codeText(
+-                writer.getLink(new LinkInfoImpl(
++            Content intfaclink = new RawHtml(writer.getLink(new LinkInfoImpl(
+                     LinkInfoImpl.CONTEXT_METHOD_SPECIFIED_BY, intfac)));
+-            writer.dt();
+-            writer.strongText("doclet.Specified_By");
+-            writer.dtEnd();
+-            writer.dd();
+-            methlink = writer.codeText(writer.getDocLink(
+-                LinkInfoImpl.CONTEXT_MEMBER, implementedMeth,
+-                implementedMeth.name(), false));
+-            writer.printText("doclet.in_interface", methlink, intfaclink);
+-            writer.ddEnd();
+-        }
+-
+-    }
+-
+-    protected void printReturnType(MethodDoc method) {
+-        Type type = method.returnType();
+-        if (type != null) {
+-            writer.printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_RETURN_TYPE,
+-                type));
+-            print(' ');
++            Content codeIntfacLink = HtmlTree.CODE(intfaclink);
++            Content dt = HtmlTree.DT(HtmlTree.STRONG(writer.specifiedByLabel));
++            dl.addContent(dt);
++            Content methlink = new RawHtml(writer.getDocLink(
++                    LinkInfoImpl.CONTEXT_MEMBER, implementedMeth,
++                    implementedMeth.name(), false));
++            Content codeMethLink = HtmlTree.CODE(methlink);
++            Content dd = HtmlTree.DD(codeMethLink);
++            dd.addContent(writer.getSpace());
++            dd.addContent(writer.getResource("doclet.in_interface"));
++            dd.addContent(writer.getSpace());
++            dd.addContent(codeIntfacLink);
++            dl.addContent(dd);
+         }
+     }
+ 
+-    protected void printNavSummaryLink(ClassDoc cd, boolean link) {
+-        if (link) {
+-            writer.printHyperLink("", (cd == null)?
+-                "method_summary":
+-                "methods_inherited_from_class_" +
+-                ConfigurationImpl.getInstance().getClassName(cd),
+-                ConfigurationImpl.getInstance().getText("doclet.navMethod"));
+-        } else {
+-            writer.printText("doclet.navMethod");
++    /**
++     * Add the return type.
++     *
++     * @param method the method being documented.
++     * @param htmltree the content tree to which the return type will be added
++     */
++    protected void addReturnType(MethodDoc method, Content htmltree) {
++        Type type = method.returnType();
++        if (type != null) {
++            Content linkContent = new RawHtml(writer.getLink(
++                    new LinkInfoImpl(LinkInfoImpl.CONTEXT_RETURN_TYPE, type)));
++            htmltree.addContent(linkContent);
++            htmltree.addContent(writer.getSpace());
+         }
+     }
+ 
+-    protected void printNavDetailLink(boolean link) {
++    /**
++     * {@inheritDoc}
++     */
++    protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
+         if (link) {
+-            writer.printHyperLink("", "method_detail",
+-                ConfigurationImpl.getInstance().getText("doclet.navMethod"));
++            return writer.getHyperLink("", (cd == null)?
++                "method_summary":
++                "methods_inherited_from_class_" +
++                configuration().getClassName(cd),
++                writer.getResource("doclet.navMethod"));
+         } else {
+-            writer.printText("doclet.navMethod");
++            return writer.getResource("doclet.navMethod");
++        }
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    protected void addNavDetailLink(boolean link, Content liNav) {
++        if (link) {
++            liNav.addContent(writer.getHyperLink("", "method_detail",
++                    writer.getResource("doclet.navMethod")));
++        } else {
++            liNav.addContent(writer.getResource("doclet.navMethod"));
+         }
+     }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java
+@@ -26,8 +26,10 @@
+ package com.sun.tools.doclets.formats.html;
+ 
+ import java.io.*;
++import java.util.*;
+ 
+ import com.sun.javadoc.*;
++import com.sun.tools.doclets.formats.html.markup.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+ 
+@@ -42,8 +44,6 @@
+ public class NestedClassWriterImpl extends AbstractMemberWriter
+     implements MemberSummaryWriter {
+ 
+-    private boolean printedSummaryHeader = false;
+-
+     public NestedClassWriterImpl(SubWriterHolderWriter writer,
+             ClassDoc classdoc) {
+         super(writer, classdoc);
+@@ -54,90 +54,17 @@
+     }
+ 
+     /**
+-     * Write the classes summary header for the given class.
+-     *
+-     * @param classDoc the class the summary belongs to.
+-     */
+-    public void writeMemberSummaryHeader(ClassDoc classDoc) {
+-        printedSummaryHeader = true;
+-        writer.println("<!-- ======== NESTED CLASS SUMMARY ======== -->");
+-        writer.println();
+-        writer.printSummaryHeader(this, classDoc);
+-    }
+-
+-    /**
+-     * Write the classes summary footer for the given class.
+-     *
+-     * @param classDoc the class the summary belongs to.
+-     */
+-    public void writeMemberSummaryFooter(ClassDoc classDoc) {
+-        writer.printSummaryFooter(this, classDoc);
+-    }
+-
+-    /**
+-     * Write the inherited classes summary header for the given class.
+-     *
+-     * @param classDoc the class the summary belongs to.
+-     */
+-    public void writeInheritedMemberSummaryHeader(ClassDoc classDoc) {
+-        if(! printedSummaryHeader){
+-            //We don't want inherited summary to not be under heading.
+-            writeMemberSummaryHeader(classDoc);
+-            writeMemberSummaryFooter(classDoc);
+-            printedSummaryHeader = true;
+-        }
+-        writer.printInheritedSummaryHeader(this, classDoc);
+-    }
+-
+-    /**
+      * {@inheritDoc}
+      */
+-    public void writeInheritedMemberSummary(ClassDoc classDoc,
+-            ProgramElementDoc nestedClass, boolean isFirst, boolean isLast) {
+-        writer.printInheritedSummaryMember(this, classDoc, nestedClass, isFirst);
++    public Content getMemberSummaryHeader(ClassDoc classDoc,
++            Content memberSummaryTree) {
++        memberSummaryTree.addContent(HtmlConstants.START_OF_NESTED_CLASS_SUMMARY);
++        Content memberTree = writer.getMemberTreeHeader();
++        writer.addSummaryHeader(this, classDoc, memberTree);
++        return memberTree;
+     }
+ 
+     /**
+-     * Write the inherited classes summary footer for the given class.
+-     *
+-     * @param classDoc the class the summary belongs to.
+-     */
+-    public void writeInheritedMemberSummaryFooter(ClassDoc classDoc) {
+-        writer.printInheritedSummaryFooter(this, classDoc);
+-        writer.println();
+-    }
+-
+-    /**
+-     * Write the header for the nested class documentation.
+-     *
+-     * @param classDoc the class that the classes belong to.
+-     */
+-    public void writeHeader(ClassDoc classDoc, String header) {
+-        writer.anchor("nested class_detail");
+-        writer.printTableHeadingBackground(header);
+-    }
+-
+-    /**
+-     * Write the nested class header for the given nested class.
+-     *
+-     * @param nestedClass the nested class being documented.
+-     * @param isFirst the flag to indicate whether or not the nested class is the
+-     *        first to be documented.
+-     */
+-    public void writeClassHeader(ClassDoc nestedClass, boolean isFirst) {
+-        if (! isFirst) {
+-            writer.printMemberHeader();
+-            writer.println("");
+-        }
+-        writer.anchor(nestedClass.name());
+-        writer.h3();
+-        writer.print(nestedClass.name());
+-        writer.h3End();
+-    }
+-
+-
+-
+-    /**
+      * Close the writer.
+      */
+     public void close() throws IOException {
+@@ -148,17 +75,35 @@
+         return VisibleMemberMap.INNERCLASSES;
+     }
+ 
+-    public void printSummaryLabel() {
+-        writer.printText("doclet.Nested_Class_Summary");
++    /**
++     * {@inheritDoc}
++     */
++    public void addSummaryLabel(Content memberTree) {
++        Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
++                writer.getResource("doclet.Nested_Class_Summary"));
++        memberTree.addContent(label);
+     }
+ 
+-    public void printTableSummary() {
+-        writer.tableIndexSummary(configuration().getText("doclet.Member_Table_Summary",
++    /**
++     * {@inheritDoc}
++     */
++    public String getTableSummary() {
++        return configuration().getText("doclet.Member_Table_Summary",
+                 configuration().getText("doclet.Nested_Class_Summary"),
+-                configuration().getText("doclet.nested_classes")));
++                configuration().getText("doclet.nested_classes"));
+     }
+ 
+-    public void printSummaryTableHeader(ProgramElementDoc member) {
++    /**
++     * {@inheritDoc}
++     */
++    public String getCaption() {
++        return configuration().getText("doclet.Nested_Classes");
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public String[] getSummaryTableHeader(ProgramElementDoc member) {
+         String[] header;
+         if (member.isInterface()) {
+             header = new String[] {
+@@ -176,92 +121,95 @@
+                         configuration().getText("doclet.Description"))
+             };
+         }
+-        writer.summaryTableHeader(header, "col");
++        return header;
+     }
+ 
+-    public void printSummaryAnchor(ClassDoc cd) {
+-        writer.anchor("nested_class_summary");
++    /**
++     * {@inheritDoc}
++     */
++    public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
++        memberTree.addContent(writer.getMarkerAnchor("nested_class_summary"));
+     }
+ 
+-    public void printInheritedSummaryAnchor(ClassDoc cd) {
+-        writer.anchor("nested_classes_inherited_from_class_" +
+-                       cd.qualifiedName());
++    /**
++     * {@inheritDoc}
++     */
++    public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
++        inheritedTree.addContent(writer.getMarkerAnchor(
++                "nested_classes_inherited_from_class_" + cd.qualifiedName()));
+     }
+ 
+-    public void printInheritedSummaryLabel(ClassDoc cd) {
+-        String clslink = writer.getPreQualifiedClassLink(
+-            LinkInfoImpl.CONTEXT_MEMBER, cd, false);
+-        writer.strong();
+-        writer.printText(cd.isInterface() ?
+-            "doclet.Nested_Classes_Interface_Inherited_From_Interface" :
+-            "doclet.Nested_Classes_Interfaces_Inherited_From_Class",
+-            clslink);
+-        writer.strongEnd();
++    /**
++     * {@inheritDoc}
++     */
++    public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
++        Content classLink = new RawHtml(writer.getPreQualifiedClassLink(
++                LinkInfoImpl.CONTEXT_MEMBER, cd, false));
++        Content label = new StringContent(cd.isInterface() ?
++            configuration().getText("doclet.Nested_Classes_Interface_Inherited_From_Interface") :
++            configuration().getText("doclet.Nested_Classes_Interfaces_Inherited_From_Class"));
++        Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
++                label);
++        labelHeading.addContent(writer.getSpace());
++        labelHeading.addContent(classLink);
++        inheritedTree.addContent(labelHeading);
+     }
+ 
+-    protected void writeSummaryLink(int context, ClassDoc cd, ProgramElementDoc member) {
+-        writer.strong();
+-        writer.printLink(new LinkInfoImpl(context, (ClassDoc)member, false));
+-        writer.strongEnd();
++    /**
++     * {@inheritDoc}
++     */
++    protected void addSummaryLink(int context, ClassDoc cd, ProgramElementDoc member,
++            Content tdSummary) {
++        Content strong = HtmlTree.STRONG(new RawHtml(
++                writer.getLink(new LinkInfoImpl(context, (ClassDoc)member, false))));
++        Content code = HtmlTree.CODE(strong);
++        tdSummary.addContent(code);
+     }
+ 
+-    protected void writeInheritedSummaryLink(ClassDoc cd,
+-            ProgramElementDoc member) {
+-        writer.printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
+-            (ClassDoc)member, false));
++    /**
++     * {@inheritDoc}
++     */
++    protected void addInheritedSummaryLink(ClassDoc cd,
++            ProgramElementDoc member, Content linksTree) {
++        linksTree.addContent(new RawHtml(
++                writer.getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
++                (ClassDoc)member, false))));
+     }
+ 
+-    protected void printSummaryType(ProgramElementDoc member) {
++    /**
++     * {@inheritDoc}
++     */
++    protected void addSummaryType(ProgramElementDoc member,
++            Content tdSummaryType) {
+         ClassDoc cd = (ClassDoc)member;
+-        printModifierAndType(cd, null);
++        addModifierAndType(cd, null, tdSummaryType);
+     }
+ 
+-    protected void printHeader(ClassDoc cd) {
+-        // N.A.
++    /**
++     * {@inheritDoc}
++     */
++    protected Content getDeprecatedLink(ProgramElementDoc member) {
++        return writer.getQualifiedClassLink(LinkInfoImpl.CONTEXT_MEMBER,
++                (ClassDoc)member);
+     }
+ 
+-    protected void printBodyHtmlEnd(ClassDoc cd) {
+-        // N.A.
+-    }
+-
+-    protected void printMember(ProgramElementDoc member) {
+-        // N.A.
+-    }
+-
+-    protected void writeDeprecatedLink(ProgramElementDoc member) {
+-        writer.printQualifiedClassLink(LinkInfoImpl.CONTEXT_MEMBER,
+-            (ClassDoc)member);
+-    }
+-
+-    protected void printNavSummaryLink(ClassDoc cd, boolean link) {
++    /**
++     * {@inheritDoc}
++     */
++    protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
+         if (link) {
+-            writer.printHyperLink("", (cd == null) ? "nested_class_summary":
+-                    "nested_classes_inherited_from_class_" +
++            return writer.getHyperLink("", (cd == null) ? "nested_class_summary":
++                "nested_classes_inherited_from_class_" +
+                 cd.qualifiedName(),
+-                ConfigurationImpl.getInstance().getText("doclet.navNested"));
++                writer.getResource("doclet.navNested"));
+         } else {
+-            writer.printText("doclet.navNested");
++            return writer.getResource("doclet.navNested");
+         }
+     }
+ 
+-    protected void printNavDetailLink(boolean link) {
+-    }
+-
+-    protected void printMemberLink(ProgramElementDoc member) {
+-    }
+-
+-    protected void printMembersSummaryLink(ClassDoc cd, ClassDoc icd,
+-                                           boolean link) {
+-        if (link) {
+-            writer.printHyperLink(cd.name() + ".html",
+-                (cd == icd)?
+-                    "nested_class_summary":
+-                    "nested_classes_inherited_from_class_" +
+-                    icd.qualifiedName(),
+-                    ConfigurationImpl.getInstance().getText(
+-                        "doclet.Nested_Class_Summary"));
+-        } else {
+-            writer.printText("doclet.Nested_Class_Summary");
+-        }
++    /**
++     * {@inheritDoc}
++     */
++    protected void addNavDetailLink(boolean link, Content liNav) {
+     }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java
+@@ -25,18 +25,20 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
++import java.io.*;
++import java.util.*;
++import com.sun.javadoc.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
++import com.sun.tools.doclets.formats.html.markup.*;
+ 
+-import com.sun.javadoc.*;
+-import java.io.*;
+-import java.util.*;
+ /**
+  * Class to generate file for each package contents in the left-hand bottom
+  * frame. This will list all the Class Kinds in the package. A click on any
+  * class-kind will update the right-hand frame with the clicked class-kind page.
+  *
+  * @author Atul M Dambalkar
++ * @author Bhavesh Patel (Modified)
+  */
+ public class PackageFrameWriter extends HtmlDocletWriter {
+ 
+@@ -85,132 +87,107 @@
+      * @param packageDoc The package for which "pacakge-frame.html" is to be generated.
+      */
+     public static void generate(ConfigurationImpl configuration,
+-                                PackageDoc packageDoc) {
++            PackageDoc packageDoc) {
+         PackageFrameWriter packgen;
+         try {
+             packgen = new PackageFrameWriter(configuration, packageDoc);
+             String pkgName = Util.getPackageName(packageDoc);
+-            packgen.printHtmlHeader(pkgName, configuration.metakeywords.getMetaKeywords(packageDoc), false);
+-            packgen.printPackageHeader(pkgName);
+-            packgen.generateClassListing();
+-            packgen.printBodyHtmlEnd();
++            Content body = packgen.getBody(false, packgen.getWindowTitle(pkgName));
++            Content pkgNameContent = new StringContent(pkgName);
++            Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar,
++                    packgen.getTargetPackageLink(packageDoc, "classFrame", pkgNameContent));
++            body.addContent(heading);
++            HtmlTree div = new HtmlTree(HtmlTag.DIV);
++            div.addStyle(HtmlStyle.indexContainer);
++            packgen.addClassListing(div);
++            body.addContent(div);
++            packgen.printHtmlDocument(
++                    configuration.metakeywords.getMetaKeywords(packageDoc), false, body);
+             packgen.close();
+         } catch (IOException exc) {
+             configuration.standardmessage.error(
+-                        "doclet.exception_encountered",
+-                        exc.toString(), OUTPUT_FILE_NAME);
++                    "doclet.exception_encountered",
++                    exc.toString(), OUTPUT_FILE_NAME);
+             throw new DocletAbortException();
+         }
+     }
+ 
+     /**
+-     * Generate class listing for all the classes in this package. Divide class
++     * Add class listing for all the classes in this package. Divide class
+      * listing as per the class kind and generate separate listing for
+      * Classes, Interfaces, Exceptions and Errors.
++     *
++     * @param contentTree the content tree to which the listing will be added
+      */
+-    protected void generateClassListing() {
++    protected void addClassListing(Content contentTree) {
+         Configuration config = configuration();
+         if (packageDoc.isIncluded()) {
+-            generateClassKindListing(packageDoc.interfaces(),
+-                configuration.getText("doclet.Interfaces"));
+-            generateClassKindListing(packageDoc.ordinaryClasses(),
+-                configuration.getText("doclet.Classes"));
+-            generateClassKindListing(packageDoc.enums(),
+-                configuration.getText("doclet.Enums"));
+-            generateClassKindListing(packageDoc.exceptions(),
+-                configuration.getText("doclet.Exceptions"));
+-            generateClassKindListing(packageDoc.errors(),
+-                configuration.getText("doclet.Errors"));
+-            generateClassKindListing(packageDoc.annotationTypes(),
+-                configuration.getText("doclet.AnnotationTypes"));
++            addClassKindListing(packageDoc.interfaces(),
++                getResource("doclet.Interfaces"), contentTree);
++            addClassKindListing(packageDoc.ordinaryClasses(),
++                getResource("doclet.Classes"), contentTree);
++            addClassKindListing(packageDoc.enums(),
++                getResource("doclet.Enums"), contentTree);
++            addClassKindListing(packageDoc.exceptions(),
++                getResource("doclet.Exceptions"), contentTree);
++            addClassKindListing(packageDoc.errors(),
++                getResource("doclet.Errors"), contentTree);
++            addClassKindListing(packageDoc.annotationTypes(),
++                getResource("doclet.AnnotationTypes"), contentTree);
+         } else {
+             String name = Util.getPackageName(packageDoc);
+-            generateClassKindListing(config.classDocCatalog.interfaces(name),
+-                configuration.getText("doclet.Interfaces"));
+-            generateClassKindListing(config.classDocCatalog.ordinaryClasses(name),
+-                configuration.getText("doclet.Classes"));
+-            generateClassKindListing(config.classDocCatalog.enums(name),
+-                configuration.getText("doclet.Enums"));
+-            generateClassKindListing(config.classDocCatalog.exceptions(name),
+-                configuration.getText("doclet.Exceptions"));
+-            generateClassKindListing(config.classDocCatalog.errors(name),
+-                configuration.getText("doclet.Errors"));
+-            generateClassKindListing(config.classDocCatalog.annotationTypes(name),
+-                configuration.getText("doclet.AnnotationTypes"));
++            addClassKindListing(config.classDocCatalog.interfaces(name),
++                getResource("doclet.Interfaces"), contentTree);
++            addClassKindListing(config.classDocCatalog.ordinaryClasses(name),
++                getResource("doclet.Classes"), contentTree);
++            addClassKindListing(config.classDocCatalog.enums(name),
++                getResource("doclet.Enums"), contentTree);
++            addClassKindListing(config.classDocCatalog.exceptions(name),
++                getResource("doclet.Exceptions"), contentTree);
++            addClassKindListing(config.classDocCatalog.errors(name),
++                getResource("doclet.Errors"), contentTree);
++            addClassKindListing(config.classDocCatalog.annotationTypes(name),
++                getResource("doclet.AnnotationTypes"), contentTree);
+         }
+     }
+ 
+     /**
+-     * Generate specific class kind listing. Also add label to the listing.
++     * Add specific class kind listing. Also add label to the listing.
+      *
+-     * @param arr Array of specific class kinds, namely Class or Interface or
+-     * Exception or Error.
+-     * @param label Label for the listing
++     * @param arr Array of specific class kinds, namely Class or Interface or Exception or Error
++     * @param labelContent content tree of the label to be added
++     * @param contentTree the content tree to which the class kind listing will be added
+      */
+-    protected void generateClassKindListing(ClassDoc[] arr, String label) {
++    protected void addClassKindListing(ClassDoc[] arr, Content labelContent,
++            Content contentTree) {
+         if(arr.length > 0) {
+             Arrays.sort(arr);
+-            printPackageTableHeader();
+-            fontSizeStyle("+1", "FrameHeadingFont");
+             boolean printedHeader = false;
++            HtmlTree ul = new HtmlTree(HtmlTag.UL);
++            ul.addAttr(HtmlAttr.TITLE, labelContent.toString());
+             for (int i = 0; i < arr.length; i++) {
+                 if (documentedClasses != null &&
+-                    !documentedClasses.contains(arr[i])) {
++                        !documentedClasses.contains(arr[i])) {
+                     continue;
+                 }
+                 if (!Util.isCoreClass(arr[i]) || !
+-                    configuration.isGeneratedDoc(arr[i])) {
++                        configuration.isGeneratedDoc(arr[i])) {
+                     continue;
+                 }
+                 if (!printedHeader) {
+-                    print(label);
+-                    fontEnd();
+-                    println(" ");
+-                    fontStyle("FrameItemFont");
++                    Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
++                            true, labelContent);
++                    contentTree.addContent(heading);
+                     printedHeader = true;
+                 }
+-                br();
+-                printLink(new LinkInfoImpl(
+-                    LinkInfoImpl.PACKAGE_FRAME,
+-                    arr[i],
+-                    (arr[i].isInterface() ?
+-                        italicsText(arr[i].name()) :
+-                        arr[i].name()),"classFrame")
+-                );
++                Content link = new RawHtml (getLink(new LinkInfoImpl(
++                        LinkInfoImpl.PACKAGE_FRAME, arr[i],
++                        (arr[i].isInterface() ? italicsText(arr[i].name()) :
++                            arr[i].name()),"classFrame")));
++                Content li = HtmlTree.LI(link);
++                ul.addContent(li);
+             }
+-            fontEnd();
+-            printPackageTableFooter();
+-            println();
++            contentTree.addContent(ul);
+         }
+     }
+-
+-    /**
+-     * Print the package link at the top of the class kind listing. Clicking
+-     * this link, package-summary page will appear in the right hand frame.
+-     *
+-     * @param heading Top Heading to be used for the class kind listing.
+-     */
+-    protected void printPackageHeader(String heading) {
+-        fontSizeStyle("+1", "FrameTitleFont");
+-        printTargetPackageLink(packageDoc, "classFrame", heading);
+-        fontEnd();
+-    }
+-
+-    /**
+-     * The table for the class kind listing.
+-     */
+-    protected void printPackageTableHeader() {
+-        table();
+-        tr();
+-        tdNowrap();
+-    }
+-
+-    /**
+-     * Closing Html tags for table of class kind listing.
+-     */
+-    protected void printPackageTableFooter() {
+-        tdEnd();
+-        trEnd();
+-        tableEnd();
+-    }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java
+@@ -25,10 +25,11 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
++import java.io.*;
++import com.sun.javadoc.*;
++import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+-
+-import com.sun.javadoc.*;
+-import java.io.*;
++import com.sun.tools.doclets.formats.html.markup.*;
+ 
+ /**
+  * Generate the package index for the left-hand frame in the generated output.
+@@ -58,7 +59,7 @@
+         String filename = "overview-frame.html";
+         try {
+             packgen = new PackageIndexFrameWriter(configuration, filename);
+-            packgen.generatePackageIndexFile("doclet.Window_Overview", false);
++            packgen.buildPackageIndexFile("doclet.Window_Overview", false);
+             packgen.close();
+         } catch (IOException exc) {
+             configuration.standardmessage.error(
+@@ -69,114 +70,86 @@
+     }
+ 
+     /**
+-     * Print each package name on separate rows.
+-     *
+-     * @param pd PackageDoc
++     * {@inheritDoc}
+      */
+-    protected void printIndexRow(PackageDoc pd) {
+-        fontStyle("FrameItemFont");
+-        if (pd.name().length() > 0) {
+-            print(getHyperLink(pathString(pd, "package-frame.html"), "",
+-                pd.name(), false, "", "", "packageFrame"));
+-        } else {
+-            print(getHyperLink("package-frame.html", "", "<unnamed package>",
+-                false, "", "", "packageFrame"));
++    protected void addPackagesList(PackageDoc[] packages, String text,
++            String tableSummary, Content body) {
++        Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
++                packagesLabel);
++        Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
++        HtmlTree ul = new HtmlTree(HtmlTag.UL);
++        ul.addAttr(HtmlAttr.TITLE, packagesLabel.toString());
++        for(int i = 0; i < packages.length; i++) {
++            if (packages[i] != null) {
++                ul.addContent(getPackage(packages[i]));
++            }
+         }
+-        fontEnd();
+-        br();
++        div.addContent(ul);
++        body.addContent(div);
+     }
+ 
+     /**
+-     * Print the "-packagesheader" string in strong format, at top of the page,
+-     * if it is not the empty string.  Otherwise print the "-header" string.
+-     * Despite the name, there is actually no navigation bar for this page.
++     * Gets each package name as a separate link.
++     *
++     * @param pd PackageDoc
++     * @return content for the package link
+      */
+-    protected void printNavigationBarHeader() {
+-        printTableHeader(true);
+-        fontSizeStyle("+1", "FrameTitleFont");
++    protected Content getPackage(PackageDoc pd) {
++        Content packageLinkContent;
++        Content packageLabel;
++        if (pd.name().length() > 0) {
++            packageLabel = getPackageLabel(pd.name());
++            packageLinkContent = getHyperLink(pathString(pd,
++                    "package-frame.html"), "", packageLabel, "",
++                    "packageFrame");
++        } else {
++            packageLabel = new RawHtml("<unnamed package>");
++            packageLinkContent = getHyperLink("package-frame.html",
++                    "", packageLabel, "", "packageFrame");
++        }
++        Content li = HtmlTree.LI(packageLinkContent);
++        return li;
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    protected void addNavigationBarHeader(Content body) {
++        Content headerContent;
+         if (configuration.packagesheader.length() > 0) {
+-            strong(replaceDocRootDir(configuration.packagesheader));
++            headerContent = new RawHtml(replaceDocRootDir(configuration.packagesheader));
+         } else {
+-            strong(replaceDocRootDir(configuration.header));
++            headerContent = new RawHtml(replaceDocRootDir(configuration.header));
+         }
+-        fontEnd();
+-        printTableFooter(true);
++        Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
++                HtmlStyle.bar, headerContent);
++        body.addContent(heading);
+     }
+ 
+     /**
+      * Do nothing as there is no overview information in this page.
+      */
+-    protected void printOverviewHeader() {
++    protected void addOverviewHeader(Content body) {
+     }
+ 
+     /**
+-     * Print Html "table" tag for the package index format.
++     * Adds "All Classes" link for the top of the left-hand frame page to the
++     * documentation tree.
+      *
+-     * @param text Text string will not be used in this method.
++     * @param body the Content object to which the all classes link should be added
+      */
+-    protected void printIndexHeader(String text, String tableSummary) {
+-        printTableHeader(false);
++    protected void addAllClassesLink(Content body) {
++        Content linkContent = getHyperLink("allclasses-frame.html", "",
++                allclassesLabel, "", "packageFrame");
++        Content div = HtmlTree.DIV(HtmlStyle.indexHeader, linkContent);
++        body.addContent(div);
+     }
+ 
+     /**
+-     * Print Html closing "table" tag at the end of the package index.
++     * {@inheritDoc}
+      */
+-    protected void printIndexFooter() {
+-        printTableFooter(false);
+-    }
+-
+-    /**
+-     * Print "All Classes" link at the top of the left-hand frame page.
+-     */
+-    protected void printAllClassesPackagesLink() {
+-        fontStyle("FrameItemFont");
+-        print(getHyperLink("allclasses-frame.html", "",
+-            configuration.getText("doclet.All_Classes"), false, "", "",
+-            "packageFrame"));
+-        fontEnd();
+-        p();
+-        fontSizeStyle("+1", "FrameHeadingFont");
+-        printText("doclet.Packages");
+-        fontEnd();
+-        br();
+-    }
+-
+-    /**
+-     * Just print some space, since there is no navigation bar for this page.
+-     */
+-    protected void printNavigationBarFooter() {
+-        p();
+-        space();
+-    }
+-
+-    /**
+-     * Print Html closing tags for the table for package index.
+-     *
+-     * @param isHeading true if this is a table for a heading.
+-     */
+-    private void printTableFooter(boolean isHeading) {
+-        if (isHeading) {
+-            thEnd();
+-        } else {
+-            tdEnd();
+-        }
+-        trEnd();
+-        tableEnd();
+-    }
+-
+-    /**
+-     * Print Html tags for the table for package index.
+-     *
+-     * @param isHeading true if this is a table for a heading.
+-     */
+-    private void printTableHeader(boolean isHeading) {
+-        table();
+-        tr();
+-        if (isHeading) {
+-            thAlignNowrap("left");
+-        } else {
+-            tdNowrap();
+-        }
+-
++    protected void addNavigationBarFooter(Content body) {
++        Content p = HtmlTree.P(getSpace());
++        body.addContent(p);
+     }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java
+@@ -25,10 +25,12 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
+-import com.sun.tools.doclets.internal.toolkit.util.*;
+-import com.sun.javadoc.*;
+ import java.io.*;
+ import java.util.*;
++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.*;
+ 
+ /**
+  * Generate the package index page "overview-summary.html" for the right-hand
+@@ -83,7 +85,7 @@
+         String filename = "overview-summary.html";
+         try {
+             packgen = new PackageIndexWriter(configuration, filename);
+-            packgen.generatePackageIndexFile("doclet.Window_Overview_Summary", true);
++            packgen.buildPackageIndexFile("doclet.Window_Overview_Summary", true);
+             packgen.close();
+         } catch (IOException exc) {
+             configuration.standardmessage.error(
+@@ -94,125 +96,139 @@
+     }
+ 
+     /**
+-     * Print each package in separate rows in the index table. Generate link
+-     * to each package.
++     * Depending upon the grouping information and their titles, add
++     * separate table indices for each package group.
+      *
+-     * @param pkg Package to which link is to be generated.
++     * @param body the documentation tree to which the index will be added
+      */
+-    protected void printIndexRow(PackageDoc pkg) {
+-        if(pkg != null && pkg.name().length() > 0) {
+-            trBgcolorStyle("white", "TableRowColor");
+-            summaryRow(20);
+-            strong();
+-            printPackageLink(pkg, Util.getPackageName(pkg), false);
+-            strongEnd();
+-            summaryRowEnd();
+-            summaryRow(0);
+-            printSummaryComment(pkg);
+-            summaryRowEnd();
+-            trEnd();
+-       }
+-    }
+-
+-    /**
+-     * Depending upon the grouping information and their titles, generate
+-     * separate table indices for each package group.
+-     */
+-    protected void generateIndex() {
++    protected void addIndex(Content body) {
+         for (int i = 0; i < groupList.size(); i++) {
+         String groupname = (String)groupList.get(i);
+         List list = (List)groupPackageMap.get(groupname);
+             if (list != null && list.size() > 0) {
+-                printIndexContents((PackageDoc[])list.
+-                                       toArray(new PackageDoc[list.size()]),
+-                        groupname,
+-                        configuration.getText("doclet.Member_Table_Summary",
+-                        groupname,
+-                        configuration.getText("doclet.packages")));
++                addIndexContents(list.toArray(new PackageDoc[list.size()]),
++                        groupname, configuration.getText("doclet.Member_Table_Summary",
++                        groupname, configuration.getText("doclet.packages")), body);
+             }
+         }
+     }
+ 
+     /**
+-     * Print the overview summary comment for this documentation. Print one line
+-     * summary at the top of the page and generate a link to the description,
+-     * which is generated at the end of this page.
++     * {@inheritDoc}
+      */
+-    protected void printOverviewHeader() {
+-        if (root.inlineTags().length > 0) {
+-            printSummaryComment(root);
+-            p();
+-            strong(configuration.getText("doclet.See"));
+-            br();
+-            printNbsps();
+-            printHyperLink("", "overview_description",
+-                configuration.getText("doclet.Description"), true);
+-            p();
++    protected void addPackagesList(PackageDoc[] packages, String text,
++            String tableSummary, Content body) {
++        Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0, tableSummary,
++                getTableCaption(text));
++        table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
++        Content tbody = new HtmlTree(HtmlTag.TBODY);
++        addPackagesList(packages, tbody);
++        table.addContent(tbody);
++        Content div = HtmlTree.DIV(HtmlStyle.contentContainer, table);
++        body.addContent(div);
++    }
++
++    /**
++     * Adds list of packages in the index table. Generate link to each package.
++     *
++     * @param packages Packages to which link is to be generated
++     * @param tbody the documentation tree to which the list will be added
++     */
++    protected void addPackagesList(PackageDoc[] packages, Content tbody) {
++        for (int i = 0; i < packages.length; i++) {
++            if (packages[i] != null && packages[i].name().length() > 0) {
++                Content packageLinkContent = getPackageLink(packages[i],
++                        getPackageName(packages[i]));
++                Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, packageLinkContent);
++                HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
++                tdSummary.addStyle(HtmlStyle.colLast);
++                addSummaryComment(packages[i], tdSummary);
++                HtmlTree tr = HtmlTree.TR(tdPackage);
++                tr.addContent(tdSummary);
++                if (i%2 == 0)
++                    tr.addStyle(HtmlStyle.altColor);
++                else
++                    tr.addStyle(HtmlStyle.rowColor);
++                tbody.addContent(tr);
++            }
+         }
+     }
+ 
+     /**
+-     * Print Html tags for the table for this package index.
++     * Adds the overview summary comment for this documentation. Add one line
++     * summary at the top of the page and generate a link to the description,
++     * which is added at the end of this page.
++     *
++     * @param body the documentation tree to which the overview header will be added
+      */
+-    protected void printIndexHeader(String text, String tableSummary) {
+-        tableIndexSummary(tableSummary);
+-        tableCaptionStart();
+-        print(text);
+-        tableCaptionEnd();
+-        summaryTableHeader(packageTableHeader, "col");
+-    }
+-
+-    /**
+-     * Print Html closing tags for the table for this package index.
+-     */
+-    protected void printIndexFooter() {
+-        tableEnd();
+-        p();
+-        space();
+-    }
+-
+-    /**
+-     * Print the overview comment as provided in the file specified by the
+-     * "-overview" option on the command line.
+-     */
+-    protected void printOverviewComment() {
++    protected void addOverviewHeader(Content body) {
+         if (root.inlineTags().length > 0) {
+-            anchor("overview_description");
+-            p();
+-            printInlineComment(root);
+-            p();
++            HtmlTree p = new HtmlTree(HtmlTag.P);
++            p.addStyle(HtmlStyle.subTitle);
++            addSummaryComment(root, p);
++            Content div = HtmlTree.DIV(HtmlStyle.header, p);
++            Content see = seeLabel;
++            see.addContent(" ");
++            Content descPara = HtmlTree.P(see);
++            Content descLink = getHyperLink("", "overview_description",
++                descriptionLabel, "", "");
++            descPara.addContent(descLink);
++            div.addContent(descPara);
++            body.addContent(div);
+         }
+     }
+ 
+     /**
+-     * Call {@link #printOverviewComment()} and then genrate the tag information
+-     * as provided in the file specified by the "-overview" option on the
+-     * command line.
++     * Adds the overview comment as provided in the file specified by the
++     * "-overview" option on the command line.
++     *
++     * @param htmltree the documentation tree to which the overview comment will
++     *                 be added
+      */
+-    protected void printOverview() throws IOException {
+-        printOverviewComment();
+-        printTags(root);
++    protected void addOverviewComment(Content htmltree) {
++        if (root.inlineTags().length > 0) {
++            htmltree.addContent(getMarkerAnchor("overview_description"));
++            HtmlTree p = new HtmlTree(HtmlTag.P);
++            p.addStyle(HtmlStyle.subTitle);
++            addInlineComment(root, p);
++            htmltree.addContent(p);
++        }
+     }
+ 
+     /**
+-     * Print the top text (from the -top option), the upper
+-     * navigation bar, and then the title (from the"-title"
+-     * option), at the top of page.
++     * Adds the tag information as provided in the file specified by the
++     * "-overview" option on the command line.
++     *
++     * @param body the documentation tree to which the overview will be added
+      */
+-    protected void printNavigationBarHeader() {
+-        printTop();
+-        navLinks(true);
+-        hr();
+-        printConfigurationTitle();
++    protected void addOverview(Content body) throws IOException {
++        HtmlTree div = new HtmlTree(HtmlTag.DIV);
++        div.addStyle(HtmlStyle.footer);
++        addOverviewComment(div);
++        addTagsInfo(root, div);
++        body.addContent(div);
+     }
+ 
+     /**
+-     * Print the lower navigation bar and the bottom text
++     * Adds the top text (from the -top option), the upper
++     * navigation bar, and then the title (from the"-title"
++     * option), at the top of page.
++     *
++     * @body the documentation tree to which the navigation bar header will be added
++     */
++    protected void addNavigationBarHeader(Content body) {
++        addTop(body);
++        addNavLinks(true, body);
++        addConfigurationTitle(body);
++    }
++
++    /**
++     * Adds the lower navigation bar and the bottom text
+      * (from the -bottom option) at the bottom of page.
+-     */
+-    protected void printNavigationBarFooter() {
+-        hr();
+-        navLinks(false);
+-        printBottom();
++     *
++     * @param the documentation tree to which the navigation bar footer will be a     */
++    protected void addNavigationBarFooter(Content body) {
++        addNavLinks(false, body);
++        addBottom(body);
+     }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java
+@@ -29,12 +29,15 @@
+ 
+ import com.sun.javadoc.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
++import com.sun.tools.doclets.formats.html.markup.*;
++import com.sun.tools.doclets.internal.toolkit.*;
+ 
+ /**
+  * Class to generate Tree page for a package. The name of the file generated is
+  * "package-tree.html" and it is generated in the respective package directory.
+  *
+  * @author Atul M Dambalkar
++ * @author Bhavesh Patel (Modified)
+  */
+ public class PackageTreeWriter extends AbstractTreeWriter {
+ 
+@@ -107,94 +110,96 @@
+      * Generate a separate tree file for each package.
+      */
+     protected void generatePackageTreeFile() throws IOException {
+-        printHtmlHeader(packagedoc.name() + " "
+-            + configuration.getText("doclet.Window_Class_Hierarchy"), null, true);
+-
+-        printPackageTreeHeader();
+-
++        Content body = getPackageTreeHeader();
++        Content headContent = getResource("doclet.Hierarchy_For_Package",
++                Util.getPackageName(packagedoc));
++        Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false,
++                HtmlStyle.title, headContent);
++        Content div = HtmlTree.DIV(HtmlStyle.header, heading);
+         if (configuration.packages.length > 1) {
+-            printLinkToMainTree();
++            addLinkToMainTree(div);
+         }
+-
+-        generateTree(classtree.baseclasses(), "doclet.Class_Hierarchy");
+-        generateTree(classtree.baseinterfaces(), "doclet.Interface_Hierarchy");
+-        generateTree(classtree.baseAnnotationTypes(), "doclet.Annotation_Type_Hierarchy");
+-        generateTree(classtree.baseEnums(), "doclet.Enum_Hierarchy");
+-
+-        printPackageTreeFooter();
+-        printBottom();
+-        printBodyHtmlEnd();
++        body.addContent(div);
++        HtmlTree divTree = new HtmlTree(HtmlTag.DIV);
++        divTree.addStyle(HtmlStyle.contentContainer);
++        addTree(classtree.baseclasses(), "doclet.Class_Hierarchy", divTree);
++        addTree(classtree.baseinterfaces(), "doclet.Interface_Hierarchy", divTree);
++        addTree(classtree.baseAnnotationTypes(), "doclet.Annotation_Type_Hierarchy", divTree);
++        addTree(classtree.baseEnums(), "doclet.Enum_Hierarchy", divTree);
++        body.addContent(divTree);
++        addNavLinks(false, body);
++        addBottom(body);
++        printHtmlDocument(null, true, body);
+     }
+ 
+     /**
+-     * Print the navigation bar header for the package tree file.
++     * Get the package tree header.
++     *
++     * @return a content tree for the header
+      */
+-    protected void printPackageTreeHeader() {
+-        printTop();
+-        navLinks(true);
+-        hr();
+-        center();
+-        h2(configuration.getText("doclet.Hierarchy_For_Package",
+-            Util.getPackageName(packagedoc)));
+-        centerEnd();
++    protected Content getPackageTreeHeader() {
++        String title = packagedoc.name() + " " +
++                configuration.getText("doclet.Window_Class_Hierarchy");
++        Content bodyTree = getBody(true, getWindowTitle(title));
++        addTop(bodyTree);
++        addNavLinks(true, bodyTree);
++        return bodyTree;
+     }
+ 
+     /**
+-     * Generate a link to the tree for all the packages.
++     * Add a link to the tree for all the packages.
++     *
++     * @param div the content tree to which the link will be added
+      */
+-    protected void printLinkToMainTree() {
+-        dl();
+-        dt();
+-        strongText("doclet.Package_Hierarchies");
+-        dtEnd();
+-        dd();
+-        navLinkMainTree(configuration.getText("doclet.All_Packages"));
+-        ddEnd();
+-        dlEnd();
+-        hr();
++    protected void addLinkToMainTree(Content div) {
++        Content span = HtmlTree.SPAN(HtmlStyle.strong,
++                getResource("doclet.Package_Hierarchies"));
++        div.addContent(span);
++        HtmlTree ul = new HtmlTree (HtmlTag.UL);
++        ul.addStyle(HtmlStyle.horizontal);
++        ul.addContent(getNavLinkMainTree(configuration.getText("doclet.All_Packages")));
++        div.addContent(ul);
+     }
+ 
+     /**
+-     * Print the navigation bar footer for the package tree file.
++     * Get link for the previous package tree file.
++     *
++     * @return a content tree for the link
+      */
+-    protected void printPackageTreeFooter() {
+-        hr();
+-        navLinks(false);
+-    }
+-
+-    /**
+-     * Link for the previous package tree file.
+-     */
+-    protected void navLinkPrevious() {
++    protected Content getNavLinkPrevious() {
+         if (prev == null) {
+-            navLinkPrevious(null);
++            return getNavLinkPrevious(null);
+         } else {
+             String path = DirectoryManager.getRelativePath(packagedoc.name(),
+-                                                           prev.name());
+-            navLinkPrevious(path + "package-tree.html");
++                    prev.name());
++            return getNavLinkPrevious(path + "package-tree.html");
+         }
+     }
+ 
+     /**
+-     * Link for the next package tree file.
++     * Get link for the next package tree file.
++     *
++     * @return a content tree for the link
+      */
+-    protected void navLinkNext() {
++    protected Content getNavLinkNext() {
+         if (next == null) {
+-            navLinkNext(null);
++            return getNavLinkNext(null);
+         } else {
+             String path = DirectoryManager.getRelativePath(packagedoc.name(),
+-                                                           next.name());
+-            navLinkNext(path + "package-tree.html");
++                    next.name());
++            return getNavLinkNext(path + "package-tree.html");
+         }
+     }
+ 
+     /**
+-     * Link to the package summary page for the package of this tree.
++     * Get link to the package summary page for the package of this tree.
++     *
++     * @return a content tree for the package link
+      */
+-    protected void navLinkPackage() {
+-        navCellStart();
+-        printHyperLink("package-summary.html", "", configuration.getText("doclet.Package"),
+-                        true, "NavBarFont1");
+-        navCellEnd();
++    protected Content getNavLinkPackage() {
++        Content linkContent = getHyperLink("package-summary.html", "",
++                packageLabel);
++        Content li = HtmlTree.LI(linkContent);
++        return li;
+     }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java
+@@ -25,10 +25,12 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
+-import com.sun.tools.doclets.internal.toolkit.util.*;
+-import com.sun.javadoc.*;
+ import java.io.*;
+ import java.util.*;
++import com.sun.javadoc.*;
++import com.sun.tools.doclets.internal.toolkit.util.*;
++import com.sun.tools.doclets.formats.html.markup.*;
++import com.sun.tools.doclets.internal.toolkit.*;
+ 
+ /**
+  * Generate package usage information.
+@@ -106,49 +108,74 @@
+ 
+ 
+     /**
+-     * Print the class use list.
++     * Generate the package use list.
+      */
+     protected void generatePackageUseFile() throws IOException {
+-        printPackageUseHeader();
+-
++        Content body = getPackageUseHeader();
++        HtmlTree div = new HtmlTree(HtmlTag.DIV);
++        div.addStyle(HtmlStyle.contentContainer);
+         if (usingPackageToUsedClasses.isEmpty()) {
+-            printText("doclet.ClassUse_No.usage.of.0", pkgdoc.name());
+-            p();
++            div.addContent(getResource(
++                    "doclet.ClassUse_No.usage.of.0", pkgdoc.name()));
+         } else {
+-            generatePackageUse();
++            addPackageUse(div);
+         }
+-
+-        printPackageUseFooter();
++        body.addContent(div);
++        addNavLinks(false, body);
++        addBottom(body);
++        printHtmlDocument(null, true, body);
+     }
+ 
+     /**
+-     * Print the class use list.
++     * Add the package use information.
++     *
++     * @param contentTree the content tree to which the package use information will be added
+      */
+-    protected void generatePackageUse() throws IOException {
++    protected void addPackageUse(Content contentTree) throws IOException {
++        HtmlTree ul = new HtmlTree(HtmlTag.UL);
++        ul.addStyle(HtmlStyle.blockList);
+         if (configuration.packages.length > 1) {
+-            generatePackageList();
++            addPackageList(ul);
+         }
+-        generateClassList();
++        addClassList(ul);
++        contentTree.addContent(ul);
+     }
+ 
+-    protected void generatePackageList() throws IOException {
+-        tableIndexSummary(useTableSummary);
+-        tableCaptionStart();
+-        printText("doclet.ClassUse_Packages.that.use.0",
+-            getPackageLink(pkgdoc, Util.getPackageName(pkgdoc), false));
+-        tableCaptionEnd();
+-        summaryTableHeader(packageTableHeader, "col");
++    /**
++     * Add the list of packages that use the given package.
++     *
++     * @param contentTree the content tree to which the package list will be added
++     */
++    protected void addPackageList(Content contentTree) throws IOException {
++        Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary,
++                getTableCaption(configuration().getText(
++                "doclet.ClassUse_Packages.that.use.0",
++                getPackageLinkString(pkgdoc, Util.getPackageName(pkgdoc), false))));
++        table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
++        Content tbody = new HtmlTree(HtmlTag.TBODY);
+         Iterator it = usingPackageToUsedClasses.keySet().iterator();
+-        while (it.hasNext()) {
++        for (int i = 0; it.hasNext(); i++) {
+             PackageDoc pkg = configuration.root.packageNamed((String)it.next());
+-            generatePackageUse(pkg);
++            HtmlTree tr = new HtmlTree(HtmlTag.TR);
++            if (i % 2 == 0) {
++                tr.addStyle(HtmlStyle.altColor);
++            } else {
++                tr.addStyle(HtmlStyle.rowColor);
++            }
++            addPackageUse(pkg, tr);
++            tbody.addContent(tr);
+         }
+-        tableEnd();
+-        space();
+-        p();
++        table.addContent(tbody);
++        Content li = HtmlTree.LI(HtmlStyle.blockList, table);
++        contentTree.addContent(li);
+     }
+ 
+-    protected void generateClassList() throws IOException {
++    /**
++     * Add the list of classes that use the given package.
++     *
++     * @param contentTree the content tree to which the class list will be added
++     */
++    protected void addClassList(Content contentTree) throws IOException {
+         String[] classTableHeader = new String[] {
+             configuration.getText("doclet.0_and_1",
+                     configuration.getText("doclet.Class"),
+@@ -158,118 +185,127 @@
+         while (itp.hasNext()) {
+             String packageName = (String)itp.next();
+             PackageDoc usingPackage = configuration.root.packageNamed(packageName);
++            HtmlTree li = new HtmlTree(HtmlTag.LI);
++            li.addStyle(HtmlStyle.blockList);
+             if (usingPackage != null) {
+-                anchor(usingPackage.name());
++                li.addContent(getMarkerAnchor(usingPackage.name()));
+             }
+-            tableIndexSummary(configuration.getText("doclet.Use_Table_Summary",
+-                    configuration.getText("doclet.classes")));
+-            tableCaptionStart();
+-            printText("doclet.ClassUse_Classes.in.0.used.by.1",
+-                getPackageLink(pkgdoc, Util.getPackageName(pkgdoc), false),
+-                getPackageLink(usingPackage,Util.getPackageName(usingPackage), false));
+-            tableCaptionEnd();
+-            summaryTableHeader(classTableHeader, "col");
++            String tableSummary = configuration.getText("doclet.Use_Table_Summary",
++                    configuration.getText("doclet.classes"));
++            Content table = HtmlTree.TABLE(0, 3, 0, tableSummary,
++                    getTableCaption(configuration().getText(
++                    "doclet.ClassUse_Classes.in.0.used.by.1",
++                    getPackageLinkString(pkgdoc, Util.getPackageName(pkgdoc), false),
++                    getPackageLinkString(usingPackage,Util.getPackageName(usingPackage), false))));
++            table.addContent(getSummaryTableHeader(classTableHeader, "col"));
++            Content tbody = new HtmlTree(HtmlTag.TBODY);
+             Iterator itc =
+                 ((Collection)usingPackageToUsedClasses.get(packageName))
+                 .iterator();
+-            while (itc.hasNext()) {
+-                printClassRow((ClassDoc)itc.next(), packageName);
++            for (int i = 0; itc.hasNext(); i++) {
++                HtmlTree tr = new HtmlTree(HtmlTag.TR);
++                if (i % 2 == 0) {
++                    tr.addStyle(HtmlStyle.altColor);
++                } else {
++                    tr.addStyle(HtmlStyle.rowColor);
++                }
++                addClassRow(itc.next(), packageName, tr);
++                tbody.addContent(tr);
+             }
+-            tableEnd();
+-            space();
+-            p();
++            table.addContent(tbody);
++            li.addContent(table);
++            contentTree.addContent(li);
+         }
+     }
+ 
+-    protected void printClassRow(ClassDoc usedClass, String packageName) {
++    /**
++     * Add a row for the class that uses the given package.
++     *
++     * @param usedClass the class that uses the given package
++     * @param packageName the name of the package to which the class belongs
++     * @param contentTree the content tree to which the row will be added
++     */
++    protected void addClassRow(ClassDoc usedClass, String packageName,
++            Content contentTree) {
+         String path = pathString(usedClass,
+-                                 "class-use/" + usedClass.name() + ".html");
+-
+-        trBgcolorStyle("white", "TableRowColor");
+-        summaryRow(0);
+-        strong();
+-        printHyperLink(path, packageName, usedClass.name(), true);
+-        strongEnd();
+-        println(); br();
+-        printNbsps();
+-        printIndexComment(usedClass);
+-        summaryRowEnd();
+-        trEnd();
++                "class-use/" + usedClass.name() + ".html");
++        Content td = HtmlTree.TD(HtmlStyle.colOne,
++                getHyperLink(path, packageName, new StringContent(usedClass.name())));
++        addIndexComment(usedClass, td);
++        contentTree.addContent(td);
+     }
+ 
+     /**
+-     * Print the package use list.
++     * Add the package use information.
++     *
++     * @param pkg the package that used the given package
++     * @param contentTree the content tree to which the information will be added
+      */
+-    protected void generatePackageUse(PackageDoc pkg) throws IOException {
+-        trBgcolorStyle("white", "TableRowColor");
+-        summaryRow(0);
+-        //Just want an anchor here.
+-        printHyperLink("", pkg.name(), Util.getPackageName(pkg), true);
+-        summaryRowEnd();
+-        summaryRow(0);
+-        if (pkg != null) {
+-            printSummaryComment(pkg);
+-        }
+-        space();
+-        summaryRowEnd();
+-        trEnd();
++    protected void addPackageUse(PackageDoc pkg, Content contentTree) throws IOException {
++        Content tdFirst = HtmlTree.TD(HtmlStyle.colFirst,
++                getHyperLink("", pkg.name(), new StringContent(Util.getPackageName(pkg))));
++        contentTree.addContent(tdFirst);
++        HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
++        tdLast.addStyle(HtmlStyle.colLast);
++        if (pkg != null)
++            addSummaryComment(pkg, tdLast);
++        else
++            tdLast.addContent(getSpace());
++        contentTree.addContent(tdLast);
+     }
+ 
+     /**
+-     * Print the header for the class use Listing.
++     * Get the header for the package use listing.
++     *
++     * @return a content tree representing the package use header
+      */
+-    protected void printPackageUseHeader() {
+-        String packageLabel = configuration.getText("doclet.Package");
++    protected Content getPackageUseHeader() {
++        String packageText = configuration.getText("doclet.Package");
+         String name = pkgdoc.name();
+-        printHtmlHeader(configuration.getText("doclet.Window_ClassUse_Header",
+-            packageLabel, name), null, true);
+-        printTop();
+-        navLinks(true);
+-        hr();
+-        center();
+-        h2();
+-        strongText("doclet.ClassUse_Title", packageLabel, name);
+-        h2End();
+-        centerEnd();
++        String title = configuration.getText("doclet.Window_ClassUse_Header",
++                packageText, name);
++        Content bodyTree = getBody(true, getWindowTitle(title));
++        addTop(bodyTree);
++        addNavLinks(true, bodyTree);
++        Content headContent = getResource("doclet.ClassUse_Title", packageText, name);
++        Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
++                HtmlStyle.title, headContent);
++        Content div = HtmlTree.DIV(HtmlStyle.header, heading);
++        bodyTree.addContent(div);
++        return bodyTree;
+     }
+ 
+     /**
+-     * Print the footer for the class use Listing.
++     * Get this package link.
++     *
++     * @return a content tree for the package link
+      */
+-    protected void printPackageUseFooter() {
+-        hr();
+-        navLinks(false);
+-        printBottom();
+-        printBodyHtmlEnd();
+-    }
+-
+-
+-    /**
+-     * Print this package link
+-     */
+-    protected void navLinkPackage() {
+-        navCellStart();
+-        printHyperLink("package-summary.html", "", configuration.getText("doclet.Package"),
+-                       true, "NavBarFont1");
+-        navCellEnd();
++    protected Content getNavLinkPackage() {
++        Content linkContent = getHyperLink("package-summary.html", "",
++                packageLabel);
++        Content li = HtmlTree.LI(linkContent);
++        return li;
+     }
+ 
+     /**
+-     * Print class use link
++     * Get the use link.
++     *
++     * @return a content tree for the use link
+      */
+-    protected void navLinkClassUse() {
+-        navCellRevStart();
+-        fontStyle("NavBarFont1Rev");
+-        strongText("doclet.navClassUse");
+-        fontEnd();
+-        navCellEnd();
++    protected Content getNavLinkClassUse() {
++        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, useLabel);
++        return li;
+     }
+ 
+-    protected void navLinkTree() {
+-        navCellStart();
+-        printHyperLink("package-tree.html", "", configuration.getText("doclet.Tree"),
+-                       true, "NavBarFont1");
+-        navCellEnd();
++    /**
++     * Get the tree link.
++     *
++     * @return a content tree for the tree link
++     */
++    protected Content getNavLinkTree() {
++        Content linkContent = getHyperLink("package-tree.html", "",
++                treeLabel);
++        Content li = HtmlTree.LI(linkContent);
++        return li;
+     }
+-
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java
+@@ -25,12 +25,12 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
++import java.io.*;
++import java.util.*;
++import com.sun.javadoc.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+-
+-import com.sun.javadoc.*;
+-import java.io.*;
+-import java.util.*;
++import com.sun.tools.doclets.formats.html.markup.*;
+ 
+ /**
+  * Class to generate file for each package contents in the right-hand
+@@ -98,189 +98,206 @@
+     /**
+      * {@inheritDoc}
+      */
+-    public void writeSummaryHeader() {}
+-
+-    /**
+-     * {@inheritDoc}
+-     */
+-    public void writeSummaryFooter() {}
+-
+-    /**
+-     * {@inheritDoc}
+-     */
+-    public void writeClassesSummary(ClassDoc[] classes, String label, String tableSummary, String[] tableHeader) {
+-        if(classes.length > 0) {
+-            Arrays.sort(classes);
+-            tableIndexSummary(tableSummary);
+-            boolean printedHeading = false;
+-            for (int i = 0; i < classes.length; i++) {
+-                if (!printedHeading) {
+-                    printTableCaption(label);
+-                    printFirstRow(tableHeader);
+-                    printedHeading = true;
+-                }
+-                if (!Util.isCoreClass(classes[i]) ||
+-                    !configuration.isGeneratedDoc(classes[i])) {
+-                    continue;
+-                }
+-                trBgcolorStyle("white", "TableRowColor");
+-                summaryRow(15);
+-                strong();
+-                printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_PACKAGE,
+-                    classes[i], false));
+-                strongEnd();
+-                summaryRowEnd();
+-                summaryRow(0);
+-                if (Util.isDeprecated(classes[i])) {
+-                    strongText("doclet.Deprecated");
+-                    if (classes[i].tags("deprecated").length > 0) {
+-                        space();
+-                        printSummaryDeprecatedComment(classes[i],
+-                            classes[i].tags("deprecated")[0]);
+-                    }
+-                } else {
+-                    printSummaryComment(classes[i]);
+-                }
+-                summaryRowEnd();
+-                trEnd();
+-            }
+-            tableEnd();
+-            println(" ");
+-            p();
++    public Content getPackageHeader(String heading) {
++        String pkgName = packageDoc.name();
++        Content bodyTree = getBody(true, getWindowTitle(pkgName));
++        addTop(bodyTree);
++        addNavLinks(true, bodyTree);
++        HtmlTree div = new HtmlTree(HtmlTag.DIV);
++        div.addStyle(HtmlStyle.header);
++        Content annotationContent = new HtmlTree(HtmlTag.P);
++        addAnnotationInfo(packageDoc, annotationContent);
++        div.addContent(annotationContent);
++        Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
++                HtmlStyle.title, packageLabel);
++        tHeading.addContent(getSpace());
++        Content packageHead = new RawHtml(heading);
++        tHeading.addContent(packageHead);
++        div.addContent(tHeading);
++        if (packageDoc.inlineTags().length > 0 && ! configuration.nocomment) {
++            HtmlTree p = new HtmlTree(HtmlTag.P);
++            p.addStyle(HtmlStyle.subTitle);
++            addSummaryComment(packageDoc, p);
++            div.addContent(p);
++            Content space = getSpace();
++            Content descLink = getHyperLink("", "package_description",
++                    descriptionLabel, "", "");
++            Content descPara = new HtmlTree(HtmlTag.P, seeLabel, space, descLink);
++            div.addContent(descPara);
+         }
+-    }
+-
+-    /**
+-     * Print the table caption for the class-listing.
+-     *
+-     * @param label label for the Class kind listing.
+-     */
+-    protected void printTableCaption(String label) {
+-        tableCaptionStart();
+-        print(label);
+-        tableCaptionEnd();
+-    }
+-
+-    /**
+-     * Print the table heading for the class-listing.
+-     *
+-     * @param tableHeader table header string for the Class listing.
+-     */
+-    protected void printFirstRow(String[] tableHeader) {
+-        summaryTableHeader(tableHeader, "col");
++        bodyTree.addContent(div);
++        return bodyTree;
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writePackageDescription() {
+-        if (packageDoc.inlineTags().length > 0) {
+-            anchor("package_description");
+-            h2(configuration.getText("doclet.Package_Description", packageDoc.name()));
+-            p();
+-            printInlineComment(packageDoc);
+-            p();
++    public Content getContentHeader() {
++        HtmlTree div = new HtmlTree(HtmlTag.DIV);
++        div.addStyle(HtmlStyle.contentContainer);
++        return div;
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public Content getSummaryHeader() {
++        HtmlTree ul = new HtmlTree(HtmlTag.UL);
++        ul.addStyle(HtmlStyle.blockList);
++        return ul;
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public void addClassesSummary(ClassDoc[] classes, String label,
++            String tableSummary, String[] tableHeader, Content summaryContentTree) {
++        if(classes.length > 0) {
++            Arrays.sort(classes);
++            Content caption = getTableCaption(label);
++            Content table = HtmlTree.TABLE(HtmlStyle.packageSummary, 0, 3, 0,
++                    tableSummary, caption);
++            table.addContent(getSummaryTableHeader(tableHeader, "col"));
++            Content tbody = new HtmlTree(HtmlTag.TBODY);
++            for (int i = 0; i < classes.length; i++) {
++                if (!Util.isCoreClass(classes[i]) ||
++                    !configuration.isGeneratedDoc(classes[i])) {
++                    continue;
++                }
++                Content classContent = new RawHtml(getLink(new LinkInfoImpl(
++                        LinkInfoImpl.CONTEXT_PACKAGE, classes[i], false)));
++                Content tdClass = HtmlTree.TD(HtmlStyle.colFirst, classContent);
++                HtmlTree tr = HtmlTree.TR(tdClass);
++                if (i%2 == 0)
++                    tr.addStyle(HtmlStyle.altColor);
++                else
++                    tr.addStyle(HtmlStyle.rowColor);
++                HtmlTree tdClassDescription = new HtmlTree(HtmlTag.TD);
++                tdClassDescription.addStyle(HtmlStyle.colLast);
++                if (Util.isDeprecated(classes[i])) {
++                    tdClassDescription.addContent(deprecatedLabel);
++                    if (classes[i].tags("deprecated").length > 0) {
++                        addSummaryDeprecatedComment(classes[i],
++                            classes[i].tags("deprecated")[0], tdClassDescription);
++                    }
++                }
++                else
++                    addSummaryComment(classes[i], tdClassDescription);
++                tr.addContent(tdClassDescription);
++                tbody.addContent(tr);
++            }
++            table.addContent(tbody);
++            Content li = HtmlTree.LI(HtmlStyle.blockList, table);
++            summaryContentTree.addContent(li);
+         }
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writePackageTags() {
+-        printTags(packageDoc);
+-    }
+-
+-    /**
+-     * {@inheritDoc}
+-     */
+-    public void writePackageHeader(String heading) {
+-        String pkgName = packageDoc.name();
+-        printHtmlHeader(pkgName,
+-            configuration.metakeywords.getMetaKeywords(packageDoc), true);
+-        printTop();
+-        navLinks(true);
+-        hr();
+-        writeAnnotationInfo(packageDoc);
+-        h2(configuration.getText("doclet.Package") + " " + heading);
+-        if (packageDoc.inlineTags().length > 0 && ! configuration.nocomment) {
+-            printSummaryComment(packageDoc);
+-            p();
+-            strong(configuration.getText("doclet.See"));
+-            br();
+-            printNbsps();
+-            printHyperLink("", "package_description",
+-                configuration.getText("doclet.Description"), true);
+-            p();
++    public void addPackageDescription(Content packageContentTree) {
++        if (packageDoc.inlineTags().length > 0) {
++            packageContentTree.addContent(getMarkerAnchor("package_description"));
++            Content h2Content = new StringContent(
++                    configuration.getText("doclet.Package_Description",
++                    packageDoc.name()));
++            packageContentTree.addContent(HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING,
++                    true, h2Content));
++            addInlineComment(packageDoc, packageContentTree);
+         }
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+-    public void writePackageFooter() {
+-        hr();
+-        navLinks(false);
+-        printBottom();
+-        printBodyHtmlEnd();
++    public void addPackageTags(Content packageContentTree) {
++        addTagsInfo(packageDoc, packageContentTree);
+     }
+ 
+     /**
+-     * Print "Use" link for this pacakge in the navigation bar.
++     * {@inheritDoc}
+      */
+-    protected void navLinkClassUse() {
+-        navCellStart();
+-        printHyperLink("package-use.html", "", configuration.getText("doclet.navClassUse"),
+-                       true, "NavBarFont1");
+-        navCellEnd();
++    public void addPackageFooter(Content contentTree) {
++        addNavLinks(false, contentTree);
++        addBottom(contentTree);
+     }
+ 
+     /**
+-     * Print "PREV PACKAGE" link in the navigation bar.
++     * {@inheritDoc}
+      */
+-    protected void navLinkPrevious() {
++    public void printDocument(Content contentTree) {
++        printHtmlDocument(configuration.metakeywords.getMetaKeywords(packageDoc),
++                true, contentTree);
++    }
++
++    /**
++     * Get "Use" link for this pacakge in the navigation bar.
++     *
++     * @return a content tree for the class use link
++     */
++    protected Content getNavLinkClassUse() {
++        Content useLink = getHyperLink("package-use.html", "",
++                useLabel, "", "");
++        Content li = HtmlTree.LI(useLink);
++        return li;
++    }
++
++    /**
++     * Get "PREV PACKAGE" link in the navigation bar.
++     *
++     * @return a content tree for the previous link
++     */
++    public Content getNavLinkPrevious() {
++        Content li;
+         if (prev == null) {
+-            printText("doclet.Prev_Package");
++            li = HtmlTree.LI(prevpackageLabel);
+         } else {
+             String path = DirectoryManager.getRelativePath(packageDoc.name(),
+                                                            prev.name());
+-            printHyperLink(path + "package-summary.html", "",
+-                configuration.getText("doclet.Prev_Package"), true);
++            li = HtmlTree.LI(getHyperLink(path + "package-summary.html", "",
++                prevpackageLabel, "", ""));
+         }
++        return li;
+     }
+ 
+     /**
+-     * Print "NEXT PACKAGE" link in the navigation bar.
++     * Get "NEXT PACKAGE" link in the navigation bar.
++     *
++     * @return a content tree for the next link
+      */
+-    protected void navLinkNext() {
++    public Content getNavLinkNext() {
++        Content li;
+         if (next == null) {
+-            printText("doclet.Next_Package");
++            li = HtmlTree.LI(nextpackageLabel);
+         } else {
+             String path = DirectoryManager.getRelativePath(packageDoc.name(),
+                                                            next.name());
+-            printHyperLink(path + "package-summary.html", "",
+-                configuration.getText("doclet.Next_Package"), true);
++            li = HtmlTree.LI(getHyperLink(path + "package-summary.html", "",
++                nextpackageLabel, "", ""));
+         }
++        return li;
+     }
+ 
+     /**
+-     * Print "Tree" link in the navigation bar. This will be link to the package
++     * Get "Tree" link in the navigation bar. This will be link to the package
+      * tree file.
++     *
++     * @return a content tree for the tree link
+      */
+-    protected void navLinkTree() {
+-        navCellStart();
+-        printHyperLink("package-tree.html", "", configuration.getText("doclet.Tree"),
+-                       true, "NavBarFont1");
+-        navCellEnd();
++    protected Content getNavLinkTree() {
++        Content useLink = getHyperLink("package-tree.html", "",
++                treeLabel, "", "");
++        Content li = HtmlTree.LI(useLink);
++        return li;
+     }
+ 
+     /**
+      * Highlight "Package" in the navigation bar, as this is the package page.
++     *
++     * @return a content tree for the package link
+      */
+-    protected void navLinkPackage() {
+-        navCellRevStart();
+-        fontStyle("NavBarFont1Rev");
+-        strongText("doclet.Package");
+-        fontEnd();
+-        navCellEnd();
++    protected Content getNavLinkPackage() {
++        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, packageLabel);
++        return li;
+     }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java
+@@ -25,8 +25,10 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
++import java.io.*;
+ import com.sun.javadoc.*;
+-import java.io.*;
++import com.sun.tools.doclets.formats.html.markup.*;
++import com.sun.tools.doclets.internal.toolkit.*;
+ 
+ /**
+  * Generate the Serialized Form Information Page.
+@@ -64,76 +66,167 @@
+     }
+ 
+     /**
+-     * Write the given package header.
++     * Get the given header.
+      *
+-     * @param packageName the package header to write.
++     * @param header the header to write
++     * @return the body content tree
+      */
+-    public void writePackageHeader(String packageName) {
+-        hr(4, "noshade");
+-        tableHeader();
+-        thAlign("center");
+-        font("+2");
+-        strongText("doclet.Package");
+-        print(' ');
+-        strong(packageName);
+-        tableFooter();
++    public Content getHeader(String header) {
++        Content bodyTree = getBody(true, getWindowTitle(header));
++        addTop(bodyTree);
++        addNavLinks(true, bodyTree);
++        Content h1Content = new StringContent(header);
++        Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
++                HtmlStyle.title, h1Content);
++        Content div = HtmlTree.DIV(HtmlStyle.header, heading);
++        bodyTree.addContent(div);
++        return bodyTree;
+     }
+ 
+     /**
+-     * Write the serial UID info.
++     * Get the serialized form summaries header.
+      *
+-     * @param header the header that will show up before the UID.
+-     * @param serialUID the serial UID to print.
++     * @return the serialized form summary header tree
+      */
+-    public void writeSerialUIDInfo(String header, String serialUID) {
+-        strong(header + " ");
+-        println(serialUID);
+-        p();
++    public Content getSerializedSummariesHeader() {
++        HtmlTree ul = new HtmlTree(HtmlTag.UL);
++        ul.addStyle(HtmlStyle.blockList);
++        return ul;
+     }
+ 
+     /**
+-     * Write the footer.
++     * Get the package serialized form header.
++     *
++     * @return the package serialized form header tree
+      */
+-    public void writeFooter() {
+-        p();
+-        hr();
+-        navLinks(false);
+-        printBottom();
+-        printBodyHtmlEnd();
++    public Content getPackageSerializedHeader() {
++        HtmlTree li = new HtmlTree(HtmlTag.LI);
++        li.addStyle(HtmlStyle.blockList);
++        return li;
+     }
+ 
++    /**
++     * Get the given package header.
++     *
++     * @param packageName the package header to write
++     * @return a content tree for the package header
++     */
++    public Content getPackageHeader(String packageName) {
++        Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
++                packageLabel);
++        heading.addContent(getSpace());
++        heading.addContent(packageName);
++        return heading;
++    }
+ 
+     /**
+-     * Write the serializable class heading.
++     * Get the serialized class header.
+      *
+-     * @param classDoc the class being processed.
++     * @return a content tree for the serialized class header
+      */
+-    public void writeClassHeader(ClassDoc classDoc) {
++    public Content getClassSerializedHeader() {
++        HtmlTree ul = new HtmlTree(HtmlTag.UL);
++        ul.addStyle(HtmlStyle.blockList);
++        return ul;
++    }
++
++    /**
++     * Get the serializable class heading.
++     *
++     * @param classDoc the class being processed
++     * @return a content tree for the class header
++     */
++    public Content getClassHeader(ClassDoc classDoc) {
+         String classLink = (classDoc.isPublic() || classDoc.isProtected())?
+             getLink(new LinkInfoImpl(classDoc,
+-                configuration.getClassName(classDoc))):
++            configuration.getClassName(classDoc))):
+             classDoc.qualifiedName();
+-        p();
+-        anchor(classDoc.qualifiedName());
++        Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor(
++                classDoc.qualifiedName()));
+         String superClassLink =
+             classDoc.superclassType() != null ?
+                 getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_SERIALIZED_FORM,
+-                    classDoc.superclassType())) :
++                classDoc.superclassType())) :
+                 null;
+ 
+         //Print the heading.
+         String className = superClassLink == null ?
+             configuration.getText(
+-                "doclet.Class_0_implements_serializable", classLink) :
++            "doclet.Class_0_implements_serializable", classLink) :
+             configuration.getText(
+-                "doclet.Class_0_extends_implements_serializable", classLink,
+-                    superClassLink);
+-        tableHeader();
+-        thAlignColspan("left", 2);
+-        font("+2");
+-        strong(className);
+-        tableFooter();
+-        p();
++            "doclet.Class_0_extends_implements_serializable", classLink,
++            superClassLink);
++        Content classNameContent = new RawHtml(className);
++        li.addContent(HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING,
++                classNameContent));
++        return li;
++    }
++
++    /**
++     * Get the serial UID info header.
++     *
++     * @return a content tree for the serial uid info header
++     */
++    public Content getSerialUIDInfoHeader() {
++        HtmlTree dl = new HtmlTree(HtmlTag.DL);
++        dl.addStyle(HtmlStyle.nameValue);
++        return dl;
++    }
++
++    /**
++     * Adds the serial UID info.
++     *
++     * @param header the header that will show up before the UID.
++     * @param serialUID the serial UID to print.
++     * @param serialUidTree the serial UID content tree to which the serial UID
++     *                      content will be added
++     */
++    public void addSerialUIDInfo(String header, String serialUID,
++            Content serialUidTree) {
++        Content headerContent = new StringContent(header);
++        serialUidTree.addContent(HtmlTree.DT(headerContent));
++        Content serialContent = new StringContent(serialUID);
++        serialUidTree.addContent(HtmlTree.DD(serialContent));
++    }
++
++    /**
++     * Get the class serialize content header.
++     *
++     * @return a content tree for the class serialize content header
++     */
++    public Content getClassContentHeader() {
++        HtmlTree ul = new HtmlTree(HtmlTag.UL);
++        ul.addStyle(HtmlStyle.blockList);
++        return ul;
++    }
++
++    /**
++     * Get the serialized content tree section.
++     *
++     * @param serializedTreeContent the serialized content tree to be added
++     * @return a div content tree
++     */
++    public Content getSerializedContent(Content serializedTreeContent) {
++        Content divContent = HtmlTree.DIV(HtmlStyle.serializedFormContainer,
++                serializedTreeContent);
++        return divContent;
++    }
++
++    /**
++     * Add the footer.
++     *
++     * @param serializedTree the serialized tree to be added
++     */
++    public void addFooter(Content serializedTree) {
++        addNavLinks(false, serializedTree);
++        addBottom(serializedTree);
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public void printDocument(Content serializedTree) {
++        printHtmlDocument(null, true, serializedTree);
+     }
+ 
+     private void tableHeader() {
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/SingleIndexWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/SingleIndexWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/SingleIndexWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/SingleIndexWriter.java
+@@ -25,9 +25,10 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
++import java.io.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+-
+-import java.io.*;
++import com.sun.tools.doclets.formats.html.markup.*;
++import com.sun.tools.doclets.internal.toolkit.*;
+ 
+ /**
+  * Generate only one index file for all the Member Names with Indexing in
+@@ -36,6 +37,7 @@
+  *
+  * @see java.lang.Character
+  * @author Atul M Dambalkar
++ * @author Bhavesh Patel (Modified)
+  */
+ public class SingleIndexWriter extends AbstractIndexWriter {
+ 
+@@ -82,34 +84,35 @@
+      * Member Field, Method and Constructor Description.
+      */
+     protected void generateIndexFile() throws IOException {
+-        printHtmlHeader(configuration.getText("doclet.Window_Single_Index"),
+-            null, true);
+-        printTop();
+-        navLinks(true);
+-        printLinksForIndexes();
+-
+-        hr();
+-
++        String title = configuration.getText("doclet.Window_Single_Index");
++        Content body = getBody(true, getWindowTitle(title));
++        addTop(body);
++        addNavLinks(true, body);
++        HtmlTree divTree = new HtmlTree(HtmlTag.DIV);
++        divTree.addStyle(HtmlStyle.contentContainer);
++        addLinksForIndexes(divTree);
+         for (int i = 0; i < indexbuilder.elements().length; i++) {
+             Character unicode = (Character)((indexbuilder.elements())[i]);
+-            generateContents(unicode, indexbuilder.getMemberList(unicode));
++            addContents(unicode, indexbuilder.getMemberList(unicode), divTree);
+         }
+-
+-        printLinksForIndexes();
+-        navLinks(false);
+-
+-        printBottom();
+-        printBodyHtmlEnd();
++        addLinksForIndexes(divTree);
++        body.addContent(divTree);
++        addNavLinks(false, body);
++        addBottom(body);
++        printHtmlDocument(null, true, body);
+     }
+ 
+     /**
+-     * Print Links for all the Index Files per unicode character.
++     * Add links for all the Index Files per unicode character.
++     *
++     * @param contentTree the content tree to which the links for indexes will be added
+      */
+-    protected void printLinksForIndexes() {
++    protected void addLinksForIndexes(Content contentTree) {
+         for (int i = 0; i < indexbuilder.elements().length; i++) {
+             String unicode = (indexbuilder.elements())[i].toString();
+-            printHyperLink("#_" + unicode + "_", unicode);
+-            print(' ');
++            contentTree.addContent(
++                    getHyperLink("#_" + unicode + "_", new StringContent(unicode)));
++            contentTree.addContent(getSpace());
+         }
+     }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/SourceToHTMLConverter.java b/src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java
+# most patch programs can not handle renames
+# rename from src/share/classes/com/sun/tools/doclets/internal/toolkit/util/SourceToHTMLConverter.java
+# rename to src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/SourceToHTMLConverter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java
+@@ -23,14 +23,14 @@
+  * questions.
+  */
+ 
+-package com.sun.tools.doclets.internal.toolkit.util;
++package com.sun.tools.doclets.formats.html;
+ 
+ import java.io.*;
+-import java.util.*;
+ 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.
+@@ -40,27 +40,28 @@
+  * Do not use it as an API
+  *
+  * @author Jamie Ho
++ * @author Bhavesh Patel (Modified)
+  * @since 1.4
+  */
+ public class SourceToHTMLConverter {
+ 
+     /**
+-     * The background color.
+-     */
+-    protected static final String BGCOLOR = "white";
+-
+-    /**
+-     * The line number color.
+-     */
+-    protected static final String LINE_NO_COLOR = "green";
+-
+-    /**
+      * 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.
+      */
+-    protected static final int NUM_BLANK_LINES = 60;
++    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.
+@@ -69,11 +70,13 @@
+ 
+     /**
+      * 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(Configuration configuration, RootDoc rd, String outputdir) {
++    public static void convertRoot(ConfigurationImpl configuration, RootDoc rd,
++            String outputdir) {
+         if (rd == null || outputdir == null) {
+             return;
+         }
+@@ -84,17 +87,19 @@
+         ClassDoc[] cds = rd.specifiedClasses();
+         for (int i = 0; i < cds.length; i++) {
+             convertClass(configuration, cds[i],
+-                getPackageOutputDir(outputdir, cds[i].containingPackage()));
++                    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(Configuration configuration, PackageDoc pd, String outputdir) {
++    public static void convertPackage(ConfigurationImpl configuration, PackageDoc pd,
++            String outputdir) {
+         if (pd == null || outputdir == null) {
+             return;
+         }
+@@ -107,8 +112,10 @@
+ 
+     /**
+      * 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 +
+@@ -117,11 +124,13 @@
+ 
+     /**
+      * 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(Configuration configuration, ClassDoc cd, String outputdir) {
++    public static void convertClass(ConfigurationImpl configuration, ClassDoc cd,
++            String outputdir) {
+         if (cd == null || outputdir == null) {
+             return;
+         }
+@@ -145,19 +154,23 @@
+             LineNumberReader reader = new LineNumberReader(r);
+             int lineno = 1;
+             String line;
+-            StringBuffer output = new StringBuffer();
++            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) {
+-                    output.append(formatLine(line, configuration.sourcetab, lineno));
++                    addLineNo(pre, lineno);
++                    addLine(pre, line, configuration.sourcetab, lineno);
+                     lineno++;
+                 }
+             } finally {
+                 reader.close();
+             }
+-            output = addLineNumbers(output.toString());
+-            output.insert(0, getHeader(configuration));
+-            output.append(getFooter());
+-            writeToFile(output.toString(), outputdir, cd.name(), configuration);
++            addBlankLines(pre);
++            Content div = HtmlTree.DIV(HtmlStyle.sourceContainer, pre);
++            body.addContent(div);
++            writeToFile(body, outputdir, cd.name(), configuration);
+         } catch (Exception e){
+             e.printStackTrace();
+         }
+@@ -165,135 +178,117 @@
+ 
+     /**
+      * Write the output to the file.
+-     * @param output the string to output.
++     *
++     * @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(String output, String outputDir, String className, Configuration configuration) throws IOException {
++    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(output);
++        bw.write(htmlDocument.toString());
+         bw.close();
+         fout.close();
+     }
+ 
+     /**
+-     * Given a <code>String</code>, add line numbers.
+-     * @param s the text to add line numbers to.
++     * Returns a link to the stylesheet file.
+      *
+-     * @return the string buffer with the line numbering for each line.
++     * @param configuration the doclet configuration for the current run of javadoc
++     * @return an HtmlTree for the lINK tag which provides the stylesheet location
+      */
+-    private static StringBuffer addLineNumbers(String s) {
+-        StringBuffer sb = new StringBuffer();
+-        StringTokenizer st = new StringTokenizer(s, "\n", true);
+-        int lineno = 1;
+-        String current;
+-        while(st.hasMoreTokens()){
+-            current = st.nextToken();
+-            sb.append(current.equals("\n") ?
+-                    getHTMLLineNo(lineno) + current :
+-                    getHTMLLineNo(lineno) + current + st.nextToken());
+-            lineno++;
++    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";
+         }
+-        return sb;
++        filename = relativePath + filename;
++        HtmlTree link = HtmlTree.LINK("stylesheet", "text/css", filename, "Style");
++        return link;
+     }
+ 
+     /**
+      * Get the header.
+-     * @param configuration the Doclet configuration
+-     * @return the header to the output file
++     *
++     * @return the header content for the HTML file
+      */
+-    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();
++    private static Content getHeader() {
++        return new HtmlTree(HtmlTag.BODY);
+     }
+ 
+     /**
+-     * Get the footer
+-     * @return the footer to the output file
++     * 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
+      */
+-    protected static String getFooter() {
+-        StringBuffer footer = new StringBuffer();
+-        for (int i = 0; i < NUM_BLANK_LINES; i++) {
+-            footer.append(DocletConstants.NL);
++    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));
+         }
+-        footer.append("</PRE>" + DocletConstants.NL + "</BODY>" +
+-            DocletConstants.NL + "</HTML>" + DocletConstants.NL);
+-        return footer.toString();
++        pre.addContent(span);
+     }
+ 
+     /**
+-     * Get the HTML for the lines.
+-     * @param lineno The line number
+-     * @return the HTML code for the line
+-     */
+-    protected static String getHTMLLineNo(int lineno) {
+-        StringBuffer result = new StringBuffer("<FONT color=\"" + LINE_NO_COLOR
+-            + "\">");
+-        if (lineno < 10) {
+-            result.append("00" + ((new Integer(lineno)).toString()));
+-        } else if (lineno < 100) {
+-            result.append("0" + ((new Integer(lineno)).toString()));
+-        } else {
+-            result.append((new Integer(lineno)).toString());
+-        }
+-        result.append("</FONT>    ");
+-        return result.toString();
+-    }
+-
+-    /**
+-     * Format a given line of source. <br>
+-     * Note:  In the future, we will add special colors for constructs in the
+-     * language.
++     * 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.
+      */
+-    protected static String formatLine(String line, int tabLength, int currentLineNo) {
+-        if (line == null) {
+-            return null;
+-        }
+-        StringBuffer lineBuffer = new StringBuffer(Util.escapeHtmlChars(line));
+-        //Insert an anchor for the line
+-        lineBuffer.append("<a name=\"line." + Integer.toString(currentLineNo) + "\"></a>");
+-        lineBuffer.append(DocletConstants.NL);
+-        Util.replaceTabs(tabLength, lineBuffer);
+-        return lineBuffer.toString();
+-    }
+-
+-    /**
+-     * Given an array of <code>Doc</code>s, add to the given <code>HashMap</code> the
+-     * line numbers and anchors that should be inserted in the output at those lines.
+-     * @param docs the array of <code>Doc</code>s to add anchors for.
+-     * @param hash the <code>HashMap</code> to add to.
+-     */
+-    protected static void addToHash(Doc[] docs, HashMap<Integer,String> hash) {
+-        if(docs == null) {
+-            return;
+-        }
+-        for(int i = 0; i < docs.length; i++) {
+-            hash.put(docs[i].position().line(), getAnchor(docs[i]));
++    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);
+         }
+     }
+ 
+     /**
+-     * Given a <code>Doc</code>, return an anchor for it.
+-     * @param d the <code>Doc</code> to check.
+-     * @return an anchor of the form <a name="my_name"></a>
++     * Add trailing blank lines at the end of the page.
++     *
++     * @param pre the content tree to which the blank lines will be added.
+      */
+-    protected static String getAnchor(Doc d) {
+-        return "    <a name=\"" + getAnchorName(d) + "\"></a>";
++    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.
+      */
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/SplitIndexWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/SplitIndexWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/SplitIndexWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/SplitIndexWriter.java
+@@ -25,9 +25,10 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
++import java.io.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+-
+-import java.io.*;
++import com.sun.tools.doclets.formats.html.markup.*;
++import com.sun.tools.doclets.internal.toolkit.*;
+ 
+ /**
+  * Generate Separate Index Files for all the member names with Indexing in
+@@ -36,6 +37,7 @@
+  *
+  * @see java.lang.Character
+  * @author Atul M Dambalkar
++ * @author Bhavesh Patel (Modified)
+  */
+ public class SplitIndexWriter extends AbstractIndexWriter {
+ 
+@@ -109,56 +111,68 @@
+      * index.
+      */
+     protected void generateIndexFile(Character unicode) throws IOException {
+-        printHtmlHeader(configuration.getText("doclet.Window_Split_Index",
+-            unicode.toString()), null, true);
+-        printTop();
+-        navLinks(true);
+-        printLinksForIndexes();
+-
+-        hr();
+-
+-        generateContents(unicode, indexbuilder.getMemberList(unicode));
+-
+-        navLinks(false);
+-        printLinksForIndexes();
+-
+-        printBottom();
+-        printBodyHtmlEnd();
++        String title = configuration.getText("doclet.Window_Split_Index",
++                unicode.toString());
++        Content body = getBody(true, getWindowTitle(title));
++        addTop(body);
++        addNavLinks(true, body);
++        HtmlTree divTree = new HtmlTree(HtmlTag.DIV);
++        divTree.addStyle(HtmlStyle.contentContainer);
++        addLinksForIndexes(divTree);
++        addContents(unicode, indexbuilder.getMemberList(unicode), divTree);
++        addLinksForIndexes(divTree);
++        body.addContent(divTree);
++        addNavLinks(false, body);
++        addBottom(body);
++        printHtmlDocument(null, true, body);
+     }
+ 
+     /**
+-     * Print Links for all the Index Files per unicode character.
++     * Add links for all the Index Files per unicode character.
++     *
++     * @param contentTree the content tree to which the links for indexes will be added
+      */
+-    protected void printLinksForIndexes() {
+-        for (int i = 0; i < indexbuilder.elements().length; i++) {
++    protected void addLinksForIndexes(Content contentTree) {
++        Object[] unicodeChars = indexbuilder.elements();
++        for (int i = 0; i < unicodeChars.length; i++) {
+             int j = i + 1;
+-            printHyperLink("index-" + j + ".html",
+-                           indexbuilder.elements()[i].toString());
+-            print(' ');
++            contentTree.addContent(getHyperLink("index-" + j + ".html",
++                    new StringContent(unicodeChars[i].toString())));
++            contentTree.addContent(getSpace());
+         }
+     }
+ 
+     /**
+-     * Print the previous unicode character index link.
++     * Get link to the previous unicode character.
++     *
++     * @return a content tree for the link
+      */
+-    protected void navLinkPrevious() {
++    public Content getNavLinkPrevious() {
++        Content prevletterLabel = getResource("doclet.Prev_Letter");
+         if (prev == -1) {
+-            printText("doclet.Prev_Letter");
+-        } else {
+-            printHyperLink("index-" + prev + ".html", "",
+-                configuration.getText("doclet.Prev_Letter"), true);
++            return HtmlTree.LI(prevletterLabel);
++        }
++        else {
++            Content prevLink = getHyperLink("index-" + prev + ".html", "",
++                    prevletterLabel);
++            return HtmlTree.LI(prevLink);
+         }
+     }
+ 
+     /**
+-     * Print the next unicode character index link.
++     * Get link to the next unicode character.
++     *
++     * @return a content tree for the link
+      */
+-    protected void navLinkNext() {
++    public Content getNavLinkNext() {
++        Content nextletterLabel = getResource("doclet.Next_Letter");
+         if (next == -1) {
+-            printText("doclet.Next_Letter");
+-        } else {
+-            printHyperLink("index-" + next + ".html","",
+-                configuration.getText("doclet.Next_Letter"), true);
++            return HtmlTree.LI(nextletterLabel);
++        }
++        else {
++            Content nextLink = getHyperLink("index-" + next + ".html","",
++                    nextletterLabel);
++            return HtmlTree.LI(nextLink);
+         }
+     }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/StylesheetWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/StylesheetWriter.java
+deleted file mode 100644
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/StylesheetWriter.java
++++ /dev/null
+@@ -1,130 +0,0 @@
+-/*
+- * Copyright (c) 1998, 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.
+- */
+-
+-package com.sun.tools.doclets.formats.html;
+-
+-import com.sun.tools.doclets.internal.toolkit.util.*;
+-
+-import java.io.*;
+-
+-/**
+- * Writes the style sheet for the doclet output.
+- *
+- * @author Atul M Dambalkar
+- * @author Bhavesh Patel (Modified)
+- */
+-public class StylesheetWriter extends HtmlDocletWriter {
+-
+-    /**
+-     * Constructor.
+-     */
+-    public StylesheetWriter(ConfigurationImpl configuration,
+-                            String filename) throws IOException {
+-        super(configuration, filename);
+-    }
+-
+-    /**
+-     * Generate the style file contents.
+-     * @throws DocletAbortException
+-     */
+-    public static void generate(ConfigurationImpl configuration) {
+-        StylesheetWriter stylegen;
+-        String filename = "";
+-        try {
+-            filename = "stylesheet.css";
+-            stylegen = new StylesheetWriter(configuration, filename);
+-            stylegen.generateStyleFile();
+-            stylegen.close();
+-        } catch (IOException exc) {
+-            configuration.standardmessage.error(
+-                        "doclet.exception_encountered",
+-                        exc.toString(), filename);
+-            throw new DocletAbortException();
+-        }
+-    }
+-
+-    /**
+-     * Generate the style file contents.
+-     */
+-    protected void generateStyleFile() {
+-        print("/* "); printText("doclet.Style_line_1"); println(" */");
+-        println("");
+-
+-        print("/* "); printText("doclet.Style_line_2"); println(" */");
+-        println("");
+-
+-        print("/* "); printText("doclet.Style_line_3"); println(" */");
+-        println("body { background-color: #FFFFFF; color:#000000 }");
+-        println("");
+-
+-        print("/* "); printText("doclet.Style_Headings"); println(" */");
+-        println("h1 { font-size: 145% }");
+-        println("");
+-
+-        print("/* "); printText("doclet.Style_line_4"); println(" */");
+-        print(".TableHeadingColor     { background: #CCCCFF; color:#000000 }");
+-        print(" /* "); printText("doclet.Style_line_5"); println(" */");
+-        print(".TableSubHeadingColor  { background: #EEEEFF; color:#000000 }");
+-        print(" /* "); printText("doclet.Style_line_6"); println(" */");
+-        print(".TableRowColor         { background: #FFFFFF; color:#000000 }");
+-        print(" /* "); printText("doclet.Style_line_7"); println(" */");
+-        println("");
+-
+-        print("/* "); printText("doclet.Style_line_8"); println(" */");
+-        println(".FrameTitleFont   { font-size: 100%; font-family: Helvetica, Arial, sans-serif; color:#000000 }");
+-        println(".FrameHeadingFont { font-size:  90%; font-family: Helvetica, Arial, sans-serif; color:#000000 }");
+-        println(".FrameItemFont    { font-size:  90%; font-family: Helvetica, Arial, sans-serif; color:#000000 }");
+-        println("");
+-
+-       // Removed doclet.Style_line_9 as no longer needed
+-
+-        print("/* "); printText("doclet.Style_line_10"); println(" */");
+-        print(".NavBarCell1    { background-color:#EEEEFF; color:#000000}");
+-        print(" /* "); printText("doclet.Style_line_6"); println(" */");
+-        print(".NavBarCell1Rev { background-color:#00008B; color:#FFFFFF}");
+-        print(" /* "); printText("doclet.Style_line_11"); println(" */");
+-
+-        print(".NavBarFont1    { font-family: Arial, Helvetica, sans-serif; color:#000000;");
+-        println("color:#000000;}");
+-        print(".NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;");
+-        println("color:#FFFFFF;}");
+-        println("");
+-
+-        print(".NavBarCell2    { font-family: Arial, Helvetica, sans-serif; ");
+-        println("background-color:#FFFFFF; color:#000000}");
+-        print(".NavBarCell3    { font-family: Arial, Helvetica, sans-serif; ");
+-        println("background-color:#FFFFFF; color:#000000}");
+-
+-        print("/* "); printText("doclet.Style_line_12"); println(" */");
+-        print(".TableCaption     { background: #CCCCFF; color:#000000; text-align: left; font-size: 150%; font-weight: bold; border-left: 2px ridge; border-right: 2px ridge; border-top: 2px ridge; padding-left: 5px; }");
+-        print(" /* "); printText("doclet.Style_line_5"); println(" */");
+-        print(".TableSubCaption  { background: #EEEEFF; color:#000000; text-align: left; font-weight: bold; border-left: 2px ridge; border-right: 2px ridge; border-top: 2px ridge; padding-left: 5px; }");
+-        print(" /* "); printText("doclet.Style_line_6"); println(" */");
+-        print(".TableHeader     { text-align: center; font-size: 80%; font-weight: bold; }");
+-        println("");
+-
+-    }
+-
+-}
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java
+@@ -25,10 +25,11 @@
+ 
+ package com.sun.tools.doclets.formats.html;
+ 
++import java.io.*;
+ import com.sun.javadoc.*;
++import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+-
+-import java.io.*;
++import com.sun.tools.doclets.formats.html.markup.*;
+ 
+ /**
+  * This abstract class exists to provide functionality needed in the
+@@ -71,13 +72,31 @@
+         tdEnd();
+     }
+ 
+-    public void printSummaryHeader(AbstractMemberWriter mw, ClassDoc cd) {
+-        mw.printSummaryAnchor(cd);
+-        mw.printTableSummary();
+-        tableCaptionStart();
+-        mw.printSummaryLabel();
+-        tableCaptionEnd();
+-        mw.printSummaryTableHeader(cd);
++    /**
++     * Add the summary header.
++     *
++     * @param mw the writer for the member being documented
++     * @param cd the classdoc to be documented
++     * @param memberTree the content tree to which the summary header will be added
++     */
++    public void addSummaryHeader(AbstractMemberWriter mw, ClassDoc cd,
++            Content memberTree) {
++        mw.addSummaryAnchor(cd, memberTree);
++        mw.addSummaryLabel(memberTree);
++    }
++
++    /**
++     * Get the summary table.
++     *
++     * @param mw the writer for the member being documented
++     * @param cd the classdoc to be documented
++     * @return the content tree for the summary table
++     */
++    public Content getSummaryTableTree(AbstractMemberWriter mw, ClassDoc cd) {
++        Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0,
++                mw.getTableSummary(), getTableCaption(mw.getCaption()));
++        table.addContent(getSummaryTableHeader(mw.getSummaryTableHeader(cd), "col"));
++        return table;
+     }
+ 
+     public void printTableHeadingBackground(String str) {
+@@ -88,15 +107,17 @@
+         tableEnd();
+     }
+ 
+-    public void printInheritedSummaryHeader(AbstractMemberWriter mw, ClassDoc cd) {
+-        mw.printInheritedSummaryAnchor(cd);
+-        tableIndexSummary();
+-        tableInheritedHeaderStart("#EEEEFF");
+-        mw.printInheritedSummaryLabel(cd);
+-        tableInheritedHeaderEnd();
+-        trBgcolorStyle("white", "TableRowColor");
+-        summaryRow(0);
+-        code();
++    /**
++     * Add the inherited summary header.
++     *
++     * @param mw the writer for the member being documented
++     * @param cd the classdoc to be documented
++     * @param inheritedTree the content tree to which the inherited summary header will be added
++     */
++    public void addInheritedSummaryHeader(AbstractMemberWriter mw, ClassDoc cd,
++            Content inheritedTree) {
++        mw.addInheritedSummaryAnchor(cd, inheritedTree);
++        mw.addInheritedSummaryLabel(cd, inheritedTree);
+     }
+ 
+     public void printSummaryFooter(AbstractMemberWriter mw, ClassDoc cd) {
+@@ -112,8 +133,14 @@
+         space();
+     }
+ 
+-    protected void printIndexComment(Doc member) {
+-        printIndexComment(member, member.firstSentenceTags());
++    /**
++     * Add the index comment.
++     *
++     * @param member the member being documented
++     * @param contentTree the content tree to which the comment will be added
++     */
++    protected void addIndexComment(Doc member, Content contentTree) {
++        addIndexComment(member, member.firstSentenceTags(), contentTree);
+     }
+ 
+     protected void printIndexComment(Doc member, Tag[] firstSentenceTags) {
+@@ -134,17 +161,60 @@
+         printSummaryComment(member, firstSentenceTags);
+     }
+ 
+-    public void printSummaryLinkType(AbstractMemberWriter mw,
+-                                     ProgramElementDoc member) {
+-        trBgcolorStyle("white", "TableRowColor");
+-        mw.printSummaryType(member);
+-        summaryRow(0);
+-        code();
++    /**
++     * Add the index comment.
++     *
++     * @param member the member being documented
++     * @param firstSentenceTags the first sentence tags for the member to be documented
++     * @param tdSummary the content tree to which the comment will be added
++     */
++    protected void addIndexComment(Doc member, Tag[] firstSentenceTags,
++            Content tdSummary) {
++        Tag[] deprs = member.tags("deprecated");
++        Content div;
++        if (Util.isDeprecated((ProgramElementDoc) member)) {
++            Content strong = HtmlTree.STRONG(deprecatedPhrase);
++            div = HtmlTree.DIV(HtmlStyle.block, strong);
++            div.addContent(getSpace());
++            if (deprs.length > 0) {
++                addInlineDeprecatedComment(member, deprs[0], div);
++            }
++            tdSummary.addContent(div);
++            return;
++        } else {
++            ClassDoc cd = ((ProgramElementDoc)member).containingClass();
++            if (cd != null && Util.isDeprecated(cd)) {
++                Content strong = HtmlTree.STRONG(deprecatedPhrase);
++                div = HtmlTree.DIV(HtmlStyle.block, strong);
++                div.addContent(getSpace());
++                tdSummary.addContent(div);
++            }
++        }
++        addSummaryComment(member, firstSentenceTags, tdSummary);
+     }
+ 
+-    public void printSummaryLinkComment(AbstractMemberWriter mw,
+-                                        ProgramElementDoc member) {
+-        printSummaryLinkComment(mw, member, member.firstSentenceTags());
++    /**
++     * Add the summary type for the member.
++     *
++     * @param mw the writer for the member being documented
++     * @param member the member to be documented
++     * @param tdSummaryType the content tree to which the type will be added
++     */
++    public void addSummaryType(AbstractMemberWriter mw, ProgramElementDoc member,
++            Content tdSummaryType) {
++        mw.addSummaryType(member, tdSummaryType);
++    }
++
++    /**
++     * Add the summary link for the member.
++     *
++     * @param mw the writer for the member being documented
++     * @param member the member to be documented
++     * @param contentTree the content tree to which the link will be added
++     */
++    public void addSummaryLinkComment(AbstractMemberWriter mw,
++            ProgramElementDoc member, Content contentTree) {
++        addSummaryLinkComment(mw, member, member.firstSentenceTags(), contentTree);
+     }
+ 
+     public void printSummaryLinkComment(AbstractMemberWriter mw,
+@@ -159,12 +229,34 @@
+         trEnd();
+     }
+ 
+-    public void printInheritedSummaryMember(AbstractMemberWriter mw, ClassDoc cd,
+-            ProgramElementDoc member, boolean isFirst) {
++    /**
++     * Add the summary link comment.
++     *
++     * @param mw the writer for the member being documented
++     * @param member the member being documented
++     * @param firstSentenceTags the first sentence tags for the member to be documented
++     * @param tdSummary the content tree to which the comment will be added
++     */
++    public void addSummaryLinkComment(AbstractMemberWriter mw,
++            ProgramElementDoc member, Tag[] firstSentenceTags, Content tdSummary) {
++        addIndexComment(member, firstSentenceTags, tdSummary);
++    }
++
++    /**
++     * Add the inherited member summary.
++     *
++     * @param mw the writer for the member being documented
++     * @param cd the class being documented
++     * @param member the member being documented
++     * @param isFirst true if its the first link being documented
++     * @param linksTree the content tree to which the summary will be added
++     */
++    public void addInheritedMemberSummary(AbstractMemberWriter mw, ClassDoc cd,
++            ProgramElementDoc member, boolean isFirst, Content linksTree) {
+         if (! isFirst) {
+-            mw.print(", ");
++            linksTree.addContent(", ");
+         }
+-        mw.writeInheritedSummaryLink(cd, member);
++        mw.addInheritedSummaryLink(cd, member, linksTree);
+     }
+ 
+     public void printMemberHeader() {
+@@ -174,4 +266,67 @@
+     public void printMemberFooter() {
+     }
+ 
++    /**
++     * Get the document content header tree
++     *
++     * @return a content tree the document content header
++     */
++    public Content getContentHeader() {
++        HtmlTree div = new HtmlTree(HtmlTag.DIV);
++        div.addStyle(HtmlStyle.contentContainer);
++        return div;
++    }
++
++    /**
++     * Get the member header tree
++     *
++     * @return a content tree the member header
++     */
++    public Content getMemberTreeHeader() {
++        HtmlTree li = new HtmlTree(HtmlTag.LI);
++        li.addStyle(HtmlStyle.blockList);
++        return li;
++    }
++
++    /**
++     * Get the member tree
++     *
++     * @param contentTree the tree used to generate the complete member tree
++     * @return a content tree for the member
++     */
++    public Content getMemberTree(Content contentTree) {
++        Content ul = HtmlTree.UL(HtmlStyle.blockList, contentTree);
++        return ul;
++    }
++
++    /**
++     * Get the member summary tree
++     *
++     * @param contentTree the tree used to generate the member summary tree
++     * @return a content tree for the member summary
++     */
++    public Content getMemberSummaryTree(Content contentTree) {
++        return getMemberTree(HtmlStyle.summary, contentTree);
++    }
++
++    /**
++     * Get the member details tree
++     *
++     * @param contentTree the tree used to generate the member details tree
++     * @return a content tree for the member details
++     */
++    public Content getMemberDetailsTree(Content contentTree) {
++        return getMemberTree(HtmlStyle.details, contentTree);
++    }
++
++    /**
++     * Get the member tree
++     *
++     * @param style the style class to be added to the content tree
++     * @param contentTree the tree used to generate the complete member tree
++     */
++    public Content getMemberTree(HtmlStyle style, Content contentTree) {
++        Content div = HtmlTree.DIV(style, getMemberTree(contentTree));
++        return div;
++    }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java
+@@ -70,9 +70,9 @@
+         Tag[] deprs = doc.tags("deprecated");
+         if (doc instanceof ClassDoc) {
+             if (Util.isDeprecated((ProgramElementDoc) doc)) {
+-                output.append("<STRONG>" +
++                output.append("<span class=\"strong\">" +
+                     ConfigurationImpl.getInstance().
+-                        getText("doclet.Deprecated") + "</STRONG> ");
++                        getText("doclet.Deprecated") + "</span> ");
+                 if (deprs.length > 0) {
+                     Tag[] commentTags = deprs[0].inlineTags();
+                     if (commentTags.length > 0) {
+@@ -82,30 +82,24 @@
+                         );
+                     }
+                 }
+-                output.append("<p>");
+             }
+         } else {
+             MemberDoc member = (MemberDoc) doc;
+             if (Util.isDeprecated((ProgramElementDoc) doc)) {
+-                output.append("<DD><STRONG>" +
++                output.append("<span class=\"strong\">" +
+                     ConfigurationImpl.getInstance().
+-                            getText("doclet.Deprecated") + "</STRONG> ");
++                            getText("doclet.Deprecated") + "</span> ");
+                 if (deprs.length > 0) {
+-                    output.append("<I>");
++                    output.append("<i>");
+                     output.append(commentTagsToOutput(null, doc,
+                         deprs[0].inlineTags(), false).toString());
+-                    output.append("</I>");
++                    output.append("</i>");
+                 }
+-                if (member instanceof ExecutableMemberDoc) {
+-                    output.append(DocletConstants.NL + "<P>" +
+-                        DocletConstants.NL);
+-                }
+-                output.append("</DD>");
+             } else {
+                 if (Util.isDeprecated(member.containingClass())) {
+-                    output.append("<DD><STRONG>" +
++                    output.append("<span class=\"strong\">" +
+                     ConfigurationImpl.getInstance().
+-                            getText("doclet.Deprecated") + "</STRONG> </DD>");
++                            getText("doclet.Deprecated") + "</span> ");
+                 }
+             }
+         }
+@@ -124,8 +118,8 @@
+      */
+     public TagletOutput getParamHeader(String header) {
+         StringBuffer result = new StringBuffer();
+-        result.append("<DT>");
+-        result.append("<STRONG>" +  header + "</STRONG></DT>");
++        result.append("<dt>");
++        result.append("<span class=\"strong\">" +  header + "</span></dt>");
+         return new TagletOutputImpl(result.toString());
+     }
+ 
+@@ -133,8 +127,8 @@
+      * {@inheritDoc}
+      */
+     public TagletOutput paramTagOutput(ParamTag paramTag, String paramName) {
+-        TagletOutput result = new TagletOutputImpl("<DD><CODE>" + paramName + "</CODE>"
+-         + " - " + htmlWriter.commentTagsToString(paramTag, null, paramTag.inlineTags(), false) + "</DD>");
++        TagletOutput result = new TagletOutputImpl("<dd><code>" + paramName + "</code>"
++         + " - " + htmlWriter.commentTagsToString(paramTag, null, paramTag.inlineTags(), false) + "</dd>");
+         return result;
+     }
+ 
+@@ -142,11 +136,11 @@
+      * {@inheritDoc}
+      */
+     public TagletOutput returnTagOutput(Tag returnTag) {
+-        TagletOutput result = new TagletOutputImpl(DocletConstants.NL + "<DT>" +
+-            "<STRONG>" + htmlWriter.configuration.getText("doclet.Returns") +
+-            "</STRONG>" + "</DT>" + "<DD>" +
++        TagletOutput result = new TagletOutputImpl(DocletConstants.NL + "<dt>" +
++            "<span class=\"strong\">" + htmlWriter.configuration.getText("doclet.Returns") +
++            "</span>" + "</dt>" + "<dd>" +
+             htmlWriter.commentTagsToString(returnTag, null, returnTag.inlineTags(),
+-            false) + "</DD>");
++            false) + "</dd>");
+         return result;
+     }
+ 
+@@ -168,7 +162,7 @@
+                 htmlWriter instanceof ClassWriterImpl) {
+             //Automatically add link to constant values page for constant fields.
+             result = addSeeHeader(result);
+-            result += htmlWriter.getHyperLink(htmlWriter.relativePath +
++            result += htmlWriter.getHyperLinkString(htmlWriter.relativePath +
+                 ConfigurationImpl.CONSTANTS_FILE_NAME
+                 + "#" + ((ClassWriterImpl) htmlWriter).getClassDoc().qualifiedName()
+                 + "." + ((FieldDoc) holder).name(),
+@@ -179,18 +173,19 @@
+             if ((SerializedFormBuilder.serialInclude(holder) &&
+                       SerializedFormBuilder.serialInclude(((ClassDoc)holder).containingPackage()))) {
+                 result = addSeeHeader(result);
+-                result += htmlWriter.getHyperLink(htmlWriter.relativePath + "serialized-form.html",
++                result += htmlWriter.getHyperLinkString(htmlWriter.relativePath + "serialized-form.html",
+                         ((ClassDoc)holder).qualifiedName(), htmlWriter.configuration.getText("doclet.Serialized_Form"), false);
+             }
+         }
+-        return result.equals("") ? null : new TagletOutputImpl(result + "</DD>");
++        return result.equals("") ? null : new TagletOutputImpl(result + "</dd>");
+     }
+ 
+     private String addSeeHeader(String result) {
+         if (result != null && result.length() > 0) {
+             return result + ", " + DocletConstants.NL;
+         } else {
+-            return "<DT><STRONG>" + htmlWriter.configuration().getText("doclet.See_Also") + "</STRONG></DT><DD>";
++            return "<dt><span class=\"strong\">" +
++                    htmlWriter.configuration().getText("doclet.See_Also") + "</span></dt><dd>";
+         }
+      }
+ 
+@@ -198,15 +193,15 @@
+      * {@inheritDoc}
+      */
+     public TagletOutput simpleTagOutput(Tag[] simpleTags, String header) {
+-        String result = "<DT><STRONG>" + header + "</STRONG></DT>" + DocletConstants.NL +
+-            "  <DD>";
++        String result = "<dt><span class=\"strong\">" + header + "</span></dt>" + DocletConstants.NL +
++            "  <dd>";
+         for (int i = 0; i < simpleTags.length; i++) {
+             if (i > 0) {
+                 result += ", ";
+             }
+             result += htmlWriter.commentTagsToString(simpleTags[i], null, simpleTags[i].inlineTags(), false);
+         }
+-        result += "</DD>" + DocletConstants.NL;
++        result += "</dd>" + DocletConstants.NL;
+         return new TagletOutputImpl(result);
+     }
+ 
+@@ -214,24 +209,24 @@
+      * {@inheritDoc}
+      */
+     public TagletOutput simpleTagOutput(Tag simpleTag, String header) {
+-        return new TagletOutputImpl("<DT><STRONG>" + header + "</STRONG></DT>" + "  <DD>"
++        return new TagletOutputImpl("<dt><span class=\"strong\">" + header + "</span></dt>" + "  <dd>"
+             + htmlWriter.commentTagsToString(simpleTag, null, simpleTag.inlineTags(), false)
+-            + "</DD>" + DocletConstants.NL);
++            + "</dd>" + DocletConstants.NL);
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+     public TagletOutput getThrowsHeader() {
+-        return new TagletOutputImpl(DocletConstants.NL + "<DT>" + "<STRONG>" +
+-            htmlWriter.configuration().getText("doclet.Throws") + "</STRONG></DT>");
++        return new TagletOutputImpl(DocletConstants.NL + "<dt>" + "<span class=\"strong\">" +
++            htmlWriter.configuration().getText("doclet.Throws") + "</span></dt>");
+     }
+ 
+     /**
+      * {@inheritDoc}
+      */
+     public TagletOutput throwsTagOutput(ThrowsTag throwsTag) {
+-        String result = DocletConstants.NL + "<DD>";
++        String result = DocletConstants.NL + "<dd>";
+         result += throwsTag.exceptionType() == null ?
+             htmlWriter.codeText(throwsTag.exceptionName()) :
+             htmlWriter.codeText(
+@@ -243,7 +238,7 @@
+         if (text != null && text.toString().length() > 0) {
+             result += " - " + text;
+         }
+-        result += "</DD>";
++        result += "</dd>";
+         return new TagletOutputImpl(result);
+     }
+ 
+@@ -251,9 +246,9 @@
+      * {@inheritDoc}
+      */
+     public TagletOutput throwsTagOutput(Type throwsType) {
+-        return new TagletOutputImpl(DocletConstants.NL + "<DD>" +
++        return new TagletOutputImpl(DocletConstants.NL + "<dd>" +
+             htmlWriter.codeText(htmlWriter.getLink(
+-                new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER, throwsType))) + "</DD>");
++                new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER, throwsType))) + "</dd>");
+     }
+ 
+     /**
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java
+@@ -29,6 +29,8 @@
+ 
+ import com.sun.javadoc.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
++import com.sun.tools.doclets.formats.html.markup.*;
++import com.sun.tools.doclets.internal.toolkit.*;
+ 
+ /**
+  * Generate Class Hierarchy page for all the Classes in this run.  Use
+@@ -37,6 +39,7 @@
+  * current or the destination directory.
+  *
+  * @author Atul M Dambalkar
++ * @author Bhavesh Patel (Modified)
+  */
+ public class TreeWriter extends AbstractTreeWriter {
+ 
+@@ -90,86 +93,70 @@
+     }
+ 
+     /**
+-     * Print the interface hierarchy and class hierarchy in the file.
++     * Generate the interface hierarchy and class hierarchy.
+      */
+     public void generateTreeFile() throws IOException {
+-        printHtmlHeader(configuration.getText("doclet.Window_Class_Hierarchy"),
+-            null, true);
+-
+-        printTreeHeader();
+-
+-        printPageHeading();
+-
+-        printPackageTreeLinks();
+-
+-        generateTree(classtree.baseclasses(), "doclet.Class_Hierarchy");
+-        generateTree(classtree.baseinterfaces(), "doclet.Interface_Hierarchy");
+-        generateTree(classtree.baseAnnotationTypes(), "doclet.Annotation_Type_Hierarchy");
+-        generateTree(classtree.baseEnums(), "doclet.Enum_Hierarchy");
+-
+-        printTreeFooter();
++        Content body = getTreeHeader();
++        Content headContent = getResource("doclet.Hierarchy_For_All_Packages");
++        Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false,
++                HtmlStyle.title, headContent);
++        Content div = HtmlTree.DIV(HtmlStyle.header, heading);
++        addPackageTreeLinks(div);
++        body.addContent(div);
++        HtmlTree divTree = new HtmlTree(HtmlTag.DIV);
++        divTree.addStyle(HtmlStyle.contentContainer);
++        addTree(classtree.baseclasses(), "doclet.Class_Hierarchy", divTree);
++        addTree(classtree.baseinterfaces(), "doclet.Interface_Hierarchy", divTree);
++        addTree(classtree.baseAnnotationTypes(), "doclet.Annotation_Type_Hierarchy", divTree);
++        addTree(classtree.baseEnums(), "doclet.Enum_Hierarchy", divTree);
++        body.addContent(divTree);
++        addNavLinks(false, body);
++        addBottom(body);
++        printHtmlDocument(null, true, body);
+     }
+ 
+     /**
+-     * Generate the links to all the package tree files.
++     * Add the links to all the package tree files.
++     *
++     * @param contentTree the content tree to which the links will be added
+      */
+-    protected void printPackageTreeLinks() {
++    protected void addPackageTreeLinks(Content contentTree) {
+         //Do nothing if only unnamed package is used
+         if (packages.length == 1 && packages[0].name().length() == 0) {
+             return;
+         }
+         if (!classesonly) {
+-            dl();
+-            dt();
+-            strongText("doclet.Package_Hierarchies");
+-            dtEnd();
+-            dd();
++            Content span = HtmlTree.SPAN(HtmlStyle.strong,
++                    getResource("doclet.Package_Hierarchies"));
++            contentTree.addContent(span);
++            HtmlTree ul = new HtmlTree(HtmlTag.UL);
++            ul.addStyle(HtmlStyle.horizontal);
+             for (int i = 0; i < packages.length; i++) {
+                 if (packages[i].name().length() == 0) {
+                     continue;
+                 }
+-                String filename = pathString(packages[i], "package-tree.html");
+-                printHyperLink(filename, "", packages[i].name());
++                String link = pathString(packages[i], "package-tree.html");
++                Content li = HtmlTree.LI(getHyperLink(
++                        link, "", new StringContent(packages[i].name())));
+                 if (i < packages.length - 1) {
+-                    print(", ");
++                    li.addContent(", ");
+                 }
++                ul.addContent(li);
+             }
+-            ddEnd();
+-            dlEnd();
+-            hr();
++            contentTree.addContent(ul);
+         }
+     }
+ 
+     /**
+-     * Print the top text (from the -top option) and
+-     * navigation bar at the top of page.
++     * Get the tree header.
++     *
++     * @return a content tree for the tree header
+      */
+-    protected void printTreeHeader() {
+-        printTop();
+-        navLinks(true);
+-        hr();
+-    }
+-
+-    /**
+-     * Print the navigation bar and bottom text (from the -bottom option)
+-     * at the bottom of page.
+-     */
+-    protected void printTreeFooter() {
+-        hr();
+-        navLinks(false);
+-        printBottom();
+-        printBodyHtmlEnd();
+-    }
+-
+-    /**
+-     * Print the page title "Hierarchy For All Packages" at the top of the tree
+-     * page.
+-     */
+-    protected void printPageHeading() {
+-        center();
+-        h2();
+-        printText("doclet.Hierarchy_For_All_Packages");
+-        h2End();
+-        centerEnd();
++    protected Content getTreeHeader() {
++        String title = configuration.getText("doclet.Window_Class_Hierarchy");
++        Content bodyTree = getBody(true, getWindowTitle(title));
++        addTop(bodyTree);
++        addNavLinks(true, bodyTree);
++        return bodyTree;
+     }
+ }
+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
+new file mode 100644
+--- /dev/null
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/Comment.java
+@@ -0,0 +1,90 @@
++/*
++ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute 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.markup;
++
++import com.sun.tools.doclets.internal.toolkit.Content;
++import com.sun.tools.doclets.internal.toolkit.util.*;
++
++/**
++ * Class for generating a comment for HTML pages of javadoc output.
++ *
++ * @author Bhavesh Patel
++ */
++public class Comment extends Content{
++
++    private String commentText;
++
++    /**
++     * Constructor to construct a Comment object.
++     *
++     * @param comment comment text for the comment
++     */
++    public Comment(String comment) {
++        commentText = nullCheck(comment);
++    }
++
++    /**
++     * This method is not supported by the class.
++     *
++     * @param content content that needs to be added
++     * @throws DocletAbortException this method will always throw a
++     *                              DocletAbortException because it
++     *                              is not supported.
++     */
++    public void addContent(Content content) {
++        throw new DocletAbortException();
++    }
++
++    /**
++     * This method is not supported by the class.
++     *
++     * @param stringContent string content that needs to be added
++     * @throws DocletAbortException this method will always throw a
++     *                              DocletAbortException because it
++     *                              is not supported.
++     */
++    public void addContent(String stringContent) {
++        throw new DocletAbortException();
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public boolean isEmpty() {
++        return commentText.isEmpty();
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public void write(StringBuilder contentBuilder) {
++        if (!endsWithNewLine(contentBuilder))
++            contentBuilder.append("\n");
++        contentBuilder.append("<!-- ");
++        contentBuilder.append(commentText);
++        contentBuilder.append(" -->\n");
++    }
++}
+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
+new file mode 100644
+--- /dev/null
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/DocType.java
+@@ -0,0 +1,113 @@
++/*
++ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute 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.markup;
++
++import com.sun.tools.doclets.internal.toolkit.Content;
++import com.sun.tools.doclets.internal.toolkit.util.*;
++
++/**
++ * Class for generating document type for HTML pages of javadoc output.
++ *
++ * @author Bhavesh Patel
++ */
++public class DocType extends Content{
++
++    private String docType;
++
++    private static DocType transitional;
++
++    private static DocType frameset;
++
++    /**
++     * Constructor to construct a DocType object.
++     *
++     * @param type the doctype to be added
++     */
++    private DocType(String type, String dtd) {
++        docType = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 " + type +
++                "//EN\" \"" + dtd + "\">\n";
++    }
++
++     /**
++     * Construct and return a HTML 4.01 transitional DocType content
++     *
++     * @return a content tree for transitional DocType
++     */
++    public static DocType Transitional() {
++        if (transitional == null)
++            transitional = new DocType("Transitional", "http://www.w3.org/TR/html4/loose.dtd");
++        return transitional;
++    }
++
++    /**
++     * Construct and return a HTML 4.01 frameset DocType content
++     *
++     * @return a content tree for frameset DocType
++     */
++    public static DocType Frameset() {
++        if (frameset == null)
++            frameset = new DocType("Frameset", "http://www.w3.org/TR/html4/frameset.dtd");
++        return frameset;
++    }
++
++    /**
++     * This method is not supported by the class.
++     *
++     * @param content content that needs to be added
++     * @throws DocletAbortException this method will always throw a
++     *                              DocletAbortException because it
++     *                              is not supported.
++     */
++    public void addContent(Content content) {
++        throw new DocletAbortException();
++    }
++
++    /**
++     * This method is not supported by the class.
++     *
++     * @param stringContent string content that needs to be added
++     * @throws DocletAbortException this method will always throw a
++     *                              DocletAbortException because it
++     *                              is not supported.
++     */
++    public void addContent(String stringContent) {
++        throw new DocletAbortException();
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public boolean isEmpty() {
++        return (docType.length() == 0);
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public void write(StringBuilder contentBuilder) {
++        contentBuilder.append(docType);
++    }
++}
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlAttr.java b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlAttr.java
+new file mode 100644
+--- /dev/null
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlAttr.java
+@@ -0,0 +1,73 @@
++/*
++ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute 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.markup;
++
++/**
++ * Enum representing HTML tag attributes.
++ *
++ * @author Bhavesh Patel
++ */
++public enum HtmlAttr {
++    ALT,
++    BORDER,
++    CELLPADDING,
++    CELLSPACING,
++    CHARSET,
++    CLASS,
++    CLEAR,
++    COLS,
++    CONTENT,
++    HREF,
++    HTTP_EQUIV("http-equiv"),
++    ID,
++    LANG,
++    NAME,
++    ONLOAD,
++    REL,
++    ROWS,
++    SCOPE,
++    SCROLLING,
++    SRC,
++    SUMMARY,
++    TARGET,
++    TITLE,
++    TYPE,
++    WIDTH;
++
++    private final String value;
++
++    HtmlAttr() {
++        this.value = name().toLowerCase();
++    }
++
++    HtmlAttr(String name) {
++        this.value = name;
++    }
++
++    public String toString() {
++        return value;
++    }
++}
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlConstants.java b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlConstants.java
+new file mode 100644
+--- /dev/null
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlConstants.java
+@@ -0,0 +1,189 @@
++/*
++ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute 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.markup;
++
++import com.sun.tools.doclets.internal.toolkit.Content;
++
++/**
++ * Stores constants for Html Doclet.
++ *
++ * @author Bhavesh Patel
++ */
++public class HtmlConstants {
++
++    /**
++     * Marker to identify start of top navigation bar.
++     */
++    public static final Content START_OF_TOP_NAVBAR =
++            new Comment("========= START OF TOP NAVBAR =======");
++
++    /**
++     * Marker to identify start of bottom navigation bar.
++     */
++    public static final Content START_OF_BOTTOM_NAVBAR =
++            new Comment("======= START OF BOTTOM NAVBAR ======");
++
++    /**
++     * Marker to identify end of top navigation bar.
++     */
++    public static final Content END_OF_TOP_NAVBAR =
++            new Comment("========= END OF TOP NAVBAR =========");
++
++    /**
++     * Marker to identify end of bottom navigation bar.
++     */
++    public static final Content END_OF_BOTTOM_NAVBAR =
++            new Comment("======== END OF BOTTOM NAVBAR =======");
++
++    /**
++     * Marker to identify start of class data.
++     */
++    public static final Content START_OF_CLASS_DATA =
++            new Comment("======== START OF CLASS DATA ========");
++
++    /**
++     * Marker to identify end of class data.
++     */
++    public static final Content END_OF_CLASS_DATA =
++            new Comment("========= END OF CLASS DATA =========");
++
++    /**
++     * Marker to identify start of nested class summary.
++     */
++    public static final Content START_OF_NESTED_CLASS_SUMMARY =
++            new Comment("======== NESTED CLASS SUMMARY ========");
++
++    /**
++     * Marker to identify start of annotation type optional member summary.
++     */
++    public static final Content START_OF_ANNOTATION_TYPE_OPTIONAL_MEMBER_SUMMARY =
++            new Comment("=========== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY ===========");
++
++    /**
++     * Marker to identify start of annotation type required member summary.
++     */
++    public static final Content START_OF_ANNOTATION_TYPE_REQUIRED_MEMBER_SUMMARY =
++            new Comment("=========== ANNOTATION TYPE REQUIRED MEMBER SUMMARY ===========");
++
++    /**
++     * Marker to identify start of constructor summary.
++     */
++    public static final Content START_OF_CONSTRUCTOR_SUMMARY =
++            new Comment("======== CONSTRUCTOR SUMMARY ========");
++
++    /**
++     * Marker to identify start of enum constants summary.
++     */
++    public static final Content START_OF_ENUM_CONSTANT_SUMMARY =
++            new Comment("=========== ENUM CONSTANT SUMMARY ===========");
++
++    /**
++     * Marker to identify start of field summary.
++     */
++    public static final Content START_OF_FIELD_SUMMARY =
++            new Comment("=========== FIELD SUMMARY ===========");
++
++    /**
++     * Marker to identify start of method summary.
++     */
++    public static final Content START_OF_METHOD_SUMMARY =
++            new Comment("========== METHOD SUMMARY ===========");
++
++    /**
++     * Marker to identify start of annotation type details.
++     */
++    public static final Content START_OF_ANNOTATION_TYPE_DETAILS =
++            new Comment("============ ANNOTATION TYPE MEMBER DETAIL ===========");
++
++    /**
++     * Marker to identify start of method details.
++     */
++    public static final Content START_OF_METHOD_DETAILS =
++            new Comment("============ METHOD DETAIL ==========");
++
++    /**
++     * Marker to identify start of field details.
++     */
++    public static final Content START_OF_FIELD_DETAILS =
++            new Comment("============ FIELD DETAIL ===========");
++
++    /**
++     * Marker to identify start of constructor details.
++     */
++    public static final Content START_OF_CONSTRUCTOR_DETAILS =
++            new Comment("========= CONSTRUCTOR DETAIL ========");
++
++    /**
++     * Marker to identify start of enum constants details.
++     */
++    public static final Content START_OF_ENUM_CONSTANT_DETAILS =
++            new Comment("============ ENUM CONSTANT DETAIL ===========");
++
++    /**
++     * Html tag for the page title heading.
++     */
++    public static final HtmlTag TITLE_HEADING = HtmlTag.H1;
++
++    /**
++     * Html tag for the class page title heading.
++     */
++    public static final HtmlTag CLASS_PAGE_HEADING = HtmlTag.H2;
++
++    /**
++     * Html tag for the content heading.
++     */
++    public static final HtmlTag CONTENT_HEADING = HtmlTag.H2;
++
++    /**
++     * Html tag for the package name heading.
++     */
++    public static final HtmlTag PACKAGE_HEADING = HtmlTag.H2;
++
++    /**
++     * Html tag for the member summary heading.
++     */
++    public static final HtmlTag SUMMARY_HEADING = HtmlTag.H3;
++
++    /**
++     * Html tag for the inherited member summary heading.
++     */
++    public static final HtmlTag INHERITED_SUMMARY_HEADING = HtmlTag.H3;
++
++    /**
++     * Html tag for the member details heading.
++     */
++    public static final HtmlTag DETAILS_HEADING = HtmlTag.H3;
++
++    /**
++     * Html tag for the serialized member heading.
++     */
++    public static final HtmlTag SERIALIZED_MEMBER_HEADING = HtmlTag.H3;
++
++    /**
++     * Html tag for the member heading.
++     */
++    public static final HtmlTag MEMBER_HEADING = HtmlTag.H4;
++}
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
+@@ -87,7 +87,7 @@
+      */
+     public void printHyperLink(String link, String where,
+                                String label, boolean strong) {
+-        print(getHyperLink(link, where, label, strong, "", "", ""));
++        print(getHyperLinkString(link, where, label, strong, "", "", ""));
+     }
+ 
+     /**
+@@ -115,7 +115,7 @@
+     public void printHyperLink(String link, String where,
+                                String label, boolean strong,
+                                String stylename) {
+-        print(getHyperLink(link, where, label, strong, stylename, "", ""));
++        print(getHyperLinkString(link, where, label, strong, stylename, "", ""));
+     }
+ 
+     /**
+@@ -128,9 +128,9 @@
+      * @param strong       Boolean that sets label to strong.
+      * @return String    Hyper Link.
+      */
+-    public String getHyperLink(String link, String where,
++    public String getHyperLinkString(String link, String where,
+                                String label, boolean strong) {
+-        return getHyperLink(link, where, label, strong, "", "", "");
++        return getHyperLinkString(link, where, label, strong, "", "", "");
+     }
+ 
+     /**
+@@ -144,10 +144,24 @@
+      * @param stylename  String style of text defined in style sheet.
+      * @return String    Hyper Link.
+      */
+-    public String getHyperLink(String link, String where,
++    public String getHyperLinkString(String link, String where,
+                                String label, boolean strong,
+                                String stylename) {
+-        return getHyperLink(link, where, label, strong, stylename, "", "");
++        return getHyperLinkString(link, where, label, strong, stylename, "", "");
++    }
++
++    /**
++     * Get Html Hyper Link string.
++     *
++     * @param link       String name of the file.
++     * @param where      Position of the link in the file. Character '#' is not
++     *                   needed.
++     * @param label      Tag for the link.
++     * @return a content tree for the hyper link
++     */
++    public Content getHyperLink(String link, String where,
++                               Content label) {
++        return getHyperLink(link, where, label, "", "");
+     }
+ 
+     /**
+@@ -163,11 +177,11 @@
+      * @param target     Target frame.
+      * @return String    Hyper Link.
+      */
+-    public String getHyperLink(String link, String where,
++    public String getHyperLinkString(String link, String where,
+                                String label, boolean strong,
+                                String stylename, String title, String target) {
+         StringBuffer retlink = new StringBuffer();
+-        retlink.append("<A HREF=\"");
++        retlink.append("<a href=\"");
+         retlink.append(link);
+         if (where != null && where.length() != 0) {
+             retlink.append("#");
+@@ -187,27 +201,54 @@
+             retlink.append("\">");
+         }
+         if (strong) {
+-            retlink.append("<STRONG>");
++            retlink.append("<span class=\"strong\">");
+         }
+         retlink.append(label);
+         if (strong) {
+-            retlink.append("</STRONG>");
++            retlink.append("</span>");
+         }
+         if (stylename != null && stylename.length() != 0) {
+             retlink.append("</FONT>");
+         }
+-        retlink.append("</A>");
++        retlink.append("</a>");
+         return retlink.toString();
+     }
+ 
+     /**
+-     * Print link without positioning in the file.
++     * Get Html Hyper Link.
+      *
+      * @param link       String name of the file.
++     * @param where      Position of the link in the file. Character '#' is not
++     *                   needed.
+      * @param label      Tag for the link.
++     * @param title      String that describes the link's content for accessibility.
++     * @param target     Target frame.
++     * @return a content tree for the hyper link.
+      */
+-    public void printHyperLink(String link, String label) {
+-        print(getHyperLink(link, "", label, false));
++    public Content getHyperLink(String link, String where,
++            Content label, String title, String target) {
++        if (where != null && where.length() != 0) {
++            link += "#" + where;
++        }
++        HtmlTree anchor = HtmlTree.A(link, label);
++        if (title != null && title.length() != 0) {
++            anchor.addAttr(HtmlAttr.TITLE, title);
++        }
++        if (target != null && target.length() != 0) {
++            anchor.addAttr(HtmlAttr.TARGET, target);
++        }
++        return anchor;
++    }
++
++    /**
++     * Get a hyperlink to a file.
++     *
++     * @param link String name of the file
++     * @param label Label for the link
++     * @return a content for the hyperlink to the file
++     */
++    public Content getHyperLink(String link, Content label) {
++        return getHyperLink(link, "", label);
+     }
+ 
+     /**
+@@ -217,8 +258,8 @@
+      * @param label      Tag for the link.
+      * @return Strign    Hyper link.
+      */
+-    public String getHyperLink(String link, String label) {
+-        return getHyperLink(link, "", label, false);
++    public String getHyperLinkString(String link, String label) {
++        return getHyperLinkString(link, "", label, false);
+     }
+ 
+     /**
+@@ -273,54 +314,32 @@
+      * Print the frameset version of the Html file header.
+      * Called only when generating an HTML frameset file.
+      *
+-     * @param title    Title of this HTML document.
++     * @param title Title of this HTML document
++     * @param noTimeStamp If true, don't print time stamp in header
++     * @param frameset the frameset to be added to the HTML document
+      */
+-    public void printFramesetHeader(String title) {
+-        printFramesetHeader(title, false);
+-    }
+-
+-    /**
+-     * Print the frameset version of the Html file header.
+-     * Called only when generating an HTML frameset file.
+-     *
+-     * @param title        Title of this HTML document.
+-     * @param noTimeStamp  If true, don't print time stamp in header.
+-     */
+-    public void printFramesetHeader(String title, boolean noTimeStamp) {
+-        println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 " +
+-                    "Frameset//EN\" " +
+-                    "\"http://www.w3.org/TR/html4/frameset.dtd\">");
+-        println("<!--NewPage-->");
+-        html();
+-        head();
++    public void printFramesetDocument(String title, boolean noTimeStamp,
++            Content frameset) {
++        Content htmlDocType = DocType.Frameset();
++        Content htmlComment = new Comment(configuration.getText("doclet.New_Page"));
++        Content head = new HtmlTree(HtmlTag.HEAD);
+         if (! noTimeStamp) {
+-            print("<!-- Generated by javadoc on ");
+-            print(today());
+-            println("-->");
++            Content headComment = new Comment("Generated by javadoc on " + today());
++            head.addContent(headComment);
+         }
+         if (configuration.charset.length() > 0) {
+-            println("<META http-equiv=\"Content-Type\" content=\"text/html; "
+-                        + "charset=" + configuration.charset + "\">");
++            Content meta = HtmlTree.META("Content-Type", "text/html",
++                    configuration.charset);
++            head.addContent(meta);
+         }
+-        title();
+-        println(title);
+-        titleEnd();
+-        //Script to set the classFrame if necessary.
+-        script();
+-        println("    targetPage = \"\" + window.location.search;");
+-        println("    if (targetPage != \"\" && targetPage != \"undefined\")");
+-        println("        targetPage = targetPage.substring(1);");
+-        println("    if (targetPage.indexOf(\":\") != -1)");
+-        println("        targetPage = \"undefined\";");
+-
+-        println("    function loadFrames() {");
+-        println("        if (targetPage != \"\" && targetPage != \"undefined\")");
+-        println("             top.classFrame.location = top.targetPage;");
+-        println("    }");
+-        scriptEnd();
+-        noScript();
+-        noScriptEnd();
+-        headEnd();
++        Content windowTitle = HtmlTree.TITLE(new StringContent(title));
++        head.addContent(windowTitle);
++        head.addContent(getFramesetJavaScript());
++        Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(),
++                head, frameset);
++        Content htmlDocument = new HtmlDocument(htmlDocType,
++                htmlComment, htmlTree);
++        print(htmlDocument.toString());
+     }
+ 
+     /**
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocument.java b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocument.java
+new file mode 100644
+--- /dev/null
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocument.java
+@@ -0,0 +1,103 @@
++/*
++ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute 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.markup;
++
++import java.util.*;
++import com.sun.tools.doclets.internal.toolkit.Content;
++import com.sun.tools.doclets.internal.toolkit.util.*;
++
++/**
++ * Class for generating an HTML document for javadoc output.
++ *
++ * @author Bhavesh Patel
++ */
++public class HtmlDocument extends Content {
++
++    private List<Content> docContent = Collections.<Content>emptyList();
++
++    /**
++     * Constructor to construct an HTML document.
++     *
++     * @param docType document type for the HTML document
++     * @param docComment comment for the document
++     * @param htmlTree HTML tree of the document
++     */
++    public HtmlDocument(Content docType, Content docComment, Content htmlTree) {
++        docContent = new ArrayList<Content>();
++        addContent(nullCheck(docType));
++        addContent(nullCheck(docComment));
++        addContent(nullCheck(htmlTree));
++    }
++
++    /**
++     * Constructor to construct an HTML document.
++     *
++     * @param docType document type for the HTML document
++     * @param htmlTree HTML tree of the document
++     */
++    public HtmlDocument(Content docType, Content htmlTree) {
++        docContent = new ArrayList<Content>();
++        addContent(nullCheck(docType));
++        addContent(nullCheck(htmlTree));
++    }
++
++    /**
++     * Adds content for the HTML document.
++     *
++     * @param htmlContent html content to be added
++     */
++    public void addContent(Content htmlContent) {
++        if (htmlContent.isValid())
++            docContent.add(htmlContent);
++    }
++
++    /**
++     * This method is not supported by the class.
++     *
++     * @param stringContent string content that needs to be added
++     * @throws DocletAbortException this method will always throw a
++     *                              DocletAbortException because it
++     *                              is not supported.
++     */
++    public void addContent(String stringContent) {
++        throw new DocletAbortException();
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public boolean isEmpty() {
++        return (docContent.isEmpty());
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public void write(StringBuilder contentBuilder) {
++        for (Content c : docContent)
++            c.write(contentBuilder);
++    }
++}
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java
+new file mode 100644
+--- /dev/null
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java
+@@ -0,0 +1,73 @@
++/*
++ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute 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.markup;
++
++/**
++ * Enum representing HTML styles. The name map to values in the CSS file.
++ *
++ * @author Bhavesh Patel
++ */
++public enum HtmlStyle {
++    aboutLanguage,
++    altColor,
++    bar,
++    block,
++    blockList,
++    blockListLast,
++    bottomNav,
++    classUseContainer,
++    colFirst,
++    colLast,
++    colOne,
++    constantValuesContainer,
++    contentContainer,
++    description,
++    details,
++    header,
++    horizontal,
++    footer,
++    indexContainer,
++    indexHeader,
++    inheritance,
++    legalCopy,
++    nameValue,
++    navBarCell1Rev,
++    navList,
++    overviewSummary,
++    packageSummary,
++    rowColor,
++    serializedFormContainer,
++    sourceContainer,
++    sourceLineNo,
++    strong,
++    subNav,
++    subNavList,
++    subTitle,
++    summary,
++    tabEnd,
++    title,
++    topNav;
++}
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTag.java b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTag.java
+new file mode 100644
+--- /dev/null
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTag.java
+@@ -0,0 +1,126 @@
++/*
++ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute 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.markup;
++
++/**
++ * Enum representing HTML tags.
++ *
++ * @author Bhavesh Patel
++ */
++public enum HtmlTag {
++    A(BlockType.INLINE, EndTag.END),
++    BLOCKQUOTE,
++    BODY(BlockType.OTHER, EndTag.END),
++    BR(BlockType.INLINE, EndTag.NOEND),
++    CAPTION,
++    CENTER,
++    CODE(BlockType.INLINE, EndTag.END),
++    DD,
++    DIV,
++    DL,
++    DT,
++    EM(BlockType.INLINE, EndTag.END),
++    FONT(BlockType.INLINE, EndTag.END),
++    FRAME(BlockType.OTHER, EndTag.NOEND),
++    FRAMESET(BlockType.OTHER, EndTag.END),
++    H1,
++    H2,
++    H3,
++    H4,
++    H5,
++    H6,
++    HEAD(BlockType.OTHER, EndTag.END),
++    HR(BlockType.BLOCK, EndTag.NOEND),
++    HTML(BlockType.OTHER, EndTag.END),
++    I(BlockType.INLINE, EndTag.END),
++    IMG(BlockType.INLINE, EndTag.NOEND),
++    LI,
++    LINK(BlockType.OTHER, EndTag.NOEND),
++    MENU,
++    META(BlockType.OTHER, EndTag.NOEND),
++    NOFRAMES(BlockType.OTHER, EndTag.END),
++    NOSCRIPT(BlockType.OTHER, EndTag.END),
++    OL,
++    P,
++    PRE,
++    SCRIPT(BlockType.OTHER, EndTag.END),
++    SMALL(BlockType.INLINE, EndTag.END),
++    SPAN(BlockType.INLINE, EndTag.END),
++    STRONG(BlockType.INLINE, EndTag.END),
++    TABLE,
++    TBODY,
++    TD,
++    TH,
++    TITLE(BlockType.OTHER, EndTag.END),
++    TR,
++    TT(BlockType.INLINE, EndTag.END),
++    UL;
++
++    protected final BlockType blockType;
++    protected final EndTag endTag;
++    private final String value;
++
++    /**
++     * Enum representing the type of HTML element.
++     */
++    protected static enum BlockType {
++        BLOCK,
++        INLINE,
++        OTHER;
++    }
++
++    /**
++     * Enum representing HTML end tag requirement.
++     */
++    protected static enum EndTag {
++        END,
++        NOEND;
++    }
++
++    HtmlTag() {
++        this(BlockType.BLOCK, EndTag.END);
++    }
++
++    HtmlTag(BlockType blockType, EndTag endTag ) {
++        this.blockType = blockType;
++        this.endTag = endTag;
++        this.value = name().toLowerCase();
++    }
++
++    /**
++     * Returns true if the end tag is required. This is specific to the standard
++     * doclet and does not exactly resemble the W3C specifications.
++     *
++     * @return true if end tag needs to be displayed else return false
++     */
++    public boolean endTagRequired() {
++        return (endTag == EndTag.END);
++    }
++
++    public String toString() {
++        return value;
++    }
++}
+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
+new file mode 100644
+--- /dev/null
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java
+@@ -0,0 +1,777 @@
++/*
++ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute 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.markup;
++
++import java.util.*;
++import com.sun.tools.doclets.internal.toolkit.Content;
++import com.sun.tools.doclets.internal.toolkit.util.*;
++
++/**
++ * Class for generating HTML tree for javadoc output.
++ *
++ * @author Bhavesh Patel
++ */
++public class HtmlTree extends Content {
++
++    private HtmlTag htmlTag;
++    private Map<HtmlAttr,String> attrs = Collections.<HtmlAttr,String>emptyMap();
++    private List<Content> content = Collections.<Content>emptyList();
++    public static final Content EMPTY = new StringContent("");
++
++    /**
++     * Constructor to construct HtmlTree object.
++     *
++     * @param tag HTML tag for the HtmlTree object
++     */
++    public HtmlTree(HtmlTag tag) {
++        htmlTag = nullCheck(tag);
++    }
++
++    /**
++     * Constructor to construct HtmlTree object.
++     *
++     * @param tag HTML tag for the HtmlTree object
++     * @param contents contents to be added to the tree
++     */
++    public HtmlTree(HtmlTag tag, Content... contents) {
++        this(tag);
++        for (Content content: contents)
++            addContent(content);
++    }
++
++    /**
++     * Adds an attribute for the HTML tag.
++     *
++     * @param attrName name of the attribute
++     * @param attrValue value of the attribute
++     */
++    public void addAttr(HtmlAttr attrName, String attrValue) {
++        if (attrs.isEmpty())
++            attrs = new LinkedHashMap<HtmlAttr,String>();
++        attrs.put(nullCheck(attrName), nullCheck(attrValue));
++    }
++
++    /**
++     * Adds a style for the HTML tag.
++     *
++     * @param style style to be added
++     */
++    public void addStyle(HtmlStyle style) {
++        addAttr(HtmlAttr.CLASS, style.toString());
++    }
++
++    /**
++     * Adds content for the HTML tag.
++     *
++     * @param tagContent tag content to be added
++     */
++    public void addContent(Content tagContent) {
++        if (tagContent == HtmlTree.EMPTY || tagContent.isValid()) {
++            if (content.isEmpty())
++                content = new ArrayList<Content>();
++            content.add(tagContent);
++        }
++    }
++
++    /**
++     * This method adds a string content to the htmltree. If the last content member
++     * added is a StringContent, append the string to that StringContent or else
++     * create a new StringContent and add it to the html tree.
++     *
++     * @param stringContent string content that needs to be added
++     */
++    public void addContent(String stringContent) {
++        if (!content.isEmpty()) {
++            Content lastContent = content.get(content.size() - 1);
++            if (lastContent instanceof StringContent)
++                lastContent.addContent(stringContent);
++            else
++                addContent(new StringContent(stringContent));
++        }
++        else
++            addContent(new StringContent(stringContent));
++    }
++
++    /**
++     * Generates an HTML anchor tag.
++     *
++     * @param ref reference url for the anchor tag
++     * @param body content for the anchor tag
++     * @return an HtmlTree object
++     */
++    public static HtmlTree A(String ref, Content body) {
++        HtmlTree htmltree = new HtmlTree(HtmlTag.A, nullCheck(body));
++        htmltree.addAttr(HtmlAttr.HREF, nullCheck(ref));
++        return htmltree;
++    }
++
++    /**
++     * Generates an HTML anchor tag with name attribute and content.
++     *
++     * @param name name for the anchor tag
++     * @param body content for the anchor tag
++     * @return an HtmlTree object
++     */
++    public static HtmlTree A_NAME(String name, Content body) {
++        HtmlTree htmltree = HtmlTree.A_NAME(name);
++        htmltree.addContent(nullCheck(body));
++        return htmltree;
++    }
++
++    /**
++     * Generates an HTML anchor tag with name attribute.
++     *
++     * @param name name for the anchor tag
++     * @return an HtmlTree object
++     */
++    public static HtmlTree A_NAME(String name) {
++        HtmlTree htmltree = new HtmlTree(HtmlTag.A);
++        htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
++        return htmltree;
++    }
++
++    /**
++     * Generates a CAPTION tag with some content.
++     *
++     * @param body content for the tag
++     * @return an HtmlTree object for the CAPTION tag
++     */
++    public static HtmlTree CAPTION(Content body) {
++        HtmlTree htmltree = new HtmlTree(HtmlTag.CAPTION, nullCheck(body));
++        return htmltree;
++    }
++
++    /**
++     * Generates a CODE tag with some content.
++     *
++     * @param body content for the tag
++     * @return an HtmlTree object for the CODE tag
++     */
++    public static HtmlTree CODE(Content body) {
++        HtmlTree htmltree = new HtmlTree(HtmlTag.CODE, nullCheck(body));
++        return htmltree;
++    }
++
++    /**
++     * Generates a DD tag with some content.
++     *
++     * @param body content for the tag
++     * @return an HtmlTree object for the DD tag
++     */
++    public static HtmlTree DD(Content body) {
++        HtmlTree htmltree = new HtmlTree(HtmlTag.DD, nullCheck(body));
++        return htmltree;
++    }
++
++    /**
++     * Generates a DL tag with some content.
++     *
++     * @param body content for the tag
++     * @return an HtmlTree object for the DL tag
++     */
++    public static HtmlTree DL(Content body) {
++        HtmlTree htmltree = new HtmlTree(HtmlTag.DL, nullCheck(body));
++        return htmltree;
++    }
++
++    /**
++     * Generates a DIV tag with the style class attributes. It also encloses
++     * a content.
++     *
++     * @param styleClass stylesheet class for the tag
++     * @param body content for the tag
++     * @return an HtmlTree object for the DIV tag
++     */
++    public static HtmlTree DIV(HtmlStyle styleClass, Content body) {
++        HtmlTree htmltree = new HtmlTree(HtmlTag.DIV, nullCheck(body));
++        if (styleClass != null)
++            htmltree.addStyle(styleClass);
++        return htmltree;
++    }
++
++    /**
++     * Generates a DIV tag with some content.
++     *
++     * @param body content for the tag
++     * @return an HtmlTree object for the DIV tag
++     */
++    public static HtmlTree DIV(Content body) {
++        return DIV(null, body);
++    }
++
++    /**
++     * Generates a DT tag with some content.
++     *
++     * @param body content for the tag
++     * @return an HtmlTree object for the DT tag
++     */
++    public static HtmlTree DT(Content body) {
++        HtmlTree htmltree = new HtmlTree(HtmlTag.DT, nullCheck(body));
++        return htmltree;
++    }
++
++    /**
++     * Generates a EM tag with some content.
++     *
++     * @param body content to be added to the tag
++     * @return an HtmlTree object for the EM tag
++     */
++    public static HtmlTree EM(Content body) {
++        HtmlTree htmltree = new HtmlTree(HtmlTag.EM, nullCheck(body));
++        return htmltree;
++    }
++
++    /**
++     * Generates a FRAME tag.
++     *
++     * @param src the url of the document to be shown in the frame
++     * @param name specifies the name of the frame
++     * @param title the title for the frame
++     * @param scrolling specifies whether to display scrollbars in the frame
++     * @return an HtmlTree object for the FRAME tag
++     */
++    public static HtmlTree FRAME(String src, String name, String title, String scrolling) {
++        HtmlTree htmltree = new HtmlTree(HtmlTag.FRAME);
++        htmltree.addAttr(HtmlAttr.SRC, nullCheck(src));
++        htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
++        htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
++        if (scrolling != null)
++            htmltree.addAttr(HtmlAttr.SCROLLING, scrolling);
++        return htmltree;
++    }
++
++    /**
++     * Generates a Frame tag.
++     *
++     * @param src the url of the document to be shown in the frame
++     * @param name specifies the name of the frame
++     * @param title the title for the frame
++     * @return an HtmlTree object for the SPAN tag
++     */
++    public static HtmlTree FRAME(String src, String name, String title) {
++        return FRAME(src, name, title, null);
++    }
++
++    /**
++     * Generates a FRAMESET tag.
++     *
++     * @param cols the size of columns in the frameset
++     * @param rows the size of rows in the frameset
++     * @param title the title for the frameset
++     * @param onload the script to run when the document loads
++     * @return an HtmlTree object for the FRAMESET tag
++     */
++    public static HtmlTree FRAMESET(String cols, String rows, String title, String onload) {
++        HtmlTree htmltree = new HtmlTree(HtmlTag.FRAMESET);
++        if (cols != null)
++            htmltree.addAttr(HtmlAttr.COLS, cols);
++        if (rows != null)
++            htmltree.addAttr(HtmlAttr.ROWS, rows);
++        htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
++        htmltree.addAttr(HtmlAttr.ONLOAD, nullCheck(onload));
++        return htmltree;
++    }
++
++    /**
++     * Generates a heading tag (h1 to h6) with the title and style class attributes. It also encloses
++     * a content.
++     *
++     * @param headingTag the heading tag to be generated
++     * @param printTitle true if title for the tag needs to be printed else false
++     * @param styleClass stylesheet class for the tag
++     * @param body content for the tag
++     * @return an HtmlTree object for the tag
++     */
++    public static HtmlTree HEADING(HtmlTag headingTag, boolean printTitle,
++            HtmlStyle styleClass, Content body) {
++        HtmlTree htmltree = new HtmlTree(headingTag, nullCheck(body));
++        if (printTitle)
++            htmltree.addAttr(HtmlAttr.TITLE, Util.stripHtml(body.toString()));
++        if (styleClass != null)
++            htmltree.addStyle(styleClass);
++        return htmltree;
++    }
++
++    /**
++     * Generates a heading tag (h1 to h6) with style class attribute. It also encloses
++     * a content.
++     *
++     * @param headingTag the heading tag to be generated
++     * @param styleClass stylesheet class for the tag
++     * @param body content for the tag
++     * @return an HtmlTree object for the tag
++     */
++    public static HtmlTree HEADING(HtmlTag headingTag, HtmlStyle styleClass, Content body) {
++        return HEADING(headingTag, false, styleClass, body);
++    }
++
++    /**
++     * Generates a heading tag (h1 to h6) with the title attribute. It also encloses
++     * a content.
++     *
++     * @param headingTag the heading tag to be generated
++     * @param printTitle true if the title for the tag needs to be printed else false
++     * @param body content for the tag
++     * @return an HtmlTree object for the tag
++     */
++    public static HtmlTree HEADING(HtmlTag headingTag, boolean printTitle, Content body) {
++        return HEADING(headingTag, printTitle, null, body);
++    }
++
++    /**
++     * Generates a heading tag (h1 to h6)  with some content.
++     *
++     * @param headingTag the heading tag to be generated
++     * @param body content for the tag
++     * @return an HtmlTree object for the tag
++     */
++    public static HtmlTree HEADING(HtmlTag headingTag, Content body) {
++        return HEADING(headingTag, false, null, body);
++    }
++
++    /**
++     * Generates an HTML tag with lang attribute. It also adds head and body
++     * content to the HTML tree.
++     *
++     * @param lang language for the HTML document
++     * @param head head for the HTML tag
++     * @param body body for the HTML tag
++     * @return an HtmlTree object for the HTML tag
++     */
++    public static HtmlTree HTML(String lang, Content head, Content body) {
++        HtmlTree htmltree = new HtmlTree(HtmlTag.HTML, nullCheck(head), nullCheck(body));
++        htmltree.addAttr(HtmlAttr.LANG, nullCheck(lang));
++        return htmltree;
++    }
++
++    /**
++     * Generates a I tag with some content.
++     *
++     * @param body content for the tag
++     * @return an HtmlTree object for the I tag
++     */
++    public static HtmlTree I(Content body) {
++        HtmlTree htmltree = new HtmlTree(HtmlTag.I, nullCheck(body));
++        return htmltree;
++    }
++
++    /**
++     * Generates a LI tag with some content.
++     *
++     * @param body content for the tag
++     * @return an HtmlTree object for the LI tag
++     */
++    public static HtmlTree LI(Content body) {
++        return LI(null, body);
++    }
++
++    /**
++     * Generates a LI tag with some content.
++     *
++     * @param styleClass style for the tag
++     * @param body content for the tag
++     * @return an HtmlTree object for the LI tag
++     */
++    public static HtmlTree LI(HtmlStyle styleClass, Content body) {
++        HtmlTree htmltree = new HtmlTree(HtmlTag.LI, nullCheck(body));
++        if (styleClass != null)
++            htmltree.addStyle(styleClass);
++        return htmltree;
++    }
++
++    /**
++     * Generates a LINK tag with the rel, type, href and title attributes.
++     *
++     * @param rel relevance of the link
++     * @param type type of link
++     * @param href the path for the link
++     * @param title title for the link
++     * @return an HtmlTree object for the LINK tag
++     */
++    public static HtmlTree LINK(String rel, String type, String href, String title) {
++        HtmlTree htmltree = new HtmlTree(HtmlTag.LINK);
++        htmltree.addAttr(HtmlAttr.REL, nullCheck(rel));
++        htmltree.addAttr(HtmlAttr.TYPE, nullCheck(type));
++        htmltree.addAttr(HtmlAttr.HREF, nullCheck(href));
++        htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
++        return htmltree;
++    }
++
++    /**
++     * Generates a META tag with the http-equiv, content and charset attributes.
++     *
++     * @param http-equiv http equiv attribute for the META tag
++     * @param content type of content
++     * @param charset character set used
++     * @return an HtmlTree object for the META tag
++     */
++    public static HtmlTree META(String httpEquiv, String content, String charSet) {
++        HtmlTree htmltree = new HtmlTree(HtmlTag.META);
++        htmltree.addAttr(HtmlAttr.HTTP_EQUIV, nullCheck(httpEquiv));
++        htmltree.addAttr(HtmlAttr.CONTENT, nullCheck(content));
++        htmltree.addAttr(HtmlAttr.CHARSET, nullCheck(charSet));
++        return htmltree;
++    }
++
++    /**
++     * Generates a META tag with the name and content attributes.
++     *
++     * @param name name attribute
++     * @param content type of content
++     * @return an HtmlTree object for the META tag
++     */
++    public static HtmlTree META(String name, String content) {
++        HtmlTree htmltree = new HtmlTree(HtmlTag.META);
++        htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
++        htmltree.addAttr(HtmlAttr.CONTENT, nullCheck(content));
++        return htmltree;
++    }
++
++    /**
++     * Generates a NOSCRIPT tag with some content.
++     *
++     * @param body content of the noscript tag
++     * @return an HtmlTree object for the NOSCRIPT tag
++     */
++    public static HtmlTree NOSCRIPT(Content body) {
++        HtmlTree htmltree = new HtmlTree(HtmlTag.NOSCRIPT, nullCheck(body));
++        return htmltree;
++    }
++
++    /**
++     * Generates a P tag with some content.
++     *
++     * @param body content of the Paragraph tag
++     * @return an HtmlTree object for the P tag
++     */
++    public static HtmlTree P(Content body) {
++        return P(null, body);
++    }
++
++    /**
++     * Generates a P tag with some content.
++     *
++     * @param styleClass style of the Paragraph tag
++     * @param body content of the Paragraph tag
++     * @return an HtmlTree object for the P tag
++     */
++    public static HtmlTree P(HtmlStyle styleClass, Content body) {
++        HtmlTree htmltree = new HtmlTree(HtmlTag.P, nullCheck(body));
++        if (styleClass != null)
++            htmltree.addStyle(styleClass);
++        return htmltree;
++    }
++
++    /**
++     * Generates a SMALL tag with some content.
++     *
++     * @param body content for the tag
++     * @return an HtmlTree object for the SMALL tag
++     */
++    public static HtmlTree SMALL(Content body) {
++        HtmlTree htmltree = new HtmlTree(HtmlTag.SMALL, nullCheck(body));
++        return htmltree;
++    }
++
++    /**
++     * Generates a STRONG tag with some content.
++     *
++     * @param body content for the tag
++     * @return an HtmlTree object for the STRONG tag
++     */
++    public static HtmlTree STRONG(Content body) {
++        HtmlTree htmltree = new HtmlTree(HtmlTag.STRONG, nullCheck(body));
++        return htmltree;
++    }
++
++    /**
++     * Generates a SPAN tag with some content.
++     *
++     * @param body content for the tag
++     * @return an HtmlTree object for the SPAN tag
++     */
++    public static HtmlTree SPAN(Content body) {
++        return SPAN(null, body);
++    }
++
++    /**
++     * Generates a SPAN tag with style class attribute and some content.
++     *
++     * @param styleClass style class for the tag
++     * @param body content for the tag
++     * @return an HtmlTree object for the SPAN tag
++     */
++    public static HtmlTree SPAN(HtmlStyle styleClass, Content body) {
++        HtmlTree htmltree = new HtmlTree(HtmlTag.SPAN, nullCheck(body));
++        if (styleClass != null)
++            htmltree.addStyle(styleClass);
++        return htmltree;
++    }
++
++    /**
++     * Generates a Table tag with border, width and summary attributes and
++     * some content.
++     *
++     * @param border border for the table
++     * @param width width of the table
++     * @param summary summary for the table
++     * @param body content for the table
++     * @return an HtmlTree object for the TABLE tag
++     */
++    public static HtmlTree TABLE(int border, int width, String summary,
++            Content body) {
++        HtmlTree htmltree = new HtmlTree(HtmlTag.TABLE, nullCheck(body));
++        htmltree.addAttr(HtmlAttr.BORDER, Integer.toString(border));
++        htmltree.addAttr(HtmlAttr.WIDTH, Integer.toString(width));
++        htmltree.addAttr(HtmlAttr.SUMMARY, nullCheck(summary));
++        return htmltree;
++    }
++
++    /**
++     * Generates a Table tag with style class, border, cell padding,
++     * cellspacing and summary attributes and some content.
++     *
++     * @param styleClass style of the table
++     * @param border border for the table
++     * @param cellPadding cell padding for the table
++     * @param cellSpacing cell spacing for the table
++     * @param summary summary for the table
++     * @param body content for the table
++     * @return an HtmlTree object for the TABLE tag
++     */
++    public static HtmlTree TABLE(HtmlStyle styleClass, int border, int cellPadding,
++            int cellSpacing, String summary, Content body) {
++        HtmlTree htmltree = new HtmlTree(HtmlTag.TABLE, nullCheck(body));
++        if (styleClass != null)
++            htmltree.addStyle(styleClass);
++        htmltree.addAttr(HtmlAttr.BORDER, Integer.toString(border));
++        htmltree.addAttr(HtmlAttr.CELLPADDING, Integer.toString(cellPadding));
++        htmltree.addAttr(HtmlAttr.CELLSPACING, Integer.toString(cellSpacing));
++        htmltree.addAttr(HtmlAttr.SUMMARY, nullCheck(summary));
++        return htmltree;
++    }
++
++    /**
++     * Generates a Table tag with border, cell padding,
++     * cellspacing and summary attributes and some content.
++     *
++     * @param border border for the table
++     * @param cellPadding cell padding for the table
++     * @param cellSpacing cell spacing for the table
++     * @param summary summary for the table
++     * @param body content for the table
++     * @return an HtmlTree object for the TABLE tag
++     */
++    public static HtmlTree TABLE(int border, int cellPadding,
++            int cellSpacing, String summary, Content body) {
++        return TABLE(null, border, cellPadding, cellSpacing, summary, body);
++    }
++
++    /**
++     * Generates a TD tag with style class attribute and some content.
++     *
++     * @param styleClass style for the tag
++     * @param body content for the tag
++     * @return an HtmlTree object for the TD tag
++     */
++    public static HtmlTree TD(HtmlStyle styleClass, Content body) {
++        HtmlTree htmltree = new HtmlTree(HtmlTag.TD, nullCheck(body));
++        if (styleClass != null)
++            htmltree.addStyle(styleClass);
++        return htmltree;
++    }
++
++    /**
++     * Generates a TD tag for an HTML table with some content.
++     *
++     * @param body content for the tag
++     * @return an HtmlTree object for the TD tag
++     */
++    public static HtmlTree TD(Content body) {
++        return TD(null, body);
++    }
++
++    /**
++     * Generates a TH tag with style class and scope attributes and some content.
++     *
++     * @param styleClass style for the tag
++     * @param scope scope of the tag
++     * @param body content for the tag
++     * @return an HtmlTree object for the TH tag
++     */
++    public static HtmlTree TH(HtmlStyle styleClass, String scope, Content body) {
++        HtmlTree htmltree = new HtmlTree(HtmlTag.TH, nullCheck(body));
++        if (styleClass != null)
++            htmltree.addStyle(styleClass);
++        htmltree.addAttr(HtmlAttr.SCOPE, nullCheck(scope));
++        return htmltree;
++    }
++
++    /**
++     * Generates a TH tag with scope attribute and some content.
++     *
++     * @param scope scope of the tag
++     * @param body content for the tag
++     * @return an HtmlTree object for the TH tag
++     */
++    public static HtmlTree TH(String scope, Content body) {
++        return TH(null, scope, body);
++    }
++
++    /**
++     * Generates a TITLE tag with some content.
++     *
++     * @param body content for the tag
++     * @return an HtmlTree object for the TITLE tag
++     */
++    public static HtmlTree TITLE(Content body) {
++        HtmlTree htmltree = new HtmlTree(HtmlTag.TITLE, nullCheck(body));
++        return htmltree;
++    }
++
++    /**
++     * Generates a TR tag for an HTML table with some content.
++     *
++     * @param body content for the tag
++     * @return an HtmlTree object for the TR tag
++     */
++    public static HtmlTree TR(Content body) {
++        HtmlTree htmltree = new HtmlTree(HtmlTag.TR, nullCheck(body));
++        return htmltree;
++    }
++
++    /**
++     * Generates a UL tag with the style class attribute and some content.
++     *
++     * @param styleClass style for the tag
++     * @param body content for the tag
++     * @return an HtmlTree object for the UL tag
++     */
++    public static HtmlTree UL(HtmlStyle styleClass, Content body) {
++        HtmlTree htmltree = new HtmlTree(HtmlTag.UL, nullCheck(body));
++        htmltree.addStyle(nullCheck(styleClass));
++        return htmltree;
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public boolean isEmpty() {
++        return (!hasContent() && !hasAttrs());
++    }
++
++    /**
++     * Returns true if the HTML tree has content.
++     *
++     * @return true if the HTML tree has content else return false
++     */
++    public boolean hasContent() {
++        return (!content.isEmpty());
++    }
++
++    /**
++     * Returns true if the HTML tree has attributes.
++     *
++     * @return true if the HTML tree has attributes else return false
++     */
++    public boolean hasAttrs() {
++        return (!attrs.isEmpty());
++    }
++
++    /**
++     * Returns true if the HTML tree has a specific attribute.
++     *
++     * @param attrName name of the attribute to check within the HTML tree
++     * @return true if the HTML tree has the specified attribute else return false
++     */
++    public boolean hasAttr(HtmlAttr attrName) {
++        return (attrs.containsKey(attrName));
++    }
++
++    /**
++     * Returns true if the HTML tree is valid. This check is more specific to
++     * standard doclet and not exactly similar to W3C specifications. But it
++     * ensures HTML validation.
++     *
++     * @return true if the HTML tree is valid
++     */
++    public boolean isValid() {
++        switch (htmlTag) {
++            case A :
++                return (hasAttr(HtmlAttr.NAME) || (hasAttr(HtmlAttr.HREF) && hasContent()));
++            case BR :
++                return (!hasContent() && (!hasAttrs() || hasAttr(HtmlAttr.CLEAR)));
++            case FRAME :
++                return (hasAttr(HtmlAttr.SRC) && !hasContent());
++            case HR :
++                return (!hasContent());
++            case IMG :
++                return (hasAttr(HtmlAttr.SRC) && hasAttr(HtmlAttr.ALT) && !hasContent());
++            case LINK :
++                return (hasAttr(HtmlAttr.HREF) && !hasContent());
++            case META :
++                return (hasAttr(HtmlAttr.CONTENT) && !hasContent());
++            default :
++                return hasContent();
++        }
++    }
++
++    /**
++     * Returns true if the element is an inline element.
++     *
++     * @return true if the HTML tag is an inline element
++     */
++    public boolean isInline() {
++        return (htmlTag.blockType == HtmlTag.BlockType.INLINE);
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public void write(StringBuilder contentBuilder) {
++        if (!isInline() && !endsWithNewLine(contentBuilder))
++            contentBuilder.append("\n");
++        String tagString = htmlTag.toString();
++        contentBuilder.append("<" + tagString);
++        Iterator<HtmlAttr> iterator = attrs.keySet().iterator();
++        HtmlAttr key;
++        String value = "";
++        while (iterator.hasNext()) {
++            key = iterator.next();
++            value = attrs.get(key);
++            contentBuilder.append(" " + key.toString());
++            if (!value.isEmpty())
++                contentBuilder.append("=\"" + value + "\"");
++        }
++        contentBuilder.append(">");
++        for (Content c : content)
++            c.write(contentBuilder);
++        if (htmlTag.endTagRequired())
++            contentBuilder.append("</" + tagString + ">");
++        if (!isInline())
++            contentBuilder.append("\n");
++    }
++}
+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
+@@ -55,7 +55,7 @@
+      * URL file separator string("/").
+      */
+     public static final String fileseparator =
+-         DirectoryManager.URL_FILE_SEPERATOR;
++         DirectoryManager.URL_FILE_SEPARATOR;
+ 
+     /**
+      * The configuration
+@@ -82,6 +82,72 @@
+      */
+     protected final String modifierTypeHeader;
+ 
++    public final Content overviewLabel;
++
++    public final Content defaultPackageLabel;
++
++    public final Content packageLabel;
++
++    public final Content useLabel;
++
++    public final Content prevLabel;
++
++    public final Content nextLabel;
++
++    public final Content prevclassLabel;
++
++    public final Content nextclassLabel;
++
++    public final Content summaryLabel;
++
++    public final Content detailLabel;
++
++    public final Content framesLabel;
++
++    public final Content noframesLabel;
++
++    public final Content treeLabel;
++
++    public final Content classLabel;
++
++    public final Content deprecatedLabel;
++
++    public final Content deprecatedPhrase;
++
++    public final Content allclassesLabel;
++
++    public final Content indexLabel;
++
++    public final Content helpLabel;
++
++    public final Content seeLabel;
++
++    public final Content descriptionLabel;
++
++    public final Content prevpackageLabel;
++
++    public final Content nextpackageLabel;
++
++    public final Content packagesLabel;
++
++    public final Content methodDetailsLabel;
++
++    public final Content annotationTypeDetailsLabel;
++
++    public final Content fieldDetailsLabel;
++
++    public final Content constructorDetailsLabel;
++
++    public final Content enumConstantsDetailsLabel;
++
++    public final Content specifiedByLabel;
++
++    public final Content overridesLabel;
++
++    public final Content descfrmClassLabel;
++
++    public final Content descfrmInterfaceLabel;
++
+     /**
+      * Constructor.
+      *
+@@ -111,6 +177,73 @@
+         modifierTypeHeader = configuration.getText("doclet.0_and_1",
+                 configuration.getText("doclet.Modifier"),
+                 configuration.getText("doclet.Type"));
++        overviewLabel = getResource("doclet.Overview");
++        defaultPackageLabel = new RawHtml(
++                DocletConstants.DEFAULT_PACKAGE_NAME);
++        packageLabel = getResource("doclet.Package");
++        useLabel = getResource("doclet.navClassUse");
++        prevLabel = getResource("doclet.Prev");
++        nextLabel = getResource("doclet.Next");
++        prevclassLabel = getResource("doclet.Prev_Class");
++        nextclassLabel = getResource("doclet.Next_Class");
++        summaryLabel = getResource("doclet.Summary");
++        detailLabel = getResource("doclet.Detail");
++        framesLabel = getResource("doclet.FRAMES");
++        noframesLabel = getResource("doclet.NO_FRAMES");
++        treeLabel = getResource("doclet.Tree");
++        classLabel = getResource("doclet.Class");
++        deprecatedLabel = getResource("doclet.navDeprecated");
++        deprecatedPhrase = getResource("doclet.Deprecated");
++        allclassesLabel = getResource("doclet.All_Classes");
++        indexLabel = getResource("doclet.Index");
++        helpLabel = getResource("doclet.Help");
++        seeLabel = getResource("doclet.See");
++        descriptionLabel = getResource("doclet.Description");
++        prevpackageLabel = getResource("doclet.Prev_Package");
++        nextpackageLabel = getResource("doclet.Next_Package");
++        packagesLabel = getResource("doclet.Packages");
++        methodDetailsLabel = getResource("doclet.Method_Detail");
++        annotationTypeDetailsLabel = getResource("doclet.Annotation_Type_Member_Detail");
++        fieldDetailsLabel = getResource("doclet.Field_Detail");
++        constructorDetailsLabel = getResource("doclet.Constructor_Detail");
++        enumConstantsDetailsLabel = getResource("doclet.Enum_Constant_Detail");
++        specifiedByLabel = getResource("doclet.Specified_By");
++        overridesLabel = getResource("doclet.Overrides");
++        descfrmClassLabel = getResource("doclet.Description_From_Class");
++        descfrmInterfaceLabel = getResource("doclet.Description_From_Interface");
++    }
++
++    /**
++     * Get the configuration string as a content.
++     *
++     * @param key the key to look for in the configuration file
++     * @return a content tree for the text
++     */
++    public Content getResource(String key) {
++        return new StringContent(configuration.getText(key));
++    }
++
++    /**
++     * Get the configuration string as a content.
++     *
++     * @param key the key to look for in the configuration file
++     * @param a1 string argument added to configuration text
++     * @return a content tree for the text
++     */
++    public Content getResource(String key, String a1) {
++        return new RawHtml(configuration.getText(key, a1));
++    }
++
++    /**
++     * Get the configuration string as a content.
++     *
++     * @param key the key to look for in the configuration file
++     * @param a1 string argument added to configuration text
++     * @param a2 string argument added to configuration text
++     * @return a content tree for the text
++     */
++    public Content getResource(String key, String a1, String a2) {
++        return new RawHtml(configuration.getText(key, a1, a2));
+     }
+ 
+     /**
+@@ -146,6 +279,48 @@
+     }
+ 
+     /**
++     * Returns an HtmlTree for the SCRIPT tag.
++     *
++     * @return an HtmlTree for the SCRIPT tag
++     */
++    protected HtmlTree getWinTitleScript(){
++        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";
++            RawHtml scriptContent = new RawHtml(scriptCode);
++            script.addContent(scriptContent);
++        }
++        return script;
++    }
++
++    /**
++     * Returns a content tree for the SCRIPT tag for the main page(index.html).
++     *
++     * @return a content for the SCRIPT tag
++     */
++    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";
++        RawHtml scriptContent = new RawHtml(scriptCode);
++        script.addContent(scriptContent);
++        return script;
++    }
++
++    /**
+      * Print the Javascript <SCRIPT> start tag with its type
+      * attribute.
+      */
+@@ -204,6 +379,28 @@
+     }
+ 
+     /**
++     * Returns an HtmlTree for the BODY tag.
++     *
++     * @param includeScript  set true if printing windowtitle script
++     * @param title title for the window
++     * @return an HtmlTree for the BODY tag
++     */
++    public HtmlTree getBody(boolean includeScript, String title) {
++        HtmlTree body = new HtmlTree(HtmlTag.BODY);
++        // Set window title string which is later printed
++        this.winTitle = title;
++        // Don't print windowtitle script for overview-frame, allclasses-frame
++        // and package-frame
++        if (includeScript) {
++            body.addContent(getWinTitleScript());
++            Content noScript = HtmlTree.NOSCRIPT(
++                    HtmlTree.DIV(getResource("doclet.No_Script_Message")));
++            body.addContent(noScript);
++        }
++        return body;
++    }
++
++    /**
+      * Print </BODY> tag. Add a newline character at the end.
+      */
+     public void bodyEnd() {
+@@ -228,6 +425,15 @@
+         title();
+     }
+ 
++    /**
++     * Returns an HtmlTree for the TITLE tag.
++     *
++     * @return an HtmlTree for the TITLE tag
++     */
++    public HtmlTree getTitle() {
++        HtmlTree title = HtmlTree.TITLE(new StringContent(winTitle));
++        return title;
++    }
+ 
+     /**
+      * Print </TITLE> tag. Add a newline character at the end.
+@@ -519,17 +725,17 @@
+     }
+ 
+     /**
+-     * Return, text passed, with Italics <I> and </I> tags, surrounding it.
+-     * So if the text passed is "Hi", then string returned will be "<I>Hi</I>".
++     * Return, text passed, with Italics <i> and </i> tags, surrounding it.
++     * So if the text passed is "Hi", then string returned will be "<i>Hi</i>".
+      *
+      * @param text String to be printed in between <I> and </I> tags.
+      */
+     public String italicsText(String text) {
+-        return "<I>" + text + "</I>";
++        return "<i>" + text + "</i>";
+     }
+ 
+     public String codeText(String text) {
+-        return "<CODE>" + text + "</CODE>";
++        return "<code>" + text + "</code>";
+     }
+ 
+     /**
+@@ -540,6 +746,13 @@
+     }
+ 
+     /**
++     * Return "&nbsp;", non-breaking space.
++     */
++    public Content getSpace() {
++        return RawHtml.nbsp;
++    }
++
++    /**
+      * Print <DL> tag. Add a newline character at the end.
+      */
+     public void dl() {
+@@ -1182,21 +1395,21 @@
+     }
+ 
+     /**
+-     * Get the "<CODE>" string.
++     * Get the "<code>" string.
+      *
+-     * @return String Return String "<CODE>";
++     * @return String Return String "<code>";
+      */
+     public String getCode() {
+-        return "<CODE>";
++        return "<code>";
+     }
+ 
+     /**
+-     * Get the "</CODE>" string.
++     * Get the "</code>" string.
+      *
+-     * @return String Return String "</CODE>";
++     * @return String Return String "</code>";
+      */
+     public String getCodeEnd() {
+-        return "</CODE>";
++        return "</code>";
+     }
+ 
+     /**
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/markup/RawHtml.java b/src/share/classes/com/sun/tools/doclets/formats/html/markup/RawHtml.java
+new file mode 100644
+--- /dev/null
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/RawHtml.java
+@@ -0,0 +1,88 @@
++/*
++ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute 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.markup;
++
++import com.sun.tools.doclets.internal.toolkit.Content;
++import com.sun.tools.doclets.internal.toolkit.util.*;
++
++/**
++ * Class for generating raw HTML content to be added to HTML pages of javadoc output.
++ *
++ * @author Bhavesh Patel
++ */
++public class RawHtml extends Content{
++
++    private String rawHtmlContent;
++
++    public static final Content nbsp = new RawHtml(" ");
++
++    /**
++     * Constructor to construct a RawHtml object.
++     *
++     * @param rawHtml raw HTML text to be added
++     */
++    public RawHtml(String rawHtml) {
++        rawHtmlContent = nullCheck(rawHtml);
++    }
++
++    /**
++     * This method is not supported by the class.
++     *
++     * @param content content that needs to be added
++     * @throws DocletAbortException this method will always throw a
++     *                              DocletAbortException because it
++     *                              is not supported.
++     */
++    public void addContent(Content content) {
++        throw new DocletAbortException();
++    }
++
++    /**
++     * This method is not supported by the class.
++     *
++     * @param stringContent string content that needs to be added
++     * @throws DocletAbortException this method will always throw a
++     *                              DocletAbortException because it
++     *                              is not supported.
++     */
++    public void addContent(String stringContent) {
++        throw new DocletAbortException();
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public boolean isEmpty() {
++        return rawHtmlContent.isEmpty();
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public void write(StringBuilder contentBuilder) {
++        contentBuilder.append(rawHtmlContent);
++    }
++}
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/markup/StringContent.java b/src/share/classes/com/sun/tools/doclets/formats/html/markup/StringContent.java
+new file mode 100644
+--- /dev/null
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/StringContent.java
+@@ -0,0 +1,99 @@
++/*
++ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute 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.markup;
++
++import com.sun.tools.doclets.internal.toolkit.Content;
++import com.sun.tools.doclets.internal.toolkit.util.*;
++
++/**
++ * Class for generating string content for HTML tags of javadoc output.
++ *
++ * @author Bhavesh Patel
++ */
++public class StringContent extends Content{
++
++    private StringBuilder stringContent;
++
++    /**
++     * Constructor to construct StringContent object.
++     */
++    public StringContent() {
++        stringContent = new StringBuilder();
++    }
++
++    /**
++     * Constructor to construct StringContent object with some initial content.
++     *
++     * @param initialContent initial content for the object
++     */
++    public StringContent(String initialContent) {
++        stringContent = new StringBuilder(
++                Util.escapeHtmlChars(nullCheck(initialContent)));
++    }
++
++    /**
++     * This method is not supported by the class.
++     *
++     * @param content content that needs to be added
++     * @throws DocletAbortException this method will always throw a
++     *                              DocletAbortException because it
++     *                              is not supported.
++     */
++    public void addContent(Content content) {
++        throw new DocletAbortException();
++    }
++
++    /**
++     * Adds content for the StringContent object.  The method escapes
++     * HTML characters for the string content that is added.
++     *
++     * @param strContent string content to be added
++     */
++    public void addContent(String strContent) {
++        stringContent.append(Util.escapeHtmlChars(nullCheck(strContent)));
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public boolean isEmpty() {
++        return (stringContent.length() == 0);
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public String toString() {
++        return stringContent.toString();
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public void write(StringBuilder contentBuilder) {
++        contentBuilder.append(stringContent);
++    }
++}
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties b/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties
+@@ -43,6 +43,7 @@
+ doclet.Window_Split_Index={0}-Index
+ doclet.Help=Help
+ doclet.Skip_navigation_links=Skip navigation links
++doclet.New_Page=NewPage
+ doclet.None=None
+ doclet.CLASSES=CLASSES
+ doclet.MEMBERS=MEMBERS
+@@ -53,7 +54,7 @@
+ doclet.Window_Deprecated_List=Deprecated List
+ doclet.Note_0_is_deprecated=Note: {0} is deprecated.
+ doclet.Overrides=Overrides:
+-doclet.in_class={0} in class {1}
++doclet.in_class=in class
+ doclet.0_Fields_and_Methods="{0}" Fields and Methods
+ doclet.Index_of_Fields_and_Methods=Index of Fields and Methods
+ doclet.Static_variable_in=Static variable in {0}
+@@ -102,7 +103,7 @@
+ doclet.Package_Description=Package {0} Description
+ doclet.Description=Description
+ doclet.Specified_By=Specified by:
+-doclet.in_interface={0} in interface {1}
++doclet.in_interface=in interface
+ doclet.Subclasses=Direct Known Subclasses:
+ doclet.Subinterfaces=All Known Subinterfaces:
+ doclet.Implementing_Classes=All Known Implementing Classes:
+@@ -120,18 +121,20 @@
+ doclet.Frame_Alert=Frame Alert
+ doclet.Overview-Member-Frame=Overview Member Frame
+ doclet.Frame_Warning_Message=This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.
++doclet.No_Script_Message=JavaScript is disabled on your browser.
+ doclet.Non_Frame_Version=Non-frame version.
+ doclet.Frame_Version=Frame version
+ doclet.Link_To=Link to
+ doclet.Following_From_Class=Following copied from class: {0}
+ doclet.Following_From_Interface=Following copied from interface: {0}
+-doclet.Description_From_Interface=Description copied from interface: {0}
+-doclet.Description_From_Class=Description copied from class: {0}
++doclet.Description_From_Interface=Description copied from interface:
++doclet.Description_From_Class=Description copied from class:
+ doclet.Standard_doclet_invoked=Standard doclet invoked...
+ doclet.No_Non_Deprecated_Classes_To_Document=No non-deprecated classes found to document.
+ doclet.Interfaces_Italic=Interfaces (italic)
+ doclet.Enclosing_Class=Enclosing class:
+ doclet.Enclosing_Interface=Enclosing interface:
++doclet.Window_Source_title=Source code
+ doclet.Help_title=API Help
+ doclet.Window_Help_title=API Help
+ doclet.Help_line_1=How This API Document Is Organized
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeOptionalMemberWriter.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeOptionalMemberWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeOptionalMemberWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeOptionalMemberWriter.java
+@@ -35,14 +35,18 @@
+  * Do not use it as an API
+  *
+  * @author Jamie Ho
++ * @author Bhavesh Patel (Modified)
+  * @since 1.5
+  */
+ 
+ public interface AnnotationTypeOptionalMemberWriter extends
+-    AnnotationTypeRequiredMemberWriter {
++        AnnotationTypeRequiredMemberWriter {
+ 
+     /**
+-     * Write the default value documentation.
++     * Add the the default value documentation.
++     *
++     * @param member the member being documented
++     * @param annotationDocTree content tree to which the default value will be added
+      */
+-    public void writeDefaultValueInfo(MemberDoc member);
++    public void addDefaultValueInfo(MemberDoc member, Content annotationDocTree);
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeRequiredMemberWriter.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeRequiredMemberWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeRequiredMemberWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeRequiredMemberWriter.java
+@@ -36,67 +36,79 @@
+  * Do not use it as an API
+  *
+  * @author Jamie Ho
++ * @author Bhavesh Patel (Modified)
+  * @since 1.5
+  */
+ 
+ public interface AnnotationTypeRequiredMemberWriter {
+ 
+     /**
+-     * Write the header for the member documentation.
++     * Add the annotation type details tree header.
+      *
+-     * @param classDoc the annotation type that the members belong to.
+-     * @param header the header to write.
++     * @param classDoc the annotation type being documented
++     * @param memberDetailsTree the content tree representing member details
+      */
+-    public void writeHeader(ClassDoc classDoc, String header);
++    public void addAnnotationDetailsTreeHeader(ClassDoc classDoc,
++            Content memberDetailsTree);
+ 
+     /**
+-     * Write the member header for the given member.
++     * Get the annotation type documentation tree header.
+      *
+-     * @param member the member being documented.
+-     * @param isFirst the flag to indicate whether or not the member is
+-     *                the first to be documented.
++     * @param member the annotation type being documented
++     * @param annotationDetailsTree the content tree representing annotation type details
++     * @return content tree for the annotation type documentation header
+      */
+-    public void writeMemberHeader(MemberDoc member, boolean isFirst);
++    public Content getAnnotationDocTreeHeader(MemberDoc member,
++            Content annotationDetailsTree);
+ 
+     /**
+-     * Write the signature for the given member.
++     * Get the annotation type details tree.
+      *
+-     * @param member the member being documented.
++     * @param annotationDetailsTree the content tree representing annotation type details
++     * @return content tree for the annotation type details
+      */
+-    public void writeSignature(MemberDoc member);
++    public Content getAnnotationDetails(Content annotationDetailsTree);
+ 
+     /**
+-     * Write the deprecated output for the given member.
++     * Get the annotation type documentation.
+      *
+-     * @param member the member being documented.
++     * @param annotationDocTree the content tree representing annotation type documentation
++     * @param isLastContent true if the content to be added is the last content
++     * @return content tree for the annotation type documentation
+      */
+-    public void writeDeprecated(MemberDoc member);
++    public Content getAnnotationDoc(Content annotationDocTree, boolean isLastContent);
+ 
+     /**
+-     * Write the comments for the given member.
++     * Get the signature for the given member.
+      *
+-     * @param member the member being documented.
++     * @param member the member being documented
++     * @return content tree for the annotation type signature
+      */
+-    public void writeComments(MemberDoc member);
++    public Content getSignature(MemberDoc member);
+ 
+     /**
+-     * Write the tag output for the given member.
++     * Add the deprecated output for the given member.
+      *
+-     * @param member the member being documented.
++     * @param member the member being documented
++     * @param annotationDocTree content tree to which the deprecated information will be added
+      */
+-    public void writeTags(MemberDoc member);
++    public void addDeprecated(MemberDoc member, Content annotationDocTree);
+ 
+     /**
+-     * Write the member footer.
++     * Add the comments for the given member.
++     *
++     * @param member the member being documented
++     * @param annotationDocTree the content tree to which the comments will be added
+      */
+-    public void writeMemberFooter();
++    public void addComments(MemberDoc member, Content annotationDocTree);
+ 
+     /**
+-     * Write the footer for the member documentation.
++     * Add the tags for the given member.
+      *
+-     * @param classDoc the class that the member belong to.
++     * @param member the member being documented
++     * @param annotationDocTree the content tree to which the tags will be added
+      */
+-    public void writeFooter(ClassDoc classDoc);
++    public void addTags(MemberDoc member, Content annotationDocTree);
+ 
+     /**
+      * Close the writer.
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeWriter.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeWriter.java
+@@ -37,43 +37,122 @@
+  * Do not use it as an API.
+  *
+  * @author Jamie Ho
++ * @author Bhavesh Patel (Modified)
+  * @since 1.5
+  */
+ 
+ public interface AnnotationTypeWriter {
+ 
+     /**
+-     * Write the header of the page.
+-     * @param header the header to write.
++     * Get the header of the page.
++     *
++     * @param header the header string to write
++     * @return a content tree for the header documentation
+      */
+-    public void writeHeader(String header);
++    public Content getHeader(String header);
+ 
+     /**
+-     * Write the signature of the current annotation type.
++     * Get the annotation content header.
+      *
+-     * @param modifiers the modifiers for the signature.
++     * @return annotation content header that needs to be added to the documentation
+      */
+-    public void writeAnnotationTypeSignature(String modifiers);
++    public Content getAnnotationContentHeader();
++
++    /**
++     * Get the annotation information tree header.
++     *
++     * @return annotation information tree header that needs to be added to the documentation
++     */
++    public Content getAnnotationInfoTreeHeader();
++
++    /**
++     * Get the annotation information.
++     *
++     * @param annotationInfoTree content tree containing the annotation information
++     * @return a content tree for the annotation
++     */
++    public Content getAnnotationInfo(Content annotationInfoTree);
++
++    /**
++     * Add the signature of the current annotation type.
++     *
++     * @param modifiers the modifiers for the signature
++     * @param annotationInfoTree the annotation content tree to which the signature will be added
++     */
++    public void addAnnotationTypeSignature(String modifiers, Content annotationInfoTree);
+ 
+     /**
+      * Build the annotation type description.
++     *
++     * @param annotationInfoTree content tree to which the description will be added
+      */
+-    public void writeAnnotationTypeDescription();
++    public void addAnnotationTypeDescription(Content annotationInfoTree);
+ 
+     /**
+-     * Write the tag information for the current annotation type.
++     * Add the tag information for the current annotation type.
++     *
++     * @param annotationInfoTree content tree to which the tag information will be added
+      */
+-    public void writeAnnotationTypeTagInfo();
++    public void addAnnotationTypeTagInfo(Content annotationInfoTree);
+ 
+     /**
+-     * If this annotation type is deprecated, write the appropriate information.
++     * If this annotation is deprecated, add the appropriate information.
++     *
++     * @param annotationInfoTree content tree to which the deprecated information will be added
+      */
+-    public void writeAnnotationTypeDeprecationInfo();
++    public void addAnnotationTypeDeprecationInfo (Content annotationInfoTree);
+ 
+     /**
+-     * Write the footer of the page.
++     * Add the annotation type details marker.
++     *
++     * @param memberDetails the content tree representing member details marker
+      */
+-    public void writeFooter();
++    public void addAnnotationDetailsMarker(Content memberDetails);
++
++    /**
++     * Get the member tree header for the annotation type.
++     *
++     * @return a content tree for the member tree header
++     */
++    public Content getMemberTreeHeader();
++
++    /**
++     * Get the member tree.
++     *
++     * @param memberTree the content tree that will be modified and returned
++     * @return a content tree for the member
++     */
++    public Content getMemberTree(Content memberTree);
++
++    /**
++     * Get the member summary tree.
++     *
++     * @param memberTree the content tree that will be used to build the summary tree
++     * @return a content tree for the member summary
++     */
++    public Content getMemberSummaryTree(Content memberTree);
++
++    /**
++     * Get the member details tree.
++     *
++     * @param memberTree the content tree that will be used to build the details tree
++     * @return a content tree for the member details
++     */
++    public Content getMemberDetailsTree(Content memberTree);
++
++    /**
++     * Add the footer of the page.
++     *
++     * @param contentTree content tree to which the footer will be added
++     */
++    public void addFooter(Content contentTree);
++
++    /**
++     * Print the document.
++     *
++     * @param contentTree content tree that will be printed as a document
++     */
++    public void printDocument(Content contentTree);
+ 
+     /**
+      * Close the writer.
+@@ -86,10 +165,4 @@
+      * @return the AnnotationTypeDoc being documented.
+      */
+     public AnnotationTypeDoc getAnnotationTypeDoc();
+-
+-    /**
+-     * Perform any operations that are necessary when the member summary
+-     * finished building.
+-     */
+-    public void completeMemberSummaryBuild();
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/ClassWriter.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/ClassWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/ClassWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/ClassWriter.java
+@@ -37,85 +37,149 @@
+  * Do not use it as an API
+  *
+  * @author Jamie Ho
++ * @author Bhavesh Patel (Modified)
+  * @since 1.5
+  */
+ 
+ public interface ClassWriter {
+ 
+     /**
+-     * Write the header of the page.
+-     * @param header the header to write.
++     * Get the header of the page.
++     *
++     * @param header the header string to write
++     * @return header content that needs to be added to the documentation
+      */
+-    public void writeHeader(String header);
++    public Content getHeader(String header);
+ 
+     /**
+-     * Write the class tree documentation.
++     * Get the class content header.
++     *
++     * @return class content header that needs to be added to the documentation
+      */
+-    public void writeClassTree();
++    public Content getClassContentHeader();
+ 
+     /**
+-     * Write all implemented interfaces if this is a class.
++     * Add the class tree documentation.
++     *
++     * @param classContentTree class content tree to which the documentation will be added
+      */
+-    public void writeImplementedInterfacesInfo();
++    public void addClassTree(Content classContentTree);
+ 
+     /**
+-     * Write all super interfaces if this is an interface.
++     * Get the class information tree header.
++     *
++     * @return class informaion tree header that needs to be added to the documentation
+      */
+-    public void writeSuperInterfacesInfo();
++    public Content getClassInfoTreeHeader();
+ 
+     /**
+-     * Write the type parameter information.
++     * Add the type parameter information.
++     *
++     * @param classInfoTree content tree to which the documentation will be added
+      */
+-    public void writeTypeParamInfo();
++    public void addTypeParamInfo(Content classInfoTree);
+ 
+     /**
+-     * Write all the classes that extend this one.
++     * Add all super interfaces if this is an interface.
++     *
++     * @param classInfoTree content tree to which the documentation will be added
+      */
+-    public void writeSubClassInfo();
++    public void addSuperInterfacesInfo(Content classInfoTree);
+ 
+     /**
+-     * Write all the interfaces that extend this one.
++     * Add all implemented interfaces if this is a class.
++     *
++     * @param classInfoTree content tree to which the documentation will be added
+      */
+-    public void writeSubInterfacesInfo();
++    public void addImplementedInterfacesInfo(Content classInfoTree);
+ 
+     /**
+-     * If this is an interface, write all classes that implement this
+-     * interface.
++     * Add all the classes that extend this one.
++     *
++     * @param classInfoTree content tree to which the documentation will be added
+      */
+-    public void writeInterfaceUsageInfo ();
++    public void addSubClassInfo(Content classInfoTree);
+ 
+     /**
+-     * If this is an inner class or interface, write the enclosing class or
+-     * interface.
++     * Add all the interfaces that extend this one.
++     *
++     * @param classInfoTree content tree to which the documentation will be added
+      */
+-    public void writeNestedClassInfo ();
++    public void addSubInterfacesInfo(Content classInfoTree);
+ 
+     /**
+-     * If this class is deprecated, write the appropriate information.
++     * If this is an interface, add all classes that implement this
++     * interface.
++     *
++     * @param classInfoTree content tree to which the documentation will be added
+      */
+-    public void writeClassDeprecationInfo ();
++    public void addInterfaceUsageInfo(Content classInfoTree);
+ 
+     /**
+-     * Write the signature of the current class.
++     * If this is an inner class or interface, add the enclosing class or
++     * interface.
+      *
+-     * @param modifiers the modifiers for the signature.
++     * @param classInfoTree content tree to which the documentation will be added
+      */
+-    public void writeClassSignature(String modifiers);
++    public void addNestedClassInfo (Content classInfoTree);
++
++    /**
++     * Get the class information.
++     *
++     * @param classInfoTree content tree conatining the class information
++     * @return a content tree for the class
++     */
++    public Content getClassInfo(Content classInfoTree);
++
++    /**
++     * If this class is deprecated, add the appropriate information.
++     *
++     * @param classInfoTree content tree to which the documentation will be added
++     */
++    public void addClassDeprecationInfo (Content classInfoTree);
++
++    /**
++     * Add the signature of the current class content tree.
++     *
++     * @param modifiers the modifiers for the signature
++     * @param classInfoTree the class content tree to which the signature will be added
++     */
++    public void addClassSignature(String modifiers, Content classInfoTree);
+ 
+     /**
+      * Build the class description.
++     *
++     * @param classInfoTree content tree to which the documentation will be added
+      */
+-    public void writeClassDescription();
++    public void addClassDescription(Content classInfoTree);
+ 
+     /**
+-     * Write the tag information for the current class.
++     * Add the tag information for the current class.
++     *
++     * @param classInfoTree content tree to which the tag information will be added
+      */
+-    public void writeClassTagInfo();
++    public void addClassTagInfo(Content classInfoTree);
+ 
+     /**
+-     * Write the footer of the page.
++     * Get the member tree header for the class.
++     *
++     * @return a content tree for the member tree header
+      */
+-    public void writeFooter();
++    public Content getMemberTreeHeader();
++
++    /**
++     * Add the footer of the page.
++     *
++     * @param contentTree content tree to which the footer will be added
++     */
++    public void addFooter(Content contentTree);
++
++    /**
++     * Print the document.
++     *
++     * @param contentTree content tree that will be printed as a document
++     */
++    public void printDocument(Content contentTree);
+ 
+     /**
+      * Close the writer.
+@@ -130,8 +194,18 @@
+     public ClassDoc getClassDoc();
+ 
+     /**
+-     * Perform any operations that are necessary when the member summary
+-     * finished building.
++     * Get the member summary tree.
++     *
++     * @param memberTree the content tree used to build the summary tree
++     * @return a content tree for the member summary
+      */
+-    public void completeMemberSummaryBuild();
++    public Content getMemberSummaryTree(Content memberTree);
++
++    /**
++     * Get the member details tree.
++     *
++     * @param memberTree the content tree used to build the details tree
++     * @return a content tree for the member details
++     */
++    public Content getMemberDetailsTree(Content memberTree);
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/ConstantsSummaryWriter.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/ConstantsSummaryWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/ConstantsSummaryWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/ConstantsSummaryWriter.java
+@@ -25,9 +25,9 @@
+ 
+ package com.sun.tools.doclets.internal.toolkit;
+ 
+-import com.sun.javadoc.*;
+ import java.util.*;
+ import java.io.*;
++import com.sun.javadoc.*;
+ 
+ /**
+  * The interface for writing constants summary output.
+@@ -37,38 +37,34 @@
+  * Do not use it as an API
+  *
+  * @author Jamie Ho
++ * @author Bhavesh Patel (Modified)
+  * @since 1.5
+  */
+ 
+ public interface ConstantsSummaryWriter {
+ 
+     /**
+-     * Write the header for the summary.
+-     */
+-    public abstract void writeHeader();
+-
+-    /**
+-     * Write the footer for the summary.
+-     */
+-    public abstract void writeFooter();
+-
+-    /**
+      * Close the writer.
+      */
+     public abstract void close() throws IOException;
+ 
+     /**
+-     * Write the header for the index.
++     * Get the header for the constant summary documentation.
++     *
++     * @return header that needs to be added to the documentation
+      */
+-    public abstract void writeContentsHeader();
++    public abstract Content getHeader();
+ 
+     /**
+-     * Write the footer for the index.
++     * Get the header for the constant content list.
++     *
++     * @return content header that needs to be added to the documentation
+      */
+-    public abstract void writeContentsFooter();
++    public abstract Content getContentsHeader();
+ 
+     /**
+-     * Add the given package name to the index.
++     * Adds the given package name link to the constant content list tree.
++     *
+      * @param pkg                    the {@link PackageDoc} to index.
+      * @param parsedPackageName      the parsed package name.  We only Write the
+      *                               first 2 directory levels of the package
+@@ -77,38 +73,70 @@
+      * @param WriteedPackageHeaders the set of package headers that have already
+      *                              been indexed.  We don't want to index
+      *                              something more than once.
++     * @param contentListTree the content tree to which the link will be added
+      */
+-    public abstract void writeLinkToPackageContent(PackageDoc pkg, String parsedPackageName,
+-        Set WriteedPackageHeaders);
++    public abstract void addLinkToPackageContent(PackageDoc pkg, String parsedPackageName,
++        Set<String> WriteedPackageHeaders, Content contentListTree);
+ 
+     /**
+-     * Write the given package name.
+-     * @param pkg                    the {@link PackageDoc} to index.
+-     * @param parsedPackageName      the parsed package name.  We only Write the
+-     *                               first 2 directory levels of the package
+-     *                               name. For example, java.lang.ref would be
+-     *                               indexed as java.lang.*.
++     * Get the content list to be added to the documentation tree.
++     *
++     * @param contentListTree the content that will be added to the list
++     * @return content list that will be added to the documentation tree
+      */
+-    public abstract void writePackageName(PackageDoc pkg,
+-        String parsedPackageName);
++    public abstract Content getContentsList(Content contentListTree);
+ 
+     /**
+-     * Write the heading for the current table of constants for a given class.
+-     * @param cd the class whose constants are being documented.
++     * Get the constant summaries for the document.
++     *
++     * @return constant summaries header to be added to the documentation tree
+      */
+-    public abstract void writeConstantMembersHeader(ClassDoc cd);
++    public abstract Content getConstantSummaries();
+ 
+     /**
+-     * Document the given constants.
++     * Adds the given package name.
++     *
++     * @param pkg the {@link PackageDoc} to index.
++     * @param parsedPackageName the parsed package name.  We only Write the
++     *                          first 2 directory levels of the package
++     *                          name. For example, java.lang.ref would be
++     *                          indexed as java.lang.*.
++     * @param summariesTree the documentation tree to which the package name will
++     *                    be written
++     */
++    public abstract void addPackageName(PackageDoc pkg,
++        String parsedPackageName, Content summariesTree);
++
++    /**
++     * Get the class summary header for the constants summary.
++     *
++     * @return the header content for the class constants summary
++     */
++    public abstract Content getClassConstantHeader();
++
++    /**
++     * Adds the constant member table to the documentation tree.
++     *
+      * @param cd the class whose constants are being documented.
+      * @param fields the constants being documented.
++     * @param classConstantTree the documentation tree to which theconstant member
++     *                    table content will be added
+      */
+-    public abstract void writeConstantMembers(ClassDoc cd, List fields);
++    public abstract void addConstantMembers(ClassDoc cd, List<FieldDoc> fields,
++            Content classConstantTree);
+ 
+     /**
+-     * Document the given constants.
+-     * @param cd the class whose constants are being documented.
++     * Adds the footer for the summary documentation.
++     *
++     * @param contentTree content tree to which the footer will be added
+      */
+-    public abstract void writeConstantMembersFooter(ClassDoc cd);
++    public abstract void addFooter(Content contentTree);
++
++    /**
++     * Print the constants summary document.
++     *
++     * @param contentTree content tree which should be printed
++     */
++    public abstract void printDocument(Content contentTree);
+ 
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/ConstructorWriter.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/ConstructorWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/ConstructorWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/ConstructorWriter.java
+@@ -36,67 +36,80 @@
+  * Do not use it as an API
+  *
+  * @author Jamie Ho
++ * @author Bhavesh Patel (Modified)
+  * @since 1.5
+  */
+ 
+ public interface ConstructorWriter {
+ 
+     /**
+-     * Write the header for the constructor documentation.
++     * Get the constructor details tree header.
+      *
+-     * @param classDoc the class that the constructors belong to.
+-     * @param header the header to write.
++     * @param classDoc the class being documented
++     * @param memberDetailsTree the content tree representing member details
++     * @return content tree for the constructor details header
+      */
+-    public void writeHeader(ClassDoc classDoc, String header);
++    public Content getConstructorDetailsTreeHeader(ClassDoc classDoc,
++            Content memberDetailsTree);
+ 
+     /**
+-     * Write the constructor header for the given constructor.
++     * Get the constructor documentation tree header.
+      *
+-     * @param constructor the constructor being documented.
+-     * @param isFirst the flag to indicate whether or not the constructor is the
+-     *        first to be documented.
++     * @param constructor the constructor being documented
++     * @param constructorDetailsTree the content tree representing constructor details
++     * @return content tree for the constructor documentation header
+      */
+-    public void writeConstructorHeader(ConstructorDoc constructor, boolean isFirst);
++    public Content getConstructorDocTreeHeader(ConstructorDoc constructor,
++            Content constructorDetailsTree);
+ 
+     /**
+-     * Write the signature for the given constructor.
++     * Get the signature for the given constructor.
+      *
+-     * @param constructor the constructor being documented.
++     * @param constructor the constructor being documented
++     * @return content tree for the constructor signature
+      */
+-    public void writeSignature(ConstructorDoc constructor);
++    public Content getSignature(ConstructorDoc constructor);
+ 
+     /**
+-     * Write the deprecated output for the given constructor.
++     * Add the deprecated output for the given constructor.
+      *
+-     * @param constructor the constructor being documented.
++     * @param constructor the constructor being documented
++     * @param constructorDocTree content tree to which the deprecated information will be added
+      */
+-    public void writeDeprecated(ConstructorDoc constructor);
++    public void addDeprecated(ConstructorDoc constructor, Content constructorDocTree);
+ 
+     /**
+-     * Write the comments for the given constructor.
++     * Add the comments for the given constructor.
+      *
+-     * @param constructor the constructor being documented.
++     * @param constructor the constructor being documented
++     * @param constructorDocTree the content tree to which the comments will be added
+      */
+-    public void writeComments(ConstructorDoc constructor);
++    public void addComments(ConstructorDoc constructor, Content constructorDocTree);
+ 
+     /**
+-     * Write the tag output for the given constructor.
++     * Add the tags for the given constructor.
+      *
+-     * @param constructor the constructor being documented.
++     * @param constructor the constructor being documented
++     * @param constructorDocTree the content tree to which the tags will be added
+      */
+-    public void writeTags(ConstructorDoc constructor);
++    public void addTags(ConstructorDoc constructor, Content constructorDocTree);
+ 
+     /**
+-     * Write the constructor footer.
++     * Get the constructor details tree.
++     *
++     * @param memberDetailsTree the content tree representing member details
++     * @return content tree for the constructor details
+      */
+-    public void writeConstructorFooter();
++    public Content getConstructorDetails(Content memberDetailsTree);
+ 
+     /**
+-     * Write the footer for the constructor documentation.
++     * Get the constructor documentation.
+      *
+-     * @param classDoc the class that the constructors belong to.
++     * @param constructorDocTree the content tree representing constructor documentation
++     * @param isLastContent true if the content to be added is the last content
++     * @return content tree for the constructor documentation
+      */
+-    public void writeFooter(ClassDoc classDoc);
++    public Content getConstructorDoc(Content constructorDocTree, boolean isLastContent);
+ 
+     /**
+      * Let the writer know whether a non public constructor was found.
+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
+new file mode 100644
+--- /dev/null
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Content.java
+@@ -0,0 +1,106 @@
++/*
++ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute 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.internal.toolkit;
++
++import com.sun.tools.doclets.internal.toolkit.util.*;
++
++/**
++ * A class to create content for javadoc output pages.
++ *
++ * @author Bhavesh Patel
++ */
++public abstract class Content {
++
++    /**
++     * Returns a string representation of the content.
++     *
++     * @return string representation of the content
++     */
++    public String toString() {
++        StringBuilder contentBuilder = new StringBuilder();
++        write(contentBuilder);
++        return contentBuilder.toString();
++    }
++
++    /**
++     * Adds content to the existing content.
++     *
++     * @param content content that needs to be added
++     */
++    public abstract void addContent(Content content);
++
++    /**
++     * Adds a string content to the existing content.
++     *
++     * @param stringContent the string content to be added
++     */
++    public abstract void addContent(String stringContent);
++
++    /**
++     * Writes content to a StringBuilder.
++     *
++     */
++    public abstract void write(StringBuilder contentBuilder);
++
++    /**
++     * Returns true if the content is empty.
++     *
++     * @return true if no content to be displayed else return false
++     */
++    public abstract boolean isEmpty();
++
++    /**
++     * Returns true if the content is valid.
++     *
++     * @return true if the content is valid else return false
++     */
++    public boolean isValid() {
++        return !isEmpty();
++    }
++
++    /**
++     * Checks for null values.
++     *
++     * @param t reference type to check for null values
++     * @return the reference type if not null or else throws a null pointer exception
++     */
++    protected static <T> T nullCheck(T t) {
++        t.getClass();
++        return t;
++    }
++
++    /**
++     * Returns true if the content ends with a newline character. Empty content
++     * is considered as ending with new line.
++     *
++     * @param contentBuilder content to test for newline character at the end
++     * @return true if the content ends with newline.
++     */
++    public boolean endsWithNewLine(StringBuilder contentBuilder) {
++        return ((contentBuilder.length() == 0) ||
++                (contentBuilder.substring(contentBuilder.length() - 1).equals("\n")));
++    }
++}
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/EnumConstantWriter.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/EnumConstantWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/EnumConstantWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/EnumConstantWriter.java
+@@ -36,67 +36,80 @@
+  * Do not use it as an API
+  *
+  * @author Jamie Ho
++ * @author Bhavesh Patel (Modified)
+  * @since 1.5
+  */
+ 
+ public interface EnumConstantWriter {
+ 
+     /**
+-     * Write the header for the enum constant documentation.
++     * Get the enum constants details tree header.
+      *
+-     * @param classDoc the class that the enum constants belong to.
+-     * @param header the header to write.
++     * @param classDoc the class being documented
++     * @param memberDetailsTree the content tree representing member details
++     * @return content tree for the enum constants details header
+      */
+-    public void writeHeader(ClassDoc classDoc, String header);
++    public Content getEnumConstantsDetailsTreeHeader(ClassDoc classDoc,
++            Content memberDetailsTree);
+ 
+     /**
+-     * Write the enum constant header for the given enum constant.
++     * Get the enum constants documentation tree header.
+      *
+-     * @param enumConstant the enum constant being documented.
+-     * @param isFirst the flag to indicate whether or not the enum constant is
+-     *                the first to be documented.
++     * @param enumConstant the enum constant being documented
++     * @param enumConstantDetailsTree the content tree representing enum constant details
++     * @return content tree for the enum constant documentation header
+      */
+-    public void writeEnumConstantHeader(FieldDoc enumConstant, boolean isFirst);
++    public Content getEnumConstantsTreeHeader(FieldDoc enumConstant,
++            Content enumConstantsDetailsTree);
+ 
+     /**
+-     * Write the signature for the given enum constant.
++     * Get the signature for the given enum constant.
+      *
+-     * @param enumConstant the enum constant being documented.
++     * @param enumConstant the enum constant being documented
++     * @return content tree for the enum constant signature
+      */
+-    public void writeSignature(FieldDoc enumConstant);
++    public Content getSignature(FieldDoc enumConstant);
+ 
+     /**
+-     * Write the deprecated output for the given enum constant.
++     * Add the deprecated output for the given enum constant.
+      *
+-     * @param enumConstant the enum constant being documented.
++     * @param enumConstant the enum constant being documented
++     * @param enumConstantsTree content tree to which the deprecated information will be added
+      */
+-    public void writeDeprecated(FieldDoc enumConstant);
++    public void addDeprecated(FieldDoc enumConstant, Content enumConstantsTree);
+ 
+     /**
+-     * Write the comments for the given enum constant.
++     * Add the comments for the given enum constant.
+      *
+-     * @param enumConstant the enum constant being documented.
++     * @param enumConstant the enum constant being documented
++     * @param enumConstantsTree the content tree to which the comments will be added
+      */
+-    public void writeComments(FieldDoc enumConstant);
++    public void addComments(FieldDoc enumConstant, Content enumConstantsTree);
+ 
+     /**
+-     * Write the tag output for the given enum constant.
++     * Add the tags for the given enum constant.
+      *
+-     * @param enumConstant the enum constant being documented.
++     * @param enumConstant the enum constant being documented
++     * @param enumConstantsTree the content tree to which the tags will be added
+      */
+-    public void writeTags(FieldDoc enumConstant);
++    public void addTags(FieldDoc enumConstant, Content enumConstantsTree);
+ 
+     /**
+-     * Write the enum constant footer.
++     * Get the enum constants details tree.
++     *
++     * @param memberDetailsTree the content tree representing member details
++     * @return content tree for the enum constant details
+      */
+-    public void writeEnumConstantFooter();
++    public Content getEnumConstantsDetails(Content memberDetailsTree);
+ 
+     /**
+-     * Write the footer for the enum constant documentation.
++     * Get the enum constants documentation.
+      *
+-     * @param classDoc the class that the enum constant belong to.
++     * @param enumConstantsTree the content tree representing enum constants documentation
++     * @param isLastContent true if the content to be added is the last content
++     * @return content tree for the enum constants documentation
+      */
+-    public void writeFooter(ClassDoc classDoc);
++    public Content getEnumConstants(Content enumConstantsTree, boolean isLastContent);
+ 
+     /**
+      * Close the writer.
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/FieldWriter.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/FieldWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/FieldWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/FieldWriter.java
+@@ -36,67 +36,80 @@
+  * Do not use it as an API
+  *
+  * @author Jamie Ho
++ * @author Bhavesh Patel (Modified)
+  * @since 1.5
+  */
+ 
+ public interface FieldWriter {
+ 
+     /**
+-     * Write the header for the field documentation.
++     * Get the field details tree header.
+      *
+-     * @param classDoc the class that the fields belong to.
+-     * @param header the header to write.
++     * @param classDoc the class being documented
++     * @param memberDetailsTree the content tree representing member details
++     * @return content tree for the field details header
+      */
+-    public void writeHeader(ClassDoc classDoc, String header);
++    public Content getFieldDetailsTreeHeader(ClassDoc classDoc,
++            Content memberDetailsTree);
+ 
+     /**
+-     * Write the field header for the given field.
++     * Get the field documentation tree header.
+      *
+-     * @param field the field being documented.
+-     * @param isFirst the flag to indicate whether or not the field is the
+-     *        first to be documented.
++     * @param field the constructor being documented
++     * @param fieldDetailsTree the content tree representing field details
++     * @return content tree for the field documentation header
+      */
+-    public void writeFieldHeader(FieldDoc field, boolean isFirst);
++    public Content getFieldDocTreeHeader(FieldDoc field,
++            Content fieldDetailsTree);
+ 
+     /**
+-     * Write the signature for the given field.
++     * Get the signature for the given field.
+      *
+-     * @param field the field being documented.
++     * @param field the field being documented
++     * @return content tree for the field signature
+      */
+-    public void writeSignature(FieldDoc field);
++    public Content getSignature(FieldDoc field);
+ 
+     /**
+-     * Write the deprecated output for the given field.
++     * Add the deprecated output for the given field.
+      *
+-     * @param field the field being documented.
++     * @param field the field being documented
++     * @param fieldDocTree content tree to which the deprecated information will be added
+      */
+-    public void writeDeprecated(FieldDoc field);
++    public void addDeprecated(FieldDoc field, Content fieldDocTree);
+ 
+     /**
+-     * Write the comments for the given field.
++     * Add the comments for the given field.
+      *
+-     * @param field the field being documented.
++     * @param field the field being documented
++     * @param fieldDocTree the content tree to which the comments will be added
+      */
+-    public void writeComments(FieldDoc field);
++    public void addComments(FieldDoc field, Content fieldDocTree);
+ 
+     /**
+-     * Write the tag output for the given field.
++     * Add the tags for the given field.
+      *
+-     * @param field the field being documented.
++     * @param field the field being documented
++     * @param fieldDocTree the content tree to which the tags will be added
+      */
+-    public void writeTags(FieldDoc field);
++    public void addTags(FieldDoc field, Content fieldDocTree);
+ 
+     /**
+-     * Write the field footer.
++     * Get the field details tree.
++     *
++     * @param memberDetailsTree the content tree representing member details
++     * @return content tree for the field details
+      */
+-    public void writeFieldFooter();
++    public Content getFieldDetails(Content memberDetailsTree);
+ 
+     /**
+-     * Write the footer for the field documentation.
++     * Get the field documentation.
+      *
+-     * @param classDoc the class that the fields belong to.
++     * @param fieldDocTree the content tree representing field documentation
++     * @param isLastContent true if the content to be added is the last content
++     * @return content tree for the field documentation
+      */
+-    public void writeFooter(ClassDoc classDoc);
++    public Content getFieldDoc(Content fieldDocTree, boolean isLastContent);
+ 
+     /**
+      * Close the writer.
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/MemberSummaryWriter.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/MemberSummaryWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/MemberSummaryWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/MemberSummaryWriter.java
+@@ -26,6 +26,7 @@
+ package com.sun.tools.doclets.internal.toolkit;
+ 
+ import java.io.*;
++import java.util.*;
+ import com.sun.javadoc.*;
+ 
+ /**
+@@ -36,61 +37,77 @@
+  * Do not use it as an API
+  *
+  * @author Jamie Ho
++ * @author Bhavesh Patel (Modified)
+  * @since 1.5
+  */
+ 
+ public interface MemberSummaryWriter {
+ 
+     /**
+-     * Write the member summary header for the given class.
++     * Get the member summary header for the given class.
+      *
+-     * @param classDoc the class the summary belongs to.
++     * @param classDoc the class the summary belongs to
++     * @param memberSummaryTree the content tree to which the member summary will be added
++     * @return a content tree for the member summary header
+      */
+-    public void writeMemberSummaryHeader(ClassDoc classDoc);
++    public Content getMemberSummaryHeader(ClassDoc classDoc,
++            Content memberSummaryTree);
+ 
+     /**
+-     * Write the member summary for the given class and member.
++     * Get the summary table for the given class.
+      *
+-     * @param classDoc the class the summary belongs to.
+-     * @param member the member that I am summarizing.
+-     * @param firstSentenceTags the tags for the sentence being documented.
+-     * @param isFirst true if this is the first member in the list.
+-     * @param isLast true if this the last member being documented.
++     * @param classDoc the class the summary table belongs to
++     * @return a content tree for the member summary table
+      */
+-    public void writeMemberSummary(ClassDoc classDoc, ProgramElementDoc member,
+-        Tag[] firstSentenceTags, boolean isFirst, boolean isLast);
++    public Content getSummaryTableTree(ClassDoc classDoc);
+ 
+     /**
+-     * Write the member summary footer for the given class.
++     * Add the member summary for the given class and member.
+      *
+-     * @param classDoc the class the summary belongs to.
++     * @param classDoc the class the summary belongs to
++     * @param member the member that is documented
++     * @param firstSentenceTags the tags for the sentence being documented
++     * @param tableTree the content treeto which the information will be added
++     * @param counter the counter for determing style for the table row
+      */
+-    public void writeMemberSummaryFooter(ClassDoc classDoc);
++    public void addMemberSummary(ClassDoc classDoc, ProgramElementDoc member,
++        Tag[] firstSentenceTags, Content tableTree, int counter);
+ 
+     /**
+-     * Write the inherited member summary header for the given class.
++     * Get the inherited member summary header for the given class.
+      *
+-     * @param classDoc the class the summary belongs to.
++     * @param classDoc the class the summary belongs to
++     * @return a content tree containing the inherited summary header
+      */
+-    public void writeInheritedMemberSummaryHeader(ClassDoc classDoc);
++    public Content getInheritedSummaryHeader(ClassDoc classDoc);
+ 
+     /**
+-     * Write the inherited member summary for the given class and member.
++     * Add the inherited member summary for the given class and member.
+      *
+-     * @param classDoc the class the inherited member belongs to.
+-     * @param member   the inherited member that I am summarizing.
+-     * @param isFirst  true if this is the first member in the list.
+-     * @param isLast   true if this is the last member in the list.
++     * @param classDoc the class the inherited member belongs to
++     * @param member the inherited member that is being documented
++     * @param isFirst true if this is the first member in the list
++     * @param isLast true if this is the last member in the list
++     * @param linksTree the content tree to which the links will be added
+      */
+-    public void writeInheritedMemberSummary(ClassDoc classDoc,
+-        ProgramElementDoc member, boolean isFirst, boolean isLast);
++    public void addInheritedMemberSummary(ClassDoc classDoc,
++        ProgramElementDoc member, boolean isFirst, boolean isLast,
++        Content linksTree);
+ 
+     /**
+-     * Write the inherited member summary footer for the given class.
++     * Get inherited summary links.
+      *
+-     * @param classDoc the class the summary belongs to.
++     * @return a content tree conatining the inherited summary links
+      */
+-    public void writeInheritedMemberSummaryFooter(ClassDoc classDoc);
++    public Content getInheritedSummaryLinksTree();
++
++    /**
++     * Get the member tree.
++     *
++     * @param memberTree the content tree representating the member
++     * @return a content tree for the member
++     */
++    public Content getMemberTree(Content memberTree);
+ 
+     /**
+      * Close the writer.
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/MethodWriter.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/MethodWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/MethodWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/MethodWriter.java
+@@ -36,68 +36,81 @@
+  * Do not use it as an API
+  *
+  * @author Jamie Ho
++ * @author Bhavesh Patel (Modified)
+  * @since 1.5
+  */
+ 
+ public interface MethodWriter {
+ 
+     /**
+-     * Write the header for the method documentation.
++     * Get the method details tree header.
+      *
+-     * @param classDoc the class that the methods belong to.
+-     * @param header the header to write.
++     * @param classDoc the class being documented
++     * @param memberDetailsTree the content tree representing member details
++     * @return content tree for the method details header
+      */
+-    public void writeHeader(ClassDoc classDoc, String header);
++    public Content getMethodDetailsTreeHeader(ClassDoc classDoc,
++            Content memberDetailsTree);
+ 
+     /**
+-     * Write the method header for the given method.
++     * Get the method documentation tree header.
+      *
+-     * @param method the method being documented.
+-     * @param isFirst the flag to indicate whether or not the method is the
+-     *        first to be documented.
++     * @param method the method being documented
++     * @param methodDetailsTree the content tree representing method details
++     * @return content tree for the method documentation header
+      */
+-    public void writeMethodHeader(MethodDoc method, boolean isFirst);
++    public Content getMethodDocTreeHeader(MethodDoc method,
++            Content methodDetailsTree);
+ 
+     /**
+-     * Write the signature for the given method.
++     * Get the signature for the given method.
+      *
+-     * @param method the method being documented.
++     * @param method the method being documented
++     * @return content tree for the method signature
+      */
+-    public void writeSignature(MethodDoc method);
++    public Content getSignature(MethodDoc method);
+ 
+     /**
+-     * Write the deprecated output for the given method.
++     * Add the deprecated output for the given method.
+      *
+-     * @param method the method being documented.
++     * @param method the method being documented
++     * @param methodDocTree content tree to which the deprecated information will be added
+      */
+-    public void writeDeprecated(MethodDoc method);
++    public void addDeprecated(MethodDoc method, Content methodDocTree);
+ 
+     /**
+-     * Write the comments for the given method.
++     * Add the comments for the given method.
+      *
+-     * @param holder the holder type (not erasure) of the method.
+-     * @param method the method being documented.
++     * @param holder the holder type (not erasure) of the method
++     * @param method the method being documented
++     * @param methodDocTree the content tree to which the comments will be added
+      */
+-    public void writeComments(Type holder, MethodDoc method);
++    public void addComments(Type holder, MethodDoc method, Content methodDocTree);
+ 
+     /**
+-     * Write the tag output for the given method.
++     * Add the tags for the given method.
+      *
+-     * @param method the method being documented.
++     * @param method the method being documented
++     * @param methodDocTree the content tree to which the tags will be added
+      */
+-    public void writeTags(MethodDoc method);
++    public void addTags(MethodDoc method, Content methodDocTree);
+ 
+     /**
+-     * Write the method footer.
++     * Get the method details tree.
++     *
++     * @param methodDetailsTree the content tree representing method details
++     * @return content tree for the method details
+      */
+-    public void writeMethodFooter();
++    public Content getMethodDetails(Content methodDetailsTree);
+ 
+     /**
+-     * Write the footer for the method documentation.
++     * Get the method documentation.
+      *
+-     * @param classDoc the class that the methods belong to.
++     * @param methodDocTree the content tree representing method documentation
++     * @param isLastContent true if the content to be added is the last content
++     * @return content tree for the method documentation
+      */
+-    public void writeFooter(ClassDoc classDoc);
++    public Content getMethodDoc(Content methodDocTree, boolean isLastContent);
+ 
+     /**
+      * Close the writer.
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/NestedClassWriter.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/NestedClassWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/NestedClassWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/NestedClassWriter.java
+@@ -26,7 +26,6 @@
+ package com.sun.tools.doclets.internal.toolkit;
+ 
+ import java.io.*;
+-import com.sun.javadoc.*;
+ 
+ /**
+  * The interface for writing class output.
+@@ -36,59 +35,13 @@
+  * Do not use it as an API
+  *
+  * @author Jamie Ho
++ * @author Bhavesh Patel (Modified)
+  * @since 1.5
+  */
+ 
+ public interface NestedClassWriter {
+ 
+     /**
+-     * Write the classes summary header for the given class.
+-     *
+-     * @param nestedClass the class the summary belongs to.
+-     */
+-    public void writeNestedClassSummaryHeader(ClassDoc nestedClass);
+-
+-    /**
+-     * Write the class summary for the given class and class.
+-     *
+-     * @param classDoc the class the summary belongs to.
+-     * @param nestedClass the nested class that I am summarizing.
+-     */
+-    public void writeNestedClassSummary(ClassDoc classDoc, ClassDoc nestedClass);
+-
+-    /**
+-     * Write the classes summary footer for the given class.
+-     *
+-     * @param nestedClass the class the summary belongs to.
+-     */
+-    public void writeNestedClassSummaryFooter(ClassDoc nestedClass);
+-
+-    /**
+-     * Write the inherited classes summary header for the given class.
+-     *
+-     * @param nestedClass the class the summary belongs to.
+-     */
+-    public void writeInheritedNestedClassSummaryHeader(ClassDoc nestedClass);
+-
+-    /**
+-     * Write the inherited nested class summary for the given class and nested
+-     * class.
+-     *
+-     * @param classDoc the class the inherited nested class belongs to.
+-     * @param nestedClass the inherited nested class that I am summarizing.
+-     * @param isFirst true if this is the first member in the list.
+-     */
+-    public void writeInheritedNestedClassSummary(ClassDoc classDoc,
+-            ClassDoc nestedClass, boolean isFirst);
+-
+-    /**
+-     * Write the inherited classes summary footer for the given class.
+-     *
+-     * @param nestedClass the class the summary belongs to.
+-     */
+-    public void writeInheritedNestedClassSummaryFooter(ClassDoc nestedClass);
+-
+-    /**
+      * Close the writer.
+      */
+     public void close() throws IOException;
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/PackageSummaryWriter.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/PackageSummaryWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/PackageSummaryWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/PackageSummaryWriter.java
+@@ -36,6 +36,7 @@
+  * Do not use it as an API
+  *
+  * @author Jamie Ho
++ * @author Bhavesh Patel (Modified)
+  * @since 1.5
+  */
+ 
+@@ -49,45 +50,70 @@
+     public abstract String getOutputFileName();
+ 
+     /**
+-     * Write the header for the package summary.
++     * Get the header for the summary.
++     *
++     * @param heading Package name.
++     * @return the header to be added to the content tree
+      */
+-    public abstract void writeSummaryHeader();
++    public abstract Content getPackageHeader(String heading);
+ 
+     /**
+-     * Write the footer for the package summary.
++     * Get the header for the package content.
++     *
++     * @return a content tree for the package content header
+      */
+-    public abstract void writeSummaryFooter();
++    public abstract Content getContentHeader();
+ 
+     /**
+-     * Write the table of classes in this package.
++     * Get the header for the package summary.
++     *
++     * @return a content tree with the package summary header
++     */
++    public abstract Content getSummaryHeader();
++
++    /**
++     * Adds the table of classes to the documentation tree.
+      *
+      * @param classes the array of classes to document.
+      * @param label the label for this table.
++     * @param tableSummary the summary string for the table
++     * @param tableHeader array of table headers
++     * @param summaryContentTree the content tree to which the summaries will be added
+      */
+-    public abstract void writeClassesSummary(ClassDoc[] classes, String label, String tableSummary, String[] tableHeader);
++    public abstract void addClassesSummary(ClassDoc[] classes, String label,
++            String tableSummary, String[] tableHeader, Content summaryContentTree);
+ 
+     /**
+-     * Write the header for the summary.
++     * Adds the package description from the "packages.html" file to the documentation
++     * tree.
+      *
+-     * @param heading Package name.
++     * @param packageContentTree the content tree to which the package description
++     *                           will be added
+      */
+-    public abstract void writePackageHeader(String heading);
++    public abstract void addPackageDescription(Content packageContentTree);
+ 
+     /**
+-     * Print the package description from the "packages.html" file.
++     * Adds the tag information from the "packages.html" file to the documentation
++     * tree.
++     *
++     * @param packageContentTree the content tree to which the package tags will
++     *                           be added
+      */
+-    public abstract void writePackageDescription();
++    public abstract void addPackageTags(Content packageContentTree);
+ 
+     /**
+-     * Print the tag information from the "packages.html" file.
++     * Adds the footer to the documentation tree.
++     *
++     * @param contentTree the tree to which the footer will be added
+      */
+-    public abstract void writePackageTags();
++    public abstract void addPackageFooter(Content contentTree);
+ 
+     /**
+-     * Write the footer for the summary.
++     * Print the package summary document.
+      *
++     * @param contentTree the content tree that will be printed
+      */
+-    public abstract void writePackageFooter();
++    public abstract void printDocument(Content contentTree);
+ 
+     /**
+      * Close the writer.
+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
+@@ -43,33 +43,73 @@
+ public interface SerializedFormWriter {
+ 
+     /**
+-     * Write the given header.
++     * Get the header.
+      *
+      * @param header the header to write.
++     * @return the header content tree
+      */
+-    public void writeHeader(String header);
++    public Content getHeader(String header);
+ 
+     /**
+-     * Write the given package header.
++     * Get the serialized form summaries header.
+      *
+-     * @param packageName the package header to write.
++     * @return the serialized form summary header tree
+      */
+-    public void writePackageHeader(String packageName);
++    public Content getSerializedSummariesHeader();
+ 
+     /**
+-     * Write the heading for the serializable class.
++     * Get the package serialized form header.
+      *
+-     * @param classDoc the class being processed.
++     * @return the package serialized form header tree
+      */
+-    public void writeClassHeader(ClassDoc classDoc);
++    public Content getPackageSerializedHeader();
+ 
+     /**
+-     * Write the serial UID info.
++     * Get the given package header.
++     *
++     * @param packageName the package header to write
++     * @return a content tree for the package header
++     */
++    public Content getPackageHeader(String packageName);
++
++    /**
++     * Get the serialized class header.
++     *
++     * @return a content tree for the serialized class header
++     */
++    public Content getClassSerializedHeader();
++
++    /**
++     * Get the heading for the serializable class.
++     *
++     * @param classDoc the class being processed
++     * @return a content tree for the class heading
++     */
++    public Content getClassHeader(ClassDoc classDoc);
++
++    /**
++     * Get the serial UID info header.
++     *
++     * @return a content tree for the serial uid info header
++     */
++    public Content getSerialUIDInfoHeader();
++
++    /**
++     * Adds the serial UID info.
+      *
+      * @param header the header that will show up before the UID.
+      * @param serialUID the serial UID to print.
++     * @param serialUidTree the serial UID tree to which the content will be added.
+      */
+-    public void writeSerialUIDInfo(String header, String serialUID);
++    public void addSerialUIDInfo(String header, String serialUID,
++            Content serialUidTree);
++
++    /**
++     * Get the class serialize content header.
++     *
++     * @return a content tree for the class serialize content header
++     */
++    public Content getClassContentHeader();
+ 
+     /**
+      * Return an instance of a SerialFieldWriter.
+@@ -91,9 +131,26 @@
+     public abstract void close() throws IOException;
+ 
+     /**
+-     * Write the footer.
++     * Get the serialized content.
++     *
++     * @param serializedTreeContent content for serialized data
++     * @return a content tree for serialized information
+      */
+-    public void writeFooter();
++    public Content getSerializedContent(Content serializedTreeContent);
++
++    /**
++     * Add the footer.
++     *
++     * @param serializedTree the serialized tree to be added
++     */
++    public void addFooter(Content serializedTree);
++
++    /**
++     * Print the serialized form document.
++     *
++     * @param serializedTree the content tree that will be printed
++     */
++    public abstract void printDocument(Content serializedTree);
+ 
+     /**
+      * Write the serialized form for a given field.
+@@ -101,56 +158,73 @@
+     public interface SerialFieldWriter {
+ 
+         /**
+-         * Write the given heading.
++         * Get the serializable field header.
++         *
++         * @return serialized fields header content tree
++         */
++        public Content getSerializableFieldsHeader();
++
++        /**
++         * Get the field content header.
++         *
++         * @param isLastContent true if this is the last content to be documented
++         * @return fields header content tree
++         */
++        public Content getFieldsContentHeader(boolean isLastContent);
++
++        /**
++         * Get the fields content.
+          *
+          * @param heading the heading to write.
++         * @param contentTree content tree to which the heading will be added
++         * @return serializable fields content tree
+          */
+-        public void writeHeader(String heading);
++        public Content getSerializableFields(String heading, Content contentTree);
+ 
+         /**
+-         * Write the deprecated information for this member.
++         * Adds the deprecated information for this member.
+          *
+          * @param field the field to document.
++         * @param contentTree content tree to which the deprecated information will be added
+          */
+-        public void writeMemberDeprecatedInfo(FieldDoc field);
++        public void addMemberDeprecatedInfo(FieldDoc field, Content contentTree);
+ 
+         /**
+-         * Write the description text for this member.
++         * Adds the description text for this member.
+          *
+          * @param field the field to document.
++         * @param contentTree content tree to which the member description will be added
+          */
+-        public void writeMemberDescription(FieldDoc field);
++        public void addMemberDescription(FieldDoc field, Content contentTree);
+ 
+         /**
+-         * Write the description text for this member represented by the tag.
++         * Adds the description text for this member represented by the tag.
+          *
+          * @param serialFieldTag the field to document (represented by tag).
++         * @param contentTree content tree to which the member description will be added
+          */
+-        public void writeMemberDescription(SerialFieldTag serialFieldTag);
++        public void addMemberDescription(SerialFieldTag serialFieldTag, Content contentTree);
+ 
+         /**
+-         * Write the tag information for this member.
++         * Adds the tag information for this member.
+          *
+          * @param field the field to document.
++         * @param contentTree content tree to which the member tags will be added
+          */
+-        public void writeMemberTags(FieldDoc field);
++        public void addMemberTags(FieldDoc field, Content contentTree);
+ 
+         /**
+-         * Write the member header.
++         * Adds the member header.
+          *
+          * @param fieldType the type of the field.
+          * @param fieldTypeStr the type of the field in string format.  We will
+          * print this out if we can't link to the type.
+          * @param fieldDimensions the dimensions of the field.
+          * @param fieldName the name of the field.
++         * @param contentTree content tree to which the member header will be added
+          */
+-        public void writeMemberHeader(ClassDoc fieldType, String fieldTypeStr,
+-            String fieldDimensions, String fieldName);
+-
+-        /**
+-         * Write the member footer.
+-         */
+-        public void writeMemberFooter();
++        public void addMemberHeader(ClassDoc fieldType, String fieldTypeStr,
++            String fieldDimensions, String fieldName, Content contentTree);
+ 
+         /**
+          * Check to see if overview details should be printed. If
+@@ -162,13 +236,6 @@
+          * @return true if overview details need to be printed
+          */
+         public boolean shouldPrintOverview(FieldDoc field);
+-
+-        /**
+-         * Write the footer.
+-         *
+-         * @param heading the heading that was written.
+-         */
+-        public void writeFooter (String heading);
+     }
+ 
+     /**
+@@ -177,44 +244,70 @@
+     public interface SerialMethodWriter {
+ 
+         /**
++         * Get the serializable method header.
++         *
++         * @return serializable methods content tree
++         */
++        public Content getSerializableMethodsHeader();
++
++        /**
++         * Get the method content header.
++         *
++         * @param isLastContent true if this is the last content to be documented
++         * @return methods content tree
++         */
++        public Content getMethodsContentHeader(boolean isLastContent);
++
++        /**
+          * Write the given heading.
+          *
+-         * @param heading the heading to write.
++         * @param heading the heading to write
++         * @param serializableMethodTree content tree which will be added
++         * @return serializable methods content tree
+          */
+-        public void writeHeader(String heading);
++        public Content getSerializableMethods(String heading, Content serializableMethodTree);
+ 
+         /**
+          * Write a warning that no serializable methods exist.
+          *
+-         * @param msg the warning to print.
++         * @param msg the warning to print
++         * @return no customization message tree
+          */
+-        public void writeNoCustomizationMsg(String msg);
++        public Content getNoCustomizationMsg(String msg);
+ 
+         /**
+-         * Write the header.
++         * Adds the header.
+          *
+-         * @param member the member to write the header for.
++         * @param member the member to write the header for
++         * @param methodsContentTree content tree to which the header will be added
+          */
+-        public void writeMemberHeader(MethodDoc member);
++        public void addMemberHeader(MethodDoc member, Content methodsContentTree);
+ 
+         /**
+-         * Write the footer.
++         * Adds the deprecated information for this member.
++         *
++         * @param member the member to write the deprecated information for
++         * @param methodsContentTree content tree to which the deprecated
++         * information will be added
+          */
+-        public void writeMemberFooter();
++        public void addDeprecatedMemberInfo(MethodDoc member, Content methodsContentTree);
+ 
+         /**
+-         * Write the deprecated information for this member.
++         * Adds the description for this member.
++         *
++         * @param member the member to write the information for
++         * @param methodsContentTree content tree to which the member
++         * information will be added
+          */
+-        public void writeDeprecatedMemberInfo(MethodDoc member);
++        public void addMemberDescription(MethodDoc member, Content methodsContentTree);
+ 
+         /**
+-         * Write the description for this member.
++         * Adds the tag information for this member.
++         *
++         * @param member the member to write the tags information for
++         * @param methodsContentTree content tree to which the tags
++         * information will be added
+          */
+-        public void writeMemberDescription(MethodDoc member);
+-
+-        /**
+-         * Write the tag information for this member.
+-         */
+-        public void writeMemberTags(MethodDoc member);
++        public void addMemberTags(MethodDoc member, Content methodsContentTree);
+     }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java
+@@ -95,13 +95,14 @@
+      * Build the documentation, as specified by the given XML element.
+      *
+      * @param node the XML element that specifies which component to document.
++     * @param contentTree content tree to which the documentation will be added
+      */
+     protected void build(XMLNode node) {
+         String component = node.name;
+         try {
+             invokeMethod("build" + component,
+-                    new Class<?>[] { XMLNode.class },
+-                    new Object[] { node });
++                    new Class<?>[]{XMLNode.class, Content.class},
++                    new Object[]{node, contentTree});
+         } catch (NoSuchMethodException e) {
+             e.printStackTrace();
+             configuration.root.printError("Unknown element: " + component);
+@@ -111,8 +112,8 @@
+         } catch (Exception e) {
+             e.printStackTrace();
+             configuration.root.printError("Exception " +
+-                e.getClass().getName() +
+-                " thrown while processing element: " + component);
++                    e.getClass().getName() +
++                    " thrown while processing element: " + component);
+             throw new DocletAbortException();
+         }
+     }
+@@ -121,10 +122,11 @@
+      * Build the documentation, as specified by the children of the given XML element.
+      *
+      * @param node the XML element that specifies which components to document.
++     * @param contentTree content tree to which the documentation will be added
+      */
+-    protected void buildChildren(XMLNode node) {
+-        for (XMLNode child: node.children)
+-            build(child);
++    protected void buildChildren(XMLNode node, Content contentTree) {
++        for (XMLNode child : node.children)
++            build(child, contentTree);
+     }
+ 
+     /**
+@@ -140,8 +142,7 @@
+              Object[] params)
+     throws Exception {
+         if (DEBUG) {
+-            configuration.root.printError("DEBUG: " + this.getClass().getName()
+-                + "." + methodName);
++            configuration.root.printError("DEBUG: " + this.getClass().getName() + "." + methodName);
+         }
+         Method method = this.getClass().getMethod(methodName, paramClasses);
+         method.invoke(this, params);
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractMemberBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractMemberBuilder.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractMemberBuilder.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractMemberBuilder.java
+@@ -27,6 +27,7 @@
+ 
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
++import java.util.*;
+ 
+ /**
+  * The superclass for all member builders.  Member builders are only executed
+@@ -66,12 +67,13 @@
+     /**
+      * Build the sub component if there is anything to document.
+      *
+-     * @param elements {@inheritDoc}
++     * @param node the XML element that specifies which components to document.
++     * @param contentTree content tree to which the documentation will be added
+      */
+     @Override
+-    public void build(XMLNode node) {
++    public void build(XMLNode node, Content contentTree) {
+         if (hasMembersToDocument()) {
+-            super.build(node);
++            super.build(node, contentTree);
+         }
+     }
+ 
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+  * 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,11 +25,11 @@
+ 
+ package com.sun.tools.doclets.internal.toolkit.builders;
+ 
++import java.io.*;
++import java.util.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.javadoc.*;
+-import java.io.*;
+-import java.util.*;
+ 
+ /**
+  * Builds the summary for a given annotation type.
+@@ -39,6 +39,7 @@
+  * Do not use it as an API
+  *
+  * @author Jamie Ho
++ * @author Bhavesh Patel (Modified)
+  * @since 1.5
+  */
+ public class AnnotationTypeBuilder extends AbstractBuilder {
+@@ -59,6 +60,11 @@
+     private AnnotationTypeWriter writer;
+ 
+     /**
++     * The content tree for the annotation documentation.
++     */
++    private Content contentTree;
++
++    /**
+      * Construct a new ClassBuilder.
+      *
+      * @param configuration the current configuration of the
+@@ -83,7 +89,7 @@
+         builder.annotationTypeDoc = annotationTypeDoc;
+         builder.writer = writer;
+         if(containingPackagesSeen == null) {
+-            containingPackagesSeen = new HashSet();
++            containingPackagesSeen = new HashSet<String>();
+         }
+         return builder;
+     }
+@@ -92,7 +98,7 @@
+      * {@inheritDoc}
+      */
+     public void build() throws IOException {
+-        build(LayoutParser.getInstance(configuration).parseXML(ROOT));
++        build(LayoutParser.getInstance(configuration).parseXML(ROOT), contentTree);
+     }
+ 
+     /**
+@@ -102,18 +108,24 @@
+         return ROOT;
+     }
+ 
+-     /**
+-      * Handles the <AnnotationTypeDoc> tag.
++    /**
++      * Build the annotation type documentation.
+       *
+-      * @param elements the XML elements that specify how to document a class.
++      * @param node the XML element that specifies which components to document
++      * @param contentTree the content tree to which the documentation will be added
+       */
+-     public void buildAnnotationTypeDoc(XMLNode node) throws Exception {
+-        buildChildren(node);
+-        writer.close();
+-        copyDocFiles();
++     public void buildAnnotationTypeDoc(XMLNode node, Content contentTree) throws Exception {
++        contentTree = writer.getHeader(configuration.getText("doclet.AnnotationType") +
++                " " + annotationTypeDoc.name());
++        Content annotationContentTree = writer.getAnnotationContentHeader();
++         buildChildren(node, annotationContentTree);
++         contentTree.addContent(annotationContentTree);
++         writer.addFooter(contentTree);
++         writer.printDocument(contentTree);
++         writer.close();
++         copyDocFiles();
+      }
+ 
+-
+      /**
+       * Copy the doc files for the current ClassDoc if necessary.
+       */
+@@ -137,86 +149,112 @@
+      }
+ 
+     /**
+-     * Build the header of the page.
++     * Build the annotation information tree documentation.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param annotationContentTree the content tree to which the documentation will be added
+      */
+-    public void buildAnnotationTypeHeader(XMLNode node) {
+-        writer.writeHeader(configuration.getText("doclet.AnnotationType") +
+-            " " + annotationTypeDoc.name());
++    public void buildAnnotationTypeInfo(XMLNode node, Content annotationContentTree) {
++        Content annotationInfoTree = writer.getAnnotationInfoTreeHeader();
++        buildChildren(node, annotationInfoTree);
++        annotationContentTree.addContent(writer.getAnnotationInfo(annotationInfoTree));
+     }
+ 
+     /**
+-     * If this class is deprecated, print the appropriate information.
++     * If this annotation is deprecated, build the appropriate information.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param annotationInfoTree the content tree to which the documentation will be added
+      */
+-    public void buildDeprecationInfo (XMLNode node) {
+-        writer.writeAnnotationTypeDeprecationInfo();
++    public void buildDeprecationInfo (XMLNode node, Content annotationInfoTree) {
++        writer.addAnnotationTypeDeprecationInfo(annotationInfoTree);
+     }
+ 
+     /**
+      * Build the signature of the current annotation type.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param annotationInfoTree the content tree to which the documentation will be added
+      */
+-    public void buildAnnotationTypeSignature(XMLNode node) {
++    public void buildAnnotationTypeSignature(XMLNode node, Content annotationInfoTree) {
+         StringBuffer modifiers = new StringBuffer(
+-            annotationTypeDoc.modifiers() + " ");
+-        writer.writeAnnotationTypeSignature(
+-            Util.replaceText(
+-                modifiers.toString(), "interface", "@interface"));
++                annotationTypeDoc.modifiers() + " ");
++        writer.addAnnotationTypeSignature(Util.replaceText(
++                modifiers.toString(), "interface", "@interface"), annotationInfoTree);
+     }
+ 
+     /**
+-     * Build the class description.
++     * Build the annotation type description.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param annotationInfoTree the content tree to which the documentation will be added
+      */
+-    public void buildAnnotationTypeDescription(XMLNode node) {
+-       writer.writeAnnotationTypeDescription();
++    public void buildAnnotationTypeDescription(XMLNode node, Content annotationInfoTree) {
++        writer.addAnnotationTypeDescription(annotationInfoTree);
+     }
+ 
+     /**
+-     * Build the tag information for the current class.
++     * Build the tag information for the current annotation type.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param annotationInfoTree the content tree to which the documentation will be added
+      */
+-    public void buildAnnotationTypeTagInfo(XMLNode node) {
+-       writer.writeAnnotationTypeTagInfo();
++    public void buildAnnotationTypeTagInfo(XMLNode node, Content annotationInfoTree) {
++        writer.addAnnotationTypeTagInfo(annotationInfoTree);
+     }
+ 
+     /**
+-     * Build the contents of the page.
++     * Build the member summary contents of the page.
+      *
+-     * @param elements the XML elements that specify how a member summary is
+-     *                 documented.
++     * @param node the XML element that specifies which components to document
++     * @param annotationContentTree the content tree to which the documentation will be added
+      */
+-    public void buildMemberSummary(XMLNode node) throws Exception {
++    public void buildMemberSummary(XMLNode node, Content annotationContentTree)
++            throws Exception {
++        Content memberSummaryTree = writer.getMemberTreeHeader();
+         configuration.getBuilderFactory().
+-            getMemberSummaryBuilder(writer).buildChildren(node);
+-        writer.completeMemberSummaryBuild();
++                getMemberSummaryBuilder(writer).buildChildren(node, memberSummaryTree);
++        annotationContentTree.addContent(writer.getMemberSummaryTree(memberSummaryTree));
++    }
++
++    /**
++     * Build the member details contents of the page.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param annotationContentTree the content tree to which the documentation will be added
++     */
++    public void buildAnnotationTypeMemberDetails(XMLNode node, Content annotationContentTree) {
++        Content memberDetailsTree = writer.getMemberTreeHeader();
++        buildChildren(node, memberDetailsTree);
++        if (memberDetailsTree.isValid()) {
++            Content memberDetails = writer.getMemberTreeHeader();
++            writer.addAnnotationDetailsMarker(memberDetails);
++            memberDetails.addContent(writer.getMemberTree(memberDetailsTree));
++            annotationContentTree.addContent(writer.getMemberDetailsTree(memberDetails));
++        }
+     }
+ 
+     /**
+      * Build the annotation type optional member documentation.
+      *
+-     * @param elements the XML elements that specify how a annotation type
+-     *                 members are documented.
++     * @param node the XML element that specifies which components to document
++     * @param memberDetailsTree the content tree to which the documentation will be added
+      */
+-    public void buildAnnotationTypeOptionalMemberDetails(XMLNode node)
+-    throws Exception {
++    public void buildAnnotationTypeOptionalMemberDetails(XMLNode node, Content memberDetailsTree)
++            throws Exception {
+         configuration.getBuilderFactory().
+-            getAnnotationTypeOptionalMemberBuilder(writer).buildChildren(node);
++                getAnnotationTypeOptionalMemberBuilder(writer).buildChildren(node, memberDetailsTree);
+     }
+ 
+     /**
+      * Build the annotation type required member documentation.
+      *
+-     * @param elements the XML elements that specify how a annotation type
+-     *                 members are documented.
++     * @param node the XML element that specifies which components to document
++     * @param memberDetailsTree the content tree to which the documentation will be added
+      */
+-    public void buildAnnotationTypeRequiredMemberDetails(XMLNode node)
+-    throws Exception {
++    public void buildAnnotationTypeRequiredMemberDetails(XMLNode node, Content memberDetailsTree)
++            throws Exception {
+         configuration.getBuilderFactory().
+-            getAnnotationTypeRequiredMemberBuilder(writer).buildChildren(node);
+-    }
+-
+-
+-    /**
+-     * Build the footer of the page.
+-     */
+-    public void buildAnnotationTypeFooter(XMLNode node) {
+-        writer.writeFooter();
++                getAnnotationTypeRequiredMemberBuilder(writer).buildChildren(node, memberDetailsTree);
+     }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeOptionalMemberBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeOptionalMemberBuilder.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeOptionalMemberBuilder.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeOptionalMemberBuilder.java
+@@ -25,11 +25,10 @@
+ 
+ package com.sun.tools.doclets.internal.toolkit.builders;
+ 
+-
++import java.util.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.javadoc.*;
+-import java.util.*;
+ 
+ /**
+  * Builds documentation for optional annotation type members.
+@@ -39,6 +38,7 @@
+  * Do not use it as an API
+  *
+  * @author Jamie Ho
++ * @author Bhavesh Patel (Modified)
+  * @since 1.5
+  */
+ public class AnnotationTypeOptionalMemberBuilder extends
+@@ -90,27 +90,25 @@
+     }
+ 
+     /**
+-     * Build the member documentation.
++     * Build the annotation type optional member documentation.
+      *
+-     * @param elements the XML elements that specify how to construct this
+-     *                documentation.
++     * @param node the XML element that specifies which components to document
++     * @param memberDetailsTree the content tree to which the documentation will be added
+      */
+-    public void buildAnnotationTypeOptionalMember(XMLNode node) {
+-        if (writer == null) {
+-            return;
+-        }
+-        for (currentMemberIndex = 0; currentMemberIndex < members.size();
+-            currentMemberIndex++) {
+-            buildChildren(node);
+-        }
++    public void buildAnnotationTypeOptionalMember(XMLNode node, Content memberDetailsTree) {
++        buildAnnotationTypeMember(node, memberDetailsTree);
+     }
+ 
+     /**
+-     * Document the default value for this optional member.
++     * Build the default value for this optional member.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param annotationDocTree the content tree to which the documentation will be added
+      */
+-    public void buildDefaultValueInfo(XMLNode node) {
+-        ((AnnotationTypeOptionalMemberWriter) writer).writeDefaultValueInfo(
+-            (MemberDoc) members.get(currentMemberIndex));
++    public void buildDefaultValueInfo(XMLNode node, Content annotationDocTree) {
++        ((AnnotationTypeOptionalMemberWriter) writer).addDefaultValueInfo(
++                (MemberDoc) members.get(currentMemberIndex),
++                annotationDocTree);
+     }
+ 
+     /**
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java
+@@ -25,11 +25,10 @@
+ 
+ package com.sun.tools.doclets.internal.toolkit.builders;
+ 
+-
++import java.util.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.javadoc.*;
+-import java.util.*;
+ 
+ /**
+  * Builds documentation for required annotation type members.
+@@ -39,6 +38,7 @@
+  * Do not use it as an API
+  *
+  * @author Jamie Ho
++ * @author Bhavesh Patel (Modified)
+  * @since 1.5
+  */
+ public class AnnotationTypeRequiredMemberBuilder extends AbstractMemberBuilder {
+@@ -141,81 +141,86 @@
+     }
+ 
+     /**
++     * Build the annotation type required member documentation.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param memberDetailsTree the content tree to which the documentation will be added
++     */
++    public void buildAnnotationTypeRequiredMember(XMLNode node, Content memberDetailsTree) {
++        buildAnnotationTypeMember(node, memberDetailsTree);
++    }
++
++    /**
+      * Build the member documentation.
+      *
+-     * @param elements the XML elements that specify how to construct this
+-     *                documentation.
++     * @param node the XML element that specifies which components to document
++     * @param memberDetailsTree the content tree to which the documentation will be added
+      */
+-    public void buildAnnotationTypeRequiredMember(XMLNode node) {
++    public void buildAnnotationTypeMember(XMLNode node, Content memberDetailsTree) {
+         if (writer == null) {
+             return;
+         }
+-        for (currentMemberIndex = 0; currentMemberIndex < members.size();
++        int size = members.size();
++        if (size > 0) {
++            writer.addAnnotationDetailsTreeHeader(
++                    classDoc, memberDetailsTree);
++            for (currentMemberIndex = 0; currentMemberIndex < size;
+             currentMemberIndex++) {
+-            buildChildren(node);
+-        }
+-    }
+-
+-    /**
+-     * Build the overall header.
+-     */
+-    public void buildHeader(XMLNode node) {
+-        writer.writeHeader(classDoc,
+-            configuration.getText("doclet.Annotation_Type_Member_Detail"));
+-    }
+-
+-    /**
+-     * Build the header for the individual members.
+-     */
+-    public void buildMemberHeader(XMLNode node) {
+-        writer.writeMemberHeader((MemberDoc) members.get(
+-                currentMemberIndex),
+-            currentMemberIndex == 0);
++                Content annotationDocTree = writer.getAnnotationDocTreeHeader(
++                        (MemberDoc) members.get(currentMemberIndex),
++                        memberDetailsTree);
++                buildChildren(node, annotationDocTree);
++                memberDetailsTree.addContent(writer.getAnnotationDoc(
++                        annotationDocTree, (currentMemberIndex == size - 1)));
++            } 
++       }
+     }
+ 
+     /**
+      * Build the signature.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param annotationDocTree the content tree to which the documentation will be added
+      */
+-    public void buildSignature(XMLNode node) {
+-        writer.writeSignature((MemberDoc) members.get(currentMemberIndex));
++    public void buildSignature(XMLNode node, Content annotationDocTree) {
++        annotationDocTree.addContent(
++                writer.getSignature((MemberDoc) members.get(currentMemberIndex)));
+     }
+ 
+     /**
+      * Build the deprecation information.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param annotationDocTree the content tree to which the documentation will be added
+      */
+-    public void buildDeprecationInfo(XMLNode node) {
+-        writer.writeDeprecated((MemberDoc) members.get(currentMemberIndex));
++    public void buildDeprecationInfo(XMLNode node, Content annotationDocTree) {
++        writer.addDeprecated((MemberDoc) members.get(currentMemberIndex),
++                annotationDocTree);
+     }
+ 
+     /**
+      * Build the comments for the member.  Do nothing if
+      * {@link Configuration#nocomment} is set to true.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param annotationDocTree the content tree to which the documentation will be added
+      */
+-    public void buildMemberComments(XMLNode node) {
++    public void buildMemberComments(XMLNode node, Content annotationDocTree) {
+         if(! configuration.nocomment){
+-            writer.writeComments((MemberDoc) members.get(currentMemberIndex));
++            writer.addComments((MemberDoc) members.get(currentMemberIndex),
++                    annotationDocTree);
+         }
+     }
+ 
+     /**
+      * Build the tag information.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param annotationDocTree the content tree to which the documentation will be added
+      */
+-    public void buildTagInfo(XMLNode node) {
+-        writer.writeTags((MemberDoc) members.get(currentMemberIndex));
+-    }
+-
+-    /**
+-     * Build the footer for the individual member.
+-     */
+-    public void buildMemberFooter(XMLNode node) {
+-        writer.writeMemberFooter();
+-    }
+-
+-    /**
+-     * Build the overall footer.
+-     */
+-    public void buildFooter(XMLNode node) {
+-        writer.writeFooter(classDoc);
++    public void buildTagInfo(XMLNode node, Content annotationDocTree) {
++        writer.addTags((MemberDoc) members.get(currentMemberIndex),
++                annotationDocTree);
+     }
+ 
+     /**
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java
+@@ -25,11 +25,11 @@
+ 
+ package com.sun.tools.doclets.internal.toolkit.builders;
+ 
++import java.io.*;
++import java.util.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.javadoc.*;
+-import java.io.*;
+-import java.util.*;
+ 
+ /**
+  * Builds the summary for a given class.
+@@ -39,6 +39,7 @@
+  * Do not use it as an API
+  *
+  * @author Jamie Ho
++ * @author Bhavesh Patel (Modified)
+  * @since 1.5
+  */
+ public class ClassBuilder extends AbstractBuilder {
+@@ -69,6 +70,11 @@
+     private boolean isEnum = false;
+ 
+     /**
++     * The content tree for the class documentation.
++     */
++    private Content contentTree;
++
++    /**
+      * Construct a new ClassBuilder.
+      *
+      * @param configuration the current configuration of the
+@@ -108,7 +114,7 @@
+      * {@inheritDoc}
+      */
+     public void build() throws IOException {
+-        build(LayoutParser.getInstance(configuration).parseXML(ROOT));
++        build(LayoutParser.getInstance(configuration).parseXML(ROOT), contentTree);
+     }
+ 
+     /**
+@@ -121,121 +127,159 @@
+      /**
+       * Handles the <ClassDoc> tag.
+       *
+-      * @param elements the XML elements that specify how to document a class.
++      * @param node the XML element that specifies which components to document
++      * @param contentTree the content tree to which the documentation will be added
+       */
+-     public void buildClassDoc(XMLNode node) throws Exception {
+-        buildChildren(node);
+-        writer.close();
+-        copyDocFiles();
++     public void buildClassDoc(XMLNode node, Content contentTree) throws Exception {
++         String key;
++         if (isInterface) {
++             key =  "doclet.Interface";
++         } else if (isEnum) {
++             key = "doclet.Enum";
++         } else {
++             key =  "doclet.Class";
++         }
++         contentTree = writer.getHeader(configuration.getText(key) + " " +
++                 classDoc.name());
++         Content classContentTree = writer.getClassContentHeader();
++         buildChildren(node, classContentTree);
++         contentTree.addContent(classContentTree);
++         writer.addFooter(contentTree);
++         writer.printDocument(contentTree);
++         writer.close();
++         copyDocFiles();
+      }
+ 
++     /**
++      * Build the class tree documentation.
++      *
++      * @param node the XML element that specifies which components to document
++      * @param classContentTree the content tree to which the documentation will be added
++      */
++    public void buildClassTree(XMLNode node, Content classContentTree) {
++        writer.addClassTree(classContentTree);
++    }
+ 
+-     /**
+-      * Copy the doc files for the current ClassDoc if necessary.
+-      */
++    /**
++     * Build the class information tree documentation.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param classContentTree the content tree to which the documentation will be added
++     */
++    public void buildClassInfo(XMLNode node, Content classContentTree) {
++        Content classInfoTree = writer.getClassInfoTreeHeader();
++        buildChildren(node, classInfoTree);
++        classContentTree.addContent(writer.getClassInfo(classInfoTree));
++    }
++
++    /**
++     * Build the typeparameters of this class.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param classInfoTree the content tree to which the documentation will be added
++     */
++    public void buildTypeParamInfo(XMLNode node, Content classInfoTree) {
++        writer.addTypeParamInfo(classInfoTree);
++    }
++
++    /**
++     * If this is an interface, list all super interfaces.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param classInfoTree the content tree to which the documentation will be added
++     */
++    public void buildSuperInterfacesInfo(XMLNode node, Content classInfoTree) {
++        writer.addSuperInterfacesInfo(classInfoTree);
++    }
++
++    /**
++     * If this is a class, list all interfaces implemented by this class.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param classInfoTree the content tree to which the documentation will be added
++     */
++    public void buildImplementedInterfacesInfo(XMLNode node, Content classInfoTree) {
++        writer.addImplementedInterfacesInfo(classInfoTree);
++    }
++
++    /**
++     * List all the classes extend this one.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param classInfoTree the content tree to which the documentation will be added
++     */
++    public void buildSubClassInfo(XMLNode node, Content classInfoTree) {
++        writer.addSubClassInfo(classInfoTree);
++    }
++
++    /**
++     * List all the interfaces that extend this one.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param classInfoTree the content tree to which the documentation will be added
++     */
++    public void buildSubInterfacesInfo(XMLNode node, Content classInfoTree) {
++        writer.addSubInterfacesInfo(classInfoTree);
++    }
++
++    /**
++     * If this is an interface, list all classes that implement this interface.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param classInfoTree the content tree to which the documentation will be added
++     */
++    public void buildInterfaceUsageInfo(XMLNode node, Content classInfoTree) {
++        writer.addInterfaceUsageInfo(classInfoTree);
++    }
++
++    /**
++     * If this class is deprecated, build the appropriate information.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param classInfoTree the content tree to which the documentation will be added
++     */
++    public void buildDeprecationInfo (XMLNode node, Content classInfoTree) {
++        writer.addClassDeprecationInfo(classInfoTree);
++    }
++
++    /**
++     * If this is an inner class or interface, list the enclosing class or interface.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param classInfoTree the content tree to which the documentation will be added
++     */
++    public void buildNestedClassInfo (XMLNode node, Content classInfoTree) {
++        writer.addNestedClassInfo(classInfoTree);
++    }
++
++    /**
++     * Copy the doc files for the current ClassDoc if necessary.
++     */
+      private void copyDocFiles() {
+         PackageDoc containingPackage = classDoc.containingPackage();
+         if((configuration.packages == null ||
+                 Arrays.binarySearch(configuration.packages,
+-                                    containingPackage) < 0) &&
+-           ! containingPackagesSeen.contains(containingPackage.name())){
++                containingPackage) < 0) &&
++                ! containingPackagesSeen.contains(containingPackage.name())){
+             //Only copy doc files dir if the containing package is not
+             //documented AND if we have not documented a class from the same
+             //package already. Otherwise, we are making duplicate copies.
+             Util.copyDocFiles(configuration,
+-                Util.getPackageSourcePath(configuration,
++                    Util.getPackageSourcePath(configuration,
+                     classDoc.containingPackage()) +
+-                DirectoryManager.getDirectoryPath(classDoc.containingPackage())
++                    DirectoryManager.getDirectoryPath(classDoc.containingPackage())
+                     + File.separator, DocletConstants.DOC_FILES_DIR_NAME, true);
+             containingPackagesSeen.add(containingPackage.name());
+         }
+      }
+ 
+     /**
+-     * Build the header of the page.
++     * Build the signature of the current class.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param classInfoTree the content tree to which the documentation will be added
+      */
+-    public void buildClassHeader(XMLNode node) {
+-        String key;
+-        if (isInterface) {
+-            key =  "doclet.Interface";
+-        } else if (isEnum) {
+-            key = "doclet.Enum";
+-        } else {
+-            key =  "doclet.Class";
+-        }
+-
+-        writer.writeHeader(configuration.getText(key) + " " + classDoc.name());
+-    }
+-
+-    /**
+-     * Build the class tree documentation.
+-     */
+-    public void buildClassTree(XMLNode node) {
+-        writer.writeClassTree();
+-    }
+-
+-    /**
+-     * If this is a class, list all interfaces
+-     * implemented by this class.
+-     */
+-    public void buildImplementedInterfacesInfo(XMLNode node) {
+-        writer.writeImplementedInterfacesInfo();
+-    }
+-
+-    /**
+-     * If this is an interface, list all super interfaces.
+-     */
+-    public void buildSuperInterfacesInfo(XMLNode node) {
+-        writer.writeSuperInterfacesInfo();
+-    }
+-
+-    /**
+-     * List the parameters of this class.
+-     */
+-    public void buildTypeParamInfo(XMLNode node) {
+-        writer.writeTypeParamInfo();
+-    }
+-
+-    /**
+-     * List all the classes extend this one.
+-     */
+-    public void buildSubClassInfo(XMLNode node) {
+-        writer.writeSubClassInfo();
+-    }
+-
+-    /**
+-     * List all the interfaces that extend this one.
+-     */
+-    public void buildSubInterfacesInfo(XMLNode node) {
+-        writer.writeSubInterfacesInfo();
+-    }
+-
+-    /**
+-     * If this is an interface, list all classes that implement this interface.
+-     */
+-    public void buildInterfaceUsageInfo (XMLNode node) {
+-        writer.writeInterfaceUsageInfo();
+-    }
+-
+-    /**
+-     * If this is an inner class or interface, list the enclosing class or
+-     * interface.
+-     */
+-    public void buildNestedClassInfo (XMLNode node) {
+-        writer.writeNestedClassInfo();
+-    }
+-
+-    /**
+-     * If this class is deprecated, print the appropriate information.
+-     */
+-    public void buildDeprecationInfo (XMLNode node) {
+-        writer.writeClassDeprecationInfo();
+-    }
+-
+-    /**
+-     * Build the signature of the current class.
+-     */
+-    public void buildClassSignature(XMLNode node) {
++    public void buildClassSignature(XMLNode node, Content classInfoTree) {
+         StringBuffer modifiers = new StringBuffer(classDoc.modifiers() + " ");
+         if (isEnum) {
+             modifiers.append("enum ");
+@@ -243,93 +287,111 @@
+             if ((index = modifiers.indexOf("abstract")) >= 0) {
+                 modifiers.delete(index, index + (new String("abstract")).length());
+                 modifiers = new StringBuffer(
+-                    Util.replaceText(modifiers.toString(), "  ", " "));
++                        Util.replaceText(modifiers.toString(), "  ", " "));
+             }
+             if ((index = modifiers.indexOf("final")) >= 0) {
+                 modifiers.delete(index, index + (new String("final")).length());
+                 modifiers = new StringBuffer(
+-                    Util.replaceText(modifiers.toString(), "  ", " "));
++                        Util.replaceText(modifiers.toString(), "  ", " "));
+             }
+         //} else if (classDoc.isAnnotationType()) {
+             //modifiers.append("@interface ");
+         } else if (! isInterface) {
+             modifiers.append("class ");
+         }
+-        writer.writeClassSignature(modifiers.toString());
++        writer.addClassSignature(modifiers.toString(), classInfoTree);
+     }
+ 
+     /**
+      * Build the class description.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param classInfoTree the content tree to which the documentation will be added
+      */
+-    public void buildClassDescription(XMLNode node) {
+-       writer.writeClassDescription();
++    public void buildClassDescription(XMLNode node, Content classInfoTree) {
++       writer.addClassDescription(classInfoTree);
+     }
+ 
+     /**
+      * Build the tag information for the current class.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param classInfoTree the content tree to which the documentation will be added
+      */
+-    public void buildClassTagInfo(XMLNode node) {
+-       writer.writeClassTagInfo();
++    public void buildClassTagInfo(XMLNode node, Content classInfoTree) {
++       writer.addClassTagInfo(classInfoTree);
+     }
+ 
+     /**
+-     * Build the contents of the page.
++     * Build the member summary contents of the page.
+      *
+-     * @param elements the XML elements that specify how a member summary is
+-     *                 documented.
++     * @param node the XML element that specifies which components to document
++     * @param classContentTree the content tree to which the documentation will be added
+      */
+-    public void buildMemberSummary(List elements) throws Exception {
++    public void buildMemberSummary(XMLNode node, Content classContentTree) throws Exception {
++        Content memberSummaryTree = writer.getMemberTreeHeader();
+         configuration.getBuilderFactory().
+-            getMemberSummaryBuilder(writer).buildChildren(node);
+-        writer.completeMemberSummaryBuild();
++                getMemberSummaryBuilder(writer).buildChildren(node, memberSummaryTree);
++        classContentTree.addContent(writer.getMemberSummaryTree(memberSummaryTree));
++    }
++
++    /**
++     * Build the member details contents of the page.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param classContentTree the content tree to which the documentation will be added
++     */
++    public void buildMemberDetails(XMLNode node, Content classContentTree) {
++        Content memberDetailsTree = writer.getMemberTreeHeader();
++        buildChildren(node, memberDetailsTree);
++        classContentTree.addContent(writer.getMemberDetailsTree(memberDetailsTree));
+     }
+ 
+     /**
+      * Build the enum constants documentation.
+      *
+-     * @param elements the XML elements that specify how a enum constants are
+-     *                 documented.
++     * @param node the XML element that specifies which components to document
++     * @param memberDetailsTree the content tree to which the documentation will be added
+      */
+-    public void buildEnumConstantsDetails(XMLNode node) throws Exception {
++    public void buildEnumConstantsDetails(XMLNode node,
++            Content memberDetailsTree) throws Exception {
+         configuration.getBuilderFactory().
+-            getEnumConstantsBuilder(writer).buildChildren(node);
++                getEnumConstantsBuilder(writer).buildChildren(node, memberDetailsTree);
+     }
+ 
+     /**
+      * Build the field documentation.
+      *
+-     * @param elements the XML elements that specify how a field is documented.
++     * @param node the XML element that specifies which components to document
++     * @param memberDetailsTree the content tree to which the documentation will be added
+      */
+-    public void buildFieldDetails(XMLNode node) throws Exception {
++    public void buildFieldDetails(XMLNode node,
++            Content memberDetailsTree) throws Exception {
+         configuration.getBuilderFactory().
+-            getFieldBuilder(writer).buildChildren(node);
++                getFieldBuilder(writer).buildChildren(node, memberDetailsTree);
+     }
+ 
+     /**
+      * Build the constructor documentation.
+      *
+-     * @param elements the XML elements that specify how to document a
+-     * constructor.
++     * @param node the XML element that specifies which components to document
++     * @param memberDetailsTree the content tree to which the documentation will be added
+      */
+-    public void buildConstructorDetails(XMLNode node) throws Exception {
++    public void buildConstructorDetails(XMLNode node,
++            Content memberDetailsTree) throws Exception {
+         configuration.getBuilderFactory().
+-            getConstructorBuilder(writer).buildChildren(node);
++                getConstructorBuilder(writer).buildChildren(node, memberDetailsTree);
+     }
+ 
+     /**
+      * Build the method documentation.
+      *
+-     * @param elements the XML elements that specify how a method is documented.
++     * @param node the XML element that specifies which components to document
++     * @param memberDetailsTree the content tree to which the documentation will be added
+      */
+-    public void buildMethodDetails(XMLNode node) throws Exception {
++    public void buildMethodDetails(XMLNode node,
++            Content memberDetailsTree) throws Exception {
+         configuration.getBuilderFactory().
+-                getMethodBuilder(writer).buildChildren(node);
+-    }
+-
+-    /**
+-     * Build the footer of the page.
+-     */
+-    public void buildClassFooter(XMLNode node) {
+-        writer.writeFooter();
++                getMethodBuilder(writer).buildChildren(node, memberDetailsTree);
+     }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java
+@@ -25,11 +25,11 @@
+ 
+ package com.sun.tools.doclets.internal.toolkit.builders;
+ 
++import java.io.*;
++import java.util.*;
++import com.sun.javadoc.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+-import com.sun.javadoc.*;
+-import java.io.*;
+-import java.util.*;
+ 
+ /**
+  * Builds the Constants Summary Page.
+@@ -39,6 +39,7 @@
+  * Do not use it as an API
+  *
+  * @author Jamie Ho
++ * @author Bhavesh Patel (Modified)
+  * @since 1.5
+  */
+ public class ConstantsSummaryBuilder extends AbstractBuilder {
+@@ -80,6 +81,11 @@
+     private ClassDoc currentClass;
+ 
+     /**
++     * The content tree for the constant summary documentation.
++     */
++    private Content contentTree;
++
++    /**
+      * Construct a new ConstantsSummaryBuilder.
+      *
+      * @param configuration the current configuration of the
+@@ -113,7 +119,7 @@
+             //Doclet does not support this output.
+             return;
+         }
+-        build(LayoutParser.getInstance(configuration).parseXML(ROOT));
++        build(LayoutParser.getInstance(configuration).parseXML(ROOT), contentTree);
+     }
+ 
+     /**
+@@ -126,85 +132,85 @@
+     /**
+      * Build the constant summary.
+      *
+-     * @param elements the list of elements describing constant summary
+-     *                 documentation.
++     * @param node the XML element that specifies which components to document
++     * @param contentTree the content tree to which the documentation will be added
+      */
+-    public void buildConstantSummary(XMLNode node) throws Exception {
+-        buildChildren(node);
++    public void buildConstantSummary(XMLNode node, Content contentTree) throws Exception {
++        contentTree = writer.getHeader();
++        buildChildren(node, contentTree);
++        writer.addFooter(contentTree);
++        writer.printDocument(contentTree);
+         writer.close();
+     }
+ 
+     /**
+-     * Build the header.
++     * Build the list of packages.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param contentTree the content tree to which the content list will be added
+      */
+-    public void buildHeader(XMLNode node) {
+-        writer.writeHeader();
+-    }
+-
+-    /**
+-     * Build the footer.
+-     */
+-    public void buildFooter(XMLNode node) {
+-        writer.writeFooter();
+-    }
+-
+-    /**
+-     * Build the table of contents.
+-     */
+-    public void buildContents(XMLNode node) {
+-        writer.writeContentsHeader();
++    public void buildContents(XMLNode node, Content contentTree) {
++        Content contentListTree = writer.getContentsHeader();
+         PackageDoc[] packages = configuration.packages;
+         printedPackageHeaders = new HashSet();
+         for (int i = 0; i < packages.length; i++) {
+             if (hasConstantField(packages[i]) && ! hasPrintedPackageIndex(packages[i].name())) {
+-                writer.writeLinkToPackageContent(packages[i],
++                writer.addLinkToPackageContent(packages[i],
+                     parsePackageName(packages[i].name()),
+-                    printedPackageHeaders);
++                    printedPackageHeaders, contentListTree);
+             }
+         }
+-        writer.writeContentsFooter();
++        contentTree.addContent(writer.getContentsList(contentListTree));
+     }
+ 
+     /**
+      * Build the summary for each documented package.
+      *
+-     * @param elements the XML elements that represent the components
+-     *                 of documentation for each package.
++     * @param node the XML element that specifies which components to document
++     * @param contentTree the tree to which the summaries will be added
+      */
+-    public void buildConstantSummaries(XMLNode node) {
++    public void buildConstantSummaries(XMLNode node, Content contentTree) {
+         PackageDoc[] packages = configuration.packages;
+         printedPackageHeaders = new HashSet();
++        Content summariesTree = writer.getConstantSummaries();
+         for (int i = 0; i < packages.length; i++) {
+             if (hasConstantField(packages[i])) {
+                 currentPackage = packages[i];
+                 //Build the documentation for the current package.
+-                buildChildren(node);
++                buildChildren(node, summariesTree);
+             }
+         }
++        contentTree.addContent(summariesTree);
+     }
+ 
+     /**
+-     * Build the summary for the current package.
++     * Build the header for the given package.
+      *
+-     * @param elements the list of XML elements that make up package
+-     *                 documentation.
++     * @param node the XML element that specifies which components to document
++     * @param summariesTree the tree to which the package header will be added
+      */
+-    public void buildPackageConstantSummary(XMLNode node) {
+-        buildChildren(node);
++    public void buildPackageHeader(XMLNode node, Content summariesTree) {
++        String parsedPackageName = parsePackageName(currentPackage.name());
++        if (! printedPackageHeaders.contains(parsedPackageName)) {
++            writer.addPackageName(currentPackage,
++                parsePackageName(currentPackage.name()), summariesTree);
++            printedPackageHeaders.add(parsedPackageName);
++        }
+     }
+ 
+     /**
+      * Build the summary for the current class.
+      *
+-     * @param elements the list of XML elements that make up the class
+-     *                 constant summary.
++     * @param node the XML element that specifies which components to document
++     * @param summariesTree the tree to which the class constant summary will be added
+      */
+-    public void buildClassConstantSummary(XMLNode node) {
++    public void buildClassConstantSummary(XMLNode node, Content summariesTree) {
+         ClassDoc[] classes = currentPackage.name().length() > 0 ?
+             currentPackage.allClasses() :
+             configuration.classDocCatalog.allClasses(
+                 DocletConstants.DEFAULT_PACKAGE_NAME);
+         Arrays.sort(classes);
++        Content classConstantTree = writer.getClassConstantHeader();
+         for (int i = 0; i < classes.length; i++) {
+             if (! classDocsWithConstFields.contains(classes[i]) ||
+                 ! classes[i].isIncluded()) {
+@@ -212,42 +218,20 @@
+             }
+             currentClass = classes[i];
+             //Build the documentation for the current class.
+-            buildChildren(node);
++            buildChildren(node, classConstantTree);
+         }
++        summariesTree.addContent(classConstantTree);
+     }
+ 
+     /**
+-     * Build the header for the given class.
++     * Build the summary of constant members in the class.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param classConstantTree the tree to which the constant members table
++     *                          will be added
+      */
+-    public void buildPackageHeader(XMLNode node) {
+-        String parsedPackageName = parsePackageName(currentPackage.name());
+-        if (! printedPackageHeaders.contains(parsedPackageName)) {
+-            writer.writePackageName(currentPackage,
+-                parsePackageName(currentPackage.name()));
+-            printedPackageHeaders.add(parsedPackageName);
+-        }
+-    }
+-
+-    /**
+-     * Build the header for the given class.
+-     */
+-    public void buildClassHeader(XMLNode node) {
+-        writer.writeConstantMembersHeader(currentClass);
+-    }
+-
+-    /**
+-     * Print summary of constant members in the
+-     * class.
+-     */
+-    public void buildConstantMembers(XMLNode node) {
+-        new ConstantFieldBuilder(currentClass).buildMembersSummary(node);
+-    }
+-
+-    /**
+-     * Build the footer for the given class.
+-     */
+-    public void buildClassFooter(XMLNode node) {
+-        writer.writeConstantMembersFooter(currentClass);
++    public void buildConstantMembers(XMLNode node, Content classConstantTree) {
++        new ConstantFieldBuilder(currentClass).buildMembersSummary(node, classConstantTree);
+     }
+ 
+     /**
+@@ -346,12 +330,16 @@
+ 
+         /**
+          * Builds the table of constants for a given class.
++         *
++         * @param node the XML element that specifies which components to document
++         * @param classConstantTree the tree to which the class constants table
++         *                          will be added
+          */
+-        protected void buildMembersSummary(XMLNode node) {
++        protected void buildMembersSummary(XMLNode node, Content classConstantTree) {
+             List members = new ArrayList(members());
+             if (members.size() > 0) {
+                 Collections.sort(members);
+-                writer.writeConstantMembers(classdoc, members);
++                writer.addConstantMembers(classdoc, members, classConstantTree);
+             }
+         }
+ 
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java
+@@ -25,10 +25,10 @@
+ 
+ package com.sun.tools.doclets.internal.toolkit.builders;
+ 
++import java.util.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.javadoc.*;
+-import java.util.*;
+ 
+ /**
+  * Builds documentation for a constructor.
+@@ -38,202 +38,195 @@
+  * Do not use it as an API
+  *
+  * @author Jamie Ho
++ * @author Bhavesh Patel (Modified)
+  * @since 1.5
+  */
+ public class ConstructorBuilder extends AbstractMemberBuilder {
+ 
+-        /**
+-         * The name of this builder.
+-         */
+-        public static final String NAME = "ConstructorDetails";
++    /**
++     * The name of this builder.
++     */
++    public static final String NAME = "ConstructorDetails";
+ 
+-        /**
+-         * The index of the current field that is being documented at this point
+-         * in time.
+-         */
+-        private int currentMethodIndex;
++    /**
++     * The index of the current field that is being documented at this point
++     * in time.
++     */
++    private int currentConstructorIndex;
+ 
+-        /**
+-         * The class whose constructors are being documented.
+-         */
+-        private ClassDoc classDoc;
++    /**
++     * The class whose constructors are being documented.
++     */
++    private ClassDoc classDoc;
+ 
+-        /**
+-         * The visible constructors for the given class.
+-         */
+-        private VisibleMemberMap visibleMemberMap;
++    /**
++     * The visible constructors for the given class.
++     */
++    private VisibleMemberMap visibleMemberMap;
+ 
+-        /**
+-         * The writer to output the constructor documentation.
+-         */
+-        private ConstructorWriter writer;
++    /**
++     * The writer to output the constructor documentation.
++     */
++    private ConstructorWriter writer;
+ 
+-        /**
+-         * The constructors being documented.
+-         */
+-        private List constructors;
++    /**
++     * The constructors being documented.
++     */
++    private List<ProgramElementDoc> constructors;
+ 
+-        /**
+-         * Construct a new ConstructorBuilder.
+-         *
+-         * @param configuration the current configuration of the
+-         *                      doclet.
+-         */
+-        private ConstructorBuilder(Configuration configuration) {
+-                super(configuration);
++    /**
++     * Construct a new ConstructorBuilder.
++     *
++     * @param configuration the current configuration of the
++     *                      doclet.
++     */
++    private ConstructorBuilder(Configuration configuration) {
++	super(configuration);
++    }
++
++    /**
++     * Construct a new ConstructorBuilder.
++     *
++     * @param configuration the current configuration of the doclet.
++     * @param classDoc the class whoses members are being documented.
++     * @param writer the doclet specific writer.
++     */
++    public static ConstructorBuilder getInstance(
++            Configuration configuration,
++            ClassDoc classDoc,
++            ConstructorWriter writer) {
++        ConstructorBuilder builder = new ConstructorBuilder(configuration);
++        builder.classDoc = classDoc;
++        builder.writer = writer;
++        builder.visibleMemberMap =
++                new VisibleMemberMap(
++                classDoc,
++                VisibleMemberMap.CONSTRUCTORS,
++                configuration.nodeprecated);
++        builder.constructors =
++                new ArrayList<ProgramElementDoc>(builder.visibleMemberMap.getMembersFor(classDoc));
++        for (int i = 0; i < builder.constructors.size(); i++) {
++            if (builder.constructors.get(i).isProtected()
++                    || builder.constructors.get(i).isPrivate()) {
++                writer.setFoundNonPubConstructor(true);
++            }
++         }
++        if (configuration.getMemberComparator() != null) {
++            Collections.sort(
++                    builder.constructors,
++                    configuration.getMemberComparator());
+         }
++        return builder;
++    }
+ 
+-        /**
+-         * Construct a new ConstructorBuilder.
+-         *
+-         * @param configuration the current configuration of the doclet.
+-         * @param classDoc the class whoses members are being documented.
+-         * @param writer the doclet specific writer.
+-         */
+-        public static ConstructorBuilder getInstance(
+-                Configuration configuration,
+-                ClassDoc classDoc,
+-                ConstructorWriter writer) {
+-                ConstructorBuilder builder = new ConstructorBuilder(configuration);
+-                builder.classDoc = classDoc;
+-                builder.writer = writer;
+-                builder.visibleMemberMap =
+-                        new VisibleMemberMap(
+-                                classDoc,
+-                                VisibleMemberMap.CONSTRUCTORS,
+-                                configuration.nodeprecated);
+-                builder.constructors =
+-                        new ArrayList(builder.visibleMemberMap.getMembersFor(classDoc));
+-                for (int i = 0; i < builder.constructors.size(); i++) {
+-                        if (((ProgramElementDoc) (builder.constructors.get(i)))
+-                                .isProtected()
+-                                || ((ProgramElementDoc) (builder.constructors.get(i)))
+-                                        .isPrivate()) {
+-                                writer.setFoundNonPubConstructor(true);
+-                        }
+-                }
+-                if (configuration.getMemberComparator() != null) {
+-                        Collections.sort(
+-                                builder.constructors,
+-                                configuration.getMemberComparator());
+-                }
+-                return builder;
++    /**
++     * {@inheritDoc}
++     */
++    public String getName() {
++        return NAME;
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public boolean hasMembersToDocument() {
++        return constructors.size() > 0;
++    }
++
++    /**
++     * Returns a list of constructors that will be documented for the given class.
++     * This information can be used for doclet specific documentation
++     * generation.
++     *
++     * @return a list of constructors that will be documented.
++     */
++    public List<ProgramElementDoc> members(ClassDoc classDoc) {
++        return visibleMemberMap.getMembersFor(classDoc);
++    }
++
++    /**
++     * Return the constructor writer for this builder.
++     *
++     * @return the constructor writer for this builder.
++     */
++    public ConstructorWriter getWriter() {
++        return writer;
++    }
++
++    /**
++     * Build the constructor documentation.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param memberDetailsTree the content tree to which the documentation will be added
++     */
++    public void buildConstructorDoc(XMLNode node, Content memberDetailsTree) {
++        if (writer == null) {
++            return;
+         }
++        int size = constructors.size();
++        if (size > 0) {
++            Content constructorDetailsTree = writer.getConstructorDetailsTreeHeader(
++                    classDoc, memberDetailsTree);
++            for (currentConstructorIndex = 0; currentConstructorIndex < size;
++                    currentConstructorIndex++) {
++                Content constructorDocTree = writer.getConstructorDocTreeHeader(
++                        (ConstructorDoc) constructors.get(currentConstructorIndex),
++                        constructorDetailsTree);
++                buildChildren(node, constructorDocTree);
++                constructorDetailsTree.addContent(writer.getConstructorDoc(
++                        constructorDocTree, (currentConstructorIndex == size - 1)));
++            }
++            memberDetailsTree.addContent(
++                    writer.getConstructorDetails(constructorDetailsTree));
++        }
++    }
+ 
+-        /**
+-         * {@inheritDoc}
+-         */
+-        public String getName() {
+-                return NAME;
++    /**
++     * Build the signature.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param constructorDocTree the content tree to which the documentation will be added
++     */
++    public void buildSignature(XMLNode node, Content constructorDocTree) {
++        constructorDocTree.addContent(
++                writer.getSignature(
++                (ConstructorDoc) constructors.get(currentConstructorIndex)));
++    }
++
++    /**
++     * Build the deprecation information.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param constructorDocTree the content tree to which the documentation will be added
++     */
++    public void buildDeprecationInfo(XMLNode node, Content constructorDocTree) {
++        writer.addDeprecated(
++                (ConstructorDoc) constructors.get(currentConstructorIndex), constructorDocTree);
++    }
++
++    /**
++     * Build the comments for the constructor.  Do nothing if
++     * {@link Configuration#nocomment} is set to true.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param constructorDocTree the content tree to which the documentation will be added
++     */
++    public void buildConstructorComments(XMLNode node, Content constructorDocTree) {
++        if (!configuration.nocomment) {
++            writer.addComments(
++                    (ConstructorDoc) constructors.get(currentConstructorIndex),
++                    constructorDocTree);
+         }
++    }
+ 
+-        /**
+-         * {@inheritDoc}
+-         */
+-        public boolean hasMembersToDocument() {
+-                return constructors.size() > 0;
+-        }
+-
+-        /**
+-         * Returns a list of constructors that will be documented for the given class.
+-         * This information can be used for doclet specific documentation
+-         * generation.
+-         *
+-         * @return a list of constructors that will be documented.
+-         */
+-        public List members(ClassDoc classDoc) {
+-                return visibleMemberMap.getMembersFor(classDoc);
+-        }
+-
+-        /**
+-         * Return the constructor writer for this builder.
+-         *
+-         * @return the constructor writer for this builder.
+-         */
+-        public ConstructorWriter getWriter() {
+-                return writer;
+-        }
+-
+-        /**
+-         * Build the constructor documentation.
+-         *
+-         * @param elements the XML elements that specify how to construct this
+-         *                documentation.
+-         */
+-        public void buildConstructorDoc(XMLNode node) {
+-                if (writer == null) {
+-                        return;
+-                }
+-                for (currentMethodIndex = 0;
+-                        currentMethodIndex < constructors.size();
+-                        currentMethodIndex++) {
+-                        buildChildren(node);
+-                }
+-        }
+-
+-        /**
+-         * Build the overall header.
+-         */
+-        public void buildHeader(XMLNode node) {
+-                writer.writeHeader(
+-                        classDoc,
+-                        configuration.getText("doclet.Constructor_Detail"));
+-        }
+-
+-        /**
+-         * Build the header for the individual constructor.
+-         */
+-        public void buildConstructorHeader(XMLNode node) {
+-                writer.writeConstructorHeader(
+-                        (ConstructorDoc) constructors.get(currentMethodIndex),
+-                        currentMethodIndex == 0);
+-        }
+-
+-        /**
+-         * Build the signature.
+-         */
+-        public void buildSignature(XMLNode node) {
+-                writer.writeSignature(
+-                        (ConstructorDoc) constructors.get(currentMethodIndex));
+-        }
+-
+-        /**
+-         * Build the deprecation information.
+-         */
+-        public void buildDeprecationInfo(XMLNode node) {
+-                writer.writeDeprecated(
+-                        (ConstructorDoc) constructors.get(currentMethodIndex));
+-        }
+-
+-        /**
+-         * Build the comments for the constructor.  Do nothing if
+-         * {@link Configuration#nocomment} is set to true.
+-         */
+-        public void buildConstructorComments(XMLNode node) {
+-                if (!configuration.nocomment) {
+-                        writer.writeComments(
+-                                (ConstructorDoc) constructors.get(currentMethodIndex));
+-                }
+-        }
+-
+-        /**
+-         * Build the tag information.
+-         */
+-        public void buildTagInfo(XMLNode node) {
+-                writer.writeTags((ConstructorDoc) constructors.get(currentMethodIndex));
+-        }
+-
+-        /**
+-         * Build the footer for the individual constructor.
+-         */
+-        public void buildConstructorFooter(XMLNode node) {
+-                writer.writeConstructorFooter();
+-        }
+-
+-        /**
+-         * Build the overall footer.
+-         */
+-        public void buildFooter(XMLNode node) {
+-                writer.writeFooter(classDoc);
+-        }
++    /**
++     * Build the tag information.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param constructorDocTree the content tree to which the documentation will be added
++     */
++    public void buildTagInfo(XMLNode node, Content constructorDocTree) {
++        writer.addTags((ConstructorDoc) constructors.get(currentConstructorIndex),
++                constructorDocTree);
++    }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java
+@@ -25,10 +25,10 @@
+ 
+ package com.sun.tools.doclets.internal.toolkit.builders;
+ 
++import java.util.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.javadoc.*;
+-import java.util.*;
+ 
+ /**
+  * Builds documentation for a enum constants.
+@@ -38,200 +38,195 @@
+  * Do not use it as an API
+  *
+  * @author Jamie Ho
++ * @author Bhavesh Patel (Modified)
+  * @since 1.5
+  */
+ public class EnumConstantBuilder extends AbstractMemberBuilder {
+ 
+-        /**
+-         * The class whose enum constants are being documented.
+-         */
+-        private ClassDoc classDoc;
++    /**
++     * The class whose enum constants are being documented.
++     */
++    private ClassDoc classDoc;
+ 
+-        /**
+-         * The visible enum constantss for the given class.
+-         */
+-        private VisibleMemberMap visibleMemberMap;
++    /**
++     * The visible enum constantss for the given class.
++     */
++    private VisibleMemberMap visibleMemberMap;
+ 
+-        /**
+-         * The writer to output the enum constants documentation.
+-         */
+-        private EnumConstantWriter writer;
++    /**
++     * The writer to output the enum constants documentation.
++     */
++    private EnumConstantWriter writer;
+ 
+-        /**
+-         * The list of enum constants being documented.
+-         */
+-        private List enumConstants;
++    /**
++     * The list of enum constants being documented.
++     */
++    private List<ProgramElementDoc> enumConstants;
+ 
+-        /**
+-         * The index of the current enum constant that is being documented at this point
+-         * in time.
+-         */
+-        private int currentEnumConstantsIndex;
++    /**
++     * The index of the current enum constant that is being documented at this point
++     * in time.
++     */
++    private int currentEnumConstantsIndex;
+ 
+-        /**
+-         * Construct a new EnumConstantsBuilder.
+-         *
+-         * @param configuration the current configuration of the
+-         *                      doclet.
+-         */
+-        private EnumConstantBuilder(Configuration configuration) {
+-                super(configuration);
++    /**
++     * Construct a new EnumConstantsBuilder.
++     *
++     * @param configuration the current configuration of the
++     *                      doclet.
++     */
++    private EnumConstantBuilder(Configuration configuration) {
++        super(configuration);
++    }
++
++    /**
++     * Construct a new EnumConstantsBuilder.
++     *
++     * @param configuration the current configuration of the doclet.
++     * @param classDoc the class whoses members are being documented.
++     * @param writer the doclet specific writer.
++     */
++    public static EnumConstantBuilder getInstance(
++            Configuration configuration,
++            ClassDoc classDoc,
++            EnumConstantWriter writer) {
++        EnumConstantBuilder builder = new EnumConstantBuilder(configuration);
++        builder.classDoc = classDoc;
++        builder.writer = writer;
++        builder.visibleMemberMap =
++                new VisibleMemberMap(
++                classDoc,
++                VisibleMemberMap.ENUM_CONSTANTS,
++                configuration.nodeprecated);
++        builder.enumConstants =
++                new ArrayList<ProgramElementDoc>(builder.visibleMemberMap.getMembersFor(classDoc));
++        if (configuration.getMemberComparator() != null) {
++            Collections.sort(
++                    builder.enumConstants,
++                    configuration.getMemberComparator());
++         }
++        return builder;
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public String getName() {
++        return "EnumConstantDetails";
++    }
++
++    /**
++     * Returns a list of enum constants that will be documented for the given class.
++     * This information can be used for doclet specific documentation
++     * generation.
++     *
++     * @param classDoc the {@link ClassDoc} we want to check.
++     * @return a list of enum constants that will be documented.
++     */
++    public List<ProgramElementDoc> members(ClassDoc classDoc) {
++        return visibleMemberMap.getMembersFor(classDoc);
++    }
++
++    /**
++     * Returns the visible member map for the enum constants of this class.
++     *
++     * @return the visible member map for the enum constants of this class.
++     */
++    public VisibleMemberMap getVisibleMemberMap() {
++        return visibleMemberMap;
++    }
++
++    /**
++     * summaryOrder.size()
++     */
++    public boolean hasMembersToDocument() {
++        return enumConstants.size() > 0;
++    }
++
++    /**
++     * Build the enum constant documentation.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param memberDetailsTree the content tree to which the documentation will be added
++     */
++    public void buildEnumConstant(XMLNode node, Content memberDetailsTree) {
++        if (writer == null) {
++            return;
+         }
++        int size = enumConstants.size();
++        if (size > 0) {
++            Content enumConstantsDetailsTree = writer.getEnumConstantsDetailsTreeHeader(
++                    classDoc, memberDetailsTree);
++            for (currentEnumConstantsIndex = 0; currentEnumConstantsIndex < size;
++                    currentEnumConstantsIndex++) {
++                Content enumConstantsTree = writer.getEnumConstantsTreeHeader(
++                        (FieldDoc) enumConstants.get(currentEnumConstantsIndex),
++                        enumConstantsDetailsTree);
++                buildChildren(node, enumConstantsTree);
++                enumConstantsDetailsTree.addContent(writer.getEnumConstants(
++                        enumConstantsTree, (currentEnumConstantsIndex == size - 1)));
++            }
++            memberDetailsTree.addContent(
++                    writer.getEnumConstantsDetails(enumConstantsDetailsTree));
++        }
++    }
+ 
+-        /**
+-         * Construct a new EnumConstantsBuilder.
+-         *
+-         * @param configuration the current configuration of the doclet.
+-         * @param classDoc the class whoses members are being documented.
+-         * @param writer the doclet specific writer.
+-         */
+-        public static EnumConstantBuilder getInstance(
+-                Configuration configuration,
+-                ClassDoc classDoc,
+-                EnumConstantWriter writer) {
+-                EnumConstantBuilder builder = new EnumConstantBuilder(configuration);
+-                builder.classDoc = classDoc;
+-                builder.writer = writer;
+-                builder.visibleMemberMap =
+-                        new VisibleMemberMap(
+-                                classDoc,
+-                                VisibleMemberMap.ENUM_CONSTANTS,
+-                                configuration.nodeprecated);
+-                builder.enumConstants =
+-                        new ArrayList(builder.visibleMemberMap.getMembersFor(classDoc));
+-                if (configuration.getMemberComparator() != null) {
+-                        Collections.sort(
+-                                builder.enumConstants,
+-                                configuration.getMemberComparator());
+-                }
+-                return builder;
++    /**
++     * Build the signature.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param enumConstantsTree the content tree to which the documentation will be added
++     */
++    public void buildSignature(XMLNode node, Content enumConstantsTree) {
++        enumConstantsTree.addContent(writer.getSignature(
++                (FieldDoc) enumConstants.get(currentEnumConstantsIndex)));
++    }
++
++    /**
++     * Build the deprecation information.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param enumConstantsTree the content tree to which the documentation will be added
++     */
++    public void buildDeprecationInfo(XMLNode node, Content enumConstantsTree) {
++        writer.addDeprecated(
++                (FieldDoc) enumConstants.get(currentEnumConstantsIndex),
++                enumConstantsTree);
++    }
++
++    /**
++     * Build the comments for the enum constant.  Do nothing if
++     * {@link Configuration#nocomment} is set to true.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param enumConstantsTree the content tree to which the documentation will be added
++     */
++    public void buildEnumConstantComments(XMLNode node, Content enumConstantsTree) {
++        if (!configuration.nocomment) {
++            writer.addComments(
++                    (FieldDoc) enumConstants.get(currentEnumConstantsIndex),
++                    enumConstantsTree);
+         }
++    }
+ 
+-        /**
+-         * {@inheritDoc}
+-         */
+-        public String getName() {
+-                return "EnumConstantDetails";
+-        }
++    /**
++     * Build the tag information.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param enumConstantsTree the content tree to which the documentation will be added
++     */
++    public void buildTagInfo(XMLNode node, Content enumConstantsTree) {
++        writer.addTags(
++                (FieldDoc) enumConstants.get(currentEnumConstantsIndex),
++                enumConstantsTree);
++    }
+ 
+-        /**
+-         * Returns a list of enum constants that will be documented for the given class.
+-         * This information can be used for doclet specific documentation
+-         * generation.
+-         *
+-         * @param classDoc the {@link ClassDoc} we want to check.
+-         * @return a list of enum constants that will be documented.
+-         */
+-        public List members(ClassDoc classDoc) {
+-                return visibleMemberMap.getMembersFor(classDoc);
+-        }
+-
+-        /**
+-         * Returns the visible member map for the enum constants of this class.
+-         *
+-         * @return the visible member map for the enum constants of this class.
+-         */
+-        public VisibleMemberMap getVisibleMemberMap() {
+-                return visibleMemberMap;
+-        }
+-
+-        /**
+-         * summaryOrder.size()
+-         */
+-        public boolean hasMembersToDocument() {
+-                return enumConstants.size() > 0;
+-        }
+-
+-        /**
+-         * Build the enum constant documentation.
+-         *
+-         * @param elements the XML elements that specify how to construct this
+-         *                documentation.
+-         */
+-        public void buildEnumConstant(XMLNode node) {
+-                if (writer == null) {
+-                        return;
+-                }
+-                for (currentEnumConstantsIndex = 0;
+-                        currentEnumConstantsIndex < enumConstants.size();
+-                        currentEnumConstantsIndex++) {
+-                        buildChildren(node);
+-                }
+-        }
+-
+-        /**
+-         * Build the overall header.
+-         */
+-        public void buildHeader(XMLNode node) {
+-                writer.writeHeader(
+-                        classDoc,
+-                        configuration.getText("doclet.Enum_Constant_Detail"));
+-        }
+-
+-        /**
+-         * Build the header for the individual enum constants.
+-         */
+-        public void buildEnumConstantHeader(XMLNode node) {
+-                writer.writeEnumConstantHeader(
+-                        (FieldDoc) enumConstants.get(currentEnumConstantsIndex),
+-                        currentEnumConstantsIndex == 0);
+-        }
+-
+-        /**
+-         * Build the signature.
+-         */
+-        public void buildSignature(XMLNode node) {
+-                writer.writeSignature(
+-                        (FieldDoc) enumConstants.get(currentEnumConstantsIndex));
+-        }
+-
+-        /**
+-         * Build the deprecation information.
+-         */
+-        public void buildDeprecationInfo(XMLNode node) {
+-                writer.writeDeprecated(
+-                        (FieldDoc) enumConstants.get(currentEnumConstantsIndex));
+-        }
+-
+-        /**
+-         * Build the comments for the enum constant.  Do nothing if
+-         * {@link Configuration#nocomment} is set to true.
+-         */
+-        public void buildEnumConstantComments(XMLNode node) {
+-                if (!configuration.nocomment) {
+-                        writer.writeComments(
+-                                (FieldDoc) enumConstants.get(currentEnumConstantsIndex));
+-                }
+-        }
+-
+-        /**
+-         * Build the tag information.
+-         */
+-        public void buildTagInfo(XMLNode node) {
+-                writer.writeTags(
+-                        (FieldDoc) enumConstants.get(currentEnumConstantsIndex));
+-        }
+-
+-        /**
+-         * Build the footer for the individual enum constants.
+-         */
+-        public void buildEnumConstantFooter(XMLNode node) {
+-                writer.writeEnumConstantFooter();
+-        }
+-
+-        /**
+-         * Build the overall footer.
+-         */
+-        public void buildFooter(XMLNode node) {
+-                writer.writeFooter(classDoc);
+-        }
+-
+-        /**
+-         * Return the enum constant writer for this builder.
+-         *
+-         * @return the enum constant writer for this builder.
+-         */
+-        public EnumConstantWriter getWriter() {
+-                return writer;
+-        }
++    /**
++     * Return the enum constant writer for this builder.
++     *
++     * @return the enum constant writer for this builder.
++     */
++    public EnumConstantWriter getWriter() {
++        return writer;
++    }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java
+@@ -25,10 +25,10 @@
+ 
+ package com.sun.tools.doclets.internal.toolkit.builders;
+ 
++import java.util.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.javadoc.*;
+-import java.util.*;
+ 
+ /**
+  * Builds documentation for a field.
+@@ -38,197 +38,191 @@
+  * Do not use it as an API
+  *
+  * @author Jamie Ho
++ * @author Bhavesh Patel (Modified)
+  * @since 1.5
+  */
+ public class FieldBuilder extends AbstractMemberBuilder {
+ 
+-        /**
+-         * The class whose fields are being documented.
+-         */
+-        private ClassDoc classDoc;
++    /**
++     * The class whose fields are being documented.
++     */
++    private ClassDoc classDoc;
+ 
+-        /**
+-         * The visible fields for the given class.
+-         */
+-        private VisibleMemberMap visibleMemberMap;
++    /**
++     * The visible fields for the given class.
++     */
++    private VisibleMemberMap visibleMemberMap;
+ 
+-        /**
+-         * The writer to output the field documentation.
+-         */
+-        private FieldWriter writer;
++    /**
++     * The writer to output the field documentation.
++     */
++    private FieldWriter writer;
+ 
+-        /**
+-         * The list of fields being documented.
+-         */
+-        private List fields;
++    /**
++     * The list of fields being documented.
++     */
++    private List<ProgramElementDoc> fields;
+ 
+-        /**
+-         * The index of the current field that is being documented at this point
+-         * in time.
+-         */
+-        private int currentFieldIndex;
++    /**
++     * The index of the current field that is being documented at this point
++     * in time.
++     */
++    private int currentFieldIndex;
+ 
+-        /**
+-         * Construct a new FieldBuilder.
+-         *
+-         * @param configuration the current configuration of the
+-         *                      doclet.
+-         */
+-        private FieldBuilder(Configuration configuration) {
+-                super(configuration);
++    /**
++     * Construct a new FieldBuilder.
++     *
++     * @param configuration the current configuration of the
++     *                      doclet.
++     */
++    private FieldBuilder(Configuration configuration) {
++        super(configuration);
++    }
++
++    /**
++     * Construct a new FieldBuilder.
++     *
++     * @param configuration the current configuration of the doclet.
++     * @param classDoc the class whoses members are being documented.
++     * @param writer the doclet specific writer.
++     */
++    public static FieldBuilder getInstance(
++            Configuration configuration,
++            ClassDoc classDoc,
++            FieldWriter writer) {
++        FieldBuilder builder = new FieldBuilder(configuration);
++        builder.classDoc = classDoc;
++        builder.writer = writer;
++        builder.visibleMemberMap =
++                new VisibleMemberMap(
++                classDoc,
++                VisibleMemberMap.FIELDS,
++                configuration.nodeprecated);
++        builder.fields =
++                new ArrayList<ProgramElementDoc>(builder.visibleMemberMap.getLeafClassMembers(
++                configuration));
++        if (configuration.getMemberComparator() != null) {
++            Collections.sort(
++                    builder.fields,
++                    configuration.getMemberComparator());
+         }
++        return builder;
++    }
+ 
+-        /**
+-         * Construct a new FieldBuilder.
+-         *
+-         * @param configuration the current configuration of the doclet.
+-         * @param classDoc the class whoses members are being documented.
+-         * @param writer the doclet specific writer.
+-         */
+-        public static FieldBuilder getInstance(
+-                Configuration configuration,
+-                ClassDoc classDoc,
+-                FieldWriter writer) {
+-                FieldBuilder builder = new FieldBuilder(configuration);
+-                builder.classDoc = classDoc;
+-                builder.writer = writer;
+-                builder.visibleMemberMap =
+-                        new VisibleMemberMap(
+-                                classDoc,
+-                                VisibleMemberMap.FIELDS,
+-                                configuration.nodeprecated);
+-                builder.fields =
+-                        new ArrayList(builder.visibleMemberMap.getLeafClassMembers(
+-                configuration));
+-                if (configuration.getMemberComparator() != null) {
+-                        Collections.sort(
+-                                builder.fields,
+-                                configuration.getMemberComparator());
+-                }
+-                return builder;
++    /**
++     * {@inheritDoc}
++     */
++    public String getName() {
++        return "FieldDetails";
++    }
++
++    /**
++     * Returns a list of fields that will be documented for the given class.
++     * This information can be used for doclet specific documentation
++     * generation.
++     *
++     * @param classDoc the {@link ClassDoc} we want to check.
++     * @return a list of fields that will be documented.
++     */
++    public List<ProgramElementDoc> members(ClassDoc classDoc) {
++        return visibleMemberMap.getMembersFor(classDoc);
++    }
++
++    /**
++     * Returns the visible member map for the fields of this class.
++     *
++     * @return the visible member map for the fields of this class.
++     */
++    public VisibleMemberMap getVisibleMemberMap() {
++        return visibleMemberMap;
++    }
++
++    /**
++     * summaryOrder.size()
++     */
++    public boolean hasMembersToDocument() {
++        return fields.size() > 0;
++    }
++
++    /**
++     * Build the field documentation.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param memberDetailsTree the content tree to which the documentation will be added
++     */
++    public void buildFieldDoc(XMLNode node, Content memberDetailsTree) {
++        if (writer == null) {
++            return;
++       }
++        int size = fields.size();
++        if (size > 0) {
++            Content fieldDetailsTree = writer.getFieldDetailsTreeHeader(
++                    classDoc, memberDetailsTree);
++            for (currentFieldIndex = 0; currentFieldIndex < size;
++                    currentFieldIndex++) {
++                Content fieldDocTree = writer.getFieldDocTreeHeader(
++                        (FieldDoc) fields.get(currentFieldIndex),
++                        fieldDetailsTree);
++                buildChildren(node, fieldDocTree);
++                fieldDetailsTree.addContent(writer.getFieldDoc(
++                        fieldDocTree, (currentFieldIndex == size - 1)));
++            }
++            memberDetailsTree.addContent(
++                    writer.getFieldDetails(fieldDetailsTree));
+         }
++    }
+ 
+-        /**
+-         * {@inheritDoc}
+-         */
+-        public String getName() {
+-                return "FieldDetails";
++    /**
++     * Build the signature.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param fieldDocTree the content tree to which the documentation will be added
++     */
++    public void buildSignature(XMLNode node, Content fieldDocTree) {
++        fieldDocTree.addContent(
++                writer.getSignature((FieldDoc) fields.get(currentFieldIndex)));
++    }
++
++    /**
++     * Build the deprecation information.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param fieldDocTree the content tree to which the documentation will be added
++     */
++    public void buildDeprecationInfo(XMLNode node, Content fieldDocTree) {
++        writer.addDeprecated(
++                (FieldDoc) fields.get(currentFieldIndex), fieldDocTree);
++    }
++
++    /**
++     * Build the comments for the field.  Do nothing if
++     * {@link Configuration#nocomment} is set to true.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param fieldDocTree the content tree to which the documentation will be added
++     */
++    public void buildFieldComments(XMLNode node, Content fieldDocTree) {
++        if (!configuration.nocomment) {
++            writer.addComments((FieldDoc) fields.get(currentFieldIndex), fieldDocTree);
+         }
++    }
+ 
+-        /**
+-         * Returns a list of fields that will be documented for the given class.
+-         * This information can be used for doclet specific documentation
+-         * generation.
+-         *
+-         * @param classDoc the {@link ClassDoc} we want to check.
+-         * @return a list of fields that will be documented.
+-         */
+-        public List members(ClassDoc classDoc) {
+-                return visibleMemberMap.getMembersFor(classDoc);
+-        }
++    /**
++     * Build the tag information.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param fieldDocTree the content tree to which the documentation will be added
++     */
++    public void buildTagInfo(XMLNode node, Content fieldDocTree) {
++        writer.addTags((FieldDoc) fields.get(currentFieldIndex), fieldDocTree);
++    }
+ 
+-        /**
+-         * Returns the visible member map for the fields of this class.
+-         *
+-         * @return the visible member map for the fields of this class.
+-         */
+-        public VisibleMemberMap getVisibleMemberMap() {
+-                return visibleMemberMap;
+-        }
+-
+-        /**
+-         * summaryOrder.size()
+-         */
+-        public boolean hasMembersToDocument() {
+-                return fields.size() > 0;
+-        }
+-
+-        /**
+-         * Build the field documentation.
+-         *
+-         * @param elements the XML elements that specify how to construct this
+-         *                documentation.
+-         */
+-        public void buildFieldDoc(XMLNode node) {
+-                if (writer == null) {
+-                        return;
+-                }
+-                for (currentFieldIndex = 0;
+-                        currentFieldIndex < fields.size();
+-                        currentFieldIndex++) {
+-                        buildChildren(node);
+-                }
+-        }
+-
+-        /**
+-         * Build the overall header.
+-         */
+-        public void buildHeader(XMLNode node) {
+-                writer.writeHeader(
+-                        classDoc,
+-                        configuration.getText("doclet.Field_Detail"));
+-        }
+-
+-        /**
+-         * Build the header for the individual field.
+-         */
+-        public void buildFieldHeader(XMLNode node) {
+-                writer.writeFieldHeader(
+-                        (FieldDoc) fields.get(currentFieldIndex),
+-                        currentFieldIndex == 0);
+-        }
+-
+-        /**
+-         * Build the signature.
+-         */
+-        public void buildSignature(XMLNode node) {
+-                writer.writeSignature((FieldDoc) fields.get(currentFieldIndex));
+-        }
+-
+-        /**
+-         * Build the deprecation information.
+-         */
+-        public void buildDeprecationInfo(XMLNode node) {
+-                writer.writeDeprecated((FieldDoc) fields.get(currentFieldIndex));
+-        }
+-
+-        /**
+-         * Build the comments for the field.  Do nothing if
+-         * {@link Configuration#nocomment} is set to true.
+-         */
+-        public void buildFieldComments(XMLNode node) {
+-                if (!configuration.nocomment) {
+-                        writer.writeComments((FieldDoc) fields.get(currentFieldIndex));
+-                }
+-        }
+-
+-        /**
+-         * Build the tag information.
+-         */
+-        public void buildTagInfo(XMLNode node) {
+-                writer.writeTags((FieldDoc) fields.get(currentFieldIndex));
+-        }
+-
+-        /**
+-         * Build the footer for the individual field.
+-         */
+-        public void buildFieldFooter(XMLNode node) {
+-                writer.writeFieldFooter();
+-        }
+-
+-        /**
+-         * Build the overall footer.
+-         */
+-        public void buildFooter(XMLNode node) {
+-                writer.writeFooter(classDoc);
+-        }
+-
+-        /**
+-         * Return the field writer for this builder.
+-         *
+-         * @return the field writer for this builder.
+-         */
+-        public FieldWriter getWriter() {
+-                return writer;
+-        }
++    /**
++     * Return the field writer for this builder.
++     *
++     * @return the field writer for this builder.
++     */
++    public FieldWriter getWriter() {
++        return writer;
++    }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java
+@@ -76,7 +76,7 @@
+     /**
+      * Parse the XML specifying the layout of the documentation.
+      *
+-     * @return List the list of XML elements parsed.
++     * @return the list of XML elements parsed.
+      */
+     public XMLNode parseXML(String root) {
+         if (xmlElementsMap.containsKey(root)) {
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java
+@@ -25,10 +25,10 @@
+ 
+ package com.sun.tools.doclets.internal.toolkit.builders;
+ 
++import java.util.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.javadoc.*;
+-import java.util.*;
+ 
+ /**
+  * Builds the member summary.
+@@ -38,49 +38,50 @@
+  * Do not use it as an API
+  *
+  * @author Jamie Ho
++ * @author Bhavesh Patel (Modified)
+  * @since 1.5
+  */
+ public class MemberSummaryBuilder extends AbstractMemberBuilder {
+ 
+-        /**
+-         * The XML root for this builder.
+-         */
+-        public static final String NAME = "MemberSummary";
++    /**
++     * The XML root for this builder.
++     */
++    public static final String NAME = "MemberSummary";
+ 
+-        /**
+-         * The visible members for the given class.
+-         */
+-        private VisibleMemberMap[] visibleMemberMaps;
++    /**
++     * The visible members for the given class.
++     */
++    private VisibleMemberMap[] visibleMemberMaps;
+ 
+-        /**
+-         * The member summary writers for the given class.
+-         */
+-        private MemberSummaryWriter[] memberSummaryWriters;
++    /**
++     * The member summary writers for the given class.
++     */
++    private MemberSummaryWriter[] memberSummaryWriters;
+ 
+-        /**
+-         * The type being documented.
+-         */
+-        private ClassDoc classDoc;
++    /**
++     * The type being documented.
++     */
++    private ClassDoc classDoc;
+ 
+-        private MemberSummaryBuilder(Configuration configuration) {
+-                super(configuration);
+-        }
++    private MemberSummaryBuilder(Configuration configuration) {
++        super(configuration);
++    }
+ 
+-        /**
+-         * Construct a new MemberSummaryBuilder.
+-         *
+-         * @param classWriter   the writer for the class whose members are being
+-         *                      summarized.
+-         * @param configuration the current configuration of the doclet.
+-         */
+-        public static MemberSummaryBuilder getInstance(
+-                ClassWriter classWriter, Configuration configuration)
+-        throws Exception {
+-                MemberSummaryBuilder builder = new MemberSummaryBuilder(configuration);
+-                builder.classDoc = classWriter.getClassDoc();
+-                builder.init(classWriter);
+-                return builder;
+-        }
++    /**
++     * Construct a new MemberSummaryBuilder.
++     *
++     * @param classWriter   the writer for the class whose members are being
++     *                      summarized.
++     * @param configuration the current configuration of the doclet.
++     */
++    public static MemberSummaryBuilder getInstance(
++            ClassWriter classWriter, Configuration configuration)
++            throws Exception {
++        MemberSummaryBuilder builder = new MemberSummaryBuilder(configuration);
++        builder.classDoc = classWriter.getClassDoc();
++        builder.init(classWriter);
++        return builder;
++    }
+ 
+     /**
+      * Construct a new MemberSummaryBuilder.
+@@ -90,8 +91,8 @@
+      * @param configuration the current configuration of the doclet.
+      */
+     public static MemberSummaryBuilder getInstance(
+-        AnnotationTypeWriter annotationTypeWriter, Configuration configuration)
+-    throws Exception {
++            AnnotationTypeWriter annotationTypeWriter, Configuration configuration)
++            throws Exception {
+         MemberSummaryBuilder builder = new MemberSummaryBuilder(configuration);
+         builder.classDoc = annotationTypeWriter.getAnnotationTypeDoc();
+         builder.init(annotationTypeWriter);
+@@ -100,200 +101,210 @@
+ 
+     private void init(Object writer) throws Exception {
+         visibleMemberMaps =
+-            new VisibleMemberMap[VisibleMemberMap.NUM_MEMBER_TYPES];
++                new VisibleMemberMap[VisibleMemberMap.NUM_MEMBER_TYPES];
+         for (int i = 0; i < VisibleMemberMap.NUM_MEMBER_TYPES; i++) {
+             visibleMemberMaps[i] =
+-                new VisibleMemberMap(
++                    new VisibleMemberMap(
+                     classDoc,
+                     i,
+                     configuration.nodeprecated);
+         }
+         memberSummaryWriters =
+-            new MemberSummaryWriter[VisibleMemberMap.NUM_MEMBER_TYPES];
++                new MemberSummaryWriter[VisibleMemberMap.NUM_MEMBER_TYPES];
+         for (int i = 0; i < VisibleMemberMap.NUM_MEMBER_TYPES; i++) {
+             if (classDoc.isAnnotationType()) {
+                 memberSummaryWriters[i] =
+                     visibleMemberMaps[i].noVisibleMembers()?
+                         null :
+                         configuration.getWriterFactory().getMemberSummaryWriter(
+-                            (AnnotationTypeWriter) writer, i);
++                        (AnnotationTypeWriter) writer, i);
+             } else {
+                 memberSummaryWriters[i] =
+                     visibleMemberMaps[i].noVisibleMembers()?
+                         null :
+                         configuration.getWriterFactory().getMemberSummaryWriter(
+-                            (ClassWriter) writer, i);
++                        (ClassWriter) writer, i);
+             }
+         }
+ 
+     }
+ 
+-        /**
+-         * {@inheritDoc}
+-         */
+-        public String getName() {
+-                return NAME;
+-        }
++    /**
++     * {@inheritDoc}
++     */
++    public String getName() {
++        return NAME;
++    }
+ 
+-        /**
+-         * Return the specified visible member map.
+-         *
+-         * @param type the type of visible member map to return.
+-         * @return the specified visible member map.
+-         * @throws ArrayIndexOutOfBoundsException when the type is invalid.
+-         * @see VisibleMemberMap
+-         */
+-        public VisibleMemberMap getVisibleMemberMap(int type) {
+-                return visibleMemberMaps[type];
+-        }
++    /**
++     * Return the specified visible member map.
++     *
++     * @param type the type of visible member map to return.
++     * @return the specified visible member map.
++     * @throws ArrayIndexOutOfBoundsException when the type is invalid.
++     * @see VisibleMemberMap
++     */
++    public VisibleMemberMap getVisibleMemberMap(int type) {
++        return visibleMemberMaps[type];
++    }
+ 
+-        /**
+-         * Return the specified member summary writer.
+-         *
+-         * @param type the type of member summary writer to return.
+-         * @return the specified member summary writer.
+-         * @throws ArrayIndexOutOfBoundsException when the type is invalid.
+-         * @see VisibleMemberMap
+-         */
+-        public MemberSummaryWriter getMemberSummaryWriter(int type) {
+-                return memberSummaryWriters[type];
+-        }
++    /**
++     * Return the specified member summary writer.
++     *
++     * @param type the type of member summary writer to return.
++     * @return the specified member summary writer.
++     * @throws ArrayIndexOutOfBoundsException when the type is invalid.
++     * @see VisibleMemberMap
++     */
++    public MemberSummaryWriter getMemberSummaryWriter(int type) {
++        return memberSummaryWriters[type];
++    }
+ 
+-        /**
+-         * Returns a list of methods that will be documented for the given class.
+-         * This information can be used for doclet specific documentation
+-         * generation.
+-         *
+-         * @param classDoc the {@link ClassDoc} we want to check.
+-         * @param type the type of members to return.
+-         * @return a list of methods that will be documented.
+-         * @see VisibleMemberMap
+-         */
+-        public List members(int type) {
+-                return visibleMemberMaps[type].getLeafClassMembers(configuration);
+-        }
++    /**
++     * Returns a list of methods that will be documented for the given class.
++     * This information can be used for doclet specific documentation
++     * generation.
++     *
++     * @param classDoc the {@link ClassDoc} we want to check.
++     * @param type the type of members to return.
++     * @return a list of methods that will be documented.
++     * @see VisibleMemberMap
++     */
++    public List<ProgramElementDoc> members(int type) {
++        return visibleMemberMaps[type].getLeafClassMembers(configuration);
++    }
+ 
+-        /**
+-         * Return true it there are any members to summarize.
+-         *
+-         * @return true if there are any members to summarize.
+-         */
+-        public boolean hasMembersToDocument() {
++    /**
++     * Return true it there are any members to summarize.
++     *
++     * @return true if there are any members to summarize.
++     */
++    public boolean hasMembersToDocument() {
+         if (classDoc instanceof AnnotationTypeDoc) {
+             return ((AnnotationTypeDoc) classDoc).elements().length > 0;
+         }
+-                for (int i = 0; i < VisibleMemberMap.NUM_MEMBER_TYPES; i++) {
+-                        VisibleMemberMap members = visibleMemberMaps[i];
+-                        if (!members.noVisibleMembers()) {
+-                                return true;
+-                        }
+-                }
+-                return false;
++        for (int i = 0; i < VisibleMemberMap.NUM_MEMBER_TYPES; i++) {
++            VisibleMemberMap members = visibleMemberMaps[i];
++            if (!members.noVisibleMembers()) {
++                return true;
++            }
+         }
+ 
+-        /**
+-         * Build the summary for the enum constants.
+-         */
+-        public void buildEnumConstantsSummary(XMLNode node) {
+-                buildSummary(
+-                        memberSummaryWriters[VisibleMemberMap.ENUM_CONSTANTS],
+-                        visibleMemberMaps[VisibleMemberMap.ENUM_CONSTANTS]);
+-        }
++        return false;
++    }
+ 
+     /**
+-     * Build the summary for the optional members.
++     * Build the summary for the enum constants.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param memberSummaryTree the content tree to which the documentation will be added
+      */
+-    public void buildAnnotationTypeOptionalMemberSummary(XMLNode node) {
+-        buildSummary(
+-            memberSummaryWriters[VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL],
+-                visibleMemberMaps[VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL]);
++    public void buildEnumConstantsSummary(XMLNode node, Content memberSummaryTree) {
++        MemberSummaryWriter writer =
++                memberSummaryWriters[VisibleMemberMap.ENUM_CONSTANTS];
++        VisibleMemberMap visibleMemberMap =
++                visibleMemberMaps[VisibleMemberMap.ENUM_CONSTANTS];
++        addSummary(writer, visibleMemberMap, false, memberSummaryTree);
+     }
+ 
+     /**
+      * Build the summary for the optional members.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param memberSummaryTree the content tree to which the documentation will be added
+      */
+-    public void buildAnnotationTypeRequiredMemberSummary(XMLNode node) {
+-        buildSummary(
+-            memberSummaryWriters[VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED],
+-                visibleMemberMaps[VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED]);
++    public void buildAnnotationTypeOptionalMemberSummary(XMLNode node, Content memberSummaryTree) {
++        MemberSummaryWriter writer =
++                memberSummaryWriters[VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL];
++        VisibleMemberMap visibleMemberMap =
++                visibleMemberMaps[VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL];
++        addSummary(writer, visibleMemberMap, false, memberSummaryTree);
+     }
+ 
+-        /**
+-         * Build the summary for the fields.
+-         */
+-        public void buildFieldsSummary(XMLNode node) {
+-                buildSummary(
+-                        memberSummaryWriters[VisibleMemberMap.FIELDS],
+-                        visibleMemberMaps[VisibleMemberMap.FIELDS]);
+-        }
++    /**
++     * Build the summary for the optional members.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param memberSummaryTree the content tree to which the documentation will be added
++     */
++    public void buildAnnotationTypeRequiredMemberSummary(XMLNode node, Content memberSummaryTree) {
++        MemberSummaryWriter writer =
++                memberSummaryWriters[VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED];
++        VisibleMemberMap visibleMemberMap =
++                visibleMemberMaps[VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED];
++        addSummary(writer, visibleMemberMap, false, memberSummaryTree);
++    }
+ 
+-        /**
+-         * Build the inherited summary for the fields.
+-         */
+-        public void buildFieldsInheritedSummary(XMLNode node) {
+-                buildInheritedSummary(
+-                        memberSummaryWriters[VisibleMemberMap.FIELDS],
+-                        visibleMemberMaps[VisibleMemberMap.FIELDS]);
+-        }
++    /**
++     * Build the summary for the fields.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param memberSummaryTree the content tree to which the documentation will be added
++     */
++    public void buildFieldsSummary(XMLNode node, Content memberSummaryTree) {
++        MemberSummaryWriter writer =
++                memberSummaryWriters[VisibleMemberMap.FIELDS];
++        VisibleMemberMap visibleMemberMap =
++                visibleMemberMaps[VisibleMemberMap.FIELDS];
++        addSummary(writer, visibleMemberMap, true, memberSummaryTree);
++    }
+ 
+-        /**
+-         * Build the summary for the nested classes.
+-         */
+-        public void buildNestedClassesSummary(XMLNode node) {
+-                buildSummary(
+-                        memberSummaryWriters[VisibleMemberMap.INNERCLASSES],
+-                        visibleMemberMaps[VisibleMemberMap.INNERCLASSES]);
+-        }
++    /**
++     * Build the summary for the nested classes.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param memberSummaryTree the content tree to which the documentation will be added
++     */
++    public void buildNestedClassesSummary(XMLNode node, Content memberSummaryTree) {
++        MemberSummaryWriter writer =
++                memberSummaryWriters[VisibleMemberMap.INNERCLASSES];
++        VisibleMemberMap visibleMemberMap =
++                visibleMemberMaps[VisibleMemberMap.INNERCLASSES];
++        addSummary(writer, visibleMemberMap, true, memberSummaryTree);
++    }
+ 
+-        /**
+-         * Build the inherited summary for the nested classes.
+-         */
+-        public void buildNestedClassesInheritedSummary(XMLNode node) {
+-                buildInheritedSummary(
+-                        memberSummaryWriters[VisibleMemberMap.INNERCLASSES],
+-                        visibleMemberMaps[VisibleMemberMap.INNERCLASSES]);
+-        }
++    /**
++     * Build the method summary.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param memberSummaryTree the content tree to which the documentation will be added
++     */
++    public void buildMethodsSummary(XMLNode node, Content memberSummaryTree) {
++        MemberSummaryWriter writer =
++                memberSummaryWriters[VisibleMemberMap.METHODS];
++        VisibleMemberMap visibleMemberMap =
++                visibleMemberMaps[VisibleMemberMap.METHODS];
++        addSummary(writer, visibleMemberMap, true, memberSummaryTree);
++    }
+ 
+-        /**
+-         * Build the method summary.
+-         */
+-        public void buildMethodsSummary(XMLNode node) {
+-                buildSummary(
+-                        memberSummaryWriters[VisibleMemberMap.METHODS],
+-                        visibleMemberMaps[VisibleMemberMap.METHODS]);
+-        }
++    /**
++     * Build the constructor summary.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param memberSummaryTree the content tree to which the documentation will be added
++     */
++    public void buildConstructorsSummary(XMLNode node, Content memberSummaryTree) {
++        MemberSummaryWriter writer =
++                memberSummaryWriters[VisibleMemberMap.CONSTRUCTORS];
++        VisibleMemberMap visibleMemberMap =
++                visibleMemberMaps[VisibleMemberMap.CONSTRUCTORS];
++        addSummary(writer, visibleMemberMap, false, memberSummaryTree);
++    }
+ 
+-        /**
+-         * Build the inherited method summary.
+-         */
+-        public void buildMethodsInheritedSummary(XMLNode node) {
+-                buildInheritedSummary(
+-                        memberSummaryWriters[VisibleMemberMap.METHODS],
+-                        visibleMemberMaps[VisibleMemberMap.METHODS]);
+-        }
+-
+-        /**
+-         * Build the constructor summary.
+-         */
+-        public void buildConstructorsSummary(XMLNode node) {
+-                buildSummary(
+-                        memberSummaryWriters[VisibleMemberMap.CONSTRUCTORS],
+-                        visibleMemberMaps[VisibleMemberMap.CONSTRUCTORS]);
+-        }
+-
+-        /**
+-         * Build the member summary for the given members.
+-         *
+-         * @param writer           the summary writer to write the output.
+-         * @param visibleMemberMap the given members to summarize.
+-         */
+-        private void buildSummary(MemberSummaryWriter writer,
+-            VisibleMemberMap visibleMemberMap) {
+-        List members = new ArrayList(visibleMemberMap.getLeafClassMembers(
+-            configuration));
++    /**
++     * Build the member summary for the given members.
++     *
++     * @param writer the summary writer to write the output.
++     * @param visibleMemberMap the given members to summarize.
++     * @param summaryTreeList list of content trees to which the documentation will be added
++     */
++    private void buildSummary(MemberSummaryWriter writer,
++            VisibleMemberMap visibleMemberMap, LinkedList<Content> summaryTreeList) {
++        List<ProgramElementDoc> members = new ArrayList(visibleMemberMap.getLeafClassMembers(
++                configuration));
+         if (members.size() > 0) {
+             Collections.sort(members);
+-            writer.writeMemberSummaryHeader(classDoc);
++            Content tableTree = writer.getSummaryTableTree(classDoc);
+             for (int i = 0; i < members.size(); i++) {
+                 ProgramElementDoc member = (ProgramElementDoc) members.get(i);
+                 Tag[] firstSentenceTags = member.firstSentenceTags();
+@@ -301,32 +312,32 @@
+                     //Inherit comments from overriden or implemented method if
+                     //necessary.
+                     DocFinder.Output inheritedDoc =
+-                        DocFinder.search(new DocFinder.Input((MethodDoc) member));
++                            DocFinder.search(new DocFinder.Input((MethodDoc) member));
+                     if (inheritedDoc.holder != null &&
+                             inheritedDoc.holder.firstSentenceTags().length > 0) {
+                         firstSentenceTags = inheritedDoc.holder.firstSentenceTags();
+                     }
+                 }
+-                writer.writeMemberSummary(classDoc, member, firstSentenceTags,
+-                    i == 0, i == members.size() - 1);
++                writer.addMemberSummary(classDoc, member, firstSentenceTags, tableTree, i);
+             }
+-            writer.writeMemberSummaryFooter(classDoc);
++            summaryTreeList.add(tableTree);
+         }
+-        }
++    }
+ 
+     /**
+      * Build the inherited member summary for the given methods.
+      *
+-     * @param writer           the writer for this member summary.
++     * @param writer the writer for this member summary.
+      * @param visibleMemberMap the map for the members to document.
++     * @param summaryTreeList list of content trees to which the documentation will be added
+      */
+-        private void buildInheritedSummary(MemberSummaryWriter writer,
+-            VisibleMemberMap visibleMemberMap) {
++    private void buildInheritedSummary(MemberSummaryWriter writer,
++            VisibleMemberMap visibleMemberMap, LinkedList<Content> summaryTreeList) {
+         for (Iterator iter = visibleMemberMap.getVisibleClassesList().iterator();
+                 iter.hasNext();) {
+             ClassDoc inhclass = (ClassDoc) (iter.next());
+             if (! (inhclass.isPublic() ||
+-                Util.isLinkable(inhclass, configuration))) {
++                    Util.isLinkable(inhclass, configuration))) {
+                 continue;
+             }
+             if (inhclass == classDoc) {
+@@ -335,18 +346,45 @@
+             List inhmembers = visibleMemberMap.getMembersFor(inhclass);
+             if (inhmembers.size() > 0) {
+                 Collections.sort(inhmembers);
+-                writer.writeInheritedMemberSummaryHeader(inhclass);
++                Content inheritedTree = writer.getInheritedSummaryHeader(inhclass);
++                Content linksTree = writer.getInheritedSummaryLinksTree();
+                 for (int j = 0; j < inhmembers.size(); ++j) {
+-                    writer.writeInheritedMemberSummary(
+-                        inhclass.isPackagePrivate() &&
++                    writer.addInheritedMemberSummary(
++                            inhclass.isPackagePrivate() &&
+                             ! Util.isLinkable(inhclass, configuration) ?
+                             classDoc : inhclass,
+-                        (ProgramElementDoc) inhmembers.get(j),
+-                        j == 0,
+-                        j == inhmembers.size() - 1);
++			    (ProgramElementDoc) inhmembers.get(j),
++			    j == 0,
++			    j == inhmembers.size() - 1, linksTree);
+                 }
+-                writer.writeInheritedMemberSummaryFooter(inhclass);
++                inheritedTree.addContent(linksTree);
++                summaryTreeList.add(writer.getMemberTree(inheritedTree));
+             }
+         }
+     }
++
++    /**
++     * Add the summary for the documentation.
++     *
++     * @param writer the writer for this member summary.
++     * @param visibleMemberMap the map for the members to document.
++     * @param showInheritedSummary true if inherited summary should be documented
++     * @param memberSummaryTree the content tree to which the documentation will be added
++     */
++    private void addSummary(MemberSummaryWriter writer,
++            VisibleMemberMap visibleMemberMap, boolean showInheritedSummary,
++            Content memberSummaryTree) {
++        LinkedList<Content> summaryTreeList = new LinkedList<Content>();
++        buildSummary(writer, visibleMemberMap, summaryTreeList);
++        if (showInheritedSummary)
++            buildInheritedSummary(writer, visibleMemberMap, summaryTreeList);
++        if (!summaryTreeList.isEmpty()) {
++            Content memberTree = writer.getMemberSummaryHeader(
++                    classDoc, memberSummaryTree);
++            for (int i = 0; i < summaryTreeList.size(); i++) {
++                memberTree.addContent(summaryTreeList.get(i));
++            }
++            memberSummaryTree.addContent(writer.getMemberTree(memberTree));
++        }
++    }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java
+@@ -25,10 +25,10 @@
+ 
+ package com.sun.tools.doclets.internal.toolkit.builders;
+ 
++import java.util.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.javadoc.*;
+-import java.util.*;
+ 
+ /**
+  * Builds documentation for a method.
+@@ -38,164 +38,170 @@
+  * Do not use it as an API
+  *
+  * @author Jamie Ho
++ * @author Bhavesh Patel (Modified)
+  * @since 1.5
+  */
+ public class MethodBuilder extends AbstractMemberBuilder {
+ 
+-        /**
+-         * The index of the current field that is being documented at this point
+-         * in time.
+-         */
+-        private int currentMethodIndex;
++    /**
++     * The index of the current field that is being documented at this point
++     * in time.
++     */
++    private int currentMethodIndex;
+ 
+-        /**
+-         * The class whose methods are being documented.
+-         */
+-        private ClassDoc classDoc;
++    /**
++     * The class whose methods are being documented.
++     */
++    private ClassDoc classDoc;
+ 
+-        /**
+-         * The visible methods for the given class.
+-         */
+-        private VisibleMemberMap visibleMemberMap;
++    /**
++     * The visible methods for the given class.
++     */
++    private VisibleMemberMap visibleMemberMap;
+ 
+-        /**
+-         * The writer to output the method documentation.
+-         */
+-        private MethodWriter writer;
++    /**
++     * The writer to output the method documentation.
++     */
++    private MethodWriter writer;
+ 
+-        /**
+-         * The methods being documented.
+-         */
+-        private List methods;
++    /**
++     * The methods being documented.
++     */
++    private List<ProgramElementDoc> methods;
+ 
+-        private MethodBuilder(Configuration configuration) {
+-                super(configuration);
++    private MethodBuilder(Configuration configuration) {
++        super(configuration);
++    }
++
++    /**
++     * Construct a new MethodBuilder.
++     *
++     * @param configuration the current configuration of the doclet.
++     * @param classDoc the class whoses members are being documented.
++     * @param writer the doclet specific writer.
++     *
++     * @return an instance of a MethodBuilder.
++     */
++    public static MethodBuilder getInstance(
++            Configuration configuration,
++            ClassDoc classDoc,
++            MethodWriter writer) {
++        MethodBuilder builder = new MethodBuilder(configuration);
++        builder.classDoc = classDoc;
++        builder.writer = writer;
++        builder.visibleMemberMap =
++                new VisibleMemberMap(
++                classDoc,
++                VisibleMemberMap.METHODS,
++                configuration.nodeprecated);
++        builder.methods =
++                new ArrayList<ProgramElementDoc>(builder.visibleMemberMap.getLeafClassMembers(
++                configuration));
++        if (configuration.getMemberComparator() != null) {
++            Collections.sort(
++                    builder.methods,
++                    configuration.getMemberComparator());
+         }
+ 
+-        /**
+-         * Construct a new MethodBuilder.
+-         *
+-         * @param configuration the current configuration of the doclet.
+-         * @param classDoc the class whoses members are being documented.
+-         * @param writer the doclet specific writer.
+-         *
+-         * @return an instance of a MethodBuilder.
+-         */
+-        public static MethodBuilder getInstance(
+-                Configuration configuration,
+-                ClassDoc classDoc,
+-                MethodWriter writer) {
+-                MethodBuilder builder = new MethodBuilder(configuration);
+-                builder.classDoc = classDoc;
+-                builder.writer = writer;
+-                builder.visibleMemberMap =
+-                        new VisibleMemberMap(
+-                                classDoc,
+-                                VisibleMemberMap.METHODS,
+-                                configuration.nodeprecated);
+-                builder.methods =
+-                        new ArrayList(builder.visibleMemberMap.getLeafClassMembers(
+-                configuration));
+-                if (configuration.getMemberComparator() != null) {
+-                        Collections.sort(
+-                                builder.methods,
+-                                configuration.getMemberComparator());
+-                }
+-                return builder;
++    /**
++     * {@inheritDoc}
++     */
++    public String getName() {
++        return "MethodDetails";
++    }
++
++    /**
++     * Returns a list of methods that will be documented for the given class.
++     * This information can be used for doclet specific documentation
++     * generation.
++     *
++     * @param classDoc the {@link ClassDoc} we want to check.
++     * @return a list of methods that will be documented.
++     */
++    public List<ProgramElementDoc> members(ClassDoc classDoc) {
++        return visibleMemberMap.getMembersFor(classDoc);
++    }
++
++    /**
++     * Returns the visible member map for the methods of this class.
++     *
++     * @return the visible member map for the methods of this class.
++     */
++    public VisibleMemberMap getVisibleMemberMap() {
++        return visibleMemberMap;
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public boolean hasMembersToDocument() {
++        return methods.size() > 0;
++    }
++
++    /**
++     * Build the method documentation.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param memberDetailsTree the content tree to which the documentation will be added
++     */
++    public void buildMethodDoc(XMLNode node, Content memberDetailsTree) {
++        if (writer == null) {
++            return;
+         }
++        int size = methods.size();
++        if (size > 0) {
++            Content methodDetailsTree = writer.getMethodDetailsTreeHeader(
++                    classDoc, memberDetailsTree);
++            for (currentMethodIndex = 0; currentMethodIndex < size;
++                    currentMethodIndex++) {
++                Content methodDocTree = writer.getMethodDocTreeHeader(
++                        (MethodDoc) methods.get(currentMethodIndex),
++                        methodDetailsTree);
++                buildChildren(node, methodDocTree);
++                methodDetailsTree.addContent(writer.getMethodDoc(
++                        methodDocTree, (currentMethodIndex == size - 1)));
++            }
++            memberDetailsTree.addContent(
++                    writer.getMethodDetails(methodDetailsTree));
++        }
++    }
+ 
+-        /**
+-         * {@inheritDoc}
+-         */
+-        public String getName() {
+-                return "MethodDetails";
+-        }
++    /**
++     * Build the signature.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param methodDocTree the content tree to which the documentation will be added
++     */
++    public void buildSignature(XMLNode node, Content methodDocTree) {
++        methodDocTree.addContent(
++                writer.getSignature((MethodDoc) methods.get(currentMethodIndex)));
++    }
+ 
+-        /**
+-         * Returns a list of methods that will be documented for the given class.
+-         * This information can be used for doclet specific documentation
+-         * generation.
+-         *
+-         * @param classDoc the {@link ClassDoc} we want to check.
+-         * @return a list of methods that will be documented.
+-         */
+-        public List members(ClassDoc classDoc) {
+-                return visibleMemberMap.getMembersFor(classDoc);
+-        }
++    /**
++     * Build the deprecation information.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param methodDocTree the content tree to which the documentation will be added
++     */
++    public void buildDeprecationInfo(XMLNode node, Content methodDocTree) {
++        writer.addDeprecated(
++                (MethodDoc) methods.get(currentMethodIndex), methodDocTree);
++    }
+ 
+-        /**
+-         * Returns the visible member map for the methods of this class.
+-         *
+-         * @return the visible member map for the methods of this class.
+-         */
+-        public VisibleMemberMap getVisibleMemberMap() {
+-                return visibleMemberMap;
+-        }
+-
+-        /**
+-         * {@inheritDoc}
+-         */
+-        public boolean hasMembersToDocument() {
+-                return methods.size() > 0;
+-        }
+-
+-        /**
+-         * Build the method documentation.
+-         */
+-        public void buildMethodDoc(XMLNode node) {
+-                if (writer == null) {
+-                        return;
+-                }
+-                for (currentMethodIndex = 0;
+-                        currentMethodIndex < methods.size();
+-                        currentMethodIndex++) {
+-                        buildChildren(node);
+-                }
+-        }
+-
+-        /**
+-         * Build the overall header.
+-         */
+-        public void buildHeader(XMLNode node) {
+-                writer.writeHeader(
+-                        classDoc,
+-                        configuration.getText("doclet.Method_Detail"));
+-        }
+-
+-        /**
+-         * Build the header for the individual method.
+-         */
+-        public void buildMethodHeader(XMLNode node) {
+-                writer.writeMethodHeader(
+-                        (MethodDoc) methods.get(currentMethodIndex),
+-                        currentMethodIndex == 0);
+-        }
+-
+-        /**
+-         * Build the signature.
+-         */
+-        public void buildSignature(XMLNode node) {
+-                writer.writeSignature((MethodDoc) methods.get(currentMethodIndex));
+-        }
+-
+-        /**
+-         * Build the deprecation information.
+-         */
+-        public void buildDeprecationInfo(XMLNode node) {
+-                writer.writeDeprecated((MethodDoc) methods.get(currentMethodIndex));
+-        }
+-
+-        /**
+-         * Build the comments for the method.  Do nothing if
+-         * {@link Configuration#nocomment} is set to true.  If this method
+-         */
+-        public void buildMethodComments(XMLNode node) {
+-                if (!configuration.nocomment) {
++    /**
++     * Build the comments for the method.  Do nothing if
++     * {@link Configuration#nocomment} is set to true.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param methodDocTree the content tree to which the documentation will be added
++     */
++    public void buildMethodComments(XMLNode node, Content methodDocTree) {
++        if (!configuration.nocomment) {
+             MethodDoc method = (MethodDoc) methods.get(currentMethodIndex);
+ 
+             if (method.inlineTags().length == 0) {
+                 DocFinder.Output docs = DocFinder.search(
+-                    new DocFinder.Input(method));
++                        new DocFinder.Input(method));
+                 method = docs.inlineTags != null && docs.inlineTags.length > 0 ?
+                     (MethodDoc) docs.holder : method;
+ 
+@@ -203,39 +209,27 @@
+             //NOTE:  When we fix the bug where ClassDoc.interfaceTypes() does
+             //       not pass all implemented interfaces, holder will be the
+             //       interface type.  For now, it is really the erasure.
+-            writer.writeComments(method.containingClass(), method);
+-                }
++            writer.addComments(method.containingClass(), method, methodDocTree);
+         }
++    }
+ 
++    /**
++     * Build the tag information.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param methodDocTree the content tree to which the documentation will be added
++     */
++    public void buildTagInfo(XMLNode node, Content methodDocTree) {
++        writer.addTags((MethodDoc) methods.get(currentMethodIndex),
++                methodDocTree);
++    }
+ 
+-
+-        /**
+-         * Build the tag information.
+-         */
+-        public void buildTagInfo(XMLNode node) {
+-                writer.writeTags((MethodDoc) methods.get(currentMethodIndex));
+-        }
+-
+-        /**
+-         * Build the footer of the method.
+-         */
+-        public void buildMethodFooter(XMLNode node) {
+-                writer.writeMethodFooter();
+-        }
+-
+-        /**
+-         * Build the overall footer.
+-         */
+-        public void buildFooter(XMLNode node) {
+-                writer.writeFooter(classDoc);
+-        }
+-
+-        /**
+-         * Return the method writer for this builder.
+-         *
+-         * @return the method writer for this builder.
+-         */
+-        public MethodWriter getWriter() {
+-                return writer;
+-        }
++    /**
++     * Return the method writer for this builder.
++     *
++     * @return the method writer for this builder.
++     */
++    public MethodWriter getWriter() {
++        return writer;
++    }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java
+@@ -25,10 +25,10 @@
+ 
+ package com.sun.tools.doclets.internal.toolkit.builders;
+ 
++import java.io.*;
++import com.sun.javadoc.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+-import com.sun.javadoc.*;
+-import java.io.*;
+ 
+ /**
+  * Builds the summary for a given package.
+@@ -42,281 +42,315 @@
+  * @since 1.5
+  */
+ public class PackageSummaryBuilder extends AbstractBuilder {
++    /**
++     * The root element of the package summary XML is {@value}.
++     */
++    public static final String ROOT = "PackageDoc";
+ 
+-        /**
+-         * The root element of the package summary XML is {@value}.
+-         */
+-        public static final String ROOT = "PackageDoc";
++    /**
++     * The package being documented.
++     */
++    private PackageDoc packageDoc;
+ 
+-        /**
+-         * The package being documented.
+-         */
+-        private PackageDoc packageDoc;
++    /**
++     * The doclet specific writer that will output the result.
++     */
++    private PackageSummaryWriter packageWriter;
+ 
+-        /**
+-         * The doclet specific writer that will output the result.
+-         */
+-        private PackageSummaryWriter packageWriter;
++    /**
++     * The content that will be added to the package summary documentation tree.
++     */
++    private Content contentTree;
+ 
+-        private PackageSummaryBuilder(Configuration configuration) {
+-                super(configuration);
++    private PackageSummaryBuilder(Configuration configuration) {
++        super(configuration);
++    }
++
++    /**
++     * Construct a new PackageSummaryBuilder.
++     * @param configuration the current configuration of the doclet.
++     * @param pkg the package being documented.
++     * @param packageWriter the doclet specific writer that will output the
++     *        result.
++     *
++     * @return an instance of a PackageSummaryBuilder.
++     */
++    public static PackageSummaryBuilder getInstance(
++        Configuration configuration,
++        PackageDoc pkg,
++        PackageSummaryWriter packageWriter) {
++        PackageSummaryBuilder builder =
++                new PackageSummaryBuilder(configuration);
++        builder.packageDoc = pkg;
++        builder.packageWriter = packageWriter;
++        return builder;
++    }
++
++    /**
++     * Build the package summary.
++     */
++    public void build() throws IOException {
++        if (packageWriter == null) {
++            //Doclet does not support this output.
++            return;
++        }
++        build(LayoutParser.getInstance(configuration).parseXML(ROOT), contentTree);
++    }
++
++    /**
++     * {@inheritDoc}
++     */
++    public String getName() {
++        return ROOT;
++    }
++
++    /**
++     * Build the package documentation.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param contentTree the content tree to which the documentation will be added
++     */
++    public void buildPackageDoc(XMLNode node, Content contentTree) throws Exception {
++        contentTree = packageWriter.getPackageHeader(
++                Util.getPackageName(packageDoc));
++        buildChildren(node, contentTree);
++        packageWriter.addPackageFooter(contentTree);
++        packageWriter.printDocument(contentTree);
++        packageWriter.close();
++        Util.copyDocFiles(
++                configuration,
++                Util.getPackageSourcePath(configuration, packageDoc),
++                DirectoryManager.getDirectoryPath(packageDoc)
++                        + File.separator
++                        + DocletConstants.DOC_FILES_DIR_NAME,
++                true);
++    }
++
++    /**
++     * Build the content for the package doc.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param contentTree the content tree to which the package contents
++     *                    will be added
++     */
++    public void buildContent(XMLNode node, Content contentTree) {
++        Content packageContentTree = packageWriter.getContentHeader();
++        buildChildren(node, packageContentTree);
++        contentTree.addContent(packageContentTree);
++    }
++
++    /**
++     * Build the package summary.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param packageContentTree the package content tree to which the summaries will
++     *                           be added
++     */
++    public void buildSummary(XMLNode node, Content packageContentTree) {
++        Content summaryContentTree = packageWriter.getSummaryHeader();
++        buildChildren(node, summaryContentTree);
++        packageContentTree.addContent(summaryContentTree);
++    }
++
++    /**
++     * Build the summary for the interfaces in this package.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param summaryContentTree the summary tree to which the interface summary
++     *                           will be added
++     */
++    public void buildInterfaceSummary(XMLNode node, Content summaryContentTree) {
++        String interfaceTableSummary =
++                configuration.getText("doclet.Member_Table_Summary",
++                configuration.getText("doclet.Interface_Summary"),
++                configuration.getText("doclet.interfaces"));
++        String[] interfaceTableHeader = new String[] {
++           configuration.getText("doclet.Interface"),
++            configuration.getText("doclet.Description")
++        };
++        ClassDoc[] interfaces =
++                packageDoc.isIncluded()
++                        ? packageDoc.interfaces()
++                        : configuration.classDocCatalog.interfaces(
++                                Util.getPackageName(packageDoc));
++        if (interfaces.length > 0) {
++            packageWriter.addClassesSummary(
++                    interfaces,
++                    configuration.getText("doclet.Interface_Summary"),
++                    interfaceTableSummary, interfaceTableHeader, summaryContentTree);
+         }
+ 
+-        /**
+-         * Construct a new PackageSummaryBuilder.
+-         * @param configuration the current configuration of the doclet.
+-         * @param pkg the package being documented.
+-         * @param packageWriter the doclet specific writer that will output the
+-         *        result.
+-         *
+-         * @return an instance of a PackageSummaryBuilder.
+-         */
+-        public static PackageSummaryBuilder getInstance(
+-                Configuration configuration,
+-                PackageDoc pkg,
+-                PackageSummaryWriter packageWriter) {
+-                PackageSummaryBuilder builder =
+-                        new PackageSummaryBuilder(configuration);
+-                builder.packageDoc = pkg;
+-                builder.packageWriter = packageWriter;
+-                return builder;
++    /**
++     * Build the summary for the classes in this package.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param summaryContentTree the summary tree to which the class summary will
++     *                           be added
++     */
++    public void buildClassSummary(XMLNode node, Content summaryContentTree) {
++        String classTableSummary =
++                configuration.getText("doclet.Member_Table_Summary",
++                configuration.getText("doclet.Class_Summary"),
++                configuration.getText("doclet.classes"));
++        String[] classTableHeader = new String[] {
++            configuration.getText("doclet.Class"),
++            configuration.getText("doclet.Description")
++        };
++        ClassDoc[] classes =
++                packageDoc.isIncluded()
++                        ? packageDoc.ordinaryClasses()
++                        : configuration.classDocCatalog.ordinaryClasses(
++                                Util.getPackageName(packageDoc));
++        if (classes.length > 0) {
++            packageWriter.addClassesSummary(
++                    classes,
++                    configuration.getText("doclet.Class_Summary"),
++                    classTableSummary, classTableHeader, summaryContentTree);
++        }
++    }
++
++    /**
++     * Build the summary for the enums in this package.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param summaryContentTree the summary tree to which the enum summary will
++     *                           be added
++     */
++    public void buildEnumSummary(XMLNode node, Content summaryContentTree) {
++        String enumTableSummary =
++                configuration.getText("doclet.Member_Table_Summary",
++                configuration.getText("doclet.Enum_Summary"),
++                configuration.getText("doclet.enums"));
++        String[] enumTableHeader = new String[] {
++            configuration.getText("doclet.Enum"),
++            configuration.getText("doclet.Description")
++        };
++        ClassDoc[] enums =
++                packageDoc.isIncluded()
++                        ? packageDoc.enums()
++                        : configuration.classDocCatalog.enums(
++                                Util.getPackageName(packageDoc));
++        if (enums.length > 0) {
++            packageWriter.addClassesSummary(
++                    enums,
++                    configuration.getText("doclet.Enum_Summary"),
++                    enumTableSummary, enumTableHeader, summaryContentTree);
++        }
++    }
++
++    /**
++     * Build the summary for the exceptions in this package.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param summaryContentTree the summary tree to which the exception summary will
++     *                           be added
++     */
++    public void buildExceptionSummary(XMLNode node, Content summaryContentTree) {
++        String exceptionTableSummary =
++                configuration.getText("doclet.Member_Table_Summary",
++                configuration.getText("doclet.Exception_Summary"),
++                configuration.getText("doclet.exceptions"));
++        String[] exceptionTableHeader = new String[] {
++            configuration.getText("doclet.Exception"),
++            configuration.getText("doclet.Description")
++        };
++        ClassDoc[] exceptions =
++                packageDoc.isIncluded()
++                        ? packageDoc.exceptions()
++                        : configuration.classDocCatalog.exceptions(
++                                Util.getPackageName(packageDoc));
++        if (exceptions.length > 0) {
++            packageWriter.addClassesSummary(
++                    exceptions,
++                    configuration.getText("doclet.Exception_Summary"),
++                    exceptionTableSummary, exceptionTableHeader, summaryContentTree);
++         }
++    }
++
++    /**
++     * Build the summary for the errors in this package.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param summaryContentTree the summary tree to which the error summary will
++     *                           be added
++     */
++    public void buildErrorSummary(XMLNode node, Content summaryContentTree) {
++        String errorTableSummary =
++                configuration.getText("doclet.Member_Table_Summary",
++                configuration.getText("doclet.Error_Summary"),
++                configuration.getText("doclet.errors"));
++        String[] errorTableHeader = new String[] {
++            configuration.getText("doclet.Error"),
++            configuration.getText("doclet.Description")
++        };
++        ClassDoc[] errors =
++                packageDoc.isIncluded()
++                        ? packageDoc.errors()
++                        : configuration.classDocCatalog.errors(
++                                Util.getPackageName(packageDoc));
++        if (errors.length > 0) {
++            packageWriter.addClassesSummary(
++                    errors,
++                    configuration.getText("doclet.Error_Summary"),
++                    errorTableSummary, errorTableHeader, summaryContentTree);
++        }
++    }
++
++    /**
++     * Build the summary for the annotation type in this package.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param summaryContentTree the summary tree to which the annotation type
++     *                           summary will be added
++     */
++    public void buildAnnotationTypeSummary(XMLNode node, Content summaryContentTree) {
++        String annotationtypeTableSummary =
++                configuration.getText("doclet.Member_Table_Summary",
++                configuration.getText("doclet.Annotation_Types_Summary"),
++                configuration.getText("doclet.annotationtypes"));
++        String[] annotationtypeTableHeader = new String[] {
++            configuration.getText("doclet.AnnotationType"),
++            configuration.getText("doclet.Description")
++        };
++        ClassDoc[] annotationTypes =
++                packageDoc.isIncluded()
++                        ? packageDoc.annotationTypes()
++                        : configuration.classDocCatalog.annotationTypes(
++                                Util.getPackageName(packageDoc));
++        if (annotationTypes.length > 0) {
++            packageWriter.addClassesSummary(
++                    annotationTypes,
++                    configuration.getText("doclet.Annotation_Types_Summary"),
++                    annotationtypeTableSummary, annotationtypeTableHeader,
++                    summaryContentTree);
++        }
++    }
++
++    /**
++     * Build the description of the summary.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param packageContentTree the tree to which the package description will
++     *                           be added
++     */
++    public void buildPackageDescription(XMLNode node, Content packageContentTree) {
++        if (configuration.nocomment) {
++            return;
++        }
++        packageWriter.addPackageDescription(packageContentTree);
++    }
++
++    /**
++     * Build the tags of the summary.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param packageContentTree the tree to which the package tags will be added
++     */
++    public void buildPackageTags(XMLNode node, Content packageContentTree) {
++        if (configuration.nocomment) {
++            return;
+         }
+ 
+-        /**
+-         * Build the package summary.
+-         */
+-        public void build() throws IOException {
+-                if (packageWriter == null) {
+-                        //Doclet does not support this output.
+-                        return;
+-                }
+-                build(LayoutParser.getInstance(configuration).parseXML(ROOT));
+-        }
+-
+-        /**
+-         * {@inheritDoc}
+-         */
+-        public String getName() {
+-                return ROOT;
+-        }
+-
+-        /**
+-         * Build the package documentation.
+-         */
+-        public void buildPackageDoc(XMLNode node) throws Exception {
+-                buildChildren(node);
+-                packageWriter.close();
+-                Util.copyDocFiles(
+-                        configuration,
+-                        Util.getPackageSourcePath(configuration, packageDoc),
+-                        DirectoryManager.getDirectoryPath(packageDoc)
+-                                + File.separator
+-                                + DocletConstants.DOC_FILES_DIR_NAME,
+-                        true);
+-        }
+-
+-        /**
+-         * Build the header of the summary.
+-         */
+-        public void buildPackageHeader(XMLNode node) {
+-                packageWriter.writePackageHeader(Util.getPackageName(packageDoc));
+-        }
+-
+-        /**
+-         * Build the description of the summary.
+-         */
+-        public void buildPackageDescription(XMLNode node) {
+-                if (configuration.nocomment) {
+-                        return;
+-                }
+-                packageWriter.writePackageDescription();
+-        }
+-
+-        /**
+-         * Build the tags of the summary.
+-         */
+-        public void buildPackageTags(XMLNode node) {
+-                if (configuration.nocomment) {
+-                        return;
+-                }
+-                packageWriter.writePackageTags();
+-        }
+-
+-        /**
+-         * Build the package summary.
+-         */
+-        public void buildSummary(XMLNode node) {
+-                buildChildren(node);
+-        }
+-
+-        /**
+-         * Build the overall header.
+-         */
+-        public void buildSummaryHeader(XMLNode node) {
+-                packageWriter.writeSummaryHeader();
+-        }
+-
+-        /**
+-         * Build the overall footer.
+-         */
+-        public void buildSummaryFooter(XMLNode node) {
+-                packageWriter.writeSummaryFooter();
+-        }
+-
+-        /**
+-         * Build the summary for the classes in this package.
+-         */
+-        public void buildClassSummary(XMLNode node) {
+-            String classTableSummary =
+-                    configuration.getText("doclet.Member_Table_Summary",
+-                    configuration.getText("doclet.Class_Summary"),
+-                    configuration.getText("doclet.classes"));
+-            String[] classTableHeader = new String[] {
+-                configuration.getText("doclet.Class"),
+-                configuration.getText("doclet.Description")
+-            };
+-            ClassDoc[] classes =
+-                        packageDoc.isIncluded()
+-                                ? packageDoc.ordinaryClasses()
+-                                : configuration.classDocCatalog.ordinaryClasses(
+-                                        Util.getPackageName(packageDoc));
+-                if (classes.length > 0) {
+-                        packageWriter.writeClassesSummary(
+-                                classes,
+-                                configuration.getText("doclet.Class_Summary"),
+-                                classTableSummary, classTableHeader);
+-                }
+-        }
+-
+-        /**
+-         * Build the summary for the interfaces in this package.
+-         */
+-        public void buildInterfaceSummary(XMLNode node) {
+-            String interfaceTableSummary =
+-                    configuration.getText("doclet.Member_Table_Summary",
+-                    configuration.getText("doclet.Interface_Summary"),
+-                    configuration.getText("doclet.interfaces"));
+-            String[] interfaceTableHeader = new String[] {
+-                configuration.getText("doclet.Interface"),
+-                configuration.getText("doclet.Description")
+-            };
+-            ClassDoc[] interfaces =
+-                        packageDoc.isIncluded()
+-                                ? packageDoc.interfaces()
+-                                : configuration.classDocCatalog.interfaces(
+-                                        Util.getPackageName(packageDoc));
+-                if (interfaces.length > 0) {
+-                        packageWriter.writeClassesSummary(
+-                                interfaces,
+-                                configuration.getText("doclet.Interface_Summary"),
+-                                interfaceTableSummary, interfaceTableHeader);
+-                }
+-        }
+-
+-        /**
+-         * Build the summary for the enums in this package.
+-         */
+-        public void buildAnnotationTypeSummary(XMLNode node) {
+-            String annotationtypeTableSummary =
+-                    configuration.getText("doclet.Member_Table_Summary",
+-                    configuration.getText("doclet.Annotation_Types_Summary"),
+-                    configuration.getText("doclet.annotationtypes"));
+-            String[] annotationtypeTableHeader = new String[] {
+-                configuration.getText("doclet.AnnotationType"),
+-                configuration.getText("doclet.Description")
+-            };
+-            ClassDoc[] annotationTypes =
+-                        packageDoc.isIncluded()
+-                                ? packageDoc.annotationTypes()
+-                                : configuration.classDocCatalog.annotationTypes(
+-                                        Util.getPackageName(packageDoc));
+-                if (annotationTypes.length > 0) {
+-                        packageWriter.writeClassesSummary(
+-                                annotationTypes,
+-                                configuration.getText("doclet.Annotation_Types_Summary"),
+-                                annotationtypeTableSummary, annotationtypeTableHeader);
+-                }
+-        }
+-
+-        /**
+-         * Build the summary for the enums in this package.
+-         */
+-        public void buildEnumSummary(XMLNode node) {
+-            String enumTableSummary =
+-                    configuration.getText("doclet.Member_Table_Summary",
+-                    configuration.getText("doclet.Enum_Summary"),
+-                    configuration.getText("doclet.enums"));
+-            String[] enumTableHeader = new String[] {
+-                configuration.getText("doclet.Enum"),
+-                configuration.getText("doclet.Description")
+-            };
+-            ClassDoc[] enums =
+-                        packageDoc.isIncluded()
+-                                ? packageDoc.enums()
+-                                : configuration.classDocCatalog.enums(
+-                                        Util.getPackageName(packageDoc));
+-                if (enums.length > 0) {
+-                        packageWriter.writeClassesSummary(
+-                                enums,
+-                                configuration.getText("doclet.Enum_Summary"),
+-                                enumTableSummary, enumTableHeader);
+-                }
+-        }
+-
+-        /**
+-         * Build the summary for the exceptions in this package.
+-         */
+-        public void buildExceptionSummary(XMLNode node) {
+-            String exceptionTableSummary =
+-                    configuration.getText("doclet.Member_Table_Summary",
+-                    configuration.getText("doclet.Exception_Summary"),
+-                    configuration.getText("doclet.exceptions"));
+-            String[] exceptionTableHeader = new String[] {
+-                configuration.getText("doclet.Exception"),
+-                configuration.getText("doclet.Description")
+-            };
+-            ClassDoc[] exceptions =
+-                        packageDoc.isIncluded()
+-                                ? packageDoc.exceptions()
+-                                : configuration.classDocCatalog.exceptions(
+-                                        Util.getPackageName(packageDoc));
+-                if (exceptions.length > 0) {
+-                        packageWriter.writeClassesSummary(
+-                                exceptions,
+-                                configuration.getText("doclet.Exception_Summary"),
+-                                exceptionTableSummary, exceptionTableHeader);
+-                }
+-        }
+-
+-        /**
+-         * Build the summary for the errors in this package.
+-         */
+-        public void buildErrorSummary(XMLNode node) {
+-            String errorTableSummary =
+-                    configuration.getText("doclet.Member_Table_Summary",
+-                    configuration.getText("doclet.Error_Summary"),
+-                    configuration.getText("doclet.errors"));
+-            String[] errorTableHeader = new String[] {
+-                configuration.getText("doclet.Error"),
+-                configuration.getText("doclet.Description")
+-            };
+-            ClassDoc[] errors =
+-                        packageDoc.isIncluded()
+-                                ? packageDoc.errors()
+-                                : configuration.classDocCatalog.errors(
+-                                        Util.getPackageName(packageDoc));
+-                if (errors.length > 0) {
+-                        packageWriter.writeClassesSummary(
+-                                errors,
+-                                configuration.getText("doclet.Error_Summary"),
+-                                errorTableSummary, errorTableHeader);
+-                }
+-        }
+-
+-        /**
+-         * Build the footer of the summary.
+-         */
+-        public void buildPackageFooter(XMLNode node) {
+-                packageWriter.writePackageFooter();
+-        }
++        packageWriter.addPackageTags(packageContentTree);
++    }
+ }
+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
+@@ -27,7 +27,6 @@
+ 
+ import java.io.*;
+ import java.util.*;
+-
+ import com.sun.javadoc.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+@@ -87,6 +86,11 @@
+      */
+     protected MemberDoc currentMember;
+ 
++    /**
++     * The content that will be added to the serialized form documentation tree.
++     */
++    private Content contentTree;
++
+     private SerializedFormBuilder(Configuration configuration) {
+         super(configuration);
+     }
+@@ -117,7 +121,7 @@
+         } catch (Exception e) {
+             throw new DocletAbortException();
+         }
+-        build(LayoutParser.getInstance(configuration).parseXML(NAME));
++        build(LayoutParser.getInstance(configuration).parseXML(NAME), contentTree);
+         writer.close();
+     }
+ 
+@@ -130,34 +134,44 @@
+ 
+     /**
+      * Build the serialized form.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param serializedTree content tree to which the documentation will be added
+      */
+-    public void buildSerializedForm(XMLNode node) throws Exception {
+-        buildChildren(node);
++    public void buildSerializedForm(XMLNode node, Content serializedTree) throws Exception {
++        serializedTree = writer.getHeader(configuration.getText(
++                "doclet.Serialized_Form"));
++        buildChildren(node, serializedTree);
++        writer.addFooter(serializedTree);
++        writer.printDocument(serializedTree);
+         writer.close();
+     }
+ 
+     /**
+-     * Build the header.
++     * Build the serialized form summaries.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param serializedTree content tree to which the documentation will be added
+      */
+-    public void buildHeader(XMLNode node) {
+-        writer.writeHeader(configuration.getText("doclet.Serialized_Form"));
++    public void buildSerializedFormSummaries(XMLNode node, Content serializedTree) {
++        Content serializedSummariesTree = writer.getSerializedSummariesHeader();
++        PackageDoc[] packages = configuration.packages;
++        for (int i = 0; i < packages.length; i++) {
++            currentPackage = packages[i];
++            buildChildren(node, serializedSummariesTree);
++        }
++        serializedTree.addContent(writer.getSerializedContent(
++                serializedSummariesTree));
+     }
+ 
+     /**
+-     * Build the contents.
++     * Build the package serialized form for the current package being processed.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param serializedSummariesTree content tree to which the documentation will be added
+      */
+-    public void buildSerializedFormSummaries(XMLNode node) {
+-        PackageDoc[] packages = configuration.packages;
+-        for (int i = 0; i < packages.length; i++) {
+-            currentPackage = packages[i];
+-            buildChildren(node);
+-        }
+-    }
+-
+-    /**
+-     * Build the package serialized for for the current package being processed.
+-     */
+-    public void buildPackageSerializedForm(XMLNode node) {
++    public void buildPackageSerializedForm(XMLNode node, Content serializedSummariesTree) {
++        Content packageSerializedTree = writer.getPackageSerializedHeader();
+         String foo = currentPackage.name();
+         ClassDoc[] classes = currentPackage.allClasses(false);
+         if (classes == null || classes.length == 0) {
+@@ -169,14 +183,29 @@
+         if (!serialClassFoundToDocument(classes)) {
+             return;
+         }
+-        buildChildren(node);
++        buildChildren(node, packageSerializedTree);
++        serializedSummariesTree.addContent(packageSerializedTree);
+     }
+ 
+-    public void buildPackageHeader(XMLNode node) {
+-        writer.writePackageHeader(Util.getPackageName(currentPackage));
++    /**
++     * Build the package header.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param packageSerializedTree content tree to which the documentation will be added
++     */
++    public void buildPackageHeader(XMLNode node, Content packageSerializedTree) {
++        packageSerializedTree.addContent(writer.getPackageHeader(
++                Util.getPackageName(currentPackage)));
+     }
+ 
+-    public void buildClassSerializedForm(XMLNode node) {
++    /**
++     * Build the class serialized form.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param packageSerializedTree content tree to which the documentation will be added
++     */
++    public void buildClassSerializedForm(XMLNode node, Content packageSerializedTree) {
++        Content classSerializedTree = writer.getClassSerializedHeader();
+         ClassDoc[] classes = currentPackage.allClasses(false);
+         Arrays.sort(classes);
+         for (int j = 0; j < classes.length; j++) {
+@@ -187,35 +216,293 @@
+                 if(!serialClassInclude(currentClass)) {
+                     continue;
+                 }
+-                buildChildren(node);
++                Content classTree = writer.getClassHeader(currentClass);
++                buildChildren(node, classTree);
++                classSerializedTree.addContent(classTree);
+             }
+         }
+-    }
+-
+-    public void buildClassHeader(XMLNode node) {
+-        writer.writeClassHeader(currentClass);
++        packageSerializedTree.addContent(classSerializedTree);
+     }
+ 
+     /**
+      * Build the serial UID information for the given class.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param classTree content tree to which the serial UID information will be added
+      */
+-    public void buildSerialUIDInfo(XMLNode node) {
++    public void buildSerialUIDInfo(XMLNode node, Content classTree) {
++        Content serialUidTree = writer.getSerialUIDInfoHeader();
+         FieldDoc[] fields = currentClass.fields(false);
+         for (int i = 0; i < fields.length; i++) {
+             if (fields[i].name().equals("serialVersionUID") &&
+                 fields[i].constantValueExpression() != null) {
+-                writer.writeSerialUIDInfo(SERIAL_VERSION_UID_HEADER,
+-                    fields[i].constantValueExpression());
+-                return;
++                writer.addSerialUIDInfo(SERIAL_VERSION_UID_HEADER,
++                        fields[i].constantValueExpression(), serialUidTree);
++                break;
++            }
++        }
++        classTree.addContent(serialUidTree);
++    }
++
++    /**
++     * Build the summaries for the methods and fields.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param classTree content tree to which the documentation will be added
++     */
++    public void buildClassContent(XMLNode node, Content classTree) {
++        Content classContentTree = writer.getClassContentHeader();
++        buildChildren(node, classContentTree);
++        classTree.addContent(classContentTree);
++    }
++
++    /**
++     * Build the summaries for the methods that belong to the given
++     * class.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param classContentTree content tree to which the documentation will be added
++     */
++    public void buildSerializableMethods(XMLNode node, Content classContentTree) {
++        Content serializableMethodTree = methodWriter.getSerializableMethodsHeader();
++        MemberDoc[] members = currentClass.serializationMethods();
++        int membersLength = members.length;
++        if (membersLength > 0) {
++            for (int i = 0; i < membersLength; i++) {
++                currentMember = members[i];
++                Content methodsContentTree = methodWriter.getMethodsContentHeader(
++                        (i == membersLength - 1));
++                buildChildren(node, methodsContentTree);
++                serializableMethodTree.addContent(methodsContentTree);
++            }
++        }
++        if (currentClass.serializationMethods().length > 0) {
++            classContentTree.addContent(methodWriter.getSerializableMethods(
++                    configuration.getText("doclet.Serialized_Form_methods"),
++                    serializableMethodTree));
++            if (currentClass.isSerializable() && !currentClass.isExternalizable()) {
++                if (currentClass.serializationMethods().length == 0) {
++                    Content noCustomizationMsg = methodWriter.getNoCustomizationMsg(
++                            configuration.getText(
++                            "doclet.Serializable_no_customization"));
++                    classContentTree.addContent(methodWriter.getSerializableMethods(
++                    configuration.getText("doclet.Serialized_Form_methods"),
++                    noCustomizationMsg));
++                }
+             }
+         }
+     }
+ 
+     /**
+-     * Build the footer.
++     * Build the method sub header.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param methodsContentTree content tree to which the documentation will be added
+      */
+-    public void buildFooter(XMLNode node) {
+-        writer.writeFooter();
++    public void buildMethodSubHeader(XMLNode node, Content methodsContentTree)  {
++        methodWriter.addMemberHeader((MethodDoc)currentMember, methodsContentTree);
++    }
++
++    /**
++     * Build the deprecated method description.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param methodsContentTree content tree to which the documentation will be added
++     */
++    public void buildDeprecatedMethodInfo(XMLNode node, Content methodsContentTree) {
++        methodWriter.addDeprecatedMemberInfo((MethodDoc) currentMember, methodsContentTree);
++    }
++
++    /**
++     * Build the information for the method.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param methodsContentTree content tree to which the documentation will be added
++     */
++    public void buildMethodInfo(XMLNode node, Content methodsContentTree)  {
++        if(configuration.nocomment){
++            return;
++        }
++        buildChildren(node, methodsContentTree);
++    }
++
++    /**
++     * Build method description.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param methodsContentTree content tree to which the documentation will be added
++     */
++    public void buildMethodDescription(XMLNode node, Content methodsContentTree) {
++        methodWriter.addMemberDescription((MethodDoc) currentMember, methodsContentTree);
++    }
++
++    /**
++     * Build the method tags.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param methodsContentTree content tree to which the documentation will be added
++     */
++    public void buildMethodTags(XMLNode node, Content methodsContentTree) {
++        methodWriter.addMemberTags((MethodDoc) currentMember, methodsContentTree);
++        MethodDoc method = (MethodDoc)currentMember;
++        if (method.name().compareTo("writeExternal") == 0
++                && method.tags("serialData").length == 0) {
++            if (configuration.serialwarn) {
++                configuration.getDocletSpecificMsg().warning(
++                        currentMember.position(), "doclet.MissingSerialDataTag",
++                        method.containingClass().qualifiedName(), method.name());
++            }
++        }
++    }
++
++    /**
++     * Build the field header.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param classContentTree content tree to which the documentation will be added
++     */
++    public void buildFieldHeader(XMLNode node, Content classContentTree) {
++        if (currentClass.serializableFields().length > 0) {
++            buildFieldSerializationOverview(currentClass, classContentTree);
++        }
++    }
++
++    /**
++     * Build the serialization overview for the given class.
++     *
++     * @param classDoc the class to print the overview for.
++     * @param classContentTree content tree to which the documentation will be added
++     */
++    public void buildFieldSerializationOverview(ClassDoc classDoc, Content classContentTree) {
++        if (classDoc.definesSerializableFields()) {
++            FieldDoc serialPersistentField =
++                Util.asList(classDoc.serializableFields()).get(0);
++            // Check to see if there are inline comments, tags or deprecation
++            // information to be printed.
++            if (fieldWriter.shouldPrintOverview(serialPersistentField)) {
++                Content serializableFieldsTree = fieldWriter.getSerializableFieldsHeader();
++                Content fieldsOverviewContentTree = fieldWriter.getFieldsContentHeader(true);
++                fieldWriter.addMemberDeprecatedInfo(serialPersistentField,
++                        fieldsOverviewContentTree);
++                if (!configuration.nocomment) {
++                    fieldWriter.addMemberDescription(serialPersistentField,
++                            fieldsOverviewContentTree);
++                    fieldWriter.addMemberTags(serialPersistentField,
++                            fieldsOverviewContentTree);
++                }
++                serializableFieldsTree.addContent(fieldsOverviewContentTree);
++                classContentTree.addContent(fieldWriter.getSerializableFields(
++                        configuration.getText("doclet.Serialized_Form_class"),
++                        serializableFieldsTree));
++            }
++        }
++    }
++
++    /**
++     * Build the summaries for the fields that belong to the given class.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param classContentTree content tree to which the documentation will be added
++     */
++    public void buildSerializableFields(XMLNode node, Content classContentTree) {
++        MemberDoc[] members = currentClass.serializableFields();
++        int membersLength = members.length;
++        if (membersLength > 0) {
++            Content serializableFieldsTree = fieldWriter.getSerializableFieldsHeader();
++            for (int i = 0; i < membersLength; i++) {
++                currentMember = members[i];
++                if (!currentClass.definesSerializableFields()) {
++                    Content fieldsContentTree = fieldWriter.getFieldsContentHeader(
++                            (i == membersLength - 1));
++                    buildChildren(node, fieldsContentTree);
++                    serializableFieldsTree.addContent(fieldsContentTree);
++                }
++                else {
++                    buildSerialFieldTagsInfo(serializableFieldsTree);
++                }
++            }
++            classContentTree.addContent(fieldWriter.getSerializableFields(
++                    configuration.getText("doclet.Serialized_Form_fields"),
++                    serializableFieldsTree));
++        }
++    }
++
++    /**
++     * Build the field sub header.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param fieldsContentTree content tree to which the documentation will be added
++     */
++    public void buildFieldSubHeader(XMLNode node, Content fieldsContentTree) {
++        if (!currentClass.definesSerializableFields()) {
++            FieldDoc field = (FieldDoc) currentMember;
++            fieldWriter.addMemberHeader(field.type().asClassDoc(),
++                    field.type().typeName(), field.type().dimension(), field.name(),
++                    fieldsContentTree);
++        }
++    }
++
++    /**
++     * Build the field deprecation information.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param fieldsContentTree content tree to which the documentation will be added
++     */
++    public void buildFieldDeprecationInfo(XMLNode node, Content fieldsContentTree) {
++        if (!currentClass.definesSerializableFields()) {
++            FieldDoc field = (FieldDoc)currentMember;
++            fieldWriter.addMemberDeprecatedInfo(field, fieldsContentTree);
++        }
++    }
++
++    /**
++     * Build the serial field tags information.
++     *
++     * @param serializableFieldsTree content tree to which the documentation will be added
++     */
++    public void buildSerialFieldTagsInfo(Content serializableFieldsTree) {
++        if(configuration.nocomment){
++            return;
++        }
++        FieldDoc field = (FieldDoc)currentMember;
++        // Process Serializable Fields specified as array of
++        // ObjectStreamFields. Print a member for each serialField tag.
++        // (There should be one serialField tag per ObjectStreamField
++        // element.)
++        SerialFieldTag[] tags = field.serialFieldTags();
++        Arrays.sort(tags);
++        int tagsLength = tags.length;
++        for (int i = 0; i < tagsLength; i++) {
++            Content fieldsContentTree = fieldWriter.getFieldsContentHeader(
++                    (i == tagsLength - 1));
++            fieldWriter.addMemberHeader(tags[i].fieldTypeDoc(),
++                    tags[i].fieldType(), "", tags[i].fieldName(), fieldsContentTree);
++            fieldWriter.addMemberDescription(tags[i], fieldsContentTree);
++            serializableFieldsTree.addContent(fieldsContentTree);
++        }
++    }
++
++    /**
++     * Build the field information.
++     *
++     * @param node the XML element that specifies which components to document
++     * @param fieldsContentTree content tree to which the documentation will be added
++     */
++    public void buildFieldInfo(XMLNode node, Content fieldsContentTree) {
++        if(configuration.nocomment){
++            return;
++        }
++        FieldDoc field = (FieldDoc)currentMember;
++        ClassDoc cd = field.containingClass();
++        // Process default Serializable field.
++        if ((field.tags("serial").length == 0) && ! field.isSynthetic()
++                && configuration.serialwarn) {
++            configuration.message.warning(field.position(),
++                    "doclet.MissingSerialTag", cd.qualifiedName(),
++                    field.name());
++        }
++        fieldWriter.addMemberDescription(field, fieldsContentTree);
++        fieldWriter.addMemberTags(field, fieldsContentTree);
+     }
+ 
+     /**
+@@ -298,208 +585,4 @@
+         return false;
+     }
+ 
+-    /**
+-     * Build the method header.
+-     */
+-    public void buildMethodHeader(XMLNode node) {
+-        if (currentClass.serializationMethods().length > 0) {
+-            methodWriter.writeHeader(
+-                configuration.getText("doclet.Serialized_Form_methods"));
+-            if (currentClass.isSerializable() && !currentClass.isExternalizable()) {
+-                if (currentClass.serializationMethods().length == 0) {
+-                    methodWriter.writeNoCustomizationMsg(
+-                        configuration.getText(
+-                            "doclet.Serializable_no_customization"));
+-                }
+-            }
+-        }
+-    }
+-
+-    /**
+-     * Build the method sub header.
+-     */
+-    public void buildMethodSubHeader(XMLNode node)  {
+-        methodWriter.writeMemberHeader((MethodDoc) currentMember);
+-    }
+-
+-    /**
+-     * Build the deprecated method description.
+-     */
+-    public void buildDeprecatedMethodInfo(XMLNode node) {
+-        methodWriter.writeDeprecatedMemberInfo((MethodDoc) currentMember);
+-    }
+-
+-    /**
+-     * Build method tags.
+-     */
+-    public void buildMethodDescription(XMLNode node) {
+-        methodWriter.writeMemberDescription((MethodDoc) currentMember);
+-    }
+-
+-    /**
+-     * Build the method tags.
+-     */
+-    public void buildMethodTags(XMLNode node) {
+-        methodWriter.writeMemberTags((MethodDoc) currentMember);
+-        MethodDoc method = (MethodDoc)currentMember;
+-        if (method.name().compareTo("writeExternal") == 0
+-            && method.tags("serialData").length == 0) {
+-            if (configuration.serialwarn) {
+-                configuration.getDocletSpecificMsg().warning(
+-                    currentMember.position(), "doclet.MissingSerialDataTag",
+-                    method.containingClass().qualifiedName(), method.name());
+-            }
+-        }
+-    }
+-
+-    /**
+-     * build the information for the method.
+-     */
+-    public void buildMethodInfo(XMLNode node)  {
+-        if(configuration.nocomment){
+-            return;
+-        }
+-        buildChildren(node);
+-    }
+-
+-    /**
+-     * Build the method footer.
+-     */
+-    public void buildMethodFooter(XMLNode node) {
+-        methodWriter.writeMemberFooter();
+-    }
+-
+-    /**
+-     * Build the field header.
+-     */
+-    public void buildFieldHeader(XMLNode node) {
+-        if (currentClass.serializableFields().length > 0) {
+-            buildFieldSerializationOverview(currentClass);
+-            fieldWriter.writeHeader(configuration.getText(
+-                "doclet.Serialized_Form_fields"));
+-        }
+-    }
+-
+-    /**
+-     * If possible, build the serialization overview for the given
+-     * class.
+-     *
+-     * @param classDoc the class to print the overview for.
+-     */
+-    public void buildFieldSerializationOverview(ClassDoc classDoc) {
+-        if (classDoc.definesSerializableFields()) {
+-            FieldDoc serialPersistentField =
+-                (FieldDoc)((Util.asList(classDoc.serializableFields()).get(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.writeMemberDescription(serialPersistentField);
+-                    fieldWriter.writeMemberTags(serialPersistentField);
+-                }
+-                fieldWriter.writeMemberFooter(serialPersistentField);
+-                // Footer required to close the definition list tag
+-                // for serialization overview.
+-                fieldWriter.writeFooter(
+-                        configuration.getText("doclet.Serialized_Form_class"));
+-            }
+-        }
+-    }
+-
+-    /**
+-     * Build the field sub header.
+-     */
+-    public void buildFieldSubHeader(XMLNode node) {
+-        if (! currentClass.definesSerializableFields() ){
+-            FieldDoc field = (FieldDoc) currentMember;
+-            fieldWriter.writeMemberHeader(field.type().asClassDoc(),
+-                field.type().typeName(), field.type().dimension(), field.name());
+-        }
+-    }
+-
+-    /**
+-     * Build the field deprecation information.
+-     */
+-    public void buildFieldDeprecationInfo(XMLNode node) {
+-        if (!currentClass.definesSerializableFields()) {
+-            FieldDoc field = (FieldDoc)currentMember;
+-            fieldWriter.writeMemberDeprecatedInfo(field);
+-        }
+-    }
+-
+-    /**
+-     * Build the field information.
+-     */
+-    public void buildFieldInfo(XMLNode node) {
+-        if(configuration.nocomment){
+-            return;
+-        }
+-        FieldDoc field = (FieldDoc)currentMember;
+-        ClassDoc cd = field.containingClass();
+-        if (cd.definesSerializableFields()) {
+-            // Process Serializable Fields specified as array of
+-            // ObjectStreamFields. Print a member for each serialField tag.
+-            // (There should be one serialField tag per ObjectStreamField
+-            // element.)
+-            SerialFieldTag[] tags = field.serialFieldTags();
+-            Arrays.sort(tags);
+-            for (int i = 0; i < tags.length; i++) {
+-                fieldWriter.writeMemberHeader(tags[i].fieldTypeDoc(),
+-                        tags[i].fieldType(), "", tags[i].fieldName());
+-                fieldWriter.writeMemberDescription(tags[i]);
+-
+-            }
+-        } else {
+-
+-            // Process default Serializable field.
+-            if ((field.tags("serial").length == 0) && ! field.isSynthetic()
+-                && configuration.serialwarn) {
+-                configuration.message.warning(field.position(),
+-                        "doclet.MissingSerialTag", cd.qualifiedName(),
+-                        field.name());
+-            }
+-            fieldWriter.writeMemberDescription(field);
+-            fieldWriter.writeMemberTags(field);
+-        }
+-    }
+-
+-    /**
+-     * Build the field sub footer.
+-     */
+-    public void buildFieldSubFooter(XMLNode node) {
+-        if (! currentClass.definesSerializableFields()) {
+-            fieldWriter.writeMemberFooter();
+-        }
+-    }
+-
+-    /**
+-     * Build the summaries for the methods that belong to the given
+-     * class.
+-     */
+-    public void buildSerializableMethods(XMLNode node) {
+-        MemberDoc[] members = currentClass.serializationMethods();
+-        if (members.length > 0) {
+-            for (int i = 0; i < members.length; i++) {
+-                currentMember = members[i];
+-                buildChildren(node);
+-            }
+-        }
+-    }
+-
+-    /**
+-     * Build the summaries for the fields that belong to the given
+-     * class.
+-     */
+-    public void buildSerializableFields(XMLNode node) {
+-        MemberDoc[] members = currentClass.serializableFields();
+-        if (members.length > 0) {
+-            for (int i = 0; i < members.length; i++) {
+-                currentMember = members[i];
+-                buildChildren(node);
+-            }
+-        }
+-    }
+ }
+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
+@@ -29,177 +29,145 @@
+ <Doclet>
+ 
+     <PackageDoc>
+-        <PackageHeader/>
+-        <Summary>
+-            <SummaryHeader/>
+-            <InterfaceSummary/>
+-            <ClassSummary/>
+-            <EnumSummary/>
+-            <ExceptionSummary/>
+-            <ErrorSummary/>
+-            <AnnotationTypeSummary/>
+-            <SummaryFooter/>
+-        </Summary>
+-        <PackageDescription/>
+-        <PackageTags/>
+-        <PackageFooter/>
++        <Content>
++            <Summary>
++                <InterfaceSummary/>
++                <ClassSummary/>
++                <EnumSummary/>
++                <ExceptionSummary/>
++                <ErrorSummary/>
++                <AnnotationTypeSummary/>
++            </Summary>
++            <PackageDescription/>
++            <PackageTags/>
++        </Content>
+     </PackageDoc>
+     
+     <AnnotationTypeDoc>
+-        <AnnotationTypeHeader/>
+-        <DeprecationInfo/>
+-        <AnnotationTypeSignature/>
+-        <AnnotationTypeDescription/>
+-        <AnnotationTypeTagInfo/>
++        <AnnotationTypeInfo>
++            <DeprecationInfo/>
++            <AnnotationTypeSignature/>
++            <AnnotationTypeDescription/>
++            <AnnotationTypeTagInfo/>
++        </AnnotationTypeInfo>
+         <MemberSummary>
+-        	<AnnotationTypeRequiredMemberSummary/>
++            <AnnotationTypeRequiredMemberSummary/>
+             <AnnotationTypeOptionalMemberSummary/>
+         </MemberSummary>
+-        <AnnotationTypeRequiredMemberDetails>
+-            <Header/>
+-           <AnnotationTypeRequiredMember>
+-                <MemberHeader/>
+-                <Signature/>
+-                <DeprecationInfo/>
+-                <MemberComments/>
+-                <TagInfo/>
+-                <MemberFooter/>
+-            </AnnotationTypeRequiredMember>
+-        </AnnotationTypeRequiredMemberDetails>
+-        <AnnotationTypeOptionalMemberDetails>
+-            <AnnotationTypeOptionalMember>
+-                <MemberHeader/>
+-                <Signature/>
+-                <DeprecationInfo/>
+-                <MemberComments/>
+-                <TagInfo/>
+-                <DefaultValueInfo/>
+-                <MemberFooter/>
+-            </AnnotationTypeOptionalMember>
+-            <Footer/>
+-        </AnnotationTypeOptionalMemberDetails>        
+-        <AnnotationTypeFooter/>
++        <AnnotationTypeMemberDetails>
++            <AnnotationTypeRequiredMemberDetails>
++                <AnnotationTypeRequiredMember>
++                    <Signature/>
++                    <DeprecationInfo/>
++                    <MemberComments/>
++                    <TagInfo/>
++                </AnnotationTypeRequiredMember>
++            </AnnotationTypeRequiredMemberDetails>
++            <AnnotationTypeOptionalMemberDetails>
++                <AnnotationTypeOptionalMember>
++                    <Signature/>
++                    <DeprecationInfo/>
++                    <MemberComments/>
++                    <TagInfo/>
++                    <DefaultValueInfo/>
++                </AnnotationTypeOptionalMember>
++            </AnnotationTypeOptionalMemberDetails>
++        </AnnotationTypeMemberDetails>
+     </AnnotationTypeDoc>
+     
+     <ClassDoc>
+-        <ClassHeader/>
+         <ClassTree/>
+-        <TypeParamInfo/>
+-        <SuperInterfacesInfo/>
+-        <ImplementedInterfacesInfo/>        
+-        <SubClassInfo/>
+-        <SubInterfacesInfo/>
+-        <InterfaceUsageInfo/>
+-        <NestedClassInfo/>
+-        <DeprecationInfo/>
+-        <ClassSignature/>
+-        <ClassDescription/>
+-        <ClassTagInfo/>
++        <ClassInfo>
++            <TypeParamInfo/>
++            <SuperInterfacesInfo/>
++            <ImplementedInterfacesInfo/>
++            <SubClassInfo/>
++            <SubInterfacesInfo/>
++            <InterfaceUsageInfo/>
++            <NestedClassInfo/>
++            <DeprecationInfo/>
++            <ClassSignature/>
++            <ClassDescription/>
++            <ClassTagInfo/>
++        </ClassInfo>
+         <MemberSummary>
+             <NestedClassesSummary/>
+-            <NestedClassesInheritedSummary/>
+             <EnumConstantsSummary/>
+             <FieldsSummary/>
+-            <FieldsInheritedSummary/>  
+             <ConstructorsSummary/>
+             <MethodsSummary/>
+-            <MethodsInheritedSummary/>
+         </MemberSummary>
+-        <EnumConstantsDetails>
+-           <Header/>
+-            <EnumConstant>
+-                <EnumConstantHeader/>
+-                <Signature/>
+-                <DeprecationInfo/>
+-                <EnumConstantComments/>
+-                <TagInfo/>
+-                <EnumConstantFooter/>
+-            </EnumConstant>
+-            <Footer/>
+-        </EnumConstantsDetails>
+-        <FieldDetails>
+-            <Header/>
+-            <FieldDoc>
+-                <FieldHeader/>
+-                <Signature/>
+-                <DeprecationInfo/>
+-                <FieldComments/>
+-                <TagInfo/>
+-                <FieldFooter/>
+-            </FieldDoc>
+-            <Footer/>
+-        </FieldDetails>
+-        <ConstructorDetails>
+-            <Header/>
+-            <ConstructorDoc>
+-                <ConstructorHeader/>
+-                <Signature/>
+-                <DeprecationInfo/>
+-                <ConstructorComments/>
+-                <TagInfo/>
+-                <ConstructorFooter/>
+-            </ConstructorDoc>
+-            <Footer/>
+-        </ConstructorDetails>
+-        <MethodDetails>
+-            <Header/>
+-            <MethodDoc>
+-                <MethodHeader/>
+-                <Signature/>
+-                <DeprecationInfo/>
+-                <MethodComments/>
+-                <TagInfo/>
+-                <MethodFooter/>
+-            </MethodDoc>
+-            <Footer/>
+-        </MethodDetails>
+-        <ClassFooter/>
++        <MemberDetails>
++            <EnumConstantsDetails>
++                <EnumConstant>
++                    <Signature/>
++                    <DeprecationInfo/>
++                    <EnumConstantComments/>
++                    <TagInfo/>
++                </EnumConstant>
++            </EnumConstantsDetails>
++            <FieldDetails>
++                <FieldDoc>
++                    <Signature/>
++                    <DeprecationInfo/>
++                    <FieldComments/>
++                    <TagInfo/>
++                </FieldDoc>
++            </FieldDetails>
++            <ConstructorDetails>
++                <ConstructorDoc>
++                    <Signature/>
++                    <DeprecationInfo/>
++                    <ConstructorComments/>
++                    <TagInfo/>
++                </ConstructorDoc>
++            </ConstructorDetails>
++            <MethodDetails>
++                <MethodDoc>
++                    <Signature/>
++                    <DeprecationInfo/>
++                    <MethodComments/>
++                    <TagInfo/>
++                </MethodDoc>
++            </MethodDetails>
++        </MemberDetails>
+     </ClassDoc>
+     
+     <ConstantSummary>
+-        <Header/>
+         <Contents/>
+         <ConstantSummaries>
+-            <PackageConstantSummary>
+-                <PackageHeader/>
+-                <ClassConstantSummary>
+-                    <ClassHeader/>
+-                    <ConstantMembers/>
+-                    <ClassFooter/>
+-                </ClassConstantSummary>     
+-            </PackageConstantSummary>
++            <PackageHeader/>
++            <ClassConstantSummary>
++                <ConstantMembers/>
++            </ClassConstantSummary>
+         </ConstantSummaries>    
+         <Footer/>
+     </ConstantSummary>
+     
+     <SerializedForm>
+-        <Header/>
+         <SerializedFormSummaries>
+             <PackageSerializedForm>
+                 <PackageHeader/>
+                 <ClassSerializedForm>
+-                    <ClassHeader/>
+                     <SerialUIDInfo/>
+-                    <MethodHeader/>
+-                    <SerializableMethods>
+-                        <MethodSubHeader/>
+-                        <DeprecatedMethodInfo/>
+-                        <MethodInfo>
+-                            <MethodDescription/>
+-                            <MethodTags/>
+-                        </MethodInfo>
+-                        <MethodFooter/>
+-                    </SerializableMethods>
+-                    <FieldHeader/>
+-                    <SerializableFields>
+-                        <FieldSubHeader/>
+-                        <FieldDeprecationInfo/>
+-                        <FieldInfo/>
+-                        <FieldSubFooter/>
+-                    </SerializableFields>
++                    <ClassContent>
++                        <SerializableMethods>
++                            <MethodSubHeader/>
++                            <DeprecatedMethodInfo/>
++                            <MethodInfo>
++                                <MethodDescription/>
++                                <MethodTags/>
++                            </MethodInfo>
++                        </SerializableMethods>
++                        <FieldHeader/>
++                        <SerializableFields>
++                            <FieldSubHeader/>
++                            <FieldDeprecationInfo/>
++                            <FieldInfo/>
++                        </SerializableFields>
++                    </ClassContent>
+                 </ClassSerializedForm>
+             </PackageSerializedForm>
+         </SerializedFormSummaries>
+-        <Footer/>
+     </SerializedForm>
+ </Doclet>
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties
+@@ -111,12 +111,12 @@
+ doclet.extends=extends
+ doclet.Package_private=(package private)
+ doclet.implements=implementsdoclet.Same_package_name_used=Package name format used twice: {0}
+-doclet.Nested_Classes_Interfaces_Inherited_From_Class=Nested classes/interfaces inherited from class {0}
+-doclet.Nested_Classes_Interface_Inherited_From_Interface=Nested classes/interfaces inherited from interface {0}
+-doclet.Methods_Inherited_From_Class=Methods inherited from class {0}
+-doclet.Methods_Inherited_From_Interface=Methods inherited from interface {0}
+-doclet.Fields_Inherited_From_Class=Fields inherited from class {0}
+-doclet.Fields_Inherited_From_Interface=Fields inherited from interface {0}
++doclet.Nested_Classes_Interfaces_Inherited_From_Class=Nested classes/interfaces inherited from class
++doclet.Nested_Classes_Interface_Inherited_From_Interface=Nested classes/interfaces inherited from interface
++doclet.Methods_Inherited_From_Class=Methods inherited from class
++doclet.Methods_Inherited_From_Interface=Methods inherited from interface
++doclet.Fields_Inherited_From_Class=Fields inherited from class
++doclet.Fields_Inherited_From_Interface=Fields inherited from interface
+ doclet.Serializable=Serializable
+ doclet.Externalizable=Externalizable
+ doclet.Annotation_Type_Member_Detail=Element Detail
+@@ -136,12 +136,19 @@
+ doclet.Constants_Table_Summary={0} table, listing constant fields, and values
+ doclet.Member_Table_Summary={0} table, listing {1}, and an explanation
+ doclet.fields=fields
++doclet.Fields=Fields
+ doclet.constructors=constructors
++doclet.Constructors=Constructors
+ doclet.methods=methods
++doclet.Methods=Methods
+ doclet.annotation_type_optional_members=optional elements
++doclet.Annotation_Type_Optional_Members=Optional Elements
+ doclet.annotation_type_required_members=required elements
++doclet.Annotation_Type_Required_Members=Required Elements
+ doclet.enum_constants=enum constants
++doclet.Enum_Constants=Enum Constants
+ doclet.nested_classes=nested classes
++doclet.Nested_Classes=Nested Classes
+ doclet.subclasses=subclasses
+ doclet.subinterfaces=subinterfaces
+ doclet.Modifier=Modifier
+@@ -173,7 +180,7 @@
+ 
+ doclet.enum_valueof_doc=\n\
+  Returns the enum constant of this type with the specified name.\n\
+- The string must match <I>exactly</I> an identifier used to declare an\n\
++ The string must match <i>exactly</i> an identifier used to declare an\n\
+  enum constant in this type.  (Extraneous whitespace characters are \n\
+  not permitted.)\n\
+  \n\
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css
+new file mode 100644
+--- /dev/null
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css
+@@ -0,0 +1,439 @@
++/* Javadoc style sheet */
++/*
++Overall document style
++*/
++* {
++    margin:0;
++    padding:0;
++}
++body {
++    font-family:Helvetica, Arial, sans-serif;
++    color:#000000;
++}
++p {
++    margin:20px 0;
++}
++pre {
++    font-size:1.0em;
++}
++h1 {
++    font-size:1.4em;
++}
++h2 {
++    font-size:1.35em;
++}
++h3 {
++    font-size:1.3em;
++}
++h4 {
++    font-size:1.25em;
++}
++ul {
++    margin:10px 0 10px 20px;
++}
++li {
++    list-style:disc;
++}
++dl dt {
++    font-size:0.95em;
++    font-weight:bold;
++    margin:10px 0 0 0;
++}
++dl dd {
++    margin:10px 0 10px 20px;
++}
++dl dd ul {
++    margin-left:0;
++}
++dl dd ul li {
++    list-style:none;
++    margin:10px 0 10px 0;
++}
++caption {
++    background: #CCCCFF;
++    color:#000000;
++    text-align: left;
++    font-size: 150%;
++    font-weight: bold;
++    border-left: 2px ridge;
++    border-right: 2px ridge;
++    border-top: 2px ridge;
++    padding-left: 5px;
++    width:auto;
++}
++/*
++Document title and Copyright styles
++*/
++.aboutLanguage {
++    float:right;
++    font-size:0.9em;
++    color:#000000;
++}
++.legalCopy {
++    margin:7px;
++}
++.bar {
++    font-size:1em;
++    margin:10px 0 0 10px;
++}
++.bar a {
++    font-weight:normal;
++}
++/*
++Navigation bar styles
++*/
++.topNav {
++    border-top:2px solid #C0C0C0;
++    margin:7px;
++    padding:7px 0;
++    height:2.8em;
++    width:99%;
++    min-width:600px;
++}
++.bottomNav {
++    border-top:2px solid #C0C0C0;
++    margin:7px;
++    padding:7px 0;
++    height:2.8em;
++    width:99%;
++}
++.subNav {
++    border-bottom:2px solid #C0C0C0;
++    float:left;
++    width:99%;
++    margin:7px;
++    min-width:600px;
++}
++.subNav div {
++    clear:left;
++    float:left;
++    padding:0 0 5px 2px;
++    width:100%;
++}
++.topNav a:link,.topNav a:active, .topNav a:visited, .topNav a:hover,
++.bottomNav a:link,.bottomNav a:active, .bottomNav a:visited, .bottomNav a:hover {
++    color:#000000;
++    font-weight:bold;
++    text-decoration:underline;
++    font-size:1em;
++}
++/* Navigation bar list styles */
++.topNav ul.navList, .bottomNav ul.navList {
++    background-color:#EEEEFF;
++    padding:7px 5px;
++    margin:0;
++    float:left;
++    width:80%;
++}
++ul.navList li{
++    list-style:none;
++    float:left;
++    padding:3px 4px;
++    color:#000000;
++    font-size:0.98em;
++}
++ul.navList li.navBarCell1Rev {
++    background-color:#00008B;
++    color:#FFFFFF;
++    font-weight:bold;
++    font-size:0.97em;
++}
++/* Sub-navigation bar list styles */
++.subNav ul.navList {
++    float:left;
++    margin:0;
++    font-size:0.7em;
++    width:350px;
++}
++ul.subNavList {
++    float:left;
++    margin:0;
++    font-size:0.7em;
++    width:350px;
++}
++ul.subNavList li{
++    list-style:none;
++    float:left;
++    font-size:90%;
++}
++/*
++Page header and footer styles
++*/
++.header, .footer {
++    clear:both;
++    margin:0 7px;
++}
++.indexHeader {
++    font-size:0.9em;
++    margin:10px 0 7px 10px;
++}
++.header ul {
++    padding-left:20px;
++}
++/* Header and footer title styles */ 
++.header h1.title {
++    font-size:1.4em;
++    text-align:center;
++    margin:0;
++}
++.header h2.title {
++    font-size:1.35em;
++    margin:0;
++}
++.subTitle {
++    margin:0;
++    padding-top:10px;
++    font-size:0.75em;
++    font-weight:bold;
++}
++/*
++Page layout container styles
++*/
++.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer,
++.constantValuesContainer {
++    clear:both;
++    padding:10px 10px;
++    position:relative;
++}
++.indexContainer {
++    padding:0 0 10px 10px;
++    font-size:0.9em;
++}
++/*
++Class inheritance information styles
++*/
++ul.inheritance {
++    margin:0;
++    padding:0;
++}
++ul.inheritance li {
++    display:inline;
++    list-style:none;
++}
++ul.inheritance li ul.inheritance {
++    margin-left:15px;
++    background-image:url(resources/inherit.gif);
++    background-repeat:no-repeat;
++    padding-left:15px;
++    padding-top:1px;
++}
++/*
++Heading styles
++*/
++.indexContainer h2 {
++    font-weight:normal;
++    font-size:1.0em;
++    padding:10px 0 0 0;
++}
++.contentContainer h2 {
++    margin:10px 0;
++}
++.constantValuesContainer h2 {
++    background:#CCCCFF;
++    border:2px ridge;
++    padding:3px;
++    margin:0 0 10px 0;
++}
++.serializedFormContainer ul.blockList li.blockList h2 {
++    background:#EEEEFF;
++    border:2px ridge;
++    padding:3px;
++    margin:0 0 15px 0;
++    text-align:center;
++}
++.classUseContainer ul li ul li h3 {
++    margin-bottom:30px;
++    padding:3px;
++}
++.serializedFormContainer ul.blockList li.blockList ul.blockList li.blockList h3 {
++    background:#EEEEFF;
++    margin:0 0 15px 0;
++    padding:3px;
++}
++.serializedFormContainer ul.blockList li.blockList ul.blockList li.blockList ul.blockList li.blockList h3 {
++    background:#CCCCFF;
++    margin:0 0 15px 0;
++    padding:3px;
++    border:2px ridge;
++}
++ul.blockList ul.blockList li.blockList h3, ul.blockList ul.blockList li.blockList h3 {
++    background:#CCCCFF;
++    border:2px ridge;
++    padding-left:5px;
++}
++div.summary ul.blockList ul.blockList li.blockList h3 {
++    background:#CCCCFF;
++    border:0;
++    border:2px ridge;
++    padding-left:5px;
++}
++div.summary ul.blockList ul.blockList ul.blockList li.blockList h3 {
++    background:#EEEEFF;
++    border:0;
++    border-bottom:2px ridge;
++}
++div.details ul.blockList ul.blockList ul.blockList li.blockList h4,
++div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 {
++    font-size:1.15em;
++    font-weight:bold;
++    padding:0 0 10px 0;
++}
++/*
++Table styles
++*/
++.contentContainer table {
++    border-collapse: collapse ;
++    width:100%;
++}
++.contentContainer table td, .contentContainer table th {
++    border:2px ridge;
++    padding:3px;
++}
++/* Constant values page table styles */
++.constantValuesContainer table {
++    border-collapse: collapse ;
++    margin:0 0 10px 0;
++}
++.constantValuesContainer table caption{
++    font-size:0.95em;
++    padding:3px;
++    background:#EEEEFF;
++}
++.constantValuesContainer table td, .constantValuesContainer table th {
++    border:2px ridge;
++    padding:3px;
++}
++/* Class-use/Package-use page table styles */
++.classUseContainer table {
++    border-collapse: collapse ;
++    width:100%;
++    margin:0 0 15px 0;
++}
++.classUseContainer ul li ul li table {
++    margin-bottom:30px;
++}
++.classUseContainer ul li ul li table caption{
++    font-size:0.95em;
++    padding:3px;
++    background:#EEEEFF;
++}
++.classUseContainer table td, .classUseContainer table th {
++    border:2px ridge;
++    padding:3px;
++}
++/* Summary table styles */
++ul.blockList li.blockList table.overviewSummary {
++    margin:0;
++    margin-bottom:15px;
++}
++ul.blockList li.blockList table caption {
++    padding:3px;
++}
++ul.blockList li.blockList table.overviewSummary td.colFirst{
++    text-align:right;
++}
++table.packageSummary td.colFirst, table.overviewSummary th.colFirst {
++    width:15%;
++}
++div.summary ul.blockList ul.blockList li.blockList caption {
++    display:none;
++}
++div.summary ul.blockList li.blockList ul.blockList li.blockList table.overviewSummary th {
++    border-top:0;
++}
++/* Table column block styles */
++ul.blockList li.blockList table.overviewSummary td.colLast div.block{
++    padding:0;
++    padding-left:40px;
++}
++ul.blockList li.blockList table.overviewSummary td.colOne div.block{
++    padding:0;
++    padding-left:40px;
++}
++.contentContainer ul.blockList li.blockList table .colOne div.block{
++    padding-left:40px;
++}
++.classUseContainer ul li ul li table .colLast div.block,
++.classUseContainer ul li ul li table .colOne div.block{
++    padding-left:40px;
++}
++/*
++List styles
++*/
++ul.horizontal li {
++    display:inline;
++    font-size:0.9em;   
++}
++/* Container specific list styles */
++.indexContainer ul {
++    margin:0;
++}
++.indexContainer ul li {
++    list-style:none;
++}
++.serializedFormContainer ul.blockList li.blockList ul.blockList li.blockList ul.blockList li.blockList {
++    border:0;
++}
++.serializedFormContainer ul.blockList li.blockList ul.blockList li.blockList ul.blockList li.blockList ul.blockList li.blockList {
++    list-style:none;
++    border:0;
++    border-bottom:2px ridge;
++}
++.serializedFormContainer ul.blockList li.blockList ul.blockList li.blockList ul.blockList li.blockList ul.blockList li.blockListLast {
++    list-style:none;
++}
++/* General list styles */
++ul.blockList, ul.blockListLast {
++    margin-left:0;
++    padding-left:0;
++}
++ul.blockList li.blockList, ul.blockListLast li.blockList {
++    list-style:none;
++    margin-bottom:25px;
++}
++ul.blockList ul.blockList ul.blockList li.blockList {
++    border:2px ridge;
++}
++div.details ul.blockList ul.blockList ul.blockList li.blockList {
++    border:0;
++    border-bottom:2px ridge;
++}
++/* Definition list styles */
++ul.blockList li.blockList dl{
++    margin-bottom:15px;
++}
++ul.blockList li.blockList dl dd{
++    margin:0 0 0 30px;
++}
++ul.blockList li.blockList ul.blockList li.blockList ul.blockList li.blockList dl,
++ul.blockList li.blockList ul.blockList li.blockList ul.blockListLast li.blockList dl{
++    padding:0 0 10px 35px;
++}
++dl.nameValue dt, dl.nameValue dd{
++    display:inline;
++}
++ul.blockList li.blockList pre{
++    margin:0 0 15px 0;
++}
++/* List content styles */
++ul.blockList li.blockList ul.blockList li.blockList pre{
++    margin:10px 0 15px 0;
++}
++ul.blockList li.blockList ul.blockList li.blockList ul.blockList li.blockList pre,
++ul.blockList li.blockList ul.blockList li.blockList ul.blockListLast li.blockList pre{
++    padding:0 0 10px 0;
++}
++ul.blockList li.blockList ul.blockList li.blockList ul.blockList li.blockList div.block,
++ul.blockList li.blockList ul.blockList li.blockList ul.blockListLast li.blockList div.block{
++    padding:0 0 10px 35px;
++}
++/*
++Formatting effect styles
++*/
++.strong {
++    font-weight:bold;
++}
++.sourceLineNo {
++    color:green;
++    padding:0 30px 0 0;
++}
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DirectoryManager.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DirectoryManager.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DirectoryManager.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DirectoryManager.java
+@@ -46,7 +46,7 @@
+     /**
+      * The file separator string, "/", used in the formation of the URL path.
+      */
+-    public static final String URL_FILE_SEPERATOR = "/";
++    public static final String URL_FILE_SEPARATOR = "/";
+ 
+     /**
+      * Never instaniated.
+@@ -123,13 +123,13 @@
+         for (int i = 0; i < packageName.length(); i++) {
+             char ch = packageName.charAt(i);
+             if (ch == '.') {
+-                pathstr.append(URL_FILE_SEPERATOR);
++                pathstr.append(URL_FILE_SEPARATOR);
+             } else {
+                 pathstr.append(ch);
+             }
+         }
+-        if (pathstr.length() > 0 && ! pathstr.toString().endsWith(URL_FILE_SEPERATOR)) {
+-            pathstr.append(URL_FILE_SEPERATOR);
++        if (pathstr.length() > 0 && ! pathstr.toString().endsWith(URL_FILE_SEPARATOR)) {
++            pathstr.append(URL_FILE_SEPARATOR);
+         }
+         return pathstr.toString();
+     }
+@@ -155,7 +155,7 @@
+         for (int i = 0; i < name.length(); i++) {
+             char ch = name.charAt(i);
+             if (ch == '.') {
+-                pathstr.append(URL_FILE_SEPERATOR);
++                pathstr.append(URL_FILE_SEPARATOR);
+             } else {
+                 pathstr.append(ch);
+             }
+@@ -184,7 +184,7 @@
+         StringBuffer pathstr = new StringBuffer();
+         pathstr.append(getRelativePath(from));
+         pathstr.append(getPath(to));
+-        pathstr.append(URL_FILE_SEPERATOR);
++        pathstr.append(URL_FILE_SEPARATOR);
+         return pathstr.toString();
+     }
+ 
+@@ -226,10 +226,10 @@
+         for (int i = 0; i < from.length(); i++) {
+             char ch = from.charAt(i);
+             if (ch == '.') {
+-                pathstr.append(".." + URL_FILE_SEPERATOR);
++                pathstr.append(".." + URL_FILE_SEPARATOR);
+             }
+         }
+-        pathstr.append(".." + URL_FILE_SEPERATOR);
++        pathstr.append(".." + URL_FILE_SEPARATOR);
+         return pathstr.toString();
+     }
+ 
+@@ -297,7 +297,7 @@
+         String pathstr = createPathString(pd);
+         if (pathstr.length() > 0) {
+             buf.append(pathstr);
+-            buf.append(URL_FILE_SEPERATOR);
++            buf.append(URL_FILE_SEPARATOR);
+         }
+         buf.append(filename);
+         return buf.toString();
+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
+@@ -51,6 +51,11 @@
+     {{"&", "&"}, {"<", "<"}, {">", ">"}};
+ 
+     /**
++     * Name of the resource directory.
++     */
++    public static final String RESOURCESDIR = "resources";
++
++    /**
+      * Return array of class members whose documentation is to be generated.
+      * If the member is deprecated do not include such a member in the
+      * returned array.
+@@ -236,8 +241,8 @@
+         String destname = configuration.docFileDestDirName;
+         File srcdir = new File(path + dir);
+         if (destname.length() > 0 && !destname.endsWith(
+-               DirectoryManager.URL_FILE_SEPERATOR)) {
+-            destname += DirectoryManager.URL_FILE_SEPERATOR;
++               DirectoryManager.URL_FILE_SEPARATOR)) {
++            destname += DirectoryManager.URL_FILE_SEPARATOR;
+         }
+         String dest = destname + dir;
+         try {
+@@ -263,7 +268,7 @@
+                         && ! configuration.shouldExcludeDocFileDir(
+                           srcfile.getName())){
+                         copyDocFiles(configuration, path, dir +
+-                                    DirectoryManager.URL_FILE_SEPERATOR + srcfile.getName(),
++                                    DirectoryManager.URL_FILE_SEPARATOR + srcfile.getName(),
+                                 overwrite);
+                     }
+                 }
+@@ -322,25 +327,38 @@
+      *                       it already exists.
+      */
+     public static void copyResourceFile(Configuration configuration,
+-            String resourcefile,
+-            boolean overwrite) {
+-        String destdir = configuration.destDirName;
+-        String destresourcesdir = destdir + "resources";
+-        DirectoryManager.createDirectory(configuration, destresourcesdir);
+-        File destfile = new File(destresourcesdir, resourcefile);
++            String resourcefile, boolean overwrite) {
++        String destresourcesdir = configuration.destDirName + RESOURCESDIR;
++        copyFile(configuration, resourcefile, RESOURCESDIR, destresourcesdir,
++                overwrite);
++    }
++
++    /**
++     * Copy a file from a source directory to a destination directory
++     * (if it is not there already). If <code>overwrite</code> is true and
++     * the destination file already exists, overwrite it.
++     *
++     * @param configuration Holds the error message
++     * @param file The name of the file to copy
++     * @param source The source directory
++     * @param destination The destination directory where the file needs to be copied
++     * @param overwrite A flag to indicate whether the file in the
++     *                  destination directory will be overwritten if
++     *                  it already exists.
++     */
++    public static void copyFile(Configuration configuration, String file, String source,
++            String destination, boolean overwrite) {
++        DirectoryManager.createDirectory(configuration, destination);
++        File destfile = new File(destination, file);
+         if(destfile.exists() && (! overwrite)) return;
+         try {
+-
+             InputStream in = Configuration.class.getResourceAsStream(
+-                "resources/" + resourcefile);
+-
++                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) {}
+@@ -357,12 +375,12 @@
+         try{
+             String pkgPath = DirectoryManager.getDirectoryPath(pkgDoc);
+             String completePath = new SourcePath(configuration.sourcepath).
+-                getDirectory(pkgPath) + DirectoryManager.URL_FILE_SEPERATOR;
++                getDirectory(pkgPath) + DirectoryManager.URL_FILE_SEPARATOR;
+             //Make sure that both paths are using the same seperators.
+             completePath = Util.replaceText(completePath, File.separator,
+-                    DirectoryManager.URL_FILE_SEPERATOR);
++                    DirectoryManager.URL_FILE_SEPARATOR);
+             pkgPath = Util.replaceText(pkgPath, File.separator,
+-                    DirectoryManager.URL_FILE_SEPERATOR);
++                    DirectoryManager.URL_FILE_SEPARATOR);
+             return completePath.substring(0, completePath.indexOf(pkgPath));
+         } catch (Exception e){
+             return "";
+@@ -572,6 +590,24 @@
+     }
+ 
+     /**
++     * Given a string, strips all html characters and
++     * return the result.
++     *
++     * @param rawString The string to check.
++     * @return the original string with all of the HTML characters
++     * stripped.
++     *
++     */
++    public static String stripHtml(String rawString) {
++        // remove HTML tags
++        rawString = rawString.replaceAll("\\<.*?>", " ");
++        // consolidate multiple spaces between a word to a single space
++        rawString = rawString.replaceAll("\\b\\s{2,}\\b", " ");
++        // remove extra whitespaces
++        return rawString.trim();
++    }
++
++    /**
+      * Create the directory path for the file to be generated, construct
+      * FileOutputStream and OutputStreamWriter depending upon docencoding.
+      *
+diff --git a/test/com/sun/javadoc/AccessAsciiArt/AccessAsciiArt.java b/test/com/sun/javadoc/AccessAsciiArt/AccessAsciiArt.java
+--- langtools/test/com/sun/javadoc/AccessAsciiArt/AccessAsciiArt.java
++++ langtools/test/com/sun/javadoc/AccessAsciiArt/AccessAsciiArt.java
+@@ -84,17 +84,17 @@
+ 
+             // Test the top line of the class tree
+             {
+-"  <IMG SRC=\"../../resources/inherit.gif\" ALT=\"extended by \"><A HREF=\"../../p1/C.html\" title=\"class in p1\">p1.C</A>",
++"<li><a href=\"../../p1/C.html\" title=\"class in p1\">p1.C</a></li>",
+                      TMPDEST_DIR1 + "p1" + FS + "subpkg" + FS + "SSC.html" },
+ 
+             // Test the second line of the class tree
+             {
+-"      <IMG SRC=\"../../resources/inherit.gif\" ALT=\"extended by \"><A HREF=\"../../p1/SC.html\" title=\"class in p1\">p1.SC</A>",
++"<li><a href=\"../../p1/SC.html\" title=\"class in p1\">p1.SC</a></li>",
+                      TMPDEST_DIR1 + "p1" + FS + "subpkg" + FS + "SSC.html" },
+ 
+             // Test the third line of the class tree
+             {
+-"          <IMG SRC=\"../../resources/inherit.gif\" ALT=\"extended by \"><STRONG>p1.subpkg.SSC</STRONG>",
++"<li>p1.subpkg.SSC</li>",
+                      TMPDEST_DIR1 + "p1" + FS + "subpkg" + FS +"SSC.html" },
+ 
+         };
+diff --git a/test/com/sun/javadoc/AccessH1/AccessH1.java b/test/com/sun/javadoc/AccessH1/AccessH1.java
+--- langtools/test/com/sun/javadoc/AccessH1/AccessH1.java
++++ langtools/test/com/sun/javadoc/AccessH1/AccessH1.java
+@@ -83,18 +83,19 @@
+      * NOTE: The standard doclet uses the same separator "\n" for all OS's
+      */
+     private static final String[][] testArray = {
+-
+-            // Test the style sheet
+-            {
+-               "h1 { font-size: 145% }",
+-                     TMPDEST_DIR1 + "stylesheet.css"              },
+-
+-            // Test the doc title in the overview page
+-            {
+-               "<H1>" + LS + "Document Title" + LS + "</H1>",
+-                          TMPDEST_DIR1 + "overview-summary.html"  }
+-
+-        };
++        // Test the style sheet
++        {
++            ".header h1.title {" + LS + "    font-size:1.4em;" + LS +
++            "    text-align:center;" + LS + "    margin:0;" + LS +
++            "}",
++            TMPDEST_DIR1 + "stylesheet.css"
++        },
++        // Test the doc title in the overview page
++        {
++            "<h1 class=\"title\">Document Title</h1>",
++            TMPDEST_DIR1 + "overview-summary.html"
++        }
++    };
+ 
+     public static void runTestsOnHTML(String[][] testArray) {
+ 
+diff --git a/test/com/sun/javadoc/AccessSkipNav/AccessSkipNav.java b/test/com/sun/javadoc/AccessSkipNav/AccessSkipNav.java
+--- langtools/test/com/sun/javadoc/AccessSkipNav/AccessSkipNav.java
++++ langtools/test/com/sun/javadoc/AccessSkipNav/AccessSkipNav.java
+@@ -46,6 +46,7 @@
+     private static final String BUGNAME = "AccessSkipNav";
+     private static final String FS = System.getProperty("file.separator");
+     private static final String PS = System.getProperty("path.separator");
++    private static final String LS = System.getProperty("line.separator");
+     private static final String TMPDEST_DIR1 = "." + FS + "docs1" + FS;
+     private static final String TMPDEST_DIR2 = "." + FS + "docs2" + FS;
+ 
+@@ -84,20 +85,22 @@
+ 
+             // Testing only for the presence of the <a href> and <a name>
+ 
+-            // Top navbar <A HREF>
+-            { "<A HREF=\"#skip-navbar_top\" title=\"Skip navigation links\"></A>",
++            // Top navbar <a href>
++            { "<a href=\"#skip-navbar_top\" title=\"Skip navigation links\"></a>",
+                      TMPDEST_DIR1 + "p1" + FS + "C1.html" },
+ 
+-            // Top navbar <A NAME>
+-            { "<A NAME=\"skip-navbar_top\"></A>",
++            // Top navbar <a name>
++            { "<a name=\"skip-navbar_top\">" + LS +
++                      "<!--   -->" + LS + "</a>",
+                      TMPDEST_DIR1 + "p1" + FS + "C1.html" },
+ 
+-            // Bottom navbar <A HREF>
+-            { "<A HREF=\"#skip-navbar_bottom\" title=\"Skip navigation links\"></A>",
++            // Bottom navbar <a href>
++            { "<a href=\"#skip-navbar_bottom\" title=\"Skip navigation links\"></a>",
+                      TMPDEST_DIR1 + "p1" + FS + "C1.html" },
+ 
+-            // Bottom navbar <A NAME>
+-            { "<A NAME=\"skip-navbar_bottom\"></A>",
++            // Bottom navbar <a name>
++            { "<a name=\"skip-navbar_bottom\">" + LS +
++                      "<!--   -->" + LS + "</a>",
+                      TMPDEST_DIR1 + "p1" + FS + "C1.html" }
+         };
+ 
+diff --git a/test/com/sun/javadoc/AccessSummary/AccessSummary.java b/test/com/sun/javadoc/AccessSummary/AccessSummary.java
+--- langtools/test/com/sun/javadoc/AccessSummary/AccessSummary.java
++++ langtools/test/com/sun/javadoc/AccessSummary/AccessSummary.java
+@@ -24,7 +24,7 @@
+ /*
+  * @test   @(#)AccessSummary.java
+  * @bug      4637604 4775148
+- * @summary  Test the tables for summary=""
++ * @summary  Test the tables for summary attribute
+  * @author   dkramer
+  * @library  ../lib/
+  * @build    JavadocTester
+@@ -44,15 +44,15 @@
+ 
+         // Test that the summary attribute appears
+         { OUTPUT_DIR1 + "overview-summary.html",
+-                 "SUMMARY=\"\"" },
++                 "summary=\"Packages table, listing packages, and an explanation\"" },
+ 
+         // Test that the summary attribute appears
+         { OUTPUT_DIR1 + "p1" + FS + "C1.html",
+-                 "SUMMARY=\"\"" },
++                 "summary=\"Constructor Summary table, listing constructors, and an explanation\"" },
+ 
+         // Test that the summary attribute appears
+         { OUTPUT_DIR1 + "constant-values.html",
+-                 "SUMMARY=\"\"" }
++                 "summary=\"Constant Field Values table, listing constant fields, and values\"" }
+     };
+ 
+     // First test with -header only
+diff --git a/test/com/sun/javadoc/AuthorDD/AuthorDD.java b/test/com/sun/javadoc/AuthorDD/AuthorDD.java
+--- langtools/test/com/sun/javadoc/AuthorDD/AuthorDD.java
++++ langtools/test/com/sun/javadoc/AuthorDD/AuthorDD.java
+@@ -86,12 +86,12 @@
+ 
+              // Test single @since tag:
+ 
+-            { "<DT><STRONG>Since:</STRONG></DT>"+NL+"  <DD>JDK 1.0</DD>",
++            { "<dt><span class=\"strong\">Since:</span></dt>"+NL+"  <dd>JDK 1.0</dd>",
+                                   BUGID + FS + "p1" + FS + "C1.html" },
+ 
+             // Test multiple @author tags:
+ 
+-            { "<DT><STRONG>Author:</STRONG></DT>"+NL+"  <DD>Doug Kramer, Jamie, Neal</DD>",
++            { "<dt><span class=\"strong\">Author:</span></dt>"+NL+"  <dd>Doug Kramer, Jamie, Neal</dd>",
+                                   BUGID + FS + "p1" + FS + "C1.html" },
+ 
+         };
+diff --git a/test/com/sun/javadoc/JavascriptWinTitle/JavascriptWinTitle.java b/test/com/sun/javadoc/JavascriptWinTitle/JavascriptWinTitle.java
+--- langtools/test/com/sun/javadoc/JavascriptWinTitle/JavascriptWinTitle.java
++++ langtools/test/com/sun/javadoc/JavascriptWinTitle/JavascriptWinTitle.java
+@@ -90,44 +90,34 @@
+     private static final String[][] testArray = {
+ 
+             // Test the javascript "type" attribute is present:
+-            {  "<SCRIPT type=\"text/javascript\">",
++            {  "<script type=\"text/javascript\">",
++                     TMPDEST_DIR1 + "overview-summary.html"  },
++
++            // Test onload is absent:
++            {  "<body>",
+                      TMPDEST_DIR1 + "overview-summary.html"  },
+ 
+             // Test onload is present:
+-            {  "onload=\"windowTitle();\"",
+-                     TMPDEST_DIR1 + "overview-summary.html"  },
+-
+-            // Test onload is present:
+-            {  "onload=\"windowTitle();\"",
++            {  "<body>",
+                      TMPDEST_DIR1 + FS + "p1" + FS + "package-summary.html"  },
+ 
+-            // Test onload is present:
+-            {  "onload=\"windowTitle();\"",
+-                     TMPDEST_DIR1 + FS + "p1" + FS + "C.html"  },
+-
+             // Test that "onload" is not present in BODY tag:
+-            {   "<BODY BGCOLOR=\"white\">",
++            {   "<body>",
+                      TMPDEST_DIR1 + "overview-frame.html"  },
+ 
+             // Test that "onload" is not present in BODY tag:
+-            {   "<BODY BGCOLOR=\"white\">",
++            {   "<body>",
+                      TMPDEST_DIR1 + "allclasses-frame.html"  },
+ 
+             // Test that "onload" is not present in BODY tag:
+-            {   "<BODY BGCOLOR=\"white\">",
++            {   "<body>",
+                      TMPDEST_DIR1 + FS + "p1" + FS + "package-frame.html"  },
+ 
+             // Test that win title javascript is followed by NOSCRIPT code.
+-            {"<SCRIPT type=\"text/javascript\">" + LS +
+-                    "function windowTitle()" + LS +
+-                    "{" + LS +
+-                    "    if (location.href.indexOf('is-external=true') == -1) {" + LS +
+-                    "        parent.document.title=\"C (Window Title)\";" + LS +
+-                    "    }" + LS +
+-                    "}" + LS +
+-             "</SCRIPT>" + LS +
+-             "<NOSCRIPT>" + LS +
+-             "</NOSCRIPT>",
++            {"<script type=\"text/javascript\"><!--" + LS +
++                     "    if (location.href.indexOf('is-external=true') == -1) {" + LS +
++                     "        parent.document.title=\"C (Window Title)\";" + LS +
++                     "    }" + LS + "//-->" + LS + "</script>",
+              TMPDEST_DIR1 + FS + "p1" + FS + "C.html"
+             }
+ 
+diff --git a/test/com/sun/javadoc/MetaTag/MetaTag.java b/test/com/sun/javadoc/MetaTag/MetaTag.java
+--- langtools/test/com/sun/javadoc/MetaTag/MetaTag.java
++++ langtools/test/com/sun/javadoc/MetaTag/MetaTag.java
+@@ -67,31 +67,31 @@
+     private static final String[][] TEST = {
+ 
+         { OUTPUT_DIR + FS + "p1" + FS + "C1.html",
+-           "<META NAME=\"keywords\" CONTENT=\"p1.C1 class\">" },
++           "<meta name=\"keywords\" content=\"p1.C1 class\">" },
+ 
+         { OUTPUT_DIR + FS + "p1" + FS + "C1.html",
+-           "<META NAME=\"keywords\" CONTENT=\"field1\">" },
++           "<meta name=\"keywords\" content=\"field1\">" },
+ 
+         { OUTPUT_DIR + FS + "p1" + FS + "C1.html",
+-           "<META NAME=\"keywords\" CONTENT=\"field2\">" },
++           "<meta name=\"keywords\" content=\"field2\">" },
+ 
+         { OUTPUT_DIR + FS + "p1" + FS + "C1.html",
+-           "<META NAME=\"keywords\" CONTENT=\"method1()\">" },
++           "<meta name=\"keywords\" content=\"method1()\">" },
+ 
+         { OUTPUT_DIR + FS + "p1" + FS + "C1.html",
+-           "<META NAME=\"keywords\" CONTENT=\"method2()\">" },
++           "<meta name=\"keywords\" content=\"method2()\">" },
+ 
+         { OUTPUT_DIR + FS + "p1" + FS + "package-summary.html",
+-           "<META NAME=\"keywords\" CONTENT=\"p1 package\">" },
++           "<meta name=\"keywords\" content=\"p1 package\">" },
+ 
+         { OUTPUT_DIR + FS + "overview-summary.html",
+-           "<META NAME=\"keywords\" CONTENT=\"Overview, Sample Packages\">" },
++           "<meta name=\"keywords\" content=\"Overview, Sample Packages\">" },
+ 
+         //NOTE: Hopefully, this regression test is not run at midnight.  If the output
+         //was generated yesterday and this test is run today, the test will fail.
+         {OUTPUT_DIR + FS + "overview-summary.html",
+-           "<META NAME=\"date\" "
+-                            + "CONTENT=\"" + m_dateFormat.format(new Date()) + "\">"},
++           "<meta name=\"date\" "
++                            + "content=\"" + m_dateFormat.format(new Date()) + "\">"},
+     };
+ 
+     private static final String[][] NEGATED_TEST = NO_TEST;
+diff --git a/test/com/sun/javadoc/ValidHtml/ValidHtml.java b/test/com/sun/javadoc/ValidHtml/ValidHtml.java
+--- langtools/test/com/sun/javadoc/ValidHtml/ValidHtml.java
++++ langtools/test/com/sun/javadoc/ValidHtml/ValidHtml.java
+@@ -33,12 +33,10 @@
+  * @run main ValidHtml
+  */
+ 
+-
+ import com.sun.javadoc.*;
+ import java.util.*;
+ import java.io.*;
+ 
+-
+ /**
+  * Runs javadoc and runs regression tests on the resulting HTML.
+  * It reads each file, complete with newlines, into a string to easily
+@@ -66,13 +64,14 @@
+         String srcdir = System.getProperty("test.src", ".");
+ 
+         // Test for all cases except the split index page
+-        runJavadoc(new String[] {"-d", TMPDEST_DIR1,
+-                                 "-doctitle", "Document Title",
+-                                 "-windowtitle", "Window Title",
+-                                 "-use",
+-                                 "-overview", (srcdir + FS + "overview.html"),
+-                                 "-sourcepath", srcdir,
+-                                 "p1", "p2"});
++        runJavadoc(new String[]{"-d", TMPDEST_DIR1,
++                    "-doctitle", "Document Title",
++                    "-windowtitle", "Window Title",
++                    "-use",
++                    "-overview", (srcdir + FS + "overview.html"),
++                    "-sourcepath", srcdir,
++                    "p1", "p2"
++                });
+         runTestsOnHTML(testArray);
+ 
+         printSummary();
+@@ -90,53 +89,52 @@
+      * NOTE: The standard doclet uses the same separator "\n" for all OS's
+      */
+     private static final String[][] testArray = {
+-
+-            // Test the proper DOCTYPE element is present:
+-            {
+-"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">",
+-                     TMPDEST_DIR1 + "index.html"  },
+-
+-            // Test the proper DOCTYPE element is present:
+-            {
+-"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
+-                     TMPDEST_DIR1 + "overview-summary.html"  },
+-
+-            // Test the proper DOCTYPE element is present:
+-            {
+-"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
+-                     TMPDEST_DIR1 + "p1" + FS + "package-summary.html"  },
+-
+-            // Test the proper DOCTYPE element is present:
+-            {
+-"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
+-                     TMPDEST_DIR1 + "p1" + FS + "C.html"  },
+-
+-            // Test the proper DOCTYPE element is present:
+-            {
+-"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
+-                     TMPDEST_DIR1 + "overview-frame.html"  },
+-
+-            // Test the proper DOCTYPE element is present:
+-            {
+-"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
+-                     TMPDEST_DIR1 + "allclasses-frame.html"  },
+-
+-            // Test the proper DOCTYPE element is present:
+-            {
+-"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
+-                     TMPDEST_DIR1 + "p1" + FS + "package-frame.html"  },
+-
+-            // Test that <NOFRAMES> is inside <FRAMESET> element:
+-            {
+-"</NOFRAMES>" + LS + "</FRAMESET>",
+-                     TMPDEST_DIR1 + "index.html"  },
+-
+-            // Test the table elements are in the correct order:
+-            {
+-"</FONT></TD>" + LS + "</TR>",
+-                     TMPDEST_DIR1 + FS + "p1" + FS + "package-use.html"  }
+-
+-        };
++        // Test the proper DOCTYPE element is present:
++        {
++            "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">",
++            TMPDEST_DIR1 + "index.html"
++        },
++        // Test the proper DOCTYPE element is present:
++        {
++            "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
++            TMPDEST_DIR1 + "overview-summary.html"
++        },
++        // Test the proper DOCTYPE element is present:
++        {
++            "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
++            TMPDEST_DIR1 + "p1" + FS + "package-summary.html"
++        },
++        // Test the proper DOCTYPE element is present:
++        {
++            "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
++            TMPDEST_DIR1 + "p1" + FS + "C.html"
++        },
++        // Test the proper DOCTYPE element is present:
++        {
++            "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
++            TMPDEST_DIR1 + "overview-frame.html"
++        },
++        // Test the proper DOCTYPE element is present:
++        {
++            "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
++            TMPDEST_DIR1 + "allclasses-frame.html"
++        },
++        // Test the proper DOCTYPE element is present:
++        {
++            "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
++            TMPDEST_DIR1 + "p1" + FS + "package-frame.html"
++        },
++        // Test that <NOFRAMES> is inside <FRAMESET> element:
++        {
++            "</noframes>" + LS + "</frameset>",
++            TMPDEST_DIR1 + "index.html"
++        },
++        // Test the table elements are in the correct order:
++        {
++            "</td>" + LS + "</tr>",
++            TMPDEST_DIR1 + FS + "p1" + FS + "package-use.html"
++        }
++    };
+ 
+     public static void runTestsOnHTML(String[][] testArray) {
+ 
+@@ -152,10 +150,7 @@
+ 
+             // Find string in file's contents
+             if (findString(fileString, stringToFind) == -1) {
+-                System.out.println("\nSub-test " + (subtestNum)
+-                    + " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n"
+-                    + "when searching for:\n"
+-                    + stringToFind);
++                System.out.println("\nSub-test " + (subtestNum) + " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n" + "when searching for:\n" + stringToFind);
+             } else {
+                 numSubtestsPassed += 1;
+                 System.out.println("\nSub-test " + (subtestNum) + " passed:\n" + stringToFind);
+@@ -164,11 +159,10 @@
+     }
+ 
+     public static void printSummary() {
+-        if ( numSubtestsPassed == subtestNum ) {
++        if (numSubtestsPassed == subtestNum) {
+             System.out.println("\nAll " + numSubtestsPassed + " subtests passed");
+         } else {
+-            throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum)
+-                             + " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
++            throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum) + " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
+         }
+     }
+ 
+@@ -176,16 +170,16 @@
+     public static String readFileToString(String filename) {
+         try {
+             File file = new File(filename);
+-            if ( !file.exists() ) {
++            if (!file.exists()) {
+                 System.out.println("\nFILE DOES NOT EXIST: " + filename);
+             }
+             BufferedReader in = new BufferedReader(new FileReader(file));
+ 
+             // Create an array of characters the size of the file
+-            char[] allChars = new char[(int)file.length()];
++            char[] allChars = new char[(int) file.length()];
+ 
+             // Read the characters into the allChars array
+-            in.read(allChars, 0, (int)file.length());
++            in.read(allChars, 0, (int) file.length());
+             in.close();
+ 
+             // Convert to a string
+diff --git a/test/com/sun/javadoc/VersionNumber/VersionNumber.java b/test/com/sun/javadoc/VersionNumber/VersionNumber.java
+--- langtools/test/com/sun/javadoc/VersionNumber/VersionNumber.java
++++ langtools/test/com/sun/javadoc/VersionNumber/VersionNumber.java
+@@ -84,7 +84,7 @@
+ 
+             // Test the proper DOCTYPE element is present:
+             {
+-                 "<!-- Generated by javadoc (build",
++                 "<!-- Generated by javadoc (version",
+                      TMPDEST_DIR1 + "p1" + FS + "C.html"  },
+ 
+         };
+diff --git a/test/com/sun/javadoc/WindowTitles/WindowTitles.java b/test/com/sun/javadoc/WindowTitles/WindowTitles.java
+--- langtools/test/com/sun/javadoc/WindowTitles/WindowTitles.java
++++ langtools/test/com/sun/javadoc/WindowTitles/WindowTitles.java
+@@ -94,52 +94,52 @@
+      */
+     private static final String[][] testArray = {
+ 
+-            { "<TITLE>" + LS + "Overview" + LS + "</TITLE>",
++            { "<title>Overview</title>",
+                     TMPDIR_STRING1 + "overview-summary.html"                  },
+ 
+-            { "<TITLE>" + LS + "Class Hierarchy" + LS + "</TITLE>",
++            { "<title>Class Hierarchy</title>",
+                     TMPDIR_STRING1 + "overview-tree.html"                     },
+ 
+-            { "<TITLE>" + LS + "Overview List" + LS + "</TITLE>",
++            { "<title>Overview List</title>",
+                     TMPDIR_STRING1 + "overview-frame.html"                    },
+ 
+-            { "<TITLE>" + LS + "p1" + LS + "</TITLE>",
++            { "<title>p1</title>",
+                     TMPDIR_STRING1 + "p1" + FS + "package-summary.html"       },
+ 
+-            { "<TITLE>" + LS + "p1" + LS + "</TITLE>",
++            { "<title>p1</title>",
+                     TMPDIR_STRING1 + "p1" + FS + "package-frame.html"         },
+ 
+-            { "<TITLE>" + LS + "p1 Class Hierarchy" + LS + "</TITLE>",
++            { "<title>p1 Class Hierarchy</title>",
+                     TMPDIR_STRING1 + "p1" + FS + "package-tree.html"          },
+ 
+-            { "<TITLE>" + LS + "Uses of Package p1" + LS + "</TITLE>",
++            { "<title>Uses of Package p1</title>",
+                     TMPDIR_STRING1 + "p1" + FS + "package-use.html"           },
+ 
+-            { "<TITLE>" + LS + "C1" + LS + "</TITLE>",
++            { "<title>C1</title>",
+                     TMPDIR_STRING1 + "p1" + FS + "C1.html"                    },
+ 
+-            { "<TITLE>" + LS + "All Classes" + LS + "</TITLE>",
++            { "<title>All Classes</title>",
+                     TMPDIR_STRING1 + "allclasses-frame.html"                  },
+ 
+-            { "<TITLE>" + LS + "All Classes" + LS + "</TITLE>",
++            { "<title>All Classes</title>",
+                     TMPDIR_STRING1 + "allclasses-noframe.html"                },
+ 
+-            { "<TITLE>" + LS + "Constant Field Values" + LS + "</TITLE>",
++            { "<title>Constant Field Values</title>",
+                     TMPDIR_STRING1 + "constant-values.html"                   },
+ 
+-            { "<TITLE>" + LS + "Deprecated List" + LS + "</TITLE>",
++            { "<title>Deprecated List</title>",
+                     TMPDIR_STRING1 + "deprecated-list.html"                   },
+ 
+-            { "<TITLE>" + LS + "Serialized Form" + LS + "</TITLE>",
++            { "<title>Serialized Form</title>",
+                     TMPDIR_STRING1 + "serialized-form.html"                   },
+ 
+-            { "<TITLE>" + LS + "API Help" + LS + "</TITLE>",
++            { "<title>API Help</title>",
+                     TMPDIR_STRING1 + "help-doc.html"                          },
+ 
+-            { "<TITLE>" + LS + "Index" + LS + "</TITLE>",
++            { "<title>Index</title>",
+                     TMPDIR_STRING1 + "index-all.html"                         },
+ 
+-            { "<TITLE>" + LS + "Uses of Class p1.C1" + LS + "</TITLE>",
++            { "<title>Uses of Class p1.C1</title>",
+                     TMPDIR_STRING1 + "p1" + FS + "class-use" + FS + "C1.html" },
+         };
+ 
+@@ -147,7 +147,7 @@
+      * Assign value for [ stringToFind, filename ] for split index page
+      */
+     private static final String[][] testSplitIndexArray = {
+-            { "<TITLE>" + LS + "C-Index" + LS + "</TITLE>",
++            { "<title>C-Index</title>",
+                     TMPDIR_STRING2 + "index-files" + FS + "index-1.html"       },
+         };
+ 
+diff --git a/test/com/sun/javadoc/constantValues/TestConstantValuesDriver.java b/test/com/sun/javadoc/constantValues/TestConstantValuesDriver.java
+--- langtools/test/com/sun/javadoc/constantValues/TestConstantValuesDriver.java
++++ langtools/test/com/sun/javadoc/constantValues/TestConstantValuesDriver.java
+@@ -51,7 +51,7 @@
+             tests[i][1] = "TEST"+(i+1)+"PASSES";
+         }
+         tests[tests.length-1][0] = BUG_ID + FS + "constant-values.html";
+-        tests[tests.length-1][1] = "<CODE>\"<Hello World>\"</CODE>";
++        tests[tests.length-1][1] = "<code>\"<Hello World>\"</code>";
+         TestConstantValuesDriver tester = new TestConstantValuesDriver();
+         run(tester, ARGS, tests, NO_TEST);
+         tester.printSummary();
+diff --git a/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java b/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java
+--- langtools/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java
++++ langtools/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java
+@@ -37,18 +37,20 @@
+     private static final String BUG_ID = "4652655-4857717";
+     private static final String[][] TEST = {
+         {BUG_ID + FS + "C.html",
+-            "<A HREF=\"http://java.sun.com/j2se/1.4/docs/api/java/math/package-summary.html?is-external=true\"><CODE>Link to math package</CODE></A>"},
++            "<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/math/package-summary.html?is-external=true\"><code>Link to math package</code></a>"},
+         {BUG_ID + FS + "C.html",
+-            "<A HREF=\"http://java.sun.com/j2se/1.4/docs/api/javax/swing/text/AbstractDocument.AttributeContext.html?is-external=true\" " +
+-            "title=\"class or interface in javax.swing.text\"><CODE>Link to AttributeContext innerclass</CODE></A>"},
++            "<a href=\"http://java.sun.com/j2se/1.4/docs/api/javax/swing/text/AbstractDocument.AttributeContext.html?is-external=true\" " +
++            "title=\"class or interface in javax.swing.text\"><code>Link to AttributeContext innerclass</code></a>"},
+         {BUG_ID + FS + "C.html",
+-            "<A HREF=\"http://java.sun.com/j2se/1.4/docs/api/java/math/BigDecimal.html?is-external=true\" " +
+-                "title=\"class or interface in java.math\"><CODE>Link to external class BigDecimal</CODE></A>"},
++            "<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/math/BigDecimal.html?is-external=true\" " +
++                "title=\"class or interface in java.math\"><code>Link to external class BigDecimal</code></a>"},
+         {BUG_ID + FS + "C.html",
+-            "<A HREF=\"http://java.sun.com/j2se/1.4/docs/api/java/math/BigInteger.html?is-external=true#gcd(java.math.BigInteger)\" " +
+-                "title=\"class or interface in java.math\"><CODE>Link to external member gcd</CODE></A>"},
++            "<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/math/BigInteger.html?is-external=true#gcd(java.math.BigInteger)\" " +
++                "title=\"class or interface in java.math\"><code>Link to external member gcd</code></a>"},
+         {BUG_ID + FS + "C.html",
+-            "<STRONG>Overrides:</STRONG></DT><DD><CODE>toString</CODE> in class <CODE>java.lang.Object</CODE>"}
++            "<dl>" + NL + "<dt><strong>Overrides:</strong></dt>" + NL +
++            "<dd><code>toString</code> in class <code>java.lang.Object</code></dd>" + NL +
++            "</dl>"}
+     };
+     private static final String[][] NEGATED_TEST = NO_TEST;
+     private static final String[] ARGS =
+diff --git a/test/com/sun/javadoc/testClassTree/TestClassTree.java b/test/com/sun/javadoc/testClassTree/TestClassTree.java
+--- langtools/test/com/sun/javadoc/testClassTree/TestClassTree.java
++++ langtools/test/com/sun/javadoc/testClassTree/TestClassTree.java
+@@ -48,32 +48,29 @@
+     //Input for string search tests.
+     private static final String[][] TEST = {
+         {BUG_ID + FS + "pkg" + FS + "package-tree.html",
+-            "<LI TYPE=\"circle\">pkg.<A HREF=\"../pkg/ParentClass.html\" " +
+-            "title=\"class in pkg\"><STRONG>ParentClass</STRONG></A><UL>"},
++            "<ul>" + NL + "<li type=\"circle\">pkg.<a href=\"../pkg/ParentClass.html\" " +
++            "title=\"class in pkg\"><span class=\"strong\">ParentClass</span></a>"},
+ 
+         {BUG_ID + FS + "pkg" + FS + "package-tree.html",
+-            "Annotation Type Hierarchy" + NL + "</H2>" + NL + "<UL>" + NL +
+-            "<LI TYPE=\"circle\">pkg.<A HREF=\"../pkg/AnnotationType.html\" " +
+-            "title=\"annotation in pkg\"><STRONG>AnnotationType</STRONG></A> " +
+-            "(implements java.lang.annotation.Annotation)" + NL + "</UL>"},
++            "<h2 title=\"Annotation Type Hierarchy\">Annotation Type Hierarchy</h2>" + NL +
++            "<ul>" + NL + "<li type=\"circle\">pkg.<a href=\"../pkg/AnnotationType.html\" " +
++            "title=\"annotation in pkg\"><span class=\"strong\">AnnotationType</span></a> " +
++            "(implements java.lang.annotation.Annotation)</li>" + NL + "</ul>"},
+ 
+         {BUG_ID + FS + "pkg" + FS + "package-tree.html",
+-            "<H2>" + NL +
+-            "Enum Hierarchy" + NL +
+-            "</H2>" + NL +
+-            "<UL>" + NL +
+-            "<LI TYPE=\"circle\">java.lang.Object<UL>" + NL +
+-            "<LI TYPE=\"circle\">java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable)" + NL +
+-            "<UL>" + NL +
+-            "<LI TYPE=\"circle\">pkg.<A HREF=\"../pkg/Coin.html\" title=\"enum in pkg\"><STRONG>Coin</STRONG></A></UL>" + NL +
+-            "</UL>" + NL +
+-            "</UL>"
++            "<h2 title=\"Enum Hierarchy\">Enum Hierarchy</h2>" + NL + "<ul>" + NL +
++            "<li type=\"circle\">java.lang.Object" + NL + "<ul>" + NL +
++            "<li type=\"circle\">java.lang.Enum<E> (implements java.lang." +
++            "Comparable<T>, java.io.Serializable)" + NL + "<ul>" + NL +
++            "<li type=\"circle\">pkg.<a href=\"../pkg/Coin.html\" " +
++            "title=\"enum in pkg\"><span class=\"strong\">Coin</span></a></li>" + NL +
++            "</ul>" + NL + "</li>" + NL + "</ul>" + NL + "</li>" + NL + "</ul>"
+         },
+     };
+     private static final String[][] NEGATED_TEST = {
+         {BUG_ID + FS + "pkg" + FS + "package-tree.html",
+-            "<LI TYPE=\"circle\">class pkg.<A HREF=\"../pkg/ParentClass.html\" " +
+-            "title=\"class in pkg\"><STRONG>ParentClass</STRONG></A><UL>"}
++            "<li type=\"circle\">class pkg.<a href=\"../pkg/ParentClass.html\" " +
++            "title=\"class in pkg\"><span class=\"strong\">ParentClass</span></a></li>"}
+         };
+ 
+     /**
+diff --git a/test/com/sun/javadoc/testConstructorIndent/TestConstructorIndent.java b/test/com/sun/javadoc/testConstructorIndent/TestConstructorIndent.java
+--- langtools/test/com/sun/javadoc/testConstructorIndent/TestConstructorIndent.java
++++ langtools/test/com/sun/javadoc/testConstructorIndent/TestConstructorIndent.java
+@@ -45,10 +45,10 @@
+ 
+     //Input for string search tests.
+     private static final String[][] TEST = {
+-        {BUG_ID + FS + "C.html", "<DL>" + NL + "<DD>This is just a simple constructor." + NL +
+-            "<P>" + NL + "</DD>" + NL + "<DD><DL>" + NL + "<DT><STRONG>Parameters:</STRONG>" +
+-            "</DT><DD><CODE>i</CODE> - a param.</DD></DL>" + NL +
+-            "</DD>" + NL + "</DL>"
++        {BUG_ID + FS + "C.html", "<div class=\"block\">" +
++                 "This is just a simple constructor.</div>" + NL +
++                 "<dl><dt><span class=\"strong\">Parameters:</span></dt><dd>" +
++                 "<code>i</code> - a param.</dd></dl>"
+         }
+     };
+     private static final String[][] NEGATED_TEST = NO_TEST;
+diff --git a/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java b/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java
+--- langtools/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java
++++ langtools/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java
+@@ -76,24 +76,21 @@
+         {TARGET_FILE, "pkg.DeprecatedClassByAnnotation.method()"},
+         {TARGET_FILE, "pkg.DeprecatedClassByAnnotation.field"},
+ 
+-        {TARGET_FILE2, "<STRONG>Deprecated.</STRONG>" + NL +
+-                "<P>" + NL +
+-            "<PRE><FONT SIZE=\"-1\">@Deprecated" + NL +
+-            "</FONT>public class <STRONG>DeprecatedClassByAnnotation</STRONG>"},
++        {TARGET_FILE2, "<pre>@Deprecated" + NL +
++                 "public class <strong>DeprecatedClassByAnnotation</strong>" + NL +
++                 "extends java.lang.Object</pre>"},
+ 
+-        {TARGET_FILE2, "public int <STRONG>field</STRONG></PRE>" + NL +
+-            "<DL>" + NL +
+-            "<DD><STRONG>Deprecated.</STRONG> </DD></DL>"},
++        {TARGET_FILE2, "<pre>@Deprecated" + NL +
++                 "public int field</pre>" + NL +
++                 "<div class=\"block\"><span class=\"strong\">Deprecated.</span> </div>"},
+ 
+-        {TARGET_FILE2, "<FONT SIZE=\"-1\">@Deprecated" + NL +
+-            "</FONT>public <STRONG>DeprecatedClassByAnnotation</STRONG>()</PRE>" + NL +
+-            "<DL>" + NL +
+-            "<DD><STRONG>Deprecated.</STRONG>"},
++        {TARGET_FILE2, "<pre>@Deprecated" + NL +
++                 "public DeprecatedClassByAnnotation()</pre>" + NL +
++                 "<div class=\"block\"><span class=\"strong\">Deprecated.</span> </div>"},
+ 
+-        {TARGET_FILE2, "<FONT SIZE=\"-1\">@Deprecated" + NL +
+-            "</FONT>public void <STRONG>method</STRONG>()</PRE>" + NL +
+-            "<DL>" + NL +
+-            "<DD><STRONG>Deprecated.</STRONG>"},
++        {TARGET_FILE2, "<pre>@Deprecated" + NL +
++                 "public void method()</pre>" + NL +
++                 "<div class=\"block\"><span class=\"strong\">Deprecated.</span> </div>"},
+     };
+ 
+     private static final String[][] NEGATED_TEST = NO_TEST;
+diff --git a/test/com/sun/javadoc/testDocRootInlineTag/TestDocRootInlineTag.java b/test/com/sun/javadoc/testDocRootInlineTag/TestDocRootInlineTag.java
+--- langtools/test/com/sun/javadoc/testDocRootInlineTag/TestDocRootInlineTag.java
++++ langtools/test/com/sun/javadoc/testDocRootInlineTag/TestDocRootInlineTag.java
+@@ -39,13 +39,13 @@
+     private static final String BUG_ID = "4369014-4851991";
+     private static final String[][] TEST = {
+         {BUG_ID + FS + "TestDocRootTag.html",
+-            "<A HREF=\"http://www.java.sun.com/j2se/1.4/docs/api/java/io/File.html?is-external=true\" " +
+-            "title=\"class or interface in java.io\"><CODE>File</CODE></A>"},
++            "<a href=\"http://www.java.sun.com/j2se/1.4/docs/api/java/io/File.html?is-external=true\" " +
++            "title=\"class or interface in java.io\"><code>File</code></a>"},
+         {BUG_ID + FS + "TestDocRootTag.html",
+             "<a href=\"./glossary.html\">glossary</a>"},
+         {BUG_ID + FS + "TestDocRootTag.html",
+-            "<A HREF=\"http://www.java.sun.com/j2se/1.4/docs/api/java/io/File.html?is-external=true\" " +
+-            "title=\"class or interface in java.io\"><CODE>Second File Link</CODE></A>"},
++            "<a href=\"http://www.java.sun.com/j2se/1.4/docs/api/java/io/File.html?is-external=true\" " +
++            "title=\"class or interface in java.io\"><code>Second File Link</code></a>"},
+         {BUG_ID + FS + "TestDocRootTag.html", "The value of @docRoot is \"./\""},
+         {BUG_ID + FS + "index-all.html", "My package page is " +
+             "<a href=\"./pkg/package-summary.html\">here</a>"}
+diff --git a/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java b/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java
+--- langtools/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java
++++ langtools/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java
+@@ -39,17 +39,17 @@
+     private static final String BUG_ID = "4857717";
+     private static final String[][] TEST = {
+         {BUG_ID + FS + "pkg" + FS + "XReader.html",
+-            "<STRONG>Overrides:</STRONG></DT><DD><CODE><A HREF=\"" +
+-            "http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterReader.html?is-external=true#read()\"" +
+-                " title=\"class or interface in java.io\">read</A></CODE> in class " +
+-                "<CODE><A HREF=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterReader.html?is-external=true\"" +
+-                " title=\"class or interface in java.io\">FilterReader</A>"},
++            "<dt><strong>Overrides:</strong></dt>" + NL +
++            "<dd><code><a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterReader.html?is-external=true#read()\" " +
++            "title=\"class or interface in java.io\">read</a></code> in class <code>" +
++            "<a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterReader.html?is-external=true\" " +
++            "title=\"class or interface in java.io\">FilterReader</a></code></dd>"},
+         {BUG_ID + FS + "pkg" + FS + "XReader.html",
+-            "<STRONG>Specified by:</STRONG></DT><DD><CODE><A HREF=\"" +
+-            "http://java.sun.com/j2se/1.4.1/docs/api/java/io/DataInput.html?is-external=true#readInt()\"" +
+-            " title=\"class or interface in java.io\">readInt</A></CODE> in interface " +
+-            "<CODE><A HREF=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/DataInput.html?is-external=true\"" +
+-            " title=\"class or interface in java.io\">DataInput</A>"}};
++            "<dt><strong>Specified by:</strong></dt>" + NL +
++            "<dd><code><a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/DataInput.html?is-external=true#readInt()\" " +
++            "title=\"class or interface in java.io\">readInt</a></code> in interface <code>" +
++            "<a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/DataInput.html?is-external=true\" " +
++            "title=\"class or interface in java.io\">DataInput</a></code></dd>"}};
+ 
+ 
+ 
+diff --git a/test/com/sun/javadoc/testHeadings/TestHeadings.java b/test/com/sun/javadoc/testHeadings/TestHeadings.java
+--- langtools/test/com/sun/javadoc/testHeadings/TestHeadings.java
++++ langtools/test/com/sun/javadoc/testHeadings/TestHeadings.java
+@@ -47,80 +47,65 @@
+     private static final String[][] TEST = {
+         //Package summary
+         {BUG_ID + FS + "pkg1" + FS + "package-summary.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Class</TH>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
+-            " NOWRAP>Description</TH>"
++            "<th class=\"colFirst\" scope=\"col\">" +
++            "Class</th>" + NL + "<th class=\"colLast\" scope=\"col\"" +
++            ">Description</th>"
+         },
+ 
+         // Class documentation
+         {BUG_ID + FS + "pkg1" + FS + "C1.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Modifier and Type</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
+-            " SCOPE=\"col\" NOWRAP>Field and Description</TH>"
++            "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL +
++            "<th class=\"colLast\" scope=\"col\">Field and Description</th>"
+         },
+         {BUG_ID + FS + "pkg1" + FS + "C1.html",
+-            "<TH ALIGN=\"left\"><STRONG>Methods inherited from class " +            "java.lang.Object</STRONG></TH>"
++            "<h3>Methods inherited from class java.lang.Object</h3>"
+         },
+ 
+         // Class use documentation
+         {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Package</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
+-            " SCOPE=\"col\" NOWRAP>Description</TH>"
++            "<th class=\"colFirst\" scope=\"col\">Package</th>" + NL +
++            "<th class=\"colLast\" scope=\"col\">Description</th>"
+         },
+         {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html",
+-            "<TH ALIGN=\"left\" COLSPAN=\"2\"><FONT SIZE=\"+2\">" + NL +
+-            "Uses of <A HREF=\"../../pkg1/C1.html\" " +            "title=\"class in pkg1\">C1</A> in " +            "<A HREF=\"../../pkg2/package-summary.html\">pkg2</A></FONT></TH>"
+-        },
+-        {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Modifier and Type</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
+-            " SCOPE=\"col\" NOWRAP>Field and Description</TH>"
++            "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL +
++            "<th class=\"colLast\" scope=\"col\">Field and Description</th>"
+         },
+ 
+         // Deprecated
+         {BUG_ID + FS + "deprecated-list.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Method and Description</TH>"
++            "<th class=\"colOne\" scope=\"col\">Method and Description</th>"
+         },
+ 
+         // Constant values
+         {BUG_ID + FS + "constant-values.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Modifier and Type</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
+-            " SCOPE=\"col\" NOWRAP>Constant Field</TH>" + NL +
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>Value</TH>"
++            "<th class=\"colFirst\" scope=\"col\">" +
++            "Modifier and Type</th>" + NL + "<th scope=\"col\">Constant Field</th>" + NL +
++            "<th class=\"colLast\" scope=\"col\">Value</th>"
+         },
+ 
+         // Serialized Form
+         {BUG_ID + FS + "serialized-form.html",
+-            "<TH ALIGN=\"center\"><FONT SIZE=\"+2\">" + NL +
+-            "<STRONG>Package</STRONG> <STRONG>pkg1</STRONG></FONT></TH>"
++            "<h2 title=\"Package\">Package pkg1</h2>"
+         },
+         {BUG_ID + FS + "serialized-form.html",
+-            "<TH ALIGN=\"left\" COLSPAN=\"2\"><FONT SIZE=\"+2\">" + NL +
+-            "<STRONG>Class <A HREF=\"pkg1/C1.html\" " +            "title=\"class in pkg1\">pkg1.C1</A> extends java.lang.Object " +            "implements Serializable</STRONG></FONT></TH>"
++            "<h3>Class <a href=\"pkg1/C1.html\" title=\"class in pkg1\">" +
++            "pkg1.C1</a> extends java.lang.Object implements Serializable</h3>"
+         },
+         {BUG_ID + FS + "serialized-form.html",
+-            "<TH ALIGN=\"left\" COLSPAN=\"1\"><FONT SIZE=\"+2\">" + NL +
+-            "<STRONG>Serialized Fields</STRONG></FONT></TH>"
++            "<h3>Serialized Fields</h3>"
+         },
+ 
+         // Overview Frame
+         {BUG_ID + FS + "overview-frame.html",
+-            "<TH ALIGN=\"left\" NOWRAP><FONT size=\"+1\" " +            "CLASS=\"FrameTitleFont\">" + NL + "<STRONG>Test Files</STRONG></FONT></TH>"
++            "<h1 title=\"Test Files\" class=\"bar\">Test Files</h1>"
+         },
+         {BUG_ID + FS + "overview-frame.html",
+-            "<TITLE>" + NL +
+-            "Overview List" + NL +
+-            "</TITLE>"
++            "<title>Overview List</title>"
+         },
+ 
+         // Overview Summary
+         {BUG_ID + FS + "overview-summary.html",
+-            "<TITLE>" + NL +
+-            "Overview" + NL +
+-            "</TITLE>"
++            "<title>Overview</title>"
+         },
+ 
+     };
+diff --git a/test/com/sun/javadoc/testHelpOption/TestHelpOption.java b/test/com/sun/javadoc/testHelpOption/TestHelpOption.java
+--- langtools/test/com/sun/javadoc/testHelpOption/TestHelpOption.java
++++ langtools/test/com/sun/javadoc/testHelpOption/TestHelpOption.java
+@@ -91,8 +91,7 @@
+ 
+     private static final String[][] TEST2 = {
+         {BUG_ID + FS + "TestHelpOption.html",
+-            "<A HREF=\"help-doc.html\"><FONT CLASS=\"NavBarFont1\">" +
+-            "<STRONG>Help</STRONG></FONT></A>"
++            "<li><a href=\"help-doc.html\">Help</a></li>"
+         },
+     };
+     private static final String[][] NEGATED_TEST2 = NO_TEST;
+diff --git a/test/com/sun/javadoc/testHref/TestHref.java b/test/com/sun/javadoc/testHref/TestHref.java
+--- langtools/test/com/sun/javadoc/testHref/TestHref.java
++++ langtools/test/com/sun/javadoc/testHref/TestHref.java
+@@ -47,37 +47,41 @@
+     private static final String[][] TEST = {
+         //External link.
+         {BUG_ID + FS + "pkg" + FS + "C1.html",
+-            "HREF=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true#wait(long, int)\""
++            "href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true#wait(long, int)\""
+         },
+         //Member summary table link.
+         {BUG_ID + FS + "pkg" + FS + "C1.html",
+-            "HREF=\"../pkg/C1.html#method(int, int, java.util.ArrayList)\""
++            "href=\"../pkg/C1.html#method(int, int, java.util.ArrayList)\""
+         },
+         //Anchor test.
+         {BUG_ID + FS + "pkg" + FS + "C1.html",
+-            "<A NAME=\"method(int, int, java.util.ArrayList)\"><!-- --></A>"
++            "<a name=\"method(int, int, java.util.ArrayList)\">" + NL +
++            "<!--   -->" + NL +
++            "</a>"
+         },
+         //Backward compatibility anchor test.
+         {BUG_ID + FS + "pkg" + FS + "C1.html",
+-            "<A NAME=\"method(int, int, java.util.ArrayList)\"><!-- --></A>"
++            "<a name=\"method(int, int, java.util.ArrayList)\">" + NL +
++            "<!--   -->" + NL +
++            "</a>"
+         },
+         //{@link} test.
+         {BUG_ID + FS + "pkg" + FS + "C2.html",
+-            "Link: <A HREF=\"../pkg/C1.html#method(int, int, java.util.ArrayList)\">"
++            "Link: <a href=\"../pkg/C1.html#method(int, int, java.util.ArrayList)\">"
+         },
+         //@see test.
+         {BUG_ID + FS + "pkg" + FS + "C2.html",
+-            "See Also:</STRONG></DT><DD><A HREF=\"../pkg/C1.html#method(int, int, java.util.ArrayList)\">"
++            "See Also:</span></dt><dd><a href=\"../pkg/C1.html#method(int, int, java.util.ArrayList)\">"
+         },
+ 
+         //Header does not link to the page itself.
+         {BUG_ID + FS + "pkg" + FS + "C4.html",
+-            "Class C4<E extends C4<E>></H2>"
++            "Class C4<E extends C4<E>></h2>"
+         },
+ 
+         //Signature does not link to the page itself.
+         {BUG_ID + FS + "pkg" + FS + "C4.html",
+-            "public abstract class <STRONG>C4<E extends C4<E>></STRONG>"
++            "public abstract class <strong>C4<E extends C4<E>></strong>"
+         },
+     };
+     private static final String[][] NEGATED_TEST =
+diff --git a/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java b/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java
+--- langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java
++++ langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java
+@@ -43,149 +43,77 @@
+     // Optional Element should print properly nested definition list tags
+     // for default value.
+     private static final String[][] TEST_ALL = {
+-        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<PRE>public class " +
+-                 "<STRONG>C1</STRONG>" + NL + "extends " +
+-                 "java.lang.Object" + NL + "implements " +
+-                 "java.io.Serializable</PRE>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C4.html", "<DL>" + NL + "<DD><DL>" + NL +
+-                 "<DT><STRONG>Default:</STRONG></DT><DD>true</DD>" + NL +
+-                 "</DL>" + NL + "</DD>" + NL + "</DL>"}};
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<pre>public class <strong>C1</strong>" + NL +
++                 "extends java.lang.Object" + NL + "implements java.io.Serializable</pre>"},
++        {BUG_ID + FS + "pkg1" + FS + "C4.html", "<dl>" + NL +
++                 "<dt>Default:</dt>" + NL + "<dd>true</dd>" + NL +
++                 "</dl>"}};
+ 
+     // Test for normal run of javadoc in which various ClassDocs and
+     // serialized form should have properly nested definition list tags
+     // enclosing comments, tags and deprecated information.
+     private static final String[][] TEST_CMNT_DEPR = {
+-        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<DL>" + NL +
+-                 "<DT><STRONG>Since:</STRONG></DT>" + NL +
+-                 "  <DD>JDK1.0</DD>" + NL + "<DT><STRONG>See Also:</STRONG></DT><DD>" +
+-                 "<A HREF=\"../pkg1/C2.html\" title=\"class in pkg1\">" +
+-                 "<CODE>C2</CODE></A>, " + NL +
+-                 "<A HREF=\"../serialized-form.html#pkg1.C1\">" +
+-                 "Serialized Form</A></DD></DL>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C1.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>" +
+-                 "<DD>This field indicates whether the C1 is undecorated." + NL +
+-                 "<P>" + NL + "</DD>" + NL + "<DD><DL>" + NL + "<DT><STRONG>" +
+-                 "Since:</STRONG></DT>" + NL + "  <DD>1.4</DD>" + NL + "<DT>" +
+-                 "<STRONG>See Also:</STRONG></DT><DD>" +
+-                 "<A HREF=\"../pkg1/C1.html#setUndecorated(boolean)\"><CODE>" +
+-                 "setUndecorated(boolean)</CODE></A></DD></DL>" + NL +"</DD>" + NL +
+-                 "</DL>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<DL>" + NL +
+-                 "<DD>Constructor." + NL + "<P>" + NL + "</DD>" + NL +
+-                 "<DD><DL>" + NL + "<DT><STRONG>Parameters:</STRONG></DT><DD>" +
+-                 "<CODE>title</CODE> - the title</DD><DD><CODE>test</CODE>" +
+-                 " - boolean value</DD>" + NL + "<DT><STRONG>Throws:</STRONG></DT>" + NL +
+-                 "<DD><CODE>java.lang.IllegalArgumentException</CODE>" +
+-                 " - if the <code>owner</code>'s" + NL + "     <code>GraphicsConfiguration" +
+-                 "</code> is not from a screen device</DD>" + NL +"<DD><CODE>" +
+-                 "HeadlessException</CODE></DD></DL>" + NL + "</DD>" + NL +
+-                 "</DL>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<DL>" + NL +
+-                 "<DD>Method comments." + NL + "<P>" + NL +
+-                 "</DD>" + NL + "<DD><DL>" + NL + "<DT><STRONG>Parameters:" +
+-                 "</STRONG></DT><DD><CODE>undecorated</CODE> - <code>true</code>" +
+-                 " if no decorations are" + NL + "         to be enabled;" + NL +
+-                 "         <code>false</code> if decorations are to be enabled." +
+-                 "</DD><DT><STRONG>Since:</STRONG></DT>" + NL +
+-                 "  <DD>1.4</DD>" + NL + "<DT><STRONG>See Also:</STRONG></DT>" +
+-                 "<DD><A HREF=\"../pkg1/C1.html#readObject()\"><CODE>" +
+-                 "readObject()</CODE></A></DD></DL>" + NL + "</DD>" + NL +
+-                 "</DL>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<DL>" + NL + "<DD><DL>" + NL +
+-                 "<DT><STRONG>Throws:</STRONG></DT>" + NL + "<DD><CODE>" +
+-                 "java.io.IOException</CODE></DD><DT><STRONG>See Also:" +
+-                 "</STRONG></DT><DD>" +
+-                 "<A HREF=\"../pkg1/C1.html#setUndecorated(boolean)\">" +
+-                 "<CODE>setUndecorated(boolean)</CODE></A></DD></DL>" + NL +
+-                 "</DD>" + NL + "</DL>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C1.ModalExclusionType.html", "<DL>" + NL +
+-                 "<DD>No modal exclusion." + NL + "<P>" + NL +"</DD>" + NL +
+-                 "</DL>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C2.html", "<DL>" + NL + "<DD>Constructor." + NL +
+-                 "<P>" + NL +"</DD>" + NL + "</DL>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C2.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><DD>Set visible." + NL + "<P>" + NL + "</DD>" +NL +
+-                 "<DD><DL>" + NL + "<DT><STRONG>Parameters:</STRONG></DT><DD>" +
+-                 "<CODE>set</CODE> - boolean</DD><DT><STRONG>Since:</STRONG></DT>" + NL +
+-                 "  <DD>1.4</DD></DL>" + NL + "</DD>" + NL + "</DL>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C3.html", "<DL>" + NL + "<DD>Comment." + NL +
+-                 "<P>" + NL + "</DD>" + NL + "</DL>"},
+-        {BUG_ID + FS + "serialized-form.html", "<DL>" + NL + "<DD><DL>" + NL +
+-                 "<DT><STRONG>Throws:</STRONG></DT>" + NL + "<DD><CODE>" +
+-                 "java.io.IOException</CODE></DD><DT><STRONG>See Also:</STRONG>" +
+-                 "</DT><DD><A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+-                 "<CODE>C1.setUndecorated(boolean)</CODE></A></DD></DL>" + NL +
+-                 "</DD>" + 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>" +
+-                 "<DD>This field indicates whether the C1 is undecorated." + NL +
+-                 "<P>" + NL + "</DD>" + NL + "<DD> </DD>" + NL +
+-                 "<DD><DL>" + NL + "<DT><STRONG>Since:</STRONG></DT>" + NL +
+-                 "  <DD>1.4</DD>" + NL + "<DT><STRONG>See Also:</STRONG>" +
+-                 "</DT><DD><A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+-                 "<CODE>C1.setUndecorated(boolean)</CODE></A></DD></DL>" + NL +
+-                 "</DD>" + 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><DD>Reads the object stream." + NL + "<P>" + NL +
+-                 "</DD>" + NL + "<DD><DL>" + NL + "<DT><STRONG>Throws:" +
+-                 "</STRONG></DT>" + NL + "<DD><CODE><code>" +
+-                 "IOException</code></CODE></DD>" + NL +
+-                 "<DD><CODE>java.io.IOException</CODE></DD></DL>" + NL +
+-                 "</DD>" + NL + "</DL>"},
+-        {BUG_ID + FS + "serialized-form.html", "<DL>" + NL +
+-                 "<DD><STRONG>Deprecated.</STRONG> </DD><DD>" +
+-                 "The name for this class." + NL + "<P>" + NL + "</DD>" + NL +
+-                 "<DD> </DD>" + NL + "</DL>"}};
+-
+-    // Test with -nocomment option. The ClassDocs and serialized form should
+-    // have properly nested definition list tags enclosing deprecated
+-    // information and should not display definition lists for comments
+-    // and tags.
+-    private static final String[][] TEST_NOCMNT = {
+-        {BUG_ID + FS + "pkg1" + FS + "C1.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></DL>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C2.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></DL>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C5.html", "<PRE>" + NL +
+-                 "protected <STRONG>C5</STRONG>()</PRE>" + NL + "<DL>" + NL +
+-                 "<DD><STRONG>Deprecated.</STRONG> </DD></DL>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C5.html", "<PRE>" + NL +
+-                 "public void <STRONG>printInfo</STRONG>()</PRE>" + NL + "<DL>" + NL +
+-                 "<DD><STRONG>Deprecated.</STRONG> </DD></DL>"},
+-        {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></DD></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></DL>"},
+-        {BUG_ID + FS + "serialized-form.html", "<PRE>" + NL + "int <STRONG>" +
+-                 "publicKey</STRONG></PRE>" + NL + "<DL>" + NL + "<DD><STRONG>" +
+-                 "Deprecated.</STRONG> </DD></DL>"}};
++        {BUG_ID + FS + "pkg1" + FS + "package-summary.html", "<dl>" +
++                 "<dt><span class=\"strong\">Since:</span></dt>" + NL +
++                 "  <dd>JDK1.0</dd></dl>"},
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl><dt><span class=\"strong\">Since:</span></dt>" + NL +
++                 "  <dd>JDK1.0</dd>" + NL + "<dt><span class=\"strong\">See Also:</span></dt>" +
++                 "<dd><a href=\"../pkg1/C2.html\" title=\"class in pkg1\"><code>" +
++                 "C2</code></a>, " + NL + "<a href=\"../serialized-form.html#pkg1.C1\">" +
++                 "Serialized Form</a></dd></dl>"},
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl><dt><span class=\"strong\">Since:</span></dt>" + NL +
++                 "  <dd>1.4</dd>" + NL +
++                 "<dt><span class=\"strong\">See Also:</span></dt><dd>" +
++                 "<a href=\"../pkg1/C1.html#setUndecorated(boolean)\">" +
++                 "<code>setUndecorated(boolean)</code></a></dd></dl>"},
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl><dt><span class=\"strong\">Parameters:</span></dt><dd><code>title" +
++                 "</code> - the title</dd><dd><code>test</code> - boolean value" +
++                 "</dd>" + NL + "<dt><span class=\"strong\">Throws:</span></dt>" + NL +
++                 "<dd><code>java.lang.IllegalArgumentException</code> - if the " +
++                 "<code>owner</code>'s" + NL +
++                 "     <code>GraphicsConfiguration</code> is not from a screen " +
++                 "device</dd>" + NL + "<dd><code>HeadlessException</code></dd></dl>"},
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl><dt><span class=\"strong\">Parameters:</span></dt><dd><code>undecorated" +
++                 "</code> - <code>true</code> if no decorations are" + NL +
++                 "         to be enabled;" + NL + "         <code>false</code> " +
++                 "if decorations are to be enabled.</dd><dt><span class=\"strong\">Since:" +
++                 "</span></dt>" + NL + "  <dd>1.4</dd>" + NL +
++                 "<dt><span class=\"strong\">See Also:</span></dt><dd>" +
++                 "<a href=\"../pkg1/C1.html#readObject()\"><code>readObject()" +
++                 "</code></a></dd></dl>"},
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl><dt><span class=\"strong\">Throws:</span></dt>" + NL +
++                 "<dd><code>java.io.IOException</code></dd><dt><span class=\"strong\">See Also:" +
++                 "</span></dt><dd><a href=\"../pkg1/C1.html#setUndecorated(boolean)\">" +
++                 "<code>setUndecorated(boolean)</code></a></dd></dl>"},
++        {BUG_ID + FS + "pkg1" + FS + "C2.html", "<dl><dt><span class=\"strong\">Parameters:" +
++                 "</span></dt><dd><code>set</code> - boolean</dd><dt><span class=\"strong\">" +
++                 "Since:</span></dt>" + NL + "  <dd>1.4</dd></dl>"},
++        {BUG_ID + FS + "serialized-form.html", "<dl><dt><span class=\"strong\">Throws:</span>" +
++                 "</dt>" + NL + "<dd><code>" +
++                 "java.io.IOException</code></dd><dt><span class=\"strong\">See Also:</span>" +
++                 "</dt><dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
++                 "<code>C1.setUndecorated(boolean)</code></a></dd></dl>"},
++        {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
++                 " <i>As of JDK version 1.5, replaced by" + NL +
++                 " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
++                 "<code>setUndecorated(boolean)</code></a>.</i></div>" + NL +
++                 "<div class=\"block\">This field indicates whether the C1 is " +
++                 "undecorated.</div>" + NL + " " + NL + "<dl><dt><span class=\"strong\">Since:</span></dt>" + NL +
++                 "  <dd>1.4</dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" +
++                 "</dt><dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
++                 "<code>C1.setUndecorated(boolean)</code></a></dd></dl>"},
++        {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
++                 " <i>As of JDK version 1.5, replaced by" + NL +
++                 " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
++                 "<code>setUndecorated(boolean)</code></a>.</i></div>" + NL +
++                 "<div class=\"block\">Reads the object stream.</div>" + NL +
++                 "<dl><dt><span class=\"strong\">Throws:" +
++                 "</span></dt>" + NL + "<dd><code><code>" +
++                 "IOException</code></code></dd>" + NL +
++                 "<dd><code>java.io.IOException</code></dd></dl>"},
++        {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
++                 " </div>" + NL +
++                 "<div class=\"block\">The name for this class.</div>"}};
+ 
+     // Test with -nodeprecated option. The ClassDocs should have properly nested
+     // definition list tags enclosing comments and tags. The ClassDocs should not
+@@ -193,133 +121,104 @@
+     // should display properly nested definition list tags for comments, tags
+     // and deprecated information.
+     private static final String[][] TEST_NODEPR = {
+-        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<DL>" + NL +
+-                 "<DT><STRONG>Since:</STRONG></DT>" + NL +
+-                 "  <DD>JDK1.0</DD>" + NL + "<DT><STRONG>See Also:</STRONG></DT><DD>" +
+-                 "<A HREF=\"../pkg1/C2.html\" title=\"class in pkg1\">" +
+-                 "<CODE>C2</CODE></A>, " + NL +
+-                 "<A HREF=\"../serialized-form.html#pkg1.C1\">" +
+-                 "Serialized Form</A></DD></DL>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<DL>" + NL +
+-                 "<DD>Constructor." + NL + "<P>" + NL + "</DD>" + NL +
+-                 "<DD><DL>" + NL + "<DT><STRONG>Parameters:</STRONG></DT><DD>" +
+-                 "<CODE>title</CODE> - the title</DD><DD><CODE>test</CODE>" +
+-                 " - boolean value</DD>" + NL + "<DT><STRONG>Throws:</STRONG></DT>" + NL +
+-                 "<DD><CODE>java.lang.IllegalArgumentException</CODE>" +
+-                 " - if the <code>owner</code>'s" + NL + "     <code>GraphicsConfiguration" +
+-                 "</code> is not from a screen device</DD>" + NL +"<DD><CODE>" +
+-                 "HeadlessException</CODE></DD></DL>" + NL + "</DD>" + NL +
+-                 "</DL>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<DL>" + NL +
+-                 "<DD>Method comments." + NL + "<P>" + NL +
+-                 "</DD>" + NL + "<DD><DL>" + NL + "<DT><STRONG>Parameters:" +
+-                 "</STRONG></DT><DD><CODE>undecorated</CODE> - <code>true</code>" +
++        {BUG_ID + FS + "pkg1" + FS + "package-summary.html", "<dl>" +
++                 "<dt><span class=\"strong\">Since:</span></dt>" + NL +
++                 "  <dd>JDK1.0</dd></dl>"},
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl><dt><span class=\"strong\">Since:</span>" +
++                 "</dt>" + NL + "  <dd>JDK1.0</dd>" + NL + "<dt><span class=\"strong\">See Also:" +
++                 "</span></dt><dd><a href=\"../pkg1/C2.html\" title=\"class in pkg1\">" +
++                 "<code>C2</code></a>, " + NL + "<a href=\"../serialized-form.html#pkg1.C1\">" +
++                 "Serialized Form</a></dd></dl>"},
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl><dt><span class=\"strong\">Parameters:" +
++                 "</span></dt><dd><code>title</code> - the title</dd><dd><code>" +
++                 "test</code> - boolean value</dd>" + NL + "<dt><span class=\"strong\">Throws:" +
++                 "</span></dt>" + NL + "<dd><code>java.lang.IllegalArgumentException" +
++                 "</code> - if the <code>owner</code>'s" + NL + "     <code>GraphicsConfiguration" +
++                 "</code> is not from a screen device</dd>" + NL + "<dd><code>" +
++                 "HeadlessException</code></dd></dl>"},
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl><dt><span class=\"strong\">Parameters:" +
++                 "</span></dt><dd><code>undecorated</code> - <code>true</code>" +
+                  " if no decorations are" + NL + "         to be enabled;" + NL +
+                  "         <code>false</code> if decorations are to be enabled." +
+-                 "</DD><DT><STRONG>Since:</STRONG></DT>" + NL +
+-                 "  <DD>1.4</DD>" + NL + "<DT><STRONG>See Also:</STRONG></DT>" +
+-                 "<DD><A HREF=\"../pkg1/C1.html#readObject()\"><CODE>" +
+-                 "readObject()</CODE></A></DD></DL>" + NL + "</DD>" + NL +
+-                 "</DL>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<DL>" + NL + "<DD><DL>" + NL +
+-                 "<DT><STRONG>Throws:</STRONG></DT>" + NL + "<DD><CODE>" +
+-                 "java.io.IOException</CODE></DD><DT><STRONG>See Also:" +
+-                 "</STRONG></DT><DD>" +
+-                 "<A HREF=\"../pkg1/C1.html#setUndecorated(boolean)\">" +
+-                 "<CODE>setUndecorated(boolean)</CODE></A></DD></DL>" + NL +
+-                 "</DD>" + NL + "</DL>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C1.ModalExclusionType.html", "<DL>" + NL +
+-                 "<DD>No modal exclusion." + NL + "<P>" + NL +"</DD>" + NL +
+-                 "</DL>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C2.html", "<DL>" + NL + "<DD>Constructor." + NL +
+-                 "<P>" + NL +"</DD>" + NL + "</DL>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C3.html", "<DL>" + NL + "<DD>Comment." + NL +
+-                 "<P>" + NL + "</DD>" + NL + "</DL>"},
+-        {BUG_ID + FS + "serialized-form.html", "<DL>" + NL + "<DD><DL>" + NL +
+-                 "<DT><STRONG>Throws:</STRONG></DT>" + NL + "<DD><CODE>" +
+-                 "java.io.IOException</CODE></DD><DT><STRONG>See Also:</STRONG>" +
+-                 "</DT><DD><A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+-                 "<CODE>C1.setUndecorated(boolean)</CODE></A></DD></DL>" + NL +
+-                 "</DD>" + 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>" +
+-                 "<DD>This field indicates whether the C1 is undecorated." + NL +
+-                 "<P>" + NL + "</DD>" + NL + "<DD> </DD>" + NL +
+-                 "<DD><DL>" + NL + "<DT><STRONG>Since:</STRONG></DT>" + NL +
+-                 "  <DD>1.4</DD>" + NL + "<DT><STRONG>See Also:</STRONG>" +
+-                 "</DT><DD><A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+-                 "<CODE>C1.setUndecorated(boolean)</CODE></A></DD></DL>" + NL +
+-                 "</DD>" + 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><DD>Reads the object stream." + NL + "<P>" + NL +
+-                 "</DD>" + NL + "<DD><DL>" + NL + "<DT><STRONG>Throws:" +
+-                 "</STRONG></DT>" + NL + "<DD><CODE><code>" +
+-                 "IOException</code></CODE></DD>" + NL +
+-                 "<DD><CODE>java.io.IOException</CODE></DD></DL>" + NL +
+-                 "</DD>" + NL + "</DL>"},
+-        {BUG_ID + FS + "serialized-form.html", "<DL>" + NL +
+-                 "<DD><STRONG>Deprecated.</STRONG> </DD><DD>" +
+-                 "The name for this class." + NL + "<P>" + NL + "</DD>" + NL +
+-                 "<DD> </DD>" + NL + "</DL>"}};
++                 "</dd><dt><span class=\"strong\">Since:</span></dt>" + NL + "  <dd>1.4</dd>" + NL +
++                 "<dt><span class=\"strong\">See Also:</span></dt><dd><a href=\"../pkg1/C1.html#readObject()\">" +
++                 "<code>readObject()</code></a></dd></dl>"},
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl><dt><span class=\"strong\">Throws:</span>" +
++                 "</dt>" + NL + "<dd><code>java.io.IOException</code></dd><dt>" +
++                 "<span class=\"strong\">See Also:</span></dt><dd><a href=\"../pkg1/C1.html#setUndecorated(boolean)\">" +
++                 "<code>setUndecorated(boolean)</code></a></dd></dl>"},
++        {BUG_ID + FS + "serialized-form.html", "<dl><dt><span class=\"strong\">Throws:</span>" +
++                 "</dt>" + NL + "<dd><code>" +
++                 "java.io.IOException</code></dd><dt><span class=\"strong\">See Also:</span>" +
++                 "</dt><dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
++                 "<code>C1.setUndecorated(boolean)</code></a></dd></dl>"},
++        {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
++                 " <i>As of JDK version 1.5, replaced by" + NL +
++                 " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
++                 "<code>setUndecorated(boolean)</code></a>.</i></div>" + NL +
++                 "<div class=\"block\">This field indicates whether the C1 is " +
++                 "undecorated.</div>" + NL + " " + NL + "<dl><dt><span class=\"strong\">Since:</span></dt>" + NL +
++                 "  <dd>1.4</dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" +
++                 "</dt><dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
++                 "<code>C1.setUndecorated(boolean)</code></a></dd></dl>"},
++        {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
++                 " <i>As of JDK version 1.5, replaced by" + NL +
++                 " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
++                 "<code>setUndecorated(boolean)</code></a>.</i></div>" + NL +
++                 "<div class=\"block\">Reads the object stream.</div>" + NL +
++                 "<dl><dt><span class=\"strong\">Throws:" +
++                 "</span></dt>" + NL + "<dd><code><code>" +
++                 "IOException</code></code></dd>" + NL +
++                 "<dd><code>java.io.IOException</code></dd></dl>"},
++        {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
++                 " </div>" + NL + "<div class=\"block\">" +
++                 "The name for this class.</div>"}};
+ 
+     // Test with -nocomment and -nodeprecated options. The ClassDocs whould
+-    // not display definition lists for any member details. The serialized
+-    // form should display properly nested definition list tags for
+-    // deprecated information only.
++    // not display definition lists for any member details.
+     private static final String[][] TEST_NOCMNT_NODEPR = {
+-        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<PRE>" + NL + "public void " +
+-                 "<STRONG>readObject</STRONG>()" + NL + "                throws" +
+-                 " java.io.IOException</PRE>" + NL + "<HR>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C2.html", "<PRE>" +NL + "public <STRONG>" +
+-                 "C2</STRONG>()</PRE>" + NL + "<HR>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C1.ModalExclusionType.html", "<PRE>" + NL +
+-                 "public static final " +
+-                 "<A HREF=\"../pkg1/C1.ModalExclusionType.html\" " +
+-                 "title=\"enum in pkg1\">C1.ModalExclusionType</A> <STRONG>" +
+-                 "APPLICATION_EXCLUDE</STRONG></PRE>" + NL + "<HR>"},
+-        {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></DD></DL>"},
+-        {BUG_ID + FS + "serialized-form.html", "<DL>" + NL + "<DD><STRONG>" +
+-                 "Deprecated.</STRONG> <I>As of JDK version" +
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<pre>public void readObject()" + NL +
++                 "                throws java.io.IOException</pre>" + NL + "</li>"},
++        {BUG_ID + FS + "pkg1" + FS + "C2.html", "<pre>public C2()</pre>" + NL +
++                 "</li>"},
++        {BUG_ID + FS + "pkg1" + FS + "C1.ModalExclusionType.html", "<pre>public " +
++                 "static final <a href=\"../pkg1/C1.ModalExclusionType.html\" " +
++                 "title=\"enum in pkg1\">C1.ModalExclusionType</a> " +
++                 "APPLICATION_EXCLUDE</pre>" + NL + "</li>"},
++        {BUG_ID + FS + "serialized-form.html", "<pre>boolean " +
++                 "undecorated</pre>" + NL + "<div class=\"block\"><span class=\"strong\">" +
++                 "Deprecated.</span> <i>As of JDK version 1.5, replaced by" + NL +
++                 " <a href=\"pkg1/C1.html#setUndecorated(boolean)\"><code>" +
++                 "setUndecorated(boolean)</code></a>.</i></div>" + NL + "</li>"},
++        {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">" +
++                 "Deprecated.</span> <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></DL>"},
+-        {BUG_ID + FS + "serialized-form.html", "<PRE>" + NL + "int <STRONG>" +
+-                 "publicKey</STRONG></PRE>" + NL + "<DL>" + NL + "<DD><STRONG>" +
+-                 "Deprecated.</STRONG> </DD></DL>"}};
++                 " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
++                 "<code>setUndecorated(boolean)</code></a>.</i></div>" + NL + "</li>"}};
+ 
+     // Test for valid HTML generation which should not comprise of empty
+     // definition list tags.
+     private static final String[][] NEGATED_TEST = {
+-        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<DL></DL>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<DL>" + NL + "</DL>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C1.ModalExclusionType.html", "<DL></DL>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C1.ModalExclusionType.html", "<DL>" + NL + "</DL>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C2.html", "<DL></DL>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C2.html", "<DL>" + NL + "</DL>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C2.ModalType.html", "<DL></DL>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C2.ModalType.html", "<DL>" + NL + "</DL>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C3.html", "<DL></DL>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C3.html", "<DL>" + NL + "</DL>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C4.html", "<DL></DL>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C4.html", "<DL>" + NL + "</DL>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C5.html", "<DL></DL>"},
+-        {BUG_ID + FS + "pkg1" + FS + "C5.html", "<DL>" + NL + "</DL>"},
+-        {BUG_ID + FS + "overview-tree.html", "<DL></DL>"},
+-        {BUG_ID + FS + "overview-tree.html", "<DL>" + NL + "</DL>"},
+-        {BUG_ID + FS + "serialized-form.html", "<DL></DL>"},
+-        {BUG_ID + FS + "serialized-form.html", "<DL>" + NL + "</DL>"}};
++        {BUG_ID + FS + "pkg1" + FS + "package-summary.html", "<dl></dl>"},
++        {BUG_ID + FS + "pkg1" + FS + "package-summary.html", "<dl>" + NL + "</dl>"},
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl></dl>"},
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>" + NL + "</dl>"},
++        {BUG_ID + FS + "pkg1" + FS + "C1.ModalExclusionType.html", "<dl></dl>"},
++        {BUG_ID + FS + "pkg1" + FS + "C1.ModalExclusionType.html", "<dl>" + NL + "</dl>"},
++        {BUG_ID + FS + "pkg1" + FS + "C2.html", "<dl></dl>"},
++        {BUG_ID + FS + "pkg1" + FS + "C2.html", "<dl>" + NL + "</dl>"},
++        {BUG_ID + FS + "pkg1" + FS + "C2.ModalType.html", "<dl></dl>"},
++        {BUG_ID + FS + "pkg1" + FS + "C2.ModalType.html", "<dl>" + NL + "</dl>"},
++        {BUG_ID + FS + "pkg1" + FS + "C3.html", "<dl></dl>"},
++        {BUG_ID + FS + "pkg1" + FS + "C3.html", "<dl>" + NL + "</dl>"},
++        {BUG_ID + FS + "pkg1" + FS + "C4.html", "<dl></dl>"},
++        {BUG_ID + FS + "pkg1" + FS + "C4.html", "<dl>" + NL + "</dl>"},
++        {BUG_ID + FS + "pkg1" + FS + "C5.html", "<dl></dl>"},
++        {BUG_ID + FS + "pkg1" + FS + "C5.html", "<dl>" + NL + "</dl>"},
++        {BUG_ID + FS + "overview-tree.html", "<dl></dl>"},
++        {BUG_ID + FS + "overview-tree.html", "<dl>" + NL + "</dl>"},
++        {BUG_ID + FS + "serialized-form.html", "<dl></dl>"},
++        {BUG_ID + FS + "serialized-form.html", "<dl>" + NL + "</dl>"}};
+ 
+     private static final String[] ARGS1 =
+         new String[] {
+@@ -346,7 +245,7 @@
+         run(tester, ARGS1, TEST_ALL, NEGATED_TEST);
+         run(tester, ARGS1, TEST_CMNT_DEPR, NEGATED_TEST);
+         run(tester, ARGS2, TEST_ALL, NEGATED_TEST);
+-        run(tester, ARGS2, TEST_NOCMNT, TEST_CMNT_DEPR);
++        run(tester, ARGS2, NO_TEST, TEST_CMNT_DEPR);
+         run(tester, ARGS3, TEST_ALL, NEGATED_TEST);
+         run(tester, ARGS3, TEST_NODEPR, TEST_NOCMNT_NODEPR);
+         run(tester, ARGS4, TEST_ALL, NEGATED_TEST);
+diff --git a/test/com/sun/javadoc/testHtmlDocument/TestHtmlDocument.java b/test/com/sun/javadoc/testHtmlDocument/TestHtmlDocument.java
+new file mode 100644
+--- /dev/null
++++ langtools/test/com/sun/javadoc/testHtmlDocument/TestHtmlDocument.java
+@@ -0,0 +1,155 @@
++/*
++ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute 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.
++ */
++
++/*
++ * @test
++ * @bug 6851834
++ * @summary This test verifies the HTML document generation for javadoc output.
++ * @author Bhavesh Patel
++ * @build TestHtmlDocument
++ * @run main TestHtmlDocument
++ */
++
++import java.io.*;
++import com.sun.tools.doclets.formats.html.markup.*;
++
++/**
++ * The class reads each file, complete with newlines, into a string to easily
++ * compare the existing markup with the generated markup.
++ */
++public class TestHtmlDocument {
++
++    private static final String BUGID = "6851834";
++    private static final String BUGNAME = "TestHtmlDocument";
++    private static final String FS = System.getProperty("file.separator");
++    private static String srcdir = System.getProperty("test.src", ".");
++
++    // Entry point
++    public static void main(String[] args) throws IOException {
++        // Check whether the generated markup is same as the existing markup.
++        if (generateHtmlTree().equals(readFileToString(srcdir + FS + "testMarkup.html"))) {
++            System.out.println("\nTest passed for bug " + BUGID + " (" + BUGNAME + ")\n");
++        } else {
++            throw new Error("\nTest failed for bug " + BUGID + " (" + BUGNAME + ")\n");
++        }
++    }
++
++    // Generate the HTML output using the HTML document generation within doclet.
++    public static String generateHtmlTree() {
++        // Document type for the HTML document
++        DocType htmlDocType = DocType.Transitional();
++        HtmlTree html = new HtmlTree(HtmlTag.HTML);
++        HtmlTree head = new HtmlTree(HtmlTag.HEAD);
++        HtmlTree title = new HtmlTree(HtmlTag.TITLE);
++        // String content within the document
++        StringContent titleContent = new StringContent("Markup test");
++        title.addContent(titleContent);
++        head.addContent(title);
++        // Test META tag
++        HtmlTree meta = new HtmlTree(HtmlTag.META);
++        meta.addAttr(HtmlAttr.NAME, "keywords");
++        meta.addAttr(HtmlAttr.CONTENT, "testContent");
++        head.addContent(meta);
++        // Test invalid META tag
++        HtmlTree invmeta = new HtmlTree(HtmlTag.META);
++        head.addContent(invmeta);
++        // Test LINK tag
++        HtmlTree link = new HtmlTree(HtmlTag.LINK);
++        link.addAttr(HtmlAttr.REL, "testRel");
++        link.addAttr(HtmlAttr.HREF, "testLink.html");
++        head.addContent(link);
++        // Test invalid LINK tag
++        HtmlTree invlink = new HtmlTree(HtmlTag.LINK);
++        head.addContent(invlink);
++        html.addContent(head);
++        // Comment within the document
++        Comment bodyMarker = new Comment("======== START OF BODY ========");
++        html.addContent(bodyMarker);
++        HtmlTree body = new HtmlTree(HtmlTag.BODY);
++        Comment pMarker = new Comment("======== START OF PARAGRAPH ========");
++        body.addContent(pMarker);
++        HtmlTree p = new HtmlTree(HtmlTag.P);
++        StringContent bodyContent = new StringContent(
++                "This document is generated from sample source code and HTML " +
++                "files with examples of a wide variety of Java language constructs: packages, " +
++                "subclasses, subinterfaces, nested classes, nested interfaces," +
++                "inheriting from other packages, constructors, fields," +
++                "methods, and so forth. ");
++        p.addContent(bodyContent);
++        StringContent anchorContent = new StringContent("Click Here");
++        p.addContent(HtmlTree.A("testLink.html", anchorContent));
++        StringContent pContent = new StringContent(" to <test> out a link.");
++        p.addContent(pContent);
++        body.addContent(p);
++        HtmlTree p1 = new HtmlTree(HtmlTag.P);
++        // Test another version of A tag.
++        HtmlTree anchor = new HtmlTree(HtmlTag.A);
++        anchor.addAttr(HtmlAttr.HREF, "testLink.html");
++        anchor.addAttr(HtmlAttr.NAME, "Another version of a tag");
++        p1.addContent(anchor);
++        body.addContent(p1);
++        // Test for empty tags.
++        HtmlTree dl = new HtmlTree(HtmlTag.DL);
++        html.addContent(dl);
++        // Test for empty nested tags.
++        HtmlTree dlTree = new HtmlTree(HtmlTag.DL);
++        dlTree.addContent(new HtmlTree(HtmlTag.DT));
++        dlTree.addContent(new HtmlTree (HtmlTag.DD));
++        html.addContent(dlTree);
++        HtmlTree dlDisplay = new HtmlTree(HtmlTag.DL);
++        dlDisplay.addContent(new HtmlTree(HtmlTag.DT));
++        HtmlTree dd = new HtmlTree (HtmlTag.DD);
++        StringContent ddContent = new StringContent("Test DD");
++        dd.addContent(ddContent);
++        dlDisplay.addContent(dd);
++        body.addContent(dlDisplay);
++        StringContent emptyString = new StringContent("");
++        body.addContent(emptyString);
++        Comment emptyComment = new Comment("");
++        body.addContent(emptyComment);
++        HtmlTree hr = new HtmlTree(HtmlTag.HR);
++        body.addContent(hr);
++        html.addContent(body);
++        HtmlDocument htmlDoc = new HtmlDocument(htmlDocType, html);
++        return htmlDoc.toString();
++    }
++
++    // Read the file into a String
++    public static String readFileToString(String filename) throws IOException {
++        File file = new File(filename);
++        if ( !file.exists() ) {
++            System.out.println("\nFILE DOES NOT EXIST: " + filename);
++        }
++        BufferedReader in = new BufferedReader(new FileReader(file));
++        // 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;
++    }
++}
+diff --git a/test/com/sun/javadoc/testHtmlDocument/testLink.html b/test/com/sun/javadoc/testHtmlDocument/testLink.html
+new file mode 100644
+--- /dev/null
++++ langtools/test/com/sun/javadoc/testHtmlDocument/testLink.html
+@@ -0,0 +1,9 @@
++<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
++<html>
++<head>
++<title>Markup test</title>
++</head>
++<body>
++This is a test for link.
++</body>
++</html>
+diff --git a/test/com/sun/javadoc/testHtmlDocument/testMarkup.html b/test/com/sun/javadoc/testHtmlDocument/testMarkup.html
+new file mode 100644
+--- /dev/null
++++ langtools/test/com/sun/javadoc/testHtmlDocument/testMarkup.html
+@@ -0,0 +1,18 @@
++<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
++<html>
++<head>
++<title>Markup test</title>
++<meta name="keywords" content="testContent">
++<link rel="testRel" href="testLink.html">
++</head>
++<!-- ======== START OF BODY ======== -->
++<body>
++<!-- ======== START OF PARAGRAPH ======== -->
++<p>This document is generated from sample source code and HTML files with examples of a wide variety of Java language constructs: packages, subclasses, subinterfaces, nested classes, nested interfaces,inheriting from other packages, constructors, fields,methods, and so forth. <a href="testLink.html">Click Here</a> to <test> out a link.</p>
++<p><a href="testLink.html" name="Another version of a tag"></a></p>
++<dl>
++<dd>Test DD</dd>
++</dl>
++<hr>
++</body>
++</html>
+diff --git a/test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java b/test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java
+--- langtools/test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java
++++ langtools/test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java
+@@ -38,7 +38,7 @@
+ 
+     private static final String BUG_ID = "6786028";
+     private static final String[][] TEST1 = {
+-        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<STRONG>See Also:</STRONG>"}};
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<span class=\"strong\">See Also:</span>"}};
+     private static final String[][] NEGATED_TEST1 = {
+         {BUG_ID + FS + "pkg1" + FS + "C1.html", "<STRONG>Method Summary</STRONG>"},
+         {BUG_ID + FS + "pkg1" + FS + "C1.html", "<B>"},
+diff --git a/test/com/sun/javadoc/testHtmlTableTags/TestHtmlTableTags.java b/test/com/sun/javadoc/testHtmlTableTags/TestHtmlTableTags.java
+--- langtools/test/com/sun/javadoc/testHtmlTableTags/TestHtmlTableTags.java
++++ langtools/test/com/sun/javadoc/testHtmlTableTags/TestHtmlTableTags.java
+@@ -50,139 +50,128 @@
+ 
+         //Package summary
+         {BUG_ID + FS + "pkg1" + FS + "package-summary.html",
+-            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
+-            "CELLSPACING=\"0\" SUMMARY=\"Class Summary table, " +
++            "<table class=\"packageSummary\" border=\"0\" cellpadding=\"3\"" +
++            " cellspacing=\"0\" summary=\"Class Summary table, " +
+             "listing classes, and an explanation\">"
+         },
+         {BUG_ID + FS + "pkg1" + FS + "package-summary.html",
+-            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
+-            "CELLSPACING=\"0\" SUMMARY=\"Interface Summary table, " +
++            "<table class=\"packageSummary\" border=\"0\" cellpadding=\"3\"" +
++            " cellspacing=\"0\" summary=\"Interface Summary table, " +
+             "listing interfaces, and an explanation\">"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "package-summary.html",
+-            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
+-            "CELLSPACING=\"0\" SUMMARY=\"Enum Summary table, " +
++            "<table class=\"packageSummary\" border=\"0\" cellpadding=\"3\"" +
++            " cellspacing=\"0\" summary=\"Enum Summary table, " +
+             "listing enums, and an explanation\">"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "package-summary.html",
+-            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
+-            "CELLSPACING=\"0\" SUMMARY=\"Annotation Types Summary table, " +
++            "<table class=\"packageSummary\" border=\"0\" cellpadding=\"3\"" +
++            " cellspacing=\"0\" summary=\"Annotation Types Summary table, " +
+             "listing annotation types, and an explanation\">"
+         },
+         // Class documentation
+         {BUG_ID + FS + "pkg1" + FS + "C1.html",
+-            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
+-            "CELLSPACING=\"0\" SUMMARY=\"Field Summary table, " +
+-            "listing fields, and an explanation\">"
++            "<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" " +
++            "cellspacing=\"0\" summary=\"Field Summary table, listing fields, " +
++            "and an explanation\">"
+         },
+         {BUG_ID + FS + "pkg1" + FS + "C1.html",
+-            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
+-            "CELLSPACING=\"0\" SUMMARY=\"Method Summary table, " +
+-            "listing methods, and an explanation\">"
++            "<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" " +
++            "cellspacing=\"0\" summary=\"Method Summary table, listing methods, " +
++            "and an explanation\">"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "C2.html",
+-            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
+-            "CELLSPACING=\"0\" SUMMARY=\"Nested Class Summary table, " +
+-            "listing nested classes, and an explanation\">"
++            "<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" " +
++            "cellspacing=\"0\" summary=\"Nested Class Summary table, listing " +
++            "nested classes, and an explanation\">"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "C2.html",
+-            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
+-            "CELLSPACING=\"0\" SUMMARY=\"Constructor Summary table, " +
+-            "listing constructors, and an explanation\">"
++            "<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" " +
++            "cellspacing=\"0\" summary=\"Constructor Summary table, listing " +
++            "constructors, and an explanation\">"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "C2.ModalExclusionType.html",
+-            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
+-            "CELLSPACING=\"0\" SUMMARY=\"Enum Constant Summary table, " +
+-            "listing enum constants, and an explanation\">"
++            "<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" " +
++            "cellspacing=\"0\" summary=\"Enum Constant Summary table, listing " +
++            "enum constants, and an explanation\">"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "C3.html",
+-            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
+-            "CELLSPACING=\"0\" SUMMARY=\"Required Element Summary table, " +
++            "<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" " +
++            "cellspacing=\"0\" summary=\"Required Element Summary table, " +
+             "listing required elements, and an explanation\">"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "C4.html",
+-            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
+-            "CELLSPACING=\"0\" SUMMARY=\"Optional Element Summary table, " +
++            "<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" " +
++            "cellspacing=\"0\" summary=\"Optional Element Summary table, " +
+             "listing optional elements, and an explanation\">"
+         },
+         // Class use documentation
+         {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "I1.html",
+-            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
+-            "CELLSPACING=\"0\" SUMMARY=\"Use table, " +
+-            "listing packages, and an explanation\">"
++            "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
++            "table, listing packages, and an explanation\">"
+         },
+         {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html",
+-            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
+-            "CELLSPACING=\"0\" SUMMARY=\"Use table, " +
+-            "listing fields, and an explanation\">"
++            "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
++            "table, listing fields, and an explanation\">"
+         },
+         {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html",
+-            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
+-            "CELLSPACING=\"0\" SUMMARY=\"Use table, " +
+-            "listing methods, and an explanation\">"
++            "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
++            "table, listing methods, and an explanation\">"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.html",
+-            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
+-            "CELLSPACING=\"0\" SUMMARY=\"Use table, " +
+-            "listing fields, and an explanation\">"
++            "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
++            "table, listing fields, and an explanation\">"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.html",
+-            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
+-            "CELLSPACING=\"0\" SUMMARY=\"Use table, " +
+-            "listing methods, and an explanation\">"
++            "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
++            "table, listing methods, and an explanation\">"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.ModalExclusionType.html",
+-            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
+-            "CELLSPACING=\"0\" SUMMARY=\"Use table, " +
+-            "listing packages, and an explanation\">"
++            "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
++            "table, listing packages, and an explanation\">"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.ModalExclusionType.html",
+-            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
+-            "CELLSPACING=\"0\" SUMMARY=\"Use table, " +
+-            "listing methods, and an explanation\">"
++            "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
++            "table, listing methods, and an explanation\">"
+         },
+         // Package use documentation
+         {BUG_ID + FS + "pkg1" + FS + "package-use.html",
+-            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
+-            "CELLSPACING=\"0\" SUMMARY=\"Use table, " +
+-            "listing packages, and an explanation\">"
++            "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
++            "table, listing packages, and an explanation\">"
+         },
+         {BUG_ID + FS + "pkg1" + FS + "package-use.html",
+-            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
+-            "CELLSPACING=\"0\" SUMMARY=\"Use table, " +
+-            "listing classes, and an explanation\">"
++            "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
++            "table, listing classes, and an explanation\">"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "package-use.html",
+-            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
+-            "CELLSPACING=\"0\" SUMMARY=\"Use table, " +
+-            "listing packages, and an explanation\">"
++            "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
++            "table, listing packages, and an explanation\">"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "package-use.html",
+-            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
+-            "CELLSPACING=\"0\" SUMMARY=\"Use table, " +
+-            "listing classes, and an explanation\">"
++            "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
++            "table, listing classes, and an explanation\">"
+         },
+         // Deprecated
+         {BUG_ID + FS + "deprecated-list.html",
+-            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
+-            "CELLSPACING=\"0\" SUMMARY=\"Deprecated Fields table, " +
+-            "listing deprecated fields, and an explanation\">"
++            "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" " +
++            "summary=\"Deprecated Fields table, listing deprecated fields, " +
++            "and an explanation\">"
+         },
+         {BUG_ID + FS + "deprecated-list.html",
+-            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
+-            "CELLSPACING=\"0\" SUMMARY=\"Deprecated Methods table, " +
+-            "listing deprecated methods, and an explanation\">"
++            "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" " +
++            "summary=\"Deprecated Methods table, listing deprecated methods, " +
++            "and an explanation\">"
+         },
+         // Constant values
+         {BUG_ID + FS + "constant-values.html",
+-            "<TABLE BORDER=\"1\" CELLPADDING=\"3\" CELLSPACING=\"0\" " +
+-            "SUMMARY=\"Constant Field Values table, listing " +
++            "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" " +
++            "summary=\"Constant Field Values table, listing " +
+             "constant fields, and values\">"
+         },
+         // Overview Summary
+         {BUG_ID + FS + "overview-summary.html",
+-            "<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" " +
+-            "CELLSPACING=\"0\" SUMMARY=\"Packages table, " +
++            "<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" " +
++            "cellspacing=\"0\" summary=\"Packages table, " +
+             "listing packages, and an explanation\">"
+         },
+ 
+@@ -192,125 +181,117 @@
+ 
+         //Package summary
+         {BUG_ID + FS + "pkg1" + FS + "package-summary.html",
+-            "<CAPTION CLASS=\"TableCaption\">" + NL +
+-            "Class Summary</CAPTION>"
++            "<caption><span>Class Summary</span><span class=\"tabEnd\">" +
++            " </span></caption>"
+         },
+         {BUG_ID + FS + "pkg1" + FS + "package-summary.html",
+-            "<CAPTION CLASS=\"TableCaption\">" + NL +
+-            "Interface Summary</CAPTION>"
++            "<caption><span>Interface Summary</span><span class=\"tabEnd\">" +
++            " </span></caption>"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "package-summary.html",
+-            "<CAPTION CLASS=\"TableCaption\">" + NL +
+-            "Enum Summary</CAPTION>"
++            "<caption><span>Enum Summary</span><span class=\"tabEnd\">" +
++            " </span></caption>"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "package-summary.html",
+-            "<CAPTION CLASS=\"TableCaption\">" + NL +
+-            "Annotation Types Summary</CAPTION>"
++            "<caption><span>Annotation Types Summary</span><span class=\"tabEnd\">" +
++            " </span></caption>"
+         },
+         // Class documentation
+         {BUG_ID + FS + "pkg1" + FS + "C1.html",
+-            "<CAPTION CLASS=\"TableCaption\">" + NL +
+-            "Field Summary</CAPTION>"
++            "<caption><span>Fields</span><span class=\"tabEnd\"> </span></caption>"
+         },
+         {BUG_ID + FS + "pkg1" + FS + "C1.html",
+-            "<CAPTION CLASS=\"TableCaption\">" + NL +
+-            "Method Summary</CAPTION>"
++            "<caption><span>Methods</span><span class=\"tabEnd\"> </span></caption>"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "C2.html",
+-            "<CAPTION CLASS=\"TableCaption\">" + NL +
+-            "Nested Class Summary</CAPTION>"
++            "<caption><span>Nested Classes</span><span class=\"tabEnd\"> </span></caption>"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "C2.html",
+-            "<CAPTION CLASS=\"TableCaption\">" + NL +
+-            "Constructor Summary</CAPTION>"
++            "<caption><span>Constructors</span><span class=\"tabEnd\"> </span></caption>"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "C2.ModalExclusionType.html",
+-            "<CAPTION CLASS=\"TableCaption\">" + NL +
+-            "Enum Constant Summary</CAPTION>"
++            "<caption><span>Enum Constants</span><span class=\"tabEnd\"> </span></caption>"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "C3.html",
+-            "<CAPTION CLASS=\"TableCaption\">" + NL +
+-            "Required Element Summary</CAPTION>"
++            "<caption><span>Required Elements</span><span class=\"tabEnd\"> " +
++            "</span></caption>"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "C4.html",
+-            "<CAPTION CLASS=\"TableCaption\">" + NL +
+-            "Optional Element Summary</CAPTION>"
++            "<caption><span>Optional Elements</span><span class=\"tabEnd\"> " +
++            "</span></caption>"
+         },
+         // Class use documentation
+         {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "I1.html",
+-            "<CAPTION CLASS=\"TableCaption\">" + NL +
+-            "Packages that use <A HREF=\"../../pkg1/I1.html\" " +
+-            "title=\"interface in pkg1\">I1</A></CAPTION>"
++            "<caption><span>Packages that use <a href=\"../../pkg1/I1.html\" " +
++            "title=\"interface in pkg1\">I1</a></span><span class=\"tabEnd\">" +
++            " </span></caption>"
+         },
+         {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html",
+-            "<CAPTION CLASS=\"TableSubCaption\">" + NL +
+-            "Fields in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> " +
+-            "declared as <A HREF=\"../../pkg1/C1.html\" title=\"class in pkg1\">" +
+-            "C1</A></CAPTION>"
++            "<caption><span>Fields in <a href=\"../../pkg2/package-summary.html\">" +
++            "pkg2</a> declared as <a href=\"../../pkg1/C1.html\" " +
++            "title=\"class in pkg1\">C1</a></span><span class=\"tabEnd\"> " +
++            "</span></caption>"
+         },
+         {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html",
+-            "<CAPTION CLASS=\"TableSubCaption\">" + NL +
+-            "Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> " +
+-            "with parameters of type <A HREF=\"../../pkg1/C1.html\" " +
+-            "title=\"class in pkg1\">C1</A></CAPTION>"
++            "<caption><span>Methods in <a href=\"../../pkg2/package-summary.html\">" +
++            "pkg2</a> that return <a href=\"../../pkg1/C1.html\" " +
++            "title=\"class in pkg1\">C1</a></span><span class=\"tabEnd\">" +
++            " </span></caption>"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.html",
+-            "<CAPTION CLASS=\"TableSubCaption\">" + NL +
+-            "Fields in <A HREF=\"../../pkg1/package-summary.html\">pkg1</A> " +
+-            "declared as <A HREF=\"../../pkg2/C2.html\" title=\"class in pkg2\">" +
+-            "C2</A></CAPTION>"
++            "<caption><span>Fields in <a href=\"../../pkg1/package-summary.html\">" +
++            "pkg1</a> declared as <a href=\"../../pkg2/C2.html\" " +
++            "title=\"class in pkg2\">C2</a></span><span class=\"tabEnd\">" +
++            " </span></caption>"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.html",
+-            "<CAPTION CLASS=\"TableSubCaption\">" + NL +
+-            "Methods in <A HREF=\"../../pkg1/package-summary.html\">pkg1</A> " +
+-            "with parameters of type <A HREF=\"../../pkg2/C2.html\" " +
+-            "title=\"class in pkg2\">C2</A></CAPTION>"
++            "<caption><span>Methods in <a href=\"../../pkg1/package-summary.html\">" +
++            "pkg1</a> that return <a href=\"../../pkg2/C2.html\" " +
++            "title=\"class in pkg2\">C2</a></span><span class=\"tabEnd\">" +
++            " </span></caption>"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.ModalExclusionType.html",
+-            "<CAPTION CLASS=\"TableSubCaption\">" + NL +
+-            "Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> " +
+-            "that return <A HREF=\"../../pkg2/C2.ModalExclusionType.html\" " +
+-            "title=\"enum in pkg2\">C2.ModalExclusionType</A></CAPTION>"
++            "<caption><span>Methods in <a href=\"../../pkg2/package-summary.html\">" +
++            "pkg2</a> that return <a href=\"../../pkg2/C2.ModalExclusionType.html\" " +
++            "title=\"enum in pkg2\">C2.ModalExclusionType</a></span>" +
++            "<span class=\"tabEnd\"> </span></caption>"
+         },
+         // Package use documentation
+         {BUG_ID + FS + "pkg1" + FS + "package-use.html",
+-            "<CAPTION CLASS=\"TableCaption\">" + NL +
+-            "Packages that use <A HREF=\"../pkg1/package-summary.html\">" +
+-            "pkg1</A></CAPTION>"
++            "<caption><span>Packages that use <a href=\"../pkg1/package-summary.html\">" +
++            "pkg1</a></span><span class=\"tabEnd\"> </span></caption>"
+         },
+         {BUG_ID + FS + "pkg1" + FS + "package-use.html",
+-            "<CAPTION CLASS=\"TableCaption\">" + NL +
+-            "Classes in <A HREF=\"../pkg1/package-summary.html\">pkg1</A> " +
+-            "used by <A HREF=\"../pkg1/package-summary.html\">pkg1</A></CAPTION>"
++            "<caption><span>Classes in <a href=\"../pkg1/package-summary.html\">" +
++            "pkg1</a> used by <a href=\"../pkg1/package-summary.html\">pkg1</a>" +
++            "</span><span class=\"tabEnd\"> </span></caption>"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "package-use.html",
+-            "<CAPTION CLASS=\"TableCaption\">" + NL +
+-            "Packages that use <A HREF=\"../pkg2/package-summary.html\">" +
+-            "pkg2</A></CAPTION>"
++            "<caption><span>Packages that use <a href=\"../pkg2/package-summary.html\">" +
++            "pkg2</a></span><span class=\"tabEnd\"> </span></caption>"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "package-use.html",
+-            "<CAPTION CLASS=\"TableCaption\">" + NL +
+-            "Classes in <A HREF=\"../pkg2/package-summary.html\">pkg2</A> " +
+-            "used by <A HREF=\"../pkg1/package-summary.html\">pkg1</A></CAPTION>"
++            "<caption><span>Classes in <a href=\"../pkg2/package-summary.html\">" +
++            "pkg2</a> used by <a href=\"../pkg1/package-summary.html\">pkg1</a>" +
++            "</span><span class=\"tabEnd\"> </span></caption>"
+         },
+         // Deprecated
+         {BUG_ID + FS + "deprecated-list.html",
+-            "<CAPTION CLASS=\"TableCaption\">" + NL +
+-            "Deprecated Fields</CAPTION>"
++            "<caption><span>Deprecated Fields</span><span class=\"tabEnd\">" +
++            " </span></caption>"
+         },
+         {BUG_ID + FS + "deprecated-list.html",
+-            "<CAPTION CLASS=\"TableCaption\">" + NL +
+-            "Deprecated Methods</CAPTION>"
++            "<caption><span>Deprecated Methods</span><span class=\"tabEnd\">" +
++            " </span></caption>"
+         },
+         // Constant values
+         {BUG_ID + FS + "constant-values.html",
+-            "<CAPTION CLASS=\"TableSubCaption\">" + NL +
+-            "pkg1.<A HREF=\"pkg1/C1.html\" title=\"class in pkg1\">C1</A></CAPTION>"
++            "<caption><span>pkg1.<a href=\"pkg1/C1.html\" title=\"class in pkg1\">" +
++            "C1</a></span><span class=\"tabEnd\"> </span></caption>"
+         },
+         // Overview Summary
+         {BUG_ID + FS + "overview-summary.html",
+-            "<CAPTION CLASS=\"TableCaption\">" + NL +
+-            "Packages</CAPTION>"
++            "<caption><span>Packages</span><span class=\"tabEnd\"> </span></caption>"
+         },
+ 
+         /*
+@@ -319,135 +300,115 @@
+ 
+         //Package summary
+         {BUG_ID + FS + "pkg1" + FS + "package-summary.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Class</TH>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
+-            " NOWRAP>Description</TH>"
++            "<th class=\"colFirst\" scope=\"col\">" +
++            "Class</th>" + NL + "<th class=\"colLast\" scope=\"col\"" +
++            ">Description</th>"
+         },
+         {BUG_ID + FS + "pkg1" + FS + "package-summary.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Interface</TH>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
+-            " NOWRAP>Description</TH>"
++            "<th class=\"colFirst\" scope=\"col\">" +
++            "Interface</th>" + NL + "<th class=\"colLast\" scope=\"col\"" +
++            ">Description</th>"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "package-summary.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Enum</TH>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
+-            " NOWRAP>Description</TH>"
++            "<th class=\"colFirst\" scope=\"col\">" +
++            "Enum</th>" + NL + "<th class=\"colLast\" scope=\"col\"" +
++            ">Description</th>"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "package-summary.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Annotation Type</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
+-            " SCOPE=\"col\" NOWRAP>Description</TH>"
++            "<th class=\"colFirst\" scope=\"col\">" +
++            "Annotation Type</th>" + NL + "<th class=\"colLast\"" +
++            " scope=\"col\">Description</th>"
+         },
+         // Class documentation
+         {BUG_ID + FS + "pkg1" + FS + "C1.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Modifier and Type</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
+-            " SCOPE=\"col\" NOWRAP>Field and Description</TH>"
++            "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL +
++            "<th class=\"colLast\" scope=\"col\">Field and Description</th>"
+         },
+         {BUG_ID + FS + "pkg1" + FS + "C1.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Modifier and Type</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
+-            " SCOPE=\"col\" NOWRAP>Method and Description</TH>"
++            "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL +
++            "<th class=\"colLast\" scope=\"col\">Method and Description</th>"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "C2.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Modifier and Type</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
+-            " SCOPE=\"col\" NOWRAP>Class and Description</TH>"
++            "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL +
++            "<th class=\"colLast\" scope=\"col\">Class and Description</th>"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "C2.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Constructor and Description</TH>"
++            "<th class=\"colOne\" scope=\"col\">Constructor and Description</th>"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "C2.ModalExclusionType.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Enum Constant and Description</TH>"
++            "<th class=\"colOne\" scope=\"col\">Enum Constant and Description</th>"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "C3.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Modifier and Type</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
+-            " SCOPE=\"col\" NOWRAP>Required Element and Description</TH>"
++            "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL +
++            "<th class=\"colLast\" scope=\"col\">Required Element and Description</th>"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "C4.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Modifier and Type</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
+-            " SCOPE=\"col\" NOWRAP>Optional Element and Description</TH>"
++            "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL +
++            "<th class=\"colLast\" scope=\"col\">Optional Element and Description</th>"
+         },
+         // Class use documentation
+         {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "I1.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Package</TH>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
+-            " NOWRAP>Description</TH>"
++            "<th class=\"colFirst\" scope=\"col\">Package</th>" + NL +
++            "<th class=\"colLast\" scope=\"col\">Description</th>"
+         },
+         {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Modifier and Type</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
+-            " SCOPE=\"col\" NOWRAP>Field and Description</TH>"
++            "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL +
++            "<th class=\"colLast\" scope=\"col\">Field and Description</th>"
+         },
+         {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Modifier and Type</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
+-            " SCOPE=\"col\" NOWRAP>Method and Description</TH>"
++            "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL +
++            "<th class=\"colLast\" scope=\"col\">Method and Description</th>"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Modifier and Type</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
+-            " SCOPE=\"col\" NOWRAP>Field and Description</TH>"
++            "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL +
++            "<th class=\"colLast\" scope=\"col\">Field and Description</th>"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Modifier and Type</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
+-            " SCOPE=\"col\" NOWRAP>Method and Description</TH>"
++            "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL +
++            "<th class=\"colLast\" scope=\"col\">Method and Description</th>"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.ModalExclusionType.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Package</TH>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
+-            " NOWRAP>Description</TH>"
++            "<th class=\"colFirst\" scope=\"col\">Package</th>" + NL +
++            "<th class=\"colLast\" scope=\"col\">Description</th>"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.ModalExclusionType.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Modifier and Type</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
+-            " SCOPE=\"col\" NOWRAP>Method and Description</TH>"
++            "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL +
++            "<th class=\"colLast\" scope=\"col\">Method and Description</th>"
+         },
+         // Package use documentation
+         {BUG_ID + FS + "pkg1" + FS + "package-use.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Package</TH>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
+-            " NOWRAP>Description</TH>"
++            "<th class=\"colFirst\" scope=\"col\">Package</th>" + NL +
++            "<th class=\"colLast\" scope=\"col\">Description</th>"
+         },
+         {BUG_ID + FS + "pkg1" + FS + "package-use.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Class and Description</TH>"
++            "<th class=\"colOne\" scope=\"col\">Class and Description</th>"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "package-use.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Package</TH>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
+-            " NOWRAP>Description</TH>"
++            "<th class=\"colFirst\" scope=\"col\">Package</th>" + NL +
++            "<th class=\"colLast\" scope=\"col\">Description</th>"
+         },
+         {BUG_ID + FS + "pkg2" + FS + "package-use.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Class and Description</TH>"
++            "<th class=\"colOne\" scope=\"col\">Class and Description</th>"
+         },
+         // Deprecated
+         {BUG_ID + FS + "deprecated-list.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Field and Description</TH>"
++            "<th class=\"colOne\" scope=\"col\">Field and Description</th>"
+         },
+         {BUG_ID + FS + "deprecated-list.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Method and Description</TH>"
++            "<th class=\"colOne\" scope=\"col\">Method and Description</th>"
+         },
+         // Constant values
+         {BUG_ID + FS + "constant-values.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Modifier and Type</TH>" + NL + "<TH CLASS=\"TableHeader\"" +
+-            " SCOPE=\"col\" NOWRAP>Constant Field</TH>" + NL +
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>Value</TH>"
++            "<th class=\"colFirst\" scope=\"col\">" +
++            "Modifier and Type</th>" + NL + "<th" +
++            " scope=\"col\">Constant Field</th>" + NL +
++            "<th class=\"colLast\" scope=\"col\">Value</th>"
+         },
+         // Overview Summary
+         {BUG_ID + FS + "overview-summary.html",
+-            "<TH CLASS=\"TableHeader\" SCOPE=\"col\" NOWRAP>" +
+-            "Package</TH>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
+-            " NOWRAP>Description</TH>"
++            "<th class=\"colFirst\" scope=\"col\">" +
++            "Package</th>" + NL + "<th class=\"colLast\" scope=\"col\"" +
++            ">Description</th>"
+         }
+     };
+     private static final String[][] NEGATED_TEST = NO_TEST;
+diff --git a/test/com/sun/javadoc/testHtmlTag/TestHtmlTag.java b/test/com/sun/javadoc/testHtmlTag/TestHtmlTag.java
+--- langtools/test/com/sun/javadoc/testHtmlTag/TestHtmlTag.java
++++ langtools/test/com/sun/javadoc/testHtmlTag/TestHtmlTag.java
+@@ -40,20 +40,20 @@
+ 
+     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() + "\">"}};
++        {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>"}};
++        {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\">"}};
++        {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>"}};
++        {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\">"}};
++        {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>"}};
++        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<html>"}};
+ 
+     private static final String[] ARGS1 =
+         new String[] {
+diff --git a/test/com/sun/javadoc/testIndex/TestIndex.java b/test/com/sun/javadoc/testIndex/TestIndex.java
+--- langtools/test/com/sun/javadoc/testIndex/TestIndex.java
++++ langtools/test/com/sun/javadoc/testIndex/TestIndex.java
+@@ -48,35 +48,34 @@
+     private static final String[][] TEST = {
+         //Make sure the horizontal scroll bar does not appear in class frame.
+         {BUG_ID + FS + "index.html",
+-            "<FRAME src=\"overview-summary.html\" name=\"classFrame\" " +
+-            "title=\"Package, class and interface descriptions\" " +
+-            "scrolling=\"yes\">"},
++            "<frame src=\"overview-summary.html\" name=\"classFrame\" title=\"" +
++            "Package, class and interface descriptions\" scrolling=\"yes\">"},
+ 
+         //Test index-all.html
+         {BUG_ID + FS + "index-all.html",
+-            "<A HREF=\"./pkg/C.html\" title=\"class in pkg\"><STRONG>C</STRONG></A>" +
+-            " - Class in <A HREF=\"./pkg/package-summary.html\">pkg</A>"},
++            "<a href=\"./pkg/C.html\" title=\"class in pkg\"><span class=\"strong\">C</span></a>" +
++            " - Class in <a href=\"./pkg/package-summary.html\">pkg</a>"},
+         {BUG_ID + FS + "index-all.html",
+-            "<A HREF=\"./pkg/Interface.html\" title=\"interface in pkg\">" +
+-            "<STRONG>Interface</STRONG></A> - Interface in " +
+-            "<A HREF=\"./pkg/package-summary.html\">pkg</A>"},
++            "<a href=\"./pkg/Interface.html\" title=\"interface in pkg\">" +
++            "<span class=\"strong\">Interface</span></a> - Interface in " +
++            "<a href=\"./pkg/package-summary.html\">pkg</a>"},
+         {BUG_ID + FS + "index-all.html",
+-            "<A HREF=\"./pkg/AnnotationType.html\" title=\"annotation in pkg\">" +
+-            "<STRONG>AnnotationType</STRONG></A> - Annotation Type in " +
+-            "<A HREF=\"./pkg/package-summary.html\">pkg</A>"},
++            "<a href=\"./pkg/AnnotationType.html\" title=\"annotation in pkg\">" +
++            "<span class=\"strong\">AnnotationType</span></a> - Annotation Type in " +
++            "<a href=\"./pkg/package-summary.html\">pkg</a>"},
+         {BUG_ID + FS + "index-all.html",
+-            "<A HREF=\"./pkg/Coin.html\" title=\"enum in pkg\">" +
+-            "<STRONG>Coin</STRONG></A> - Enum in " +
+-            "<A HREF=\"./pkg/package-summary.html\">pkg</A>"},
++            "<a href=\"./pkg/Coin.html\" title=\"enum in pkg\">" +
++            "<span class=\"strong\">Coin</span></a> - Enum in " +
++            "<a href=\"./pkg/package-summary.html\">pkg</a>"},
+         {BUG_ID + FS + "index-all.html",
+-            "Class in <A HREF=\"./package-summary.html\"><Unnamed></A>"},
++            "Class in <a href=\"./package-summary.html\"><Unnamed></a>"},
+         {BUG_ID + FS + "index-all.html",
+-            "<DT><A HREF=\"./pkg/C.html#Java\"><STRONG>Java</STRONG></A> - " + NL +
+-            "Static variable in class pkg.<A HREF=\"./pkg/C.html\" title=\"class in pkg\">C</A>" + NL +
+-            "</DT><DD> </DD>" + NL + NL +
+-            "<DT><A HREF=\"./pkg/C.html#JDK\"><STRONG>JDK</STRONG></A> - " + NL +
+-            "Static variable in class pkg.<A HREF=\"./pkg/C.html\" title=\"class in pkg\">C</A>" + NL +
+-            "</DT><DD> </DD>"},
++            "<dl>" + NL + "<dt><span class=\"strong\"><a href=\"./pkg/C.html#Java\">" +
++            "Java</a></span> - Static variable in class pkg.<a href=\"./pkg/C.html\" " +
++            "title=\"class in pkg\">C</a></dt>" + NL + "<dd> </dd>" + NL +
++            "<dt><span class=\"strong\"><a href=\"./pkg/C.html#JDK\">JDK</a></span> " +
++            "- Static variable in class pkg.<a href=\"./pkg/C.html\" title=\"class in pkg\">" +
++            "C</a></dt>" + NL + "<dd> </dd>" + NL + "</dl>"},
+     };
+     private static final String[][] NEGATED_TEST = NO_TEST;
+ 
+diff --git a/test/com/sun/javadoc/testInlineLinkLabel/TestInlineLinkLabel.java b/test/com/sun/javadoc/testInlineLinkLabel/TestInlineLinkLabel.java
+--- langtools/test/com/sun/javadoc/testInlineLinkLabel/TestInlineLinkLabel.java
++++ langtools/test/com/sun/javadoc/testInlineLinkLabel/TestInlineLinkLabel.java
+@@ -37,10 +37,10 @@
+     private static final String BUG_ID = "4524136";
+     private static final String[][] TEST = {
+         //Search for the label to the package link.
+-        {BUG_ID + FS + "pkg" + FS + "C1.html" , "<A HREF=\"../pkg/package-summary.html\"><CODE>Here is a link to a package</CODE></A>"},
++        {BUG_ID + FS + "pkg" + FS + "C1.html" , "<a href=\"../pkg/package-summary.html\"><code>Here is a link to a package</code></a>"},
+ 
+         //Search for the label to the class link
+-        {BUG_ID + FS + "pkg" + FS + "C1.html" , "<A HREF=\"../pkg/C2.html\" title=\"class in pkg\"><CODE>Here is a link to a class</CODE></A>"}
++        {BUG_ID + FS + "pkg" + FS + "C1.html" , "<a href=\"../pkg/C2.html\" title=\"class in pkg\"><code>Here is a link to a class</code></a>"}
+     };
+     private static final String[][] NEGATED_TEST = NO_TEST;
+     private static final String[] ARGS =
+diff --git a/test/com/sun/javadoc/testInterface/TestInterface.java b/test/com/sun/javadoc/testInterface/TestInterface.java
+--- langtools/test/com/sun/javadoc/testInterface/TestInterface.java
++++ langtools/test/com/sun/javadoc/testInterface/TestInterface.java
+@@ -48,51 +48,62 @@
+     //Input for string search tests.
+     private static final String[][] TEST = {
+         {BUG_ID + FS + "pkg" + FS + "Interface.html",
+-            "int <STRONG>method</STRONG>()"},
++            "<pre>int method()</pre>"},
+         {BUG_ID + FS + "pkg" + FS + "Interface.html",
+-            "static final int <STRONG>field</STRONG>"},
++            "<pre>static final int field</pre>"},
+ 
+ 
+         // Make sure known implementing class list is correct and omits type parameters.
+         {BUG_ID + FS + "pkg" + FS + "Interface.html",
+-            "<DT><STRONG>All Known Implementing Classes:</STRONG></DT> " +
+-            "<DD><A HREF=\"../pkg/Child.html\" " +
+-            "title=\"class in pkg\">Child</A>, " +
+-            "<A HREF=\"../pkg/Parent.html\" title=\"class in pkg\">" +
+-            "Parent</A></DD>"},
++            "<dl>" + NL + "<dt>All Known Implementing Classes:</dt>" + NL +
++            "<dd><a href=\"../pkg/Child.html\" title=\"class in pkg\">Child" +
++            "</a>, <a href=\"../pkg/Parent.html\" title=\"class in pkg\">Parent" +
++            "</a></dd>" + NL + "</dl>"},
+ 
+          // Make sure "All Implemented Interfaces": has substituted type parameters
+          {BUG_ID + FS + "pkg" + FS + "Child.html",
+-            "<STRONG>All Implemented Interfaces:</STRONG></DT> <DD>" +
+-            "<A HREF=\"../pkg/Interface.html\" title=\"interface in pkg\">" +
+-            "Interface</A><T>"
++            "<dl>" + NL + "<dt>All Implemented Interfaces:</dt>" + NL +
++            "<dd><a href=\"../pkg/Interface.html\" title=\"interface in pkg\">" +
++            "Interface</a><T></dd>" + NL + "</dl>"
+          },
+          //Make sure Class Tree has substituted type parameters.
+          {BUG_ID + FS + "pkg" + FS + "Child.html",
+-            "<PRE>" + NL +
+-            "java.lang.Object" + NL +
+-            "  <IMG SRC=\"../resources/inherit.gif\" ALT=\"extended by \"><A HREF=\"../pkg/Parent.html\" title=\"class in pkg\">pkg.Parent</A><T>" + NL +
+-            "      <IMG SRC=\"../resources/inherit.gif\" ALT=\"extended by \"><STRONG>pkg.Child<T></STRONG>" + NL +
+-            "</PRE>"
++            "<ul class=\"inheritance\">" + NL + "<li>java.lang.Object</li>" + NL +
++            "<li>" + NL + "<ul class=\"inheritance\">" + NL +
++            "<li><a href=\"../pkg/Parent.html\" title=\"class in pkg\">" +
++            "pkg.Parent</a><T></li>" + NL + "<li>" + NL +
++            "<ul class=\"inheritance\">" + NL + "<li>pkg.Child<T></li>" + NL +
++            "</ul>" + NL + "</li>" + NL + "</ul>" + NL + "</li>" + NL + "</ul>"
+          },
+          //Make sure "Direct Know Subclasses" omits type parameters
+         {BUG_ID + FS + "pkg" + FS + "Parent.html",
+-            "<STRONG>Direct Known Subclasses:</STRONG></DT> <DD><A HREF=\"../pkg/Child.html\" title=\"class in pkg\">Child</A>"
++            "<dl>" + NL + "<dt>Direct Known Subclasses:</dt>" + NL +
++            "<dd><a href=\"../pkg/Child.html\" title=\"class in pkg\">Child" +
++            "</a></dd>" + NL + "</dl>"
+         },
+         //Make sure "Specified By" has substituted type parameters.
+         {BUG_ID + FS + "pkg" + FS + "Child.html",
+-            "<STRONG>Specified by:</STRONG></DT><DD><CODE><A HREF=\"../pkg/Interface.html#method()\">method</A></CODE> in interface <CODE><A HREF=\"../pkg/Interface.html\" title=\"interface in pkg\">Interface</A><<A HREF=\"../pkg/Child.html\" title=\"type parameter in Child\">T</A>></CODE>"
++            "<dt><strong>Specified by:</strong></dt>" + NL +
++            "<dd><code><a href=\"../pkg/Interface.html#method()\">method</a>" +
++            "</code> in interface <code>" +
++            "<a href=\"../pkg/Interface.html\" title=\"interface in pkg\">" +
++            "Interface</a><<a href=\"../pkg/Child.html\" title=\"type parameter in Child\">" +
++            "T</a>></code></dd>"
+          },
+         //Make sure "Overrides" has substituted type parameters.
+         {BUG_ID + FS + "pkg" + FS + "Child.html",
+-            "<STRONG>Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg/Parent.html#method()\">method</A></CODE> in class <CODE><A HREF=\"../pkg/Parent.html\" title=\"class in pkg\">Parent</A><<A HREF=\"../pkg/Child.html\" title=\"type parameter in Child\">T</A>></CODE>"
++            "<dt><strong>Overrides:</strong></dt>" + NL +
++            "<dd><code><a href=\"../pkg/Parent.html#method()\">method</a>" +
++            "</code> in class <code><a href=\"../pkg/Parent.html\" " +
++            "title=\"class in pkg\">Parent</a><<a href=\"../pkg/Child.html\" " +
++            "title=\"type parameter in Child\">T</a>></code></dd>"
+          },
+     };
+     private static final String[][] NEGATED_TEST = {
+         {BUG_ID + FS + "pkg" + FS + "Interface.html",
+-            "public int <STRONG>method</STRONG>()"},
++            "public int method()"},
+         {BUG_ID + FS + "pkg" + FS + "Interface.html",
+-            "public static final int <STRONG>field</STRONG>"},
++            "public static final int field"},
+     };
+ 
+     /**
+diff --git a/test/com/sun/javadoc/testJavascript/TestJavascript.java b/test/com/sun/javadoc/testJavascript/TestJavascript.java
+--- langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java
++++ langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java
+@@ -45,11 +45,11 @@
+     //Input for string search tests.
+     private static final String[][] TEST = {
+         {BUG_ID + FS + "pkg" + FS + "C.html",
+-            "<A HREF=\"../index.html?pkg/C.html\" target=\"_top\"><STRONG>FRAMES</STRONG></A>"},
++            "<a href=\"../index.html?pkg/C.html\" target=\"_top\">FRAMES</a>"},
+         {BUG_ID + FS + "TestJavascript.html",
+-            "<A HREF=\"index.html?TestJavascript.html\" target=\"_top\"><STRONG>FRAMES</STRONG></A>"},
++            "<a href=\"index.html?TestJavascript.html\" target=\"_top\">FRAMES</a>"},
+         {BUG_ID + FS + "index.html",
+-            "<SCRIPT type=\"text/javascript\">" + NL +
++            "<script type=\"text/javascript\">" + NL +
+                         "    targetPage = \"\" + window.location.search;" + NL +
+             "    if (targetPage != \"\" && targetPage != \"undefined\")" + NL +
+             "        targetPage = targetPage.substring(1);" + NL +
+@@ -59,7 +59,7 @@
+             "        if (targetPage != \"\" && targetPage != \"undefined\")" + NL +
+             "             top.classFrame.location = top.targetPage;" + NL +
+             "    }" + NL +
+-            "</SCRIPT>"},
++            "</script>"},
+ 
+         //Make sure title javascript only runs if is-external is not true
+         {BUG_ID + FS + "pkg" + FS + "C.html",
+diff --git a/test/com/sun/javadoc/testLinkOption/TestLinkOption.java b/test/com/sun/javadoc/testLinkOption/TestLinkOption.java
+--- langtools/test/com/sun/javadoc/testLinkOption/TestLinkOption.java
++++ langtools/test/com/sun/javadoc/testLinkOption/TestLinkOption.java
+@@ -46,25 +46,25 @@
+ 
+     private static final String[][] TEST1 = {
+         {BUG_ID + "-1" + FS + "pkg" + FS + "C.html",
+-            "<A HREF=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html?is-external=true\" " +
+-            "title=\"class or interface in java.lang\"><CODE>Link to String Class</CODE></A>"
++            "<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html?is-external=true\" " +
++            "title=\"class or interface in java.lang\"><code>Link to String Class</code></a>"
+         },
+         //Make sure the parameters are indented properly when the -link option is used.
+         {BUG_ID + "-1" + FS + "pkg" + FS + "C.html",
+                                 "(int p1," + NL +
+-            "                     int p2," + NL +
+-            "                     int p3)"
++                                "      int p2," + NL +
++                                "      int p3)"
+         },
+         {BUG_ID + "-1" + FS + "pkg" + FS + "C.html",
+                                 "(int p1," + NL +
+-            "                     int p2," + NL +
+-            "                     " +
+-            "<A HREF=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true\" " +
+-            "title=\"class or interface in java.lang\">Object</A> p3)"
++                                "      int p2," + NL +
++                                "      <a href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true\" title=\"class or interface in java.lang\">" +
++                                "Object</a> p3)"
+         },
+         {BUG_ID + "-1" + FS + "java" + FS + "lang" + FS + "StringBuilderChild.html",
+-                "public abstract class <STRONG>StringBuilderChild</STRONG>" + NL +
+-                "extends <A HREF=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true\" title=\"class or interface in java.lang\">Object</A>"
++                "<pre>public abstract class <strong>StringBuilderChild</strong>" + NL +
++                "extends <a href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true\" " +
++                "title=\"class or interface in java.lang\">Object</a></pre>"
+         },
+ 
+     };
+@@ -79,8 +79,8 @@
+ 
+     private static final String[][] TEST2 = {
+         {BUG_ID + "-2" + FS + "pkg2" + FS + "C2.html",
+-            "This is a link to <A HREF=\"../../" + BUG_ID + "-1/pkg/C.html?is-external=true\" " +
+-            "title=\"class or interface in pkg\"><CODE>Class C</CODE></A>."
++            "This is a link to <a href=\"../../" + BUG_ID + "-1/pkg/C.html?is-external=true\" " +
++            "title=\"class or interface in pkg\"><code>Class C</code></a>."
+         }
+     };
+     private static final String[][] NEGATED_TEST2 = NO_TEST;
+diff --git a/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java b/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java
+--- langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java
++++ langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java
+@@ -46,20 +46,22 @@
+     //Input for string search tests.
+     private static final String[][] TEST = {
+         {BUG_ID + FS + "pkg" + FS + "C.html",
+-            "Qualified Link: <A HREF=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><CODE>C.InnerC</CODE></A>.<br/>\n" +
+-            " Unqualified Link1: <A HREF=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><CODE>C.InnerC</CODE></A>.<br/>\n" +
+-            " Unqualified Link2: <A HREF=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><CODE>C.InnerC</CODE></A>.<br/>\n" +
+-            " Qualified Link: <A HREF=\"../pkg/C.html#method(pkg.C.InnerC, pkg.C.InnerC2)\"><CODE>method(pkg.C.InnerC, pkg.C.InnerC2)</CODE></A>.<br/>\n" +
+-            " Unqualified Link: <A HREF=\"../pkg/C.html#method(pkg.C.InnerC, pkg.C.InnerC2)\"><CODE>method(C.InnerC, C.InnerC2)</CODE></A>.<br/>\n" +
+-            " Unqualified Link: <A HREF=\"../pkg/C.html#method(pkg.C.InnerC, pkg.C.InnerC2)\"><CODE>method(InnerC, InnerC2)</CODE></A>.<br/>"
++            "Qualified Link: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n" +
++            " Unqualified Link1: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n" +
++            " Unqualified Link2: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n" +
++            " Qualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC, pkg.C.InnerC2)\"><code>method(pkg.C.InnerC, pkg.C.InnerC2)</code></a>.<br/>\n" +
++            " Unqualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC, pkg.C.InnerC2)\"><code>method(C.InnerC, C.InnerC2)</code></a>.<br/>\n" +
++            " Unqualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC, pkg.C.InnerC2)\"><code>method(InnerC, InnerC2)</code></a>.<br/>"
+         },
+         {BUG_ID + FS + "pkg" + FS + "C.InnerC.html",
+-            "Link to member in outer class: <A HREF=\"../pkg/C.html#MEMBER\"><CODE>C.MEMBER</CODE></A> <br/>\n" +
+-            " Link to member in inner class: <A HREF=\"../pkg/C.InnerC2.html#MEMBER2\"><CODE>C.InnerC2.MEMBER2</CODE></A> <br/>\n" +
+-            " Link to another inner class: <A HREF=\"../pkg/C.InnerC2.html\" title=\"class in pkg\"><CODE>C.InnerC2</CODE></A>"
++            "Link to member in outer class: <a href=\"../pkg/C.html#MEMBER\"><code>C.MEMBER</code></a> <br/>\n" +
++            " Link to member in inner class: <a href=\"../pkg/C.InnerC2.html#MEMBER2\"><code>C.InnerC2.MEMBER2</code></a> <br/>\n" +
++            " Link to another inner class: <a href=\"../pkg/C.InnerC2.html\" title=\"class in pkg\"><code>C.InnerC2</code></a>"
+         },
+         {BUG_ID + FS + "pkg" + FS + "C.InnerC2.html",
+-            "Enclosing class:</STRONG></DT><DD><A HREF=\"../pkg/C.html\" title=\"class in pkg\">C</A>"
++            "<dl>" + NL + "<dt>Enclosing class:</dt>" + NL +
++            "<dd><a href=\"../pkg/C.html\" title=\"class in pkg\">C</a></dd>" + NL +
++            "</dl>"
+         },
+     };
+     private static final String[][] NEGATED_TEST = {
+diff --git a/test/com/sun/javadoc/testLinkToSerialForm/TestLinkToSerialForm.java b/test/com/sun/javadoc/testLinkToSerialForm/TestLinkToSerialForm.java
+--- langtools/test/com/sun/javadoc/testLinkToSerialForm/TestLinkToSerialForm.java
++++ langtools/test/com/sun/javadoc/testLinkToSerialForm/TestLinkToSerialForm.java
+@@ -37,8 +37,8 @@
+ 
+     private static final String BUG_ID = "4521661";
+     private static final String[][] TEST = {
+-        {BUG_ID + FS + "serialized-form.html", "<A NAME=\"pkg.C\">"},
+-        {BUG_ID + FS + "pkg" + FS + "C.html", "<A HREF=\"../serialized-form.html#pkg.C\">"}
++        {BUG_ID + FS + "serialized-form.html", "<a name=\"pkg.C\">"},
++        {BUG_ID + FS + "pkg" + FS + "C.html", "<a href=\"../serialized-form.html#pkg.C\">"}
+     };
+     private static final String[][] NEGATED_TEST = NO_TEST;
+     private static final String[] ARGS =
+diff --git a/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java b/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java
+--- langtools/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java
++++ langtools/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java
+@@ -40,55 +40,57 @@
+     private static final String[][] TEST = {
+         //Public field should be inherited
+         {BUG_ID + FS + "pkg" + FS + "SubClass.html",
+-         "<A HREF=\"../pkg/BaseClass.html#pubField\">"},
++         "<a href=\"../pkg/BaseClass.html#pubField\">"},
+ 
+         //Public method should be inherited
+         {BUG_ID + FS + "pkg" + FS + "SubClass.html",
+-         "<A HREF=\"../pkg/BaseClass.html#pubMethod()\">"},
++         "<a href=\"../pkg/BaseClass.html#pubMethod()\">"},
+ 
+         //Public inner class should be inherited.
+         {BUG_ID + FS + "pkg" + FS + "SubClass.html",
+-         "<A HREF=\"../pkg/BaseClass.pubInnerClass.html\" title=\"class in pkg\">"},
++         "<a href=\"../pkg/BaseClass.pubInnerClass.html\" title=\"class in pkg\">"},
+ 
+         //Protected field should be inherited
+         {BUG_ID + FS + "pkg" + FS + "SubClass.html",
+-         "<A HREF=\"../pkg/BaseClass.html#proField\">"},
++         "<a href=\"../pkg/BaseClass.html#proField\">"},
+ 
+         //Protected method should be inherited
+         {BUG_ID + FS + "pkg" + FS + "SubClass.html",
+-         "<A HREF=\"../pkg/BaseClass.html#proMethod()\">"},
++         "<a href=\"../pkg/BaseClass.html#proMethod()\">"},
+ 
+         //Protected inner class should be inherited.
+         {BUG_ID + FS + "pkg" + FS + "SubClass.html",
+-         "<A HREF=\"../pkg/BaseClass.proInnerClass.html\" title=\"class in pkg\">"},
++         "<a href=\"../pkg/BaseClass.proInnerClass.html\" title=\"class in pkg\">"},
+ 
+         // New labels as of 1.5.0
+         {BUG_ID + FS + "pkg" + FS + "SubClass.html",
+-         "<STRONG>Nested classes/interfaces inherited from class pkg." +
+-         "<A HREF=\"../pkg/BaseClass.html\" title=\"class in pkg\">" +
+-         "BaseClass</A></STRONG>"},
++         "Nested classes/interfaces inherited from class pkg." +
++                 "<a href=\"../pkg/BaseClass.html\" title=\"class in pkg\">BaseClass</a>"},
+         {BUG_ID + FS + "pkg" + FS + "SubClass.html",
+-         "<STRONG>Nested classes/interfaces inherited from interface pkg." +
+-         "<A HREF=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">" +
+-         "BaseInterface</A></STRONG>"},
++         "Nested classes/interfaces inherited from interface pkg." +
++                 "<a href=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">BaseInterface</a>"},
+ 
+          // Test overriding/implementing methods with generic parameters.
+                  {BUG_ID + FS + "pkg" + FS + "BaseClass.html",
+-         "<DT><STRONG>Specified by:</STRONG></DT><DD><CODE><A HREF=\"../pkg/BaseInterface.html#getAnnotation(java.lang.Class)\">getAnnotation</A></CODE> in interface <CODE><A HREF=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">BaseInterface</A></CODE></DD>"+NL+"</DL>"},
++         "<dl>" + NL + "<dt><strong>Specified by:</strong></dt>" + NL +
++                          "<dd><code><a href=\"../pkg/BaseInterface.html#getAnnotation(java.lang.Class)\">" +
++                          "getAnnotation</a></code> in interface <code>" +
++                          "<a href=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">" +
++                          "BaseInterface</a></code></dd>" + NL + "</dl>"},
+ 
+          // Test diamond inheritence member summary (6256068)
+                  {BUG_ID + FS + "diamond" + FS + "Z.html",
+-                 "<TD><CODE><A HREF=\"../diamond/A.html#aMethod()\">aMethod</A></CODE></TD>"},
++                 "<code><a href=\"../diamond/A.html#aMethod()\">aMethod</a></code>"},
+ 
+          // Test that doc is inherited from closed parent (6270645)
+                  {BUG_ID + FS + "inheritDist" + FS + "C.html",
+-                 "          m1-B</TD>"},
++                 "<div class=\"block\">m1-B</div>"},
+ 
+     };
+ 
+     private static final String[][] NEGATED_TEST = {
+         {BUG_ID + FS + "pkg" + FS + "SubClass.html",
+-        "<A HREF=\"../pkg/BaseClass.html#staticMethod()\">staticMethod</A></CODE>"},
++        "<a href=\"../pkg/BaseClass.html#staticMethod()\">staticMethod</a></code>"},
+     };
+     private static final String[] ARGS =
+         new String[] {
+diff --git a/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java b/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java
+--- langtools/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java
++++ langtools/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java
+@@ -48,21 +48,23 @@
+     private static final String[][] TEST = {
+         // Check return type in member summary.
+         {BUG_ID + FS + "pkg" + FS + "PublicChild.html",
+-            "<CODE> <A HREF=\"../pkg/PublicChild.html\" " +
+-            "title=\"class in pkg\">PublicChild</A></CODE></FONT></TD>" + NL +
+-            "<TD><CODE><STRONG><A HREF=\"../pkg/PublicChild.html#" +
+-            "returnTypeTest()\">returnTypeTest</A></STRONG>()</CODE>"
++            "<code><a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">PublicChild</a></code></td>" + NL +
++            "<td class=\"colLast\"><code><strong><a href=\"../pkg/PublicChild.html#returnTypeTest()\">" +
++            "returnTypeTest</a></strong>()</code>"
+         },
+         // Check return type in member detail.
+         {BUG_ID + FS + "pkg" + FS + "PublicChild.html",
+-            "public <A HREF=\"../pkg/PublicChild.html\" " +
+-            "title=\"class in pkg\">PublicChild</A> " +
+-            "<STRONG>returnTypeTest</STRONG>()"
++            "<pre>public <a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">" +
++            "PublicChild</a> returnTypeTest()</pre>"
+         },
+ 
+          // Legacy anchor dimensions (6290760)
+         {BUG_ID + FS + "pkg2" + FS + "A.html",
+-            "<A NAME=\"f(java.lang.Object[])\"><!-- --></A><A NAME=\"f(T[])\"><!-- --></A>"
++            "<a name=\"f(java.lang.Object[])\">" + NL +
++            "<!--   -->" + NL +
++            "</a><a name=\"f(T[])\">" + NL +
++            "<!--   -->" + NL +
++            "</a>"
+         },
+     };
+     private static final String[][] NEGATED_TEST = NO_TEST;
+diff --git a/test/com/sun/javadoc/testNavagation/TestNavagation.java b/test/com/sun/javadoc/testNavagation/TestNavagation.java
+--- langtools/test/com/sun/javadoc/testNavagation/TestNavagation.java
++++ langtools/test/com/sun/javadoc/testNavagation/TestNavagation.java
+@@ -45,24 +45,24 @@
+ 
+     //Input for string search tests.
+     private static final String[][] TEST = {
+-        {BUG_ID + FS + "pkg" + FS + "A.html", " PREV CLASS "},
++        {BUG_ID + FS + "pkg" + FS + "A.html", "<li>PREV CLASS</li>"},
+         {BUG_ID + FS + "pkg" + FS + "A.html",
+-            "<A HREF=\"../pkg/C.html\" title=\"class in pkg\"><STRONG>NEXT CLASS</STRONG></A>"},
++            "<a href=\"../pkg/C.html\" title=\"class in pkg\"><span class=\"strong\">NEXT CLASS</span></a>"},
+         {BUG_ID + FS + "pkg" + FS + "C.html",
+-            "<A HREF=\"../pkg/A.html\" title=\"annotation in pkg\"><STRONG>PREV CLASS</STRONG></A>"},
++            "<a href=\"../pkg/A.html\" title=\"annotation in pkg\"><span class=\"strong\">PREV CLASS</span></a>"},
+         {BUG_ID + FS + "pkg" + FS + "C.html",
+-            "<A HREF=\"../pkg/E.html\" title=\"enum in pkg\"><STRONG>NEXT CLASS</STRONG></A>"},
++            "<a href=\"../pkg/E.html\" title=\"enum in pkg\"><span class=\"strong\">NEXT CLASS</span></a>"},
+         {BUG_ID + FS + "pkg" + FS + "E.html",
+-            "<A HREF=\"../pkg/C.html\" title=\"class in pkg\"><STRONG>PREV CLASS</STRONG></A>"},
++            "<a href=\"../pkg/C.html\" title=\"class in pkg\"><span class=\"strong\">PREV CLASS</span></a>"},
+         {BUG_ID + FS + "pkg" + FS + "E.html",
+-            "<A HREF=\"../pkg/I.html\" title=\"interface in pkg\"><STRONG>NEXT CLASS</STRONG></A>"},
++            "<a href=\"../pkg/I.html\" title=\"interface in pkg\"><span class=\"strong\">NEXT CLASS</span></a>"},
+         {BUG_ID + FS + "pkg" + FS + "I.html",
+-            "<A HREF=\"../pkg/E.html\" title=\"enum in pkg\"><STRONG>PREV CLASS</STRONG></A>"},
+-        {BUG_ID + FS + "pkg" + FS + "I.html", " NEXT CLASS"},
++            "<a href=\"../pkg/E.html\" title=\"enum in pkg\"><span class=\"strong\">PREV CLASS</span></a>"},
++        {BUG_ID + FS + "pkg" + FS + "I.html", "<li>NEXT CLASS</li>"},
+         // Test for 4664607
+         {BUG_ID + FS + "pkg" + FS + "I.html",
+-            "<TD COLSPAN=2 BGCOLOR=\"#EEEEFF\" CLASS=\"NavBarCell1\">" + NL +
+-            "<A NAME=\"navbar_top_firstrow\"><!-- --></A>"}
++            "<a href=\"#skip-navbar_top\" title=\"Skip navigation links\"></a><a name=\"navbar_top_firstrow\">" + NL +
++            "<!--   -->" + NL + "</a>"}
+     };
+     private static final String[][] NEGATED_TEST = NO_TEST;
+ 
+diff --git a/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java b/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java
+--- langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java
++++ langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java
+@@ -51,18 +51,18 @@
+             // ENUM TESTING
+             //=================================
+             //Make sure enum header is correct.
+-            {BUG_ID + FS + "pkg" + FS + "Coin.html", "Enum Coin</H2>"},
++            {BUG_ID + FS + "pkg" + FS + "Coin.html", "Enum Coin</h2>"},
+             //Make sure enum signature is correct.
+-            {BUG_ID + FS + "pkg" + FS + "Coin.html", "public enum "+
+-                "<STRONG>Coin</STRONG>" + NL + "extends java.lang.Enum<" +
+-                "<A HREF=\"../pkg/Coin.html\" title=\"enum in pkg\">Coin</A>>"
++            {BUG_ID + FS + "pkg" + FS + "Coin.html", "<pre>public enum <strong>Coin</strong>" + NL +
++                "extends java.lang.Enum<<a href=\"../pkg/Coin.html\" " +
++                "title=\"enum in pkg\">Coin</a>></pre>"
+             },
+             //Check for enum constant section
+-            {BUG_ID + FS + "pkg" + FS + "Coin.html", "<CAPTION CLASS=\"TableCaption\">" + NL +
+-                     "Enum Constant Summary</CAPTION>"},
++            {BUG_ID + FS + "pkg" + FS + "Coin.html", "<caption><span>Enum Constants" +
++                     "</span><span class=\"tabEnd\"> </span></caption>"},
+             //Detail for enum constant
+             {BUG_ID + FS + "pkg" + FS + "Coin.html",
+-                "<STRONG><A HREF=\"../pkg/Coin.html#Dime\">Dime</A></STRONG>"},
++                "<strong><a href=\"../pkg/Coin.html#Dime\">Dime</a></strong>"},
+             //Automatically insert documentation for values() and valueOf().
+             {BUG_ID + FS + "pkg" + FS + "Coin.html",
+                 "Returns an array containing the constants of this enum type,"},
+@@ -77,38 +77,39 @@
+             //=================================
+             //Make sure the header is correct.
+             {BUG_ID + FS + "pkg" + FS + "TypeParameters.html",
+-                "Class TypeParameters<E></H2>"},
++                "Class TypeParameters<E></h2>"},
+             //Check class type parameters section.
+             {BUG_ID + FS + "pkg" + FS + "TypeParameters.html",
+-                "<DT><STRONG>Type Parameters:</STRONG></DT><DD><CODE>E</CODE> - " +
++                "<dt><span class=\"strong\">Type Parameters:</span></dt><dd><code>E</code> - " +
+                 "the type parameter for this class."},
+             //Type parameters in @see/@link
+             {BUG_ID + FS + "pkg" + FS + "TypeParameters.html",
+-                "<DT><STRONG>See Also:</STRONG></DT><DD><A HREF=\"../pkg/TypeParameters.html\" " +
+-                    "title=\"class in pkg\"><CODE>TypeParameters</CODE></A></DD></DL>"},
++                "<dl><dt><span class=\"strong\">See Also:</span></dt><dd>" +
++                "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">" +
++                "<code>TypeParameters</code></a></dd></dl>"},
+             //Method that uses class type parameter.
+             {BUG_ID + FS + "pkg" + FS + "TypeParameters.html",
+-                "(<A HREF=\"../pkg/TypeParameters.html\" title=\"type " +
+-                    "parameter in TypeParameters\">E</A> param)"},
++                "(<a href=\"../pkg/TypeParameters.html\" title=\"type " +
++                    "parameter in TypeParameters\">E</a> param)"},
+             //Method type parameter section.
+             {BUG_ID + FS + "pkg" + FS + "TypeParameters.html",
+-                "<STRONG>Type Parameters:</STRONG></DT><DD><CODE>T</CODE> - This is the first " +
+-                    "type parameter.</DD><DD><CODE>V</CODE> - This is the second type " +
++                "<span class=\"strong\">Type Parameters:</span></dt><dd><code>T</code> - This is the first " +
++                    "type parameter.</dd><dd><code>V</code> - This is the second type " +
+                     "parameter."},
+             //Signature of method with type parameters
+             {BUG_ID + FS + "pkg" + FS + "TypeParameters.html",
+-                "public <T extends java.util.List,V> " +
+-                    "java.lang.String[] <STRONG>methodThatHasTypeParameters</STRONG>"},
++                "public <T extends java.util.List,V> " +
++                "java.lang.String[] methodThatHasTypeParameters"},
+             //Wildcard testing.
+             {BUG_ID + FS + "pkg" + FS + "Wildcards.html",
+-                "<A HREF=\"../pkg/TypeParameters.html\" title=\"class in pkg\">" +
+-                "TypeParameters</A><? super java.lang.String> a"},
++                "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">" +
++                "TypeParameters</a><? super java.lang.String> a"},
+             {BUG_ID + FS + "pkg" + FS + "Wildcards.html",
+-                "<A HREF=\"../pkg/TypeParameters.html\" title=\"class in pkg\">" +
+-                "TypeParameters</A><? extends java.lang.StringBuffer> b"},
++                "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">" +
++                "TypeParameters</a><? extends java.lang.StringBuffer> b"},
+             {BUG_ID + FS + "pkg" + FS + "Wildcards.html",
+-                "<A HREF=\"../pkg/TypeParameters.html\" title=\"class in pkg\">" +
+-                    "TypeParameters</A> c"},
++                "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">" +
++                    "TypeParameters</a> c"},
+             //Bad type parameter warnings.
+             {WARNING_OUTPUT, "warning - @param argument " +
+                 "\"<BadClassTypeParam>\" is not a type parameter name."},
+@@ -117,18 +118,27 @@
+ 
+             //Signature of subclass that has type parameters.
+             {BUG_ID + FS + "pkg" + FS + "TypeParameterSubClass.html",
+-                "public class <STRONG>TypeParameterSubClass<T extends java.lang.String>" +
+-                "</STRONG>" + NL + "extends <A HREF=\"../pkg/TypeParameterSuperClass.html\" " +
+-                "title=\"class in pkg\">TypeParameterSuperClass</A><T>"},
++                "<pre>public class <strong>TypeParameterSubClass<T extends " +
++                "java.lang.String></strong>" + NL + "extends " +
++                "<a href=\"../pkg/TypeParameterSuperClass.html\" title=\"class in pkg\">" +
++                "TypeParameterSuperClass</a><T></pre>"},
+ 
+             //Interface generic parameter substitution
+             //Signature of subclass that has type parameters.
+             {BUG_ID + FS + "pkg" + FS + "TypeParameters.html",
+-                "<STRONG>All Implemented Interfaces:</STRONG></DT> <DD><A HREF=\"../pkg/SubInterface.html\" title=\"interface in pkg\">SubInterface</A><E>, <A HREF=\"../pkg/SuperInterface.html\" title=\"interface in pkg\">SuperInterface</A><E></DD>"},
++                "<dl>" + NL + "<dt>All Implemented Interfaces:</dt>" + NL +
++                "<dd><a href=\"../pkg/SubInterface.html\" title=\"interface in pkg\">" +
++                "SubInterface</a><E>, <a href=\"../pkg/SuperInterface.html\" " +
++                "title=\"interface in pkg\">SuperInterface</a><E></dd>" + NL +
++                "</dl>"},
+             {BUG_ID + FS + "pkg" + FS + "SuperInterface.html",
+-                "<STRONG>All Known Subinterfaces:</STRONG></DT> <DD><A HREF=\"../pkg/SubInterface.html\" title=\"interface in pkg\">SubInterface</A><V></DD>"},
++                "<dl>" + NL + "<dt>All Known Subinterfaces:</dt>" + NL +
++                "<dd><a href=\"../pkg/SubInterface.html\" title=\"interface in pkg\">" +
++                "SubInterface</a><V></dd>" + NL + "</dl>"},
+             {BUG_ID + FS + "pkg" + FS + "SubInterface.html",
+-                "<STRONG>All Superinterfaces:</STRONG></DT> <DD><A HREF=\"../pkg/SuperInterface.html\" title=\"interface in pkg\">SuperInterface</A><V></DD>"},
++                "<dl>" + NL + "<dt>All Superinterfaces:</dt>" + NL +
++                "<dd><a href=\"../pkg/SuperInterface.html\" title=\"interface in pkg\">" +
++                "SuperInterface</a><V></dd>" + NL + "</dl>"},
+ 
+             //=================================
+             // VAR ARG TESTING
+@@ -137,39 +147,40 @@
+             {BUG_ID + FS + "pkg" + FS + "VarArgs.html", "(int[][]... i)"},
+             {BUG_ID + FS + "pkg" + FS + "VarArgs.html", "(int[]...)"},
+             {BUG_ID + FS + "pkg" + FS + "VarArgs.html",
+-                "<A HREF=\"../pkg/TypeParameters.html\" title=\"class in pkg\">" +
+-                "TypeParameters</A>... t"},
++                "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">" +
++                "TypeParameters</a>... t"},
+ 
+             //=================================
+             // ANNOTATION TYPE TESTING
+             //=================================
+             //Make sure the summary links are correct.
+             {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
+-                "SUMMARY: <A HREF=\"#annotation_type_required_element_summary\">" +
+-                "REQUIRED</A> | <A HREF=\"#annotation_type_optional_element_summary\">" +
+-                "OPTIONAL</A>"},
++                "<li>SUMMARY: </li>" + NL +
++                "<li><a href=\"#annotation_type_required_element_summary\">" +
++                "REQUIRED</a> | </li>" + NL + "<li>" +
++                "<a href=\"#annotation_type_optional_element_summary\">OPTIONAL</a></li>"},
+             //Make sure the detail links are correct.
+             {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
+-                "DETAIL: <A HREF=\"#annotation_type_element_detail\">ELEMENT</A>"},
++                "<li>DETAIL: </li>" + NL +
++                "<li><a href=\"#annotation_type_element_detail\">ELEMENT</a></li>"},
+             //Make sure the heading is correct.
+             {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
+-                "Annotation Type AnnotationType</H2>"},
++                "Annotation Type AnnotationType</h2>"},
+             //Make sure the signature is correct.
+             {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
+-                "public @interface <STRONG>AnnotationType</STRONG>"},
++                "public @interface <strong>AnnotationType</strong>"},
+             //Make sure member summary headings are correct.
+             {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
+-                "<CAPTION CLASS=\"TableCaption\">" + NL +
+-                "Required Element Summary</CAPTION>"},
++                "<h3>Required Element Summary</h3>"},
+             {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
+-                "<CAPTION CLASS=\"TableCaption\">" + NL +
+-                "Optional Element Summary</CAPTION>"},
++                "<h3>Optional Element Summary</h3>"},
+             //Make sure element detail heading is correct
+             {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
+                 "Element Detail"},
+             //Make sure default annotation type value is printed when necessary.
+             {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
+-                "<STRONG>Default:</STRONG></DT><DD>\"unknown\"</DD>"},
++                "<dl>" + NL + "<dt>Default:</dt>" + NL + "<dd>\"unknown\"</dd>" + NL +
++                "</dl>"},
+ 
+             //=================================
+             // ANNOTATION TYPE USAGE TESTING
+@@ -177,51 +188,65 @@
+ 
+             //PACKAGE
+             {BUG_ID + FS + "pkg" + FS + "package-summary.html",
+-                "<A HREF=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</A>(<A HREF=\"../pkg/AnnotationType.html#optional()\">optional</A>=\"Package Annotation\"," + NL +
+-                "                <A HREF=\"../pkg/AnnotationType.html#required()\">required</A>=1994)"},
++                "<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>=\"Package Annotation\"," + NL +
++                "                <a href=\"../pkg/AnnotationType.html#required()\">required</a>=1994)"},
+ 
+             //CLASS
+             {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
+-                "<FONT SIZE=\"-1\">" +
+-                "<A HREF=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</A>(<A HREF=\"../pkg/AnnotationType.html#optional()\">optional</A>=\"Class Annotation\","+NL +
+-                "                <A HREF=\"../pkg/AnnotationType.html#required()\">required</A>=1994)"+NL +
+-                "</FONT>public class <STRONG>AnnotationTypeUsage</STRONG>" + NL +
+-                "extends java.lang.Object"},
++                "<pre><a href=\"../pkg/AnnotationType.html\" " +
++                "title=\"annotation in pkg\">@AnnotationType</a>(" +
++                "<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>" +
++                "=\"Class Annotation\"," + NL +
++                "                <a href=\"../pkg/AnnotationType.html#required()\">" +
++                "required</a>=1994)" + NL + "public class <strong>" +
++                "AnnotationTypeUsage</strong>" + NL + "extends java.lang.Object</pre>"},
+ 
+             //FIELD
+             {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
+-                "<FONT SIZE=\"-1\">" +
+-                "<A HREF=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</A>(<A HREF=\"../pkg/AnnotationType.html#optional()\">optional</A>=\"Field Annotation\","+NL +
+-                "                <A HREF=\"../pkg/AnnotationType.html#required()\">required</A>=1994)"+NL +
+-                "</FONT>public int <STRONG>field</STRONG>"},
++                "<pre><a href=\"../pkg/AnnotationType.html\" " +
++                "title=\"annotation in pkg\">@AnnotationType</a>(" +
++                "<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>" +
++                "=\"Field Annotation\"," + NL +
++                "                <a href=\"../pkg/AnnotationType.html#required()\">" +
++                "required</a>=1994)" + NL + "public int field</pre>"},
+ 
+             //CONSTRUCTOR
+             {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
+-                "<FONT SIZE=\"-1\">" +
+-                "<A HREF=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</A>(<A HREF=\"../pkg/AnnotationType.html#optional()\">optional</A>=\"Constructor Annotation\","+NL +
+-                "                <A HREF=\"../pkg/AnnotationType.html#required()\">required</A>=1994)"+NL +
+-                "</FONT>public <STRONG>AnnotationTypeUsage</STRONG>()"},
++                "<pre><a href=\"../pkg/AnnotationType.html\" " +
++                "title=\"annotation in pkg\">@AnnotationType</a>(" +
++                "<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>" +
++                "=\"Constructor Annotation\"," + NL +
++                "                <a href=\"../pkg/AnnotationType.html#required()\">" +
++                "required</a>=1994)" + NL + "public AnnotationTypeUsage()</pre>"},
+ 
+             //METHOD
+             {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
+-                "<FONT SIZE=\"-1\">" +
+-                "<A HREF=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</A>(<A HREF=\"../pkg/AnnotationType.html#optional()\">optional</A>=\"Method Annotation\","+NL +
+-                "                <A HREF=\"../pkg/AnnotationType.html#required()\">required</A>=1994)"+NL +
+-                "</FONT>public void <STRONG>method</STRONG>()"},
++                "<pre><a href=\"../pkg/AnnotationType.html\" " +
++                "title=\"annotation in pkg\">@AnnotationType</a>(" +
++                "<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>" +
++                "=\"Method Annotation\"," + NL +
++                "                <a href=\"../pkg/AnnotationType.html#required()\">" +
++                "required</a>=1994)" + NL + "public void method()</pre>"},
+ 
+             //METHOD PARAMS
+             {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
+-                "<PRE>" + NL +
+-                "public void <STRONG>methodWithParams</STRONG>(<FONT SIZE=\"-1\"><A HREF=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</A>(<A HREF=\"../pkg/AnnotationType.html#optional()\">optional</A>=\"Parameter Annotation\",<A HREF=\"../pkg/AnnotationType.html#required()\">required</A>=1994)</FONT>" + NL +
+-                "                             int documented," + NL +
+-                "                             int undocmented)</PRE>"},
++                "<pre>public void methodWithParams(" +
++                "<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">" +
++                "@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional()\">" +
++                "optional</a>=\"Parameter Annotation\",<a " +
++                "href=\"../pkg/AnnotationType.html#required()\">required</a>=1994)" + NL +
++                "                    int documented," + NL +
++                "                    int undocmented)</pre>"},
+ 
+             //CONSTRUCTOR PARAMS
+             {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
+-                "<PRE>" + NL +
+-                                "public <STRONG>AnnotationTypeUsage</STRONG>(<FONT SIZE=\"-1\"><A HREF=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</A>(<A HREF=\"../pkg/AnnotationType.html#optional()\">optional</A>=\"Constructor Param Annotation\",<A HREF=\"../pkg/AnnotationType.html#required()\">required</A>=1994)</FONT>" + NL +
+-                                "                           int documented," + NL +
+-                "                           int undocmented)</PRE>"},
++                "<pre>public AnnotationTypeUsage(<a " +
++                "href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">" +
++                "@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional()\">" +
++                "optional</a>=\"Constructor Param Annotation\",<a " +
++                "href=\"../pkg/AnnotationType.html#required()\">required</a>=1994)" + NL +
++                "                   int documented," + NL +
++                "                   int undocmented)</pre>"},
+ 
+             //=================================
+             // ANNOTATION TYPE USAGE TESTING (All Different Types).
+@@ -229,59 +254,59 @@
+ 
+             //Integer
+             {BUG_ID + FS + "pkg1" + FS + "B.html",
+-                "<A HREF=\"../pkg1/A.html#d()\">d</A>=3.14,"},
++                "<a href=\"../pkg1/A.html#d()\">d</a>=3.14,"},
+ 
+             //Double
+             {BUG_ID + FS + "pkg1" + FS + "B.html",
+-                "<A HREF=\"../pkg1/A.html#d()\">d</A>=3.14,"},
++                "<a href=\"../pkg1/A.html#d()\">d</a>=3.14,"},
+ 
+             //Boolean
+             {BUG_ID + FS + "pkg1" + FS + "B.html",
+-                "<A HREF=\"../pkg1/A.html#b()\">b</A>=true,"},
++                "<a href=\"../pkg1/A.html#b()\">b</a>=true,"},
+ 
+             //String
+             {BUG_ID + FS + "pkg1" + FS + "B.html",
+-                "<A HREF=\"../pkg1/A.html#s()\">s</A>=\"sigh\","},
++                "<a href=\"../pkg1/A.html#s()\">s</a>=\"sigh\","},
+ 
+             //Class
+             {BUG_ID + FS + "pkg1" + FS + "B.html",
+-                "<A HREF=\"../pkg1/A.html#c()\">c</A>=<A HREF=\"../pkg2/Foo.html\" title=\"class in pkg2\">Foo.class</A>,"},
++                "<a href=\"../pkg1/A.html#c()\">c</a>=<a href=\"../pkg2/Foo.html\" title=\"class in pkg2\">Foo.class</a>,"},
+ 
+             //Bounded Class
+             {BUG_ID + FS + "pkg1" + FS + "B.html",
+-                "<A HREF=\"../pkg1/A.html#w()\">w</A>=<A HREF=\"../pkg/TypeParameterSubClass.html\" title=\"class in pkg\">TypeParameterSubClass.class</A>,"},
++                "<a href=\"../pkg1/A.html#w()\">w</a>=<a href=\"../pkg/TypeParameterSubClass.html\" title=\"class in pkg\">TypeParameterSubClass.class</a>,"},
+ 
+             //Enum
+             {BUG_ID + FS + "pkg1" + FS + "B.html",
+-                "<A HREF=\"../pkg1/A.html#e()\">e</A>=<A HREF=\"../pkg/Coin.html#Penny\">Penny</A>,"},
++                "<a href=\"../pkg1/A.html#e()\">e</a>=<a href=\"../pkg/Coin.html#Penny\">Penny</a>,"},
+ 
+             //Annotation Type
+             {BUG_ID + FS + "pkg1" + FS + "B.html",
+-                "<A HREF=\"../pkg1/A.html#a()\">a</A>=<A HREF=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</A>(<A HREF=\"../pkg/AnnotationType.html#optional()\">optional</A>=\"foo\",<A HREF=\"../pkg/AnnotationType.html#required()\">required</A>=1994),"},
++                "<a href=\"../pkg1/A.html#a()\">a</a>=<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>=\"foo\",<a href=\"../pkg/AnnotationType.html#required()\">required</a>=1994),"},
+ 
+             //String Array
+             {BUG_ID + FS + "pkg1" + FS + "B.html",
+-                "<A HREF=\"../pkg1/A.html#sa()\">sa</A>={\"up\",\"down\"},"},
++                "<a href=\"../pkg1/A.html#sa()\">sa</a>={\"up\",\"down\"},"},
+ 
+             //Primitive
+             {BUG_ID + FS + "pkg1" + FS + "B.html",
+-                "<A HREF=\"../pkg1/A.html#primitiveClassTest()\">primitiveClassTest</A>=boolean.class,"},
++                "<a href=\"../pkg1/A.html#primitiveClassTest()\">primitiveClassTest</a>=boolean.class,"},
+ 
+             //XXX:  Add array test case after this if fixed:
+             //5020899: Incorrect internal representation of class-valued annotation elements
+ 
+             //Make sure that annotations are surrounded by <pre> and </pre>
+             {BUG_ID + FS + "pkg1" + FS + "B.html",
+-                "<PRE><FONT SIZE=\"-1\"><A HREF=\"../pkg1/A.html\" title=\"annotation in pkg1\">@A</A>"},
++                "<pre><a href=\"../pkg1/A.html\" title=\"annotation in pkg1\">@A</a>"},
+             {BUG_ID + FS + "pkg1" + FS + "B.html",
+-                "</FONT>public interface <STRONG>B</STRONG></PRE>"},
++                "public interface <strong>B</strong></pre>"},
+ 
+ 
+             //==============================================================
+             // Handle multiple bounds.
+             //==============================================================
+             {BUG_ID + FS + "pkg" + FS + "MultiTypeParameters.html",
+-                "public <T extends java.lang.Number & java.lang.Runnable> T <STRONG>foo</STRONG>(T t)"},
++                "public <T extends java.lang.Number & java.lang.Runnable> T foo(T t)"},
+ 
+             //==============================================================
+             // Test Class-Use Documenation for Type Parameters.
+@@ -289,347 +314,356 @@
+ 
+             //ClassUseTest1: <T extends Foo & Foo2>
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html",
+-                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
+-                     "Classes in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
+-                     "</A> with type parameters of type <A HREF=\"../../pkg2/Foo.html\" " +
+-                     "title=\"class in pkg2\">Foo</A></CAPTION>"
++                     "<caption><span>Classes in <a href=\"../../pkg2/" +
++                     "package-summary.html\">pkg2</a> with type parameters of " +
++                     "type <a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">" +
++                     "Foo</a></span><span class=\"tabEnd\"> </span></caption>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html",
+-                "<TD><CODE><STRONG><A HREF=\"../../pkg2/ClassUseTest1.html\" title=\"class in pkg2\">ClassUseTest1<T extends Foo & Foo2></A></STRONG></CODE>"
++                     "<td class=\"colLast\"><code><strong><a href=\"../../pkg2/" +
++                     "ClassUseTest1.html\" title=\"class in pkg2\">ClassUseTest1" +
++                     "<T extends Foo & Foo2></a></strong></code> </td>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html",
+-                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
+-                     "Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
+-                     "</A> with type parameters of type <A HREF=\"../../pkg2/Foo.html\" " +
+-                     "title=\"class in pkg2\">Foo</A></CAPTION>"
++                     "<caption><span>Methods in <a href=\"../../pkg2/" +
++                     "package-summary.html\">pkg2</a> with type parameters of " +
++                     "type <a href=\"../../pkg2/Foo.html\" title=\"class in " +
++                     "pkg2\">Foo</a></span><span class=\"tabEnd\"> </span></caption>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html",
+-                "<TD><CODE><STRONG>ClassUseTest1.</STRONG><STRONG><A HREF=\"../../pkg2/ClassUseTest1.html#method(T)\">method</A></STRONG>(T t)</CODE>"
++                     "<td class=\"colLast\"><span class=\"strong\">ClassUseTest1." +
++                     "</span><code><strong><a href=\"../../pkg2/" +
++                     "ClassUseTest1.html#method(T)\">method</a></strong>" +
++                     "(T t)</code> </td>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html",
+-                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
+-                     "Fields in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
+-                     "</A> with type parameters of type <A HREF=\"../../pkg2/Foo.html\" " +
+-                     "title=\"class in pkg2\">Foo</A></CAPTION>"
++                     "<caption><span>Fields in <a href=\"../../pkg2/" +
++                     "package-summary.html\">pkg2</a> with type parameters of " +
++                     "type <a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">" +
++                     "Foo</a></span><span class=\"tabEnd\"> </span></caption>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html",
+-                "<A HREF=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest</A><<A HREF=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo</A>></CODE></FONT></TD>"
++                     "td class=\"colFirst\"><code><a href=\"../../pkg2/" +
++                     "ParamTest.html\" title=\"class in pkg2\">ParamTest</a>" +
++                     "<<a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\"" +
++                     ">Foo</a>></code></td>"
+             },
+ 
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
+-                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
+-                     "Fields in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
+-                     "</A> declared as <A HREF=\"../../pkg2/ParamTest.html\" " +
+-                     "title=\"class in pkg2\">ParamTest</A></CAPTION>"
++                     "<caption><span>Fields in <a href=\"../../pkg2/" +
++                     "package-summary.html\">pkg2</a> declared as <a href=\"../" +
++                     "../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest" +
++                     "</a></span><span class=\"tabEnd\"> </span></caption>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
+-                "<A HREF=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest</A><<A HREF=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo</A>></CODE></FONT></TD>"
++                     "<td class=\"colFirst\"><code><a href=\"../../pkg2/" +
++                     "ParamTest.html\" title=\"class in pkg2\">ParamTest</a><<a " +
++                     "href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo</a" +
++                     ">></code></td>"
+             },
+ 
+            {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html",
+-                    "<CAPTION CLASS=\"TableSubCaption\">" + NL +
+-                    "Classes in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
+-                    "</A> with type parameters of type <A HREF=\"../../pkg2/Foo2.html\" " +
+-                    "title=\"interface in pkg2\">Foo2</A></CAPTION>"
++                    "<caption><span>Classes in <a href=\"../../pkg2/" +
++                    "package-summary.html\">pkg2</a> with type parameters of " +
++                    "type <a href=\"../../pkg2/Foo2.html\" title=\"interface " +
++                    "in pkg2\">Foo2</a></span><span class=\"tabEnd\"> " +
++                    "</span></caption>"
+            },
+            {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html",
+-            "<TD><CODE><STRONG><A HREF=\"../../pkg2/ClassUseTest1.html\" title=\"class in pkg2\">ClassUseTest1<T extends Foo & Foo2></A></STRONG></CODE>"
++                    "<td class=\"colLast\"><code><strong><a href=\"../../pkg2/" +
++                    "ClassUseTest1.html\" title=\"class in pkg2\">" +
++                    "ClassUseTest1<T extends Foo & Foo2></a></strong>" +
++                    "</code> </td>"
+            },
+            {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html",
+-                    "<CAPTION CLASS=\"TableSubCaption\">" + NL +
+-                    "Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
+-                    "</A> with type parameters of type <A HREF=\"../../pkg2/Foo2.html\" " +
+-                    "title=\"interface in pkg2\">Foo2</A></CAPTION>"
++                    "<caption><span>Methods in <a href=\"../../pkg2/" +
++                    "package-summary.html\">pkg2</a> with type parameters of " +
++                    "type <a href=\"../../pkg2/Foo2.html\" title=\"interface " +
++                    "in pkg2\">Foo2</a></span><span class=\"tabEnd\"> " +
++                    "</span></caption>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html",
+-               "<TD><CODE><STRONG>ClassUseTest1.</STRONG><STRONG><A HREF=\"../../pkg2/ClassUseTest1.html#method(T)\">method</A></STRONG>(T t)</CODE>"
++                     "<td class=\"colLast\"><span class=\"strong\">" +
++                     "ClassUseTest1.</span><code><strong><a href=\"../../" +
++                     "pkg2/ClassUseTest1.html#method(T)\">method</a></strong>" +
++                     "(T t)</code> </td>"
+             },
+ 
+             //ClassUseTest2: <T extends ParamTest<Foo3>>
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
+-                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
+-                     "Classes in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
+-                     "</A> with type parameters of type <A HREF=\"../../pkg2/ParamTest.html\" " +
+-                     "title=\"class in pkg2\">ParamTest</A></CAPTION>"
++                     "<caption><span>Classes in <a href=\"../../pkg2/" +
++                     "package-summary.html\">pkg2</a> with type parameters of " +
++                     "type <a href=\"../../pkg2/ParamTest.html\" title=\"class " +
++                     "in pkg2\">ParamTest</a></span><span class=\"tabEnd\">" +
++                     " </span></caption>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
+-              "<TD><CODE><STRONG><A HREF=\"../../pkg2/ClassUseTest2.html\" title=\"class in pkg2\">ClassUseTest2<T extends ParamTest<<A HREF=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3</A>>></A></STRONG></CODE>"
++                     "<td class=\"colLast\"><code><strong><a href=\"../../pkg2/" +
++                     "ClassUseTest2.html\" title=\"class in pkg2\">ClassUseTest2<T " +
++                     "extends ParamTest<<a href=\"../../pkg2/Foo3.html\" title=\"class " +
++                     "in pkg2\">Foo3</a>>></a></strong></code> </td>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
+-                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
+-                     "Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
+-                     "</A> with type parameters of type <A HREF=\"../../pkg2/ParamTest.html\" " +
+-                     "title=\"class in pkg2\">ParamTest</A></CAPTION>"
++                     "<caption><span>Methods in <a href=\"../../pkg2/" +
++                     "package-summary.html\">pkg2</a> with type parameters of " +
++                     "type <a href=\"../../pkg2/ParamTest.html\" title=\"class " +
++                     "in pkg2\">ParamTest</a></span><span class=\"tabEnd\">" +
++                     " </span></caption>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
+-              "<TD><CODE><STRONG>ClassUseTest2.</STRONG><STRONG><A HREF=\"../../pkg2/ClassUseTest2.html#method(T)\">method</A></STRONG>(T t)</CODE>"
++                     "<td class=\"colLast\"><span class=\"strong\">ClassUseTest2." +
++                     "</span><code><strong><a href=\"../../pkg2/" +
++                     "ClassUseTest2.html#method(T)\">method</a></strong>" +
++                     "(T t)</code> </td>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
+-                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
+-                     "Fields in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
+-                     "</A> declared as <A HREF=\"../../pkg2/ParamTest.html\" " +
+-                     "title=\"class in pkg2\">ParamTest</A></CAPTION>"
++                     "<caption><span>Fields in <a href=\"../../pkg2/" +
++                     "package-summary.html\">pkg2</a> declared as <a href=\"../" +
++                     "../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest" +
++                     "</a></span><span class=\"tabEnd\"> </span></caption>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
+-              "<A HREF=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest</A><<A HREF=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo</A>></CODE></FONT></TD>"
++                     "<td class=\"colFirst\"><code><a href=\"../../pkg2/" +
++                     "ParamTest.html\" title=\"class in pkg2\">ParamTest</a>" +
++                     "<<a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">" +
++                     "Foo</a>></code></td>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
+-                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
+-                     "Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
+-                     "</A> with type parameters of type <A HREF=\"../../pkg2/ParamTest.html\" " +
+-                     "title=\"class in pkg2\">ParamTest</A></CAPTION>"
++                     "<caption><span>Methods in <a href=\"../../pkg2/" +
++                     "package-summary.html\">pkg2</a> with type parameters of " +
++                     "type <a href=\"../../pkg2/ParamTest.html\" title=\"class " +
++                     "in pkg2\">ParamTest</a></span><span class=\"tabEnd\">" +
++                     " </span></caption>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
+-              "<T extends <A HREF=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest</A><<A HREF=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3</A>>>"
++                     "<td class=\"colFirst\"><code><T extends <a href=\"../" +
++                     "../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest" +
++                     "</a><<a href=\"../../pkg2/Foo3.html\" title=\"class in " +
++                     "pkg2\">Foo3</a>>> <br><a href=\"../../pkg2/" +
++                     "ParamTest.html\" title=\"class in pkg2\">ParamTest</a>" +
++                     "<<a href=\"../../pkg2/Foo3.html\" title=\"class in " +
++                     "pkg2\">Foo3</a>></code></td>"
+             },
+ 
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html",
+-                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
+-                     "Classes in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
+-                     "</A> with type parameters of type <A HREF=\"../../pkg2/Foo3.html\" " +
+-                     "title=\"class in pkg2\">Foo3</A></CAPTION>"
++                     "<caption><span>Classes in <a href=\"../../pkg2/" +
++                     "package-summary.html\">pkg2</a> with type parameters of " +
++                     "type <a href=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">" +
++                     "Foo3</a></span><span class=\"tabEnd\"> </span></caption>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html",
+-                "<TD><CODE><STRONG><A HREF=\"../../pkg2/ClassUseTest2.html\" title=\"class in pkg2\">ClassUseTest2<T extends ParamTest<<A HREF=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3</A>>></A></STRONG></CODE>"
++                     "<td class=\"colLast\"><code><strong><a href=\"../../" +
++                     "pkg2/ClassUseTest2.html\" title=\"class in pkg2\">" +
++                     "ClassUseTest2<T extends ParamTest<<a href=\"../../" +
++                     "pkg2/Foo3.html\" title=\"class in pkg2\">Foo3</a>>>" +
++                     "</a></strong></code> </td>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html",
+-                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
+-                     "Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
+-                     "</A> with type parameters of type <A HREF=\"../../pkg2/Foo3.html\" " +
+-                     "title=\"class in pkg2\">Foo3</A></CAPTION>"
++                     "<caption><span>Methods in <a href=\"../../pkg2/" +
++                     "package-summary.html\">pkg2</a> with type parameters of " +
++                     "type <a href=\"../../pkg2/Foo3.html\" title=\"class in " +
++                     "pkg2\">Foo3</a></span><span class=\"tabEnd\"> " +
++                     "</span></caption>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html",
+-                "<TD><CODE><STRONG>ClassUseTest2.</STRONG><STRONG><A HREF=\"../../pkg2/ClassUseTest2.html#method(T)\">method</A></STRONG>(T t)</CODE>"
++                     "<td class=\"colLast\"><span class=\"strong\">ClassUseTest2." +
++                     "</span><code><strong><a href=\"../../pkg2/" +
++                     "ClassUseTest2.html#method(T)\">method</a></strong>" +
++                     "(T t)</code> </td>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html",
+-                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
+-                     "Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
+-                     "</A> that return types with arguments of type " +
+-                     "<A HREF=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">" +
+-                     "Foo3</A></CAPTION>"
++                     "<caption><span>Methods in <a href=\"../../pkg2/" +
++                     "package-summary.html\">pkg2</a> that return types with " +
++                     "arguments of type <a href=\"../../pkg2/Foo3.html\" title" +
++                     "=\"class in pkg2\">Foo3</a></span><span class=\"tabEnd\">" +
++                     " </span></caption>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html",
+-                "<T extends <A HREF=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest</A><<A HREF=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3</A>>>"
++                     "<td class=\"colFirst\"><code><T extends <a href=\"../../" +
++                     "pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest</a><" +
++                     "<a href=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3" +
++                     "</a>>> <br><a href=\"../../pkg2/ParamTest.html\" " +
++                     "title=\"class in pkg2\">ParamTest</a><<a href=\"../../pkg2/" +
++                     "Foo3.html\" title=\"class in pkg2\">Foo3</a>></code></td>"
+             },
+ 
+             //ClassUseTest3: <T extends ParamTest2<List<? extends Foo4>>>
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
+-                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
+-                     "Classes in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
+-                     "</A> with type parameters of type " +
+-                     "<A HREF=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">" +
+-                     "ParamTest2</A></CAPTION>"
++                     "<caption><span>Classes in <a href=\"../../pkg2/" +
++                     "package-summary.html\">pkg2</a> with type parameters of " +
++                     "type <a href=\"../../pkg2/ParamTest2.html\" title=\"class " +
++                     "in pkg2\">ParamTest2</a></span><span class=\"tabEnd\">" +
++                     " </span></caption>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
+-                "<TD><CODE><STRONG><A HREF=\"../../pkg2/ClassUseTest3.html\" title=\"class in pkg2\">ClassUseTest3<T extends ParamTest2<java.util.List<? extends Foo4>>></A></STRONG></CODE>"
++                     "<td class=\"colLast\"><code><strong><a href=\"../../pkg2/" +
++                     "ClassUseTest3.html\" title=\"class in pkg2\">" +
++                     "ClassUseTest3<T extends ParamTest2<java.util.List" +
++                     "<? extends Foo4>>></a></strong></code> </td>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
+-                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
+-                     "Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
+-                     "</A> with type parameters of type " +
+-                     "<A HREF=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">" +
+-                     "ParamTest2</A></CAPTION>"
++                     "<caption><span>Methods in <a href=\"../../pkg2/" +
++                     "package-summary.html\">pkg2</a> with type parameters of " +
++                     "type <a href=\"../../pkg2/ParamTest2.html\" title=\"class " +
++                     "in pkg2\">ParamTest2</a></span><span class=\"tabEnd\">" +
++                     " </span></caption>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
+-                "<TD><CODE><STRONG>ClassUseTest3.</STRONG><STRONG><A HREF=\"../../pkg2/ClassUseTest3.html#method(T)\">method</A></STRONG>(T t)</CODE>"
++                     "<td class=\"colLast\"><span class=\"strong\">ClassUseTest3" +
++                     ".</span><code><strong><a href=\"../../pkg2/ClassUseTest3." +
++                     "html#method(T)\">method</a></strong>(T t)</code> </td>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
+-                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
+-                     "Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
+-                     "</A> with type parameters of type " +
+-                     "<A HREF=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">" +
+-                     "ParamTest2</A></CAPTION>"
+-            },
+-            {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
+-                "<T extends <A HREF=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">ParamTest2</A><java.util.List<? extends <A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</A>>>>"
++                     "<td class=\"colFirst\"><code><T extends <a href=\"../" +
++                     "../pkg2/ParamTest2.html\" title=\"class in pkg2\">" +
++                     "ParamTest2</a><java.util.List<? extends <a href=\".." +
++                     "/../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</a>>" +
++                     ">> <br><a href=\"../../pkg2/ParamTest2.html\" " +
++                     "title=\"class in pkg2\">ParamTest2</a><java.util.List" +
++                     "<? extends <a href=\"../../pkg2/Foo4.html\" title=\"" +
++                     "class in pkg2\">Foo4</a>>></code></td>"
+             },
+ 
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
+-                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
+-                     "Classes in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
+-                     "</A> with type parameters of type " +
+-                     "<A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">" +
+-                     "Foo4</A></CAPTION>"
++                     "<caption><span>Classes in <a href=\"../../pkg2/" +
++                     "package-summary.html\">pkg2</a> with type parameters of " +
++                     "type <a href=\"../../pkg2/Foo4.html\" title=\"class in " +
++                     "pkg2\">Foo4</a></span><span class=\"tabEnd\"> " +
++                     "</span></caption>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
+-                "<TD><CODE><STRONG><A HREF=\"../../pkg2/ClassUseTest3.html\" title=\"class in pkg2\">ClassUseTest3<T extends ParamTest2<java.util.List<? extends Foo4>>></A></STRONG></CODE>"
++                     "<td class=\"colLast\"><code><strong><a href=\"../../" +
++                     "pkg2/ClassUseTest3.html\" title=\"class in pkg2\">" +
++                     "ClassUseTest3<T extends ParamTest2<java.util.List" +
++                     "<? extends Foo4>>></a></strong></code> </td>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
+-                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
+-                     "Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
+-                     "</A> with type parameters of type <A HREF=\"../../pkg2/Foo4.html\" " +
+-                     "title=\"class in pkg2\">Foo4</A></CAPTION>"
++                     "<caption><span>Methods in <a href=\"../../pkg2/" +
++                     "package-summary.html\">pkg2</a> with type parameters of " +
++                     "type <a href=\"../../pkg2/Foo4.html\" title=\"class in " +
++                     "pkg2\">Foo4</a></span><span class=\"tabEnd\"> </span></caption>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
+-                "<TD><CODE><STRONG>ClassUseTest3.</STRONG><STRONG><A HREF=\"../../pkg2/ClassUseTest3.html#method(T)\">method</A></STRONG>(T t)</CODE>"
++                     "<td class=\"colLast\"><span class=\"strong\">ClassUseTest3." +
++                     "</span><code><strong><a href=\"../../pkg2/ClassUseTest3." +
++                     "html#method(T)\">method</a></strong>(T t)</code>" +
++                     " </td>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
+-                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
+-                     "Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
+-                     "</A> that return types with arguments of type " +
+-                     "<A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">" +
+-                     "Foo4</A></CAPTION>"
++                     "<caption><span>Methods in <a href=\"../../pkg2/" +
++                     "package-summary.html\">pkg2</a> that return types with " +
++                     "arguments of type <a href=\"../../pkg2/Foo4.html\" " +
++                     "title=\"class in pkg2\">Foo4</a></span><span class=\"" +
++                     "tabEnd\"> </span></caption>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
+-                "<T extends <A HREF=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">ParamTest2</A><java.util.List<? extends <A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</A>>>>"
++                     "<td class=\"colFirst\"><code><T extends <a href=\"../" +
++                     "../pkg2/ParamTest2.html\" title=\"class in pkg2\">" +
++                     "ParamTest2</a><java.util.List<? extends <a href=\".." +
++                     "/../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</a>>" +
++                     ">> <br><a href=\"../../pkg2/ParamTest2.html\" " +
++                     "title=\"class in pkg2\">ParamTest2</a><java.util.List" +
++                     "<? extends <a href=\"../../pkg2/Foo4.html\" title=\"" +
++                     "class in pkg2\">Foo4</a>>></code></td>"
+             },
+ 
+             //Type parameters in constructor and method args
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
+-                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
+-                     "Method parameters in <A HREF=\"../../pkg2/package-summary.html\">pkg2" +
+-                     "</A> with type arguments of type <A HREF=\"../../pkg2/Foo4.html\" " +
+-                     "title=\"class in pkg2\">Foo4</A></CAPTION>" + NL +
+-                     "<TR>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
+-                     " NOWRAP>Modifier and Type" +
+-                     "</TH>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
+-                     " NOWRAP>Method and Description</TH>" + NL +
+-                     "</TR>" + NL +
+-                     "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
+-                     "<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\"><FONT SIZE=\"-1\">" + NL +
+-                     "<CODE> void</CODE></FONT></TD>" + NL +
+-                     "<TD><CODE><STRONG>ClassUseTest3.</STRONG><STRONG>" +
+-                     "<A HREF=\"../../pkg2/ClassUseTest3.html#method(java.util.Set)\">" +
+-                     "method</A></STRONG>(java.util.Set<<A HREF=\"../../pkg2/Foo4.html\" " +
+-                     "title=\"class in pkg2\">Foo4</A>> p)</CODE>"
++                     "<caption><span>Method parameters in <a href=\"../../pkg2/" +
++                     "package-summary.html\">pkg2</a> with type arguments of " +
++                     "type <a href=\"../../pkg2/Foo4.html\" title=\"class in " +
++                     "pkg2\">Foo4</a></span><span class=\"tabEnd\"> " +
++                     "</span></caption>" + NL + "<tr>" + NL +
++                     "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL +
++                     "<th class=\"colLast\" scope=\"col\">Method and Description</th>" + NL +
++                     "</tr>" + NL + "<tbody>" + NL + "<tr class=\"altColor\">" + NL +
++                     "<td class=\"colFirst\"><code>void</code></td>" + NL +
++                     "<td class=\"colLast\"><span class=\"strong\">ClassUseTest3." +
++                     "</span><code><strong><a href=\"../../pkg2/ClassUseTest3." +
++                     "html#method(java.util.Set)\">method</a></strong>(java." +
++                     "util.Set<<a href=\"../../pkg2/Foo4.html\" title=\"" +
++                     "class in pkg2\">Foo4</a>> p)</code> </td>" + NL +
++                     "</tr>" + NL + "</tbody>"
+             },
+             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
+-                     "<CAPTION CLASS=\"TableSubCaption\">" + NL +
+-                     "Constructor parameters in <A HREF=\"../../pkg2/package-summary.html\">" +
+-                     "pkg2</A> with type arguments of type <A HREF=\"../../pkg2/Foo4.html\" " +
+-                     "title=\"class in pkg2\">Foo4</A></CAPTION>" + NL +
+-                     "<TR>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
+-                     " NOWRAP>Constructor and Description" +
+-                     "</TH>" + NL + "</TR>" + NL +
+-                     "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
+-                     "<TD><CODE><STRONG><A HREF=\"../../pkg2/ClassUseTest3.html#ClassUseTest3" +
+-                     "(java.util.Set)\">ClassUseTest3</A></STRONG>(java.util.Set<" +
+-                     "<A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">" +
+-                     "Foo4</A>> p)</CODE>"
++                     "<caption><span>Constructor parameters in <a href=\"../../" +
++                     "pkg2/package-summary.html\">pkg2</a> with type arguments " +
++                     "of type <a href=\"../../pkg2/Foo4.html\" title=\"class in " +
++                     "pkg2\">Foo4</a></span><span class=\"tabEnd\"> " +
++                     "</span></caption>"
+             },
+ 
+             //=================================
+             // Annotatation Type Usage
+             //=================================
+             {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "AnnotationType.html",
+-                     "Packages with annotations of type " +
+-                     "<A HREF=\"../../pkg/AnnotationType.html\" " +
+-                     "title=\"annotation in pkg\">AnnotationType</A></CAPTION>" + NL +
+-                     "<TR>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
+-                     " NOWRAP>Package" +
+-                     "</TH>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
+-                     " NOWRAP>Description</TH>" + NL + "</TR>" + NL +
+-                     "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
+-                     "<TD><A HREF=\"../../pkg/package-summary.html\"><STRONG>pkg" +
+-                     "</STRONG></A></TD>"
++                     "<caption><span>Packages with annotations of type <a href=\"" +
++                     "../../pkg/AnnotationType.html\" title=\"annotation in pkg\">" +
++                     "AnnotationType</a></span><span class=\"tabEnd\"> " +
++                     "</span></caption>"
+             },
+ 
+             {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "AnnotationType.html",
+-                     "Classes in <A HREF=\"../../pkg/package-summary.html\">pkg" +
+-                     "</A> with annotations of type <A HREF=\"../../pkg/AnnotationType.html\" " +
+-                     "title=\"annotation in pkg\">AnnotationType</A></CAPTION>" + NL +
+-                     "<TR>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
+-                     " NOWRAP>Modifier and Type" +
+-                     "</TH>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
+-                     " NOWRAP>Class and Description</TH>" + NL +
+-                     "</TR>" + NL +
+-                     "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
+-                     "<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\"><FONT SIZE=\"-1\">" + NL +
+-                     "<CODE> class</CODE></FONT></TD>" + NL +
+-                     "<TD><CODE><STRONG><A HREF=\"../../pkg/AnnotationTypeUsage.html\" " +
+-                     "title=\"class in pkg\">AnnotationTypeUsage</A></STRONG></CODE>"
++                     "<caption><span>Classes in <a href=\"../../pkg/" +
++                     "package-summary.html\">pkg</a> with annotations of type " +
++                     "<a href=\"../../pkg/AnnotationType.html\" title=\"" +
++                     "annotation in pkg\">AnnotationType</a></span><span class" +
++                     "=\"tabEnd\"> </span></caption>"
+             },
+ 
+             {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "AnnotationType.html",
+-                     "Fields in <A HREF=\"../../pkg/package-summary.html\">pkg" +
+-                     "</A> with annotations of type <A HREF=\"../../pkg/AnnotationType.html\" " +
+-                     "title=\"annotation in pkg\">AnnotationType</A></CAPTION>" + NL +
+-                     "<TR>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
+-                     " NOWRAP>Modifier and Type" +
+-                     "</TH>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
+-                     " NOWRAP>Field and Description</TH>" + NL +
+-                     "</TR>" + NL +
+-                     "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
+-                     "<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\"><FONT SIZE=\"-1\">" + NL +
+-                     "<CODE> int</CODE></FONT></TD>" + NL +
+-                     "<TD><CODE><STRONG>AnnotationTypeUsage.</STRONG><STRONG>" +
+-                     "<A HREF=\"../../pkg/AnnotationTypeUsage.html#field\">field" +
+-                     "</A></STRONG></CODE>"
++                     "<caption><span>Fields in <a href=\"../../pkg/" +
++                     "package-summary.html\">pkg</a> with annotations of type " +
++                     "<a href=\"../../pkg/AnnotationType.html\" title=\"annotation " +
++                     "in pkg\">AnnotationType</a></span><span class=\"tabEnd\">" +
++                     " </span></caption>"
+             },
+ 
+             {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "AnnotationType.html",
+-                     "Methods in <A HREF=\"../../pkg/package-summary.html\">pkg" +
+-                     "</A> with annotations of type <A HREF=\"../../pkg/AnnotationType.html\" " +
+-                     "title=\"annotation in pkg\">AnnotationType</A></CAPTION>" + NL +
+-                     "<TR>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
+-                     " NOWRAP>Modifier and Type" +
+-                     "</TH>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
+-                     " NOWRAP>Method and Description</TH>" + NL +
+-                     "</TR>" + NL +
+-                     "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
+-                     "<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\"><FONT SIZE=\"-1\">" + NL +
+-                     "<CODE> void</CODE></FONT></TD>" + NL +
+-                     "<TD><CODE><STRONG>AnnotationTypeUsage.</STRONG><STRONG>" +
+-                     "<A HREF=\"../../pkg/AnnotationTypeUsage.html#method()\">" +
+-                     "method</A></STRONG>()</CODE>"
++                     "<caption><span>Methods in <a href=\"../../pkg/" +
++                     "package-summary.html\">pkg</a> with annotations of type " +
++                     "<a href=\"../../pkg/AnnotationType.html\" title=\"annotation " +
++                     "in pkg\">AnnotationType</a></span><span class=\"tabEnd\">" +
++                     " </span></caption>"
+             },
+ 
+             {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "AnnotationType.html",
+-                     "Method parameters in <A HREF=\"../../pkg/package-summary.html\">pkg" +
+-                     "</A> with annotations of type <A HREF=\"../../pkg/AnnotationType.html\" " +
+-                     "title=\"annotation in pkg\">AnnotationType</A></CAPTION>" + NL +
+-                     "<TR>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
+-                     " NOWRAP>Modifier and Type" +
+-                     "</TH>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
+-                     " NOWRAP>Method and Description</TH>" + NL +
+-                     "</TR>" + NL +
+-                     "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
+-                     "<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\"><FONT SIZE=\"-1\">" + NL +
+-                     "<CODE> void</CODE></FONT></TD>" + NL +
+-                     "<TD><CODE><STRONG>AnnotationTypeUsage.</STRONG><STRONG>" +
+-                     "<A HREF=\"../../pkg/AnnotationTypeUsage.html#methodWithParams" +
+-                     "(int, int)\">methodWithParams</A></STRONG>(int documented," + NL +
+-                     "                 int undocmented)</CODE>"
++                     "<caption><span>Method parameters in <a href=\"../../pkg/" +
++                     "package-summary.html\">pkg</a> with annotations of type " +
++                     "<a href=\"../../pkg/AnnotationType.html\" title=\"annotation " +
++                     "in pkg\">AnnotationType</a></span><span class=\"tabEnd\">" +
++                     " </span></caption>"
+             },
+ 
+             {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "AnnotationType.html",
+-                     "Constructors in <A HREF=\"../../pkg/package-summary.html\">pkg" +
+-                     "</A> with annotations of type <A HREF=\"../../pkg/AnnotationType.html\" " +
+-                     "title=\"annotation in pkg\">AnnotationType</A></CAPTION>" + NL +
+-                     "<TR>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
+-                     " NOWRAP>Constructor and Description" +
+-                     "</TH>" + NL + "</TR>" + NL +
+-                     "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
+-                     "<TD><CODE><STRONG><A HREF=\"../../pkg/" +
+-                     "AnnotationTypeUsage.html#AnnotationTypeUsage()\">" +
+-                     "AnnotationTypeUsage</A></STRONG>()</CODE>"
++                     "<caption><span>Constructors in <a href=\"../../pkg/" +
++                     "package-summary.html\">pkg</a> with annotations of type " +
++                     "<a href=\"../../pkg/AnnotationType.html\" title=\"annotation " +
++                     "in pkg\">AnnotationType</a></span><span class=\"tabEnd\">" +
++                     " </span></caption>"
+             },
+ 
+             {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "AnnotationType.html",
+-                     "Constructor parameters in <A HREF=\"../../pkg/package-summary.html\">pkg" +
+-                     "</A> with annotations of type <A HREF=\"../../pkg/AnnotationType.html\" " +
+-                     "title=\"annotation in pkg\">AnnotationType</A></CAPTION>" + NL +
+-                     "<TR>" + NL + "<TH CLASS=\"TableHeader\" SCOPE=\"col\"" +
+-                     " NOWRAP>Constructor and Description" +
+-                     "</TH>" + NL + "</TR>" + NL +
+-                     "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL +
+-                     "<TD><CODE><STRONG><A HREF=\"../../pkg/" +
+-                     "AnnotationTypeUsage.html#AnnotationTypeUsage(int, int)\">" +
+-                     "AnnotationTypeUsage</A></STRONG>(int documented," + NL +
+-                     "                    int undocmented)</CODE>"
++                     "<caption><span>Constructor parameters in <a href=\"../../" +
++                     "pkg/package-summary.html\">pkg</a> with annotations of " +
++                     "type <a href=\"../../pkg/AnnotationType.html\" title=\"" +
++                     "annotation in pkg\">AnnotationType</a></span><span class=\"" +
++                     "tabEnd\"> </span></caption>"
+             },
+ 
+             //=================================
+             // TYPE PARAMETER IN INDEX
+             //=================================
+             {BUG_ID + FS + "index-all.html",
+-                "<A HREF=\"./pkg2/Foo.html#method(java.util.Vector)\"><STRONG>method(Vector<Object>)</STRONG></A>"
++                "<span class=\"strong\"><a href=\"./pkg2/Foo.html#method(java.util.Vector)\">" +
++                "method(Vector<Object>)</a></span>"
+             },
+             //=================================
+             // TYPE PARAMETER IN INDEX
+             //=================================
+             {BUG_ID + FS + "index-all.html",
+-                "<A HREF=\"./pkg2/Foo.html#method(java.util.Vector)\"><STRONG>method(Vector<Object>)</STRONG></A>"
++                "<span class=\"strong\"><a href=\"./pkg2/Foo.html#method(java.util.Vector)\">" +
++                "method(Vector<Object>)</a></span>"
+             },
+         };
+     private static final String[][] NEGATED_TEST = {
+@@ -637,15 +671,15 @@
+         // ENUM TESTING
+         //=================================
+         //NO constructor section
+-        {BUG_ID + FS + "pkg" + FS + "Coin.html", "<STRONG>Constructor Summary</STRONG>"},
++        {BUG_ID + FS + "pkg" + FS + "Coin.html", "<span class=\"strong\">Constructor Summary</span>"},
+         //=================================
+         // TYPE PARAMETER TESTING
+         //=================================
+         //No type parameters in class frame.
+         {BUG_ID + FS + "allclasses-frame.html",
+-            "<A HREF=\"../pkg/TypeParameters.html\" title=\"class in pkg\">" +
+-                    "TypeParameters</A><<A HREF=\"../pkg/TypeParameters.html\" " +
+-                    "title=\"type parameter in TypeParameters\">E</A>>"
++            "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">" +
++                    "TypeParameters</a><<a href=\"../pkg/TypeParameters.html\" " +
++                    "title=\"type parameter in TypeParameters\">E</a>>"
+         },
+ 
+         //==============================================================
+@@ -654,31 +688,27 @@
+ 
+         //CLASS
+         {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
+-            "<FONT SIZE=\"-1\">" + NL +
+-            "<A HREF=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</A>(<A HREF=\"../pkg/AnnotationType.html#optional\">optional</A>=\"Class Annotation\"," + NL +
+-            "                <A HREF=\"../pkg/AnnotationType.html#required\">required</A>=1994)" + NL +
+-            "</FONT>public class <STRONG>AnnotationTypeUsage</STRONG></DT><DT>extends java.lang.Object</DT></DL>"},
++            "<a href=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</a>(<a href=\"../pkg/AnnotationType.html#optional\">optional</a>=\"Class Annotation\"," + NL +
++            "                <a href=\"../pkg/AnnotationType.html#required\">required</a>=1994)" + NL +
++            "public class <strong>AnnotationTypeUsage</strong></dt><dt>extends java.lang.Object</dt>"},
+ 
+         //FIELD
+         {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
+-            "<FONT SIZE=\"-1\">" + NL +
+-            "<A HREF=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</A>(<A HREF=\"../pkg/AnnotationType.html#optional\">optional</A>=\"Field Annotation\"," + NL +
+-            "                <A HREF=\"../pkg/AnnotationType.html#required\">required</A>=1994)" + NL +
+-            "</FONT>public int <STRONG>field</STRONG>"},
++            "<a href=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</a>(<a href=\"../pkg/AnnotationType.html#optional\">optional</a>=\"Field Annotation\"," + NL +
++            "                <a href=\"../pkg/AnnotationType.html#required\">required</a>=1994)" + NL +
++            "public int <strong>field</strong>"},
+ 
+         //CONSTRUCTOR
+         {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
+-            "<FONT SIZE=\"-1\">" + NL +
+-            "<A HREF=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</A>(<A HREF=\"../pkg/AnnotationType.html#optional\">optional</A>=\"Constructor Annotation\"," + NL +
+-            "                <A HREF=\"../pkg/AnnotationType.html#required\">required</A>=1994)" + NL +
+-            "</FONT>public <STRONG>AnnotationTypeUsage</STRONG>()"},
++            "<a href=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</a>(<a href=\"../pkg/AnnotationType.html#optional\">optional</a>=\"Constructor Annotation\"," + NL +
++            "                <a href=\"../pkg/AnnotationType.html#required\">required</a>=1994)" + NL +
++            "public <strong>AnnotationTypeUsage</strong>()"},
+ 
+         //METHOD
+         {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
+-            "<FONT SIZE=\"-1\">" + NL +
+-            "<A HREF=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</A>(<A HREF=\"../pkg/AnnotationType.html#optional\">optional</A>=\"Method Annotation\"," + NL +
+-            "                <A HREF=\"../pkg/AnnotationType.html#required\">required</A>=1994)" + NL +
+-            "</FONT>public void <STRONG>method</STRONG>()"},
++            "<a href=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</a>(<a href=\"../pkg/AnnotationType.html#optional\">optional</a>=\"Method Annotation\"," + NL +
++            "                <a href=\"../pkg/AnnotationType.html#required\">required</a>=1994)" + NL +
++            "public void <strong>method</strong>()"},
+ 
+         //=================================
+         // Make sure annotation types do not
+diff --git a/test/com/sun/javadoc/testOverridenMethods/TestMultiInheritence.java b/test/com/sun/javadoc/testOverridenMethods/TestMultiInheritence.java
+--- langtools/test/com/sun/javadoc/testOverridenMethods/TestMultiInheritence.java
++++ langtools/test/com/sun/javadoc/testOverridenMethods/TestMultiInheritence.java
+@@ -46,27 +46,34 @@
+     //Method foo() is inherited from BOTH I2 and I3
+     private static final String[][] TEST = {
+        {BUG_ID + FS + "pkg3" + FS + "I1.html",
+-        "Methods inherited from interface pkg3." +
+        "<A HREF=\"../pkg3/I2.html\" title=\"interface in pkg3\">I2</A>"},
++        "Methods inherited from interface pkg3." +
++                "<a href=\"../pkg3/I2.html\" title=\"interface in pkg3\">" +
++                "I2</a>"},
+         {BUG_ID + FS + "pkg3" + FS +"I1.html",
+-        "Methods inherited from interface pkg3." +
+-        "<A HREF=\"../pkg3/I3.html\" title=\"interface in pkg3\">I3</A>"},
++        "Methods inherited from interface pkg3." +
++                 "<a href=\"../pkg3/I3.html\" title=\"interface in pkg3\">" +
++                 "I3</a>"},
+         {BUG_ID + FS + "pkg3" + FS + "I0.html",
+-        "Methods inherited from interface pkg3." +
+-        "<A HREF=\"../pkg3/I2.html\" title=\"interface in pkg3\">I2</A>"},
++        "Methods inherited from interface pkg3." +
++                 "<a href=\"../pkg3/I2.html\" title=\"interface in pkg3\">" +
++                 "I2</a>"},
+         {BUG_ID + FS + "pkg3" + FS +"I0.html",
+-        "Methods inherited from interface pkg3." +
+-        "<A HREF=\"../pkg3/I3.html\" title=\"interface in pkg3\">I3</A>"},
++        "Methods inherited from interface pkg3." +
++                 "<a href=\"../pkg3/I3.html\" title=\"interface in pkg3\">" +
++                 "I3</a>"},
+     };
+ 
+     //Method foo() is NOT inherited from I4 because it is overriden by
+     //I3.
+     private static final String[][] NEGATED_TEST = {
+         {BUG_ID + FS + "pkg3" + FS + "I1.html",
+-        "Methods inherited from interface pkg3." +
+-        "<A HREF=\"../pkg3/I4.html\" title=\"interface in pkg3\">I4</A>"},
++        "Methods inherited from interface pkg3." +
++                 "<a href=\"../pkg3/I4.html\" title=\"interface in pkg3\">" +
++                 "I4</a>"},
+         {BUG_ID + FS + "pkg3" + FS + "I0.html",
+-        "Methods inherited from interface pkg3." +
+-        "<A HREF=\"../pkg3/I4.html\" title=\"interface in pkg3\">I4</A>"},
++        "Methods inherited from interface pkg3." +
++                 "<a href=\"../pkg3/I4.html\" title=\"interface in pkg3\">" +
++                 "I4</a>"},
+     };
+ 
+     /**
+diff --git a/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java b/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java
+--- langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java
++++ langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java
+@@ -46,9 +46,9 @@
+     //Input for string search tests.
+     private static final String[][] TEST = {
+         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
+-            "<STRONG>Description copied from class: <CODE>" +
+-            "<A HREF=\"../pkg1/BaseClass.html#overridenMethodWithDocsToCopy()\">" +
+-            "BaseClass</A></CODE></STRONG>"
++            "<strong>Description copied from class: <code>" +
++            "<a href=\"../pkg1/BaseClass.html#overridenMethodWithDocsToCopy()\">" +
++            "BaseClass</a></code></strong>"
+         }
+     };
+     private static final String[][] NEGATED_TEST = NO_TEST;
+diff --git a/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethods.java b/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethods.java
+--- langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethods.java
++++ langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethods.java
+@@ -40,11 +40,13 @@
+     private static final String[][] TEST = {
+         //The public method should be overriden
+         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
+-         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"},
++         "<dt><strong>Overrides:</strong></dt>" + NL +
++                 "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod"},
+ 
+         //The public method in different package should be overriden
+         {BUG_ID + FS + "pkg2" + FS + "SubClass.html",
+-         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"}
++         "<dt><strong>Overrides:</strong></dt>" + NL +
++                 "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod"}
+     };
+ 
+     private static final String[][] NEGATED_TEST = {
+@@ -52,20 +54,23 @@
+         //The package private method should be overriden since the base and sub class are in the same
+         //package.  However, the link should not show up because the package private methods are not documented.
+         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
+-         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"},
++         "<dt><strong>Overrides:</strong></dt>" + NL +
++                 "<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod"},
+ 
+         //The private method in should not be overriden
+         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
+-         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"},
++         "<dt><strong>Overrides:</strong></dt>" + NL +
++                 "<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod"},
+ 
+         //The private method in different package should not be overriden
+         {BUG_ID + FS + "pkg2" + FS + "SubClass.html",
+-         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"},
++         "<dt><strong>Overrides:</strong></dt>" + NL +
++                 "<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod"},
+ 
+         //The package private method should not be overriden since the base and sub class are in
+         //different packages.
+         {BUG_ID + FS + "pkg2" + FS + "SubClass.html",
+-         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"}
++         "Overrides:</strong></dt><dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod"}
+     };
+ 
+     private static final String[] ARGS =
+diff --git a/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java b/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java
+--- langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java
++++ langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java
+@@ -40,32 +40,44 @@
+     private static final String[][] TEST = {
+         //The public method should be overriden
+         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
+-         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"},
++         "<dt><strong>Overrides:</strong></dt>" + NL +
++                 "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod()\">" +
++                 "publicMethod</a></code> in class <code>" +
++                 "<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>"},
+ 
+         //The public method in different package should be overriden
+         {BUG_ID + FS + "pkg2" + FS + "SubClass.html",
+-         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"},
++         "<dt><strong>Overrides:</strong></dt>" + NL +
++                 "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod()\">" +
++                 "publicMethod</a></code> in class <code>" +
++                 "<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>"},
+ 
+         //The package private method should be overriden since the base and sub class are in the same
+         //package.
+         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
+-         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"}
++         "<dt><strong>Overrides:</strong></dt>" + NL +
++                 "<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod()\">" +
++                 "packagePrivateMethod</a></code> in class <code>" +
++                 "<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>"}
+     };
+ 
+     private static final String[][] NEGATED_TEST = {
+ 
+         //The private method in should not be overriden
+         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
+-         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"},
++         "<dt><strong>Overrides:</strong></dt>" + NL +
++                 "<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod()\">"},
+ 
+         //The private method in different package should not be overriden
+         {BUG_ID + FS + "pkg2" + FS + "SubClass.html",
+-         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"},
++         "<dt><strong>Overrides:</strong></dt>" + NL +
++                 "<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod()\">"},
+ 
+         //The package private method should not be overriden since the base and sub class are in
+         //different packages.
+         {BUG_ID + FS + "pkg2" + FS + "SubClass.html",
+-         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"},
++         "<dt><strong>Overrides:</strong></dt>" + NL +
++                 "<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod()\">"},
+     };
+ 
+     private static final String[] ARGS =
+diff --git a/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPrivateFlag.java b/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPrivateFlag.java
+--- langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPrivateFlag.java
++++ langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPrivateFlag.java
+@@ -40,32 +40,38 @@
+     private static final String[][] TEST = {
+         //The public method should be overriden
+         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
+-         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"},
++         "<dt><strong>Overrides:</strong></dt>" + NL +
++                 "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod"},
+ 
+         //The package private method should be overriden since the base and sub class are in the same
+         //package.
+         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
+-         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"},
++         "<dt><strong>Overrides:</strong></dt>" + NL +
++                 "<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod"},
+ 
+         //The public method in different package should be overriden
+         {BUG_ID + FS + "pkg2" + FS + "SubClass.html",
+-         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"},
++         "<dt><strong>Overrides:</strong></dt>" + NL +
++                 "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod"},
+     };
+ 
+     private static final String[][] NEGATED_TEST = {
+ 
+         //The private method in should not be overriden
+         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
+-         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"},
++         "<dt><strong>Overrides:</strong></dt>" + NL +
++                 "<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod"},
+ 
+         //The private method in different package should not be overriden
+         {BUG_ID + FS + "pkg2" + FS + "SubClass.html",
+-         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"},
++         "<dt><strong>Overrides:</strong></dt>" + NL +
++                 "<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod"},
+ 
+         //The package private method should not be overriden since the base and sub class are in
+         //different packages.
+         {BUG_ID + FS + "pkg2" + FS + "SubClass.html",
+-         "Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"}
++         "<dt><strong>Overrides:</strong></dt>" + NL +
++                 "<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod"}
+ 
+ 
+     };
+diff --git a/test/com/sun/javadoc/testPackagePage/TestPackagePage.java b/test/com/sun/javadoc/testPackagePage/TestPackagePage.java
+--- langtools/test/com/sun/javadoc/testPackagePage/TestPackagePage.java
++++ langtools/test/com/sun/javadoc/testPackagePage/TestPackagePage.java
+@@ -43,37 +43,32 @@
+         },
+         //With just one package, all general pages link to the single package page.
+         {BUG_ID + "-1" + FS + "com" + FS + "pkg" + FS + "C.html",
+-            "<A HREF=\"../../com/pkg/package-summary.html\">" +
+-            "<FONT CLASS=\"NavBarFont1\"><STRONG>Package</STRONG></FONT></A>"
++            "<a href=\"../../com/pkg/package-summary.html\">Package</a>"
+         },
+         {BUG_ID + "-1" + FS + "com" + FS + "pkg" + FS + "package-tree.html",
+-            "<A HREF=\"../../com/pkg/package-summary.html\">" +
+-            "<FONT CLASS=\"NavBarFont1\"><STRONG>Package</STRONG></FONT></A>"
++            "<li><a href=\"../../com/pkg/package-summary.html\">Package</a></li>"
+         },
+         {BUG_ID + "-1" + FS + "deprecated-list.html",
+-            "<A HREF=\"com/pkg/package-summary.html\">" +
+-            "<FONT CLASS=\"NavBarFont1\"><STRONG>Package</STRONG></FONT></A>"
++            "<li><a href=\"com/pkg/package-summary.html\">Package</a></li>"
+         },
+         {BUG_ID + "-1" + FS + "index-all.html",
+-            "<A HREF=\"./com/pkg/package-summary.html\">" +
+-            "<FONT CLASS=\"NavBarFont1\"><STRONG>Package</STRONG></FONT></A>"
++            "<li><a href=\"./com/pkg/package-summary.html\">Package</a></li>"
+         },
+         {BUG_ID + "-1" + FS + "help-doc.html",
+-            "<A HREF=\"com/pkg/package-summary.html\">" +
+-            "<FONT CLASS=\"NavBarFont1\"><STRONG>Package</STRONG></FONT></A>"
++            "<li><a href=\"com/pkg/package-summary.html\">Package</a></li>"
+         },
+     };
+ 
+     private static final String[][] TEST2 = {
+         //With multiple packages, there is no package link in general pages.
+         {BUG_ID + "-2" + FS + "deprecated-list.html",
+-            " <FONT CLASS=\"NavBarFont1\">Package</FONT> "
++            "<li>Package</li>"
+         },
+         {BUG_ID + "-2" + FS + "index-all.html",
+-            " <FONT CLASS=\"NavBarFont1\">Package</FONT> "
++            "<li>Package</li>"
+         },
+         {BUG_ID + "-2" + FS + "help-doc.html",
+-            " <FONT CLASS=\"NavBarFont1\">Package</FONT> "
++            "<li>Package</li>"
+         },
+     };
+ 
+diff --git a/test/com/sun/javadoc/testParamTaglet/TestParamTaglet.java b/test/com/sun/javadoc/testParamTaglet/TestParamTaglet.java
+--- langtools/test/com/sun/javadoc/testParamTaglet/TestParamTaglet.java
++++ langtools/test/com/sun/javadoc/testParamTaglet/TestParamTaglet.java
+@@ -48,20 +48,20 @@
+     private static final String[][] TEST = {
+         //Regular param tags.
+         {BUG_ID + FS + "pkg" + FS + "C.html",
+-            "<STRONG>Parameters:</STRONG></DT><DD><CODE>param1</CODE> - testing 1 2 3.</DD>" +
+-                "<DD><CODE>param2</CODE> - testing 1 2 3."
++            "<span class=\"strong\">Parameters:</span></dt><dd><code>param1</code> - testing 1 2 3.</dd>" +
++                "<dd><code>param2</code> - testing 1 2 3."
+         },
+         //Param tags that don't match with any real parameters.
+         {BUG_ID + FS + "pkg" + FS + "C.html",
+-            "<STRONG>Parameters:</STRONG></DT><DD><CODE><I>p1</I></CODE> - testing 1 2 3.</DD>" +
+-                "<DD><CODE><I>p2</I></CODE> - testing 1 2 3."
++            "<span class=\"strong\">Parameters:</span></dt><dd><code><I>p1</I></code> - testing 1 2 3.</dd>" +
++                "<dd><code><I>p2</I></code> - testing 1 2 3."
+         },
+         //{@inherit} doc misuse does not cause doclet to throw exception.
+         // Param is printed with nothing inherited.
+         //XXX: in the future when Configuration is available during doc inheritence,
+         //print a warning for this mistake.
+         {BUG_ID + FS + "pkg" + FS + "C.html",
+-            "<CODE><I>inheritBug</I></CODE> -"
++            "<code><I>inheritBug</I></code> -"
+         },
+ 
+     };
+diff --git a/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java b/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java
+--- langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java
++++ langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java
+@@ -58,50 +58,50 @@
+     private static final String[][] TEST1 = {
+         // Field inheritence from non-public superclass.
+         {BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html",
+-            "<A HREF=\"../pkg/PublicChild.html#fieldInheritedFromParent\">" +
+-                "fieldInheritedFromParent</A>"
++            "<a href=\"../pkg/PublicChild.html#fieldInheritedFromParent\">" +
++                "fieldInheritedFromParent</a>"
+         },
+ 
+         // Method inheritence from non-public superclass.
+         {BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html",
+-            "<A HREF=\"../pkg/PublicChild.html#methodInheritedFromParent(int)\">" +
+-                "methodInheritedFromParent</A>"
++            "<a href=\"../pkg/PublicChild.html#methodInheritedFromParent(int)\">" +
++                "methodInheritedFromParent</a>"
+         },
+ 
+         // Field inheritence from non-public superinterface.
+         {BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html",
+-            "<A HREF=\"../pkg/PublicInterface.html#fieldInheritedFromInterface\">" +
+-                "fieldInheritedFromInterface</A>"
++            "<a href=\"../pkg/PublicInterface.html#fieldInheritedFromInterface\">" +
++                "fieldInheritedFromInterface</a>"
+         },
+ 
+         // Method inheritence from non-public superinterface.
+         {BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html",
+-            "<A HREF=\"../pkg/PublicInterface.html#methodInterface(int)\">" +
+-                "methodInterface</A>"
++            "<a href=\"../pkg/PublicInterface.html#methodInterface(int)\">" +
++                "methodInterface</a>"
+         },
+ 
+         // private class does not show up in tree
+         {BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html",
+-            "<PRE>" + NL +
+-                "java.lang.Object" + NL +
+-                "  <IMG SRC=\"../resources/inherit.gif\" " +
+-                "ALT=\"extended by \"><STRONG>pkg.PublicChild</STRONG>" + NL +
+-            "</PRE>"
++            "<ul class=\"inheritance\">" + NL + "<li>java.lang.Object</li>" + NL +
++            "<li>" + NL + "<ul class=\"inheritance\">" + NL + "<li>pkg.PublicChild</li>" + NL +
++            "</ul>" + NL + "</li>" + NL + "</ul>"
+         },
+ 
+         // Method is documented as though it is declared in the inheriting method.
+         {BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html",
+-            "public void <STRONG>methodInheritedFromParent</STRONG>(int p1)"
++            "<pre>public void methodInheritedFromParent(int p1)"
+         },
+ 
+         //Make sure implemented interfaces from private superclass are inherited
+         {BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html",
+-            "<STRONG>All Known Implementing Classes:</STRONG></DT> <DD><A HREF=\"../pkg/PublicChild.html\" " +
+-            "title=\"class in pkg\">PublicChild</A>"},
++            "<dl>" + NL + "<dt>All Known Implementing Classes:</dt>" + NL +
++            "<dd><a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">" +
++            "PublicChild</a></dd>" + NL + "</dl>"},
+ 
+         {BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html",
+-            "<STRONG>All Implemented Interfaces:</STRONG></DT> <DD><A HREF=\"../pkg/PublicInterface.html\" " +
+-            "title=\"interface in pkg\">PublicInterface</A>"},
++            "<dl>" + NL + "<dt>All Implemented Interfaces:</dt>" + NL +
++            "<dd><a href=\"../pkg/PublicInterface.html\" title=\"interface in pkg\">" +
++            "PublicInterface</a></dd>" + NL + "</dl>"},
+ 
+         //Generic interface method test.
+         {BUG_ID + "-1" + FS + "pkg2" + FS + "C.html",
+@@ -110,12 +110,12 @@
+     private static final String[][] NEGATED_TEST1 = {
+        // Should not document that a method overrides method from private class.
+       {BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html",
+-        "<STRONG>Overrides:</STRONG>"},
++        "<strong>Overrides:</strong>"},
+       // Should not document that a method specified by private interface.
+       {BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html",
+-        "<STRONG>Specified by:</STRONG>"},
++        "<strong>Specified by:</strong>"},
+       {BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html",
+-        "<STRONG>Specified by:</STRONG>"},
++        "<strong>Specified by:</strong>"},
+       // Should not mention that any documentation was copied.
+       {BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html",
+         "Description copied from"},
+@@ -137,64 +137,64 @@
+         //Do not inherit private interface method with generic parameters.
+         //This method has been implemented.
+         {BUG_ID + "-1" + FS + "pkg2" + FS + "C.html",
+-            "<STRONG><A HREF=\"../pkg2/I.html#hello(T)\">hello</A></STRONG>"},
++            "<strong><a href=\"../pkg2/I.html#hello(T)\">hello</a></strong>"},
+     };
+ 
+     // Test output when -private flag is used.
+     private static final String[][] TEST2 = {
+         // Field inheritence from non-public superclass.
+         {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
+-            "Fields inherited from class " +
+-            "pkg.<A HREF=\"../pkg/PrivateParent.html\" " +
+-            "title=\"class in pkg\">PrivateParent</A>"
++            "Fields inherited from class pkg." +
++            "<a href=\"../pkg/PrivateParent.html\" title=\"class in pkg\">" +
++            "PrivateParent</a>"
+         },
+         {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
+-            "<A HREF=\"../pkg/PrivateParent.html#fieldInheritedFromParent\">" +
+-                "fieldInheritedFromParent</A>"
++            "<a href=\"../pkg/PrivateParent.html#fieldInheritedFromParent\">" +
++                "fieldInheritedFromParent</a>"
+         },
+         // Field inheritence from non-public superinterface.
+         {BUG_ID + "-2" + FS + "pkg" + FS + "PublicInterface.html",
+-            "Fields inherited from interface " +
+-            "pkg.<A HREF=\"../pkg/PrivateInterface.html\" " +
+-            "title=\"interface in pkg\">PrivateInterface</A>"
++            "Fields inherited from interface pkg." +
++            "<a href=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">" +
++            "PrivateInterface</a>"
+         },
+         {BUG_ID + "-2" + FS + "pkg" + FS + "PublicInterface.html",
+-            "<A HREF=\"../pkg/PrivateInterface.html#fieldInheritedFromInterface\">" +
+-                "fieldInheritedFromInterface</A>"
++            "<a href=\"../pkg/PrivateInterface.html#fieldInheritedFromInterface\">" +
++                "fieldInheritedFromInterface</a>"
+         },
+         // Method inheritence from non-public superclass.
+         {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
+-            "Methods inherited from class " +
+-            "pkg.<A HREF=\"../pkg/PrivateParent.html\" " +
+-            "title=\"class in pkg\">PrivateParent</A>"
++            "Methods inherited from class pkg." +
++            "<a href=\"../pkg/PrivateParent.html\" title=\"class in pkg\">" +
++            "PrivateParent</a>"
+         },
+         {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
+-            "<A HREF=\"../pkg/PrivateParent.html#methodInheritedFromParent(int)\">" +
+-                "methodInheritedFromParent</A>"
++            "<a href=\"../pkg/PrivateParent.html#methodInheritedFromParent(int)\">" +
++                "methodInheritedFromParent</a>"
+         },
+         // Should document that a method overrides method from private class.
+        {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
+-            "<STRONG>Overrides:</STRONG></DT><DD><CODE>" +
+-            "<A HREF=\"../pkg/PrivateParent.html#methodOverridenFromParent(char[], int, T, V, java.util.List)\">" +
+-            "methodOverridenFromParent</A></CODE> in class <CODE>" +
+-            "<A HREF=\"../pkg/PrivateParent.html\" title=\"class in pkg\">" +
+-            "PrivateParent</A></CODE></DD>" + NL + "</DL>"},
++            "<dt><strong>Overrides:</strong></dt>" + NL +
++            "<dd><code><a href=\"../pkg/PrivateParent.html#methodOverridenFromParent(char[], int, T, V, java.util.List)\">" +
++            "methodOverridenFromParent</a></code> in class <code>" +
++            "<a href=\"../pkg/PrivateParent.html\" title=\"class in pkg\">" +
++            "PrivateParent</a></code></dd>"},
+        // Should document that a method is specified by private interface.
+        {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
+-            "<STRONG>Specified by:</STRONG></DT><DD><CODE>" +
+-            "<A HREF=\"../pkg/PrivateInterface.html#methodInterface(int)\">" +
+-            "methodInterface</A></CODE> in interface <CODE>" +
+-            "<A HREF=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">" +
+-            "PrivateInterface</A></CODE></DD>" + NL + "</DL>" + NL + "</DD>"},
++            "<dt><strong>Specified by:</strong></dt>" + NL +
++            "<dd><code><a href=\"../pkg/PrivateInterface.html#methodInterface(int)\">" +
++            "methodInterface</a></code> in interface <code>" +
++            "<a href=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">" +
++            "PrivateInterface</a></code></dd>"},
+        // Method inheritence from non-public superinterface.
+        {BUG_ID + "-2" + FS + "pkg" + FS + "PublicInterface.html",
+-            "Methods inherited from interface " +
+-            "pkg.<A HREF=\"../pkg/PrivateInterface.html\" " +
+-            "title=\"interface in pkg\">PrivateInterface</A>"
++            "Methods inherited from interface pkg." +
++            "<a href=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">" +
++            "PrivateInterface</a>"
+         },
+         {BUG_ID + "-2" + FS + "pkg" + FS + "PrivateInterface.html",
+-            "<A HREF=\"../pkg/PrivateInterface.html#methodInterface(int)\">" +
+-                "methodInterface</A>"
++            "<a href=\"../pkg/PrivateInterface.html#methodInterface(int)\">" +
++                "methodInterface</a>"
+         },
+       // Should mention that any documentation was copied.
+       {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
+@@ -209,26 +209,31 @@
+ 
+       //Make sure implemented interfaces from private superclass are inherited
+       {BUG_ID + "-2" + FS + "pkg" + FS + "PublicInterface.html",
+-        "<STRONG>All Known Implementing Classes:</STRONG></DT> <DD><A HREF=\"../pkg/PrivateParent.html\" " +
+-        "title=\"class in pkg\">PrivateParent</A>, " +
+-        "<A HREF=\"../pkg/PublicChild.html\" title=\"class in pkg\">PublicChild</A>"},
++        "<dl>" + NL + "<dt>All Known Implementing Classes:</dt>" + NL +
++        "<dd><a href=\"../pkg/PrivateParent.html\" title=\"class in pkg\">" +
++        "PrivateParent</a>, " +
++        "<a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">PublicChild" +
++        "</a></dd>" + NL + "</dl>"},
+ 
+       {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
+-        "<STRONG>All Implemented Interfaces:</STRONG></DT> <DD><A HREF=\"../pkg/PrivateInterface.html\" " +
+-        "title=\"interface in pkg\">PrivateInterface</A>, " +
+-        "<A HREF=\"../pkg/PublicInterface.html\" title=\"interface in pkg\">" +
+-        "PublicInterface</A>"},
++        "<dl>" + NL + "<dt>All Implemented Interfaces:</dt>" + NL +
++        "<dd><a href=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">" +
++        "PrivateInterface</a>, " +
++        "<a href=\"../pkg/PublicInterface.html\" title=\"interface in pkg\">" +
++        "PublicInterface</a></dd>" + NL + "</dl>"},
+ 
+       //Since private flag is used, we can document that private interface method
+       //with generic parameters has been implemented.
+       {BUG_ID + "-2" + FS + "pkg2" + FS + "C.html",
+-            "<STRONG>Description copied from interface: " +
+-            "<CODE><A HREF=\"../pkg2/I.html#hello(T)\">I</A></CODE></STRONG>"},
++            "<strong>Description copied from interface: <code>" +
++            "<a href=\"../pkg2/I.html#hello(T)\">I</a></code></strong>"},
+ 
+       {BUG_ID + "-2" + FS + "pkg2" + FS + "C.html",
+-            "<STRONG>Specified by:</STRONG></DT><DD><CODE><A HREF=\"../pkg2/I.html#hello(T)\">" +
+-            "hello</A></CODE> in interface <CODE><A HREF=\"../pkg2/I.html\" " +
+-            "title=\"interface in pkg2\">I</A>"},
++            "<dt><strong>Specified by:</strong></dt>" + NL +
++            "<dd><code><a href=\"../pkg2/I.html#hello(T)\">hello</a></code>" +
++            " in interface <code>" +
++            "<a href=\"../pkg2/I.html\" title=\"interface in pkg2\">I</a>" +
++            "<java.lang.String></code></dd>"},
+     };
+     private static final String[][] NEGATED_TEST2 = NO_TEST;
+ 
+diff --git a/test/com/sun/javadoc/testSerializedForm/TestSerializedForm.java b/test/com/sun/javadoc/testSerializedForm/TestSerializedForm.java
+--- langtools/test/com/sun/javadoc/testSerializedForm/TestSerializedForm.java
++++ langtools/test/com/sun/javadoc/testSerializedForm/TestSerializedForm.java
+@@ -47,11 +47,11 @@
+ 
+     private static final String[][] TEST = {
+         {BUG_ID + FS + "serialized-form.html",
+-            "protected java.lang.Object <STRONG>readResolve</STRONG>()"},
++            "protected java.lang.Object readResolve()"},
+         {BUG_ID + FS + "serialized-form.html",
+-            "protected java.lang.Object <STRONG>writeReplace</STRONG>()"},
++            "protected java.lang.Object writeReplace()"},
+         {BUG_ID + FS + "serialized-form.html",
+-            "protected java.lang.Object <STRONG>readObjectNoData</STRONG>()"},
++            "protected java.lang.Object readObjectNoData()"},
+         {BUG_ID + FS + "serialized-form.html",
+             "See Also"},
+     };
+diff --git a/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java b/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java
+--- langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java
++++ langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java
+@@ -41,58 +41,47 @@
+     // 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 +
+-                 "<DT><STRONG>Throws:</STRONG></DT>" + NL + "<DD><CODE>" +
+-                 "java.io.IOException</CODE></DD><DT><STRONG>See Also:</STRONG>" +
+-                 "</DT><DD><A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+-                 "<CODE>C1.setUndecorated(boolean)</CODE></A></DD></DL>" + NL +
+-                 "</DD>" + 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>" +
+-                 "<DD>This field indicates whether the C1 is undecorated." + NL +
+-                 "<P>" + NL + "</DD>" + NL + "<DD> </DD>" + NL +
+-                 "<DD><DL>" + NL + "<DT><STRONG>Since:</STRONG></DT>" + NL +
+-                 "  <DD>1.4</DD>" + NL + "<DT><STRONG>See Also:</STRONG>" +
+-                 "</DT><DD><A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+-                 "<CODE>C1.setUndecorated(boolean)</CODE></A></DD></DL>" + NL +
+-                 "</DD>" + 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><DD>Reads the object stream." + NL + "<P>" + NL +
+-                 "</DD>" + NL + "<DD><DL>" + NL + "<DT><STRONG>Throws:" +
+-                 "</STRONG></DT>" + NL + "<DD><CODE><code>" +
+-                 "IOException</code></CODE></DD>" + NL +
+-                 "<DD><CODE>java.io.IOException</CODE></DD></DL>" + NL +
+-                 "</DD>" + NL + "</DL>"},
+-        {BUG_ID + FS + "serialized-form.html", "<DL>" + NL +
+-                 "<DD><STRONG>Deprecated.</STRONG> </DD><DD>" +
+-                 "The name for this class." + NL + "<P>" + NL + "</DD>" + NL +
+-                 "<DD> </DD>" + NL + "</DL>"}};
++        {BUG_ID + FS + "serialized-form.html", "<dl>" +
++                 "<dt><span class=\"strong\">Throws:</span></dt>" + NL + "<dd><code>" +
++                 "java.io.IOException</code></dd><dt><span class=\"strong\">See Also:</span>" +
++                 "</dt><dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
++                 "<code>C1.setUndecorated(boolean)</code></a></dd></dl>"},
++        {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
++                 " <i>As of JDK version 1.5, replaced by" + NL +
++                 " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
++                 "<code>setUndecorated(boolean)</code></a>.</i></div>" + NL +
++                 "<div class=\"block\">This field indicates whether the C1 " +
++                 "is undecorated.</div>" + NL + " " + NL +
++                 "<dl><dt><span class=\"strong\">Since:</span></dt>" + NL +
++                 "  <dd>1.4</dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" +
++                 "</dt><dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
++                 "<code>C1.setUndecorated(boolean)</code></a></dd></dl>"},
++        {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
++                 " <i>As of JDK version 1.5, replaced by" + NL +
++                 " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
++                 "<code>setUndecorated(boolean)</code></a>.</i></div>" + NL +
++                 "<div class=\"block\">Reads the object stream.</div>" + NL +
++                 "<dl><dt><span class=\"strong\">Throws:</span></dt>" + NL + "<dd><code><code>" +
++                 "IOException</code></code></dd>" + NL +
++                 "<dd><code>java.io.IOException</code></dd></dl>"},
++        {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
++                 " </div>" + NL + "<div class=\"block\">" +
++                 "The name for this class.</div>"}};
+ 
+     // 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></DD></DL>"},
+-        {BUG_ID + FS + "serialized-form.html", "<DL>" + NL + "<DD><STRONG>" +
+-                 "Deprecated.</STRONG> <I>As of JDK version" +
++        {BUG_ID + FS + "serialized-form.html", "<pre>boolean undecorated</pre>" + NL +
++                 "<div class=\"block\"><span class=\"strong\">Deprecated.</span> <i>" +
++                 "As of JDK version 1.5, replaced by" + NL +
++                 " <a href=\"pkg1/C1.html#setUndecorated(boolean)\"><code>" +
++                 "setUndecorated(boolean)</code></a>.</i></div>" + NL + "</li>"},
++        {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">" +
++                 "Deprecated.</span> <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></DL>"},
+-        {BUG_ID + FS + "serialized-form.html", "<PRE>" + NL + "int <STRONG>" +
+-                 "publicKey</STRONG></PRE>" + NL + "<DL>" + NL + "<DD><STRONG>" +
+-                 "Deprecated.</STRONG> </DD></DL>"}};
++                 " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
++                 "<code>setUndecorated(boolean)</code></a>.</i></div>" + NL + "</li>"}};
+ 
+     // Test with -nodeprecated option. The serialized-form.html should
+     // ignore the -nodeprecated tag and display the deprecation info. This
+diff --git a/test/com/sun/javadoc/testSimpleTag/TestSimpleTag.java b/test/com/sun/javadoc/testSimpleTag/TestSimpleTag.java
+--- langtools/test/com/sun/javadoc/testSimpleTag/TestSimpleTag.java
++++ langtools/test/com/sun/javadoc/testSimpleTag/TestSimpleTag.java
+@@ -42,13 +42,13 @@
+     private static final String[][] TEST =
+         new String[][] {
+             {"./" + BUG_ID + "/C.html",
+-                "<STRONG>Todo:</STRONG>"},
++                "<span class=\"strong\">Todo:</span>"},
+             {"./" + BUG_ID + "/C.html",
+-                "<STRONG>EJB Beans:</STRONG>"},
++                "<span class=\"strong\">EJB Beans:</span>"},
+             {"./" + BUG_ID + "/C.html",
+-                "<STRONG>Regular Tag:</STRONG>"},
++                "<span class=\"strong\">Regular Tag:</span>"},
+             {"./" + BUG_ID + "/C.html",
+-                "<STRONG>Back-Slash-Tag:</STRONG>"},
++                "<span class=\"strong\">Back-Slash-Tag:</span>"},
+         };
+ 
+     private static final String[] ARGS = new String[] {
+diff --git a/test/com/sun/javadoc/testStylesheet/TestStylesheet.java b/test/com/sun/javadoc/testStylesheet/TestStylesheet.java
+--- langtools/test/com/sun/javadoc/testStylesheet/TestStylesheet.java
++++ langtools/test/com/sun/javadoc/testStylesheet/TestStylesheet.java
+@@ -45,32 +45,24 @@
+     //Input for string search tests.
+     private static final String[][] TEST = {
+         {BUG_ID + FS + "stylesheet.css",
+-                "body { background-color: #FFFFFF; color:#000000 }"},
++                "/* Javadoc style sheet */"},
+         {BUG_ID + FS + "stylesheet.css",
+-                ".TableHeadingColor     { background: #CCCCFF; color:#000000 }"},
++                "/*" + NL + "Overall document style" + NL + "*/"},
+         {BUG_ID + FS + "stylesheet.css",
+-                ".TableSubHeadingColor  { background: #EEEEFF; color:#000000 }"},
++                "/*" + NL + "Heading styles" + NL + "*/"},
+         {BUG_ID + FS + "stylesheet.css",
+-                ".TableRowColor         { background: #FFFFFF; color:#000000 }"},
++                "/*" + NL + "Navigation bar styles" + NL + "*/"},
+         {BUG_ID + FS + "stylesheet.css",
+-                ".FrameTitleFont   { font-size: 100%; font-family: Helvetica, Arial, sans-serif; color:#000000 }"},
++                "body {" + NL + "    font-family:Helvetica, Arial, sans-serif;" + NL +
++                "    color:#000000;" + NL + "}"},
+         {BUG_ID + FS + "stylesheet.css",
+-                ".FrameHeadingFont { font-size:  90%; font-family: Helvetica, Arial, sans-serif; color:#000000 }"},
+-        {BUG_ID + FS + "stylesheet.css",
+-                ".FrameItemFont    { font-size:  90%; font-family: Helvetica, Arial, sans-serif; color:#000000 }"},
+-        {BUG_ID + FS + "stylesheet.css",
+-                ".NavBarCell1    { background-color:#EEEEFF; color:#000000}"},
+-        {BUG_ID + FS + "stylesheet.css",
+-                ".NavBarCell1Rev { background-color:#00008B; color:#FFFFFF}"},
+-        {BUG_ID + FS + "stylesheet.css",
+-                ".NavBarFont1    { font-family: Arial, Helvetica, sans-serif; color:#000000;color:#000000;}"},
+-        {BUG_ID + FS + "stylesheet.css",
+-                ".NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;color:#FFFFFF;}"},
+-        {BUG_ID + FS + "stylesheet.css",
+-                ".NavBarCell2    { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000}"},
+-        {BUG_ID + FS + "stylesheet.css",
+-                ".NavBarCell3    { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000}"},
+-
++                "dl dd ul li {" + NL + "    list-style:none;" + NL +
++                "    margin:10px 0 10px 0;" + NL + "}"},
++        // Test whether a link to the stylesheet file is inserted properly
++        // in the class documentation.
++        {BUG_ID + FS + "pkg" + FS + "A.html",
++                "<link rel=\"stylesheet\" type=\"text/css\" " +
++                "href=\"../stylesheet.css\" title=\"Style\">"}
+     };
+     private static final String[][] NEGATED_TEST = NO_TEST;
+ 
+diff --git a/test/com/sun/javadoc/testSummaryHeading/TestSummaryHeading.java b/test/com/sun/javadoc/testSummaryHeading/TestSummaryHeading.java
+--- langtools/test/com/sun/javadoc/testSummaryHeading/TestSummaryHeading.java
++++ langtools/test/com/sun/javadoc/testSummaryHeading/TestSummaryHeading.java
+@@ -46,8 +46,7 @@
+ 
+     //Input for string search tests.
+     private static final String[][] TEST = {
+-        {BUG_ID + FS + "C.html",  "<CAPTION CLASS=\"TableCaption\">" + NL +
+-                 "Method Summary</CAPTION>"}
++        {BUG_ID + FS + "C.html",  "<h3>Method Summary</h3>"}
+     };
+     private static final String[][] NEGATED_TEST = NO_TEST;
+ 
+diff --git a/test/com/sun/javadoc/testSuperclassInSerialForm/TestSuperClassInSerialForm.java b/test/com/sun/javadoc/testSuperclassInSerialForm/TestSuperClassInSerialForm.java
+--- langtools/test/com/sun/javadoc/testSuperclassInSerialForm/TestSuperClassInSerialForm.java
++++ langtools/test/com/sun/javadoc/testSuperclassInSerialForm/TestSuperClassInSerialForm.java
+@@ -39,7 +39,7 @@
+ 
+     private static final String[][] TEST = {
+         {BUG_ID + FS + "serialized-form.html",
+-         "<A HREF=\"pkg/SubClass.html\" title=\"class in pkg\">pkg.SubClass</A> extends <A HREF=\"pkg/SuperClass.html\" title=\"class in pkg\">SuperClass</A>"}
++         "<a href=\"pkg/SubClass.html\" title=\"class in pkg\">pkg.SubClass</a> extends <a href=\"pkg/SuperClass.html\" title=\"class in pkg\">SuperClass</a>"}
+     };
+ 
+     private static final String[][] NEGATED_TEST = NO_TEST;
+diff --git a/test/com/sun/javadoc/testTagInheritence/TestTagInheritence.java b/test/com/sun/javadoc/testTagInheritence/TestTagInheritence.java
+--- langtools/test/com/sun/javadoc/testTagInheritence/TestTagInheritence.java
++++ langtools/test/com/sun/javadoc/testTagInheritence/TestTagInheritence.java
+@@ -59,12 +59,12 @@
+         //First sentence test (6253614)
+         tests[tests.length - 2][0] =BUG_ID + FS + "firstSentence" + FS +
+             "B.html";
+-        tests[tests.length - 2][1] =  "          First sentence.</TD>";
++        tests[tests.length - 2][1] =  "<div class=\"block\">First sentence.</div>";
+ 
+         //Another first sentence test (6253604)
+         tests[tests.length - 1][0] =BUG_ID + FS + "firstSentence2" + FS +
+             "C.html";
+-        tests[tests.length - 1][1] =  "          First sentence.</TD>";
++        tests[tests.length - 1][1] =  "<div class=\"block\">First sentence.</div>";
+ 
+         TestTagInheritence tester = new TestTagInheritence();
+         run(tester, ARGS, tests, NO_TEST);
+diff --git a/test/com/sun/javadoc/testTaglets/TestTaglets.java b/test/com/sun/javadoc/testTaglets/TestTaglets.java
+--- langtools/test/com/sun/javadoc/testTaglets/TestTaglets.java
++++ langtools/test/com/sun/javadoc/testTaglets/TestTaglets.java
+@@ -55,13 +55,15 @@
+ 
+     //Input for string search tests.
+     private static final String[][] TEST_4654308 = new String[][] {
+-        {"4654308" + FS + "C.html", "<B>Foo:</B><DD>my only method is " +
+            "<A HREF=\"C.html#method()\"><CODE>here</CODE></A>"}
++        {"4654308" + FS + "C.html", "<span class=\"strong\">Foo:</span></dt>" +
++                 "<dd>my only method is <a href=\"C.html#method()\"><code>here" +
++                 "</code></a></dd></dl>"}
+     };
+     private static final String[][] NEGATED_TEST_4654308 = NO_TEST;
+ 
+     private static final String[][] TEST_4767038 = new String[][] {
+         {"4767038" + FS + "Child.html",
+-            " This is the first sentence.</TD>"}
++            "This is the first sentence."}
+     };
+     private static final String[][] NEGATED_TEST_4767038 = NO_TEST;
+ 
+diff --git a/test/com/sun/javadoc/testTaglets/taglets/Foo.java b/test/com/sun/javadoc/testTaglets/taglets/Foo.java
+--- langtools/test/com/sun/javadoc/testTaglets/taglets/Foo.java
++++ langtools/test/com/sun/javadoc/testTaglets/taglets/Foo.java
+@@ -50,9 +50,9 @@
+      */
+     public TagletOutput getTagletOutput(Tag tag, TagletWriter writer) {
+         ArrayList inlineTags = new ArrayList();
+-        inlineTags.add(new TextTag(tag.holder(), "<DT><B>Foo:</B><DD>"));
++        inlineTags.add(new TextTag(tag.holder(), "<dt><span class=\"strong\">Foo:</span></dt><dd>"));
+         inlineTags.addAll(Arrays.asList(tag.inlineTags()));
+-        inlineTags.add(new TextTag(tag.holder(), "</DD>"));
++        inlineTags.add(new TextTag(tag.holder(), "</dd>"));
+         return writer.commentTagsToOutput(tag,
+                 (Tag[]) inlineTags.toArray(new Tag[] {}));
+     }
+diff --git a/test/com/sun/javadoc/testThrowsHead/TestThrowsHead.java b/test/com/sun/javadoc/testThrowsHead/TestThrowsHead.java
+--- langtools/test/com/sun/javadoc/testThrowsHead/TestThrowsHead.java
++++ langtools/test/com/sun/javadoc/testThrowsHead/TestThrowsHead.java
+@@ -38,7 +38,7 @@
+ 
+     private static final String BUG_ID = "4530727";
+     private static final String[][] TEST = {
+-        {BUG_ID + FS + "C.html", "<DT><STRONG>Throws:</STRONG>"}
++        {BUG_ID + FS + "C.html", "<dt><span class=\"strong\">Throws:</span>"}
+     };
+     private static final String[][] NEGATED_TEST = NO_TEST;
+     private static final String[] ARGS = new String[] {
+diff --git a/test/com/sun/javadoc/testThrowsTag/TestThrowsTag.java b/test/com/sun/javadoc/testThrowsTag/TestThrowsTag.java
+--- langtools/test/com/sun/javadoc/testThrowsTag/TestThrowsTag.java
++++ langtools/test/com/sun/javadoc/testThrowsTag/TestThrowsTag.java
+@@ -46,14 +46,14 @@
+     //Input for string search tests.
+     private static final String[][] TEST = {
+         {BUG_ID + FS + "pkg" + FS + "C.html",
+-            "<DD><CODE><A HREF=\"../pkg/T1.html\" title=\"class in pkg\">T1</A></CODE> - the first throws tag.</DD>" + NL +
+-            "<DD><CODE><A HREF=\"../pkg/T2.html\" title=\"class in pkg\">T2</A></CODE> - the second throws tag.</DD>" + NL +
+-            "<DD><CODE><A HREF=\"../pkg/T3.html\" title=\"class in pkg\">T3</A></CODE> - the third throws tag.</DD>" + NL +
+-            "<DD><CODE><A HREF=\"../pkg/T4.html\" title=\"class in pkg\">T4</A></CODE> - the fourth throws tag.</DD>" + NL +
+-            "<DD><CODE><A HREF=\"../pkg/T5.html\" title=\"class in pkg\">T5</A></CODE> - the first inherited throws tag.</DD>" + NL +
+-            "<DD><CODE><A HREF=\"../pkg/T6.html\" title=\"class in pkg\">T6</A></CODE> - the second inherited throws tag.</DD>" + NL +
+-            "<DD><CODE><A HREF=\"../pkg/T7.html\" title=\"class in pkg\">T7</A></CODE> - the third inherited throws tag.</DD>" + NL +
+-            "<DD><CODE><A HREF=\"../pkg/T8.html\" title=\"class in pkg\">T8</A></CODE> - the fourth inherited throws tag.</DD>"
++            "<dd><code><a href=\"../pkg/T1.html\" title=\"class in pkg\">T1</a></code> - the first throws tag.</dd>" + NL +
++            "<dd><code><a href=\"../pkg/T2.html\" title=\"class in pkg\">T2</a></code> - the second throws tag.</dd>" + NL +
++            "<dd><code><a href=\"../pkg/T3.html\" title=\"class in pkg\">T3</a></code> - the third throws tag.</dd>" + NL +
++            "<dd><code><a href=\"../pkg/T4.html\" title=\"class in pkg\">T4</a></code> - the fourth throws tag.</dd>" + NL +
++            "<dd><code><a href=\"../pkg/T5.html\" title=\"class in pkg\">T5</a></code> - the first inherited throws tag.</dd>" + NL +
++            "<dd><code><a href=\"../pkg/T6.html\" title=\"class in pkg\">T6</a></code> - the second inherited throws tag.</dd>" + NL +
++            "<dd><code><a href=\"../pkg/T7.html\" title=\"class in pkg\">T7</a></code> - the third inherited throws tag.</dd>" + NL +
++            "<dd><code><a href=\"../pkg/T8.html\" title=\"class in pkg\">T8</a></code> - the fourth inherited throws tag.</dd>"
+         },
+     };
+     private static final String[][] NEGATED_TEST = NO_TEST;
+diff --git a/test/com/sun/javadoc/testTitleInHref/TestTitleInHref.java b/test/com/sun/javadoc/testTitleInHref/TestTitleInHref.java
+--- langtools/test/com/sun/javadoc/testTitleInHref/TestTitleInHref.java
++++ langtools/test/com/sun/javadoc/testTitleInHref/TestTitleInHref.java
+@@ -38,13 +38,13 @@
+ 
+     private static final String[][] TEST = {
+         //Test to make sure that the title shows up in a class link.
+-        {BUG_ID + FS + "pkg" + FS + "Links.html", "<A HREF=\"../pkg/Class.html\" title=\"class in pkg\">"},
++        {BUG_ID + FS + "pkg" + FS + "Links.html", "<a href=\"../pkg/Class.html\" title=\"class in pkg\">"},
+ 
+         //Test to make sure that the title shows up in an interface link.
+-        {BUG_ID + FS + "pkg" + FS + "Links.html", "<A HREF=\"../pkg/Interface.html\" title=\"interface in pkg\">"},
++        {BUG_ID + FS + "pkg" + FS + "Links.html", "<a href=\"../pkg/Interface.html\" title=\"interface in pkg\">"},
+ 
+         //Test to make sure that the title shows up in cross link shows up
+-        {BUG_ID + FS + "pkg" + FS + "Links.html", "<A HREF=\"http://java.sun.com/j2se/1.4/docs/api/java/io/File.html?is-external=true\" title=\"class or interface in java.io\"><CODE>This is a cross link to class File</CODE></A>"},
++        {BUG_ID + FS + "pkg" + FS + "Links.html", "<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/io/File.html?is-external=true\" title=\"class or interface in java.io\"><code>This is a cross link to class File</code></a>"},
+ 
+     };
+ 
+diff --git a/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java b/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java
+--- langtools/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java
++++ langtools/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java
+@@ -49,16 +49,17 @@
+     private static final String[][] TEST =
+     {
+         {BUG_ID + FS + "pkg" + FS + "C.html",
+-            "<CODE><W extends java.lang.String,V extends java.util.List> " + NL +
+-            "<BR>" + NL +
+-            "java.lang.Object</CODE>"},
++            "<td class=\"colFirst\"><code><W extends java.lang.String,V extends " +
++            "java.util.List> <br>java.lang.Object</code></td>"},
+         {BUG_ID + FS + "pkg" + FS + "C.html",
+-            "<CODE><T> java.lang.Object</CODE>"},
++            "<code><T> java.lang.Object</code>"},
+         {BUG_ID + FS + "pkg" + FS + "package-summary.html",
+             "C<E extends Parent>"},
+         //Nested type parameters
+         {BUG_ID + FS + "pkg" + FS + "C.html",
+-            "<A NAME=\"formatDetails(java.util.Collection, java.util.Collection)\"><!-- --></A>"},
++            "<a name=\"formatDetails(java.util.Collection, java.util.Collection)\">" + NL +
++            "<!--   -->" + NL +
++            "</a>"},
+ 
+     };
+     private static final String[][] NEGATED_TEST = NO_TEST;
+diff --git a/test/com/sun/javadoc/testUnnamedPackage/TestUnnamedPackage.java b/test/com/sun/javadoc/testUnnamedPackage/TestUnnamedPackage.java
+--- langtools/test/com/sun/javadoc/testUnnamedPackage/TestUnnamedPackage.java
++++ langtools/test/com/sun/javadoc/testUnnamedPackage/TestUnnamedPackage.java
+@@ -46,7 +46,7 @@
+     //Input for string search tests.
+     private static final String[][] TEST = {
+         {BUG_ID + FS + "package-summary.html",
+-            "<H2>"+NL+"Package <Unnamed>"+NL+"</H2>"
++            "<h1 title=\"Package\" class=\"title\">Package <Unnamed></h1>"
+         },
+         {BUG_ID + FS + "package-summary.html",
+             "This is a package comment for the unnamed package."
+@@ -55,12 +55,12 @@
+             "This is a class in the unnamed package."
+         },
+         {BUG_ID + FS + "package-tree.html",
+-            "<H2>"+NL+"Hierarchy For Package <Unnamed>"+NL+"</H2>"
++            "<h1 class=\"title\">Hierarchy For Package <Unnamed></h1>"
+         },
+         {BUG_ID + FS + "index-all.html",
+             "title=\"class in <Unnamed>\""
+         },
+-        {BUG_ID + FS + "C.html", "<A HREF=\"package-summary.html\">"}
++        {BUG_ID + FS + "C.html", "<a href=\"package-summary.html\">"}
+     };
+     private static final String[][] NEGATED_TEST = {
+         {ERROR_OUTPUT, "BadSource"},
+diff --git a/test/com/sun/javadoc/testValueTag/TestValueTag.java b/test/com/sun/javadoc/testValueTag/TestValueTag.java
+--- langtools/test/com/sun/javadoc/testValueTag/TestValueTag.java
++++ langtools/test/com/sun/javadoc/testValueTag/TestValueTag.java
+@@ -52,44 +52,44 @@
+             "Result:  \"Test 1 passes\""},
+         //Retrieve value of constant in same class.
+         {BUG_ID + FS + "pkg1" + FS + "Class1.html",
+-            "Result:  <A HREF=\"../pkg1/Class1.html#TEST_2_PASSES\">\"Test 2 passes\"</A>"},
++            "Result:  <a href=\"../pkg1/Class1.html#TEST_2_PASSES\">\"Test 2 passes\"</a>"},
+         {BUG_ID + FS + "pkg1" + FS + "Class1.html",
+-            "Result:  <A HREF=\"../pkg1/Class1.html#TEST_3_PASSES\">\"Test 3 passes\"</A>"},
++            "Result:  <a href=\"../pkg1/Class1.html#TEST_3_PASSES\">\"Test 3 passes\"</a>"},
+         {BUG_ID + FS + "pkg1" + FS + "Class1.html",
+-            "Result:  <A HREF=\"../pkg1/Class1.html#TEST_4_PASSES\">\"Test 4 passes\"</A>"},
++            "Result:  <a href=\"../pkg1/Class1.html#TEST_4_PASSES\">\"Test 4 passes\"</a>"},
+         {BUG_ID + FS + "pkg1" + FS + "Class1.html",
+-            "Result:  <A HREF=\"../pkg1/Class1.html#TEST_5_PASSES\">\"Test 5 passes\"</A>"},
++            "Result:  <a href=\"../pkg1/Class1.html#TEST_5_PASSES\">\"Test 5 passes\"</a>"},
+         {BUG_ID + FS + "pkg1" + FS + "Class1.html",
+-            "Result:  <A HREF=\"../pkg1/Class1.html#TEST_6_PASSES\">\"Test 6 passes\"</A>"},
++            "Result:  <a href=\"../pkg1/Class1.html#TEST_6_PASSES\">\"Test 6 passes\"</a>"},
+         //Retrieve value of constant in different class.
+         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
+-            "Result:  <A HREF=\"../pkg1/Class1.html#TEST_7_PASSES\">\"Test 7 passes\"</A>"},
++            "Result:  <a href=\"../pkg1/Class1.html#TEST_7_PASSES\">\"Test 7 passes\"</a>"},
+         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
+-            "Result:  <A HREF=\"../pkg1/Class1.html#TEST_8_PASSES\">\"Test 8 passes\"</A>"},
++            "Result:  <a href=\"../pkg1/Class1.html#TEST_8_PASSES\">\"Test 8 passes\"</a>"},
+         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
+-            "Result:  <A HREF=\"../pkg1/Class1.html#TEST_9_PASSES\">\"Test 9 passes\"</A>"},
++            "Result:  <a href=\"../pkg1/Class1.html#TEST_9_PASSES\">\"Test 9 passes\"</a>"},
+         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
+-            "Result:  <A HREF=\"../pkg1/Class1.html#TEST_10_PASSES\">\"Test 10 passes\"</A>"},
++            "Result:  <a href=\"../pkg1/Class1.html#TEST_10_PASSES\">\"Test 10 passes\"</a>"},
+         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
+-            "Result:  <A HREF=\"../pkg1/Class1.html#TEST_11_PASSES\">\"Test 11 passes\"</A>"},
++            "Result:  <a href=\"../pkg1/Class1.html#TEST_11_PASSES\">\"Test 11 passes\"</a>"},
+         //Retrieve value of constant in different package
+         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
+-            "Result:  <A HREF=\"../pkg2/Class3.html#TEST_12_PASSES\">\"Test 12 passes\"</A>"},
++            "Result:  <a href=\"../pkg2/Class3.html#TEST_12_PASSES\">\"Test 12 passes\"</a>"},
+         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
+-            "Result:  <A HREF=\"../pkg2/Class3.html#TEST_13_PASSES\">\"Test 13 passes\"</A>"},
++            "Result:  <a href=\"../pkg2/Class3.html#TEST_13_PASSES\">\"Test 13 passes\"</a>"},
+         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
+-            "Result:  <A HREF=\"../pkg2/Class3.html#TEST_14_PASSES\">\"Test 14 passes\"</A>"},
++            "Result:  <a href=\"../pkg2/Class3.html#TEST_14_PASSES\">\"Test 14 passes\"</a>"},
+         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
+-            "Result:  <A HREF=\"../pkg2/Class3.html#TEST_15_PASSES\">\"Test 15 passes\"</A>"},
++            "Result:  <a href=\"../pkg2/Class3.html#TEST_15_PASSES\">\"Test 15 passes\"</a>"},
+         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
+-            "Result:  <A HREF=\"../pkg2/Class3.html#TEST_16_PASSES\">\"Test 16 passes\"</A>"},
++            "Result:  <a href=\"../pkg2/Class3.html#TEST_16_PASSES\">\"Test 16 passes\"</a>"},
+         //Retrieve value of constant from a package page
+         {BUG_ID + FS + "pkg2" + FS + "package-summary.html",
+-            "Result: <A HREF=\"../pkg2/Class3.html#TEST_17_PASSES\">\"Test 17 passes\"</A>"},
++            "Result: <a href=\"../pkg2/Class3.html#TEST_17_PASSES\">\"Test 17 passes\"</a>"},
+         //Test @value tag used with custom tag.
+         {BUG_ID + FS + "pkg1" + FS + "CustomTagUsage.html",
+-            "<DT><STRONG>Todo:</STRONG></DT>" + NL +
+-                "  <DD>the value of this constant is 55.</DD>"},
++            "<dt><span class=\"strong\">Todo:</span></dt>" + NL +
++                "  <dd>the value of this constant is 55.</dd>"},
+         //Test @value warning printed when used with non-constant.
+         {WARNING_OUTPUT,"warning - @value tag (which references nonConstant) " +
+             "can only be used in constants."
+diff --git a/test/com/sun/javadoc/testWarnings/TestWarnings.java b/test/com/sun/javadoc/testWarnings/TestWarnings.java
+--- langtools/test/com/sun/javadoc/testWarnings/TestWarnings.java
++++ langtools/test/com/sun/javadoc/testWarnings/TestWarnings.java
+@@ -65,9 +65,9 @@
+     };
+ 
+     private static final String[][] TEST2 = {
+-        {BUG_ID + FS + "pkg" + FS + "X.html", "<A HREF=\"../pkg/X.html#m()\"><CODE>m()</CODE></A><br/>"},
+-        {BUG_ID + FS + "pkg" + FS + "X.html", "<A HREF=\"../pkg/X.html#X()\"><CODE>X()</CODE></A><br/>"},
+-        {BUG_ID + FS + "pkg" + FS + "X.html", "<A HREF=\"../pkg/X.html#f\"><CODE>f</CODE></A><br/>"},
++        {BUG_ID + FS + "pkg" + FS + "X.html", "<a href=\"../pkg/X.html#m()\"><code>m()</code></a><br/>"},
++        {BUG_ID + FS + "pkg" + FS + "X.html", "<a href=\"../pkg/X.html#X()\"><code>X()</code></a><br/>"},
++        {BUG_ID + FS + "pkg" + FS + "X.html", "<a href=\"../pkg/X.html#f\"><code>f</code></a><br/>"},
+     };
+ 
+     private static final String[][] NEGATED_TEST2 = NO_TEST;

Added: trunk/java/openjdk6/files/icedtea/openjdk/6886358-layout_update.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/openjdk/6886358-layout_update.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/openjdk/6886358-layout_update.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,13847 @@
+# HG changeset patch
+# User andrew
+# Date 1365742546 -3600
+# Node ID ec8a935f0737e033e4ffd401c4d554cd73739c39
+# Parent  e8ed86062291305172267be90dcec2acef7c15a8
+6886358: layout code update
+Reviewed-by: igor, prr
+
+diff --git a/make/sun/font/FILES_c.gmk b/make/sun/font/FILES_c.gmk
+--- jdk/make/sun/font/FILES_c.gmk
++++ jdk/make/sun/font/FILES_c.gmk
+@@ -72,8 +72,7 @@
+         GlyphPositioningTables.cpp \
+         GlyphSubstLookupProc.cpp \
+         GlyphSubstitutionTables.cpp \
+-        HebrewLigatureData.cpp \
+-        HebrewShaping.cpp \
++        HangulLayoutEngine.cpp \
+         IndicClassTables.cpp \
+         IndicReordering.cpp \
+         KernTable.cpp \
+@@ -99,6 +98,8 @@
+         SubstitutionLookups.cpp \
+         ThaiShaping.cpp \
+         ThaiStateTables.cpp \
++        TibetanLayoutEngine.cpp \
++        TibetanReordering.cpp \
+         ValueRecords.cpp \
+         ArabicLayoutEngine.cpp \
+         ArabicShaping.cpp \
+diff --git a/src/share/classes/sun/font/FontManager.java b/src/share/classes/sun/font/FontManager.java
+--- jdk/src/share/classes/sun/font/FontManager.java
++++ jdk/src/share/classes/sun/font/FontManager.java
+@@ -3598,6 +3598,18 @@
+             // 0E00 - 0E7F if Thai, assume shaping for vowel, tone marks
+             return true;
+         }
++        else if (code <  0x0f00) {
++            return false;
++        }
++        else if (code <= 0x0fff) { // U+0F00 - U+0FFF Tibetan
++            return true;
++        }
++        else if (code < 0x1100) {
++            return false;
++        }
++        else if (code < 0x11ff) { // U+1100 - U+11FF Old Hangul
++            return true;
++        }
+         else if (code < 0x1780) {
+             return false;
+         }
+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
+@@ -59,16 +59,16 @@
+ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ArabicOpenTypeLayoutEngine)
+ 
+ ArabicOpenTypeLayoutEngine::ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                        le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable)
+-    : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable)
++                        le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success)
++    : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success)
+ {
+     fFeatureMap = ArabicShaping::getFeatureMap(fFeatureMapCount);
+     fFeatureOrder = TRUE;
+ }
+ 
+ ArabicOpenTypeLayoutEngine::ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                                                       le_int32 typoFlags)
+-    : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags)
++                                                       le_int32 typoFlags, LEErrorCode &success)
++    : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success)
+ {
+     fFeatureMap = ArabicShaping::getFeatureMap(fFeatureMapCount);
+ 
+@@ -151,8 +151,8 @@
+     }
+ }
+ 
+-UnicodeArabicOpenTypeLayoutEngine::UnicodeArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags)
+-    : ArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags | LE_CHAR_FILTER_FEATURE_FLAG)
++UnicodeArabicOpenTypeLayoutEngine::UnicodeArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags, LEErrorCode &success)
++    : ArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags | LE_CHAR_FILTER_FEATURE_FLAG, success)
+ {
+     fGSUBTable = (const GlyphSubstitutionTableHeader *) CanonShaping::glyphSubstitutionTable;
+     fGDEFTable = (const GlyphDefinitionTableHeader *) CanonShaping::glyphDefinitionTable;
+diff --git a/src/share/native/sun/font/layout/ArabicLayoutEngine.h b/src/share/native/sun/font/layout/ArabicLayoutEngine.h
+--- jdk/src/share/native/sun/font/layout/ArabicLayoutEngine.h
++++ jdk/src/share/native/sun/font/layout/ArabicLayoutEngine.h
+@@ -66,6 +66,7 @@
+      * @param scriptCode - the script
+      * @param langaugeCode - the language
+      * @param gsubTable - the GSUB table
++     * @param success - set to an error code if the operation fails
+      *
+      * @see LayoutEngine::layoutEngineFactory
+      * @see OpenTypeLayoutEngine
+@@ -74,7 +75,7 @@
+      * @internal
+      */
+     ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                            le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable);
++                            le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success);
+ 
+     /**
+      * This constructor is used when the font requires a "canned" GSUB table which can't be known
+@@ -83,6 +84,7 @@
+      * @param fontInstance - the font
+      * @param scriptCode - the script
+      * @param langaugeCode - the language
++     * @param success - set to an error code if the operation fails
+      *
+      * @see OpenTypeLayoutEngine
+      * @see ScriptAndLanguageTags.h for script and language codes
+@@ -90,7 +92,7 @@
+      * @internal
+      */
+     ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                               le_int32 typoFlags);
++                               le_int32 typoFlags, LEErrorCode &success);
+ 
+     /**
+      * The destructor, virtual for correct polymorphic invocation.
+@@ -184,6 +186,7 @@
+      * @param fontInstance - the font
+      * @param scriptCode - the script
+      * @param languageCode - the language
++     * @param success - set to an error code if the operation fails
+      *
+      * @see LEFontInstance
+      * @see ScriptAndLanguageTags.h for script and language codes
+@@ -191,7 +194,7 @@
+      * @internal
+      */
+     UnicodeArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                le_int32 typoFlags);
++                le_int32 typoFlags, LEErrorCode &success);
+ 
+     /**
+      * The destructor, virtual for correct polymorphic invocation.
+diff --git a/src/share/native/sun/font/layout/ArabicShaping.cpp b/src/share/native/sun/font/layout/ArabicShaping.cpp
+--- jdk/src/share/native/sun/font/layout/ArabicShaping.cpp
++++ jdk/src/share/native/sun/font/layout/ArabicShaping.cpp
+@@ -104,6 +104,7 @@
+ #define markFeatureMask 0x00040000UL
+ #define mkmkFeatureMask 0x00020000UL
+ 
++#define NO_FEATURES   0
+ #define ISOL_FEATURES (isolFeatureMask | ligaFeatureMask | msetFeatureMask | markFeatureMask | ccmpFeatureMask | rligFeatureMask | caltFeatureMask | dligFeatureMask | cswhFeatureMask | cursFeatureMask | kernFeatureMask | mkmkFeatureMask)
+ 
+ #define SHAPE_MASK 0xF0000000UL
+@@ -198,7 +199,11 @@
+         LEUnicode c = chars[in];
+         ShapeType t = getShapeType(c);
+ 
++        if (t == ST_NOSHAPE_NONE) {
++            glyphStorage.setAuxData(out, NO_FEATURES, success);
++        } else {
+         glyphStorage.setAuxData(out, ISOL_FEATURES, success);
++        }
+ 
+         if ((t & MASK_TRANSPARENT) != 0) {
+             continue;
+diff --git a/src/share/native/sun/font/layout/CanonData.cpp b/src/share/native/sun/font/layout/CanonData.cpp
+--- jdk/src/share/native/sun/font/layout/CanonData.cpp
++++ jdk/src/share/native/sun/font/layout/CanonData.cpp
+@@ -30,7 +30,7 @@
+  * WARNING: THIS FILE IS MACHINE GENERATED. DO NOT HAND EDIT IT UNLESS
+  * YOU REALLY KNOW WHAT YOU'RE DOING.
+  *
+- * Generated on: 03/31/2005 08:15:27 AM HST
++ * Generated on: 03/12/2008 03:14:34 PM HST
+  */
+ 
+ #include "LETypes.h"
+@@ -39,36 +39,33 @@
+ U_NAMESPACE_BEGIN
+ 
+ const le_uint8 CanonShaping::glyphSubstitutionTable[] = {
+-    0x00, 0x01, 0x00, 0x00, 0x00, 0x0A, 0x01, 0x58, 0x02, 0x86, 0x00, 0x12, 0x61, 0x72, 0x61, 0x62,
+-    0x00, 0x6E, 0x62, 0x65, 0x6E, 0x67, 0x00, 0x82, 0x63, 0x79, 0x72, 0x6C, 0x00, 0x8E, 0x64, 0x65,
+-    0x76, 0x61, 0x00, 0x9A, 0x67, 0x72, 0x65, 0x6B, 0x00, 0xA6, 0x67, 0x75, 0x72, 0x75, 0x00, 0xB2,
+-    0x68, 0x65, 0x62, 0x72, 0x00, 0xBE, 0x68, 0x69, 0x72, 0x61, 0x00, 0xCA, 0x6B, 0x61, 0x6E, 0x61,
+-    0x00, 0xD6, 0x6B, 0x6E, 0x64, 0x61, 0x00, 0xE2, 0x6C, 0x61, 0x74, 0x6E, 0x00, 0xEE, 0x6D, 0x6C,
+-    0x79, 0x6D, 0x00, 0xFA, 0x6D, 0x79, 0x6D, 0x72, 0x01, 0x06, 0x6F, 0x72, 0x79, 0x61, 0x01, 0x12,
+-    0x73, 0x69, 0x6E, 0x68, 0x01, 0x1E, 0x74, 0x61, 0x6D, 0x6C, 0x01, 0x2A, 0x74, 0x65, 0x6C, 0x75,
+-    0x01, 0x36, 0x74, 0x69, 0x62, 0x74, 0x01, 0x42, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
+-    0x00, 0x05, 0x00, 0x00, 0x00, 0x13, 0x00, 0x15, 0x00, 0x12, 0x00, 0x14, 0x00, 0x04, 0x00, 0x00,
++    0x00, 0x01, 0x00, 0x00, 0x00, 0x0A, 0x01, 0x34, 0x02, 0x46, 0x00, 0x10, 0x61, 0x72, 0x61, 0x62,
++    0x00, 0x62, 0x62, 0x61, 0x6C, 0x69, 0x00, 0x76, 0x62, 0x65, 0x6E, 0x67, 0x00, 0x82, 0x63, 0x79,
++    0x72, 0x6C, 0x00, 0x8E, 0x64, 0x65, 0x76, 0x61, 0x00, 0x9A, 0x67, 0x72, 0x65, 0x6B, 0x00, 0xA6,
++    0x68, 0x69, 0x72, 0x61, 0x00, 0xB2, 0x6B, 0x61, 0x6E, 0x61, 0x00, 0xBE, 0x6B, 0x6E, 0x64, 0x61,
++    0x00, 0xCA, 0x6C, 0x61, 0x74, 0x6E, 0x00, 0xD6, 0x6D, 0x6C, 0x79, 0x6D, 0x00, 0xE2, 0x6D, 0x79,
++    0x6D, 0x72, 0x00, 0xEE, 0x6F, 0x72, 0x79, 0x61, 0x00, 0xFA, 0x73, 0x69, 0x6E, 0x68, 0x01, 0x06,
++    0x74, 0x61, 0x6D, 0x6C, 0x01, 0x12, 0x74, 0x65, 0x6C, 0x75, 0x01, 0x1E, 0x00, 0x04, 0x00, 0x00,
++    0x00, 0x00, 0xFF, 0xFF, 0x00, 0x05, 0x00, 0x00, 0x00, 0x11, 0x00, 0x13, 0x00, 0x10, 0x00, 0x12,
++    0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x01, 0x00, 0x0F, 0x00, 0x04, 0x00, 0x00,
+     0x00, 0x00, 0xFF, 0xFF, 0x00, 0x01, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
+     0x00, 0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x01, 0x00, 0x03,
+     0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x01, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00,
+     0x00, 0x00, 0xFF, 0xFF, 0x00, 0x01, 0x00, 0x05, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
+-    0x00, 0x01, 0x00, 0x06, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x01, 0x00, 0x07,
+-    0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x01, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00,
+-    0x00, 0x00, 0xFF, 0xFF, 0x00, 0x01, 0x00, 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
++    0x00, 0x01, 0x00, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x01, 0x00, 0x06,
++    0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x01, 0x00, 0x08, 0x00, 0x04, 0x00, 0x00,
++    0x00, 0x00, 0xFF, 0xFF, 0x00, 0x01, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
+     0x00, 0x01, 0x00, 0x0A, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x01, 0x00, 0x0B,
+     0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x01, 0x00, 0x0C, 0x00, 0x04, 0x00, 0x00,
+     0x00, 0x00, 0xFF, 0xFF, 0x00, 0x01, 0x00, 0x0D, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
+-    0x00, 0x01, 0x00, 0x0E, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x01, 0x00, 0x0F,
+-    0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x01, 0x00, 0x10, 0x00, 0x04, 0x00, 0x00,
+-    0x00, 0x00, 0xFF, 0xFF, 0x00, 0x01, 0x00, 0x11, 0x00, 0x16, 0x63, 0x63, 0x6D, 0x70, 0x00, 0x86,
+-    0x63, 0x63, 0x6D, 0x70, 0x00, 0x8E, 0x63, 0x63, 0x6D, 0x70, 0x00, 0x96, 0x63, 0x63, 0x6D, 0x70,
+-    0x00, 0x9E, 0x63, 0x63, 0x6D, 0x70, 0x00, 0xA6, 0x63, 0x63, 0x6D, 0x70, 0x00, 0xAE, 0x63, 0x63,
+-    0x6D, 0x70, 0x00, 0xB6, 0x63, 0x63, 0x6D, 0x70, 0x00, 0xBE, 0x63, 0x63, 0x6D, 0x70, 0x00, 0xC6,
+-    0x63, 0x63, 0x6D, 0x70, 0x00, 0xCE, 0x63, 0x63, 0x6D, 0x70, 0x00, 0xD6, 0x63, 0x63, 0x6D, 0x70,
+-    0x00, 0xDE, 0x63, 0x63, 0x6D, 0x70, 0x00, 0xE6, 0x63, 0x63, 0x6D, 0x70, 0x00, 0xEE, 0x63, 0x63,
+-    0x6D, 0x70, 0x00, 0xF6, 0x63, 0x63, 0x6D, 0x70, 0x00, 0xFE, 0x63, 0x63, 0x6D, 0x70, 0x01, 0x06,
+-    0x63, 0x63, 0x6D, 0x70, 0x01, 0x0E, 0x66, 0x69, 0x6E, 0x61, 0x01, 0x16, 0x69, 0x6E, 0x69, 0x74,
+-    0x01, 0x1C, 0x6C, 0x69, 0x67, 0x61, 0x01, 0x22, 0x6D, 0x65, 0x64, 0x69, 0x01, 0x28, 0x00, 0x00,
++    0x00, 0x01, 0x00, 0x0E, 0x00, 0x14, 0x63, 0x63, 0x6D, 0x70, 0x00, 0x7A, 0x63, 0x63, 0x6D, 0x70,
++    0x00, 0x82, 0x63, 0x63, 0x6D, 0x70, 0x00, 0x8A, 0x63, 0x63, 0x6D, 0x70, 0x00, 0x92, 0x63, 0x63,
++    0x6D, 0x70, 0x00, 0x9A, 0x63, 0x63, 0x6D, 0x70, 0x00, 0xA2, 0x63, 0x63, 0x6D, 0x70, 0x00, 0xAA,
++    0x63, 0x63, 0x6D, 0x70, 0x00, 0xB2, 0x63, 0x63, 0x6D, 0x70, 0x00, 0xBA, 0x63, 0x63, 0x6D, 0x70,
++    0x00, 0xC2, 0x63, 0x63, 0x6D, 0x70, 0x00, 0xCA, 0x63, 0x63, 0x6D, 0x70, 0x00, 0xD2, 0x63, 0x63,
++    0x6D, 0x70, 0x00, 0xDA, 0x63, 0x63, 0x6D, 0x70, 0x00, 0xE2, 0x63, 0x63, 0x6D, 0x70, 0x00, 0xEA,
++    0x63, 0x63, 0x6D, 0x70, 0x00, 0xF2, 0x66, 0x69, 0x6E, 0x61, 0x00, 0xFA, 0x69, 0x6E, 0x69, 0x74,
++    0x01, 0x00, 0x6C, 0x69, 0x67, 0x61, 0x01, 0x06, 0x6D, 0x65, 0x64, 0x69, 0x01, 0x0C, 0x00, 0x00,
+     0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00,
+     0x00, 0x02, 0x00, 0x08, 0x00, 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0A, 0x00, 0x0B, 0x00, 0x00,
+     0x00, 0x02, 0x00, 0x0C, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0E, 0x00, 0x0F, 0x00, 0x00,
+@@ -77,355 +74,349 @@
+     0x00, 0x02, 0x00, 0x18, 0x00, 0x19, 0x00, 0x00, 0x00, 0x02, 0x00, 0x1A, 0x00, 0x1B, 0x00, 0x00,
+     0x00, 0x02, 0x00, 0x1C, 0x00, 0x1D, 0x00, 0x00, 0x00, 0x02, 0x00, 0x1E, 0x00, 0x1F, 0x00, 0x00,
+     0x00, 0x02, 0x00, 0x20, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x22, 0x00, 0x23, 0x00, 0x00,
+-    0x00, 0x02, 0x00, 0x24, 0x00, 0x25, 0x00, 0x00, 0x00, 0x02, 0x00, 0x26, 0x00, 0x27, 0x00, 0x00,
+     0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05,
+-    0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x00, 0x28, 0x00, 0x52, 0x00, 0xC8, 0x01, 0x2A, 0x01, 0xF4,
+-    0x02, 0xBE, 0x03, 0xF8, 0x15, 0x06, 0x15, 0x58, 0x15, 0x9C, 0x18, 0x4E, 0x1A, 0xC4, 0x1B, 0x70,
+-    0x1B, 0xF0, 0x4F, 0xEA, 0x8E, 0xAE, 0x8F, 0x14, 0x8F, 0x62, 0x91, 0x58, 0x93, 0x26, 0x94, 0x94,
+-    0x95, 0xB4, 0x96, 0x0A, 0x96, 0x66, 0x98, 0x0C, 0x99, 0x54, 0xB9, 0x0C, 0xDC, 0x92, 0xDC, 0xC8,
+-    0xDC, 0xF8, 0xDD, 0x18, 0xDD, 0x34, 0xDD, 0x80, 0xDD, 0xC4, 0xDE, 0x0C, 0xDE, 0x5E, 0xDE, 0xA2,
+-    0xDE, 0xDC, 0xDE, 0xFC, 0xDF, 0x18, 0xE0, 0x36, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08,
+-    0x00, 0x01, 0x00, 0x5E, 0x00, 0x06, 0x00, 0x12, 0x00, 0x2C, 0x00, 0x36, 0x00, 0x40, 0x00, 0x4A,
+-    0x00, 0x54, 0x00, 0x03, 0x00, 0x08, 0x00, 0x0E, 0x00, 0x14, 0x06, 0x22, 0x00, 0x02, 0x06, 0x53,
+-    0x06, 0x23, 0x00, 0x02, 0x06, 0x54, 0x06, 0x25, 0x00, 0x02, 0x06, 0x55, 0x00, 0x01, 0x00, 0x04,
+-    0x06, 0x24, 0x00, 0x02, 0x06, 0x54, 0x00, 0x01, 0x00, 0x04, 0x06, 0x26, 0x00, 0x02, 0x06, 0x54,
+-    0x00, 0x01, 0x00, 0x04, 0x06, 0xC2, 0x00, 0x02, 0x06, 0x54, 0x00, 0x01, 0x00, 0x04, 0x06, 0xD3,
+-    0x00, 0x02, 0x06, 0x54, 0x00, 0x01, 0x00, 0x04, 0x06, 0xC0, 0x00, 0x02, 0x06, 0x54, 0x00, 0x01,
+-    0x00, 0x06, 0x06, 0x27, 0x06, 0x48, 0x06, 0x4A, 0x06, 0xC1, 0x06, 0xD2, 0x06, 0xD5, 0x00, 0x02,
+-    0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0x46, 0x00, 0x08, 0x00, 0x16, 0x00, 0x1C,
+-    0x00, 0x22, 0x00, 0x28, 0x00, 0x2E, 0x00, 0x34, 0x00, 0x3A, 0x00, 0x40, 0x00, 0x02, 0x06, 0x27,
+-    0x06, 0x53, 0x00, 0x02, 0x06, 0x27, 0x06, 0x54, 0x00, 0x02, 0x06, 0x48, 0x06, 0x54, 0x00, 0x02,
+-    0x06, 0x27, 0x06, 0x55, 0x00, 0x02, 0x06, 0x4A, 0x06, 0x54, 0x00, 0x02, 0x06, 0xD5, 0x06, 0x54,
+-    0x00, 0x02, 0x06, 0xC1, 0x06, 0x54, 0x00, 0x02, 0x06, 0xD2, 0x06, 0x54, 0x00, 0x01, 0x00, 0x08,
+-    0x06, 0x22, 0x06, 0x23, 0x06, 0x24, 0x06, 0x25, 0x06, 0x26, 0x06, 0xC0, 0x06, 0xC2, 0x06, 0xD3,
+-    0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x02, 0x00, 0x62, 0x00, 0x2E, 0xFE, 0x8B,
+-    0xFE, 0x91, 0xFE, 0x97, 0xFE, 0x9B, 0xFE, 0x9F, 0xFE, 0xA3, 0xFE, 0xA7, 0xFE, 0xB3, 0xFE, 0xB7,
+-    0xFE, 0xBB, 0xFE, 0xBF, 0xFE, 0xC3, 0xFE, 0xC7, 0xFE, 0xCB, 0xFE, 0xCF, 0xFE, 0xD3, 0xFE, 0xD7,
+-    0xFE, 0xDB, 0xFE, 0xDF, 0xFE, 0xE3, 0xFE, 0xE7, 0xFE, 0xEB, 0xFB, 0xE8, 0xFE, 0xF3, 0xFB, 0x68,
+-    0xFB, 0x60, 0xFB, 0x54, 0xFB, 0x58, 0xFB, 0x64, 0xFB, 0x5C, 0xFB, 0x78, 0xFB, 0x74, 0xFB, 0x7C,
+-    0xFB, 0x80, 0xFB, 0x6C, 0xFB, 0x70, 0xFB, 0x90, 0xFB, 0xD5, 0xFB, 0x94, 0xFB, 0x9C, 0xFB, 0x98,
+-    0xFB, 0xA2, 0xFB, 0xAC, 0xFB, 0xA8, 0xFB, 0xFE, 0xFB, 0xE6, 0x00, 0x01, 0x00, 0x2E, 0x06, 0x26,
+-    0x06, 0x28, 0x06, 0x2A, 0x06, 0x2B, 0x06, 0x2C, 0x06, 0x2D, 0x06, 0x2E, 0x06, 0x33, 0x06, 0x34,
+-    0x06, 0x35, 0x06, 0x36, 0x06, 0x37, 0x06, 0x38, 0x06, 0x39, 0x06, 0x3A, 0x06, 0x41, 0x06, 0x42,
+-    0x06, 0x43, 0x06, 0x44, 0x06, 0x45, 0x06, 0x46, 0x06, 0x47, 0x06, 0x49, 0x06, 0x4A, 0x06, 0x79,
+-    0x06, 0x7A, 0x06, 0x7B, 0x06, 0x7E, 0x06, 0x7F, 0x06, 0x80, 0x06, 0x83, 0x06, 0x84, 0x06, 0x86,
+-    0x06, 0x87, 0x06, 0xA4, 0x06, 0xA6, 0x06, 0xA9, 0x06, 0xAD, 0x06, 0xAF, 0x06, 0xB1, 0x06, 0xB3,
+-    0x06, 0xBB, 0x06, 0xBE, 0x06, 0xC1, 0x06, 0xCC, 0x06, 0xD0, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
+-    0x00, 0x08, 0x00, 0x02, 0x00, 0x62, 0x00, 0x2E, 0xFE, 0x8C, 0xFE, 0x92, 0xFE, 0x98, 0xFE, 0x9C,
+-    0xFE, 0xA0, 0xFE, 0xA4, 0xFE, 0xA8, 0xFE, 0xB4, 0xFE, 0xB8, 0xFE, 0xBC, 0xFE, 0xC0, 0xFE, 0xC4,
+-    0xFE, 0xC8, 0xFE, 0xCC, 0xFE, 0xD0, 0xFE, 0xD4, 0xFE, 0xD8, 0xFE, 0xDC, 0xFE, 0xE0, 0xFE, 0xE4,
+-    0xFE, 0xE8, 0xFE, 0xEC, 0xFB, 0xE9, 0xFE, 0xF4, 0xFB, 0x69, 0xFB, 0x61, 0xFB, 0x55, 0xFB, 0x59,
+-    0xFB, 0x65, 0xFB, 0x5D, 0xFB, 0x79, 0xFB, 0x75, 0xFB, 0x7D, 0xFB, 0x81, 0xFB, 0x6D, 0xFB, 0x71,
+-    0xFB, 0x91, 0xFB, 0xD6, 0xFB, 0x95, 0xFB, 0x9D, 0xFB, 0x99, 0xFB, 0xA3, 0xFB, 0xAD, 0xFB, 0xA9,
+-    0xFB, 0xFF, 0xFB, 0xE7, 0x00, 0x01, 0x00, 0x2E, 0x06, 0x26, 0x06, 0x28, 0x06, 0x2A, 0x06, 0x2B,
+-    0x06, 0x2C, 0x06, 0x2D, 0x06, 0x2E, 0x06, 0x33, 0x06, 0x34, 0x06, 0x35, 0x06, 0x36, 0x06, 0x37,
+-    0x06, 0x38, 0x06, 0x39, 0x06, 0x3A, 0x06, 0x41, 0x06, 0x42, 0x06, 0x43, 0x06, 0x44, 0x06, 0x45,
+-    0x06, 0x46, 0x06, 0x47, 0x06, 0x49, 0x06, 0x4A, 0x06, 0x79, 0x06, 0x7A, 0x06, 0x7B, 0x06, 0x7E,
+-    0x06, 0x7F, 0x06, 0x80, 0x06, 0x83, 0x06, 0x84, 0x06, 0x86, 0x06, 0x87, 0x06, 0xA4, 0x06, 0xA6,
+-    0x06, 0xA9, 0x06, 0xAD, 0x06, 0xAF, 0x06, 0xB1, 0x06, 0xB3, 0x06, 0xBB, 0x06, 0xBE, 0x06, 0xC1,
+-    0x06, 0xCC, 0x06, 0xD0, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x02, 0x00, 0x9A,
+-    0x00, 0x4A, 0xFE, 0x82, 0xFE, 0x84, 0xFE, 0x86, 0xFE, 0x88, 0xFE, 0x8A, 0xFE, 0x8E, 0xFE, 0x90,
+-    0xFE, 0x94, 0xFE, 0x96, 0xFE, 0x9A, 0xFE, 0x9E, 0xFE, 0xA2, 0xFE, 0xA6, 0xFE, 0xAA, 0xFE, 0xAC,
+-    0xFE, 0xAE, 0xFE, 0xB0, 0xFE, 0xB2, 0xFE, 0xB6, 0xFE, 0xBA, 0xFE, 0xBE, 0xFE, 0xC2, 0xFE, 0xC6,
+-    0xFE, 0xCA, 0xFE, 0xCE, 0xFE, 0xD2, 0xFE, 0xD6, 0xFE, 0xDA, 0xFE, 0xDE, 0xFE, 0xE2, 0xFE, 0xE6,
+-    0xFE, 0xEA, 0xFE, 0xEE, 0xFE, 0xF0, 0xFE, 0xF2, 0xFB, 0x51, 0xFB, 0x67, 0xFB, 0x5F, 0xFB, 0x53,
+-    0xFB, 0x57, 0xFB, 0x63, 0xFB, 0x5B, 0xFB, 0x77, 0xFB, 0x73, 0xFB, 0x7B, 0xFB, 0x7F, 0xFB, 0x89,
+-    0xFB, 0x85, 0xFB, 0x83, 0xFB, 0x87, 0xFB, 0x8D, 0xFB, 0x8B, 0xFB, 0x6B, 0xFB, 0x6F, 0xFB, 0x8F,
+-    0xFB, 0xD4, 0xFB, 0x93, 0xFB, 0x9B, 0xFB, 0x97, 0xFB, 0x9F, 0xFB, 0xA1, 0xFB, 0xAB, 0xFB, 0xA5,
+-    0xFB, 0xA7, 0xFB, 0xE1, 0xFB, 0xDA, 0xFB, 0xD8, 0xFB, 0xDC, 0xFB, 0xE3, 0xFB, 0xDF, 0xFB, 0xFD,
+-    0xFB, 0xE5, 0xFB, 0xAF, 0xFB, 0xB1, 0x00, 0x01, 0x00, 0x4A, 0x06, 0x22, 0x06, 0x23, 0x06, 0x24,
+-    0x06, 0x25, 0x06, 0x26, 0x06, 0x27, 0x06, 0x28, 0x06, 0x29, 0x06, 0x2A, 0x06, 0x2B, 0x06, 0x2C,
+-    0x06, 0x2D, 0x06, 0x2E, 0x06, 0x2F, 0x06, 0x30, 0x06, 0x31, 0x06, 0x32, 0x06, 0x33, 0x06, 0x34,
+-    0x06, 0x35, 0x06, 0x36, 0x06, 0x37, 0x06, 0x38, 0x06, 0x39, 0x06, 0x3A, 0x06, 0x41, 0x06, 0x42,
+-    0x06, 0x43, 0x06, 0x44, 0x06, 0x45, 0x06, 0x46, 0x06, 0x47, 0x06, 0x48, 0x06, 0x49, 0x06, 0x4A,
+-    0x06, 0x71, 0x06, 0x79, 0x06, 0x7A, 0x06, 0x7B, 0x06, 0x7E, 0x06, 0x7F, 0x06, 0x80, 0x06, 0x83,
+-    0x06, 0x84, 0x06, 0x86, 0x06, 0x87, 0x06, 0x88, 0x06, 0x8C, 0x06, 0x8D, 0x06, 0x8E, 0x06, 0x91,
+-    0x06, 0x98, 0x06, 0xA4, 0x06, 0xA6, 0x06, 0xA9, 0x06, 0xAD, 0x06, 0xAF, 0x06, 0xB1, 0x06, 0xB3,
+-    0x06, 0xBA, 0x06, 0xBB, 0x06, 0xBE, 0x06, 0xC0, 0x06, 0xC1, 0x06, 0xC5, 0x06, 0xC6, 0x06, 0xC7,
+-    0x06, 0xC8, 0x06, 0xC9, 0x06, 0xCB, 0x06, 0xCC, 0x06, 0xD0, 0x06, 0xD2, 0x06, 0xD3, 0x00, 0x04,
+-    0x00, 0x08, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x10, 0x98, 0x00, 0x35, 0x00, 0x70, 0x00, 0x7A,
+-    0x01, 0x0C, 0x01, 0x86, 0x01, 0xA8, 0x01, 0xB2, 0x02, 0x0C, 0x02, 0x62, 0x03, 0x02, 0x03, 0x8A,
+-    0x03, 0xB4, 0x03, 0xF6, 0x04, 0x46, 0x04, 0x8A, 0x04, 0xBC, 0x04, 0xEC, 0x05, 0x26, 0x05, 0x38,
+-    0x05, 0x42, 0x05, 0x64, 0x05, 0xF8, 0x06, 0x6C, 0x06, 0xEC, 0x07, 0x80, 0x08, 0x1E, 0x08, 0x56,
+-    0x08, 0xBA, 0x08, 0xF2, 0x09, 0x38, 0x09, 0x66, 0x09, 0x78, 0x09, 0x82, 0x09, 0xD4, 0x0A, 0x0E,
+-    0x0A, 0x40, 0x0A, 0x70, 0x0A, 0xCC, 0x0A, 0xF2, 0x0B, 0x38, 0x0B, 0x68, 0x0B, 0xDC, 0x0C, 0x2A,
+-    0x0C, 0xD6, 0x0D, 0x72, 0x0E, 0x16, 0x0E, 0x50, 0x0E, 0xC8, 0x0F, 0x5A, 0x0F, 0xA8, 0x0F, 0xB6,
+-    0x0F, 0xC0, 0x0F, 0xCA, 0x10, 0x2E, 0x00, 0x01, 0x00, 0x04, 0xFB, 0xDD, 0x00, 0x02, 0x06, 0x74,
+-    0x00, 0x12, 0x00, 0x26, 0x00, 0x2C, 0x00, 0x32, 0x00, 0x38, 0x00, 0x3E, 0x00, 0x44, 0x00, 0x4A,
+-    0x00, 0x50, 0x00, 0x56, 0x00, 0x5C, 0x00, 0x62, 0x00, 0x68, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x7A,
+-    0x00, 0x80, 0x00, 0x86, 0x00, 0x8C, 0xFB, 0xEC, 0x00, 0x02, 0x00, 0x01, 0xFB, 0xF0, 0x00, 0x02,
+-    0xFB, 0xD8, 0xFB, 0xF2, 0x00, 0x02, 0xFB, 0xDA, 0xFB, 0xF4, 0x00, 0x02, 0xFB, 0xDC, 0xFB, 0xF6,
+-    0x00, 0x02, 0xFB, 0xE5, 0xFB, 0xF8, 0x00, 0x02, 0xFB, 0xE7, 0xFB, 0xEA, 0x00, 0x02, 0xFE, 0x8E,
+-    0xFC, 0x00, 0x00, 0x02, 0xFE, 0x9E, 0xFC, 0x97, 0x00, 0x02, 0xFE, 0xA0, 0xFC, 0x01, 0x00, 0x02,
+-    0xFE, 0xA2, 0xFC, 0x98, 0x00, 0x02, 0xFE, 0xA4, 0xFC, 0x99, 0x00, 0x02, 0xFE, 0xA8, 0xFC, 0x02,
+-    0x00, 0x02, 0xFE, 0xE2, 0xFC, 0x9A, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0x9B, 0x00, 0x02, 0xFE, 0xEC,
+-    0xFB, 0xEE, 0x00, 0x02, 0xFE, 0xEE, 0xFB, 0xF9, 0x00, 0x02, 0xFE, 0xF0, 0xFB, 0xFB, 0x00, 0x02,
+-    0xFE, 0xF2, 0x00, 0x0F, 0x00, 0x20, 0x00, 0x26, 0x00, 0x2C, 0x00, 0x32, 0x00, 0x38, 0x00, 0x3E,
+-    0x00, 0x44, 0x00, 0x4A, 0x00, 0x50, 0x00, 0x56, 0x00, 0x5C, 0x00, 0x62, 0x00, 0x68, 0x00, 0x6E,
+-    0x00, 0x74, 0xFB, 0xED, 0x00, 0x02, 0x00, 0x01, 0xFB, 0xF1, 0x00, 0x02, 0xFB, 0xD8, 0xFB, 0xF3,
+-    0x00, 0x02, 0xFB, 0xDA, 0xFB, 0xF5, 0x00, 0x02, 0xFB, 0xDC, 0xFB, 0xF7, 0x00, 0x02, 0xFB, 0xE5,
+-    0xFB, 0xEB, 0x00, 0x02, 0xFE, 0x8E, 0xFC, 0x64, 0x00, 0x02, 0xFE, 0xAE, 0xFC, 0x65, 0x00, 0x02,
+-    0xFE, 0xB0, 0xFC, 0x66, 0x00, 0x02, 0xFE, 0xE2, 0xFC, 0xDF, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0x67,
+-    0x00, 0x02, 0xFE, 0xE6, 0xFC, 0xE0, 0x00, 0x02, 0xFE, 0xEC, 0xFB, 0xEF, 0x00, 0x02, 0xFE, 0xEE,
+-    0xFB, 0xFA, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0x69, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x03, 0x00, 0x08,
+-    0x00, 0x0E, 0x00, 0x18, 0xFD, 0x3D, 0x00, 0x02, 0x06, 0x4B, 0xFD, 0xF3, 0x00, 0x04, 0xFE, 0xDB,
+-    0xFE, 0x92, 0xFE, 0xAE, 0xFD, 0xF2, 0x00, 0x04, 0xFE, 0xDF, 0xFE, 0xE0, 0xFE, 0xEA, 0x00, 0x01,
+-    0x00, 0x04, 0xFD, 0x3C, 0x00, 0x02, 0x06, 0x4B, 0x00, 0x0B, 0x00, 0x18, 0x00, 0x1E, 0x00, 0x24,
+-    0x00, 0x2A, 0x00, 0x30, 0x00, 0x36, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x48, 0x00, 0x4E, 0x00, 0x54,
+-    0xFC, 0x05, 0x00, 0x02, 0xFE, 0x9E, 0xFC, 0x9C, 0x00, 0x02, 0xFE, 0xA0, 0xFC, 0x06, 0x00, 0x02,
+-    0xFE, 0xA2, 0xFC, 0x9D, 0x00, 0x02, 0xFE, 0xA4, 0xFC, 0x07, 0x00, 0x02, 0xFE, 0xA6, 0xFC, 0x9E,
+-    0x00, 0x02, 0xFE, 0xA8, 0xFC, 0x08, 0x00, 0x02, 0xFE, 0xE2, 0xFC, 0x9F, 0x00, 0x02, 0xFE, 0xE4,
+-    0xFC, 0xA0, 0x00, 0x02, 0xFE, 0xEC, 0xFC, 0x09, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0x0A, 0x00, 0x02,
+-    0xFE, 0xF2, 0x00, 0x0A, 0x00, 0x16, 0x00, 0x1E, 0x00, 0x26, 0x00, 0x2C, 0x00, 0x32, 0x00, 0x38,
+-    0x00, 0x3E, 0x00, 0x44, 0x00, 0x4A, 0x00, 0x50, 0xFD, 0xC2, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xF2,
+-    0xFD, 0x9E, 0x00, 0x03, 0xFE, 0xA8, 0xFE, 0xF2, 0xFC, 0x6A, 0x00, 0x02, 0xFE, 0xAE, 0xFC, 0x6B,
+-    0x00, 0x02, 0xFE, 0xB0, 0xFC, 0x6C, 0x00, 0x02, 0xFE, 0xE2, 0xFC, 0xE1, 0x00, 0x02, 0xFE, 0xE4,
+-    0xFC, 0x6D, 0x00, 0x02, 0xFE, 0xE6, 0xFC, 0xE2, 0x00, 0x02, 0xFE, 0xEC, 0xFC, 0x6E, 0x00, 0x02,
+-    0xFE, 0xF0, 0xFC, 0x6F, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x12, 0x00, 0x26, 0x00, 0x2C, 0x00, 0x34,
+-    0x00, 0x3A, 0x00, 0x40, 0x00, 0x48, 0x00, 0x50, 0x00, 0x56, 0x00, 0x5C, 0x00, 0x64, 0x00, 0x6A,
+-    0x00, 0x70, 0x00, 0x78, 0x00, 0x80, 0x00, 0x88, 0x00, 0x8E, 0x00, 0x94, 0x00, 0x9A, 0xFC, 0x0B,
+-    0x00, 0x02, 0xFE, 0x9E, 0xFD, 0x50, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xE4, 0xFC, 0xA1, 0x00, 0x02,
+-    0xFE, 0xA0, 0xFC, 0x0C, 0x00, 0x02, 0xFE, 0xA2, 0xFD, 0x52, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xA0,
+-    0xFD, 0x53, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xE4, 0xFC, 0xA2, 0x00, 0x02, 0xFE, 0xA4, 0xFC, 0x0D,
+-    0x00, 0x02, 0xFE, 0xA6, 0xFD, 0x54, 0x00, 0x03, 0xFE, 0xA8, 0xFE, 0xE4, 0xFC, 0xA3, 0x00, 0x02,
+-    0xFE, 0xA8, 0xFC, 0x0E, 0x00, 0x02, 0xFE, 0xE2, 0xFD, 0x55, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xA0,
+-    0xFD, 0x56, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xA4, 0xFD, 0x57, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xA8,
+-    0xFC, 0xA4, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0xA5, 0x00, 0x02, 0xFE, 0xEC, 0xFC, 0x0F, 0x00, 0x02,
+-    0xFE, 0xF0, 0xFC, 0x10, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x0F, 0x00, 0x20, 0x00, 0x28, 0x00, 0x30,
+-    0x00, 0x38, 0x00, 0x40, 0x00, 0x48, 0x00, 0x4E, 0x00, 0x54, 0x00, 0x5A, 0x00, 0x62, 0x00, 0x6A,
+-    0x00, 0x70, 0x00, 0x76, 0x00, 0x7C, 0x00, 0x82, 0xFD, 0xA0, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xF0,
+-    0xFD, 0x9F, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xF2, 0xFD, 0x51, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0x9E,
+-    0xFD, 0xA2, 0x00, 0x03, 0xFE, 0xA8, 0xFE, 0xF0, 0xFD, 0xA1, 0x00, 0x03, 0xFE, 0xA8, 0xFE, 0xF2,
+-    0xFC, 0x70, 0x00, 0x02, 0xFE, 0xAE, 0xFC, 0x71, 0x00, 0x02, 0xFE, 0xB0, 0xFC, 0x72, 0x00, 0x02,
+-    0xFE, 0xE2, 0xFD, 0xA4, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xF0, 0xFD, 0xA3, 0x00, 0x03, 0xFE, 0xE4,
+-    0xFE, 0xF2, 0xFC, 0xE3, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0x73, 0x00, 0x02, 0xFE, 0xE6, 0xFC, 0xE4,
+-    0x00, 0x02, 0xFE, 0xEC, 0xFC, 0x74, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0x75, 0x00, 0x02, 0xFE, 0xF2,
+-    0x00, 0x05, 0x00, 0x0C, 0x00, 0x12, 0x00, 0x18, 0x00, 0x1E, 0x00, 0x24, 0xFC, 0x11, 0x00, 0x02,
+-    0xFE, 0x9E, 0xFC, 0x12, 0x00, 0x02, 0xFE, 0xE2, 0xFC, 0xA6, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0x13,
+-    0x00, 0x02, 0xFE, 0xF0, 0xFC, 0x14, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x08, 0x00, 0x12, 0x00, 0x18,
+-    0x00, 0x1E, 0x00, 0x24, 0x00, 0x2A, 0x00, 0x30, 0x00, 0x36, 0x00, 0x3C, 0xFC, 0x76, 0x00, 0x02,
+-    0xFE, 0xAE, 0xFC, 0x77, 0x00, 0x02, 0xFE, 0xB0, 0xFC, 0x78, 0x00, 0x02, 0xFE, 0xE2, 0xFC, 0xE5,
+-    0x00, 0x02, 0xFE, 0xE4, 0xFC, 0x79, 0x00, 0x02, 0xFE, 0xE6, 0xFC, 0xE6, 0x00, 0x02, 0xFE, 0xEC,
+-    0xFC, 0x7A, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0x7B, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x08, 0x00, 0x12,
+-    0x00, 0x18, 0x00, 0x1E, 0x00, 0x30, 0x00, 0x36, 0x00, 0x3E, 0x00, 0x44, 0x00, 0x4A, 0xFC, 0x15,
+-    0x00, 0x02, 0xFE, 0xA2, 0xFC, 0xA7, 0x00, 0x02, 0xFE, 0xA4, 0xFD, 0xFB, 0x00, 0x08, 0xFE, 0xDE,
+-    0x00, 0x20, 0xFE, 0x9F, 0xFE, 0xE0, 0xFE, 0x8E, 0xFE, 0xDF, 0xFE, 0xEA, 0xFC, 0x16, 0x00, 0x02,
+-    0xFE, 0xE2, 0xFD, 0x59, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xA4, 0xFC, 0xA8, 0x00, 0x02, 0xFE, 0xE4,
+-    0xFD, 0x01, 0x00, 0x02, 0xFE, 0xF0, 0xFD, 0x02, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x07, 0x00, 0x10,
+-    0x00, 0x18, 0x00, 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x3E, 0xFD, 0xA6, 0x00, 0x03,
+-    0xFE, 0xA4, 0xFE, 0xF0, 0xFD, 0xBE, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xF2, 0xFD, 0x58, 0x00, 0x03,
+-    0xFE, 0xE4, 0xFE, 0xA2, 0xFD, 0xA7, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xF0, 0xFD, 0xA5, 0x00, 0x03,
+-    0xFE, 0xE4, 0xFE, 0xF2, 0xFD, 0x1D, 0x00, 0x02, 0xFE, 0xF0, 0xFD, 0x1E, 0x00, 0x02, 0xFE, 0xF2,
+-    0x00, 0x06, 0x00, 0x0E, 0x00, 0x14, 0x00, 0x1A, 0x00, 0x20, 0x00, 0x26, 0x00, 0x2C, 0xFC, 0x17,
+-    0x00, 0x02, 0xFE, 0x9E, 0xFC, 0xA9, 0x00, 0x02, 0xFE, 0xA0, 0xFC, 0x18, 0x00, 0x02, 0xFE, 0xE2,
+-    0xFC, 0xAA, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0xFF, 0x00, 0x02, 0xFE, 0xF0, 0xFD, 0x00, 0x00, 0x02,
+-    0xFE, 0xF2, 0x00, 0x05, 0x00, 0x0C, 0x00, 0x14, 0x00, 0x1C, 0x00, 0x24, 0x00, 0x2A, 0xFD, 0xBF,
+-    0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xF2, 0xFD, 0x5B, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xF0, 0xFD, 0x5A,
+-    0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xF2, 0xFD, 0x1B, 0x00, 0x02, 0xFE, 0xF0, 0xFD, 0x1C, 0x00, 0x02,
+-    0xFE, 0xF2, 0x00, 0x07, 0x00, 0x10, 0x00, 0x16, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x28, 0x00, 0x2E,
+-    0x00, 0x34, 0xFC, 0x19, 0x00, 0x02, 0xFE, 0x9E, 0xFC, 0xAB, 0x00, 0x02, 0xFE, 0xA0, 0xFC, 0x1A,
+-    0x00, 0x02, 0xFE, 0xA2, 0xFC, 0x1B, 0x00, 0x02, 0xFE, 0xE2, 0xFC, 0xAC, 0x00, 0x02, 0xFE, 0xE4,
+-    0xFD, 0x03, 0x00, 0x02, 0xFE, 0xF0, 0xFD, 0x04, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x02, 0x00, 0x06,
+-    0x00, 0x0C, 0xFD, 0x1F, 0x00, 0x02, 0xFE, 0xF0, 0xFD, 0x20, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x01,
+-    0x00, 0x04, 0xFC, 0x5B, 0x00, 0x02, 0x06, 0x70, 0x00, 0x03, 0x00, 0x08, 0x00, 0x0E, 0x00, 0x18,
+-    0xFC, 0x5C, 0x00, 0x02, 0x06, 0x70, 0xFD, 0xFC, 0x00, 0x04, 0xFB, 0xFE, 0xFE, 0x8E, 0xFE, 0xDD,
+-    0xFD, 0xF6, 0x00, 0x04, 0xFE, 0xB3, 0xFE, 0xEE, 0xFE, 0xDD, 0x00, 0x11, 0x00, 0x24, 0x00, 0x2A,
+-    0x00, 0x32, 0x00, 0x38, 0x00, 0x3E, 0x00, 0x46, 0x00, 0x4C, 0x00, 0x52, 0x00, 0x58, 0x00, 0x5E,
+-    0x00, 0x64, 0x00, 0x6C, 0x00, 0x74, 0x00, 0x7C, 0x00, 0x82, 0x00, 0x88, 0x00, 0x8E, 0xFC, 0x1C,
+-    0x00, 0x02, 0xFE, 0x9E, 0xFD, 0x5D, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xA4, 0xFC, 0xAD, 0x00, 0x02,
+-    0xFE, 0xA0, 0xFC, 0x1D, 0x00, 0x02, 0xFE, 0xA2, 0xFD, 0x5C, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xA0,
+-    0xFC, 0xAE, 0x00, 0x02, 0xFE, 0xA4, 0xFC, 0x1E, 0x00, 0x02, 0xFE, 0xA6, 0xFC, 0xAF, 0x00, 0x02,
+-    0xFE, 0xA8, 0xFD, 0x0E, 0x00, 0x02, 0xFE, 0xAE, 0xFC, 0x1F, 0x00, 0x02, 0xFE, 0xE2, 0xFD, 0x61,
+-    0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xA0, 0xFD, 0x60, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xA4, 0xFD, 0x63,
+-    0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xE4, 0xFC, 0xB0, 0x00, 0x02, 0xFE, 0xE4, 0xFD, 0x31, 0x00, 0x02,
+-    0xFE, 0xEC, 0xFC, 0xFB, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0xFC, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x0D,
+-    0x00, 0x1C, 0x00, 0x24, 0x00, 0x2A, 0x00, 0x30, 0x00, 0x38, 0x00, 0x40, 0x00, 0x46, 0x00, 0x4C,
+-    0x00, 0x54, 0x00, 0x5C, 0x00, 0x62, 0x00, 0x68, 0x00, 0x6E, 0xFD, 0x5E, 0x00, 0x03, 0xFE, 0xA0,
+-    0xFE, 0xF0, 0xFD, 0x34, 0x00, 0x02, 0xFE, 0xA0, 0xFD, 0x35, 0x00, 0x02, 0xFE, 0xA4, 0xFD, 0xA8,
+-    0x00, 0x03, 0xFE, 0xA8, 0xFE, 0xF0, 0xFD, 0xC6, 0x00, 0x03, 0xFE, 0xA8, 0xFE, 0xF2, 0xFD, 0x36,
+-    0x00, 0x02, 0xFE, 0xA8, 0xFD, 0x2A, 0x00, 0x02, 0xFE, 0xAE, 0xFD, 0x5F, 0x00, 0x03, 0xFE, 0xE4,
+-    0xFE, 0xA2, 0xFD, 0x62, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xE2, 0xFC, 0xE7, 0x00, 0x02, 0xFE, 0xE4,
+-    0xFC, 0xE8, 0x00, 0x02, 0xFE, 0xEC, 0xFD, 0x17, 0x00, 0x02, 0xFE, 0xF0, 0xFD, 0x18, 0x00, 0x02,
+-    0xFE, 0xF2, 0x00, 0x0F, 0x00, 0x20, 0x00, 0x26, 0x00, 0x2C, 0x00, 0x32, 0x00, 0x3A, 0x00, 0x40,
+-    0x00, 0x46, 0x00, 0x4C, 0x00, 0x52, 0x00, 0x58, 0x00, 0x60, 0x00, 0x68, 0x00, 0x6E, 0x00, 0x74,
+-    0x00, 0x7A, 0xFD, 0x09, 0x00, 0x02, 0xFE, 0x9E, 0xFD, 0x2D, 0x00, 0x02, 0xFE, 0xA0, 0xFD, 0x0A,
+-    0x00, 0x02, 0xFE, 0xA2, 0xFD, 0x68, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xE4, 0xFD, 0x2E, 0x00, 0x02,
+-    0xFE, 0xA4, 0xFD, 0x0B, 0x00, 0x02, 0xFE, 0xA6, 0xFD, 0x2F, 0x00, 0x02, 0xFE, 0xA8, 0xFD, 0x0D,
+-    0x00, 0x02, 0xFE, 0xAE, 0xFD, 0x0C, 0x00, 0x02, 0xFE, 0xE2, 0xFD, 0x6B, 0x00, 0x03, 0xFE, 0xE4,
+-    0xFE, 0xA8, 0xFD, 0x6D, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xE4, 0xFD, 0x30, 0x00, 0x02, 0xFE, 0xE4,
+-    0xFD, 0x32, 0x00, 0x02, 0xFE, 0xEC, 0xFC, 0xFD, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0xFE, 0x00, 0x02,
+-    0xFE, 0xF2, 0x00, 0x11, 0x00, 0x24, 0x00, 0x2A, 0x00, 0x32, 0x00, 0x38, 0x00, 0x3E, 0x00, 0x46,
+-    0x00, 0x4E, 0x00, 0x54, 0x00, 0x5A, 0x00, 0x60, 0x00, 0x66, 0x00, 0x6C, 0x00, 0x74, 0x00, 0x7C,
+-    0x00, 0x82, 0x00, 0x88, 0x00, 0x8E, 0xFD, 0x25, 0x00, 0x02, 0xFE, 0x9E, 0xFD, 0x69, 0x00, 0x03,
+-    0xFE, 0xA0, 0xFE, 0xF2, 0xFD, 0x37, 0x00, 0x02, 0xFE, 0xA0, 0xFD, 0x26, 0x00, 0x02, 0xFE, 0xA2,
+-    0xFD, 0x67, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xE2, 0xFD, 0xAA, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xF2,
+-    0xFD, 0x38, 0x00, 0x02, 0xFE, 0xA4, 0xFD, 0x27, 0x00, 0x02, 0xFE, 0xA6, 0xFD, 0x39, 0x00, 0x02,
+-    0xFE, 0xA8, 0xFD, 0x29, 0x00, 0x02, 0xFE, 0xAE, 0xFD, 0x28, 0x00, 0x02, 0xFE, 0xE2, 0xFD, 0x6A,
+-    0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xA6, 0xFD, 0x6C, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xE2, 0xFC, 0xE9,
+-    0x00, 0x02, 0xFE, 0xE4, 0xFC, 0xEA, 0x00, 0x02, 0xFE, 0xEC, 0xFD, 0x19, 0x00, 0x02, 0xFE, 0xF0,
+-    0xFD, 0x1A, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x0E, 0x00, 0x1E, 0x00, 0x24, 0x00, 0x2C, 0x00, 0x32,
+-    0x00, 0x38, 0x00, 0x3E, 0x00, 0x46, 0x00, 0x50, 0x00, 0x76, 0x00, 0x7E, 0x00, 0x84, 0x00, 0x8C,
+-    0x00, 0x92, 0x00, 0x98, 0xFC, 0x20, 0x00, 0x02, 0xFE, 0xA2, 0xFD, 0x65, 0x00, 0x03, 0xFE, 0xA4,
+-    0xFE, 0xA4, 0xFC, 0xB1, 0x00, 0x02, 0xFE, 0xA4, 0xFC, 0xB2, 0x00, 0x02, 0xFE, 0xA8, 0xFD, 0x0F,
+-    0x00, 0x02, 0xFE, 0xAE, 0xFD, 0xF0, 0x00, 0x03, 0xFE, 0xE0, 0xFB, 0xAF, 0xFD, 0xF5, 0x00, 0x04,
+-    0xFE, 0xE0, 0xFE, 0xCC, 0xFE, 0xE2, 0xFD, 0xFA, 0x00, 0x12, 0xFE, 0xE0, 0xFE, 0xF0, 0x00, 0x20,
+-    0xFE, 0x8D, 0xFE, 0xDF, 0xFE, 0xE0, 0xFE, 0xEA, 0x00, 0x20, 0xFE, 0xCB, 0xFE, 0xE0, 0xFE, 0xF4,
+-    0xFE, 0xEA, 0x00, 0x20, 0xFE, 0xED, 0xFE, 0xB3, 0xFE, 0xE0, 0xFE, 0xE2, 0xFD, 0xF9, 0x00, 0x03,
+-    0xFE, 0xE0, 0xFE, 0xF0, 0xFC, 0x21, 0x00, 0x02, 0xFE, 0xE2, 0xFD, 0xC5, 0x00, 0x03, 0xFE, 0xE4,
+-    0xFE, 0xE4, 0xFC, 0xB3, 0x00, 0x02, 0xFE, 0xE4, 0xFD, 0x05, 0x00, 0x02, 0xFE, 0xF0, 0xFD, 0x06,
+-    0x00, 0x02, 0xFE, 0xF2, 0x00, 0x06, 0x00, 0x0E, 0x00, 0x16, 0x00, 0x1E, 0x00, 0x24, 0x00, 0x2C,
+-    0x00, 0x32, 0xFD, 0x64, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xA2, 0xFD, 0xA9, 0x00, 0x03, 0xFE, 0xA4,
+-    0xFE, 0xF2, 0xFD, 0x2B, 0x00, 0x02, 0xFE, 0xAE, 0xFD, 0x66, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xE2,
+-    0xFD, 0x21, 0x00, 0x02, 0xFE, 0xF0, 0xFD, 0x22, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x0C, 0x00, 0x1A,
+-    0x00, 0x20, 0x00, 0x26, 0x00, 0x2C, 0x00, 0x32, 0x00, 0x38, 0x00, 0x40, 0x00, 0x46, 0x00, 0x4C,
+-    0x00, 0x52, 0x00, 0x58, 0x00, 0x5E, 0xFC, 0x22, 0x00, 0x02, 0xFE, 0x9E, 0xFC, 0xB4, 0x00, 0x02,
+-    0xFE, 0xA0, 0xFC, 0x23, 0x00, 0x02, 0xFE, 0xA2, 0xFC, 0xB5, 0x00, 0x02, 0xFE, 0xA4, 0xFC, 0x24,
+-    0x00, 0x02, 0xFE, 0xA6, 0xFD, 0x70, 0x00, 0x03, 0xFE, 0xA8, 0xFE, 0xE4, 0xFC, 0xB6, 0x00, 0x02,
+-    0xFE, 0xA8, 0xFD, 0x10, 0x00, 0x02, 0xFE, 0xAE, 0xFC, 0x25, 0x00, 0x02, 0xFE, 0xE2, 0xFC, 0xB7,
+-    0x00, 0x02, 0xFE, 0xE4, 0xFD, 0x07, 0x00, 0x02, 0xFE, 0xF0, 0xFD, 0x08, 0x00, 0x02, 0xFE, 0xF2,
+-    0x00, 0x06, 0x00, 0x0E, 0x00, 0x16, 0x00, 0x1E, 0x00, 0x26, 0x00, 0x2C, 0x00, 0x32, 0xFD, 0x6E,
+-    0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xF0, 0xFD, 0xAB, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xF2, 0xFD, 0x6F,
+-    0x00, 0x03, 0xFE, 0xA8, 0xFE, 0xE2, 0xFD, 0x2C, 0x00, 0x02, 0xFE, 0xAE, 0xFD, 0x23, 0x00, 0x02,
+-    0xFE, 0xF0, 0xFD, 0x24, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x08, 0x00, 0x12, 0x00, 0x18, 0x00, 0x1E,
+-    0x00, 0x24, 0x00, 0x2C, 0x00, 0x34, 0x00, 0x3A, 0x00, 0x40, 0xFC, 0x26, 0x00, 0x02, 0xFE, 0xA2,
+-    0xFC, 0xB8, 0x00, 0x02, 0xFE, 0xA4, 0xFC, 0x27, 0x00, 0x02, 0xFE, 0xE2, 0xFD, 0x72, 0x00, 0x03,
+-    0xFE, 0xE4, 0xFE, 0xA4, 0xFD, 0x73, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xE4, 0xFD, 0x33, 0x00, 0x02,
+-    0xFE, 0xE4, 0xFC, 0xF5, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0xF6, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x05,
+-    0x00, 0x0C, 0x00, 0x14, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x28, 0xFD, 0x71, 0x00, 0x03, 0xFE, 0xE4,
+-    0xFE, 0xA2, 0xFD, 0x74, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xF2, 0xFD, 0x3A, 0x00, 0x02, 0xFE, 0xE4,
+-    0xFD, 0x11, 0x00, 0x02, 0xFE, 0xF0, 0xFD, 0x12, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x02, 0x00, 0x06,
+-    0x00, 0x0C, 0xFC, 0x28, 0x00, 0x02, 0xFE, 0xE2, 0xFC, 0xB9, 0x00, 0x02, 0xFE, 0xE4, 0x00, 0x01,
+-    0x00, 0x04, 0xFD, 0x3B, 0x00, 0x02, 0xFE, 0xE4, 0x00, 0x09, 0x00, 0x14, 0x00, 0x1A, 0x00, 0x22,
+-    0x00, 0x28, 0x00, 0x32, 0x00, 0x38, 0x00, 0x40, 0x00, 0x46, 0x00, 0x4C, 0xFC, 0x29, 0x00, 0x02,
+-    0xFE, 0x9E, 0xFD, 0xC4, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xE4, 0xFC, 0xBA, 0x00, 0x02, 0xFE, 0xA0,
+-    0xFD, 0xF7, 0x00, 0x04, 0xFE, 0xE0, 0xFE, 0xF4, 0xFE, 0xEA, 0xFC, 0x2A, 0x00, 0x02, 0xFE, 0xE2,
+-    0xFD, 0x77, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xE4, 0xFC, 0xBB, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0xF7,
+-    0x00, 0x02, 0xFE, 0xF0, 0xFC, 0xF8, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x06, 0x00, 0x0E, 0x00, 0x16,
+-    0x00, 0x1E, 0x00, 0x26, 0x00, 0x2E, 0x00, 0x34, 0xFD, 0x75, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xE2,
+-    0xFD, 0x76, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xE2, 0xFD, 0x78, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xF0,
+-    0xFD, 0xB6, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xF2, 0xFD, 0x13, 0x00, 0x02, 0xFE, 0xF0, 0xFD, 0x14,
+-    0x00, 0x02, 0xFE, 0xF2, 0x00, 0x06, 0x00, 0x0E, 0x00, 0x14, 0x00, 0x1A, 0x00, 0x20, 0x00, 0x26,
+-    0x00, 0x2C, 0xFC, 0x2B, 0x00, 0x02, 0xFE, 0x9E, 0xFC, 0xBC, 0x00, 0x02, 0xFE, 0xA0, 0xFC, 0x2C,
+-    0x00, 0x02, 0xFE, 0xE2, 0xFC, 0xBD, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0xF9, 0x00, 0x02, 0xFE, 0xF0,
+-    0xFC, 0xFA, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x05, 0x00, 0x0C, 0x00, 0x14, 0x00, 0x1C, 0x00, 0x24,
+-    0x00, 0x2A, 0xFD, 0x79, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xE2, 0xFD, 0x7B, 0x00, 0x03, 0xFE, 0xE4,
+-    0xFE, 0xF0, 0xFD, 0x7A, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xF2, 0xFD, 0x15, 0x00, 0x02, 0xFE, 0xF0,
+-    0xFD, 0x16, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x0B, 0x00, 0x18, 0x00, 0x1E, 0x00, 0x24, 0x00, 0x2A,
+-    0x00, 0x30, 0x00, 0x36, 0x00, 0x3E, 0x00, 0x44, 0x00, 0x4A, 0x00, 0x50, 0x00, 0x56, 0xFC, 0x2D,
+-    0x00, 0x02, 0xFE, 0x9E, 0xFC, 0xBE, 0x00, 0x02, 0xFE, 0xA0, 0xFC, 0x2E, 0x00, 0x02, 0xFE, 0xA2,
+-    0xFC, 0xBF, 0x00, 0x02, 0xFE, 0xA4, 0xFC, 0x2F, 0x00, 0x02, 0xFE, 0xA6, 0xFD, 0x7D, 0x00, 0x03,
+-    0xFE, 0xA8, 0xFE, 0xE4, 0xFC, 0xC0, 0x00, 0x02, 0xFE, 0xA8, 0xFC, 0x30, 0x00, 0x02, 0xFE, 0xE2,
+-    0xFC, 0xC1, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0x31, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0x32, 0x00, 0x02,
+-    0xFE, 0xF2, 0x00, 0x04, 0x00, 0x0A, 0x00, 0x12, 0x00, 0x1A, 0x00, 0x20, 0xFD, 0x7C, 0x00, 0x03,
+-    0xFE, 0xA8, 0xFE, 0xE2, 0xFD, 0xC1, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xF2, 0xFC, 0x7C, 0x00, 0x02,
+-    0xFE, 0xF0, 0xFC, 0x7D, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x08, 0x00, 0x12, 0x00, 0x18, 0x00, 0x1E,
+-    0x00, 0x26, 0x00, 0x2C, 0x00, 0x34, 0x00, 0x3A, 0x00, 0x40, 0xFC, 0x33, 0x00, 0x02, 0xFE, 0xA2,
+-    0xFC, 0xC2, 0x00, 0x02, 0xFE, 0xA4, 0xFD, 0xF1, 0x00, 0x03, 0xFE, 0xE0, 0xFB, 0xAF, 0xFC, 0x34,
+-    0x00, 0x02, 0xFE, 0xE2, 0xFD, 0xB4, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xA4, 0xFC, 0xC3, 0x00, 0x02,
+-    0xFE, 0xE4, 0xFC, 0x35, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0x36, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x05,
+-    0x00, 0x0C, 0x00, 0x14, 0x00, 0x1C, 0x00, 0x24, 0x00, 0x2A, 0xFD, 0x7E, 0x00, 0x03, 0xFE, 0xE4,
+-    0xFE, 0xA2, 0xFD, 0x7F, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xE2, 0xFD, 0xB2, 0x00, 0x03, 0xFE, 0xE4,
+-    0xFE, 0xF2, 0xFC, 0x7E, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0x7F, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x0E,
+-    0x00, 0x1E, 0x00, 0x24, 0x00, 0x2A, 0x00, 0x30, 0x00, 0x36, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x48,
+-    0x00, 0x4E, 0x00, 0x54, 0x00, 0x5A, 0x00, 0x62, 0x00, 0x68, 0x00, 0x6E, 0xFC, 0x37, 0x00, 0x02,
+-    0xFE, 0x8E, 0xFC, 0x38, 0x00, 0x02, 0xFE, 0x9E, 0xFC, 0xC4, 0x00, 0x02, 0xFE, 0xA0, 0xFC, 0x39,
+-    0x00, 0x02, 0xFE, 0xA2, 0xFC, 0xC5, 0x00, 0x02, 0xFE, 0xA4, 0xFC, 0x3A, 0x00, 0x02, 0xFE, 0xA6,
+-    0xFC, 0xC6, 0x00, 0x02, 0xFE, 0xA8, 0xFC, 0x3B, 0x00, 0x02, 0xFE, 0xDE, 0xFC, 0xC7, 0x00, 0x02,
+-    0xFE, 0xE0, 0xFC, 0x3C, 0x00, 0x02, 0xFE, 0xE2, 0xFD, 0xC3, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xE4,
+-    0xFC, 0xC8, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0x3D, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0x3E, 0x00, 0x02,
+-    0xFE, 0xF2, 0x00, 0x09, 0x00, 0x14, 0x00, 0x1A, 0x00, 0x20, 0x00, 0x26, 0x00, 0x2C, 0x00, 0x34,
+-    0x00, 0x3C, 0x00, 0x42, 0x00, 0x48, 0xFC, 0x80, 0x00, 0x02, 0xFE, 0x8E, 0xFC, 0x81, 0x00, 0x02,
+-    0xFE, 0xDE, 0xFC, 0xEB, 0x00, 0x02, 0xFE, 0xE0, 0xFC, 0x82, 0x00, 0x02, 0xFE, 0xE2, 0xFD, 0xBB,
+-    0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xE2, 0xFD, 0xB7, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xF2, 0xFC, 0xEC,
+-    0x00, 0x02, 0xFE, 0xE4, 0xFC, 0x83, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0x84, 0x00, 0x02, 0xFE, 0xF2,
+-    0x00, 0x14, 0x00, 0x2A, 0x00, 0x30, 0x00, 0x36, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x48, 0x00, 0x50,
+-    0x00, 0x58, 0x00, 0x5E, 0x00, 0x64, 0x00, 0x6C, 0x00, 0x72, 0x00, 0x78, 0x00, 0x80, 0x00, 0x86,
+-    0x00, 0x8C, 0x00, 0x94, 0x00, 0x9A, 0x00, 0xA0, 0x00, 0xA6, 0xFE, 0xF5, 0x00, 0x02, 0xFE, 0x82,
+-    0xFE, 0xF7, 0x00, 0x02, 0xFE, 0x84, 0xFE, 0xF9, 0x00, 0x02, 0xFE, 0x88, 0xFE, 0xFB, 0x00, 0x02,
+-    0xFE, 0x8E, 0xFC, 0x3F, 0x00, 0x02, 0xFE, 0x9E, 0xFD, 0x83, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xA0,
+-    0xFD, 0xBA, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xE4, 0xFC, 0xC9, 0x00, 0x02, 0xFE, 0xA0, 0xFC, 0x40,
+-    0x00, 0x02, 0xFE, 0xA2, 0xFD, 0xB5, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xE4, 0xFC, 0xCA, 0x00, 0x02,
+-    0xFE, 0xA4, 0xFC, 0x41, 0x00, 0x02, 0xFE, 0xA6, 0xFD, 0x86, 0x00, 0x03, 0xFE, 0xA8, 0xFE, 0xE4,
+-    0xFC, 0xCB, 0x00, 0x02, 0xFE, 0xA8, 0xFC, 0x42, 0x00, 0x02, 0xFE, 0xE2, 0xFD, 0x88, 0x00, 0x03,
+-    0xFE, 0xE4, 0xFE, 0xA4, 0xFC, 0xCC, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0xCD, 0x00, 0x02, 0xFE, 0xEC,
+-    0xFC, 0x43, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0x44, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x11, 0x00, 0x24,
+-    0x00, 0x2A, 0x00, 0x30, 0x00, 0x36, 0x00, 0x3C, 0x00, 0x44, 0x00, 0x4C, 0x00, 0x54, 0x00, 0x5C,
+-    0x00, 0x64, 0x00, 0x6C, 0x00, 0x74, 0x00, 0x7A, 0x00, 0x82, 0x00, 0x8A, 0x00, 0x90, 0x00, 0x96,
+-    0xFE, 0xF6, 0x00, 0x02, 0xFE, 0x82, 0xFE, 0xF8, 0x00, 0x02, 0xFE, 0x84, 0xFE, 0xFA, 0x00, 0x02,
+-    0xFE, 0x88, 0xFE, 0xFC, 0x00, 0x02, 0xFE, 0x8E, 0xFD, 0x84, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0x9E,
+-    0xFD, 0xBC, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xE2, 0xFD, 0xAC, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xF2,
+-    0xFD, 0x80, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xE2, 0xFD, 0x82, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xF0,
+-    0xFD, 0x81, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xF2, 0xFD, 0x85, 0x00, 0x03, 0xFE, 0xA8, 0xFE, 0xE2,
+-    0xFC, 0x85, 0x00, 0x02, 0xFE, 0xE2, 0xFD, 0x87, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xA2, 0xFD, 0xAD,
+-    0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xF2, 0xFC, 0xED, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0x86, 0x00, 0x02,
+-    0xFE, 0xF0, 0xFC, 0x87, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x12, 0x00, 0x26, 0x00, 0x2C, 0x00, 0x34,
+-    0x00, 0x3C, 0x00, 0x44, 0x00, 0x4A, 0x00, 0x50, 0x00, 0x58, 0x00, 0x62, 0x00, 0x6A, 0x00, 0x70,
+-    0x00, 0x76, 0x00, 0x7E, 0x00, 0x86, 0x00, 0x8C, 0x00, 0x92, 0x00, 0x98, 0x00, 0x9E, 0xFC, 0x45,
+-    0x00, 0x02, 0xFE, 0x9E, 0xFD, 0x8C, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xA4, 0xFD, 0x92, 0x00, 0x03,
+-    0xFE, 0xA0, 0xFE, 0xA8, 0xFD, 0x8D, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xE4, 0xFC, 0xCE, 0x00, 0x02,
+-    0xFE, 0xA0, 0xFC, 0x46, 0x00, 0x02, 0xFE, 0xA2, 0xFD, 0x89, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xA0,
+-    0xFD, 0xF4, 0x00, 0x04, 0xFE, 0xA4, 0xFE, 0xE4, 0xFE, 0xAA, 0xFD, 0x8A, 0x00, 0x03, 0xFE, 0xA4,
+-    0xFE, 0xE4, 0xFC, 0xCF, 0x00, 0x02, 0xFE, 0xA4, 0xFC, 0x47, 0x00, 0x02, 0xFE, 0xA6, 0xFD, 0x8E,
+-    0x00, 0x03, 0xFE, 0xA8, 0xFE, 0xA0, 0xFD, 0x8F, 0x00, 0x03, 0xFE, 0xA8, 0xFE, 0xE4, 0xFC, 0xD0,
+-    0x00, 0x02, 0xFE, 0xA8, 0xFC, 0x48, 0x00, 0x02, 0xFE, 0xE2, 0xFC, 0xD1, 0x00, 0x02, 0xFE, 0xE4,
+-    0xFC, 0x49, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0x4A, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x06, 0x00, 0x0E,
+-    0x00, 0x14, 0x00, 0x1C, 0x00, 0x24, 0x00, 0x2C, 0x00, 0x32, 0xFC, 0x88, 0x00, 0x02, 0xFE, 0x8E,
+-    0xFD, 0xC0, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xF2, 0xFD, 0x8B, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xF2,
+-    0xFD, 0xB9, 0x00, 0x03, 0xFE, 0xA8, 0xFE, 0xF2, 0xFC, 0x89, 0x00, 0x02, 0xFE, 0xE2, 0xFD, 0xB1,
+-    0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xF2, 0x00, 0x0E, 0x00, 0x1E, 0x00, 0x24, 0x00, 0x2C, 0x00, 0x34,
+-    0x00, 0x3A, 0x00, 0x40, 0x00, 0x48, 0x00, 0x4E, 0x00, 0x54, 0x00, 0x5A, 0x00, 0x60, 0x00, 0x66,
+-    0x00, 0x6C, 0x00, 0x72, 0xFC, 0x4B, 0x00, 0x02, 0xFE, 0x9E, 0xFD, 0xB8, 0x00, 0x03, 0xFE, 0xA0,
+-    0xFE, 0xA4, 0xFD, 0x98, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xE4, 0xFC, 0xD2, 0x00, 0x02, 0xFE, 0xA0,
+-    0xFC, 0x4C, 0x00, 0x02, 0xFE, 0xA2, 0xFD, 0x95, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xE4, 0xFC, 0xD3,
+-    0x00, 0x02, 0xFE, 0xA4, 0xFC, 0x4D, 0x00, 0x02, 0xFE, 0xA6, 0xFC, 0xD4, 0x00, 0x02, 0xFE, 0xA8,
+-    0xFC, 0x4E, 0x00, 0x02, 0xFE, 0xE2, 0xFC, 0xD5, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0xD6, 0x00, 0x02,
+-    0xFE, 0xEC, 0xFC, 0x4F, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0x50, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x10,
+-    0x00, 0x22, 0x00, 0x2A, 0x00, 0x32, 0x00, 0x3A, 0x00, 0x42, 0x00, 0x4A, 0x00, 0x52, 0x00, 0x58,
+-    0x00, 0x5E, 0x00, 0x64, 0x00, 0x6C, 0x00, 0x74, 0x00, 0x7A, 0x00, 0x80, 0x00, 0x86, 0x00, 0x8C,
+-    0xFD, 0xBD, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xA2, 0xFD, 0x97, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xE2,
+-    0xFD, 0x99, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xF0, 0xFD, 0xC7, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xF2,
+-    0xFD, 0x96, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xF0, 0xFD, 0xB3, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xF2,
+-    0xFC, 0x8A, 0x00, 0x02, 0xFE, 0xAE, 0xFC, 0x8B, 0x00, 0x02, 0xFE, 0xB0, 0xFC, 0x8C, 0x00, 0x02,
+-    0xFE, 0xE2, 0xFD, 0x9B, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xF0, 0xFD, 0x9A, 0x00, 0x03, 0xFE, 0xE4,
+-    0xFE, 0xF2, 0xFC, 0xEE, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0x8D, 0x00, 0x02, 0xFE, 0xE6, 0xFC, 0xEF,
+-    0x00, 0x02, 0xFE, 0xEC, 0xFC, 0x8E, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0x8F, 0x00, 0x02, 0xFE, 0xF2,
+-    0x00, 0x09, 0x00, 0x14, 0x00, 0x1A, 0x00, 0x20, 0x00, 0x26, 0x00, 0x2C, 0x00, 0x34, 0x00, 0x3C,
+-    0x00, 0x42, 0x00, 0x48, 0xFC, 0xD9, 0x00, 0x02, 0x06, 0x70, 0xFC, 0x51, 0x00, 0x02, 0xFE, 0x9E,
+-    0xFC, 0xD7, 0x00, 0x02, 0xFE, 0xA0, 0xFC, 0x52, 0x00, 0x02, 0xFE, 0xE2, 0xFD, 0x93, 0x00, 0x03,
+-    0xFE, 0xE4, 0xFE, 0xA0, 0xFD, 0x94, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xE4, 0xFC, 0xD8, 0x00, 0x02,
+-    0xFE, 0xE4, 0xFC, 0x53, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0x54, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x01,
+-    0x00, 0x04, 0xFD, 0xF8, 0x00, 0x04, 0xFE, 0xB3, 0xFE, 0xE0, 0xFE, 0xE2, 0x00, 0x01, 0x00, 0x04,
+-    0xFC, 0x5D, 0x00, 0x02, 0x06, 0x70, 0x00, 0x01, 0x00, 0x04, 0xFC, 0x90, 0x00, 0x02, 0x06, 0x70,
+-    0x00, 0x0C, 0x00, 0x1A, 0x00, 0x20, 0x00, 0x26, 0x00, 0x2C, 0x00, 0x32, 0x00, 0x38, 0x00, 0x3E,
+-    0x00, 0x44, 0x00, 0x4C, 0x00, 0x52, 0x00, 0x58, 0x00, 0x5E, 0xFC, 0x55, 0x00, 0x02, 0xFE, 0x9E,
+-    0xFC, 0xDA, 0x00, 0x02, 0xFE, 0xA0, 0xFC, 0x56, 0x00, 0x02, 0xFE, 0xA2, 0xFC, 0xDB, 0x00, 0x02,
+-    0xFE, 0xA4, 0xFC, 0x57, 0x00, 0x02, 0xFE, 0xA6, 0xFC, 0xDC, 0x00, 0x02, 0xFE, 0xA8, 0xFC, 0x58,
+-    0x00, 0x02, 0xFE, 0xE2, 0xFD, 0x9D, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xE4, 0xFC, 0xDD, 0x00, 0x02,
+-    0xFE, 0xE4, 0xFC, 0xDE, 0x00, 0x02, 0xFE, 0xEC, 0xFC, 0x59, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0x5A,
+-    0x00, 0x02, 0xFE, 0xF2, 0x00, 0x0C, 0x00, 0x1A, 0x00, 0x22, 0x00, 0x2A, 0x00, 0x30, 0x00, 0x36,
+-    0x00, 0x3C, 0x00, 0x44, 0x00, 0x4C, 0x00, 0x52, 0x00, 0x58, 0x00, 0x5E, 0x00, 0x64, 0xFD, 0xAF,
+-    0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xF2, 0xFD, 0xAE, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xF2, 0xFC, 0x91,
+-    0x00, 0x02, 0xFE, 0xAE, 0xFC, 0x92, 0x00, 0x02, 0xFE, 0xB0, 0xFC, 0x93, 0x00, 0x02, 0xFE, 0xE2,
+-    0xFD, 0x9C, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xE2, 0xFD, 0xB0, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xF2,
+-    0xFC, 0xF0, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0x94, 0x00, 0x02, 0xFE, 0xE6, 0xFC, 0xF1, 0x00, 0x02,
+-    0xFE, 0xEC, 0xFC, 0x95, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0x96, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x01,
+-    0x00, 0x35, 0xFB, 0xD7, 0xFE, 0x8B, 0xFE, 0x8C, 0xFE, 0x8D, 0xFE, 0x8E, 0xFE, 0x91, 0xFE, 0x92,
+-    0xFE, 0x97, 0xFE, 0x98, 0xFE, 0x9B, 0xFE, 0x9C, 0xFE, 0x9F, 0xFE, 0xA0, 0xFE, 0xA3, 0xFE, 0xA4,
+-    0xFE, 0xA7, 0xFE, 0xA8, 0xFE, 0xAB, 0xFE, 0xAD, 0xFE, 0xB3, 0xFE, 0xB4, 0xFE, 0xB7, 0xFE, 0xB8,
+-    0xFE, 0xBB, 0xFE, 0xBC, 0xFE, 0xBF, 0xFE, 0xC0, 0xFE, 0xC3, 0xFE, 0xC4, 0xFE, 0xC7, 0xFE, 0xC8,
+-    0xFE, 0xCB, 0xFE, 0xCC, 0xFE, 0xCF, 0xFE, 0xD0, 0xFE, 0xD3, 0xFE, 0xD4, 0xFE, 0xD7, 0xFE, 0xD8,
+-    0xFE, 0xDB, 0xFE, 0xDC, 0xFE, 0xDF, 0xFE, 0xE0, 0xFE, 0xE3, 0xFE, 0xE4, 0xFE, 0xE7, 0xFE, 0xE8,
+-    0xFE, 0xEB, 0xFE, 0xED, 0xFE, 0xEF, 0xFE, 0xF0, 0xFE, 0xF3, 0xFE, 0xF4, 0x00, 0x04, 0x00, 0x00,
+-    0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0x3E, 0x00, 0x04, 0x00, 0x0E, 0x00, 0x18, 0x00, 0x22,
+-    0x00, 0x2C, 0x00, 0x01, 0x00, 0x04, 0x09, 0xDC, 0x00, 0x02, 0x09, 0xBC, 0x00, 0x01, 0x00, 0x04,
+-    0x09, 0xDD, 0x00, 0x02, 0x09, 0xBC, 0x00, 0x01, 0x00, 0x04, 0x09, 0xDF, 0x00, 0x02, 0x09, 0xBC,
+-    0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x09, 0xCB, 0x00, 0x02, 0x09, 0xBE, 0x09, 0xCC, 0x00, 0x02,
+-    0x09, 0xD7, 0x00, 0x01, 0x00, 0x04, 0x09, 0xA1, 0x09, 0xA2, 0x09, 0xAF, 0x09, 0xC7, 0x00, 0x02,
+-    0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0x2E, 0x00, 0x05, 0x00, 0x10, 0x00, 0x16,
+-    0x00, 0x1C, 0x00, 0x22, 0x00, 0x28, 0x00, 0x02, 0x09, 0xC7, 0x09, 0xBE, 0x00, 0x02, 0x09, 0xC7,
+-    0x09, 0xD7, 0x00, 0x02, 0x09, 0xA1, 0x09, 0xBC, 0x00, 0x02, 0x09, 0xA2, 0x09, 0xBC, 0x00, 0x02,
+-    0x09, 0xAF, 0x09, 0xBC, 0x00, 0x01, 0x00, 0x05, 0x09, 0xCB, 0x09, 0xCC, 0x09, 0xDC, 0x09, 0xDD,
+-    0x09, 0xDF, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x02, 0x66, 0x00, 0x20,
++    0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x00, 0x24, 0x00, 0x4A, 0x00, 0xC0, 0x01, 0x22, 0x01, 0xEC,
++    0x02, 0xB6, 0x03, 0xF0, 0x14, 0xFE, 0x15, 0x26, 0x15, 0x4C, 0x17, 0xFE, 0x1A, 0x74, 0x1A, 0xB0,
++    0x1A, 0xE0, 0x4E, 0xDA, 0x8B, 0xBC, 0x8D, 0x2A, 0x8E, 0x4A, 0x8E, 0xA0, 0x8E, 0xFC, 0x90, 0xA2,
++    0x91, 0xEA, 0xB1, 0xA2, 0xD5, 0x1E, 0xD5, 0x54, 0xD5, 0x84, 0xD5, 0xA4, 0xD5, 0xC0, 0xD5, 0xF0,
++    0xD6, 0x20, 0xD6, 0x68, 0xD6, 0xBA, 0xD6, 0xFE, 0xD7, 0x38, 0xD7, 0x58, 0xD7, 0x74, 0xD8, 0x20,
++    0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0x5E, 0x00, 0x06, 0x00, 0x12,
++    0x00, 0x2C, 0x00, 0x36, 0x00, 0x40, 0x00, 0x4A, 0x00, 0x54, 0x00, 0x03, 0x00, 0x08, 0x00, 0x0E,
++    0x00, 0x14, 0x06, 0x22, 0x00, 0x02, 0x06, 0x53, 0x06, 0x23, 0x00, 0x02, 0x06, 0x54, 0x06, 0x25,
++    0x00, 0x02, 0x06, 0x55, 0x00, 0x01, 0x00, 0x04, 0x06, 0x24, 0x00, 0x02, 0x06, 0x54, 0x00, 0x01,
++    0x00, 0x04, 0x06, 0x26, 0x00, 0x02, 0x06, 0x54, 0x00, 0x01, 0x00, 0x04, 0x06, 0xC2, 0x00, 0x02,
++    0x06, 0x54, 0x00, 0x01, 0x00, 0x04, 0x06, 0xD3, 0x00, 0x02, 0x06, 0x54, 0x00, 0x01, 0x00, 0x04,
++    0x06, 0xC0, 0x00, 0x02, 0x06, 0x54, 0x00, 0x01, 0x00, 0x06, 0x06, 0x27, 0x06, 0x48, 0x06, 0x4A,
++    0x06, 0xC1, 0x06, 0xD2, 0x06, 0xD5, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01,
++    0x00, 0x46, 0x00, 0x08, 0x00, 0x16, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x28, 0x00, 0x2E, 0x00, 0x34,
++    0x00, 0x3A, 0x00, 0x40, 0x00, 0x02, 0x06, 0x27, 0x06, 0x53, 0x00, 0x02, 0x06, 0x27, 0x06, 0x54,
++    0x00, 0x02, 0x06, 0x48, 0x06, 0x54, 0x00, 0x02, 0x06, 0x27, 0x06, 0x55, 0x00, 0x02, 0x06, 0x4A,
++    0x06, 0x54, 0x00, 0x02, 0x06, 0xD5, 0x06, 0x54, 0x00, 0x02, 0x06, 0xC1, 0x06, 0x54, 0x00, 0x02,
++    0x06, 0xD2, 0x06, 0x54, 0x00, 0x01, 0x00, 0x08, 0x06, 0x22, 0x06, 0x23, 0x06, 0x24, 0x06, 0x25,
++    0x06, 0x26, 0x06, 0xC0, 0x06, 0xC2, 0x06, 0xD3, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08,
++    0x00, 0x02, 0x00, 0x62, 0x00, 0x2E, 0xFE, 0x8B, 0xFE, 0x91, 0xFE, 0x97, 0xFE, 0x9B, 0xFE, 0x9F,
++    0xFE, 0xA3, 0xFE, 0xA7, 0xFE, 0xB3, 0xFE, 0xB7, 0xFE, 0xBB, 0xFE, 0xBF, 0xFE, 0xC3, 0xFE, 0xC7,
++    0xFE, 0xCB, 0xFE, 0xCF, 0xFE, 0xD3, 0xFE, 0xD7, 0xFE, 0xDB, 0xFE, 0xDF, 0xFE, 0xE3, 0xFE, 0xE7,
++    0xFE, 0xEB, 0xFB, 0xE8, 0xFE, 0xF3, 0xFB, 0x68, 0xFB, 0x60, 0xFB, 0x54, 0xFB, 0x58, 0xFB, 0x64,
++    0xFB, 0x5C, 0xFB, 0x78, 0xFB, 0x74, 0xFB, 0x7C, 0xFB, 0x80, 0xFB, 0x6C, 0xFB, 0x70, 0xFB, 0x90,
++    0xFB, 0xD5, 0xFB, 0x94, 0xFB, 0x9C, 0xFB, 0x98, 0xFB, 0xA2, 0xFB, 0xAC, 0xFB, 0xA8, 0xFB, 0xFE,
++    0xFB, 0xE6, 0x00, 0x01, 0x00, 0x2E, 0x06, 0x26, 0x06, 0x28, 0x06, 0x2A, 0x06, 0x2B, 0x06, 0x2C,
++    0x06, 0x2D, 0x06, 0x2E, 0x06, 0x33, 0x06, 0x34, 0x06, 0x35, 0x06, 0x36, 0x06, 0x37, 0x06, 0x38,
++    0x06, 0x39, 0x06, 0x3A, 0x06, 0x41, 0x06, 0x42, 0x06, 0x43, 0x06, 0x44, 0x06, 0x45, 0x06, 0x46,
++    0x06, 0x47, 0x06, 0x49, 0x06, 0x4A, 0x06, 0x79, 0x06, 0x7A, 0x06, 0x7B, 0x06, 0x7E, 0x06, 0x7F,
++    0x06, 0x80, 0x06, 0x83, 0x06, 0x84, 0x06, 0x86, 0x06, 0x87, 0x06, 0xA4, 0x06, 0xA6, 0x06, 0xA9,
++    0x06, 0xAD, 0x06, 0xAF, 0x06, 0xB1, 0x06, 0xB3, 0x06, 0xBB, 0x06, 0xBE, 0x06, 0xC1, 0x06, 0xCC,
++    0x06, 0xD0, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x02, 0x00, 0x62, 0x00, 0x2E,
++    0xFE, 0x8C, 0xFE, 0x92, 0xFE, 0x98, 0xFE, 0x9C, 0xFE, 0xA0, 0xFE, 0xA4, 0xFE, 0xA8, 0xFE, 0xB4,
++    0xFE, 0xB8, 0xFE, 0xBC, 0xFE, 0xC0, 0xFE, 0xC4, 0xFE, 0xC8, 0xFE, 0xCC, 0xFE, 0xD0, 0xFE, 0xD4,
++    0xFE, 0xD8, 0xFE, 0xDC, 0xFE, 0xE0, 0xFE, 0xE4, 0xFE, 0xE8, 0xFE, 0xEC, 0xFB, 0xE9, 0xFE, 0xF4,
++    0xFB, 0x69, 0xFB, 0x61, 0xFB, 0x55, 0xFB, 0x59, 0xFB, 0x65, 0xFB, 0x5D, 0xFB, 0x79, 0xFB, 0x75,
++    0xFB, 0x7D, 0xFB, 0x81, 0xFB, 0x6D, 0xFB, 0x71, 0xFB, 0x91, 0xFB, 0xD6, 0xFB, 0x95, 0xFB, 0x9D,
++    0xFB, 0x99, 0xFB, 0xA3, 0xFB, 0xAD, 0xFB, 0xA9, 0xFB, 0xFF, 0xFB, 0xE7, 0x00, 0x01, 0x00, 0x2E,
++    0x06, 0x26, 0x06, 0x28, 0x06, 0x2A, 0x06, 0x2B, 0x06, 0x2C, 0x06, 0x2D, 0x06, 0x2E, 0x06, 0x33,
++    0x06, 0x34, 0x06, 0x35, 0x06, 0x36, 0x06, 0x37, 0x06, 0x38, 0x06, 0x39, 0x06, 0x3A, 0x06, 0x41,
++    0x06, 0x42, 0x06, 0x43, 0x06, 0x44, 0x06, 0x45, 0x06, 0x46, 0x06, 0x47, 0x06, 0x49, 0x06, 0x4A,
++    0x06, 0x79, 0x06, 0x7A, 0x06, 0x7B, 0x06, 0x7E, 0x06, 0x7F, 0x06, 0x80, 0x06, 0x83, 0x06, 0x84,
++    0x06, 0x86, 0x06, 0x87, 0x06, 0xA4, 0x06, 0xA6, 0x06, 0xA9, 0x06, 0xAD, 0x06, 0xAF, 0x06, 0xB1,
++    0x06, 0xB3, 0x06, 0xBB, 0x06, 0xBE, 0x06, 0xC1, 0x06, 0xCC, 0x06, 0xD0, 0x00, 0x01, 0x00, 0x00,
++    0x00, 0x01, 0x00, 0x08, 0x00, 0x02, 0x00, 0x9A, 0x00, 0x4A, 0xFE, 0x82, 0xFE, 0x84, 0xFE, 0x86,
++    0xFE, 0x88, 0xFE, 0x8A, 0xFE, 0x8E, 0xFE, 0x90, 0xFE, 0x94, 0xFE, 0x96, 0xFE, 0x9A, 0xFE, 0x9E,
++    0xFE, 0xA2, 0xFE, 0xA6, 0xFE, 0xAA, 0xFE, 0xAC, 0xFE, 0xAE, 0xFE, 0xB0, 0xFE, 0xB2, 0xFE, 0xB6,
++    0xFE, 0xBA, 0xFE, 0xBE, 0xFE, 0xC2, 0xFE, 0xC6, 0xFE, 0xCA, 0xFE, 0xCE, 0xFE, 0xD2, 0xFE, 0xD6,
++    0xFE, 0xDA, 0xFE, 0xDE, 0xFE, 0xE2, 0xFE, 0xE6, 0xFE, 0xEA, 0xFE, 0xEE, 0xFE, 0xF0, 0xFE, 0xF2,
++    0xFB, 0x51, 0xFB, 0x67, 0xFB, 0x5F, 0xFB, 0x53, 0xFB, 0x57, 0xFB, 0x63, 0xFB, 0x5B, 0xFB, 0x77,
++    0xFB, 0x73, 0xFB, 0x7B, 0xFB, 0x7F, 0xFB, 0x89, 0xFB, 0x85, 0xFB, 0x83, 0xFB, 0x87, 0xFB, 0x8D,
++    0xFB, 0x8B, 0xFB, 0x6B, 0xFB, 0x6F, 0xFB, 0x8F, 0xFB, 0xD4, 0xFB, 0x93, 0xFB, 0x9B, 0xFB, 0x97,
++    0xFB, 0x9F, 0xFB, 0xA1, 0xFB, 0xAB, 0xFB, 0xA5, 0xFB, 0xA7, 0xFB, 0xE1, 0xFB, 0xDA, 0xFB, 0xD8,
++    0xFB, 0xDC, 0xFB, 0xE3, 0xFB, 0xDF, 0xFB, 0xFD, 0xFB, 0xE5, 0xFB, 0xAF, 0xFB, 0xB1, 0x00, 0x01,
++    0x00, 0x4A, 0x06, 0x22, 0x06, 0x23, 0x06, 0x24, 0x06, 0x25, 0x06, 0x26, 0x06, 0x27, 0x06, 0x28,
++    0x06, 0x29, 0x06, 0x2A, 0x06, 0x2B, 0x06, 0x2C, 0x06, 0x2D, 0x06, 0x2E, 0x06, 0x2F, 0x06, 0x30,
++    0x06, 0x31, 0x06, 0x32, 0x06, 0x33, 0x06, 0x34, 0x06, 0x35, 0x06, 0x36, 0x06, 0x37, 0x06, 0x38,
++    0x06, 0x39, 0x06, 0x3A, 0x06, 0x41, 0x06, 0x42, 0x06, 0x43, 0x06, 0x44, 0x06, 0x45, 0x06, 0x46,
++    0x06, 0x47, 0x06, 0x48, 0x06, 0x49, 0x06, 0x4A, 0x06, 0x71, 0x06, 0x79, 0x06, 0x7A, 0x06, 0x7B,
++    0x06, 0x7E, 0x06, 0x7F, 0x06, 0x80, 0x06, 0x83, 0x06, 0x84, 0x06, 0x86, 0x06, 0x87, 0x06, 0x88,
++    0x06, 0x8C, 0x06, 0x8D, 0x06, 0x8E, 0x06, 0x91, 0x06, 0x98, 0x06, 0xA4, 0x06, 0xA6, 0x06, 0xA9,
++    0x06, 0xAD, 0x06, 0xAF, 0x06, 0xB1, 0x06, 0xB3, 0x06, 0xBA, 0x06, 0xBB, 0x06, 0xBE, 0x06, 0xC0,
++    0x06, 0xC1, 0x06, 0xC5, 0x06, 0xC6, 0x06, 0xC7, 0x06, 0xC8, 0x06, 0xC9, 0x06, 0xCB, 0x06, 0xCC,
++    0x06, 0xD0, 0x06, 0xD2, 0x06, 0xD3, 0x00, 0x04, 0x00, 0x08, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01,
++    0x10, 0x98, 0x00, 0x35, 0x00, 0x70, 0x00, 0x7A, 0x01, 0x0C, 0x01, 0x86, 0x01, 0xA8, 0x01, 0xB2,
++    0x02, 0x0C, 0x02, 0x62, 0x03, 0x02, 0x03, 0x8A, 0x03, 0xB4, 0x03, 0xF6, 0x04, 0x46, 0x04, 0x8A,
++    0x04, 0xBC, 0x04, 0xEC, 0x05, 0x26, 0x05, 0x38, 0x05, 0x42, 0x05, 0x64, 0x05, 0xF8, 0x06, 0x6C,
++    0x06, 0xEC, 0x07, 0x80, 0x08, 0x1E, 0x08, 0x56, 0x08, 0xBA, 0x08, 0xF2, 0x09, 0x38, 0x09, 0x66,
++    0x09, 0x78, 0x09, 0x82, 0x09, 0xD4, 0x0A, 0x0E, 0x0A, 0x40, 0x0A, 0x70, 0x0A, 0xCC, 0x0A, 0xF2,
++    0x0B, 0x38, 0x0B, 0x68, 0x0B, 0xDC, 0x0C, 0x2A, 0x0C, 0xD6, 0x0D, 0x72, 0x0E, 0x16, 0x0E, 0x50,
++    0x0E, 0xC8, 0x0F, 0x5A, 0x0F, 0xA8, 0x0F, 0xB6, 0x0F, 0xC0, 0x0F, 0xCA, 0x10, 0x2E, 0x00, 0x01,
++    0x00, 0x04, 0xFB, 0xDD, 0x00, 0x02, 0x06, 0x74, 0x00, 0x12, 0x00, 0x26, 0x00, 0x2C, 0x00, 0x32,
++    0x00, 0x38, 0x00, 0x3E, 0x00, 0x44, 0x00, 0x4A, 0x00, 0x50, 0x00, 0x56, 0x00, 0x5C, 0x00, 0x62,
++    0x00, 0x68, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x7A, 0x00, 0x80, 0x00, 0x86, 0x00, 0x8C, 0xFB, 0xEC,
++    0x00, 0x02, 0x00, 0x01, 0xFB, 0xF0, 0x00, 0x02, 0xFB, 0xD8, 0xFB, 0xF2, 0x00, 0x02, 0xFB, 0xDA,
++    0xFB, 0xF4, 0x00, 0x02, 0xFB, 0xDC, 0xFB, 0xF6, 0x00, 0x02, 0xFB, 0xE5, 0xFB, 0xF8, 0x00, 0x02,
++    0xFB, 0xE7, 0xFB, 0xEA, 0x00, 0x02, 0xFE, 0x8E, 0xFC, 0x00, 0x00, 0x02, 0xFE, 0x9E, 0xFC, 0x97,
++    0x00, 0x02, 0xFE, 0xA0, 0xFC, 0x01, 0x00, 0x02, 0xFE, 0xA2, 0xFC, 0x98, 0x00, 0x02, 0xFE, 0xA4,
++    0xFC, 0x99, 0x00, 0x02, 0xFE, 0xA8, 0xFC, 0x02, 0x00, 0x02, 0xFE, 0xE2, 0xFC, 0x9A, 0x00, 0x02,
++    0xFE, 0xE4, 0xFC, 0x9B, 0x00, 0x02, 0xFE, 0xEC, 0xFB, 0xEE, 0x00, 0x02, 0xFE, 0xEE, 0xFB, 0xF9,
++    0x00, 0x02, 0xFE, 0xF0, 0xFB, 0xFB, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x0F, 0x00, 0x20, 0x00, 0x26,
++    0x00, 0x2C, 0x00, 0x32, 0x00, 0x38, 0x00, 0x3E, 0x00, 0x44, 0x00, 0x4A, 0x00, 0x50, 0x00, 0x56,
++    0x00, 0x5C, 0x00, 0x62, 0x00, 0x68, 0x00, 0x6E, 0x00, 0x74, 0xFB, 0xED, 0x00, 0x02, 0x00, 0x01,
++    0xFB, 0xF1, 0x00, 0x02, 0xFB, 0xD8, 0xFB, 0xF3, 0x00, 0x02, 0xFB, 0xDA, 0xFB, 0xF5, 0x00, 0x02,
++    0xFB, 0xDC, 0xFB, 0xF7, 0x00, 0x02, 0xFB, 0xE5, 0xFB, 0xEB, 0x00, 0x02, 0xFE, 0x8E, 0xFC, 0x64,
++    0x00, 0x02, 0xFE, 0xAE, 0xFC, 0x65, 0x00, 0x02, 0xFE, 0xB0, 0xFC, 0x66, 0x00, 0x02, 0xFE, 0xE2,
++    0xFC, 0xDF, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0x67, 0x00, 0x02, 0xFE, 0xE6, 0xFC, 0xE0, 0x00, 0x02,
++    0xFE, 0xEC, 0xFB, 0xEF, 0x00, 0x02, 0xFE, 0xEE, 0xFB, 0xFA, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0x69,
++    0x00, 0x02, 0xFE, 0xF2, 0x00, 0x03, 0x00, 0x08, 0x00, 0x0E, 0x00, 0x18, 0xFD, 0x3D, 0x00, 0x02,
++    0x06, 0x4B, 0xFD, 0xF3, 0x00, 0x04, 0xFE, 0xDB, 0xFE, 0x92, 0xFE, 0xAE, 0xFD, 0xF2, 0x00, 0x04,
++    0xFE, 0xDF, 0xFE, 0xE0, 0xFE, 0xEA, 0x00, 0x01, 0x00, 0x04, 0xFD, 0x3C, 0x00, 0x02, 0x06, 0x4B,
++    0x00, 0x0B, 0x00, 0x18, 0x00, 0x1E, 0x00, 0x24, 0x00, 0x2A, 0x00, 0x30, 0x00, 0x36, 0x00, 0x3C,
++    0x00, 0x42, 0x00, 0x48, 0x00, 0x4E, 0x00, 0x54, 0xFC, 0x05, 0x00, 0x02, 0xFE, 0x9E, 0xFC, 0x9C,
++    0x00, 0x02, 0xFE, 0xA0, 0xFC, 0x06, 0x00, 0x02, 0xFE, 0xA2, 0xFC, 0x9D, 0x00, 0x02, 0xFE, 0xA4,
++    0xFC, 0x07, 0x00, 0x02, 0xFE, 0xA6, 0xFC, 0x9E, 0x00, 0x02, 0xFE, 0xA8, 0xFC, 0x08, 0x00, 0x02,
++    0xFE, 0xE2, 0xFC, 0x9F, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0xA0, 0x00, 0x02, 0xFE, 0xEC, 0xFC, 0x09,
++    0x00, 0x02, 0xFE, 0xF0, 0xFC, 0x0A, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x0A, 0x00, 0x16, 0x00, 0x1E,
++    0x00, 0x26, 0x00, 0x2C, 0x00, 0x32, 0x00, 0x38, 0x00, 0x3E, 0x00, 0x44, 0x00, 0x4A, 0x00, 0x50,
++    0xFD, 0xC2, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xF2, 0xFD, 0x9E, 0x00, 0x03, 0xFE, 0xA8, 0xFE, 0xF2,
++    0xFC, 0x6A, 0x00, 0x02, 0xFE, 0xAE, 0xFC, 0x6B, 0x00, 0x02, 0xFE, 0xB0, 0xFC, 0x6C, 0x00, 0x02,
++    0xFE, 0xE2, 0xFC, 0xE1, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0x6D, 0x00, 0x02, 0xFE, 0xE6, 0xFC, 0xE2,
++    0x00, 0x02, 0xFE, 0xEC, 0xFC, 0x6E, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0x6F, 0x00, 0x02, 0xFE, 0xF2,
++    0x00, 0x12, 0x00, 0x26, 0x00, 0x2C, 0x00, 0x34, 0x00, 0x3A, 0x00, 0x40, 0x00, 0x48, 0x00, 0x50,
++    0x00, 0x56, 0x00, 0x5C, 0x00, 0x64, 0x00, 0x6A, 0x00, 0x70, 0x00, 0x78, 0x00, 0x80, 0x00, 0x88,
++    0x00, 0x8E, 0x00, 0x94, 0x00, 0x9A, 0xFC, 0x0B, 0x00, 0x02, 0xFE, 0x9E, 0xFD, 0x50, 0x00, 0x03,
++    0xFE, 0xA0, 0xFE, 0xE4, 0xFC, 0xA1, 0x00, 0x02, 0xFE, 0xA0, 0xFC, 0x0C, 0x00, 0x02, 0xFE, 0xA2,
++    0xFD, 0x52, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xA0, 0xFD, 0x53, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xE4,
++    0xFC, 0xA2, 0x00, 0x02, 0xFE, 0xA4, 0xFC, 0x0D, 0x00, 0x02, 0xFE, 0xA6, 0xFD, 0x54, 0x00, 0x03,
++    0xFE, 0xA8, 0xFE, 0xE4, 0xFC, 0xA3, 0x00, 0x02, 0xFE, 0xA8, 0xFC, 0x0E, 0x00, 0x02, 0xFE, 0xE2,
++    0xFD, 0x55, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xA0, 0xFD, 0x56, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xA4,
++    0xFD, 0x57, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xA8, 0xFC, 0xA4, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0xA5,
++    0x00, 0x02, 0xFE, 0xEC, 0xFC, 0x0F, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0x10, 0x00, 0x02, 0xFE, 0xF2,
++    0x00, 0x0F, 0x00, 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x40, 0x00, 0x48, 0x00, 0x4E,
++    0x00, 0x54, 0x00, 0x5A, 0x00, 0x62, 0x00, 0x6A, 0x00, 0x70, 0x00, 0x76, 0x00, 0x7C, 0x00, 0x82,
++    0xFD, 0xA0, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xF0, 0xFD, 0x9F, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xF2,
++    0xFD, 0x51, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0x9E, 0xFD, 0xA2, 0x00, 0x03, 0xFE, 0xA8, 0xFE, 0xF0,
++    0xFD, 0xA1, 0x00, 0x03, 0xFE, 0xA8, 0xFE, 0xF2, 0xFC, 0x70, 0x00, 0x02, 0xFE, 0xAE, 0xFC, 0x71,
++    0x00, 0x02, 0xFE, 0xB0, 0xFC, 0x72, 0x00, 0x02, 0xFE, 0xE2, 0xFD, 0xA4, 0x00, 0x03, 0xFE, 0xE4,
++    0xFE, 0xF0, 0xFD, 0xA3, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xF2, 0xFC, 0xE3, 0x00, 0x02, 0xFE, 0xE4,
++    0xFC, 0x73, 0x00, 0x02, 0xFE, 0xE6, 0xFC, 0xE4, 0x00, 0x02, 0xFE, 0xEC, 0xFC, 0x74, 0x00, 0x02,
++    0xFE, 0xF0, 0xFC, 0x75, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x05, 0x00, 0x0C, 0x00, 0x12, 0x00, 0x18,
++    0x00, 0x1E, 0x00, 0x24, 0xFC, 0x11, 0x00, 0x02, 0xFE, 0x9E, 0xFC, 0x12, 0x00, 0x02, 0xFE, 0xE2,
++    0xFC, 0xA6, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0x13, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0x14, 0x00, 0x02,
++    0xFE, 0xF2, 0x00, 0x08, 0x00, 0x12, 0x00, 0x18, 0x00, 0x1E, 0x00, 0x24, 0x00, 0x2A, 0x00, 0x30,
++    0x00, 0x36, 0x00, 0x3C, 0xFC, 0x76, 0x00, 0x02, 0xFE, 0xAE, 0xFC, 0x77, 0x00, 0x02, 0xFE, 0xB0,
++    0xFC, 0x78, 0x00, 0x02, 0xFE, 0xE2, 0xFC, 0xE5, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0x79, 0x00, 0x02,
++    0xFE, 0xE6, 0xFC, 0xE6, 0x00, 0x02, 0xFE, 0xEC, 0xFC, 0x7A, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0x7B,
++    0x00, 0x02, 0xFE, 0xF2, 0x00, 0x08, 0x00, 0x12, 0x00, 0x18, 0x00, 0x1E, 0x00, 0x30, 0x00, 0x36,
++    0x00, 0x3E, 0x00, 0x44, 0x00, 0x4A, 0xFC, 0x15, 0x00, 0x02, 0xFE, 0xA2, 0xFC, 0xA7, 0x00, 0x02,
++    0xFE, 0xA4, 0xFD, 0xFB, 0x00, 0x08, 0xFE, 0xDE, 0x00, 0x20, 0xFE, 0x9F, 0xFE, 0xE0, 0xFE, 0x8E,
++    0xFE, 0xDF, 0xFE, 0xEA, 0xFC, 0x16, 0x00, 0x02, 0xFE, 0xE2, 0xFD, 0x59, 0x00, 0x03, 0xFE, 0xE4,
++    0xFE, 0xA4, 0xFC, 0xA8, 0x00, 0x02, 0xFE, 0xE4, 0xFD, 0x01, 0x00, 0x02, 0xFE, 0xF0, 0xFD, 0x02,
++    0x00, 0x02, 0xFE, 0xF2, 0x00, 0x07, 0x00, 0x10, 0x00, 0x18, 0x00, 0x20, 0x00, 0x28, 0x00, 0x30,
++    0x00, 0x38, 0x00, 0x3E, 0xFD, 0xA6, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xF0, 0xFD, 0xBE, 0x00, 0x03,
++    0xFE, 0xA4, 0xFE, 0xF2, 0xFD, 0x58, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xA2, 0xFD, 0xA7, 0x00, 0x03,
++    0xFE, 0xE4, 0xFE, 0xF0, 0xFD, 0xA5, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xF2, 0xFD, 0x1D, 0x00, 0x02,
++    0xFE, 0xF0, 0xFD, 0x1E, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x06, 0x00, 0x0E, 0x00, 0x14, 0x00, 0x1A,
++    0x00, 0x20, 0x00, 0x26, 0x00, 0x2C, 0xFC, 0x17, 0x00, 0x02, 0xFE, 0x9E, 0xFC, 0xA9, 0x00, 0x02,
++    0xFE, 0xA0, 0xFC, 0x18, 0x00, 0x02, 0xFE, 0xE2, 0xFC, 0xAA, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0xFF,
++    0x00, 0x02, 0xFE, 0xF0, 0xFD, 0x00, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x05, 0x00, 0x0C, 0x00, 0x14,
++    0x00, 0x1C, 0x00, 0x24, 0x00, 0x2A, 0xFD, 0xBF, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xF2, 0xFD, 0x5B,
++    0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xF0, 0xFD, 0x5A, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xF2, 0xFD, 0x1B,
++    0x00, 0x02, 0xFE, 0xF0, 0xFD, 0x1C, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x07, 0x00, 0x10, 0x00, 0x16,
++    0x00, 0x1C, 0x00, 0x22, 0x00, 0x28, 0x00, 0x2E, 0x00, 0x34, 0xFC, 0x19, 0x00, 0x02, 0xFE, 0x9E,
++    0xFC, 0xAB, 0x00, 0x02, 0xFE, 0xA0, 0xFC, 0x1A, 0x00, 0x02, 0xFE, 0xA2, 0xFC, 0x1B, 0x00, 0x02,
++    0xFE, 0xE2, 0xFC, 0xAC, 0x00, 0x02, 0xFE, 0xE4, 0xFD, 0x03, 0x00, 0x02, 0xFE, 0xF0, 0xFD, 0x04,
++    0x00, 0x02, 0xFE, 0xF2, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0xFD, 0x1F, 0x00, 0x02, 0xFE, 0xF0,
++    0xFD, 0x20, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x01, 0x00, 0x04, 0xFC, 0x5B, 0x00, 0x02, 0x06, 0x70,
++    0x00, 0x03, 0x00, 0x08, 0x00, 0x0E, 0x00, 0x18, 0xFC, 0x5C, 0x00, 0x02, 0x06, 0x70, 0xFD, 0xFC,
++    0x00, 0x04, 0xFB, 0xFE, 0xFE, 0x8E, 0xFE, 0xDD, 0xFD, 0xF6, 0x00, 0x04, 0xFE, 0xB3, 0xFE, 0xEE,
++    0xFE, 0xDD, 0x00, 0x11, 0x00, 0x24, 0x00, 0x2A, 0x00, 0x32, 0x00, 0x38, 0x00, 0x3E, 0x00, 0x46,
++    0x00, 0x4C, 0x00, 0x52, 0x00, 0x58, 0x00, 0x5E, 0x00, 0x64, 0x00, 0x6C, 0x00, 0x74, 0x00, 0x7C,
++    0x00, 0x82, 0x00, 0x88, 0x00, 0x8E, 0xFC, 0x1C, 0x00, 0x02, 0xFE, 0x9E, 0xFD, 0x5D, 0x00, 0x03,
++    0xFE, 0xA0, 0xFE, 0xA4, 0xFC, 0xAD, 0x00, 0x02, 0xFE, 0xA0, 0xFC, 0x1D, 0x00, 0x02, 0xFE, 0xA2,
++    0xFD, 0x5C, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xA0, 0xFC, 0xAE, 0x00, 0x02, 0xFE, 0xA4, 0xFC, 0x1E,
++    0x00, 0x02, 0xFE, 0xA6, 0xFC, 0xAF, 0x00, 0x02, 0xFE, 0xA8, 0xFD, 0x0E, 0x00, 0x02, 0xFE, 0xAE,
++    0xFC, 0x1F, 0x00, 0x02, 0xFE, 0xE2, 0xFD, 0x61, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xA0, 0xFD, 0x60,
++    0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xA4, 0xFD, 0x63, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xE4, 0xFC, 0xB0,
++    0x00, 0x02, 0xFE, 0xE4, 0xFD, 0x31, 0x00, 0x02, 0xFE, 0xEC, 0xFC, 0xFB, 0x00, 0x02, 0xFE, 0xF0,
++    0xFC, 0xFC, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x0D, 0x00, 0x1C, 0x00, 0x24, 0x00, 0x2A, 0x00, 0x30,
++    0x00, 0x38, 0x00, 0x40, 0x00, 0x46, 0x00, 0x4C, 0x00, 0x54, 0x00, 0x5C, 0x00, 0x62, 0x00, 0x68,
++    0x00, 0x6E, 0xFD, 0x5E, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xF0, 0xFD, 0x34, 0x00, 0x02, 0xFE, 0xA0,
++    0xFD, 0x35, 0x00, 0x02, 0xFE, 0xA4, 0xFD, 0xA8, 0x00, 0x03, 0xFE, 0xA8, 0xFE, 0xF0, 0xFD, 0xC6,
++    0x00, 0x03, 0xFE, 0xA8, 0xFE, 0xF2, 0xFD, 0x36, 0x00, 0x02, 0xFE, 0xA8, 0xFD, 0x2A, 0x00, 0x02,
++    0xFE, 0xAE, 0xFD, 0x5F, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xA2, 0xFD, 0x62, 0x00, 0x03, 0xFE, 0xE4,
++    0xFE, 0xE2, 0xFC, 0xE7, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0xE8, 0x00, 0x02, 0xFE, 0xEC, 0xFD, 0x17,
++    0x00, 0x02, 0xFE, 0xF0, 0xFD, 0x18, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x0F, 0x00, 0x20, 0x00, 0x26,
++    0x00, 0x2C, 0x00, 0x32, 0x00, 0x3A, 0x00, 0x40, 0x00, 0x46, 0x00, 0x4C, 0x00, 0x52, 0x00, 0x58,
++    0x00, 0x60, 0x00, 0x68, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x7A, 0xFD, 0x09, 0x00, 0x02, 0xFE, 0x9E,
++    0xFD, 0x2D, 0x00, 0x02, 0xFE, 0xA0, 0xFD, 0x0A, 0x00, 0x02, 0xFE, 0xA2, 0xFD, 0x68, 0x00, 0x03,
++    0xFE, 0xA4, 0xFE, 0xE4, 0xFD, 0x2E, 0x00, 0x02, 0xFE, 0xA4, 0xFD, 0x0B, 0x00, 0x02, 0xFE, 0xA6,
++    0xFD, 0x2F, 0x00, 0x02, 0xFE, 0xA8, 0xFD, 0x0D, 0x00, 0x02, 0xFE, 0xAE, 0xFD, 0x0C, 0x00, 0x02,
++    0xFE, 0xE2, 0xFD, 0x6B, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xA8, 0xFD, 0x6D, 0x00, 0x03, 0xFE, 0xE4,
++    0xFE, 0xE4, 0xFD, 0x30, 0x00, 0x02, 0xFE, 0xE4, 0xFD, 0x32, 0x00, 0x02, 0xFE, 0xEC, 0xFC, 0xFD,
++    0x00, 0x02, 0xFE, 0xF0, 0xFC, 0xFE, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x11, 0x00, 0x24, 0x00, 0x2A,
++    0x00, 0x32, 0x00, 0x38, 0x00, 0x3E, 0x00, 0x46, 0x00, 0x4E, 0x00, 0x54, 0x00, 0x5A, 0x00, 0x60,
++    0x00, 0x66, 0x00, 0x6C, 0x00, 0x74, 0x00, 0x7C, 0x00, 0x82, 0x00, 0x88, 0x00, 0x8E, 0xFD, 0x25,
++    0x00, 0x02, 0xFE, 0x9E, 0xFD, 0x69, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xF2, 0xFD, 0x37, 0x00, 0x02,
++    0xFE, 0xA0, 0xFD, 0x26, 0x00, 0x02, 0xFE, 0xA2, 0xFD, 0x67, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xE2,
++    0xFD, 0xAA, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xF2, 0xFD, 0x38, 0x00, 0x02, 0xFE, 0xA4, 0xFD, 0x27,
++    0x00, 0x02, 0xFE, 0xA6, 0xFD, 0x39, 0x00, 0x02, 0xFE, 0xA8, 0xFD, 0x29, 0x00, 0x02, 0xFE, 0xAE,
++    0xFD, 0x28, 0x00, 0x02, 0xFE, 0xE2, 0xFD, 0x6A, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xA6, 0xFD, 0x6C,
++    0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xE2, 0xFC, 0xE9, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0xEA, 0x00, 0x02,
++    0xFE, 0xEC, 0xFD, 0x19, 0x00, 0x02, 0xFE, 0xF0, 0xFD, 0x1A, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x0E,
++    0x00, 0x1E, 0x00, 0x24, 0x00, 0x2C, 0x00, 0x32, 0x00, 0x38, 0x00, 0x3E, 0x00, 0x46, 0x00, 0x50,
++    0x00, 0x76, 0x00, 0x7E, 0x00, 0x84, 0x00, 0x8C, 0x00, 0x92, 0x00, 0x98, 0xFC, 0x20, 0x00, 0x02,
++    0xFE, 0xA2, 0xFD, 0x65, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xA4, 0xFC, 0xB1, 0x00, 0x02, 0xFE, 0xA4,
++    0xFC, 0xB2, 0x00, 0x02, 0xFE, 0xA8, 0xFD, 0x0F, 0x00, 0x02, 0xFE, 0xAE, 0xFD, 0xF0, 0x00, 0x03,
++    0xFE, 0xE0, 0xFB, 0xAF, 0xFD, 0xF5, 0x00, 0x04, 0xFE, 0xE0, 0xFE, 0xCC, 0xFE, 0xE2, 0xFD, 0xFA,
++    0x00, 0x12, 0xFE, 0xE0, 0xFE, 0xF0, 0x00, 0x20, 0xFE, 0x8D, 0xFE, 0xDF, 0xFE, 0xE0, 0xFE, 0xEA,
++    0x00, 0x20, 0xFE, 0xCB, 0xFE, 0xE0, 0xFE, 0xF4, 0xFE, 0xEA, 0x00, 0x20, 0xFE, 0xED, 0xFE, 0xB3,
++    0xFE, 0xE0, 0xFE, 0xE2, 0xFD, 0xF9, 0x00, 0x03, 0xFE, 0xE0, 0xFE, 0xF0, 0xFC, 0x21, 0x00, 0x02,
++    0xFE, 0xE2, 0xFD, 0xC5, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xE4, 0xFC, 0xB3, 0x00, 0x02, 0xFE, 0xE4,
++    0xFD, 0x05, 0x00, 0x02, 0xFE, 0xF0, 0xFD, 0x06, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x06, 0x00, 0x0E,
++    0x00, 0x16, 0x00, 0x1E, 0x00, 0x24, 0x00, 0x2C, 0x00, 0x32, 0xFD, 0x64, 0x00, 0x03, 0xFE, 0xA4,
++    0xFE, 0xA2, 0xFD, 0xA9, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xF2, 0xFD, 0x2B, 0x00, 0x02, 0xFE, 0xAE,
++    0xFD, 0x66, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xE2, 0xFD, 0x21, 0x00, 0x02, 0xFE, 0xF0, 0xFD, 0x22,
++    0x00, 0x02, 0xFE, 0xF2, 0x00, 0x0C, 0x00, 0x1A, 0x00, 0x20, 0x00, 0x26, 0x00, 0x2C, 0x00, 0x32,
++    0x00, 0x38, 0x00, 0x40, 0x00, 0x46, 0x00, 0x4C, 0x00, 0x52, 0x00, 0x58, 0x00, 0x5E, 0xFC, 0x22,
++    0x00, 0x02, 0xFE, 0x9E, 0xFC, 0xB4, 0x00, 0x02, 0xFE, 0xA0, 0xFC, 0x23, 0x00, 0x02, 0xFE, 0xA2,
++    0xFC, 0xB5, 0x00, 0x02, 0xFE, 0xA4, 0xFC, 0x24, 0x00, 0x02, 0xFE, 0xA6, 0xFD, 0x70, 0x00, 0x03,
++    0xFE, 0xA8, 0xFE, 0xE4, 0xFC, 0xB6, 0x00, 0x02, 0xFE, 0xA8, 0xFD, 0x10, 0x00, 0x02, 0xFE, 0xAE,
++    0xFC, 0x25, 0x00, 0x02, 0xFE, 0xE2, 0xFC, 0xB7, 0x00, 0x02, 0xFE, 0xE4, 0xFD, 0x07, 0x00, 0x02,
++    0xFE, 0xF0, 0xFD, 0x08, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x06, 0x00, 0x0E, 0x00, 0x16, 0x00, 0x1E,
++    0x00, 0x26, 0x00, 0x2C, 0x00, 0x32, 0xFD, 0x6E, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xF0, 0xFD, 0xAB,
++    0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xF2, 0xFD, 0x6F, 0x00, 0x03, 0xFE, 0xA8, 0xFE, 0xE2, 0xFD, 0x2C,
++    0x00, 0x02, 0xFE, 0xAE, 0xFD, 0x23, 0x00, 0x02, 0xFE, 0xF0, 0xFD, 0x24, 0x00, 0x02, 0xFE, 0xF2,
++    0x00, 0x08, 0x00, 0x12, 0x00, 0x18, 0x00, 0x1E, 0x00, 0x24, 0x00, 0x2C, 0x00, 0x34, 0x00, 0x3A,
++    0x00, 0x40, 0xFC, 0x26, 0x00, 0x02, 0xFE, 0xA2, 0xFC, 0xB8, 0x00, 0x02, 0xFE, 0xA4, 0xFC, 0x27,
++    0x00, 0x02, 0xFE, 0xE2, 0xFD, 0x72, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xA4, 0xFD, 0x73, 0x00, 0x03,
++    0xFE, 0xE4, 0xFE, 0xE4, 0xFD, 0x33, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0xF5, 0x00, 0x02, 0xFE, 0xF0,
++    0xFC, 0xF6, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x05, 0x00, 0x0C, 0x00, 0x14, 0x00, 0x1C, 0x00, 0x22,
++    0x00, 0x28, 0xFD, 0x71, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xA2, 0xFD, 0x74, 0x00, 0x03, 0xFE, 0xE4,
++    0xFE, 0xF2, 0xFD, 0x3A, 0x00, 0x02, 0xFE, 0xE4, 0xFD, 0x11, 0x00, 0x02, 0xFE, 0xF0, 0xFD, 0x12,
++    0x00, 0x02, 0xFE, 0xF2, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0xFC, 0x28, 0x00, 0x02, 0xFE, 0xE2,
++    0xFC, 0xB9, 0x00, 0x02, 0xFE, 0xE4, 0x00, 0x01, 0x00, 0x04, 0xFD, 0x3B, 0x00, 0x02, 0xFE, 0xE4,
++    0x00, 0x09, 0x00, 0x14, 0x00, 0x1A, 0x00, 0x22, 0x00, 0x28, 0x00, 0x32, 0x00, 0x38, 0x00, 0x40,
++    0x00, 0x46, 0x00, 0x4C, 0xFC, 0x29, 0x00, 0x02, 0xFE, 0x9E, 0xFD, 0xC4, 0x00, 0x03, 0xFE, 0xA0,
++    0xFE, 0xE4, 0xFC, 0xBA, 0x00, 0x02, 0xFE, 0xA0, 0xFD, 0xF7, 0x00, 0x04, 0xFE, 0xE0, 0xFE, 0xF4,
++    0xFE, 0xEA, 0xFC, 0x2A, 0x00, 0x02, 0xFE, 0xE2, 0xFD, 0x77, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xE4,
++    0xFC, 0xBB, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0xF7, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0xF8, 0x00, 0x02,
++    0xFE, 0xF2, 0x00, 0x06, 0x00, 0x0E, 0x00, 0x16, 0x00, 0x1E, 0x00, 0x26, 0x00, 0x2E, 0x00, 0x34,
++    0xFD, 0x75, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xE2, 0xFD, 0x76, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xE2,
++    0xFD, 0x78, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xF0, 0xFD, 0xB6, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xF2,
++    0xFD, 0x13, 0x00, 0x02, 0xFE, 0xF0, 0xFD, 0x14, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x06, 0x00, 0x0E,
++    0x00, 0x14, 0x00, 0x1A, 0x00, 0x20, 0x00, 0x26, 0x00, 0x2C, 0xFC, 0x2B, 0x00, 0x02, 0xFE, 0x9E,
++    0xFC, 0xBC, 0x00, 0x02, 0xFE, 0xA0, 0xFC, 0x2C, 0x00, 0x02, 0xFE, 0xE2, 0xFC, 0xBD, 0x00, 0x02,
++    0xFE, 0xE4, 0xFC, 0xF9, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0xFA, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x05,
++    0x00, 0x0C, 0x00, 0x14, 0x00, 0x1C, 0x00, 0x24, 0x00, 0x2A, 0xFD, 0x79, 0x00, 0x03, 0xFE, 0xE4,
++    0xFE, 0xE2, 0xFD, 0x7B, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xF0, 0xFD, 0x7A, 0x00, 0x03, 0xFE, 0xE4,
++    0xFE, 0xF2, 0xFD, 0x15, 0x00, 0x02, 0xFE, 0xF0, 0xFD, 0x16, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x0B,
++    0x00, 0x18, 0x00, 0x1E, 0x00, 0x24, 0x00, 0x2A, 0x00, 0x30, 0x00, 0x36, 0x00, 0x3E, 0x00, 0x44,
++    0x00, 0x4A, 0x00, 0x50, 0x00, 0x56, 0xFC, 0x2D, 0x00, 0x02, 0xFE, 0x9E, 0xFC, 0xBE, 0x00, 0x02,
++    0xFE, 0xA0, 0xFC, 0x2E, 0x00, 0x02, 0xFE, 0xA2, 0xFC, 0xBF, 0x00, 0x02, 0xFE, 0xA4, 0xFC, 0x2F,
++    0x00, 0x02, 0xFE, 0xA6, 0xFD, 0x7D, 0x00, 0x03, 0xFE, 0xA8, 0xFE, 0xE4, 0xFC, 0xC0, 0x00, 0x02,
++    0xFE, 0xA8, 0xFC, 0x30, 0x00, 0x02, 0xFE, 0xE2, 0xFC, 0xC1, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0x31,
++    0x00, 0x02, 0xFE, 0xF0, 0xFC, 0x32, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x04, 0x00, 0x0A, 0x00, 0x12,
++    0x00, 0x1A, 0x00, 0x20, 0xFD, 0x7C, 0x00, 0x03, 0xFE, 0xA8, 0xFE, 0xE2, 0xFD, 0xC1, 0x00, 0x03,
++    0xFE, 0xE4, 0xFE, 0xF2, 0xFC, 0x7C, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0x7D, 0x00, 0x02, 0xFE, 0xF2,
++    0x00, 0x08, 0x00, 0x12, 0x00, 0x18, 0x00, 0x1E, 0x00, 0x26, 0x00, 0x2C, 0x00, 0x34, 0x00, 0x3A,
++    0x00, 0x40, 0xFC, 0x33, 0x00, 0x02, 0xFE, 0xA2, 0xFC, 0xC2, 0x00, 0x02, 0xFE, 0xA4, 0xFD, 0xF1,
++    0x00, 0x03, 0xFE, 0xE0, 0xFB, 0xAF, 0xFC, 0x34, 0x00, 0x02, 0xFE, 0xE2, 0xFD, 0xB4, 0x00, 0x03,
++    0xFE, 0xE4, 0xFE, 0xA4, 0xFC, 0xC3, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0x35, 0x00, 0x02, 0xFE, 0xF0,
++    0xFC, 0x36, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x05, 0x00, 0x0C, 0x00, 0x14, 0x00, 0x1C, 0x00, 0x24,
++    0x00, 0x2A, 0xFD, 0x7E, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xA2, 0xFD, 0x7F, 0x00, 0x03, 0xFE, 0xE4,
++    0xFE, 0xE2, 0xFD, 0xB2, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xF2, 0xFC, 0x7E, 0x00, 0x02, 0xFE, 0xF0,
++    0xFC, 0x7F, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x0E, 0x00, 0x1E, 0x00, 0x24, 0x00, 0x2A, 0x00, 0x30,
++    0x00, 0x36, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x48, 0x00, 0x4E, 0x00, 0x54, 0x00, 0x5A, 0x00, 0x62,
++    0x00, 0x68, 0x00, 0x6E, 0xFC, 0x37, 0x00, 0x02, 0xFE, 0x8E, 0xFC, 0x38, 0x00, 0x02, 0xFE, 0x9E,
++    0xFC, 0xC4, 0x00, 0x02, 0xFE, 0xA0, 0xFC, 0x39, 0x00, 0x02, 0xFE, 0xA2, 0xFC, 0xC5, 0x00, 0x02,
++    0xFE, 0xA4, 0xFC, 0x3A, 0x00, 0x02, 0xFE, 0xA6, 0xFC, 0xC6, 0x00, 0x02, 0xFE, 0xA8, 0xFC, 0x3B,
++    0x00, 0x02, 0xFE, 0xDE, 0xFC, 0xC7, 0x00, 0x02, 0xFE, 0xE0, 0xFC, 0x3C, 0x00, 0x02, 0xFE, 0xE2,
++    0xFD, 0xC3, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xE4, 0xFC, 0xC8, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0x3D,
++    0x00, 0x02, 0xFE, 0xF0, 0xFC, 0x3E, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x09, 0x00, 0x14, 0x00, 0x1A,
++    0x00, 0x20, 0x00, 0x26, 0x00, 0x2C, 0x00, 0x34, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x48, 0xFC, 0x80,
++    0x00, 0x02, 0xFE, 0x8E, 0xFC, 0x81, 0x00, 0x02, 0xFE, 0xDE, 0xFC, 0xEB, 0x00, 0x02, 0xFE, 0xE0,
++    0xFC, 0x82, 0x00, 0x02, 0xFE, 0xE2, 0xFD, 0xBB, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xE2, 0xFD, 0xB7,
++    0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xF2, 0xFC, 0xEC, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0x83, 0x00, 0x02,
++    0xFE, 0xF0, 0xFC, 0x84, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x14, 0x00, 0x2A, 0x00, 0x30, 0x00, 0x36,
++    0x00, 0x3C, 0x00, 0x42, 0x00, 0x48, 0x00, 0x50, 0x00, 0x58, 0x00, 0x5E, 0x00, 0x64, 0x00, 0x6C,
++    0x00, 0x72, 0x00, 0x78, 0x00, 0x80, 0x00, 0x86, 0x00, 0x8C, 0x00, 0x94, 0x00, 0x9A, 0x00, 0xA0,
++    0x00, 0xA6, 0xFE, 0xF5, 0x00, 0x02, 0xFE, 0x82, 0xFE, 0xF7, 0x00, 0x02, 0xFE, 0x84, 0xFE, 0xF9,
++    0x00, 0x02, 0xFE, 0x88, 0xFE, 0xFB, 0x00, 0x02, 0xFE, 0x8E, 0xFC, 0x3F, 0x00, 0x02, 0xFE, 0x9E,
++    0xFD, 0x83, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xA0, 0xFD, 0xBA, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xE4,
++    0xFC, 0xC9, 0x00, 0x02, 0xFE, 0xA0, 0xFC, 0x40, 0x00, 0x02, 0xFE, 0xA2, 0xFD, 0xB5, 0x00, 0x03,
++    0xFE, 0xA4, 0xFE, 0xE4, 0xFC, 0xCA, 0x00, 0x02, 0xFE, 0xA4, 0xFC, 0x41, 0x00, 0x02, 0xFE, 0xA6,
++    0xFD, 0x86, 0x00, 0x03, 0xFE, 0xA8, 0xFE, 0xE4, 0xFC, 0xCB, 0x00, 0x02, 0xFE, 0xA8, 0xFC, 0x42,
++    0x00, 0x02, 0xFE, 0xE2, 0xFD, 0x88, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xA4, 0xFC, 0xCC, 0x00, 0x02,
++    0xFE, 0xE4, 0xFC, 0xCD, 0x00, 0x02, 0xFE, 0xEC, 0xFC, 0x43, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0x44,
++    0x00, 0x02, 0xFE, 0xF2, 0x00, 0x11, 0x00, 0x24, 0x00, 0x2A, 0x00, 0x30, 0x00, 0x36, 0x00, 0x3C,
++    0x00, 0x44, 0x00, 0x4C, 0x00, 0x54, 0x00, 0x5C, 0x00, 0x64, 0x00, 0x6C, 0x00, 0x74, 0x00, 0x7A,
++    0x00, 0x82, 0x00, 0x8A, 0x00, 0x90, 0x00, 0x96, 0xFE, 0xF6, 0x00, 0x02, 0xFE, 0x82, 0xFE, 0xF8,
++    0x00, 0x02, 0xFE, 0x84, 0xFE, 0xFA, 0x00, 0x02, 0xFE, 0x88, 0xFE, 0xFC, 0x00, 0x02, 0xFE, 0x8E,
++    0xFD, 0x84, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0x9E, 0xFD, 0xBC, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xE2,
++    0xFD, 0xAC, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xF2, 0xFD, 0x80, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xE2,
++    0xFD, 0x82, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xF0, 0xFD, 0x81, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xF2,
++    0xFD, 0x85, 0x00, 0x03, 0xFE, 0xA8, 0xFE, 0xE2, 0xFC, 0x85, 0x00, 0x02, 0xFE, 0xE2, 0xFD, 0x87,
++    0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xA2, 0xFD, 0xAD, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xF2, 0xFC, 0xED,
++    0x00, 0x02, 0xFE, 0xE4, 0xFC, 0x86, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0x87, 0x00, 0x02, 0xFE, 0xF2,
++    0x00, 0x12, 0x00, 0x26, 0x00, 0x2C, 0x00, 0x34, 0x00, 0x3C, 0x00, 0x44, 0x00, 0x4A, 0x00, 0x50,
++    0x00, 0x58, 0x00, 0x62, 0x00, 0x6A, 0x00, 0x70, 0x00, 0x76, 0x00, 0x7E, 0x00, 0x86, 0x00, 0x8C,
++    0x00, 0x92, 0x00, 0x98, 0x00, 0x9E, 0xFC, 0x45, 0x00, 0x02, 0xFE, 0x9E, 0xFD, 0x8C, 0x00, 0x03,
++    0xFE, 0xA0, 0xFE, 0xA4, 0xFD, 0x92, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xA8, 0xFD, 0x8D, 0x00, 0x03,
++    0xFE, 0xA0, 0xFE, 0xE4, 0xFC, 0xCE, 0x00, 0x02, 0xFE, 0xA0, 0xFC, 0x46, 0x00, 0x02, 0xFE, 0xA2,
++    0xFD, 0x89, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xA0, 0xFD, 0xF4, 0x00, 0x04, 0xFE, 0xA4, 0xFE, 0xE4,
++    0xFE, 0xAA, 0xFD, 0x8A, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xE4, 0xFC, 0xCF, 0x00, 0x02, 0xFE, 0xA4,
++    0xFC, 0x47, 0x00, 0x02, 0xFE, 0xA6, 0xFD, 0x8E, 0x00, 0x03, 0xFE, 0xA8, 0xFE, 0xA0, 0xFD, 0x8F,
++    0x00, 0x03, 0xFE, 0xA8, 0xFE, 0xE4, 0xFC, 0xD0, 0x00, 0x02, 0xFE, 0xA8, 0xFC, 0x48, 0x00, 0x02,
++    0xFE, 0xE2, 0xFC, 0xD1, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0x49, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0x4A,
++    0x00, 0x02, 0xFE, 0xF2, 0x00, 0x06, 0x00, 0x0E, 0x00, 0x14, 0x00, 0x1C, 0x00, 0x24, 0x00, 0x2C,
++    0x00, 0x32, 0xFC, 0x88, 0x00, 0x02, 0xFE, 0x8E, 0xFD, 0xC0, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xF2,
++    0xFD, 0x8B, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xF2, 0xFD, 0xB9, 0x00, 0x03, 0xFE, 0xA8, 0xFE, 0xF2,
++    0xFC, 0x89, 0x00, 0x02, 0xFE, 0xE2, 0xFD, 0xB1, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xF2, 0x00, 0x0E,
++    0x00, 0x1E, 0x00, 0x24, 0x00, 0x2C, 0x00, 0x34, 0x00, 0x3A, 0x00, 0x40, 0x00, 0x48, 0x00, 0x4E,
++    0x00, 0x54, 0x00, 0x5A, 0x00, 0x60, 0x00, 0x66, 0x00, 0x6C, 0x00, 0x72, 0xFC, 0x4B, 0x00, 0x02,
++    0xFE, 0x9E, 0xFD, 0xB8, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xA4, 0xFD, 0x98, 0x00, 0x03, 0xFE, 0xA0,
++    0xFE, 0xE4, 0xFC, 0xD2, 0x00, 0x02, 0xFE, 0xA0, 0xFC, 0x4C, 0x00, 0x02, 0xFE, 0xA2, 0xFD, 0x95,
++    0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xE4, 0xFC, 0xD3, 0x00, 0x02, 0xFE, 0xA4, 0xFC, 0x4D, 0x00, 0x02,
++    0xFE, 0xA6, 0xFC, 0xD4, 0x00, 0x02, 0xFE, 0xA8, 0xFC, 0x4E, 0x00, 0x02, 0xFE, 0xE2, 0xFC, 0xD5,
++    0x00, 0x02, 0xFE, 0xE4, 0xFC, 0xD6, 0x00, 0x02, 0xFE, 0xEC, 0xFC, 0x4F, 0x00, 0x02, 0xFE, 0xF0,
++    0xFC, 0x50, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x10, 0x00, 0x22, 0x00, 0x2A, 0x00, 0x32, 0x00, 0x3A,
++    0x00, 0x42, 0x00, 0x4A, 0x00, 0x52, 0x00, 0x58, 0x00, 0x5E, 0x00, 0x64, 0x00, 0x6C, 0x00, 0x74,
++    0x00, 0x7A, 0x00, 0x80, 0x00, 0x86, 0x00, 0x8C, 0xFD, 0xBD, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xA2,
++    0xFD, 0x97, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xE2, 0xFD, 0x99, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xF0,
++    0xFD, 0xC7, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xF2, 0xFD, 0x96, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xF0,
++    0xFD, 0xB3, 0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xF2, 0xFC, 0x8A, 0x00, 0x02, 0xFE, 0xAE, 0xFC, 0x8B,
++    0x00, 0x02, 0xFE, 0xB0, 0xFC, 0x8C, 0x00, 0x02, 0xFE, 0xE2, 0xFD, 0x9B, 0x00, 0x03, 0xFE, 0xE4,
++    0xFE, 0xF0, 0xFD, 0x9A, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xF2, 0xFC, 0xEE, 0x00, 0x02, 0xFE, 0xE4,
++    0xFC, 0x8D, 0x00, 0x02, 0xFE, 0xE6, 0xFC, 0xEF, 0x00, 0x02, 0xFE, 0xEC, 0xFC, 0x8E, 0x00, 0x02,
++    0xFE, 0xF0, 0xFC, 0x8F, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x09, 0x00, 0x14, 0x00, 0x1A, 0x00, 0x20,
++    0x00, 0x26, 0x00, 0x2C, 0x00, 0x34, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x48, 0xFC, 0xD9, 0x00, 0x02,
++    0x06, 0x70, 0xFC, 0x51, 0x00, 0x02, 0xFE, 0x9E, 0xFC, 0xD7, 0x00, 0x02, 0xFE, 0xA0, 0xFC, 0x52,
++    0x00, 0x02, 0xFE, 0xE2, 0xFD, 0x93, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xA0, 0xFD, 0x94, 0x00, 0x03,
++    0xFE, 0xE4, 0xFE, 0xE4, 0xFC, 0xD8, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0x53, 0x00, 0x02, 0xFE, 0xF0,
++    0xFC, 0x54, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x01, 0x00, 0x04, 0xFD, 0xF8, 0x00, 0x04, 0xFE, 0xB3,
++    0xFE, 0xE0, 0xFE, 0xE2, 0x00, 0x01, 0x00, 0x04, 0xFC, 0x5D, 0x00, 0x02, 0x06, 0x70, 0x00, 0x01,
++    0x00, 0x04, 0xFC, 0x90, 0x00, 0x02, 0x06, 0x70, 0x00, 0x0C, 0x00, 0x1A, 0x00, 0x20, 0x00, 0x26,
++    0x00, 0x2C, 0x00, 0x32, 0x00, 0x38, 0x00, 0x3E, 0x00, 0x44, 0x00, 0x4C, 0x00, 0x52, 0x00, 0x58,
++    0x00, 0x5E, 0xFC, 0x55, 0x00, 0x02, 0xFE, 0x9E, 0xFC, 0xDA, 0x00, 0x02, 0xFE, 0xA0, 0xFC, 0x56,
++    0x00, 0x02, 0xFE, 0xA2, 0xFC, 0xDB, 0x00, 0x02, 0xFE, 0xA4, 0xFC, 0x57, 0x00, 0x02, 0xFE, 0xA6,
++    0xFC, 0xDC, 0x00, 0x02, 0xFE, 0xA8, 0xFC, 0x58, 0x00, 0x02, 0xFE, 0xE2, 0xFD, 0x9D, 0x00, 0x03,
++    0xFE, 0xE4, 0xFE, 0xE4, 0xFC, 0xDD, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0xDE, 0x00, 0x02, 0xFE, 0xEC,
++    0xFC, 0x59, 0x00, 0x02, 0xFE, 0xF0, 0xFC, 0x5A, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x0C, 0x00, 0x1A,
++    0x00, 0x22, 0x00, 0x2A, 0x00, 0x30, 0x00, 0x36, 0x00, 0x3C, 0x00, 0x44, 0x00, 0x4C, 0x00, 0x52,
++    0x00, 0x58, 0x00, 0x5E, 0x00, 0x64, 0xFD, 0xAF, 0x00, 0x03, 0xFE, 0xA0, 0xFE, 0xF2, 0xFD, 0xAE,
++    0x00, 0x03, 0xFE, 0xA4, 0xFE, 0xF2, 0xFC, 0x91, 0x00, 0x02, 0xFE, 0xAE, 0xFC, 0x92, 0x00, 0x02,
++    0xFE, 0xB0, 0xFC, 0x93, 0x00, 0x02, 0xFE, 0xE2, 0xFD, 0x9C, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xE2,
++    0xFD, 0xB0, 0x00, 0x03, 0xFE, 0xE4, 0xFE, 0xF2, 0xFC, 0xF0, 0x00, 0x02, 0xFE, 0xE4, 0xFC, 0x94,
++    0x00, 0x02, 0xFE, 0xE6, 0xFC, 0xF1, 0x00, 0x02, 0xFE, 0xEC, 0xFC, 0x95, 0x00, 0x02, 0xFE, 0xF0,
++    0xFC, 0x96, 0x00, 0x02, 0xFE, 0xF2, 0x00, 0x01, 0x00, 0x35, 0xFB, 0xD7, 0xFE, 0x8B, 0xFE, 0x8C,
++    0xFE, 0x8D, 0xFE, 0x8E, 0xFE, 0x91, 0xFE, 0x92, 0xFE, 0x97, 0xFE, 0x98, 0xFE, 0x9B, 0xFE, 0x9C,
++    0xFE, 0x9F, 0xFE, 0xA0, 0xFE, 0xA3, 0xFE, 0xA4, 0xFE, 0xA7, 0xFE, 0xA8, 0xFE, 0xAB, 0xFE, 0xAD,
++    0xFE, 0xB3, 0xFE, 0xB4, 0xFE, 0xB7, 0xFE, 0xB8, 0xFE, 0xBB, 0xFE, 0xBC, 0xFE, 0xBF, 0xFE, 0xC0,
++    0xFE, 0xC3, 0xFE, 0xC4, 0xFE, 0xC7, 0xFE, 0xC8, 0xFE, 0xCB, 0xFE, 0xCC, 0xFE, 0xCF, 0xFE, 0xD0,
++    0xFE, 0xD3, 0xFE, 0xD4, 0xFE, 0xD7, 0xFE, 0xD8, 0xFE, 0xDB, 0xFE, 0xDC, 0xFE, 0xDF, 0xFE, 0xE0,
++    0xFE, 0xE3, 0xFE, 0xE4, 0xFE, 0xE7, 0xFE, 0xE8, 0xFE, 0xEB, 0xFE, 0xED, 0xFE, 0xEF, 0xFE, 0xF0,
++    0xFE, 0xF3, 0xFE, 0xF4, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0x1A,
++    0x00, 0x01, 0x00, 0x08, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x09, 0xCB, 0x00, 0x02, 0x09, 0xBE,
++    0x09, 0xCC, 0x00, 0x02, 0x09, 0xD7, 0x00, 0x01, 0x00, 0x01, 0x09, 0xC7, 0x00, 0x02, 0x00, 0x00,
++    0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0x16, 0x00, 0x02, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x02,
++    0x09, 0xC7, 0x09, 0xBE, 0x00, 0x02, 0x09, 0xC7, 0x09, 0xD7, 0x00, 0x01, 0x00, 0x02, 0x09, 0xCB,
++    0x09, 0xCC, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x02, 0x66, 0x00, 0x20,
+     0x00, 0x46, 0x00, 0x50, 0x00, 0x62, 0x00, 0x74, 0x00, 0x96, 0x00, 0xA8, 0x00, 0xB2, 0x00, 0xDC,
+     0x00, 0xEE, 0x00, 0xF8, 0x01, 0x1A, 0x01, 0x24, 0x01, 0x2E, 0x01, 0x38, 0x01, 0x4A, 0x01, 0x5C,
+     0x01, 0x7E, 0x01, 0x90, 0x01, 0x9A, 0x01, 0xC4, 0x01, 0xD6, 0x01, 0xE0, 0x02, 0x02, 0x02, 0x0C,
+@@ -508,25 +499,13 @@
+     0x04, 0x35, 0x03, 0x40, 0x00, 0x02, 0x04, 0x33, 0x03, 0x41, 0x00, 0x02, 0x04, 0x3A, 0x03, 0x41,
+     0x00, 0x02, 0x04, 0x38, 0x03, 0x40, 0x00, 0x01, 0x00, 0x08, 0x04, 0x00, 0x04, 0x03, 0x04, 0x0C,
+     0x04, 0x0D, 0x04, 0x50, 0x04, 0x53, 0x04, 0x5C, 0x04, 0x5D, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01,
+-    0x00, 0x08, 0x00, 0x01, 0x00, 0x8A, 0x00, 0x0B, 0x00, 0x1C, 0x00, 0x26, 0x00, 0x30, 0x00, 0x3A,
+-    0x00, 0x44, 0x00, 0x4E, 0x00, 0x58, 0x00, 0x62, 0x00, 0x6C, 0x00, 0x76, 0x00, 0x80, 0x00, 0x01,
+-    0x00, 0x04, 0x09, 0x58, 0x00, 0x02, 0x09, 0x3C, 0x00, 0x01, 0x00, 0x04, 0x09, 0x59, 0x00, 0x02,
+-    0x09, 0x3C, 0x00, 0x01, 0x00, 0x04, 0x09, 0x5A, 0x00, 0x02, 0x09, 0x3C, 0x00, 0x01, 0x00, 0x04,
+-    0x09, 0x5B, 0x00, 0x02, 0x09, 0x3C, 0x00, 0x01, 0x00, 0x04, 0x09, 0x5C, 0x00, 0x02, 0x09, 0x3C,
+-    0x00, 0x01, 0x00, 0x04, 0x09, 0x5D, 0x00, 0x02, 0x09, 0x3C, 0x00, 0x01, 0x00, 0x04, 0x09, 0x29,
+-    0x00, 0x02, 0x09, 0x3C, 0x00, 0x01, 0x00, 0x04, 0x09, 0x5E, 0x00, 0x02, 0x09, 0x3C, 0x00, 0x01,
+-    0x00, 0x04, 0x09, 0x5F, 0x00, 0x02, 0x09, 0x3C, 0x00, 0x01, 0x00, 0x04, 0x09, 0x31, 0x00, 0x02,
+-    0x09, 0x3C, 0x00, 0x01, 0x00, 0x04, 0x09, 0x34, 0x00, 0x02, 0x09, 0x3C, 0x00, 0x01, 0x00, 0x0B,
+-    0x09, 0x15, 0x09, 0x16, 0x09, 0x17, 0x09, 0x1C, 0x09, 0x21, 0x09, 0x22, 0x09, 0x28, 0x09, 0x2B,
+-    0x09, 0x2F, 0x09, 0x30, 0x09, 0x33, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01,
+-    0x00, 0x5E, 0x00, 0x0B, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x28, 0x00, 0x2E, 0x00, 0x34, 0x00, 0x3A,
+-    0x00, 0x40, 0x00, 0x46, 0x00, 0x4C, 0x00, 0x52, 0x00, 0x58, 0x00, 0x02, 0x09, 0x28, 0x09, 0x3C,
+-    0x00, 0x02, 0x09, 0x30, 0x09, 0x3C, 0x00, 0x02, 0x09, 0x33, 0x09, 0x3C, 0x00, 0x02, 0x09, 0x15,
+-    0x09, 0x3C, 0x00, 0x02, 0x09, 0x16, 0x09, 0x3C, 0x00, 0x02, 0x09, 0x17, 0x09, 0x3C, 0x00, 0x02,
+-    0x09, 0x1C, 0x09, 0x3C, 0x00, 0x02, 0x09, 0x21, 0x09, 0x3C, 0x00, 0x02, 0x09, 0x22, 0x09, 0x3C,
+-    0x00, 0x02, 0x09, 0x2B, 0x09, 0x3C, 0x00, 0x02, 0x09, 0x2F, 0x09, 0x3C, 0x00, 0x01, 0x00, 0x0B,
+-    0x09, 0x29, 0x09, 0x31, 0x09, 0x34, 0x09, 0x58, 0x09, 0x59, 0x09, 0x5A, 0x09, 0x5B, 0x09, 0x5C,
+-    0x09, 0x5D, 0x09, 0x5E, 0x09, 0x5F, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01,
++    0x00, 0x08, 0x00, 0x01, 0x00, 0x2A, 0x00, 0x03, 0x00, 0x0C, 0x00, 0x16, 0x00, 0x20, 0x00, 0x01,
++    0x00, 0x04, 0x09, 0x29, 0x00, 0x02, 0x09, 0x3C, 0x00, 0x01, 0x00, 0x04, 0x09, 0x31, 0x00, 0x02,
++    0x09, 0x3C, 0x00, 0x01, 0x00, 0x04, 0x09, 0x34, 0x00, 0x02, 0x09, 0x3C, 0x00, 0x01, 0x00, 0x03,
++    0x09, 0x28, 0x09, 0x30, 0x09, 0x33, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01,
++    0x00, 0x1E, 0x00, 0x03, 0x00, 0x0C, 0x00, 0x12, 0x00, 0x18, 0x00, 0x02, 0x09, 0x28, 0x09, 0x3C,
++    0x00, 0x02, 0x09, 0x30, 0x09, 0x3C, 0x00, 0x02, 0x09, 0x33, 0x09, 0x3C, 0x00, 0x01, 0x00, 0x03,
++    0x09, 0x29, 0x09, 0x31, 0x09, 0x34, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01,
+     0x33, 0x04, 0x00, 0x75, 0x00, 0xF0, 0x01, 0x1A, 0x04, 0x5A, 0x05, 0x0C, 0x08, 0x3C, 0x09, 0x24,
+     0x09, 0xD6, 0x09, 0xE0, 0x0A, 0x54, 0x0D, 0x84, 0x0D, 0x8E, 0x0D, 0x98, 0x11, 0x44, 0x11, 0xF6,
+     0x15, 0x92, 0x16, 0xBC, 0x17, 0x6E, 0x17, 0x88, 0x18, 0xB2, 0x1C, 0x4E, 0x1C, 0x78, 0x1C, 0xA2,
+@@ -1358,569 +1337,541 @@
+     0x1F, 0x81, 0x1F, 0x88, 0x1F, 0x89, 0x1F, 0x90, 0x1F, 0x91, 0x1F, 0x98, 0x1F, 0x99, 0x1F, 0xA0,
+     0x1F, 0xA1, 0x1F, 0xA8, 0x1F, 0xA9, 0x1F, 0xB3, 0x1F, 0xB6, 0x1F, 0xBC, 0x1F, 0xBE, 0x1F, 0xBF,
+     0x1F, 0xC3, 0x1F, 0xC6, 0x1F, 0xCC, 0x1F, 0xF3, 0x1F, 0xF6, 0x1F, 0xFC, 0x1F, 0xFE, 0x21, 0x26,
+-    0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x4C, 0x0A, 0x10, 0x12, 0x6E, 0x18, 0x84, 0x1E, 0x68,
+-    0x22, 0x7A, 0x26, 0x68, 0x29, 0x12, 0x2B, 0x5C, 0x2D, 0x24, 0x2F, 0x04, 0x30, 0xB4, 0x32, 0x62,
+-    0x33, 0xCA, 0x35, 0x32, 0x36, 0x9A, 0x37, 0x76, 0x38, 0x52, 0x39, 0x2E, 0x39, 0xFC, 0x3A, 0xCA,
+-    0x3B, 0x98, 0x3C, 0x4A, 0x3C, 0xFC, 0x3D, 0x22, 0x3D, 0x48, 0x3D, 0x6E, 0x3D, 0x94, 0x3D, 0xBA,
+-    0x3D, 0xE0, 0x3E, 0x06, 0x3E, 0x2C, 0x3E, 0x52, 0x3E, 0x78, 0x3E, 0x9E, 0x00, 0x01, 0x07, 0xCE,
+-    0x00, 0xF9, 0x01, 0xF8, 0x01, 0xFE, 0x02, 0x04, 0x02, 0x0A, 0x02, 0x10, 0x02, 0x16, 0x02, 0x1C,
+-    0x02, 0x22, 0x02, 0x28, 0x02, 0x2E, 0x02, 0x34, 0x02, 0x3A, 0x02, 0x40, 0x02, 0x46, 0x02, 0x4C,
+-    0x02, 0x52, 0x02, 0x58, 0x02, 0x5E, 0x02, 0x64, 0x02, 0x6A, 0x02, 0x70, 0x02, 0x76, 0x02, 0x7C,
+-    0x02, 0x82, 0x02, 0x88, 0x02, 0x8E, 0x02, 0x94, 0x02, 0x9A, 0x02, 0xA0, 0x02, 0xA6, 0x02, 0xAC,
+-    0x02, 0xB2, 0x02, 0xB8, 0x02, 0xBE, 0x02, 0xC4, 0x02, 0xCA, 0x02, 0xD0, 0x02, 0xD6, 0x02, 0xDC,
+-    0x02, 0xE2, 0x02, 0xE8, 0x02, 0xEE, 0x02, 0xF4, 0x02, 0xFA, 0x03, 0x00, 0x03, 0x06, 0x03, 0x0C,
+-    0x03, 0x12, 0x03, 0x18, 0x03, 0x1E, 0x03, 0x24, 0x03, 0x2A, 0x03, 0x30, 0x03, 0x36, 0x03, 0x3C,
+-    0x03, 0x42, 0x03, 0x48, 0x03, 0x4E, 0x03, 0x54, 0x03, 0x5A, 0x03, 0x60, 0x03, 0x66, 0x03, 0x6C,
+-    0x03, 0x72, 0x03, 0x78, 0x03, 0x7E, 0x03, 0x84, 0x03, 0x8A, 0x03, 0x90, 0x03, 0x96, 0x03, 0x9C,
+-    0x03, 0xA2, 0x03, 0xA8, 0x03, 0xAE, 0x03, 0xB4, 0x03, 0xBA, 0x03, 0xC0, 0x03, 0xC6, 0x03, 0xCC,
+-    0x03, 0xD2, 0x03, 0xD8, 0x03, 0xDE, 0x03, 0xE4, 0x03, 0xEA, 0x03, 0xF0, 0x03, 0xF6, 0x03, 0xFC,
+-    0x04, 0x02, 0x04, 0x08, 0x04, 0x0E, 0x04, 0x14, 0x04, 0x1A, 0x04, 0x20, 0x04, 0x26, 0x04, 0x2C,
+-    0x04, 0x32, 0x04, 0x38, 0x04, 0x3E, 0x04, 0x44, 0x04, 0x4A, 0x04, 0x50, 0x04, 0x56, 0x04, 0x5C,
+-    0x04, 0x62, 0x04, 0x68, 0x04, 0x6E, 0x04, 0x74, 0x04, 0x7A, 0x04, 0x80, 0x04, 0x86, 0x04, 0x8C,
+-    0x04, 0x92, 0x04, 0x98, 0x04, 0x9E, 0x04, 0xA4, 0x04, 0xAA, 0x04, 0xB0, 0x04, 0xB6, 0x04, 0xBC,
+-    0x04, 0xC2, 0x04, 0xC8, 0x04, 0xCE, 0x04, 0xD4, 0x04, 0xDA, 0x04, 0xE0, 0x04, 0xE6, 0x04, 0xEC,
+-    0x04, 0xF2, 0x04, 0xF8, 0x04, 0xFE, 0x05, 0x04, 0x05, 0x0A, 0x05, 0x10, 0x05, 0x16, 0x05, 0x1C,
+-    0x05, 0x22, 0x05, 0x28, 0x05, 0x2E, 0x05, 0x34, 0x05, 0x3A, 0x05, 0x40, 0x05, 0x46, 0x05, 0x4C,
+-    0x05, 0x52, 0x05, 0x58, 0x05, 0x5E, 0x05, 0x64, 0x05, 0x6A, 0x05, 0x70, 0x05, 0x76, 0x05, 0x7C,
+-    0x05, 0x82, 0x05, 0x88, 0x05, 0x8E, 0x05, 0x94, 0x05, 0x9A, 0x05, 0xA0, 0x05, 0xA6, 0x05, 0xAC,
+-    0x05, 0xB2, 0x05, 0xB8, 0x05, 0xBE, 0x05, 0xC4, 0x05, 0xCA, 0x05, 0xD0, 0x05, 0xD6, 0x05, 0xDC,
+-    0x05, 0xE2, 0x05, 0xE8, 0x05, 0xEE, 0x05, 0xF4, 0x05, 0xFA, 0x06, 0x00, 0x06, 0x06, 0x06, 0x0C,
+-    0x06, 0x12, 0x06, 0x18, 0x06, 0x1E, 0x06, 0x24, 0x06, 0x2A, 0x06, 0x30, 0x06, 0x36, 0x06, 0x3C,
+-    0x06, 0x42, 0x06, 0x48, 0x06, 0x4E, 0x06, 0x54, 0x06, 0x5A, 0x06, 0x60, 0x06, 0x66, 0x06, 0x6C,
+-    0x06, 0x72, 0x06, 0x78, 0x06, 0x7E, 0x06, 0x84, 0x06, 0x8A, 0x06, 0x90, 0x06, 0x96, 0x06, 0x9C,
+-    0x06, 0xA2, 0x06, 0xA8, 0x06, 0xAE, 0x06, 0xB4, 0x06, 0xBA, 0x06, 0xC0, 0x06, 0xC6, 0x06, 0xCC,
+-    0x06, 0xD2, 0x06, 0xD8, 0x06, 0xDE, 0x06, 0xE4, 0x06, 0xEA, 0x06, 0xF0, 0x06, 0xF6, 0x06, 0xFC,
+-    0x07, 0x02, 0x07, 0x08, 0x07, 0x0E, 0x07, 0x14, 0x07, 0x1A, 0x07, 0x20, 0x07, 0x26, 0x07, 0x2C,
+-    0x07, 0x32, 0x07, 0x38, 0x07, 0x3E, 0x07, 0x44, 0x07, 0x4A, 0x07, 0x50, 0x07, 0x56, 0x07, 0x5C,
+-    0x07, 0x62, 0x07, 0x68, 0x07, 0x6E, 0x07, 0x74, 0x07, 0x7A, 0x07, 0x80, 0x07, 0x86, 0x07, 0x8C,
+-    0x07, 0x92, 0x07, 0x98, 0x07, 0x9E, 0x07, 0xA4, 0x07, 0xAA, 0x07, 0xB0, 0x07, 0xB6, 0x07, 0xBC,
+-    0x07, 0xC2, 0x07, 0xC8, 0x00, 0x02, 0x00, 0xA8, 0x03, 0x01, 0x00, 0x02, 0x03, 0x91, 0x03, 0x01,
+-    0x00, 0x02, 0x03, 0x95, 0x03, 0x01, 0x00, 0x02, 0x03, 0x97, 0x03, 0x01, 0x00, 0x02, 0x03, 0x99,
+-    0x03, 0x01, 0x00, 0x02, 0x03, 0x9F, 0x03, 0x01, 0x00, 0x02, 0x03, 0xA5, 0x03, 0x01, 0x00, 0x02,
+-    0x03, 0xA9, 0x03, 0x01, 0x00, 0x02, 0x03, 0xB9, 0x03, 0x44, 0x00, 0x02, 0x03, 0x99, 0x03, 0x08,
+-    0x00, 0x02, 0x03, 0xA5, 0x03, 0x08, 0x00, 0x02, 0x03, 0xB1, 0x03, 0x01, 0x00, 0x02, 0x03, 0xB5,
+-    0x03, 0x01, 0x00, 0x02, 0x03, 0xB7, 0x03, 0x01, 0x00, 0x02, 0x03, 0xB9, 0x03, 0x01, 0x00, 0x02,
+-    0x03, 0xC5, 0x03, 0x44, 0x00, 0x02, 0x03, 0xB9, 0x03, 0x08, 0x00, 0x02, 0x03, 0xC5, 0x03, 0x08,
+-    0x00, 0x02, 0x03, 0xBF, 0x03, 0x01, 0x00, 0x02, 0x03, 0xC5, 0x03, 0x01, 0x00, 0x02, 0x03, 0xC9,
+-    0x03, 0x01, 0x00, 0x02, 0x03, 0xD2, 0x03, 0x01, 0x00, 0x02, 0x03, 0xD2, 0x03, 0x08, 0x00, 0x02,
+-    0x03, 0xB1, 0x03, 0x13, 0x00, 0x02, 0x03, 0xB1, 0x03, 0x14, 0x00, 0x02, 0x1F, 0x00, 0x03, 0x00,
+-    0x00, 0x02, 0x1F, 0x01, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x00, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x01,
+-    0x03, 0x01, 0x00, 0x02, 0x1F, 0x00, 0x03, 0x42, 0x00, 0x02, 0x1F, 0x01, 0x03, 0x42, 0x00, 0x02,
+-    0x03, 0x91, 0x03, 0x13, 0x00, 0x02, 0x03, 0x91, 0x03, 0x14, 0x00, 0x02, 0x1F, 0x08, 0x03, 0x00,
+-    0x00, 0x02, 0x1F, 0x09, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x08, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x09,
+-    0x03, 0x01, 0x00, 0x02, 0x1F, 0x08, 0x03, 0x42, 0x00, 0x02, 0x1F, 0x09, 0x03, 0x42, 0x00, 0x02,
+-    0x03, 0xB5, 0x03, 0x13, 0x00, 0x02, 0x03, 0xB5, 0x03, 0x14, 0x00, 0x02, 0x1F, 0x10, 0x03, 0x00,
+-    0x00, 0x02, 0x1F, 0x11, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x10, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x11,
+-    0x03, 0x01, 0x00, 0x02, 0x03, 0x95, 0x03, 0x13, 0x00, 0x02, 0x03, 0x95, 0x03, 0x14, 0x00, 0x02,
+-    0x1F, 0x18, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x19, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x18, 0x03, 0x01,
+-    0x00, 0x02, 0x1F, 0x19, 0x03, 0x01, 0x00, 0x02, 0x03, 0xB7, 0x03, 0x13, 0x00, 0x02, 0x03, 0xB7,
+-    0x03, 0x14, 0x00, 0x02, 0x1F, 0x20, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x21, 0x03, 0x00, 0x00, 0x02,
+-    0x1F, 0x20, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x21, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x20, 0x03, 0x42,
+-    0x00, 0x02, 0x1F, 0x21, 0x03, 0x42, 0x00, 0x02, 0x03, 0x97, 0x03, 0x13, 0x00, 0x02, 0x03, 0x97,
+-    0x03, 0x14, 0x00, 0x02, 0x1F, 0x28, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x29, 0x03, 0x00, 0x00, 0x02,
+-    0x1F, 0x28, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x29, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x28, 0x03, 0x42,
+-    0x00, 0x02, 0x1F, 0x29, 0x03, 0x42, 0x00, 0x02, 0x03, 0xB9, 0x03, 0x13, 0x00, 0x02, 0x03, 0xB9,
+-    0x03, 0x14, 0x00, 0x02, 0x1F, 0x30, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x31, 0x03, 0x00, 0x00, 0x02,
+-    0x1F, 0x30, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x31, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x30, 0x03, 0x42,
+-    0x00, 0x02, 0x1F, 0x31, 0x03, 0x42, 0x00, 0x02, 0x03, 0x99, 0x03, 0x13, 0x00, 0x02, 0x03, 0x99,
+-    0x03, 0x14, 0x00, 0x02, 0x1F, 0x38, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x39, 0x03, 0x00, 0x00, 0x02,
+-    0x1F, 0x38, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x39, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x38, 0x03, 0x42,
+-    0x00, 0x02, 0x1F, 0x39, 0x03, 0x42, 0x00, 0x02, 0x03, 0xBF, 0x03, 0x13, 0x00, 0x02, 0x03, 0xBF,
+-    0x03, 0x14, 0x00, 0x02, 0x1F, 0x40, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x41, 0x03, 0x00, 0x00, 0x02,
+-    0x1F, 0x40, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x41, 0x03, 0x01, 0x00, 0x02, 0x03, 0x9F, 0x03, 0x13,
+-    0x00, 0x02, 0x03, 0x9F, 0x03, 0x14, 0x00, 0x02, 0x1F, 0x48, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x49,
+-    0x03, 0x00, 0x00, 0x02, 0x1F, 0x48, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x49, 0x03, 0x01, 0x00, 0x02,
+-    0x03, 0xC5, 0x03, 0x13, 0x00, 0x02, 0x03, 0xC5, 0x03, 0x14, 0x00, 0x02, 0x1F, 0x50, 0x03, 0x00,
+-    0x00, 0x02, 0x1F, 0x51, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x50, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x51,
+-    0x03, 0x01, 0x00, 0x02, 0x1F, 0x50, 0x03, 0x42, 0x00, 0x02, 0x1F, 0x51, 0x03, 0x42, 0x00, 0x02,
+-    0x03, 0xA5, 0x03, 0x14, 0x00, 0x02, 0x1F, 0x59, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x59, 0x03, 0x01,
+-    0x00, 0x02, 0x1F, 0x59, 0x03, 0x42, 0x00, 0x02, 0x03, 0xC9, 0x03, 0x13, 0x00, 0x02, 0x03, 0xC9,
+-    0x03, 0x14, 0x00, 0x02, 0x1F, 0x60, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x61, 0x03, 0x00, 0x00, 0x02,
+-    0x1F, 0x60, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x61, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x60, 0x03, 0x42,
+-    0x00, 0x02, 0x1F, 0x61, 0x03, 0x42, 0x00, 0x02, 0x03, 0xA9, 0x03, 0x13, 0x00, 0x02, 0x03, 0xA9,
+-    0x03, 0x14, 0x00, 0x02, 0x1F, 0x68, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x69, 0x03, 0x00, 0x00, 0x02,
+-    0x1F, 0x68, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x69, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x68, 0x03, 0x42,
+-    0x00, 0x02, 0x1F, 0x69, 0x03, 0x42, 0x00, 0x02, 0x03, 0xB1, 0x03, 0x00, 0x00, 0x02, 0x03, 0xB1,
+-    0x03, 0x01, 0x00, 0x02, 0x03, 0xB5, 0x03, 0x00, 0x00, 0x02, 0x03, 0xB5, 0x03, 0x01, 0x00, 0x02,
+-    0x03, 0xB7, 0x03, 0x00, 0x00, 0x02, 0x03, 0xB7, 0x03, 0x01, 0x00, 0x02, 0x03, 0xB9, 0x03, 0x00,
+-    0x00, 0x02, 0x03, 0xB9, 0x03, 0x01, 0x00, 0x02, 0x03, 0xBF, 0x03, 0x00, 0x00, 0x02, 0x03, 0xBF,
+-    0x03, 0x01, 0x00, 0x02, 0x03, 0xC5, 0x03, 0x00, 0x00, 0x02, 0x03, 0xC5, 0x03, 0x01, 0x00, 0x02,
+-    0x03, 0xC9, 0x03, 0x00, 0x00, 0x02, 0x03, 0xC9, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x00, 0x03, 0x45,
+-    0x00, 0x02, 0x1F, 0x01, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x02, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x03,
+-    0x03, 0x45, 0x00, 0x02, 0x1F, 0x04, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x05, 0x03, 0x45, 0x00, 0x02,
+-    0x1F, 0x06, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x07, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x08, 0x03, 0x45,
+-    0x00, 0x02, 0x1F, 0x09, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x0A, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x0B,
+-    0x03, 0x45, 0x00, 0x02, 0x1F, 0x0C, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x0D, 0x03, 0x45, 0x00, 0x02,
+-    0x1F, 0x0E, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x0F, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x20, 0x03, 0x45,
+-    0x00, 0x02, 0x1F, 0x21, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x22, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x23,
+-    0x03, 0x45, 0x00, 0x02, 0x1F, 0x24, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x25, 0x03, 0x45, 0x00, 0x02,
+-    0x1F, 0x26, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x27, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x28, 0x03, 0x45,
+-    0x00, 0x02, 0x1F, 0x29, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x2A, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x2B,
+-    0x03, 0x45, 0x00, 0x02, 0x1F, 0x2C, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x2D, 0x03, 0x45, 0x00, 0x02,
+-    0x1F, 0x2E, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x2F, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x60, 0x03, 0x45,
+-    0x00, 0x02, 0x1F, 0x61, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x62, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x63,
+-    0x03, 0x45, 0x00, 0x02, 0x1F, 0x64, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x65, 0x03, 0x45, 0x00, 0x02,
+-    0x1F, 0x66, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x67, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x68, 0x03, 0x45,
+-    0x00, 0x02, 0x1F, 0x69, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x6A, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x6B,
+-    0x03, 0x45, 0x00, 0x02, 0x1F, 0x6C, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x6D, 0x03, 0x45, 0x00, 0x02,
+-    0x1F, 0x6E, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x6F, 0x03, 0x45, 0x00, 0x02, 0x03, 0xB1, 0x03, 0x06,
+-    0x00, 0x02, 0x03, 0xB1, 0x03, 0x04, 0x00, 0x02, 0x1F, 0x70, 0x03, 0x45, 0x00, 0x02, 0x03, 0xB1,
+-    0x03, 0x45, 0x00, 0x02, 0x03, 0xAC, 0x03, 0x45, 0x00, 0x02, 0x03, 0xB1, 0x03, 0x42, 0x00, 0x02,
+-    0x1F, 0xB3, 0x03, 0x42, 0x00, 0x02, 0x03, 0x91, 0x03, 0x06, 0x00, 0x02, 0x03, 0x91, 0x03, 0x04,
+-    0x00, 0x02, 0x03, 0x91, 0x03, 0x00, 0x00, 0x02, 0x03, 0x91, 0x03, 0x01, 0x00, 0x02, 0x03, 0x91,
+-    0x03, 0x45, 0x00, 0x02, 0x00, 0xA8, 0x03, 0x42, 0x00, 0x02, 0x1F, 0x74, 0x03, 0x45, 0x00, 0x02,
+-    0x03, 0xB7, 0x03, 0x45, 0x00, 0x02, 0x03, 0xAE, 0x03, 0x45, 0x00, 0x02, 0x03, 0xB7, 0x03, 0x42,
+-    0x00, 0x02, 0x1F, 0xC3, 0x03, 0x42, 0x00, 0x02, 0x03, 0x95, 0x03, 0x00, 0x00, 0x02, 0x03, 0x95,
+-    0x03, 0x01, 0x00, 0x02, 0x03, 0x97, 0x03, 0x00, 0x00, 0x02, 0x03, 0x97, 0x03, 0x01, 0x00, 0x02,
+-    0x03, 0x97, 0x03, 0x45, 0x00, 0x02, 0x1F, 0xBF, 0x03, 0x00, 0x00, 0x02, 0x1F, 0xBF, 0x03, 0x01,
+-    0x00, 0x02, 0x1F, 0xBF, 0x03, 0x42, 0x00, 0x02, 0x03, 0xB9, 0x03, 0x06, 0x00, 0x02, 0x03, 0xB9,
+-    0x03, 0x04, 0x00, 0x02, 0x03, 0xCA, 0x03, 0x00, 0x00, 0x02, 0x03, 0xB9, 0x03, 0x44, 0x00, 0x02,
+-    0x03, 0xB9, 0x03, 0x42, 0x00, 0x02, 0x03, 0xCA, 0x03, 0x42, 0x00, 0x02, 0x03, 0x99, 0x03, 0x06,
+-    0x00, 0x02, 0x03, 0x99, 0x03, 0x04, 0x00, 0x02, 0x03, 0x99, 0x03, 0x00, 0x00, 0x02, 0x03, 0x99,
+-    0x03, 0x01, 0x00, 0x02, 0x1F, 0xFE, 0x03, 0x00, 0x00, 0x02, 0x1F, 0xFE, 0x03, 0x01, 0x00, 0x02,
+-    0x1F, 0xFE, 0x03, 0x42, 0x00, 0x02, 0x03, 0xC5, 0x03, 0x06, 0x00, 0x02, 0x03, 0xC5, 0x03, 0x04,
+-    0x00, 0x02, 0x03, 0xCB, 0x03, 0x00, 0x00, 0x02, 0x03, 0xC5, 0x03, 0x44, 0x00, 0x02, 0x03, 0xC1,
++    0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x4C, 0x09, 0x66, 0x11, 0x1A, 0x17, 0x08, 0x1C, 0xC2,
++    0x20, 0xBC, 0x24, 0x9E, 0x27, 0x3C, 0x29, 0x7A, 0x2B, 0x42, 0x2D, 0x22, 0x2E, 0xD2, 0x30, 0x80,
++    0x31, 0xE8, 0x33, 0x50, 0x34, 0xB8, 0x35, 0x94, 0x36, 0x70, 0x37, 0x4C, 0x38, 0x1A, 0x38, 0xE8,
++    0x39, 0xB6, 0x3A, 0x68, 0x3B, 0x1A, 0x3B, 0x40, 0x3B, 0x66, 0x3B, 0x8C, 0x3B, 0xB2, 0x3B, 0xD8,
++    0x3B, 0xFE, 0x3C, 0x24, 0x3C, 0x4A, 0x3C, 0x70, 0x3C, 0x96, 0x3C, 0xBC, 0x00, 0x01, 0x07, 0x46,
++    0x00, 0xE8, 0x01, 0xD6, 0x01, 0xDC, 0x01, 0xE2, 0x01, 0xE8, 0x01, 0xEE, 0x01, 0xF4, 0x01, 0xFA,
++    0x02, 0x00, 0x02, 0x06, 0x02, 0x0C, 0x02, 0x12, 0x02, 0x18, 0x02, 0x1E, 0x02, 0x24, 0x02, 0x2A,
++    0x02, 0x30, 0x02, 0x36, 0x02, 0x3C, 0x02, 0x42, 0x02, 0x48, 0x02, 0x4E, 0x02, 0x54, 0x02, 0x5A,
++    0x02, 0x60, 0x02, 0x66, 0x02, 0x6C, 0x02, 0x72, 0x02, 0x78, 0x02, 0x7E, 0x02, 0x84, 0x02, 0x8A,
++    0x02, 0x90, 0x02, 0x96, 0x02, 0x9C, 0x02, 0xA2, 0x02, 0xA8, 0x02, 0xAE, 0x02, 0xB4, 0x02, 0xBA,
++    0x02, 0xC0, 0x02, 0xC6, 0x02, 0xCC, 0x02, 0xD2, 0x02, 0xD8, 0x02, 0xDE, 0x02, 0xE4, 0x02, 0xEA,
++    0x02, 0xF0, 0x02, 0xF6, 0x02, 0xFC, 0x03, 0x02, 0x03, 0x08, 0x03, 0x0E, 0x03, 0x14, 0x03, 0x1A,
++    0x03, 0x20, 0x03, 0x26, 0x03, 0x2C, 0x03, 0x32, 0x03, 0x38, 0x03, 0x3E, 0x03, 0x44, 0x03, 0x4A,
++    0x03, 0x50, 0x03, 0x56, 0x03, 0x5C, 0x03, 0x62, 0x03, 0x68, 0x03, 0x6E, 0x03, 0x74, 0x03, 0x7A,
++    0x03, 0x80, 0x03, 0x86, 0x03, 0x8C, 0x03, 0x92, 0x03, 0x98, 0x03, 0x9E, 0x03, 0xA4, 0x03, 0xAA,
++    0x03, 0xB0, 0x03, 0xB6, 0x03, 0xBC, 0x03, 0xC2, 0x03, 0xC8, 0x03, 0xCE, 0x03, 0xD4, 0x03, 0xDA,
++    0x03, 0xE0, 0x03, 0xE6, 0x03, 0xEC, 0x03, 0xF2, 0x03, 0xF8, 0x03, 0xFE, 0x04, 0x04, 0x04, 0x0A,
++    0x04, 0x10, 0x04, 0x16, 0x04, 0x1C, 0x04, 0x22, 0x04, 0x28, 0x04, 0x2E, 0x04, 0x34, 0x04, 0x3A,
++    0x04, 0x40, 0x04, 0x46, 0x04, 0x4C, 0x04, 0x52, 0x04, 0x58, 0x04, 0x5E, 0x04, 0x64, 0x04, 0x6A,
++    0x04, 0x70, 0x04, 0x76, 0x04, 0x7C, 0x04, 0x82, 0x04, 0x88, 0x04, 0x8E, 0x04, 0x94, 0x04, 0x9A,
++    0x04, 0xA0, 0x04, 0xA6, 0x04, 0xAC, 0x04, 0xB2, 0x04, 0xB8, 0x04, 0xBE, 0x04, 0xC4, 0x04, 0xCA,
++    0x04, 0xD0, 0x04, 0xD6, 0x04, 0xDC, 0x04, 0xE2, 0x04, 0xE8, 0x04, 0xEE, 0x04, 0xF4, 0x04, 0xFA,
++    0x05, 0x00, 0x05, 0x06, 0x05, 0x0C, 0x05, 0x12, 0x05, 0x18, 0x05, 0x1E, 0x05, 0x24, 0x05, 0x2A,
++    0x05, 0x30, 0x05, 0x36, 0x05, 0x3C, 0x05, 0x42, 0x05, 0x48, 0x05, 0x4E, 0x05, 0x54, 0x05, 0x5A,
++    0x05, 0x60, 0x05, 0x66, 0x05, 0x6C, 0x05, 0x72, 0x05, 0x78, 0x05, 0x7E, 0x05, 0x84, 0x05, 0x8A,
++    0x05, 0x90, 0x05, 0x96, 0x05, 0x9C, 0x05, 0xA2, 0x05, 0xA8, 0x05, 0xAE, 0x05, 0xB4, 0x05, 0xBA,
++    0x05, 0xC0, 0x05, 0xC6, 0x05, 0xCC, 0x05, 0xD2, 0x05, 0xD8, 0x05, 0xDE, 0x05, 0xE4, 0x05, 0xEA,
++    0x05, 0xF0, 0x05, 0xF6, 0x05, 0xFC, 0x06, 0x02, 0x06, 0x08, 0x06, 0x0E, 0x06, 0x14, 0x06, 0x1A,
++    0x06, 0x20, 0x06, 0x26, 0x06, 0x2C, 0x06, 0x32, 0x06, 0x38, 0x06, 0x3E, 0x06, 0x44, 0x06, 0x4A,
++    0x06, 0x50, 0x06, 0x56, 0x06, 0x5C, 0x06, 0x62, 0x06, 0x68, 0x06, 0x6E, 0x06, 0x74, 0x06, 0x7A,
++    0x06, 0x80, 0x06, 0x86, 0x06, 0x8C, 0x06, 0x92, 0x06, 0x98, 0x06, 0x9E, 0x06, 0xA4, 0x06, 0xAA,
++    0x06, 0xB0, 0x06, 0xB6, 0x06, 0xBC, 0x06, 0xC2, 0x06, 0xC8, 0x06, 0xCE, 0x06, 0xD4, 0x06, 0xDA,
++    0x06, 0xE0, 0x06, 0xE6, 0x06, 0xEC, 0x06, 0xF2, 0x06, 0xF8, 0x06, 0xFE, 0x07, 0x04, 0x07, 0x0A,
++    0x07, 0x10, 0x07, 0x16, 0x07, 0x1C, 0x07, 0x22, 0x07, 0x28, 0x07, 0x2E, 0x07, 0x34, 0x07, 0x3A,
++    0x07, 0x40, 0x00, 0x02, 0x00, 0xA8, 0x03, 0x01, 0x00, 0x02, 0x03, 0x91, 0x03, 0x01, 0x00, 0x02,
++    0x03, 0x95, 0x03, 0x01, 0x00, 0x02, 0x03, 0x97, 0x03, 0x01, 0x00, 0x02, 0x03, 0x99, 0x03, 0x01,
++    0x00, 0x02, 0x03, 0x9F, 0x03, 0x01, 0x00, 0x02, 0x03, 0xA5, 0x03, 0x01, 0x00, 0x02, 0x03, 0xA9,
++    0x03, 0x01, 0x00, 0x02, 0x03, 0xB9, 0x03, 0x44, 0x00, 0x02, 0x03, 0x99, 0x03, 0x08, 0x00, 0x02,
++    0x03, 0xA5, 0x03, 0x08, 0x00, 0x02, 0x03, 0xB1, 0x03, 0x01, 0x00, 0x02, 0x03, 0xB5, 0x03, 0x01,
++    0x00, 0x02, 0x03, 0xB7, 0x03, 0x01, 0x00, 0x02, 0x03, 0xB9, 0x03, 0x01, 0x00, 0x02, 0x03, 0xC5,
++    0x03, 0x44, 0x00, 0x02, 0x03, 0xB9, 0x03, 0x08, 0x00, 0x02, 0x03, 0xC5, 0x03, 0x08, 0x00, 0x02,
++    0x03, 0xBF, 0x03, 0x01, 0x00, 0x02, 0x03, 0xC5, 0x03, 0x01, 0x00, 0x02, 0x03, 0xC9, 0x03, 0x01,
++    0x00, 0x02, 0x03, 0xD2, 0x03, 0x01, 0x00, 0x02, 0x03, 0xD2, 0x03, 0x08, 0x00, 0x02, 0x03, 0xB1,
++    0x03, 0x13, 0x00, 0x02, 0x03, 0xB1, 0x03, 0x14, 0x00, 0x02, 0x1F, 0x00, 0x03, 0x00, 0x00, 0x02,
++    0x1F, 0x01, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x00, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x01, 0x03, 0x01,
++    0x00, 0x02, 0x1F, 0x00, 0x03, 0x42, 0x00, 0x02, 0x1F, 0x01, 0x03, 0x42, 0x00, 0x02, 0x03, 0x91,
++    0x03, 0x13, 0x00, 0x02, 0x03, 0x91, 0x03, 0x14, 0x00, 0x02, 0x1F, 0x08, 0x03, 0x00, 0x00, 0x02,
++    0x1F, 0x09, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x08, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x09, 0x03, 0x01,
++    0x00, 0x02, 0x1F, 0x08, 0x03, 0x42, 0x00, 0x02, 0x1F, 0x09, 0x03, 0x42, 0x00, 0x02, 0x03, 0xB5,
++    0x03, 0x13, 0x00, 0x02, 0x03, 0xB5, 0x03, 0x14, 0x00, 0x02, 0x1F, 0x10, 0x03, 0x00, 0x00, 0x02,
++    0x1F, 0x11, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x10, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x11, 0x03, 0x01,
++    0x00, 0x02, 0x03, 0x95, 0x03, 0x13, 0x00, 0x02, 0x03, 0x95, 0x03, 0x14, 0x00, 0x02, 0x1F, 0x18,
++    0x03, 0x00, 0x00, 0x02, 0x1F, 0x19, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x18, 0x03, 0x01, 0x00, 0x02,
++    0x1F, 0x19, 0x03, 0x01, 0x00, 0x02, 0x03, 0xB7, 0x03, 0x13, 0x00, 0x02, 0x03, 0xB7, 0x03, 0x14,
++    0x00, 0x02, 0x1F, 0x20, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x21, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x20,
++    0x03, 0x01, 0x00, 0x02, 0x1F, 0x21, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x20, 0x03, 0x42, 0x00, 0x02,
++    0x1F, 0x21, 0x03, 0x42, 0x00, 0x02, 0x03, 0x97, 0x03, 0x13, 0x00, 0x02, 0x03, 0x97, 0x03, 0x14,
++    0x00, 0x02, 0x1F, 0x28, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x29, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x28,
++    0x03, 0x01, 0x00, 0x02, 0x1F, 0x29, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x28, 0x03, 0x42, 0x00, 0x02,
++    0x1F, 0x29, 0x03, 0x42, 0x00, 0x02, 0x03, 0xB9, 0x03, 0x13, 0x00, 0x02, 0x03, 0xB9, 0x03, 0x14,
++    0x00, 0x02, 0x1F, 0x30, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x31, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x30,
++    0x03, 0x01, 0x00, 0x02, 0x1F, 0x31, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x30, 0x03, 0x42, 0x00, 0x02,
++    0x1F, 0x31, 0x03, 0x42, 0x00, 0x02, 0x03, 0x99, 0x03, 0x13, 0x00, 0x02, 0x03, 0x99, 0x03, 0x14,
++    0x00, 0x02, 0x1F, 0x38, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x39, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x38,
++    0x03, 0x01, 0x00, 0x02, 0x1F, 0x39, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x38, 0x03, 0x42, 0x00, 0x02,
++    0x1F, 0x39, 0x03, 0x42, 0x00, 0x02, 0x03, 0xBF, 0x03, 0x13, 0x00, 0x02, 0x03, 0xBF, 0x03, 0x14,
++    0x00, 0x02, 0x1F, 0x40, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x41, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x40,
++    0x03, 0x01, 0x00, 0x02, 0x1F, 0x41, 0x03, 0x01, 0x00, 0x02, 0x03, 0x9F, 0x03, 0x13, 0x00, 0x02,
++    0x03, 0x9F, 0x03, 0x14, 0x00, 0x02, 0x1F, 0x48, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x49, 0x03, 0x00,
++    0x00, 0x02, 0x1F, 0x48, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x49, 0x03, 0x01, 0x00, 0x02, 0x03, 0xC5,
++    0x03, 0x13, 0x00, 0x02, 0x03, 0xC5, 0x03, 0x14, 0x00, 0x02, 0x1F, 0x50, 0x03, 0x00, 0x00, 0x02,
++    0x1F, 0x51, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x50, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x51, 0x03, 0x01,
++    0x00, 0x02, 0x1F, 0x50, 0x03, 0x42, 0x00, 0x02, 0x1F, 0x51, 0x03, 0x42, 0x00, 0x02, 0x03, 0xA5,
++    0x03, 0x14, 0x00, 0x02, 0x1F, 0x59, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x59, 0x03, 0x01, 0x00, 0x02,
++    0x1F, 0x59, 0x03, 0x42, 0x00, 0x02, 0x03, 0xC9, 0x03, 0x13, 0x00, 0x02, 0x03, 0xC9, 0x03, 0x14,
++    0x00, 0x02, 0x1F, 0x60, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x61, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x60,
++    0x03, 0x01, 0x00, 0x02, 0x1F, 0x61, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x60, 0x03, 0x42, 0x00, 0x02,
++    0x1F, 0x61, 0x03, 0x42, 0x00, 0x02, 0x03, 0xA9, 0x03, 0x13, 0x00, 0x02, 0x03, 0xA9, 0x03, 0x14,
++    0x00, 0x02, 0x1F, 0x68, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x69, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x68,
++    0x03, 0x01, 0x00, 0x02, 0x1F, 0x69, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x68, 0x03, 0x42, 0x00, 0x02,
++    0x1F, 0x69, 0x03, 0x42, 0x00, 0x02, 0x03, 0xB1, 0x03, 0x00, 0x00, 0x02, 0x03, 0xB5, 0x03, 0x00,
++    0x00, 0x02, 0x03, 0xB7, 0x03, 0x00, 0x00, 0x02, 0x03, 0xB9, 0x03, 0x00, 0x00, 0x02, 0x03, 0xBF,
++    0x03, 0x00, 0x00, 0x02, 0x03, 0xC5, 0x03, 0x00, 0x00, 0x02, 0x03, 0xC9, 0x03, 0x00, 0x00, 0x02,
++    0x1F, 0x00, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x01, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x02, 0x03, 0x45,
++    0x00, 0x02, 0x1F, 0x03, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x04, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x05,
++    0x03, 0x45, 0x00, 0x02, 0x1F, 0x06, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x07, 0x03, 0x45, 0x00, 0x02,
++    0x1F, 0x08, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x09, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x0A, 0x03, 0x45,
++    0x00, 0x02, 0x1F, 0x0B, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x0C, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x0D,
++    0x03, 0x45, 0x00, 0x02, 0x1F, 0x0E, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x0F, 0x03, 0x45, 0x00, 0x02,
++    0x1F, 0x20, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x21, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x22, 0x03, 0x45,
++    0x00, 0x02, 0x1F, 0x23, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x24, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x25,
++    0x03, 0x45, 0x00, 0x02, 0x1F, 0x26, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x27, 0x03, 0x45, 0x00, 0x02,
++    0x1F, 0x28, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x29, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x2A, 0x03, 0x45,
++    0x00, 0x02, 0x1F, 0x2B, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x2C, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x2D,
++    0x03, 0x45, 0x00, 0x02, 0x1F, 0x2E, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x2F, 0x03, 0x45, 0x00, 0x02,
++    0x1F, 0x60, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x61, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x62, 0x03, 0x45,
++    0x00, 0x02, 0x1F, 0x63, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x64, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x65,
++    0x03, 0x45, 0x00, 0x02, 0x1F, 0x66, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x67, 0x03, 0x45, 0x00, 0x02,
++    0x1F, 0x68, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x69, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x6A, 0x03, 0x45,
++    0x00, 0x02, 0x1F, 0x6B, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x6C, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x6D,
++    0x03, 0x45, 0x00, 0x02, 0x1F, 0x6E, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x6F, 0x03, 0x45, 0x00, 0x02,
++    0x03, 0xB1, 0x03, 0x06, 0x00, 0x02, 0x03, 0xB1, 0x03, 0x04, 0x00, 0x02, 0x1F, 0x70, 0x03, 0x45,
++    0x00, 0x02, 0x03, 0xB1, 0x03, 0x45, 0x00, 0x02, 0x03, 0xAC, 0x03, 0x45, 0x00, 0x02, 0x03, 0xB1,
++    0x03, 0x42, 0x00, 0x02, 0x1F, 0xB3, 0x03, 0x42, 0x00, 0x02, 0x03, 0x91, 0x03, 0x06, 0x00, 0x02,
++    0x03, 0x91, 0x03, 0x04, 0x00, 0x02, 0x03, 0x91, 0x03, 0x00, 0x00, 0x02, 0x03, 0x91, 0x03, 0x45,
++    0x00, 0x02, 0x00, 0xA8, 0x03, 0x42, 0x00, 0x02, 0x1F, 0x74, 0x03, 0x45, 0x00, 0x02, 0x03, 0xB7,
++    0x03, 0x45, 0x00, 0x02, 0x03, 0xAE, 0x03, 0x45, 0x00, 0x02, 0x03, 0xB7, 0x03, 0x42, 0x00, 0x02,
++    0x1F, 0xC3, 0x03, 0x42, 0x00, 0x02, 0x03, 0x95, 0x03, 0x00, 0x00, 0x02, 0x03, 0x97, 0x03, 0x00,
++    0x00, 0x02, 0x03, 0x97, 0x03, 0x45, 0x00, 0x02, 0x1F, 0xBF, 0x03, 0x00, 0x00, 0x02, 0x1F, 0xBF,
++    0x03, 0x01, 0x00, 0x02, 0x1F, 0xBF, 0x03, 0x42, 0x00, 0x02, 0x03, 0xB9, 0x03, 0x06, 0x00, 0x02,
++    0x03, 0xB9, 0x03, 0x04, 0x00, 0x02, 0x03, 0xCA, 0x03, 0x00, 0x00, 0x02, 0x03, 0xB9, 0x03, 0x42,
++    0x00, 0x02, 0x03, 0xCA, 0x03, 0x42, 0x00, 0x02, 0x03, 0x99, 0x03, 0x06, 0x00, 0x02, 0x03, 0x99,
++    0x03, 0x04, 0x00, 0x02, 0x03, 0x99, 0x03, 0x00, 0x00, 0x02, 0x1F, 0xFE, 0x03, 0x00, 0x00, 0x02,
++    0x1F, 0xFE, 0x03, 0x01, 0x00, 0x02, 0x1F, 0xFE, 0x03, 0x42, 0x00, 0x02, 0x03, 0xC5, 0x03, 0x06,
++    0x00, 0x02, 0x03, 0xC5, 0x03, 0x04, 0x00, 0x02, 0x03, 0xCB, 0x03, 0x00, 0x00, 0x02, 0x03, 0xC1,
+     0x03, 0x13, 0x00, 0x02, 0x03, 0xC1, 0x03, 0x14, 0x00, 0x02, 0x03, 0xC5, 0x03, 0x42, 0x00, 0x02,
+     0x03, 0xCB, 0x03, 0x42, 0x00, 0x02, 0x03, 0xA5, 0x03, 0x06, 0x00, 0x02, 0x03, 0xA5, 0x03, 0x04,
+-    0x00, 0x02, 0x03, 0xA5, 0x03, 0x00, 0x00, 0x02, 0x03, 0xA5, 0x03, 0x01, 0x00, 0x02, 0x03, 0xA1,
+-    0x03, 0x14, 0x00, 0x02, 0x00, 0xA8, 0x03, 0x00, 0x00, 0x02, 0x00, 0xA8, 0x03, 0x01, 0x00, 0x02,
+-    0x1F, 0x7C, 0x03, 0x45, 0x00, 0x02, 0x03, 0xC9, 0x03, 0x45, 0x00, 0x02, 0x03, 0xCE, 0x03, 0x45,
+-    0x00, 0x02, 0x03, 0xC9, 0x03, 0x42, 0x00, 0x02, 0x1F, 0xF3, 0x03, 0x42, 0x00, 0x02, 0x03, 0x9F,
+-    0x03, 0x00, 0x00, 0x02, 0x03, 0x9F, 0x03, 0x01, 0x00, 0x02, 0x03, 0xA9, 0x03, 0x00, 0x00, 0x02,
+-    0x03, 0xA9, 0x03, 0x01, 0x00, 0x02, 0x03, 0xA9, 0x03, 0x45, 0x00, 0x01, 0x00, 0xF9, 0x03, 0x85,
+-    0x03, 0x86, 0x03, 0x88, 0x03, 0x89, 0x03, 0x8A, 0x03, 0x8C, 0x03, 0x8E, 0x03, 0x8F, 0x03, 0x90,
+-    0x03, 0xAA, 0x03, 0xAB, 0x03, 0xAC, 0x03, 0xAD, 0x03, 0xAE, 0x03, 0xAF, 0x03, 0xB0, 0x03, 0xCA,
+-    0x03, 0xCB, 0x03, 0xCC, 0x03, 0xCD, 0x03, 0xCE, 0x03, 0xD3, 0x03, 0xD4, 0x1F, 0x00, 0x1F, 0x01,
+-    0x1F, 0x02, 0x1F, 0x03, 0x1F, 0x04, 0x1F, 0x05, 0x1F, 0x06, 0x1F, 0x07, 0x1F, 0x08, 0x1F, 0x09,
+-    0x1F, 0x0A, 0x1F, 0x0B, 0x1F, 0x0C, 0x1F, 0x0D, 0x1F, 0x0E, 0x1F, 0x0F, 0x1F, 0x10, 0x1F, 0x11,
+-    0x1F, 0x12, 0x1F, 0x13, 0x1F, 0x14, 0x1F, 0x15, 0x1F, 0x18, 0x1F, 0x19, 0x1F, 0x1A, 0x1F, 0x1B,
+-    0x1F, 0x1C, 0x1F, 0x1D, 0x1F, 0x20, 0x1F, 0x21, 0x1F, 0x22, 0x1F, 0x23, 0x1F, 0x24, 0x1F, 0x25,
+-    0x1F, 0x26, 0x1F, 0x27, 0x1F, 0x28, 0x1F, 0x29, 0x1F, 0x2A, 0x1F, 0x2B, 0x1F, 0x2C, 0x1F, 0x2D,
+-    0x1F, 0x2E, 0x1F, 0x2F, 0x1F, 0x30, 0x1F, 0x31, 0x1F, 0x32, 0x1F, 0x33, 0x1F, 0x34, 0x1F, 0x35,
+-    0x1F, 0x36, 0x1F, 0x37, 0x1F, 0x38, 0x1F, 0x39, 0x1F, 0x3A, 0x1F, 0x3B, 0x1F, 0x3C, 0x1F, 0x3D,
+-    0x1F, 0x3E, 0x1F, 0x3F, 0x1F, 0x40, 0x1F, 0x41, 0x1F, 0x42, 0x1F, 0x43, 0x1F, 0x44, 0x1F, 0x45,
+-    0x1F, 0x48, 0x1F, 0x49, 0x1F, 0x4A, 0x1F, 0x4B, 0x1F, 0x4C, 0x1F, 0x4D, 0x1F, 0x50, 0x1F, 0x51,
+-    0x1F, 0x52, 0x1F, 0x53, 0x1F, 0x54, 0x1F, 0x55, 0x1F, 0x56, 0x1F, 0x57, 0x1F, 0x59, 0x1F, 0x5B,
+-    0x1F, 0x5D, 0x1F, 0x5F, 0x1F, 0x60, 0x1F, 0x61, 0x1F, 0x62, 0x1F, 0x63, 0x1F, 0x64, 0x1F, 0x65,
+-    0x1F, 0x66, 0x1F, 0x67, 0x1F, 0x68, 0x1F, 0x69, 0x1F, 0x6A, 0x1F, 0x6B, 0x1F, 0x6C, 0x1F, 0x6D,
+-    0x1F, 0x6E, 0x1F, 0x6F, 0x1F, 0x70, 0x1F, 0x71, 0x1F, 0x72, 0x1F, 0x73, 0x1F, 0x74, 0x1F, 0x75,
+-    0x1F, 0x76, 0x1F, 0x77, 0x1F, 0x78, 0x1F, 0x79, 0x1F, 0x7A, 0x1F, 0x7B, 0x1F, 0x7C, 0x1F, 0x7D,
+-    0x1F, 0x80, 0x1F, 0x81, 0x1F, 0x82, 0x1F, 0x83, 0x1F, 0x84, 0x1F, 0x85, 0x1F, 0x86, 0x1F, 0x87,
+-    0x1F, 0x88, 0x1F, 0x89, 0x1F, 0x8A, 0x1F, 0x8B, 0x1F, 0x8C, 0x1F, 0x8D, 0x1F, 0x8E, 0x1F, 0x8F,
+-    0x1F, 0x90, 0x1F, 0x91, 0x1F, 0x92, 0x1F, 0x93, 0x1F, 0x94, 0x1F, 0x95, 0x1F, 0x96, 0x1F, 0x97,
+-    0x1F, 0x98, 0x1F, 0x99, 0x1F, 0x9A, 0x1F, 0x9B, 0x1F, 0x9C, 0x1F, 0x9D, 0x1F, 0x9E, 0x1F, 0x9F,
+-    0x1F, 0xA0, 0x1F, 0xA1, 0x1F, 0xA2, 0x1F, 0xA3, 0x1F, 0xA4, 0x1F, 0xA5, 0x1F, 0xA6, 0x1F, 0xA7,
+-    0x1F, 0xA8, 0x1F, 0xA9, 0x1F, 0xAA, 0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD, 0x1F, 0xAE, 0x1F, 0xAF,
+-    0x1F, 0xB0, 0x1F, 0xB1, 0x1F, 0xB2, 0x1F, 0xB3, 0x1F, 0xB4, 0x1F, 0xB6, 0x1F, 0xB7, 0x1F, 0xB8,
+-    0x1F, 0xB9, 0x1F, 0xBA, 0x1F, 0xBB, 0x1F, 0xBC, 0x1F, 0xC1, 0x1F, 0xC2, 0x1F, 0xC3, 0x1F, 0xC4,
+-    0x1F, 0xC6, 0x1F, 0xC7, 0x1F, 0xC8, 0x1F, 0xC9, 0x1F, 0xCA, 0x1F, 0xCB, 0x1F, 0xCC, 0x1F, 0xCD,
+-    0x1F, 0xCE, 0x1F, 0xCF, 0x1F, 0xD0, 0x1F, 0xD1, 0x1F, 0xD2, 0x1F, 0xD3, 0x1F, 0xD6, 0x1F, 0xD7,
+-    0x1F, 0xD8, 0x1F, 0xD9, 0x1F, 0xDA, 0x1F, 0xDB, 0x1F, 0xDD, 0x1F, 0xDE, 0x1F, 0xDF, 0x1F, 0xE0,
+-    0x1F, 0xE1, 0x1F, 0xE2, 0x1F, 0xE3, 0x1F, 0xE4, 0x1F, 0xE5, 0x1F, 0xE6, 0x1F, 0xE7, 0x1F, 0xE8,
+-    0x1F, 0xE9, 0x1F, 0xEA, 0x1F, 0xEB, 0x1F, 0xEC, 0x1F, 0xED, 0x1F, 0xEE, 0x1F, 0xF2, 0x1F, 0xF3,
+-    0x1F, 0xF4, 0x1F, 0xF6, 0x1F, 0xF7, 0x1F, 0xF8, 0x1F, 0xF9, 0x1F, 0xFA, 0x1F, 0xFB, 0x1F, 0xFC,
+-    0x00, 0x01, 0x06, 0xB8, 0x00, 0xD1, 0x01, 0xA8, 0x01, 0xAE, 0x01, 0xB4, 0x01, 0xBA, 0x01, 0xC0,
+-    0x01, 0xC6, 0x01, 0xCC, 0x01, 0xD2, 0x01, 0xD8, 0x01, 0xDE, 0x01, 0xE4, 0x01, 0xEA, 0x01, 0xF0,
+-    0x01, 0xF6, 0x01, 0xFC, 0x02, 0x02, 0x02, 0x08, 0x02, 0x0E, 0x02, 0x14, 0x02, 0x1A, 0x02, 0x20,
+-    0x02, 0x26, 0x02, 0x2C, 0x02, 0x32, 0x02, 0x38, 0x02, 0x40, 0x02, 0x48, 0x02, 0x4E, 0x02, 0x54,
+-    0x02, 0x5A, 0x02, 0x60, 0x02, 0x66, 0x02, 0x6E, 0x02, 0x76, 0x02, 0x7C, 0x02, 0x82, 0x02, 0x88,
+-    0x02, 0x8E, 0x02, 0x94, 0x02, 0x9A, 0x02, 0xA0, 0x02, 0xA6, 0x02, 0xAC, 0x02, 0xB2, 0x02, 0xB8,
+-    0x02, 0xBE, 0x02, 0xC4, 0x02, 0xCA, 0x02, 0xD0, 0x02, 0xD8, 0x02, 0xE0, 0x02, 0xE6, 0x02, 0xEC,
+-    0x02, 0xF2, 0x02, 0xF8, 0x02, 0xFE, 0x03, 0x06, 0x03, 0x0E, 0x03, 0x14, 0x03, 0x1A, 0x03, 0x20,
+-    0x03, 0x26, 0x03, 0x2C, 0x03, 0x32, 0x03, 0x3A, 0x03, 0x42, 0x03, 0x48, 0x03, 0x4E, 0x03, 0x54,
+-    0x03, 0x5A, 0x03, 0x60, 0x03, 0x68, 0x03, 0x70, 0x03, 0x76, 0x03, 0x7C, 0x03, 0x82, 0x03, 0x88,
+-    0x03, 0x8E, 0x03, 0x94, 0x03, 0x9A, 0x03, 0xA0, 0x03, 0xA6, 0x03, 0xAC, 0x03, 0xB2, 0x03, 0xB8,
+-    0x03, 0xBE, 0x03, 0xC4, 0x03, 0xCA, 0x03, 0xD2, 0x03, 0xDA, 0x03, 0xE0, 0x03, 0xE6, 0x03, 0xEE,
+-    0x03, 0xF4, 0x03, 0xFA, 0x04, 0x00, 0x04, 0x06, 0x04, 0x0C, 0x04, 0x14, 0x04, 0x1C, 0x04, 0x22,
+-    0x04, 0x28, 0x04, 0x2E, 0x04, 0x34, 0x04, 0x3A, 0x04, 0x40, 0x04, 0x48, 0x04, 0x50, 0x04, 0x56,
+-    0x04, 0x5C, 0x04, 0x62, 0x04, 0x68, 0x04, 0x6E, 0x04, 0x74, 0x04, 0x7A, 0x04, 0x80, 0x04, 0x86,
+-    0x04, 0x8C, 0x04, 0x92, 0x04, 0x98, 0x04, 0x9E, 0x04, 0xA4, 0x04, 0xAA, 0x04, 0xB0, 0x04, 0xB6,
+-    0x04, 0xBC, 0x04, 0xC2, 0x04, 0xC8, 0x04, 0xCE, 0x04, 0xD4, 0x04, 0xDA, 0x04, 0xE0, 0x04, 0xE6,
+-    0x04, 0xEC, 0x04, 0xF2, 0x04, 0xF8, 0x04, 0xFE, 0x05, 0x04, 0x05, 0x0A, 0x05, 0x10, 0x05, 0x16,
+-    0x05, 0x1C, 0x05, 0x22, 0x05, 0x28, 0x05, 0x2E, 0x05, 0x34, 0x05, 0x3A, 0x05, 0x40, 0x05, 0x46,
+-    0x05, 0x4C, 0x05, 0x52, 0x05, 0x58, 0x05, 0x5E, 0x05, 0x64, 0x05, 0x6A, 0x05, 0x70, 0x05, 0x76,
+-    0x05, 0x7C, 0x05, 0x82, 0x05, 0x88, 0x05, 0x8E, 0x05, 0x94, 0x05, 0x9A, 0x05, 0xA0, 0x05, 0xA6,
+-    0x05, 0xAC, 0x05, 0xB2, 0x05, 0xB8, 0x05, 0xBE, 0x05, 0xC4, 0x05, 0xCA, 0x05, 0xD0, 0x05, 0xD6,
+-    0x05, 0xDC, 0x05, 0xE2, 0x05, 0xE8, 0x05, 0xEE, 0x05, 0xF4, 0x05, 0xFA, 0x06, 0x00, 0x06, 0x06,
+-    0x06, 0x0C, 0x06, 0x12, 0x06, 0x18, 0x06, 0x1E, 0x06, 0x24, 0x06, 0x2A, 0x06, 0x30, 0x06, 0x36,
+-    0x06, 0x3E, 0x06, 0x44, 0x06, 0x4A, 0x06, 0x50, 0x06, 0x56, 0x06, 0x5C, 0x06, 0x62, 0x06, 0x68,
+-    0x06, 0x70, 0x06, 0x76, 0x06, 0x7C, 0x06, 0x82, 0x06, 0x88, 0x06, 0x8E, 0x06, 0x94, 0x06, 0x9A,
+-    0x06, 0xA0, 0x06, 0xA6, 0x06, 0xAC, 0x06, 0xB2, 0x00, 0x02, 0x00, 0xA8, 0x03, 0x41, 0x00, 0x02,
+-    0x03, 0x91, 0x03, 0x41, 0x00, 0x02, 0x03, 0x95, 0x03, 0x41, 0x00, 0x02, 0x03, 0x97, 0x03, 0x41,
+-    0x00, 0x02, 0x03, 0x99, 0x03, 0x41, 0x00, 0x02, 0x03, 0x9F, 0x03, 0x41, 0x00, 0x02, 0x03, 0xA5,
+-    0x03, 0x41, 0x00, 0x02, 0x03, 0xA9, 0x03, 0x41, 0x00, 0x02, 0x03, 0xCA, 0x03, 0x01, 0x00, 0x02,
+-    0x03, 0xB1, 0x03, 0x41, 0x00, 0x02, 0x03, 0xB5, 0x03, 0x41, 0x00, 0x02, 0x03, 0xB7, 0x03, 0x41,
+-    0x00, 0x02, 0x03, 0xB9, 0x03, 0x41, 0x00, 0x02, 0x03, 0xCB, 0x03, 0x01, 0x00, 0x02, 0x1F, 0xBE,
+-    0x03, 0x08, 0x00, 0x02, 0x03, 0xBF, 0x03, 0x41, 0x00, 0x02, 0x03, 0xC5, 0x03, 0x41, 0x00, 0x02,
+-    0x03, 0xC9, 0x03, 0x41, 0x00, 0x02, 0x03, 0xD2, 0x03, 0x41, 0x00, 0x02, 0x03, 0xB1, 0x03, 0x43,
+-    0x00, 0x02, 0x1F, 0x00, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x01, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x00,
+-    0x03, 0x41, 0x00, 0x02, 0x1F, 0x01, 0x03, 0x41, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x13, 0x03, 0x42,
+-    0x00, 0x03, 0x03, 0xB1, 0x03, 0x14, 0x03, 0x42, 0x00, 0x02, 0x03, 0x91, 0x03, 0x43, 0x00, 0x02,
+-    0x1F, 0x08, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x09, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x08, 0x03, 0x41,
+-    0x00, 0x02, 0x1F, 0x09, 0x03, 0x41, 0x00, 0x03, 0x03, 0x91, 0x03, 0x13, 0x03, 0x42, 0x00, 0x03,
+-    0x03, 0x91, 0x03, 0x14, 0x03, 0x42, 0x00, 0x02, 0x03, 0xB5, 0x03, 0x43, 0x00, 0x02, 0x1F, 0x10,
+-    0x03, 0x40, 0x00, 0x02, 0x1F, 0x11, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x10, 0x03, 0x41, 0x00, 0x02,
+-    0x1F, 0x11, 0x03, 0x41, 0x00, 0x02, 0x03, 0x95, 0x03, 0x43, 0x00, 0x02, 0x1F, 0x18, 0x03, 0x40,
+-    0x00, 0x02, 0x1F, 0x19, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x18, 0x03, 0x41, 0x00, 0x02, 0x1F, 0x19,
+-    0x03, 0x41, 0x00, 0x02, 0x03, 0xB7, 0x03, 0x43, 0x00, 0x02, 0x1F, 0x20, 0x03, 0x40, 0x00, 0x02,
+-    0x1F, 0x21, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x20, 0x03, 0x41, 0x00, 0x02, 0x1F, 0x21, 0x03, 0x41,
+-    0x00, 0x03, 0x03, 0xB7, 0x03, 0x13, 0x03, 0x42, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x14, 0x03, 0x42,
+-    0x00, 0x02, 0x03, 0x97, 0x03, 0x43, 0x00, 0x02, 0x1F, 0x28, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x29,
+-    0x03, 0x40, 0x00, 0x02, 0x1F, 0x28, 0x03, 0x41, 0x00, 0x02, 0x1F, 0x29, 0x03, 0x41, 0x00, 0x03,
+-    0x03, 0x97, 0x03, 0x13, 0x03, 0x42, 0x00, 0x03, 0x03, 0x97, 0x03, 0x14, 0x03, 0x42, 0x00, 0x02,
+-    0x03, 0xB9, 0x03, 0x43, 0x00, 0x02, 0x1F, 0xBE, 0x03, 0x14, 0x00, 0x02, 0x1F, 0x30, 0x03, 0x40,
+-    0x00, 0x02, 0x1F, 0x31, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x30, 0x03, 0x41, 0x00, 0x02, 0x1F, 0x31,
+-    0x03, 0x41, 0x00, 0x03, 0x03, 0xB9, 0x03, 0x13, 0x03, 0x42, 0x00, 0x03, 0x03, 0xB9, 0x03, 0x14,
+-    0x03, 0x42, 0x00, 0x02, 0x03, 0x99, 0x03, 0x43, 0x00, 0x02, 0x1F, 0x38, 0x03, 0x40, 0x00, 0x02,
+-    0x1F, 0x39, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x38, 0x03, 0x41, 0x00, 0x02, 0x1F, 0x39, 0x03, 0x41,
+-    0x00, 0x03, 0x03, 0x99, 0x03, 0x13, 0x03, 0x42, 0x00, 0x03, 0x03, 0x99, 0x03, 0x14, 0x03, 0x42,
+-    0x00, 0x02, 0x03, 0xBF, 0x03, 0x43, 0x00, 0x02, 0x1F, 0x40, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x41,
+-    0x03, 0x40, 0x00, 0x02, 0x1F, 0x40, 0x03, 0x41, 0x00, 0x02, 0x1F, 0x41, 0x03, 0x41, 0x00, 0x02,
+-    0x03, 0x9F, 0x03, 0x43, 0x00, 0x02, 0x1F, 0x48, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x49, 0x03, 0x40,
+-    0x00, 0x02, 0x1F, 0x48, 0x03, 0x41, 0x00, 0x02, 0x1F, 0x49, 0x03, 0x41, 0x00, 0x02, 0x03, 0xC5,
+-    0x03, 0x43, 0x00, 0x02, 0x1F, 0x50, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x51, 0x03, 0x40, 0x00, 0x02,
+-    0x1F, 0x50, 0x03, 0x41, 0x00, 0x02, 0x1F, 0x51, 0x03, 0x41, 0x00, 0x03, 0x03, 0xC5, 0x03, 0x13,
+-    0x03, 0x42, 0x00, 0x03, 0x03, 0xC5, 0x03, 0x14, 0x03, 0x42, 0x00, 0x02, 0x1F, 0x59, 0x03, 0x40,
+-    0x00, 0x02, 0x1F, 0x59, 0x03, 0x41, 0x00, 0x03, 0x03, 0xA5, 0x03, 0x14, 0x03, 0x42, 0x00, 0x02,
+-    0x03, 0xC9, 0x03, 0x43, 0x00, 0x02, 0x1F, 0x60, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x61, 0x03, 0x40,
+-    0x00, 0x02, 0x1F, 0x60, 0x03, 0x41, 0x00, 0x02, 0x1F, 0x61, 0x03, 0x41, 0x00, 0x03, 0x03, 0xC9,
+-    0x03, 0x13, 0x03, 0x42, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x14, 0x03, 0x42, 0x00, 0x02, 0x03, 0xA9,
+-    0x03, 0x43, 0x00, 0x02, 0x21, 0x26, 0x03, 0x14, 0x00, 0x02, 0x1F, 0x68, 0x03, 0x40, 0x00, 0x02,
+-    0x1F, 0x69, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x68, 0x03, 0x41, 0x00, 0x02, 0x1F, 0x69, 0x03, 0x41,
+-    0x00, 0x03, 0x03, 0xA9, 0x03, 0x13, 0x03, 0x42, 0x00, 0x03, 0x03, 0xA9, 0x03, 0x14, 0x03, 0x42,
+-    0x00, 0x02, 0x03, 0xB1, 0x03, 0x40, 0x00, 0x02, 0x03, 0xB1, 0x03, 0x41, 0x00, 0x02, 0x03, 0xB5,
+-    0x03, 0x40, 0x00, 0x02, 0x03, 0xB5, 0x03, 0x41, 0x00, 0x02, 0x03, 0xB7, 0x03, 0x40, 0x00, 0x02,
+-    0x03, 0xB7, 0x03, 0x41, 0x00, 0x02, 0x03, 0xB9, 0x03, 0x40, 0x00, 0x02, 0x03, 0xB9, 0x03, 0x41,
+-    0x00, 0x02, 0x03, 0xBF, 0x03, 0x40, 0x00, 0x02, 0x03, 0xBF, 0x03, 0x41, 0x00, 0x02, 0x03, 0xC5,
+-    0x03, 0x40, 0x00, 0x02, 0x03, 0xC5, 0x03, 0x41, 0x00, 0x02, 0x03, 0xC9, 0x03, 0x40, 0x00, 0x02,
+-    0x03, 0xC9, 0x03, 0x41, 0x00, 0x02, 0x1F, 0xB3, 0x03, 0x13, 0x00, 0x02, 0x1F, 0xB3, 0x03, 0x14,
+-    0x00, 0x02, 0x1F, 0x80, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x81, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x80,
+-    0x03, 0x01, 0x00, 0x02, 0x1F, 0x81, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x80, 0x03, 0x42, 0x00, 0x02,
+-    0x1F, 0x81, 0x03, 0x42, 0x00, 0x02, 0x1F, 0xBC, 0x03, 0x13, 0x00, 0x02, 0x1F, 0xBC, 0x03, 0x14,
+-    0x00, 0x02, 0x1F, 0x88, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x89, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x88,
+-    0x03, 0x01, 0x00, 0x02, 0x1F, 0x89, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x88, 0x03, 0x42, 0x00, 0x02,
+-    0x1F, 0x89, 0x03, 0x42, 0x00, 0x02, 0x1F, 0xC3, 0x03, 0x13, 0x00, 0x02, 0x1F, 0xC3, 0x03, 0x14,
+-    0x00, 0x02, 0x1F, 0x90, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x91, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x90,
+-    0x03, 0x01, 0x00, 0x02, 0x1F, 0x91, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x90, 0x03, 0x42, 0x00, 0x02,
+-    0x1F, 0x91, 0x03, 0x42, 0x00, 0x02, 0x1F, 0xCC, 0x03, 0x13, 0x00, 0x02, 0x1F, 0xCC, 0x03, 0x14,
+-    0x00, 0x02, 0x1F, 0x98, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x99, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x98,
+-    0x03, 0x01, 0x00, 0x02, 0x1F, 0x99, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x98, 0x03, 0x42, 0x00, 0x02,
+-    0x1F, 0x99, 0x03, 0x42, 0x00, 0x02, 0x1F, 0xF3, 0x03, 0x13, 0x00, 0x02, 0x1F, 0xF3, 0x03, 0x14,
+-    0x00, 0x02, 0x1F, 0xA0, 0x03, 0x00, 0x00, 0x02, 0x1F, 0xA1, 0x03, 0x00, 0x00, 0x02, 0x1F, 0xA0,
+-    0x03, 0x01, 0x00, 0x02, 0x1F, 0xA1, 0x03, 0x01, 0x00, 0x02, 0x1F, 0xA0, 0x03, 0x42, 0x00, 0x02,
+-    0x1F, 0xA1, 0x03, 0x42, 0x00, 0x02, 0x1F, 0xFC, 0x03, 0x13, 0x00, 0x02, 0x1F, 0xFC, 0x03, 0x14,
+-    0x00, 0x02, 0x1F, 0xA8, 0x03, 0x00, 0x00, 0x02, 0x1F, 0xA9, 0x03, 0x00, 0x00, 0x02, 0x1F, 0xA8,
+-    0x03, 0x01, 0x00, 0x02, 0x1F, 0xA9, 0x03, 0x01, 0x00, 0x02, 0x1F, 0xA8, 0x03, 0x42, 0x00, 0x02,
+-    0x1F, 0xA9, 0x03, 0x42, 0x00, 0x02, 0x1F, 0xB3, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x71, 0x03, 0x45,
+-    0x00, 0x02, 0x1F, 0xB6, 0x03, 0x45, 0x00, 0x02, 0x03, 0x91, 0x03, 0x40, 0x00, 0x02, 0x03, 0x91,
+-    0x03, 0x41, 0x00, 0x02, 0x1F, 0xC3, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x75, 0x03, 0x45, 0x00, 0x02,
+-    0x1F, 0xC6, 0x03, 0x45, 0x00, 0x02, 0x03, 0x95, 0x03, 0x40, 0x00, 0x02, 0x03, 0x95, 0x03, 0x41,
+-    0x00, 0x02, 0x03, 0x97, 0x03, 0x40, 0x00, 0x02, 0x03, 0x97, 0x03, 0x41, 0x00, 0x02, 0x1F, 0xBF,
+-    0x03, 0x40, 0x00, 0x02, 0x1F, 0xBF, 0x03, 0x41, 0x00, 0x02, 0x1F, 0xBE, 0x03, 0x06, 0x00, 0x02,
+-    0x1F, 0xBE, 0x03, 0x04, 0x00, 0x02, 0x03, 0xCA, 0x03, 0x40, 0x00, 0x02, 0x03, 0xCA, 0x03, 0x01,
+-    0x00, 0x02, 0x1F, 0xBE, 0x03, 0x42, 0x00, 0x03, 0x03, 0xB9, 0x03, 0x08, 0x03, 0x42, 0x00, 0x02,
+-    0x03, 0x99, 0x03, 0x40, 0x00, 0x02, 0x03, 0x99, 0x03, 0x41, 0x00, 0x02, 0x1F, 0xFE, 0x03, 0x40,
+-    0x00, 0x02, 0x1F, 0xFE, 0x03, 0x41, 0x00, 0x02, 0x03, 0xCB, 0x03, 0x40, 0x00, 0x02, 0x03, 0xCB,
+-    0x03, 0x01, 0x00, 0x02, 0x03, 0xC1, 0x03, 0x43, 0x00, 0x03, 0x03, 0xC5, 0x03, 0x08, 0x03, 0x42,
+-    0x00, 0x02, 0x03, 0xA5, 0x03, 0x40, 0x00, 0x02, 0x03, 0xA5, 0x03, 0x41, 0x00, 0x02, 0x00, 0xA8,
+-    0x03, 0x40, 0x00, 0x02, 0x00, 0xA8, 0x03, 0x41, 0x00, 0x02, 0x1F, 0xF3, 0x03, 0x00, 0x00, 0x02,
+-    0x1F, 0x7D, 0x03, 0x45, 0x00, 0x02, 0x1F, 0xF6, 0x03, 0x45, 0x00, 0x02, 0x03, 0x9F, 0x03, 0x40,
+-    0x00, 0x02, 0x03, 0x9F, 0x03, 0x41, 0x00, 0x02, 0x03, 0xA9, 0x03, 0x40, 0x00, 0x02, 0x03, 0xA9,
+-    0x03, 0x41, 0x00, 0x02, 0x21, 0x26, 0x03, 0x45, 0x00, 0x01, 0x00, 0xD1, 0x03, 0x85, 0x03, 0x86,
+-    0x03, 0x88, 0x03, 0x89, 0x03, 0x8A, 0x03, 0x8C, 0x03, 0x8E, 0x03, 0x8F, 0x03, 0x90, 0x03, 0xAC,
+-    0x03, 0xAD, 0x03, 0xAE, 0x03, 0xAF, 0x03, 0xB0, 0x03, 0xCA, 0x03, 0xCC, 0x03, 0xCD, 0x03, 0xCE,
+-    0x03, 0xD3, 0x1F, 0x00, 0x1F, 0x02, 0x1F, 0x03, 0x1F, 0x04, 0x1F, 0x05, 0x1F, 0x06, 0x1F, 0x07,
+-    0x1F, 0x08, 0x1F, 0x0A, 0x1F, 0x0B, 0x1F, 0x0C, 0x1F, 0x0D, 0x1F, 0x0E, 0x1F, 0x0F, 0x1F, 0x10,
+-    0x1F, 0x12, 0x1F, 0x13, 0x1F, 0x14, 0x1F, 0x15, 0x1F, 0x18, 0x1F, 0x1A, 0x1F, 0x1B, 0x1F, 0x1C,
+-    0x1F, 0x1D, 0x1F, 0x20, 0x1F, 0x22, 0x1F, 0x23, 0x1F, 0x24, 0x1F, 0x25, 0x1F, 0x26, 0x1F, 0x27,
+-    0x1F, 0x28, 0x1F, 0x2A, 0x1F, 0x2B, 0x1F, 0x2C, 0x1F, 0x2D, 0x1F, 0x2E, 0x1F, 0x2F, 0x1F, 0x30,
+-    0x1F, 0x31, 0x1F, 0x32, 0x1F, 0x33, 0x1F, 0x34, 0x1F, 0x35, 0x1F, 0x36, 0x1F, 0x37, 0x1F, 0x38,
+-    0x1F, 0x3A, 0x1F, 0x3B, 0x1F, 0x3C, 0x1F, 0x3D, 0x1F, 0x3E, 0x1F, 0x3F, 0x1F, 0x40, 0x1F, 0x42,
+-    0x1F, 0x43, 0x1F, 0x44, 0x1F, 0x45, 0x1F, 0x48, 0x1F, 0x4A, 0x1F, 0x4B, 0x1F, 0x4C, 0x1F, 0x4D,
+-    0x1F, 0x50, 0x1F, 0x52, 0x1F, 0x53, 0x1F, 0x54, 0x1F, 0x55, 0x1F, 0x56, 0x1F, 0x57, 0x1F, 0x5B,
+-    0x1F, 0x5D, 0x1F, 0x5F, 0x1F, 0x60, 0x1F, 0x62, 0x1F, 0x63, 0x1F, 0x64, 0x1F, 0x65, 0x1F, 0x66,
+-    0x1F, 0x67, 0x1F, 0x68, 0x1F, 0x69, 0x1F, 0x6A, 0x1F, 0x6B, 0x1F, 0x6C, 0x1F, 0x6D, 0x1F, 0x6E,
+-    0x1F, 0x6F, 0x1F, 0x70, 0x1F, 0x71, 0x1F, 0x72, 0x1F, 0x73, 0x1F, 0x74, 0x1F, 0x75, 0x1F, 0x76,
+-    0x1F, 0x77, 0x1F, 0x78, 0x1F, 0x79, 0x1F, 0x7A, 0x1F, 0x7B, 0x1F, 0x7C, 0x1F, 0x7D, 0x1F, 0x80,
++    0x00, 0x02, 0x03, 0xA5, 0x03, 0x00, 0x00, 0x02, 0x03, 0xA1, 0x03, 0x14, 0x00, 0x02, 0x00, 0xA8,
++    0x03, 0x00, 0x00, 0x02, 0x1F, 0x7C, 0x03, 0x45, 0x00, 0x02, 0x03, 0xC9, 0x03, 0x45, 0x00, 0x02,
++    0x03, 0xCE, 0x03, 0x45, 0x00, 0x02, 0x03, 0xC9, 0x03, 0x42, 0x00, 0x02, 0x1F, 0xF3, 0x03, 0x42,
++    0x00, 0x02, 0x03, 0x9F, 0x03, 0x00, 0x00, 0x02, 0x03, 0xA9, 0x03, 0x00, 0x00, 0x02, 0x03, 0xA9,
++    0x03, 0x45, 0x00, 0x01, 0x00, 0xE8, 0x03, 0x85, 0x03, 0x86, 0x03, 0x88, 0x03, 0x89, 0x03, 0x8A,
++    0x03, 0x8C, 0x03, 0x8E, 0x03, 0x8F, 0x03, 0x90, 0x03, 0xAA, 0x03, 0xAB, 0x03, 0xAC, 0x03, 0xAD,
++    0x03, 0xAE, 0x03, 0xAF, 0x03, 0xB0, 0x03, 0xCA, 0x03, 0xCB, 0x03, 0xCC, 0x03, 0xCD, 0x03, 0xCE,
++    0x03, 0xD3, 0x03, 0xD4, 0x1F, 0x00, 0x1F, 0x01, 0x1F, 0x02, 0x1F, 0x03, 0x1F, 0x04, 0x1F, 0x05,
++    0x1F, 0x06, 0x1F, 0x07, 0x1F, 0x08, 0x1F, 0x09, 0x1F, 0x0A, 0x1F, 0x0B, 0x1F, 0x0C, 0x1F, 0x0D,
++    0x1F, 0x0E, 0x1F, 0x0F, 0x1F, 0x10, 0x1F, 0x11, 0x1F, 0x12, 0x1F, 0x13, 0x1F, 0x14, 0x1F, 0x15,
++    0x1F, 0x18, 0x1F, 0x19, 0x1F, 0x1A, 0x1F, 0x1B, 0x1F, 0x1C, 0x1F, 0x1D, 0x1F, 0x20, 0x1F, 0x21,
++    0x1F, 0x22, 0x1F, 0x23, 0x1F, 0x24, 0x1F, 0x25, 0x1F, 0x26, 0x1F, 0x27, 0x1F, 0x28, 0x1F, 0x29,
++    0x1F, 0x2A, 0x1F, 0x2B, 0x1F, 0x2C, 0x1F, 0x2D, 0x1F, 0x2E, 0x1F, 0x2F, 0x1F, 0x30, 0x1F, 0x31,
++    0x1F, 0x32, 0x1F, 0x33, 0x1F, 0x34, 0x1F, 0x35, 0x1F, 0x36, 0x1F, 0x37, 0x1F, 0x38, 0x1F, 0x39,
++    0x1F, 0x3A, 0x1F, 0x3B, 0x1F, 0x3C, 0x1F, 0x3D, 0x1F, 0x3E, 0x1F, 0x3F, 0x1F, 0x40, 0x1F, 0x41,
++    0x1F, 0x42, 0x1F, 0x43, 0x1F, 0x44, 0x1F, 0x45, 0x1F, 0x48, 0x1F, 0x49, 0x1F, 0x4A, 0x1F, 0x4B,
++    0x1F, 0x4C, 0x1F, 0x4D, 0x1F, 0x50, 0x1F, 0x51, 0x1F, 0x52, 0x1F, 0x53, 0x1F, 0x54, 0x1F, 0x55,
++    0x1F, 0x56, 0x1F, 0x57, 0x1F, 0x59, 0x1F, 0x5B, 0x1F, 0x5D, 0x1F, 0x5F, 0x1F, 0x60, 0x1F, 0x61,
++    0x1F, 0x62, 0x1F, 0x63, 0x1F, 0x64, 0x1F, 0x65, 0x1F, 0x66, 0x1F, 0x67, 0x1F, 0x68, 0x1F, 0x69,
++    0x1F, 0x6A, 0x1F, 0x6B, 0x1F, 0x6C, 0x1F, 0x6D, 0x1F, 0x6E, 0x1F, 0x6F, 0x1F, 0x70, 0x1F, 0x72,
++    0x1F, 0x74, 0x1F, 0x76, 0x1F, 0x78, 0x1F, 0x7A, 0x1F, 0x7C, 0x1F, 0x80, 0x1F, 0x81, 0x1F, 0x82,
++    0x1F, 0x83, 0x1F, 0x84, 0x1F, 0x85, 0x1F, 0x86, 0x1F, 0x87, 0x1F, 0x88, 0x1F, 0x89, 0x1F, 0x8A,
++    0x1F, 0x8B, 0x1F, 0x8C, 0x1F, 0x8D, 0x1F, 0x8E, 0x1F, 0x8F, 0x1F, 0x90, 0x1F, 0x91, 0x1F, 0x92,
++    0x1F, 0x93, 0x1F, 0x94, 0x1F, 0x95, 0x1F, 0x96, 0x1F, 0x97, 0x1F, 0x98, 0x1F, 0x99, 0x1F, 0x9A,
++    0x1F, 0x9B, 0x1F, 0x9C, 0x1F, 0x9D, 0x1F, 0x9E, 0x1F, 0x9F, 0x1F, 0xA0, 0x1F, 0xA1, 0x1F, 0xA2,
++    0x1F, 0xA3, 0x1F, 0xA4, 0x1F, 0xA5, 0x1F, 0xA6, 0x1F, 0xA7, 0x1F, 0xA8, 0x1F, 0xA9, 0x1F, 0xAA,
++    0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD, 0x1F, 0xAE, 0x1F, 0xAF, 0x1F, 0xB0, 0x1F, 0xB1, 0x1F, 0xB2,
++    0x1F, 0xB3, 0x1F, 0xB4, 0x1F, 0xB6, 0x1F, 0xB7, 0x1F, 0xB8, 0x1F, 0xB9, 0x1F, 0xBA, 0x1F, 0xBC,
++    0x1F, 0xC1, 0x1F, 0xC2, 0x1F, 0xC3, 0x1F, 0xC4, 0x1F, 0xC6, 0x1F, 0xC7, 0x1F, 0xC8, 0x1F, 0xCA,
++    0x1F, 0xCC, 0x1F, 0xCD, 0x1F, 0xCE, 0x1F, 0xCF, 0x1F, 0xD0, 0x1F, 0xD1, 0x1F, 0xD2, 0x1F, 0xD6,
++    0x1F, 0xD7, 0x1F, 0xD8, 0x1F, 0xD9, 0x1F, 0xDA, 0x1F, 0xDD, 0x1F, 0xDE, 0x1F, 0xDF, 0x1F, 0xE0,
++    0x1F, 0xE1, 0x1F, 0xE2, 0x1F, 0xE4, 0x1F, 0xE5, 0x1F, 0xE6, 0x1F, 0xE7, 0x1F, 0xE8, 0x1F, 0xE9,
++    0x1F, 0xEA, 0x1F, 0xEC, 0x1F, 0xED, 0x1F, 0xF2, 0x1F, 0xF3, 0x1F, 0xF4, 0x1F, 0xF6, 0x1F, 0xF7,
++    0x1F, 0xF8, 0x1F, 0xFA, 0x1F, 0xFC, 0x00, 0x01, 0x06, 0x30, 0x00, 0xC0, 0x01, 0x86, 0x01, 0x8C,
++    0x01, 0x92, 0x01, 0x98, 0x01, 0x9E, 0x01, 0xA4, 0x01, 0xAA, 0x01, 0xB0, 0x01, 0xB6, 0x01, 0xBC,
++    0x01, 0xC2, 0x01, 0xC8, 0x01, 0xCE, 0x01, 0xD4, 0x01, 0xDA, 0x01, 0xE0, 0x01, 0xE6, 0x01, 0xEC,
++    0x01, 0xF2, 0x01, 0xF8, 0x01, 0xFE, 0x02, 0x04, 0x02, 0x0A, 0x02, 0x10, 0x02, 0x16, 0x02, 0x1E,
++    0x02, 0x26, 0x02, 0x2C, 0x02, 0x32, 0x02, 0x38, 0x02, 0x3E, 0x02, 0x44, 0x02, 0x4C, 0x02, 0x54,
++    0x02, 0x5A, 0x02, 0x60, 0x02, 0x66, 0x02, 0x6C, 0x02, 0x72, 0x02, 0x78, 0x02, 0x7E, 0x02, 0x84,
++    0x02, 0x8A, 0x02, 0x90, 0x02, 0x96, 0x02, 0x9C, 0x02, 0xA2, 0x02, 0xA8, 0x02, 0xAE, 0x02, 0xB6,
++    0x02, 0xBE, 0x02, 0xC4, 0x02, 0xCA, 0x02, 0xD0, 0x02, 0xD6, 0x02, 0xDC, 0x02, 0xE4, 0x02, 0xEC,
++    0x02, 0xF2, 0x02, 0xF8, 0x02, 0xFE, 0x03, 0x04, 0x03, 0x0A, 0x03, 0x10, 0x03, 0x18, 0x03, 0x20,
++    0x03, 0x26, 0x03, 0x2C, 0x03, 0x32, 0x03, 0x38, 0x03, 0x3E, 0x03, 0x46, 0x03, 0x4E, 0x03, 0x54,
++    0x03, 0x5A, 0x03, 0x60, 0x03, 0x66, 0x03, 0x6C, 0x03, 0x72, 0x03, 0x78, 0x03, 0x7E, 0x03, 0x84,
++    0x03, 0x8A, 0x03, 0x90, 0x03, 0x96, 0x03, 0x9C, 0x03, 0xA2, 0x03, 0xA8, 0x03, 0xB0, 0x03, 0xB8,
++    0x03, 0xBE, 0x03, 0xC4, 0x03, 0xCC, 0x03, 0xD2, 0x03, 0xD8, 0x03, 0xDE, 0x03, 0xE4, 0x03, 0xEA,
++    0x03, 0xF2, 0x03, 0xFA, 0x04, 0x00, 0x04, 0x06, 0x04, 0x0C, 0x04, 0x12, 0x04, 0x18, 0x04, 0x1E,
++    0x04, 0x26, 0x04, 0x2E, 0x04, 0x34, 0x04, 0x3A, 0x04, 0x40, 0x04, 0x46, 0x04, 0x4C, 0x04, 0x52,
++    0x04, 0x58, 0x04, 0x5E, 0x04, 0x64, 0x04, 0x6A, 0x04, 0x70, 0x04, 0x76, 0x04, 0x7C, 0x04, 0x82,
++    0x04, 0x88, 0x04, 0x8E, 0x04, 0x94, 0x04, 0x9A, 0x04, 0xA0, 0x04, 0xA6, 0x04, 0xAC, 0x04, 0xB2,
++    0x04, 0xB8, 0x04, 0xBE, 0x04, 0xC4, 0x04, 0xCA, 0x04, 0xD0, 0x04, 0xD6, 0x04, 0xDC, 0x04, 0xE2,
++    0x04, 0xE8, 0x04, 0xEE, 0x04, 0xF4, 0x04, 0xFA, 0x05, 0x00, 0x05, 0x06, 0x05, 0x0C, 0x05, 0x12,
++    0x05, 0x18, 0x05, 0x1E, 0x05, 0x24, 0x05, 0x2A, 0x05, 0x30, 0x05, 0x36, 0x05, 0x3C, 0x05, 0x42,
++    0x05, 0x48, 0x05, 0x4E, 0x05, 0x54, 0x05, 0x5A, 0x05, 0x60, 0x05, 0x66, 0x05, 0x6C, 0x05, 0x72,
++    0x05, 0x78, 0x05, 0x7E, 0x05, 0x84, 0x05, 0x8A, 0x05, 0x90, 0x05, 0x96, 0x05, 0x9C, 0x05, 0xA2,
++    0x05, 0xA8, 0x05, 0xAE, 0x05, 0xB4, 0x05, 0xBA, 0x05, 0xC0, 0x05, 0xC6, 0x05, 0xCC, 0x05, 0xD2,
++    0x05, 0xDA, 0x05, 0xE0, 0x05, 0xE6, 0x05, 0xEC, 0x05, 0xF2, 0x05, 0xF8, 0x06, 0x00, 0x06, 0x06,
++    0x06, 0x0C, 0x06, 0x12, 0x06, 0x18, 0x06, 0x1E, 0x06, 0x24, 0x06, 0x2A, 0x00, 0x02, 0x00, 0xA8,
++    0x03, 0x41, 0x00, 0x02, 0x03, 0x91, 0x03, 0x41, 0x00, 0x02, 0x03, 0x95, 0x03, 0x41, 0x00, 0x02,
++    0x03, 0x97, 0x03, 0x41, 0x00, 0x02, 0x03, 0x99, 0x03, 0x41, 0x00, 0x02, 0x03, 0x9F, 0x03, 0x41,
++    0x00, 0x02, 0x03, 0xA5, 0x03, 0x41, 0x00, 0x02, 0x03, 0xA9, 0x03, 0x41, 0x00, 0x02, 0x03, 0xCA,
++    0x03, 0x01, 0x00, 0x02, 0x03, 0xB1, 0x03, 0x41, 0x00, 0x02, 0x03, 0xB5, 0x03, 0x41, 0x00, 0x02,
++    0x03, 0xB7, 0x03, 0x41, 0x00, 0x02, 0x03, 0xB9, 0x03, 0x41, 0x00, 0x02, 0x03, 0xCB, 0x03, 0x01,
++    0x00, 0x02, 0x1F, 0xBE, 0x03, 0x08, 0x00, 0x02, 0x03, 0xBF, 0x03, 0x41, 0x00, 0x02, 0x03, 0xC5,
++    0x03, 0x41, 0x00, 0x02, 0x03, 0xC9, 0x03, 0x41, 0x00, 0x02, 0x03, 0xD2, 0x03, 0x41, 0x00, 0x02,
++    0x03, 0xB1, 0x03, 0x43, 0x00, 0x02, 0x1F, 0x00, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x01, 0x03, 0x40,
++    0x00, 0x02, 0x1F, 0x00, 0x03, 0x41, 0x00, 0x02, 0x1F, 0x01, 0x03, 0x41, 0x00, 0x03, 0x03, 0xB1,
++    0x03, 0x13, 0x03, 0x42, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x14, 0x03, 0x42, 0x00, 0x02, 0x03, 0x91,
++    0x03, 0x43, 0x00, 0x02, 0x1F, 0x08, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x09, 0x03, 0x40, 0x00, 0x02,
++    0x1F, 0x08, 0x03, 0x41, 0x00, 0x02, 0x1F, 0x09, 0x03, 0x41, 0x00, 0x03, 0x03, 0x91, 0x03, 0x13,
++    0x03, 0x42, 0x00, 0x03, 0x03, 0x91, 0x03, 0x14, 0x03, 0x42, 0x00, 0x02, 0x03, 0xB5, 0x03, 0x43,
++    0x00, 0x02, 0x1F, 0x10, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x11, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x10,
++    0x03, 0x41, 0x00, 0x02, 0x1F, 0x11, 0x03, 0x41, 0x00, 0x02, 0x03, 0x95, 0x03, 0x43, 0x00, 0x02,
++    0x1F, 0x18, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x19, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x18, 0x03, 0x41,
++    0x00, 0x02, 0x1F, 0x19, 0x03, 0x41, 0x00, 0x02, 0x03, 0xB7, 0x03, 0x43, 0x00, 0x02, 0x1F, 0x20,
++    0x03, 0x40, 0x00, 0x02, 0x1F, 0x21, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x20, 0x03, 0x41, 0x00, 0x02,
++    0x1F, 0x21, 0x03, 0x41, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x13, 0x03, 0x42, 0x00, 0x03, 0x03, 0xB7,
++    0x03, 0x14, 0x03, 0x42, 0x00, 0x02, 0x03, 0x97, 0x03, 0x43, 0x00, 0x02, 0x1F, 0x28, 0x03, 0x40,
++    0x00, 0x02, 0x1F, 0x29, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x28, 0x03, 0x41, 0x00, 0x02, 0x1F, 0x29,
++    0x03, 0x41, 0x00, 0x03, 0x03, 0x97, 0x03, 0x13, 0x03, 0x42, 0x00, 0x03, 0x03, 0x97, 0x03, 0x14,
++    0x03, 0x42, 0x00, 0x02, 0x03, 0xB9, 0x03, 0x43, 0x00, 0x02, 0x1F, 0xBE, 0x03, 0x14, 0x00, 0x02,
++    0x1F, 0x30, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x31, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x30, 0x03, 0x41,
++    0x00, 0x02, 0x1F, 0x31, 0x03, 0x41, 0x00, 0x03, 0x03, 0xB9, 0x03, 0x13, 0x03, 0x42, 0x00, 0x03,
++    0x03, 0xB9, 0x03, 0x14, 0x03, 0x42, 0x00, 0x02, 0x03, 0x99, 0x03, 0x43, 0x00, 0x02, 0x1F, 0x38,
++    0x03, 0x40, 0x00, 0x02, 0x1F, 0x39, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x38, 0x03, 0x41, 0x00, 0x02,
++    0x1F, 0x39, 0x03, 0x41, 0x00, 0x03, 0x03, 0x99, 0x03, 0x13, 0x03, 0x42, 0x00, 0x03, 0x03, 0x99,
++    0x03, 0x14, 0x03, 0x42, 0x00, 0x02, 0x03, 0xBF, 0x03, 0x43, 0x00, 0x02, 0x1F, 0x40, 0x03, 0x40,
++    0x00, 0x02, 0x1F, 0x41, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x40, 0x03, 0x41, 0x00, 0x02, 0x1F, 0x41,
++    0x03, 0x41, 0x00, 0x02, 0x03, 0x9F, 0x03, 0x43, 0x00, 0x02, 0x1F, 0x48, 0x03, 0x40, 0x00, 0x02,
++    0x1F, 0x49, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x48, 0x03, 0x41, 0x00, 0x02, 0x1F, 0x49, 0x03, 0x41,
++    0x00, 0x02, 0x03, 0xC5, 0x03, 0x43, 0x00, 0x02, 0x1F, 0x50, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x51,
++    0x03, 0x40, 0x00, 0x02, 0x1F, 0x50, 0x03, 0x41, 0x00, 0x02, 0x1F, 0x51, 0x03, 0x41, 0x00, 0x03,
++    0x03, 0xC5, 0x03, 0x13, 0x03, 0x42, 0x00, 0x03, 0x03, 0xC5, 0x03, 0x14, 0x03, 0x42, 0x00, 0x02,
++    0x1F, 0x59, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x59, 0x03, 0x41, 0x00, 0x03, 0x03, 0xA5, 0x03, 0x14,
++    0x03, 0x42, 0x00, 0x02, 0x03, 0xC9, 0x03, 0x43, 0x00, 0x02, 0x1F, 0x60, 0x03, 0x40, 0x00, 0x02,
++    0x1F, 0x61, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x60, 0x03, 0x41, 0x00, 0x02, 0x1F, 0x61, 0x03, 0x41,
++    0x00, 0x03, 0x03, 0xC9, 0x03, 0x13, 0x03, 0x42, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x14, 0x03, 0x42,
++    0x00, 0x02, 0x03, 0xA9, 0x03, 0x43, 0x00, 0x02, 0x21, 0x26, 0x03, 0x14, 0x00, 0x02, 0x1F, 0x68,
++    0x03, 0x40, 0x00, 0x02, 0x1F, 0x69, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x68, 0x03, 0x41, 0x00, 0x02,
++    0x1F, 0x69, 0x03, 0x41, 0x00, 0x03, 0x03, 0xA9, 0x03, 0x13, 0x03, 0x42, 0x00, 0x03, 0x03, 0xA9,
++    0x03, 0x14, 0x03, 0x42, 0x00, 0x02, 0x03, 0xB1, 0x03, 0x40, 0x00, 0x02, 0x03, 0xB5, 0x03, 0x40,
++    0x00, 0x02, 0x03, 0xB7, 0x03, 0x40, 0x00, 0x02, 0x03, 0xB9, 0x03, 0x40, 0x00, 0x02, 0x03, 0xBF,
++    0x03, 0x40, 0x00, 0x02, 0x03, 0xC5, 0x03, 0x40, 0x00, 0x02, 0x03, 0xC9, 0x03, 0x40, 0x00, 0x02,
++    0x1F, 0xB3, 0x03, 0x13, 0x00, 0x02, 0x1F, 0xB3, 0x03, 0x14, 0x00, 0x02, 0x1F, 0x80, 0x03, 0x00,
++    0x00, 0x02, 0x1F, 0x81, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x80, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x81,
++    0x03, 0x01, 0x00, 0x02, 0x1F, 0x80, 0x03, 0x42, 0x00, 0x02, 0x1F, 0x81, 0x03, 0x42, 0x00, 0x02,
++    0x1F, 0xBC, 0x03, 0x13, 0x00, 0x02, 0x1F, 0xBC, 0x03, 0x14, 0x00, 0x02, 0x1F, 0x88, 0x03, 0x00,
++    0x00, 0x02, 0x1F, 0x89, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x88, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x89,
++    0x03, 0x01, 0x00, 0x02, 0x1F, 0x88, 0x03, 0x42, 0x00, 0x02, 0x1F, 0x89, 0x03, 0x42, 0x00, 0x02,
++    0x1F, 0xC3, 0x03, 0x13, 0x00, 0x02, 0x1F, 0xC3, 0x03, 0x14, 0x00, 0x02, 0x1F, 0x90, 0x03, 0x00,
++    0x00, 0x02, 0x1F, 0x91, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x90, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x91,
++    0x03, 0x01, 0x00, 0x02, 0x1F, 0x90, 0x03, 0x42, 0x00, 0x02, 0x1F, 0x91, 0x03, 0x42, 0x00, 0x02,
++    0x1F, 0xCC, 0x03, 0x13, 0x00, 0x02, 0x1F, 0xCC, 0x03, 0x14, 0x00, 0x02, 0x1F, 0x98, 0x03, 0x00,
++    0x00, 0x02, 0x1F, 0x99, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x98, 0x03, 0x01, 0x00, 0x02, 0x1F, 0x99,
++    0x03, 0x01, 0x00, 0x02, 0x1F, 0x98, 0x03, 0x42, 0x00, 0x02, 0x1F, 0x99, 0x03, 0x42, 0x00, 0x02,
++    0x1F, 0xF3, 0x03, 0x13, 0x00, 0x02, 0x1F, 0xF3, 0x03, 0x14, 0x00, 0x02, 0x1F, 0xA0, 0x03, 0x00,
++    0x00, 0x02, 0x1F, 0xA1, 0x03, 0x00, 0x00, 0x02, 0x1F, 0xA0, 0x03, 0x01, 0x00, 0x02, 0x1F, 0xA1,
++    0x03, 0x01, 0x00, 0x02, 0x1F, 0xA0, 0x03, 0x42, 0x00, 0x02, 0x1F, 0xA1, 0x03, 0x42, 0x00, 0x02,
++    0x1F, 0xFC, 0x03, 0x13, 0x00, 0x02, 0x1F, 0xFC, 0x03, 0x14, 0x00, 0x02, 0x1F, 0xA8, 0x03, 0x00,
++    0x00, 0x02, 0x1F, 0xA9, 0x03, 0x00, 0x00, 0x02, 0x1F, 0xA8, 0x03, 0x01, 0x00, 0x02, 0x1F, 0xA9,
++    0x03, 0x01, 0x00, 0x02, 0x1F, 0xA8, 0x03, 0x42, 0x00, 0x02, 0x1F, 0xA9, 0x03, 0x42, 0x00, 0x02,
++    0x1F, 0xB3, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x71, 0x03, 0x45, 0x00, 0x02, 0x1F, 0xB6, 0x03, 0x45,
++    0x00, 0x02, 0x03, 0x91, 0x03, 0x40, 0x00, 0x02, 0x1F, 0xC3, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x75,
++    0x03, 0x45, 0x00, 0x02, 0x1F, 0xC6, 0x03, 0x45, 0x00, 0x02, 0x03, 0x95, 0x03, 0x40, 0x00, 0x02,
++    0x03, 0x97, 0x03, 0x40, 0x00, 0x02, 0x1F, 0xBF, 0x03, 0x40, 0x00, 0x02, 0x1F, 0xBF, 0x03, 0x41,
++    0x00, 0x02, 0x1F, 0xBE, 0x03, 0x06, 0x00, 0x02, 0x1F, 0xBE, 0x03, 0x04, 0x00, 0x02, 0x03, 0xCA,
++    0x03, 0x40, 0x00, 0x02, 0x1F, 0xBE, 0x03, 0x42, 0x00, 0x03, 0x03, 0xB9, 0x03, 0x08, 0x03, 0x42,
++    0x00, 0x02, 0x03, 0x99, 0x03, 0x40, 0x00, 0x02, 0x1F, 0xFE, 0x03, 0x40, 0x00, 0x02, 0x1F, 0xFE,
++    0x03, 0x41, 0x00, 0x02, 0x03, 0xCB, 0x03, 0x40, 0x00, 0x02, 0x03, 0xC1, 0x03, 0x43, 0x00, 0x03,
++    0x03, 0xC5, 0x03, 0x08, 0x03, 0x42, 0x00, 0x02, 0x03, 0xA5, 0x03, 0x40, 0x00, 0x02, 0x00, 0xA8,
++    0x03, 0x40, 0x00, 0x02, 0x1F, 0xF3, 0x03, 0x00, 0x00, 0x02, 0x1F, 0x7D, 0x03, 0x45, 0x00, 0x02,
++    0x1F, 0xF6, 0x03, 0x45, 0x00, 0x02, 0x03, 0x9F, 0x03, 0x40, 0x00, 0x02, 0x03, 0xA9, 0x03, 0x40,
++    0x00, 0x02, 0x21, 0x26, 0x03, 0x45, 0x00, 0x01, 0x00, 0xC0, 0x03, 0x85, 0x03, 0x86, 0x03, 0x88,
++    0x03, 0x89, 0x03, 0x8A, 0x03, 0x8C, 0x03, 0x8E, 0x03, 0x8F, 0x03, 0x90, 0x03, 0xAC, 0x03, 0xAD,
++    0x03, 0xAE, 0x03, 0xAF, 0x03, 0xB0, 0x03, 0xCA, 0x03, 0xCC, 0x03, 0xCD, 0x03, 0xCE, 0x03, 0xD3,
++    0x1F, 0x00, 0x1F, 0x02, 0x1F, 0x03, 0x1F, 0x04, 0x1F, 0x05, 0x1F, 0x06, 0x1F, 0x07, 0x1F, 0x08,
++    0x1F, 0x0A, 0x1F, 0x0B, 0x1F, 0x0C, 0x1F, 0x0D, 0x1F, 0x0E, 0x1F, 0x0F, 0x1F, 0x10, 0x1F, 0x12,
++    0x1F, 0x13, 0x1F, 0x14, 0x1F, 0x15, 0x1F, 0x18, 0x1F, 0x1A, 0x1F, 0x1B, 0x1F, 0x1C, 0x1F, 0x1D,
++    0x1F, 0x20, 0x1F, 0x22, 0x1F, 0x23, 0x1F, 0x24, 0x1F, 0x25, 0x1F, 0x26, 0x1F, 0x27, 0x1F, 0x28,
++    0x1F, 0x2A, 0x1F, 0x2B, 0x1F, 0x2C, 0x1F, 0x2D, 0x1F, 0x2E, 0x1F, 0x2F, 0x1F, 0x30, 0x1F, 0x31,
++    0x1F, 0x32, 0x1F, 0x33, 0x1F, 0x34, 0x1F, 0x35, 0x1F, 0x36, 0x1F, 0x37, 0x1F, 0x38, 0x1F, 0x3A,
++    0x1F, 0x3B, 0x1F, 0x3C, 0x1F, 0x3D, 0x1F, 0x3E, 0x1F, 0x3F, 0x1F, 0x40, 0x1F, 0x42, 0x1F, 0x43,
++    0x1F, 0x44, 0x1F, 0x45, 0x1F, 0x48, 0x1F, 0x4A, 0x1F, 0x4B, 0x1F, 0x4C, 0x1F, 0x4D, 0x1F, 0x50,
++    0x1F, 0x52, 0x1F, 0x53, 0x1F, 0x54, 0x1F, 0x55, 0x1F, 0x56, 0x1F, 0x57, 0x1F, 0x5B, 0x1F, 0x5D,
++    0x1F, 0x5F, 0x1F, 0x60, 0x1F, 0x62, 0x1F, 0x63, 0x1F, 0x64, 0x1F, 0x65, 0x1F, 0x66, 0x1F, 0x67,
++    0x1F, 0x68, 0x1F, 0x69, 0x1F, 0x6A, 0x1F, 0x6B, 0x1F, 0x6C, 0x1F, 0x6D, 0x1F, 0x6E, 0x1F, 0x6F,
++    0x1F, 0x70, 0x1F, 0x72, 0x1F, 0x74, 0x1F, 0x76, 0x1F, 0x78, 0x1F, 0x7A, 0x1F, 0x7C, 0x1F, 0x80,
+     0x1F, 0x81, 0x1F, 0x82, 0x1F, 0x83, 0x1F, 0x84, 0x1F, 0x85, 0x1F, 0x86, 0x1F, 0x87, 0x1F, 0x88,
+     0x1F, 0x89, 0x1F, 0x8A, 0x1F, 0x8B, 0x1F, 0x8C, 0x1F, 0x8D, 0x1F, 0x8E, 0x1F, 0x8F, 0x1F, 0x90,
+     0x1F, 0x91, 0x1F, 0x92, 0x1F, 0x93, 0x1F, 0x94, 0x1F, 0x95, 0x1F, 0x96, 0x1F, 0x97, 0x1F, 0x98,
+     0x1F, 0x99, 0x1F, 0x9A, 0x1F, 0x9B, 0x1F, 0x9C, 0x1F, 0x9D, 0x1F, 0x9E, 0x1F, 0x9F, 0x1F, 0xA0,
+     0x1F, 0xA1, 0x1F, 0xA2, 0x1F, 0xA3, 0x1F, 0xA4, 0x1F, 0xA5, 0x1F, 0xA6, 0x1F, 0xA7, 0x1F, 0xA8,
+     0x1F, 0xA9, 0x1F, 0xAA, 0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD, 0x1F, 0xAE, 0x1F, 0xAF, 0x1F, 0xB2,
+-    0x1F, 0xB4, 0x1F, 0xB7, 0x1F, 0xBA, 0x1F, 0xBB, 0x1F, 0xC2, 0x1F, 0xC4, 0x1F, 0xC7, 0x1F, 0xC8,
+-    0x1F, 0xC9, 0x1F, 0xCA, 0x1F, 0xCB, 0x1F, 0xCD, 0x1F, 0xCE, 0x1F, 0xD0, 0x1F, 0xD1, 0x1F, 0xD2,
+-    0x1F, 0xD3, 0x1F, 0xD6, 0x1F, 0xD7, 0x1F, 0xDA, 0x1F, 0xDB, 0x1F, 0xDD, 0x1F, 0xDE, 0x1F, 0xE2,
+-    0x1F, 0xE3, 0x1F, 0xE4, 0x1F, 0xE7, 0x1F, 0xEA, 0x1F, 0xEB, 0x1F, 0xED, 0x1F, 0xEE, 0x1F, 0xF2,
+-    0x1F, 0xF4, 0x1F, 0xF7, 0x1F, 0xF8, 0x1F, 0xF9, 0x1F, 0xFA, 0x1F, 0xFB, 0x1F, 0xFC, 0x00, 0x01,
+-    0x05, 0x00, 0x00, 0x89, 0x01, 0x18, 0x01, 0x1E, 0x01, 0x24, 0x01, 0x2A, 0x01, 0x30, 0x01, 0x38,
+-    0x01, 0x40, 0x01, 0x48, 0x01, 0x50, 0x01, 0x58, 0x01, 0x60, 0x01, 0x68, 0x01, 0x70, 0x01, 0x78,
+-    0x01, 0x80, 0x01, 0x88, 0x01, 0x90, 0x01, 0x98, 0x01, 0xA0, 0x01, 0xA8, 0x01, 0xB0, 0x01, 0xB8,
+-    0x01, 0xC0, 0x01, 0xC8, 0x01, 0xD0, 0x01, 0xD8, 0x01, 0xE0, 0x01, 0xE8, 0x01, 0xF0, 0x01, 0xF8,
+-    0x02, 0x00, 0x02, 0x08, 0x02, 0x10, 0x02, 0x16, 0x02, 0x1E, 0x02, 0x26, 0x02, 0x2E, 0x02, 0x36,
+-    0x02, 0x3E, 0x02, 0x46, 0x02, 0x4E, 0x02, 0x56, 0x02, 0x5E, 0x02, 0x66, 0x02, 0x6E, 0x02, 0x76,
+-    0x02, 0x7E, 0x02, 0x86, 0x02, 0x8E, 0x02, 0x96, 0x02, 0x9E, 0x02, 0xA6, 0x02, 0xAE, 0x02, 0xB6,
+-    0x02, 0xBE, 0x02, 0xC6, 0x02, 0xCE, 0x02, 0xD6, 0x02, 0xDE, 0x02, 0xE6, 0x02, 0xEE, 0x02, 0xF6,
+-    0x02, 0xFE, 0x03, 0x06, 0x03, 0x0E, 0x03, 0x14, 0x03, 0x1C, 0x03, 0x24, 0x03, 0x2C, 0x03, 0x34,
+-    0x03, 0x3C, 0x03, 0x44, 0x03, 0x4A, 0x03, 0x50, 0x03, 0x56, 0x03, 0x5E, 0x03, 0x64, 0x03, 0x6A,
+-    0x03, 0x70, 0x03, 0x76, 0x03, 0x7E, 0x03, 0x86, 0x03, 0x8C, 0x03, 0x94, 0x03, 0x9A, 0x03, 0xA0,
+-    0x03, 0xA6, 0x03, 0xAC, 0x03, 0xB4, 0x03, 0xBC, 0x03, 0xC2, 0x03, 0xCA, 0x03, 0xD0, 0x03, 0xD6,
+-    0x03, 0xDC, 0x03, 0xE2, 0x03, 0xEA, 0x03, 0xF2, 0x03, 0xF8, 0x04, 0x00, 0x04, 0x06, 0x04, 0x0C,
+-    0x04, 0x12, 0x04, 0x18, 0x04, 0x20, 0x04, 0x28, 0x04, 0x2E, 0x04, 0x36, 0x04, 0x3C, 0x04, 0x42,
+-    0x04, 0x48, 0x04, 0x4E, 0x04, 0x56, 0x04, 0x5E, 0x04, 0x64, 0x04, 0x6C, 0x04, 0x72, 0x04, 0x78,
+-    0x04, 0x7E, 0x04, 0x84, 0x04, 0x8C, 0x04, 0x94, 0x04, 0x9A, 0x04, 0xA0, 0x04, 0xA8, 0x04, 0xAE,
+-    0x04, 0xB4, 0x04, 0xBC, 0x04, 0xC4, 0x04, 0xCA, 0x04, 0xD2, 0x04, 0xDA, 0x04, 0xE0, 0x04, 0xE6,
+-    0x04, 0xEC, 0x04, 0xF4, 0x04, 0xFA, 0x00, 0x02, 0x21, 0x26, 0x03, 0x01, 0x00, 0x02, 0x03, 0xCA,
+-    0x03, 0x41, 0x00, 0x02, 0x1F, 0xBE, 0x03, 0x01, 0x00, 0x02, 0x03, 0xCB, 0x03, 0x41, 0x00, 0x03,
+-    0x03, 0xB1, 0x03, 0x13, 0x03, 0x00, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x14, 0x03, 0x00, 0x00, 0x03,
+-    0x03, 0xB1, 0x03, 0x13, 0x03, 0x01, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x14, 0x03, 0x01, 0x00, 0x03,
+-    0x03, 0xB1, 0x03, 0x43, 0x03, 0x42, 0x00, 0x03, 0x03, 0x91, 0x03, 0x13, 0x03, 0x00, 0x00, 0x03,
+-    0x03, 0x91, 0x03, 0x14, 0x03, 0x00, 0x00, 0x03, 0x03, 0x91, 0x03, 0x13, 0x03, 0x01, 0x00, 0x03,
+-    0x03, 0x91, 0x03, 0x14, 0x03, 0x01, 0x00, 0x03, 0x03, 0x91, 0x03, 0x43, 0x03, 0x42, 0x00, 0x03,
+-    0x03, 0xB5, 0x03, 0x13, 0x03, 0x00, 0x00, 0x03, 0x03, 0xB5, 0x03, 0x14, 0x03, 0x00, 0x00, 0x03,
+-    0x03, 0xB5, 0x03, 0x13, 0x03, 0x01, 0x00, 0x03, 0x03, 0xB5, 0x03, 0x14, 0x03, 0x01, 0x00, 0x03,
+-    0x03, 0x95, 0x03, 0x13, 0x03, 0x00, 0x00, 0x03, 0x03, 0x95, 0x03, 0x14, 0x03, 0x00, 0x00, 0x03,
+-    0x03, 0x95, 0x03, 0x13, 0x03, 0x01, 0x00, 0x03, 0x03, 0x95, 0x03, 0x14, 0x03, 0x01, 0x00, 0x03,
+-    0x03, 0xB7, 0x03, 0x13, 0x03, 0x00, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x14, 0x03, 0x00, 0x00, 0x03,
+-    0x03, 0xB7, 0x03, 0x13, 0x03, 0x01, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x14, 0x03, 0x01, 0x00, 0x03,
+-    0x03, 0xB7, 0x03, 0x43, 0x03, 0x42, 0x00, 0x03, 0x03, 0x97, 0x03, 0x13, 0x03, 0x00, 0x00, 0x03,
+-    0x03, 0x97, 0x03, 0x14, 0x03, 0x00, 0x00, 0x03, 0x03, 0x97, 0x03, 0x13, 0x03, 0x01, 0x00, 0x03,
+-    0x03, 0x97, 0x03, 0x14, 0x03, 0x01, 0x00, 0x03, 0x03, 0x97, 0x03, 0x43, 0x03, 0x42, 0x00, 0x02,
+-    0x1F, 0xBE, 0x03, 0x13, 0x00, 0x03, 0x03, 0xB9, 0x03, 0x13, 0x03, 0x00, 0x00, 0x03, 0x03, 0xB9,
+-    0x03, 0x14, 0x03, 0x00, 0x00, 0x03, 0x03, 0xB9, 0x03, 0x13, 0x03, 0x01, 0x00, 0x03, 0x03, 0xB9,
+-    0x03, 0x14, 0x03, 0x01, 0x00, 0x03, 0x03, 0xB9, 0x03, 0x43, 0x03, 0x42, 0x00, 0x03, 0x1F, 0xBE,
+-    0x03, 0x14, 0x03, 0x42, 0x00, 0x03, 0x03, 0x99, 0x03, 0x13, 0x03, 0x00, 0x00, 0x03, 0x03, 0x99,
+-    0x03, 0x14, 0x03, 0x00, 0x00, 0x03, 0x03, 0x99, 0x03, 0x13, 0x03, 0x01, 0x00, 0x03, 0x03, 0x99,
+-    0x03, 0x14, 0x03, 0x01, 0x00, 0x03, 0x03, 0x99, 0x03, 0x43, 0x03, 0x42, 0x00, 0x03, 0x03, 0xBF,
+-    0x03, 0x13, 0x03, 0x00, 0x00, 0x03, 0x03, 0xBF, 0x03, 0x14, 0x03, 0x00, 0x00, 0x03, 0x03, 0xBF,
+-    0x03, 0x13, 0x03, 0x01, 0x00, 0x03, 0x03, 0xBF, 0x03, 0x14, 0x03, 0x01, 0x00, 0x03, 0x03, 0x9F,
+-    0x03, 0x13, 0x03, 0x00, 0x00, 0x03, 0x03, 0x9F, 0x03, 0x14, 0x03, 0x00, 0x00, 0x03, 0x03, 0x9F,
+-    0x03, 0x13, 0x03, 0x01, 0x00, 0x03, 0x03, 0x9F, 0x03, 0x14, 0x03, 0x01, 0x00, 0x03, 0x03, 0xC5,
+-    0x03, 0x13, 0x03, 0x00, 0x00, 0x03, 0x03, 0xC5, 0x03, 0x14, 0x03, 0x00, 0x00, 0x03, 0x03, 0xC5,
+-    0x03, 0x13, 0x03, 0x01, 0x00, 0x03, 0x03, 0xC5, 0x03, 0x14, 0x03, 0x01, 0x00, 0x03, 0x03, 0xC5,
+-    0x03, 0x43, 0x03, 0x42, 0x00, 0x03, 0x03, 0xA5, 0x03, 0x14, 0x03, 0x00, 0x00, 0x03, 0x03, 0xA5,
+-    0x03, 0x14, 0x03, 0x01, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x13, 0x03, 0x00, 0x00, 0x03, 0x03, 0xC9,
+-    0x03, 0x14, 0x03, 0x00, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x13, 0x03, 0x01, 0x00, 0x03, 0x03, 0xC9,
+-    0x03, 0x14, 0x03, 0x01, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x43, 0x03, 0x42, 0x00, 0x02, 0x21, 0x26,
+-    0x03, 0x13, 0x00, 0x03, 0x03, 0xA9, 0x03, 0x13, 0x03, 0x00, 0x00, 0x03, 0x03, 0xA9, 0x03, 0x14,
+-    0x03, 0x00, 0x00, 0x03, 0x03, 0xA9, 0x03, 0x13, 0x03, 0x01, 0x00, 0x03, 0x03, 0xA9, 0x03, 0x14,
+-    0x03, 0x01, 0x00, 0x03, 0x03, 0xA9, 0x03, 0x43, 0x03, 0x42, 0x00, 0x03, 0x21, 0x26, 0x03, 0x14,
+-    0x03, 0x42, 0x00, 0x02, 0x1F, 0xBE, 0x03, 0x00, 0x00, 0x02, 0x1F, 0xBE, 0x03, 0x01, 0x00, 0x02,
+-    0x1F, 0xB3, 0x03, 0x43, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x14, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x80,
+-    0x03, 0x40, 0x00, 0x02, 0x1F, 0x81, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x80, 0x03, 0x41, 0x00, 0x02,
+-    0x1F, 0x81, 0x03, 0x41, 0x00, 0x03, 0x1F, 0x00, 0x03, 0x42, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x01,
+-    0x03, 0x42, 0x03, 0x45, 0x00, 0x02, 0x1F, 0xBC, 0x03, 0x43, 0x00, 0x03, 0x03, 0x91, 0x03, 0x14,
+-    0x03, 0x45, 0x00, 0x02, 0x1F, 0x88, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x89, 0x03, 0x40, 0x00, 0x02,
+-    0x1F, 0x88, 0x03, 0x41, 0x00, 0x02, 0x1F, 0x89, 0x03, 0x41, 0x00, 0x03, 0x1F, 0x08, 0x03, 0x42,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0x09, 0x03, 0x42, 0x03, 0x45, 0x00, 0x02, 0x1F, 0xC3, 0x03, 0x43,
+-    0x00, 0x03, 0x03, 0xB7, 0x03, 0x14, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x90, 0x03, 0x40, 0x00, 0x02,
+-    0x1F, 0x91, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x90, 0x03, 0x41, 0x00, 0x02, 0x1F, 0x91, 0x03, 0x41,
+-    0x00, 0x03, 0x1F, 0x20, 0x03, 0x42, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x21, 0x03, 0x42, 0x03, 0x45,
+-    0x00, 0x02, 0x1F, 0xCC, 0x03, 0x43, 0x00, 0x03, 0x03, 0x97, 0x03, 0x14, 0x03, 0x45, 0x00, 0x02,
+-    0x1F, 0x98, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x99, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x98, 0x03, 0x41,
+-    0x00, 0x02, 0x1F, 0x99, 0x03, 0x41, 0x00, 0x03, 0x1F, 0x28, 0x03, 0x42, 0x03, 0x45, 0x00, 0x03,
+-    0x1F, 0x29, 0x03, 0x42, 0x03, 0x45, 0x00, 0x02, 0x1F, 0xF3, 0x03, 0x43, 0x00, 0x03, 0x03, 0xC9,
+-    0x03, 0x14, 0x03, 0x45, 0x00, 0x02, 0x1F, 0xA0, 0x03, 0x40, 0x00, 0x02, 0x1F, 0xA1, 0x03, 0x40,
+-    0x00, 0x02, 0x1F, 0xA0, 0x03, 0x41, 0x00, 0x02, 0x1F, 0xA1, 0x03, 0x41, 0x00, 0x03, 0x1F, 0x60,
+-    0x03, 0x42, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x61, 0x03, 0x42, 0x03, 0x45, 0x00, 0x02, 0x1F, 0xFC,
+-    0x03, 0x43, 0x00, 0x03, 0x03, 0xA9, 0x03, 0x14, 0x03, 0x45, 0x00, 0x02, 0x1F, 0xA8, 0x03, 0x40,
+-    0x00, 0x02, 0x1F, 0xA9, 0x03, 0x40, 0x00, 0x02, 0x1F, 0xA8, 0x03, 0x41, 0x00, 0x02, 0x1F, 0xA9,
+-    0x03, 0x41, 0x00, 0x03, 0x1F, 0x68, 0x03, 0x42, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x69, 0x03, 0x42,
+-    0x03, 0x45, 0x00, 0x02, 0x1F, 0xB3, 0x03, 0x40, 0x00, 0x02, 0x1F, 0xB3, 0x03, 0x01, 0x00, 0x03,
+-    0x03, 0xB1, 0x03, 0x42, 0x03, 0x45, 0x00, 0x02, 0x1F, 0xC3, 0x03, 0x40, 0x00, 0x02, 0x1F, 0xC3,
+-    0x03, 0x01, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x42, 0x03, 0x45, 0x00, 0x03, 0x03, 0xB9, 0x03, 0x08,
+-    0x03, 0x00, 0x00, 0x02, 0x03, 0xCA, 0x03, 0x41, 0x00, 0x03, 0x1F, 0xBE, 0x03, 0x08, 0x03, 0x42,
+-    0x00, 0x03, 0x03, 0xC5, 0x03, 0x08, 0x03, 0x00, 0x00, 0x02, 0x03, 0xCB, 0x03, 0x41, 0x00, 0x02,
+-    0x1F, 0xF3, 0x03, 0x40, 0x00, 0x02, 0x1F, 0xF3, 0x03, 0x01, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x42,
+-    0x03, 0x45, 0x00, 0x02, 0x21, 0x26, 0x03, 0x00, 0x00, 0x02, 0x21, 0x26, 0x03, 0x01, 0x00, 0x01,
+-    0x00, 0x89, 0x03, 0x8F, 0x03, 0x90, 0x03, 0xAF, 0x03, 0xB0, 0x1F, 0x02, 0x1F, 0x03, 0x1F, 0x04,
+-    0x1F, 0x05, 0x1F, 0x06, 0x1F, 0x0A, 0x1F, 0x0B, 0x1F, 0x0C, 0x1F, 0x0D, 0x1F, 0x0E, 0x1F, 0x12,
+-    0x1F, 0x13, 0x1F, 0x14, 0x1F, 0x15, 0x1F, 0x1A, 0x1F, 0x1B, 0x1F, 0x1C, 0x1F, 0x1D, 0x1F, 0x22,
+-    0x1F, 0x23, 0x1F, 0x24, 0x1F, 0x25, 0x1F, 0x26, 0x1F, 0x2A, 0x1F, 0x2B, 0x1F, 0x2C, 0x1F, 0x2D,
+-    0x1F, 0x2E, 0x1F, 0x30, 0x1F, 0x32, 0x1F, 0x33, 0x1F, 0x34, 0x1F, 0x35, 0x1F, 0x36, 0x1F, 0x37,
+-    0x1F, 0x3A, 0x1F, 0x3B, 0x1F, 0x3C, 0x1F, 0x3D, 0x1F, 0x3E, 0x1F, 0x42, 0x1F, 0x43, 0x1F, 0x44,
+-    0x1F, 0x45, 0x1F, 0x4A, 0x1F, 0x4B, 0x1F, 0x4C, 0x1F, 0x4D, 0x1F, 0x52, 0x1F, 0x53, 0x1F, 0x54,
+-    0x1F, 0x55, 0x1F, 0x56, 0x1F, 0x5B, 0x1F, 0x5D, 0x1F, 0x62, 0x1F, 0x63, 0x1F, 0x64, 0x1F, 0x65,
+-    0x1F, 0x66, 0x1F, 0x68, 0x1F, 0x6A, 0x1F, 0x6B, 0x1F, 0x6C, 0x1F, 0x6D, 0x1F, 0x6E, 0x1F, 0x6F,
+-    0x1F, 0x76, 0x1F, 0x77, 0x1F, 0x80, 0x1F, 0x81, 0x1F, 0x82, 0x1F, 0x83, 0x1F, 0x84, 0x1F, 0x85,
+-    0x1F, 0x86, 0x1F, 0x87, 0x1F, 0x88, 0x1F, 0x89, 0x1F, 0x8A, 0x1F, 0x8B, 0x1F, 0x8C, 0x1F, 0x8D,
+-    0x1F, 0x8E, 0x1F, 0x8F, 0x1F, 0x90, 0x1F, 0x91, 0x1F, 0x92, 0x1F, 0x93, 0x1F, 0x94, 0x1F, 0x95,
+-    0x1F, 0x96, 0x1F, 0x97, 0x1F, 0x98, 0x1F, 0x99, 0x1F, 0x9A, 0x1F, 0x9B, 0x1F, 0x9C, 0x1F, 0x9D,
+-    0x1F, 0x9E, 0x1F, 0x9F, 0x1F, 0xA0, 0x1F, 0xA1, 0x1F, 0xA2, 0x1F, 0xA3, 0x1F, 0xA4, 0x1F, 0xA5,
+-    0x1F, 0xA6, 0x1F, 0xA7, 0x1F, 0xA8, 0x1F, 0xA9, 0x1F, 0xAA, 0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD,
+-    0x1F, 0xAE, 0x1F, 0xAF, 0x1F, 0xB2, 0x1F, 0xB4, 0x1F, 0xB7, 0x1F, 0xC2, 0x1F, 0xC4, 0x1F, 0xC7,
+-    0x1F, 0xD2, 0x1F, 0xD3, 0x1F, 0xD7, 0x1F, 0xE2, 0x1F, 0xE3, 0x1F, 0xF2, 0x1F, 0xF4, 0x1F, 0xF7,
+-    0x1F, 0xFA, 0x1F, 0xFB, 0x00, 0x01, 0x04, 0xE2, 0x00, 0x7F, 0x01, 0x04, 0x01, 0x0A, 0x01, 0x10,
+-    0x01, 0x16, 0x01, 0x1E, 0x01, 0x26, 0x01, 0x2E, 0x01, 0x36, 0x01, 0x3E, 0x01, 0x46, 0x01, 0x4E,
+-    0x01, 0x56, 0x01, 0x5E, 0x01, 0x66, 0x01, 0x6E, 0x01, 0x76, 0x01, 0x7E, 0x01, 0x86, 0x01, 0x8E,
+-    0x01, 0x96, 0x01, 0x9E, 0x01, 0xA6, 0x01, 0xAE, 0x01, 0xB6, 0x01, 0xBE, 0x01, 0xC6, 0x01, 0xCE,
+-    0x01, 0xD6, 0x01, 0xDE, 0x01, 0xE4, 0x01, 0xEC, 0x01, 0xF4, 0x01, 0xFC, 0x02, 0x04, 0x02, 0x0C,
+-    0x02, 0x14, 0x02, 0x1C, 0x02, 0x24, 0x02, 0x2C, 0x02, 0x34, 0x02, 0x3C, 0x02, 0x44, 0x02, 0x4C,
+-    0x02, 0x54, 0x02, 0x5C, 0x02, 0x64, 0x02, 0x6C, 0x02, 0x74, 0x02, 0x7C, 0x02, 0x84, 0x02, 0x8C,
+-    0x02, 0x94, 0x02, 0x9C, 0x02, 0xA4, 0x02, 0xAC, 0x02, 0xB4, 0x02, 0xBC, 0x02, 0xC2, 0x02, 0xCA,
+-    0x02, 0xD2, 0x02, 0xDA, 0x02, 0xE2, 0x02, 0xEA, 0x02, 0xF0, 0x02, 0xF6, 0x02, 0xFE, 0x03, 0x06,
+-    0x03, 0x0E, 0x03, 0x16, 0x03, 0x1E, 0x03, 0x26, 0x03, 0x2E, 0x03, 0x36, 0x03, 0x3E, 0x03, 0x46,
+-    0x03, 0x4E, 0x03, 0x56, 0x03, 0x5E, 0x03, 0x66, 0x03, 0x6E, 0x03, 0x76, 0x03, 0x7E, 0x03, 0x86,
+-    0x03, 0x8E, 0x03, 0x96, 0x03, 0x9E, 0x03, 0xA6, 0x03, 0xAE, 0x03, 0xB6, 0x03, 0xBE, 0x03, 0xC6,
+-    0x03, 0xCE, 0x03, 0xD6, 0x03, 0xDE, 0x03, 0xE6, 0x03, 0xEE, 0x03, 0xF6, 0x03, 0xFE, 0x04, 0x06,
+-    0x04, 0x0E, 0x04, 0x16, 0x04, 0x1E, 0x04, 0x26, 0x04, 0x2E, 0x04, 0x36, 0x04, 0x3E, 0x04, 0x46,
+-    0x04, 0x4E, 0x04, 0x56, 0x04, 0x5E, 0x04, 0x66, 0x04, 0x6E, 0x04, 0x76, 0x04, 0x7E, 0x04, 0x84,
+-    0x04, 0x8C, 0x04, 0x94, 0x04, 0x9A, 0x04, 0xA2, 0x04, 0xAA, 0x04, 0xB0, 0x04, 0xB8, 0x04, 0xC0,
+-    0x04, 0xC8, 0x04, 0xCE, 0x04, 0xD6, 0x04, 0xDC, 0x00, 0x02, 0x21, 0x26, 0x03, 0x41, 0x00, 0x02,
+-    0x1F, 0xBE, 0x03, 0x44, 0x00, 0x02, 0x1F, 0xBE, 0x03, 0x41, 0x00, 0x03, 0x03, 0xC5, 0x03, 0x08,
+-    0x03, 0x01, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x14,
+-    0x03, 0x40, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x14,
+-    0x03, 0x41, 0x00, 0x03, 0x03, 0x91, 0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x03, 0x91, 0x03, 0x14,
+-    0x03, 0x40, 0x00, 0x03, 0x03, 0x91, 0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x03, 0x91, 0x03, 0x14,
+-    0x03, 0x41, 0x00, 0x03, 0x03, 0xB5, 0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x03, 0xB5, 0x03, 0x14,
+-    0x03, 0x40, 0x00, 0x03, 0x03, 0xB5, 0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x03, 0xB5, 0x03, 0x14,
+-    0x03, 0x41, 0x00, 0x03, 0x03, 0x95, 0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x03, 0x95, 0x03, 0x14,
+-    0x03, 0x40, 0x00, 0x03, 0x03, 0x95, 0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x03, 0x95, 0x03, 0x14,
+-    0x03, 0x41, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x14,
+-    0x03, 0x40, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x14,
+-    0x03, 0x41, 0x00, 0x03, 0x03, 0x97, 0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x03, 0x97, 0x03, 0x14,
+-    0x03, 0x40, 0x00, 0x03, 0x03, 0x97, 0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x03, 0x97, 0x03, 0x14,
+-    0x03, 0x41, 0x00, 0x02, 0x1F, 0xBE, 0x03, 0x43, 0x00, 0x03, 0x03, 0xB9, 0x03, 0x13, 0x03, 0x40,
+-    0x00, 0x03, 0x03, 0xB9, 0x03, 0x14, 0x03, 0x40, 0x00, 0x03, 0x03, 0xB9, 0x03, 0x13, 0x03, 0x41,
+-    0x00, 0x03, 0x03, 0xB9, 0x03, 0x14, 0x03, 0x41, 0x00, 0x03, 0x1F, 0xBE, 0x03, 0x13, 0x03, 0x42,
+-    0x00, 0x03, 0x03, 0x99, 0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x03, 0x99, 0x03, 0x14, 0x03, 0x40,
+-    0x00, 0x03, 0x03, 0x99, 0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x03, 0x99, 0x03, 0x14, 0x03, 0x41,
+-    0x00, 0x03, 0x03, 0xBF, 0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x03, 0xBF, 0x03, 0x14, 0x03, 0x40,
+-    0x00, 0x03, 0x03, 0xBF, 0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x03, 0xBF, 0x03, 0x14, 0x03, 0x41,
+-    0x00, 0x03, 0x03, 0x9F, 0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x03, 0x9F, 0x03, 0x14, 0x03, 0x40,
+-    0x00, 0x03, 0x03, 0x9F, 0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x03, 0x9F, 0x03, 0x14, 0x03, 0x41,
+-    0x00, 0x03, 0x03, 0xC5, 0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x03, 0xC5, 0x03, 0x14, 0x03, 0x40,
+-    0x00, 0x03, 0x03, 0xC5, 0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x03, 0xC5, 0x03, 0x14, 0x03, 0x41,
+-    0x00, 0x03, 0x03, 0xA5, 0x03, 0x14, 0x03, 0x40, 0x00, 0x03, 0x03, 0xA5, 0x03, 0x14, 0x03, 0x41,
+-    0x00, 0x03, 0x03, 0xC9, 0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x14, 0x03, 0x40,
+-    0x00, 0x03, 0x03, 0xC9, 0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x14, 0x03, 0x41,
+-    0x00, 0x02, 0x21, 0x26, 0x03, 0x43, 0x00, 0x03, 0x03, 0xA9, 0x03, 0x13, 0x03, 0x40, 0x00, 0x03,
+-    0x03, 0xA9, 0x03, 0x14, 0x03, 0x40, 0x00, 0x03, 0x03, 0xA9, 0x03, 0x13, 0x03, 0x41, 0x00, 0x03,
+-    0x03, 0xA9, 0x03, 0x14, 0x03, 0x41, 0x00, 0x03, 0x21, 0x26, 0x03, 0x13, 0x03, 0x42, 0x00, 0x02,
+-    0x1F, 0xBE, 0x03, 0x40, 0x00, 0x02, 0x1F, 0xBE, 0x03, 0x41, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x13,
+-    0x03, 0x45, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x45, 0x03, 0x14, 0x00, 0x03, 0x1F, 0x00, 0x03, 0x00,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0x01, 0x03, 0x00, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x00, 0x03, 0x01,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0x01, 0x03, 0x01, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x00, 0x03, 0x45,
+-    0x03, 0x42, 0x00, 0x03, 0x1F, 0x01, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03, 0x03, 0x91, 0x03, 0x13,
+-    0x03, 0x45, 0x00, 0x03, 0x03, 0x91, 0x03, 0x45, 0x03, 0x14, 0x00, 0x03, 0x1F, 0x08, 0x03, 0x00,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0x09, 0x03, 0x00, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x08, 0x03, 0x01,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0x09, 0x03, 0x01, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x08, 0x03, 0x45,
+-    0x03, 0x42, 0x00, 0x03, 0x1F, 0x09, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x13,
+-    0x03, 0x45, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x45, 0x03, 0x14, 0x00, 0x03, 0x1F, 0x20, 0x03, 0x00,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0x21, 0x03, 0x00, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x20, 0x03, 0x01,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0x21, 0x03, 0x01, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x20, 0x03, 0x45,
+-    0x03, 0x42, 0x00, 0x03, 0x1F, 0x21, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03, 0x03, 0x97, 0x03, 0x13,
+-    0x03, 0x45, 0x00, 0x03, 0x03, 0x97, 0x03, 0x45, 0x03, 0x14, 0x00, 0x03, 0x1F, 0x28, 0x03, 0x00,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0x29, 0x03, 0x00, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x28, 0x03, 0x01,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0x29, 0x03, 0x01, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x28, 0x03, 0x45,
+-    0x03, 0x42, 0x00, 0x03, 0x1F, 0x29, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x13,
+-    0x03, 0x45, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x14, 0x00, 0x03, 0x1F, 0x60, 0x03, 0x00,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0x61, 0x03, 0x00, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x60, 0x03, 0x01,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0x61, 0x03, 0x01, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x60, 0x03, 0x45,
+-    0x03, 0x42, 0x00, 0x03, 0x1F, 0x61, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03, 0x03, 0xA9, 0x03, 0x13,
+-    0x03, 0x45, 0x00, 0x03, 0x03, 0xA9, 0x03, 0x45, 0x03, 0x14, 0x00, 0x03, 0x1F, 0x68, 0x03, 0x00,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0x69, 0x03, 0x00, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x68, 0x03, 0x01,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0x69, 0x03, 0x01, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x68, 0x03, 0x45,
+-    0x03, 0x42, 0x00, 0x03, 0x1F, 0x69, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x00,
+-    0x03, 0x45, 0x00, 0x02, 0x1F, 0xB3, 0x03, 0x41, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x45, 0x03, 0x42,
+-    0x00, 0x03, 0x03, 0xB7, 0x03, 0x00, 0x03, 0x45, 0x00, 0x02, 0x1F, 0xC3, 0x03, 0x41, 0x00, 0x03,
+-    0x03, 0xB7, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03, 0x03, 0xB9, 0x03, 0x08, 0x03, 0x40, 0x00, 0x02,
+-    0x1F, 0xBE, 0x03, 0x44, 0x00, 0x03, 0x03, 0xC5, 0x03, 0x08, 0x03, 0x40, 0x00, 0x03, 0x03, 0xC5,
+-    0x03, 0x08, 0x03, 0x01, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x00, 0x03, 0x45, 0x00, 0x02, 0x1F, 0xF3,
+-    0x03, 0x41, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x42, 0x00, 0x02, 0x21, 0x26, 0x03, 0x40,
+-    0x00, 0x02, 0x21, 0x26, 0x03, 0x41, 0x00, 0x01, 0x00, 0x7F, 0x03, 0x8F, 0x03, 0x90, 0x03, 0xAF,
+-    0x03, 0xB0, 0x1F, 0x02, 0x1F, 0x03, 0x1F, 0x04, 0x1F, 0x05, 0x1F, 0x0A, 0x1F, 0x0B, 0x1F, 0x0C,
+-    0x1F, 0x0D, 0x1F, 0x12, 0x1F, 0x13, 0x1F, 0x14, 0x1F, 0x15, 0x1F, 0x1A, 0x1F, 0x1B, 0x1F, 0x1C,
+-    0x1F, 0x1D, 0x1F, 0x22, 0x1F, 0x23, 0x1F, 0x24, 0x1F, 0x25, 0x1F, 0x2A, 0x1F, 0x2B, 0x1F, 0x2C,
+-    0x1F, 0x2D, 0x1F, 0x30, 0x1F, 0x32, 0x1F, 0x33, 0x1F, 0x34, 0x1F, 0x35, 0x1F, 0x36, 0x1F, 0x3A,
+-    0x1F, 0x3B, 0x1F, 0x3C, 0x1F, 0x3D, 0x1F, 0x42, 0x1F, 0x43, 0x1F, 0x44, 0x1F, 0x45, 0x1F, 0x4A,
+-    0x1F, 0x4B, 0x1F, 0x4C, 0x1F, 0x4D, 0x1F, 0x52, 0x1F, 0x53, 0x1F, 0x54, 0x1F, 0x55, 0x1F, 0x5B,
+-    0x1F, 0x5D, 0x1F, 0x62, 0x1F, 0x63, 0x1F, 0x64, 0x1F, 0x65, 0x1F, 0x68, 0x1F, 0x6A, 0x1F, 0x6B,
+-    0x1F, 0x6C, 0x1F, 0x6D, 0x1F, 0x6E, 0x1F, 0x76, 0x1F, 0x77, 0x1F, 0x80, 0x1F, 0x81, 0x1F, 0x82,
++    0x1F, 0xB4, 0x1F, 0xB7, 0x1F, 0xBA, 0x1F, 0xC2, 0x1F, 0xC4, 0x1F, 0xC7, 0x1F, 0xC8, 0x1F, 0xCA,
++    0x1F, 0xCD, 0x1F, 0xCE, 0x1F, 0xD0, 0x1F, 0xD1, 0x1F, 0xD2, 0x1F, 0xD6, 0x1F, 0xD7, 0x1F, 0xDA,
++    0x1F, 0xDD, 0x1F, 0xDE, 0x1F, 0xE2, 0x1F, 0xE4, 0x1F, 0xE7, 0x1F, 0xEA, 0x1F, 0xED, 0x1F, 0xF2,
++    0x1F, 0xF4, 0x1F, 0xF7, 0x1F, 0xF8, 0x1F, 0xFA, 0x1F, 0xFC, 0x00, 0x01, 0x04, 0xE0, 0x00, 0x85,
++    0x01, 0x10, 0x01, 0x16, 0x01, 0x1C, 0x01, 0x22, 0x01, 0x28, 0x01, 0x30, 0x01, 0x38, 0x01, 0x40,
++    0x01, 0x48, 0x01, 0x50, 0x01, 0x58, 0x01, 0x60, 0x01, 0x68, 0x01, 0x70, 0x01, 0x78, 0x01, 0x80,
++    0x01, 0x88, 0x01, 0x90, 0x01, 0x98, 0x01, 0xA0, 0x01, 0xA8, 0x01, 0xB0, 0x01, 0xB8, 0x01, 0xC0,
++    0x01, 0xC8, 0x01, 0xD0, 0x01, 0xD8, 0x01, 0xE0, 0x01, 0xE8, 0x01, 0xF0, 0x01, 0xF8, 0x02, 0x00,
++    0x02, 0x08, 0x02, 0x0E, 0x02, 0x16, 0x02, 0x1E, 0x02, 0x26, 0x02, 0x2E, 0x02, 0x36, 0x02, 0x3E,
++    0x02, 0x46, 0x02, 0x4E, 0x02, 0x56, 0x02, 0x5E, 0x02, 0x66, 0x02, 0x6E, 0x02, 0x76, 0x02, 0x7E,
++    0x02, 0x86, 0x02, 0x8E, 0x02, 0x96, 0x02, 0x9E, 0x02, 0xA6, 0x02, 0xAE, 0x02, 0xB6, 0x02, 0xBE,
++    0x02, 0xC6, 0x02, 0xCE, 0x02, 0xD6, 0x02, 0xDE, 0x02, 0xE6, 0x02, 0xEE, 0x02, 0xF6, 0x02, 0xFE,
++    0x03, 0x06, 0x03, 0x0C, 0x03, 0x14, 0x03, 0x1C, 0x03, 0x24, 0x03, 0x2C, 0x03, 0x34, 0x03, 0x3C,
++    0x03, 0x42, 0x03, 0x48, 0x03, 0x50, 0x03, 0x56, 0x03, 0x5C, 0x03, 0x62, 0x03, 0x68, 0x03, 0x70,
++    0x03, 0x78, 0x03, 0x7E, 0x03, 0x86, 0x03, 0x8C, 0x03, 0x92, 0x03, 0x98, 0x03, 0x9E, 0x03, 0xA6,
++    0x03, 0xAE, 0x03, 0xB4, 0x03, 0xBC, 0x03, 0xC2, 0x03, 0xC8, 0x03, 0xCE, 0x03, 0xD4, 0x03, 0xDC,
++    0x03, 0xE4, 0x03, 0xEA, 0x03, 0xF2, 0x03, 0xF8, 0x03, 0xFE, 0x04, 0x04, 0x04, 0x0A, 0x04, 0x12,
++    0x04, 0x1A, 0x04, 0x20, 0x04, 0x28, 0x04, 0x2E, 0x04, 0x34, 0x04, 0x3A, 0x04, 0x40, 0x04, 0x48,
++    0x04, 0x50, 0x04, 0x56, 0x04, 0x5E, 0x04, 0x64, 0x04, 0x6A, 0x04, 0x70, 0x04, 0x76, 0x04, 0x7E,
++    0x04, 0x86, 0x04, 0x8C, 0x04, 0x92, 0x04, 0x9A, 0x04, 0xA0, 0x04, 0xA6, 0x04, 0xAE, 0x04, 0xB6,
++    0x04, 0xBE, 0x04, 0xC6, 0x04, 0xCC, 0x04, 0xD2, 0x04, 0xDA, 0x00, 0x02, 0x21, 0x26, 0x03, 0x01,
++    0x00, 0x02, 0x03, 0xCA, 0x03, 0x41, 0x00, 0x02, 0x1F, 0xBE, 0x03, 0x01, 0x00, 0x02, 0x03, 0xCB,
++    0x03, 0x41, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x13, 0x03, 0x00, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x14,
++    0x03, 0x00, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x13, 0x03, 0x01, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x14,
++    0x03, 0x01, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x43, 0x03, 0x42, 0x00, 0x03, 0x03, 0x91, 0x03, 0x13,
++    0x03, 0x00, 0x00, 0x03, 0x03, 0x91, 0x03, 0x14, 0x03, 0x00, 0x00, 0x03, 0x03, 0x91, 0x03, 0x13,
++    0x03, 0x01, 0x00, 0x03, 0x03, 0x91, 0x03, 0x14, 0x03, 0x01, 0x00, 0x03, 0x03, 0x91, 0x03, 0x43,
++    0x03, 0x42, 0x00, 0x03, 0x03, 0xB5, 0x03, 0x13, 0x03, 0x00, 0x00, 0x03, 0x03, 0xB5, 0x03, 0x14,
++    0x03, 0x00, 0x00, 0x03, 0x03, 0xB5, 0x03, 0x13, 0x03, 0x01, 0x00, 0x03, 0x03, 0xB5, 0x03, 0x14,
++    0x03, 0x01, 0x00, 0x03, 0x03, 0x95, 0x03, 0x13, 0x03, 0x00, 0x00, 0x03, 0x03, 0x95, 0x03, 0x14,
++    0x03, 0x00, 0x00, 0x03, 0x03, 0x95, 0x03, 0x13, 0x03, 0x01, 0x00, 0x03, 0x03, 0x95, 0x03, 0x14,
++    0x03, 0x01, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x13, 0x03, 0x00, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x14,
++    0x03, 0x00, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x13, 0x03, 0x01, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x14,
++    0x03, 0x01, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x43, 0x03, 0x42, 0x00, 0x03, 0x03, 0x97, 0x03, 0x13,
++    0x03, 0x00, 0x00, 0x03, 0x03, 0x97, 0x03, 0x14, 0x03, 0x00, 0x00, 0x03, 0x03, 0x97, 0x03, 0x13,
++    0x03, 0x01, 0x00, 0x03, 0x03, 0x97, 0x03, 0x14, 0x03, 0x01, 0x00, 0x03, 0x03, 0x97, 0x03, 0x43,
++    0x03, 0x42, 0x00, 0x02, 0x1F, 0xBE, 0x03, 0x13, 0x00, 0x03, 0x03, 0xB9, 0x03, 0x13, 0x03, 0x00,
++    0x00, 0x03, 0x03, 0xB9, 0x03, 0x14, 0x03, 0x00, 0x00, 0x03, 0x03, 0xB9, 0x03, 0x13, 0x03, 0x01,
++    0x00, 0x03, 0x03, 0xB9, 0x03, 0x14, 0x03, 0x01, 0x00, 0x03, 0x03, 0xB9, 0x03, 0x43, 0x03, 0x42,
++    0x00, 0x03, 0x1F, 0xBE, 0x03, 0x14, 0x03, 0x42, 0x00, 0x03, 0x03, 0x99, 0x03, 0x13, 0x03, 0x00,
++    0x00, 0x03, 0x03, 0x99, 0x03, 0x14, 0x03, 0x00, 0x00, 0x03, 0x03, 0x99, 0x03, 0x13, 0x03, 0x01,
++    0x00, 0x03, 0x03, 0x99, 0x03, 0x14, 0x03, 0x01, 0x00, 0x03, 0x03, 0x99, 0x03, 0x43, 0x03, 0x42,
++    0x00, 0x03, 0x03, 0xBF, 0x03, 0x13, 0x03, 0x00, 0x00, 0x03, 0x03, 0xBF, 0x03, 0x14, 0x03, 0x00,
++    0x00, 0x03, 0x03, 0xBF, 0x03, 0x13, 0x03, 0x01, 0x00, 0x03, 0x03, 0xBF, 0x03, 0x14, 0x03, 0x01,
++    0x00, 0x03, 0x03, 0x9F, 0x03, 0x13, 0x03, 0x00, 0x00, 0x03, 0x03, 0x9F, 0x03, 0x14, 0x03, 0x00,
++    0x00, 0x03, 0x03, 0x9F, 0x03, 0x13, 0x03, 0x01, 0x00, 0x03, 0x03, 0x9F, 0x03, 0x14, 0x03, 0x01,
++    0x00, 0x03, 0x03, 0xC5, 0x03, 0x13, 0x03, 0x00, 0x00, 0x03, 0x03, 0xC5, 0x03, 0x14, 0x03, 0x00,
++    0x00, 0x03, 0x03, 0xC5, 0x03, 0x13, 0x03, 0x01, 0x00, 0x03, 0x03, 0xC5, 0x03, 0x14, 0x03, 0x01,
++    0x00, 0x03, 0x03, 0xC5, 0x03, 0x43, 0x03, 0x42, 0x00, 0x03, 0x03, 0xA5, 0x03, 0x14, 0x03, 0x00,
++    0x00, 0x03, 0x03, 0xA5, 0x03, 0x14, 0x03, 0x01, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x13, 0x03, 0x00,
++    0x00, 0x03, 0x03, 0xC9, 0x03, 0x14, 0x03, 0x00, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x13, 0x03, 0x01,
++    0x00, 0x03, 0x03, 0xC9, 0x03, 0x14, 0x03, 0x01, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x43, 0x03, 0x42,
++    0x00, 0x02, 0x21, 0x26, 0x03, 0x13, 0x00, 0x03, 0x03, 0xA9, 0x03, 0x13, 0x03, 0x00, 0x00, 0x03,
++    0x03, 0xA9, 0x03, 0x14, 0x03, 0x00, 0x00, 0x03, 0x03, 0xA9, 0x03, 0x13, 0x03, 0x01, 0x00, 0x03,
++    0x03, 0xA9, 0x03, 0x14, 0x03, 0x01, 0x00, 0x03, 0x03, 0xA9, 0x03, 0x43, 0x03, 0x42, 0x00, 0x03,
++    0x21, 0x26, 0x03, 0x14, 0x03, 0x42, 0x00, 0x02, 0x1F, 0xBE, 0x03, 0x00, 0x00, 0x02, 0x1F, 0xB3,
++    0x03, 0x43, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x14, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x80, 0x03, 0x40,
++    0x00, 0x02, 0x1F, 0x81, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x80, 0x03, 0x41, 0x00, 0x02, 0x1F, 0x81,
++    0x03, 0x41, 0x00, 0x03, 0x1F, 0x00, 0x03, 0x42, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x01, 0x03, 0x42,
++    0x03, 0x45, 0x00, 0x02, 0x1F, 0xBC, 0x03, 0x43, 0x00, 0x03, 0x03, 0x91, 0x03, 0x14, 0x03, 0x45,
++    0x00, 0x02, 0x1F, 0x88, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x89, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x88,
++    0x03, 0x41, 0x00, 0x02, 0x1F, 0x89, 0x03, 0x41, 0x00, 0x03, 0x1F, 0x08, 0x03, 0x42, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0x09, 0x03, 0x42, 0x03, 0x45, 0x00, 0x02, 0x1F, 0xC3, 0x03, 0x43, 0x00, 0x03,
++    0x03, 0xB7, 0x03, 0x14, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x90, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x91,
++    0x03, 0x40, 0x00, 0x02, 0x1F, 0x90, 0x03, 0x41, 0x00, 0x02, 0x1F, 0x91, 0x03, 0x41, 0x00, 0x03,
++    0x1F, 0x20, 0x03, 0x42, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x21, 0x03, 0x42, 0x03, 0x45, 0x00, 0x02,
++    0x1F, 0xCC, 0x03, 0x43, 0x00, 0x03, 0x03, 0x97, 0x03, 0x14, 0x03, 0x45, 0x00, 0x02, 0x1F, 0x98,
++    0x03, 0x40, 0x00, 0x02, 0x1F, 0x99, 0x03, 0x40, 0x00, 0x02, 0x1F, 0x98, 0x03, 0x41, 0x00, 0x02,
++    0x1F, 0x99, 0x03, 0x41, 0x00, 0x03, 0x1F, 0x28, 0x03, 0x42, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x29,
++    0x03, 0x42, 0x03, 0x45, 0x00, 0x02, 0x1F, 0xF3, 0x03, 0x43, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x14,
++    0x03, 0x45, 0x00, 0x02, 0x1F, 0xA0, 0x03, 0x40, 0x00, 0x02, 0x1F, 0xA1, 0x03, 0x40, 0x00, 0x02,
++    0x1F, 0xA0, 0x03, 0x41, 0x00, 0x02, 0x1F, 0xA1, 0x03, 0x41, 0x00, 0x03, 0x1F, 0x60, 0x03, 0x42,
++    0x03, 0x45, 0x00, 0x03, 0x1F, 0x61, 0x03, 0x42, 0x03, 0x45, 0x00, 0x02, 0x1F, 0xFC, 0x03, 0x43,
++    0x00, 0x03, 0x03, 0xA9, 0x03, 0x14, 0x03, 0x45, 0x00, 0x02, 0x1F, 0xA8, 0x03, 0x40, 0x00, 0x02,
++    0x1F, 0xA9, 0x03, 0x40, 0x00, 0x02, 0x1F, 0xA8, 0x03, 0x41, 0x00, 0x02, 0x1F, 0xA9, 0x03, 0x41,
++    0x00, 0x03, 0x1F, 0x68, 0x03, 0x42, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x69, 0x03, 0x42, 0x03, 0x45,
++    0x00, 0x02, 0x1F, 0xB3, 0x03, 0x40, 0x00, 0x02, 0x1F, 0xB3, 0x03, 0x01, 0x00, 0x03, 0x03, 0xB1,
++    0x03, 0x42, 0x03, 0x45, 0x00, 0x02, 0x1F, 0xC3, 0x03, 0x40, 0x00, 0x02, 0x1F, 0xC3, 0x03, 0x01,
++    0x00, 0x03, 0x03, 0xB7, 0x03, 0x42, 0x03, 0x45, 0x00, 0x03, 0x03, 0xB9, 0x03, 0x08, 0x03, 0x00,
++    0x00, 0x03, 0x1F, 0xBE, 0x03, 0x08, 0x03, 0x42, 0x00, 0x03, 0x03, 0xC5, 0x03, 0x08, 0x03, 0x00,
++    0x00, 0x02, 0x1F, 0xF3, 0x03, 0x40, 0x00, 0x02, 0x1F, 0xF3, 0x03, 0x01, 0x00, 0x03, 0x03, 0xC9,
++    0x03, 0x42, 0x03, 0x45, 0x00, 0x02, 0x21, 0x26, 0x03, 0x00, 0x00, 0x01, 0x00, 0x85, 0x03, 0x8F,
++    0x03, 0x90, 0x03, 0xAF, 0x03, 0xB0, 0x1F, 0x02, 0x1F, 0x03, 0x1F, 0x04, 0x1F, 0x05, 0x1F, 0x06,
++    0x1F, 0x0A, 0x1F, 0x0B, 0x1F, 0x0C, 0x1F, 0x0D, 0x1F, 0x0E, 0x1F, 0x12, 0x1F, 0x13, 0x1F, 0x14,
++    0x1F, 0x15, 0x1F, 0x1A, 0x1F, 0x1B, 0x1F, 0x1C, 0x1F, 0x1D, 0x1F, 0x22, 0x1F, 0x23, 0x1F, 0x24,
++    0x1F, 0x25, 0x1F, 0x26, 0x1F, 0x2A, 0x1F, 0x2B, 0x1F, 0x2C, 0x1F, 0x2D, 0x1F, 0x2E, 0x1F, 0x30,
++    0x1F, 0x32, 0x1F, 0x33, 0x1F, 0x34, 0x1F, 0x35, 0x1F, 0x36, 0x1F, 0x37, 0x1F, 0x3A, 0x1F, 0x3B,
++    0x1F, 0x3C, 0x1F, 0x3D, 0x1F, 0x3E, 0x1F, 0x42, 0x1F, 0x43, 0x1F, 0x44, 0x1F, 0x45, 0x1F, 0x4A,
++    0x1F, 0x4B, 0x1F, 0x4C, 0x1F, 0x4D, 0x1F, 0x52, 0x1F, 0x53, 0x1F, 0x54, 0x1F, 0x55, 0x1F, 0x56,
++    0x1F, 0x5B, 0x1F, 0x5D, 0x1F, 0x62, 0x1F, 0x63, 0x1F, 0x64, 0x1F, 0x65, 0x1F, 0x66, 0x1F, 0x68,
++    0x1F, 0x6A, 0x1F, 0x6B, 0x1F, 0x6C, 0x1F, 0x6D, 0x1F, 0x6E, 0x1F, 0x6F, 0x1F, 0x76, 0x1F, 0x80,
++    0x1F, 0x81, 0x1F, 0x82, 0x1F, 0x83, 0x1F, 0x84, 0x1F, 0x85, 0x1F, 0x86, 0x1F, 0x87, 0x1F, 0x88,
++    0x1F, 0x89, 0x1F, 0x8A, 0x1F, 0x8B, 0x1F, 0x8C, 0x1F, 0x8D, 0x1F, 0x8E, 0x1F, 0x8F, 0x1F, 0x90,
++    0x1F, 0x91, 0x1F, 0x92, 0x1F, 0x93, 0x1F, 0x94, 0x1F, 0x95, 0x1F, 0x96, 0x1F, 0x97, 0x1F, 0x98,
++    0x1F, 0x99, 0x1F, 0x9A, 0x1F, 0x9B, 0x1F, 0x9C, 0x1F, 0x9D, 0x1F, 0x9E, 0x1F, 0x9F, 0x1F, 0xA0,
++    0x1F, 0xA1, 0x1F, 0xA2, 0x1F, 0xA3, 0x1F, 0xA4, 0x1F, 0xA5, 0x1F, 0xA6, 0x1F, 0xA7, 0x1F, 0xA8,
++    0x1F, 0xA9, 0x1F, 0xAA, 0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD, 0x1F, 0xAE, 0x1F, 0xAF, 0x1F, 0xB2,
++    0x1F, 0xB4, 0x1F, 0xB7, 0x1F, 0xC2, 0x1F, 0xC4, 0x1F, 0xC7, 0x1F, 0xD2, 0x1F, 0xD7, 0x1F, 0xE2,
++    0x1F, 0xF2, 0x1F, 0xF4, 0x1F, 0xF7, 0x1F, 0xFA, 0x00, 0x01, 0x04, 0xC0, 0x00, 0x7B, 0x00, 0xFC,
++    0x01, 0x02, 0x01, 0x08, 0x01, 0x0E, 0x01, 0x16, 0x01, 0x1E, 0x01, 0x26, 0x01, 0x2E, 0x01, 0x36,
++    0x01, 0x3E, 0x01, 0x46, 0x01, 0x4E, 0x01, 0x56, 0x01, 0x5E, 0x01, 0x66, 0x01, 0x6E, 0x01, 0x76,
++    0x01, 0x7E, 0x01, 0x86, 0x01, 0x8E, 0x01, 0x96, 0x01, 0x9E, 0x01, 0xA6, 0x01, 0xAE, 0x01, 0xB6,
++    0x01, 0xBE, 0x01, 0xC6, 0x01, 0xCE, 0x01, 0xD6, 0x01, 0xDC, 0x01, 0xE4, 0x01, 0xEC, 0x01, 0xF4,
++    0x01, 0xFC, 0x02, 0x04, 0x02, 0x0C, 0x02, 0x14, 0x02, 0x1C, 0x02, 0x24, 0x02, 0x2C, 0x02, 0x34,
++    0x02, 0x3C, 0x02, 0x44, 0x02, 0x4C, 0x02, 0x54, 0x02, 0x5C, 0x02, 0x64, 0x02, 0x6C, 0x02, 0x74,
++    0x02, 0x7C, 0x02, 0x84, 0x02, 0x8C, 0x02, 0x94, 0x02, 0x9C, 0x02, 0xA4, 0x02, 0xAC, 0x02, 0xB4,
++    0x02, 0xBA, 0x02, 0xC2, 0x02, 0xCA, 0x02, 0xD2, 0x02, 0xDA, 0x02, 0xE2, 0x02, 0xE8, 0x02, 0xF0,
++    0x02, 0xF8, 0x03, 0x00, 0x03, 0x08, 0x03, 0x10, 0x03, 0x18, 0x03, 0x20, 0x03, 0x28, 0x03, 0x30,
++    0x03, 0x38, 0x03, 0x40, 0x03, 0x48, 0x03, 0x50, 0x03, 0x58, 0x03, 0x60, 0x03, 0x68, 0x03, 0x70,
++    0x03, 0x78, 0x03, 0x80, 0x03, 0x88, 0x03, 0x90, 0x03, 0x98, 0x03, 0xA0, 0x03, 0xA8, 0x03, 0xB0,
++    0x03, 0xB8, 0x03, 0xC0, 0x03, 0xC8, 0x03, 0xD0, 0x03, 0xD8, 0x03, 0xE0, 0x03, 0xE8, 0x03, 0xF0,
++    0x03, 0xF8, 0x04, 0x00, 0x04, 0x08, 0x04, 0x10, 0x04, 0x18, 0x04, 0x20, 0x04, 0x28, 0x04, 0x30,
++    0x04, 0x38, 0x04, 0x40, 0x04, 0x48, 0x04, 0x50, 0x04, 0x58, 0x04, 0x60, 0x04, 0x68, 0x04, 0x70,
++    0x04, 0x76, 0x04, 0x7E, 0x04, 0x86, 0x04, 0x8C, 0x04, 0x94, 0x04, 0x9C, 0x04, 0xA4, 0x04, 0xAC,
++    0x04, 0xB2, 0x04, 0xBA, 0x00, 0x02, 0x21, 0x26, 0x03, 0x41, 0x00, 0x02, 0x1F, 0xBE, 0x03, 0x44,
++    0x00, 0x02, 0x1F, 0xBE, 0x03, 0x41, 0x00, 0x03, 0x03, 0xC5, 0x03, 0x08, 0x03, 0x01, 0x00, 0x03,
++    0x03, 0xB1, 0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x14, 0x03, 0x40, 0x00, 0x03,
++    0x03, 0xB1, 0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x14, 0x03, 0x41, 0x00, 0x03,
++    0x03, 0x91, 0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x03, 0x91, 0x03, 0x14, 0x03, 0x40, 0x00, 0x03,
++    0x03, 0x91, 0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x03, 0x91, 0x03, 0x14, 0x03, 0x41, 0x00, 0x03,
++    0x03, 0xB5, 0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x03, 0xB5, 0x03, 0x14, 0x03, 0x40, 0x00, 0x03,
++    0x03, 0xB5, 0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x03, 0xB5, 0x03, 0x14, 0x03, 0x41, 0x00, 0x03,
++    0x03, 0x95, 0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x03, 0x95, 0x03, 0x14, 0x03, 0x40, 0x00, 0x03,
++    0x03, 0x95, 0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x03, 0x95, 0x03, 0x14, 0x03, 0x41, 0x00, 0x03,
++    0x03, 0xB7, 0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x14, 0x03, 0x40, 0x00, 0x03,
++    0x03, 0xB7, 0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x14, 0x03, 0x41, 0x00, 0x03,
++    0x03, 0x97, 0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x03, 0x97, 0x03, 0x14, 0x03, 0x40, 0x00, 0x03,
++    0x03, 0x97, 0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x03, 0x97, 0x03, 0x14, 0x03, 0x41, 0x00, 0x02,
++    0x1F, 0xBE, 0x03, 0x43, 0x00, 0x03, 0x03, 0xB9, 0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x03, 0xB9,
++    0x03, 0x14, 0x03, 0x40, 0x00, 0x03, 0x03, 0xB9, 0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x03, 0xB9,
++    0x03, 0x14, 0x03, 0x41, 0x00, 0x03, 0x1F, 0xBE, 0x03, 0x13, 0x03, 0x42, 0x00, 0x03, 0x03, 0x99,
++    0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x03, 0x99, 0x03, 0x14, 0x03, 0x40, 0x00, 0x03, 0x03, 0x99,
++    0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x03, 0x99, 0x03, 0x14, 0x03, 0x41, 0x00, 0x03, 0x03, 0xBF,
++    0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x03, 0xBF, 0x03, 0x14, 0x03, 0x40, 0x00, 0x03, 0x03, 0xBF,
++    0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x03, 0xBF, 0x03, 0x14, 0x03, 0x41, 0x00, 0x03, 0x03, 0x9F,
++    0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x03, 0x9F, 0x03, 0x14, 0x03, 0x40, 0x00, 0x03, 0x03, 0x9F,
++    0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x03, 0x9F, 0x03, 0x14, 0x03, 0x41, 0x00, 0x03, 0x03, 0xC5,
++    0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x03, 0xC5, 0x03, 0x14, 0x03, 0x40, 0x00, 0x03, 0x03, 0xC5,
++    0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x03, 0xC5, 0x03, 0x14, 0x03, 0x41, 0x00, 0x03, 0x03, 0xA5,
++    0x03, 0x14, 0x03, 0x40, 0x00, 0x03, 0x03, 0xA5, 0x03, 0x14, 0x03, 0x41, 0x00, 0x03, 0x03, 0xC9,
++    0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x14, 0x03, 0x40, 0x00, 0x03, 0x03, 0xC9,
++    0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x14, 0x03, 0x41, 0x00, 0x02, 0x21, 0x26,
++    0x03, 0x43, 0x00, 0x03, 0x03, 0xA9, 0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x03, 0xA9, 0x03, 0x14,
++    0x03, 0x40, 0x00, 0x03, 0x03, 0xA9, 0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x03, 0xA9, 0x03, 0x14,
++    0x03, 0x41, 0x00, 0x03, 0x21, 0x26, 0x03, 0x13, 0x03, 0x42, 0x00, 0x02, 0x1F, 0xBE, 0x03, 0x40,
++    0x00, 0x03, 0x03, 0xB1, 0x03, 0x13, 0x03, 0x45, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x45, 0x03, 0x14,
++    0x00, 0x03, 0x1F, 0x00, 0x03, 0x00, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x01, 0x03, 0x00, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0x00, 0x03, 0x01, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x01, 0x03, 0x01, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0x00, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03, 0x1F, 0x01, 0x03, 0x45, 0x03, 0x42,
++    0x00, 0x03, 0x03, 0x91, 0x03, 0x13, 0x03, 0x45, 0x00, 0x03, 0x03, 0x91, 0x03, 0x45, 0x03, 0x14,
++    0x00, 0x03, 0x1F, 0x08, 0x03, 0x00, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x09, 0x03, 0x00, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0x08, 0x03, 0x01, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x09, 0x03, 0x01, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0x08, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03, 0x1F, 0x09, 0x03, 0x45, 0x03, 0x42,
++    0x00, 0x03, 0x03, 0xB7, 0x03, 0x13, 0x03, 0x45, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x45, 0x03, 0x14,
++    0x00, 0x03, 0x1F, 0x20, 0x03, 0x00, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x21, 0x03, 0x00, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0x20, 0x03, 0x01, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x21, 0x03, 0x01, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0x20, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03, 0x1F, 0x21, 0x03, 0x45, 0x03, 0x42,
++    0x00, 0x03, 0x03, 0x97, 0x03, 0x13, 0x03, 0x45, 0x00, 0x03, 0x03, 0x97, 0x03, 0x45, 0x03, 0x14,
++    0x00, 0x03, 0x1F, 0x28, 0x03, 0x00, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x29, 0x03, 0x00, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0x28, 0x03, 0x01, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x29, 0x03, 0x01, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0x28, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03, 0x1F, 0x29, 0x03, 0x45, 0x03, 0x42,
++    0x00, 0x03, 0x03, 0xC9, 0x03, 0x13, 0x03, 0x45, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x14,
++    0x00, 0x03, 0x1F, 0x60, 0x03, 0x00, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x61, 0x03, 0x00, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0x60, 0x03, 0x01, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x61, 0x03, 0x01, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0x60, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03, 0x1F, 0x61, 0x03, 0x45, 0x03, 0x42,
++    0x00, 0x03, 0x03, 0xA9, 0x03, 0x13, 0x03, 0x45, 0x00, 0x03, 0x03, 0xA9, 0x03, 0x45, 0x03, 0x14,
++    0x00, 0x03, 0x1F, 0x68, 0x03, 0x00, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x69, 0x03, 0x00, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0x68, 0x03, 0x01, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x69, 0x03, 0x01, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0x68, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03, 0x1F, 0x69, 0x03, 0x45, 0x03, 0x42,
++    0x00, 0x03, 0x03, 0xB1, 0x03, 0x00, 0x03, 0x45, 0x00, 0x02, 0x1F, 0xB3, 0x03, 0x41, 0x00, 0x03,
++    0x03, 0xB1, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x00, 0x03, 0x45, 0x00, 0x02,
++    0x1F, 0xC3, 0x03, 0x41, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03, 0x03, 0xB9,
++    0x03, 0x08, 0x03, 0x40, 0x00, 0x03, 0x03, 0xC5, 0x03, 0x08, 0x03, 0x40, 0x00, 0x03, 0x03, 0xC9,
++    0x03, 0x00, 0x03, 0x45, 0x00, 0x02, 0x1F, 0xF3, 0x03, 0x41, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x45,
++    0x03, 0x42, 0x00, 0x02, 0x21, 0x26, 0x03, 0x40, 0x00, 0x01, 0x00, 0x7B, 0x03, 0x8F, 0x03, 0x90,
++    0x03, 0xAF, 0x03, 0xB0, 0x1F, 0x02, 0x1F, 0x03, 0x1F, 0x04, 0x1F, 0x05, 0x1F, 0x0A, 0x1F, 0x0B,
++    0x1F, 0x0C, 0x1F, 0x0D, 0x1F, 0x12, 0x1F, 0x13, 0x1F, 0x14, 0x1F, 0x15, 0x1F, 0x1A, 0x1F, 0x1B,
++    0x1F, 0x1C, 0x1F, 0x1D, 0x1F, 0x22, 0x1F, 0x23, 0x1F, 0x24, 0x1F, 0x25, 0x1F, 0x2A, 0x1F, 0x2B,
++    0x1F, 0x2C, 0x1F, 0x2D, 0x1F, 0x30, 0x1F, 0x32, 0x1F, 0x33, 0x1F, 0x34, 0x1F, 0x35, 0x1F, 0x36,
++    0x1F, 0x3A, 0x1F, 0x3B, 0x1F, 0x3C, 0x1F, 0x3D, 0x1F, 0x42, 0x1F, 0x43, 0x1F, 0x44, 0x1F, 0x45,
++    0x1F, 0x4A, 0x1F, 0x4B, 0x1F, 0x4C, 0x1F, 0x4D, 0x1F, 0x52, 0x1F, 0x53, 0x1F, 0x54, 0x1F, 0x55,
++    0x1F, 0x5B, 0x1F, 0x5D, 0x1F, 0x62, 0x1F, 0x63, 0x1F, 0x64, 0x1F, 0x65, 0x1F, 0x68, 0x1F, 0x6A,
++    0x1F, 0x6B, 0x1F, 0x6C, 0x1F, 0x6D, 0x1F, 0x6E, 0x1F, 0x76, 0x1F, 0x80, 0x1F, 0x81, 0x1F, 0x82,
+     0x1F, 0x83, 0x1F, 0x84, 0x1F, 0x85, 0x1F, 0x86, 0x1F, 0x87, 0x1F, 0x88, 0x1F, 0x89, 0x1F, 0x8A,
+     0x1F, 0x8B, 0x1F, 0x8C, 0x1F, 0x8D, 0x1F, 0x8E, 0x1F, 0x8F, 0x1F, 0x90, 0x1F, 0x91, 0x1F, 0x92,
+     0x1F, 0x93, 0x1F, 0x94, 0x1F, 0x95, 0x1F, 0x96, 0x1F, 0x97, 0x1F, 0x98, 0x1F, 0x99, 0x1F, 0x9A,
+     0x1F, 0x9B, 0x1F, 0x9C, 0x1F, 0x9D, 0x1F, 0x9E, 0x1F, 0x9F, 0x1F, 0xA0, 0x1F, 0xA1, 0x1F, 0xA2,
+     0x1F, 0xA3, 0x1F, 0xA4, 0x1F, 0xA5, 0x1F, 0xA6, 0x1F, 0xA7, 0x1F, 0xA8, 0x1F, 0xA9, 0x1F, 0xAA,
+     0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD, 0x1F, 0xAE, 0x1F, 0xAF, 0x1F, 0xB2, 0x1F, 0xB4, 0x1F, 0xB7,
+-    0x1F, 0xC2, 0x1F, 0xC4, 0x1F, 0xC7, 0x1F, 0xD2, 0x1F, 0xD3, 0x1F, 0xE2, 0x1F, 0xE3, 0x1F, 0xF2,
+-    0x1F, 0xF4, 0x1F, 0xF7, 0x1F, 0xFA, 0x1F, 0xFB, 0x00, 0x01, 0x03, 0x62, 0x00, 0x56, 0x00, 0xB2,
+-    0x00, 0xBA, 0x00, 0xC2, 0x00, 0xCA, 0x00, 0xD2, 0x00, 0xDA, 0x00, 0xE2, 0x00, 0xEA, 0x00, 0xF2,
+-    0x00, 0xFA, 0x01, 0x02, 0x01, 0x0A, 0x01, 0x12, 0x01, 0x1A, 0x01, 0x22, 0x01, 0x2A, 0x01, 0x32,
+-    0x01, 0x3A, 0x01, 0x42, 0x01, 0x4A, 0x01, 0x52, 0x01, 0x5A, 0x01, 0x62, 0x01, 0x6A, 0x01, 0x72,
+-    0x01, 0x7A, 0x01, 0x82, 0x01, 0x8A, 0x01, 0x92, 0x01, 0x9A, 0x01, 0xA2, 0x01, 0xAA, 0x01, 0xB2,
+-    0x01, 0xBA, 0x01, 0xC2, 0x01, 0xCA, 0x01, 0xD2, 0x01, 0xDA, 0x01, 0xE2, 0x01, 0xEA, 0x01, 0xF2,
+-    0x01, 0xFA, 0x02, 0x02, 0x02, 0x0A, 0x02, 0x12, 0x02, 0x1A, 0x02, 0x22, 0x02, 0x2A, 0x02, 0x32,
+-    0x02, 0x3A, 0x02, 0x42, 0x02, 0x4A, 0x02, 0x52, 0x02, 0x5A, 0x02, 0x62, 0x02, 0x6A, 0x02, 0x72,
+-    0x02, 0x7A, 0x02, 0x82, 0x02, 0x8A, 0x02, 0x92, 0x02, 0x9A, 0x02, 0xA2, 0x02, 0xAA, 0x02, 0xB2,
+-    0x02, 0xBA, 0x02, 0xC2, 0x02, 0xCA, 0x02, 0xD2, 0x02, 0xDA, 0x02, 0xE2, 0x02, 0xEA, 0x02, 0xF2,
+-    0x02, 0xFA, 0x03, 0x02, 0x03, 0x0A, 0x03, 0x12, 0x03, 0x1A, 0x03, 0x22, 0x03, 0x2A, 0x03, 0x32,
+-    0x03, 0x3A, 0x03, 0x42, 0x03, 0x4A, 0x03, 0x52, 0x03, 0x5A, 0x00, 0x03, 0x03, 0xB9, 0x03, 0x08,
+-    0x03, 0x01, 0x00, 0x03, 0x03, 0xC5, 0x03, 0x08, 0x03, 0x41, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x43,
+-    0x03, 0x00, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x43, 0x03, 0x01, 0x00, 0x03, 0x03, 0x91, 0x03, 0x43,
+-    0x03, 0x00, 0x00, 0x03, 0x03, 0x91, 0x03, 0x43, 0x03, 0x01, 0x00, 0x03, 0x03, 0xB5, 0x03, 0x43,
+-    0x03, 0x00, 0x00, 0x03, 0x03, 0xB5, 0x03, 0x43, 0x03, 0x01, 0x00, 0x03, 0x03, 0x95, 0x03, 0x43,
+-    0x03, 0x00, 0x00, 0x03, 0x03, 0x95, 0x03, 0x43, 0x03, 0x01, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x43,
+-    0x03, 0x00, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x43, 0x03, 0x01, 0x00, 0x03, 0x03, 0x97, 0x03, 0x43,
+-    0x03, 0x00, 0x00, 0x03, 0x03, 0x97, 0x03, 0x43, 0x03, 0x01, 0x00, 0x03, 0x03, 0xB9, 0x03, 0x43,
+-    0x03, 0x00, 0x00, 0x03, 0x1F, 0xBE, 0x03, 0x14, 0x03, 0x00, 0x00, 0x03, 0x03, 0xB9, 0x03, 0x43,
+-    0x03, 0x01, 0x00, 0x03, 0x1F, 0xBE, 0x03, 0x14, 0x03, 0x01, 0x00, 0x03, 0x1F, 0xBE, 0x03, 0x43,
+-    0x03, 0x42, 0x00, 0x03, 0x03, 0x99, 0x03, 0x43, 0x03, 0x00, 0x00, 0x03, 0x03, 0x99, 0x03, 0x43,
+-    0x03, 0x01, 0x00, 0x03, 0x03, 0xBF, 0x03, 0x43, 0x03, 0x00, 0x00, 0x03, 0x03, 0xBF, 0x03, 0x43,
+-    0x03, 0x01, 0x00, 0x03, 0x03, 0x9F, 0x03, 0x43, 0x03, 0x00, 0x00, 0x03, 0x03, 0x9F, 0x03, 0x43,
+-    0x03, 0x01, 0x00, 0x03, 0x03, 0xC5, 0x03, 0x43, 0x03, 0x00, 0x00, 0x03, 0x03, 0xC5, 0x03, 0x43,
+-    0x03, 0x01, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x43, 0x03, 0x00, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x43,
+-    0x03, 0x01, 0x00, 0x03, 0x03, 0xA9, 0x03, 0x43, 0x03, 0x00, 0x00, 0x03, 0x21, 0x26, 0x03, 0x14,
+-    0x03, 0x00, 0x00, 0x03, 0x03, 0xA9, 0x03, 0x43, 0x03, 0x01, 0x00, 0x03, 0x21, 0x26, 0x03, 0x14,
+-    0x03, 0x01, 0x00, 0x03, 0x21, 0x26, 0x03, 0x43, 0x03, 0x42, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x43,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0x00, 0x03, 0x40, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x01, 0x03, 0x40,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0x00, 0x03, 0x41, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x01, 0x03, 0x41,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0xB3, 0x03, 0x13, 0x03, 0x42, 0x00, 0x03, 0x1F, 0xB3, 0x03, 0x14,
+-    0x03, 0x42, 0x00, 0x03, 0x03, 0x91, 0x03, 0x43, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x08, 0x03, 0x40,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0x09, 0x03, 0x40, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x08, 0x03, 0x41,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0x09, 0x03, 0x41, 0x03, 0x45, 0x00, 0x03, 0x1F, 0xBC, 0x03, 0x13,
+-    0x03, 0x42, 0x00, 0x03, 0x1F, 0xBC, 0x03, 0x14, 0x03, 0x42, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x43,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0x20, 0x03, 0x40, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x21, 0x03, 0x40,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0x20, 0x03, 0x41, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x21, 0x03, 0x41,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0xC3, 0x03, 0x13, 0x03, 0x42, 0x00, 0x03, 0x1F, 0xC3, 0x03, 0x14,
+-    0x03, 0x42, 0x00, 0x03, 0x03, 0x97, 0x03, 0x43, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x28, 0x03, 0x40,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0x29, 0x03, 0x40, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x28, 0x03, 0x41,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0x29, 0x03, 0x41, 0x03, 0x45, 0x00, 0x03, 0x1F, 0xCC, 0x03, 0x13,
+-    0x03, 0x42, 0x00, 0x03, 0x1F, 0xCC, 0x03, 0x14, 0x03, 0x42, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x43,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0x60, 0x03, 0x40, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x61, 0x03, 0x40,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0x60, 0x03, 0x41, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x61, 0x03, 0x41,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0xF3, 0x03, 0x13, 0x03, 0x42, 0x00, 0x03, 0x1F, 0xF3, 0x03, 0x14,
+-    0x03, 0x42, 0x00, 0x03, 0x03, 0xA9, 0x03, 0x43, 0x03, 0x45, 0x00, 0x03, 0x21, 0x26, 0x03, 0x14,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0x68, 0x03, 0x40, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x69, 0x03, 0x40,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0x68, 0x03, 0x41, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x69, 0x03, 0x41,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0xFC, 0x03, 0x13, 0x03, 0x42, 0x00, 0x03, 0x1F, 0xFC, 0x03, 0x14,
+-    0x03, 0x42, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x40, 0x03, 0x45, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x01,
+-    0x03, 0x45, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x40, 0x03, 0x45, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x01,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0xBE, 0x03, 0x08, 0x03, 0x00, 0x00, 0x03, 0x03, 0xB9, 0x03, 0x08,
+-    0x03, 0x01, 0x00, 0x03, 0x03, 0xC5, 0x03, 0x08, 0x03, 0x41, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x40,
+-    0x03, 0x45, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x01, 0x03, 0x45, 0x00, 0x01, 0x00, 0x56, 0x03, 0x90,
+-    0x03, 0xB0, 0x1F, 0x02, 0x1F, 0x04, 0x1F, 0x0A, 0x1F, 0x0C, 0x1F, 0x12, 0x1F, 0x14, 0x1F, 0x1A,
+-    0x1F, 0x1C, 0x1F, 0x22, 0x1F, 0x24, 0x1F, 0x2A, 0x1F, 0x2C, 0x1F, 0x32, 0x1F, 0x33, 0x1F, 0x34,
+-    0x1F, 0x35, 0x1F, 0x36, 0x1F, 0x3A, 0x1F, 0x3C, 0x1F, 0x42, 0x1F, 0x44, 0x1F, 0x4A, 0x1F, 0x4C,
+-    0x1F, 0x52, 0x1F, 0x54, 0x1F, 0x62, 0x1F, 0x64, 0x1F, 0x6A, 0x1F, 0x6B, 0x1F, 0x6C, 0x1F, 0x6D,
+-    0x1F, 0x6E, 0x1F, 0x80, 0x1F, 0x82, 0x1F, 0x83, 0x1F, 0x84, 0x1F, 0x85, 0x1F, 0x86, 0x1F, 0x87,
+-    0x1F, 0x88, 0x1F, 0x8A, 0x1F, 0x8B, 0x1F, 0x8C, 0x1F, 0x8D, 0x1F, 0x8E, 0x1F, 0x8F, 0x1F, 0x90,
+-    0x1F, 0x92, 0x1F, 0x93, 0x1F, 0x94, 0x1F, 0x95, 0x1F, 0x96, 0x1F, 0x97, 0x1F, 0x98, 0x1F, 0x9A,
+-    0x1F, 0x9B, 0x1F, 0x9C, 0x1F, 0x9D, 0x1F, 0x9E, 0x1F, 0x9F, 0x1F, 0xA0, 0x1F, 0xA2, 0x1F, 0xA3,
+-    0x1F, 0xA4, 0x1F, 0xA5, 0x1F, 0xA6, 0x1F, 0xA7, 0x1F, 0xA8, 0x1F, 0xA9, 0x1F, 0xAA, 0x1F, 0xAB,
+-    0x1F, 0xAC, 0x1F, 0xAD, 0x1F, 0xAE, 0x1F, 0xAF, 0x1F, 0xB2, 0x1F, 0xB4, 0x1F, 0xC2, 0x1F, 0xC4,
+-    0x1F, 0xD2, 0x1F, 0xD3, 0x1F, 0xE3, 0x1F, 0xF2, 0x1F, 0xF4, 0x00, 0x01, 0x03, 0x46, 0x00, 0x52,
+-    0x00, 0xAA, 0x00, 0xB2, 0x00, 0xBA, 0x00, 0xC2, 0x00, 0xCA, 0x00, 0xD2, 0x00, 0xDA, 0x00, 0xE2,
+-    0x00, 0xEA, 0x00, 0xF2, 0x00, 0xFA, 0x01, 0x02, 0x01, 0x0A, 0x01, 0x12, 0x01, 0x1A, 0x01, 0x22,
+-    0x01, 0x2A, 0x01, 0x32, 0x01, 0x3A, 0x01, 0x42, 0x01, 0x4A, 0x01, 0x52, 0x01, 0x5A, 0x01, 0x62,
+-    0x01, 0x6A, 0x01, 0x72, 0x01, 0x7A, 0x01, 0x82, 0x01, 0x8A, 0x01, 0x92, 0x01, 0x9A, 0x01, 0xA2,
+-    0x01, 0xAA, 0x01, 0xB2, 0x01, 0xBA, 0x01, 0xC2, 0x01, 0xCA, 0x01, 0xD2, 0x01, 0xDC, 0x01, 0xE4,
+-    0x01, 0xEC, 0x01, 0xF4, 0x01, 0xFC, 0x02, 0x04, 0x02, 0x0C, 0x02, 0x16, 0x02, 0x1E, 0x02, 0x26,
+-    0x02, 0x2E, 0x02, 0x36, 0x02, 0x3E, 0x02, 0x46, 0x02, 0x50, 0x02, 0x58, 0x02, 0x60, 0x02, 0x68,
+-    0x02, 0x70, 0x02, 0x78, 0x02, 0x80, 0x02, 0x8A, 0x02, 0x92, 0x02, 0x9A, 0x02, 0xA2, 0x02, 0xAA,
+-    0x02, 0xB2, 0x02, 0xBA, 0x02, 0xC4, 0x02, 0xCC, 0x02, 0xD4, 0x02, 0xDC, 0x02, 0xE4, 0x02, 0xEC,
+-    0x02, 0xF4, 0x02, 0xFC, 0x03, 0x06, 0x03, 0x0E, 0x03, 0x16, 0x03, 0x1E, 0x03, 0x26, 0x03, 0x2E,
+-    0x03, 0x36, 0x03, 0x3E, 0x00, 0x03, 0x03, 0xB9, 0x03, 0x08, 0x03, 0x41, 0x00, 0x03, 0x03, 0xB1,
++    0x1F, 0xC2, 0x1F, 0xC4, 0x1F, 0xC7, 0x1F, 0xD2, 0x1F, 0xE2, 0x1F, 0xF2, 0x1F, 0xF4, 0x1F, 0xF7,
++    0x1F, 0xFA, 0x00, 0x01, 0x03, 0x4E, 0x00, 0x54, 0x00, 0xAE, 0x00, 0xB6, 0x00, 0xBE, 0x00, 0xC6,
++    0x00, 0xCE, 0x00, 0xD6, 0x00, 0xDE, 0x00, 0xE6, 0x00, 0xEE, 0x00, 0xF6, 0x00, 0xFE, 0x01, 0x06,
++    0x01, 0x0E, 0x01, 0x16, 0x01, 0x1E, 0x01, 0x26, 0x01, 0x2E, 0x01, 0x36, 0x01, 0x3E, 0x01, 0x46,
++    0x01, 0x4E, 0x01, 0x56, 0x01, 0x5E, 0x01, 0x66, 0x01, 0x6E, 0x01, 0x76, 0x01, 0x7E, 0x01, 0x86,
++    0x01, 0x8E, 0x01, 0x96, 0x01, 0x9E, 0x01, 0xA6, 0x01, 0xAE, 0x01, 0xB6, 0x01, 0xBE, 0x01, 0xC6,
++    0x01, 0xCE, 0x01, 0xD6, 0x01, 0xDE, 0x01, 0xE6, 0x01, 0xEE, 0x01, 0xF6, 0x01, 0xFE, 0x02, 0x06,
++    0x02, 0x0E, 0x02, 0x16, 0x02, 0x1E, 0x02, 0x26, 0x02, 0x2E, 0x02, 0x36, 0x02, 0x3E, 0x02, 0x46,
++    0x02, 0x4E, 0x02, 0x56, 0x02, 0x5E, 0x02, 0x66, 0x02, 0x6E, 0x02, 0x76, 0x02, 0x7E, 0x02, 0x86,
++    0x02, 0x8E, 0x02, 0x96, 0x02, 0x9E, 0x02, 0xA6, 0x02, 0xAE, 0x02, 0xB6, 0x02, 0xBE, 0x02, 0xC6,
++    0x02, 0xCE, 0x02, 0xD6, 0x02, 0xDE, 0x02, 0xE6, 0x02, 0xEE, 0x02, 0xF6, 0x02, 0xFE, 0x03, 0x06,
++    0x03, 0x0E, 0x03, 0x16, 0x03, 0x1E, 0x03, 0x26, 0x03, 0x2E, 0x03, 0x36, 0x03, 0x3E, 0x03, 0x46,
++    0x00, 0x03, 0x03, 0xB9, 0x03, 0x08, 0x03, 0x01, 0x00, 0x03, 0x03, 0xC5, 0x03, 0x08, 0x03, 0x41,
++    0x00, 0x03, 0x03, 0xB1, 0x03, 0x43, 0x03, 0x00, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x43, 0x03, 0x01,
++    0x00, 0x03, 0x03, 0x91, 0x03, 0x43, 0x03, 0x00, 0x00, 0x03, 0x03, 0x91, 0x03, 0x43, 0x03, 0x01,
++    0x00, 0x03, 0x03, 0xB5, 0x03, 0x43, 0x03, 0x00, 0x00, 0x03, 0x03, 0xB5, 0x03, 0x43, 0x03, 0x01,
++    0x00, 0x03, 0x03, 0x95, 0x03, 0x43, 0x03, 0x00, 0x00, 0x03, 0x03, 0x95, 0x03, 0x43, 0x03, 0x01,
++    0x00, 0x03, 0x03, 0xB7, 0x03, 0x43, 0x03, 0x00, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x43, 0x03, 0x01,
++    0x00, 0x03, 0x03, 0x97, 0x03, 0x43, 0x03, 0x00, 0x00, 0x03, 0x03, 0x97, 0x03, 0x43, 0x03, 0x01,
++    0x00, 0x03, 0x03, 0xB9, 0x03, 0x43, 0x03, 0x00, 0x00, 0x03, 0x1F, 0xBE, 0x03, 0x14, 0x03, 0x00,
++    0x00, 0x03, 0x03, 0xB9, 0x03, 0x43, 0x03, 0x01, 0x00, 0x03, 0x1F, 0xBE, 0x03, 0x14, 0x03, 0x01,
++    0x00, 0x03, 0x1F, 0xBE, 0x03, 0x43, 0x03, 0x42, 0x00, 0x03, 0x03, 0x99, 0x03, 0x43, 0x03, 0x00,
++    0x00, 0x03, 0x03, 0x99, 0x03, 0x43, 0x03, 0x01, 0x00, 0x03, 0x03, 0xBF, 0x03, 0x43, 0x03, 0x00,
++    0x00, 0x03, 0x03, 0xBF, 0x03, 0x43, 0x03, 0x01, 0x00, 0x03, 0x03, 0x9F, 0x03, 0x43, 0x03, 0x00,
++    0x00, 0x03, 0x03, 0x9F, 0x03, 0x43, 0x03, 0x01, 0x00, 0x03, 0x03, 0xC5, 0x03, 0x43, 0x03, 0x00,
++    0x00, 0x03, 0x03, 0xC5, 0x03, 0x43, 0x03, 0x01, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x43, 0x03, 0x00,
++    0x00, 0x03, 0x03, 0xC9, 0x03, 0x43, 0x03, 0x01, 0x00, 0x03, 0x03, 0xA9, 0x03, 0x43, 0x03, 0x00,
++    0x00, 0x03, 0x21, 0x26, 0x03, 0x14, 0x03, 0x00, 0x00, 0x03, 0x03, 0xA9, 0x03, 0x43, 0x03, 0x01,
++    0x00, 0x03, 0x21, 0x26, 0x03, 0x14, 0x03, 0x01, 0x00, 0x03, 0x21, 0x26, 0x03, 0x43, 0x03, 0x42,
++    0x00, 0x03, 0x03, 0xB1, 0x03, 0x43, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x00, 0x03, 0x40, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0x01, 0x03, 0x40, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x00, 0x03, 0x41, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0x01, 0x03, 0x41, 0x03, 0x45, 0x00, 0x03, 0x1F, 0xB3, 0x03, 0x13, 0x03, 0x42,
++    0x00, 0x03, 0x1F, 0xB3, 0x03, 0x14, 0x03, 0x42, 0x00, 0x03, 0x03, 0x91, 0x03, 0x43, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0x08, 0x03, 0x40, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x09, 0x03, 0x40, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0x08, 0x03, 0x41, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x09, 0x03, 0x41, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0xBC, 0x03, 0x13, 0x03, 0x42, 0x00, 0x03, 0x1F, 0xBC, 0x03, 0x14, 0x03, 0x42,
++    0x00, 0x03, 0x03, 0xB7, 0x03, 0x43, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x20, 0x03, 0x40, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0x21, 0x03, 0x40, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x20, 0x03, 0x41, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0x21, 0x03, 0x41, 0x03, 0x45, 0x00, 0x03, 0x1F, 0xC3, 0x03, 0x13, 0x03, 0x42,
++    0x00, 0x03, 0x1F, 0xC3, 0x03, 0x14, 0x03, 0x42, 0x00, 0x03, 0x03, 0x97, 0x03, 0x43, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0x28, 0x03, 0x40, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x29, 0x03, 0x40, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0x28, 0x03, 0x41, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x29, 0x03, 0x41, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0xCC, 0x03, 0x13, 0x03, 0x42, 0x00, 0x03, 0x1F, 0xCC, 0x03, 0x14, 0x03, 0x42,
++    0x00, 0x03, 0x03, 0xC9, 0x03, 0x43, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x60, 0x03, 0x40, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0x61, 0x03, 0x40, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x60, 0x03, 0x41, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0x61, 0x03, 0x41, 0x03, 0x45, 0x00, 0x03, 0x1F, 0xF3, 0x03, 0x13, 0x03, 0x42,
++    0x00, 0x03, 0x1F, 0xF3, 0x03, 0x14, 0x03, 0x42, 0x00, 0x03, 0x03, 0xA9, 0x03, 0x43, 0x03, 0x45,
++    0x00, 0x03, 0x21, 0x26, 0x03, 0x14, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x68, 0x03, 0x40, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0x69, 0x03, 0x40, 0x03, 0x45, 0x00, 0x03, 0x1F, 0x68, 0x03, 0x41, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0x69, 0x03, 0x41, 0x03, 0x45, 0x00, 0x03, 0x1F, 0xFC, 0x03, 0x13, 0x03, 0x42,
++    0x00, 0x03, 0x1F, 0xFC, 0x03, 0x14, 0x03, 0x42, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x40, 0x03, 0x45,
++    0x00, 0x03, 0x03, 0xB1, 0x03, 0x01, 0x03, 0x45, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x40, 0x03, 0x45,
++    0x00, 0x03, 0x03, 0xB7, 0x03, 0x01, 0x03, 0x45, 0x00, 0x03, 0x1F, 0xBE, 0x03, 0x08, 0x03, 0x00,
++    0x00, 0x03, 0x03, 0xC9, 0x03, 0x40, 0x03, 0x45, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x01, 0x03, 0x45,
++    0x00, 0x01, 0x00, 0x54, 0x03, 0x90, 0x03, 0xB0, 0x1F, 0x02, 0x1F, 0x04, 0x1F, 0x0A, 0x1F, 0x0C,
++    0x1F, 0x12, 0x1F, 0x14, 0x1F, 0x1A, 0x1F, 0x1C, 0x1F, 0x22, 0x1F, 0x24, 0x1F, 0x2A, 0x1F, 0x2C,
++    0x1F, 0x32, 0x1F, 0x33, 0x1F, 0x34, 0x1F, 0x35, 0x1F, 0x36, 0x1F, 0x3A, 0x1F, 0x3C, 0x1F, 0x42,
++    0x1F, 0x44, 0x1F, 0x4A, 0x1F, 0x4C, 0x1F, 0x52, 0x1F, 0x54, 0x1F, 0x62, 0x1F, 0x64, 0x1F, 0x6A,
++    0x1F, 0x6B, 0x1F, 0x6C, 0x1F, 0x6D, 0x1F, 0x6E, 0x1F, 0x80, 0x1F, 0x82, 0x1F, 0x83, 0x1F, 0x84,
++    0x1F, 0x85, 0x1F, 0x86, 0x1F, 0x87, 0x1F, 0x88, 0x1F, 0x8A, 0x1F, 0x8B, 0x1F, 0x8C, 0x1F, 0x8D,
++    0x1F, 0x8E, 0x1F, 0x8F, 0x1F, 0x90, 0x1F, 0x92, 0x1F, 0x93, 0x1F, 0x94, 0x1F, 0x95, 0x1F, 0x96,
++    0x1F, 0x97, 0x1F, 0x98, 0x1F, 0x9A, 0x1F, 0x9B, 0x1F, 0x9C, 0x1F, 0x9D, 0x1F, 0x9E, 0x1F, 0x9F,
++    0x1F, 0xA0, 0x1F, 0xA2, 0x1F, 0xA3, 0x1F, 0xA4, 0x1F, 0xA5, 0x1F, 0xA6, 0x1F, 0xA7, 0x1F, 0xA8,
++    0x1F, 0xA9, 0x1F, 0xAA, 0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD, 0x1F, 0xAE, 0x1F, 0xAF, 0x1F, 0xB2,
++    0x1F, 0xB4, 0x1F, 0xC2, 0x1F, 0xC4, 0x1F, 0xD2, 0x1F, 0xF2, 0x1F, 0xF4, 0x00, 0x01, 0x03, 0x3C,
++    0x00, 0x51, 0x00, 0xA8, 0x00, 0xB0, 0x00, 0xB8, 0x00, 0xC0, 0x00, 0xC8, 0x00, 0xD0, 0x00, 0xD8,
++    0x00, 0xE0, 0x00, 0xE8, 0x00, 0xF0, 0x00, 0xF8, 0x01, 0x00, 0x01, 0x08, 0x01, 0x10, 0x01, 0x18,
++    0x01, 0x20, 0x01, 0x28, 0x01, 0x30, 0x01, 0x38, 0x01, 0x40, 0x01, 0x48, 0x01, 0x50, 0x01, 0x58,
++    0x01, 0x60, 0x01, 0x68, 0x01, 0x70, 0x01, 0x78, 0x01, 0x80, 0x01, 0x88, 0x01, 0x90, 0x01, 0x98,
++    0x01, 0xA0, 0x01, 0xA8, 0x01, 0xB0, 0x01, 0xB8, 0x01, 0xC0, 0x01, 0xC8, 0x01, 0xD0, 0x01, 0xDA,
++    0x01, 0xE2, 0x01, 0xEA, 0x01, 0xF2, 0x01, 0xFA, 0x02, 0x02, 0x02, 0x0A, 0x02, 0x14, 0x02, 0x1C,
++    0x02, 0x24, 0x02, 0x2C, 0x02, 0x34, 0x02, 0x3C, 0x02, 0x44, 0x02, 0x4E, 0x02, 0x56, 0x02, 0x5E,
++    0x02, 0x66, 0x02, 0x6E, 0x02, 0x76, 0x02, 0x7E, 0x02, 0x88, 0x02, 0x90, 0x02, 0x98, 0x02, 0xA0,
++    0x02, 0xA8, 0x02, 0xB0, 0x02, 0xB8, 0x02, 0xC2, 0x02, 0xCA, 0x02, 0xD2, 0x02, 0xDA, 0x02, 0xE2,
++    0x02, 0xEA, 0x02, 0xF2, 0x02, 0xFA, 0x03, 0x04, 0x03, 0x0C, 0x03, 0x14, 0x03, 0x1C, 0x03, 0x24,
++    0x03, 0x2C, 0x03, 0x34, 0x00, 0x03, 0x03, 0xB9, 0x03, 0x08, 0x03, 0x41, 0x00, 0x03, 0x03, 0xB1,
+     0x03, 0x43, 0x03, 0x40, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x43, 0x03, 0x41, 0x00, 0x03, 0x03, 0x91,
+     0x03, 0x43, 0x03, 0x40, 0x00, 0x03, 0x03, 0x91, 0x03, 0x43, 0x03, 0x41, 0x00, 0x03, 0x03, 0xB5,
+     0x03, 0x43, 0x03, 0x40, 0x00, 0x03, 0x03, 0xB5, 0x03, 0x43, 0x03, 0x41, 0x00, 0x03, 0x03, 0x95,
+@@ -1960,1728 +1911,1637 @@
+     0x1F, 0xFC, 0x03, 0x43, 0x03, 0x42, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x14, 0x03, 0x42, 0x03, 0x45,
+     0x00, 0x03, 0x03, 0xB1, 0x03, 0x45, 0x03, 0x00, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x41, 0x03, 0x45,
+     0x00, 0x03, 0x03, 0xB7, 0x03, 0x45, 0x03, 0x00, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x41, 0x03, 0x45,
+-    0x00, 0x03, 0x1F, 0xBE, 0x03, 0x08, 0x03, 0x40, 0x00, 0x03, 0x03, 0xB9, 0x03, 0x08, 0x03, 0x41,
+-    0x00, 0x03, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x00, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x41, 0x03, 0x45,
+-    0x00, 0x01, 0x00, 0x52, 0x03, 0x90, 0x1F, 0x02, 0x1F, 0x04, 0x1F, 0x0A, 0x1F, 0x0C, 0x1F, 0x12,
+-    0x1F, 0x14, 0x1F, 0x1A, 0x1F, 0x1C, 0x1F, 0x22, 0x1F, 0x24, 0x1F, 0x2A, 0x1F, 0x2C, 0x1F, 0x32,
+-    0x1F, 0x33, 0x1F, 0x34, 0x1F, 0x35, 0x1F, 0x3A, 0x1F, 0x3C, 0x1F, 0x42, 0x1F, 0x44, 0x1F, 0x4A,
+-    0x1F, 0x4C, 0x1F, 0x52, 0x1F, 0x54, 0x1F, 0x62, 0x1F, 0x64, 0x1F, 0x6A, 0x1F, 0x6B, 0x1F, 0x6C,
+-    0x1F, 0x6D, 0x1F, 0x80, 0x1F, 0x82, 0x1F, 0x83, 0x1F, 0x84, 0x1F, 0x85, 0x1F, 0x86, 0x1F, 0x87,
+-    0x1F, 0x88, 0x1F, 0x8A, 0x1F, 0x8B, 0x1F, 0x8C, 0x1F, 0x8D, 0x1F, 0x8E, 0x1F, 0x8F, 0x1F, 0x90,
+-    0x1F, 0x92, 0x1F, 0x93, 0x1F, 0x94, 0x1F, 0x95, 0x1F, 0x96, 0x1F, 0x97, 0x1F, 0x98, 0x1F, 0x9A,
+-    0x1F, 0x9B, 0x1F, 0x9C, 0x1F, 0x9D, 0x1F, 0x9E, 0x1F, 0x9F, 0x1F, 0xA0, 0x1F, 0xA2, 0x1F, 0xA3,
+-    0x1F, 0xA4, 0x1F, 0xA5, 0x1F, 0xA6, 0x1F, 0xA7, 0x1F, 0xA8, 0x1F, 0xA9, 0x1F, 0xAA, 0x1F, 0xAB,
+-    0x1F, 0xAC, 0x1F, 0xAD, 0x1F, 0xAE, 0x1F, 0xAF, 0x1F, 0xB2, 0x1F, 0xB4, 0x1F, 0xC2, 0x1F, 0xC4,
+-    0x1F, 0xD2, 0x1F, 0xD3, 0x1F, 0xF2, 0x1F, 0xF4, 0x00, 0x01, 0x02, 0x3A, 0x00, 0x36, 0x00, 0x72,
+-    0x00, 0x7A, 0x00, 0x82, 0x00, 0x8A, 0x00, 0x92, 0x00, 0x9A, 0x00, 0xA2, 0x00, 0xAA, 0x00, 0xB2,
+-    0x00, 0xBA, 0x00, 0xC2, 0x00, 0xCC, 0x00, 0xD6, 0x00, 0xDE, 0x00, 0xE6, 0x00, 0xEE, 0x00, 0xF6,
+-    0x00, 0xFE, 0x01, 0x08, 0x01, 0x12, 0x01, 0x1A, 0x01, 0x22, 0x01, 0x2A, 0x01, 0x32, 0x01, 0x3A,
+-    0x01, 0x44, 0x01, 0x4E, 0x01, 0x56, 0x01, 0x5E, 0x01, 0x66, 0x01, 0x6E, 0x01, 0x76, 0x01, 0x80,
+-    0x01, 0x8A, 0x01, 0x92, 0x01, 0x9A, 0x01, 0xA2, 0x01, 0xAA, 0x01, 0xB2, 0x01, 0xBC, 0x01, 0xC6,
+-    0x01, 0xCE, 0x01, 0xD6, 0x01, 0xDE, 0x01, 0xE6, 0x01, 0xEE, 0x01, 0xF8, 0x02, 0x02, 0x02, 0x0A,
+-    0x02, 0x12, 0x02, 0x1A, 0x02, 0x22, 0x02, 0x2A, 0x02, 0x32, 0x00, 0x03, 0x1F, 0xBE, 0x03, 0x08,
+-    0x03, 0x01, 0x00, 0x03, 0x1F, 0xBE, 0x03, 0x13, 0x03, 0x00, 0x00, 0x03, 0x1F, 0xBE, 0x03, 0x13,
+-    0x03, 0x01, 0x00, 0x03, 0x21, 0x26, 0x03, 0x13, 0x03, 0x00, 0x00, 0x03, 0x21, 0x26, 0x03, 0x13,
+-    0x03, 0x01, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x45, 0x03, 0x43, 0x00, 0x03, 0x1F, 0x00, 0x03, 0x45,
+-    0x03, 0x40, 0x00, 0x03, 0x1F, 0x01, 0x03, 0x45, 0x03, 0x40, 0x00, 0x03, 0x1F, 0x00, 0x03, 0x45,
+-    0x03, 0x41, 0x00, 0x03, 0x1F, 0x01, 0x03, 0x45, 0x03, 0x41, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x13,
+-    0x03, 0x42, 0x03, 0x45, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x14, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03,
+-    0x03, 0x91, 0x03, 0x45, 0x03, 0x43, 0x00, 0x03, 0x1F, 0x08, 0x03, 0x45, 0x03, 0x40, 0x00, 0x03,
+-    0x1F, 0x09, 0x03, 0x45, 0x03, 0x40, 0x00, 0x03, 0x1F, 0x08, 0x03, 0x45, 0x03, 0x41, 0x00, 0x03,
+-    0x1F, 0x09, 0x03, 0x45, 0x03, 0x41, 0x00, 0x04, 0x03, 0x91, 0x03, 0x13, 0x03, 0x42, 0x03, 0x45,
+-    0x00, 0x04, 0x03, 0x91, 0x03, 0x14, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x45,
+-    0x03, 0x43, 0x00, 0x03, 0x1F, 0x20, 0x03, 0x45, 0x03, 0x40, 0x00, 0x03, 0x1F, 0x21, 0x03, 0x45,
+-    0x03, 0x40, 0x00, 0x03, 0x1F, 0x20, 0x03, 0x45, 0x03, 0x41, 0x00, 0x03, 0x1F, 0x21, 0x03, 0x45,
+-    0x03, 0x41, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x13, 0x03, 0x42, 0x03, 0x45, 0x00, 0x04, 0x03, 0xB7,
+-    0x03, 0x14, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03, 0x03, 0x97, 0x03, 0x45, 0x03, 0x43, 0x00, 0x03,
+-    0x1F, 0x28, 0x03, 0x45, 0x03, 0x40, 0x00, 0x03, 0x1F, 0x29, 0x03, 0x45, 0x03, 0x40, 0x00, 0x03,
+-    0x1F, 0x28, 0x03, 0x45, 0x03, 0x41, 0x00, 0x03, 0x1F, 0x29, 0x03, 0x45, 0x03, 0x41, 0x00, 0x04,
+-    0x03, 0x97, 0x03, 0x13, 0x03, 0x42, 0x03, 0x45, 0x00, 0x04, 0x03, 0x97, 0x03, 0x14, 0x03, 0x45,
+-    0x03, 0x42, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x43, 0x00, 0x03, 0x1F, 0x60, 0x03, 0x45,
+-    0x03, 0x40, 0x00, 0x03, 0x1F, 0x61, 0x03, 0x45, 0x03, 0x40, 0x00, 0x03, 0x1F, 0x60, 0x03, 0x45,
+-    0x03, 0x41, 0x00, 0x03, 0x1F, 0x61, 0x03, 0x45, 0x03, 0x41, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x13,
+-    0x03, 0x42, 0x03, 0x45, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x14, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03,
+-    0x03, 0xA9, 0x03, 0x45, 0x03, 0x43, 0x00, 0x03, 0x1F, 0x68, 0x03, 0x45, 0x03, 0x40, 0x00, 0x03,
+-    0x1F, 0x69, 0x03, 0x45, 0x03, 0x40, 0x00, 0x03, 0x1F, 0x68, 0x03, 0x45, 0x03, 0x41, 0x00, 0x03,
+-    0x1F, 0x69, 0x03, 0x45, 0x03, 0x41, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x13, 0x03, 0x42, 0x03, 0x45,
+-    0x00, 0x04, 0x03, 0xA9, 0x03, 0x14, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x45,
+-    0x03, 0x40, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x45, 0x03, 0x01, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x45,
+-    0x03, 0x40, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x45, 0x03, 0x01, 0x00, 0x03, 0x1F, 0xBE, 0x03, 0x08,
+-    0x03, 0x01, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x40, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x45,
+-    0x03, 0x01, 0x00, 0x01, 0x00, 0x36, 0x03, 0x90, 0x1F, 0x32, 0x1F, 0x34, 0x1F, 0x6A, 0x1F, 0x6C,
+-    0x1F, 0x80, 0x1F, 0x82, 0x1F, 0x83, 0x1F, 0x84, 0x1F, 0x85, 0x1F, 0x86, 0x1F, 0x87, 0x1F, 0x88,
+-    0x1F, 0x8A, 0x1F, 0x8B, 0x1F, 0x8C, 0x1F, 0x8D, 0x1F, 0x8E, 0x1F, 0x8F, 0x1F, 0x90, 0x1F, 0x92,
+-    0x1F, 0x93, 0x1F, 0x94, 0x1F, 0x95, 0x1F, 0x96, 0x1F, 0x97, 0x1F, 0x98, 0x1F, 0x9A, 0x1F, 0x9B,
+-    0x1F, 0x9C, 0x1F, 0x9D, 0x1F, 0x9E, 0x1F, 0x9F, 0x1F, 0xA0, 0x1F, 0xA2, 0x1F, 0xA3, 0x1F, 0xA4,
+-    0x1F, 0xA5, 0x1F, 0xA6, 0x1F, 0xA7, 0x1F, 0xA8, 0x1F, 0xAA, 0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD,
+-    0x1F, 0xAE, 0x1F, 0xAF, 0x1F, 0xB2, 0x1F, 0xB4, 0x1F, 0xC2, 0x1F, 0xC4, 0x1F, 0xD3, 0x1F, 0xF2,
+-    0x1F, 0xF4, 0x00, 0x01, 0x01, 0xEA, 0x00, 0x2E, 0x00, 0x62, 0x00, 0x6A, 0x00, 0x72, 0x00, 0x7A,
+-    0x00, 0x82, 0x00, 0x8A, 0x00, 0x92, 0x00, 0x9A, 0x00, 0xA2, 0x00, 0xAA, 0x00, 0xB4, 0x00, 0xBE,
+-    0x00, 0xC6, 0x00, 0xCE, 0x00, 0xD6, 0x00, 0xDE, 0x00, 0xE8, 0x00, 0xF2, 0x00, 0xFA, 0x01, 0x02,
+-    0x01, 0x0A, 0x01, 0x12, 0x01, 0x1C, 0x01, 0x26, 0x01, 0x2E, 0x01, 0x36, 0x01, 0x3E, 0x01, 0x46,
+-    0x01, 0x50, 0x01, 0x5A, 0x01, 0x62, 0x01, 0x6A, 0x01, 0x72, 0x01, 0x7A, 0x01, 0x84, 0x01, 0x8E,
+-    0x01, 0x96, 0x01, 0x9E, 0x01, 0xA6, 0x01, 0xAE, 0x01, 0xB6, 0x01, 0xC0, 0x01, 0xCA, 0x01, 0xD2,
+-    0x01, 0xDA, 0x01, 0xE2, 0x00, 0x03, 0x1F, 0xBE, 0x03, 0x08, 0x03, 0x41, 0x00, 0x03, 0x1F, 0xBE,
+-    0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x1F, 0xBE, 0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x21, 0x26,
+-    0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x21, 0x26, 0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x1F, 0xB3,
+-    0x03, 0x13, 0x03, 0x00, 0x00, 0x03, 0x1F, 0xB3, 0x03, 0x14, 0x03, 0x00, 0x00, 0x03, 0x1F, 0xB3,
+-    0x03, 0x13, 0x03, 0x01, 0x00, 0x03, 0x1F, 0xB3, 0x03, 0x14, 0x03, 0x01, 0x00, 0x04, 0x03, 0xB1,
+-    0x03, 0x13, 0x03, 0x45, 0x03, 0x42, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x45, 0x03, 0x14, 0x03, 0x42,
+-    0x00, 0x03, 0x1F, 0xBC, 0x03, 0x13, 0x03, 0x00, 0x00, 0x03, 0x1F, 0xBC, 0x03, 0x14, 0x03, 0x00,
+-    0x00, 0x03, 0x1F, 0xBC, 0x03, 0x13, 0x03, 0x01, 0x00, 0x03, 0x1F, 0xBC, 0x03, 0x14, 0x03, 0x01,
+-    0x00, 0x04, 0x03, 0x91, 0x03, 0x13, 0x03, 0x45, 0x03, 0x42, 0x00, 0x04, 0x03, 0x91, 0x03, 0x45,
+-    0x03, 0x14, 0x03, 0x42, 0x00, 0x03, 0x1F, 0xC3, 0x03, 0x13, 0x03, 0x00, 0x00, 0x03, 0x1F, 0xC3,
+-    0x03, 0x14, 0x03, 0x00, 0x00, 0x03, 0x1F, 0xC3, 0x03, 0x13, 0x03, 0x01, 0x00, 0x03, 0x1F, 0xC3,
+-    0x03, 0x14, 0x03, 0x01, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x13, 0x03, 0x45, 0x03, 0x42, 0x00, 0x04,
+-    0x03, 0xB7, 0x03, 0x45, 0x03, 0x14, 0x03, 0x42, 0x00, 0x03, 0x1F, 0xCC, 0x03, 0x13, 0x03, 0x00,
+-    0x00, 0x03, 0x1F, 0xCC, 0x03, 0x14, 0x03, 0x00, 0x00, 0x03, 0x1F, 0xCC, 0x03, 0x13, 0x03, 0x01,
+-    0x00, 0x03, 0x1F, 0xCC, 0x03, 0x14, 0x03, 0x01, 0x00, 0x04, 0x03, 0x97, 0x03, 0x13, 0x03, 0x45,
+-    0x03, 0x42, 0x00, 0x04, 0x03, 0x97, 0x03, 0x45, 0x03, 0x14, 0x03, 0x42, 0x00, 0x03, 0x1F, 0xF3,
+-    0x03, 0x13, 0x03, 0x00, 0x00, 0x03, 0x1F, 0xF3, 0x03, 0x14, 0x03, 0x00, 0x00, 0x03, 0x1F, 0xF3,
+-    0x03, 0x13, 0x03, 0x01, 0x00, 0x03, 0x1F, 0xF3, 0x03, 0x14, 0x03, 0x01, 0x00, 0x04, 0x03, 0xC9,
+-    0x03, 0x13, 0x03, 0x45, 0x03, 0x42, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x14, 0x03, 0x42,
+-    0x00, 0x03, 0x21, 0x26, 0x03, 0x13, 0x03, 0x45, 0x00, 0x03, 0x1F, 0xFC, 0x03, 0x13, 0x03, 0x00,
+-    0x00, 0x03, 0x1F, 0xFC, 0x03, 0x14, 0x03, 0x00, 0x00, 0x03, 0x1F, 0xFC, 0x03, 0x13, 0x03, 0x01,
+-    0x00, 0x03, 0x1F, 0xFC, 0x03, 0x14, 0x03, 0x01, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x13, 0x03, 0x45,
+-    0x03, 0x42, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x45, 0x03, 0x14, 0x03, 0x42, 0x00, 0x03, 0x03, 0xB1,
+-    0x03, 0x45, 0x03, 0x41, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x45, 0x03, 0x41, 0x00, 0x03, 0x1F, 0xBE,
+-    0x03, 0x08, 0x03, 0x41, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x41, 0x00, 0x01, 0x00, 0x2E,
++    0x00, 0x03, 0x1F, 0xBE, 0x03, 0x08, 0x03, 0x40, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x00,
++    0x00, 0x03, 0x03, 0xC9, 0x03, 0x41, 0x03, 0x45, 0x00, 0x01, 0x00, 0x51, 0x03, 0x90, 0x1F, 0x02,
++    0x1F, 0x04, 0x1F, 0x0A, 0x1F, 0x0C, 0x1F, 0x12, 0x1F, 0x14, 0x1F, 0x1A, 0x1F, 0x1C, 0x1F, 0x22,
++    0x1F, 0x24, 0x1F, 0x2A, 0x1F, 0x2C, 0x1F, 0x32, 0x1F, 0x33, 0x1F, 0x34, 0x1F, 0x35, 0x1F, 0x3A,
++    0x1F, 0x3C, 0x1F, 0x42, 0x1F, 0x44, 0x1F, 0x4A, 0x1F, 0x4C, 0x1F, 0x52, 0x1F, 0x54, 0x1F, 0x62,
++    0x1F, 0x64, 0x1F, 0x6A, 0x1F, 0x6B, 0x1F, 0x6C, 0x1F, 0x6D, 0x1F, 0x80, 0x1F, 0x82, 0x1F, 0x83,
++    0x1F, 0x84, 0x1F, 0x85, 0x1F, 0x86, 0x1F, 0x87, 0x1F, 0x88, 0x1F, 0x8A, 0x1F, 0x8B, 0x1F, 0x8C,
++    0x1F, 0x8D, 0x1F, 0x8E, 0x1F, 0x8F, 0x1F, 0x90, 0x1F, 0x92, 0x1F, 0x93, 0x1F, 0x94, 0x1F, 0x95,
++    0x1F, 0x96, 0x1F, 0x97, 0x1F, 0x98, 0x1F, 0x9A, 0x1F, 0x9B, 0x1F, 0x9C, 0x1F, 0x9D, 0x1F, 0x9E,
++    0x1F, 0x9F, 0x1F, 0xA0, 0x1F, 0xA2, 0x1F, 0xA3, 0x1F, 0xA4, 0x1F, 0xA5, 0x1F, 0xA6, 0x1F, 0xA7,
++    0x1F, 0xA8, 0x1F, 0xA9, 0x1F, 0xAA, 0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD, 0x1F, 0xAE, 0x1F, 0xAF,
++    0x1F, 0xB2, 0x1F, 0xB4, 0x1F, 0xC2, 0x1F, 0xC4, 0x1F, 0xD2, 0x1F, 0xF2, 0x1F, 0xF4, 0x00, 0x01,
++    0x02, 0x30, 0x00, 0x35, 0x00, 0x70, 0x00, 0x78, 0x00, 0x80, 0x00, 0x88, 0x00, 0x90, 0x00, 0x98,
++    0x00, 0xA0, 0x00, 0xA8, 0x00, 0xB0, 0x00, 0xB8, 0x00, 0xC0, 0x00, 0xCA, 0x00, 0xD4, 0x00, 0xDC,
++    0x00, 0xE4, 0x00, 0xEC, 0x00, 0xF4, 0x00, 0xFC, 0x01, 0x06, 0x01, 0x10, 0x01, 0x18, 0x01, 0x20,
++    0x01, 0x28, 0x01, 0x30, 0x01, 0x38, 0x01, 0x42, 0x01, 0x4C, 0x01, 0x54, 0x01, 0x5C, 0x01, 0x64,
++    0x01, 0x6C, 0x01, 0x74, 0x01, 0x7E, 0x01, 0x88, 0x01, 0x90, 0x01, 0x98, 0x01, 0xA0, 0x01, 0xA8,
++    0x01, 0xB0, 0x01, 0xBA, 0x01, 0xC4, 0x01, 0xCC, 0x01, 0xD4, 0x01, 0xDC, 0x01, 0xE4, 0x01, 0xEC,
++    0x01, 0xF6, 0x02, 0x00, 0x02, 0x08, 0x02, 0x10, 0x02, 0x18, 0x02, 0x20, 0x02, 0x28, 0x00, 0x03,
++    0x1F, 0xBE, 0x03, 0x08, 0x03, 0x01, 0x00, 0x03, 0x1F, 0xBE, 0x03, 0x13, 0x03, 0x00, 0x00, 0x03,
++    0x1F, 0xBE, 0x03, 0x13, 0x03, 0x01, 0x00, 0x03, 0x21, 0x26, 0x03, 0x13, 0x03, 0x00, 0x00, 0x03,
++    0x21, 0x26, 0x03, 0x13, 0x03, 0x01, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x45, 0x03, 0x43, 0x00, 0x03,
++    0x1F, 0x00, 0x03, 0x45, 0x03, 0x40, 0x00, 0x03, 0x1F, 0x01, 0x03, 0x45, 0x03, 0x40, 0x00, 0x03,
++    0x1F, 0x00, 0x03, 0x45, 0x03, 0x41, 0x00, 0x03, 0x1F, 0x01, 0x03, 0x45, 0x03, 0x41, 0x00, 0x04,
++    0x03, 0xB1, 0x03, 0x13, 0x03, 0x42, 0x03, 0x45, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x14, 0x03, 0x45,
++    0x03, 0x42, 0x00, 0x03, 0x03, 0x91, 0x03, 0x45, 0x03, 0x43, 0x00, 0x03, 0x1F, 0x08, 0x03, 0x45,
++    0x03, 0x40, 0x00, 0x03, 0x1F, 0x09, 0x03, 0x45, 0x03, 0x40, 0x00, 0x03, 0x1F, 0x08, 0x03, 0x45,
++    0x03, 0x41, 0x00, 0x03, 0x1F, 0x09, 0x03, 0x45, 0x03, 0x41, 0x00, 0x04, 0x03, 0x91, 0x03, 0x13,
++    0x03, 0x42, 0x03, 0x45, 0x00, 0x04, 0x03, 0x91, 0x03, 0x14, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03,
++    0x03, 0xB7, 0x03, 0x45, 0x03, 0x43, 0x00, 0x03, 0x1F, 0x20, 0x03, 0x45, 0x03, 0x40, 0x00, 0x03,
++    0x1F, 0x21, 0x03, 0x45, 0x03, 0x40, 0x00, 0x03, 0x1F, 0x20, 0x03, 0x45, 0x03, 0x41, 0x00, 0x03,
++    0x1F, 0x21, 0x03, 0x45, 0x03, 0x41, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x13, 0x03, 0x42, 0x03, 0x45,
++    0x00, 0x04, 0x03, 0xB7, 0x03, 0x14, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03, 0x03, 0x97, 0x03, 0x45,
++    0x03, 0x43, 0x00, 0x03, 0x1F, 0x28, 0x03, 0x45, 0x03, 0x40, 0x00, 0x03, 0x1F, 0x29, 0x03, 0x45,
++    0x03, 0x40, 0x00, 0x03, 0x1F, 0x28, 0x03, 0x45, 0x03, 0x41, 0x00, 0x03, 0x1F, 0x29, 0x03, 0x45,
++    0x03, 0x41, 0x00, 0x04, 0x03, 0x97, 0x03, 0x13, 0x03, 0x42, 0x03, 0x45, 0x00, 0x04, 0x03, 0x97,
++    0x03, 0x14, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x43, 0x00, 0x03,
++    0x1F, 0x60, 0x03, 0x45, 0x03, 0x40, 0x00, 0x03, 0x1F, 0x61, 0x03, 0x45, 0x03, 0x40, 0x00, 0x03,
++    0x1F, 0x60, 0x03, 0x45, 0x03, 0x41, 0x00, 0x03, 0x1F, 0x61, 0x03, 0x45, 0x03, 0x41, 0x00, 0x04,
++    0x03, 0xC9, 0x03, 0x13, 0x03, 0x42, 0x03, 0x45, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x14, 0x03, 0x45,
++    0x03, 0x42, 0x00, 0x03, 0x03, 0xA9, 0x03, 0x45, 0x03, 0x43, 0x00, 0x03, 0x1F, 0x68, 0x03, 0x45,
++    0x03, 0x40, 0x00, 0x03, 0x1F, 0x69, 0x03, 0x45, 0x03, 0x40, 0x00, 0x03, 0x1F, 0x68, 0x03, 0x45,
++    0x03, 0x41, 0x00, 0x03, 0x1F, 0x69, 0x03, 0x45, 0x03, 0x41, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x13,
++    0x03, 0x42, 0x03, 0x45, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x14, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03,
++    0x03, 0xB1, 0x03, 0x45, 0x03, 0x40, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x45, 0x03, 0x01, 0x00, 0x03,
++    0x03, 0xB7, 0x03, 0x45, 0x03, 0x40, 0x00, 0x03, 0x03, 0xB7, 0x03, 0x45, 0x03, 0x01, 0x00, 0x03,
++    0x03, 0xC9, 0x03, 0x45, 0x03, 0x40, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x01, 0x00, 0x01,
++    0x00, 0x35, 0x03, 0x90, 0x1F, 0x32, 0x1F, 0x34, 0x1F, 0x6A, 0x1F, 0x6C, 0x1F, 0x80, 0x1F, 0x82,
++    0x1F, 0x83, 0x1F, 0x84, 0x1F, 0x85, 0x1F, 0x86, 0x1F, 0x87, 0x1F, 0x88, 0x1F, 0x8A, 0x1F, 0x8B,
++    0x1F, 0x8C, 0x1F, 0x8D, 0x1F, 0x8E, 0x1F, 0x8F, 0x1F, 0x90, 0x1F, 0x92, 0x1F, 0x93, 0x1F, 0x94,
++    0x1F, 0x95, 0x1F, 0x96, 0x1F, 0x97, 0x1F, 0x98, 0x1F, 0x9A, 0x1F, 0x9B, 0x1F, 0x9C, 0x1F, 0x9D,
++    0x1F, 0x9E, 0x1F, 0x9F, 0x1F, 0xA0, 0x1F, 0xA2, 0x1F, 0xA3, 0x1F, 0xA4, 0x1F, 0xA5, 0x1F, 0xA6,
++    0x1F, 0xA7, 0x1F, 0xA8, 0x1F, 0xAA, 0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD, 0x1F, 0xAE, 0x1F, 0xAF,
++    0x1F, 0xB2, 0x1F, 0xB4, 0x1F, 0xC2, 0x1F, 0xC4, 0x1F, 0xF2, 0x1F, 0xF4, 0x00, 0x01, 0x01, 0xE0,
++    0x00, 0x2D, 0x00, 0x60, 0x00, 0x68, 0x00, 0x70, 0x00, 0x78, 0x00, 0x80, 0x00, 0x88, 0x00, 0x90,
++    0x00, 0x98, 0x00, 0xA0, 0x00, 0xA8, 0x00, 0xB2, 0x00, 0xBC, 0x00, 0xC4, 0x00, 0xCC, 0x00, 0xD4,
++    0x00, 0xDC, 0x00, 0xE6, 0x00, 0xF0, 0x00, 0xF8, 0x01, 0x00, 0x01, 0x08, 0x01, 0x10, 0x01, 0x1A,
++    0x01, 0x24, 0x01, 0x2C, 0x01, 0x34, 0x01, 0x3C, 0x01, 0x44, 0x01, 0x4E, 0x01, 0x58, 0x01, 0x60,
++    0x01, 0x68, 0x01, 0x70, 0x01, 0x78, 0x01, 0x82, 0x01, 0x8C, 0x01, 0x94, 0x01, 0x9C, 0x01, 0xA4,
++    0x01, 0xAC, 0x01, 0xB4, 0x01, 0xBE, 0x01, 0xC8, 0x01, 0xD0, 0x01, 0xD8, 0x00, 0x03, 0x1F, 0xBE,
++    0x03, 0x08, 0x03, 0x41, 0x00, 0x03, 0x1F, 0xBE, 0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x1F, 0xBE,
++    0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x21, 0x26, 0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x21, 0x26,
++    0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x1F, 0xB3, 0x03, 0x13, 0x03, 0x00, 0x00, 0x03, 0x1F, 0xB3,
++    0x03, 0x14, 0x03, 0x00, 0x00, 0x03, 0x1F, 0xB3, 0x03, 0x13, 0x03, 0x01, 0x00, 0x03, 0x1F, 0xB3,
++    0x03, 0x14, 0x03, 0x01, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x13, 0x03, 0x45, 0x03, 0x42, 0x00, 0x04,
++    0x03, 0xB1, 0x03, 0x45, 0x03, 0x14, 0x03, 0x42, 0x00, 0x03, 0x1F, 0xBC, 0x03, 0x13, 0x03, 0x00,
++    0x00, 0x03, 0x1F, 0xBC, 0x03, 0x14, 0x03, 0x00, 0x00, 0x03, 0x1F, 0xBC, 0x03, 0x13, 0x03, 0x01,
++    0x00, 0x03, 0x1F, 0xBC, 0x03, 0x14, 0x03, 0x01, 0x00, 0x04, 0x03, 0x91, 0x03, 0x13, 0x03, 0x45,
++    0x03, 0x42, 0x00, 0x04, 0x03, 0x91, 0x03, 0x45, 0x03, 0x14, 0x03, 0x42, 0x00, 0x03, 0x1F, 0xC3,
++    0x03, 0x13, 0x03, 0x00, 0x00, 0x03, 0x1F, 0xC3, 0x03, 0x14, 0x03, 0x00, 0x00, 0x03, 0x1F, 0xC3,
++    0x03, 0x13, 0x03, 0x01, 0x00, 0x03, 0x1F, 0xC3, 0x03, 0x14, 0x03, 0x01, 0x00, 0x04, 0x03, 0xB7,
++    0x03, 0x13, 0x03, 0x45, 0x03, 0x42, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x45, 0x03, 0x14, 0x03, 0x42,
++    0x00, 0x03, 0x1F, 0xCC, 0x03, 0x13, 0x03, 0x00, 0x00, 0x03, 0x1F, 0xCC, 0x03, 0x14, 0x03, 0x00,
++    0x00, 0x03, 0x1F, 0xCC, 0x03, 0x13, 0x03, 0x01, 0x00, 0x03, 0x1F, 0xCC, 0x03, 0x14, 0x03, 0x01,
++    0x00, 0x04, 0x03, 0x97, 0x03, 0x13, 0x03, 0x45, 0x03, 0x42, 0x00, 0x04, 0x03, 0x97, 0x03, 0x45,
++    0x03, 0x14, 0x03, 0x42, 0x00, 0x03, 0x1F, 0xF3, 0x03, 0x13, 0x03, 0x00, 0x00, 0x03, 0x1F, 0xF3,
++    0x03, 0x14, 0x03, 0x00, 0x00, 0x03, 0x1F, 0xF3, 0x03, 0x13, 0x03, 0x01, 0x00, 0x03, 0x1F, 0xF3,
++    0x03, 0x14, 0x03, 0x01, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x13, 0x03, 0x45, 0x03, 0x42, 0x00, 0x04,
++    0x03, 0xC9, 0x03, 0x45, 0x03, 0x14, 0x03, 0x42, 0x00, 0x03, 0x21, 0x26, 0x03, 0x13, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0xFC, 0x03, 0x13, 0x03, 0x00, 0x00, 0x03, 0x1F, 0xFC, 0x03, 0x14, 0x03, 0x00,
++    0x00, 0x03, 0x1F, 0xFC, 0x03, 0x13, 0x03, 0x01, 0x00, 0x03, 0x1F, 0xFC, 0x03, 0x14, 0x03, 0x01,
++    0x00, 0x04, 0x03, 0xA9, 0x03, 0x13, 0x03, 0x45, 0x03, 0x42, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x45,
++    0x03, 0x14, 0x03, 0x42, 0x00, 0x03, 0x03, 0xB1, 0x03, 0x45, 0x03, 0x41, 0x00, 0x03, 0x03, 0xB7,
++    0x03, 0x45, 0x03, 0x41, 0x00, 0x03, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x41, 0x00, 0x01, 0x00, 0x2D,
+     0x03, 0x90, 0x1F, 0x32, 0x1F, 0x34, 0x1F, 0x6A, 0x1F, 0x6C, 0x1F, 0x82, 0x1F, 0x83, 0x1F, 0x84,
+     0x1F, 0x85, 0x1F, 0x86, 0x1F, 0x87, 0x1F, 0x8A, 0x1F, 0x8B, 0x1F, 0x8C, 0x1F, 0x8D, 0x1F, 0x8E,
+     0x1F, 0x8F, 0x1F, 0x92, 0x1F, 0x93, 0x1F, 0x94, 0x1F, 0x95, 0x1F, 0x96, 0x1F, 0x97, 0x1F, 0x9A,
+     0x1F, 0x9B, 0x1F, 0x9C, 0x1F, 0x9D, 0x1F, 0x9E, 0x1F, 0x9F, 0x1F, 0xA2, 0x1F, 0xA3, 0x1F, 0xA4,
+     0x1F, 0xA5, 0x1F, 0xA6, 0x1F, 0xA7, 0x1F, 0xA8, 0x1F, 0xAA, 0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD,
+-    0x1F, 0xAE, 0x1F, 0xAF, 0x1F, 0xB4, 0x1F, 0xC4, 0x1F, 0xD3, 0x1F, 0xF4, 0x00, 0x01, 0x01, 0x7C,
+-    0x00, 0x24, 0x00, 0x4E, 0x00, 0x56, 0x00, 0x5E, 0x00, 0x66, 0x00, 0x6E, 0x00, 0x76, 0x00, 0x7E,
+-    0x00, 0x86, 0x00, 0x8E, 0x00, 0x98, 0x00, 0xA0, 0x00, 0xA8, 0x00, 0xB0, 0x00, 0xB8, 0x00, 0xC2,
+-    0x00, 0xCA, 0x00, 0xD2, 0x00, 0xDA, 0x00, 0xE2, 0x00, 0xEC, 0x00, 0xF4, 0x00, 0xFC, 0x01, 0x04,
+-    0x01, 0x0C, 0x01, 0x16, 0x01, 0x1E, 0x01, 0x26, 0x01, 0x2E, 0x01, 0x36, 0x01, 0x40, 0x01, 0x48,
+-    0x01, 0x50, 0x01, 0x58, 0x01, 0x60, 0x01, 0x68, 0x01, 0x72, 0x00, 0x03, 0x1F, 0xBE, 0x03, 0x43,
+-    0x03, 0x00, 0x00, 0x03, 0x1F, 0xBE, 0x03, 0x43, 0x03, 0x01, 0x00, 0x03, 0x21, 0x26, 0x03, 0x43,
+-    0x03, 0x00, 0x00, 0x03, 0x21, 0x26, 0x03, 0x43, 0x03, 0x01, 0x00, 0x03, 0x1F, 0xB3, 0x03, 0x13,
+-    0x03, 0x40, 0x00, 0x03, 0x1F, 0xB3, 0x03, 0x14, 0x03, 0x40, 0x00, 0x03, 0x1F, 0xB3, 0x03, 0x13,
+-    0x03, 0x41, 0x00, 0x03, 0x1F, 0xB3, 0x03, 0x14, 0x03, 0x41, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x43,
+-    0x03, 0x42, 0x03, 0x45, 0x00, 0x03, 0x1F, 0xBC, 0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x1F, 0xBC,
+-    0x03, 0x14, 0x03, 0x40, 0x00, 0x03, 0x1F, 0xBC, 0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x1F, 0xBC,
+-    0x03, 0x14, 0x03, 0x41, 0x00, 0x04, 0x03, 0x91, 0x03, 0x43, 0x03, 0x42, 0x03, 0x45, 0x00, 0x03,
+-    0x1F, 0xC3, 0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x1F, 0xC3, 0x03, 0x14, 0x03, 0x40, 0x00, 0x03,
+-    0x1F, 0xC3, 0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x1F, 0xC3, 0x03, 0x14, 0x03, 0x41, 0x00, 0x04,
+-    0x03, 0xB7, 0x03, 0x43, 0x03, 0x42, 0x03, 0x45, 0x00, 0x03, 0x1F, 0xCC, 0x03, 0x13, 0x03, 0x40,
+-    0x00, 0x03, 0x1F, 0xCC, 0x03, 0x14, 0x03, 0x40, 0x00, 0x03, 0x1F, 0xCC, 0x03, 0x13, 0x03, 0x41,
+-    0x00, 0x03, 0x1F, 0xCC, 0x03, 0x14, 0x03, 0x41, 0x00, 0x04, 0x03, 0x97, 0x03, 0x43, 0x03, 0x42,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0xF3, 0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x1F, 0xF3, 0x03, 0x14,
+-    0x03, 0x40, 0x00, 0x03, 0x1F, 0xF3, 0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x1F, 0xF3, 0x03, 0x14,
+-    0x03, 0x41, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x43, 0x03, 0x42, 0x03, 0x45, 0x00, 0x03, 0x21, 0x26,
+-    0x03, 0x43, 0x03, 0x45, 0x00, 0x03, 0x1F, 0xFC, 0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x1F, 0xFC,
+-    0x03, 0x14, 0x03, 0x40, 0x00, 0x03, 0x1F, 0xFC, 0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x1F, 0xFC,
+-    0x03, 0x14, 0x03, 0x41, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x43, 0x03, 0x42, 0x03, 0x45, 0x00, 0x04,
+-    0x21, 0x26, 0x03, 0x14, 0x03, 0x42, 0x03, 0x45, 0x00, 0x01, 0x00, 0x24, 0x1F, 0x32, 0x1F, 0x34,
+-    0x1F, 0x6A, 0x1F, 0x6C, 0x1F, 0x82, 0x1F, 0x83, 0x1F, 0x84, 0x1F, 0x85, 0x1F, 0x86, 0x1F, 0x8A,
++    0x1F, 0xAE, 0x1F, 0xAF, 0x1F, 0xB4, 0x1F, 0xC4, 0x1F, 0xF4, 0x00, 0x01, 0x01, 0x7C, 0x00, 0x24,
++    0x00, 0x4E, 0x00, 0x56, 0x00, 0x5E, 0x00, 0x66, 0x00, 0x6E, 0x00, 0x76, 0x00, 0x7E, 0x00, 0x86,
++    0x00, 0x8E, 0x00, 0x98, 0x00, 0xA0, 0x00, 0xA8, 0x00, 0xB0, 0x00, 0xB8, 0x00, 0xC2, 0x00, 0xCA,
++    0x00, 0xD2, 0x00, 0xDA, 0x00, 0xE2, 0x00, 0xEC, 0x00, 0xF4, 0x00, 0xFC, 0x01, 0x04, 0x01, 0x0C,
++    0x01, 0x16, 0x01, 0x1E, 0x01, 0x26, 0x01, 0x2E, 0x01, 0x36, 0x01, 0x40, 0x01, 0x48, 0x01, 0x50,
++    0x01, 0x58, 0x01, 0x60, 0x01, 0x68, 0x01, 0x72, 0x00, 0x03, 0x1F, 0xBE, 0x03, 0x43, 0x03, 0x00,
++    0x00, 0x03, 0x1F, 0xBE, 0x03, 0x43, 0x03, 0x01, 0x00, 0x03, 0x21, 0x26, 0x03, 0x43, 0x03, 0x00,
++    0x00, 0x03, 0x21, 0x26, 0x03, 0x43, 0x03, 0x01, 0x00, 0x03, 0x1F, 0xB3, 0x03, 0x13, 0x03, 0x40,
++    0x00, 0x03, 0x1F, 0xB3, 0x03, 0x14, 0x03, 0x40, 0x00, 0x03, 0x1F, 0xB3, 0x03, 0x13, 0x03, 0x41,
++    0x00, 0x03, 0x1F, 0xB3, 0x03, 0x14, 0x03, 0x41, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x43, 0x03, 0x42,
++    0x03, 0x45, 0x00, 0x03, 0x1F, 0xBC, 0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x1F, 0xBC, 0x03, 0x14,
++    0x03, 0x40, 0x00, 0x03, 0x1F, 0xBC, 0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x1F, 0xBC, 0x03, 0x14,
++    0x03, 0x41, 0x00, 0x04, 0x03, 0x91, 0x03, 0x43, 0x03, 0x42, 0x03, 0x45, 0x00, 0x03, 0x1F, 0xC3,
++    0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x1F, 0xC3, 0x03, 0x14, 0x03, 0x40, 0x00, 0x03, 0x1F, 0xC3,
++    0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x1F, 0xC3, 0x03, 0x14, 0x03, 0x41, 0x00, 0x04, 0x03, 0xB7,
++    0x03, 0x43, 0x03, 0x42, 0x03, 0x45, 0x00, 0x03, 0x1F, 0xCC, 0x03, 0x13, 0x03, 0x40, 0x00, 0x03,
++    0x1F, 0xCC, 0x03, 0x14, 0x03, 0x40, 0x00, 0x03, 0x1F, 0xCC, 0x03, 0x13, 0x03, 0x41, 0x00, 0x03,
++    0x1F, 0xCC, 0x03, 0x14, 0x03, 0x41, 0x00, 0x04, 0x03, 0x97, 0x03, 0x43, 0x03, 0x42, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0xF3, 0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x1F, 0xF3, 0x03, 0x14, 0x03, 0x40,
++    0x00, 0x03, 0x1F, 0xF3, 0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x1F, 0xF3, 0x03, 0x14, 0x03, 0x41,
++    0x00, 0x04, 0x03, 0xC9, 0x03, 0x43, 0x03, 0x42, 0x03, 0x45, 0x00, 0x03, 0x21, 0x26, 0x03, 0x43,
++    0x03, 0x45, 0x00, 0x03, 0x1F, 0xFC, 0x03, 0x13, 0x03, 0x40, 0x00, 0x03, 0x1F, 0xFC, 0x03, 0x14,
++    0x03, 0x40, 0x00, 0x03, 0x1F, 0xFC, 0x03, 0x13, 0x03, 0x41, 0x00, 0x03, 0x1F, 0xFC, 0x03, 0x14,
++    0x03, 0x41, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x43, 0x03, 0x42, 0x03, 0x45, 0x00, 0x04, 0x21, 0x26,
++    0x03, 0x14, 0x03, 0x42, 0x03, 0x45, 0x00, 0x01, 0x00, 0x24, 0x1F, 0x32, 0x1F, 0x34, 0x1F, 0x6A,
++    0x1F, 0x6C, 0x1F, 0x82, 0x1F, 0x83, 0x1F, 0x84, 0x1F, 0x85, 0x1F, 0x86, 0x1F, 0x8A, 0x1F, 0x8B,
++    0x1F, 0x8C, 0x1F, 0x8D, 0x1F, 0x8E, 0x1F, 0x92, 0x1F, 0x93, 0x1F, 0x94, 0x1F, 0x95, 0x1F, 0x96,
++    0x1F, 0x9A, 0x1F, 0x9B, 0x1F, 0x9C, 0x1F, 0x9D, 0x1F, 0x9E, 0x1F, 0xA2, 0x1F, 0xA3, 0x1F, 0xA4,
++    0x1F, 0xA5, 0x1F, 0xA6, 0x1F, 0xA8, 0x1F, 0xAA, 0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD, 0x1F, 0xAE,
++    0x1F, 0xAF, 0x00, 0x01, 0x01, 0x94, 0x00, 0x24, 0x00, 0x4E, 0x00, 0x56, 0x00, 0x5E, 0x00, 0x66,
++    0x00, 0x6E, 0x00, 0x76, 0x00, 0x80, 0x00, 0x88, 0x00, 0x92, 0x00, 0x9C, 0x00, 0xA4, 0x00, 0xAE,
++    0x00, 0xB6, 0x00, 0xC0, 0x00, 0xCA, 0x00, 0xD2, 0x00, 0xDC, 0x00, 0xE4, 0x00, 0xEE, 0x00, 0xF8,
++    0x01, 0x00, 0x01, 0x0A, 0x01, 0x12, 0x01, 0x1C, 0x01, 0x26, 0x01, 0x2E, 0x01, 0x38, 0x01, 0x40,
++    0x01, 0x4A, 0x01, 0x54, 0x01, 0x5C, 0x01, 0x64, 0x01, 0x6E, 0x01, 0x76, 0x01, 0x80, 0x01, 0x8A,
++    0x00, 0x03, 0x1F, 0xBE, 0x03, 0x43, 0x03, 0x40, 0x00, 0x03, 0x1F, 0xBE, 0x03, 0x43, 0x03, 0x41,
++    0x00, 0x03, 0x21, 0x26, 0x03, 0x43, 0x03, 0x40, 0x00, 0x03, 0x21, 0x26, 0x03, 0x43, 0x03, 0x41,
++    0x00, 0x03, 0x1F, 0xB3, 0x03, 0x43, 0x03, 0x00, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x14, 0x03, 0x00,
++    0x03, 0x45, 0x00, 0x03, 0x1F, 0xB3, 0x03, 0x43, 0x03, 0x01, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x14,
++    0x03, 0x01, 0x03, 0x45, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x43, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03,
++    0x1F, 0xBC, 0x03, 0x43, 0x03, 0x00, 0x00, 0x04, 0x03, 0x91, 0x03, 0x14, 0x03, 0x00, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0xBC, 0x03, 0x43, 0x03, 0x01, 0x00, 0x04, 0x03, 0x91, 0x03, 0x14, 0x03, 0x01,
++    0x03, 0x45, 0x00, 0x04, 0x03, 0x91, 0x03, 0x43, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03, 0x1F, 0xC3,
++    0x03, 0x43, 0x03, 0x00, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x14, 0x03, 0x00, 0x03, 0x45, 0x00, 0x03,
++    0x1F, 0xC3, 0x03, 0x43, 0x03, 0x01, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x14, 0x03, 0x01, 0x03, 0x45,
++    0x00, 0x04, 0x03, 0xB7, 0x03, 0x43, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03, 0x1F, 0xCC, 0x03, 0x43,
++    0x03, 0x00, 0x00, 0x04, 0x03, 0x97, 0x03, 0x14, 0x03, 0x00, 0x03, 0x45, 0x00, 0x03, 0x1F, 0xCC,
++    0x03, 0x43, 0x03, 0x01, 0x00, 0x04, 0x03, 0x97, 0x03, 0x14, 0x03, 0x01, 0x03, 0x45, 0x00, 0x04,
++    0x03, 0x97, 0x03, 0x43, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03, 0x1F, 0xF3, 0x03, 0x43, 0x03, 0x00,
++    0x00, 0x04, 0x03, 0xC9, 0x03, 0x14, 0x03, 0x00, 0x03, 0x45, 0x00, 0x03, 0x1F, 0xF3, 0x03, 0x43,
++    0x03, 0x01, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x14, 0x03, 0x01, 0x03, 0x45, 0x00, 0x04, 0x03, 0xC9,
++    0x03, 0x43, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03, 0x21, 0x26, 0x03, 0x45, 0x03, 0x13, 0x00, 0x03,
++    0x1F, 0xFC, 0x03, 0x43, 0x03, 0x00, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x14, 0x03, 0x00, 0x03, 0x45,
++    0x00, 0x03, 0x1F, 0xFC, 0x03, 0x43, 0x03, 0x01, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x14, 0x03, 0x01,
++    0x03, 0x45, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x43, 0x03, 0x45, 0x03, 0x42, 0x00, 0x04, 0x21, 0x26,
++    0x03, 0x14, 0x03, 0x45, 0x03, 0x42, 0x00, 0x01, 0x00, 0x24, 0x1F, 0x32, 0x1F, 0x34, 0x1F, 0x6A,
++    0x1F, 0x6C, 0x1F, 0x82, 0x1F, 0x83, 0x1F, 0x84, 0x1F, 0x85, 0x1F, 0x86, 0x1F, 0x8A, 0x1F, 0x8B,
++    0x1F, 0x8C, 0x1F, 0x8D, 0x1F, 0x8E, 0x1F, 0x92, 0x1F, 0x93, 0x1F, 0x94, 0x1F, 0x95, 0x1F, 0x96,
++    0x1F, 0x9A, 0x1F, 0x9B, 0x1F, 0x9C, 0x1F, 0x9D, 0x1F, 0x9E, 0x1F, 0xA2, 0x1F, 0xA3, 0x1F, 0xA4,
++    0x1F, 0xA5, 0x1F, 0xA6, 0x1F, 0xA8, 0x1F, 0xAA, 0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD, 0x1F, 0xAE,
++    0x1F, 0xAF, 0x00, 0x01, 0x01, 0x6C, 0x00, 0x20, 0x00, 0x46, 0x00, 0x4E, 0x00, 0x58, 0x00, 0x60,
++    0x00, 0x6A, 0x00, 0x74, 0x00, 0x7C, 0x00, 0x86, 0x00, 0x8E, 0x00, 0x98, 0x00, 0xA2, 0x00, 0xAA,
++    0x00, 0xB4, 0x00, 0xBC, 0x00, 0xC6, 0x00, 0xD0, 0x00, 0xD8, 0x00, 0xE2, 0x00, 0xEA, 0x00, 0xF4,
++    0x00, 0xFE, 0x01, 0x06, 0x01, 0x10, 0x01, 0x18, 0x01, 0x22, 0x01, 0x2C, 0x01, 0x34, 0x01, 0x3C,
++    0x01, 0x46, 0x01, 0x4E, 0x01, 0x58, 0x01, 0x62, 0x00, 0x03, 0x1F, 0xB3, 0x03, 0x43, 0x03, 0x40,
++    0x00, 0x04, 0x03, 0xB1, 0x03, 0x14, 0x03, 0x40, 0x03, 0x45, 0x00, 0x03, 0x1F, 0xB3, 0x03, 0x43,
++    0x03, 0x41, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x14, 0x03, 0x41, 0x03, 0x45, 0x00, 0x04, 0x03, 0xB1,
++    0x03, 0x45, 0x03, 0x13, 0x03, 0x42, 0x00, 0x03, 0x1F, 0xBC, 0x03, 0x43, 0x03, 0x40, 0x00, 0x04,
++    0x03, 0x91, 0x03, 0x14, 0x03, 0x40, 0x03, 0x45, 0x00, 0x03, 0x1F, 0xBC, 0x03, 0x43, 0x03, 0x41,
++    0x00, 0x04, 0x03, 0x91, 0x03, 0x14, 0x03, 0x41, 0x03, 0x45, 0x00, 0x04, 0x03, 0x91, 0x03, 0x45,
++    0x03, 0x13, 0x03, 0x42, 0x00, 0x03, 0x1F, 0xC3, 0x03, 0x43, 0x03, 0x40, 0x00, 0x04, 0x03, 0xB7,
++    0x03, 0x14, 0x03, 0x40, 0x03, 0x45, 0x00, 0x03, 0x1F, 0xC3, 0x03, 0x43, 0x03, 0x41, 0x00, 0x04,
++    0x03, 0xB7, 0x03, 0x14, 0x03, 0x41, 0x03, 0x45, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x45, 0x03, 0x13,
++    0x03, 0x42, 0x00, 0x03, 0x1F, 0xCC, 0x03, 0x43, 0x03, 0x40, 0x00, 0x04, 0x03, 0x97, 0x03, 0x14,
++    0x03, 0x40, 0x03, 0x45, 0x00, 0x03, 0x1F, 0xCC, 0x03, 0x43, 0x03, 0x41, 0x00, 0x04, 0x03, 0x97,
++    0x03, 0x14, 0x03, 0x41, 0x03, 0x45, 0x00, 0x04, 0x03, 0x97, 0x03, 0x45, 0x03, 0x13, 0x03, 0x42,
++    0x00, 0x03, 0x1F, 0xF3, 0x03, 0x43, 0x03, 0x40, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x14, 0x03, 0x40,
++    0x03, 0x45, 0x00, 0x03, 0x1F, 0xF3, 0x03, 0x43, 0x03, 0x41, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x14,
++    0x03, 0x41, 0x03, 0x45, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x13, 0x03, 0x42, 0x00, 0x03,
++    0x21, 0x26, 0x03, 0x45, 0x03, 0x43, 0x00, 0x03, 0x1F, 0xFC, 0x03, 0x43, 0x03, 0x40, 0x00, 0x04,
++    0x03, 0xA9, 0x03, 0x14, 0x03, 0x40, 0x03, 0x45, 0x00, 0x03, 0x1F, 0xFC, 0x03, 0x43, 0x03, 0x41,
++    0x00, 0x04, 0x03, 0xA9, 0x03, 0x14, 0x03, 0x41, 0x03, 0x45, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x45,
++    0x03, 0x13, 0x03, 0x42, 0x00, 0x04, 0x21, 0x26, 0x03, 0x45, 0x03, 0x14, 0x03, 0x42, 0x00, 0x01,
++    0x00, 0x20, 0x1F, 0x82, 0x1F, 0x83, 0x1F, 0x84, 0x1F, 0x85, 0x1F, 0x86, 0x1F, 0x8A, 0x1F, 0x8B,
++    0x1F, 0x8C, 0x1F, 0x8D, 0x1F, 0x8E, 0x1F, 0x92, 0x1F, 0x93, 0x1F, 0x94, 0x1F, 0x95, 0x1F, 0x96,
++    0x1F, 0x9A, 0x1F, 0x9B, 0x1F, 0x9C, 0x1F, 0x9D, 0x1F, 0x9E, 0x1F, 0xA2, 0x1F, 0xA3, 0x1F, 0xA4,
++    0x1F, 0xA5, 0x1F, 0xA6, 0x1F, 0xA8, 0x1F, 0xAA, 0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD, 0x1F, 0xAE,
++    0x1F, 0xAF, 0x00, 0x01, 0x01, 0x6E, 0x00, 0x1E, 0x00, 0x42, 0x00, 0x4C, 0x00, 0x56, 0x00, 0x60,
++    0x00, 0x6A, 0x00, 0x74, 0x00, 0x7E, 0x00, 0x88, 0x00, 0x92, 0x00, 0x9C, 0x00, 0xA6, 0x00, 0xB0,
++    0x00, 0xBA, 0x00, 0xC4, 0x00, 0xCE, 0x00, 0xD8, 0x00, 0xE2, 0x00, 0xEC, 0x00, 0xF6, 0x01, 0x00,
++    0x01, 0x0A, 0x01, 0x14, 0x01, 0x1E, 0x01, 0x28, 0x01, 0x32, 0x01, 0x3C, 0x01, 0x46, 0x01, 0x50,
++    0x01, 0x5A, 0x01, 0x64, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x13, 0x03, 0x00, 0x03, 0x45, 0x00, 0x04,
++    0x03, 0xB1, 0x03, 0x14, 0x03, 0x45, 0x03, 0x00, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x13, 0x03, 0x01,
++    0x03, 0x45, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x14, 0x03, 0x45, 0x03, 0x01, 0x00, 0x04, 0x03, 0xB1,
++    0x03, 0x45, 0x03, 0x43, 0x03, 0x42, 0x00, 0x04, 0x03, 0x91, 0x03, 0x13, 0x03, 0x00, 0x03, 0x45,
++    0x00, 0x04, 0x03, 0x91, 0x03, 0x14, 0x03, 0x45, 0x03, 0x00, 0x00, 0x04, 0x03, 0x91, 0x03, 0x13,
++    0x03, 0x01, 0x03, 0x45, 0x00, 0x04, 0x03, 0x91, 0x03, 0x14, 0x03, 0x45, 0x03, 0x01, 0x00, 0x04,
++    0x03, 0x91, 0x03, 0x45, 0x03, 0x43, 0x03, 0x42, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x13, 0x03, 0x00,
++    0x03, 0x45, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x14, 0x03, 0x45, 0x03, 0x00, 0x00, 0x04, 0x03, 0xB7,
++    0x03, 0x13, 0x03, 0x01, 0x03, 0x45, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x14, 0x03, 0x45, 0x03, 0x01,
++    0x00, 0x04, 0x03, 0xB7, 0x03, 0x45, 0x03, 0x43, 0x03, 0x42, 0x00, 0x04, 0x03, 0x97, 0x03, 0x13,
++    0x03, 0x00, 0x03, 0x45, 0x00, 0x04, 0x03, 0x97, 0x03, 0x14, 0x03, 0x45, 0x03, 0x00, 0x00, 0x04,
++    0x03, 0x97, 0x03, 0x13, 0x03, 0x01, 0x03, 0x45, 0x00, 0x04, 0x03, 0x97, 0x03, 0x14, 0x03, 0x45,
++    0x03, 0x01, 0x00, 0x04, 0x03, 0x97, 0x03, 0x45, 0x03, 0x43, 0x03, 0x42, 0x00, 0x04, 0x03, 0xC9,
++    0x03, 0x13, 0x03, 0x00, 0x03, 0x45, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x14, 0x03, 0x45, 0x03, 0x00,
++    0x00, 0x04, 0x03, 0xC9, 0x03, 0x13, 0x03, 0x01, 0x03, 0x45, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x14,
++    0x03, 0x45, 0x03, 0x01, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x43, 0x03, 0x42, 0x00, 0x04,
++    0x03, 0xA9, 0x03, 0x13, 0x03, 0x00, 0x03, 0x45, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x14, 0x03, 0x45,
++    0x03, 0x00, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x13, 0x03, 0x01, 0x03, 0x45, 0x00, 0x04, 0x03, 0xA9,
++    0x03, 0x14, 0x03, 0x45, 0x03, 0x01, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x45, 0x03, 0x43, 0x03, 0x42,
++    0x00, 0x01, 0x00, 0x1E, 0x1F, 0x82, 0x1F, 0x83, 0x1F, 0x84, 0x1F, 0x85, 0x1F, 0x86, 0x1F, 0x8A,
+     0x1F, 0x8B, 0x1F, 0x8C, 0x1F, 0x8D, 0x1F, 0x8E, 0x1F, 0x92, 0x1F, 0x93, 0x1F, 0x94, 0x1F, 0x95,
+     0x1F, 0x96, 0x1F, 0x9A, 0x1F, 0x9B, 0x1F, 0x9C, 0x1F, 0x9D, 0x1F, 0x9E, 0x1F, 0xA2, 0x1F, 0xA3,
+-    0x1F, 0xA4, 0x1F, 0xA5, 0x1F, 0xA6, 0x1F, 0xA8, 0x1F, 0xAA, 0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD,
+-    0x1F, 0xAE, 0x1F, 0xAF, 0x00, 0x01, 0x01, 0x94, 0x00, 0x24, 0x00, 0x4E, 0x00, 0x56, 0x00, 0x5E,
+-    0x00, 0x66, 0x00, 0x6E, 0x00, 0x76, 0x00, 0x80, 0x00, 0x88, 0x00, 0x92, 0x00, 0x9C, 0x00, 0xA4,
+-    0x00, 0xAE, 0x00, 0xB6, 0x00, 0xC0, 0x00, 0xCA, 0x00, 0xD2, 0x00, 0xDC, 0x00, 0xE4, 0x00, 0xEE,
+-    0x00, 0xF8, 0x01, 0x00, 0x01, 0x0A, 0x01, 0x12, 0x01, 0x1C, 0x01, 0x26, 0x01, 0x2E, 0x01, 0x38,
+-    0x01, 0x40, 0x01, 0x4A, 0x01, 0x54, 0x01, 0x5C, 0x01, 0x64, 0x01, 0x6E, 0x01, 0x76, 0x01, 0x80,
+-    0x01, 0x8A, 0x00, 0x03, 0x1F, 0xBE, 0x03, 0x43, 0x03, 0x40, 0x00, 0x03, 0x1F, 0xBE, 0x03, 0x43,
+-    0x03, 0x41, 0x00, 0x03, 0x21, 0x26, 0x03, 0x43, 0x03, 0x40, 0x00, 0x03, 0x21, 0x26, 0x03, 0x43,
+-    0x03, 0x41, 0x00, 0x03, 0x1F, 0xB3, 0x03, 0x43, 0x03, 0x00, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x14,
+-    0x03, 0x00, 0x03, 0x45, 0x00, 0x03, 0x1F, 0xB3, 0x03, 0x43, 0x03, 0x01, 0x00, 0x04, 0x03, 0xB1,
+-    0x03, 0x14, 0x03, 0x01, 0x03, 0x45, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x43, 0x03, 0x45, 0x03, 0x42,
+-    0x00, 0x03, 0x1F, 0xBC, 0x03, 0x43, 0x03, 0x00, 0x00, 0x04, 0x03, 0x91, 0x03, 0x14, 0x03, 0x00,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0xBC, 0x03, 0x43, 0x03, 0x01, 0x00, 0x04, 0x03, 0x91, 0x03, 0x14,
+-    0x03, 0x01, 0x03, 0x45, 0x00, 0x04, 0x03, 0x91, 0x03, 0x43, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03,
+-    0x1F, 0xC3, 0x03, 0x43, 0x03, 0x00, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x14, 0x03, 0x00, 0x03, 0x45,
+-    0x00, 0x03, 0x1F, 0xC3, 0x03, 0x43, 0x03, 0x01, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x14, 0x03, 0x01,
+-    0x03, 0x45, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x43, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03, 0x1F, 0xCC,
+-    0x03, 0x43, 0x03, 0x00, 0x00, 0x04, 0x03, 0x97, 0x03, 0x14, 0x03, 0x00, 0x03, 0x45, 0x00, 0x03,
+-    0x1F, 0xCC, 0x03, 0x43, 0x03, 0x01, 0x00, 0x04, 0x03, 0x97, 0x03, 0x14, 0x03, 0x01, 0x03, 0x45,
+-    0x00, 0x04, 0x03, 0x97, 0x03, 0x43, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03, 0x1F, 0xF3, 0x03, 0x43,
+-    0x03, 0x00, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x14, 0x03, 0x00, 0x03, 0x45, 0x00, 0x03, 0x1F, 0xF3,
+-    0x03, 0x43, 0x03, 0x01, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x14, 0x03, 0x01, 0x03, 0x45, 0x00, 0x04,
+-    0x03, 0xC9, 0x03, 0x43, 0x03, 0x45, 0x03, 0x42, 0x00, 0x03, 0x21, 0x26, 0x03, 0x45, 0x03, 0x13,
+-    0x00, 0x03, 0x1F, 0xFC, 0x03, 0x43, 0x03, 0x00, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x14, 0x03, 0x00,
+-    0x03, 0x45, 0x00, 0x03, 0x1F, 0xFC, 0x03, 0x43, 0x03, 0x01, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x14,
+-    0x03, 0x01, 0x03, 0x45, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x43, 0x03, 0x45, 0x03, 0x42, 0x00, 0x04,
+-    0x21, 0x26, 0x03, 0x14, 0x03, 0x45, 0x03, 0x42, 0x00, 0x01, 0x00, 0x24, 0x1F, 0x32, 0x1F, 0x34,
+-    0x1F, 0x6A, 0x1F, 0x6C, 0x1F, 0x82, 0x1F, 0x83, 0x1F, 0x84, 0x1F, 0x85, 0x1F, 0x86, 0x1F, 0x8A,
+-    0x1F, 0x8B, 0x1F, 0x8C, 0x1F, 0x8D, 0x1F, 0x8E, 0x1F, 0x92, 0x1F, 0x93, 0x1F, 0x94, 0x1F, 0x95,
+-    0x1F, 0x96, 0x1F, 0x9A, 0x1F, 0x9B, 0x1F, 0x9C, 0x1F, 0x9D, 0x1F, 0x9E, 0x1F, 0xA2, 0x1F, 0xA3,
+-    0x1F, 0xA4, 0x1F, 0xA5, 0x1F, 0xA6, 0x1F, 0xA8, 0x1F, 0xAA, 0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD,
+-    0x1F, 0xAE, 0x1F, 0xAF, 0x00, 0x01, 0x01, 0x6C, 0x00, 0x20, 0x00, 0x46, 0x00, 0x4E, 0x00, 0x58,
+-    0x00, 0x60, 0x00, 0x6A, 0x00, 0x74, 0x00, 0x7C, 0x00, 0x86, 0x00, 0x8E, 0x00, 0x98, 0x00, 0xA2,
+-    0x00, 0xAA, 0x00, 0xB4, 0x00, 0xBC, 0x00, 0xC6, 0x00, 0xD0, 0x00, 0xD8, 0x00, 0xE2, 0x00, 0xEA,
+-    0x00, 0xF4, 0x00, 0xFE, 0x01, 0x06, 0x01, 0x10, 0x01, 0x18, 0x01, 0x22, 0x01, 0x2C, 0x01, 0x34,
+-    0x01, 0x3C, 0x01, 0x46, 0x01, 0x4E, 0x01, 0x58, 0x01, 0x62, 0x00, 0x03, 0x1F, 0xB3, 0x03, 0x43,
+-    0x03, 0x40, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x14, 0x03, 0x40, 0x03, 0x45, 0x00, 0x03, 0x1F, 0xB3,
+-    0x03, 0x43, 0x03, 0x41, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x14, 0x03, 0x41, 0x03, 0x45, 0x00, 0x04,
+-    0x03, 0xB1, 0x03, 0x45, 0x03, 0x13, 0x03, 0x42, 0x00, 0x03, 0x1F, 0xBC, 0x03, 0x43, 0x03, 0x40,
+-    0x00, 0x04, 0x03, 0x91, 0x03, 0x14, 0x03, 0x40, 0x03, 0x45, 0x00, 0x03, 0x1F, 0xBC, 0x03, 0x43,
+-    0x03, 0x41, 0x00, 0x04, 0x03, 0x91, 0x03, 0x14, 0x03, 0x41, 0x03, 0x45, 0x00, 0x04, 0x03, 0x91,
+-    0x03, 0x45, 0x03, 0x13, 0x03, 0x42, 0x00, 0x03, 0x1F, 0xC3, 0x03, 0x43, 0x03, 0x40, 0x00, 0x04,
+-    0x03, 0xB7, 0x03, 0x14, 0x03, 0x40, 0x03, 0x45, 0x00, 0x03, 0x1F, 0xC3, 0x03, 0x43, 0x03, 0x41,
+-    0x00, 0x04, 0x03, 0xB7, 0x03, 0x14, 0x03, 0x41, 0x03, 0x45, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x45,
+-    0x03, 0x13, 0x03, 0x42, 0x00, 0x03, 0x1F, 0xCC, 0x03, 0x43, 0x03, 0x40, 0x00, 0x04, 0x03, 0x97,
+-    0x03, 0x14, 0x03, 0x40, 0x03, 0x45, 0x00, 0x03, 0x1F, 0xCC, 0x03, 0x43, 0x03, 0x41, 0x00, 0x04,
+-    0x03, 0x97, 0x03, 0x14, 0x03, 0x41, 0x03, 0x45, 0x00, 0x04, 0x03, 0x97, 0x03, 0x45, 0x03, 0x13,
+-    0x03, 0x42, 0x00, 0x03, 0x1F, 0xF3, 0x03, 0x43, 0x03, 0x40, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x14,
+-    0x03, 0x40, 0x03, 0x45, 0x00, 0x03, 0x1F, 0xF3, 0x03, 0x43, 0x03, 0x41, 0x00, 0x04, 0x03, 0xC9,
+-    0x03, 0x14, 0x03, 0x41, 0x03, 0x45, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x13, 0x03, 0x42,
+-    0x00, 0x03, 0x21, 0x26, 0x03, 0x45, 0x03, 0x43, 0x00, 0x03, 0x1F, 0xFC, 0x03, 0x43, 0x03, 0x40,
+-    0x00, 0x04, 0x03, 0xA9, 0x03, 0x14, 0x03, 0x40, 0x03, 0x45, 0x00, 0x03, 0x1F, 0xFC, 0x03, 0x43,
+-    0x03, 0x41, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x14, 0x03, 0x41, 0x03, 0x45, 0x00, 0x04, 0x03, 0xA9,
+-    0x03, 0x45, 0x03, 0x13, 0x03, 0x42, 0x00, 0x04, 0x21, 0x26, 0x03, 0x45, 0x03, 0x14, 0x03, 0x42,
+-    0x00, 0x01, 0x00, 0x20, 0x1F, 0x82, 0x1F, 0x83, 0x1F, 0x84, 0x1F, 0x85, 0x1F, 0x86, 0x1F, 0x8A,
+-    0x1F, 0x8B, 0x1F, 0x8C, 0x1F, 0x8D, 0x1F, 0x8E, 0x1F, 0x92, 0x1F, 0x93, 0x1F, 0x94, 0x1F, 0x95,
+-    0x1F, 0x96, 0x1F, 0x9A, 0x1F, 0x9B, 0x1F, 0x9C, 0x1F, 0x9D, 0x1F, 0x9E, 0x1F, 0xA2, 0x1F, 0xA3,
+-    0x1F, 0xA4, 0x1F, 0xA5, 0x1F, 0xA6, 0x1F, 0xA8, 0x1F, 0xAA, 0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD,
+-    0x1F, 0xAE, 0x1F, 0xAF, 0x00, 0x01, 0x01, 0x6E, 0x00, 0x1E, 0x00, 0x42, 0x00, 0x4C, 0x00, 0x56,
+-    0x00, 0x60, 0x00, 0x6A, 0x00, 0x74, 0x00, 0x7E, 0x00, 0x88, 0x00, 0x92, 0x00, 0x9C, 0x00, 0xA6,
+-    0x00, 0xB0, 0x00, 0xBA, 0x00, 0xC4, 0x00, 0xCE, 0x00, 0xD8, 0x00, 0xE2, 0x00, 0xEC, 0x00, 0xF6,
+-    0x01, 0x00, 0x01, 0x0A, 0x01, 0x14, 0x01, 0x1E, 0x01, 0x28, 0x01, 0x32, 0x01, 0x3C, 0x01, 0x46,
+-    0x01, 0x50, 0x01, 0x5A, 0x01, 0x64, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x13, 0x03, 0x00, 0x03, 0x45,
+-    0x00, 0x04, 0x03, 0xB1, 0x03, 0x14, 0x03, 0x45, 0x03, 0x00, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x13,
+-    0x03, 0x01, 0x03, 0x45, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x14, 0x03, 0x45, 0x03, 0x01, 0x00, 0x04,
+-    0x03, 0xB1, 0x03, 0x45, 0x03, 0x43, 0x03, 0x42, 0x00, 0x04, 0x03, 0x91, 0x03, 0x13, 0x03, 0x00,
+-    0x03, 0x45, 0x00, 0x04, 0x03, 0x91, 0x03, 0x14, 0x03, 0x45, 0x03, 0x00, 0x00, 0x04, 0x03, 0x91,
+-    0x03, 0x13, 0x03, 0x01, 0x03, 0x45, 0x00, 0x04, 0x03, 0x91, 0x03, 0x14, 0x03, 0x45, 0x03, 0x01,
+-    0x00, 0x04, 0x03, 0x91, 0x03, 0x45, 0x03, 0x43, 0x03, 0x42, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x13,
+-    0x03, 0x00, 0x03, 0x45, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x14, 0x03, 0x45, 0x03, 0x00, 0x00, 0x04,
+-    0x03, 0xB7, 0x03, 0x13, 0x03, 0x01, 0x03, 0x45, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x14, 0x03, 0x45,
+-    0x03, 0x01, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x45, 0x03, 0x43, 0x03, 0x42, 0x00, 0x04, 0x03, 0x97,
+-    0x03, 0x13, 0x03, 0x00, 0x03, 0x45, 0x00, 0x04, 0x03, 0x97, 0x03, 0x14, 0x03, 0x45, 0x03, 0x00,
+-    0x00, 0x04, 0x03, 0x97, 0x03, 0x13, 0x03, 0x01, 0x03, 0x45, 0x00, 0x04, 0x03, 0x97, 0x03, 0x14,
+-    0x03, 0x45, 0x03, 0x01, 0x00, 0x04, 0x03, 0x97, 0x03, 0x45, 0x03, 0x43, 0x03, 0x42, 0x00, 0x04,
+-    0x03, 0xC9, 0x03, 0x13, 0x03, 0x00, 0x03, 0x45, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x14, 0x03, 0x45,
+-    0x03, 0x00, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x13, 0x03, 0x01, 0x03, 0x45, 0x00, 0x04, 0x03, 0xC9,
+-    0x03, 0x14, 0x03, 0x45, 0x03, 0x01, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x43, 0x03, 0x42,
+-    0x00, 0x04, 0x03, 0xA9, 0x03, 0x13, 0x03, 0x00, 0x03, 0x45, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x14,
+-    0x03, 0x45, 0x03, 0x00, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x13, 0x03, 0x01, 0x03, 0x45, 0x00, 0x04,
+-    0x03, 0xA9, 0x03, 0x14, 0x03, 0x45, 0x03, 0x01, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x45, 0x03, 0x43,
+-    0x03, 0x42, 0x00, 0x01, 0x00, 0x1E, 0x1F, 0x82, 0x1F, 0x83, 0x1F, 0x84, 0x1F, 0x85, 0x1F, 0x86,
+-    0x1F, 0x8A, 0x1F, 0x8B, 0x1F, 0x8C, 0x1F, 0x8D, 0x1F, 0x8E, 0x1F, 0x92, 0x1F, 0x93, 0x1F, 0x94,
+-    0x1F, 0x95, 0x1F, 0x96, 0x1F, 0x9A, 0x1F, 0x9B, 0x1F, 0x9C, 0x1F, 0x9D, 0x1F, 0x9E, 0x1F, 0xA2,
+-    0x1F, 0xA3, 0x1F, 0xA4, 0x1F, 0xA5, 0x1F, 0xA6, 0x1F, 0xAA, 0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD,
+-    0x1F, 0xAE, 0x00, 0x01, 0x01, 0x32, 0x00, 0x19, 0x00, 0x38, 0x00, 0x42, 0x00, 0x4C, 0x00, 0x56,
+-    0x00, 0x60, 0x00, 0x6A, 0x00, 0x74, 0x00, 0x7E, 0x00, 0x88, 0x00, 0x92, 0x00, 0x9C, 0x00, 0xA6,
+-    0x00, 0xB0, 0x00, 0xBA, 0x00, 0xC4, 0x00, 0xCE, 0x00, 0xD8, 0x00, 0xE2, 0x00, 0xEC, 0x00, 0xF6,
+-    0x01, 0x00, 0x01, 0x0A, 0x01, 0x14, 0x01, 0x1E, 0x01, 0x28, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x13,
+-    0x03, 0x40, 0x03, 0x45, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x14, 0x03, 0x45, 0x03, 0x40, 0x00, 0x04,
+-    0x03, 0xB1, 0x03, 0x13, 0x03, 0x41, 0x03, 0x45, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x14, 0x03, 0x45,
+-    0x03, 0x41, 0x00, 0x04, 0x03, 0x91, 0x03, 0x13, 0x03, 0x40, 0x03, 0x45, 0x00, 0x04, 0x03, 0x91,
+-    0x03, 0x14, 0x03, 0x45, 0x03, 0x40, 0x00, 0x04, 0x03, 0x91, 0x03, 0x13, 0x03, 0x41, 0x03, 0x45,
+-    0x00, 0x04, 0x03, 0x91, 0x03, 0x14, 0x03, 0x45, 0x03, 0x41, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x13,
+-    0x03, 0x40, 0x03, 0x45, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x14, 0x03, 0x45, 0x03, 0x40, 0x00, 0x04,
+-    0x03, 0xB7, 0x03, 0x13, 0x03, 0x41, 0x03, 0x45, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x14, 0x03, 0x45,
+-    0x03, 0x41, 0x00, 0x04, 0x03, 0x97, 0x03, 0x13, 0x03, 0x40, 0x03, 0x45, 0x00, 0x04, 0x03, 0x97,
+-    0x03, 0x14, 0x03, 0x45, 0x03, 0x40, 0x00, 0x04, 0x03, 0x97, 0x03, 0x13, 0x03, 0x41, 0x03, 0x45,
+-    0x00, 0x04, 0x03, 0x97, 0x03, 0x14, 0x03, 0x45, 0x03, 0x41, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x13,
+-    0x03, 0x40, 0x03, 0x45, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x14, 0x03, 0x45, 0x03, 0x40, 0x00, 0x04,
+-    0x03, 0xC9, 0x03, 0x13, 0x03, 0x41, 0x03, 0x45, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x14, 0x03, 0x45,
+-    0x03, 0x41, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x13, 0x03, 0x40, 0x03, 0x45, 0x00, 0x04, 0x03, 0xA9,
+-    0x03, 0x14, 0x03, 0x45, 0x03, 0x40, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x13, 0x03, 0x41, 0x03, 0x45,
+-    0x00, 0x04, 0x03, 0xA9, 0x03, 0x14, 0x03, 0x45, 0x03, 0x41, 0x00, 0x04, 0x21, 0x26, 0x03, 0x13,
+-    0x03, 0x42, 0x03, 0x45, 0x00, 0x01, 0x00, 0x19, 0x1F, 0x82, 0x1F, 0x83, 0x1F, 0x84, 0x1F, 0x85,
+-    0x1F, 0x8A, 0x1F, 0x8B, 0x1F, 0x8C, 0x1F, 0x8D, 0x1F, 0x92, 0x1F, 0x93, 0x1F, 0x94, 0x1F, 0x95,
+-    0x1F, 0x9A, 0x1F, 0x9B, 0x1F, 0x9C, 0x1F, 0x9D, 0x1F, 0xA2, 0x1F, 0xA3, 0x1F, 0xA4, 0x1F, 0xA5,
+-    0x1F, 0xAA, 0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD, 0x1F, 0xAE, 0x00, 0x01, 0x01, 0x32, 0x00, 0x19,
+-    0x00, 0x38, 0x00, 0x42, 0x00, 0x4C, 0x00, 0x56, 0x00, 0x60, 0x00, 0x6A, 0x00, 0x74, 0x00, 0x7E,
+-    0x00, 0x88, 0x00, 0x92, 0x00, 0x9C, 0x00, 0xA6, 0x00, 0xB0, 0x00, 0xBA, 0x00, 0xC4, 0x00, 0xCE,
+-    0x00, 0xD8, 0x00, 0xE2, 0x00, 0xEC, 0x00, 0xF6, 0x01, 0x00, 0x01, 0x0A, 0x01, 0x14, 0x01, 0x1E,
+-    0x01, 0x28, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x13, 0x03, 0x45, 0x03, 0x00, 0x00, 0x04, 0x03, 0xB1,
+-    0x03, 0x45, 0x03, 0x14, 0x03, 0x00, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x13, 0x03, 0x45, 0x03, 0x01,
+-    0x00, 0x04, 0x03, 0xB1, 0x03, 0x45, 0x03, 0x14, 0x03, 0x01, 0x00, 0x04, 0x03, 0x91, 0x03, 0x13,
+-    0x03, 0x45, 0x03, 0x00, 0x00, 0x04, 0x03, 0x91, 0x03, 0x45, 0x03, 0x14, 0x03, 0x00, 0x00, 0x04,
+-    0x03, 0x91, 0x03, 0x13, 0x03, 0x45, 0x03, 0x01, 0x00, 0x04, 0x03, 0x91, 0x03, 0x45, 0x03, 0x14,
+-    0x03, 0x01, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x13, 0x03, 0x45, 0x03, 0x00, 0x00, 0x04, 0x03, 0xB7,
+-    0x03, 0x45, 0x03, 0x14, 0x03, 0x00, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x13, 0x03, 0x45, 0x03, 0x01,
+-    0x00, 0x04, 0x03, 0xB7, 0x03, 0x45, 0x03, 0x14, 0x03, 0x01, 0x00, 0x04, 0x03, 0x97, 0x03, 0x13,
+-    0x03, 0x45, 0x03, 0x00, 0x00, 0x04, 0x03, 0x97, 0x03, 0x45, 0x03, 0x14, 0x03, 0x00, 0x00, 0x04,
+-    0x03, 0x97, 0x03, 0x13, 0x03, 0x45, 0x03, 0x01, 0x00, 0x04, 0x03, 0x97, 0x03, 0x45, 0x03, 0x14,
+-    0x03, 0x01, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x13, 0x03, 0x45, 0x03, 0x00, 0x00, 0x04, 0x03, 0xC9,
+-    0x03, 0x45, 0x03, 0x14, 0x03, 0x00, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x13, 0x03, 0x45, 0x03, 0x01,
+-    0x00, 0x04, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x14, 0x03, 0x01, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x13,
+-    0x03, 0x45, 0x03, 0x00, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x45, 0x03, 0x14, 0x03, 0x00, 0x00, 0x04,
+-    0x03, 0xA9, 0x03, 0x13, 0x03, 0x45, 0x03, 0x01, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x45, 0x03, 0x14,
+-    0x03, 0x01, 0x00, 0x04, 0x21, 0x26, 0x03, 0x13, 0x03, 0x45, 0x03, 0x42, 0x00, 0x01, 0x00, 0x19,
+-    0x1F, 0x82, 0x1F, 0x83, 0x1F, 0x84, 0x1F, 0x85, 0x1F, 0x8A, 0x1F, 0x8B, 0x1F, 0x8C, 0x1F, 0x8D,
+-    0x1F, 0x92, 0x1F, 0x93, 0x1F, 0x94, 0x1F, 0x95, 0x1F, 0x9A, 0x1F, 0x9B, 0x1F, 0x9C, 0x1F, 0x9D,
+-    0x1F, 0xA2, 0x1F, 0xA3, 0x1F, 0xA4, 0x1F, 0xA5, 0x1F, 0xAA, 0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD,
+-    0x1F, 0xAE, 0x00, 0x01, 0x01, 0x32, 0x00, 0x19, 0x00, 0x38, 0x00, 0x42, 0x00, 0x4C, 0x00, 0x56,
+-    0x00, 0x60, 0x00, 0x6A, 0x00, 0x74, 0x00, 0x7E, 0x00, 0x88, 0x00, 0x92, 0x00, 0x9C, 0x00, 0xA6,
+-    0x00, 0xB0, 0x00, 0xBA, 0x00, 0xC4, 0x00, 0xCE, 0x00, 0xD8, 0x00, 0xE2, 0x00, 0xEC, 0x00, 0xF6,
+-    0x01, 0x00, 0x01, 0x0A, 0x01, 0x14, 0x01, 0x1E, 0x01, 0x28, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x13,
+-    0x03, 0x45, 0x03, 0x40, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x45, 0x03, 0x14, 0x03, 0x40, 0x00, 0x04,
+-    0x03, 0xB1, 0x03, 0x13, 0x03, 0x45, 0x03, 0x41, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x45, 0x03, 0x14,
+-    0x03, 0x41, 0x00, 0x04, 0x03, 0x91, 0x03, 0x13, 0x03, 0x45, 0x03, 0x40, 0x00, 0x04, 0x03, 0x91,
+-    0x03, 0x45, 0x03, 0x14, 0x03, 0x40, 0x00, 0x04, 0x03, 0x91, 0x03, 0x13, 0x03, 0x45, 0x03, 0x41,
+-    0x00, 0x04, 0x03, 0x91, 0x03, 0x45, 0x03, 0x14, 0x03, 0x41, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x13,
+-    0x03, 0x45, 0x03, 0x40, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x45, 0x03, 0x14, 0x03, 0x40, 0x00, 0x04,
+-    0x03, 0xB7, 0x03, 0x13, 0x03, 0x45, 0x03, 0x41, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x45, 0x03, 0x14,
+-    0x03, 0x41, 0x00, 0x04, 0x03, 0x97, 0x03, 0x13, 0x03, 0x45, 0x03, 0x40, 0x00, 0x04, 0x03, 0x97,
+-    0x03, 0x45, 0x03, 0x14, 0x03, 0x40, 0x00, 0x04, 0x03, 0x97, 0x03, 0x13, 0x03, 0x45, 0x03, 0x41,
+-    0x00, 0x04, 0x03, 0x97, 0x03, 0x45, 0x03, 0x14, 0x03, 0x41, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x13,
+-    0x03, 0x45, 0x03, 0x40, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x14, 0x03, 0x40, 0x00, 0x04,
+-    0x03, 0xC9, 0x03, 0x13, 0x03, 0x45, 0x03, 0x41, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x14,
+-    0x03, 0x41, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x13, 0x03, 0x45, 0x03, 0x40, 0x00, 0x04, 0x03, 0xA9,
+-    0x03, 0x45, 0x03, 0x14, 0x03, 0x40, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x13, 0x03, 0x45, 0x03, 0x41,
+-    0x00, 0x04, 0x03, 0xA9, 0x03, 0x45, 0x03, 0x14, 0x03, 0x41, 0x00, 0x04, 0x21, 0x26, 0x03, 0x43,
+-    0x03, 0x42, 0x03, 0x45, 0x00, 0x01, 0x00, 0x19, 0x1F, 0x82, 0x1F, 0x83, 0x1F, 0x84, 0x1F, 0x85,
+-    0x1F, 0x8A, 0x1F, 0x8B, 0x1F, 0x8C, 0x1F, 0x8D, 0x1F, 0x92, 0x1F, 0x93, 0x1F, 0x94, 0x1F, 0x95,
+-    0x1F, 0x9A, 0x1F, 0x9B, 0x1F, 0x9C, 0x1F, 0x9D, 0x1F, 0xA2, 0x1F, 0xA3, 0x1F, 0xA4, 0x1F, 0xA5,
+-    0x1F, 0xAA, 0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD, 0x1F, 0xAE, 0x00, 0x01, 0x00, 0xBA, 0x00, 0x0F,
+-    0x00, 0x24, 0x00, 0x2E, 0x00, 0x38, 0x00, 0x42, 0x00, 0x4C, 0x00, 0x56, 0x00, 0x60, 0x00, 0x6A,
+-    0x00, 0x74, 0x00, 0x7E, 0x00, 0x88, 0x00, 0x92, 0x00, 0x9C, 0x00, 0xA6, 0x00, 0xB0, 0x00, 0x04,
+-    0x03, 0xB1, 0x03, 0x43, 0x03, 0x00, 0x03, 0x45, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x43, 0x03, 0x01,
+-    0x03, 0x45, 0x00, 0x04, 0x03, 0x91, 0x03, 0x43, 0x03, 0x00, 0x03, 0x45, 0x00, 0x04, 0x03, 0x91,
+-    0x03, 0x43, 0x03, 0x01, 0x03, 0x45, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x43, 0x03, 0x00, 0x03, 0x45,
+-    0x00, 0x04, 0x03, 0xB7, 0x03, 0x43, 0x03, 0x01, 0x03, 0x45, 0x00, 0x04, 0x03, 0x97, 0x03, 0x43,
+-    0x03, 0x00, 0x03, 0x45, 0x00, 0x04, 0x03, 0x97, 0x03, 0x43, 0x03, 0x01, 0x03, 0x45, 0x00, 0x04,
+-    0x03, 0xC9, 0x03, 0x43, 0x03, 0x00, 0x03, 0x45, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x43, 0x03, 0x01,
+-    0x03, 0x45, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x43, 0x03, 0x00, 0x03, 0x45, 0x00, 0x04, 0x21, 0x26,
+-    0x03, 0x14, 0x03, 0x00, 0x03, 0x45, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x43, 0x03, 0x01, 0x03, 0x45,
+-    0x00, 0x04, 0x21, 0x26, 0x03, 0x14, 0x03, 0x01, 0x03, 0x45, 0x00, 0x04, 0x21, 0x26, 0x03, 0x43,
+-    0x03, 0x45, 0x03, 0x42, 0x00, 0x01, 0x00, 0x0F, 0x1F, 0x82, 0x1F, 0x84, 0x1F, 0x8A, 0x1F, 0x8C,
+-    0x1F, 0x92, 0x1F, 0x94, 0x1F, 0x9A, 0x1F, 0x9C, 0x1F, 0xA2, 0x1F, 0xA4, 0x1F, 0xAA, 0x1F, 0xAB,
+-    0x1F, 0xAC, 0x1F, 0xAD, 0x1F, 0xAE, 0x00, 0x01, 0x00, 0xBA, 0x00, 0x0F, 0x00, 0x24, 0x00, 0x2E,
+-    0x00, 0x38, 0x00, 0x42, 0x00, 0x4C, 0x00, 0x56, 0x00, 0x60, 0x00, 0x6A, 0x00, 0x74, 0x00, 0x7E,
+-    0x00, 0x88, 0x00, 0x92, 0x00, 0x9C, 0x00, 0xA6, 0x00, 0xB0, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x43,
+-    0x03, 0x40, 0x03, 0x45, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x43, 0x03, 0x41, 0x03, 0x45, 0x00, 0x04,
+-    0x03, 0x91, 0x03, 0x43, 0x03, 0x40, 0x03, 0x45, 0x00, 0x04, 0x03, 0x91, 0x03, 0x43, 0x03, 0x41,
+-    0x03, 0x45, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x43, 0x03, 0x40, 0x03, 0x45, 0x00, 0x04, 0x03, 0xB7,
+-    0x03, 0x43, 0x03, 0x41, 0x03, 0x45, 0x00, 0x04, 0x03, 0x97, 0x03, 0x43, 0x03, 0x40, 0x03, 0x45,
+-    0x00, 0x04, 0x03, 0x97, 0x03, 0x43, 0x03, 0x41, 0x03, 0x45, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x43,
+-    0x03, 0x40, 0x03, 0x45, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x43, 0x03, 0x41, 0x03, 0x45, 0x00, 0x04,
+-    0x03, 0xA9, 0x03, 0x43, 0x03, 0x40, 0x03, 0x45, 0x00, 0x04, 0x21, 0x26, 0x03, 0x14, 0x03, 0x40,
+-    0x03, 0x45, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x43, 0x03, 0x41, 0x03, 0x45, 0x00, 0x04, 0x21, 0x26,
+-    0x03, 0x14, 0x03, 0x41, 0x03, 0x45, 0x00, 0x04, 0x21, 0x26, 0x03, 0x45, 0x03, 0x13, 0x03, 0x42,
+-    0x00, 0x01, 0x00, 0x0F, 0x1F, 0x82, 0x1F, 0x84, 0x1F, 0x8A, 0x1F, 0x8C, 0x1F, 0x92, 0x1F, 0x94,
+-    0x1F, 0x9A, 0x1F, 0x9C, 0x1F, 0xA2, 0x1F, 0xA4, 0x1F, 0xAA, 0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD,
+-    0x1F, 0xAE, 0x00, 0x01, 0x00, 0xBA, 0x00, 0x0F, 0x00, 0x24, 0x00, 0x2E, 0x00, 0x38, 0x00, 0x42,
+-    0x00, 0x4C, 0x00, 0x56, 0x00, 0x60, 0x00, 0x6A, 0x00, 0x74, 0x00, 0x7E, 0x00, 0x88, 0x00, 0x92,
+-    0x00, 0x9C, 0x00, 0xA6, 0x00, 0xB0, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x43, 0x03, 0x45, 0x03, 0x00,
+-    0x00, 0x04, 0x03, 0xB1, 0x03, 0x43, 0x03, 0x45, 0x03, 0x01, 0x00, 0x04, 0x03, 0x91, 0x03, 0x43,
+-    0x03, 0x45, 0x03, 0x00, 0x00, 0x04, 0x03, 0x91, 0x03, 0x43, 0x03, 0x45, 0x03, 0x01, 0x00, 0x04,
+-    0x03, 0xB7, 0x03, 0x43, 0x03, 0x45, 0x03, 0x00, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x43, 0x03, 0x45,
+-    0x03, 0x01, 0x00, 0x04, 0x03, 0x97, 0x03, 0x43, 0x03, 0x45, 0x03, 0x00, 0x00, 0x04, 0x03, 0x97,
+-    0x03, 0x43, 0x03, 0x45, 0x03, 0x01, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x43, 0x03, 0x45, 0x03, 0x00,
+-    0x00, 0x04, 0x03, 0xC9, 0x03, 0x43, 0x03, 0x45, 0x03, 0x01, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x43,
+-    0x03, 0x45, 0x03, 0x00, 0x00, 0x04, 0x21, 0x26, 0x03, 0x14, 0x03, 0x45, 0x03, 0x00, 0x00, 0x04,
+-    0x03, 0xA9, 0x03, 0x43, 0x03, 0x45, 0x03, 0x01, 0x00, 0x04, 0x21, 0x26, 0x03, 0x14, 0x03, 0x45,
+-    0x03, 0x01, 0x00, 0x04, 0x21, 0x26, 0x03, 0x45, 0x03, 0x43, 0x03, 0x42, 0x00, 0x01, 0x00, 0x0F,
+-    0x1F, 0x82, 0x1F, 0x84, 0x1F, 0x8A, 0x1F, 0x8C, 0x1F, 0x92, 0x1F, 0x94, 0x1F, 0x9A, 0x1F, 0x9C,
+-    0x1F, 0xA2, 0x1F, 0xA4, 0x1F, 0xAA, 0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD, 0x1F, 0xAE, 0x00, 0x01,
+-    0x00, 0xAE, 0x00, 0x0E, 0x00, 0x22, 0x00, 0x2C, 0x00, 0x36, 0x00, 0x40, 0x00, 0x4A, 0x00, 0x54,
+-    0x00, 0x5E, 0x00, 0x68, 0x00, 0x72, 0x00, 0x7C, 0x00, 0x86, 0x00, 0x90, 0x00, 0x9A, 0x00, 0xA4,
+-    0x00, 0x04, 0x03, 0xB1, 0x03, 0x43, 0x03, 0x45, 0x03, 0x40, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x43,
+-    0x03, 0x45, 0x03, 0x41, 0x00, 0x04, 0x03, 0x91, 0x03, 0x43, 0x03, 0x45, 0x03, 0x40, 0x00, 0x04,
+-    0x03, 0x91, 0x03, 0x43, 0x03, 0x45, 0x03, 0x41, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x43, 0x03, 0x45,
+-    0x03, 0x40, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x43, 0x03, 0x45, 0x03, 0x41, 0x00, 0x04, 0x03, 0x97,
+-    0x03, 0x43, 0x03, 0x45, 0x03, 0x40, 0x00, 0x04, 0x03, 0x97, 0x03, 0x43, 0x03, 0x45, 0x03, 0x41,
+-    0x00, 0x04, 0x03, 0xC9, 0x03, 0x43, 0x03, 0x45, 0x03, 0x40, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x43,
+-    0x03, 0x45, 0x03, 0x41, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x43, 0x03, 0x45, 0x03, 0x40, 0x00, 0x04,
+-    0x21, 0x26, 0x03, 0x14, 0x03, 0x45, 0x03, 0x40, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x43, 0x03, 0x45,
+-    0x03, 0x41, 0x00, 0x04, 0x21, 0x26, 0x03, 0x14, 0x03, 0x45, 0x03, 0x41, 0x00, 0x01, 0x00, 0x0E,
+-    0x1F, 0x82, 0x1F, 0x84, 0x1F, 0x8A, 0x1F, 0x8C, 0x1F, 0x92, 0x1F, 0x94, 0x1F, 0x9A, 0x1F, 0x9C,
+-    0x1F, 0xA2, 0x1F, 0xA4, 0x1F, 0xAA, 0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD, 0x00, 0x01, 0x00, 0xAE,
++    0x1F, 0xA4, 0x1F, 0xA5, 0x1F, 0xA6, 0x1F, 0xAA, 0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD, 0x1F, 0xAE,
++    0x00, 0x01, 0x01, 0x32, 0x00, 0x19, 0x00, 0x38, 0x00, 0x42, 0x00, 0x4C, 0x00, 0x56, 0x00, 0x60,
++    0x00, 0x6A, 0x00, 0x74, 0x00, 0x7E, 0x00, 0x88, 0x00, 0x92, 0x00, 0x9C, 0x00, 0xA6, 0x00, 0xB0,
++    0x00, 0xBA, 0x00, 0xC4, 0x00, 0xCE, 0x00, 0xD8, 0x00, 0xE2, 0x00, 0xEC, 0x00, 0xF6, 0x01, 0x00,
++    0x01, 0x0A, 0x01, 0x14, 0x01, 0x1E, 0x01, 0x28, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x13, 0x03, 0x40,
++    0x03, 0x45, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x14, 0x03, 0x45, 0x03, 0x40, 0x00, 0x04, 0x03, 0xB1,
++    0x03, 0x13, 0x03, 0x41, 0x03, 0x45, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x14, 0x03, 0x45, 0x03, 0x41,
++    0x00, 0x04, 0x03, 0x91, 0x03, 0x13, 0x03, 0x40, 0x03, 0x45, 0x00, 0x04, 0x03, 0x91, 0x03, 0x14,
++    0x03, 0x45, 0x03, 0x40, 0x00, 0x04, 0x03, 0x91, 0x03, 0x13, 0x03, 0x41, 0x03, 0x45, 0x00, 0x04,
++    0x03, 0x91, 0x03, 0x14, 0x03, 0x45, 0x03, 0x41, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x13, 0x03, 0x40,
++    0x03, 0x45, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x14, 0x03, 0x45, 0x03, 0x40, 0x00, 0x04, 0x03, 0xB7,
++    0x03, 0x13, 0x03, 0x41, 0x03, 0x45, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x14, 0x03, 0x45, 0x03, 0x41,
++    0x00, 0x04, 0x03, 0x97, 0x03, 0x13, 0x03, 0x40, 0x03, 0x45, 0x00, 0x04, 0x03, 0x97, 0x03, 0x14,
++    0x03, 0x45, 0x03, 0x40, 0x00, 0x04, 0x03, 0x97, 0x03, 0x13, 0x03, 0x41, 0x03, 0x45, 0x00, 0x04,
++    0x03, 0x97, 0x03, 0x14, 0x03, 0x45, 0x03, 0x41, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x13, 0x03, 0x40,
++    0x03, 0x45, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x14, 0x03, 0x45, 0x03, 0x40, 0x00, 0x04, 0x03, 0xC9,
++    0x03, 0x13, 0x03, 0x41, 0x03, 0x45, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x14, 0x03, 0x45, 0x03, 0x41,
++    0x00, 0x04, 0x03, 0xA9, 0x03, 0x13, 0x03, 0x40, 0x03, 0x45, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x14,
++    0x03, 0x45, 0x03, 0x40, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x13, 0x03, 0x41, 0x03, 0x45, 0x00, 0x04,
++    0x03, 0xA9, 0x03, 0x14, 0x03, 0x45, 0x03, 0x41, 0x00, 0x04, 0x21, 0x26, 0x03, 0x13, 0x03, 0x42,
++    0x03, 0x45, 0x00, 0x01, 0x00, 0x19, 0x1F, 0x82, 0x1F, 0x83, 0x1F, 0x84, 0x1F, 0x85, 0x1F, 0x8A,
++    0x1F, 0x8B, 0x1F, 0x8C, 0x1F, 0x8D, 0x1F, 0x92, 0x1F, 0x93, 0x1F, 0x94, 0x1F, 0x95, 0x1F, 0x9A,
++    0x1F, 0x9B, 0x1F, 0x9C, 0x1F, 0x9D, 0x1F, 0xA2, 0x1F, 0xA3, 0x1F, 0xA4, 0x1F, 0xA5, 0x1F, 0xAA,
++    0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD, 0x1F, 0xAE, 0x00, 0x01, 0x01, 0x32, 0x00, 0x19, 0x00, 0x38,
++    0x00, 0x42, 0x00, 0x4C, 0x00, 0x56, 0x00, 0x60, 0x00, 0x6A, 0x00, 0x74, 0x00, 0x7E, 0x00, 0x88,
++    0x00, 0x92, 0x00, 0x9C, 0x00, 0xA6, 0x00, 0xB0, 0x00, 0xBA, 0x00, 0xC4, 0x00, 0xCE, 0x00, 0xD8,
++    0x00, 0xE2, 0x00, 0xEC, 0x00, 0xF6, 0x01, 0x00, 0x01, 0x0A, 0x01, 0x14, 0x01, 0x1E, 0x01, 0x28,
++    0x00, 0x04, 0x03, 0xB1, 0x03, 0x13, 0x03, 0x45, 0x03, 0x00, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x45,
++    0x03, 0x14, 0x03, 0x00, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x13, 0x03, 0x45, 0x03, 0x01, 0x00, 0x04,
++    0x03, 0xB1, 0x03, 0x45, 0x03, 0x14, 0x03, 0x01, 0x00, 0x04, 0x03, 0x91, 0x03, 0x13, 0x03, 0x45,
++    0x03, 0x00, 0x00, 0x04, 0x03, 0x91, 0x03, 0x45, 0x03, 0x14, 0x03, 0x00, 0x00, 0x04, 0x03, 0x91,
++    0x03, 0x13, 0x03, 0x45, 0x03, 0x01, 0x00, 0x04, 0x03, 0x91, 0x03, 0x45, 0x03, 0x14, 0x03, 0x01,
++    0x00, 0x04, 0x03, 0xB7, 0x03, 0x13, 0x03, 0x45, 0x03, 0x00, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x45,
++    0x03, 0x14, 0x03, 0x00, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x13, 0x03, 0x45, 0x03, 0x01, 0x00, 0x04,
++    0x03, 0xB7, 0x03, 0x45, 0x03, 0x14, 0x03, 0x01, 0x00, 0x04, 0x03, 0x97, 0x03, 0x13, 0x03, 0x45,
++    0x03, 0x00, 0x00, 0x04, 0x03, 0x97, 0x03, 0x45, 0x03, 0x14, 0x03, 0x00, 0x00, 0x04, 0x03, 0x97,
++    0x03, 0x13, 0x03, 0x45, 0x03, 0x01, 0x00, 0x04, 0x03, 0x97, 0x03, 0x45, 0x03, 0x14, 0x03, 0x01,
++    0x00, 0x04, 0x03, 0xC9, 0x03, 0x13, 0x03, 0x45, 0x03, 0x00, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x45,
++    0x03, 0x14, 0x03, 0x00, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x13, 0x03, 0x45, 0x03, 0x01, 0x00, 0x04,
++    0x03, 0xC9, 0x03, 0x45, 0x03, 0x14, 0x03, 0x01, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x13, 0x03, 0x45,
++    0x03, 0x00, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x45, 0x03, 0x14, 0x03, 0x00, 0x00, 0x04, 0x03, 0xA9,
++    0x03, 0x13, 0x03, 0x45, 0x03, 0x01, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x45, 0x03, 0x14, 0x03, 0x01,
++    0x00, 0x04, 0x21, 0x26, 0x03, 0x13, 0x03, 0x45, 0x03, 0x42, 0x00, 0x01, 0x00, 0x19, 0x1F, 0x82,
++    0x1F, 0x83, 0x1F, 0x84, 0x1F, 0x85, 0x1F, 0x8A, 0x1F, 0x8B, 0x1F, 0x8C, 0x1F, 0x8D, 0x1F, 0x92,
++    0x1F, 0x93, 0x1F, 0x94, 0x1F, 0x95, 0x1F, 0x9A, 0x1F, 0x9B, 0x1F, 0x9C, 0x1F, 0x9D, 0x1F, 0xA2,
++    0x1F, 0xA3, 0x1F, 0xA4, 0x1F, 0xA5, 0x1F, 0xAA, 0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD, 0x1F, 0xAE,
++    0x00, 0x01, 0x01, 0x32, 0x00, 0x19, 0x00, 0x38, 0x00, 0x42, 0x00, 0x4C, 0x00, 0x56, 0x00, 0x60,
++    0x00, 0x6A, 0x00, 0x74, 0x00, 0x7E, 0x00, 0x88, 0x00, 0x92, 0x00, 0x9C, 0x00, 0xA6, 0x00, 0xB0,
++    0x00, 0xBA, 0x00, 0xC4, 0x00, 0xCE, 0x00, 0xD8, 0x00, 0xE2, 0x00, 0xEC, 0x00, 0xF6, 0x01, 0x00,
++    0x01, 0x0A, 0x01, 0x14, 0x01, 0x1E, 0x01, 0x28, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x13, 0x03, 0x45,
++    0x03, 0x40, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x45, 0x03, 0x14, 0x03, 0x40, 0x00, 0x04, 0x03, 0xB1,
++    0x03, 0x13, 0x03, 0x45, 0x03, 0x41, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x45, 0x03, 0x14, 0x03, 0x41,
++    0x00, 0x04, 0x03, 0x91, 0x03, 0x13, 0x03, 0x45, 0x03, 0x40, 0x00, 0x04, 0x03, 0x91, 0x03, 0x45,
++    0x03, 0x14, 0x03, 0x40, 0x00, 0x04, 0x03, 0x91, 0x03, 0x13, 0x03, 0x45, 0x03, 0x41, 0x00, 0x04,
++    0x03, 0x91, 0x03, 0x45, 0x03, 0x14, 0x03, 0x41, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x13, 0x03, 0x45,
++    0x03, 0x40, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x45, 0x03, 0x14, 0x03, 0x40, 0x00, 0x04, 0x03, 0xB7,
++    0x03, 0x13, 0x03, 0x45, 0x03, 0x41, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x45, 0x03, 0x14, 0x03, 0x41,
++    0x00, 0x04, 0x03, 0x97, 0x03, 0x13, 0x03, 0x45, 0x03, 0x40, 0x00, 0x04, 0x03, 0x97, 0x03, 0x45,
++    0x03, 0x14, 0x03, 0x40, 0x00, 0x04, 0x03, 0x97, 0x03, 0x13, 0x03, 0x45, 0x03, 0x41, 0x00, 0x04,
++    0x03, 0x97, 0x03, 0x45, 0x03, 0x14, 0x03, 0x41, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x13, 0x03, 0x45,
++    0x03, 0x40, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x14, 0x03, 0x40, 0x00, 0x04, 0x03, 0xC9,
++    0x03, 0x13, 0x03, 0x45, 0x03, 0x41, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x14, 0x03, 0x41,
++    0x00, 0x04, 0x03, 0xA9, 0x03, 0x13, 0x03, 0x45, 0x03, 0x40, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x45,
++    0x03, 0x14, 0x03, 0x40, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x13, 0x03, 0x45, 0x03, 0x41, 0x00, 0x04,
++    0x03, 0xA9, 0x03, 0x45, 0x03, 0x14, 0x03, 0x41, 0x00, 0x04, 0x21, 0x26, 0x03, 0x43, 0x03, 0x42,
++    0x03, 0x45, 0x00, 0x01, 0x00, 0x19, 0x1F, 0x82, 0x1F, 0x83, 0x1F, 0x84, 0x1F, 0x85, 0x1F, 0x8A,
++    0x1F, 0x8B, 0x1F, 0x8C, 0x1F, 0x8D, 0x1F, 0x92, 0x1F, 0x93, 0x1F, 0x94, 0x1F, 0x95, 0x1F, 0x9A,
++    0x1F, 0x9B, 0x1F, 0x9C, 0x1F, 0x9D, 0x1F, 0xA2, 0x1F, 0xA3, 0x1F, 0xA4, 0x1F, 0xA5, 0x1F, 0xAA,
++    0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD, 0x1F, 0xAE, 0x00, 0x01, 0x00, 0xBA, 0x00, 0x0F, 0x00, 0x24,
++    0x00, 0x2E, 0x00, 0x38, 0x00, 0x42, 0x00, 0x4C, 0x00, 0x56, 0x00, 0x60, 0x00, 0x6A, 0x00, 0x74,
++    0x00, 0x7E, 0x00, 0x88, 0x00, 0x92, 0x00, 0x9C, 0x00, 0xA6, 0x00, 0xB0, 0x00, 0x04, 0x03, 0xB1,
++    0x03, 0x43, 0x03, 0x00, 0x03, 0x45, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x43, 0x03, 0x01, 0x03, 0x45,
++    0x00, 0x04, 0x03, 0x91, 0x03, 0x43, 0x03, 0x00, 0x03, 0x45, 0x00, 0x04, 0x03, 0x91, 0x03, 0x43,
++    0x03, 0x01, 0x03, 0x45, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x43, 0x03, 0x00, 0x03, 0x45, 0x00, 0x04,
++    0x03, 0xB7, 0x03, 0x43, 0x03, 0x01, 0x03, 0x45, 0x00, 0x04, 0x03, 0x97, 0x03, 0x43, 0x03, 0x00,
++    0x03, 0x45, 0x00, 0x04, 0x03, 0x97, 0x03, 0x43, 0x03, 0x01, 0x03, 0x45, 0x00, 0x04, 0x03, 0xC9,
++    0x03, 0x43, 0x03, 0x00, 0x03, 0x45, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x43, 0x03, 0x01, 0x03, 0x45,
++    0x00, 0x04, 0x03, 0xA9, 0x03, 0x43, 0x03, 0x00, 0x03, 0x45, 0x00, 0x04, 0x21, 0x26, 0x03, 0x14,
++    0x03, 0x00, 0x03, 0x45, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x43, 0x03, 0x01, 0x03, 0x45, 0x00, 0x04,
++    0x21, 0x26, 0x03, 0x14, 0x03, 0x01, 0x03, 0x45, 0x00, 0x04, 0x21, 0x26, 0x03, 0x43, 0x03, 0x45,
++    0x03, 0x42, 0x00, 0x01, 0x00, 0x0F, 0x1F, 0x82, 0x1F, 0x84, 0x1F, 0x8A, 0x1F, 0x8C, 0x1F, 0x92,
++    0x1F, 0x94, 0x1F, 0x9A, 0x1F, 0x9C, 0x1F, 0xA2, 0x1F, 0xA4, 0x1F, 0xAA, 0x1F, 0xAB, 0x1F, 0xAC,
++    0x1F, 0xAD, 0x1F, 0xAE, 0x00, 0x01, 0x00, 0xBA, 0x00, 0x0F, 0x00, 0x24, 0x00, 0x2E, 0x00, 0x38,
++    0x00, 0x42, 0x00, 0x4C, 0x00, 0x56, 0x00, 0x60, 0x00, 0x6A, 0x00, 0x74, 0x00, 0x7E, 0x00, 0x88,
++    0x00, 0x92, 0x00, 0x9C, 0x00, 0xA6, 0x00, 0xB0, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x43, 0x03, 0x40,
++    0x03, 0x45, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x43, 0x03, 0x41, 0x03, 0x45, 0x00, 0x04, 0x03, 0x91,
++    0x03, 0x43, 0x03, 0x40, 0x03, 0x45, 0x00, 0x04, 0x03, 0x91, 0x03, 0x43, 0x03, 0x41, 0x03, 0x45,
++    0x00, 0x04, 0x03, 0xB7, 0x03, 0x43, 0x03, 0x40, 0x03, 0x45, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x43,
++    0x03, 0x41, 0x03, 0x45, 0x00, 0x04, 0x03, 0x97, 0x03, 0x43, 0x03, 0x40, 0x03, 0x45, 0x00, 0x04,
++    0x03, 0x97, 0x03, 0x43, 0x03, 0x41, 0x03, 0x45, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x43, 0x03, 0x40,
++    0x03, 0x45, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x43, 0x03, 0x41, 0x03, 0x45, 0x00, 0x04, 0x03, 0xA9,
++    0x03, 0x43, 0x03, 0x40, 0x03, 0x45, 0x00, 0x04, 0x21, 0x26, 0x03, 0x14, 0x03, 0x40, 0x03, 0x45,
++    0x00, 0x04, 0x03, 0xA9, 0x03, 0x43, 0x03, 0x41, 0x03, 0x45, 0x00, 0x04, 0x21, 0x26, 0x03, 0x14,
++    0x03, 0x41, 0x03, 0x45, 0x00, 0x04, 0x21, 0x26, 0x03, 0x45, 0x03, 0x13, 0x03, 0x42, 0x00, 0x01,
++    0x00, 0x0F, 0x1F, 0x82, 0x1F, 0x84, 0x1F, 0x8A, 0x1F, 0x8C, 0x1F, 0x92, 0x1F, 0x94, 0x1F, 0x9A,
++    0x1F, 0x9C, 0x1F, 0xA2, 0x1F, 0xA4, 0x1F, 0xAA, 0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD, 0x1F, 0xAE,
++    0x00, 0x01, 0x00, 0xBA, 0x00, 0x0F, 0x00, 0x24, 0x00, 0x2E, 0x00, 0x38, 0x00, 0x42, 0x00, 0x4C,
++    0x00, 0x56, 0x00, 0x60, 0x00, 0x6A, 0x00, 0x74, 0x00, 0x7E, 0x00, 0x88, 0x00, 0x92, 0x00, 0x9C,
++    0x00, 0xA6, 0x00, 0xB0, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x43, 0x03, 0x45, 0x03, 0x00, 0x00, 0x04,
++    0x03, 0xB1, 0x03, 0x43, 0x03, 0x45, 0x03, 0x01, 0x00, 0x04, 0x03, 0x91, 0x03, 0x43, 0x03, 0x45,
++    0x03, 0x00, 0x00, 0x04, 0x03, 0x91, 0x03, 0x43, 0x03, 0x45, 0x03, 0x01, 0x00, 0x04, 0x03, 0xB7,
++    0x03, 0x43, 0x03, 0x45, 0x03, 0x00, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x43, 0x03, 0x45, 0x03, 0x01,
++    0x00, 0x04, 0x03, 0x97, 0x03, 0x43, 0x03, 0x45, 0x03, 0x00, 0x00, 0x04, 0x03, 0x97, 0x03, 0x43,
++    0x03, 0x45, 0x03, 0x01, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x43, 0x03, 0x45, 0x03, 0x00, 0x00, 0x04,
++    0x03, 0xC9, 0x03, 0x43, 0x03, 0x45, 0x03, 0x01, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x43, 0x03, 0x45,
++    0x03, 0x00, 0x00, 0x04, 0x21, 0x26, 0x03, 0x14, 0x03, 0x45, 0x03, 0x00, 0x00, 0x04, 0x03, 0xA9,
++    0x03, 0x43, 0x03, 0x45, 0x03, 0x01, 0x00, 0x04, 0x21, 0x26, 0x03, 0x14, 0x03, 0x45, 0x03, 0x01,
++    0x00, 0x04, 0x21, 0x26, 0x03, 0x45, 0x03, 0x43, 0x03, 0x42, 0x00, 0x01, 0x00, 0x0F, 0x1F, 0x82,
++    0x1F, 0x84, 0x1F, 0x8A, 0x1F, 0x8C, 0x1F, 0x92, 0x1F, 0x94, 0x1F, 0x9A, 0x1F, 0x9C, 0x1F, 0xA2,
++    0x1F, 0xA4, 0x1F, 0xAA, 0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD, 0x1F, 0xAE, 0x00, 0x01, 0x00, 0xAE,
+     0x00, 0x0E, 0x00, 0x22, 0x00, 0x2C, 0x00, 0x36, 0x00, 0x40, 0x00, 0x4A, 0x00, 0x54, 0x00, 0x5E,
+     0x00, 0x68, 0x00, 0x72, 0x00, 0x7C, 0x00, 0x86, 0x00, 0x90, 0x00, 0x9A, 0x00, 0xA4, 0x00, 0x04,
+-    0x03, 0xB1, 0x03, 0x45, 0x03, 0x13, 0x03, 0x00, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x45, 0x03, 0x13,
+-    0x03, 0x01, 0x00, 0x04, 0x03, 0x91, 0x03, 0x45, 0x03, 0x13, 0x03, 0x00, 0x00, 0x04, 0x03, 0x91,
+-    0x03, 0x45, 0x03, 0x13, 0x03, 0x01, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x45, 0x03, 0x13, 0x03, 0x00,
+-    0x00, 0x04, 0x03, 0xB7, 0x03, 0x45, 0x03, 0x13, 0x03, 0x01, 0x00, 0x04, 0x03, 0x97, 0x03, 0x45,
+-    0x03, 0x13, 0x03, 0x00, 0x00, 0x04, 0x03, 0x97, 0x03, 0x45, 0x03, 0x13, 0x03, 0x01, 0x00, 0x04,
+-    0x03, 0xC9, 0x03, 0x45, 0x03, 0x13, 0x03, 0x00, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x13,
+-    0x03, 0x01, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x45, 0x03, 0x13, 0x03, 0x00, 0x00, 0x04, 0x21, 0x26,
+-    0x03, 0x45, 0x03, 0x14, 0x03, 0x00, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x45, 0x03, 0x13, 0x03, 0x01,
+-    0x00, 0x04, 0x21, 0x26, 0x03, 0x45, 0x03, 0x14, 0x03, 0x01, 0x00, 0x01, 0x00, 0x0E, 0x1F, 0x82,
++    0x03, 0xB1, 0x03, 0x43, 0x03, 0x45, 0x03, 0x40, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x43, 0x03, 0x45,
++    0x03, 0x41, 0x00, 0x04, 0x03, 0x91, 0x03, 0x43, 0x03, 0x45, 0x03, 0x40, 0x00, 0x04, 0x03, 0x91,
++    0x03, 0x43, 0x03, 0x45, 0x03, 0x41, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x43, 0x03, 0x45, 0x03, 0x40,
++    0x00, 0x04, 0x03, 0xB7, 0x03, 0x43, 0x03, 0x45, 0x03, 0x41, 0x00, 0x04, 0x03, 0x97, 0x03, 0x43,
++    0x03, 0x45, 0x03, 0x40, 0x00, 0x04, 0x03, 0x97, 0x03, 0x43, 0x03, 0x45, 0x03, 0x41, 0x00, 0x04,
++    0x03, 0xC9, 0x03, 0x43, 0x03, 0x45, 0x03, 0x40, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x43, 0x03, 0x45,
++    0x03, 0x41, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x43, 0x03, 0x45, 0x03, 0x40, 0x00, 0x04, 0x21, 0x26,
++    0x03, 0x14, 0x03, 0x45, 0x03, 0x40, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x43, 0x03, 0x45, 0x03, 0x41,
++    0x00, 0x04, 0x21, 0x26, 0x03, 0x14, 0x03, 0x45, 0x03, 0x41, 0x00, 0x01, 0x00, 0x0E, 0x1F, 0x82,
+     0x1F, 0x84, 0x1F, 0x8A, 0x1F, 0x8C, 0x1F, 0x92, 0x1F, 0x94, 0x1F, 0x9A, 0x1F, 0x9C, 0x1F, 0xA2,
+     0x1F, 0xA4, 0x1F, 0xAA, 0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD, 0x00, 0x01, 0x00, 0xAE, 0x00, 0x0E,
+     0x00, 0x22, 0x00, 0x2C, 0x00, 0x36, 0x00, 0x40, 0x00, 0x4A, 0x00, 0x54, 0x00, 0x5E, 0x00, 0x68,
+     0x00, 0x72, 0x00, 0x7C, 0x00, 0x86, 0x00, 0x90, 0x00, 0x9A, 0x00, 0xA4, 0x00, 0x04, 0x03, 0xB1,
+-    0x03, 0x45, 0x03, 0x13, 0x03, 0x40, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x45, 0x03, 0x13, 0x03, 0x41,
+-    0x00, 0x04, 0x03, 0x91, 0x03, 0x45, 0x03, 0x13, 0x03, 0x40, 0x00, 0x04, 0x03, 0x91, 0x03, 0x45,
+-    0x03, 0x13, 0x03, 0x41, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x45, 0x03, 0x13, 0x03, 0x40, 0x00, 0x04,
+-    0x03, 0xB7, 0x03, 0x45, 0x03, 0x13, 0x03, 0x41, 0x00, 0x04, 0x03, 0x97, 0x03, 0x45, 0x03, 0x13,
+-    0x03, 0x40, 0x00, 0x04, 0x03, 0x97, 0x03, 0x45, 0x03, 0x13, 0x03, 0x41, 0x00, 0x04, 0x03, 0xC9,
+-    0x03, 0x45, 0x03, 0x13, 0x03, 0x40, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x13, 0x03, 0x41,
+-    0x00, 0x04, 0x03, 0xA9, 0x03, 0x45, 0x03, 0x13, 0x03, 0x40, 0x00, 0x04, 0x21, 0x26, 0x03, 0x45,
+-    0x03, 0x14, 0x03, 0x40, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x45, 0x03, 0x13, 0x03, 0x41, 0x00, 0x04,
+-    0x21, 0x26, 0x03, 0x45, 0x03, 0x14, 0x03, 0x41, 0x00, 0x01, 0x00, 0x0E, 0x1F, 0x82, 0x1F, 0x84,
++    0x03, 0x45, 0x03, 0x13, 0x03, 0x00, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x45, 0x03, 0x13, 0x03, 0x01,
++    0x00, 0x04, 0x03, 0x91, 0x03, 0x45, 0x03, 0x13, 0x03, 0x00, 0x00, 0x04, 0x03, 0x91, 0x03, 0x45,
++    0x03, 0x13, 0x03, 0x01, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x45, 0x03, 0x13, 0x03, 0x00, 0x00, 0x04,
++    0x03, 0xB7, 0x03, 0x45, 0x03, 0x13, 0x03, 0x01, 0x00, 0x04, 0x03, 0x97, 0x03, 0x45, 0x03, 0x13,
++    0x03, 0x00, 0x00, 0x04, 0x03, 0x97, 0x03, 0x45, 0x03, 0x13, 0x03, 0x01, 0x00, 0x04, 0x03, 0xC9,
++    0x03, 0x45, 0x03, 0x13, 0x03, 0x00, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x13, 0x03, 0x01,
++    0x00, 0x04, 0x03, 0xA9, 0x03, 0x45, 0x03, 0x13, 0x03, 0x00, 0x00, 0x04, 0x21, 0x26, 0x03, 0x45,
++    0x03, 0x14, 0x03, 0x00, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x45, 0x03, 0x13, 0x03, 0x01, 0x00, 0x04,
++    0x21, 0x26, 0x03, 0x45, 0x03, 0x14, 0x03, 0x01, 0x00, 0x01, 0x00, 0x0E, 0x1F, 0x82, 0x1F, 0x84,
+     0x1F, 0x8A, 0x1F, 0x8C, 0x1F, 0x92, 0x1F, 0x94, 0x1F, 0x9A, 0x1F, 0x9C, 0x1F, 0xA2, 0x1F, 0xA4,
+-    0x1F, 0xAA, 0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD, 0x00, 0x01, 0x00, 0x96, 0x00, 0x0C, 0x00, 0x1E,
++    0x1F, 0xAA, 0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD, 0x00, 0x01, 0x00, 0xAE, 0x00, 0x0E, 0x00, 0x22,
++    0x00, 0x2C, 0x00, 0x36, 0x00, 0x40, 0x00, 0x4A, 0x00, 0x54, 0x00, 0x5E, 0x00, 0x68, 0x00, 0x72,
++    0x00, 0x7C, 0x00, 0x86, 0x00, 0x90, 0x00, 0x9A, 0x00, 0xA4, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x45,
++    0x03, 0x13, 0x03, 0x40, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x45, 0x03, 0x13, 0x03, 0x41, 0x00, 0x04,
++    0x03, 0x91, 0x03, 0x45, 0x03, 0x13, 0x03, 0x40, 0x00, 0x04, 0x03, 0x91, 0x03, 0x45, 0x03, 0x13,
++    0x03, 0x41, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x45, 0x03, 0x13, 0x03, 0x40, 0x00, 0x04, 0x03, 0xB7,
++    0x03, 0x45, 0x03, 0x13, 0x03, 0x41, 0x00, 0x04, 0x03, 0x97, 0x03, 0x45, 0x03, 0x13, 0x03, 0x40,
++    0x00, 0x04, 0x03, 0x97, 0x03, 0x45, 0x03, 0x13, 0x03, 0x41, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x45,
++    0x03, 0x13, 0x03, 0x40, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x13, 0x03, 0x41, 0x00, 0x04,
++    0x03, 0xA9, 0x03, 0x45, 0x03, 0x13, 0x03, 0x40, 0x00, 0x04, 0x21, 0x26, 0x03, 0x45, 0x03, 0x14,
++    0x03, 0x40, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x45, 0x03, 0x13, 0x03, 0x41, 0x00, 0x04, 0x21, 0x26,
++    0x03, 0x45, 0x03, 0x14, 0x03, 0x41, 0x00, 0x01, 0x00, 0x0E, 0x1F, 0x82, 0x1F, 0x84, 0x1F, 0x8A,
++    0x1F, 0x8C, 0x1F, 0x92, 0x1F, 0x94, 0x1F, 0x9A, 0x1F, 0x9C, 0x1F, 0xA2, 0x1F, 0xA4, 0x1F, 0xAA,
++    0x1F, 0xAB, 0x1F, 0xAC, 0x1F, 0xAD, 0x00, 0x01, 0x00, 0x96, 0x00, 0x0C, 0x00, 0x1E, 0x00, 0x28,
++    0x00, 0x32, 0x00, 0x3C, 0x00, 0x46, 0x00, 0x50, 0x00, 0x5A, 0x00, 0x64, 0x00, 0x6E, 0x00, 0x78,
++    0x00, 0x82, 0x00, 0x8C, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x45, 0x03, 0x43, 0x03, 0x00, 0x00, 0x04,
++    0x03, 0xB1, 0x03, 0x45, 0x03, 0x43, 0x03, 0x01, 0x00, 0x04, 0x03, 0x91, 0x03, 0x45, 0x03, 0x43,
++    0x03, 0x00, 0x00, 0x04, 0x03, 0x91, 0x03, 0x45, 0x03, 0x43, 0x03, 0x01, 0x00, 0x04, 0x03, 0xB7,
++    0x03, 0x45, 0x03, 0x43, 0x03, 0x00, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x45, 0x03, 0x43, 0x03, 0x01,
++    0x00, 0x04, 0x03, 0x97, 0x03, 0x45, 0x03, 0x43, 0x03, 0x00, 0x00, 0x04, 0x03, 0x97, 0x03, 0x45,
++    0x03, 0x43, 0x03, 0x01, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x43, 0x03, 0x00, 0x00, 0x04,
++    0x03, 0xC9, 0x03, 0x45, 0x03, 0x43, 0x03, 0x01, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x45, 0x03, 0x43,
++    0x03, 0x00, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x45, 0x03, 0x43, 0x03, 0x01, 0x00, 0x01, 0x00, 0x0C,
++    0x1F, 0x82, 0x1F, 0x84, 0x1F, 0x8A, 0x1F, 0x8C, 0x1F, 0x92, 0x1F, 0x94, 0x1F, 0x9A, 0x1F, 0x9C,
++    0x1F, 0xA2, 0x1F, 0xA4, 0x1F, 0xAA, 0x1F, 0xAC, 0x00, 0x01, 0x00, 0x96, 0x00, 0x0C, 0x00, 0x1E,
+     0x00, 0x28, 0x00, 0x32, 0x00, 0x3C, 0x00, 0x46, 0x00, 0x50, 0x00, 0x5A, 0x00, 0x64, 0x00, 0x6E,
+-    0x00, 0x78, 0x00, 0x82, 0x00, 0x8C, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x45, 0x03, 0x43, 0x03, 0x00,
+-    0x00, 0x04, 0x03, 0xB1, 0x03, 0x45, 0x03, 0x43, 0x03, 0x01, 0x00, 0x04, 0x03, 0x91, 0x03, 0x45,
+-    0x03, 0x43, 0x03, 0x00, 0x00, 0x04, 0x03, 0x91, 0x03, 0x45, 0x03, 0x43, 0x03, 0x01, 0x00, 0x04,
+-    0x03, 0xB7, 0x03, 0x45, 0x03, 0x43, 0x03, 0x00, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x45, 0x03, 0x43,
+-    0x03, 0x01, 0x00, 0x04, 0x03, 0x97, 0x03, 0x45, 0x03, 0x43, 0x03, 0x00, 0x00, 0x04, 0x03, 0x97,
+-    0x03, 0x45, 0x03, 0x43, 0x03, 0x01, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x43, 0x03, 0x00,
+-    0x00, 0x04, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x43, 0x03, 0x01, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x45,
+-    0x03, 0x43, 0x03, 0x00, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x45, 0x03, 0x43, 0x03, 0x01, 0x00, 0x01,
++    0x00, 0x78, 0x00, 0x82, 0x00, 0x8C, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x45, 0x03, 0x43, 0x03, 0x40,
++    0x00, 0x04, 0x03, 0xB1, 0x03, 0x45, 0x03, 0x43, 0x03, 0x41, 0x00, 0x04, 0x03, 0x91, 0x03, 0x45,
++    0x03, 0x43, 0x03, 0x40, 0x00, 0x04, 0x03, 0x91, 0x03, 0x45, 0x03, 0x43, 0x03, 0x41, 0x00, 0x04,
++    0x03, 0xB7, 0x03, 0x45, 0x03, 0x43, 0x03, 0x40, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x45, 0x03, 0x43,
++    0x03, 0x41, 0x00, 0x04, 0x03, 0x97, 0x03, 0x45, 0x03, 0x43, 0x03, 0x40, 0x00, 0x04, 0x03, 0x97,
++    0x03, 0x45, 0x03, 0x43, 0x03, 0x41, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x43, 0x03, 0x40,
++    0x00, 0x04, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x43, 0x03, 0x41, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x45,
++    0x03, 0x43, 0x03, 0x40, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x45, 0x03, 0x43, 0x03, 0x41, 0x00, 0x01,
+     0x00, 0x0C, 0x1F, 0x82, 0x1F, 0x84, 0x1F, 0x8A, 0x1F, 0x8C, 0x1F, 0x92, 0x1F, 0x94, 0x1F, 0x9A,
+-    0x1F, 0x9C, 0x1F, 0xA2, 0x1F, 0xA4, 0x1F, 0xAA, 0x1F, 0xAC, 0x00, 0x01, 0x00, 0x96, 0x00, 0x0C,
+-    0x00, 0x1E, 0x00, 0x28, 0x00, 0x32, 0x00, 0x3C, 0x00, 0x46, 0x00, 0x50, 0x00, 0x5A, 0x00, 0x64,
+-    0x00, 0x6E, 0x00, 0x78, 0x00, 0x82, 0x00, 0x8C, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x45, 0x03, 0x43,
+-    0x03, 0x40, 0x00, 0x04, 0x03, 0xB1, 0x03, 0x45, 0x03, 0x43, 0x03, 0x41, 0x00, 0x04, 0x03, 0x91,
+-    0x03, 0x45, 0x03, 0x43, 0x03, 0x40, 0x00, 0x04, 0x03, 0x91, 0x03, 0x45, 0x03, 0x43, 0x03, 0x41,
+-    0x00, 0x04, 0x03, 0xB7, 0x03, 0x45, 0x03, 0x43, 0x03, 0x40, 0x00, 0x04, 0x03, 0xB7, 0x03, 0x45,
+-    0x03, 0x43, 0x03, 0x41, 0x00, 0x04, 0x03, 0x97, 0x03, 0x45, 0x03, 0x43, 0x03, 0x40, 0x00, 0x04,
+-    0x03, 0x97, 0x03, 0x45, 0x03, 0x43, 0x03, 0x41, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x43,
+-    0x03, 0x40, 0x00, 0x04, 0x03, 0xC9, 0x03, 0x45, 0x03, 0x43, 0x03, 0x41, 0x00, 0x04, 0x03, 0xA9,
+-    0x03, 0x45, 0x03, 0x43, 0x03, 0x40, 0x00, 0x04, 0x03, 0xA9, 0x03, 0x45, 0x03, 0x43, 0x03, 0x41,
+-    0x00, 0x01, 0x00, 0x0C, 0x1F, 0x82, 0x1F, 0x84, 0x1F, 0x8A, 0x1F, 0x8C, 0x1F, 0x92, 0x1F, 0x94,
+-    0x1F, 0x9A, 0x1F, 0x9C, 0x1F, 0xA2, 0x1F, 0xA4, 0x1F, 0xAA, 0x1F, 0xAC, 0x00, 0x01, 0x00, 0x1E,
+-    0x00, 0x02, 0x00, 0x0A, 0x00, 0x14, 0x00, 0x04, 0x21, 0x26, 0x03, 0x13, 0x03, 0x00, 0x03, 0x45,
+-    0x00, 0x04, 0x21, 0x26, 0x03, 0x13, 0x03, 0x01, 0x03, 0x45, 0x00, 0x01, 0x00, 0x02, 0x1F, 0xAA,
++    0x1F, 0x9C, 0x1F, 0xA2, 0x1F, 0xA4, 0x1F, 0xAA, 0x1F, 0xAC, 0x00, 0x01, 0x00, 0x1E, 0x00, 0x02,
++    0x00, 0x0A, 0x00, 0x14, 0x00, 0x04, 0x21, 0x26, 0x03, 0x13, 0x03, 0x00, 0x03, 0x45, 0x00, 0x04,
++    0x21, 0x26, 0x03, 0x13, 0x03, 0x01, 0x03, 0x45, 0x00, 0x01, 0x00, 0x02, 0x1F, 0xAA, 0x1F, 0xAC,
++    0x00, 0x01, 0x00, 0x1E, 0x00, 0x02, 0x00, 0x0A, 0x00, 0x14, 0x00, 0x04, 0x21, 0x26, 0x03, 0x13,
++    0x03, 0x40, 0x03, 0x45, 0x00, 0x04, 0x21, 0x26, 0x03, 0x13, 0x03, 0x41, 0x03, 0x45, 0x00, 0x01,
++    0x00, 0x02, 0x1F, 0xAA, 0x1F, 0xAC, 0x00, 0x01, 0x00, 0x1E, 0x00, 0x02, 0x00, 0x0A, 0x00, 0x14,
++    0x00, 0x04, 0x21, 0x26, 0x03, 0x13, 0x03, 0x45, 0x03, 0x00, 0x00, 0x04, 0x21, 0x26, 0x03, 0x13,
++    0x03, 0x45, 0x03, 0x01, 0x00, 0x01, 0x00, 0x02, 0x1F, 0xAA, 0x1F, 0xAC, 0x00, 0x01, 0x00, 0x1E,
++    0x00, 0x02, 0x00, 0x0A, 0x00, 0x14, 0x00, 0x04, 0x21, 0x26, 0x03, 0x13, 0x03, 0x45, 0x03, 0x40,
++    0x00, 0x04, 0x21, 0x26, 0x03, 0x13, 0x03, 0x45, 0x03, 0x41, 0x00, 0x01, 0x00, 0x02, 0x1F, 0xAA,
+     0x1F, 0xAC, 0x00, 0x01, 0x00, 0x1E, 0x00, 0x02, 0x00, 0x0A, 0x00, 0x14, 0x00, 0x04, 0x21, 0x26,
+-    0x03, 0x13, 0x03, 0x40, 0x03, 0x45, 0x00, 0x04, 0x21, 0x26, 0x03, 0x13, 0x03, 0x41, 0x03, 0x45,
++    0x03, 0x43, 0x03, 0x00, 0x03, 0x45, 0x00, 0x04, 0x21, 0x26, 0x03, 0x43, 0x03, 0x01, 0x03, 0x45,
+     0x00, 0x01, 0x00, 0x02, 0x1F, 0xAA, 0x1F, 0xAC, 0x00, 0x01, 0x00, 0x1E, 0x00, 0x02, 0x00, 0x0A,
+-    0x00, 0x14, 0x00, 0x04, 0x21, 0x26, 0x03, 0x13, 0x03, 0x45, 0x03, 0x00, 0x00, 0x04, 0x21, 0x26,
+-    0x03, 0x13, 0x03, 0x45, 0x03, 0x01, 0x00, 0x01, 0x00, 0x02, 0x1F, 0xAA, 0x1F, 0xAC, 0x00, 0x01,
+-    0x00, 0x1E, 0x00, 0x02, 0x00, 0x0A, 0x00, 0x14, 0x00, 0x04, 0x21, 0x26, 0x03, 0x13, 0x03, 0x45,
+-    0x03, 0x40, 0x00, 0x04, 0x21, 0x26, 0x03, 0x13, 0x03, 0x45, 0x03, 0x41, 0x00, 0x01, 0x00, 0x02,
++    0x00, 0x14, 0x00, 0x04, 0x21, 0x26, 0x03, 0x43, 0x03, 0x40, 0x03, 0x45, 0x00, 0x04, 0x21, 0x26,
++    0x03, 0x43, 0x03, 0x41, 0x03, 0x45, 0x00, 0x01, 0x00, 0x02, 0x1F, 0xAA, 0x1F, 0xAC, 0x00, 0x01,
++    0x00, 0x1E, 0x00, 0x02, 0x00, 0x0A, 0x00, 0x14, 0x00, 0x04, 0x21, 0x26, 0x03, 0x43, 0x03, 0x45,
++    0x03, 0x00, 0x00, 0x04, 0x21, 0x26, 0x03, 0x43, 0x03, 0x45, 0x03, 0x01, 0x00, 0x01, 0x00, 0x02,
+     0x1F, 0xAA, 0x1F, 0xAC, 0x00, 0x01, 0x00, 0x1E, 0x00, 0x02, 0x00, 0x0A, 0x00, 0x14, 0x00, 0x04,
+-    0x21, 0x26, 0x03, 0x43, 0x03, 0x00, 0x03, 0x45, 0x00, 0x04, 0x21, 0x26, 0x03, 0x43, 0x03, 0x01,
+-    0x03, 0x45, 0x00, 0x01, 0x00, 0x02, 0x1F, 0xAA, 0x1F, 0xAC, 0x00, 0x01, 0x00, 0x1E, 0x00, 0x02,
+-    0x00, 0x0A, 0x00, 0x14, 0x00, 0x04, 0x21, 0x26, 0x03, 0x43, 0x03, 0x40, 0x03, 0x45, 0x00, 0x04,
+-    0x21, 0x26, 0x03, 0x43, 0x03, 0x41, 0x03, 0x45, 0x00, 0x01, 0x00, 0x02, 0x1F, 0xAA, 0x1F, 0xAC,
+-    0x00, 0x01, 0x00, 0x1E, 0x00, 0x02, 0x00, 0x0A, 0x00, 0x14, 0x00, 0x04, 0x21, 0x26, 0x03, 0x43,
+-    0x03, 0x45, 0x03, 0x00, 0x00, 0x04, 0x21, 0x26, 0x03, 0x43, 0x03, 0x45, 0x03, 0x01, 0x00, 0x01,
++    0x21, 0x26, 0x03, 0x43, 0x03, 0x45, 0x03, 0x40, 0x00, 0x04, 0x21, 0x26, 0x03, 0x43, 0x03, 0x45,
++    0x03, 0x41, 0x00, 0x01, 0x00, 0x02, 0x1F, 0xAA, 0x1F, 0xAC, 0x00, 0x01, 0x00, 0x1E, 0x00, 0x02,
++    0x00, 0x0A, 0x00, 0x14, 0x00, 0x04, 0x21, 0x26, 0x03, 0x45, 0x03, 0x13, 0x03, 0x00, 0x00, 0x04,
++    0x21, 0x26, 0x03, 0x45, 0x03, 0x13, 0x03, 0x01, 0x00, 0x01, 0x00, 0x02, 0x1F, 0xAA, 0x1F, 0xAC,
++    0x00, 0x01, 0x00, 0x1E, 0x00, 0x02, 0x00, 0x0A, 0x00, 0x14, 0x00, 0x04, 0x21, 0x26, 0x03, 0x45,
++    0x03, 0x13, 0x03, 0x40, 0x00, 0x04, 0x21, 0x26, 0x03, 0x45, 0x03, 0x13, 0x03, 0x41, 0x00, 0x01,
+     0x00, 0x02, 0x1F, 0xAA, 0x1F, 0xAC, 0x00, 0x01, 0x00, 0x1E, 0x00, 0x02, 0x00, 0x0A, 0x00, 0x14,
+-    0x00, 0x04, 0x21, 0x26, 0x03, 0x43, 0x03, 0x45, 0x03, 0x40, 0x00, 0x04, 0x21, 0x26, 0x03, 0x43,
+-    0x03, 0x45, 0x03, 0x41, 0x00, 0x01, 0x00, 0x02, 0x1F, 0xAA, 0x1F, 0xAC, 0x00, 0x01, 0x00, 0x1E,
+-    0x00, 0x02, 0x00, 0x0A, 0x00, 0x14, 0x00, 0x04, 0x21, 0x26, 0x03, 0x45, 0x03, 0x13, 0x03, 0x00,
+-    0x00, 0x04, 0x21, 0x26, 0x03, 0x45, 0x03, 0x13, 0x03, 0x01, 0x00, 0x01, 0x00, 0x02, 0x1F, 0xAA,
+-    0x1F, 0xAC, 0x00, 0x01, 0x00, 0x1E, 0x00, 0x02, 0x00, 0x0A, 0x00, 0x14, 0x00, 0x04, 0x21, 0x26,
+-    0x03, 0x45, 0x03, 0x13, 0x03, 0x40, 0x00, 0x04, 0x21, 0x26, 0x03, 0x45, 0x03, 0x13, 0x03, 0x41,
+-    0x00, 0x01, 0x00, 0x02, 0x1F, 0xAA, 0x1F, 0xAC, 0x00, 0x01, 0x00, 0x1E, 0x00, 0x02, 0x00, 0x0A,
+-    0x00, 0x14, 0x00, 0x04, 0x21, 0x26, 0x03, 0x45, 0x03, 0x43, 0x03, 0x00, 0x00, 0x04, 0x21, 0x26,
+-    0x03, 0x45, 0x03, 0x43, 0x03, 0x01, 0x00, 0x01, 0x00, 0x02, 0x1F, 0xAA, 0x1F, 0xAC, 0x00, 0x01,
+-    0x00, 0x1E, 0x00, 0x02, 0x00, 0x0A, 0x00, 0x14, 0x00, 0x04, 0x21, 0x26, 0x03, 0x45, 0x03, 0x43,
+-    0x03, 0x40, 0x00, 0x04, 0x21, 0x26, 0x03, 0x45, 0x03, 0x43, 0x03, 0x41, 0x00, 0x01, 0x00, 0x02,
+-    0x1F, 0xAA, 0x1F, 0xAC, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0x4E,
+-    0x00, 0x06, 0x00, 0x12, 0x00, 0x1C, 0x00, 0x26, 0x00, 0x30, 0x00, 0x3A, 0x00, 0x44, 0x00, 0x01,
+-    0x00, 0x04, 0x0A, 0x59, 0x00, 0x02, 0x0A, 0x3C, 0x00, 0x01, 0x00, 0x04, 0x0A, 0x5A, 0x00, 0x02,
+-    0x0A, 0x3C, 0x00, 0x01, 0x00, 0x04, 0x0A, 0x5B, 0x00, 0x02, 0x0A, 0x3C, 0x00, 0x01, 0x00, 0x04,
+-    0x0A, 0x5E, 0x00, 0x02, 0x0A, 0x3C, 0x00, 0x01, 0x00, 0x04, 0x0A, 0x33, 0x00, 0x02, 0x0A, 0x3C,
+-    0x00, 0x01, 0x00, 0x04, 0x0A, 0x36, 0x00, 0x02, 0x0A, 0x3C, 0x00, 0x01, 0x00, 0x06, 0x0A, 0x16,
+-    0x0A, 0x17, 0x0A, 0x1C, 0x0A, 0x2B, 0x0A, 0x32, 0x0A, 0x38, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01,
+-    0x00, 0x08, 0x00, 0x01, 0x00, 0x36, 0x00, 0x06, 0x00, 0x12, 0x00, 0x18, 0x00, 0x1E, 0x00, 0x24,
+-    0x00, 0x2A, 0x00, 0x30, 0x00, 0x02, 0x0A, 0x32, 0x0A, 0x3C, 0x00, 0x02, 0x0A, 0x38, 0x0A, 0x3C,
+-    0x00, 0x02, 0x0A, 0x16, 0x0A, 0x3C, 0x00, 0x02, 0x0A, 0x17, 0x0A, 0x3C, 0x00, 0x02, 0x0A, 0x1C,
+-    0x0A, 0x3C, 0x00, 0x02, 0x0A, 0x2B, 0x0A, 0x3C, 0x00, 0x01, 0x00, 0x06, 0x0A, 0x33, 0x0A, 0x36,
+-    0x0A, 0x59, 0x0A, 0x5A, 0x0A, 0x5B, 0x0A, 0x5E, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08,
+-    0x00, 0x01, 0x01, 0xB6, 0x00, 0x1A, 0x00, 0x3A, 0x00, 0x54, 0x00, 0x66, 0x00, 0x70, 0x00, 0x7A,
+-    0x00, 0x84, 0x00, 0x96, 0x00, 0xA0, 0x00, 0xAA, 0x00, 0xBC, 0x00, 0xC6, 0x00, 0xD8, 0x00, 0xE2,
+-    0x00, 0xEC, 0x00, 0xF6, 0x01, 0x00, 0x01, 0x0A, 0x01, 0x1C, 0x01, 0x26, 0x01, 0x30, 0x01, 0x3A,
+-    0x01, 0x7C, 0x01, 0x86, 0x01, 0x90, 0x01, 0x9A, 0x01, 0xA4, 0x00, 0x03, 0x00, 0x08, 0x00, 0x0E,
+-    0x00, 0x14, 0xFB, 0x2E, 0x00, 0x02, 0x05, 0xB7, 0xFB, 0x2F, 0x00, 0x02, 0x05, 0xB8, 0xFB, 0x30,
+-    0x00, 0x02, 0x05, 0xBC, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0xFB, 0x31, 0x00, 0x02, 0x05, 0xBC,
+-    0xFB, 0x4C, 0x00, 0x02, 0x05, 0xBF, 0x00, 0x01, 0x00, 0x04, 0xFB, 0x32, 0x00, 0x02, 0x05, 0xBC,
+-    0x00, 0x01, 0x00, 0x04, 0xFB, 0x33, 0x00, 0x02, 0x05, 0xBC, 0x00, 0x01, 0x00, 0x04, 0xFB, 0x34,
+-    0x00, 0x02, 0x05, 0xBC, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0xFB, 0x4B, 0x00, 0x02, 0x05, 0xB9,
+-    0xFB, 0x35, 0x00, 0x02, 0x05, 0xBC, 0x00, 0x01, 0x00, 0x04, 0xFB, 0x36, 0x00, 0x02, 0x05, 0xBC,
+-    0x00, 0x01, 0x00, 0x04, 0xFB, 0x38, 0x00, 0x02, 0x05, 0xBC, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C,
+-    0xFB, 0x1D, 0x00, 0x02, 0x05, 0xB4, 0xFB, 0x39, 0x00, 0x02, 0x05, 0xBC, 0x00, 0x01, 0x00, 0x04,
+-    0xFB, 0x3A, 0x00, 0x02, 0x05, 0xBC, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0xFB, 0x3B, 0x00, 0x02,
+-    0x05, 0xBC, 0xFB, 0x4D, 0x00, 0x02, 0x05, 0xBF, 0x00, 0x01, 0x00, 0x04, 0xFB, 0x3C, 0x00, 0x02,
+-    0x05, 0xBC, 0x00, 0x01, 0x00, 0x04, 0xFB, 0x3E, 0x00, 0x02, 0x05, 0xBC, 0x00, 0x01, 0x00, 0x04,
+-    0xFB, 0x40, 0x00, 0x02, 0x05, 0xBC, 0x00, 0x01, 0x00, 0x04, 0xFB, 0x41, 0x00, 0x02, 0x05, 0xBC,
+-    0x00, 0x01, 0x00, 0x04, 0xFB, 0x43, 0x00, 0x02, 0x05, 0xBC, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C,
+-    0xFB, 0x44, 0x00, 0x02, 0x05, 0xBC, 0xFB, 0x4E, 0x00, 0x02, 0x05, 0xBF, 0x00, 0x01, 0x00, 0x04,
+-    0xFB, 0x46, 0x00, 0x02, 0x05, 0xBC, 0x00, 0x01, 0x00, 0x04, 0xFB, 0x47, 0x00, 0x02, 0x05, 0xBC,
+-    0x00, 0x01, 0x00, 0x04, 0xFB, 0x48, 0x00, 0x02, 0x05, 0xBC, 0x00, 0x07, 0x00, 0x10, 0x00, 0x18,
+-    0x00, 0x20, 0x00, 0x26, 0x00, 0x2E, 0x00, 0x34, 0x00, 0x3C, 0xFB, 0x2C, 0x00, 0x03, 0x05, 0xBC,
+-    0x05, 0xC1, 0xFB, 0x2D, 0x00, 0x03, 0x05, 0xBC, 0x05, 0xC2, 0xFB, 0x49, 0x00, 0x02, 0x05, 0xBC,
+-    0xFB, 0x2C, 0x00, 0x03, 0x05, 0xC1, 0x05, 0xBC, 0xFB, 0x2A, 0x00, 0x02, 0x05, 0xC1, 0xFB, 0x2D,
+-    0x00, 0x03, 0x05, 0xC2, 0x05, 0xBC, 0xFB, 0x2B, 0x00, 0x02, 0x05, 0xC2, 0x00, 0x01, 0x00, 0x04,
+-    0xFB, 0x4A, 0x00, 0x02, 0x05, 0xBC, 0x00, 0x01, 0x00, 0x04, 0xFB, 0x1F, 0x00, 0x02, 0x05, 0xB7,
+-    0x00, 0x01, 0x00, 0x04, 0xFB, 0x2C, 0x00, 0x02, 0x05, 0xBC, 0x00, 0x01, 0x00, 0x04, 0xFB, 0x2D,
+-    0x00, 0x02, 0x05, 0xBC, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0xFB, 0x2C, 0x00, 0x02, 0x05, 0xC1,
+-    0xFB, 0x2D, 0x00, 0x02, 0x05, 0xC2, 0x00, 0x01, 0x00, 0x1A, 0x05, 0xD0, 0x05, 0xD1, 0x05, 0xD2,
+-    0x05, 0xD3, 0x05, 0xD4, 0x05, 0xD5, 0x05, 0xD6, 0x05, 0xD8, 0x05, 0xD9, 0x05, 0xDA, 0x05, 0xDB,
+-    0x05, 0xDC, 0x05, 0xDE, 0x05, 0xE0, 0x05, 0xE1, 0x05, 0xE3, 0x05, 0xE4, 0x05, 0xE6, 0x05, 0xE7,
+-    0x05, 0xE8, 0x05, 0xE9, 0x05, 0xEA, 0x05, 0xF2, 0xFB, 0x2A, 0xFB, 0x2B, 0xFB, 0x49, 0x00, 0x02,
+-    0x00, 0x00, 0x00, 0x04, 0x00, 0x0E, 0x01, 0x6C, 0x01, 0x8A, 0x01, 0xAC, 0x00, 0x01, 0x01, 0x16,
+-    0x00, 0x22, 0x00, 0x4A, 0x00, 0x50, 0x00, 0x56, 0x00, 0x5C, 0x00, 0x62, 0x00, 0x68, 0x00, 0x6E,
+-    0x00, 0x74, 0x00, 0x7A, 0x00, 0x80, 0x00, 0x86, 0x00, 0x8C, 0x00, 0x92, 0x00, 0x98, 0x00, 0x9E,
+-    0x00, 0xA4, 0x00, 0xAA, 0x00, 0xB0, 0x00, 0xB6, 0x00, 0xBC, 0x00, 0xC2, 0x00, 0xC8, 0x00, 0xCE,
+-    0x00, 0xD4, 0x00, 0xDA, 0x00, 0xE0, 0x00, 0xE6, 0x00, 0xEC, 0x00, 0xF2, 0x00, 0xF8, 0x00, 0xFE,
+-    0x01, 0x04, 0x01, 0x0A, 0x01, 0x10, 0x00, 0x02, 0x05, 0xD9, 0x05, 0xB4, 0x00, 0x02, 0x05, 0xF2,
+-    0x05, 0xB7, 0x00, 0x02, 0x05, 0xE9, 0x05, 0xC1, 0x00, 0x02, 0x05, 0xE9, 0x05, 0xC2, 0x00, 0x02,
+-    0xFB, 0x2A, 0x05, 0xBC, 0x00, 0x02, 0xFB, 0x2B, 0x05, 0xBC, 0x00, 0x02, 0x05, 0xD0, 0x05, 0xB7,
+-    0x00, 0x02, 0x05, 0xD0, 0x05, 0xB8, 0x00, 0x02, 0x05, 0xD0, 0x05, 0xBC, 0x00, 0x02, 0x05, 0xD1,
+-    0x05, 0xBC, 0x00, 0x02, 0x05, 0xD2, 0x05, 0xBC, 0x00, 0x02, 0x05, 0xD3, 0x05, 0xBC, 0x00, 0x02,
+-    0x05, 0xD4, 0x05, 0xBC, 0x00, 0x02, 0x05, 0xD5, 0x05, 0xBC, 0x00, 0x02, 0x05, 0xD6, 0x05, 0xBC,
+-    0x00, 0x02, 0x05, 0xD8, 0x05, 0xBC, 0x00, 0x02, 0x05, 0xD9, 0x05, 0xBC, 0x00, 0x02, 0x05, 0xDA,
+-    0x05, 0xBC, 0x00, 0x02, 0x05, 0xDB, 0x05, 0xBC, 0x00, 0x02, 0x05, 0xDC, 0x05, 0xBC, 0x00, 0x02,
+-    0x05, 0xDE, 0x05, 0xBC, 0x00, 0x02, 0x05, 0xE0, 0x05, 0xBC, 0x00, 0x02, 0x05, 0xE1, 0x05, 0xBC,
+-    0x00, 0x02, 0x05, 0xE3, 0x05, 0xBC, 0x00, 0x02, 0x05, 0xE4, 0x05, 0xBC, 0x00, 0x02, 0x05, 0xE6,
+-    0x05, 0xBC, 0x00, 0x02, 0x05, 0xE7, 0x05, 0xBC, 0x00, 0x02, 0x05, 0xE8, 0x05, 0xBC, 0x00, 0x02,
+-    0x05, 0xE9, 0x05, 0xBC, 0x00, 0x02, 0x05, 0xEA, 0x05, 0xBC, 0x00, 0x02, 0x05, 0xD5, 0x05, 0xB9,
+-    0x00, 0x02, 0x05, 0xD1, 0x05, 0xBF, 0x00, 0x02, 0x05, 0xDB, 0x05, 0xBF, 0x00, 0x02, 0x05, 0xE4,
+-    0x05, 0xBF, 0x00, 0x01, 0x00, 0x22, 0xFB, 0x1D, 0xFB, 0x1F, 0xFB, 0x2A, 0xFB, 0x2B, 0xFB, 0x2C,
+-    0xFB, 0x2D, 0xFB, 0x2E, 0xFB, 0x2F, 0xFB, 0x30, 0xFB, 0x31, 0xFB, 0x32, 0xFB, 0x33, 0xFB, 0x34,
+-    0xFB, 0x35, 0xFB, 0x36, 0xFB, 0x38, 0xFB, 0x39, 0xFB, 0x3A, 0xFB, 0x3B, 0xFB, 0x3C, 0xFB, 0x3E,
+-    0xFB, 0x40, 0xFB, 0x41, 0xFB, 0x43, 0xFB, 0x44, 0xFB, 0x46, 0xFB, 0x47, 0xFB, 0x48, 0xFB, 0x49,
+-    0xFB, 0x4A, 0xFB, 0x4B, 0xFB, 0x4C, 0xFB, 0x4D, 0xFB, 0x4E, 0x00, 0x01, 0x00, 0x16, 0x00, 0x02,
+-    0x00, 0x0A, 0x00, 0x10, 0x00, 0x02, 0xFB, 0x49, 0x05, 0xC1, 0x00, 0x02, 0xFB, 0x49, 0x05, 0xC2,
+-    0x00, 0x01, 0x00, 0x02, 0xFB, 0x2C, 0xFB, 0x2D, 0x00, 0x01, 0x00, 0x1A, 0x00, 0x02, 0x00, 0x0A,
+-    0x00, 0x12, 0x00, 0x03, 0x05, 0xE9, 0x05, 0xBC, 0x05, 0xC1, 0x00, 0x03, 0x05, 0xE9, 0x05, 0xBC,
+-    0x05, 0xC2, 0x00, 0x01, 0x00, 0x02, 0xFB, 0x2C, 0xFB, 0x2D, 0x00, 0x01, 0x00, 0x1A, 0x00, 0x02,
+-    0x00, 0x0A, 0x00, 0x12, 0x00, 0x03, 0x05, 0xE9, 0x05, 0xC1, 0x05, 0xBC, 0x00, 0x03, 0x05, 0xE9,
+-    0x05, 0xC2, 0x05, 0xBC, 0x00, 0x01, 0x00, 0x02, 0xFB, 0x2C, 0xFB, 0x2D, 0x00, 0x04, 0x00, 0x00,
+-    0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x01, 0x36, 0x00, 0x16, 0x00, 0x32, 0x00, 0x3C, 0x00, 0x46,
+-    0x00, 0x50, 0x00, 0x5A, 0x00, 0x64, 0x00, 0x6E, 0x00, 0x78, 0x00, 0x82, 0x00, 0x8C, 0x00, 0x96,
+-    0x00, 0xA0, 0x00, 0xAA, 0x00, 0xB4, 0x00, 0xBE, 0x00, 0xC8, 0x00, 0xD2, 0x00, 0xE4, 0x00, 0xF6,
+-    0x01, 0x08, 0x01, 0x1A, 0x01, 0x2C, 0x00, 0x01, 0x00, 0x04, 0x30, 0x94, 0x00, 0x02, 0x30, 0x99,
+-    0x00, 0x01, 0x00, 0x04, 0x30, 0x4C, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0x4E,
+-    0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0x50, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01,
+-    0x00, 0x04, 0x30, 0x52, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0x54, 0x00, 0x02,
+-    0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0x56, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04,
+-    0x30, 0x58, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0x5A, 0x00, 0x02, 0x30, 0x99,
+-    0x00, 0x01, 0x00, 0x04, 0x30, 0x5C, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0x5E,
+-    0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0x60, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01,
+-    0x00, 0x04, 0x30, 0x62, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0x65, 0x00, 0x02,
+-    0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0x67, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04,
+-    0x30, 0x69, 0x00, 0x02, 0x30, 0x99, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x30, 0x70, 0x00, 0x02,
+-    0x30, 0x99, 0x30, 0x71, 0x00, 0x02, 0x30, 0x9A, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x30, 0x73,
+-    0x00, 0x02, 0x30, 0x99, 0x30, 0x74, 0x00, 0x02, 0x30, 0x9A, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C,
+-    0x30, 0x76, 0x00, 0x02, 0x30, 0x99, 0x30, 0x77, 0x00, 0x02, 0x30, 0x9A, 0x00, 0x02, 0x00, 0x06,
+-    0x00, 0x0C, 0x30, 0x79, 0x00, 0x02, 0x30, 0x99, 0x30, 0x7A, 0x00, 0x02, 0x30, 0x9A, 0x00, 0x02,
+-    0x00, 0x06, 0x00, 0x0C, 0x30, 0x7C, 0x00, 0x02, 0x30, 0x99, 0x30, 0x7D, 0x00, 0x02, 0x30, 0x9A,
+-    0x00, 0x01, 0x00, 0x04, 0x30, 0x9E, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x16, 0x30, 0x46,
+-    0x30, 0x4B, 0x30, 0x4D, 0x30, 0x4F, 0x30, 0x51, 0x30, 0x53, 0x30, 0x55, 0x30, 0x57, 0x30, 0x59,
+-    0x30, 0x5B, 0x30, 0x5D, 0x30, 0x5F, 0x30, 0x61, 0x30, 0x64, 0x30, 0x66, 0x30, 0x68, 0x30, 0x6F,
+-    0x30, 0x72, 0x30, 0x75, 0x30, 0x78, 0x30, 0x7B, 0x30, 0x9D, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01,
+-    0x00, 0x08, 0x00, 0x01, 0x00, 0xDE, 0x00, 0x1B, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x48, 0x00, 0x4E,
+-    0x00, 0x54, 0x00, 0x5A, 0x00, 0x60, 0x00, 0x66, 0x00, 0x6C, 0x00, 0x72, 0x00, 0x78, 0x00, 0x7E,
+-    0x00, 0x84, 0x00, 0x8A, 0x00, 0x90, 0x00, 0x96, 0x00, 0x9C, 0x00, 0xA2, 0x00, 0xA8, 0x00, 0xAE,
+-    0x00, 0xB4, 0x00, 0xBA, 0x00, 0xC0, 0x00, 0xC6, 0x00, 0xCC, 0x00, 0xD2, 0x00, 0xD8, 0x00, 0x02,
+-    0x30, 0x4B, 0x30, 0x99, 0x00, 0x02, 0x30, 0x4D, 0x30, 0x99, 0x00, 0x02, 0x30, 0x4F, 0x30, 0x99,
+-    0x00, 0x02, 0x30, 0x51, 0x30, 0x99, 0x00, 0x02, 0x30, 0x53, 0x30, 0x99, 0x00, 0x02, 0x30, 0x55,
+-    0x30, 0x99, 0x00, 0x02, 0x30, 0x57, 0x30, 0x99, 0x00, 0x02, 0x30, 0x59, 0x30, 0x99, 0x00, 0x02,
+-    0x30, 0x5B, 0x30, 0x99, 0x00, 0x02, 0x30, 0x5D, 0x30, 0x99, 0x00, 0x02, 0x30, 0x5F, 0x30, 0x99,
+-    0x00, 0x02, 0x30, 0x61, 0x30, 0x99, 0x00, 0x02, 0x30, 0x64, 0x30, 0x99, 0x00, 0x02, 0x30, 0x66,
+-    0x30, 0x99, 0x00, 0x02, 0x30, 0x68, 0x30, 0x99, 0x00, 0x02, 0x30, 0x6F, 0x30, 0x99, 0x00, 0x02,
+-    0x30, 0x6F, 0x30, 0x9A, 0x00, 0x02, 0x30, 0x72, 0x30, 0x99, 0x00, 0x02, 0x30, 0x72, 0x30, 0x9A,
+-    0x00, 0x02, 0x30, 0x75, 0x30, 0x99, 0x00, 0x02, 0x30, 0x75, 0x30, 0x9A, 0x00, 0x02, 0x30, 0x78,
+-    0x30, 0x99, 0x00, 0x02, 0x30, 0x78, 0x30, 0x9A, 0x00, 0x02, 0x30, 0x7B, 0x30, 0x99, 0x00, 0x02,
+-    0x30, 0x7B, 0x30, 0x9A, 0x00, 0x02, 0x30, 0x46, 0x30, 0x99, 0x00, 0x02, 0x30, 0x9D, 0x30, 0x99,
+-    0x00, 0x01, 0x00, 0x1B, 0x30, 0x4C, 0x30, 0x4E, 0x30, 0x50, 0x30, 0x52, 0x30, 0x54, 0x30, 0x56,
+-    0x30, 0x58, 0x30, 0x5A, 0x30, 0x5C, 0x30, 0x5E, 0x30, 0x60, 0x30, 0x62, 0x30, 0x65, 0x30, 0x67,
+-    0x30, 0x69, 0x30, 0x70, 0x30, 0x71, 0x30, 0x73, 0x30, 0x74, 0x30, 0x76, 0x30, 0x77, 0x30, 0x79,
+-    0x30, 0x7A, 0x30, 0x7C, 0x30, 0x7D, 0x30, 0x94, 0x30, 0x9E, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01,
+-    0x00, 0x08, 0x00, 0x01, 0x00, 0x44, 0x00, 0x03, 0x00, 0x0C, 0x00, 0x16, 0x00, 0x3A, 0x00, 0x01,
+-    0x00, 0x04, 0x0C, 0xC0, 0x00, 0x02, 0x0C, 0xD5, 0x00, 0x04, 0x00, 0x0A, 0x00, 0x12, 0x00, 0x18,
+-    0x00, 0x1E, 0x0C, 0xCB, 0x00, 0x03, 0x0C, 0xC2, 0x0C, 0xD5, 0x0C, 0xCA, 0x00, 0x02, 0x0C, 0xC2,
+-    0x0C, 0xC7, 0x00, 0x02, 0x0C, 0xD5, 0x0C, 0xC8, 0x00, 0x02, 0x0C, 0xD6, 0x00, 0x01, 0x00, 0x04,
+-    0x0C, 0xCB, 0x00, 0x02, 0x0C, 0xD5, 0x00, 0x01, 0x00, 0x03, 0x0C, 0xBF, 0x0C, 0xC6, 0x0C, 0xCA,
+-    0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0A, 0x00, 0x46, 0x00, 0x01, 0x00, 0x2E, 0x00, 0x05,
+-    0x00, 0x10, 0x00, 0x16, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x28, 0x00, 0x02, 0x0C, 0xBF, 0x0C, 0xD5,
+-    0x00, 0x02, 0x0C, 0xC6, 0x0C, 0xD5, 0x00, 0x02, 0x0C, 0xC6, 0x0C, 0xD6, 0x00, 0x02, 0x0C, 0xC6,
+-    0x0C, 0xC2, 0x00, 0x02, 0x0C, 0xCA, 0x0C, 0xD5, 0x00, 0x01, 0x00, 0x05, 0x0C, 0xC0, 0x0C, 0xC7,
+-    0x0C, 0xC8, 0x0C, 0xCA, 0x0C, 0xCB, 0x00, 0x01, 0x00, 0x10, 0x00, 0x01, 0x00, 0x08, 0x00, 0x03,
+-    0x0C, 0xC6, 0x0C, 0xC2, 0x0C, 0xD5, 0x00, 0x01, 0x00, 0x01, 0x0C, 0xCB, 0x00, 0x04, 0x00, 0x00,
+-    0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x01, 0x66, 0x00, 0x1A, 0x00, 0x3A, 0x00, 0x44, 0x00, 0x4E,
+-    0x00, 0x58, 0x00, 0x62, 0x00, 0x6C, 0x00, 0x76, 0x00, 0x80, 0x00, 0x8A, 0x00, 0x94, 0x00, 0x9E,
+-    0x00, 0xA8, 0x00, 0xB2, 0x00, 0xBC, 0x00, 0xC6, 0x00, 0xD0, 0x00, 0xDA, 0x00, 0xEC, 0x00, 0xFE,
+-    0x01, 0x10, 0x01, 0x22, 0x01, 0x34, 0x01, 0x3E, 0x01, 0x48, 0x01, 0x52, 0x01, 0x5C, 0x00, 0x01,
+-    0x00, 0x04, 0x30, 0xF4, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0xAC, 0x00, 0x02,
+-    0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0xAE, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04,
+-    0x30, 0xB0, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0xB2, 0x00, 0x02, 0x30, 0x99,
+-    0x00, 0x01, 0x00, 0x04, 0x30, 0xB4, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0xB6,
+-    0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0xB8, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01,
+-    0x00, 0x04, 0x30, 0xBA, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0xBC, 0x00, 0x02,
+-    0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0xBE, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04,
+-    0x30, 0xC0, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0xC2, 0x00, 0x02, 0x30, 0x99,
+-    0x00, 0x01, 0x00, 0x04, 0x30, 0xC5, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0xC7,
+-    0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0xC9, 0x00, 0x02, 0x30, 0x99, 0x00, 0x02,
+-    0x00, 0x06, 0x00, 0x0C, 0x30, 0xD0, 0x00, 0x02, 0x30, 0x99, 0x30, 0xD1, 0x00, 0x02, 0x30, 0x9A,
+-    0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x30, 0xD3, 0x00, 0x02, 0x30, 0x99, 0x30, 0xD4, 0x00, 0x02,
+-    0x30, 0x9A, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x30, 0xD6, 0x00, 0x02, 0x30, 0x99, 0x30, 0xD7,
+-    0x00, 0x02, 0x30, 0x9A, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x30, 0xD9, 0x00, 0x02, 0x30, 0x99,
+-    0x30, 0xDA, 0x00, 0x02, 0x30, 0x9A, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x30, 0xDC, 0x00, 0x02,
+-    0x30, 0x99, 0x30, 0xDD, 0x00, 0x02, 0x30, 0x9A, 0x00, 0x01, 0x00, 0x04, 0x30, 0xF7, 0x00, 0x02,
+-    0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0xF8, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04,
+-    0x30, 0xF9, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0xFA, 0x00, 0x02, 0x30, 0x99,
+-    0x00, 0x01, 0x00, 0x04, 0x30, 0xFE, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x1A, 0x30, 0xA6,
+-    0x30, 0xAB, 0x30, 0xAD, 0x30, 0xAF, 0x30, 0xB1, 0x30, 0xB3, 0x30, 0xB5, 0x30, 0xB7, 0x30, 0xB9,
+-    0x30, 0xBB, 0x30, 0xBD, 0x30, 0xBF, 0x30, 0xC1, 0x30, 0xC4, 0x30, 0xC6, 0x30, 0xC8, 0x30, 0xCF,
+-    0x30, 0xD2, 0x30, 0xD5, 0x30, 0xD8, 0x30, 0xDB, 0x30, 0xEF, 0x30, 0xF0, 0x30, 0xF1, 0x30, 0xF2,
+-    0x30, 0xFD, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0xFE, 0x00, 0x1F,
+-    0x00, 0x44, 0x00, 0x4A, 0x00, 0x50, 0x00, 0x56, 0x00, 0x5C, 0x00, 0x62, 0x00, 0x68, 0x00, 0x6E,
+-    0x00, 0x74, 0x00, 0x7A, 0x00, 0x80, 0x00, 0x86, 0x00, 0x8C, 0x00, 0x92, 0x00, 0x98, 0x00, 0x9E,
+-    0x00, 0xA4, 0x00, 0xAA, 0x00, 0xB0, 0x00, 0xB6, 0x00, 0xBC, 0x00, 0xC2, 0x00, 0xC8, 0x00, 0xCE,
+-    0x00, 0xD4, 0x00, 0xDA, 0x00, 0xE0, 0x00, 0xE6, 0x00, 0xEC, 0x00, 0xF2, 0x00, 0xF8, 0x00, 0x02,
+-    0x30, 0xAB, 0x30, 0x99, 0x00, 0x02, 0x30, 0xAD, 0x30, 0x99, 0x00, 0x02, 0x30, 0xAF, 0x30, 0x99,
+-    0x00, 0x02, 0x30, 0xB1, 0x30, 0x99, 0x00, 0x02, 0x30, 0xB3, 0x30, 0x99, 0x00, 0x02, 0x30, 0xB5,
+-    0x30, 0x99, 0x00, 0x02, 0x30, 0xB7, 0x30, 0x99, 0x00, 0x02, 0x30, 0xB9, 0x30, 0x99, 0x00, 0x02,
+-    0x30, 0xBB, 0x30, 0x99, 0x00, 0x02, 0x30, 0xBD, 0x30, 0x99, 0x00, 0x02, 0x30, 0xBF, 0x30, 0x99,
+-    0x00, 0x02, 0x30, 0xC1, 0x30, 0x99, 0x00, 0x02, 0x30, 0xC4, 0x30, 0x99, 0x00, 0x02, 0x30, 0xC6,
+-    0x30, 0x99, 0x00, 0x02, 0x30, 0xC8, 0x30, 0x99, 0x00, 0x02, 0x30, 0xCF, 0x30, 0x99, 0x00, 0x02,
+-    0x30, 0xCF, 0x30, 0x9A, 0x00, 0x02, 0x30, 0xD2, 0x30, 0x99, 0x00, 0x02, 0x30, 0xD2, 0x30, 0x9A,
+-    0x00, 0x02, 0x30, 0xD5, 0x30, 0x99, 0x00, 0x02, 0x30, 0xD5, 0x30, 0x9A, 0x00, 0x02, 0x30, 0xD8,
+-    0x30, 0x99, 0x00, 0x02, 0x30, 0xD8, 0x30, 0x9A, 0x00, 0x02, 0x30, 0xDB, 0x30, 0x99, 0x00, 0x02,
+-    0x30, 0xDB, 0x30, 0x9A, 0x00, 0x02, 0x30, 0xA6, 0x30, 0x99, 0x00, 0x02, 0x30, 0xEF, 0x30, 0x99,
+-    0x00, 0x02, 0x30, 0xF0, 0x30, 0x99, 0x00, 0x02, 0x30, 0xF1, 0x30, 0x99, 0x00, 0x02, 0x30, 0xF2,
+-    0x30, 0x99, 0x00, 0x02, 0x30, 0xFD, 0x30, 0x99, 0x00, 0x01, 0x00, 0x1F, 0x30, 0xAC, 0x30, 0xAE,
+-    0x30, 0xB0, 0x30, 0xB2, 0x30, 0xB4, 0x30, 0xB6, 0x30, 0xB8, 0x30, 0xBA, 0x30, 0xBC, 0x30, 0xBE,
+-    0x30, 0xC0, 0x30, 0xC2, 0x30, 0xC5, 0x30, 0xC7, 0x30, 0xC9, 0x30, 0xD0, 0x30, 0xD1, 0x30, 0xD3,
+-    0x30, 0xD4, 0x30, 0xD6, 0x30, 0xD7, 0x30, 0xD9, 0x30, 0xDA, 0x30, 0xDC, 0x30, 0xDD, 0x30, 0xF4,
+-    0x30, 0xF7, 0x30, 0xF8, 0x30, 0xF9, 0x30, 0xFA, 0x30, 0xFE, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01,
+-    0x00, 0x08, 0x00, 0x01, 0x1E, 0x9A, 0x00, 0x89, 0x01, 0x18, 0x02, 0x72, 0x02, 0x8C, 0x02, 0xE6,
+-    0x03, 0x18, 0x04, 0x3E, 0x04, 0x48, 0x04, 0x8A, 0x04, 0xC4, 0x05, 0x6A, 0x05, 0x74, 0x05, 0xA6,
+-    0x05, 0xF4, 0x06, 0x16, 0x06, 0x70, 0x08, 0x56, 0x08, 0x70, 0x08, 0xCE, 0x09, 0x42, 0x09, 0x7C,
+-    0x0B, 0x14, 0x0B, 0x26, 0x0B, 0x68, 0x0B, 0x7A, 0x0B, 0xD4, 0x0C, 0x0E, 0x0D, 0x68, 0x0D, 0x82,
+-    0x0D, 0xDC, 0x0E, 0x0E, 0x0F, 0x34, 0x0F, 0x3E, 0x0F, 0x80, 0x0F, 0xC2, 0x10, 0x60, 0x10, 0x72,
+-    0x10, 0xA4, 0x10, 0xF2, 0x11, 0x14, 0x11, 0x6E, 0x13, 0x54, 0x13, 0x6E, 0x13, 0xCC, 0x14, 0x40,
+-    0x14, 0x82, 0x16, 0x1A, 0x16, 0x2C, 0x16, 0x76, 0x16, 0x88, 0x16, 0xEA, 0x17, 0x24, 0x17, 0x5E,
+-    0x17, 0x68, 0x17, 0x7A, 0x17, 0x94, 0x17, 0xA6, 0x17, 0xE0, 0x17, 0xF2, 0x17, 0xFC, 0x18, 0x06,
+-    0x18, 0x40, 0x18, 0x6A, 0x18, 0x74, 0x18, 0x86, 0x18, 0x90, 0x18, 0x9A, 0x18, 0xCC, 0x19, 0x06,
+-    0x19, 0x10, 0x19, 0x22, 0x19, 0x3C, 0x19, 0x4E, 0x19, 0x88, 0x19, 0x9A, 0x19, 0xA4, 0x19, 0xAE,
+-    0x19, 0xE8, 0x1A, 0x12, 0x1A, 0x1C, 0x1A, 0x2E, 0x1A, 0x38, 0x1A, 0x42, 0x1A, 0x74, 0x1A, 0xAE,
+-    0x1A, 0xE8, 0x1A, 0xF2, 0x1A, 0xFC, 0x1B, 0x1E, 0x1B, 0x40, 0x1B, 0x4A, 0x1B, 0x54, 0x1B, 0x7E,
+-    0x1B, 0xA8, 0x1B, 0xB2, 0x1B, 0xBC, 0x1B, 0xC6, 0x1B, 0xD0, 0x1B, 0xEA, 0x1C, 0x04, 0x1C, 0x0E,
+-    0x1C, 0x18, 0x1C, 0x22, 0x1C, 0x5C, 0x1C, 0x96, 0x1C, 0xD0, 0x1D, 0x0A, 0x1D, 0x14, 0x1D, 0x1E,
+-    0x1D, 0x28, 0x1D, 0x32, 0x1D, 0x3C, 0x1D, 0x46, 0x1D, 0x50, 0x1D, 0x5A, 0x1D, 0x64, 0x1D, 0x6E,
+-    0x1D, 0x78, 0x1D, 0x82, 0x1D, 0x8C, 0x1D, 0x96, 0x1D, 0xA0, 0x1D, 0xAA, 0x1D, 0xB4, 0x1D, 0xBE,
+-    0x1D, 0xD0, 0x1D, 0xE2, 0x1D, 0xEC, 0x1D, 0xF6, 0x1E, 0x08, 0x1E, 0x1A, 0x1E, 0x24, 0x1E, 0x2E,
+-    0x1E, 0x38, 0x1E, 0x42, 0x1E, 0x4C, 0x1E, 0x56, 0x1E, 0x88, 0x00, 0x26, 0x00, 0x4E, 0x00, 0x54,
+-    0x00, 0x5A, 0x00, 0x62, 0x00, 0x6A, 0x00, 0x72, 0x00, 0x7A, 0x00, 0x82, 0x00, 0x8A, 0x00, 0x92,
+-    0x00, 0x98, 0x00, 0x9E, 0x00, 0xA4, 0x00, 0xAC, 0x00, 0xB4, 0x00, 0xBC, 0x00, 0xC4, 0x00, 0xCC,
+-    0x00, 0xD4, 0x00, 0xDC, 0x00, 0xE2, 0x00, 0xEA, 0x00, 0xF0, 0x00, 0xF8, 0x00, 0xFE, 0x01, 0x04,
+-    0x01, 0x0C, 0x01, 0x14, 0x01, 0x1A, 0x01, 0x20, 0x01, 0x26, 0x01, 0x2C, 0x01, 0x34, 0x01, 0x3C,
+-    0x01, 0x42, 0x01, 0x48, 0x01, 0x4E, 0x01, 0x54, 0x00, 0xC0, 0x00, 0x02, 0x03, 0x00, 0x00, 0xC1,
+-    0x00, 0x02, 0x03, 0x01, 0x1E, 0xA6, 0x00, 0x03, 0x03, 0x02, 0x03, 0x00, 0x1E, 0xA4, 0x00, 0x03,
+-    0x03, 0x02, 0x03, 0x01, 0x1E, 0xAA, 0x00, 0x03, 0x03, 0x02, 0x03, 0x03, 0x1E, 0xA8, 0x00, 0x03,
+-    0x03, 0x02, 0x03, 0x09, 0x1E, 0xAC, 0x00, 0x03, 0x03, 0x02, 0x03, 0x23, 0x1E, 0xA6, 0x00, 0x03,
+-    0x03, 0x02, 0x03, 0x40, 0x1E, 0xA4, 0x00, 0x03, 0x03, 0x02, 0x03, 0x41, 0x00, 0xC2, 0x00, 0x02,
+-    0x03, 0x02, 0x00, 0xC3, 0x00, 0x02, 0x03, 0x03, 0x01, 0x00, 0x00, 0x02, 0x03, 0x04, 0x1E, 0xB0,
+-    0x00, 0x03, 0x03, 0x06, 0x03, 0x00, 0x1E, 0xAE, 0x00, 0x03, 0x03, 0x06, 0x03, 0x01, 0x1E, 0xB4,
+-    0x00, 0x03, 0x03, 0x06, 0x03, 0x03, 0x1E, 0xB2, 0x00, 0x03, 0x03, 0x06, 0x03, 0x09, 0x1E, 0xB6,
+-    0x00, 0x03, 0x03, 0x06, 0x03, 0x23, 0x1E, 0xB0, 0x00, 0x03, 0x03, 0x06, 0x03, 0x40, 0x1E, 0xAE,
+-    0x00, 0x03, 0x03, 0x06, 0x03, 0x41, 0x01, 0x02, 0x00, 0x02, 0x03, 0x06, 0x01, 0xE0, 0x00, 0x03,
+-    0x03, 0x07, 0x03, 0x04, 0x02, 0x26, 0x00, 0x02, 0x03, 0x07, 0x01, 0xDE, 0x00, 0x03, 0x03, 0x08,
+-    0x03, 0x04, 0x00, 0xC4, 0x00, 0x02, 0x03, 0x08, 0x1E, 0xA2, 0x00, 0x02, 0x03, 0x09, 0x01, 0xFA,
+-    0x00, 0x03, 0x03, 0x0A, 0x03, 0x01, 0x01, 0xFA, 0x00, 0x03, 0x03, 0x0A, 0x03, 0x41, 0x00, 0xC5,
+-    0x00, 0x02, 0x03, 0x0A, 0x01, 0xCD, 0x00, 0x02, 0x03, 0x0C, 0x02, 0x00, 0x00, 0x02, 0x03, 0x0F,
+-    0x02, 0x02, 0x00, 0x02, 0x03, 0x11, 0x1E, 0xAC, 0x00, 0x03, 0x03, 0x23, 0x03, 0x02, 0x1E, 0xB6,
+-    0x00, 0x03, 0x03, 0x23, 0x03, 0x06, 0x1E, 0xA0, 0x00, 0x02, 0x03, 0x23, 0x1E, 0x00, 0x00, 0x02,
+-    0x03, 0x25, 0x01, 0x04, 0x00, 0x02, 0x03, 0x28, 0x00, 0xC0, 0x00, 0x02, 0x03, 0x40, 0x00, 0xC1,
+-    0x00, 0x02, 0x03, 0x41, 0x00, 0x03, 0x00, 0x08, 0x00, 0x0E, 0x00, 0x14, 0x1E, 0x02, 0x00, 0x02,
+-    0x03, 0x07, 0x1E, 0x04, 0x00, 0x02, 0x03, 0x23, 0x1E, 0x06, 0x00, 0x02, 0x03, 0x31, 0x00, 0x0A,
+-    0x00, 0x16, 0x00, 0x1E, 0x00, 0x24, 0x00, 0x2A, 0x00, 0x30, 0x00, 0x36, 0x00, 0x3E, 0x00, 0x46,
+-    0x00, 0x4C, 0x00, 0x54, 0x1E, 0x08, 0x00, 0x03, 0x03, 0x01, 0x03, 0x27, 0x01, 0x06, 0x00, 0x02,
+-    0x03, 0x01, 0x01, 0x08, 0x00, 0x02, 0x03, 0x02, 0x01, 0x0A, 0x00, 0x02, 0x03, 0x07, 0x01, 0x0C,
+-    0x00, 0x02, 0x03, 0x0C, 0x1E, 0x08, 0x00, 0x03, 0x03, 0x27, 0x03, 0x01, 0x1E, 0x08, 0x00, 0x03,
+-    0x03, 0x27, 0x03, 0x41, 0x00, 0xC7, 0x00, 0x02, 0x03, 0x27, 0x1E, 0x08, 0x00, 0x03, 0x03, 0x41,
+-    0x03, 0x27, 0x01, 0x06, 0x00, 0x02, 0x03, 0x41, 0x00, 0x06, 0x00, 0x0E, 0x00, 0x14, 0x00, 0x1A,
+-    0x00, 0x20, 0x00, 0x26, 0x00, 0x2C, 0x1E, 0x0A, 0x00, 0x02, 0x03, 0x07, 0x01, 0x0E, 0x00, 0x02,
+-    0x03, 0x0C, 0x1E, 0x0C, 0x00, 0x02, 0x03, 0x23, 0x1E, 0x10, 0x00, 0x02, 0x03, 0x27, 0x1E, 0x12,
+-    0x00, 0x02, 0x03, 0x2D, 0x1E, 0x0E, 0x00, 0x02, 0x03, 0x31, 0x00, 0x21, 0x00, 0x44, 0x00, 0x4A,
+-    0x00, 0x50, 0x00, 0x58, 0x00, 0x60, 0x00, 0x68, 0x00, 0x70, 0x00, 0x78, 0x00, 0x80, 0x00, 0x88,
+-    0x00, 0x8E, 0x00, 0x94, 0x00, 0x9C, 0x00, 0xA4, 0x00, 0xAC, 0x00, 0xB4, 0x00, 0xBA, 0x00, 0xC2,
+-    0x00, 0xC8, 0x00, 0xCE, 0x00, 0xD4, 0x00, 0xDA, 0x00, 0xE0, 0x00, 0xE6, 0x00, 0xEC, 0x00, 0xF4,
+-    0x00, 0xFA, 0x01, 0x02, 0x01, 0x08, 0x01, 0x0E, 0x01, 0x14, 0x01, 0x1A, 0x01, 0x20, 0x00, 0xC8,
+-    0x00, 0x02, 0x03, 0x00, 0x00, 0xC9, 0x00, 0x02, 0x03, 0x01, 0x1E, 0xC0, 0x00, 0x03, 0x03, 0x02,
+-    0x03, 0x00, 0x1E, 0xBE, 0x00, 0x03, 0x03, 0x02, 0x03, 0x01, 0x1E, 0xC4, 0x00, 0x03, 0x03, 0x02,
+-    0x03, 0x03, 0x1E, 0xC2, 0x00, 0x03, 0x03, 0x02, 0x03, 0x09, 0x1E, 0xC6, 0x00, 0x03, 0x03, 0x02,
+-    0x03, 0x23, 0x1E, 0xC0, 0x00, 0x03, 0x03, 0x02, 0x03, 0x40, 0x1E, 0xBE, 0x00, 0x03, 0x03, 0x02,
+-    0x03, 0x41, 0x00, 0xCA, 0x00, 0x02, 0x03, 0x02, 0x1E, 0xBC, 0x00, 0x02, 0x03, 0x03, 0x1E, 0x14,
+-    0x00, 0x03, 0x03, 0x04, 0x03, 0x00, 0x1E, 0x16, 0x00, 0x03, 0x03, 0x04, 0x03, 0x01, 0x1E, 0x14,
+-    0x00, 0x03, 0x03, 0x04, 0x03, 0x40, 0x1E, 0x16, 0x00, 0x03, 0x03, 0x04, 0x03, 0x41, 0x01, 0x12,
+-    0x00, 0x02, 0x03, 0x04, 0x1E, 0x1C, 0x00, 0x03, 0x03, 0x06, 0x03, 0x27, 0x01, 0x14, 0x00, 0x02,
+-    0x03, 0x06, 0x01, 0x16, 0x00, 0x02, 0x03, 0x07, 0x00, 0xCB, 0x00, 0x02, 0x03, 0x08, 0x1E, 0xBA,
+-    0x00, 0x02, 0x03, 0x09, 0x01, 0x1A, 0x00, 0x02, 0x03, 0x0C, 0x02, 0x04, 0x00, 0x02, 0x03, 0x0F,
+-    0x02, 0x06, 0x00, 0x02, 0x03, 0x11, 0x1E, 0xC6, 0x00, 0x03, 0x03, 0x23, 0x03, 0x02, 0x1E, 0xB8,
+-    0x00, 0x02, 0x03, 0x23, 0x1E, 0x1C, 0x00, 0x03, 0x03, 0x27, 0x03, 0x06, 0x02, 0x28, 0x00, 0x02,
+-    0x03, 0x27, 0x01, 0x18, 0x00, 0x02, 0x03, 0x28, 0x1E, 0x18, 0x00, 0x02, 0x03, 0x2D, 0x1E, 0x1A,
+-    0x00, 0x02, 0x03, 0x30, 0x00, 0xC8, 0x00, 0x02, 0x03, 0x40, 0x00, 0xC9, 0x00, 0x02, 0x03, 0x41,
+-    0x00, 0x01, 0x00, 0x04, 0x1E, 0x1E, 0x00, 0x02, 0x03, 0x07, 0x00, 0x08, 0x00, 0x12, 0x00, 0x18,
+-    0x00, 0x1E, 0x00, 0x24, 0x00, 0x2A, 0x00, 0x30, 0x00, 0x36, 0x00, 0x3C, 0x01, 0xF4, 0x00, 0x02,
+-    0x03, 0x01, 0x01, 0x1C, 0x00, 0x02, 0x03, 0x02, 0x1E, 0x20, 0x00, 0x02, 0x03, 0x04, 0x01, 0x1E,
+-    0x00, 0x02, 0x03, 0x06, 0x01, 0x20, 0x00, 0x02, 0x03, 0x07, 0x01, 0xE6, 0x00, 0x02, 0x03, 0x0C,
+-    0x01, 0x22, 0x00, 0x02, 0x03, 0x27, 0x01, 0xF4, 0x00, 0x02, 0x03, 0x41, 0x00, 0x07, 0x00, 0x10,
+-    0x00, 0x16, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x28, 0x00, 0x2E, 0x00, 0x34, 0x01, 0x24, 0x00, 0x02,
+-    0x03, 0x02, 0x1E, 0x22, 0x00, 0x02, 0x03, 0x07, 0x1E, 0x26, 0x00, 0x02, 0x03, 0x08, 0x02, 0x1E,
+-    0x00, 0x02, 0x03, 0x0C, 0x1E, 0x24, 0x00, 0x02, 0x03, 0x23, 0x1E, 0x28, 0x00, 0x02, 0x03, 0x27,
+-    0x1E, 0x2A, 0x00, 0x02, 0x03, 0x2E, 0x00, 0x14, 0x00, 0x2A, 0x00, 0x30, 0x00, 0x36, 0x00, 0x3C,
+-    0x00, 0x42, 0x00, 0x48, 0x00, 0x4E, 0x00, 0x54, 0x00, 0x5C, 0x00, 0x64, 0x00, 0x6A, 0x00, 0x70,
+-    0x00, 0x76, 0x00, 0x7C, 0x00, 0x82, 0x00, 0x88, 0x00, 0x8E, 0x00, 0x94, 0x00, 0x9A, 0x00, 0xA0,
+-    0x00, 0xCC, 0x00, 0x02, 0x03, 0x00, 0x00, 0xCD, 0x00, 0x02, 0x03, 0x01, 0x00, 0xCE, 0x00, 0x02,
+-    0x03, 0x02, 0x01, 0x28, 0x00, 0x02, 0x03, 0x03, 0x01, 0x2A, 0x00, 0x02, 0x03, 0x04, 0x01, 0x2C,
+-    0x00, 0x02, 0x03, 0x06, 0x01, 0x30, 0x00, 0x02, 0x03, 0x07, 0x1E, 0x2E, 0x00, 0x03, 0x03, 0x08,
+-    0x03, 0x01, 0x1E, 0x2E, 0x00, 0x03, 0x03, 0x08, 0x03, 0x41, 0x00, 0xCF, 0x00, 0x02, 0x03, 0x08,
+-    0x1E, 0xC8, 0x00, 0x02, 0x03, 0x09, 0x01, 0xCF, 0x00, 0x02, 0x03, 0x0C, 0x02, 0x08, 0x00, 0x02,
+-    0x03, 0x0F, 0x02, 0x0A, 0x00, 0x02, 0x03, 0x11, 0x1E, 0xCA, 0x00, 0x02, 0x03, 0x23, 0x01, 0x2E,
+-    0x00, 0x02, 0x03, 0x28, 0x1E, 0x2C, 0x00, 0x02, 0x03, 0x30, 0x00, 0xCC, 0x00, 0x02, 0x03, 0x40,
+-    0x00, 0xCD, 0x00, 0x02, 0x03, 0x41, 0x1E, 0x2E, 0x00, 0x02, 0x03, 0x44, 0x00, 0x01, 0x00, 0x04,
+-    0x01, 0x34, 0x00, 0x02, 0x03, 0x02, 0x00, 0x06, 0x00, 0x0E, 0x00, 0x14, 0x00, 0x1A, 0x00, 0x20,
+-    0x00, 0x26, 0x00, 0x2C, 0x1E, 0x30, 0x00, 0x02, 0x03, 0x01, 0x01, 0xE8, 0x00, 0x02, 0x03, 0x0C,
+-    0x1E, 0x32, 0x00, 0x02, 0x03, 0x23, 0x01, 0x36, 0x00, 0x02, 0x03, 0x27, 0x1E, 0x34, 0x00, 0x02,
+-    0x03, 0x31, 0x1E, 0x30, 0x00, 0x02, 0x03, 0x41, 0x00, 0x09, 0x00, 0x14, 0x00, 0x1A, 0x00, 0x22,
+-    0x00, 0x28, 0x00, 0x30, 0x00, 0x36, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x48, 0x01, 0x39, 0x00, 0x02,
+-    0x03, 0x01, 0x1E, 0x38, 0x00, 0x03, 0x03, 0x04, 0x03, 0x23, 0x01, 0x3D, 0x00, 0x02, 0x03, 0x0C,
+-    0x1E, 0x38, 0x00, 0x03, 0x03, 0x23, 0x03, 0x04, 0x1E, 0x36, 0x00, 0x02, 0x03, 0x23, 0x01, 0x3B,
+-    0x00, 0x02, 0x03, 0x27, 0x1E, 0x3C, 0x00, 0x02, 0x03, 0x2D, 0x1E, 0x3A, 0x00, 0x02, 0x03, 0x31,
+-    0x01, 0x39, 0x00, 0x02, 0x03, 0x41, 0x00, 0x04, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x16, 0x00, 0x1C,
+-    0x1E, 0x3E, 0x00, 0x02, 0x03, 0x01, 0x1E, 0x40, 0x00, 0x02, 0x03, 0x07, 0x1E, 0x42, 0x00, 0x02,
+-    0x03, 0x23, 0x1E, 0x3E, 0x00, 0x02, 0x03, 0x41, 0x00, 0x0B, 0x00, 0x18, 0x00, 0x1E, 0x00, 0x24,
+-    0x00, 0x2A, 0x00, 0x30, 0x00, 0x36, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x48, 0x00, 0x4E, 0x00, 0x54,
+-    0x01, 0xF8, 0x00, 0x02, 0x03, 0x00, 0x01, 0x43, 0x00, 0x02, 0x03, 0x01, 0x00, 0xD1, 0x00, 0x02,
+-    0x03, 0x03, 0x1E, 0x44, 0x00, 0x02, 0x03, 0x07, 0x01, 0x47, 0x00, 0x02, 0x03, 0x0C, 0x1E, 0x46,
+-    0x00, 0x02, 0x03, 0x23, 0x01, 0x45, 0x00, 0x02, 0x03, 0x27, 0x1E, 0x4A, 0x00, 0x02, 0x03, 0x2D,
+-    0x1E, 0x48, 0x00, 0x02, 0x03, 0x31, 0x01, 0xF8, 0x00, 0x02, 0x03, 0x40, 0x01, 0x43, 0x00, 0x02,
+-    0x03, 0x41, 0x00, 0x34, 0x00, 0x6A, 0x00, 0x72, 0x00, 0x78, 0x00, 0x80, 0x00, 0x86, 0x00, 0x8E,
+-    0x00, 0x96, 0x00, 0x9E, 0x00, 0xA6, 0x00, 0xAE, 0x00, 0xB6, 0x00, 0xBE, 0x00, 0xC4, 0x00, 0xCC,
+-    0x00, 0xD4, 0x00, 0xDC, 0x00, 0xE4, 0x00, 0xEC, 0x00, 0xF2, 0x00, 0xFA, 0x01, 0x02, 0x01, 0x0A,
+-    0x01, 0x12, 0x01, 0x1A, 0x01, 0x20, 0x01, 0x26, 0x01, 0x2E, 0x01, 0x34, 0x01, 0x3C, 0x01, 0x42,
+-    0x01, 0x4A, 0x01, 0x50, 0x01, 0x56, 0x01, 0x5C, 0x01, 0x62, 0x01, 0x68, 0x01, 0x70, 0x01, 0x78,
+-    0x01, 0x80, 0x01, 0x88, 0x01, 0x90, 0x01, 0x98, 0x01, 0xA0, 0x01, 0xA6, 0x01, 0xAE, 0x01, 0xB6,
+-    0x01, 0xBC, 0x01, 0xC4, 0x01, 0xCA, 0x01, 0xD2, 0x01, 0xD8, 0x01, 0xE0, 0x1E, 0xDC, 0x00, 0x03,
+-    0x03, 0x00, 0x03, 0x1B, 0x00, 0xD2, 0x00, 0x02, 0x03, 0x00, 0x1E, 0xDA, 0x00, 0x03, 0x03, 0x01,
+-    0x03, 0x1B, 0x00, 0xD3, 0x00, 0x02, 0x03, 0x01, 0x1E, 0xD2, 0x00, 0x03, 0x03, 0x02, 0x03, 0x00,
+-    0x1E, 0xD0, 0x00, 0x03, 0x03, 0x02, 0x03, 0x01, 0x1E, 0xD6, 0x00, 0x03, 0x03, 0x02, 0x03, 0x03,
+-    0x1E, 0xD4, 0x00, 0x03, 0x03, 0x02, 0x03, 0x09, 0x1E, 0xD8, 0x00, 0x03, 0x03, 0x02, 0x03, 0x23,
+-    0x1E, 0xD2, 0x00, 0x03, 0x03, 0x02, 0x03, 0x40, 0x1E, 0xD0, 0x00, 0x03, 0x03, 0x02, 0x03, 0x41,
+-    0x00, 0xD4, 0x00, 0x02, 0x03, 0x02, 0x1E, 0x4C, 0x00, 0x03, 0x03, 0x03, 0x03, 0x01, 0x02, 0x2C,
+-    0x00, 0x03, 0x03, 0x03, 0x03, 0x04, 0x1E, 0x4E, 0x00, 0x03, 0x03, 0x03, 0x03, 0x08, 0x1E, 0xE0,
+-    0x00, 0x03, 0x03, 0x03, 0x03, 0x1B, 0x1E, 0x4C, 0x00, 0x03, 0x03, 0x03, 0x03, 0x41, 0x00, 0xD5,
+-    0x00, 0x02, 0x03, 0x03, 0x1E, 0x50, 0x00, 0x03, 0x03, 0x04, 0x03, 0x00, 0x1E, 0x52, 0x00, 0x03,
+-    0x03, 0x04, 0x03, 0x01, 0x01, 0xEC, 0x00, 0x03, 0x03, 0x04, 0x03, 0x28, 0x1E, 0x50, 0x00, 0x03,
+-    0x03, 0x04, 0x03, 0x40, 0x1E, 0x52, 0x00, 0x03, 0x03, 0x04, 0x03, 0x41, 0x01, 0x4C, 0x00, 0x02,
+-    0x03, 0x04, 0x01, 0x4E, 0x00, 0x02, 0x03, 0x06, 0x02, 0x30, 0x00, 0x03, 0x03, 0x07, 0x03, 0x04,
+-    0x02, 0x2E, 0x00, 0x02, 0x03, 0x07, 0x02, 0x2A, 0x00, 0x03, 0x03, 0x08, 0x03, 0x04, 0x00, 0xD6,
+-    0x00, 0x02, 0x03, 0x08, 0x1E, 0xDE, 0x00, 0x03, 0x03, 0x09, 0x03, 0x1B, 0x1E, 0xCE, 0x00, 0x02,
+-    0x03, 0x09, 0x01, 0x50, 0x00, 0x02, 0x03, 0x0B, 0x01, 0xD1, 0x00, 0x02, 0x03, 0x0C, 0x02, 0x0C,
+-    0x00, 0x02, 0x03, 0x0F, 0x02, 0x0E, 0x00, 0x02, 0x03, 0x11, 0x1E, 0xDC, 0x00, 0x03, 0x03, 0x1B,
+-    0x03, 0x00, 0x1E, 0xDA, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x01, 0x1E, 0xE0, 0x00, 0x03, 0x03, 0x1B,
+-    0x03, 0x03, 0x1E, 0xDE, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x09, 0x1E, 0xE2, 0x00, 0x03, 0x03, 0x1B,
+-    0x03, 0x23, 0x1E, 0xDC, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x40, 0x1E, 0xDA, 0x00, 0x03, 0x03, 0x1B,
+-    0x03, 0x41, 0x01, 0xA0, 0x00, 0x02, 0x03, 0x1B, 0x1E, 0xD8, 0x00, 0x03, 0x03, 0x23, 0x03, 0x02,
+-    0x1E, 0xE2, 0x00, 0x03, 0x03, 0x23, 0x03, 0x1B, 0x1E, 0xCC, 0x00, 0x02, 0x03, 0x23, 0x01, 0xEC,
+-    0x00, 0x03, 0x03, 0x28, 0x03, 0x04, 0x01, 0xEA, 0x00, 0x02, 0x03, 0x28, 0x1E, 0xDC, 0x00, 0x03,
+-    0x03, 0x40, 0x03, 0x1B, 0x00, 0xD2, 0x00, 0x02, 0x03, 0x40, 0x1E, 0xDA, 0x00, 0x03, 0x03, 0x41,
+-    0x03, 0x1B, 0x00, 0xD3, 0x00, 0x02, 0x03, 0x41, 0x00, 0x03, 0x00, 0x08, 0x00, 0x0E, 0x00, 0x14,
+-    0x1E, 0x54, 0x00, 0x02, 0x03, 0x01, 0x1E, 0x56, 0x00, 0x02, 0x03, 0x07, 0x1E, 0x54, 0x00, 0x02,
+-    0x03, 0x41, 0x00, 0x0B, 0x00, 0x18, 0x00, 0x1E, 0x00, 0x26, 0x00, 0x2C, 0x00, 0x32, 0x00, 0x38,
+-    0x00, 0x3E, 0x00, 0x46, 0x00, 0x4C, 0x00, 0x52, 0x00, 0x58, 0x01, 0x54, 0x00, 0x02, 0x03, 0x01,
+-    0x1E, 0x5C, 0x00, 0x03, 0x03, 0x04, 0x03, 0x23, 0x1E, 0x58, 0x00, 0x02, 0x03, 0x07, 0x01, 0x58,
+-    0x00, 0x02, 0x03, 0x0C, 0x02, 0x10, 0x00, 0x02, 0x03, 0x0F, 0x02, 0x12, 0x00, 0x02, 0x03, 0x11,
+-    0x1E, 0x5C, 0x00, 0x03, 0x03, 0x23, 0x03, 0x04, 0x1E, 0x5A, 0x00, 0x02, 0x03, 0x23, 0x01, 0x56,
+-    0x00, 0x02, 0x03, 0x27, 0x1E, 0x5E, 0x00, 0x02, 0x03, 0x31, 0x01, 0x54, 0x00, 0x02, 0x03, 0x41,
+-    0x00, 0x0D, 0x00, 0x1C, 0x00, 0x24, 0x00, 0x2A, 0x00, 0x30, 0x00, 0x38, 0x00, 0x3E, 0x00, 0x46,
+-    0x00, 0x4C, 0x00, 0x54, 0x00, 0x5A, 0x00, 0x60, 0x00, 0x66, 0x00, 0x6E, 0x1E, 0x64, 0x00, 0x03,
+-    0x03, 0x01, 0x03, 0x07, 0x01, 0x5A, 0x00, 0x02, 0x03, 0x01, 0x01, 0x5C, 0x00, 0x02, 0x03, 0x02,
+-    0x1E, 0x68, 0x00, 0x03, 0x03, 0x07, 0x03, 0x23, 0x1E, 0x60, 0x00, 0x02, 0x03, 0x07, 0x1E, 0x66,
+-    0x00, 0x03, 0x03, 0x0C, 0x03, 0x07, 0x01, 0x60, 0x00, 0x02, 0x03, 0x0C, 0x1E, 0x68, 0x00, 0x03,
+-    0x03, 0x23, 0x03, 0x07, 0x1E, 0x62, 0x00, 0x02, 0x03, 0x23, 0x02, 0x18, 0x00, 0x02, 0x03, 0x26,
+-    0x01, 0x5E, 0x00, 0x02, 0x03, 0x27, 0x1E, 0x64, 0x00, 0x03, 0x03, 0x41, 0x03, 0x07, 0x01, 0x5A,
+-    0x00, 0x02, 0x03, 0x41, 0x00, 0x07, 0x00, 0x10, 0x00, 0x16, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x28,
+-    0x00, 0x2E, 0x00, 0x34, 0x1E, 0x6A, 0x00, 0x02, 0x03, 0x07, 0x01, 0x64, 0x00, 0x02, 0x03, 0x0C,
+-    0x1E, 0x6C, 0x00, 0x02, 0x03, 0x23, 0x02, 0x1A, 0x00, 0x02, 0x03, 0x26, 0x01, 0x62, 0x00, 0x02,
+-    0x03, 0x27, 0x1E, 0x70, 0x00, 0x02, 0x03, 0x2D, 0x1E, 0x6E, 0x00, 0x02, 0x03, 0x31, 0x00, 0x2D,
+-    0x00, 0x5C, 0x00, 0x64, 0x00, 0x6A, 0x00, 0x72, 0x00, 0x78, 0x00, 0x7E, 0x00, 0x86, 0x00, 0x8E,
+-    0x00, 0x96, 0x00, 0x9C, 0x00, 0xA4, 0x00, 0xAA, 0x00, 0xB0, 0x00, 0xB8, 0x00, 0xC0, 0x00, 0xC8,
+-    0x00, 0xD0, 0x00, 0xD8, 0x00, 0xE0, 0x00, 0xE6, 0x00, 0xEE, 0x00, 0xF4, 0x00, 0xFA, 0x01, 0x00,
+-    0x01, 0x06, 0x01, 0x0C, 0x01, 0x12, 0x01, 0x1A, 0x01, 0x22, 0x01, 0x2A, 0x01, 0x32, 0x01, 0x3A,
+-    0x01, 0x42, 0x01, 0x4A, 0x01, 0x50, 0x01, 0x58, 0x01, 0x5E, 0x01, 0x64, 0x01, 0x6A, 0x01, 0x70,
+-    0x01, 0x76, 0x01, 0x7E, 0x01, 0x84, 0x01, 0x8C, 0x01, 0x92, 0x1E, 0xEA, 0x00, 0x03, 0x03, 0x00,
+-    0x03, 0x1B, 0x00, 0xD9, 0x00, 0x02, 0x03, 0x00, 0x1E, 0xE8, 0x00, 0x03, 0x03, 0x01, 0x03, 0x1B,
+-    0x00, 0xDA, 0x00, 0x02, 0x03, 0x01, 0x00, 0xDB, 0x00, 0x02, 0x03, 0x02, 0x1E, 0x78, 0x00, 0x03,
+-    0x03, 0x03, 0x03, 0x01, 0x1E, 0xEE, 0x00, 0x03, 0x03, 0x03, 0x03, 0x1B, 0x1E, 0x78, 0x00, 0x03,
+-    0x03, 0x03, 0x03, 0x41, 0x01, 0x68, 0x00, 0x02, 0x03, 0x03, 0x1E, 0x7A, 0x00, 0x03, 0x03, 0x04,
+-    0x03, 0x08, 0x01, 0x6A, 0x00, 0x02, 0x03, 0x04, 0x01, 0x6C, 0x00, 0x02, 0x03, 0x06, 0x01, 0xDB,
+-    0x00, 0x03, 0x03, 0x08, 0x03, 0x00, 0x01, 0xD7, 0x00, 0x03, 0x03, 0x08, 0x03, 0x01, 0x01, 0xD5,
+-    0x00, 0x03, 0x03, 0x08, 0x03, 0x04, 0x01, 0xD9, 0x00, 0x03, 0x03, 0x08, 0x03, 0x0C, 0x01, 0xDB,
+-    0x00, 0x03, 0x03, 0x08, 0x03, 0x40, 0x01, 0xD7, 0x00, 0x03, 0x03, 0x08, 0x03, 0x41, 0x00, 0xDC,
+-    0x00, 0x02, 0x03, 0x08, 0x1E, 0xEC, 0x00, 0x03, 0x03, 0x09, 0x03, 0x1B, 0x1E, 0xE6, 0x00, 0x02,
+-    0x03, 0x09, 0x01, 0x6E, 0x00, 0x02, 0x03, 0x0A, 0x01, 0x70, 0x00, 0x02, 0x03, 0x0B, 0x01, 0xD3,
+-    0x00, 0x02, 0x03, 0x0C, 0x02, 0x14, 0x00, 0x02, 0x03, 0x0F, 0x02, 0x16, 0x00, 0x02, 0x03, 0x11,
+-    0x1E, 0xEA, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x00, 0x1E, 0xE8, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x01,
+-    0x1E, 0xEE, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x03, 0x1E, 0xEC, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x09,
+-    0x1E, 0xF0, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x23, 0x1E, 0xEA, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x40,
+-    0x1E, 0xE8, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x41, 0x01, 0xAF, 0x00, 0x02, 0x03, 0x1B, 0x1E, 0xF0,
+-    0x00, 0x03, 0x03, 0x23, 0x03, 0x1B, 0x1E, 0xE4, 0x00, 0x02, 0x03, 0x23, 0x1E, 0x72, 0x00, 0x02,
+-    0x03, 0x24, 0x01, 0x72, 0x00, 0x02, 0x03, 0x28, 0x1E, 0x76, 0x00, 0x02, 0x03, 0x2D, 0x1E, 0x74,
+-    0x00, 0x02, 0x03, 0x30, 0x1E, 0xEA, 0x00, 0x03, 0x03, 0x40, 0x03, 0x1B, 0x00, 0xD9, 0x00, 0x02,
+-    0x03, 0x40, 0x1E, 0xE8, 0x00, 0x03, 0x03, 0x41, 0x03, 0x1B, 0x00, 0xDA, 0x00, 0x02, 0x03, 0x41,
+-    0x01, 0xD7, 0x00, 0x02, 0x03, 0x44, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x1E, 0x7C, 0x00, 0x02,
+-    0x03, 0x03, 0x1E, 0x7E, 0x00, 0x02, 0x03, 0x23, 0x00, 0x08, 0x00, 0x12, 0x00, 0x18, 0x00, 0x1E,
+-    0x00, 0x24, 0x00, 0x2A, 0x00, 0x30, 0x00, 0x36, 0x00, 0x3C, 0x1E, 0x80, 0x00, 0x02, 0x03, 0x00,
+-    0x1E, 0x82, 0x00, 0x02, 0x03, 0x01, 0x01, 0x74, 0x00, 0x02, 0x03, 0x02, 0x1E, 0x86, 0x00, 0x02,
+-    0x03, 0x07, 0x1E, 0x84, 0x00, 0x02, 0x03, 0x08, 0x1E, 0x88, 0x00, 0x02, 0x03, 0x23, 0x1E, 0x80,
+-    0x00, 0x02, 0x03, 0x40, 0x1E, 0x82, 0x00, 0x02, 0x03, 0x41, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C,
+-    0x1E, 0x8A, 0x00, 0x02, 0x03, 0x07, 0x1E, 0x8C, 0x00, 0x02, 0x03, 0x08, 0x00, 0x0B, 0x00, 0x18,
+-    0x00, 0x1E, 0x00, 0x24, 0x00, 0x2A, 0x00, 0x30, 0x00, 0x36, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x48,
+-    0x00, 0x4E, 0x00, 0x54, 0x1E, 0xF2, 0x00, 0x02, 0x03, 0x00, 0x00, 0xDD, 0x00, 0x02, 0x03, 0x01,
+-    0x01, 0x76, 0x00, 0x02, 0x03, 0x02, 0x1E, 0xF8, 0x00, 0x02, 0x03, 0x03, 0x02, 0x32, 0x00, 0x02,
+-    0x03, 0x04, 0x1E, 0x8E, 0x00, 0x02, 0x03, 0x07, 0x01, 0x78, 0x00, 0x02, 0x03, 0x08, 0x1E, 0xF6,
+-    0x00, 0x02, 0x03, 0x09, 0x1E, 0xF4, 0x00, 0x02, 0x03, 0x23, 0x1E, 0xF2, 0x00, 0x02, 0x03, 0x40,
+-    0x00, 0xDD, 0x00, 0x02, 0x03, 0x41, 0x00, 0x07, 0x00, 0x10, 0x00, 0x16, 0x00, 0x1C, 0x00, 0x22,
+-    0x00, 0x28, 0x00, 0x2E, 0x00, 0x34, 0x01, 0x79, 0x00, 0x02, 0x03, 0x01, 0x1E, 0x90, 0x00, 0x02,
+-    0x03, 0x02, 0x01, 0x7B, 0x00, 0x02, 0x03, 0x07, 0x01, 0x7D, 0x00, 0x02, 0x03, 0x0C, 0x1E, 0x92,
+-    0x00, 0x02, 0x03, 0x23, 0x1E, 0x94, 0x00, 0x02, 0x03, 0x31, 0x01, 0x79, 0x00, 0x02, 0x03, 0x41,
++    0x00, 0x04, 0x21, 0x26, 0x03, 0x45, 0x03, 0x43, 0x03, 0x00, 0x00, 0x04, 0x21, 0x26, 0x03, 0x45,
++    0x03, 0x43, 0x03, 0x01, 0x00, 0x01, 0x00, 0x02, 0x1F, 0xAA, 0x1F, 0xAC, 0x00, 0x01, 0x00, 0x1E,
++    0x00, 0x02, 0x00, 0x0A, 0x00, 0x14, 0x00, 0x04, 0x21, 0x26, 0x03, 0x45, 0x03, 0x43, 0x03, 0x40,
++    0x00, 0x04, 0x21, 0x26, 0x03, 0x45, 0x03, 0x43, 0x03, 0x41, 0x00, 0x01, 0x00, 0x02, 0x1F, 0xAA,
++    0x1F, 0xAC, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x01, 0x36, 0x00, 0x16,
++    0x00, 0x32, 0x00, 0x3C, 0x00, 0x46, 0x00, 0x50, 0x00, 0x5A, 0x00, 0x64, 0x00, 0x6E, 0x00, 0x78,
++    0x00, 0x82, 0x00, 0x8C, 0x00, 0x96, 0x00, 0xA0, 0x00, 0xAA, 0x00, 0xB4, 0x00, 0xBE, 0x00, 0xC8,
++    0x00, 0xD2, 0x00, 0xE4, 0x00, 0xF6, 0x01, 0x08, 0x01, 0x1A, 0x01, 0x2C, 0x00, 0x01, 0x00, 0x04,
++    0x30, 0x94, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0x4C, 0x00, 0x02, 0x30, 0x99,
++    0x00, 0x01, 0x00, 0x04, 0x30, 0x4E, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0x50,
++    0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0x52, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01,
++    0x00, 0x04, 0x30, 0x54, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0x56, 0x00, 0x02,
++    0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0x58, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04,
++    0x30, 0x5A, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0x5C, 0x00, 0x02, 0x30, 0x99,
++    0x00, 0x01, 0x00, 0x04, 0x30, 0x5E, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0x60,
++    0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0x62, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01,
++    0x00, 0x04, 0x30, 0x65, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0x67, 0x00, 0x02,
++    0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0x69, 0x00, 0x02, 0x30, 0x99, 0x00, 0x02, 0x00, 0x06,
++    0x00, 0x0C, 0x30, 0x70, 0x00, 0x02, 0x30, 0x99, 0x30, 0x71, 0x00, 0x02, 0x30, 0x9A, 0x00, 0x02,
++    0x00, 0x06, 0x00, 0x0C, 0x30, 0x73, 0x00, 0x02, 0x30, 0x99, 0x30, 0x74, 0x00, 0x02, 0x30, 0x9A,
++    0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x30, 0x76, 0x00, 0x02, 0x30, 0x99, 0x30, 0x77, 0x00, 0x02,
++    0x30, 0x9A, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x30, 0x79, 0x00, 0x02, 0x30, 0x99, 0x30, 0x7A,
++    0x00, 0x02, 0x30, 0x9A, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x30, 0x7C, 0x00, 0x02, 0x30, 0x99,
++    0x30, 0x7D, 0x00, 0x02, 0x30, 0x9A, 0x00, 0x01, 0x00, 0x04, 0x30, 0x9E, 0x00, 0x02, 0x30, 0x99,
++    0x00, 0x01, 0x00, 0x16, 0x30, 0x46, 0x30, 0x4B, 0x30, 0x4D, 0x30, 0x4F, 0x30, 0x51, 0x30, 0x53,
++    0x30, 0x55, 0x30, 0x57, 0x30, 0x59, 0x30, 0x5B, 0x30, 0x5D, 0x30, 0x5F, 0x30, 0x61, 0x30, 0x64,
++    0x30, 0x66, 0x30, 0x68, 0x30, 0x6F, 0x30, 0x72, 0x30, 0x75, 0x30, 0x78, 0x30, 0x7B, 0x30, 0x9D,
++    0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0xDE, 0x00, 0x1B, 0x00, 0x3C,
++    0x00, 0x42, 0x00, 0x48, 0x00, 0x4E, 0x00, 0x54, 0x00, 0x5A, 0x00, 0x60, 0x00, 0x66, 0x00, 0x6C,
++    0x00, 0x72, 0x00, 0x78, 0x00, 0x7E, 0x00, 0x84, 0x00, 0x8A, 0x00, 0x90, 0x00, 0x96, 0x00, 0x9C,
++    0x00, 0xA2, 0x00, 0xA8, 0x00, 0xAE, 0x00, 0xB4, 0x00, 0xBA, 0x00, 0xC0, 0x00, 0xC6, 0x00, 0xCC,
++    0x00, 0xD2, 0x00, 0xD8, 0x00, 0x02, 0x30, 0x4B, 0x30, 0x99, 0x00, 0x02, 0x30, 0x4D, 0x30, 0x99,
++    0x00, 0x02, 0x30, 0x4F, 0x30, 0x99, 0x00, 0x02, 0x30, 0x51, 0x30, 0x99, 0x00, 0x02, 0x30, 0x53,
++    0x30, 0x99, 0x00, 0x02, 0x30, 0x55, 0x30, 0x99, 0x00, 0x02, 0x30, 0x57, 0x30, 0x99, 0x00, 0x02,
++    0x30, 0x59, 0x30, 0x99, 0x00, 0x02, 0x30, 0x5B, 0x30, 0x99, 0x00, 0x02, 0x30, 0x5D, 0x30, 0x99,
++    0x00, 0x02, 0x30, 0x5F, 0x30, 0x99, 0x00, 0x02, 0x30, 0x61, 0x30, 0x99, 0x00, 0x02, 0x30, 0x64,
++    0x30, 0x99, 0x00, 0x02, 0x30, 0x66, 0x30, 0x99, 0x00, 0x02, 0x30, 0x68, 0x30, 0x99, 0x00, 0x02,
++    0x30, 0x6F, 0x30, 0x99, 0x00, 0x02, 0x30, 0x6F, 0x30, 0x9A, 0x00, 0x02, 0x30, 0x72, 0x30, 0x99,
++    0x00, 0x02, 0x30, 0x72, 0x30, 0x9A, 0x00, 0x02, 0x30, 0x75, 0x30, 0x99, 0x00, 0x02, 0x30, 0x75,
++    0x30, 0x9A, 0x00, 0x02, 0x30, 0x78, 0x30, 0x99, 0x00, 0x02, 0x30, 0x78, 0x30, 0x9A, 0x00, 0x02,
++    0x30, 0x7B, 0x30, 0x99, 0x00, 0x02, 0x30, 0x7B, 0x30, 0x9A, 0x00, 0x02, 0x30, 0x46, 0x30, 0x99,
++    0x00, 0x02, 0x30, 0x9D, 0x30, 0x99, 0x00, 0x01, 0x00, 0x1B, 0x30, 0x4C, 0x30, 0x4E, 0x30, 0x50,
++    0x30, 0x52, 0x30, 0x54, 0x30, 0x56, 0x30, 0x58, 0x30, 0x5A, 0x30, 0x5C, 0x30, 0x5E, 0x30, 0x60,
++    0x30, 0x62, 0x30, 0x65, 0x30, 0x67, 0x30, 0x69, 0x30, 0x70, 0x30, 0x71, 0x30, 0x73, 0x30, 0x74,
++    0x30, 0x76, 0x30, 0x77, 0x30, 0x79, 0x30, 0x7A, 0x30, 0x7C, 0x30, 0x7D, 0x30, 0x94, 0x30, 0x9E,
++    0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0x44, 0x00, 0x03, 0x00, 0x0C,
++    0x00, 0x16, 0x00, 0x3A, 0x00, 0x01, 0x00, 0x04, 0x0C, 0xC0, 0x00, 0x02, 0x0C, 0xD5, 0x00, 0x04,
++    0x00, 0x0A, 0x00, 0x12, 0x00, 0x18, 0x00, 0x1E, 0x0C, 0xCB, 0x00, 0x03, 0x0C, 0xC2, 0x0C, 0xD5,
++    0x0C, 0xCA, 0x00, 0x02, 0x0C, 0xC2, 0x0C, 0xC7, 0x00, 0x02, 0x0C, 0xD5, 0x0C, 0xC8, 0x00, 0x02,
++    0x0C, 0xD6, 0x00, 0x01, 0x00, 0x04, 0x0C, 0xCB, 0x00, 0x02, 0x0C, 0xD5, 0x00, 0x01, 0x00, 0x03,
++    0x0C, 0xBF, 0x0C, 0xC6, 0x0C, 0xCA, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0A, 0x00, 0x46,
++    0x00, 0x01, 0x00, 0x2E, 0x00, 0x05, 0x00, 0x10, 0x00, 0x16, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x28,
++    0x00, 0x02, 0x0C, 0xBF, 0x0C, 0xD5, 0x00, 0x02, 0x0C, 0xC6, 0x0C, 0xD5, 0x00, 0x02, 0x0C, 0xC6,
++    0x0C, 0xD6, 0x00, 0x02, 0x0C, 0xC6, 0x0C, 0xC2, 0x00, 0x02, 0x0C, 0xCA, 0x0C, 0xD5, 0x00, 0x01,
++    0x00, 0x05, 0x0C, 0xC0, 0x0C, 0xC7, 0x0C, 0xC8, 0x0C, 0xCA, 0x0C, 0xCB, 0x00, 0x01, 0x00, 0x10,
++    0x00, 0x01, 0x00, 0x08, 0x00, 0x03, 0x0C, 0xC6, 0x0C, 0xC2, 0x0C, 0xD5, 0x00, 0x01, 0x00, 0x01,
++    0x0C, 0xCB, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x01, 0x66, 0x00, 0x1A,
++    0x00, 0x3A, 0x00, 0x44, 0x00, 0x4E, 0x00, 0x58, 0x00, 0x62, 0x00, 0x6C, 0x00, 0x76, 0x00, 0x80,
++    0x00, 0x8A, 0x00, 0x94, 0x00, 0x9E, 0x00, 0xA8, 0x00, 0xB2, 0x00, 0xBC, 0x00, 0xC6, 0x00, 0xD0,
++    0x00, 0xDA, 0x00, 0xEC, 0x00, 0xFE, 0x01, 0x10, 0x01, 0x22, 0x01, 0x34, 0x01, 0x3E, 0x01, 0x48,
++    0x01, 0x52, 0x01, 0x5C, 0x00, 0x01, 0x00, 0x04, 0x30, 0xF4, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01,
++    0x00, 0x04, 0x30, 0xAC, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0xAE, 0x00, 0x02,
++    0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0xB0, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04,
++    0x30, 0xB2, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0xB4, 0x00, 0x02, 0x30, 0x99,
++    0x00, 0x01, 0x00, 0x04, 0x30, 0xB6, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0xB8,
++    0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0xBA, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01,
++    0x00, 0x04, 0x30, 0xBC, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0xBE, 0x00, 0x02,
++    0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0xC0, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04,
++    0x30, 0xC2, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0xC5, 0x00, 0x02, 0x30, 0x99,
++    0x00, 0x01, 0x00, 0x04, 0x30, 0xC7, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0xC9,
++    0x00, 0x02, 0x30, 0x99, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x30, 0xD0, 0x00, 0x02, 0x30, 0x99,
++    0x30, 0xD1, 0x00, 0x02, 0x30, 0x9A, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x30, 0xD3, 0x00, 0x02,
++    0x30, 0x99, 0x30, 0xD4, 0x00, 0x02, 0x30, 0x9A, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x30, 0xD6,
++    0x00, 0x02, 0x30, 0x99, 0x30, 0xD7, 0x00, 0x02, 0x30, 0x9A, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C,
++    0x30, 0xD9, 0x00, 0x02, 0x30, 0x99, 0x30, 0xDA, 0x00, 0x02, 0x30, 0x9A, 0x00, 0x02, 0x00, 0x06,
++    0x00, 0x0C, 0x30, 0xDC, 0x00, 0x02, 0x30, 0x99, 0x30, 0xDD, 0x00, 0x02, 0x30, 0x9A, 0x00, 0x01,
++    0x00, 0x04, 0x30, 0xF7, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0xF8, 0x00, 0x02,
++    0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0xF9, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04,
++    0x30, 0xFA, 0x00, 0x02, 0x30, 0x99, 0x00, 0x01, 0x00, 0x04, 0x30, 0xFE, 0x00, 0x02, 0x30, 0x99,
++    0x00, 0x01, 0x00, 0x1A, 0x30, 0xA6, 0x30, 0xAB, 0x30, 0xAD, 0x30, 0xAF, 0x30, 0xB1, 0x30, 0xB3,
++    0x30, 0xB5, 0x30, 0xB7, 0x30, 0xB9, 0x30, 0xBB, 0x30, 0xBD, 0x30, 0xBF, 0x30, 0xC1, 0x30, 0xC4,
++    0x30, 0xC6, 0x30, 0xC8, 0x30, 0xCF, 0x30, 0xD2, 0x30, 0xD5, 0x30, 0xD8, 0x30, 0xDB, 0x30, 0xEF,
++    0x30, 0xF0, 0x30, 0xF1, 0x30, 0xF2, 0x30, 0xFD, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08,
++    0x00, 0x01, 0x00, 0xFE, 0x00, 0x1F, 0x00, 0x44, 0x00, 0x4A, 0x00, 0x50, 0x00, 0x56, 0x00, 0x5C,
++    0x00, 0x62, 0x00, 0x68, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x7A, 0x00, 0x80, 0x00, 0x86, 0x00, 0x8C,
++    0x00, 0x92, 0x00, 0x98, 0x00, 0x9E, 0x00, 0xA4, 0x00, 0xAA, 0x00, 0xB0, 0x00, 0xB6, 0x00, 0xBC,
++    0x00, 0xC2, 0x00, 0xC8, 0x00, 0xCE, 0x00, 0xD4, 0x00, 0xDA, 0x00, 0xE0, 0x00, 0xE6, 0x00, 0xEC,
++    0x00, 0xF2, 0x00, 0xF8, 0x00, 0x02, 0x30, 0xAB, 0x30, 0x99, 0x00, 0x02, 0x30, 0xAD, 0x30, 0x99,
++    0x00, 0x02, 0x30, 0xAF, 0x30, 0x99, 0x00, 0x02, 0x30, 0xB1, 0x30, 0x99, 0x00, 0x02, 0x30, 0xB3,
++    0x30, 0x99, 0x00, 0x02, 0x30, 0xB5, 0x30, 0x99, 0x00, 0x02, 0x30, 0xB7, 0x30, 0x99, 0x00, 0x02,
++    0x30, 0xB9, 0x30, 0x99, 0x00, 0x02, 0x30, 0xBB, 0x30, 0x99, 0x00, 0x02, 0x30, 0xBD, 0x30, 0x99,
++    0x00, 0x02, 0x30, 0xBF, 0x30, 0x99, 0x00, 0x02, 0x30, 0xC1, 0x30, 0x99, 0x00, 0x02, 0x30, 0xC4,
++    0x30, 0x99, 0x00, 0x02, 0x30, 0xC6, 0x30, 0x99, 0x00, 0x02, 0x30, 0xC8, 0x30, 0x99, 0x00, 0x02,
++    0x30, 0xCF, 0x30, 0x99, 0x00, 0x02, 0x30, 0xCF, 0x30, 0x9A, 0x00, 0x02, 0x30, 0xD2, 0x30, 0x99,
++    0x00, 0x02, 0x30, 0xD2, 0x30, 0x9A, 0x00, 0x02, 0x30, 0xD5, 0x30, 0x99, 0x00, 0x02, 0x30, 0xD5,
++    0x30, 0x9A, 0x00, 0x02, 0x30, 0xD8, 0x30, 0x99, 0x00, 0x02, 0x30, 0xD8, 0x30, 0x9A, 0x00, 0x02,
++    0x30, 0xDB, 0x30, 0x99, 0x00, 0x02, 0x30, 0xDB, 0x30, 0x9A, 0x00, 0x02, 0x30, 0xA6, 0x30, 0x99,
++    0x00, 0x02, 0x30, 0xEF, 0x30, 0x99, 0x00, 0x02, 0x30, 0xF0, 0x30, 0x99, 0x00, 0x02, 0x30, 0xF1,
++    0x30, 0x99, 0x00, 0x02, 0x30, 0xF2, 0x30, 0x99, 0x00, 0x02, 0x30, 0xFD, 0x30, 0x99, 0x00, 0x01,
++    0x00, 0x1F, 0x30, 0xAC, 0x30, 0xAE, 0x30, 0xB0, 0x30, 0xB2, 0x30, 0xB4, 0x30, 0xB6, 0x30, 0xB8,
++    0x30, 0xBA, 0x30, 0xBC, 0x30, 0xBE, 0x30, 0xC0, 0x30, 0xC2, 0x30, 0xC5, 0x30, 0xC7, 0x30, 0xC9,
++    0x30, 0xD0, 0x30, 0xD1, 0x30, 0xD3, 0x30, 0xD4, 0x30, 0xD6, 0x30, 0xD7, 0x30, 0xD9, 0x30, 0xDA,
++    0x30, 0xDC, 0x30, 0xDD, 0x30, 0xF4, 0x30, 0xF7, 0x30, 0xF8, 0x30, 0xF9, 0x30, 0xFA, 0x30, 0xFE,
++    0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x1E, 0x9A, 0x00, 0x89, 0x01, 0x18,
++    0x02, 0x72, 0x02, 0x8C, 0x02, 0xE6, 0x03, 0x18, 0x04, 0x3E, 0x04, 0x48, 0x04, 0x8A, 0x04, 0xC4,
++    0x05, 0x6A, 0x05, 0x74, 0x05, 0xA6, 0x05, 0xF4, 0x06, 0x16, 0x06, 0x70, 0x08, 0x56, 0x08, 0x70,
++    0x08, 0xCE, 0x09, 0x42, 0x09, 0x7C, 0x0B, 0x14, 0x0B, 0x26, 0x0B, 0x68, 0x0B, 0x7A, 0x0B, 0xD4,
++    0x0C, 0x0E, 0x0D, 0x68, 0x0D, 0x82, 0x0D, 0xDC, 0x0E, 0x0E, 0x0F, 0x34, 0x0F, 0x3E, 0x0F, 0x80,
++    0x0F, 0xC2, 0x10, 0x60, 0x10, 0x72, 0x10, 0xA4, 0x10, 0xF2, 0x11, 0x14, 0x11, 0x6E, 0x13, 0x54,
++    0x13, 0x6E, 0x13, 0xCC, 0x14, 0x40, 0x14, 0x82, 0x16, 0x1A, 0x16, 0x2C, 0x16, 0x76, 0x16, 0x88,
++    0x16, 0xEA, 0x17, 0x24, 0x17, 0x5E, 0x17, 0x68, 0x17, 0x7A, 0x17, 0x94, 0x17, 0xA6, 0x17, 0xE0,
++    0x17, 0xF2, 0x17, 0xFC, 0x18, 0x06, 0x18, 0x40, 0x18, 0x6A, 0x18, 0x74, 0x18, 0x86, 0x18, 0x90,
++    0x18, 0x9A, 0x18, 0xCC, 0x19, 0x06, 0x19, 0x10, 0x19, 0x22, 0x19, 0x3C, 0x19, 0x4E, 0x19, 0x88,
++    0x19, 0x9A, 0x19, 0xA4, 0x19, 0xAE, 0x19, 0xE8, 0x1A, 0x12, 0x1A, 0x1C, 0x1A, 0x2E, 0x1A, 0x38,
++    0x1A, 0x42, 0x1A, 0x74, 0x1A, 0xAE, 0x1A, 0xE8, 0x1A, 0xF2, 0x1A, 0xFC, 0x1B, 0x1E, 0x1B, 0x40,
++    0x1B, 0x4A, 0x1B, 0x54, 0x1B, 0x7E, 0x1B, 0xA8, 0x1B, 0xB2, 0x1B, 0xBC, 0x1B, 0xC6, 0x1B, 0xD0,
++    0x1B, 0xEA, 0x1C, 0x04, 0x1C, 0x0E, 0x1C, 0x18, 0x1C, 0x22, 0x1C, 0x5C, 0x1C, 0x96, 0x1C, 0xD0,
++    0x1D, 0x0A, 0x1D, 0x14, 0x1D, 0x1E, 0x1D, 0x28, 0x1D, 0x32, 0x1D, 0x3C, 0x1D, 0x46, 0x1D, 0x50,
++    0x1D, 0x5A, 0x1D, 0x64, 0x1D, 0x6E, 0x1D, 0x78, 0x1D, 0x82, 0x1D, 0x8C, 0x1D, 0x96, 0x1D, 0xA0,
++    0x1D, 0xAA, 0x1D, 0xB4, 0x1D, 0xBE, 0x1D, 0xD0, 0x1D, 0xE2, 0x1D, 0xEC, 0x1D, 0xF6, 0x1E, 0x08,
++    0x1E, 0x1A, 0x1E, 0x24, 0x1E, 0x2E, 0x1E, 0x38, 0x1E, 0x42, 0x1E, 0x4C, 0x1E, 0x56, 0x1E, 0x88,
+     0x00, 0x26, 0x00, 0x4E, 0x00, 0x54, 0x00, 0x5A, 0x00, 0x62, 0x00, 0x6A, 0x00, 0x72, 0x00, 0x7A,
+     0x00, 0x82, 0x00, 0x8A, 0x00, 0x92, 0x00, 0x98, 0x00, 0x9E, 0x00, 0xA4, 0x00, 0xAC, 0x00, 0xB4,
+     0x00, 0xBC, 0x00, 0xC4, 0x00, 0xCC, 0x00, 0xD4, 0x00, 0xDC, 0x00, 0xE2, 0x00, 0xEA, 0x00, 0xF0,
+     0x00, 0xF8, 0x00, 0xFE, 0x01, 0x04, 0x01, 0x0C, 0x01, 0x14, 0x01, 0x1A, 0x01, 0x20, 0x01, 0x26,
+-    0x01, 0x2C, 0x01, 0x34, 0x01, 0x3C, 0x01, 0x42, 0x01, 0x48, 0x01, 0x4E, 0x01, 0x54, 0x00, 0xE0,
+-    0x00, 0x02, 0x03, 0x00, 0x00, 0xE1, 0x00, 0x02, 0x03, 0x01, 0x1E, 0xA7, 0x00, 0x03, 0x03, 0x02,
+-    0x03, 0x00, 0x1E, 0xA5, 0x00, 0x03, 0x03, 0x02, 0x03, 0x01, 0x1E, 0xAB, 0x00, 0x03, 0x03, 0x02,
+-    0x03, 0x03, 0x1E, 0xA9, 0x00, 0x03, 0x03, 0x02, 0x03, 0x09, 0x1E, 0xAD, 0x00, 0x03, 0x03, 0x02,
+-    0x03, 0x23, 0x1E, 0xA7, 0x00, 0x03, 0x03, 0x02, 0x03, 0x40, 0x1E, 0xA5, 0x00, 0x03, 0x03, 0x02,
+-    0x03, 0x41, 0x00, 0xE2, 0x00, 0x02, 0x03, 0x02, 0x00, 0xE3, 0x00, 0x02, 0x03, 0x03, 0x01, 0x01,
+-    0x00, 0x02, 0x03, 0x04, 0x1E, 0xB1, 0x00, 0x03, 0x03, 0x06, 0x03, 0x00, 0x1E, 0xAF, 0x00, 0x03,
+-    0x03, 0x06, 0x03, 0x01, 0x1E, 0xB5, 0x00, 0x03, 0x03, 0x06, 0x03, 0x03, 0x1E, 0xB3, 0x00, 0x03,
+-    0x03, 0x06, 0x03, 0x09, 0x1E, 0xB7, 0x00, 0x03, 0x03, 0x06, 0x03, 0x23, 0x1E, 0xB1, 0x00, 0x03,
+-    0x03, 0x06, 0x03, 0x40, 0x1E, 0xAF, 0x00, 0x03, 0x03, 0x06, 0x03, 0x41, 0x01, 0x03, 0x00, 0x02,
+-    0x03, 0x06, 0x01, 0xE1, 0x00, 0x03, 0x03, 0x07, 0x03, 0x04, 0x02, 0x27, 0x00, 0x02, 0x03, 0x07,
+-    0x01, 0xDF, 0x00, 0x03, 0x03, 0x08, 0x03, 0x04, 0x00, 0xE4, 0x00, 0x02, 0x03, 0x08, 0x1E, 0xA3,
+-    0x00, 0x02, 0x03, 0x09, 0x01, 0xFB, 0x00, 0x03, 0x03, 0x0A, 0x03, 0x01, 0x01, 0xFB, 0x00, 0x03,
+-    0x03, 0x0A, 0x03, 0x41, 0x00, 0xE5, 0x00, 0x02, 0x03, 0x0A, 0x01, 0xCE, 0x00, 0x02, 0x03, 0x0C,
+-    0x02, 0x01, 0x00, 0x02, 0x03, 0x0F, 0x02, 0x03, 0x00, 0x02, 0x03, 0x11, 0x1E, 0xAD, 0x00, 0x03,
+-    0x03, 0x23, 0x03, 0x02, 0x1E, 0xB7, 0x00, 0x03, 0x03, 0x23, 0x03, 0x06, 0x1E, 0xA1, 0x00, 0x02,
+-    0x03, 0x23, 0x1E, 0x01, 0x00, 0x02, 0x03, 0x25, 0x01, 0x05, 0x00, 0x02, 0x03, 0x28, 0x00, 0xE0,
+-    0x00, 0x02, 0x03, 0x40, 0x00, 0xE1, 0x00, 0x02, 0x03, 0x41, 0x00, 0x03, 0x00, 0x08, 0x00, 0x0E,
+-    0x00, 0x14, 0x1E, 0x03, 0x00, 0x02, 0x03, 0x07, 0x1E, 0x05, 0x00, 0x02, 0x03, 0x23, 0x1E, 0x07,
++    0x01, 0x2C, 0x01, 0x34, 0x01, 0x3C, 0x01, 0x42, 0x01, 0x48, 0x01, 0x4E, 0x01, 0x54, 0x00, 0xC0,
++    0x00, 0x02, 0x03, 0x00, 0x00, 0xC1, 0x00, 0x02, 0x03, 0x01, 0x1E, 0xA6, 0x00, 0x03, 0x03, 0x02,
++    0x03, 0x00, 0x1E, 0xA4, 0x00, 0x03, 0x03, 0x02, 0x03, 0x01, 0x1E, 0xAA, 0x00, 0x03, 0x03, 0x02,
++    0x03, 0x03, 0x1E, 0xA8, 0x00, 0x03, 0x03, 0x02, 0x03, 0x09, 0x1E, 0xAC, 0x00, 0x03, 0x03, 0x02,
++    0x03, 0x23, 0x1E, 0xA6, 0x00, 0x03, 0x03, 0x02, 0x03, 0x40, 0x1E, 0xA4, 0x00, 0x03, 0x03, 0x02,
++    0x03, 0x41, 0x00, 0xC2, 0x00, 0x02, 0x03, 0x02, 0x00, 0xC3, 0x00, 0x02, 0x03, 0x03, 0x01, 0x00,
++    0x00, 0x02, 0x03, 0x04, 0x1E, 0xB0, 0x00, 0x03, 0x03, 0x06, 0x03, 0x00, 0x1E, 0xAE, 0x00, 0x03,
++    0x03, 0x06, 0x03, 0x01, 0x1E, 0xB4, 0x00, 0x03, 0x03, 0x06, 0x03, 0x03, 0x1E, 0xB2, 0x00, 0x03,
++    0x03, 0x06, 0x03, 0x09, 0x1E, 0xB6, 0x00, 0x03, 0x03, 0x06, 0x03, 0x23, 0x1E, 0xB0, 0x00, 0x03,
++    0x03, 0x06, 0x03, 0x40, 0x1E, 0xAE, 0x00, 0x03, 0x03, 0x06, 0x03, 0x41, 0x01, 0x02, 0x00, 0x02,
++    0x03, 0x06, 0x01, 0xE0, 0x00, 0x03, 0x03, 0x07, 0x03, 0x04, 0x02, 0x26, 0x00, 0x02, 0x03, 0x07,
++    0x01, 0xDE, 0x00, 0x03, 0x03, 0x08, 0x03, 0x04, 0x00, 0xC4, 0x00, 0x02, 0x03, 0x08, 0x1E, 0xA2,
++    0x00, 0x02, 0x03, 0x09, 0x01, 0xFA, 0x00, 0x03, 0x03, 0x0A, 0x03, 0x01, 0x01, 0xFA, 0x00, 0x03,
++    0x03, 0x0A, 0x03, 0x41, 0x00, 0xC5, 0x00, 0x02, 0x03, 0x0A, 0x01, 0xCD, 0x00, 0x02, 0x03, 0x0C,
++    0x02, 0x00, 0x00, 0x02, 0x03, 0x0F, 0x02, 0x02, 0x00, 0x02, 0x03, 0x11, 0x1E, 0xAC, 0x00, 0x03,
++    0x03, 0x23, 0x03, 0x02, 0x1E, 0xB6, 0x00, 0x03, 0x03, 0x23, 0x03, 0x06, 0x1E, 0xA0, 0x00, 0x02,
++    0x03, 0x23, 0x1E, 0x00, 0x00, 0x02, 0x03, 0x25, 0x01, 0x04, 0x00, 0x02, 0x03, 0x28, 0x00, 0xC0,
++    0x00, 0x02, 0x03, 0x40, 0x00, 0xC1, 0x00, 0x02, 0x03, 0x41, 0x00, 0x03, 0x00, 0x08, 0x00, 0x0E,
++    0x00, 0x14, 0x1E, 0x02, 0x00, 0x02, 0x03, 0x07, 0x1E, 0x04, 0x00, 0x02, 0x03, 0x23, 0x1E, 0x06,
+     0x00, 0x02, 0x03, 0x31, 0x00, 0x0A, 0x00, 0x16, 0x00, 0x1E, 0x00, 0x24, 0x00, 0x2A, 0x00, 0x30,
+-    0x00, 0x36, 0x00, 0x3E, 0x00, 0x46, 0x00, 0x4C, 0x00, 0x54, 0x1E, 0x09, 0x00, 0x03, 0x03, 0x01,
+-    0x03, 0x27, 0x01, 0x07, 0x00, 0x02, 0x03, 0x01, 0x01, 0x09, 0x00, 0x02, 0x03, 0x02, 0x01, 0x0B,
+-    0x00, 0x02, 0x03, 0x07, 0x01, 0x0D, 0x00, 0x02, 0x03, 0x0C, 0x1E, 0x09, 0x00, 0x03, 0x03, 0x27,
+-    0x03, 0x01, 0x1E, 0x09, 0x00, 0x03, 0x03, 0x27, 0x03, 0x41, 0x00, 0xE7, 0x00, 0x02, 0x03, 0x27,
+-    0x1E, 0x09, 0x00, 0x03, 0x03, 0x41, 0x03, 0x27, 0x01, 0x07, 0x00, 0x02, 0x03, 0x41, 0x00, 0x06,
+-    0x00, 0x0E, 0x00, 0x14, 0x00, 0x1A, 0x00, 0x20, 0x00, 0x26, 0x00, 0x2C, 0x1E, 0x0B, 0x00, 0x02,
+-    0x03, 0x07, 0x01, 0x0F, 0x00, 0x02, 0x03, 0x0C, 0x1E, 0x0D, 0x00, 0x02, 0x03, 0x23, 0x1E, 0x11,
+-    0x00, 0x02, 0x03, 0x27, 0x1E, 0x13, 0x00, 0x02, 0x03, 0x2D, 0x1E, 0x0F, 0x00, 0x02, 0x03, 0x31,
++    0x00, 0x36, 0x00, 0x3E, 0x00, 0x46, 0x00, 0x4C, 0x00, 0x54, 0x1E, 0x08, 0x00, 0x03, 0x03, 0x01,
++    0x03, 0x27, 0x01, 0x06, 0x00, 0x02, 0x03, 0x01, 0x01, 0x08, 0x00, 0x02, 0x03, 0x02, 0x01, 0x0A,
++    0x00, 0x02, 0x03, 0x07, 0x01, 0x0C, 0x00, 0x02, 0x03, 0x0C, 0x1E, 0x08, 0x00, 0x03, 0x03, 0x27,
++    0x03, 0x01, 0x1E, 0x08, 0x00, 0x03, 0x03, 0x27, 0x03, 0x41, 0x00, 0xC7, 0x00, 0x02, 0x03, 0x27,
++    0x1E, 0x08, 0x00, 0x03, 0x03, 0x41, 0x03, 0x27, 0x01, 0x06, 0x00, 0x02, 0x03, 0x41, 0x00, 0x06,
++    0x00, 0x0E, 0x00, 0x14, 0x00, 0x1A, 0x00, 0x20, 0x00, 0x26, 0x00, 0x2C, 0x1E, 0x0A, 0x00, 0x02,
++    0x03, 0x07, 0x01, 0x0E, 0x00, 0x02, 0x03, 0x0C, 0x1E, 0x0C, 0x00, 0x02, 0x03, 0x23, 0x1E, 0x10,
++    0x00, 0x02, 0x03, 0x27, 0x1E, 0x12, 0x00, 0x02, 0x03, 0x2D, 0x1E, 0x0E, 0x00, 0x02, 0x03, 0x31,
+     0x00, 0x21, 0x00, 0x44, 0x00, 0x4A, 0x00, 0x50, 0x00, 0x58, 0x00, 0x60, 0x00, 0x68, 0x00, 0x70,
+     0x00, 0x78, 0x00, 0x80, 0x00, 0x88, 0x00, 0x8E, 0x00, 0x94, 0x00, 0x9C, 0x00, 0xA4, 0x00, 0xAC,
+     0x00, 0xB4, 0x00, 0xBA, 0x00, 0xC2, 0x00, 0xC8, 0x00, 0xCE, 0x00, 0xD4, 0x00, 0xDA, 0x00, 0xE0,
+     0x00, 0xE6, 0x00, 0xEC, 0x00, 0xF4, 0x00, 0xFA, 0x01, 0x02, 0x01, 0x08, 0x01, 0x0E, 0x01, 0x14,
+-    0x01, 0x1A, 0x01, 0x20, 0x00, 0xE8, 0x00, 0x02, 0x03, 0x00, 0x00, 0xE9, 0x00, 0x02, 0x03, 0x01,
+-    0x1E, 0xC1, 0x00, 0x03, 0x03, 0x02, 0x03, 0x00, 0x1E, 0xBF, 0x00, 0x03, 0x03, 0x02, 0x03, 0x01,
+-    0x1E, 0xC5, 0x00, 0x03, 0x03, 0x02, 0x03, 0x03, 0x1E, 0xC3, 0x00, 0x03, 0x03, 0x02, 0x03, 0x09,
+-    0x1E, 0xC7, 0x00, 0x03, 0x03, 0x02, 0x03, 0x23, 0x1E, 0xC1, 0x00, 0x03, 0x03, 0x02, 0x03, 0x40,
+-    0x1E, 0xBF, 0x00, 0x03, 0x03, 0x02, 0x03, 0x41, 0x00, 0xEA, 0x00, 0x02, 0x03, 0x02, 0x1E, 0xBD,
+-    0x00, 0x02, 0x03, 0x03, 0x1E, 0x15, 0x00, 0x03, 0x03, 0x04, 0x03, 0x00, 0x1E, 0x17, 0x00, 0x03,
+-    0x03, 0x04, 0x03, 0x01, 0x1E, 0x15, 0x00, 0x03, 0x03, 0x04, 0x03, 0x40, 0x1E, 0x17, 0x00, 0x03,
+-    0x03, 0x04, 0x03, 0x41, 0x01, 0x13, 0x00, 0x02, 0x03, 0x04, 0x1E, 0x1D, 0x00, 0x03, 0x03, 0x06,
+-    0x03, 0x27, 0x01, 0x15, 0x00, 0x02, 0x03, 0x06, 0x01, 0x17, 0x00, 0x02, 0x03, 0x07, 0x00, 0xEB,
+-    0x00, 0x02, 0x03, 0x08, 0x1E, 0xBB, 0x00, 0x02, 0x03, 0x09, 0x01, 0x1B, 0x00, 0x02, 0x03, 0x0C,
+-    0x02, 0x05, 0x00, 0x02, 0x03, 0x0F, 0x02, 0x07, 0x00, 0x02, 0x03, 0x11, 0x1E, 0xC7, 0x00, 0x03,
+-    0x03, 0x23, 0x03, 0x02, 0x1E, 0xB9, 0x00, 0x02, 0x03, 0x23, 0x1E, 0x1D, 0x00, 0x03, 0x03, 0x27,
+-    0x03, 0x06, 0x02, 0x29, 0x00, 0x02, 0x03, 0x27, 0x01, 0x19, 0x00, 0x02, 0x03, 0x28, 0x1E, 0x19,
+-    0x00, 0x02, 0x03, 0x2D, 0x1E, 0x1B, 0x00, 0x02, 0x03, 0x30, 0x00, 0xE8, 0x00, 0x02, 0x03, 0x40,
+-    0x00, 0xE9, 0x00, 0x02, 0x03, 0x41, 0x00, 0x01, 0x00, 0x04, 0x1E, 0x1F, 0x00, 0x02, 0x03, 0x07,
++    0x01, 0x1A, 0x01, 0x20, 0x00, 0xC8, 0x00, 0x02, 0x03, 0x00, 0x00, 0xC9, 0x00, 0x02, 0x03, 0x01,
++    0x1E, 0xC0, 0x00, 0x03, 0x03, 0x02, 0x03, 0x00, 0x1E, 0xBE, 0x00, 0x03, 0x03, 0x02, 0x03, 0x01,
++    0x1E, 0xC4, 0x00, 0x03, 0x03, 0x02, 0x03, 0x03, 0x1E, 0xC2, 0x00, 0x03, 0x03, 0x02, 0x03, 0x09,
++    0x1E, 0xC6, 0x00, 0x03, 0x03, 0x02, 0x03, 0x23, 0x1E, 0xC0, 0x00, 0x03, 0x03, 0x02, 0x03, 0x40,
++    0x1E, 0xBE, 0x00, 0x03, 0x03, 0x02, 0x03, 0x41, 0x00, 0xCA, 0x00, 0x02, 0x03, 0x02, 0x1E, 0xBC,
++    0x00, 0x02, 0x03, 0x03, 0x1E, 0x14, 0x00, 0x03, 0x03, 0x04, 0x03, 0x00, 0x1E, 0x16, 0x00, 0x03,
++    0x03, 0x04, 0x03, 0x01, 0x1E, 0x14, 0x00, 0x03, 0x03, 0x04, 0x03, 0x40, 0x1E, 0x16, 0x00, 0x03,
++    0x03, 0x04, 0x03, 0x41, 0x01, 0x12, 0x00, 0x02, 0x03, 0x04, 0x1E, 0x1C, 0x00, 0x03, 0x03, 0x06,
++    0x03, 0x27, 0x01, 0x14, 0x00, 0x02, 0x03, 0x06, 0x01, 0x16, 0x00, 0x02, 0x03, 0x07, 0x00, 0xCB,
++    0x00, 0x02, 0x03, 0x08, 0x1E, 0xBA, 0x00, 0x02, 0x03, 0x09, 0x01, 0x1A, 0x00, 0x02, 0x03, 0x0C,
++    0x02, 0x04, 0x00, 0x02, 0x03, 0x0F, 0x02, 0x06, 0x00, 0x02, 0x03, 0x11, 0x1E, 0xC6, 0x00, 0x03,
++    0x03, 0x23, 0x03, 0x02, 0x1E, 0xB8, 0x00, 0x02, 0x03, 0x23, 0x1E, 0x1C, 0x00, 0x03, 0x03, 0x27,
++    0x03, 0x06, 0x02, 0x28, 0x00, 0x02, 0x03, 0x27, 0x01, 0x18, 0x00, 0x02, 0x03, 0x28, 0x1E, 0x18,
++    0x00, 0x02, 0x03, 0x2D, 0x1E, 0x1A, 0x00, 0x02, 0x03, 0x30, 0x00, 0xC8, 0x00, 0x02, 0x03, 0x40,
++    0x00, 0xC9, 0x00, 0x02, 0x03, 0x41, 0x00, 0x01, 0x00, 0x04, 0x1E, 0x1E, 0x00, 0x02, 0x03, 0x07,
+     0x00, 0x08, 0x00, 0x12, 0x00, 0x18, 0x00, 0x1E, 0x00, 0x24, 0x00, 0x2A, 0x00, 0x30, 0x00, 0x36,
+-    0x00, 0x3C, 0x01, 0xF5, 0x00, 0x02, 0x03, 0x01, 0x01, 0x1D, 0x00, 0x02, 0x03, 0x02, 0x1E, 0x21,
+-    0x00, 0x02, 0x03, 0x04, 0x01, 0x1F, 0x00, 0x02, 0x03, 0x06, 0x01, 0x21, 0x00, 0x02, 0x03, 0x07,
+-    0x01, 0xE7, 0x00, 0x02, 0x03, 0x0C, 0x01, 0x23, 0x00, 0x02, 0x03, 0x27, 0x01, 0xF5, 0x00, 0x02,
+-    0x03, 0x41, 0x00, 0x08, 0x00, 0x12, 0x00, 0x18, 0x00, 0x1E, 0x00, 0x24, 0x00, 0x2A, 0x00, 0x30,
+-    0x00, 0x36, 0x00, 0x3C, 0x01, 0x25, 0x00, 0x02, 0x03, 0x02, 0x1E, 0x23, 0x00, 0x02, 0x03, 0x07,
+-    0x1E, 0x27, 0x00, 0x02, 0x03, 0x08, 0x02, 0x1F, 0x00, 0x02, 0x03, 0x0C, 0x1E, 0x25, 0x00, 0x02,
+-    0x03, 0x23, 0x1E, 0x29, 0x00, 0x02, 0x03, 0x27, 0x1E, 0x2B, 0x00, 0x02, 0x03, 0x2E, 0x1E, 0x96,
+-    0x00, 0x02, 0x03, 0x31, 0x00, 0x13, 0x00, 0x28, 0x00, 0x2E, 0x00, 0x34, 0x00, 0x3A, 0x00, 0x40,
+-    0x00, 0x46, 0x00, 0x4C, 0x00, 0x54, 0x00, 0x5C, 0x00, 0x62, 0x00, 0x68, 0x00, 0x6E, 0x00, 0x74,
+-    0x00, 0x7A, 0x00, 0x80, 0x00, 0x86, 0x00, 0x8C, 0x00, 0x92, 0x00, 0x98, 0x00, 0xEC, 0x00, 0x02,
+-    0x03, 0x00, 0x00, 0xED, 0x00, 0x02, 0x03, 0x01, 0x00, 0xEE, 0x00, 0x02, 0x03, 0x02, 0x01, 0x29,
+-    0x00, 0x02, 0x03, 0x03, 0x01, 0x2B, 0x00, 0x02, 0x03, 0x04, 0x01, 0x2D, 0x00, 0x02, 0x03, 0x06,
+-    0x1E, 0x2F, 0x00, 0x03, 0x03, 0x08, 0x03, 0x01, 0x1E, 0x2F, 0x00, 0x03, 0x03, 0x08, 0x03, 0x41,
+-    0x00, 0xEF, 0x00, 0x02, 0x03, 0x08, 0x1E, 0xC9, 0x00, 0x02, 0x03, 0x09, 0x01, 0xD0, 0x00, 0x02,
+-    0x03, 0x0C, 0x02, 0x09, 0x00, 0x02, 0x03, 0x0F, 0x02, 0x0B, 0x00, 0x02, 0x03, 0x11, 0x1E, 0xCB,
+-    0x00, 0x02, 0x03, 0x23, 0x01, 0x2F, 0x00, 0x02, 0x03, 0x28, 0x1E, 0x2D, 0x00, 0x02, 0x03, 0x30,
+-    0x00, 0xEC, 0x00, 0x02, 0x03, 0x40, 0x00, 0xED, 0x00, 0x02, 0x03, 0x41, 0x1E, 0x2F, 0x00, 0x02,
+-    0x03, 0x44, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x01, 0x35, 0x00, 0x02, 0x03, 0x02, 0x01, 0xF0,
+-    0x00, 0x02, 0x03, 0x0C, 0x00, 0x06, 0x00, 0x0E, 0x00, 0x14, 0x00, 0x1A, 0x00, 0x20, 0x00, 0x26,
+-    0x00, 0x2C, 0x1E, 0x31, 0x00, 0x02, 0x03, 0x01, 0x01, 0xE9, 0x00, 0x02, 0x03, 0x0C, 0x1E, 0x33,
+-    0x00, 0x02, 0x03, 0x23, 0x01, 0x37, 0x00, 0x02, 0x03, 0x27, 0x1E, 0x35, 0x00, 0x02, 0x03, 0x31,
+-    0x1E, 0x31, 0x00, 0x02, 0x03, 0x41, 0x00, 0x09, 0x00, 0x14, 0x00, 0x1A, 0x00, 0x22, 0x00, 0x28,
+-    0x00, 0x30, 0x00, 0x36, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x48, 0x01, 0x3A, 0x00, 0x02, 0x03, 0x01,
+-    0x1E, 0x39, 0x00, 0x03, 0x03, 0x04, 0x03, 0x23, 0x01, 0x3E, 0x00, 0x02, 0x03, 0x0C, 0x1E, 0x39,
+-    0x00, 0x03, 0x03, 0x23, 0x03, 0x04, 0x1E, 0x37, 0x00, 0x02, 0x03, 0x23, 0x01, 0x3C, 0x00, 0x02,
+-    0x03, 0x27, 0x1E, 0x3D, 0x00, 0x02, 0x03, 0x2D, 0x1E, 0x3B, 0x00, 0x02, 0x03, 0x31, 0x01, 0x3A,
+-    0x00, 0x02, 0x03, 0x41, 0x00, 0x04, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x16, 0x00, 0x1C, 0x1E, 0x3F,
+-    0x00, 0x02, 0x03, 0x01, 0x1E, 0x41, 0x00, 0x02, 0x03, 0x07, 0x1E, 0x43, 0x00, 0x02, 0x03, 0x23,
+-    0x1E, 0x3F, 0x00, 0x02, 0x03, 0x41, 0x00, 0x0B, 0x00, 0x18, 0x00, 0x1E, 0x00, 0x24, 0x00, 0x2A,
+-    0x00, 0x30, 0x00, 0x36, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x48, 0x00, 0x4E, 0x00, 0x54, 0x01, 0xF9,
+-    0x00, 0x02, 0x03, 0x00, 0x01, 0x44, 0x00, 0x02, 0x03, 0x01, 0x00, 0xF1, 0x00, 0x02, 0x03, 0x03,
+-    0x1E, 0x45, 0x00, 0x02, 0x03, 0x07, 0x01, 0x48, 0x00, 0x02, 0x03, 0x0C, 0x1E, 0x47, 0x00, 0x02,
+-    0x03, 0x23, 0x01, 0x46, 0x00, 0x02, 0x03, 0x27, 0x1E, 0x4B, 0x00, 0x02, 0x03, 0x2D, 0x1E, 0x49,
+-    0x00, 0x02, 0x03, 0x31, 0x01, 0xF9, 0x00, 0x02, 0x03, 0x40, 0x01, 0x44, 0x00, 0x02, 0x03, 0x41,
+-    0x00, 0x34, 0x00, 0x6A, 0x00, 0x72, 0x00, 0x78, 0x00, 0x80, 0x00, 0x86, 0x00, 0x8E, 0x00, 0x96,
+-    0x00, 0x9E, 0x00, 0xA6, 0x00, 0xAE, 0x00, 0xB6, 0x00, 0xBE, 0x00, 0xC4, 0x00, 0xCC, 0x00, 0xD4,
+-    0x00, 0xDC, 0x00, 0xE4, 0x00, 0xEC, 0x00, 0xF2, 0x00, 0xFA, 0x01, 0x02, 0x01, 0x0A, 0x01, 0x12,
+-    0x01, 0x1A, 0x01, 0x20, 0x01, 0x26, 0x01, 0x2E, 0x01, 0x34, 0x01, 0x3C, 0x01, 0x42, 0x01, 0x4A,
+-    0x01, 0x50, 0x01, 0x56, 0x01, 0x5C, 0x01, 0x62, 0x01, 0x68, 0x01, 0x70, 0x01, 0x78, 0x01, 0x80,
+-    0x01, 0x88, 0x01, 0x90, 0x01, 0x98, 0x01, 0xA0, 0x01, 0xA6, 0x01, 0xAE, 0x01, 0xB6, 0x01, 0xBC,
+-    0x01, 0xC4, 0x01, 0xCA, 0x01, 0xD2, 0x01, 0xD8, 0x01, 0xE0, 0x1E, 0xDD, 0x00, 0x03, 0x03, 0x00,
+-    0x03, 0x1B, 0x00, 0xF2, 0x00, 0x02, 0x03, 0x00, 0x1E, 0xDB, 0x00, 0x03, 0x03, 0x01, 0x03, 0x1B,
+-    0x00, 0xF3, 0x00, 0x02, 0x03, 0x01, 0x1E, 0xD3, 0x00, 0x03, 0x03, 0x02, 0x03, 0x00, 0x1E, 0xD1,
+-    0x00, 0x03, 0x03, 0x02, 0x03, 0x01, 0x1E, 0xD7, 0x00, 0x03, 0x03, 0x02, 0x03, 0x03, 0x1E, 0xD5,
+-    0x00, 0x03, 0x03, 0x02, 0x03, 0x09, 0x1E, 0xD9, 0x00, 0x03, 0x03, 0x02, 0x03, 0x23, 0x1E, 0xD3,
+-    0x00, 0x03, 0x03, 0x02, 0x03, 0x40, 0x1E, 0xD1, 0x00, 0x03, 0x03, 0x02, 0x03, 0x41, 0x00, 0xF4,
+-    0x00, 0x02, 0x03, 0x02, 0x1E, 0x4D, 0x00, 0x03, 0x03, 0x03, 0x03, 0x01, 0x02, 0x2D, 0x00, 0x03,
+-    0x03, 0x03, 0x03, 0x04, 0x1E, 0x4F, 0x00, 0x03, 0x03, 0x03, 0x03, 0x08, 0x1E, 0xE1, 0x00, 0x03,
+-    0x03, 0x03, 0x03, 0x1B, 0x1E, 0x4D, 0x00, 0x03, 0x03, 0x03, 0x03, 0x41, 0x00, 0xF5, 0x00, 0x02,
+-    0x03, 0x03, 0x1E, 0x51, 0x00, 0x03, 0x03, 0x04, 0x03, 0x00, 0x1E, 0x53, 0x00, 0x03, 0x03, 0x04,
+-    0x03, 0x01, 0x01, 0xED, 0x00, 0x03, 0x03, 0x04, 0x03, 0x28, 0x1E, 0x51, 0x00, 0x03, 0x03, 0x04,
+-    0x03, 0x40, 0x1E, 0x53, 0x00, 0x03, 0x03, 0x04, 0x03, 0x41, 0x01, 0x4D, 0x00, 0x02, 0x03, 0x04,
+-    0x01, 0x4F, 0x00, 0x02, 0x03, 0x06, 0x02, 0x31, 0x00, 0x03, 0x03, 0x07, 0x03, 0x04, 0x02, 0x2F,
+-    0x00, 0x02, 0x03, 0x07, 0x02, 0x2B, 0x00, 0x03, 0x03, 0x08, 0x03, 0x04, 0x00, 0xF6, 0x00, 0x02,
+-    0x03, 0x08, 0x1E, 0xDF, 0x00, 0x03, 0x03, 0x09, 0x03, 0x1B, 0x1E, 0xCF, 0x00, 0x02, 0x03, 0x09,
+-    0x01, 0x51, 0x00, 0x02, 0x03, 0x0B, 0x01, 0xD2, 0x00, 0x02, 0x03, 0x0C, 0x02, 0x0D, 0x00, 0x02,
+-    0x03, 0x0F, 0x02, 0x0F, 0x00, 0x02, 0x03, 0x11, 0x1E, 0xDD, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x00,
+-    0x1E, 0xDB, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x01, 0x1E, 0xE1, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x03,
+-    0x1E, 0xDF, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x09, 0x1E, 0xE3, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x23,
+-    0x1E, 0xDD, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x40, 0x1E, 0xDB, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x41,
+-    0x01, 0xA1, 0x00, 0x02, 0x03, 0x1B, 0x1E, 0xD9, 0x00, 0x03, 0x03, 0x23, 0x03, 0x02, 0x1E, 0xE3,
+-    0x00, 0x03, 0x03, 0x23, 0x03, 0x1B, 0x1E, 0xCD, 0x00, 0x02, 0x03, 0x23, 0x01, 0xED, 0x00, 0x03,
+-    0x03, 0x28, 0x03, 0x04, 0x01, 0xEB, 0x00, 0x02, 0x03, 0x28, 0x1E, 0xDD, 0x00, 0x03, 0x03, 0x40,
+-    0x03, 0x1B, 0x00, 0xF2, 0x00, 0x02, 0x03, 0x40, 0x1E, 0xDB, 0x00, 0x03, 0x03, 0x41, 0x03, 0x1B,
+-    0x00, 0xF3, 0x00, 0x02, 0x03, 0x41, 0x00, 0x03, 0x00, 0x08, 0x00, 0x0E, 0x00, 0x14, 0x1E, 0x55,
+-    0x00, 0x02, 0x03, 0x01, 0x1E, 0x57, 0x00, 0x02, 0x03, 0x07, 0x1E, 0x55, 0x00, 0x02, 0x03, 0x41,
+-    0x00, 0x0B, 0x00, 0x18, 0x00, 0x1E, 0x00, 0x26, 0x00, 0x2C, 0x00, 0x32, 0x00, 0x38, 0x00, 0x3E,
+-    0x00, 0x46, 0x00, 0x4C, 0x00, 0x52, 0x00, 0x58, 0x01, 0x55, 0x00, 0x02, 0x03, 0x01, 0x1E, 0x5D,
+-    0x00, 0x03, 0x03, 0x04, 0x03, 0x23, 0x1E, 0x59, 0x00, 0x02, 0x03, 0x07, 0x01, 0x59, 0x00, 0x02,
+-    0x03, 0x0C, 0x02, 0x11, 0x00, 0x02, 0x03, 0x0F, 0x02, 0x13, 0x00, 0x02, 0x03, 0x11, 0x1E, 0x5D,
+-    0x00, 0x03, 0x03, 0x23, 0x03, 0x04, 0x1E, 0x5B, 0x00, 0x02, 0x03, 0x23, 0x01, 0x57, 0x00, 0x02,
+-    0x03, 0x27, 0x1E, 0x5F, 0x00, 0x02, 0x03, 0x31, 0x01, 0x55, 0x00, 0x02, 0x03, 0x41, 0x00, 0x0D,
+-    0x00, 0x1C, 0x00, 0x24, 0x00, 0x2A, 0x00, 0x30, 0x00, 0x38, 0x00, 0x3E, 0x00, 0x46, 0x00, 0x4C,
+-    0x00, 0x54, 0x00, 0x5A, 0x00, 0x60, 0x00, 0x66, 0x00, 0x6E, 0x1E, 0x65, 0x00, 0x03, 0x03, 0x01,
+-    0x03, 0x07, 0x01, 0x5B, 0x00, 0x02, 0x03, 0x01, 0x01, 0x5D, 0x00, 0x02, 0x03, 0x02, 0x1E, 0x69,
+-    0x00, 0x03, 0x03, 0x07, 0x03, 0x23, 0x1E, 0x61, 0x00, 0x02, 0x03, 0x07, 0x1E, 0x67, 0x00, 0x03,
+-    0x03, 0x0C, 0x03, 0x07, 0x01, 0x61, 0x00, 0x02, 0x03, 0x0C, 0x1E, 0x69, 0x00, 0x03, 0x03, 0x23,
+-    0x03, 0x07, 0x1E, 0x63, 0x00, 0x02, 0x03, 0x23, 0x02, 0x19, 0x00, 0x02, 0x03, 0x26, 0x01, 0x5F,
+-    0x00, 0x02, 0x03, 0x27, 0x1E, 0x65, 0x00, 0x03, 0x03, 0x41, 0x03, 0x07, 0x01, 0x5B, 0x00, 0x02,
+-    0x03, 0x41, 0x00, 0x08, 0x00, 0x12, 0x00, 0x18, 0x00, 0x1E, 0x00, 0x24, 0x00, 0x2A, 0x00, 0x30,
+-    0x00, 0x36, 0x00, 0x3C, 0x1E, 0x6B, 0x00, 0x02, 0x03, 0x07, 0x1E, 0x97, 0x00, 0x02, 0x03, 0x08,
+-    0x01, 0x65, 0x00, 0x02, 0x03, 0x0C, 0x1E, 0x6D, 0x00, 0x02, 0x03, 0x23, 0x02, 0x1B, 0x00, 0x02,
+-    0x03, 0x26, 0x01, 0x63, 0x00, 0x02, 0x03, 0x27, 0x1E, 0x71, 0x00, 0x02, 0x03, 0x2D, 0x1E, 0x6F,
++    0x00, 0x3C, 0x01, 0xF4, 0x00, 0x02, 0x03, 0x01, 0x01, 0x1C, 0x00, 0x02, 0x03, 0x02, 0x1E, 0x20,
++    0x00, 0x02, 0x03, 0x04, 0x01, 0x1E, 0x00, 0x02, 0x03, 0x06, 0x01, 0x20, 0x00, 0x02, 0x03, 0x07,
++    0x01, 0xE6, 0x00, 0x02, 0x03, 0x0C, 0x01, 0x22, 0x00, 0x02, 0x03, 0x27, 0x01, 0xF4, 0x00, 0x02,
++    0x03, 0x41, 0x00, 0x07, 0x00, 0x10, 0x00, 0x16, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x28, 0x00, 0x2E,
++    0x00, 0x34, 0x01, 0x24, 0x00, 0x02, 0x03, 0x02, 0x1E, 0x22, 0x00, 0x02, 0x03, 0x07, 0x1E, 0x26,
++    0x00, 0x02, 0x03, 0x08, 0x02, 0x1E, 0x00, 0x02, 0x03, 0x0C, 0x1E, 0x24, 0x00, 0x02, 0x03, 0x23,
++    0x1E, 0x28, 0x00, 0x02, 0x03, 0x27, 0x1E, 0x2A, 0x00, 0x02, 0x03, 0x2E, 0x00, 0x14, 0x00, 0x2A,
++    0x00, 0x30, 0x00, 0x36, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x48, 0x00, 0x4E, 0x00, 0x54, 0x00, 0x5C,
++    0x00, 0x64, 0x00, 0x6A, 0x00, 0x70, 0x00, 0x76, 0x00, 0x7C, 0x00, 0x82, 0x00, 0x88, 0x00, 0x8E,
++    0x00, 0x94, 0x00, 0x9A, 0x00, 0xA0, 0x00, 0xCC, 0x00, 0x02, 0x03, 0x00, 0x00, 0xCD, 0x00, 0x02,
++    0x03, 0x01, 0x00, 0xCE, 0x00, 0x02, 0x03, 0x02, 0x01, 0x28, 0x00, 0x02, 0x03, 0x03, 0x01, 0x2A,
++    0x00, 0x02, 0x03, 0x04, 0x01, 0x2C, 0x00, 0x02, 0x03, 0x06, 0x01, 0x30, 0x00, 0x02, 0x03, 0x07,
++    0x1E, 0x2E, 0x00, 0x03, 0x03, 0x08, 0x03, 0x01, 0x1E, 0x2E, 0x00, 0x03, 0x03, 0x08, 0x03, 0x41,
++    0x00, 0xCF, 0x00, 0x02, 0x03, 0x08, 0x1E, 0xC8, 0x00, 0x02, 0x03, 0x09, 0x01, 0xCF, 0x00, 0x02,
++    0x03, 0x0C, 0x02, 0x08, 0x00, 0x02, 0x03, 0x0F, 0x02, 0x0A, 0x00, 0x02, 0x03, 0x11, 0x1E, 0xCA,
++    0x00, 0x02, 0x03, 0x23, 0x01, 0x2E, 0x00, 0x02, 0x03, 0x28, 0x1E, 0x2C, 0x00, 0x02, 0x03, 0x30,
++    0x00, 0xCC, 0x00, 0x02, 0x03, 0x40, 0x00, 0xCD, 0x00, 0x02, 0x03, 0x41, 0x1E, 0x2E, 0x00, 0x02,
++    0x03, 0x44, 0x00, 0x01, 0x00, 0x04, 0x01, 0x34, 0x00, 0x02, 0x03, 0x02, 0x00, 0x06, 0x00, 0x0E,
++    0x00, 0x14, 0x00, 0x1A, 0x00, 0x20, 0x00, 0x26, 0x00, 0x2C, 0x1E, 0x30, 0x00, 0x02, 0x03, 0x01,
++    0x01, 0xE8, 0x00, 0x02, 0x03, 0x0C, 0x1E, 0x32, 0x00, 0x02, 0x03, 0x23, 0x01, 0x36, 0x00, 0x02,
++    0x03, 0x27, 0x1E, 0x34, 0x00, 0x02, 0x03, 0x31, 0x1E, 0x30, 0x00, 0x02, 0x03, 0x41, 0x00, 0x09,
++    0x00, 0x14, 0x00, 0x1A, 0x00, 0x22, 0x00, 0x28, 0x00, 0x30, 0x00, 0x36, 0x00, 0x3C, 0x00, 0x42,
++    0x00, 0x48, 0x01, 0x39, 0x00, 0x02, 0x03, 0x01, 0x1E, 0x38, 0x00, 0x03, 0x03, 0x04, 0x03, 0x23,
++    0x01, 0x3D, 0x00, 0x02, 0x03, 0x0C, 0x1E, 0x38, 0x00, 0x03, 0x03, 0x23, 0x03, 0x04, 0x1E, 0x36,
++    0x00, 0x02, 0x03, 0x23, 0x01, 0x3B, 0x00, 0x02, 0x03, 0x27, 0x1E, 0x3C, 0x00, 0x02, 0x03, 0x2D,
++    0x1E, 0x3A, 0x00, 0x02, 0x03, 0x31, 0x01, 0x39, 0x00, 0x02, 0x03, 0x41, 0x00, 0x04, 0x00, 0x0A,
++    0x00, 0x10, 0x00, 0x16, 0x00, 0x1C, 0x1E, 0x3E, 0x00, 0x02, 0x03, 0x01, 0x1E, 0x40, 0x00, 0x02,
++    0x03, 0x07, 0x1E, 0x42, 0x00, 0x02, 0x03, 0x23, 0x1E, 0x3E, 0x00, 0x02, 0x03, 0x41, 0x00, 0x0B,
++    0x00, 0x18, 0x00, 0x1E, 0x00, 0x24, 0x00, 0x2A, 0x00, 0x30, 0x00, 0x36, 0x00, 0x3C, 0x00, 0x42,
++    0x00, 0x48, 0x00, 0x4E, 0x00, 0x54, 0x01, 0xF8, 0x00, 0x02, 0x03, 0x00, 0x01, 0x43, 0x00, 0x02,
++    0x03, 0x01, 0x00, 0xD1, 0x00, 0x02, 0x03, 0x03, 0x1E, 0x44, 0x00, 0x02, 0x03, 0x07, 0x01, 0x47,
++    0x00, 0x02, 0x03, 0x0C, 0x1E, 0x46, 0x00, 0x02, 0x03, 0x23, 0x01, 0x45, 0x00, 0x02, 0x03, 0x27,
++    0x1E, 0x4A, 0x00, 0x02, 0x03, 0x2D, 0x1E, 0x48, 0x00, 0x02, 0x03, 0x31, 0x01, 0xF8, 0x00, 0x02,
++    0x03, 0x40, 0x01, 0x43, 0x00, 0x02, 0x03, 0x41, 0x00, 0x34, 0x00, 0x6A, 0x00, 0x72, 0x00, 0x78,
++    0x00, 0x80, 0x00, 0x86, 0x00, 0x8E, 0x00, 0x96, 0x00, 0x9E, 0x00, 0xA6, 0x00, 0xAE, 0x00, 0xB6,
++    0x00, 0xBE, 0x00, 0xC4, 0x00, 0xCC, 0x00, 0xD4, 0x00, 0xDC, 0x00, 0xE4, 0x00, 0xEC, 0x00, 0xF2,
++    0x00, 0xFA, 0x01, 0x02, 0x01, 0x0A, 0x01, 0x12, 0x01, 0x1A, 0x01, 0x20, 0x01, 0x26, 0x01, 0x2E,
++    0x01, 0x34, 0x01, 0x3C, 0x01, 0x42, 0x01, 0x4A, 0x01, 0x50, 0x01, 0x56, 0x01, 0x5C, 0x01, 0x62,
++    0x01, 0x68, 0x01, 0x70, 0x01, 0x78, 0x01, 0x80, 0x01, 0x88, 0x01, 0x90, 0x01, 0x98, 0x01, 0xA0,
++    0x01, 0xA6, 0x01, 0xAE, 0x01, 0xB6, 0x01, 0xBC, 0x01, 0xC4, 0x01, 0xCA, 0x01, 0xD2, 0x01, 0xD8,
++    0x01, 0xE0, 0x1E, 0xDC, 0x00, 0x03, 0x03, 0x00, 0x03, 0x1B, 0x00, 0xD2, 0x00, 0x02, 0x03, 0x00,
++    0x1E, 0xDA, 0x00, 0x03, 0x03, 0x01, 0x03, 0x1B, 0x00, 0xD3, 0x00, 0x02, 0x03, 0x01, 0x1E, 0xD2,
++    0x00, 0x03, 0x03, 0x02, 0x03, 0x00, 0x1E, 0xD0, 0x00, 0x03, 0x03, 0x02, 0x03, 0x01, 0x1E, 0xD6,
++    0x00, 0x03, 0x03, 0x02, 0x03, 0x03, 0x1E, 0xD4, 0x00, 0x03, 0x03, 0x02, 0x03, 0x09, 0x1E, 0xD8,
++    0x00, 0x03, 0x03, 0x02, 0x03, 0x23, 0x1E, 0xD2, 0x00, 0x03, 0x03, 0x02, 0x03, 0x40, 0x1E, 0xD0,
++    0x00, 0x03, 0x03, 0x02, 0x03, 0x41, 0x00, 0xD4, 0x00, 0x02, 0x03, 0x02, 0x1E, 0x4C, 0x00, 0x03,
++    0x03, 0x03, 0x03, 0x01, 0x02, 0x2C, 0x00, 0x03, 0x03, 0x03, 0x03, 0x04, 0x1E, 0x4E, 0x00, 0x03,
++    0x03, 0x03, 0x03, 0x08, 0x1E, 0xE0, 0x00, 0x03, 0x03, 0x03, 0x03, 0x1B, 0x1E, 0x4C, 0x00, 0x03,
++    0x03, 0x03, 0x03, 0x41, 0x00, 0xD5, 0x00, 0x02, 0x03, 0x03, 0x1E, 0x50, 0x00, 0x03, 0x03, 0x04,
++    0x03, 0x00, 0x1E, 0x52, 0x00, 0x03, 0x03, 0x04, 0x03, 0x01, 0x01, 0xEC, 0x00, 0x03, 0x03, 0x04,
++    0x03, 0x28, 0x1E, 0x50, 0x00, 0x03, 0x03, 0x04, 0x03, 0x40, 0x1E, 0x52, 0x00, 0x03, 0x03, 0x04,
++    0x03, 0x41, 0x01, 0x4C, 0x00, 0x02, 0x03, 0x04, 0x01, 0x4E, 0x00, 0x02, 0x03, 0x06, 0x02, 0x30,
++    0x00, 0x03, 0x03, 0x07, 0x03, 0x04, 0x02, 0x2E, 0x00, 0x02, 0x03, 0x07, 0x02, 0x2A, 0x00, 0x03,
++    0x03, 0x08, 0x03, 0x04, 0x00, 0xD6, 0x00, 0x02, 0x03, 0x08, 0x1E, 0xDE, 0x00, 0x03, 0x03, 0x09,
++    0x03, 0x1B, 0x1E, 0xCE, 0x00, 0x02, 0x03, 0x09, 0x01, 0x50, 0x00, 0x02, 0x03, 0x0B, 0x01, 0xD1,
++    0x00, 0x02, 0x03, 0x0C, 0x02, 0x0C, 0x00, 0x02, 0x03, 0x0F, 0x02, 0x0E, 0x00, 0x02, 0x03, 0x11,
++    0x1E, 0xDC, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x00, 0x1E, 0xDA, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x01,
++    0x1E, 0xE0, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x03, 0x1E, 0xDE, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x09,
++    0x1E, 0xE2, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x23, 0x1E, 0xDC, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x40,
++    0x1E, 0xDA, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x41, 0x01, 0xA0, 0x00, 0x02, 0x03, 0x1B, 0x1E, 0xD8,
++    0x00, 0x03, 0x03, 0x23, 0x03, 0x02, 0x1E, 0xE2, 0x00, 0x03, 0x03, 0x23, 0x03, 0x1B, 0x1E, 0xCC,
++    0x00, 0x02, 0x03, 0x23, 0x01, 0xEC, 0x00, 0x03, 0x03, 0x28, 0x03, 0x04, 0x01, 0xEA, 0x00, 0x02,
++    0x03, 0x28, 0x1E, 0xDC, 0x00, 0x03, 0x03, 0x40, 0x03, 0x1B, 0x00, 0xD2, 0x00, 0x02, 0x03, 0x40,
++    0x1E, 0xDA, 0x00, 0x03, 0x03, 0x41, 0x03, 0x1B, 0x00, 0xD3, 0x00, 0x02, 0x03, 0x41, 0x00, 0x03,
++    0x00, 0x08, 0x00, 0x0E, 0x00, 0x14, 0x1E, 0x54, 0x00, 0x02, 0x03, 0x01, 0x1E, 0x56, 0x00, 0x02,
++    0x03, 0x07, 0x1E, 0x54, 0x00, 0x02, 0x03, 0x41, 0x00, 0x0B, 0x00, 0x18, 0x00, 0x1E, 0x00, 0x26,
++    0x00, 0x2C, 0x00, 0x32, 0x00, 0x38, 0x00, 0x3E, 0x00, 0x46, 0x00, 0x4C, 0x00, 0x52, 0x00, 0x58,
++    0x01, 0x54, 0x00, 0x02, 0x03, 0x01, 0x1E, 0x5C, 0x00, 0x03, 0x03, 0x04, 0x03, 0x23, 0x1E, 0x58,
++    0x00, 0x02, 0x03, 0x07, 0x01, 0x58, 0x00, 0x02, 0x03, 0x0C, 0x02, 0x10, 0x00, 0x02, 0x03, 0x0F,
++    0x02, 0x12, 0x00, 0x02, 0x03, 0x11, 0x1E, 0x5C, 0x00, 0x03, 0x03, 0x23, 0x03, 0x04, 0x1E, 0x5A,
++    0x00, 0x02, 0x03, 0x23, 0x01, 0x56, 0x00, 0x02, 0x03, 0x27, 0x1E, 0x5E, 0x00, 0x02, 0x03, 0x31,
++    0x01, 0x54, 0x00, 0x02, 0x03, 0x41, 0x00, 0x0D, 0x00, 0x1C, 0x00, 0x24, 0x00, 0x2A, 0x00, 0x30,
++    0x00, 0x38, 0x00, 0x3E, 0x00, 0x46, 0x00, 0x4C, 0x00, 0x54, 0x00, 0x5A, 0x00, 0x60, 0x00, 0x66,
++    0x00, 0x6E, 0x1E, 0x64, 0x00, 0x03, 0x03, 0x01, 0x03, 0x07, 0x01, 0x5A, 0x00, 0x02, 0x03, 0x01,
++    0x01, 0x5C, 0x00, 0x02, 0x03, 0x02, 0x1E, 0x68, 0x00, 0x03, 0x03, 0x07, 0x03, 0x23, 0x1E, 0x60,
++    0x00, 0x02, 0x03, 0x07, 0x1E, 0x66, 0x00, 0x03, 0x03, 0x0C, 0x03, 0x07, 0x01, 0x60, 0x00, 0x02,
++    0x03, 0x0C, 0x1E, 0x68, 0x00, 0x03, 0x03, 0x23, 0x03, 0x07, 0x1E, 0x62, 0x00, 0x02, 0x03, 0x23,
++    0x02, 0x18, 0x00, 0x02, 0x03, 0x26, 0x01, 0x5E, 0x00, 0x02, 0x03, 0x27, 0x1E, 0x64, 0x00, 0x03,
++    0x03, 0x41, 0x03, 0x07, 0x01, 0x5A, 0x00, 0x02, 0x03, 0x41, 0x00, 0x07, 0x00, 0x10, 0x00, 0x16,
++    0x00, 0x1C, 0x00, 0x22, 0x00, 0x28, 0x00, 0x2E, 0x00, 0x34, 0x1E, 0x6A, 0x00, 0x02, 0x03, 0x07,
++    0x01, 0x64, 0x00, 0x02, 0x03, 0x0C, 0x1E, 0x6C, 0x00, 0x02, 0x03, 0x23, 0x02, 0x1A, 0x00, 0x02,
++    0x03, 0x26, 0x01, 0x62, 0x00, 0x02, 0x03, 0x27, 0x1E, 0x70, 0x00, 0x02, 0x03, 0x2D, 0x1E, 0x6E,
+     0x00, 0x02, 0x03, 0x31, 0x00, 0x2D, 0x00, 0x5C, 0x00, 0x64, 0x00, 0x6A, 0x00, 0x72, 0x00, 0x78,
+     0x00, 0x7E, 0x00, 0x86, 0x00, 0x8E, 0x00, 0x96, 0x00, 0x9C, 0x00, 0xA4, 0x00, 0xAA, 0x00, 0xB0,
+     0x00, 0xB8, 0x00, 0xC0, 0x00, 0xC8, 0x00, 0xD0, 0x00, 0xD8, 0x00, 0xE0, 0x00, 0xE6, 0x00, 0xEE,
+     0x00, 0xF4, 0x00, 0xFA, 0x01, 0x00, 0x01, 0x06, 0x01, 0x0C, 0x01, 0x12, 0x01, 0x1A, 0x01, 0x22,
+     0x01, 0x2A, 0x01, 0x32, 0x01, 0x3A, 0x01, 0x42, 0x01, 0x4A, 0x01, 0x50, 0x01, 0x58, 0x01, 0x5E,
+     0x01, 0x64, 0x01, 0x6A, 0x01, 0x70, 0x01, 0x76, 0x01, 0x7E, 0x01, 0x84, 0x01, 0x8C, 0x01, 0x92,
+-    0x1E, 0xEB, 0x00, 0x03, 0x03, 0x00, 0x03, 0x1B, 0x00, 0xF9, 0x00, 0x02, 0x03, 0x00, 0x1E, 0xE9,
+-    0x00, 0x03, 0x03, 0x01, 0x03, 0x1B, 0x00, 0xFA, 0x00, 0x02, 0x03, 0x01, 0x00, 0xFB, 0x00, 0x02,
+-    0x03, 0x02, 0x1E, 0x79, 0x00, 0x03, 0x03, 0x03, 0x03, 0x01, 0x1E, 0xEF, 0x00, 0x03, 0x03, 0x03,
+-    0x03, 0x1B, 0x1E, 0x79, 0x00, 0x03, 0x03, 0x03, 0x03, 0x41, 0x01, 0x69, 0x00, 0x02, 0x03, 0x03,
+-    0x1E, 0x7B, 0x00, 0x03, 0x03, 0x04, 0x03, 0x08, 0x01, 0x6B, 0x00, 0x02, 0x03, 0x04, 0x01, 0x6D,
+-    0x00, 0x02, 0x03, 0x06, 0x01, 0xDC, 0x00, 0x03, 0x03, 0x08, 0x03, 0x00, 0x01, 0xD8, 0x00, 0x03,
+-    0x03, 0x08, 0x03, 0x01, 0x01, 0xD6, 0x00, 0x03, 0x03, 0x08, 0x03, 0x04, 0x01, 0xDA, 0x00, 0x03,
+-    0x03, 0x08, 0x03, 0x0C, 0x01, 0xDC, 0x00, 0x03, 0x03, 0x08, 0x03, 0x40, 0x01, 0xD8, 0x00, 0x03,
+-    0x03, 0x08, 0x03, 0x41, 0x00, 0xFC, 0x00, 0x02, 0x03, 0x08, 0x1E, 0xED, 0x00, 0x03, 0x03, 0x09,
+-    0x03, 0x1B, 0x1E, 0xE7, 0x00, 0x02, 0x03, 0x09, 0x01, 0x6F, 0x00, 0x02, 0x03, 0x0A, 0x01, 0x71,
+-    0x00, 0x02, 0x03, 0x0B, 0x01, 0xD4, 0x00, 0x02, 0x03, 0x0C, 0x02, 0x15, 0x00, 0x02, 0x03, 0x0F,
+-    0x02, 0x17, 0x00, 0x02, 0x03, 0x11, 0x1E, 0xEB, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x00, 0x1E, 0xE9,
+-    0x00, 0x03, 0x03, 0x1B, 0x03, 0x01, 0x1E, 0xEF, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x03, 0x1E, 0xED,
+-    0x00, 0x03, 0x03, 0x1B, 0x03, 0x09, 0x1E, 0xF1, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x23, 0x1E, 0xEB,
+-    0x00, 0x03, 0x03, 0x1B, 0x03, 0x40, 0x1E, 0xE9, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x41, 0x01, 0xB0,
+-    0x00, 0x02, 0x03, 0x1B, 0x1E, 0xF1, 0x00, 0x03, 0x03, 0x23, 0x03, 0x1B, 0x1E, 0xE5, 0x00, 0x02,
+-    0x03, 0x23, 0x1E, 0x73, 0x00, 0x02, 0x03, 0x24, 0x01, 0x73, 0x00, 0x02, 0x03, 0x28, 0x1E, 0x77,
+-    0x00, 0x02, 0x03, 0x2D, 0x1E, 0x75, 0x00, 0x02, 0x03, 0x30, 0x1E, 0xEB, 0x00, 0x03, 0x03, 0x40,
+-    0x03, 0x1B, 0x00, 0xF9, 0x00, 0x02, 0x03, 0x40, 0x1E, 0xE9, 0x00, 0x03, 0x03, 0x41, 0x03, 0x1B,
+-    0x00, 0xFA, 0x00, 0x02, 0x03, 0x41, 0x01, 0xD8, 0x00, 0x02, 0x03, 0x44, 0x00, 0x02, 0x00, 0x06,
+-    0x00, 0x0C, 0x1E, 0x7D, 0x00, 0x02, 0x03, 0x03, 0x1E, 0x7F, 0x00, 0x02, 0x03, 0x23, 0x00, 0x09,
+-    0x00, 0x14, 0x00, 0x1A, 0x00, 0x20, 0x00, 0x26, 0x00, 0x2C, 0x00, 0x32, 0x00, 0x38, 0x00, 0x3E,
+-    0x00, 0x44, 0x1E, 0x81, 0x00, 0x02, 0x03, 0x00, 0x1E, 0x83, 0x00, 0x02, 0x03, 0x01, 0x01, 0x75,
+-    0x00, 0x02, 0x03, 0x02, 0x1E, 0x87, 0x00, 0x02, 0x03, 0x07, 0x1E, 0x85, 0x00, 0x02, 0x03, 0x08,
+-    0x1E, 0x98, 0x00, 0x02, 0x03, 0x0A, 0x1E, 0x89, 0x00, 0x02, 0x03, 0x23, 0x1E, 0x81, 0x00, 0x02,
+-    0x03, 0x40, 0x1E, 0x83, 0x00, 0x02, 0x03, 0x41, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x1E, 0x8B,
+-    0x00, 0x02, 0x03, 0x07, 0x1E, 0x8D, 0x00, 0x02, 0x03, 0x08, 0x00, 0x0C, 0x00, 0x1A, 0x00, 0x20,
+-    0x00, 0x26, 0x00, 0x2C, 0x00, 0x32, 0x00, 0x38, 0x00, 0x3E, 0x00, 0x44, 0x00, 0x4A, 0x00, 0x50,
+-    0x00, 0x56, 0x00, 0x5C, 0x1E, 0xF3, 0x00, 0x02, 0x03, 0x00, 0x00, 0xFD, 0x00, 0x02, 0x03, 0x01,
+-    0x01, 0x77, 0x00, 0x02, 0x03, 0x02, 0x1E, 0xF9, 0x00, 0x02, 0x03, 0x03, 0x02, 0x33, 0x00, 0x02,
+-    0x03, 0x04, 0x1E, 0x8F, 0x00, 0x02, 0x03, 0x07, 0x00, 0xFF, 0x00, 0x02, 0x03, 0x08, 0x1E, 0xF7,
+-    0x00, 0x02, 0x03, 0x09, 0x1E, 0x99, 0x00, 0x02, 0x03, 0x0A, 0x1E, 0xF5, 0x00, 0x02, 0x03, 0x23,
+-    0x1E, 0xF3, 0x00, 0x02, 0x03, 0x40, 0x00, 0xFD, 0x00, 0x02, 0x03, 0x41, 0x00, 0x07, 0x00, 0x10,
+-    0x00, 0x16, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x28, 0x00, 0x2E, 0x00, 0x34, 0x01, 0x7A, 0x00, 0x02,
+-    0x03, 0x01, 0x1E, 0x91, 0x00, 0x02, 0x03, 0x02, 0x01, 0x7C, 0x00, 0x02, 0x03, 0x07, 0x01, 0x7E,
+-    0x00, 0x02, 0x03, 0x0C, 0x1E, 0x93, 0x00, 0x02, 0x03, 0x23, 0x1E, 0x95, 0x00, 0x02, 0x03, 0x31,
+-    0x01, 0x7A, 0x00, 0x02, 0x03, 0x41, 0x00, 0x07, 0x00, 0x10, 0x00, 0x16, 0x00, 0x1C, 0x00, 0x22,
+-    0x00, 0x28, 0x00, 0x2E, 0x00, 0x34, 0x1E, 0xA6, 0x00, 0x02, 0x03, 0x00, 0x1E, 0xA4, 0x00, 0x02,
+-    0x03, 0x01, 0x1E, 0xAA, 0x00, 0x02, 0x03, 0x03, 0x1E, 0xA8, 0x00, 0x02, 0x03, 0x09, 0x1E, 0xAC,
+-    0x00, 0x02, 0x03, 0x23, 0x1E, 0xA6, 0x00, 0x02, 0x03, 0x40, 0x1E, 0xA4, 0x00, 0x02, 0x03, 0x41,
+-    0x00, 0x01, 0x00, 0x04, 0x01, 0xDE, 0x00, 0x02, 0x03, 0x04, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C,
+-    0x01, 0xFA, 0x00, 0x02, 0x03, 0x01, 0x01, 0xFA, 0x00, 0x02, 0x03, 0x41, 0x00, 0x03, 0x00, 0x08,
+-    0x00, 0x0E, 0x00, 0x14, 0x01, 0xFC, 0x00, 0x02, 0x03, 0x01, 0x01, 0xE2, 0x00, 0x02, 0x03, 0x04,
+-    0x01, 0xFC, 0x00, 0x02, 0x03, 0x41, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x1E, 0x08, 0x00, 0x02,
+-    0x03, 0x01, 0x1E, 0x08, 0x00, 0x02, 0x03, 0x41, 0x00, 0x07, 0x00, 0x10, 0x00, 0x16, 0x00, 0x1C,
+-    0x00, 0x22, 0x00, 0x28, 0x00, 0x2E, 0x00, 0x34, 0x1E, 0xC0, 0x00, 0x02, 0x03, 0x00, 0x1E, 0xBE,
+-    0x00, 0x02, 0x03, 0x01, 0x1E, 0xC4, 0x00, 0x02, 0x03, 0x03, 0x1E, 0xC2, 0x00, 0x02, 0x03, 0x09,
+-    0x1E, 0xC6, 0x00, 0x02, 0x03, 0x23, 0x1E, 0xC0, 0x00, 0x02, 0x03, 0x40, 0x1E, 0xBE, 0x00, 0x02,
+-    0x03, 0x41, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x1E, 0x2E, 0x00, 0x02, 0x03, 0x01, 0x1E, 0x2E,
+-    0x00, 0x02, 0x03, 0x41, 0x00, 0x01, 0x00, 0x04, 0x1E, 0xDC, 0x00, 0x02, 0x03, 0x1B, 0x00, 0x01,
+-    0x00, 0x04, 0x1E, 0xDA, 0x00, 0x02, 0x03, 0x1B, 0x00, 0x07, 0x00, 0x10, 0x00, 0x16, 0x00, 0x1C,
+-    0x00, 0x22, 0x00, 0x28, 0x00, 0x2E, 0x00, 0x34, 0x1E, 0xD2, 0x00, 0x02, 0x03, 0x00, 0x1E, 0xD0,
+-    0x00, 0x02, 0x03, 0x01, 0x1E, 0xD6, 0x00, 0x02, 0x03, 0x03, 0x1E, 0xD4, 0x00, 0x02, 0x03, 0x09,
+-    0x1E, 0xD8, 0x00, 0x02, 0x03, 0x23, 0x1E, 0xD2, 0x00, 0x02, 0x03, 0x40, 0x1E, 0xD0, 0x00, 0x02,
+-    0x03, 0x41, 0x00, 0x05, 0x00, 0x0C, 0x00, 0x12, 0x00, 0x18, 0x00, 0x1E, 0x00, 0x24, 0x1E, 0x4C,
+-    0x00, 0x02, 0x03, 0x01, 0x02, 0x2C, 0x00, 0x02, 0x03, 0x04, 0x1E, 0x4E, 0x00, 0x02, 0x03, 0x08,
+-    0x1E, 0xE0, 0x00, 0x02, 0x03, 0x1B, 0x1E, 0x4C, 0x00, 0x02, 0x03, 0x41, 0x00, 0x01, 0x00, 0x04,
+-    0x02, 0x2A, 0x00, 0x02, 0x03, 0x04, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x01, 0xFE, 0x00, 0x02,
+-    0x03, 0x01, 0x01, 0xFE, 0x00, 0x02, 0x03, 0x41, 0x00, 0x01, 0x00, 0x04, 0x1E, 0xEA, 0x00, 0x02,
+-    0x03, 0x1B, 0x00, 0x01, 0x00, 0x04, 0x1E, 0xE8, 0x00, 0x02, 0x03, 0x1B, 0x00, 0x06, 0x00, 0x0E,
+-    0x00, 0x14, 0x00, 0x1A, 0x00, 0x20, 0x00, 0x26, 0x00, 0x2C, 0x01, 0xDB, 0x00, 0x02, 0x03, 0x00,
+-    0x01, 0xD7, 0x00, 0x02, 0x03, 0x01, 0x01, 0xD5, 0x00, 0x02, 0x03, 0x04, 0x01, 0xD9, 0x00, 0x02,
+-    0x03, 0x0C, 0x01, 0xDB, 0x00, 0x02, 0x03, 0x40, 0x01, 0xD7, 0x00, 0x02, 0x03, 0x41, 0x00, 0x07,
+-    0x00, 0x10, 0x00, 0x16, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x28, 0x00, 0x2E, 0x00, 0x34, 0x1E, 0xA7,
+-    0x00, 0x02, 0x03, 0x00, 0x1E, 0xA5, 0x00, 0x02, 0x03, 0x01, 0x1E, 0xAB, 0x00, 0x02, 0x03, 0x03,
+-    0x1E, 0xA9, 0x00, 0x02, 0x03, 0x09, 0x1E, 0xAD, 0x00, 0x02, 0x03, 0x23, 0x1E, 0xA7, 0x00, 0x02,
+-    0x03, 0x40, 0x1E, 0xA5, 0x00, 0x02, 0x03, 0x41, 0x00, 0x01, 0x00, 0x04, 0x01, 0xDF, 0x00, 0x02,
+-    0x03, 0x04, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x01, 0xFB, 0x00, 0x02, 0x03, 0x01, 0x01, 0xFB,
+-    0x00, 0x02, 0x03, 0x41, 0x00, 0x03, 0x00, 0x08, 0x00, 0x0E, 0x00, 0x14, 0x01, 0xFD, 0x00, 0x02,
+-    0x03, 0x01, 0x01, 0xE3, 0x00, 0x02, 0x03, 0x04, 0x01, 0xFD, 0x00, 0x02, 0x03, 0x41, 0x00, 0x02,
+-    0x00, 0x06, 0x00, 0x0C, 0x1E, 0x09, 0x00, 0x02, 0x03, 0x01, 0x1E, 0x09, 0x00, 0x02, 0x03, 0x41,
+-    0x00, 0x07, 0x00, 0x10, 0x00, 0x16, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x28, 0x00, 0x2E, 0x00, 0x34,
+-    0x1E, 0xC1, 0x00, 0x02, 0x03, 0x00, 0x1E, 0xBF, 0x00, 0x02, 0x03, 0x01, 0x1E, 0xC5, 0x00, 0x02,
+-    0x03, 0x03, 0x1E, 0xC3, 0x00, 0x02, 0x03, 0x09, 0x1E, 0xC7, 0x00, 0x02, 0x03, 0x23, 0x1E, 0xC1,
+-    0x00, 0x02, 0x03, 0x40, 0x1E, 0xBF, 0x00, 0x02, 0x03, 0x41, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C,
+-    0x1E, 0x2F, 0x00, 0x02, 0x03, 0x01, 0x1E, 0x2F, 0x00, 0x02, 0x03, 0x41, 0x00, 0x01, 0x00, 0x04,
+-    0x1E, 0xDD, 0x00, 0x02, 0x03, 0x1B, 0x00, 0x01, 0x00, 0x04, 0x1E, 0xDB, 0x00, 0x02, 0x03, 0x1B,
+-    0x00, 0x07, 0x00, 0x10, 0x00, 0x16, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x28, 0x00, 0x2E, 0x00, 0x34,
+-    0x1E, 0xD3, 0x00, 0x02, 0x03, 0x00, 0x1E, 0xD1, 0x00, 0x02, 0x03, 0x01, 0x1E, 0xD7, 0x00, 0x02,
+-    0x03, 0x03, 0x1E, 0xD5, 0x00, 0x02, 0x03, 0x09, 0x1E, 0xD9, 0x00, 0x02, 0x03, 0x23, 0x1E, 0xD3,
+-    0x00, 0x02, 0x03, 0x40, 0x1E, 0xD1, 0x00, 0x02, 0x03, 0x41, 0x00, 0x05, 0x00, 0x0C, 0x00, 0x12,
+-    0x00, 0x18, 0x00, 0x1E, 0x00, 0x24, 0x1E, 0x4D, 0x00, 0x02, 0x03, 0x01, 0x02, 0x2D, 0x00, 0x02,
+-    0x03, 0x04, 0x1E, 0x4F, 0x00, 0x02, 0x03, 0x08, 0x1E, 0xE1, 0x00, 0x02, 0x03, 0x1B, 0x1E, 0x4D,
+-    0x00, 0x02, 0x03, 0x41, 0x00, 0x01, 0x00, 0x04, 0x02, 0x2B, 0x00, 0x02, 0x03, 0x04, 0x00, 0x02,
+-    0x00, 0x06, 0x00, 0x0C, 0x01, 0xFF, 0x00, 0x02, 0x03, 0x01, 0x01, 0xFF, 0x00, 0x02, 0x03, 0x41,
+-    0x00, 0x01, 0x00, 0x04, 0x1E, 0xEB, 0x00, 0x02, 0x03, 0x1B, 0x00, 0x01, 0x00, 0x04, 0x1E, 0xE9,
+-    0x00, 0x02, 0x03, 0x1B, 0x00, 0x06, 0x00, 0x0E, 0x00, 0x14, 0x00, 0x1A, 0x00, 0x20, 0x00, 0x26,
+-    0x00, 0x2C, 0x01, 0xDC, 0x00, 0x02, 0x03, 0x00, 0x01, 0xD8, 0x00, 0x02, 0x03, 0x01, 0x01, 0xD6,
+-    0x00, 0x02, 0x03, 0x04, 0x01, 0xDA, 0x00, 0x02, 0x03, 0x0C, 0x01, 0xDC, 0x00, 0x02, 0x03, 0x40,
+-    0x01, 0xD8, 0x00, 0x02, 0x03, 0x41, 0x00, 0x07, 0x00, 0x10, 0x00, 0x16, 0x00, 0x1C, 0x00, 0x22,
+-    0x00, 0x28, 0x00, 0x2E, 0x00, 0x34, 0x1E, 0xB0, 0x00, 0x02, 0x03, 0x00, 0x1E, 0xAE, 0x00, 0x02,
+-    0x03, 0x01, 0x1E, 0xB4, 0x00, 0x02, 0x03, 0x03, 0x1E, 0xB2, 0x00, 0x02, 0x03, 0x09, 0x1E, 0xB6,
+-    0x00, 0x02, 0x03, 0x23, 0x1E, 0xB0, 0x00, 0x02, 0x03, 0x40, 0x1E, 0xAE, 0x00, 0x02, 0x03, 0x41,
+-    0x00, 0x07, 0x00, 0x10, 0x00, 0x16, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x28, 0x00, 0x2E, 0x00, 0x34,
+-    0x1E, 0xB1, 0x00, 0x02, 0x03, 0x00, 0x1E, 0xAF, 0x00, 0x02, 0x03, 0x01, 0x1E, 0xB5, 0x00, 0x02,
+-    0x03, 0x03, 0x1E, 0xB3, 0x00, 0x02, 0x03, 0x09, 0x1E, 0xB7, 0x00, 0x02, 0x03, 0x23, 0x1E, 0xB1,
+-    0x00, 0x02, 0x03, 0x40, 0x1E, 0xAF, 0x00, 0x02, 0x03, 0x41, 0x00, 0x01, 0x00, 0x04, 0x1E, 0x08,
+-    0x00, 0x02, 0x03, 0x27, 0x00, 0x01, 0x00, 0x04, 0x1E, 0x09, 0x00, 0x02, 0x03, 0x27, 0x00, 0x04,
+-    0x00, 0x0A, 0x00, 0x10, 0x00, 0x16, 0x00, 0x1C, 0x1E, 0x14, 0x00, 0x02, 0x03, 0x00, 0x1E, 0x16,
+-    0x00, 0x02, 0x03, 0x01, 0x1E, 0x14, 0x00, 0x02, 0x03, 0x40, 0x1E, 0x16, 0x00, 0x02, 0x03, 0x41,
+-    0x00, 0x04, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x16, 0x00, 0x1C, 0x1E, 0x15, 0x00, 0x02, 0x03, 0x00,
+-    0x1E, 0x17, 0x00, 0x02, 0x03, 0x01, 0x1E, 0x15, 0x00, 0x02, 0x03, 0x40, 0x1E, 0x17, 0x00, 0x02,
+-    0x03, 0x41, 0x00, 0x01, 0x00, 0x04, 0x1E, 0x1C, 0x00, 0x02, 0x03, 0x27, 0x00, 0x01, 0x00, 0x04,
+-    0x1E, 0x1D, 0x00, 0x02, 0x03, 0x27, 0x00, 0x05, 0x00, 0x0C, 0x00, 0x12, 0x00, 0x18, 0x00, 0x1E,
+-    0x00, 0x24, 0x1E, 0x50, 0x00, 0x02, 0x03, 0x00, 0x1E, 0x52, 0x00, 0x02, 0x03, 0x01, 0x01, 0xEC,
+-    0x00, 0x02, 0x03, 0x28, 0x1E, 0x50, 0x00, 0x02, 0x03, 0x40, 0x1E, 0x52, 0x00, 0x02, 0x03, 0x41,
+-    0x00, 0x05, 0x00, 0x0C, 0x00, 0x12, 0x00, 0x18, 0x00, 0x1E, 0x00, 0x24, 0x1E, 0x51, 0x00, 0x02,
+-    0x03, 0x00, 0x1E, 0x53, 0x00, 0x02, 0x03, 0x01, 0x01, 0xED, 0x00, 0x02, 0x03, 0x28, 0x1E, 0x51,
+-    0x00, 0x02, 0x03, 0x40, 0x1E, 0x53, 0x00, 0x02, 0x03, 0x41, 0x00, 0x01, 0x00, 0x04, 0x1E, 0x64,
+-    0x00, 0x02, 0x03, 0x07, 0x00, 0x01, 0x00, 0x04, 0x1E, 0x65, 0x00, 0x02, 0x03, 0x07, 0x00, 0x01,
+-    0x00, 0x04, 0x1E, 0x66, 0x00, 0x02, 0x03, 0x07, 0x00, 0x01, 0x00, 0x04, 0x1E, 0x67, 0x00, 0x02,
+-    0x03, 0x07, 0x00, 0x03, 0x00, 0x08, 0x00, 0x0E, 0x00, 0x14, 0x1E, 0x78, 0x00, 0x02, 0x03, 0x01,
+-    0x1E, 0xEE, 0x00, 0x02, 0x03, 0x1B, 0x1E, 0x78, 0x00, 0x02, 0x03, 0x41, 0x00, 0x03, 0x00, 0x08,
+-    0x00, 0x0E, 0x00, 0x14, 0x1E, 0x79, 0x00, 0x02, 0x03, 0x01, 0x1E, 0xEF, 0x00, 0x02, 0x03, 0x1B,
+-    0x1E, 0x79, 0x00, 0x02, 0x03, 0x41, 0x00, 0x01, 0x00, 0x04, 0x1E, 0x7A, 0x00, 0x02, 0x03, 0x08,
+-    0x00, 0x01, 0x00, 0x04, 0x1E, 0x7B, 0x00, 0x02, 0x03, 0x08, 0x00, 0x01, 0x00, 0x04, 0x1E, 0x9B,
+-    0x00, 0x02, 0x03, 0x07, 0x00, 0x07, 0x00, 0x10, 0x00, 0x16, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x28,
+-    0x00, 0x2E, 0x00, 0x34, 0x1E, 0xDC, 0x00, 0x02, 0x03, 0x00, 0x1E, 0xDA, 0x00, 0x02, 0x03, 0x01,
+-    0x1E, 0xE0, 0x00, 0x02, 0x03, 0x03, 0x1E, 0xDE, 0x00, 0x02, 0x03, 0x09, 0x1E, 0xE2, 0x00, 0x02,
+-    0x03, 0x23, 0x1E, 0xDC, 0x00, 0x02, 0x03, 0x40, 0x1E, 0xDA, 0x00, 0x02, 0x03, 0x41, 0x00, 0x07,
+-    0x00, 0x10, 0x00, 0x16, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x28, 0x00, 0x2E, 0x00, 0x34, 0x1E, 0xDD,
+-    0x00, 0x02, 0x03, 0x00, 0x1E, 0xDB, 0x00, 0x02, 0x03, 0x01, 0x1E, 0xE1, 0x00, 0x02, 0x03, 0x03,
+-    0x1E, 0xDF, 0x00, 0x02, 0x03, 0x09, 0x1E, 0xE3, 0x00, 0x02, 0x03, 0x23, 0x1E, 0xDD, 0x00, 0x02,
+-    0x03, 0x40, 0x1E, 0xDB, 0x00, 0x02, 0x03, 0x41, 0x00, 0x07, 0x00, 0x10, 0x00, 0x16, 0x00, 0x1C,
+-    0x00, 0x22, 0x00, 0x28, 0x00, 0x2E, 0x00, 0x34, 0x1E, 0xEA, 0x00, 0x02, 0x03, 0x00, 0x1E, 0xE8,
+-    0x00, 0x02, 0x03, 0x01, 0x1E, 0xEE, 0x00, 0x02, 0x03, 0x03, 0x1E, 0xEC, 0x00, 0x02, 0x03, 0x09,
+-    0x1E, 0xF0, 0x00, 0x02, 0x03, 0x23, 0x1E, 0xEA, 0x00, 0x02, 0x03, 0x40, 0x1E, 0xE8, 0x00, 0x02,
++    0x1E, 0xEA, 0x00, 0x03, 0x03, 0x00, 0x03, 0x1B, 0x00, 0xD9, 0x00, 0x02, 0x03, 0x00, 0x1E, 0xE8,
++    0x00, 0x03, 0x03, 0x01, 0x03, 0x1B, 0x00, 0xDA, 0x00, 0x02, 0x03, 0x01, 0x00, 0xDB, 0x00, 0x02,
++    0x03, 0x02, 0x1E, 0x78, 0x00, 0x03, 0x03, 0x03, 0x03, 0x01, 0x1E, 0xEE, 0x00, 0x03, 0x03, 0x03,
++    0x03, 0x1B, 0x1E, 0x78, 0x00, 0x03, 0x03, 0x03, 0x03, 0x41, 0x01, 0x68, 0x00, 0x02, 0x03, 0x03,
++    0x1E, 0x7A, 0x00, 0x03, 0x03, 0x04, 0x03, 0x08, 0x01, 0x6A, 0x00, 0x02, 0x03, 0x04, 0x01, 0x6C,
++    0x00, 0x02, 0x03, 0x06, 0x01, 0xDB, 0x00, 0x03, 0x03, 0x08, 0x03, 0x00, 0x01, 0xD7, 0x00, 0x03,
++    0x03, 0x08, 0x03, 0x01, 0x01, 0xD5, 0x00, 0x03, 0x03, 0x08, 0x03, 0x04, 0x01, 0xD9, 0x00, 0x03,
++    0x03, 0x08, 0x03, 0x0C, 0x01, 0xDB, 0x00, 0x03, 0x03, 0x08, 0x03, 0x40, 0x01, 0xD7, 0x00, 0x03,
++    0x03, 0x08, 0x03, 0x41, 0x00, 0xDC, 0x00, 0x02, 0x03, 0x08, 0x1E, 0xEC, 0x00, 0x03, 0x03, 0x09,
++    0x03, 0x1B, 0x1E, 0xE6, 0x00, 0x02, 0x03, 0x09, 0x01, 0x6E, 0x00, 0x02, 0x03, 0x0A, 0x01, 0x70,
++    0x00, 0x02, 0x03, 0x0B, 0x01, 0xD3, 0x00, 0x02, 0x03, 0x0C, 0x02, 0x14, 0x00, 0x02, 0x03, 0x0F,
++    0x02, 0x16, 0x00, 0x02, 0x03, 0x11, 0x1E, 0xEA, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x00, 0x1E, 0xE8,
++    0x00, 0x03, 0x03, 0x1B, 0x03, 0x01, 0x1E, 0xEE, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x03, 0x1E, 0xEC,
++    0x00, 0x03, 0x03, 0x1B, 0x03, 0x09, 0x1E, 0xF0, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x23, 0x1E, 0xEA,
++    0x00, 0x03, 0x03, 0x1B, 0x03, 0x40, 0x1E, 0xE8, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x41, 0x01, 0xAF,
++    0x00, 0x02, 0x03, 0x1B, 0x1E, 0xF0, 0x00, 0x03, 0x03, 0x23, 0x03, 0x1B, 0x1E, 0xE4, 0x00, 0x02,
++    0x03, 0x23, 0x1E, 0x72, 0x00, 0x02, 0x03, 0x24, 0x01, 0x72, 0x00, 0x02, 0x03, 0x28, 0x1E, 0x76,
++    0x00, 0x02, 0x03, 0x2D, 0x1E, 0x74, 0x00, 0x02, 0x03, 0x30, 0x1E, 0xEA, 0x00, 0x03, 0x03, 0x40,
++    0x03, 0x1B, 0x00, 0xD9, 0x00, 0x02, 0x03, 0x40, 0x1E, 0xE8, 0x00, 0x03, 0x03, 0x41, 0x03, 0x1B,
++    0x00, 0xDA, 0x00, 0x02, 0x03, 0x41, 0x01, 0xD7, 0x00, 0x02, 0x03, 0x44, 0x00, 0x02, 0x00, 0x06,
++    0x00, 0x0C, 0x1E, 0x7C, 0x00, 0x02, 0x03, 0x03, 0x1E, 0x7E, 0x00, 0x02, 0x03, 0x23, 0x00, 0x08,
++    0x00, 0x12, 0x00, 0x18, 0x00, 0x1E, 0x00, 0x24, 0x00, 0x2A, 0x00, 0x30, 0x00, 0x36, 0x00, 0x3C,
++    0x1E, 0x80, 0x00, 0x02, 0x03, 0x00, 0x1E, 0x82, 0x00, 0x02, 0x03, 0x01, 0x01, 0x74, 0x00, 0x02,
++    0x03, 0x02, 0x1E, 0x86, 0x00, 0x02, 0x03, 0x07, 0x1E, 0x84, 0x00, 0x02, 0x03, 0x08, 0x1E, 0x88,
++    0x00, 0x02, 0x03, 0x23, 0x1E, 0x80, 0x00, 0x02, 0x03, 0x40, 0x1E, 0x82, 0x00, 0x02, 0x03, 0x41,
++    0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x1E, 0x8A, 0x00, 0x02, 0x03, 0x07, 0x1E, 0x8C, 0x00, 0x02,
++    0x03, 0x08, 0x00, 0x0B, 0x00, 0x18, 0x00, 0x1E, 0x00, 0x24, 0x00, 0x2A, 0x00, 0x30, 0x00, 0x36,
++    0x00, 0x3C, 0x00, 0x42, 0x00, 0x48, 0x00, 0x4E, 0x00, 0x54, 0x1E, 0xF2, 0x00, 0x02, 0x03, 0x00,
++    0x00, 0xDD, 0x00, 0x02, 0x03, 0x01, 0x01, 0x76, 0x00, 0x02, 0x03, 0x02, 0x1E, 0xF8, 0x00, 0x02,
++    0x03, 0x03, 0x02, 0x32, 0x00, 0x02, 0x03, 0x04, 0x1E, 0x8E, 0x00, 0x02, 0x03, 0x07, 0x01, 0x78,
++    0x00, 0x02, 0x03, 0x08, 0x1E, 0xF6, 0x00, 0x02, 0x03, 0x09, 0x1E, 0xF4, 0x00, 0x02, 0x03, 0x23,
++    0x1E, 0xF2, 0x00, 0x02, 0x03, 0x40, 0x00, 0xDD, 0x00, 0x02, 0x03, 0x41, 0x00, 0x07, 0x00, 0x10,
++    0x00, 0x16, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x28, 0x00, 0x2E, 0x00, 0x34, 0x01, 0x79, 0x00, 0x02,
++    0x03, 0x01, 0x1E, 0x90, 0x00, 0x02, 0x03, 0x02, 0x01, 0x7B, 0x00, 0x02, 0x03, 0x07, 0x01, 0x7D,
++    0x00, 0x02, 0x03, 0x0C, 0x1E, 0x92, 0x00, 0x02, 0x03, 0x23, 0x1E, 0x94, 0x00, 0x02, 0x03, 0x31,
++    0x01, 0x79, 0x00, 0x02, 0x03, 0x41, 0x00, 0x26, 0x00, 0x4E, 0x00, 0x54, 0x00, 0x5A, 0x00, 0x62,
++    0x00, 0x6A, 0x00, 0x72, 0x00, 0x7A, 0x00, 0x82, 0x00, 0x8A, 0x00, 0x92, 0x00, 0x98, 0x00, 0x9E,
++    0x00, 0xA4, 0x00, 0xAC, 0x00, 0xB4, 0x00, 0xBC, 0x00, 0xC4, 0x00, 0xCC, 0x00, 0xD4, 0x00, 0xDC,
++    0x00, 0xE2, 0x00, 0xEA, 0x00, 0xF0, 0x00, 0xF8, 0x00, 0xFE, 0x01, 0x04, 0x01, 0x0C, 0x01, 0x14,
++    0x01, 0x1A, 0x01, 0x20, 0x01, 0x26, 0x01, 0x2C, 0x01, 0x34, 0x01, 0x3C, 0x01, 0x42, 0x01, 0x48,
++    0x01, 0x4E, 0x01, 0x54, 0x00, 0xE0, 0x00, 0x02, 0x03, 0x00, 0x00, 0xE1, 0x00, 0x02, 0x03, 0x01,
++    0x1E, 0xA7, 0x00, 0x03, 0x03, 0x02, 0x03, 0x00, 0x1E, 0xA5, 0x00, 0x03, 0x03, 0x02, 0x03, 0x01,
++    0x1E, 0xAB, 0x00, 0x03, 0x03, 0x02, 0x03, 0x03, 0x1E, 0xA9, 0x00, 0x03, 0x03, 0x02, 0x03, 0x09,
++    0x1E, 0xAD, 0x00, 0x03, 0x03, 0x02, 0x03, 0x23, 0x1E, 0xA7, 0x00, 0x03, 0x03, 0x02, 0x03, 0x40,
++    0x1E, 0xA5, 0x00, 0x03, 0x03, 0x02, 0x03, 0x41, 0x00, 0xE2, 0x00, 0x02, 0x03, 0x02, 0x00, 0xE3,
++    0x00, 0x02, 0x03, 0x03, 0x01, 0x01, 0x00, 0x02, 0x03, 0x04, 0x1E, 0xB1, 0x00, 0x03, 0x03, 0x06,
++    0x03, 0x00, 0x1E, 0xAF, 0x00, 0x03, 0x03, 0x06, 0x03, 0x01, 0x1E, 0xB5, 0x00, 0x03, 0x03, 0x06,
++    0x03, 0x03, 0x1E, 0xB3, 0x00, 0x03, 0x03, 0x06, 0x03, 0x09, 0x1E, 0xB7, 0x00, 0x03, 0x03, 0x06,
++    0x03, 0x23, 0x1E, 0xB1, 0x00, 0x03, 0x03, 0x06, 0x03, 0x40, 0x1E, 0xAF, 0x00, 0x03, 0x03, 0x06,
++    0x03, 0x41, 0x01, 0x03, 0x00, 0x02, 0x03, 0x06, 0x01, 0xE1, 0x00, 0x03, 0x03, 0x07, 0x03, 0x04,
++    0x02, 0x27, 0x00, 0x02, 0x03, 0x07, 0x01, 0xDF, 0x00, 0x03, 0x03, 0x08, 0x03, 0x04, 0x00, 0xE4,
++    0x00, 0x02, 0x03, 0x08, 0x1E, 0xA3, 0x00, 0x02, 0x03, 0x09, 0x01, 0xFB, 0x00, 0x03, 0x03, 0x0A,
++    0x03, 0x01, 0x01, 0xFB, 0x00, 0x03, 0x03, 0x0A, 0x03, 0x41, 0x00, 0xE5, 0x00, 0x02, 0x03, 0x0A,
++    0x01, 0xCE, 0x00, 0x02, 0x03, 0x0C, 0x02, 0x01, 0x00, 0x02, 0x03, 0x0F, 0x02, 0x03, 0x00, 0x02,
++    0x03, 0x11, 0x1E, 0xAD, 0x00, 0x03, 0x03, 0x23, 0x03, 0x02, 0x1E, 0xB7, 0x00, 0x03, 0x03, 0x23,
++    0x03, 0x06, 0x1E, 0xA1, 0x00, 0x02, 0x03, 0x23, 0x1E, 0x01, 0x00, 0x02, 0x03, 0x25, 0x01, 0x05,
++    0x00, 0x02, 0x03, 0x28, 0x00, 0xE0, 0x00, 0x02, 0x03, 0x40, 0x00, 0xE1, 0x00, 0x02, 0x03, 0x41,
++    0x00, 0x03, 0x00, 0x08, 0x00, 0x0E, 0x00, 0x14, 0x1E, 0x03, 0x00, 0x02, 0x03, 0x07, 0x1E, 0x05,
++    0x00, 0x02, 0x03, 0x23, 0x1E, 0x07, 0x00, 0x02, 0x03, 0x31, 0x00, 0x0A, 0x00, 0x16, 0x00, 0x1E,
++    0x00, 0x24, 0x00, 0x2A, 0x00, 0x30, 0x00, 0x36, 0x00, 0x3E, 0x00, 0x46, 0x00, 0x4C, 0x00, 0x54,
++    0x1E, 0x09, 0x00, 0x03, 0x03, 0x01, 0x03, 0x27, 0x01, 0x07, 0x00, 0x02, 0x03, 0x01, 0x01, 0x09,
++    0x00, 0x02, 0x03, 0x02, 0x01, 0x0B, 0x00, 0x02, 0x03, 0x07, 0x01, 0x0D, 0x00, 0x02, 0x03, 0x0C,
++    0x1E, 0x09, 0x00, 0x03, 0x03, 0x27, 0x03, 0x01, 0x1E, 0x09, 0x00, 0x03, 0x03, 0x27, 0x03, 0x41,
++    0x00, 0xE7, 0x00, 0x02, 0x03, 0x27, 0x1E, 0x09, 0x00, 0x03, 0x03, 0x41, 0x03, 0x27, 0x01, 0x07,
++    0x00, 0x02, 0x03, 0x41, 0x00, 0x06, 0x00, 0x0E, 0x00, 0x14, 0x00, 0x1A, 0x00, 0x20, 0x00, 0x26,
++    0x00, 0x2C, 0x1E, 0x0B, 0x00, 0x02, 0x03, 0x07, 0x01, 0x0F, 0x00, 0x02, 0x03, 0x0C, 0x1E, 0x0D,
++    0x00, 0x02, 0x03, 0x23, 0x1E, 0x11, 0x00, 0x02, 0x03, 0x27, 0x1E, 0x13, 0x00, 0x02, 0x03, 0x2D,
++    0x1E, 0x0F, 0x00, 0x02, 0x03, 0x31, 0x00, 0x21, 0x00, 0x44, 0x00, 0x4A, 0x00, 0x50, 0x00, 0x58,
++    0x00, 0x60, 0x00, 0x68, 0x00, 0x70, 0x00, 0x78, 0x00, 0x80, 0x00, 0x88, 0x00, 0x8E, 0x00, 0x94,
++    0x00, 0x9C, 0x00, 0xA4, 0x00, 0xAC, 0x00, 0xB4, 0x00, 0xBA, 0x00, 0xC2, 0x00, 0xC8, 0x00, 0xCE,
++    0x00, 0xD4, 0x00, 0xDA, 0x00, 0xE0, 0x00, 0xE6, 0x00, 0xEC, 0x00, 0xF4, 0x00, 0xFA, 0x01, 0x02,
++    0x01, 0x08, 0x01, 0x0E, 0x01, 0x14, 0x01, 0x1A, 0x01, 0x20, 0x00, 0xE8, 0x00, 0x02, 0x03, 0x00,
++    0x00, 0xE9, 0x00, 0x02, 0x03, 0x01, 0x1E, 0xC1, 0x00, 0x03, 0x03, 0x02, 0x03, 0x00, 0x1E, 0xBF,
++    0x00, 0x03, 0x03, 0x02, 0x03, 0x01, 0x1E, 0xC5, 0x00, 0x03, 0x03, 0x02, 0x03, 0x03, 0x1E, 0xC3,
++    0x00, 0x03, 0x03, 0x02, 0x03, 0x09, 0x1E, 0xC7, 0x00, 0x03, 0x03, 0x02, 0x03, 0x23, 0x1E, 0xC1,
++    0x00, 0x03, 0x03, 0x02, 0x03, 0x40, 0x1E, 0xBF, 0x00, 0x03, 0x03, 0x02, 0x03, 0x41, 0x00, 0xEA,
++    0x00, 0x02, 0x03, 0x02, 0x1E, 0xBD, 0x00, 0x02, 0x03, 0x03, 0x1E, 0x15, 0x00, 0x03, 0x03, 0x04,
++    0x03, 0x00, 0x1E, 0x17, 0x00, 0x03, 0x03, 0x04, 0x03, 0x01, 0x1E, 0x15, 0x00, 0x03, 0x03, 0x04,
++    0x03, 0x40, 0x1E, 0x17, 0x00, 0x03, 0x03, 0x04, 0x03, 0x41, 0x01, 0x13, 0x00, 0x02, 0x03, 0x04,
++    0x1E, 0x1D, 0x00, 0x03, 0x03, 0x06, 0x03, 0x27, 0x01, 0x15, 0x00, 0x02, 0x03, 0x06, 0x01, 0x17,
++    0x00, 0x02, 0x03, 0x07, 0x00, 0xEB, 0x00, 0x02, 0x03, 0x08, 0x1E, 0xBB, 0x00, 0x02, 0x03, 0x09,
++    0x01, 0x1B, 0x00, 0x02, 0x03, 0x0C, 0x02, 0x05, 0x00, 0x02, 0x03, 0x0F, 0x02, 0x07, 0x00, 0x02,
++    0x03, 0x11, 0x1E, 0xC7, 0x00, 0x03, 0x03, 0x23, 0x03, 0x02, 0x1E, 0xB9, 0x00, 0x02, 0x03, 0x23,
++    0x1E, 0x1D, 0x00, 0x03, 0x03, 0x27, 0x03, 0x06, 0x02, 0x29, 0x00, 0x02, 0x03, 0x27, 0x01, 0x19,
++    0x00, 0x02, 0x03, 0x28, 0x1E, 0x19, 0x00, 0x02, 0x03, 0x2D, 0x1E, 0x1B, 0x00, 0x02, 0x03, 0x30,
++    0x00, 0xE8, 0x00, 0x02, 0x03, 0x40, 0x00, 0xE9, 0x00, 0x02, 0x03, 0x41, 0x00, 0x01, 0x00, 0x04,
++    0x1E, 0x1F, 0x00, 0x02, 0x03, 0x07, 0x00, 0x08, 0x00, 0x12, 0x00, 0x18, 0x00, 0x1E, 0x00, 0x24,
++    0x00, 0x2A, 0x00, 0x30, 0x00, 0x36, 0x00, 0x3C, 0x01, 0xF5, 0x00, 0x02, 0x03, 0x01, 0x01, 0x1D,
++    0x00, 0x02, 0x03, 0x02, 0x1E, 0x21, 0x00, 0x02, 0x03, 0x04, 0x01, 0x1F, 0x00, 0x02, 0x03, 0x06,
++    0x01, 0x21, 0x00, 0x02, 0x03, 0x07, 0x01, 0xE7, 0x00, 0x02, 0x03, 0x0C, 0x01, 0x23, 0x00, 0x02,
++    0x03, 0x27, 0x01, 0xF5, 0x00, 0x02, 0x03, 0x41, 0x00, 0x08, 0x00, 0x12, 0x00, 0x18, 0x00, 0x1E,
++    0x00, 0x24, 0x00, 0x2A, 0x00, 0x30, 0x00, 0x36, 0x00, 0x3C, 0x01, 0x25, 0x00, 0x02, 0x03, 0x02,
++    0x1E, 0x23, 0x00, 0x02, 0x03, 0x07, 0x1E, 0x27, 0x00, 0x02, 0x03, 0x08, 0x02, 0x1F, 0x00, 0x02,
++    0x03, 0x0C, 0x1E, 0x25, 0x00, 0x02, 0x03, 0x23, 0x1E, 0x29, 0x00, 0x02, 0x03, 0x27, 0x1E, 0x2B,
++    0x00, 0x02, 0x03, 0x2E, 0x1E, 0x96, 0x00, 0x02, 0x03, 0x31, 0x00, 0x13, 0x00, 0x28, 0x00, 0x2E,
++    0x00, 0x34, 0x00, 0x3A, 0x00, 0x40, 0x00, 0x46, 0x00, 0x4C, 0x00, 0x54, 0x00, 0x5C, 0x00, 0x62,
++    0x00, 0x68, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x7A, 0x00, 0x80, 0x00, 0x86, 0x00, 0x8C, 0x00, 0x92,
++    0x00, 0x98, 0x00, 0xEC, 0x00, 0x02, 0x03, 0x00, 0x00, 0xED, 0x00, 0x02, 0x03, 0x01, 0x00, 0xEE,
++    0x00, 0x02, 0x03, 0x02, 0x01, 0x29, 0x00, 0x02, 0x03, 0x03, 0x01, 0x2B, 0x00, 0x02, 0x03, 0x04,
++    0x01, 0x2D, 0x00, 0x02, 0x03, 0x06, 0x1E, 0x2F, 0x00, 0x03, 0x03, 0x08, 0x03, 0x01, 0x1E, 0x2F,
++    0x00, 0x03, 0x03, 0x08, 0x03, 0x41, 0x00, 0xEF, 0x00, 0x02, 0x03, 0x08, 0x1E, 0xC9, 0x00, 0x02,
++    0x03, 0x09, 0x01, 0xD0, 0x00, 0x02, 0x03, 0x0C, 0x02, 0x09, 0x00, 0x02, 0x03, 0x0F, 0x02, 0x0B,
++    0x00, 0x02, 0x03, 0x11, 0x1E, 0xCB, 0x00, 0x02, 0x03, 0x23, 0x01, 0x2F, 0x00, 0x02, 0x03, 0x28,
++    0x1E, 0x2D, 0x00, 0x02, 0x03, 0x30, 0x00, 0xEC, 0x00, 0x02, 0x03, 0x40, 0x00, 0xED, 0x00, 0x02,
++    0x03, 0x41, 0x1E, 0x2F, 0x00, 0x02, 0x03, 0x44, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x01, 0x35,
++    0x00, 0x02, 0x03, 0x02, 0x01, 0xF0, 0x00, 0x02, 0x03, 0x0C, 0x00, 0x06, 0x00, 0x0E, 0x00, 0x14,
++    0x00, 0x1A, 0x00, 0x20, 0x00, 0x26, 0x00, 0x2C, 0x1E, 0x31, 0x00, 0x02, 0x03, 0x01, 0x01, 0xE9,
++    0x00, 0x02, 0x03, 0x0C, 0x1E, 0x33, 0x00, 0x02, 0x03, 0x23, 0x01, 0x37, 0x00, 0x02, 0x03, 0x27,
++    0x1E, 0x35, 0x00, 0x02, 0x03, 0x31, 0x1E, 0x31, 0x00, 0x02, 0x03, 0x41, 0x00, 0x09, 0x00, 0x14,
++    0x00, 0x1A, 0x00, 0x22, 0x00, 0x28, 0x00, 0x30, 0x00, 0x36, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x48,
++    0x01, 0x3A, 0x00, 0x02, 0x03, 0x01, 0x1E, 0x39, 0x00, 0x03, 0x03, 0x04, 0x03, 0x23, 0x01, 0x3E,
++    0x00, 0x02, 0x03, 0x0C, 0x1E, 0x39, 0x00, 0x03, 0x03, 0x23, 0x03, 0x04, 0x1E, 0x37, 0x00, 0x02,
++    0x03, 0x23, 0x01, 0x3C, 0x00, 0x02, 0x03, 0x27, 0x1E, 0x3D, 0x00, 0x02, 0x03, 0x2D, 0x1E, 0x3B,
++    0x00, 0x02, 0x03, 0x31, 0x01, 0x3A, 0x00, 0x02, 0x03, 0x41, 0x00, 0x04, 0x00, 0x0A, 0x00, 0x10,
++    0x00, 0x16, 0x00, 0x1C, 0x1E, 0x3F, 0x00, 0x02, 0x03, 0x01, 0x1E, 0x41, 0x00, 0x02, 0x03, 0x07,
++    0x1E, 0x43, 0x00, 0x02, 0x03, 0x23, 0x1E, 0x3F, 0x00, 0x02, 0x03, 0x41, 0x00, 0x0B, 0x00, 0x18,
++    0x00, 0x1E, 0x00, 0x24, 0x00, 0x2A, 0x00, 0x30, 0x00, 0x36, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x48,
++    0x00, 0x4E, 0x00, 0x54, 0x01, 0xF9, 0x00, 0x02, 0x03, 0x00, 0x01, 0x44, 0x00, 0x02, 0x03, 0x01,
++    0x00, 0xF1, 0x00, 0x02, 0x03, 0x03, 0x1E, 0x45, 0x00, 0x02, 0x03, 0x07, 0x01, 0x48, 0x00, 0x02,
++    0x03, 0x0C, 0x1E, 0x47, 0x00, 0x02, 0x03, 0x23, 0x01, 0x46, 0x00, 0x02, 0x03, 0x27, 0x1E, 0x4B,
++    0x00, 0x02, 0x03, 0x2D, 0x1E, 0x49, 0x00, 0x02, 0x03, 0x31, 0x01, 0xF9, 0x00, 0x02, 0x03, 0x40,
++    0x01, 0x44, 0x00, 0x02, 0x03, 0x41, 0x00, 0x34, 0x00, 0x6A, 0x00, 0x72, 0x00, 0x78, 0x00, 0x80,
++    0x00, 0x86, 0x00, 0x8E, 0x00, 0x96, 0x00, 0x9E, 0x00, 0xA6, 0x00, 0xAE, 0x00, 0xB6, 0x00, 0xBE,
++    0x00, 0xC4, 0x00, 0xCC, 0x00, 0xD4, 0x00, 0xDC, 0x00, 0xE4, 0x00, 0xEC, 0x00, 0xF2, 0x00, 0xFA,
++    0x01, 0x02, 0x01, 0x0A, 0x01, 0x12, 0x01, 0x1A, 0x01, 0x20, 0x01, 0x26, 0x01, 0x2E, 0x01, 0x34,
++    0x01, 0x3C, 0x01, 0x42, 0x01, 0x4A, 0x01, 0x50, 0x01, 0x56, 0x01, 0x5C, 0x01, 0x62, 0x01, 0x68,
++    0x01, 0x70, 0x01, 0x78, 0x01, 0x80, 0x01, 0x88, 0x01, 0x90, 0x01, 0x98, 0x01, 0xA0, 0x01, 0xA6,
++    0x01, 0xAE, 0x01, 0xB6, 0x01, 0xBC, 0x01, 0xC4, 0x01, 0xCA, 0x01, 0xD2, 0x01, 0xD8, 0x01, 0xE0,
++    0x1E, 0xDD, 0x00, 0x03, 0x03, 0x00, 0x03, 0x1B, 0x00, 0xF2, 0x00, 0x02, 0x03, 0x00, 0x1E, 0xDB,
++    0x00, 0x03, 0x03, 0x01, 0x03, 0x1B, 0x00, 0xF3, 0x00, 0x02, 0x03, 0x01, 0x1E, 0xD3, 0x00, 0x03,
++    0x03, 0x02, 0x03, 0x00, 0x1E, 0xD1, 0x00, 0x03, 0x03, 0x02, 0x03, 0x01, 0x1E, 0xD7, 0x00, 0x03,
++    0x03, 0x02, 0x03, 0x03, 0x1E, 0xD5, 0x00, 0x03, 0x03, 0x02, 0x03, 0x09, 0x1E, 0xD9, 0x00, 0x03,
++    0x03, 0x02, 0x03, 0x23, 0x1E, 0xD3, 0x00, 0x03, 0x03, 0x02, 0x03, 0x40, 0x1E, 0xD1, 0x00, 0x03,
++    0x03, 0x02, 0x03, 0x41, 0x00, 0xF4, 0x00, 0x02, 0x03, 0x02, 0x1E, 0x4D, 0x00, 0x03, 0x03, 0x03,
++    0x03, 0x01, 0x02, 0x2D, 0x00, 0x03, 0x03, 0x03, 0x03, 0x04, 0x1E, 0x4F, 0x00, 0x03, 0x03, 0x03,
++    0x03, 0x08, 0x1E, 0xE1, 0x00, 0x03, 0x03, 0x03, 0x03, 0x1B, 0x1E, 0x4D, 0x00, 0x03, 0x03, 0x03,
++    0x03, 0x41, 0x00, 0xF5, 0x00, 0x02, 0x03, 0x03, 0x1E, 0x51, 0x00, 0x03, 0x03, 0x04, 0x03, 0x00,
++    0x1E, 0x53, 0x00, 0x03, 0x03, 0x04, 0x03, 0x01, 0x01, 0xED, 0x00, 0x03, 0x03, 0x04, 0x03, 0x28,
++    0x1E, 0x51, 0x00, 0x03, 0x03, 0x04, 0x03, 0x40, 0x1E, 0x53, 0x00, 0x03, 0x03, 0x04, 0x03, 0x41,
++    0x01, 0x4D, 0x00, 0x02, 0x03, 0x04, 0x01, 0x4F, 0x00, 0x02, 0x03, 0x06, 0x02, 0x31, 0x00, 0x03,
++    0x03, 0x07, 0x03, 0x04, 0x02, 0x2F, 0x00, 0x02, 0x03, 0x07, 0x02, 0x2B, 0x00, 0x03, 0x03, 0x08,
++    0x03, 0x04, 0x00, 0xF6, 0x00, 0x02, 0x03, 0x08, 0x1E, 0xDF, 0x00, 0x03, 0x03, 0x09, 0x03, 0x1B,
++    0x1E, 0xCF, 0x00, 0x02, 0x03, 0x09, 0x01, 0x51, 0x00, 0x02, 0x03, 0x0B, 0x01, 0xD2, 0x00, 0x02,
++    0x03, 0x0C, 0x02, 0x0D, 0x00, 0x02, 0x03, 0x0F, 0x02, 0x0F, 0x00, 0x02, 0x03, 0x11, 0x1E, 0xDD,
++    0x00, 0x03, 0x03, 0x1B, 0x03, 0x00, 0x1E, 0xDB, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x01, 0x1E, 0xE1,
++    0x00, 0x03, 0x03, 0x1B, 0x03, 0x03, 0x1E, 0xDF, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x09, 0x1E, 0xE3,
++    0x00, 0x03, 0x03, 0x1B, 0x03, 0x23, 0x1E, 0xDD, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x40, 0x1E, 0xDB,
++    0x00, 0x03, 0x03, 0x1B, 0x03, 0x41, 0x01, 0xA1, 0x00, 0x02, 0x03, 0x1B, 0x1E, 0xD9, 0x00, 0x03,
++    0x03, 0x23, 0x03, 0x02, 0x1E, 0xE3, 0x00, 0x03, 0x03, 0x23, 0x03, 0x1B, 0x1E, 0xCD, 0x00, 0x02,
++    0x03, 0x23, 0x01, 0xED, 0x00, 0x03, 0x03, 0x28, 0x03, 0x04, 0x01, 0xEB, 0x00, 0x02, 0x03, 0x28,
++    0x1E, 0xDD, 0x00, 0x03, 0x03, 0x40, 0x03, 0x1B, 0x00, 0xF2, 0x00, 0x02, 0x03, 0x40, 0x1E, 0xDB,
++    0x00, 0x03, 0x03, 0x41, 0x03, 0x1B, 0x00, 0xF3, 0x00, 0x02, 0x03, 0x41, 0x00, 0x03, 0x00, 0x08,
++    0x00, 0x0E, 0x00, 0x14, 0x1E, 0x55, 0x00, 0x02, 0x03, 0x01, 0x1E, 0x57, 0x00, 0x02, 0x03, 0x07,
++    0x1E, 0x55, 0x00, 0x02, 0x03, 0x41, 0x00, 0x0B, 0x00, 0x18, 0x00, 0x1E, 0x00, 0x26, 0x00, 0x2C,
++    0x00, 0x32, 0x00, 0x38, 0x00, 0x3E, 0x00, 0x46, 0x00, 0x4C, 0x00, 0x52, 0x00, 0x58, 0x01, 0x55,
++    0x00, 0x02, 0x03, 0x01, 0x1E, 0x5D, 0x00, 0x03, 0x03, 0x04, 0x03, 0x23, 0x1E, 0x59, 0x00, 0x02,
++    0x03, 0x07, 0x01, 0x59, 0x00, 0x02, 0x03, 0x0C, 0x02, 0x11, 0x00, 0x02, 0x03, 0x0F, 0x02, 0x13,
++    0x00, 0x02, 0x03, 0x11, 0x1E, 0x5D, 0x00, 0x03, 0x03, 0x23, 0x03, 0x04, 0x1E, 0x5B, 0x00, 0x02,
++    0x03, 0x23, 0x01, 0x57, 0x00, 0x02, 0x03, 0x27, 0x1E, 0x5F, 0x00, 0x02, 0x03, 0x31, 0x01, 0x55,
++    0x00, 0x02, 0x03, 0x41, 0x00, 0x0D, 0x00, 0x1C, 0x00, 0x24, 0x00, 0x2A, 0x00, 0x30, 0x00, 0x38,
++    0x00, 0x3E, 0x00, 0x46, 0x00, 0x4C, 0x00, 0x54, 0x00, 0x5A, 0x00, 0x60, 0x00, 0x66, 0x00, 0x6E,
++    0x1E, 0x65, 0x00, 0x03, 0x03, 0x01, 0x03, 0x07, 0x01, 0x5B, 0x00, 0x02, 0x03, 0x01, 0x01, 0x5D,
++    0x00, 0x02, 0x03, 0x02, 0x1E, 0x69, 0x00, 0x03, 0x03, 0x07, 0x03, 0x23, 0x1E, 0x61, 0x00, 0x02,
++    0x03, 0x07, 0x1E, 0x67, 0x00, 0x03, 0x03, 0x0C, 0x03, 0x07, 0x01, 0x61, 0x00, 0x02, 0x03, 0x0C,
++    0x1E, 0x69, 0x00, 0x03, 0x03, 0x23, 0x03, 0x07, 0x1E, 0x63, 0x00, 0x02, 0x03, 0x23, 0x02, 0x19,
++    0x00, 0x02, 0x03, 0x26, 0x01, 0x5F, 0x00, 0x02, 0x03, 0x27, 0x1E, 0x65, 0x00, 0x03, 0x03, 0x41,
++    0x03, 0x07, 0x01, 0x5B, 0x00, 0x02, 0x03, 0x41, 0x00, 0x08, 0x00, 0x12, 0x00, 0x18, 0x00, 0x1E,
++    0x00, 0x24, 0x00, 0x2A, 0x00, 0x30, 0x00, 0x36, 0x00, 0x3C, 0x1E, 0x6B, 0x00, 0x02, 0x03, 0x07,
++    0x1E, 0x97, 0x00, 0x02, 0x03, 0x08, 0x01, 0x65, 0x00, 0x02, 0x03, 0x0C, 0x1E, 0x6D, 0x00, 0x02,
++    0x03, 0x23, 0x02, 0x1B, 0x00, 0x02, 0x03, 0x26, 0x01, 0x63, 0x00, 0x02, 0x03, 0x27, 0x1E, 0x71,
++    0x00, 0x02, 0x03, 0x2D, 0x1E, 0x6F, 0x00, 0x02, 0x03, 0x31, 0x00, 0x2D, 0x00, 0x5C, 0x00, 0x64,
++    0x00, 0x6A, 0x00, 0x72, 0x00, 0x78, 0x00, 0x7E, 0x00, 0x86, 0x00, 0x8E, 0x00, 0x96, 0x00, 0x9C,
++    0x00, 0xA4, 0x00, 0xAA, 0x00, 0xB0, 0x00, 0xB8, 0x00, 0xC0, 0x00, 0xC8, 0x00, 0xD0, 0x00, 0xD8,
++    0x00, 0xE0, 0x00, 0xE6, 0x00, 0xEE, 0x00, 0xF4, 0x00, 0xFA, 0x01, 0x00, 0x01, 0x06, 0x01, 0x0C,
++    0x01, 0x12, 0x01, 0x1A, 0x01, 0x22, 0x01, 0x2A, 0x01, 0x32, 0x01, 0x3A, 0x01, 0x42, 0x01, 0x4A,
++    0x01, 0x50, 0x01, 0x58, 0x01, 0x5E, 0x01, 0x64, 0x01, 0x6A, 0x01, 0x70, 0x01, 0x76, 0x01, 0x7E,
++    0x01, 0x84, 0x01, 0x8C, 0x01, 0x92, 0x1E, 0xEB, 0x00, 0x03, 0x03, 0x00, 0x03, 0x1B, 0x00, 0xF9,
++    0x00, 0x02, 0x03, 0x00, 0x1E, 0xE9, 0x00, 0x03, 0x03, 0x01, 0x03, 0x1B, 0x00, 0xFA, 0x00, 0x02,
++    0x03, 0x01, 0x00, 0xFB, 0x00, 0x02, 0x03, 0x02, 0x1E, 0x79, 0x00, 0x03, 0x03, 0x03, 0x03, 0x01,
++    0x1E, 0xEF, 0x00, 0x03, 0x03, 0x03, 0x03, 0x1B, 0x1E, 0x79, 0x00, 0x03, 0x03, 0x03, 0x03, 0x41,
++    0x01, 0x69, 0x00, 0x02, 0x03, 0x03, 0x1E, 0x7B, 0x00, 0x03, 0x03, 0x04, 0x03, 0x08, 0x01, 0x6B,
++    0x00, 0x02, 0x03, 0x04, 0x01, 0x6D, 0x00, 0x02, 0x03, 0x06, 0x01, 0xDC, 0x00, 0x03, 0x03, 0x08,
++    0x03, 0x00, 0x01, 0xD8, 0x00, 0x03, 0x03, 0x08, 0x03, 0x01, 0x01, 0xD6, 0x00, 0x03, 0x03, 0x08,
++    0x03, 0x04, 0x01, 0xDA, 0x00, 0x03, 0x03, 0x08, 0x03, 0x0C, 0x01, 0xDC, 0x00, 0x03, 0x03, 0x08,
++    0x03, 0x40, 0x01, 0xD8, 0x00, 0x03, 0x03, 0x08, 0x03, 0x41, 0x00, 0xFC, 0x00, 0x02, 0x03, 0x08,
++    0x1E, 0xED, 0x00, 0x03, 0x03, 0x09, 0x03, 0x1B, 0x1E, 0xE7, 0x00, 0x02, 0x03, 0x09, 0x01, 0x6F,
++    0x00, 0x02, 0x03, 0x0A, 0x01, 0x71, 0x00, 0x02, 0x03, 0x0B, 0x01, 0xD4, 0x00, 0x02, 0x03, 0x0C,
++    0x02, 0x15, 0x00, 0x02, 0x03, 0x0F, 0x02, 0x17, 0x00, 0x02, 0x03, 0x11, 0x1E, 0xEB, 0x00, 0x03,
++    0x03, 0x1B, 0x03, 0x00, 0x1E, 0xE9, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x01, 0x1E, 0xEF, 0x00, 0x03,
++    0x03, 0x1B, 0x03, 0x03, 0x1E, 0xED, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x09, 0x1E, 0xF1, 0x00, 0x03,
++    0x03, 0x1B, 0x03, 0x23, 0x1E, 0xEB, 0x00, 0x03, 0x03, 0x1B, 0x03, 0x40, 0x1E, 0xE9, 0x00, 0x03,
++    0x03, 0x1B, 0x03, 0x41, 0x01, 0xB0, 0x00, 0x02, 0x03, 0x1B, 0x1E, 0xF1, 0x00, 0x03, 0x03, 0x23,
++    0x03, 0x1B, 0x1E, 0xE5, 0x00, 0x02, 0x03, 0x23, 0x1E, 0x73, 0x00, 0x02, 0x03, 0x24, 0x01, 0x73,
++    0x00, 0x02, 0x03, 0x28, 0x1E, 0x77, 0x00, 0x02, 0x03, 0x2D, 0x1E, 0x75, 0x00, 0x02, 0x03, 0x30,
++    0x1E, 0xEB, 0x00, 0x03, 0x03, 0x40, 0x03, 0x1B, 0x00, 0xF9, 0x00, 0x02, 0x03, 0x40, 0x1E, 0xE9,
++    0x00, 0x03, 0x03, 0x41, 0x03, 0x1B, 0x00, 0xFA, 0x00, 0x02, 0x03, 0x41, 0x01, 0xD8, 0x00, 0x02,
++    0x03, 0x44, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x1E, 0x7D, 0x00, 0x02, 0x03, 0x03, 0x1E, 0x7F,
++    0x00, 0x02, 0x03, 0x23, 0x00, 0x09, 0x00, 0x14, 0x00, 0x1A, 0x00, 0x20, 0x00, 0x26, 0x00, 0x2C,
++    0x00, 0x32, 0x00, 0x38, 0x00, 0x3E, 0x00, 0x44, 0x1E, 0x81, 0x00, 0x02, 0x03, 0x00, 0x1E, 0x83,
++    0x00, 0x02, 0x03, 0x01, 0x01, 0x75, 0x00, 0x02, 0x03, 0x02, 0x1E, 0x87, 0x00, 0x02, 0x03, 0x07,
++    0x1E, 0x85, 0x00, 0x02, 0x03, 0x08, 0x1E, 0x98, 0x00, 0x02, 0x03, 0x0A, 0x1E, 0x89, 0x00, 0x02,
++    0x03, 0x23, 0x1E, 0x81, 0x00, 0x02, 0x03, 0x40, 0x1E, 0x83, 0x00, 0x02, 0x03, 0x41, 0x00, 0x02,
++    0x00, 0x06, 0x00, 0x0C, 0x1E, 0x8B, 0x00, 0x02, 0x03, 0x07, 0x1E, 0x8D, 0x00, 0x02, 0x03, 0x08,
++    0x00, 0x0C, 0x00, 0x1A, 0x00, 0x20, 0x00, 0x26, 0x00, 0x2C, 0x00, 0x32, 0x00, 0x38, 0x00, 0x3E,
++    0x00, 0x44, 0x00, 0x4A, 0x00, 0x50, 0x00, 0x56, 0x00, 0x5C, 0x1E, 0xF3, 0x00, 0x02, 0x03, 0x00,
++    0x00, 0xFD, 0x00, 0x02, 0x03, 0x01, 0x01, 0x77, 0x00, 0x02, 0x03, 0x02, 0x1E, 0xF9, 0x00, 0x02,
++    0x03, 0x03, 0x02, 0x33, 0x00, 0x02, 0x03, 0x04, 0x1E, 0x8F, 0x00, 0x02, 0x03, 0x07, 0x00, 0xFF,
++    0x00, 0x02, 0x03, 0x08, 0x1E, 0xF7, 0x00, 0x02, 0x03, 0x09, 0x1E, 0x99, 0x00, 0x02, 0x03, 0x0A,
++    0x1E, 0xF5, 0x00, 0x02, 0x03, 0x23, 0x1E, 0xF3, 0x00, 0x02, 0x03, 0x40, 0x00, 0xFD, 0x00, 0x02,
+     0x03, 0x41, 0x00, 0x07, 0x00, 0x10, 0x00, 0x16, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x28, 0x00, 0x2E,
+-    0x00, 0x34, 0x1E, 0xEB, 0x00, 0x02, 0x03, 0x00, 0x1E, 0xE9, 0x00, 0x02, 0x03, 0x01, 0x1E, 0xEF,
+-    0x00, 0x02, 0x03, 0x03, 0x1E, 0xED, 0x00, 0x02, 0x03, 0x09, 0x1E, 0xF1, 0x00, 0x02, 0x03, 0x23,
+-    0x1E, 0xEB, 0x00, 0x02, 0x03, 0x40, 0x1E, 0xE9, 0x00, 0x02, 0x03, 0x41, 0x00, 0x01, 0x00, 0x04,
+-    0x01, 0xEE, 0x00, 0x02, 0x03, 0x0C, 0x00, 0x01, 0x00, 0x04, 0x01, 0xEC, 0x00, 0x02, 0x03, 0x04,
+-    0x00, 0x01, 0x00, 0x04, 0x01, 0xED, 0x00, 0x02, 0x03, 0x04, 0x00, 0x01, 0x00, 0x04, 0x01, 0xE0,
+-    0x00, 0x02, 0x03, 0x04, 0x00, 0x01, 0x00, 0x04, 0x01, 0xE1, 0x00, 0x02, 0x03, 0x04, 0x00, 0x01,
+-    0x00, 0x04, 0x1E, 0x1C, 0x00, 0x02, 0x03, 0x06, 0x00, 0x01, 0x00, 0x04, 0x1E, 0x1D, 0x00, 0x02,
+-    0x03, 0x06, 0x00, 0x01, 0x00, 0x04, 0x02, 0x30, 0x00, 0x02, 0x03, 0x04, 0x00, 0x01, 0x00, 0x04,
+-    0x02, 0x31, 0x00, 0x02, 0x03, 0x04, 0x00, 0x01, 0x00, 0x04, 0x01, 0xEF, 0x00, 0x02, 0x03, 0x0C,
+-    0x00, 0x01, 0x00, 0x04, 0x1E, 0x38, 0x00, 0x02, 0x03, 0x04, 0x00, 0x01, 0x00, 0x04, 0x1E, 0x39,
+-    0x00, 0x02, 0x03, 0x04, 0x00, 0x01, 0x00, 0x04, 0x1E, 0x5C, 0x00, 0x02, 0x03, 0x04, 0x00, 0x01,
+-    0x00, 0x04, 0x1E, 0x5D, 0x00, 0x02, 0x03, 0x04, 0x00, 0x01, 0x00, 0x04, 0x1E, 0x68, 0x00, 0x02,
+-    0x03, 0x23, 0x00, 0x01, 0x00, 0x04, 0x1E, 0x69, 0x00, 0x02, 0x03, 0x23, 0x00, 0x01, 0x00, 0x04,
+-    0x1E, 0x68, 0x00, 0x02, 0x03, 0x07, 0x00, 0x01, 0x00, 0x04, 0x1E, 0x69, 0x00, 0x02, 0x03, 0x07,
+-    0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x1E, 0xAC, 0x00, 0x02, 0x03, 0x02, 0x1E, 0xB6, 0x00, 0x02,
+-    0x03, 0x06, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x1E, 0xAD, 0x00, 0x02, 0x03, 0x02, 0x1E, 0xB7,
+-    0x00, 0x02, 0x03, 0x06, 0x00, 0x01, 0x00, 0x04, 0x1E, 0xC6, 0x00, 0x02, 0x03, 0x02, 0x00, 0x01,
+-    0x00, 0x04, 0x1E, 0xC7, 0x00, 0x02, 0x03, 0x02, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x1E, 0xD8,
+-    0x00, 0x02, 0x03, 0x02, 0x1E, 0xE2, 0x00, 0x02, 0x03, 0x1B, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C,
+-    0x1E, 0xD9, 0x00, 0x02, 0x03, 0x02, 0x1E, 0xE3, 0x00, 0x02, 0x03, 0x1B, 0x00, 0x01, 0x00, 0x04,
+-    0x1E, 0xDE, 0x00, 0x02, 0x03, 0x1B, 0x00, 0x01, 0x00, 0x04, 0x1E, 0xDF, 0x00, 0x02, 0x03, 0x1B,
+-    0x00, 0x01, 0x00, 0x04, 0x1E, 0xF0, 0x00, 0x02, 0x03, 0x1B, 0x00, 0x01, 0x00, 0x04, 0x1E, 0xF1,
+-    0x00, 0x02, 0x03, 0x1B, 0x00, 0x01, 0x00, 0x04, 0x1E, 0xEC, 0x00, 0x02, 0x03, 0x1B, 0x00, 0x01,
+-    0x00, 0x04, 0x1E, 0xED, 0x00, 0x02, 0x03, 0x1B, 0x00, 0x06, 0x00, 0x0E, 0x00, 0x14, 0x00, 0x1A,
+-    0x00, 0x20, 0x00, 0x26, 0x00, 0x2C, 0x1E, 0x30, 0x00, 0x02, 0x03, 0x01, 0x01, 0xE8, 0x00, 0x02,
+-    0x03, 0x0C, 0x1E, 0x32, 0x00, 0x02, 0x03, 0x23, 0x01, 0x36, 0x00, 0x02, 0x03, 0x27, 0x1E, 0x34,
+-    0x00, 0x02, 0x03, 0x31, 0x1E, 0x30, 0x00, 0x02, 0x03, 0x41, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C,
+-    0x01, 0xFA, 0x00, 0x02, 0x03, 0x01, 0x01, 0xFA, 0x00, 0x02, 0x03, 0x41, 0x00, 0x01, 0x00, 0x89,
+-    0x00, 0x41, 0x00, 0x42, 0x00, 0x43, 0x00, 0x44, 0x00, 0x45, 0x00, 0x46, 0x00, 0x47, 0x00, 0x48,
+-    0x00, 0x49, 0x00, 0x4A, 0x00, 0x4B, 0x00, 0x4C, 0x00, 0x4D, 0x00, 0x4E, 0x00, 0x4F, 0x00, 0x50,
+-    0x00, 0x52, 0x00, 0x53, 0x00, 0x54, 0x00, 0x55, 0x00, 0x56, 0x00, 0x57, 0x00, 0x58, 0x00, 0x59,
+-    0x00, 0x5A, 0x00, 0x61, 0x00, 0x62, 0x00, 0x63, 0x00, 0x64, 0x00, 0x65, 0x00, 0x66, 0x00, 0x67,
+-    0x00, 0x68, 0x00, 0x69, 0x00, 0x6A, 0x00, 0x6B, 0x00, 0x6C, 0x00, 0x6D, 0x00, 0x6E, 0x00, 0x6F,
+-    0x00, 0x70, 0x00, 0x72, 0x00, 0x73, 0x00, 0x74, 0x00, 0x75, 0x00, 0x76, 0x00, 0x77, 0x00, 0x78,
+-    0x00, 0x79, 0x00, 0x7A, 0x00, 0xC2, 0x00, 0xC4, 0x00, 0xC5, 0x00, 0xC6, 0x00, 0xC7, 0x00, 0xCA,
+-    0x00, 0xCF, 0x00, 0xD2, 0x00, 0xD3, 0x00, 0xD4, 0x00, 0xD5, 0x00, 0xD6, 0x00, 0xD8, 0x00, 0xD9,
+-    0x00, 0xDA, 0x00, 0xDC, 0x00, 0xE2, 0x00, 0xE4, 0x00, 0xE5, 0x00, 0xE6, 0x00, 0xE7, 0x00, 0xEA,
+-    0x00, 0xEF, 0x00, 0xF2, 0x00, 0xF3, 0x00, 0xF4, 0x00, 0xF5, 0x00, 0xF6, 0x00, 0xF8, 0x00, 0xF9,
+-    0x00, 0xFA, 0x00, 0xFC, 0x01, 0x02, 0x01, 0x03, 0x01, 0x06, 0x01, 0x07, 0x01, 0x12, 0x01, 0x13,
+-    0x01, 0x14, 0x01, 0x15, 0x01, 0x4C, 0x01, 0x4D, 0x01, 0x5A, 0x01, 0x5B, 0x01, 0x60, 0x01, 0x61,
+-    0x01, 0x68, 0x01, 0x69, 0x01, 0x6A, 0x01, 0x6B, 0x01, 0x7F, 0x01, 0xA0, 0x01, 0xA1, 0x01, 0xAF,
+-    0x01, 0xB0, 0x01, 0xB7, 0x01, 0xEA, 0x01, 0xEB, 0x02, 0x26, 0x02, 0x27, 0x02, 0x28, 0x02, 0x29,
+-    0x02, 0x2E, 0x02, 0x2F, 0x02, 0x92, 0x1E, 0x36, 0x1E, 0x37, 0x1E, 0x5A, 0x1E, 0x5B, 0x1E, 0x60,
+-    0x1E, 0x61, 0x1E, 0x62, 0x1E, 0x63, 0x1E, 0xA0, 0x1E, 0xA1, 0x1E, 0xB8, 0x1E, 0xB9, 0x1E, 0xCC,
+-    0x1E, 0xCD, 0x1E, 0xCE, 0x1E, 0xCF, 0x1E, 0xE4, 0x1E, 0xE5, 0x1E, 0xE6, 0x1E, 0xE7, 0x21, 0x2A,
+-    0x21, 0x2B, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x14, 0x13, 0x92, 0x1A, 0xA8, 0x1E, 0x46,
+-    0x21, 0xB8, 0x22, 0x76, 0x23, 0x04, 0x00, 0x01, 0x0F, 0x96, 0x01, 0xF2, 0x03, 0xEA, 0x03, 0xF0,
+-    0x03, 0xF6, 0x03, 0xFC, 0x04, 0x02, 0x04, 0x08, 0x04, 0x0E, 0x04, 0x14, 0x04, 0x1A, 0x04, 0x20,
+-    0x04, 0x26, 0x04, 0x2C, 0x04, 0x32, 0x04, 0x38, 0x04, 0x3E, 0x04, 0x44, 0x04, 0x4A, 0x04, 0x50,
+-    0x04, 0x56, 0x04, 0x5C, 0x04, 0x62, 0x04, 0x68, 0x04, 0x6E, 0x04, 0x74, 0x04, 0x7A, 0x04, 0x80,
+-    0x04, 0x86, 0x04, 0x8C, 0x04, 0x92, 0x04, 0x98, 0x04, 0x9E, 0x04, 0xA4, 0x04, 0xAA, 0x04, 0xB0,
+-    0x04, 0xB6, 0x04, 0xBC, 0x04, 0xC2, 0x04, 0xC8, 0x04, 0xCE, 0x04, 0xD4, 0x04, 0xDA, 0x04, 0xE0,
+-    0x04, 0xE6, 0x04, 0xEC, 0x04, 0xF2, 0x04, 0xF8, 0x04, 0xFE, 0x05, 0x04, 0x05, 0x0A, 0x05, 0x10,
+-    0x05, 0x16, 0x05, 0x1C, 0x05, 0x22, 0x05, 0x28, 0x05, 0x2E, 0x05, 0x34, 0x05, 0x3A, 0x05, 0x40,
+-    0x05, 0x46, 0x05, 0x4C, 0x05, 0x52, 0x05, 0x58, 0x05, 0x5E, 0x05, 0x64, 0x05, 0x6A, 0x05, 0x70,
+-    0x05, 0x76, 0x05, 0x7C, 0x05, 0x82, 0x05, 0x88, 0x05, 0x8E, 0x05, 0x94, 0x05, 0x9A, 0x05, 0xA0,
+-    0x05, 0xA6, 0x05, 0xAC, 0x05, 0xB2, 0x05, 0xB8, 0x05, 0xBE, 0x05, 0xC4, 0x05, 0xCA, 0x05, 0xD0,
+-    0x05, 0xD6, 0x05, 0xDC, 0x05, 0xE2, 0x05, 0xE8, 0x05, 0xEE, 0x05, 0xF4, 0x05, 0xFA, 0x06, 0x00,
+-    0x06, 0x06, 0x06, 0x0C, 0x06, 0x12, 0x06, 0x18, 0x06, 0x1E, 0x06, 0x24, 0x06, 0x2A, 0x06, 0x30,
+-    0x06, 0x36, 0x06, 0x3C, 0x06, 0x42, 0x06, 0x48, 0x06, 0x4E, 0x06, 0x54, 0x06, 0x5A, 0x06, 0x60,
+-    0x06, 0x66, 0x06, 0x6C, 0x06, 0x72, 0x06, 0x78, 0x06, 0x7E, 0x06, 0x84, 0x06, 0x8A, 0x06, 0x90,
+-    0x06, 0x96, 0x06, 0x9C, 0x06, 0xA2, 0x06, 0xA8, 0x06, 0xAE, 0x06, 0xB4, 0x06, 0xBA, 0x06, 0xC0,
+-    0x06, 0xC6, 0x06, 0xCC, 0x06, 0xD2, 0x06, 0xD8, 0x06, 0xDE, 0x06, 0xE4, 0x06, 0xEA, 0x06, 0xF0,
+-    0x06, 0xF6, 0x06, 0xFC, 0x07, 0x02, 0x07, 0x08, 0x07, 0x0E, 0x07, 0x14, 0x07, 0x1A, 0x07, 0x20,
+-    0x07, 0x26, 0x07, 0x2C, 0x07, 0x32, 0x07, 0x38, 0x07, 0x3E, 0x07, 0x44, 0x07, 0x4A, 0x07, 0x50,
+-    0x07, 0x56, 0x07, 0x5C, 0x07, 0x62, 0x07, 0x68, 0x07, 0x6E, 0x07, 0x74, 0x07, 0x7A, 0x07, 0x80,
+-    0x07, 0x86, 0x07, 0x8C, 0x07, 0x92, 0x07, 0x98, 0x07, 0x9E, 0x07, 0xA4, 0x07, 0xAA, 0x07, 0xB0,
+-    0x07, 0xB6, 0x07, 0xBC, 0x07, 0xC2, 0x07, 0xC8, 0x07, 0xCE, 0x07, 0xD4, 0x07, 0xDA, 0x07, 0xE0,
+-    0x07, 0xE6, 0x07, 0xEC, 0x07, 0xF2, 0x07, 0xF8, 0x07, 0xFE, 0x08, 0x04, 0x08, 0x0A, 0x08, 0x10,
+-    0x08, 0x16, 0x08, 0x1C, 0x08, 0x22, 0x08, 0x28, 0x08, 0x2E, 0x08, 0x34, 0x08, 0x3A, 0x08, 0x40,
+-    0x08, 0x46, 0x08, 0x4C, 0x08, 0x52, 0x08, 0x58, 0x08, 0x5E, 0x08, 0x64, 0x08, 0x6A, 0x08, 0x70,
+-    0x08, 0x76, 0x08, 0x7C, 0x08, 0x82, 0x08, 0x88, 0x08, 0x8E, 0x08, 0x94, 0x08, 0x9A, 0x08, 0xA0,
+-    0x08, 0xA6, 0x08, 0xAC, 0x08, 0xB2, 0x08, 0xB8, 0x08, 0xBE, 0x08, 0xC4, 0x08, 0xCA, 0x08, 0xD0,
+-    0x08, 0xD6, 0x08, 0xDC, 0x08, 0xE2, 0x08, 0xE8, 0x08, 0xEE, 0x08, 0xF4, 0x08, 0xFA, 0x09, 0x00,
+-    0x09, 0x06, 0x09, 0x0C, 0x09, 0x12, 0x09, 0x18, 0x09, 0x1E, 0x09, 0x24, 0x09, 0x2A, 0x09, 0x30,
+-    0x09, 0x36, 0x09, 0x3C, 0x09, 0x42, 0x09, 0x48, 0x09, 0x4E, 0x09, 0x54, 0x09, 0x5A, 0x09, 0x60,
+-    0x09, 0x66, 0x09, 0x6C, 0x09, 0x72, 0x09, 0x78, 0x09, 0x7E, 0x09, 0x84, 0x09, 0x8A, 0x09, 0x90,
+-    0x09, 0x96, 0x09, 0x9C, 0x09, 0xA2, 0x09, 0xA8, 0x09, 0xAE, 0x09, 0xB4, 0x09, 0xBA, 0x09, 0xC0,
+-    0x09, 0xC6, 0x09, 0xCC, 0x09, 0xD2, 0x09, 0xD8, 0x09, 0xDE, 0x09, 0xE4, 0x09, 0xEA, 0x09, 0xF0,
+-    0x09, 0xF6, 0x09, 0xFC, 0x0A, 0x02, 0x0A, 0x08, 0x0A, 0x0E, 0x0A, 0x14, 0x0A, 0x1A, 0x0A, 0x20,
+-    0x0A, 0x26, 0x0A, 0x2C, 0x0A, 0x32, 0x0A, 0x38, 0x0A, 0x3E, 0x0A, 0x44, 0x0A, 0x4A, 0x0A, 0x50,
+-    0x0A, 0x56, 0x0A, 0x5C, 0x0A, 0x62, 0x0A, 0x68, 0x0A, 0x6E, 0x0A, 0x74, 0x0A, 0x7A, 0x0A, 0x80,
+-    0x0A, 0x86, 0x0A, 0x8C, 0x0A, 0x92, 0x0A, 0x98, 0x0A, 0x9E, 0x0A, 0xA4, 0x0A, 0xAA, 0x0A, 0xB0,
+-    0x0A, 0xB6, 0x0A, 0xBC, 0x0A, 0xC2, 0x0A, 0xC8, 0x0A, 0xCE, 0x0A, 0xD4, 0x0A, 0xDA, 0x0A, 0xE0,
+-    0x0A, 0xE6, 0x0A, 0xEC, 0x0A, 0xF2, 0x0A, 0xF8, 0x0A, 0xFE, 0x0B, 0x04, 0x0B, 0x0A, 0x0B, 0x10,
+-    0x0B, 0x16, 0x0B, 0x1C, 0x0B, 0x22, 0x0B, 0x28, 0x0B, 0x2E, 0x0B, 0x34, 0x0B, 0x3A, 0x0B, 0x40,
+-    0x0B, 0x46, 0x0B, 0x4C, 0x0B, 0x52, 0x0B, 0x58, 0x0B, 0x5E, 0x0B, 0x64, 0x0B, 0x6A, 0x0B, 0x70,
+-    0x0B, 0x76, 0x0B, 0x7C, 0x0B, 0x82, 0x0B, 0x88, 0x0B, 0x8E, 0x0B, 0x94, 0x0B, 0x9A, 0x0B, 0xA0,
+-    0x0B, 0xA6, 0x0B, 0xAC, 0x0B, 0xB2, 0x0B, 0xB8, 0x0B, 0xBE, 0x0B, 0xC4, 0x0B, 0xCA, 0x0B, 0xD0,
+-    0x0B, 0xD6, 0x0B, 0xDC, 0x0B, 0xE2, 0x0B, 0xE8, 0x0B, 0xEE, 0x0B, 0xF4, 0x0B, 0xFA, 0x0C, 0x00,
+-    0x0C, 0x06, 0x0C, 0x0C, 0x0C, 0x12, 0x0C, 0x18, 0x0C, 0x1E, 0x0C, 0x24, 0x0C, 0x2A, 0x0C, 0x30,
+-    0x0C, 0x36, 0x0C, 0x3C, 0x0C, 0x42, 0x0C, 0x48, 0x0C, 0x4E, 0x0C, 0x54, 0x0C, 0x5A, 0x0C, 0x60,
+-    0x0C, 0x66, 0x0C, 0x6C, 0x0C, 0x72, 0x0C, 0x78, 0x0C, 0x7E, 0x0C, 0x84, 0x0C, 0x8A, 0x0C, 0x90,
+-    0x0C, 0x96, 0x0C, 0x9C, 0x0C, 0xA2, 0x0C, 0xA8, 0x0C, 0xAE, 0x0C, 0xB4, 0x0C, 0xBA, 0x0C, 0xC0,
+-    0x0C, 0xC6, 0x0C, 0xCC, 0x0C, 0xD2, 0x0C, 0xD8, 0x0C, 0xDE, 0x0C, 0xE4, 0x0C, 0xEA, 0x0C, 0xF0,
+-    0x0C, 0xF6, 0x0C, 0xFC, 0x0D, 0x02, 0x0D, 0x08, 0x0D, 0x0E, 0x0D, 0x14, 0x0D, 0x1A, 0x0D, 0x20,
+-    0x0D, 0x26, 0x0D, 0x2C, 0x0D, 0x32, 0x0D, 0x38, 0x0D, 0x3E, 0x0D, 0x44, 0x0D, 0x4A, 0x0D, 0x50,
+-    0x0D, 0x56, 0x0D, 0x5C, 0x0D, 0x62, 0x0D, 0x68, 0x0D, 0x6E, 0x0D, 0x74, 0x0D, 0x7A, 0x0D, 0x80,
+-    0x0D, 0x86, 0x0D, 0x8C, 0x0D, 0x92, 0x0D, 0x98, 0x0D, 0x9E, 0x0D, 0xA4, 0x0D, 0xAA, 0x0D, 0xB0,
+-    0x0D, 0xB6, 0x0D, 0xBC, 0x0D, 0xC2, 0x0D, 0xC8, 0x0D, 0xCE, 0x0D, 0xD4, 0x0D, 0xDA, 0x0D, 0xE0,
+-    0x0D, 0xE6, 0x0D, 0xEC, 0x0D, 0xF2, 0x0D, 0xF8, 0x0D, 0xFE, 0x0E, 0x04, 0x0E, 0x0A, 0x0E, 0x10,
+-    0x0E, 0x16, 0x0E, 0x1C, 0x0E, 0x22, 0x0E, 0x28, 0x0E, 0x2E, 0x0E, 0x34, 0x0E, 0x3A, 0x0E, 0x40,
+-    0x0E, 0x46, 0x0E, 0x4C, 0x0E, 0x52, 0x0E, 0x58, 0x0E, 0x5E, 0x0E, 0x64, 0x0E, 0x6A, 0x0E, 0x70,
+-    0x0E, 0x76, 0x0E, 0x7C, 0x0E, 0x82, 0x0E, 0x88, 0x0E, 0x8E, 0x0E, 0x94, 0x0E, 0x9A, 0x0E, 0xA0,
+-    0x0E, 0xA6, 0x0E, 0xAC, 0x0E, 0xB2, 0x0E, 0xB8, 0x0E, 0xBE, 0x0E, 0xC4, 0x0E, 0xCA, 0x0E, 0xD0,
+-    0x0E, 0xD6, 0x0E, 0xDC, 0x0E, 0xE2, 0x0E, 0xE8, 0x0E, 0xEE, 0x0E, 0xF4, 0x0E, 0xFA, 0x0F, 0x00,
+-    0x0F, 0x06, 0x0F, 0x0C, 0x0F, 0x12, 0x0F, 0x18, 0x0F, 0x1E, 0x0F, 0x24, 0x0F, 0x2A, 0x0F, 0x30,
+-    0x0F, 0x36, 0x0F, 0x3C, 0x0F, 0x42, 0x0F, 0x48, 0x0F, 0x4E, 0x0F, 0x54, 0x0F, 0x5A, 0x0F, 0x60,
+-    0x0F, 0x66, 0x0F, 0x6C, 0x0F, 0x72, 0x0F, 0x78, 0x0F, 0x7E, 0x0F, 0x84, 0x0F, 0x8A, 0x0F, 0x90,
+-    0x00, 0x02, 0x00, 0x41, 0x03, 0x00, 0x00, 0x02, 0x00, 0x41, 0x03, 0x01, 0x00, 0x02, 0x00, 0x41,
+-    0x03, 0x02, 0x00, 0x02, 0x00, 0x41, 0x03, 0x03, 0x00, 0x02, 0x00, 0x41, 0x03, 0x08, 0x00, 0x02,
+-    0x00, 0x41, 0x03, 0x0A, 0x00, 0x02, 0x00, 0x43, 0x03, 0x27, 0x00, 0x02, 0x00, 0x45, 0x03, 0x00,
+-    0x00, 0x02, 0x00, 0x45, 0x03, 0x01, 0x00, 0x02, 0x00, 0x45, 0x03, 0x02, 0x00, 0x02, 0x00, 0x45,
+-    0x03, 0x08, 0x00, 0x02, 0x00, 0x49, 0x03, 0x00, 0x00, 0x02, 0x00, 0x49, 0x03, 0x01, 0x00, 0x02,
+-    0x00, 0x49, 0x03, 0x02, 0x00, 0x02, 0x00, 0x49, 0x03, 0x08, 0x00, 0x02, 0x00, 0x4E, 0x03, 0x03,
+-    0x00, 0x02, 0x00, 0x4F, 0x03, 0x00, 0x00, 0x02, 0x00, 0x4F, 0x03, 0x01, 0x00, 0x02, 0x00, 0x4F,
+-    0x03, 0x02, 0x00, 0x02, 0x00, 0x4F, 0x03, 0x03, 0x00, 0x02, 0x00, 0x4F, 0x03, 0x08, 0x00, 0x02,
+-    0x00, 0x55, 0x03, 0x00, 0x00, 0x02, 0x00, 0x55, 0x03, 0x01, 0x00, 0x02, 0x00, 0x55, 0x03, 0x02,
+-    0x00, 0x02, 0x00, 0x55, 0x03, 0x08, 0x00, 0x02, 0x00, 0x59, 0x03, 0x01, 0x00, 0x02, 0x00, 0x61,
+-    0x03, 0x00, 0x00, 0x02, 0x00, 0x61, 0x03, 0x01, 0x00, 0x02, 0x00, 0x61, 0x03, 0x02, 0x00, 0x02,
+-    0x00, 0x61, 0x03, 0x03, 0x00, 0x02, 0x00, 0x61, 0x03, 0x08, 0x00, 0x02, 0x00, 0x61, 0x03, 0x0A,
+-    0x00, 0x02, 0x00, 0x63, 0x03, 0x27, 0x00, 0x02, 0x00, 0x65, 0x03, 0x00, 0x00, 0x02, 0x00, 0x65,
+-    0x03, 0x01, 0x00, 0x02, 0x00, 0x65, 0x03, 0x02, 0x00, 0x02, 0x00, 0x65, 0x03, 0x08, 0x00, 0x02,
+-    0x00, 0x69, 0x03, 0x00, 0x00, 0x02, 0x00, 0x69, 0x03, 0x01, 0x00, 0x02, 0x00, 0x69, 0x03, 0x02,
+-    0x00, 0x02, 0x00, 0x69, 0x03, 0x08, 0x00, 0x02, 0x00, 0x6E, 0x03, 0x03, 0x00, 0x02, 0x00, 0x6F,
+-    0x03, 0x00, 0x00, 0x02, 0x00, 0x6F, 0x03, 0x01, 0x00, 0x02, 0x00, 0x6F, 0x03, 0x02, 0x00, 0x02,
+-    0x00, 0x6F, 0x03, 0x03, 0x00, 0x02, 0x00, 0x6F, 0x03, 0x08, 0x00, 0x02, 0x00, 0x75, 0x03, 0x00,
+-    0x00, 0x02, 0x00, 0x75, 0x03, 0x01, 0x00, 0x02, 0x00, 0x75, 0x03, 0x02, 0x00, 0x02, 0x00, 0x75,
+-    0x03, 0x08, 0x00, 0x02, 0x00, 0x79, 0x03, 0x01, 0x00, 0x02, 0x00, 0x79, 0x03, 0x08, 0x00, 0x02,
+-    0x00, 0x41, 0x03, 0x04, 0x00, 0x02, 0x00, 0x61, 0x03, 0x04, 0x00, 0x02, 0x00, 0x41, 0x03, 0x06,
+-    0x00, 0x02, 0x00, 0x61, 0x03, 0x06, 0x00, 0x02, 0x00, 0x41, 0x03, 0x28, 0x00, 0x02, 0x00, 0x61,
+-    0x03, 0x28, 0x00, 0x02, 0x00, 0x43, 0x03, 0x01, 0x00, 0x02, 0x00, 0x63, 0x03, 0x01, 0x00, 0x02,
+-    0x00, 0x43, 0x03, 0x02, 0x00, 0x02, 0x00, 0x63, 0x03, 0x02, 0x00, 0x02, 0x00, 0x43, 0x03, 0x07,
+-    0x00, 0x02, 0x00, 0x63, 0x03, 0x07, 0x00, 0x02, 0x00, 0x43, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x63,
+-    0x03, 0x0C, 0x00, 0x02, 0x00, 0x44, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x64, 0x03, 0x0C, 0x00, 0x02,
+-    0x00, 0x45, 0x03, 0x04, 0x00, 0x02, 0x00, 0x65, 0x03, 0x04, 0x00, 0x02, 0x00, 0x45, 0x03, 0x06,
+-    0x00, 0x02, 0x00, 0x65, 0x03, 0x06, 0x00, 0x02, 0x00, 0x45, 0x03, 0x07, 0x00, 0x02, 0x00, 0x65,
+-    0x03, 0x07, 0x00, 0x02, 0x00, 0x45, 0x03, 0x28, 0x00, 0x02, 0x00, 0x65, 0x03, 0x28, 0x00, 0x02,
+-    0x00, 0x45, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x65, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x47, 0x03, 0x02,
+-    0x00, 0x02, 0x00, 0x67, 0x03, 0x02, 0x00, 0x02, 0x00, 0x47, 0x03, 0x06, 0x00, 0x02, 0x00, 0x67,
+-    0x03, 0x06, 0x00, 0x02, 0x00, 0x47, 0x03, 0x07, 0x00, 0x02, 0x00, 0x67, 0x03, 0x07, 0x00, 0x02,
+-    0x00, 0x47, 0x03, 0x27, 0x00, 0x02, 0x00, 0x67, 0x03, 0x27, 0x00, 0x02, 0x00, 0x48, 0x03, 0x02,
+-    0x00, 0x02, 0x00, 0x68, 0x03, 0x02, 0x00, 0x02, 0x00, 0x49, 0x03, 0x03, 0x00, 0x02, 0x00, 0x69,
+-    0x03, 0x03, 0x00, 0x02, 0x00, 0x49, 0x03, 0x04, 0x00, 0x02, 0x00, 0x69, 0x03, 0x04, 0x00, 0x02,
+-    0x00, 0x49, 0x03, 0x06, 0x00, 0x02, 0x00, 0x69, 0x03, 0x06, 0x00, 0x02, 0x00, 0x49, 0x03, 0x28,
+-    0x00, 0x02, 0x00, 0x69, 0x03, 0x28, 0x00, 0x02, 0x00, 0x49, 0x03, 0x07, 0x00, 0x02, 0x00, 0x4A,
+-    0x03, 0x02, 0x00, 0x02, 0x00, 0x6A, 0x03, 0x02, 0x00, 0x02, 0x00, 0x4B, 0x03, 0x27, 0x00, 0x02,
+-    0x00, 0x6B, 0x03, 0x27, 0x00, 0x02, 0x00, 0x4C, 0x03, 0x01, 0x00, 0x02, 0x00, 0x6C, 0x03, 0x01,
+-    0x00, 0x02, 0x00, 0x4C, 0x03, 0x27, 0x00, 0x02, 0x00, 0x6C, 0x03, 0x27, 0x00, 0x02, 0x00, 0x4C,
+-    0x03, 0x0C, 0x00, 0x02, 0x00, 0x6C, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x4E, 0x03, 0x01, 0x00, 0x02,
+-    0x00, 0x6E, 0x03, 0x01, 0x00, 0x02, 0x00, 0x4E, 0x03, 0x27, 0x00, 0x02, 0x00, 0x6E, 0x03, 0x27,
+-    0x00, 0x02, 0x00, 0x4E, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x6E, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x4F,
+-    0x03, 0x04, 0x00, 0x02, 0x00, 0x6F, 0x03, 0x04, 0x00, 0x02, 0x00, 0x4F, 0x03, 0x06, 0x00, 0x02,
+-    0x00, 0x6F, 0x03, 0x06, 0x00, 0x02, 0x00, 0x4F, 0x03, 0x0B, 0x00, 0x02, 0x00, 0x6F, 0x03, 0x0B,
+-    0x00, 0x02, 0x00, 0x52, 0x03, 0x01, 0x00, 0x02, 0x00, 0x72, 0x03, 0x01, 0x00, 0x02, 0x00, 0x52,
+-    0x03, 0x27, 0x00, 0x02, 0x00, 0x72, 0x03, 0x27, 0x00, 0x02, 0x00, 0x52, 0x03, 0x0C, 0x00, 0x02,
+-    0x00, 0x72, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x53, 0x03, 0x01, 0x00, 0x02, 0x00, 0x73, 0x03, 0x01,
+-    0x00, 0x02, 0x00, 0x53, 0x03, 0x02, 0x00, 0x02, 0x00, 0x73, 0x03, 0x02, 0x00, 0x02, 0x00, 0x53,
+-    0x03, 0x27, 0x00, 0x02, 0x00, 0x73, 0x03, 0x27, 0x00, 0x02, 0x00, 0x53, 0x03, 0x0C, 0x00, 0x02,
+-    0x00, 0x73, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x54, 0x03, 0x27, 0x00, 0x02, 0x00, 0x74, 0x03, 0x27,
+-    0x00, 0x02, 0x00, 0x54, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x74, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x55,
+-    0x03, 0x03, 0x00, 0x02, 0x00, 0x75, 0x03, 0x03, 0x00, 0x02, 0x00, 0x55, 0x03, 0x04, 0x00, 0x02,
+-    0x00, 0x75, 0x03, 0x04, 0x00, 0x02, 0x00, 0x55, 0x03, 0x06, 0x00, 0x02, 0x00, 0x75, 0x03, 0x06,
+-    0x00, 0x02, 0x00, 0x55, 0x03, 0x0A, 0x00, 0x02, 0x00, 0x75, 0x03, 0x0A, 0x00, 0x02, 0x00, 0x55,
+-    0x03, 0x0B, 0x00, 0x02, 0x00, 0x75, 0x03, 0x0B, 0x00, 0x02, 0x00, 0x55, 0x03, 0x28, 0x00, 0x02,
+-    0x00, 0x75, 0x03, 0x28, 0x00, 0x02, 0x00, 0x57, 0x03, 0x02, 0x00, 0x02, 0x00, 0x77, 0x03, 0x02,
+-    0x00, 0x02, 0x00, 0x59, 0x03, 0x02, 0x00, 0x02, 0x00, 0x79, 0x03, 0x02, 0x00, 0x02, 0x00, 0x59,
+-    0x03, 0x08, 0x00, 0x02, 0x00, 0x5A, 0x03, 0x01, 0x00, 0x02, 0x00, 0x7A, 0x03, 0x01, 0x00, 0x02,
+-    0x00, 0x5A, 0x03, 0x07, 0x00, 0x02, 0x00, 0x7A, 0x03, 0x07, 0x00, 0x02, 0x00, 0x5A, 0x03, 0x0C,
+-    0x00, 0x02, 0x00, 0x7A, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x4F, 0x03, 0x1B, 0x00, 0x02, 0x00, 0x6F,
+-    0x03, 0x1B, 0x00, 0x02, 0x00, 0x55, 0x03, 0x1B, 0x00, 0x02, 0x00, 0x75, 0x03, 0x1B, 0x00, 0x02,
+-    0x00, 0x41, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x61, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x49, 0x03, 0x0C,
+-    0x00, 0x02, 0x00, 0x69, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x4F, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x6F,
+-    0x03, 0x0C, 0x00, 0x02, 0x00, 0x55, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x75, 0x03, 0x0C, 0x00, 0x02,
+-    0x00, 0xDC, 0x03, 0x04, 0x00, 0x02, 0x00, 0xFC, 0x03, 0x04, 0x00, 0x02, 0x00, 0x55, 0x03, 0x44,
+-    0x00, 0x02, 0x00, 0x75, 0x03, 0x44, 0x00, 0x02, 0x00, 0xDC, 0x03, 0x0C, 0x00, 0x02, 0x00, 0xFC,
+-    0x03, 0x0C, 0x00, 0x02, 0x00, 0xDC, 0x03, 0x00, 0x00, 0x02, 0x00, 0xFC, 0x03, 0x00, 0x00, 0x02,
+-    0x00, 0xC4, 0x03, 0x04, 0x00, 0x02, 0x00, 0xE4, 0x03, 0x04, 0x00, 0x02, 0x02, 0x26, 0x03, 0x04,
+-    0x00, 0x02, 0x02, 0x27, 0x03, 0x04, 0x00, 0x02, 0x00, 0xC6, 0x03, 0x04, 0x00, 0x02, 0x00, 0xE6,
+-    0x03, 0x04, 0x00, 0x02, 0x00, 0x47, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x67, 0x03, 0x0C, 0x00, 0x02,
+-    0x00, 0x4B, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x6B, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x4F, 0x03, 0x28,
+-    0x00, 0x02, 0x00, 0x6F, 0x03, 0x28, 0x00, 0x02, 0x01, 0x4C, 0x03, 0x28, 0x00, 0x02, 0x01, 0x4D,
+-    0x03, 0x28, 0x00, 0x02, 0x01, 0xB7, 0x03, 0x0C, 0x00, 0x02, 0x02, 0x92, 0x03, 0x0C, 0x00, 0x02,
+-    0x00, 0x6A, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x47, 0x03, 0x01, 0x00, 0x02, 0x00, 0x67, 0x03, 0x01,
+-    0x00, 0x02, 0x00, 0x4E, 0x03, 0x00, 0x00, 0x02, 0x00, 0x6E, 0x03, 0x00, 0x00, 0x02, 0x00, 0xC5,
+-    0x03, 0x01, 0x00, 0x02, 0x00, 0xE5, 0x03, 0x01, 0x00, 0x02, 0x00, 0xC6, 0x03, 0x01, 0x00, 0x02,
+-    0x00, 0xE6, 0x03, 0x01, 0x00, 0x02, 0x00, 0xD8, 0x03, 0x01, 0x00, 0x02, 0x00, 0xF8, 0x03, 0x01,
+-    0x00, 0x02, 0x00, 0x41, 0x03, 0x0F, 0x00, 0x02, 0x00, 0x61, 0x03, 0x0F, 0x00, 0x02, 0x00, 0x41,
+-    0x03, 0x11, 0x00, 0x02, 0x00, 0x61, 0x03, 0x11, 0x00, 0x02, 0x00, 0x45, 0x03, 0x0F, 0x00, 0x02,
+-    0x00, 0x65, 0x03, 0x0F, 0x00, 0x02, 0x00, 0x45, 0x03, 0x11, 0x00, 0x02, 0x00, 0x65, 0x03, 0x11,
+-    0x00, 0x02, 0x00, 0x49, 0x03, 0x0F, 0x00, 0x02, 0x00, 0x69, 0x03, 0x0F, 0x00, 0x02, 0x00, 0x49,
+-    0x03, 0x11, 0x00, 0x02, 0x00, 0x69, 0x03, 0x11, 0x00, 0x02, 0x00, 0x4F, 0x03, 0x0F, 0x00, 0x02,
+-    0x00, 0x6F, 0x03, 0x0F, 0x00, 0x02, 0x00, 0x4F, 0x03, 0x11, 0x00, 0x02, 0x00, 0x6F, 0x03, 0x11,
+-    0x00, 0x02, 0x00, 0x52, 0x03, 0x0F, 0x00, 0x02, 0x00, 0x72, 0x03, 0x0F, 0x00, 0x02, 0x00, 0x52,
+-    0x03, 0x11, 0x00, 0x02, 0x00, 0x72, 0x03, 0x11, 0x00, 0x02, 0x00, 0x55, 0x03, 0x0F, 0x00, 0x02,
+-    0x00, 0x75, 0x03, 0x0F, 0x00, 0x02, 0x00, 0x55, 0x03, 0x11, 0x00, 0x02, 0x00, 0x75, 0x03, 0x11,
+-    0x00, 0x02, 0x00, 0x53, 0x03, 0x26, 0x00, 0x02, 0x00, 0x73, 0x03, 0x26, 0x00, 0x02, 0x00, 0x54,
+-    0x03, 0x26, 0x00, 0x02, 0x00, 0x74, 0x03, 0x26, 0x00, 0x02, 0x00, 0x48, 0x03, 0x0C, 0x00, 0x02,
+-    0x00, 0x68, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x41, 0x03, 0x07, 0x00, 0x02, 0x00, 0x61, 0x03, 0x07,
+-    0x00, 0x02, 0x00, 0x45, 0x03, 0x27, 0x00, 0x02, 0x00, 0x65, 0x03, 0x27, 0x00, 0x02, 0x00, 0xD6,
+-    0x03, 0x04, 0x00, 0x02, 0x00, 0xF6, 0x03, 0x04, 0x00, 0x02, 0x00, 0xD5, 0x03, 0x04, 0x00, 0x02,
+-    0x00, 0xF5, 0x03, 0x04, 0x00, 0x02, 0x00, 0x4F, 0x03, 0x07, 0x00, 0x02, 0x00, 0x6F, 0x03, 0x07,
+-    0x00, 0x02, 0x02, 0x2E, 0x03, 0x04, 0x00, 0x02, 0x02, 0x2F, 0x03, 0x04, 0x00, 0x02, 0x00, 0x59,
+-    0x03, 0x04, 0x00, 0x02, 0x00, 0x79, 0x03, 0x04, 0x00, 0x02, 0x00, 0x41, 0x03, 0x25, 0x00, 0x02,
+-    0x00, 0x61, 0x03, 0x25, 0x00, 0x02, 0x00, 0x42, 0x03, 0x07, 0x00, 0x02, 0x00, 0x62, 0x03, 0x07,
+-    0x00, 0x02, 0x00, 0x42, 0x03, 0x23, 0x00, 0x02, 0x00, 0x62, 0x03, 0x23, 0x00, 0x02, 0x00, 0x42,
+-    0x03, 0x31, 0x00, 0x02, 0x00, 0x62, 0x03, 0x31, 0x00, 0x02, 0x00, 0xC7, 0x03, 0x01, 0x00, 0x02,
+-    0x00, 0xE7, 0x03, 0x01, 0x00, 0x02, 0x00, 0x44, 0x03, 0x07, 0x00, 0x02, 0x00, 0x64, 0x03, 0x07,
+-    0x00, 0x02, 0x00, 0x44, 0x03, 0x23, 0x00, 0x02, 0x00, 0x64, 0x03, 0x23, 0x00, 0x02, 0x00, 0x44,
+-    0x03, 0x31, 0x00, 0x02, 0x00, 0x64, 0x03, 0x31, 0x00, 0x02, 0x00, 0x44, 0x03, 0x27, 0x00, 0x02,
+-    0x00, 0x64, 0x03, 0x27, 0x00, 0x02, 0x00, 0x44, 0x03, 0x2D, 0x00, 0x02, 0x00, 0x64, 0x03, 0x2D,
+-    0x00, 0x02, 0x01, 0x12, 0x03, 0x00, 0x00, 0x02, 0x01, 0x13, 0x03, 0x00, 0x00, 0x02, 0x01, 0x12,
+-    0x03, 0x01, 0x00, 0x02, 0x01, 0x13, 0x03, 0x01, 0x00, 0x02, 0x00, 0x45, 0x03, 0x2D, 0x00, 0x02,
+-    0x00, 0x65, 0x03, 0x2D, 0x00, 0x02, 0x00, 0x45, 0x03, 0x30, 0x00, 0x02, 0x00, 0x65, 0x03, 0x30,
+-    0x00, 0x02, 0x01, 0x14, 0x03, 0x27, 0x00, 0x02, 0x01, 0x15, 0x03, 0x27, 0x00, 0x02, 0x00, 0x46,
+-    0x03, 0x07, 0x00, 0x02, 0x00, 0x66, 0x03, 0x07, 0x00, 0x02, 0x00, 0x47, 0x03, 0x04, 0x00, 0x02,
+-    0x00, 0x67, 0x03, 0x04, 0x00, 0x02, 0x00, 0x48, 0x03, 0x07, 0x00, 0x02, 0x00, 0x68, 0x03, 0x07,
+-    0x00, 0x02, 0x00, 0x48, 0x03, 0x23, 0x00, 0x02, 0x00, 0x68, 0x03, 0x23, 0x00, 0x02, 0x00, 0x48,
+-    0x03, 0x08, 0x00, 0x02, 0x00, 0x68, 0x03, 0x08, 0x00, 0x02, 0x00, 0x48, 0x03, 0x27, 0x00, 0x02,
+-    0x00, 0x68, 0x03, 0x27, 0x00, 0x02, 0x00, 0x48, 0x03, 0x2E, 0x00, 0x02, 0x00, 0x68, 0x03, 0x2E,
+-    0x00, 0x02, 0x00, 0x49, 0x03, 0x30, 0x00, 0x02, 0x00, 0x69, 0x03, 0x30, 0x00, 0x02, 0x00, 0x49,
+-    0x03, 0x44, 0x00, 0x02, 0x00, 0x69, 0x03, 0x44, 0x00, 0x02, 0x00, 0x4B, 0x03, 0x01, 0x00, 0x02,
+-    0x00, 0x6B, 0x03, 0x01, 0x00, 0x02, 0x00, 0x4B, 0x03, 0x23, 0x00, 0x02, 0x00, 0x6B, 0x03, 0x23,
+-    0x00, 0x02, 0x00, 0x4B, 0x03, 0x31, 0x00, 0x02, 0x00, 0x6B, 0x03, 0x31, 0x00, 0x02, 0x00, 0x4C,
+-    0x03, 0x23, 0x00, 0x02, 0x00, 0x6C, 0x03, 0x23, 0x00, 0x02, 0x1E, 0x36, 0x03, 0x04, 0x00, 0x02,
+-    0x1E, 0x37, 0x03, 0x04, 0x00, 0x02, 0x00, 0x4C, 0x03, 0x31, 0x00, 0x02, 0x00, 0x6C, 0x03, 0x31,
+-    0x00, 0x02, 0x00, 0x4C, 0x03, 0x2D, 0x00, 0x02, 0x00, 0x6C, 0x03, 0x2D, 0x00, 0x02, 0x00, 0x4D,
+-    0x03, 0x01, 0x00, 0x02, 0x00, 0x6D, 0x03, 0x01, 0x00, 0x02, 0x00, 0x4D, 0x03, 0x07, 0x00, 0x02,
+-    0x00, 0x6D, 0x03, 0x07, 0x00, 0x02, 0x00, 0x4D, 0x03, 0x23, 0x00, 0x02, 0x00, 0x6D, 0x03, 0x23,
+-    0x00, 0x02, 0x00, 0x4E, 0x03, 0x07, 0x00, 0x02, 0x00, 0x6E, 0x03, 0x07, 0x00, 0x02, 0x00, 0x4E,
+-    0x03, 0x23, 0x00, 0x02, 0x00, 0x6E, 0x03, 0x23, 0x00, 0x02, 0x00, 0x4E, 0x03, 0x31, 0x00, 0x02,
+-    0x00, 0x6E, 0x03, 0x31, 0x00, 0x02, 0x00, 0x4E, 0x03, 0x2D, 0x00, 0x02, 0x00, 0x6E, 0x03, 0x2D,
+-    0x00, 0x02, 0x00, 0xD5, 0x03, 0x01, 0x00, 0x02, 0x00, 0xF5, 0x03, 0x01, 0x00, 0x02, 0x00, 0xD5,
+-    0x03, 0x08, 0x00, 0x02, 0x00, 0xF5, 0x03, 0x08, 0x00, 0x02, 0x01, 0x4C, 0x03, 0x00, 0x00, 0x02,
+-    0x01, 0x4D, 0x03, 0x00, 0x00, 0x02, 0x01, 0x4C, 0x03, 0x01, 0x00, 0x02, 0x01, 0x4D, 0x03, 0x01,
+-    0x00, 0x02, 0x00, 0x50, 0x03, 0x01, 0x00, 0x02, 0x00, 0x70, 0x03, 0x01, 0x00, 0x02, 0x00, 0x50,
+-    0x03, 0x07, 0x00, 0x02, 0x00, 0x70, 0x03, 0x07, 0x00, 0x02, 0x00, 0x52, 0x03, 0x07, 0x00, 0x02,
+-    0x00, 0x72, 0x03, 0x07, 0x00, 0x02, 0x00, 0x52, 0x03, 0x23, 0x00, 0x02, 0x00, 0x72, 0x03, 0x23,
+-    0x00, 0x02, 0x1E, 0x5A, 0x03, 0x04, 0x00, 0x02, 0x1E, 0x5B, 0x03, 0x04, 0x00, 0x02, 0x00, 0x52,
+-    0x03, 0x31, 0x00, 0x02, 0x00, 0x72, 0x03, 0x31, 0x00, 0x02, 0x00, 0x53, 0x03, 0x07, 0x00, 0x02,
+-    0x00, 0x73, 0x03, 0x07, 0x00, 0x02, 0x00, 0x53, 0x03, 0x23, 0x00, 0x02, 0x00, 0x73, 0x03, 0x23,
+-    0x00, 0x02, 0x01, 0x5A, 0x03, 0x07, 0x00, 0x02, 0x01, 0x5B, 0x03, 0x07, 0x00, 0x02, 0x01, 0x60,
+-    0x03, 0x07, 0x00, 0x02, 0x01, 0x61, 0x03, 0x07, 0x00, 0x02, 0x1E, 0x60, 0x03, 0x23, 0x00, 0x02,
+-    0x1E, 0x61, 0x03, 0x23, 0x00, 0x02, 0x00, 0x54, 0x03, 0x07, 0x00, 0x02, 0x00, 0x74, 0x03, 0x07,
+-    0x00, 0x02, 0x00, 0x54, 0x03, 0x23, 0x00, 0x02, 0x00, 0x74, 0x03, 0x23, 0x00, 0x02, 0x00, 0x54,
+-    0x03, 0x31, 0x00, 0x02, 0x00, 0x74, 0x03, 0x31, 0x00, 0x02, 0x00, 0x54, 0x03, 0x2D, 0x00, 0x02,
+-    0x00, 0x74, 0x03, 0x2D, 0x00, 0x02, 0x00, 0x55, 0x03, 0x24, 0x00, 0x02, 0x00, 0x75, 0x03, 0x24,
+-    0x00, 0x02, 0x00, 0x55, 0x03, 0x30, 0x00, 0x02, 0x00, 0x75, 0x03, 0x30, 0x00, 0x02, 0x00, 0x55,
+-    0x03, 0x2D, 0x00, 0x02, 0x00, 0x75, 0x03, 0x2D, 0x00, 0x02, 0x01, 0x68, 0x03, 0x01, 0x00, 0x02,
+-    0x01, 0x69, 0x03, 0x01, 0x00, 0x02, 0x01, 0x6A, 0x03, 0x08, 0x00, 0x02, 0x01, 0x6B, 0x03, 0x08,
+-    0x00, 0x02, 0x00, 0x56, 0x03, 0x03, 0x00, 0x02, 0x00, 0x76, 0x03, 0x03, 0x00, 0x02, 0x00, 0x56,
+-    0x03, 0x23, 0x00, 0x02, 0x00, 0x76, 0x03, 0x23, 0x00, 0x02, 0x00, 0x57, 0x03, 0x00, 0x00, 0x02,
+-    0x00, 0x77, 0x03, 0x00, 0x00, 0x02, 0x00, 0x57, 0x03, 0x01, 0x00, 0x02, 0x00, 0x77, 0x03, 0x01,
+-    0x00, 0x02, 0x00, 0x57, 0x03, 0x08, 0x00, 0x02, 0x00, 0x77, 0x03, 0x08, 0x00, 0x02, 0x00, 0x57,
+-    0x03, 0x07, 0x00, 0x02, 0x00, 0x77, 0x03, 0x07, 0x00, 0x02, 0x00, 0x57, 0x03, 0x23, 0x00, 0x02,
+-    0x00, 0x77, 0x03, 0x23, 0x00, 0x02, 0x00, 0x58, 0x03, 0x07, 0x00, 0x02, 0x00, 0x78, 0x03, 0x07,
+-    0x00, 0x02, 0x00, 0x58, 0x03, 0x08, 0x00, 0x02, 0x00, 0x78, 0x03, 0x08, 0x00, 0x02, 0x00, 0x59,
+-    0x03, 0x07, 0x00, 0x02, 0x00, 0x79, 0x03, 0x07, 0x00, 0x02, 0x00, 0x5A, 0x03, 0x02, 0x00, 0x02,
+-    0x00, 0x7A, 0x03, 0x02, 0x00, 0x02, 0x00, 0x5A, 0x03, 0x23, 0x00, 0x02, 0x00, 0x7A, 0x03, 0x23,
+-    0x00, 0x02, 0x00, 0x5A, 0x03, 0x31, 0x00, 0x02, 0x00, 0x7A, 0x03, 0x31, 0x00, 0x02, 0x00, 0x68,
+-    0x03, 0x31, 0x00, 0x02, 0x00, 0x74, 0x03, 0x08, 0x00, 0x02, 0x00, 0x77, 0x03, 0x0A, 0x00, 0x02,
+-    0x00, 0x79, 0x03, 0x0A, 0x00, 0x02, 0x01, 0x7F, 0x03, 0x07, 0x00, 0x02, 0x00, 0x41, 0x03, 0x23,
+-    0x00, 0x02, 0x00, 0x61, 0x03, 0x23, 0x00, 0x02, 0x00, 0x41, 0x03, 0x09, 0x00, 0x02, 0x00, 0x61,
+-    0x03, 0x09, 0x00, 0x02, 0x00, 0xC2, 0x03, 0x01, 0x00, 0x02, 0x00, 0xE2, 0x03, 0x01, 0x00, 0x02,
+-    0x00, 0xC2, 0x03, 0x00, 0x00, 0x02, 0x00, 0xE2, 0x03, 0x00, 0x00, 0x02, 0x00, 0xC2, 0x03, 0x09,
+-    0x00, 0x02, 0x00, 0xE2, 0x03, 0x09, 0x00, 0x02, 0x00, 0xC2, 0x03, 0x03, 0x00, 0x02, 0x00, 0xE2,
+-    0x03, 0x03, 0x00, 0x02, 0x00, 0xC2, 0x03, 0x23, 0x00, 0x02, 0x00, 0xE2, 0x03, 0x23, 0x00, 0x02,
+-    0x01, 0x02, 0x03, 0x01, 0x00, 0x02, 0x01, 0x03, 0x03, 0x01, 0x00, 0x02, 0x01, 0x02, 0x03, 0x00,
+-    0x00, 0x02, 0x01, 0x03, 0x03, 0x00, 0x00, 0x02, 0x01, 0x02, 0x03, 0x09, 0x00, 0x02, 0x01, 0x03,
+-    0x03, 0x09, 0x00, 0x02, 0x01, 0x02, 0x03, 0x03, 0x00, 0x02, 0x01, 0x03, 0x03, 0x03, 0x00, 0x02,
+-    0x01, 0x02, 0x03, 0x23, 0x00, 0x02, 0x01, 0x03, 0x03, 0x23, 0x00, 0x02, 0x00, 0x45, 0x03, 0x23,
+-    0x00, 0x02, 0x00, 0x65, 0x03, 0x23, 0x00, 0x02, 0x00, 0x45, 0x03, 0x09, 0x00, 0x02, 0x00, 0x65,
+-    0x03, 0x09, 0x00, 0x02, 0x00, 0x45, 0x03, 0x03, 0x00, 0x02, 0x00, 0x65, 0x03, 0x03, 0x00, 0x02,
+-    0x00, 0xCA, 0x03, 0x01, 0x00, 0x02, 0x00, 0xEA, 0x03, 0x01, 0x00, 0x02, 0x00, 0xCA, 0x03, 0x00,
+-    0x00, 0x02, 0x00, 0xEA, 0x03, 0x00, 0x00, 0x02, 0x00, 0xCA, 0x03, 0x09, 0x00, 0x02, 0x00, 0xEA,
+-    0x03, 0x09, 0x00, 0x02, 0x00, 0xCA, 0x03, 0x03, 0x00, 0x02, 0x00, 0xEA, 0x03, 0x03, 0x00, 0x02,
+-    0x00, 0xCA, 0x03, 0x23, 0x00, 0x02, 0x00, 0xEA, 0x03, 0x23, 0x00, 0x02, 0x00, 0x49, 0x03, 0x09,
+-    0x00, 0x02, 0x00, 0x69, 0x03, 0x09, 0x00, 0x02, 0x00, 0x49, 0x03, 0x23, 0x00, 0x02, 0x00, 0x69,
+-    0x03, 0x23, 0x00, 0x02, 0x00, 0x4F, 0x03, 0x23, 0x00, 0x02, 0x00, 0x6F, 0x03, 0x23, 0x00, 0x02,
+-    0x00, 0x4F, 0x03, 0x09, 0x00, 0x02, 0x00, 0x6F, 0x03, 0x09, 0x00, 0x02, 0x00, 0xD4, 0x03, 0x01,
+-    0x00, 0x02, 0x00, 0xF4, 0x03, 0x01, 0x00, 0x02, 0x00, 0xD4, 0x03, 0x00, 0x00, 0x02, 0x00, 0xF4,
+-    0x03, 0x00, 0x00, 0x02, 0x00, 0xD4, 0x03, 0x09, 0x00, 0x02, 0x00, 0xF4, 0x03, 0x09, 0x00, 0x02,
+-    0x00, 0xD4, 0x03, 0x03, 0x00, 0x02, 0x00, 0xF4, 0x03, 0x03, 0x00, 0x02, 0x00, 0xD4, 0x03, 0x23,
+-    0x00, 0x02, 0x00, 0xF4, 0x03, 0x23, 0x00, 0x02, 0x00, 0xD3, 0x03, 0x1B, 0x00, 0x02, 0x00, 0xF3,
+-    0x03, 0x1B, 0x00, 0x02, 0x00, 0xD2, 0x03, 0x1B, 0x00, 0x02, 0x00, 0xF2, 0x03, 0x1B, 0x00, 0x02,
+-    0x01, 0xA0, 0x03, 0x09, 0x00, 0x02, 0x01, 0xA1, 0x03, 0x09, 0x00, 0x02, 0x00, 0xD5, 0x03, 0x1B,
+-    0x00, 0x02, 0x00, 0xF5, 0x03, 0x1B, 0x00, 0x02, 0x01, 0xA0, 0x03, 0x23, 0x00, 0x02, 0x01, 0xA1,
+-    0x03, 0x23, 0x00, 0x02, 0x00, 0x55, 0x03, 0x23, 0x00, 0x02, 0x00, 0x75, 0x03, 0x23, 0x00, 0x02,
+-    0x00, 0x55, 0x03, 0x09, 0x00, 0x02, 0x00, 0x75, 0x03, 0x09, 0x00, 0x02, 0x00, 0xDA, 0x03, 0x1B,
+-    0x00, 0x02, 0x00, 0xFA, 0x03, 0x1B, 0x00, 0x02, 0x00, 0xD9, 0x03, 0x1B, 0x00, 0x02, 0x00, 0xF9,
+-    0x03, 0x1B, 0x00, 0x02, 0x01, 0xAF, 0x03, 0x09, 0x00, 0x02, 0x01, 0xB0, 0x03, 0x09, 0x00, 0x02,
+-    0x01, 0x68, 0x03, 0x1B, 0x00, 0x02, 0x01, 0x69, 0x03, 0x1B, 0x00, 0x02, 0x01, 0xAF, 0x03, 0x23,
+-    0x00, 0x02, 0x01, 0xB0, 0x03, 0x23, 0x00, 0x02, 0x00, 0x59, 0x03, 0x00, 0x00, 0x02, 0x00, 0x79,
+-    0x03, 0x00, 0x00, 0x02, 0x00, 0x59, 0x03, 0x23, 0x00, 0x02, 0x00, 0x79, 0x03, 0x23, 0x00, 0x02,
+-    0x00, 0x59, 0x03, 0x09, 0x00, 0x02, 0x00, 0x79, 0x03, 0x09, 0x00, 0x02, 0x00, 0x59, 0x03, 0x03,
+-    0x00, 0x02, 0x00, 0x79, 0x03, 0x03, 0x00, 0x02, 0x00, 0x41, 0x03, 0x0A, 0x00, 0x01, 0x01, 0xF2,
+-    0x00, 0xC0, 0x00, 0xC1, 0x00, 0xC2, 0x00, 0xC3, 0x00, 0xC4, 0x00, 0xC5, 0x00, 0xC7, 0x00, 0xC8,
+-    0x00, 0xC9, 0x00, 0xCA, 0x00, 0xCB, 0x00, 0xCC, 0x00, 0xCD, 0x00, 0xCE, 0x00, 0xCF, 0x00, 0xD1,
+-    0x00, 0xD2, 0x00, 0xD3, 0x00, 0xD4, 0x00, 0xD5, 0x00, 0xD6, 0x00, 0xD9, 0x00, 0xDA, 0x00, 0xDB,
+-    0x00, 0xDC, 0x00, 0xDD, 0x00, 0xE0, 0x00, 0xE1, 0x00, 0xE2, 0x00, 0xE3, 0x00, 0xE4, 0x00, 0xE5,
+-    0x00, 0xE7, 0x00, 0xE8, 0x00, 0xE9, 0x00, 0xEA, 0x00, 0xEB, 0x00, 0xEC, 0x00, 0xED, 0x00, 0xEE,
+-    0x00, 0xEF, 0x00, 0xF1, 0x00, 0xF2, 0x00, 0xF3, 0x00, 0xF4, 0x00, 0xF5, 0x00, 0xF6, 0x00, 0xF9,
+-    0x00, 0xFA, 0x00, 0xFB, 0x00, 0xFC, 0x00, 0xFD, 0x00, 0xFF, 0x01, 0x00, 0x01, 0x01, 0x01, 0x02,
+-    0x01, 0x03, 0x01, 0x04, 0x01, 0x05, 0x01, 0x06, 0x01, 0x07, 0x01, 0x08, 0x01, 0x09, 0x01, 0x0A,
+-    0x01, 0x0B, 0x01, 0x0C, 0x01, 0x0D, 0x01, 0x0E, 0x01, 0x0F, 0x01, 0x12, 0x01, 0x13, 0x01, 0x14,
+-    0x01, 0x15, 0x01, 0x16, 0x01, 0x17, 0x01, 0x18, 0x01, 0x19, 0x01, 0x1A, 0x01, 0x1B, 0x01, 0x1C,
+-    0x01, 0x1D, 0x01, 0x1E, 0x01, 0x1F, 0x01, 0x20, 0x01, 0x21, 0x01, 0x22, 0x01, 0x23, 0x01, 0x24,
+-    0x01, 0x25, 0x01, 0x28, 0x01, 0x29, 0x01, 0x2A, 0x01, 0x2B, 0x01, 0x2C, 0x01, 0x2D, 0x01, 0x2E,
+-    0x01, 0x2F, 0x01, 0x30, 0x01, 0x34, 0x01, 0x35, 0x01, 0x36, 0x01, 0x37, 0x01, 0x39, 0x01, 0x3A,
+-    0x01, 0x3B, 0x01, 0x3C, 0x01, 0x3D, 0x01, 0x3E, 0x01, 0x43, 0x01, 0x44, 0x01, 0x45, 0x01, 0x46,
+-    0x01, 0x47, 0x01, 0x48, 0x01, 0x4C, 0x01, 0x4D, 0x01, 0x4E, 0x01, 0x4F, 0x01, 0x50, 0x01, 0x51,
+-    0x01, 0x54, 0x01, 0x55, 0x01, 0x56, 0x01, 0x57, 0x01, 0x58, 0x01, 0x59, 0x01, 0x5A, 0x01, 0x5B,
+-    0x01, 0x5C, 0x01, 0x5D, 0x01, 0x5E, 0x01, 0x5F, 0x01, 0x60, 0x01, 0x61, 0x01, 0x62, 0x01, 0x63,
+-    0x01, 0x64, 0x01, 0x65, 0x01, 0x68, 0x01, 0x69, 0x01, 0x6A, 0x01, 0x6B, 0x01, 0x6C, 0x01, 0x6D,
+-    0x01, 0x6E, 0x01, 0x6F, 0x01, 0x70, 0x01, 0x71, 0x01, 0x72, 0x01, 0x73, 0x01, 0x74, 0x01, 0x75,
+-    0x01, 0x76, 0x01, 0x77, 0x01, 0x78, 0x01, 0x79, 0x01, 0x7A, 0x01, 0x7B, 0x01, 0x7C, 0x01, 0x7D,
+-    0x01, 0x7E, 0x01, 0xA0, 0x01, 0xA1, 0x01, 0xAF, 0x01, 0xB0, 0x01, 0xCD, 0x01, 0xCE, 0x01, 0xCF,
+-    0x01, 0xD0, 0x01, 0xD1, 0x01, 0xD2, 0x01, 0xD3, 0x01, 0xD4, 0x01, 0xD5, 0x01, 0xD6, 0x01, 0xD7,
+-    0x01, 0xD8, 0x01, 0xD9, 0x01, 0xDA, 0x01, 0xDB, 0x01, 0xDC, 0x01, 0xDE, 0x01, 0xDF, 0x01, 0xE0,
+-    0x01, 0xE1, 0x01, 0xE2, 0x01, 0xE3, 0x01, 0xE6, 0x01, 0xE7, 0x01, 0xE8, 0x01, 0xE9, 0x01, 0xEA,
+-    0x01, 0xEB, 0x01, 0xEC, 0x01, 0xED, 0x01, 0xEE, 0x01, 0xEF, 0x01, 0xF0, 0x01, 0xF4, 0x01, 0xF5,
+-    0x01, 0xF8, 0x01, 0xF9, 0x01, 0xFA, 0x01, 0xFB, 0x01, 0xFC, 0x01, 0xFD, 0x01, 0xFE, 0x01, 0xFF,
+-    0x02, 0x00, 0x02, 0x01, 0x02, 0x02, 0x02, 0x03, 0x02, 0x04, 0x02, 0x05, 0x02, 0x06, 0x02, 0x07,
+-    0x02, 0x08, 0x02, 0x09, 0x02, 0x0A, 0x02, 0x0B, 0x02, 0x0C, 0x02, 0x0D, 0x02, 0x0E, 0x02, 0x0F,
+-    0x02, 0x10, 0x02, 0x11, 0x02, 0x12, 0x02, 0x13, 0x02, 0x14, 0x02, 0x15, 0x02, 0x16, 0x02, 0x17,
+-    0x02, 0x18, 0x02, 0x19, 0x02, 0x1A, 0x02, 0x1B, 0x02, 0x1E, 0x02, 0x1F, 0x02, 0x26, 0x02, 0x27,
+-    0x02, 0x28, 0x02, 0x29, 0x02, 0x2A, 0x02, 0x2B, 0x02, 0x2C, 0x02, 0x2D, 0x02, 0x2E, 0x02, 0x2F,
+-    0x02, 0x30, 0x02, 0x31, 0x02, 0x32, 0x02, 0x33, 0x1E, 0x00, 0x1E, 0x01, 0x1E, 0x02, 0x1E, 0x03,
+-    0x1E, 0x04, 0x1E, 0x05, 0x1E, 0x06, 0x1E, 0x07, 0x1E, 0x08, 0x1E, 0x09, 0x1E, 0x0A, 0x1E, 0x0B,
+-    0x1E, 0x0C, 0x1E, 0x0D, 0x1E, 0x0E, 0x1E, 0x0F, 0x1E, 0x10, 0x1E, 0x11, 0x1E, 0x12, 0x1E, 0x13,
+-    0x1E, 0x14, 0x1E, 0x15, 0x1E, 0x16, 0x1E, 0x17, 0x1E, 0x18, 0x1E, 0x19, 0x1E, 0x1A, 0x1E, 0x1B,
+-    0x1E, 0x1C, 0x1E, 0x1D, 0x1E, 0x1E, 0x1E, 0x1F, 0x1E, 0x20, 0x1E, 0x21, 0x1E, 0x22, 0x1E, 0x23,
+-    0x1E, 0x24, 0x1E, 0x25, 0x1E, 0x26, 0x1E, 0x27, 0x1E, 0x28, 0x1E, 0x29, 0x1E, 0x2A, 0x1E, 0x2B,
+-    0x1E, 0x2C, 0x1E, 0x2D, 0x1E, 0x2E, 0x1E, 0x2F, 0x1E, 0x30, 0x1E, 0x31, 0x1E, 0x32, 0x1E, 0x33,
+-    0x1E, 0x34, 0x1E, 0x35, 0x1E, 0x36, 0x1E, 0x37, 0x1E, 0x38, 0x1E, 0x39, 0x1E, 0x3A, 0x1E, 0x3B,
+-    0x1E, 0x3C, 0x1E, 0x3D, 0x1E, 0x3E, 0x1E, 0x3F, 0x1E, 0x40, 0x1E, 0x41, 0x1E, 0x42, 0x1E, 0x43,
+-    0x1E, 0x44, 0x1E, 0x45, 0x1E, 0x46, 0x1E, 0x47, 0x1E, 0x48, 0x1E, 0x49, 0x1E, 0x4A, 0x1E, 0x4B,
+-    0x1E, 0x4C, 0x1E, 0x4D, 0x1E, 0x4E, 0x1E, 0x4F, 0x1E, 0x50, 0x1E, 0x51, 0x1E, 0x52, 0x1E, 0x53,
+-    0x1E, 0x54, 0x1E, 0x55, 0x1E, 0x56, 0x1E, 0x57, 0x1E, 0x58, 0x1E, 0x59, 0x1E, 0x5A, 0x1E, 0x5B,
+-    0x1E, 0x5C, 0x1E, 0x5D, 0x1E, 0x5E, 0x1E, 0x5F, 0x1E, 0x60, 0x1E, 0x61, 0x1E, 0x62, 0x1E, 0x63,
+-    0x1E, 0x64, 0x1E, 0x65, 0x1E, 0x66, 0x1E, 0x67, 0x1E, 0x68, 0x1E, 0x69, 0x1E, 0x6A, 0x1E, 0x6B,
+-    0x1E, 0x6C, 0x1E, 0x6D, 0x1E, 0x6E, 0x1E, 0x6F, 0x1E, 0x70, 0x1E, 0x71, 0x1E, 0x72, 0x1E, 0x73,
+-    0x1E, 0x74, 0x1E, 0x75, 0x1E, 0x76, 0x1E, 0x77, 0x1E, 0x78, 0x1E, 0x79, 0x1E, 0x7A, 0x1E, 0x7B,
+-    0x1E, 0x7C, 0x1E, 0x7D, 0x1E, 0x7E, 0x1E, 0x7F, 0x1E, 0x80, 0x1E, 0x81, 0x1E, 0x82, 0x1E, 0x83,
+-    0x1E, 0x84, 0x1E, 0x85, 0x1E, 0x86, 0x1E, 0x87, 0x1E, 0x88, 0x1E, 0x89, 0x1E, 0x8A, 0x1E, 0x8B,
+-    0x1E, 0x8C, 0x1E, 0x8D, 0x1E, 0x8E, 0x1E, 0x8F, 0x1E, 0x90, 0x1E, 0x91, 0x1E, 0x92, 0x1E, 0x93,
+-    0x1E, 0x94, 0x1E, 0x95, 0x1E, 0x96, 0x1E, 0x97, 0x1E, 0x98, 0x1E, 0x99, 0x1E, 0x9B, 0x1E, 0xA0,
+-    0x1E, 0xA1, 0x1E, 0xA2, 0x1E, 0xA3, 0x1E, 0xA4, 0x1E, 0xA5, 0x1E, 0xA6, 0x1E, 0xA7, 0x1E, 0xA8,
+-    0x1E, 0xA9, 0x1E, 0xAA, 0x1E, 0xAB, 0x1E, 0xAC, 0x1E, 0xAD, 0x1E, 0xAE, 0x1E, 0xAF, 0x1E, 0xB0,
+-    0x1E, 0xB1, 0x1E, 0xB2, 0x1E, 0xB3, 0x1E, 0xB4, 0x1E, 0xB5, 0x1E, 0xB6, 0x1E, 0xB7, 0x1E, 0xB8,
+-    0x1E, 0xB9, 0x1E, 0xBA, 0x1E, 0xBB, 0x1E, 0xBC, 0x1E, 0xBD, 0x1E, 0xBE, 0x1E, 0xBF, 0x1E, 0xC0,
+-    0x1E, 0xC1, 0x1E, 0xC2, 0x1E, 0xC3, 0x1E, 0xC4, 0x1E, 0xC5, 0x1E, 0xC6, 0x1E, 0xC7, 0x1E, 0xC8,
+-    0x1E, 0xC9, 0x1E, 0xCA, 0x1E, 0xCB, 0x1E, 0xCC, 0x1E, 0xCD, 0x1E, 0xCE, 0x1E, 0xCF, 0x1E, 0xD0,
+-    0x1E, 0xD1, 0x1E, 0xD2, 0x1E, 0xD3, 0x1E, 0xD4, 0x1E, 0xD5, 0x1E, 0xD6, 0x1E, 0xD7, 0x1E, 0xD8,
+-    0x1E, 0xD9, 0x1E, 0xDA, 0x1E, 0xDB, 0x1E, 0xDC, 0x1E, 0xDD, 0x1E, 0xDE, 0x1E, 0xDF, 0x1E, 0xE0,
+-    0x1E, 0xE1, 0x1E, 0xE2, 0x1E, 0xE3, 0x1E, 0xE4, 0x1E, 0xE5, 0x1E, 0xE6, 0x1E, 0xE7, 0x1E, 0xE8,
++    0x00, 0x34, 0x01, 0x7A, 0x00, 0x02, 0x03, 0x01, 0x1E, 0x91, 0x00, 0x02, 0x03, 0x02, 0x01, 0x7C,
++    0x00, 0x02, 0x03, 0x07, 0x01, 0x7E, 0x00, 0x02, 0x03, 0x0C, 0x1E, 0x93, 0x00, 0x02, 0x03, 0x23,
++    0x1E, 0x95, 0x00, 0x02, 0x03, 0x31, 0x01, 0x7A, 0x00, 0x02, 0x03, 0x41, 0x00, 0x07, 0x00, 0x10,
++    0x00, 0x16, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x28, 0x00, 0x2E, 0x00, 0x34, 0x1E, 0xA6, 0x00, 0x02,
++    0x03, 0x00, 0x1E, 0xA4, 0x00, 0x02, 0x03, 0x01, 0x1E, 0xAA, 0x00, 0x02, 0x03, 0x03, 0x1E, 0xA8,
++    0x00, 0x02, 0x03, 0x09, 0x1E, 0xAC, 0x00, 0x02, 0x03, 0x23, 0x1E, 0xA6, 0x00, 0x02, 0x03, 0x40,
++    0x1E, 0xA4, 0x00, 0x02, 0x03, 0x41, 0x00, 0x01, 0x00, 0x04, 0x01, 0xDE, 0x00, 0x02, 0x03, 0x04,
++    0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x01, 0xFA, 0x00, 0x02, 0x03, 0x01, 0x01, 0xFA, 0x00, 0x02,
++    0x03, 0x41, 0x00, 0x03, 0x00, 0x08, 0x00, 0x0E, 0x00, 0x14, 0x01, 0xFC, 0x00, 0x02, 0x03, 0x01,
++    0x01, 0xE2, 0x00, 0x02, 0x03, 0x04, 0x01, 0xFC, 0x00, 0x02, 0x03, 0x41, 0x00, 0x02, 0x00, 0x06,
++    0x00, 0x0C, 0x1E, 0x08, 0x00, 0x02, 0x03, 0x01, 0x1E, 0x08, 0x00, 0x02, 0x03, 0x41, 0x00, 0x07,
++    0x00, 0x10, 0x00, 0x16, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x28, 0x00, 0x2E, 0x00, 0x34, 0x1E, 0xC0,
++    0x00, 0x02, 0x03, 0x00, 0x1E, 0xBE, 0x00, 0x02, 0x03, 0x01, 0x1E, 0xC4, 0x00, 0x02, 0x03, 0x03,
++    0x1E, 0xC2, 0x00, 0x02, 0x03, 0x09, 0x1E, 0xC6, 0x00, 0x02, 0x03, 0x23, 0x1E, 0xC0, 0x00, 0x02,
++    0x03, 0x40, 0x1E, 0xBE, 0x00, 0x02, 0x03, 0x41, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x1E, 0x2E,
++    0x00, 0x02, 0x03, 0x01, 0x1E, 0x2E, 0x00, 0x02, 0x03, 0x41, 0x00, 0x01, 0x00, 0x04, 0x1E, 0xDC,
++    0x00, 0x02, 0x03, 0x1B, 0x00, 0x01, 0x00, 0x04, 0x1E, 0xDA, 0x00, 0x02, 0x03, 0x1B, 0x00, 0x07,
++    0x00, 0x10, 0x00, 0x16, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x28, 0x00, 0x2E, 0x00, 0x34, 0x1E, 0xD2,
++    0x00, 0x02, 0x03, 0x00, 0x1E, 0xD0, 0x00, 0x02, 0x03, 0x01, 0x1E, 0xD6, 0x00, 0x02, 0x03, 0x03,
++    0x1E, 0xD4, 0x00, 0x02, 0x03, 0x09, 0x1E, 0xD8, 0x00, 0x02, 0x03, 0x23, 0x1E, 0xD2, 0x00, 0x02,
++    0x03, 0x40, 0x1E, 0xD0, 0x00, 0x02, 0x03, 0x41, 0x00, 0x05, 0x00, 0x0C, 0x00, 0x12, 0x00, 0x18,
++    0x00, 0x1E, 0x00, 0x24, 0x1E, 0x4C, 0x00, 0x02, 0x03, 0x01, 0x02, 0x2C, 0x00, 0x02, 0x03, 0x04,
++    0x1E, 0x4E, 0x00, 0x02, 0x03, 0x08, 0x1E, 0xE0, 0x00, 0x02, 0x03, 0x1B, 0x1E, 0x4C, 0x00, 0x02,
++    0x03, 0x41, 0x00, 0x01, 0x00, 0x04, 0x02, 0x2A, 0x00, 0x02, 0x03, 0x04, 0x00, 0x02, 0x00, 0x06,
++    0x00, 0x0C, 0x01, 0xFE, 0x00, 0x02, 0x03, 0x01, 0x01, 0xFE, 0x00, 0x02, 0x03, 0x41, 0x00, 0x01,
++    0x00, 0x04, 0x1E, 0xEA, 0x00, 0x02, 0x03, 0x1B, 0x00, 0x01, 0x00, 0x04, 0x1E, 0xE8, 0x00, 0x02,
++    0x03, 0x1B, 0x00, 0x06, 0x00, 0x0E, 0x00, 0x14, 0x00, 0x1A, 0x00, 0x20, 0x00, 0x26, 0x00, 0x2C,
++    0x01, 0xDB, 0x00, 0x02, 0x03, 0x00, 0x01, 0xD7, 0x00, 0x02, 0x03, 0x01, 0x01, 0xD5, 0x00, 0x02,
++    0x03, 0x04, 0x01, 0xD9, 0x00, 0x02, 0x03, 0x0C, 0x01, 0xDB, 0x00, 0x02, 0x03, 0x40, 0x01, 0xD7,
++    0x00, 0x02, 0x03, 0x41, 0x00, 0x07, 0x00, 0x10, 0x00, 0x16, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x28,
++    0x00, 0x2E, 0x00, 0x34, 0x1E, 0xA7, 0x00, 0x02, 0x03, 0x00, 0x1E, 0xA5, 0x00, 0x02, 0x03, 0x01,
++    0x1E, 0xAB, 0x00, 0x02, 0x03, 0x03, 0x1E, 0xA9, 0x00, 0x02, 0x03, 0x09, 0x1E, 0xAD, 0x00, 0x02,
++    0x03, 0x23, 0x1E, 0xA7, 0x00, 0x02, 0x03, 0x40, 0x1E, 0xA5, 0x00, 0x02, 0x03, 0x41, 0x00, 0x01,
++    0x00, 0x04, 0x01, 0xDF, 0x00, 0x02, 0x03, 0x04, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x01, 0xFB,
++    0x00, 0x02, 0x03, 0x01, 0x01, 0xFB, 0x00, 0x02, 0x03, 0x41, 0x00, 0x03, 0x00, 0x08, 0x00, 0x0E,
++    0x00, 0x14, 0x01, 0xFD, 0x00, 0x02, 0x03, 0x01, 0x01, 0xE3, 0x00, 0x02, 0x03, 0x04, 0x01, 0xFD,
++    0x00, 0x02, 0x03, 0x41, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x1E, 0x09, 0x00, 0x02, 0x03, 0x01,
++    0x1E, 0x09, 0x00, 0x02, 0x03, 0x41, 0x00, 0x07, 0x00, 0x10, 0x00, 0x16, 0x00, 0x1C, 0x00, 0x22,
++    0x00, 0x28, 0x00, 0x2E, 0x00, 0x34, 0x1E, 0xC1, 0x00, 0x02, 0x03, 0x00, 0x1E, 0xBF, 0x00, 0x02,
++    0x03, 0x01, 0x1E, 0xC5, 0x00, 0x02, 0x03, 0x03, 0x1E, 0xC3, 0x00, 0x02, 0x03, 0x09, 0x1E, 0xC7,
++    0x00, 0x02, 0x03, 0x23, 0x1E, 0xC1, 0x00, 0x02, 0x03, 0x40, 0x1E, 0xBF, 0x00, 0x02, 0x03, 0x41,
++    0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x1E, 0x2F, 0x00, 0x02, 0x03, 0x01, 0x1E, 0x2F, 0x00, 0x02,
++    0x03, 0x41, 0x00, 0x01, 0x00, 0x04, 0x1E, 0xDD, 0x00, 0x02, 0x03, 0x1B, 0x00, 0x01, 0x00, 0x04,
++    0x1E, 0xDB, 0x00, 0x02, 0x03, 0x1B, 0x00, 0x07, 0x00, 0x10, 0x00, 0x16, 0x00, 0x1C, 0x00, 0x22,
++    0x00, 0x28, 0x00, 0x2E, 0x00, 0x34, 0x1E, 0xD3, 0x00, 0x02, 0x03, 0x00, 0x1E, 0xD1, 0x00, 0x02,
++    0x03, 0x01, 0x1E, 0xD7, 0x00, 0x02, 0x03, 0x03, 0x1E, 0xD5, 0x00, 0x02, 0x03, 0x09, 0x1E, 0xD9,
++    0x00, 0x02, 0x03, 0x23, 0x1E, 0xD3, 0x00, 0x02, 0x03, 0x40, 0x1E, 0xD1, 0x00, 0x02, 0x03, 0x41,
++    0x00, 0x05, 0x00, 0x0C, 0x00, 0x12, 0x00, 0x18, 0x00, 0x1E, 0x00, 0x24, 0x1E, 0x4D, 0x00, 0x02,
++    0x03, 0x01, 0x02, 0x2D, 0x00, 0x02, 0x03, 0x04, 0x1E, 0x4F, 0x00, 0x02, 0x03, 0x08, 0x1E, 0xE1,
++    0x00, 0x02, 0x03, 0x1B, 0x1E, 0x4D, 0x00, 0x02, 0x03, 0x41, 0x00, 0x01, 0x00, 0x04, 0x02, 0x2B,
++    0x00, 0x02, 0x03, 0x04, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x01, 0xFF, 0x00, 0x02, 0x03, 0x01,
++    0x01, 0xFF, 0x00, 0x02, 0x03, 0x41, 0x00, 0x01, 0x00, 0x04, 0x1E, 0xEB, 0x00, 0x02, 0x03, 0x1B,
++    0x00, 0x01, 0x00, 0x04, 0x1E, 0xE9, 0x00, 0x02, 0x03, 0x1B, 0x00, 0x06, 0x00, 0x0E, 0x00, 0x14,
++    0x00, 0x1A, 0x00, 0x20, 0x00, 0x26, 0x00, 0x2C, 0x01, 0xDC, 0x00, 0x02, 0x03, 0x00, 0x01, 0xD8,
++    0x00, 0x02, 0x03, 0x01, 0x01, 0xD6, 0x00, 0x02, 0x03, 0x04, 0x01, 0xDA, 0x00, 0x02, 0x03, 0x0C,
++    0x01, 0xDC, 0x00, 0x02, 0x03, 0x40, 0x01, 0xD8, 0x00, 0x02, 0x03, 0x41, 0x00, 0x07, 0x00, 0x10,
++    0x00, 0x16, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x28, 0x00, 0x2E, 0x00, 0x34, 0x1E, 0xB0, 0x00, 0x02,
++    0x03, 0x00, 0x1E, 0xAE, 0x00, 0x02, 0x03, 0x01, 0x1E, 0xB4, 0x00, 0x02, 0x03, 0x03, 0x1E, 0xB2,
++    0x00, 0x02, 0x03, 0x09, 0x1E, 0xB6, 0x00, 0x02, 0x03, 0x23, 0x1E, 0xB0, 0x00, 0x02, 0x03, 0x40,
++    0x1E, 0xAE, 0x00, 0x02, 0x03, 0x41, 0x00, 0x07, 0x00, 0x10, 0x00, 0x16, 0x00, 0x1C, 0x00, 0x22,
++    0x00, 0x28, 0x00, 0x2E, 0x00, 0x34, 0x1E, 0xB1, 0x00, 0x02, 0x03, 0x00, 0x1E, 0xAF, 0x00, 0x02,
++    0x03, 0x01, 0x1E, 0xB5, 0x00, 0x02, 0x03, 0x03, 0x1E, 0xB3, 0x00, 0x02, 0x03, 0x09, 0x1E, 0xB7,
++    0x00, 0x02, 0x03, 0x23, 0x1E, 0xB1, 0x00, 0x02, 0x03, 0x40, 0x1E, 0xAF, 0x00, 0x02, 0x03, 0x41,
++    0x00, 0x01, 0x00, 0x04, 0x1E, 0x08, 0x00, 0x02, 0x03, 0x27, 0x00, 0x01, 0x00, 0x04, 0x1E, 0x09,
++    0x00, 0x02, 0x03, 0x27, 0x00, 0x04, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x16, 0x00, 0x1C, 0x1E, 0x14,
++    0x00, 0x02, 0x03, 0x00, 0x1E, 0x16, 0x00, 0x02, 0x03, 0x01, 0x1E, 0x14, 0x00, 0x02, 0x03, 0x40,
++    0x1E, 0x16, 0x00, 0x02, 0x03, 0x41, 0x00, 0x04, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x16, 0x00, 0x1C,
++    0x1E, 0x15, 0x00, 0x02, 0x03, 0x00, 0x1E, 0x17, 0x00, 0x02, 0x03, 0x01, 0x1E, 0x15, 0x00, 0x02,
++    0x03, 0x40, 0x1E, 0x17, 0x00, 0x02, 0x03, 0x41, 0x00, 0x01, 0x00, 0x04, 0x1E, 0x1C, 0x00, 0x02,
++    0x03, 0x27, 0x00, 0x01, 0x00, 0x04, 0x1E, 0x1D, 0x00, 0x02, 0x03, 0x27, 0x00, 0x05, 0x00, 0x0C,
++    0x00, 0x12, 0x00, 0x18, 0x00, 0x1E, 0x00, 0x24, 0x1E, 0x50, 0x00, 0x02, 0x03, 0x00, 0x1E, 0x52,
++    0x00, 0x02, 0x03, 0x01, 0x01, 0xEC, 0x00, 0x02, 0x03, 0x28, 0x1E, 0x50, 0x00, 0x02, 0x03, 0x40,
++    0x1E, 0x52, 0x00, 0x02, 0x03, 0x41, 0x00, 0x05, 0x00, 0x0C, 0x00, 0x12, 0x00, 0x18, 0x00, 0x1E,
++    0x00, 0x24, 0x1E, 0x51, 0x00, 0x02, 0x03, 0x00, 0x1E, 0x53, 0x00, 0x02, 0x03, 0x01, 0x01, 0xED,
++    0x00, 0x02, 0x03, 0x28, 0x1E, 0x51, 0x00, 0x02, 0x03, 0x40, 0x1E, 0x53, 0x00, 0x02, 0x03, 0x41,
++    0x00, 0x01, 0x00, 0x04, 0x1E, 0x64, 0x00, 0x02, 0x03, 0x07, 0x00, 0x01, 0x00, 0x04, 0x1E, 0x65,
++    0x00, 0x02, 0x03, 0x07, 0x00, 0x01, 0x00, 0x04, 0x1E, 0x66, 0x00, 0x02, 0x03, 0x07, 0x00, 0x01,
++    0x00, 0x04, 0x1E, 0x67, 0x00, 0x02, 0x03, 0x07, 0x00, 0x03, 0x00, 0x08, 0x00, 0x0E, 0x00, 0x14,
++    0x1E, 0x78, 0x00, 0x02, 0x03, 0x01, 0x1E, 0xEE, 0x00, 0x02, 0x03, 0x1B, 0x1E, 0x78, 0x00, 0x02,
++    0x03, 0x41, 0x00, 0x03, 0x00, 0x08, 0x00, 0x0E, 0x00, 0x14, 0x1E, 0x79, 0x00, 0x02, 0x03, 0x01,
++    0x1E, 0xEF, 0x00, 0x02, 0x03, 0x1B, 0x1E, 0x79, 0x00, 0x02, 0x03, 0x41, 0x00, 0x01, 0x00, 0x04,
++    0x1E, 0x7A, 0x00, 0x02, 0x03, 0x08, 0x00, 0x01, 0x00, 0x04, 0x1E, 0x7B, 0x00, 0x02, 0x03, 0x08,
++    0x00, 0x01, 0x00, 0x04, 0x1E, 0x9B, 0x00, 0x02, 0x03, 0x07, 0x00, 0x07, 0x00, 0x10, 0x00, 0x16,
++    0x00, 0x1C, 0x00, 0x22, 0x00, 0x28, 0x00, 0x2E, 0x00, 0x34, 0x1E, 0xDC, 0x00, 0x02, 0x03, 0x00,
++    0x1E, 0xDA, 0x00, 0x02, 0x03, 0x01, 0x1E, 0xE0, 0x00, 0x02, 0x03, 0x03, 0x1E, 0xDE, 0x00, 0x02,
++    0x03, 0x09, 0x1E, 0xE2, 0x00, 0x02, 0x03, 0x23, 0x1E, 0xDC, 0x00, 0x02, 0x03, 0x40, 0x1E, 0xDA,
++    0x00, 0x02, 0x03, 0x41, 0x00, 0x07, 0x00, 0x10, 0x00, 0x16, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x28,
++    0x00, 0x2E, 0x00, 0x34, 0x1E, 0xDD, 0x00, 0x02, 0x03, 0x00, 0x1E, 0xDB, 0x00, 0x02, 0x03, 0x01,
++    0x1E, 0xE1, 0x00, 0x02, 0x03, 0x03, 0x1E, 0xDF, 0x00, 0x02, 0x03, 0x09, 0x1E, 0xE3, 0x00, 0x02,
++    0x03, 0x23, 0x1E, 0xDD, 0x00, 0x02, 0x03, 0x40, 0x1E, 0xDB, 0x00, 0x02, 0x03, 0x41, 0x00, 0x07,
++    0x00, 0x10, 0x00, 0x16, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x28, 0x00, 0x2E, 0x00, 0x34, 0x1E, 0xEA,
++    0x00, 0x02, 0x03, 0x00, 0x1E, 0xE8, 0x00, 0x02, 0x03, 0x01, 0x1E, 0xEE, 0x00, 0x02, 0x03, 0x03,
++    0x1E, 0xEC, 0x00, 0x02, 0x03, 0x09, 0x1E, 0xF0, 0x00, 0x02, 0x03, 0x23, 0x1E, 0xEA, 0x00, 0x02,
++    0x03, 0x40, 0x1E, 0xE8, 0x00, 0x02, 0x03, 0x41, 0x00, 0x07, 0x00, 0x10, 0x00, 0x16, 0x00, 0x1C,
++    0x00, 0x22, 0x00, 0x28, 0x00, 0x2E, 0x00, 0x34, 0x1E, 0xEB, 0x00, 0x02, 0x03, 0x00, 0x1E, 0xE9,
++    0x00, 0x02, 0x03, 0x01, 0x1E, 0xEF, 0x00, 0x02, 0x03, 0x03, 0x1E, 0xED, 0x00, 0x02, 0x03, 0x09,
++    0x1E, 0xF1, 0x00, 0x02, 0x03, 0x23, 0x1E, 0xEB, 0x00, 0x02, 0x03, 0x40, 0x1E, 0xE9, 0x00, 0x02,
++    0x03, 0x41, 0x00, 0x01, 0x00, 0x04, 0x01, 0xEE, 0x00, 0x02, 0x03, 0x0C, 0x00, 0x01, 0x00, 0x04,
++    0x01, 0xEC, 0x00, 0x02, 0x03, 0x04, 0x00, 0x01, 0x00, 0x04, 0x01, 0xED, 0x00, 0x02, 0x03, 0x04,
++    0x00, 0x01, 0x00, 0x04, 0x01, 0xE0, 0x00, 0x02, 0x03, 0x04, 0x00, 0x01, 0x00, 0x04, 0x01, 0xE1,
++    0x00, 0x02, 0x03, 0x04, 0x00, 0x01, 0x00, 0x04, 0x1E, 0x1C, 0x00, 0x02, 0x03, 0x06, 0x00, 0x01,
++    0x00, 0x04, 0x1E, 0x1D, 0x00, 0x02, 0x03, 0x06, 0x00, 0x01, 0x00, 0x04, 0x02, 0x30, 0x00, 0x02,
++    0x03, 0x04, 0x00, 0x01, 0x00, 0x04, 0x02, 0x31, 0x00, 0x02, 0x03, 0x04, 0x00, 0x01, 0x00, 0x04,
++    0x01, 0xEF, 0x00, 0x02, 0x03, 0x0C, 0x00, 0x01, 0x00, 0x04, 0x1E, 0x38, 0x00, 0x02, 0x03, 0x04,
++    0x00, 0x01, 0x00, 0x04, 0x1E, 0x39, 0x00, 0x02, 0x03, 0x04, 0x00, 0x01, 0x00, 0x04, 0x1E, 0x5C,
++    0x00, 0x02, 0x03, 0x04, 0x00, 0x01, 0x00, 0x04, 0x1E, 0x5D, 0x00, 0x02, 0x03, 0x04, 0x00, 0x01,
++    0x00, 0x04, 0x1E, 0x68, 0x00, 0x02, 0x03, 0x23, 0x00, 0x01, 0x00, 0x04, 0x1E, 0x69, 0x00, 0x02,
++    0x03, 0x23, 0x00, 0x01, 0x00, 0x04, 0x1E, 0x68, 0x00, 0x02, 0x03, 0x07, 0x00, 0x01, 0x00, 0x04,
++    0x1E, 0x69, 0x00, 0x02, 0x03, 0x07, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x1E, 0xAC, 0x00, 0x02,
++    0x03, 0x02, 0x1E, 0xB6, 0x00, 0x02, 0x03, 0x06, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x1E, 0xAD,
++    0x00, 0x02, 0x03, 0x02, 0x1E, 0xB7, 0x00, 0x02, 0x03, 0x06, 0x00, 0x01, 0x00, 0x04, 0x1E, 0xC6,
++    0x00, 0x02, 0x03, 0x02, 0x00, 0x01, 0x00, 0x04, 0x1E, 0xC7, 0x00, 0x02, 0x03, 0x02, 0x00, 0x02,
++    0x00, 0x06, 0x00, 0x0C, 0x1E, 0xD8, 0x00, 0x02, 0x03, 0x02, 0x1E, 0xE2, 0x00, 0x02, 0x03, 0x1B,
++    0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x1E, 0xD9, 0x00, 0x02, 0x03, 0x02, 0x1E, 0xE3, 0x00, 0x02,
++    0x03, 0x1B, 0x00, 0x01, 0x00, 0x04, 0x1E, 0xDE, 0x00, 0x02, 0x03, 0x1B, 0x00, 0x01, 0x00, 0x04,
++    0x1E, 0xDF, 0x00, 0x02, 0x03, 0x1B, 0x00, 0x01, 0x00, 0x04, 0x1E, 0xF0, 0x00, 0x02, 0x03, 0x1B,
++    0x00, 0x01, 0x00, 0x04, 0x1E, 0xF1, 0x00, 0x02, 0x03, 0x1B, 0x00, 0x01, 0x00, 0x04, 0x1E, 0xEC,
++    0x00, 0x02, 0x03, 0x1B, 0x00, 0x01, 0x00, 0x04, 0x1E, 0xED, 0x00, 0x02, 0x03, 0x1B, 0x00, 0x06,
++    0x00, 0x0E, 0x00, 0x14, 0x00, 0x1A, 0x00, 0x20, 0x00, 0x26, 0x00, 0x2C, 0x1E, 0x30, 0x00, 0x02,
++    0x03, 0x01, 0x01, 0xE8, 0x00, 0x02, 0x03, 0x0C, 0x1E, 0x32, 0x00, 0x02, 0x03, 0x23, 0x01, 0x36,
++    0x00, 0x02, 0x03, 0x27, 0x1E, 0x34, 0x00, 0x02, 0x03, 0x31, 0x1E, 0x30, 0x00, 0x02, 0x03, 0x41,
++    0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x01, 0xFA, 0x00, 0x02, 0x03, 0x01, 0x01, 0xFA, 0x00, 0x02,
++    0x03, 0x41, 0x00, 0x01, 0x00, 0x89, 0x00, 0x41, 0x00, 0x42, 0x00, 0x43, 0x00, 0x44, 0x00, 0x45,
++    0x00, 0x46, 0x00, 0x47, 0x00, 0x48, 0x00, 0x49, 0x00, 0x4A, 0x00, 0x4B, 0x00, 0x4C, 0x00, 0x4D,
++    0x00, 0x4E, 0x00, 0x4F, 0x00, 0x50, 0x00, 0x52, 0x00, 0x53, 0x00, 0x54, 0x00, 0x55, 0x00, 0x56,
++    0x00, 0x57, 0x00, 0x58, 0x00, 0x59, 0x00, 0x5A, 0x00, 0x61, 0x00, 0x62, 0x00, 0x63, 0x00, 0x64,
++    0x00, 0x65, 0x00, 0x66, 0x00, 0x67, 0x00, 0x68, 0x00, 0x69, 0x00, 0x6A, 0x00, 0x6B, 0x00, 0x6C,
++    0x00, 0x6D, 0x00, 0x6E, 0x00, 0x6F, 0x00, 0x70, 0x00, 0x72, 0x00, 0x73, 0x00, 0x74, 0x00, 0x75,
++    0x00, 0x76, 0x00, 0x77, 0x00, 0x78, 0x00, 0x79, 0x00, 0x7A, 0x00, 0xC2, 0x00, 0xC4, 0x00, 0xC5,
++    0x00, 0xC6, 0x00, 0xC7, 0x00, 0xCA, 0x00, 0xCF, 0x00, 0xD2, 0x00, 0xD3, 0x00, 0xD4, 0x00, 0xD5,
++    0x00, 0xD6, 0x00, 0xD8, 0x00, 0xD9, 0x00, 0xDA, 0x00, 0xDC, 0x00, 0xE2, 0x00, 0xE4, 0x00, 0xE5,
++    0x00, 0xE6, 0x00, 0xE7, 0x00, 0xEA, 0x00, 0xEF, 0x00, 0xF2, 0x00, 0xF3, 0x00, 0xF4, 0x00, 0xF5,
++    0x00, 0xF6, 0x00, 0xF8, 0x00, 0xF9, 0x00, 0xFA, 0x00, 0xFC, 0x01, 0x02, 0x01, 0x03, 0x01, 0x06,
++    0x01, 0x07, 0x01, 0x12, 0x01, 0x13, 0x01, 0x14, 0x01, 0x15, 0x01, 0x4C, 0x01, 0x4D, 0x01, 0x5A,
++    0x01, 0x5B, 0x01, 0x60, 0x01, 0x61, 0x01, 0x68, 0x01, 0x69, 0x01, 0x6A, 0x01, 0x6B, 0x01, 0x7F,
++    0x01, 0xA0, 0x01, 0xA1, 0x01, 0xAF, 0x01, 0xB0, 0x01, 0xB7, 0x01, 0xEA, 0x01, 0xEB, 0x02, 0x26,
++    0x02, 0x27, 0x02, 0x28, 0x02, 0x29, 0x02, 0x2E, 0x02, 0x2F, 0x02, 0x92, 0x1E, 0x36, 0x1E, 0x37,
++    0x1E, 0x5A, 0x1E, 0x5B, 0x1E, 0x60, 0x1E, 0x61, 0x1E, 0x62, 0x1E, 0x63, 0x1E, 0xA0, 0x1E, 0xA1,
++    0x1E, 0xB8, 0x1E, 0xB9, 0x1E, 0xCC, 0x1E, 0xCD, 0x1E, 0xCE, 0x1E, 0xCF, 0x1E, 0xE4, 0x1E, 0xE5,
++    0x1E, 0xE6, 0x1E, 0xE7, 0x21, 0x2A, 0x21, 0x2B, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x14,
++    0x13, 0x88, 0x1A, 0x9E, 0x1E, 0x3C, 0x21, 0xAE, 0x22, 0x6C, 0x22, 0xFA, 0x00, 0x01, 0x0F, 0x8E,
++    0x01, 0xF1, 0x03, 0xE8, 0x03, 0xEE, 0x03, 0xF4, 0x03, 0xFA, 0x04, 0x00, 0x04, 0x06, 0x04, 0x0C,
++    0x04, 0x12, 0x04, 0x18, 0x04, 0x1E, 0x04, 0x24, 0x04, 0x2A, 0x04, 0x30, 0x04, 0x36, 0x04, 0x3C,
++    0x04, 0x42, 0x04, 0x48, 0x04, 0x4E, 0x04, 0x54, 0x04, 0x5A, 0x04, 0x60, 0x04, 0x66, 0x04, 0x6C,
++    0x04, 0x72, 0x04, 0x78, 0x04, 0x7E, 0x04, 0x84, 0x04, 0x8A, 0x04, 0x90, 0x04, 0x96, 0x04, 0x9C,
++    0x04, 0xA2, 0x04, 0xA8, 0x04, 0xAE, 0x04, 0xB4, 0x04, 0xBA, 0x04, 0xC0, 0x04, 0xC6, 0x04, 0xCC,
++    0x04, 0xD2, 0x04, 0xD8, 0x04, 0xDE, 0x04, 0xE4, 0x04, 0xEA, 0x04, 0xF0, 0x04, 0xF6, 0x04, 0xFC,
++    0x05, 0x02, 0x05, 0x08, 0x05, 0x0E, 0x05, 0x14, 0x05, 0x1A, 0x05, 0x20, 0x05, 0x26, 0x05, 0x2C,
++    0x05, 0x32, 0x05, 0x38, 0x05, 0x3E, 0x05, 0x44, 0x05, 0x4A, 0x05, 0x50, 0x05, 0x56, 0x05, 0x5C,
++    0x05, 0x62, 0x05, 0x68, 0x05, 0x6E, 0x05, 0x74, 0x05, 0x7A, 0x05, 0x80, 0x05, 0x86, 0x05, 0x8C,
++    0x05, 0x92, 0x05, 0x98, 0x05, 0x9E, 0x05, 0xA4, 0x05, 0xAA, 0x05, 0xB0, 0x05, 0xB6, 0x05, 0xBC,
++    0x05, 0xC2, 0x05, 0xC8, 0x05, 0xCE, 0x05, 0xD4, 0x05, 0xDA, 0x05, 0xE0, 0x05, 0xE6, 0x05, 0xEC,
++    0x05, 0xF2, 0x05, 0xF8, 0x05, 0xFE, 0x06, 0x04, 0x06, 0x0A, 0x06, 0x10, 0x06, 0x16, 0x06, 0x1C,
++    0x06, 0x22, 0x06, 0x28, 0x06, 0x2E, 0x06, 0x34, 0x06, 0x3A, 0x06, 0x40, 0x06, 0x46, 0x06, 0x4C,
++    0x06, 0x52, 0x06, 0x58, 0x06, 0x5E, 0x06, 0x64, 0x06, 0x6A, 0x06, 0x70, 0x06, 0x76, 0x06, 0x7C,
++    0x06, 0x82, 0x06, 0x88, 0x06, 0x8E, 0x06, 0x94, 0x06, 0x9A, 0x06, 0xA0, 0x06, 0xA6, 0x06, 0xAC,
++    0x06, 0xB2, 0x06, 0xB8, 0x06, 0xBE, 0x06, 0xC4, 0x06, 0xCA, 0x06, 0xD0, 0x06, 0xD6, 0x06, 0xDC,
++    0x06, 0xE2, 0x06, 0xE8, 0x06, 0xEE, 0x06, 0xF4, 0x06, 0xFA, 0x07, 0x00, 0x07, 0x06, 0x07, 0x0C,
++    0x07, 0x12, 0x07, 0x18, 0x07, 0x1E, 0x07, 0x24, 0x07, 0x2A, 0x07, 0x30, 0x07, 0x36, 0x07, 0x3C,
++    0x07, 0x42, 0x07, 0x48, 0x07, 0x4E, 0x07, 0x54, 0x07, 0x5A, 0x07, 0x60, 0x07, 0x66, 0x07, 0x6C,
++    0x07, 0x72, 0x07, 0x78, 0x07, 0x7E, 0x07, 0x84, 0x07, 0x8A, 0x07, 0x90, 0x07, 0x96, 0x07, 0x9C,
++    0x07, 0xA2, 0x07, 0xA8, 0x07, 0xAE, 0x07, 0xB4, 0x07, 0xBA, 0x07, 0xC0, 0x07, 0xC6, 0x07, 0xCC,
++    0x07, 0xD2, 0x07, 0xD8, 0x07, 0xDE, 0x07, 0xE4, 0x07, 0xEA, 0x07, 0xF0, 0x07, 0xF6, 0x07, 0xFC,
++    0x08, 0x02, 0x08, 0x08, 0x08, 0x0E, 0x08, 0x14, 0x08, 0x1A, 0x08, 0x20, 0x08, 0x26, 0x08, 0x2C,
++    0x08, 0x32, 0x08, 0x38, 0x08, 0x3E, 0x08, 0x44, 0x08, 0x4A, 0x08, 0x50, 0x08, 0x56, 0x08, 0x5C,
++    0x08, 0x62, 0x08, 0x68, 0x08, 0x6E, 0x08, 0x74, 0x08, 0x7A, 0x08, 0x80, 0x08, 0x86, 0x08, 0x8C,
++    0x08, 0x92, 0x08, 0x98, 0x08, 0x9E, 0x08, 0xA4, 0x08, 0xAA, 0x08, 0xB0, 0x08, 0xB6, 0x08, 0xBC,
++    0x08, 0xC2, 0x08, 0xC8, 0x08, 0xCE, 0x08, 0xD4, 0x08, 0xDA, 0x08, 0xE0, 0x08, 0xE6, 0x08, 0xEC,
++    0x08, 0xF2, 0x08, 0xF8, 0x08, 0xFE, 0x09, 0x04, 0x09, 0x0A, 0x09, 0x10, 0x09, 0x16, 0x09, 0x1C,
++    0x09, 0x22, 0x09, 0x28, 0x09, 0x2E, 0x09, 0x34, 0x09, 0x3A, 0x09, 0x40, 0x09, 0x46, 0x09, 0x4C,
++    0x09, 0x52, 0x09, 0x58, 0x09, 0x5E, 0x09, 0x64, 0x09, 0x6A, 0x09, 0x70, 0x09, 0x76, 0x09, 0x7C,
++    0x09, 0x82, 0x09, 0x88, 0x09, 0x8E, 0x09, 0x94, 0x09, 0x9A, 0x09, 0xA0, 0x09, 0xA6, 0x09, 0xAC,
++    0x09, 0xB2, 0x09, 0xB8, 0x09, 0xBE, 0x09, 0xC4, 0x09, 0xCA, 0x09, 0xD0, 0x09, 0xD6, 0x09, 0xDC,
++    0x09, 0xE2, 0x09, 0xE8, 0x09, 0xEE, 0x09, 0xF4, 0x09, 0xFA, 0x0A, 0x00, 0x0A, 0x06, 0x0A, 0x0C,
++    0x0A, 0x12, 0x0A, 0x18, 0x0A, 0x1E, 0x0A, 0x24, 0x0A, 0x2A, 0x0A, 0x30, 0x0A, 0x36, 0x0A, 0x3C,
++    0x0A, 0x42, 0x0A, 0x48, 0x0A, 0x4E, 0x0A, 0x54, 0x0A, 0x5A, 0x0A, 0x60, 0x0A, 0x66, 0x0A, 0x6C,
++    0x0A, 0x72, 0x0A, 0x78, 0x0A, 0x7E, 0x0A, 0x84, 0x0A, 0x8A, 0x0A, 0x90, 0x0A, 0x96, 0x0A, 0x9C,
++    0x0A, 0xA2, 0x0A, 0xA8, 0x0A, 0xAE, 0x0A, 0xB4, 0x0A, 0xBA, 0x0A, 0xC0, 0x0A, 0xC6, 0x0A, 0xCC,
++    0x0A, 0xD2, 0x0A, 0xD8, 0x0A, 0xDE, 0x0A, 0xE4, 0x0A, 0xEA, 0x0A, 0xF0, 0x0A, 0xF6, 0x0A, 0xFC,
++    0x0B, 0x02, 0x0B, 0x08, 0x0B, 0x0E, 0x0B, 0x14, 0x0B, 0x1A, 0x0B, 0x20, 0x0B, 0x26, 0x0B, 0x2C,
++    0x0B, 0x32, 0x0B, 0x38, 0x0B, 0x3E, 0x0B, 0x44, 0x0B, 0x4A, 0x0B, 0x50, 0x0B, 0x56, 0x0B, 0x5C,
++    0x0B, 0x62, 0x0B, 0x68, 0x0B, 0x6E, 0x0B, 0x74, 0x0B, 0x7A, 0x0B, 0x80, 0x0B, 0x86, 0x0B, 0x8C,
++    0x0B, 0x92, 0x0B, 0x98, 0x0B, 0x9E, 0x0B, 0xA4, 0x0B, 0xAA, 0x0B, 0xB0, 0x0B, 0xB6, 0x0B, 0xBC,
++    0x0B, 0xC2, 0x0B, 0xC8, 0x0B, 0xCE, 0x0B, 0xD4, 0x0B, 0xDA, 0x0B, 0xE0, 0x0B, 0xE6, 0x0B, 0xEC,
++    0x0B, 0xF2, 0x0B, 0xF8, 0x0B, 0xFE, 0x0C, 0x04, 0x0C, 0x0A, 0x0C, 0x10, 0x0C, 0x16, 0x0C, 0x1C,
++    0x0C, 0x22, 0x0C, 0x28, 0x0C, 0x2E, 0x0C, 0x34, 0x0C, 0x3A, 0x0C, 0x40, 0x0C, 0x46, 0x0C, 0x4C,
++    0x0C, 0x52, 0x0C, 0x58, 0x0C, 0x5E, 0x0C, 0x64, 0x0C, 0x6A, 0x0C, 0x70, 0x0C, 0x76, 0x0C, 0x7C,
++    0x0C, 0x82, 0x0C, 0x88, 0x0C, 0x8E, 0x0C, 0x94, 0x0C, 0x9A, 0x0C, 0xA0, 0x0C, 0xA6, 0x0C, 0xAC,
++    0x0C, 0xB2, 0x0C, 0xB8, 0x0C, 0xBE, 0x0C, 0xC4, 0x0C, 0xCA, 0x0C, 0xD0, 0x0C, 0xD6, 0x0C, 0xDC,
++    0x0C, 0xE2, 0x0C, 0xE8, 0x0C, 0xEE, 0x0C, 0xF4, 0x0C, 0xFA, 0x0D, 0x00, 0x0D, 0x06, 0x0D, 0x0C,
++    0x0D, 0x12, 0x0D, 0x18, 0x0D, 0x1E, 0x0D, 0x24, 0x0D, 0x2A, 0x0D, 0x30, 0x0D, 0x36, 0x0D, 0x3C,
++    0x0D, 0x42, 0x0D, 0x48, 0x0D, 0x4E, 0x0D, 0x54, 0x0D, 0x5A, 0x0D, 0x60, 0x0D, 0x66, 0x0D, 0x6C,
++    0x0D, 0x72, 0x0D, 0x78, 0x0D, 0x7E, 0x0D, 0x84, 0x0D, 0x8A, 0x0D, 0x90, 0x0D, 0x96, 0x0D, 0x9C,
++    0x0D, 0xA2, 0x0D, 0xA8, 0x0D, 0xAE, 0x0D, 0xB4, 0x0D, 0xBA, 0x0D, 0xC0, 0x0D, 0xC6, 0x0D, 0xCC,
++    0x0D, 0xD2, 0x0D, 0xD8, 0x0D, 0xDE, 0x0D, 0xE4, 0x0D, 0xEA, 0x0D, 0xF0, 0x0D, 0xF6, 0x0D, 0xFC,
++    0x0E, 0x02, 0x0E, 0x08, 0x0E, 0x0E, 0x0E, 0x14, 0x0E, 0x1A, 0x0E, 0x20, 0x0E, 0x26, 0x0E, 0x2C,
++    0x0E, 0x32, 0x0E, 0x38, 0x0E, 0x3E, 0x0E, 0x44, 0x0E, 0x4A, 0x0E, 0x50, 0x0E, 0x56, 0x0E, 0x5C,
++    0x0E, 0x62, 0x0E, 0x68, 0x0E, 0x6E, 0x0E, 0x74, 0x0E, 0x7A, 0x0E, 0x80, 0x0E, 0x86, 0x0E, 0x8C,
++    0x0E, 0x92, 0x0E, 0x98, 0x0E, 0x9E, 0x0E, 0xA4, 0x0E, 0xAA, 0x0E, 0xB0, 0x0E, 0xB6, 0x0E, 0xBC,
++    0x0E, 0xC2, 0x0E, 0xC8, 0x0E, 0xCE, 0x0E, 0xD4, 0x0E, 0xDA, 0x0E, 0xE0, 0x0E, 0xE6, 0x0E, 0xEC,
++    0x0E, 0xF2, 0x0E, 0xF8, 0x0E, 0xFE, 0x0F, 0x04, 0x0F, 0x0A, 0x0F, 0x10, 0x0F, 0x16, 0x0F, 0x1C,
++    0x0F, 0x22, 0x0F, 0x28, 0x0F, 0x2E, 0x0F, 0x34, 0x0F, 0x3A, 0x0F, 0x40, 0x0F, 0x46, 0x0F, 0x4C,
++    0x0F, 0x52, 0x0F, 0x58, 0x0F, 0x5E, 0x0F, 0x64, 0x0F, 0x6A, 0x0F, 0x70, 0x0F, 0x76, 0x0F, 0x7C,
++    0x0F, 0x82, 0x0F, 0x88, 0x00, 0x02, 0x00, 0x41, 0x03, 0x00, 0x00, 0x02, 0x00, 0x41, 0x03, 0x01,
++    0x00, 0x02, 0x00, 0x41, 0x03, 0x02, 0x00, 0x02, 0x00, 0x41, 0x03, 0x03, 0x00, 0x02, 0x00, 0x41,
++    0x03, 0x08, 0x00, 0x02, 0x00, 0x41, 0x03, 0x0A, 0x00, 0x02, 0x00, 0x43, 0x03, 0x27, 0x00, 0x02,
++    0x00, 0x45, 0x03, 0x00, 0x00, 0x02, 0x00, 0x45, 0x03, 0x01, 0x00, 0x02, 0x00, 0x45, 0x03, 0x02,
++    0x00, 0x02, 0x00, 0x45, 0x03, 0x08, 0x00, 0x02, 0x00, 0x49, 0x03, 0x00, 0x00, 0x02, 0x00, 0x49,
++    0x03, 0x01, 0x00, 0x02, 0x00, 0x49, 0x03, 0x02, 0x00, 0x02, 0x00, 0x49, 0x03, 0x08, 0x00, 0x02,
++    0x00, 0x4E, 0x03, 0x03, 0x00, 0x02, 0x00, 0x4F, 0x03, 0x00, 0x00, 0x02, 0x00, 0x4F, 0x03, 0x01,
++    0x00, 0x02, 0x00, 0x4F, 0x03, 0x02, 0x00, 0x02, 0x00, 0x4F, 0x03, 0x03, 0x00, 0x02, 0x00, 0x4F,
++    0x03, 0x08, 0x00, 0x02, 0x00, 0x55, 0x03, 0x00, 0x00, 0x02, 0x00, 0x55, 0x03, 0x01, 0x00, 0x02,
++    0x00, 0x55, 0x03, 0x02, 0x00, 0x02, 0x00, 0x55, 0x03, 0x08, 0x00, 0x02, 0x00, 0x59, 0x03, 0x01,
++    0x00, 0x02, 0x00, 0x61, 0x03, 0x00, 0x00, 0x02, 0x00, 0x61, 0x03, 0x01, 0x00, 0x02, 0x00, 0x61,
++    0x03, 0x02, 0x00, 0x02, 0x00, 0x61, 0x03, 0x03, 0x00, 0x02, 0x00, 0x61, 0x03, 0x08, 0x00, 0x02,
++    0x00, 0x61, 0x03, 0x0A, 0x00, 0x02, 0x00, 0x63, 0x03, 0x27, 0x00, 0x02, 0x00, 0x65, 0x03, 0x00,
++    0x00, 0x02, 0x00, 0x65, 0x03, 0x01, 0x00, 0x02, 0x00, 0x65, 0x03, 0x02, 0x00, 0x02, 0x00, 0x65,
++    0x03, 0x08, 0x00, 0x02, 0x00, 0x69, 0x03, 0x00, 0x00, 0x02, 0x00, 0x69, 0x03, 0x01, 0x00, 0x02,
++    0x00, 0x69, 0x03, 0x02, 0x00, 0x02, 0x00, 0x69, 0x03, 0x08, 0x00, 0x02, 0x00, 0x6E, 0x03, 0x03,
++    0x00, 0x02, 0x00, 0x6F, 0x03, 0x00, 0x00, 0x02, 0x00, 0x6F, 0x03, 0x01, 0x00, 0x02, 0x00, 0x6F,
++    0x03, 0x02, 0x00, 0x02, 0x00, 0x6F, 0x03, 0x03, 0x00, 0x02, 0x00, 0x6F, 0x03, 0x08, 0x00, 0x02,
++    0x00, 0x75, 0x03, 0x00, 0x00, 0x02, 0x00, 0x75, 0x03, 0x01, 0x00, 0x02, 0x00, 0x75, 0x03, 0x02,
++    0x00, 0x02, 0x00, 0x75, 0x03, 0x08, 0x00, 0x02, 0x00, 0x79, 0x03, 0x01, 0x00, 0x02, 0x00, 0x79,
++    0x03, 0x08, 0x00, 0x02, 0x00, 0x41, 0x03, 0x04, 0x00, 0x02, 0x00, 0x61, 0x03, 0x04, 0x00, 0x02,
++    0x00, 0x41, 0x03, 0x06, 0x00, 0x02, 0x00, 0x61, 0x03, 0x06, 0x00, 0x02, 0x00, 0x41, 0x03, 0x28,
++    0x00, 0x02, 0x00, 0x61, 0x03, 0x28, 0x00, 0x02, 0x00, 0x43, 0x03, 0x01, 0x00, 0x02, 0x00, 0x63,
++    0x03, 0x01, 0x00, 0x02, 0x00, 0x43, 0x03, 0x02, 0x00, 0x02, 0x00, 0x63, 0x03, 0x02, 0x00, 0x02,
++    0x00, 0x43, 0x03, 0x07, 0x00, 0x02, 0x00, 0x63, 0x03, 0x07, 0x00, 0x02, 0x00, 0x43, 0x03, 0x0C,
++    0x00, 0x02, 0x00, 0x63, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x44, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x64,
++    0x03, 0x0C, 0x00, 0x02, 0x00, 0x45, 0x03, 0x04, 0x00, 0x02, 0x00, 0x65, 0x03, 0x04, 0x00, 0x02,
++    0x00, 0x45, 0x03, 0x06, 0x00, 0x02, 0x00, 0x65, 0x03, 0x06, 0x00, 0x02, 0x00, 0x45, 0x03, 0x07,
++    0x00, 0x02, 0x00, 0x65, 0x03, 0x07, 0x00, 0x02, 0x00, 0x45, 0x03, 0x28, 0x00, 0x02, 0x00, 0x65,
++    0x03, 0x28, 0x00, 0x02, 0x00, 0x45, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x65, 0x03, 0x0C, 0x00, 0x02,
++    0x00, 0x47, 0x03, 0x02, 0x00, 0x02, 0x00, 0x67, 0x03, 0x02, 0x00, 0x02, 0x00, 0x47, 0x03, 0x06,
++    0x00, 0x02, 0x00, 0x67, 0x03, 0x06, 0x00, 0x02, 0x00, 0x47, 0x03, 0x07, 0x00, 0x02, 0x00, 0x67,
++    0x03, 0x07, 0x00, 0x02, 0x00, 0x47, 0x03, 0x27, 0x00, 0x02, 0x00, 0x67, 0x03, 0x27, 0x00, 0x02,
++    0x00, 0x48, 0x03, 0x02, 0x00, 0x02, 0x00, 0x68, 0x03, 0x02, 0x00, 0x02, 0x00, 0x49, 0x03, 0x03,
++    0x00, 0x02, 0x00, 0x69, 0x03, 0x03, 0x00, 0x02, 0x00, 0x49, 0x03, 0x04, 0x00, 0x02, 0x00, 0x69,
++    0x03, 0x04, 0x00, 0x02, 0x00, 0x49, 0x03, 0x06, 0x00, 0x02, 0x00, 0x69, 0x03, 0x06, 0x00, 0x02,
++    0x00, 0x49, 0x03, 0x28, 0x00, 0x02, 0x00, 0x69, 0x03, 0x28, 0x00, 0x02, 0x00, 0x49, 0x03, 0x07,
++    0x00, 0x02, 0x00, 0x4A, 0x03, 0x02, 0x00, 0x02, 0x00, 0x6A, 0x03, 0x02, 0x00, 0x02, 0x00, 0x4B,
++    0x03, 0x27, 0x00, 0x02, 0x00, 0x6B, 0x03, 0x27, 0x00, 0x02, 0x00, 0x4C, 0x03, 0x01, 0x00, 0x02,
++    0x00, 0x6C, 0x03, 0x01, 0x00, 0x02, 0x00, 0x4C, 0x03, 0x27, 0x00, 0x02, 0x00, 0x6C, 0x03, 0x27,
++    0x00, 0x02, 0x00, 0x4C, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x6C, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x4E,
++    0x03, 0x01, 0x00, 0x02, 0x00, 0x6E, 0x03, 0x01, 0x00, 0x02, 0x00, 0x4E, 0x03, 0x27, 0x00, 0x02,
++    0x00, 0x6E, 0x03, 0x27, 0x00, 0x02, 0x00, 0x4E, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x6E, 0x03, 0x0C,
++    0x00, 0x02, 0x00, 0x4F, 0x03, 0x04, 0x00, 0x02, 0x00, 0x6F, 0x03, 0x04, 0x00, 0x02, 0x00, 0x4F,
++    0x03, 0x06, 0x00, 0x02, 0x00, 0x6F, 0x03, 0x06, 0x00, 0x02, 0x00, 0x4F, 0x03, 0x0B, 0x00, 0x02,
++    0x00, 0x6F, 0x03, 0x0B, 0x00, 0x02, 0x00, 0x52, 0x03, 0x01, 0x00, 0x02, 0x00, 0x72, 0x03, 0x01,
++    0x00, 0x02, 0x00, 0x52, 0x03, 0x27, 0x00, 0x02, 0x00, 0x72, 0x03, 0x27, 0x00, 0x02, 0x00, 0x52,
++    0x03, 0x0C, 0x00, 0x02, 0x00, 0x72, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x53, 0x03, 0x01, 0x00, 0x02,
++    0x00, 0x73, 0x03, 0x01, 0x00, 0x02, 0x00, 0x53, 0x03, 0x02, 0x00, 0x02, 0x00, 0x73, 0x03, 0x02,
++    0x00, 0x02, 0x00, 0x53, 0x03, 0x27, 0x00, 0x02, 0x00, 0x73, 0x03, 0x27, 0x00, 0x02, 0x00, 0x53,
++    0x03, 0x0C, 0x00, 0x02, 0x00, 0x73, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x54, 0x03, 0x27, 0x00, 0x02,
++    0x00, 0x74, 0x03, 0x27, 0x00, 0x02, 0x00, 0x54, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x74, 0x03, 0x0C,
++    0x00, 0x02, 0x00, 0x55, 0x03, 0x03, 0x00, 0x02, 0x00, 0x75, 0x03, 0x03, 0x00, 0x02, 0x00, 0x55,
++    0x03, 0x04, 0x00, 0x02, 0x00, 0x75, 0x03, 0x04, 0x00, 0x02, 0x00, 0x55, 0x03, 0x06, 0x00, 0x02,
++    0x00, 0x75, 0x03, 0x06, 0x00, 0x02, 0x00, 0x55, 0x03, 0x0A, 0x00, 0x02, 0x00, 0x75, 0x03, 0x0A,
++    0x00, 0x02, 0x00, 0x55, 0x03, 0x0B, 0x00, 0x02, 0x00, 0x75, 0x03, 0x0B, 0x00, 0x02, 0x00, 0x55,
++    0x03, 0x28, 0x00, 0x02, 0x00, 0x75, 0x03, 0x28, 0x00, 0x02, 0x00, 0x57, 0x03, 0x02, 0x00, 0x02,
++    0x00, 0x77, 0x03, 0x02, 0x00, 0x02, 0x00, 0x59, 0x03, 0x02, 0x00, 0x02, 0x00, 0x79, 0x03, 0x02,
++    0x00, 0x02, 0x00, 0x59, 0x03, 0x08, 0x00, 0x02, 0x00, 0x5A, 0x03, 0x01, 0x00, 0x02, 0x00, 0x7A,
++    0x03, 0x01, 0x00, 0x02, 0x00, 0x5A, 0x03, 0x07, 0x00, 0x02, 0x00, 0x7A, 0x03, 0x07, 0x00, 0x02,
++    0x00, 0x5A, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x7A, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x4F, 0x03, 0x1B,
++    0x00, 0x02, 0x00, 0x6F, 0x03, 0x1B, 0x00, 0x02, 0x00, 0x55, 0x03, 0x1B, 0x00, 0x02, 0x00, 0x75,
++    0x03, 0x1B, 0x00, 0x02, 0x00, 0x41, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x61, 0x03, 0x0C, 0x00, 0x02,
++    0x00, 0x49, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x69, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x4F, 0x03, 0x0C,
++    0x00, 0x02, 0x00, 0x6F, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x55, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x75,
++    0x03, 0x0C, 0x00, 0x02, 0x00, 0xDC, 0x03, 0x04, 0x00, 0x02, 0x00, 0xFC, 0x03, 0x04, 0x00, 0x02,
++    0x00, 0x55, 0x03, 0x44, 0x00, 0x02, 0x00, 0x75, 0x03, 0x44, 0x00, 0x02, 0x00, 0xDC, 0x03, 0x0C,
++    0x00, 0x02, 0x00, 0xFC, 0x03, 0x0C, 0x00, 0x02, 0x00, 0xDC, 0x03, 0x00, 0x00, 0x02, 0x00, 0xFC,
++    0x03, 0x00, 0x00, 0x02, 0x00, 0xC4, 0x03, 0x04, 0x00, 0x02, 0x00, 0xE4, 0x03, 0x04, 0x00, 0x02,
++    0x02, 0x26, 0x03, 0x04, 0x00, 0x02, 0x02, 0x27, 0x03, 0x04, 0x00, 0x02, 0x00, 0xC6, 0x03, 0x04,
++    0x00, 0x02, 0x00, 0xE6, 0x03, 0x04, 0x00, 0x02, 0x00, 0x47, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x67,
++    0x03, 0x0C, 0x00, 0x02, 0x00, 0x4B, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x6B, 0x03, 0x0C, 0x00, 0x02,
++    0x00, 0x4F, 0x03, 0x28, 0x00, 0x02, 0x00, 0x6F, 0x03, 0x28, 0x00, 0x02, 0x01, 0x4C, 0x03, 0x28,
++    0x00, 0x02, 0x01, 0x4D, 0x03, 0x28, 0x00, 0x02, 0x01, 0xB7, 0x03, 0x0C, 0x00, 0x02, 0x02, 0x92,
++    0x03, 0x0C, 0x00, 0x02, 0x00, 0x6A, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x47, 0x03, 0x01, 0x00, 0x02,
++    0x00, 0x67, 0x03, 0x01, 0x00, 0x02, 0x00, 0x4E, 0x03, 0x00, 0x00, 0x02, 0x00, 0x6E, 0x03, 0x00,
++    0x00, 0x02, 0x00, 0xC5, 0x03, 0x01, 0x00, 0x02, 0x00, 0xE5, 0x03, 0x01, 0x00, 0x02, 0x00, 0xC6,
++    0x03, 0x01, 0x00, 0x02, 0x00, 0xE6, 0x03, 0x01, 0x00, 0x02, 0x00, 0xD8, 0x03, 0x01, 0x00, 0x02,
++    0x00, 0xF8, 0x03, 0x01, 0x00, 0x02, 0x00, 0x41, 0x03, 0x0F, 0x00, 0x02, 0x00, 0x61, 0x03, 0x0F,
++    0x00, 0x02, 0x00, 0x41, 0x03, 0x11, 0x00, 0x02, 0x00, 0x61, 0x03, 0x11, 0x00, 0x02, 0x00, 0x45,
++    0x03, 0x0F, 0x00, 0x02, 0x00, 0x65, 0x03, 0x0F, 0x00, 0x02, 0x00, 0x45, 0x03, 0x11, 0x00, 0x02,
++    0x00, 0x65, 0x03, 0x11, 0x00, 0x02, 0x00, 0x49, 0x03, 0x0F, 0x00, 0x02, 0x00, 0x69, 0x03, 0x0F,
++    0x00, 0x02, 0x00, 0x49, 0x03, 0x11, 0x00, 0x02, 0x00, 0x69, 0x03, 0x11, 0x00, 0x02, 0x00, 0x4F,
++    0x03, 0x0F, 0x00, 0x02, 0x00, 0x6F, 0x03, 0x0F, 0x00, 0x02, 0x00, 0x4F, 0x03, 0x11, 0x00, 0x02,
++    0x00, 0x6F, 0x03, 0x11, 0x00, 0x02, 0x00, 0x52, 0x03, 0x0F, 0x00, 0x02, 0x00, 0x72, 0x03, 0x0F,
++    0x00, 0x02, 0x00, 0x52, 0x03, 0x11, 0x00, 0x02, 0x00, 0x72, 0x03, 0x11, 0x00, 0x02, 0x00, 0x55,
++    0x03, 0x0F, 0x00, 0x02, 0x00, 0x75, 0x03, 0x0F, 0x00, 0x02, 0x00, 0x55, 0x03, 0x11, 0x00, 0x02,
++    0x00, 0x75, 0x03, 0x11, 0x00, 0x02, 0x00, 0x53, 0x03, 0x26, 0x00, 0x02, 0x00, 0x73, 0x03, 0x26,
++    0x00, 0x02, 0x00, 0x54, 0x03, 0x26, 0x00, 0x02, 0x00, 0x74, 0x03, 0x26, 0x00, 0x02, 0x00, 0x48,
++    0x03, 0x0C, 0x00, 0x02, 0x00, 0x68, 0x03, 0x0C, 0x00, 0x02, 0x00, 0x41, 0x03, 0x07, 0x00, 0x02,
++    0x00, 0x61, 0x03, 0x07, 0x00, 0x02, 0x00, 0x45, 0x03, 0x27, 0x00, 0x02, 0x00, 0x65, 0x03, 0x27,
++    0x00, 0x02, 0x00, 0xD6, 0x03, 0x04, 0x00, 0x02, 0x00, 0xF6, 0x03, 0x04, 0x00, 0x02, 0x00, 0xD5,
++    0x03, 0x04, 0x00, 0x02, 0x00, 0xF5, 0x03, 0x04, 0x00, 0x02, 0x00, 0x4F, 0x03, 0x07, 0x00, 0x02,
++    0x00, 0x6F, 0x03, 0x07, 0x00, 0x02, 0x02, 0x2E, 0x03, 0x04, 0x00, 0x02, 0x02, 0x2F, 0x03, 0x04,
++    0x00, 0x02, 0x00, 0x59, 0x03, 0x04, 0x00, 0x02, 0x00, 0x79, 0x03, 0x04, 0x00, 0x02, 0x00, 0x41,
++    0x03, 0x25, 0x00, 0x02, 0x00, 0x61, 0x03, 0x25, 0x00, 0x02, 0x00, 0x42, 0x03, 0x07, 0x00, 0x02,
++    0x00, 0x62, 0x03, 0x07, 0x00, 0x02, 0x00, 0x42, 0x03, 0x23, 0x00, 0x02, 0x00, 0x62, 0x03, 0x23,
++    0x00, 0x02, 0x00, 0x42, 0x03, 0x31, 0x00, 0x02, 0x00, 0x62, 0x03, 0x31, 0x00, 0x02, 0x00, 0xC7,
++    0x03, 0x01, 0x00, 0x02, 0x00, 0xE7, 0x03, 0x01, 0x00, 0x02, 0x00, 0x44, 0x03, 0x07, 0x00, 0x02,
++    0x00, 0x64, 0x03, 0x07, 0x00, 0x02, 0x00, 0x44, 0x03, 0x23, 0x00, 0x02, 0x00, 0x64, 0x03, 0x23,
++    0x00, 0x02, 0x00, 0x44, 0x03, 0x31, 0x00, 0x02, 0x00, 0x64, 0x03, 0x31, 0x00, 0x02, 0x00, 0x44,
++    0x03, 0x27, 0x00, 0x02, 0x00, 0x64, 0x03, 0x27, 0x00, 0x02, 0x00, 0x44, 0x03, 0x2D, 0x00, 0x02,
++    0x00, 0x64, 0x03, 0x2D, 0x00, 0x02, 0x01, 0x12, 0x03, 0x00, 0x00, 0x02, 0x01, 0x13, 0x03, 0x00,
++    0x00, 0x02, 0x01, 0x12, 0x03, 0x01, 0x00, 0x02, 0x01, 0x13, 0x03, 0x01, 0x00, 0x02, 0x00, 0x45,
++    0x03, 0x2D, 0x00, 0x02, 0x00, 0x65, 0x03, 0x2D, 0x00, 0x02, 0x00, 0x45, 0x03, 0x30, 0x00, 0x02,
++    0x00, 0x65, 0x03, 0x30, 0x00, 0x02, 0x01, 0x14, 0x03, 0x27, 0x00, 0x02, 0x01, 0x15, 0x03, 0x27,
++    0x00, 0x02, 0x00, 0x46, 0x03, 0x07, 0x00, 0x02, 0x00, 0x66, 0x03, 0x07, 0x00, 0x02, 0x00, 0x47,
++    0x03, 0x04, 0x00, 0x02, 0x00, 0x67, 0x03, 0x04, 0x00, 0x02, 0x00, 0x48, 0x03, 0x07, 0x00, 0x02,
++    0x00, 0x68, 0x03, 0x07, 0x00, 0x02, 0x00, 0x48, 0x03, 0x23, 0x00, 0x02, 0x00, 0x68, 0x03, 0x23,
++    0x00, 0x02, 0x00, 0x48, 0x03, 0x08, 0x00, 0x02, 0x00, 0x68, 0x03, 0x08, 0x00, 0x02, 0x00, 0x48,
++    0x03, 0x27, 0x00, 0x02, 0x00, 0x68, 0x03, 0x27, 0x00, 0x02, 0x00, 0x48, 0x03, 0x2E, 0x00, 0x02,
++    0x00, 0x68, 0x03, 0x2E, 0x00, 0x02, 0x00, 0x49, 0x03, 0x30, 0x00, 0x02, 0x00, 0x69, 0x03, 0x30,
++    0x00, 0x02, 0x00, 0x49, 0x03, 0x44, 0x00, 0x02, 0x00, 0x69, 0x03, 0x44, 0x00, 0x02, 0x00, 0x4B,
++    0x03, 0x01, 0x00, 0x02, 0x00, 0x6B, 0x03, 0x01, 0x00, 0x02, 0x00, 0x4B, 0x03, 0x23, 0x00, 0x02,
++    0x00, 0x6B, 0x03, 0x23, 0x00, 0x02, 0x00, 0x4B, 0x03, 0x31, 0x00, 0x02, 0x00, 0x6B, 0x03, 0x31,
++    0x00, 0x02, 0x00, 0x4C, 0x03, 0x23, 0x00, 0x02, 0x00, 0x6C, 0x03, 0x23, 0x00, 0x02, 0x1E, 0x36,
++    0x03, 0x04, 0x00, 0x02, 0x1E, 0x37, 0x03, 0x04, 0x00, 0x02, 0x00, 0x4C, 0x03, 0x31, 0x00, 0x02,
++    0x00, 0x6C, 0x03, 0x31, 0x00, 0x02, 0x00, 0x4C, 0x03, 0x2D, 0x00, 0x02, 0x00, 0x6C, 0x03, 0x2D,
++    0x00, 0x02, 0x00, 0x4D, 0x03, 0x01, 0x00, 0x02, 0x00, 0x6D, 0x03, 0x01, 0x00, 0x02, 0x00, 0x4D,
++    0x03, 0x07, 0x00, 0x02, 0x00, 0x6D, 0x03, 0x07, 0x00, 0x02, 0x00, 0x4D, 0x03, 0x23, 0x00, 0x02,
++    0x00, 0x6D, 0x03, 0x23, 0x00, 0x02, 0x00, 0x4E, 0x03, 0x07, 0x00, 0x02, 0x00, 0x6E, 0x03, 0x07,
++    0x00, 0x02, 0x00, 0x4E, 0x03, 0x23, 0x00, 0x02, 0x00, 0x6E, 0x03, 0x23, 0x00, 0x02, 0x00, 0x4E,
++    0x03, 0x31, 0x00, 0x02, 0x00, 0x6E, 0x03, 0x31, 0x00, 0x02, 0x00, 0x4E, 0x03, 0x2D, 0x00, 0x02,
++    0x00, 0x6E, 0x03, 0x2D, 0x00, 0x02, 0x00, 0xD5, 0x03, 0x01, 0x00, 0x02, 0x00, 0xF5, 0x03, 0x01,
++    0x00, 0x02, 0x00, 0xD5, 0x03, 0x08, 0x00, 0x02, 0x00, 0xF5, 0x03, 0x08, 0x00, 0x02, 0x01, 0x4C,
++    0x03, 0x00, 0x00, 0x02, 0x01, 0x4D, 0x03, 0x00, 0x00, 0x02, 0x01, 0x4C, 0x03, 0x01, 0x00, 0x02,
++    0x01, 0x4D, 0x03, 0x01, 0x00, 0x02, 0x00, 0x50, 0x03, 0x01, 0x00, 0x02, 0x00, 0x70, 0x03, 0x01,
++    0x00, 0x02, 0x00, 0x50, 0x03, 0x07, 0x00, 0x02, 0x00, 0x70, 0x03, 0x07, 0x00, 0x02, 0x00, 0x52,
++    0x03, 0x07, 0x00, 0x02, 0x00, 0x72, 0x03, 0x07, 0x00, 0x02, 0x00, 0x52, 0x03, 0x23, 0x00, 0x02,
++    0x00, 0x72, 0x03, 0x23, 0x00, 0x02, 0x1E, 0x5A, 0x03, 0x04, 0x00, 0x02, 0x1E, 0x5B, 0x03, 0x04,
++    0x00, 0x02, 0x00, 0x52, 0x03, 0x31, 0x00, 0x02, 0x00, 0x72, 0x03, 0x31, 0x00, 0x02, 0x00, 0x53,
++    0x03, 0x07, 0x00, 0x02, 0x00, 0x73, 0x03, 0x07, 0x00, 0x02, 0x00, 0x53, 0x03, 0x23, 0x00, 0x02,
++    0x00, 0x73, 0x03, 0x23, 0x00, 0x02, 0x01, 0x5A, 0x03, 0x07, 0x00, 0x02, 0x01, 0x5B, 0x03, 0x07,
++    0x00, 0x02, 0x01, 0x60, 0x03, 0x07, 0x00, 0x02, 0x01, 0x61, 0x03, 0x07, 0x00, 0x02, 0x1E, 0x60,
++    0x03, 0x23, 0x00, 0x02, 0x1E, 0x61, 0x03, 0x23, 0x00, 0x02, 0x00, 0x54, 0x03, 0x07, 0x00, 0x02,
++    0x00, 0x74, 0x03, 0x07, 0x00, 0x02, 0x00, 0x54, 0x03, 0x23, 0x00, 0x02, 0x00, 0x74, 0x03, 0x23,
++    0x00, 0x02, 0x00, 0x54, 0x03, 0x31, 0x00, 0x02, 0x00, 0x74, 0x03, 0x31, 0x00, 0x02, 0x00, 0x54,
++    0x03, 0x2D, 0x00, 0x02, 0x00, 0x74, 0x03, 0x2D, 0x00, 0x02, 0x00, 0x55, 0x03, 0x24, 0x00, 0x02,
++    0x00, 0x75, 0x03, 0x24, 0x00, 0x02, 0x00, 0x55, 0x03, 0x30, 0x00, 0x02, 0x00, 0x75, 0x03, 0x30,
++    0x00, 0x02, 0x00, 0x55, 0x03, 0x2D, 0x00, 0x02, 0x00, 0x75, 0x03, 0x2D, 0x00, 0x02, 0x01, 0x68,
++    0x03, 0x01, 0x00, 0x02, 0x01, 0x69, 0x03, 0x01, 0x00, 0x02, 0x01, 0x6A, 0x03, 0x08, 0x00, 0x02,
++    0x01, 0x6B, 0x03, 0x08, 0x00, 0x02, 0x00, 0x56, 0x03, 0x03, 0x00, 0x02, 0x00, 0x76, 0x03, 0x03,
++    0x00, 0x02, 0x00, 0x56, 0x03, 0x23, 0x00, 0x02, 0x00, 0x76, 0x03, 0x23, 0x00, 0x02, 0x00, 0x57,
++    0x03, 0x00, 0x00, 0x02, 0x00, 0x77, 0x03, 0x00, 0x00, 0x02, 0x00, 0x57, 0x03, 0x01, 0x00, 0x02,
++    0x00, 0x77, 0x03, 0x01, 0x00, 0x02, 0x00, 0x57, 0x03, 0x08, 0x00, 0x02, 0x00, 0x77, 0x03, 0x08,
++    0x00, 0x02, 0x00, 0x57, 0x03, 0x07, 0x00, 0x02, 0x00, 0x77, 0x03, 0x07, 0x00, 0x02, 0x00, 0x57,
++    0x03, 0x23, 0x00, 0x02, 0x00, 0x77, 0x03, 0x23, 0x00, 0x02, 0x00, 0x58, 0x03, 0x07, 0x00, 0x02,
++    0x00, 0x78, 0x03, 0x07, 0x00, 0x02, 0x00, 0x58, 0x03, 0x08, 0x00, 0x02, 0x00, 0x78, 0x03, 0x08,
++    0x00, 0x02, 0x00, 0x59, 0x03, 0x07, 0x00, 0x02, 0x00, 0x79, 0x03, 0x07, 0x00, 0x02, 0x00, 0x5A,
++    0x03, 0x02, 0x00, 0x02, 0x00, 0x7A, 0x03, 0x02, 0x00, 0x02, 0x00, 0x5A, 0x03, 0x23, 0x00, 0x02,
++    0x00, 0x7A, 0x03, 0x23, 0x00, 0x02, 0x00, 0x5A, 0x03, 0x31, 0x00, 0x02, 0x00, 0x7A, 0x03, 0x31,
++    0x00, 0x02, 0x00, 0x68, 0x03, 0x31, 0x00, 0x02, 0x00, 0x74, 0x03, 0x08, 0x00, 0x02, 0x00, 0x77,
++    0x03, 0x0A, 0x00, 0x02, 0x00, 0x79, 0x03, 0x0A, 0x00, 0x02, 0x01, 0x7F, 0x03, 0x07, 0x00, 0x02,
++    0x00, 0x41, 0x03, 0x23, 0x00, 0x02, 0x00, 0x61, 0x03, 0x23, 0x00, 0x02, 0x00, 0x41, 0x03, 0x09,
++    0x00, 0x02, 0x00, 0x61, 0x03, 0x09, 0x00, 0x02, 0x00, 0xC2, 0x03, 0x01, 0x00, 0x02, 0x00, 0xE2,
++    0x03, 0x01, 0x00, 0x02, 0x00, 0xC2, 0x03, 0x00, 0x00, 0x02, 0x00, 0xE2, 0x03, 0x00, 0x00, 0x02,
++    0x00, 0xC2, 0x03, 0x09, 0x00, 0x02, 0x00, 0xE2, 0x03, 0x09, 0x00, 0x02, 0x00, 0xC2, 0x03, 0x03,
++    0x00, 0x02, 0x00, 0xE2, 0x03, 0x03, 0x00, 0x02, 0x00, 0xC2, 0x03, 0x23, 0x00, 0x02, 0x00, 0xE2,
++    0x03, 0x23, 0x00, 0x02, 0x01, 0x02, 0x03, 0x01, 0x00, 0x02, 0x01, 0x03, 0x03, 0x01, 0x00, 0x02,
++    0x01, 0x02, 0x03, 0x00, 0x00, 0x02, 0x01, 0x03, 0x03, 0x00, 0x00, 0x02, 0x01, 0x02, 0x03, 0x09,
++    0x00, 0x02, 0x01, 0x03, 0x03, 0x09, 0x00, 0x02, 0x01, 0x02, 0x03, 0x03, 0x00, 0x02, 0x01, 0x03,
++    0x03, 0x03, 0x00, 0x02, 0x01, 0x02, 0x03, 0x23, 0x00, 0x02, 0x01, 0x03, 0x03, 0x23, 0x00, 0x02,
++    0x00, 0x45, 0x03, 0x23, 0x00, 0x02, 0x00, 0x65, 0x03, 0x23, 0x00, 0x02, 0x00, 0x45, 0x03, 0x09,
++    0x00, 0x02, 0x00, 0x65, 0x03, 0x09, 0x00, 0x02, 0x00, 0x45, 0x03, 0x03, 0x00, 0x02, 0x00, 0x65,
++    0x03, 0x03, 0x00, 0x02, 0x00, 0xCA, 0x03, 0x01, 0x00, 0x02, 0x00, 0xEA, 0x03, 0x01, 0x00, 0x02,
++    0x00, 0xCA, 0x03, 0x00, 0x00, 0x02, 0x00, 0xEA, 0x03, 0x00, 0x00, 0x02, 0x00, 0xCA, 0x03, 0x09,
++    0x00, 0x02, 0x00, 0xEA, 0x03, 0x09, 0x00, 0x02, 0x00, 0xCA, 0x03, 0x03, 0x00, 0x02, 0x00, 0xEA,
++    0x03, 0x03, 0x00, 0x02, 0x00, 0xCA, 0x03, 0x23, 0x00, 0x02, 0x00, 0xEA, 0x03, 0x23, 0x00, 0x02,
++    0x00, 0x49, 0x03, 0x09, 0x00, 0x02, 0x00, 0x69, 0x03, 0x09, 0x00, 0x02, 0x00, 0x49, 0x03, 0x23,
++    0x00, 0x02, 0x00, 0x69, 0x03, 0x23, 0x00, 0x02, 0x00, 0x4F, 0x03, 0x23, 0x00, 0x02, 0x00, 0x6F,
++    0x03, 0x23, 0x00, 0x02, 0x00, 0x4F, 0x03, 0x09, 0x00, 0x02, 0x00, 0x6F, 0x03, 0x09, 0x00, 0x02,
++    0x00, 0xD4, 0x03, 0x01, 0x00, 0x02, 0x00, 0xF4, 0x03, 0x01, 0x00, 0x02, 0x00, 0xD4, 0x03, 0x00,
++    0x00, 0x02, 0x00, 0xF4, 0x03, 0x00, 0x00, 0x02, 0x00, 0xD4, 0x03, 0x09, 0x00, 0x02, 0x00, 0xF4,
++    0x03, 0x09, 0x00, 0x02, 0x00, 0xD4, 0x03, 0x03, 0x00, 0x02, 0x00, 0xF4, 0x03, 0x03, 0x00, 0x02,
++    0x00, 0xD4, 0x03, 0x23, 0x00, 0x02, 0x00, 0xF4, 0x03, 0x23, 0x00, 0x02, 0x00, 0xD3, 0x03, 0x1B,
++    0x00, 0x02, 0x00, 0xF3, 0x03, 0x1B, 0x00, 0x02, 0x00, 0xD2, 0x03, 0x1B, 0x00, 0x02, 0x00, 0xF2,
++    0x03, 0x1B, 0x00, 0x02, 0x01, 0xA0, 0x03, 0x09, 0x00, 0x02, 0x01, 0xA1, 0x03, 0x09, 0x00, 0x02,
++    0x00, 0xD5, 0x03, 0x1B, 0x00, 0x02, 0x00, 0xF5, 0x03, 0x1B, 0x00, 0x02, 0x01, 0xA0, 0x03, 0x23,
++    0x00, 0x02, 0x01, 0xA1, 0x03, 0x23, 0x00, 0x02, 0x00, 0x55, 0x03, 0x23, 0x00, 0x02, 0x00, 0x75,
++    0x03, 0x23, 0x00, 0x02, 0x00, 0x55, 0x03, 0x09, 0x00, 0x02, 0x00, 0x75, 0x03, 0x09, 0x00, 0x02,
++    0x00, 0xDA, 0x03, 0x1B, 0x00, 0x02, 0x00, 0xFA, 0x03, 0x1B, 0x00, 0x02, 0x00, 0xD9, 0x03, 0x1B,
++    0x00, 0x02, 0x00, 0xF9, 0x03, 0x1B, 0x00, 0x02, 0x01, 0xAF, 0x03, 0x09, 0x00, 0x02, 0x01, 0xB0,
++    0x03, 0x09, 0x00, 0x02, 0x01, 0x68, 0x03, 0x1B, 0x00, 0x02, 0x01, 0x69, 0x03, 0x1B, 0x00, 0x02,
++    0x01, 0xAF, 0x03, 0x23, 0x00, 0x02, 0x01, 0xB0, 0x03, 0x23, 0x00, 0x02, 0x00, 0x59, 0x03, 0x00,
++    0x00, 0x02, 0x00, 0x79, 0x03, 0x00, 0x00, 0x02, 0x00, 0x59, 0x03, 0x23, 0x00, 0x02, 0x00, 0x79,
++    0x03, 0x23, 0x00, 0x02, 0x00, 0x59, 0x03, 0x09, 0x00, 0x02, 0x00, 0x79, 0x03, 0x09, 0x00, 0x02,
++    0x00, 0x59, 0x03, 0x03, 0x00, 0x02, 0x00, 0x79, 0x03, 0x03, 0x00, 0x01, 0x01, 0xF1, 0x00, 0xC0,
++    0x00, 0xC1, 0x00, 0xC2, 0x00, 0xC3, 0x00, 0xC4, 0x00, 0xC5, 0x00, 0xC7, 0x00, 0xC8, 0x00, 0xC9,
++    0x00, 0xCA, 0x00, 0xCB, 0x00, 0xCC, 0x00, 0xCD, 0x00, 0xCE, 0x00, 0xCF, 0x00, 0xD1, 0x00, 0xD2,
++    0x00, 0xD3, 0x00, 0xD4, 0x00, 0xD5, 0x00, 0xD6, 0x00, 0xD9, 0x00, 0xDA, 0x00, 0xDB, 0x00, 0xDC,
++    0x00, 0xDD, 0x00, 0xE0, 0x00, 0xE1, 0x00, 0xE2, 0x00, 0xE3, 0x00, 0xE4, 0x00, 0xE5, 0x00, 0xE7,
++    0x00, 0xE8, 0x00, 0xE9, 0x00, 0xEA, 0x00, 0xEB, 0x00, 0xEC, 0x00, 0xED, 0x00, 0xEE, 0x00, 0xEF,
++    0x00, 0xF1, 0x00, 0xF2, 0x00, 0xF3, 0x00, 0xF4, 0x00, 0xF5, 0x00, 0xF6, 0x00, 0xF9, 0x00, 0xFA,
++    0x00, 0xFB, 0x00, 0xFC, 0x00, 0xFD, 0x00, 0xFF, 0x01, 0x00, 0x01, 0x01, 0x01, 0x02, 0x01, 0x03,
++    0x01, 0x04, 0x01, 0x05, 0x01, 0x06, 0x01, 0x07, 0x01, 0x08, 0x01, 0x09, 0x01, 0x0A, 0x01, 0x0B,
++    0x01, 0x0C, 0x01, 0x0D, 0x01, 0x0E, 0x01, 0x0F, 0x01, 0x12, 0x01, 0x13, 0x01, 0x14, 0x01, 0x15,
++    0x01, 0x16, 0x01, 0x17, 0x01, 0x18, 0x01, 0x19, 0x01, 0x1A, 0x01, 0x1B, 0x01, 0x1C, 0x01, 0x1D,
++    0x01, 0x1E, 0x01, 0x1F, 0x01, 0x20, 0x01, 0x21, 0x01, 0x22, 0x01, 0x23, 0x01, 0x24, 0x01, 0x25,
++    0x01, 0x28, 0x01, 0x29, 0x01, 0x2A, 0x01, 0x2B, 0x01, 0x2C, 0x01, 0x2D, 0x01, 0x2E, 0x01, 0x2F,
++    0x01, 0x30, 0x01, 0x34, 0x01, 0x35, 0x01, 0x36, 0x01, 0x37, 0x01, 0x39, 0x01, 0x3A, 0x01, 0x3B,
++    0x01, 0x3C, 0x01, 0x3D, 0x01, 0x3E, 0x01, 0x43, 0x01, 0x44, 0x01, 0x45, 0x01, 0x46, 0x01, 0x47,
++    0x01, 0x48, 0x01, 0x4C, 0x01, 0x4D, 0x01, 0x4E, 0x01, 0x4F, 0x01, 0x50, 0x01, 0x51, 0x01, 0x54,
++    0x01, 0x55, 0x01, 0x56, 0x01, 0x57, 0x01, 0x58, 0x01, 0x59, 0x01, 0x5A, 0x01, 0x5B, 0x01, 0x5C,
++    0x01, 0x5D, 0x01, 0x5E, 0x01, 0x5F, 0x01, 0x60, 0x01, 0x61, 0x01, 0x62, 0x01, 0x63, 0x01, 0x64,
++    0x01, 0x65, 0x01, 0x68, 0x01, 0x69, 0x01, 0x6A, 0x01, 0x6B, 0x01, 0x6C, 0x01, 0x6D, 0x01, 0x6E,
++    0x01, 0x6F, 0x01, 0x70, 0x01, 0x71, 0x01, 0x72, 0x01, 0x73, 0x01, 0x74, 0x01, 0x75, 0x01, 0x76,
++    0x01, 0x77, 0x01, 0x78, 0x01, 0x79, 0x01, 0x7A, 0x01, 0x7B, 0x01, 0x7C, 0x01, 0x7D, 0x01, 0x7E,
++    0x01, 0xA0, 0x01, 0xA1, 0x01, 0xAF, 0x01, 0xB0, 0x01, 0xCD, 0x01, 0xCE, 0x01, 0xCF, 0x01, 0xD0,
++    0x01, 0xD1, 0x01, 0xD2, 0x01, 0xD3, 0x01, 0xD4, 0x01, 0xD5, 0x01, 0xD6, 0x01, 0xD7, 0x01, 0xD8,
++    0x01, 0xD9, 0x01, 0xDA, 0x01, 0xDB, 0x01, 0xDC, 0x01, 0xDE, 0x01, 0xDF, 0x01, 0xE0, 0x01, 0xE1,
++    0x01, 0xE2, 0x01, 0xE3, 0x01, 0xE6, 0x01, 0xE7, 0x01, 0xE8, 0x01, 0xE9, 0x01, 0xEA, 0x01, 0xEB,
++    0x01, 0xEC, 0x01, 0xED, 0x01, 0xEE, 0x01, 0xEF, 0x01, 0xF0, 0x01, 0xF4, 0x01, 0xF5, 0x01, 0xF8,
++    0x01, 0xF9, 0x01, 0xFA, 0x01, 0xFB, 0x01, 0xFC, 0x01, 0xFD, 0x01, 0xFE, 0x01, 0xFF, 0x02, 0x00,
++    0x02, 0x01, 0x02, 0x02, 0x02, 0x03, 0x02, 0x04, 0x02, 0x05, 0x02, 0x06, 0x02, 0x07, 0x02, 0x08,
++    0x02, 0x09, 0x02, 0x0A, 0x02, 0x0B, 0x02, 0x0C, 0x02, 0x0D, 0x02, 0x0E, 0x02, 0x0F, 0x02, 0x10,
++    0x02, 0x11, 0x02, 0x12, 0x02, 0x13, 0x02, 0x14, 0x02, 0x15, 0x02, 0x16, 0x02, 0x17, 0x02, 0x18,
++    0x02, 0x19, 0x02, 0x1A, 0x02, 0x1B, 0x02, 0x1E, 0x02, 0x1F, 0x02, 0x26, 0x02, 0x27, 0x02, 0x28,
++    0x02, 0x29, 0x02, 0x2A, 0x02, 0x2B, 0x02, 0x2C, 0x02, 0x2D, 0x02, 0x2E, 0x02, 0x2F, 0x02, 0x30,
++    0x02, 0x31, 0x02, 0x32, 0x02, 0x33, 0x1E, 0x00, 0x1E, 0x01, 0x1E, 0x02, 0x1E, 0x03, 0x1E, 0x04,
++    0x1E, 0x05, 0x1E, 0x06, 0x1E, 0x07, 0x1E, 0x08, 0x1E, 0x09, 0x1E, 0x0A, 0x1E, 0x0B, 0x1E, 0x0C,
++    0x1E, 0x0D, 0x1E, 0x0E, 0x1E, 0x0F, 0x1E, 0x10, 0x1E, 0x11, 0x1E, 0x12, 0x1E, 0x13, 0x1E, 0x14,
++    0x1E, 0x15, 0x1E, 0x16, 0x1E, 0x17, 0x1E, 0x18, 0x1E, 0x19, 0x1E, 0x1A, 0x1E, 0x1B, 0x1E, 0x1C,
++    0x1E, 0x1D, 0x1E, 0x1E, 0x1E, 0x1F, 0x1E, 0x20, 0x1E, 0x21, 0x1E, 0x22, 0x1E, 0x23, 0x1E, 0x24,
++    0x1E, 0x25, 0x1E, 0x26, 0x1E, 0x27, 0x1E, 0x28, 0x1E, 0x29, 0x1E, 0x2A, 0x1E, 0x2B, 0x1E, 0x2C,
++    0x1E, 0x2D, 0x1E, 0x2E, 0x1E, 0x2F, 0x1E, 0x30, 0x1E, 0x31, 0x1E, 0x32, 0x1E, 0x33, 0x1E, 0x34,
++    0x1E, 0x35, 0x1E, 0x36, 0x1E, 0x37, 0x1E, 0x38, 0x1E, 0x39, 0x1E, 0x3A, 0x1E, 0x3B, 0x1E, 0x3C,
++    0x1E, 0x3D, 0x1E, 0x3E, 0x1E, 0x3F, 0x1E, 0x40, 0x1E, 0x41, 0x1E, 0x42, 0x1E, 0x43, 0x1E, 0x44,
++    0x1E, 0x45, 0x1E, 0x46, 0x1E, 0x47, 0x1E, 0x48, 0x1E, 0x49, 0x1E, 0x4A, 0x1E, 0x4B, 0x1E, 0x4C,
++    0x1E, 0x4D, 0x1E, 0x4E, 0x1E, 0x4F, 0x1E, 0x50, 0x1E, 0x51, 0x1E, 0x52, 0x1E, 0x53, 0x1E, 0x54,
++    0x1E, 0x55, 0x1E, 0x56, 0x1E, 0x57, 0x1E, 0x58, 0x1E, 0x59, 0x1E, 0x5A, 0x1E, 0x5B, 0x1E, 0x5C,
++    0x1E, 0x5D, 0x1E, 0x5E, 0x1E, 0x5F, 0x1E, 0x60, 0x1E, 0x61, 0x1E, 0x62, 0x1E, 0x63, 0x1E, 0x64,
++    0x1E, 0x65, 0x1E, 0x66, 0x1E, 0x67, 0x1E, 0x68, 0x1E, 0x69, 0x1E, 0x6A, 0x1E, 0x6B, 0x1E, 0x6C,
++    0x1E, 0x6D, 0x1E, 0x6E, 0x1E, 0x6F, 0x1E, 0x70, 0x1E, 0x71, 0x1E, 0x72, 0x1E, 0x73, 0x1E, 0x74,
++    0x1E, 0x75, 0x1E, 0x76, 0x1E, 0x77, 0x1E, 0x78, 0x1E, 0x79, 0x1E, 0x7A, 0x1E, 0x7B, 0x1E, 0x7C,
++    0x1E, 0x7D, 0x1E, 0x7E, 0x1E, 0x7F, 0x1E, 0x80, 0x1E, 0x81, 0x1E, 0x82, 0x1E, 0x83, 0x1E, 0x84,
++    0x1E, 0x85, 0x1E, 0x86, 0x1E, 0x87, 0x1E, 0x88, 0x1E, 0x89, 0x1E, 0x8A, 0x1E, 0x8B, 0x1E, 0x8C,
++    0x1E, 0x8D, 0x1E, 0x8E, 0x1E, 0x8F, 0x1E, 0x90, 0x1E, 0x91, 0x1E, 0x92, 0x1E, 0x93, 0x1E, 0x94,
++    0x1E, 0x95, 0x1E, 0x96, 0x1E, 0x97, 0x1E, 0x98, 0x1E, 0x99, 0x1E, 0x9B, 0x1E, 0xA0, 0x1E, 0xA1,
++    0x1E, 0xA2, 0x1E, 0xA3, 0x1E, 0xA4, 0x1E, 0xA5, 0x1E, 0xA6, 0x1E, 0xA7, 0x1E, 0xA8, 0x1E, 0xA9,
++    0x1E, 0xAA, 0x1E, 0xAB, 0x1E, 0xAC, 0x1E, 0xAD, 0x1E, 0xAE, 0x1E, 0xAF, 0x1E, 0xB0, 0x1E, 0xB1,
++    0x1E, 0xB2, 0x1E, 0xB3, 0x1E, 0xB4, 0x1E, 0xB5, 0x1E, 0xB6, 0x1E, 0xB7, 0x1E, 0xB8, 0x1E, 0xB9,
++    0x1E, 0xBA, 0x1E, 0xBB, 0x1E, 0xBC, 0x1E, 0xBD, 0x1E, 0xBE, 0x1E, 0xBF, 0x1E, 0xC0, 0x1E, 0xC1,
++    0x1E, 0xC2, 0x1E, 0xC3, 0x1E, 0xC4, 0x1E, 0xC5, 0x1E, 0xC6, 0x1E, 0xC7, 0x1E, 0xC8, 0x1E, 0xC9,
++    0x1E, 0xCA, 0x1E, 0xCB, 0x1E, 0xCC, 0x1E, 0xCD, 0x1E, 0xCE, 0x1E, 0xCF, 0x1E, 0xD0, 0x1E, 0xD1,
++    0x1E, 0xD2, 0x1E, 0xD3, 0x1E, 0xD4, 0x1E, 0xD5, 0x1E, 0xD6, 0x1E, 0xD7, 0x1E, 0xD8, 0x1E, 0xD9,
++    0x1E, 0xDA, 0x1E, 0xDB, 0x1E, 0xDC, 0x1E, 0xDD, 0x1E, 0xDE, 0x1E, 0xDF, 0x1E, 0xE0, 0x1E, 0xE1,
++    0x1E, 0xE2, 0x1E, 0xE3, 0x1E, 0xE4, 0x1E, 0xE5, 0x1E, 0xE6, 0x1E, 0xE7, 0x1E, 0xE8, 0x1E, 0xE9,
++    0x1E, 0xEA, 0x1E, 0xEB, 0x1E, 0xEC, 0x1E, 0xED, 0x1E, 0xEE, 0x1E, 0xEF, 0x1E, 0xF0, 0x1E, 0xF1,
++    0x1E, 0xF2, 0x1E, 0xF3, 0x1E, 0xF4, 0x1E, 0xF5, 0x1E, 0xF6, 0x1E, 0xF7, 0x1E, 0xF8, 0x1E, 0xF9,
++    0x00, 0x01, 0x05, 0xBA, 0x00, 0xAC, 0x01, 0x5E, 0x01, 0x64, 0x01, 0x6A, 0x01, 0x70, 0x01, 0x76,
++    0x01, 0x7C, 0x01, 0x82, 0x01, 0x88, 0x01, 0x8E, 0x01, 0x94, 0x01, 0x9A, 0x01, 0xA0, 0x01, 0xA6,
++    0x01, 0xAC, 0x01, 0xB2, 0x01, 0xB8, 0x01, 0xBE, 0x01, 0xC4, 0x01, 0xCA, 0x01, 0xD0, 0x01, 0xD6,
++    0x01, 0xDC, 0x01, 0xE2, 0x01, 0xE8, 0x01, 0xEE, 0x01, 0xF4, 0x01, 0xFA, 0x02, 0x00, 0x02, 0x06,
++    0x02, 0x0C, 0x02, 0x12, 0x02, 0x18, 0x02, 0x1E, 0x02, 0x24, 0x02, 0x2A, 0x02, 0x30, 0x02, 0x38,
++    0x02, 0x40, 0x02, 0x46, 0x02, 0x4C, 0x02, 0x54, 0x02, 0x5C, 0x02, 0x62, 0x02, 0x68, 0x02, 0x70,
++    0x02, 0x78, 0x02, 0x80, 0x02, 0x88, 0x02, 0x8E, 0x02, 0x94, 0x02, 0x9A, 0x02, 0xA0, 0x02, 0xA6,
++    0x02, 0xAC, 0x02, 0xB2, 0x02, 0xB8, 0x02, 0xBE, 0x02, 0xC4, 0x02, 0xCA, 0x02, 0xD0, 0x02, 0xD6,
++    0x02, 0xDE, 0x02, 0xE6, 0x02, 0xEE, 0x02, 0xF6, 0x02, 0xFE, 0x03, 0x06, 0x03, 0x0C, 0x03, 0x12,
++    0x03, 0x18, 0x03, 0x1E, 0x03, 0x24, 0x03, 0x2A, 0x03, 0x30, 0x03, 0x36, 0x03, 0x3C, 0x03, 0x42,
++    0x03, 0x48, 0x03, 0x4E, 0x03, 0x54, 0x03, 0x5A, 0x03, 0x62, 0x03, 0x6A, 0x03, 0x70, 0x03, 0x76,
++    0x03, 0x7C, 0x03, 0x82, 0x03, 0x8A, 0x03, 0x92, 0x03, 0x98, 0x03, 0x9E, 0x03, 0xA4, 0x03, 0xAA,
++    0x03, 0xB0, 0x03, 0xB6, 0x03, 0xBE, 0x03, 0xC6, 0x03, 0xCE, 0x03, 0xD6, 0x03, 0xDE, 0x03, 0xE6,
++    0x03, 0xEC, 0x03, 0xF2, 0x03, 0xF8, 0x03, 0xFE, 0x04, 0x06, 0x04, 0x0E, 0x04, 0x14, 0x04, 0x1A,
++    0x04, 0x20, 0x04, 0x26, 0x04, 0x2C, 0x04, 0x32, 0x04, 0x38, 0x04, 0x3E, 0x04, 0x46, 0x04, 0x4E,
++    0x04, 0x56, 0x04, 0x5E, 0x04, 0x64, 0x04, 0x6A, 0x04, 0x70, 0x04, 0x76, 0x04, 0x7C, 0x04, 0x82,
++    0x04, 0x8A, 0x04, 0x92, 0x04, 0x9A, 0x04, 0xA2, 0x04, 0xA8, 0x04, 0xAE, 0x04, 0xB4, 0x04, 0xBA,
++    0x04, 0xC0, 0x04, 0xC6, 0x04, 0xCE, 0x04, 0xD6, 0x04, 0xDE, 0x04, 0xE6, 0x04, 0xEC, 0x04, 0xF2,
++    0x04, 0xF8, 0x04, 0xFE, 0x05, 0x04, 0x05, 0x0A, 0x05, 0x12, 0x05, 0x1A, 0x05, 0x22, 0x05, 0x2A,
++    0x05, 0x30, 0x05, 0x36, 0x05, 0x3C, 0x05, 0x42, 0x05, 0x48, 0x05, 0x4E, 0x05, 0x54, 0x05, 0x5A,
++    0x05, 0x60, 0x05, 0x66, 0x05, 0x6C, 0x05, 0x72, 0x05, 0x78, 0x05, 0x7E, 0x05, 0x84, 0x05, 0x8A,
++    0x05, 0x90, 0x05, 0x96, 0x05, 0x9C, 0x05, 0xA2, 0x05, 0xA8, 0x05, 0xAE, 0x05, 0xB4, 0x00, 0x02,
++    0x00, 0x41, 0x03, 0x40, 0x00, 0x02, 0x00, 0x41, 0x03, 0x41, 0x00, 0x02, 0x00, 0x45, 0x03, 0x40,
++    0x00, 0x02, 0x00, 0x45, 0x03, 0x41, 0x00, 0x02, 0x00, 0x49, 0x03, 0x40, 0x00, 0x02, 0x00, 0x49,
++    0x03, 0x41, 0x00, 0x02, 0x00, 0x4F, 0x03, 0x40, 0x00, 0x02, 0x00, 0x4F, 0x03, 0x41, 0x00, 0x02,
++    0x00, 0x55, 0x03, 0x40, 0x00, 0x02, 0x00, 0x55, 0x03, 0x41, 0x00, 0x02, 0x00, 0x59, 0x03, 0x41,
++    0x00, 0x02, 0x00, 0x61, 0x03, 0x40, 0x00, 0x02, 0x00, 0x61, 0x03, 0x41, 0x00, 0x02, 0x00, 0x65,
++    0x03, 0x40, 0x00, 0x02, 0x00, 0x65, 0x03, 0x41, 0x00, 0x02, 0x00, 0x69, 0x03, 0x40, 0x00, 0x02,
++    0x00, 0x69, 0x03, 0x41, 0x00, 0x02, 0x00, 0x6F, 0x03, 0x40, 0x00, 0x02, 0x00, 0x6F, 0x03, 0x41,
++    0x00, 0x02, 0x00, 0x75, 0x03, 0x40, 0x00, 0x02, 0x00, 0x75, 0x03, 0x41, 0x00, 0x02, 0x00, 0x79,
++    0x03, 0x41, 0x00, 0x02, 0x00, 0x43, 0x03, 0x41, 0x00, 0x02, 0x00, 0x63, 0x03, 0x41, 0x00, 0x02,
++    0x21, 0x2A, 0x03, 0x27, 0x00, 0x02, 0x00, 0x4C, 0x03, 0x41, 0x00, 0x02, 0x00, 0x6C, 0x03, 0x41,
++    0x00, 0x02, 0x00, 0x4E, 0x03, 0x41, 0x00, 0x02, 0x00, 0x6E, 0x03, 0x41, 0x00, 0x02, 0x00, 0x52,
++    0x03, 0x41, 0x00, 0x02, 0x00, 0x72, 0x03, 0x41, 0x00, 0x02, 0x00, 0x53, 0x03, 0x41, 0x00, 0x02,
++    0x00, 0x73, 0x03, 0x41, 0x00, 0x02, 0x00, 0x5A, 0x03, 0x41, 0x00, 0x02, 0x00, 0x7A, 0x03, 0x41,
++    0x00, 0x03, 0x00, 0x55, 0x03, 0x08, 0x03, 0x04, 0x00, 0x03, 0x00, 0x75, 0x03, 0x08, 0x03, 0x04,
++    0x00, 0x02, 0x00, 0xDC, 0x03, 0x01, 0x00, 0x02, 0x00, 0xFC, 0x03, 0x01, 0x00, 0x03, 0x00, 0x55,
++    0x03, 0x08, 0x03, 0x0C, 0x00, 0x03, 0x00, 0x75, 0x03, 0x08, 0x03, 0x0C, 0x00, 0x02, 0x00, 0xDC,
++    0x03, 0x40, 0x00, 0x02, 0x00, 0xFC, 0x03, 0x40, 0x00, 0x03, 0x00, 0x41, 0x03, 0x08, 0x03, 0x04,
++    0x00, 0x03, 0x00, 0x61, 0x03, 0x08, 0x03, 0x04, 0x00, 0x03, 0x00, 0x41, 0x03, 0x07, 0x03, 0x04,
++    0x00, 0x03, 0x00, 0x61, 0x03, 0x07, 0x03, 0x04, 0x00, 0x02, 0x21, 0x2A, 0x03, 0x0C, 0x00, 0x02,
++    0x01, 0xEA, 0x03, 0x04, 0x00, 0x02, 0x01, 0xEB, 0x03, 0x04, 0x00, 0x02, 0x00, 0x47, 0x03, 0x41,
++    0x00, 0x02, 0x00, 0x67, 0x03, 0x41, 0x00, 0x02, 0x00, 0x4E, 0x03, 0x40, 0x00, 0x02, 0x00, 0x6E,
++    0x03, 0x40, 0x00, 0x02, 0x00, 0xC5, 0x03, 0x41, 0x00, 0x02, 0x00, 0xE5, 0x03, 0x41, 0x00, 0x02,
++    0x00, 0xC6, 0x03, 0x41, 0x00, 0x02, 0x00, 0xE6, 0x03, 0x41, 0x00, 0x02, 0x00, 0xD8, 0x03, 0x41,
++    0x00, 0x02, 0x00, 0xF8, 0x03, 0x41, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x08, 0x03, 0x04, 0x00, 0x03,
++    0x00, 0x6F, 0x03, 0x08, 0x03, 0x04, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x03, 0x03, 0x04, 0x00, 0x03,
++    0x00, 0x6F, 0x03, 0x03, 0x03, 0x04, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x07, 0x03, 0x04, 0x00, 0x03,
++    0x00, 0x6F, 0x03, 0x07, 0x03, 0x04, 0x00, 0x02, 0x00, 0xC7, 0x03, 0x41, 0x00, 0x02, 0x00, 0xE7,
++    0x03, 0x41, 0x00, 0x02, 0x01, 0x12, 0x03, 0x40, 0x00, 0x02, 0x01, 0x13, 0x03, 0x40, 0x00, 0x02,
++    0x01, 0x12, 0x03, 0x41, 0x00, 0x02, 0x01, 0x13, 0x03, 0x41, 0x00, 0x02, 0x02, 0x28, 0x03, 0x06,
++    0x00, 0x02, 0x02, 0x29, 0x03, 0x06, 0x00, 0x02, 0x00, 0xCF, 0x03, 0x01, 0x00, 0x02, 0x00, 0xEF,
++    0x03, 0x01, 0x00, 0x02, 0x00, 0x4B, 0x03, 0x41, 0x00, 0x02, 0x00, 0x6B, 0x03, 0x41, 0x00, 0x02,
++    0x21, 0x2A, 0x03, 0x23, 0x00, 0x02, 0x21, 0x2A, 0x03, 0x31, 0x00, 0x03, 0x00, 0x4C, 0x03, 0x04,
++    0x03, 0x23, 0x00, 0x03, 0x00, 0x6C, 0x03, 0x04, 0x03, 0x23, 0x00, 0x02, 0x00, 0x4D, 0x03, 0x41,
++    0x00, 0x02, 0x00, 0x6D, 0x03, 0x41, 0x00, 0x02, 0x00, 0xD5, 0x03, 0x41, 0x00, 0x02, 0x00, 0xF5,
++    0x03, 0x41, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x03, 0x03, 0x08, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x03,
++    0x03, 0x08, 0x00, 0x02, 0x01, 0x4C, 0x03, 0x40, 0x00, 0x02, 0x01, 0x4D, 0x03, 0x40, 0x00, 0x02,
++    0x01, 0x4C, 0x03, 0x41, 0x00, 0x02, 0x01, 0x4D, 0x03, 0x41, 0x00, 0x02, 0x00, 0x50, 0x03, 0x41,
++    0x00, 0x02, 0x00, 0x70, 0x03, 0x41, 0x00, 0x03, 0x00, 0x52, 0x03, 0x04, 0x03, 0x23, 0x00, 0x03,
++    0x00, 0x72, 0x03, 0x04, 0x03, 0x23, 0x00, 0x03, 0x00, 0x53, 0x03, 0x01, 0x03, 0x07, 0x00, 0x03,
++    0x00, 0x73, 0x03, 0x01, 0x03, 0x07, 0x00, 0x03, 0x00, 0x53, 0x03, 0x0C, 0x03, 0x07, 0x00, 0x03,
++    0x00, 0x73, 0x03, 0x0C, 0x03, 0x07, 0x00, 0x02, 0x1E, 0x62, 0x03, 0x07, 0x00, 0x02, 0x1E, 0x63,
++    0x03, 0x07, 0x00, 0x02, 0x01, 0x68, 0x03, 0x41, 0x00, 0x02, 0x01, 0x69, 0x03, 0x41, 0x00, 0x03,
++    0x00, 0x55, 0x03, 0x04, 0x03, 0x08, 0x00, 0x03, 0x00, 0x75, 0x03, 0x04, 0x03, 0x08, 0x00, 0x02,
++    0x00, 0x57, 0x03, 0x40, 0x00, 0x02, 0x00, 0x77, 0x03, 0x40, 0x00, 0x02, 0x00, 0x57, 0x03, 0x41,
++    0x00, 0x02, 0x00, 0x77, 0x03, 0x41, 0x00, 0x02, 0x00, 0xC2, 0x03, 0x41, 0x00, 0x02, 0x00, 0xE2,
++    0x03, 0x41, 0x00, 0x02, 0x00, 0xC2, 0x03, 0x40, 0x00, 0x02, 0x00, 0xE2, 0x03, 0x40, 0x00, 0x03,
++    0x00, 0x41, 0x03, 0x02, 0x03, 0x09, 0x00, 0x03, 0x00, 0x61, 0x03, 0x02, 0x03, 0x09, 0x00, 0x03,
++    0x00, 0x41, 0x03, 0x02, 0x03, 0x03, 0x00, 0x03, 0x00, 0x61, 0x03, 0x02, 0x03, 0x03, 0x00, 0x02,
++    0x1E, 0xA0, 0x03, 0x02, 0x00, 0x02, 0x1E, 0xA1, 0x03, 0x02, 0x00, 0x02, 0x01, 0x02, 0x03, 0x41,
++    0x00, 0x02, 0x01, 0x03, 0x03, 0x41, 0x00, 0x02, 0x01, 0x02, 0x03, 0x40, 0x00, 0x02, 0x01, 0x03,
++    0x03, 0x40, 0x00, 0x03, 0x00, 0x41, 0x03, 0x06, 0x03, 0x09, 0x00, 0x03, 0x00, 0x61, 0x03, 0x06,
++    0x03, 0x09, 0x00, 0x03, 0x00, 0x41, 0x03, 0x06, 0x03, 0x03, 0x00, 0x03, 0x00, 0x61, 0x03, 0x06,
++    0x03, 0x03, 0x00, 0x02, 0x1E, 0xA0, 0x03, 0x06, 0x00, 0x02, 0x1E, 0xA1, 0x03, 0x06, 0x00, 0x02,
++    0x00, 0xCA, 0x03, 0x41, 0x00, 0x02, 0x00, 0xEA, 0x03, 0x41, 0x00, 0x02, 0x00, 0xCA, 0x03, 0x40,
++    0x00, 0x02, 0x00, 0xEA, 0x03, 0x40, 0x00, 0x03, 0x00, 0x45, 0x03, 0x02, 0x03, 0x09, 0x00, 0x03,
++    0x00, 0x65, 0x03, 0x02, 0x03, 0x09, 0x00, 0x03, 0x00, 0x45, 0x03, 0x02, 0x03, 0x03, 0x00, 0x03,
++    0x00, 0x65, 0x03, 0x02, 0x03, 0x03, 0x00, 0x02, 0x1E, 0xB8, 0x03, 0x02, 0x00, 0x02, 0x1E, 0xB9,
++    0x03, 0x02, 0x00, 0x02, 0x00, 0xD4, 0x03, 0x41, 0x00, 0x02, 0x00, 0xF4, 0x03, 0x41, 0x00, 0x02,
++    0x00, 0xD4, 0x03, 0x40, 0x00, 0x02, 0x00, 0xF4, 0x03, 0x40, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x02,
++    0x03, 0x09, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x02, 0x03, 0x09, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x02,
++    0x03, 0x03, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x02, 0x03, 0x03, 0x00, 0x02, 0x1E, 0xCC, 0x03, 0x02,
++    0x00, 0x02, 0x1E, 0xCD, 0x03, 0x02, 0x00, 0x02, 0x01, 0xA0, 0x03, 0x01, 0x00, 0x02, 0x01, 0xA1,
++    0x03, 0x01, 0x00, 0x02, 0x01, 0xA0, 0x03, 0x00, 0x00, 0x02, 0x01, 0xA1, 0x03, 0x00, 0x00, 0x02,
++    0x1E, 0xCE, 0x03, 0x1B, 0x00, 0x02, 0x1E, 0xCF, 0x03, 0x1B, 0x00, 0x02, 0x01, 0xA0, 0x03, 0x03,
++    0x00, 0x02, 0x01, 0xA1, 0x03, 0x03, 0x00, 0x02, 0x1E, 0xCC, 0x03, 0x1B, 0x00, 0x02, 0x1E, 0xCD,
++    0x03, 0x1B, 0x00, 0x02, 0x01, 0xAF, 0x03, 0x01, 0x00, 0x02, 0x01, 0xB0, 0x03, 0x01, 0x00, 0x02,
++    0x01, 0xAF, 0x03, 0x00, 0x00, 0x02, 0x01, 0xB0, 0x03, 0x00, 0x00, 0x02, 0x1E, 0xE6, 0x03, 0x1B,
++    0x00, 0x02, 0x1E, 0xE7, 0x03, 0x1B, 0x00, 0x02, 0x01, 0xAF, 0x03, 0x03, 0x00, 0x02, 0x01, 0xB0,
++    0x03, 0x03, 0x00, 0x02, 0x1E, 0xE4, 0x03, 0x1B, 0x00, 0x02, 0x1E, 0xE5, 0x03, 0x1B, 0x00, 0x02,
++    0x00, 0x59, 0x03, 0x40, 0x00, 0x02, 0x00, 0x79, 0x03, 0x40, 0x00, 0x01, 0x00, 0xAC, 0x00, 0xC0,
++    0x00, 0xC1, 0x00, 0xC8, 0x00, 0xC9, 0x00, 0xCC, 0x00, 0xCD, 0x00, 0xD2, 0x00, 0xD3, 0x00, 0xD9,
++    0x00, 0xDA, 0x00, 0xDD, 0x00, 0xE0, 0x00, 0xE1, 0x00, 0xE8, 0x00, 0xE9, 0x00, 0xEC, 0x00, 0xED,
++    0x00, 0xF2, 0x00, 0xF3, 0x00, 0xF9, 0x00, 0xFA, 0x00, 0xFD, 0x01, 0x06, 0x01, 0x07, 0x01, 0x36,
++    0x01, 0x39, 0x01, 0x3A, 0x01, 0x43, 0x01, 0x44, 0x01, 0x54, 0x01, 0x55, 0x01, 0x5A, 0x01, 0x5B,
++    0x01, 0x79, 0x01, 0x7A, 0x01, 0xD5, 0x01, 0xD6, 0x01, 0xD7, 0x01, 0xD8, 0x01, 0xD9, 0x01, 0xDA,
++    0x01, 0xDB, 0x01, 0xDC, 0x01, 0xDE, 0x01, 0xDF, 0x01, 0xE0, 0x01, 0xE1, 0x01, 0xE8, 0x01, 0xEC,
++    0x01, 0xED, 0x01, 0xF4, 0x01, 0xF5, 0x01, 0xF8, 0x01, 0xF9, 0x01, 0xFA, 0x01, 0xFB, 0x01, 0xFC,
++    0x01, 0xFD, 0x01, 0xFE, 0x01, 0xFF, 0x02, 0x2A, 0x02, 0x2B, 0x02, 0x2C, 0x02, 0x2D, 0x02, 0x30,
++    0x02, 0x31, 0x1E, 0x08, 0x1E, 0x09, 0x1E, 0x14, 0x1E, 0x15, 0x1E, 0x16, 0x1E, 0x17, 0x1E, 0x1C,
++    0x1E, 0x1D, 0x1E, 0x2E, 0x1E, 0x2F, 0x1E, 0x30, 0x1E, 0x31, 0x1E, 0x32, 0x1E, 0x34, 0x1E, 0x38,
++    0x1E, 0x39, 0x1E, 0x3E, 0x1E, 0x3F, 0x1E, 0x4C, 0x1E, 0x4D, 0x1E, 0x4E, 0x1E, 0x4F, 0x1E, 0x50,
++    0x1E, 0x51, 0x1E, 0x52, 0x1E, 0x53, 0x1E, 0x54, 0x1E, 0x55, 0x1E, 0x5C, 0x1E, 0x5D, 0x1E, 0x64,
++    0x1E, 0x65, 0x1E, 0x66, 0x1E, 0x67, 0x1E, 0x68, 0x1E, 0x69, 0x1E, 0x78, 0x1E, 0x79, 0x1E, 0x7A,
++    0x1E, 0x7B, 0x1E, 0x80, 0x1E, 0x81, 0x1E, 0x82, 0x1E, 0x83, 0x1E, 0xA4, 0x1E, 0xA5, 0x1E, 0xA6,
++    0x1E, 0xA7, 0x1E, 0xA8, 0x1E, 0xA9, 0x1E, 0xAA, 0x1E, 0xAB, 0x1E, 0xAC, 0x1E, 0xAD, 0x1E, 0xAE,
++    0x1E, 0xAF, 0x1E, 0xB0, 0x1E, 0xB1, 0x1E, 0xB2, 0x1E, 0xB3, 0x1E, 0xB4, 0x1E, 0xB5, 0x1E, 0xB6,
++    0x1E, 0xB7, 0x1E, 0xBE, 0x1E, 0xBF, 0x1E, 0xC0, 0x1E, 0xC1, 0x1E, 0xC2, 0x1E, 0xC3, 0x1E, 0xC4,
++    0x1E, 0xC5, 0x1E, 0xC6, 0x1E, 0xC7, 0x1E, 0xD0, 0x1E, 0xD1, 0x1E, 0xD2, 0x1E, 0xD3, 0x1E, 0xD4,
++    0x1E, 0xD5, 0x1E, 0xD6, 0x1E, 0xD7, 0x1E, 0xD8, 0x1E, 0xD9, 0x1E, 0xDA, 0x1E, 0xDB, 0x1E, 0xDC,
++    0x1E, 0xDD, 0x1E, 0xDE, 0x1E, 0xDF, 0x1E, 0xE0, 0x1E, 0xE1, 0x1E, 0xE2, 0x1E, 0xE3, 0x1E, 0xE8,
+     0x1E, 0xE9, 0x1E, 0xEA, 0x1E, 0xEB, 0x1E, 0xEC, 0x1E, 0xED, 0x1E, 0xEE, 0x1E, 0xEF, 0x1E, 0xF0,
+-    0x1E, 0xF1, 0x1E, 0xF2, 0x1E, 0xF3, 0x1E, 0xF4, 0x1E, 0xF5, 0x1E, 0xF6, 0x1E, 0xF7, 0x1E, 0xF8,
+-    0x1E, 0xF9, 0x21, 0x2B, 0x00, 0x01, 0x05, 0xBA, 0x00, 0xAC, 0x01, 0x5E, 0x01, 0x64, 0x01, 0x6A,
+-    0x01, 0x70, 0x01, 0x76, 0x01, 0x7C, 0x01, 0x82, 0x01, 0x88, 0x01, 0x8E, 0x01, 0x94, 0x01, 0x9A,
+-    0x01, 0xA0, 0x01, 0xA6, 0x01, 0xAC, 0x01, 0xB2, 0x01, 0xB8, 0x01, 0xBE, 0x01, 0xC4, 0x01, 0xCA,
+-    0x01, 0xD0, 0x01, 0xD6, 0x01, 0xDC, 0x01, 0xE2, 0x01, 0xE8, 0x01, 0xEE, 0x01, 0xF4, 0x01, 0xFA,
+-    0x02, 0x00, 0x02, 0x06, 0x02, 0x0C, 0x02, 0x12, 0x02, 0x18, 0x02, 0x1E, 0x02, 0x24, 0x02, 0x2A,
+-    0x02, 0x30, 0x02, 0x38, 0x02, 0x40, 0x02, 0x46, 0x02, 0x4C, 0x02, 0x54, 0x02, 0x5C, 0x02, 0x62,
+-    0x02, 0x68, 0x02, 0x70, 0x02, 0x78, 0x02, 0x80, 0x02, 0x88, 0x02, 0x8E, 0x02, 0x94, 0x02, 0x9A,
+-    0x02, 0xA0, 0x02, 0xA6, 0x02, 0xAC, 0x02, 0xB2, 0x02, 0xB8, 0x02, 0xBE, 0x02, 0xC4, 0x02, 0xCA,
+-    0x02, 0xD0, 0x02, 0xD6, 0x02, 0xDE, 0x02, 0xE6, 0x02, 0xEE, 0x02, 0xF6, 0x02, 0xFE, 0x03, 0x06,
+-    0x03, 0x0C, 0x03, 0x12, 0x03, 0x18, 0x03, 0x1E, 0x03, 0x24, 0x03, 0x2A, 0x03, 0x30, 0x03, 0x36,
+-    0x03, 0x3C, 0x03, 0x42, 0x03, 0x48, 0x03, 0x4E, 0x03, 0x54, 0x03, 0x5A, 0x03, 0x62, 0x03, 0x6A,
+-    0x03, 0x70, 0x03, 0x76, 0x03, 0x7C, 0x03, 0x82, 0x03, 0x8A, 0x03, 0x92, 0x03, 0x98, 0x03, 0x9E,
+-    0x03, 0xA4, 0x03, 0xAA, 0x03, 0xB0, 0x03, 0xB6, 0x03, 0xBE, 0x03, 0xC6, 0x03, 0xCE, 0x03, 0xD6,
+-    0x03, 0xDE, 0x03, 0xE6, 0x03, 0xEC, 0x03, 0xF2, 0x03, 0xF8, 0x03, 0xFE, 0x04, 0x06, 0x04, 0x0E,
+-    0x04, 0x14, 0x04, 0x1A, 0x04, 0x20, 0x04, 0x26, 0x04, 0x2C, 0x04, 0x32, 0x04, 0x38, 0x04, 0x3E,
+-    0x04, 0x46, 0x04, 0x4E, 0x04, 0x56, 0x04, 0x5E, 0x04, 0x64, 0x04, 0x6A, 0x04, 0x70, 0x04, 0x76,
+-    0x04, 0x7C, 0x04, 0x82, 0x04, 0x8A, 0x04, 0x92, 0x04, 0x9A, 0x04, 0xA2, 0x04, 0xA8, 0x04, 0xAE,
+-    0x04, 0xB4, 0x04, 0xBA, 0x04, 0xC0, 0x04, 0xC6, 0x04, 0xCE, 0x04, 0xD6, 0x04, 0xDE, 0x04, 0xE6,
+-    0x04, 0xEC, 0x04, 0xF2, 0x04, 0xF8, 0x04, 0xFE, 0x05, 0x04, 0x05, 0x0A, 0x05, 0x12, 0x05, 0x1A,
+-    0x05, 0x22, 0x05, 0x2A, 0x05, 0x30, 0x05, 0x36, 0x05, 0x3C, 0x05, 0x42, 0x05, 0x48, 0x05, 0x4E,
+-    0x05, 0x54, 0x05, 0x5A, 0x05, 0x60, 0x05, 0x66, 0x05, 0x6C, 0x05, 0x72, 0x05, 0x78, 0x05, 0x7E,
+-    0x05, 0x84, 0x05, 0x8A, 0x05, 0x90, 0x05, 0x96, 0x05, 0x9C, 0x05, 0xA2, 0x05, 0xA8, 0x05, 0xAE,
+-    0x05, 0xB4, 0x00, 0x02, 0x00, 0x41, 0x03, 0x40, 0x00, 0x02, 0x00, 0x41, 0x03, 0x41, 0x00, 0x02,
+-    0x00, 0x45, 0x03, 0x40, 0x00, 0x02, 0x00, 0x45, 0x03, 0x41, 0x00, 0x02, 0x00, 0x49, 0x03, 0x40,
+-    0x00, 0x02, 0x00, 0x49, 0x03, 0x41, 0x00, 0x02, 0x00, 0x4F, 0x03, 0x40, 0x00, 0x02, 0x00, 0x4F,
+-    0x03, 0x41, 0x00, 0x02, 0x00, 0x55, 0x03, 0x40, 0x00, 0x02, 0x00, 0x55, 0x03, 0x41, 0x00, 0x02,
+-    0x00, 0x59, 0x03, 0x41, 0x00, 0x02, 0x00, 0x61, 0x03, 0x40, 0x00, 0x02, 0x00, 0x61, 0x03, 0x41,
+-    0x00, 0x02, 0x00, 0x65, 0x03, 0x40, 0x00, 0x02, 0x00, 0x65, 0x03, 0x41, 0x00, 0x02, 0x00, 0x69,
+-    0x03, 0x40, 0x00, 0x02, 0x00, 0x69, 0x03, 0x41, 0x00, 0x02, 0x00, 0x6F, 0x03, 0x40, 0x00, 0x02,
+-    0x00, 0x6F, 0x03, 0x41, 0x00, 0x02, 0x00, 0x75, 0x03, 0x40, 0x00, 0x02, 0x00, 0x75, 0x03, 0x41,
+-    0x00, 0x02, 0x00, 0x79, 0x03, 0x41, 0x00, 0x02, 0x00, 0x43, 0x03, 0x41, 0x00, 0x02, 0x00, 0x63,
+-    0x03, 0x41, 0x00, 0x02, 0x21, 0x2A, 0x03, 0x27, 0x00, 0x02, 0x00, 0x4C, 0x03, 0x41, 0x00, 0x02,
+-    0x00, 0x6C, 0x03, 0x41, 0x00, 0x02, 0x00, 0x4E, 0x03, 0x41, 0x00, 0x02, 0x00, 0x6E, 0x03, 0x41,
+-    0x00, 0x02, 0x00, 0x52, 0x03, 0x41, 0x00, 0x02, 0x00, 0x72, 0x03, 0x41, 0x00, 0x02, 0x00, 0x53,
+-    0x03, 0x41, 0x00, 0x02, 0x00, 0x73, 0x03, 0x41, 0x00, 0x02, 0x00, 0x5A, 0x03, 0x41, 0x00, 0x02,
+-    0x00, 0x7A, 0x03, 0x41, 0x00, 0x03, 0x00, 0x55, 0x03, 0x08, 0x03, 0x04, 0x00, 0x03, 0x00, 0x75,
+-    0x03, 0x08, 0x03, 0x04, 0x00, 0x02, 0x00, 0xDC, 0x03, 0x01, 0x00, 0x02, 0x00, 0xFC, 0x03, 0x01,
+-    0x00, 0x03, 0x00, 0x55, 0x03, 0x08, 0x03, 0x0C, 0x00, 0x03, 0x00, 0x75, 0x03, 0x08, 0x03, 0x0C,
+-    0x00, 0x02, 0x00, 0xDC, 0x03, 0x40, 0x00, 0x02, 0x00, 0xFC, 0x03, 0x40, 0x00, 0x03, 0x00, 0x41,
+-    0x03, 0x08, 0x03, 0x04, 0x00, 0x03, 0x00, 0x61, 0x03, 0x08, 0x03, 0x04, 0x00, 0x03, 0x00, 0x41,
+-    0x03, 0x07, 0x03, 0x04, 0x00, 0x03, 0x00, 0x61, 0x03, 0x07, 0x03, 0x04, 0x00, 0x02, 0x21, 0x2A,
+-    0x03, 0x0C, 0x00, 0x02, 0x01, 0xEA, 0x03, 0x04, 0x00, 0x02, 0x01, 0xEB, 0x03, 0x04, 0x00, 0x02,
+-    0x00, 0x47, 0x03, 0x41, 0x00, 0x02, 0x00, 0x67, 0x03, 0x41, 0x00, 0x02, 0x00, 0x4E, 0x03, 0x40,
+-    0x00, 0x02, 0x00, 0x6E, 0x03, 0x40, 0x00, 0x02, 0x00, 0xC5, 0x03, 0x41, 0x00, 0x02, 0x00, 0xE5,
+-    0x03, 0x41, 0x00, 0x02, 0x00, 0xC6, 0x03, 0x41, 0x00, 0x02, 0x00, 0xE6, 0x03, 0x41, 0x00, 0x02,
+-    0x00, 0xD8, 0x03, 0x41, 0x00, 0x02, 0x00, 0xF8, 0x03, 0x41, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x08,
+-    0x03, 0x04, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x08, 0x03, 0x04, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x03,
+-    0x03, 0x04, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x03, 0x03, 0x04, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x07,
+-    0x03, 0x04, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x07, 0x03, 0x04, 0x00, 0x02, 0x00, 0xC7, 0x03, 0x41,
+-    0x00, 0x02, 0x00, 0xE7, 0x03, 0x41, 0x00, 0x02, 0x01, 0x12, 0x03, 0x40, 0x00, 0x02, 0x01, 0x13,
+-    0x03, 0x40, 0x00, 0x02, 0x01, 0x12, 0x03, 0x41, 0x00, 0x02, 0x01, 0x13, 0x03, 0x41, 0x00, 0x02,
+-    0x02, 0x28, 0x03, 0x06, 0x00, 0x02, 0x02, 0x29, 0x03, 0x06, 0x00, 0x02, 0x00, 0xCF, 0x03, 0x01,
+-    0x00, 0x02, 0x00, 0xEF, 0x03, 0x01, 0x00, 0x02, 0x00, 0x4B, 0x03, 0x41, 0x00, 0x02, 0x00, 0x6B,
+-    0x03, 0x41, 0x00, 0x02, 0x21, 0x2A, 0x03, 0x23, 0x00, 0x02, 0x21, 0x2A, 0x03, 0x31, 0x00, 0x03,
+-    0x00, 0x4C, 0x03, 0x04, 0x03, 0x23, 0x00, 0x03, 0x00, 0x6C, 0x03, 0x04, 0x03, 0x23, 0x00, 0x02,
+-    0x00, 0x4D, 0x03, 0x41, 0x00, 0x02, 0x00, 0x6D, 0x03, 0x41, 0x00, 0x02, 0x00, 0xD5, 0x03, 0x41,
+-    0x00, 0x02, 0x00, 0xF5, 0x03, 0x41, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x03, 0x03, 0x08, 0x00, 0x03,
+-    0x00, 0x6F, 0x03, 0x03, 0x03, 0x08, 0x00, 0x02, 0x01, 0x4C, 0x03, 0x40, 0x00, 0x02, 0x01, 0x4D,
+-    0x03, 0x40, 0x00, 0x02, 0x01, 0x4C, 0x03, 0x41, 0x00, 0x02, 0x01, 0x4D, 0x03, 0x41, 0x00, 0x02,
+-    0x00, 0x50, 0x03, 0x41, 0x00, 0x02, 0x00, 0x70, 0x03, 0x41, 0x00, 0x03, 0x00, 0x52, 0x03, 0x04,
+-    0x03, 0x23, 0x00, 0x03, 0x00, 0x72, 0x03, 0x04, 0x03, 0x23, 0x00, 0x03, 0x00, 0x53, 0x03, 0x01,
+-    0x03, 0x07, 0x00, 0x03, 0x00, 0x73, 0x03, 0x01, 0x03, 0x07, 0x00, 0x03, 0x00, 0x53, 0x03, 0x0C,
+-    0x03, 0x07, 0x00, 0x03, 0x00, 0x73, 0x03, 0x0C, 0x03, 0x07, 0x00, 0x02, 0x1E, 0x62, 0x03, 0x07,
+-    0x00, 0x02, 0x1E, 0x63, 0x03, 0x07, 0x00, 0x02, 0x01, 0x68, 0x03, 0x41, 0x00, 0x02, 0x01, 0x69,
+-    0x03, 0x41, 0x00, 0x03, 0x00, 0x55, 0x03, 0x04, 0x03, 0x08, 0x00, 0x03, 0x00, 0x75, 0x03, 0x04,
+-    0x03, 0x08, 0x00, 0x02, 0x00, 0x57, 0x03, 0x40, 0x00, 0x02, 0x00, 0x77, 0x03, 0x40, 0x00, 0x02,
+-    0x00, 0x57, 0x03, 0x41, 0x00, 0x02, 0x00, 0x77, 0x03, 0x41, 0x00, 0x02, 0x00, 0xC2, 0x03, 0x41,
+-    0x00, 0x02, 0x00, 0xE2, 0x03, 0x41, 0x00, 0x02, 0x00, 0xC2, 0x03, 0x40, 0x00, 0x02, 0x00, 0xE2,
+-    0x03, 0x40, 0x00, 0x03, 0x00, 0x41, 0x03, 0x02, 0x03, 0x09, 0x00, 0x03, 0x00, 0x61, 0x03, 0x02,
+-    0x03, 0x09, 0x00, 0x03, 0x00, 0x41, 0x03, 0x02, 0x03, 0x03, 0x00, 0x03, 0x00, 0x61, 0x03, 0x02,
+-    0x03, 0x03, 0x00, 0x02, 0x1E, 0xA0, 0x03, 0x02, 0x00, 0x02, 0x1E, 0xA1, 0x03, 0x02, 0x00, 0x02,
+-    0x01, 0x02, 0x03, 0x41, 0x00, 0x02, 0x01, 0x03, 0x03, 0x41, 0x00, 0x02, 0x01, 0x02, 0x03, 0x40,
+-    0x00, 0x02, 0x01, 0x03, 0x03, 0x40, 0x00, 0x03, 0x00, 0x41, 0x03, 0x06, 0x03, 0x09, 0x00, 0x03,
+-    0x00, 0x61, 0x03, 0x06, 0x03, 0x09, 0x00, 0x03, 0x00, 0x41, 0x03, 0x06, 0x03, 0x03, 0x00, 0x03,
+-    0x00, 0x61, 0x03, 0x06, 0x03, 0x03, 0x00, 0x02, 0x1E, 0xA0, 0x03, 0x06, 0x00, 0x02, 0x1E, 0xA1,
+-    0x03, 0x06, 0x00, 0x02, 0x00, 0xCA, 0x03, 0x41, 0x00, 0x02, 0x00, 0xEA, 0x03, 0x41, 0x00, 0x02,
+-    0x00, 0xCA, 0x03, 0x40, 0x00, 0x02, 0x00, 0xEA, 0x03, 0x40, 0x00, 0x03, 0x00, 0x45, 0x03, 0x02,
+-    0x03, 0x09, 0x00, 0x03, 0x00, 0x65, 0x03, 0x02, 0x03, 0x09, 0x00, 0x03, 0x00, 0x45, 0x03, 0x02,
+-    0x03, 0x03, 0x00, 0x03, 0x00, 0x65, 0x03, 0x02, 0x03, 0x03, 0x00, 0x02, 0x1E, 0xB8, 0x03, 0x02,
+-    0x00, 0x02, 0x1E, 0xB9, 0x03, 0x02, 0x00, 0x02, 0x00, 0xD4, 0x03, 0x41, 0x00, 0x02, 0x00, 0xF4,
+-    0x03, 0x41, 0x00, 0x02, 0x00, 0xD4, 0x03, 0x40, 0x00, 0x02, 0x00, 0xF4, 0x03, 0x40, 0x00, 0x03,
+-    0x00, 0x4F, 0x03, 0x02, 0x03, 0x09, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x02, 0x03, 0x09, 0x00, 0x03,
+-    0x00, 0x4F, 0x03, 0x02, 0x03, 0x03, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x02, 0x03, 0x03, 0x00, 0x02,
+-    0x1E, 0xCC, 0x03, 0x02, 0x00, 0x02, 0x1E, 0xCD, 0x03, 0x02, 0x00, 0x02, 0x01, 0xA0, 0x03, 0x01,
+-    0x00, 0x02, 0x01, 0xA1, 0x03, 0x01, 0x00, 0x02, 0x01, 0xA0, 0x03, 0x00, 0x00, 0x02, 0x01, 0xA1,
+-    0x03, 0x00, 0x00, 0x02, 0x1E, 0xCE, 0x03, 0x1B, 0x00, 0x02, 0x1E, 0xCF, 0x03, 0x1B, 0x00, 0x02,
+-    0x01, 0xA0, 0x03, 0x03, 0x00, 0x02, 0x01, 0xA1, 0x03, 0x03, 0x00, 0x02, 0x1E, 0xCC, 0x03, 0x1B,
+-    0x00, 0x02, 0x1E, 0xCD, 0x03, 0x1B, 0x00, 0x02, 0x01, 0xAF, 0x03, 0x01, 0x00, 0x02, 0x01, 0xB0,
+-    0x03, 0x01, 0x00, 0x02, 0x01, 0xAF, 0x03, 0x00, 0x00, 0x02, 0x01, 0xB0, 0x03, 0x00, 0x00, 0x02,
+-    0x1E, 0xE6, 0x03, 0x1B, 0x00, 0x02, 0x1E, 0xE7, 0x03, 0x1B, 0x00, 0x02, 0x01, 0xAF, 0x03, 0x03,
+-    0x00, 0x02, 0x01, 0xB0, 0x03, 0x03, 0x00, 0x02, 0x1E, 0xE4, 0x03, 0x1B, 0x00, 0x02, 0x1E, 0xE5,
+-    0x03, 0x1B, 0x00, 0x02, 0x00, 0x59, 0x03, 0x40, 0x00, 0x02, 0x00, 0x79, 0x03, 0x40, 0x00, 0x01,
+-    0x00, 0xAC, 0x00, 0xC0, 0x00, 0xC1, 0x00, 0xC8, 0x00, 0xC9, 0x00, 0xCC, 0x00, 0xCD, 0x00, 0xD2,
+-    0x00, 0xD3, 0x00, 0xD9, 0x00, 0xDA, 0x00, 0xDD, 0x00, 0xE0, 0x00, 0xE1, 0x00, 0xE8, 0x00, 0xE9,
+-    0x00, 0xEC, 0x00, 0xED, 0x00, 0xF2, 0x00, 0xF3, 0x00, 0xF9, 0x00, 0xFA, 0x00, 0xFD, 0x01, 0x06,
+-    0x01, 0x07, 0x01, 0x36, 0x01, 0x39, 0x01, 0x3A, 0x01, 0x43, 0x01, 0x44, 0x01, 0x54, 0x01, 0x55,
+-    0x01, 0x5A, 0x01, 0x5B, 0x01, 0x79, 0x01, 0x7A, 0x01, 0xD5, 0x01, 0xD6, 0x01, 0xD7, 0x01, 0xD8,
+-    0x01, 0xD9, 0x01, 0xDA, 0x01, 0xDB, 0x01, 0xDC, 0x01, 0xDE, 0x01, 0xDF, 0x01, 0xE0, 0x01, 0xE1,
+-    0x01, 0xE8, 0x01, 0xEC, 0x01, 0xED, 0x01, 0xF4, 0x01, 0xF5, 0x01, 0xF8, 0x01, 0xF9, 0x01, 0xFA,
+-    0x01, 0xFB, 0x01, 0xFC, 0x01, 0xFD, 0x01, 0xFE, 0x01, 0xFF, 0x02, 0x2A, 0x02, 0x2B, 0x02, 0x2C,
+-    0x02, 0x2D, 0x02, 0x30, 0x02, 0x31, 0x1E, 0x08, 0x1E, 0x09, 0x1E, 0x14, 0x1E, 0x15, 0x1E, 0x16,
+-    0x1E, 0x17, 0x1E, 0x1C, 0x1E, 0x1D, 0x1E, 0x2E, 0x1E, 0x2F, 0x1E, 0x30, 0x1E, 0x31, 0x1E, 0x32,
+-    0x1E, 0x34, 0x1E, 0x38, 0x1E, 0x39, 0x1E, 0x3E, 0x1E, 0x3F, 0x1E, 0x4C, 0x1E, 0x4D, 0x1E, 0x4E,
+-    0x1E, 0x4F, 0x1E, 0x50, 0x1E, 0x51, 0x1E, 0x52, 0x1E, 0x53, 0x1E, 0x54, 0x1E, 0x55, 0x1E, 0x5C,
+-    0x1E, 0x5D, 0x1E, 0x64, 0x1E, 0x65, 0x1E, 0x66, 0x1E, 0x67, 0x1E, 0x68, 0x1E, 0x69, 0x1E, 0x78,
+-    0x1E, 0x79, 0x1E, 0x7A, 0x1E, 0x7B, 0x1E, 0x80, 0x1E, 0x81, 0x1E, 0x82, 0x1E, 0x83, 0x1E, 0xA4,
+-    0x1E, 0xA5, 0x1E, 0xA6, 0x1E, 0xA7, 0x1E, 0xA8, 0x1E, 0xA9, 0x1E, 0xAA, 0x1E, 0xAB, 0x1E, 0xAC,
+-    0x1E, 0xAD, 0x1E, 0xAE, 0x1E, 0xAF, 0x1E, 0xB0, 0x1E, 0xB1, 0x1E, 0xB2, 0x1E, 0xB3, 0x1E, 0xB4,
+-    0x1E, 0xB5, 0x1E, 0xB6, 0x1E, 0xB7, 0x1E, 0xBE, 0x1E, 0xBF, 0x1E, 0xC0, 0x1E, 0xC1, 0x1E, 0xC2,
+-    0x1E, 0xC3, 0x1E, 0xC4, 0x1E, 0xC5, 0x1E, 0xC6, 0x1E, 0xC7, 0x1E, 0xD0, 0x1E, 0xD1, 0x1E, 0xD2,
+-    0x1E, 0xD3, 0x1E, 0xD4, 0x1E, 0xD5, 0x1E, 0xD6, 0x1E, 0xD7, 0x1E, 0xD8, 0x1E, 0xD9, 0x1E, 0xDA,
++    0x1E, 0xF1, 0x1E, 0xF2, 0x1E, 0xF3, 0x00, 0x01, 0x02, 0xFC, 0x00, 0x4F, 0x00, 0xA4, 0x00, 0xAA,
++    0x00, 0xB0, 0x00, 0xB8, 0x00, 0xC0, 0x00, 0xC8, 0x00, 0xD0, 0x00, 0xD6, 0x00, 0xDE, 0x00, 0xE4,
++    0x00, 0xEA, 0x00, 0xF2, 0x00, 0xFA, 0x01, 0x02, 0x01, 0x0A, 0x01, 0x12, 0x01, 0x1A, 0x01, 0x20,
++    0x01, 0x26, 0x01, 0x2C, 0x01, 0x34, 0x01, 0x3C, 0x01, 0x44, 0x01, 0x4C, 0x01, 0x54, 0x01, 0x5C,
++    0x01, 0x64, 0x01, 0x6C, 0x01, 0x74, 0x01, 0x7C, 0x01, 0x84, 0x01, 0x8C, 0x01, 0x94, 0x01, 0x9C,
++    0x01, 0xA4, 0x01, 0xAC, 0x01, 0xB4, 0x01, 0xBC, 0x01, 0xC4, 0x01, 0xCC, 0x01, 0xD4, 0x01, 0xDC,
++    0x01, 0xE4, 0x01, 0xEC, 0x01, 0xF4, 0x01, 0xFC, 0x02, 0x04, 0x02, 0x0C, 0x02, 0x14, 0x02, 0x1C,
++    0x02, 0x24, 0x02, 0x2C, 0x02, 0x34, 0x02, 0x3C, 0x02, 0x44, 0x02, 0x4C, 0x02, 0x54, 0x02, 0x5C,
++    0x02, 0x64, 0x02, 0x6C, 0x02, 0x72, 0x02, 0x78, 0x02, 0x7E, 0x02, 0x84, 0x02, 0x8C, 0x02, 0x94,
++    0x02, 0x9C, 0x02, 0xA4, 0x02, 0xAC, 0x02, 0xB4, 0x02, 0xBA, 0x02, 0xC0, 0x02, 0xC6, 0x02, 0xCC,
++    0x02, 0xD4, 0x02, 0xDC, 0x02, 0xE4, 0x02, 0xEC, 0x02, 0xF4, 0x00, 0x02, 0x00, 0xDC, 0x03, 0x41,
++    0x00, 0x02, 0x00, 0xFC, 0x03, 0x41, 0x00, 0x03, 0x00, 0x55, 0x03, 0x08, 0x03, 0x00, 0x00, 0x03,
++    0x00, 0x75, 0x03, 0x08, 0x03, 0x00, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x04, 0x03, 0x28, 0x00, 0x03,
++    0x00, 0x6F, 0x03, 0x04, 0x03, 0x28, 0x00, 0x02, 0x21, 0x2B, 0x03, 0x01, 0x00, 0x03, 0x00, 0x61,
++    0x03, 0x0A, 0x03, 0x01, 0x00, 0x02, 0x01, 0x06, 0x03, 0x27, 0x00, 0x02, 0x01, 0x07, 0x03, 0x27,
++    0x00, 0x03, 0x00, 0x45, 0x03, 0x04, 0x03, 0x00, 0x00, 0x03, 0x00, 0x65, 0x03, 0x04, 0x03, 0x00,
++    0x00, 0x03, 0x00, 0x45, 0x03, 0x04, 0x03, 0x01, 0x00, 0x03, 0x00, 0x65, 0x03, 0x04, 0x03, 0x01,
++    0x00, 0x03, 0x00, 0x45, 0x03, 0x06, 0x03, 0x27, 0x00, 0x03, 0x00, 0x65, 0x03, 0x06, 0x03, 0x27,
++    0x00, 0x02, 0x00, 0xCF, 0x03, 0x41, 0x00, 0x02, 0x00, 0xEF, 0x03, 0x41, 0x00, 0x02, 0x21, 0x2A,
++    0x03, 0x01, 0x00, 0x03, 0x00, 0x4C, 0x03, 0x23, 0x03, 0x04, 0x00, 0x03, 0x00, 0x6C, 0x03, 0x23,
++    0x03, 0x04, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x03, 0x03, 0x01, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x03,
++    0x03, 0x01, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x04, 0x03, 0x00, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x04,
++    0x03, 0x00, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x04, 0x03, 0x01, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x04,
++    0x03, 0x01, 0x00, 0x03, 0x00, 0x52, 0x03, 0x23, 0x03, 0x04, 0x00, 0x03, 0x00, 0x72, 0x03, 0x23,
++    0x03, 0x04, 0x00, 0x03, 0x00, 0x53, 0x03, 0x41, 0x03, 0x07, 0x00, 0x03, 0x00, 0x73, 0x03, 0x41,
++    0x03, 0x07, 0x00, 0x03, 0x00, 0x53, 0x03, 0x07, 0x03, 0x23, 0x00, 0x03, 0x00, 0x73, 0x03, 0x07,
++    0x03, 0x23, 0x00, 0x03, 0x00, 0x55, 0x03, 0x03, 0x03, 0x01, 0x00, 0x03, 0x00, 0x75, 0x03, 0x03,
++    0x03, 0x01, 0x00, 0x03, 0x00, 0x41, 0x03, 0x02, 0x03, 0x01, 0x00, 0x03, 0x00, 0x61, 0x03, 0x02,
++    0x03, 0x01, 0x00, 0x03, 0x00, 0x41, 0x03, 0x02, 0x03, 0x00, 0x00, 0x03, 0x00, 0x61, 0x03, 0x02,
++    0x03, 0x00, 0x00, 0x03, 0x00, 0x41, 0x03, 0x02, 0x03, 0x23, 0x00, 0x03, 0x00, 0x61, 0x03, 0x02,
++    0x03, 0x23, 0x00, 0x03, 0x00, 0x41, 0x03, 0x06, 0x03, 0x01, 0x00, 0x03, 0x00, 0x61, 0x03, 0x06,
++    0x03, 0x01, 0x00, 0x03, 0x00, 0x41, 0x03, 0x06, 0x03, 0x00, 0x00, 0x03, 0x00, 0x61, 0x03, 0x06,
++    0x03, 0x00, 0x00, 0x03, 0x00, 0x41, 0x03, 0x06, 0x03, 0x23, 0x00, 0x03, 0x00, 0x61, 0x03, 0x06,
++    0x03, 0x23, 0x00, 0x03, 0x00, 0x45, 0x03, 0x02, 0x03, 0x01, 0x00, 0x03, 0x00, 0x65, 0x03, 0x02,
++    0x03, 0x01, 0x00, 0x03, 0x00, 0x45, 0x03, 0x02, 0x03, 0x00, 0x00, 0x03, 0x00, 0x65, 0x03, 0x02,
++    0x03, 0x00, 0x00, 0x03, 0x00, 0x45, 0x03, 0x02, 0x03, 0x23, 0x00, 0x03, 0x00, 0x65, 0x03, 0x02,
++    0x03, 0x23, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x02, 0x03, 0x01, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x02,
++    0x03, 0x01, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x02, 0x03, 0x00, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x02,
++    0x03, 0x00, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x02, 0x03, 0x23, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x02,
++    0x03, 0x23, 0x00, 0x02, 0x01, 0xA0, 0x03, 0x41, 0x00, 0x02, 0x01, 0xA1, 0x03, 0x41, 0x00, 0x02,
++    0x01, 0xA0, 0x03, 0x40, 0x00, 0x02, 0x01, 0xA1, 0x03, 0x40, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x09,
++    0x03, 0x1B, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x09, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x03,
++    0x03, 0x1B, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x03, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x1B,
++    0x03, 0x23, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x1B, 0x03, 0x23, 0x00, 0x02, 0x01, 0xAF, 0x03, 0x41,
++    0x00, 0x02, 0x01, 0xB0, 0x03, 0x41, 0x00, 0x02, 0x01, 0xAF, 0x03, 0x40, 0x00, 0x02, 0x01, 0xB0,
++    0x03, 0x40, 0x00, 0x03, 0x00, 0x55, 0x03, 0x09, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x75, 0x03, 0x09,
++    0x03, 0x1B, 0x00, 0x03, 0x00, 0x55, 0x03, 0x03, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x75, 0x03, 0x03,
++    0x03, 0x1B, 0x00, 0x03, 0x00, 0x55, 0x03, 0x1B, 0x03, 0x23, 0x00, 0x03, 0x00, 0x75, 0x03, 0x1B,
++    0x03, 0x23, 0x00, 0x01, 0x00, 0x4F, 0x01, 0xD7, 0x01, 0xD8, 0x01, 0xDB, 0x01, 0xDC, 0x01, 0xEC,
++    0x01, 0xED, 0x01, 0xFA, 0x01, 0xFB, 0x1E, 0x08, 0x1E, 0x09, 0x1E, 0x14, 0x1E, 0x15, 0x1E, 0x16,
++    0x1E, 0x17, 0x1E, 0x1C, 0x1E, 0x1D, 0x1E, 0x2E, 0x1E, 0x2F, 0x1E, 0x30, 0x1E, 0x38, 0x1E, 0x39,
++    0x1E, 0x4C, 0x1E, 0x4D, 0x1E, 0x50, 0x1E, 0x51, 0x1E, 0x52, 0x1E, 0x53, 0x1E, 0x5C, 0x1E, 0x5D,
++    0x1E, 0x64, 0x1E, 0x65, 0x1E, 0x68, 0x1E, 0x69, 0x1E, 0x78, 0x1E, 0x79, 0x1E, 0xA4, 0x1E, 0xA5,
++    0x1E, 0xA6, 0x1E, 0xA7, 0x1E, 0xAC, 0x1E, 0xAD, 0x1E, 0xAE, 0x1E, 0xAF, 0x1E, 0xB0, 0x1E, 0xB1,
++    0x1E, 0xB6, 0x1E, 0xB7, 0x1E, 0xBE, 0x1E, 0xBF, 0x1E, 0xC0, 0x1E, 0xC1, 0x1E, 0xC6, 0x1E, 0xC7,
++    0x1E, 0xD0, 0x1E, 0xD1, 0x1E, 0xD2, 0x1E, 0xD3, 0x1E, 0xD8, 0x1E, 0xD9, 0x1E, 0xDA, 0x1E, 0xDB,
++    0x1E, 0xDC, 0x1E, 0xDD, 0x1E, 0xDE, 0x1E, 0xDF, 0x1E, 0xE0, 0x1E, 0xE1, 0x1E, 0xE2, 0x1E, 0xE3,
++    0x1E, 0xE8, 0x1E, 0xE9, 0x1E, 0xEA, 0x1E, 0xEB, 0x1E, 0xEC, 0x1E, 0xED, 0x1E, 0xEE, 0x1E, 0xEF,
++    0x1E, 0xF0, 0x1E, 0xF1, 0x00, 0x01, 0x02, 0xDC, 0x00, 0x49, 0x00, 0x98, 0x00, 0xA0, 0x00, 0xA8,
++    0x00, 0xB0, 0x00, 0xB8, 0x00, 0xC0, 0x00, 0xC8, 0x00, 0xCE, 0x00, 0xD6, 0x00, 0xDE, 0x00, 0xE6,
++    0x00, 0xEE, 0x00, 0xF6, 0x00, 0xFE, 0x01, 0x06, 0x01, 0x0E, 0x01, 0x16, 0x01, 0x1E, 0x01, 0x26,
++    0x01, 0x2C, 0x01, 0x34, 0x01, 0x3C, 0x01, 0x44, 0x01, 0x4C, 0x01, 0x54, 0x01, 0x5C, 0x01, 0x64,
++    0x01, 0x6C, 0x01, 0x74, 0x01, 0x7C, 0x01, 0x84, 0x01, 0x8C, 0x01, 0x94, 0x01, 0x9C, 0x01, 0xA4,
++    0x01, 0xAC, 0x01, 0xB4, 0x01, 0xBC, 0x01, 0xC4, 0x01, 0xCC, 0x01, 0xD4, 0x01, 0xDC, 0x01, 0xE4,
++    0x01, 0xEC, 0x01, 0xF4, 0x01, 0xFC, 0x02, 0x04, 0x02, 0x0C, 0x02, 0x14, 0x02, 0x1C, 0x02, 0x24,
++    0x02, 0x2C, 0x02, 0x34, 0x02, 0x3C, 0x02, 0x44, 0x02, 0x4C, 0x02, 0x54, 0x02, 0x5C, 0x02, 0x64,
++    0x02, 0x6C, 0x02, 0x74, 0x02, 0x7C, 0x02, 0x84, 0x02, 0x8C, 0x02, 0x94, 0x02, 0x9C, 0x02, 0xA4,
++    0x02, 0xAC, 0x02, 0xB4, 0x02, 0xBC, 0x02, 0xC4, 0x02, 0xCC, 0x02, 0xD4, 0x00, 0x03, 0x00, 0x55,
++    0x03, 0x08, 0x03, 0x01, 0x00, 0x03, 0x00, 0x75, 0x03, 0x08, 0x03, 0x01, 0x00, 0x03, 0x00, 0x55,
++    0x03, 0x08, 0x03, 0x40, 0x00, 0x03, 0x00, 0x75, 0x03, 0x08, 0x03, 0x40, 0x00, 0x03, 0x00, 0x4F,
++    0x03, 0x28, 0x03, 0x04, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x28, 0x03, 0x04, 0x00, 0x02, 0x21, 0x2B,
++    0x03, 0x41, 0x00, 0x03, 0x00, 0x61, 0x03, 0x0A, 0x03, 0x41, 0x00, 0x03, 0x00, 0x43, 0x03, 0x01,
++    0x03, 0x27, 0x00, 0x03, 0x00, 0x63, 0x03, 0x01, 0x03, 0x27, 0x00, 0x03, 0x00, 0x45, 0x03, 0x04,
++    0x03, 0x40, 0x00, 0x03, 0x00, 0x65, 0x03, 0x04, 0x03, 0x40, 0x00, 0x03, 0x00, 0x45, 0x03, 0x04,
++    0x03, 0x41, 0x00, 0x03, 0x00, 0x65, 0x03, 0x04, 0x03, 0x41, 0x00, 0x03, 0x00, 0x45, 0x03, 0x27,
++    0x03, 0x06, 0x00, 0x03, 0x00, 0x65, 0x03, 0x27, 0x03, 0x06, 0x00, 0x03, 0x00, 0x49, 0x03, 0x08,
++    0x03, 0x01, 0x00, 0x03, 0x00, 0x69, 0x03, 0x08, 0x03, 0x01, 0x00, 0x02, 0x21, 0x2A, 0x03, 0x41,
++    0x00, 0x03, 0x00, 0x4F, 0x03, 0x03, 0x03, 0x41, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x03, 0x03, 0x41,
++    0x00, 0x03, 0x00, 0x4F, 0x03, 0x04, 0x03, 0x40, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x04, 0x03, 0x40,
++    0x00, 0x03, 0x00, 0x4F, 0x03, 0x04, 0x03, 0x41, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x04, 0x03, 0x41,
++    0x00, 0x03, 0x00, 0x53, 0x03, 0x23, 0x03, 0x07, 0x00, 0x03, 0x00, 0x73, 0x03, 0x23, 0x03, 0x07,
++    0x00, 0x03, 0x00, 0x55, 0x03, 0x03, 0x03, 0x41, 0x00, 0x03, 0x00, 0x75, 0x03, 0x03, 0x03, 0x41,
++    0x00, 0x03, 0x00, 0x41, 0x03, 0x02, 0x03, 0x41, 0x00, 0x03, 0x00, 0x61, 0x03, 0x02, 0x03, 0x41,
++    0x00, 0x03, 0x00, 0x41, 0x03, 0x02, 0x03, 0x40, 0x00, 0x03, 0x00, 0x61, 0x03, 0x02, 0x03, 0x40,
++    0x00, 0x03, 0x00, 0x41, 0x03, 0x23, 0x03, 0x02, 0x00, 0x03, 0x00, 0x61, 0x03, 0x23, 0x03, 0x02,
++    0x00, 0x03, 0x00, 0x41, 0x03, 0x06, 0x03, 0x41, 0x00, 0x03, 0x00, 0x61, 0x03, 0x06, 0x03, 0x41,
++    0x00, 0x03, 0x00, 0x41, 0x03, 0x06, 0x03, 0x40, 0x00, 0x03, 0x00, 0x61, 0x03, 0x06, 0x03, 0x40,
++    0x00, 0x03, 0x00, 0x41, 0x03, 0x23, 0x03, 0x06, 0x00, 0x03, 0x00, 0x61, 0x03, 0x23, 0x03, 0x06,
++    0x00, 0x03, 0x00, 0x45, 0x03, 0x02, 0x03, 0x41, 0x00, 0x03, 0x00, 0x65, 0x03, 0x02, 0x03, 0x41,
++    0x00, 0x03, 0x00, 0x45, 0x03, 0x02, 0x03, 0x40, 0x00, 0x03, 0x00, 0x65, 0x03, 0x02, 0x03, 0x40,
++    0x00, 0x03, 0x00, 0x45, 0x03, 0x23, 0x03, 0x02, 0x00, 0x03, 0x00, 0x65, 0x03, 0x23, 0x03, 0x02,
++    0x00, 0x03, 0x00, 0x4F, 0x03, 0x02, 0x03, 0x41, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x02, 0x03, 0x41,
++    0x00, 0x03, 0x00, 0x4F, 0x03, 0x02, 0x03, 0x40, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x02, 0x03, 0x40,
++    0x00, 0x03, 0x00, 0x4F, 0x03, 0x23, 0x03, 0x02, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x23, 0x03, 0x02,
++    0x00, 0x03, 0x00, 0x4F, 0x03, 0x01, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x01, 0x03, 0x1B,
++    0x00, 0x03, 0x00, 0x4F, 0x03, 0x00, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x00, 0x03, 0x1B,
++    0x00, 0x03, 0x00, 0x4F, 0x03, 0x1B, 0x03, 0x09, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x1B, 0x03, 0x09,
++    0x00, 0x03, 0x00, 0x4F, 0x03, 0x1B, 0x03, 0x03, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x1B, 0x03, 0x03,
++    0x00, 0x03, 0x00, 0x4F, 0x03, 0x23, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x23, 0x03, 0x1B,
++    0x00, 0x03, 0x00, 0x55, 0x03, 0x01, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x75, 0x03, 0x01, 0x03, 0x1B,
++    0x00, 0x03, 0x00, 0x55, 0x03, 0x00, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x75, 0x03, 0x00, 0x03, 0x1B,
++    0x00, 0x03, 0x00, 0x55, 0x03, 0x1B, 0x03, 0x09, 0x00, 0x03, 0x00, 0x75, 0x03, 0x1B, 0x03, 0x09,
++    0x00, 0x03, 0x00, 0x55, 0x03, 0x1B, 0x03, 0x03, 0x00, 0x03, 0x00, 0x75, 0x03, 0x1B, 0x03, 0x03,
++    0x00, 0x03, 0x00, 0x55, 0x03, 0x23, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x75, 0x03, 0x23, 0x03, 0x1B,
++    0x00, 0x01, 0x00, 0x49, 0x01, 0xD7, 0x01, 0xD8, 0x01, 0xDB, 0x01, 0xDC, 0x01, 0xEC, 0x01, 0xED,
++    0x01, 0xFA, 0x01, 0xFB, 0x1E, 0x08, 0x1E, 0x09, 0x1E, 0x14, 0x1E, 0x15, 0x1E, 0x16, 0x1E, 0x17,
++    0x1E, 0x1C, 0x1E, 0x1D, 0x1E, 0x2E, 0x1E, 0x2F, 0x1E, 0x30, 0x1E, 0x4C, 0x1E, 0x4D, 0x1E, 0x50,
++    0x1E, 0x51, 0x1E, 0x52, 0x1E, 0x53, 0x1E, 0x68, 0x1E, 0x69, 0x1E, 0x78, 0x1E, 0x79, 0x1E, 0xA4,
++    0x1E, 0xA5, 0x1E, 0xA6, 0x1E, 0xA7, 0x1E, 0xAC, 0x1E, 0xAD, 0x1E, 0xAE, 0x1E, 0xAF, 0x1E, 0xB0,
++    0x1E, 0xB1, 0x1E, 0xB6, 0x1E, 0xB7, 0x1E, 0xBE, 0x1E, 0xBF, 0x1E, 0xC0, 0x1E, 0xC1, 0x1E, 0xC6,
++    0x1E, 0xC7, 0x1E, 0xD0, 0x1E, 0xD1, 0x1E, 0xD2, 0x1E, 0xD3, 0x1E, 0xD8, 0x1E, 0xD9, 0x1E, 0xDA,
+     0x1E, 0xDB, 0x1E, 0xDC, 0x1E, 0xDD, 0x1E, 0xDE, 0x1E, 0xDF, 0x1E, 0xE0, 0x1E, 0xE1, 0x1E, 0xE2,
+     0x1E, 0xE3, 0x1E, 0xE8, 0x1E, 0xE9, 0x1E, 0xEA, 0x1E, 0xEB, 0x1E, 0xEC, 0x1E, 0xED, 0x1E, 0xEE,
+-    0x1E, 0xEF, 0x1E, 0xF0, 0x1E, 0xF1, 0x1E, 0xF2, 0x1E, 0xF3, 0x00, 0x01, 0x02, 0xFC, 0x00, 0x4F,
+-    0x00, 0xA4, 0x00, 0xAA, 0x00, 0xB0, 0x00, 0xB8, 0x00, 0xC0, 0x00, 0xC8, 0x00, 0xD0, 0x00, 0xD6,
+-    0x00, 0xDE, 0x00, 0xE4, 0x00, 0xEA, 0x00, 0xF2, 0x00, 0xFA, 0x01, 0x02, 0x01, 0x0A, 0x01, 0x12,
+-    0x01, 0x1A, 0x01, 0x20, 0x01, 0x26, 0x01, 0x2C, 0x01, 0x34, 0x01, 0x3C, 0x01, 0x44, 0x01, 0x4C,
+-    0x01, 0x54, 0x01, 0x5C, 0x01, 0x64, 0x01, 0x6C, 0x01, 0x74, 0x01, 0x7C, 0x01, 0x84, 0x01, 0x8C,
+-    0x01, 0x94, 0x01, 0x9C, 0x01, 0xA4, 0x01, 0xAC, 0x01, 0xB4, 0x01, 0xBC, 0x01, 0xC4, 0x01, 0xCC,
+-    0x01, 0xD4, 0x01, 0xDC, 0x01, 0xE4, 0x01, 0xEC, 0x01, 0xF4, 0x01, 0xFC, 0x02, 0x04, 0x02, 0x0C,
+-    0x02, 0x14, 0x02, 0x1C, 0x02, 0x24, 0x02, 0x2C, 0x02, 0x34, 0x02, 0x3C, 0x02, 0x44, 0x02, 0x4C,
+-    0x02, 0x54, 0x02, 0x5C, 0x02, 0x64, 0x02, 0x6C, 0x02, 0x72, 0x02, 0x78, 0x02, 0x7E, 0x02, 0x84,
+-    0x02, 0x8C, 0x02, 0x94, 0x02, 0x9C, 0x02, 0xA4, 0x02, 0xAC, 0x02, 0xB4, 0x02, 0xBA, 0x02, 0xC0,
+-    0x02, 0xC6, 0x02, 0xCC, 0x02, 0xD4, 0x02, 0xDC, 0x02, 0xE4, 0x02, 0xEC, 0x02, 0xF4, 0x00, 0x02,
+-    0x00, 0xDC, 0x03, 0x41, 0x00, 0x02, 0x00, 0xFC, 0x03, 0x41, 0x00, 0x03, 0x00, 0x55, 0x03, 0x08,
+-    0x03, 0x00, 0x00, 0x03, 0x00, 0x75, 0x03, 0x08, 0x03, 0x00, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x04,
+-    0x03, 0x28, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x04, 0x03, 0x28, 0x00, 0x02, 0x21, 0x2B, 0x03, 0x01,
+-    0x00, 0x03, 0x00, 0x61, 0x03, 0x0A, 0x03, 0x01, 0x00, 0x02, 0x01, 0x06, 0x03, 0x27, 0x00, 0x02,
+-    0x01, 0x07, 0x03, 0x27, 0x00, 0x03, 0x00, 0x45, 0x03, 0x04, 0x03, 0x00, 0x00, 0x03, 0x00, 0x65,
+-    0x03, 0x04, 0x03, 0x00, 0x00, 0x03, 0x00, 0x45, 0x03, 0x04, 0x03, 0x01, 0x00, 0x03, 0x00, 0x65,
+-    0x03, 0x04, 0x03, 0x01, 0x00, 0x03, 0x00, 0x45, 0x03, 0x06, 0x03, 0x27, 0x00, 0x03, 0x00, 0x65,
+-    0x03, 0x06, 0x03, 0x27, 0x00, 0x02, 0x00, 0xCF, 0x03, 0x41, 0x00, 0x02, 0x00, 0xEF, 0x03, 0x41,
+-    0x00, 0x02, 0x21, 0x2A, 0x03, 0x01, 0x00, 0x03, 0x00, 0x4C, 0x03, 0x23, 0x03, 0x04, 0x00, 0x03,
+-    0x00, 0x6C, 0x03, 0x23, 0x03, 0x04, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x03, 0x03, 0x01, 0x00, 0x03,
+-    0x00, 0x6F, 0x03, 0x03, 0x03, 0x01, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x04, 0x03, 0x00, 0x00, 0x03,
+-    0x00, 0x6F, 0x03, 0x04, 0x03, 0x00, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x04, 0x03, 0x01, 0x00, 0x03,
+-    0x00, 0x6F, 0x03, 0x04, 0x03, 0x01, 0x00, 0x03, 0x00, 0x52, 0x03, 0x23, 0x03, 0x04, 0x00, 0x03,
+-    0x00, 0x72, 0x03, 0x23, 0x03, 0x04, 0x00, 0x03, 0x00, 0x53, 0x03, 0x41, 0x03, 0x07, 0x00, 0x03,
+-    0x00, 0x73, 0x03, 0x41, 0x03, 0x07, 0x00, 0x03, 0x00, 0x53, 0x03, 0x07, 0x03, 0x23, 0x00, 0x03,
+-    0x00, 0x73, 0x03, 0x07, 0x03, 0x23, 0x00, 0x03, 0x00, 0x55, 0x03, 0x03, 0x03, 0x01, 0x00, 0x03,
+-    0x00, 0x75, 0x03, 0x03, 0x03, 0x01, 0x00, 0x03, 0x00, 0x41, 0x03, 0x02, 0x03, 0x01, 0x00, 0x03,
+-    0x00, 0x61, 0x03, 0x02, 0x03, 0x01, 0x00, 0x03, 0x00, 0x41, 0x03, 0x02, 0x03, 0x00, 0x00, 0x03,
+-    0x00, 0x61, 0x03, 0x02, 0x03, 0x00, 0x00, 0x03, 0x00, 0x41, 0x03, 0x02, 0x03, 0x23, 0x00, 0x03,
+-    0x00, 0x61, 0x03, 0x02, 0x03, 0x23, 0x00, 0x03, 0x00, 0x41, 0x03, 0x06, 0x03, 0x01, 0x00, 0x03,
+-    0x00, 0x61, 0x03, 0x06, 0x03, 0x01, 0x00, 0x03, 0x00, 0x41, 0x03, 0x06, 0x03, 0x00, 0x00, 0x03,
+-    0x00, 0x61, 0x03, 0x06, 0x03, 0x00, 0x00, 0x03, 0x00, 0x41, 0x03, 0x06, 0x03, 0x23, 0x00, 0x03,
+-    0x00, 0x61, 0x03, 0x06, 0x03, 0x23, 0x00, 0x03, 0x00, 0x45, 0x03, 0x02, 0x03, 0x01, 0x00, 0x03,
+-    0x00, 0x65, 0x03, 0x02, 0x03, 0x01, 0x00, 0x03, 0x00, 0x45, 0x03, 0x02, 0x03, 0x00, 0x00, 0x03,
+-    0x00, 0x65, 0x03, 0x02, 0x03, 0x00, 0x00, 0x03, 0x00, 0x45, 0x03, 0x02, 0x03, 0x23, 0x00, 0x03,
+-    0x00, 0x65, 0x03, 0x02, 0x03, 0x23, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x02, 0x03, 0x01, 0x00, 0x03,
+-    0x00, 0x6F, 0x03, 0x02, 0x03, 0x01, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x02, 0x03, 0x00, 0x00, 0x03,
+-    0x00, 0x6F, 0x03, 0x02, 0x03, 0x00, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x02, 0x03, 0x23, 0x00, 0x03,
+-    0x00, 0x6F, 0x03, 0x02, 0x03, 0x23, 0x00, 0x02, 0x01, 0xA0, 0x03, 0x41, 0x00, 0x02, 0x01, 0xA1,
+-    0x03, 0x41, 0x00, 0x02, 0x01, 0xA0, 0x03, 0x40, 0x00, 0x02, 0x01, 0xA1, 0x03, 0x40, 0x00, 0x03,
+-    0x00, 0x4F, 0x03, 0x09, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x09, 0x03, 0x1B, 0x00, 0x03,
+-    0x00, 0x4F, 0x03, 0x03, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x03, 0x03, 0x1B, 0x00, 0x03,
+-    0x00, 0x4F, 0x03, 0x1B, 0x03, 0x23, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x1B, 0x03, 0x23, 0x00, 0x02,
+-    0x01, 0xAF, 0x03, 0x41, 0x00, 0x02, 0x01, 0xB0, 0x03, 0x41, 0x00, 0x02, 0x01, 0xAF, 0x03, 0x40,
+-    0x00, 0x02, 0x01, 0xB0, 0x03, 0x40, 0x00, 0x03, 0x00, 0x55, 0x03, 0x09, 0x03, 0x1B, 0x00, 0x03,
+-    0x00, 0x75, 0x03, 0x09, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x55, 0x03, 0x03, 0x03, 0x1B, 0x00, 0x03,
+-    0x00, 0x75, 0x03, 0x03, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x55, 0x03, 0x1B, 0x03, 0x23, 0x00, 0x03,
+-    0x00, 0x75, 0x03, 0x1B, 0x03, 0x23, 0x00, 0x01, 0x00, 0x4F, 0x01, 0xD7, 0x01, 0xD8, 0x01, 0xDB,
+-    0x01, 0xDC, 0x01, 0xEC, 0x01, 0xED, 0x01, 0xFA, 0x01, 0xFB, 0x1E, 0x08, 0x1E, 0x09, 0x1E, 0x14,
+-    0x1E, 0x15, 0x1E, 0x16, 0x1E, 0x17, 0x1E, 0x1C, 0x1E, 0x1D, 0x1E, 0x2E, 0x1E, 0x2F, 0x1E, 0x30,
+-    0x1E, 0x38, 0x1E, 0x39, 0x1E, 0x4C, 0x1E, 0x4D, 0x1E, 0x50, 0x1E, 0x51, 0x1E, 0x52, 0x1E, 0x53,
+-    0x1E, 0x5C, 0x1E, 0x5D, 0x1E, 0x64, 0x1E, 0x65, 0x1E, 0x68, 0x1E, 0x69, 0x1E, 0x78, 0x1E, 0x79,
+-    0x1E, 0xA4, 0x1E, 0xA5, 0x1E, 0xA6, 0x1E, 0xA7, 0x1E, 0xAC, 0x1E, 0xAD, 0x1E, 0xAE, 0x1E, 0xAF,
+-    0x1E, 0xB0, 0x1E, 0xB1, 0x1E, 0xB6, 0x1E, 0xB7, 0x1E, 0xBE, 0x1E, 0xBF, 0x1E, 0xC0, 0x1E, 0xC1,
+-    0x1E, 0xC6, 0x1E, 0xC7, 0x1E, 0xD0, 0x1E, 0xD1, 0x1E, 0xD2, 0x1E, 0xD3, 0x1E, 0xD8, 0x1E, 0xD9,
+-    0x1E, 0xDA, 0x1E, 0xDB, 0x1E, 0xDC, 0x1E, 0xDD, 0x1E, 0xDE, 0x1E, 0xDF, 0x1E, 0xE0, 0x1E, 0xE1,
+-    0x1E, 0xE2, 0x1E, 0xE3, 0x1E, 0xE8, 0x1E, 0xE9, 0x1E, 0xEA, 0x1E, 0xEB, 0x1E, 0xEC, 0x1E, 0xED,
+-    0x1E, 0xEE, 0x1E, 0xEF, 0x1E, 0xF0, 0x1E, 0xF1, 0x00, 0x01, 0x02, 0xDC, 0x00, 0x49, 0x00, 0x98,
+-    0x00, 0xA0, 0x00, 0xA8, 0x00, 0xB0, 0x00, 0xB8, 0x00, 0xC0, 0x00, 0xC8, 0x00, 0xCE, 0x00, 0xD6,
+-    0x00, 0xDE, 0x00, 0xE6, 0x00, 0xEE, 0x00, 0xF6, 0x00, 0xFE, 0x01, 0x06, 0x01, 0x0E, 0x01, 0x16,
+-    0x01, 0x1E, 0x01, 0x26, 0x01, 0x2C, 0x01, 0x34, 0x01, 0x3C, 0x01, 0x44, 0x01, 0x4C, 0x01, 0x54,
+-    0x01, 0x5C, 0x01, 0x64, 0x01, 0x6C, 0x01, 0x74, 0x01, 0x7C, 0x01, 0x84, 0x01, 0x8C, 0x01, 0x94,
+-    0x01, 0x9C, 0x01, 0xA4, 0x01, 0xAC, 0x01, 0xB4, 0x01, 0xBC, 0x01, 0xC4, 0x01, 0xCC, 0x01, 0xD4,
+-    0x01, 0xDC, 0x01, 0xE4, 0x01, 0xEC, 0x01, 0xF4, 0x01, 0xFC, 0x02, 0x04, 0x02, 0x0C, 0x02, 0x14,
+-    0x02, 0x1C, 0x02, 0x24, 0x02, 0x2C, 0x02, 0x34, 0x02, 0x3C, 0x02, 0x44, 0x02, 0x4C, 0x02, 0x54,
+-    0x02, 0x5C, 0x02, 0x64, 0x02, 0x6C, 0x02, 0x74, 0x02, 0x7C, 0x02, 0x84, 0x02, 0x8C, 0x02, 0x94,
+-    0x02, 0x9C, 0x02, 0xA4, 0x02, 0xAC, 0x02, 0xB4, 0x02, 0xBC, 0x02, 0xC4, 0x02, 0xCC, 0x02, 0xD4,
+-    0x00, 0x03, 0x00, 0x55, 0x03, 0x08, 0x03, 0x01, 0x00, 0x03, 0x00, 0x75, 0x03, 0x08, 0x03, 0x01,
+-    0x00, 0x03, 0x00, 0x55, 0x03, 0x08, 0x03, 0x40, 0x00, 0x03, 0x00, 0x75, 0x03, 0x08, 0x03, 0x40,
+-    0x00, 0x03, 0x00, 0x4F, 0x03, 0x28, 0x03, 0x04, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x28, 0x03, 0x04,
+-    0x00, 0x02, 0x21, 0x2B, 0x03, 0x41, 0x00, 0x03, 0x00, 0x61, 0x03, 0x0A, 0x03, 0x41, 0x00, 0x03,
+-    0x00, 0x43, 0x03, 0x01, 0x03, 0x27, 0x00, 0x03, 0x00, 0x63, 0x03, 0x01, 0x03, 0x27, 0x00, 0x03,
+-    0x00, 0x45, 0x03, 0x04, 0x03, 0x40, 0x00, 0x03, 0x00, 0x65, 0x03, 0x04, 0x03, 0x40, 0x00, 0x03,
+-    0x00, 0x45, 0x03, 0x04, 0x03, 0x41, 0x00, 0x03, 0x00, 0x65, 0x03, 0x04, 0x03, 0x41, 0x00, 0x03,
+-    0x00, 0x45, 0x03, 0x27, 0x03, 0x06, 0x00, 0x03, 0x00, 0x65, 0x03, 0x27, 0x03, 0x06, 0x00, 0x03,
+-    0x00, 0x49, 0x03, 0x08, 0x03, 0x01, 0x00, 0x03, 0x00, 0x69, 0x03, 0x08, 0x03, 0x01, 0x00, 0x02,
+-    0x21, 0x2A, 0x03, 0x41, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x03, 0x03, 0x41, 0x00, 0x03, 0x00, 0x6F,
+-    0x03, 0x03, 0x03, 0x41, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x04, 0x03, 0x40, 0x00, 0x03, 0x00, 0x6F,
+-    0x03, 0x04, 0x03, 0x40, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x04, 0x03, 0x41, 0x00, 0x03, 0x00, 0x6F,
+-    0x03, 0x04, 0x03, 0x41, 0x00, 0x03, 0x00, 0x53, 0x03, 0x23, 0x03, 0x07, 0x00, 0x03, 0x00, 0x73,
+-    0x03, 0x23, 0x03, 0x07, 0x00, 0x03, 0x00, 0x55, 0x03, 0x03, 0x03, 0x41, 0x00, 0x03, 0x00, 0x75,
+-    0x03, 0x03, 0x03, 0x41, 0x00, 0x03, 0x00, 0x41, 0x03, 0x02, 0x03, 0x41, 0x00, 0x03, 0x00, 0x61,
+-    0x03, 0x02, 0x03, 0x41, 0x00, 0x03, 0x00, 0x41, 0x03, 0x02, 0x03, 0x40, 0x00, 0x03, 0x00, 0x61,
+-    0x03, 0x02, 0x03, 0x40, 0x00, 0x03, 0x00, 0x41, 0x03, 0x23, 0x03, 0x02, 0x00, 0x03, 0x00, 0x61,
+-    0x03, 0x23, 0x03, 0x02, 0x00, 0x03, 0x00, 0x41, 0x03, 0x06, 0x03, 0x41, 0x00, 0x03, 0x00, 0x61,
+-    0x03, 0x06, 0x03, 0x41, 0x00, 0x03, 0x00, 0x41, 0x03, 0x06, 0x03, 0x40, 0x00, 0x03, 0x00, 0x61,
+-    0x03, 0x06, 0x03, 0x40, 0x00, 0x03, 0x00, 0x41, 0x03, 0x23, 0x03, 0x06, 0x00, 0x03, 0x00, 0x61,
+-    0x03, 0x23, 0x03, 0x06, 0x00, 0x03, 0x00, 0x45, 0x03, 0x02, 0x03, 0x41, 0x00, 0x03, 0x00, 0x65,
+-    0x03, 0x02, 0x03, 0x41, 0x00, 0x03, 0x00, 0x45, 0x03, 0x02, 0x03, 0x40, 0x00, 0x03, 0x00, 0x65,
+-    0x03, 0x02, 0x03, 0x40, 0x00, 0x03, 0x00, 0x45, 0x03, 0x23, 0x03, 0x02, 0x00, 0x03, 0x00, 0x65,
+-    0x03, 0x23, 0x03, 0x02, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x02, 0x03, 0x41, 0x00, 0x03, 0x00, 0x6F,
+-    0x03, 0x02, 0x03, 0x41, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x02, 0x03, 0x40, 0x00, 0x03, 0x00, 0x6F,
+-    0x03, 0x02, 0x03, 0x40, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x23, 0x03, 0x02, 0x00, 0x03, 0x00, 0x6F,
+-    0x03, 0x23, 0x03, 0x02, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x01, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x6F,
+-    0x03, 0x01, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x00, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x6F,
+-    0x03, 0x00, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x1B, 0x03, 0x09, 0x00, 0x03, 0x00, 0x6F,
+-    0x03, 0x1B, 0x03, 0x09, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x1B, 0x03, 0x03, 0x00, 0x03, 0x00, 0x6F,
+-    0x03, 0x1B, 0x03, 0x03, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x23, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x6F,
+-    0x03, 0x23, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x55, 0x03, 0x01, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x75,
+-    0x03, 0x01, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x55, 0x03, 0x00, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x75,
+-    0x03, 0x00, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x55, 0x03, 0x1B, 0x03, 0x09, 0x00, 0x03, 0x00, 0x75,
+-    0x03, 0x1B, 0x03, 0x09, 0x00, 0x03, 0x00, 0x55, 0x03, 0x1B, 0x03, 0x03, 0x00, 0x03, 0x00, 0x75,
+-    0x03, 0x1B, 0x03, 0x03, 0x00, 0x03, 0x00, 0x55, 0x03, 0x23, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x75,
+-    0x03, 0x23, 0x03, 0x1B, 0x00, 0x01, 0x00, 0x49, 0x01, 0xD7, 0x01, 0xD8, 0x01, 0xDB, 0x01, 0xDC,
+-    0x01, 0xEC, 0x01, 0xED, 0x01, 0xFA, 0x01, 0xFB, 0x1E, 0x08, 0x1E, 0x09, 0x1E, 0x14, 0x1E, 0x15,
+-    0x1E, 0x16, 0x1E, 0x17, 0x1E, 0x1C, 0x1E, 0x1D, 0x1E, 0x2E, 0x1E, 0x2F, 0x1E, 0x30, 0x1E, 0x4C,
+-    0x1E, 0x4D, 0x1E, 0x50, 0x1E, 0x51, 0x1E, 0x52, 0x1E, 0x53, 0x1E, 0x68, 0x1E, 0x69, 0x1E, 0x78,
+-    0x1E, 0x79, 0x1E, 0xA4, 0x1E, 0xA5, 0x1E, 0xA6, 0x1E, 0xA7, 0x1E, 0xAC, 0x1E, 0xAD, 0x1E, 0xAE,
+-    0x1E, 0xAF, 0x1E, 0xB0, 0x1E, 0xB1, 0x1E, 0xB6, 0x1E, 0xB7, 0x1E, 0xBE, 0x1E, 0xBF, 0x1E, 0xC0,
+-    0x1E, 0xC1, 0x1E, 0xC6, 0x1E, 0xC7, 0x1E, 0xD0, 0x1E, 0xD1, 0x1E, 0xD2, 0x1E, 0xD3, 0x1E, 0xD8,
+-    0x1E, 0xD9, 0x1E, 0xDA, 0x1E, 0xDB, 0x1E, 0xDC, 0x1E, 0xDD, 0x1E, 0xDE, 0x1E, 0xDF, 0x1E, 0xE0,
+-    0x1E, 0xE1, 0x1E, 0xE2, 0x1E, 0xE3, 0x1E, 0xE8, 0x1E, 0xE9, 0x1E, 0xEA, 0x1E, 0xEB, 0x1E, 0xEC,
+-    0x1E, 0xED, 0x1E, 0xEE, 0x1E, 0xEF, 0x1E, 0xF0, 0x1E, 0xF1, 0x00, 0x01, 0x00, 0x9C, 0x00, 0x0F,
+-    0x00, 0x24, 0x00, 0x2C, 0x00, 0x34, 0x00, 0x3C, 0x00, 0x44, 0x00, 0x4C, 0x00, 0x54, 0x00, 0x5C,
+-    0x00, 0x64, 0x00, 0x6C, 0x00, 0x74, 0x00, 0x7C, 0x00, 0x84, 0x00, 0x8C, 0x00, 0x94, 0x00, 0x03,
+-    0x00, 0x55, 0x03, 0x08, 0x03, 0x41, 0x00, 0x03, 0x00, 0x75, 0x03, 0x08, 0x03, 0x41, 0x00, 0x03,
+-    0x00, 0x41, 0x03, 0x0A, 0x03, 0x01, 0x00, 0x03, 0x00, 0x43, 0x03, 0x27, 0x03, 0x01, 0x00, 0x03,
+-    0x00, 0x63, 0x03, 0x27, 0x03, 0x01, 0x00, 0x03, 0x00, 0x49, 0x03, 0x08, 0x03, 0x41, 0x00, 0x03,
+-    0x00, 0x69, 0x03, 0x08, 0x03, 0x41, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x1B, 0x03, 0x01, 0x00, 0x03,
+-    0x00, 0x6F, 0x03, 0x1B, 0x03, 0x01, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x1B, 0x03, 0x00, 0x00, 0x03,
+-    0x00, 0x6F, 0x03, 0x1B, 0x03, 0x00, 0x00, 0x03, 0x00, 0x55, 0x03, 0x1B, 0x03, 0x01, 0x00, 0x03,
+-    0x00, 0x75, 0x03, 0x1B, 0x03, 0x01, 0x00, 0x03, 0x00, 0x55, 0x03, 0x1B, 0x03, 0x00, 0x00, 0x03,
+-    0x00, 0x75, 0x03, 0x1B, 0x03, 0x00, 0x00, 0x01, 0x00, 0x0F, 0x01, 0xD7, 0x01, 0xD8, 0x01, 0xFA,
+-    0x1E, 0x08, 0x1E, 0x09, 0x1E, 0x2E, 0x1E, 0x2F, 0x1E, 0xDA, 0x1E, 0xDB, 0x1E, 0xDC, 0x1E, 0xDD,
+-    0x1E, 0xE8, 0x1E, 0xE9, 0x1E, 0xEA, 0x1E, 0xEB, 0x00, 0x01, 0x00, 0x74, 0x00, 0x0B, 0x00, 0x1C,
+-    0x00, 0x24, 0x00, 0x2C, 0x00, 0x34, 0x00, 0x3C, 0x00, 0x44, 0x00, 0x4C, 0x00, 0x54, 0x00, 0x5C,
+-    0x00, 0x64, 0x00, 0x6C, 0x00, 0x03, 0x00, 0x41, 0x03, 0x0A, 0x03, 0x41, 0x00, 0x03, 0x00, 0x43,
+-    0x03, 0x27, 0x03, 0x41, 0x00, 0x03, 0x00, 0x63, 0x03, 0x27, 0x03, 0x41, 0x00, 0x03, 0x00, 0x4F,
+-    0x03, 0x1B, 0x03, 0x41, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x1B, 0x03, 0x41, 0x00, 0x03, 0x00, 0x4F,
+-    0x03, 0x1B, 0x03, 0x40, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x1B, 0x03, 0x40, 0x00, 0x03, 0x00, 0x55,
+-    0x03, 0x1B, 0x03, 0x41, 0x00, 0x03, 0x00, 0x75, 0x03, 0x1B, 0x03, 0x41, 0x00, 0x03, 0x00, 0x55,
+-    0x03, 0x1B, 0x03, 0x40, 0x00, 0x03, 0x00, 0x75, 0x03, 0x1B, 0x03, 0x40, 0x00, 0x01, 0x00, 0x0B,
+-    0x01, 0xFA, 0x1E, 0x08, 0x1E, 0x09, 0x1E, 0xDA, 0x1E, 0xDB, 0x1E, 0xDC, 0x1E, 0xDD, 0x1E, 0xE8,
+-    0x1E, 0xE9, 0x1E, 0xEA, 0x1E, 0xEB, 0x00, 0x01, 0x00, 0x6A, 0x00, 0x0A, 0x00, 0x1A, 0x00, 0x22,
+-    0x00, 0x2A, 0x00, 0x32, 0x00, 0x3A, 0x00, 0x42, 0x00, 0x4A, 0x00, 0x52, 0x00, 0x5A, 0x00, 0x62,
+-    0x00, 0x03, 0x00, 0x43, 0x03, 0x41, 0x03, 0x27, 0x00, 0x03, 0x00, 0x63, 0x03, 0x41, 0x03, 0x27,
+-    0x00, 0x03, 0x00, 0x4F, 0x03, 0x41, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x41, 0x03, 0x1B,
+-    0x00, 0x03, 0x00, 0x4F, 0x03, 0x40, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x40, 0x03, 0x1B,
+-    0x00, 0x03, 0x00, 0x55, 0x03, 0x41, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x75, 0x03, 0x41, 0x03, 0x1B,
+-    0x00, 0x03, 0x00, 0x55, 0x03, 0x40, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x75, 0x03, 0x40, 0x03, 0x1B,
+-    0x00, 0x01, 0x00, 0x0A, 0x1E, 0x08, 0x1E, 0x09, 0x1E, 0xDA, 0x1E, 0xDB, 0x1E, 0xDC, 0x1E, 0xDD,
+-    0x1E, 0xE8, 0x1E, 0xE9, 0x1E, 0xEA, 0x1E, 0xEB, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08,
+-    0x00, 0x01, 0x00, 0x26, 0x00, 0x02, 0x00, 0x0A, 0x00, 0x1C, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C,
+-    0x0D, 0x4A, 0x00, 0x02, 0x0D, 0x3E, 0x0D, 0x4C, 0x00, 0x02, 0x0D, 0x57, 0x00, 0x01, 0x00, 0x04,
+-    0x0D, 0x4B, 0x00, 0x02, 0x0D, 0x3E, 0x00, 0x01, 0x00, 0x02, 0x0D, 0x46, 0x0D, 0x47, 0x00, 0x02,
+-    0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0x1E, 0x00, 0x03, 0x00, 0x0C, 0x00, 0x12,
+-    0x00, 0x18, 0x00, 0x02, 0x0D, 0x46, 0x0D, 0x3E, 0x00, 0x02, 0x0D, 0x47, 0x0D, 0x3E, 0x00, 0x02,
+-    0x0D, 0x46, 0x0D, 0x57, 0x00, 0x01, 0x00, 0x03, 0x0D, 0x4A, 0x0D, 0x4B, 0x0D, 0x4C, 0x00, 0x04,
++    0x1E, 0xEF, 0x1E, 0xF0, 0x1E, 0xF1, 0x00, 0x01, 0x00, 0x9C, 0x00, 0x0F, 0x00, 0x24, 0x00, 0x2C,
++    0x00, 0x34, 0x00, 0x3C, 0x00, 0x44, 0x00, 0x4C, 0x00, 0x54, 0x00, 0x5C, 0x00, 0x64, 0x00, 0x6C,
++    0x00, 0x74, 0x00, 0x7C, 0x00, 0x84, 0x00, 0x8C, 0x00, 0x94, 0x00, 0x03, 0x00, 0x55, 0x03, 0x08,
++    0x03, 0x41, 0x00, 0x03, 0x00, 0x75, 0x03, 0x08, 0x03, 0x41, 0x00, 0x03, 0x00, 0x41, 0x03, 0x0A,
++    0x03, 0x01, 0x00, 0x03, 0x00, 0x43, 0x03, 0x27, 0x03, 0x01, 0x00, 0x03, 0x00, 0x63, 0x03, 0x27,
++    0x03, 0x01, 0x00, 0x03, 0x00, 0x49, 0x03, 0x08, 0x03, 0x41, 0x00, 0x03, 0x00, 0x69, 0x03, 0x08,
++    0x03, 0x41, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x1B, 0x03, 0x01, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x1B,
++    0x03, 0x01, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x1B, 0x03, 0x00, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x1B,
++    0x03, 0x00, 0x00, 0x03, 0x00, 0x55, 0x03, 0x1B, 0x03, 0x01, 0x00, 0x03, 0x00, 0x75, 0x03, 0x1B,
++    0x03, 0x01, 0x00, 0x03, 0x00, 0x55, 0x03, 0x1B, 0x03, 0x00, 0x00, 0x03, 0x00, 0x75, 0x03, 0x1B,
++    0x03, 0x00, 0x00, 0x01, 0x00, 0x0F, 0x01, 0xD7, 0x01, 0xD8, 0x01, 0xFA, 0x1E, 0x08, 0x1E, 0x09,
++    0x1E, 0x2E, 0x1E, 0x2F, 0x1E, 0xDA, 0x1E, 0xDB, 0x1E, 0xDC, 0x1E, 0xDD, 0x1E, 0xE8, 0x1E, 0xE9,
++    0x1E, 0xEA, 0x1E, 0xEB, 0x00, 0x01, 0x00, 0x74, 0x00, 0x0B, 0x00, 0x1C, 0x00, 0x24, 0x00, 0x2C,
++    0x00, 0x34, 0x00, 0x3C, 0x00, 0x44, 0x00, 0x4C, 0x00, 0x54, 0x00, 0x5C, 0x00, 0x64, 0x00, 0x6C,
++    0x00, 0x03, 0x00, 0x41, 0x03, 0x0A, 0x03, 0x41, 0x00, 0x03, 0x00, 0x43, 0x03, 0x27, 0x03, 0x41,
++    0x00, 0x03, 0x00, 0x63, 0x03, 0x27, 0x03, 0x41, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x1B, 0x03, 0x41,
++    0x00, 0x03, 0x00, 0x6F, 0x03, 0x1B, 0x03, 0x41, 0x00, 0x03, 0x00, 0x4F, 0x03, 0x1B, 0x03, 0x40,
++    0x00, 0x03, 0x00, 0x6F, 0x03, 0x1B, 0x03, 0x40, 0x00, 0x03, 0x00, 0x55, 0x03, 0x1B, 0x03, 0x41,
++    0x00, 0x03, 0x00, 0x75, 0x03, 0x1B, 0x03, 0x41, 0x00, 0x03, 0x00, 0x55, 0x03, 0x1B, 0x03, 0x40,
++    0x00, 0x03, 0x00, 0x75, 0x03, 0x1B, 0x03, 0x40, 0x00, 0x01, 0x00, 0x0B, 0x01, 0xFA, 0x1E, 0x08,
++    0x1E, 0x09, 0x1E, 0xDA, 0x1E, 0xDB, 0x1E, 0xDC, 0x1E, 0xDD, 0x1E, 0xE8, 0x1E, 0xE9, 0x1E, 0xEA,
++    0x1E, 0xEB, 0x00, 0x01, 0x00, 0x6A, 0x00, 0x0A, 0x00, 0x1A, 0x00, 0x22, 0x00, 0x2A, 0x00, 0x32,
++    0x00, 0x3A, 0x00, 0x42, 0x00, 0x4A, 0x00, 0x52, 0x00, 0x5A, 0x00, 0x62, 0x00, 0x03, 0x00, 0x43,
++    0x03, 0x41, 0x03, 0x27, 0x00, 0x03, 0x00, 0x63, 0x03, 0x41, 0x03, 0x27, 0x00, 0x03, 0x00, 0x4F,
++    0x03, 0x41, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x41, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x4F,
++    0x03, 0x40, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x6F, 0x03, 0x40, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x55,
++    0x03, 0x41, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x75, 0x03, 0x41, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x55,
++    0x03, 0x40, 0x03, 0x1B, 0x00, 0x03, 0x00, 0x75, 0x03, 0x40, 0x03, 0x1B, 0x00, 0x01, 0x00, 0x0A,
++    0x1E, 0x08, 0x1E, 0x09, 0x1E, 0xDA, 0x1E, 0xDB, 0x1E, 0xDC, 0x1E, 0xDD, 0x1E, 0xE8, 0x1E, 0xE9,
++    0x1E, 0xEA, 0x1E, 0xEB, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0x26,
++    0x00, 0x02, 0x00, 0x0A, 0x00, 0x1C, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x0D, 0x4A, 0x00, 0x02,
++    0x0D, 0x3E, 0x0D, 0x4C, 0x00, 0x02, 0x0D, 0x57, 0x00, 0x01, 0x00, 0x04, 0x0D, 0x4B, 0x00, 0x02,
++    0x0D, 0x3E, 0x00, 0x01, 0x00, 0x02, 0x0D, 0x46, 0x0D, 0x47, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01,
++    0x00, 0x08, 0x00, 0x01, 0x00, 0x1E, 0x00, 0x03, 0x00, 0x0C, 0x00, 0x12, 0x00, 0x18, 0x00, 0x02,
++    0x0D, 0x46, 0x0D, 0x3E, 0x00, 0x02, 0x0D, 0x47, 0x0D, 0x3E, 0x00, 0x02, 0x0D, 0x46, 0x0D, 0x57,
++    0x00, 0x01, 0x00, 0x03, 0x0D, 0x4A, 0x0D, 0x4B, 0x0D, 0x4C, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01,
++    0x00, 0x08, 0x00, 0x01, 0x00, 0x12, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0x04, 0x10, 0x26,
++    0x00, 0x02, 0x10, 0x2E, 0x00, 0x01, 0x00, 0x01, 0x10, 0x25, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01,
++    0x00, 0x08, 0x00, 0x01, 0x00, 0x0E, 0x00, 0x01, 0x00, 0x08, 0x00, 0x02, 0x10, 0x25, 0x10, 0x2E,
++    0x00, 0x01, 0x00, 0x01, 0x10, 0x26, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01,
++    0x00, 0x22, 0x00, 0x01, 0x00, 0x08, 0x00, 0x03, 0x00, 0x08, 0x00, 0x0E, 0x00, 0x14, 0x0B, 0x4B,
++    0x00, 0x02, 0x0B, 0x3E, 0x0B, 0x48, 0x00, 0x02, 0x0B, 0x56, 0x0B, 0x4C, 0x00, 0x02, 0x0B, 0x57,
++    0x00, 0x01, 0x00, 0x01, 0x0B, 0x47, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01,
++    0x00, 0x1E, 0x00, 0x03, 0x00, 0x0C, 0x00, 0x12, 0x00, 0x18, 0x00, 0x02, 0x0B, 0x47, 0x0B, 0x56,
++    0x00, 0x02, 0x0B, 0x47, 0x0B, 0x3E, 0x00, 0x02, 0x0B, 0x47, 0x0B, 0x57, 0x00, 0x01, 0x00, 0x03,
++    0x0B, 0x48, 0x0B, 0x4B, 0x0B, 0x4C, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01,
++    0x00, 0x38, 0x00, 0x02, 0x00, 0x0A, 0x00, 0x2E, 0x00, 0x04, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x18,
++    0x00, 0x1E, 0x0D, 0xDA, 0x00, 0x02, 0x0D, 0xCA, 0x0D, 0xDD, 0x00, 0x03, 0x0D, 0xCF, 0x0D, 0xCA,
++    0x0D, 0xDC, 0x00, 0x02, 0x0D, 0xCF, 0x0D, 0xDE, 0x00, 0x02, 0x0D, 0xDF, 0x00, 0x01, 0x00, 0x04,
++    0x0D, 0xDD, 0x00, 0x02, 0x0D, 0xCA, 0x00, 0x01, 0x00, 0x02, 0x0D, 0xD9, 0x0D, 0xDC, 0x00, 0x02,
++    0x00, 0x00, 0x00, 0x02, 0x00, 0x0A, 0x00, 0x3C, 0x00, 0x01, 0x00, 0x26, 0x00, 0x04, 0x00, 0x0E,
++    0x00, 0x14, 0x00, 0x1A, 0x00, 0x20, 0x00, 0x02, 0x0D, 0xD9, 0x0D, 0xCA, 0x00, 0x02, 0x0D, 0xD9,
++    0x0D, 0xCF, 0x00, 0x02, 0x0D, 0xDC, 0x0D, 0xCA, 0x00, 0x02, 0x0D, 0xD9, 0x0D, 0xDF, 0x00, 0x01,
++    0x00, 0x04, 0x0D, 0xDA, 0x0D, 0xDC, 0x0D, 0xDD, 0x0D, 0xDE, 0x00, 0x01, 0x00, 0x10, 0x00, 0x01,
++    0x00, 0x08, 0x00, 0x03, 0x0D, 0xD9, 0x0D, 0xCF, 0x0D, 0xCA, 0x00, 0x01, 0x00, 0x01, 0x0D, 0xDD,
++    0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0x32, 0x00, 0x03, 0x00, 0x0C,
++    0x00, 0x16, 0x00, 0x28, 0x00, 0x01, 0x00, 0x04, 0x0B, 0x94, 0x00, 0x02, 0x0B, 0xD7, 0x00, 0x02,
++    0x00, 0x06, 0x00, 0x0C, 0x0B, 0xCA, 0x00, 0x02, 0x0B, 0xBE, 0x0B, 0xCC, 0x00, 0x02, 0x0B, 0xD7,
++    0x00, 0x01, 0x00, 0x04, 0x0B, 0xCB, 0x00, 0x02, 0x0B, 0xBE, 0x00, 0x01, 0x00, 0x03, 0x0B, 0x92,
++    0x0B, 0xC6, 0x0B, 0xC7, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0x26,
++    0x00, 0x04, 0x00, 0x0E, 0x00, 0x14, 0x00, 0x1A, 0x00, 0x20, 0x00, 0x02, 0x0B, 0x92, 0x0B, 0xD7,
++    0x00, 0x02, 0x0B, 0xC6, 0x0B, 0xBE, 0x00, 0x02, 0x0B, 0xC7, 0x0B, 0xBE, 0x00, 0x02, 0x0B, 0xC6,
++    0x0B, 0xD7, 0x00, 0x01, 0x00, 0x04, 0x0B, 0x94, 0x0B, 0xCA, 0x0B, 0xCB, 0x0B, 0xCC, 0x00, 0x04,
+     0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0x12, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01,
+-    0x00, 0x04, 0x10, 0x26, 0x00, 0x02, 0x10, 0x2E, 0x00, 0x01, 0x00, 0x01, 0x10, 0x25, 0x00, 0x02,
++    0x00, 0x04, 0x0C, 0x48, 0x00, 0x02, 0x0C, 0x56, 0x00, 0x01, 0x00, 0x01, 0x0C, 0x46, 0x00, 0x02,
+     0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0x0E, 0x00, 0x01, 0x00, 0x08, 0x00, 0x02,
+-    0x10, 0x25, 0x10, 0x2E, 0x00, 0x01, 0x00, 0x01, 0x10, 0x26, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01,
+-    0x00, 0x08, 0x00, 0x01, 0x00, 0x3A, 0x00, 0x03, 0x00, 0x0C, 0x00, 0x16, 0x00, 0x20, 0x00, 0x01,
+-    0x00, 0x04, 0x0B, 0x5C, 0x00, 0x02, 0x0B, 0x3C, 0x00, 0x01, 0x00, 0x04, 0x0B, 0x5D, 0x00, 0x02,
+-    0x0B, 0x3C, 0x00, 0x03, 0x00, 0x08, 0x00, 0x0E, 0x00, 0x14, 0x0B, 0x4B, 0x00, 0x02, 0x0B, 0x3E,
+-    0x0B, 0x48, 0x00, 0x02, 0x0B, 0x56, 0x0B, 0x4C, 0x00, 0x02, 0x0B, 0x57, 0x00, 0x01, 0x00, 0x03,
+-    0x0B, 0x21, 0x0B, 0x22, 0x0B, 0x47, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01,
+-    0x00, 0x2E, 0x00, 0x05, 0x00, 0x10, 0x00, 0x16, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x28, 0x00, 0x02,
+-    0x0B, 0x47, 0x0B, 0x56, 0x00, 0x02, 0x0B, 0x47, 0x0B, 0x3E, 0x00, 0x02, 0x0B, 0x47, 0x0B, 0x57,
+-    0x00, 0x02, 0x0B, 0x21, 0x0B, 0x3C, 0x00, 0x02, 0x0B, 0x22, 0x0B, 0x3C, 0x00, 0x01, 0x00, 0x05,
+-    0x0B, 0x48, 0x0B, 0x4B, 0x0B, 0x4C, 0x0B, 0x5C, 0x0B, 0x5D, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01,
+-    0x00, 0x08, 0x00, 0x01, 0x00, 0x38, 0x00, 0x02, 0x00, 0x0A, 0x00, 0x2E, 0x00, 0x04, 0x00, 0x0A,
+-    0x00, 0x10, 0x00, 0x18, 0x00, 0x1E, 0x0D, 0xDA, 0x00, 0x02, 0x0D, 0xCA, 0x0D, 0xDD, 0x00, 0x03,
+-    0x0D, 0xCF, 0x0D, 0xCA, 0x0D, 0xDC, 0x00, 0x02, 0x0D, 0xCF, 0x0D, 0xDE, 0x00, 0x02, 0x0D, 0xDF,
+-    0x00, 0x01, 0x00, 0x04, 0x0D, 0xDD, 0x00, 0x02, 0x0D, 0xCA, 0x00, 0x01, 0x00, 0x02, 0x0D, 0xD9,
+-    0x0D, 0xDC, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0A, 0x00, 0x3C, 0x00, 0x01, 0x00, 0x26,
+-    0x00, 0x04, 0x00, 0x0E, 0x00, 0x14, 0x00, 0x1A, 0x00, 0x20, 0x00, 0x02, 0x0D, 0xD9, 0x0D, 0xCA,
+-    0x00, 0x02, 0x0D, 0xD9, 0x0D, 0xCF, 0x00, 0x02, 0x0D, 0xDC, 0x0D, 0xCA, 0x00, 0x02, 0x0D, 0xD9,
+-    0x0D, 0xDF, 0x00, 0x01, 0x00, 0x04, 0x0D, 0xDA, 0x0D, 0xDC, 0x0D, 0xDD, 0x0D, 0xDE, 0x00, 0x01,
+-    0x00, 0x10, 0x00, 0x01, 0x00, 0x08, 0x00, 0x03, 0x0D, 0xD9, 0x0D, 0xCF, 0x0D, 0xCA, 0x00, 0x01,
+-    0x00, 0x01, 0x0D, 0xDD, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0x32,
+-    0x00, 0x03, 0x00, 0x0C, 0x00, 0x16, 0x00, 0x28, 0x00, 0x01, 0x00, 0x04, 0x0B, 0x94, 0x00, 0x02,
+-    0x0B, 0xD7, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0x0B, 0xCA, 0x00, 0x02, 0x0B, 0xBE, 0x0B, 0xCC,
+-    0x00, 0x02, 0x0B, 0xD7, 0x00, 0x01, 0x00, 0x04, 0x0B, 0xCB, 0x00, 0x02, 0x0B, 0xBE, 0x00, 0x01,
+-    0x00, 0x03, 0x0B, 0x92, 0x0B, 0xC6, 0x0B, 0xC7, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08,
+-    0x00, 0x01, 0x00, 0x26, 0x00, 0x04, 0x00, 0x0E, 0x00, 0x14, 0x00, 0x1A, 0x00, 0x20, 0x00, 0x02,
+-    0x0B, 0x92, 0x0B, 0xD7, 0x00, 0x02, 0x0B, 0xC6, 0x0B, 0xBE, 0x00, 0x02, 0x0B, 0xC7, 0x0B, 0xBE,
+-    0x00, 0x02, 0x0B, 0xC6, 0x0B, 0xD7, 0x00, 0x01, 0x00, 0x04, 0x0B, 0x94, 0x0B, 0xCA, 0x0B, 0xCB,
+-    0x0B, 0xCC, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0x12, 0x00, 0x01,
+-    0x00, 0x08, 0x00, 0x01, 0x00, 0x04, 0x0C, 0x48, 0x00, 0x02, 0x0C, 0x56, 0x00, 0x01, 0x00, 0x01,
+-    0x0C, 0x46, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0x0E, 0x00, 0x01,
+-    0x00, 0x08, 0x00, 0x02, 0x0C, 0x46, 0x0C, 0x56, 0x00, 0x01, 0x00, 0x01, 0x0C, 0x48, 0x00, 0x04,
+-    0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0xEE, 0x00, 0x12, 0x00, 0x2A, 0x00, 0x34,
+-    0x00, 0x3E, 0x00, 0x48, 0x00, 0x52, 0x00, 0x5C, 0x00, 0x66, 0x00, 0x80, 0x00, 0x8A, 0x00, 0x94,
+-    0x00, 0x9E, 0x00, 0xA8, 0x00, 0xB2, 0x00, 0xBC, 0x00, 0xC6, 0x00, 0xD0, 0x00, 0xDA, 0x00, 0xE4,
+-    0x00, 0x01, 0x00, 0x04, 0x0F, 0x69, 0x00, 0x02, 0x0F, 0xB5, 0x00, 0x01, 0x00, 0x04, 0x0F, 0x43,
+-    0x00, 0x02, 0x0F, 0xB7, 0x00, 0x01, 0x00, 0x04, 0x0F, 0x4D, 0x00, 0x02, 0x0F, 0xB7, 0x00, 0x01,
+-    0x00, 0x04, 0x0F, 0x52, 0x00, 0x02, 0x0F, 0xB7, 0x00, 0x01, 0x00, 0x04, 0x0F, 0x57, 0x00, 0x02,
+-    0x0F, 0xB7, 0x00, 0x01, 0x00, 0x04, 0x0F, 0x5C, 0x00, 0x02, 0x0F, 0xB7, 0x00, 0x03, 0x00, 0x08,
+-    0x00, 0x0E, 0x00, 0x14, 0x0F, 0x73, 0x00, 0x02, 0x0F, 0x72, 0x0F, 0x75, 0x00, 0x02, 0x0F, 0x74,
+-    0x0F, 0x81, 0x00, 0x02, 0x0F, 0x80, 0x00, 0x01, 0x00, 0x04, 0x0F, 0x73, 0x00, 0x02, 0x0F, 0x71,
+-    0x00, 0x01, 0x00, 0x04, 0x0F, 0x75, 0x00, 0x02, 0x0F, 0x71, 0x00, 0x01, 0x00, 0x04, 0x0F, 0x81,
+-    0x00, 0x02, 0x0F, 0x71, 0x00, 0x01, 0x00, 0x04, 0x0F, 0xB9, 0x00, 0x02, 0x0F, 0xB5, 0x00, 0x01,
+-    0x00, 0x04, 0x0F, 0x93, 0x00, 0x02, 0x0F, 0xB7, 0x00, 0x01, 0x00, 0x04, 0x0F, 0x9D, 0x00, 0x02,
+-    0x0F, 0xB7, 0x00, 0x01, 0x00, 0x04, 0x0F, 0xA2, 0x00, 0x02, 0x0F, 0xB7, 0x00, 0x01, 0x00, 0x04,
+-    0x0F, 0xA7, 0x00, 0x02, 0x0F, 0xB7, 0x00, 0x01, 0x00, 0x04, 0x0F, 0xAC, 0x00, 0x02, 0x0F, 0xB7,
+-    0x00, 0x01, 0x00, 0x04, 0x0F, 0x76, 0x00, 0x02, 0x0F, 0x80, 0x00, 0x01, 0x00, 0x04, 0x0F, 0x78,
+-    0x00, 0x02, 0x0F, 0x80, 0x00, 0x01, 0x00, 0x12, 0x0F, 0x40, 0x0F, 0x42, 0x0F, 0x4C, 0x0F, 0x51,
+-    0x0F, 0x56, 0x0F, 0x5B, 0x0F, 0x71, 0x0F, 0x72, 0x0F, 0x74, 0x0F, 0x80, 0x0F, 0x90, 0x0F, 0x92,
+-    0x0F, 0x9C, 0x0F, 0xA1, 0x0F, 0xA6, 0x0F, 0xAB, 0x0F, 0xB2, 0x0F, 0xB3, 0x00, 0x02, 0x00, 0x00,
+-    0x00, 0x02, 0x00, 0x0A, 0x00, 0xBE, 0x00, 0x01, 0x00, 0x8E, 0x00, 0x11, 0x00, 0x28, 0x00, 0x2E,
+-    0x00, 0x34, 0x00, 0x3A, 0x00, 0x40, 0x00, 0x46, 0x00, 0x4C, 0x00, 0x52, 0x00, 0x58, 0x00, 0x5E,
+-    0x00, 0x64, 0x00, 0x6A, 0x00, 0x70, 0x00, 0x76, 0x00, 0x7C, 0x00, 0x82, 0x00, 0x88, 0x00, 0x02,
+-    0x0F, 0x42, 0x0F, 0xB7, 0x00, 0x02, 0x0F, 0x4C, 0x0F, 0xB7, 0x00, 0x02, 0x0F, 0x51, 0x0F, 0xB7,
+-    0x00, 0x02, 0x0F, 0x56, 0x0F, 0xB7, 0x00, 0x02, 0x0F, 0x5B, 0x0F, 0xB7, 0x00, 0x02, 0x0F, 0x40,
+-    0x0F, 0xB5, 0x00, 0x02, 0x0F, 0x71, 0x0F, 0x72, 0x00, 0x02, 0x0F, 0x71, 0x0F, 0x74, 0x00, 0x02,
+-    0x0F, 0xB2, 0x0F, 0x80, 0x00, 0x02, 0x0F, 0xB3, 0x0F, 0x80, 0x00, 0x02, 0x0F, 0x71, 0x0F, 0x80,
+-    0x00, 0x02, 0x0F, 0x92, 0x0F, 0xB7, 0x00, 0x02, 0x0F, 0x9C, 0x0F, 0xB7, 0x00, 0x02, 0x0F, 0xA1,
+-    0x0F, 0xB7, 0x00, 0x02, 0x0F, 0xA6, 0x0F, 0xB7, 0x00, 0x02, 0x0F, 0xAB, 0x0F, 0xB7, 0x00, 0x02,
+-    0x0F, 0x90, 0x0F, 0xB5, 0x00, 0x01, 0x00, 0x11, 0x0F, 0x43, 0x0F, 0x4D, 0x0F, 0x52, 0x0F, 0x57,
+-    0x0F, 0x5C, 0x0F, 0x69, 0x0F, 0x73, 0x0F, 0x75, 0x0F, 0x76, 0x0F, 0x78, 0x0F, 0x81, 0x0F, 0x93,
+-    0x0F, 0x9D, 0x0F, 0xA2, 0x0F, 0xA7, 0x0F, 0xAC, 0x0F, 0xB9, 0x00, 0x01, 0x00, 0x1E, 0x00, 0x03,
+-    0x00, 0x0C, 0x00, 0x12, 0x00, 0x18, 0x00, 0x02, 0x0F, 0x72, 0x0F, 0x71, 0x00, 0x02, 0x0F, 0x74,
+-    0x0F, 0x71, 0x00, 0x02, 0x0F, 0x80, 0x0F, 0x71, 0x00, 0x01, 0x00, 0x03, 0x0F, 0x73, 0x0F, 0x75,
+-    0x0F, 0x81
++    0x0C, 0x46, 0x0C, 0x56, 0x00, 0x01, 0x00, 0x01, 0x0C, 0x48, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01,
++    0x00, 0x08, 0x00, 0x01, 0x00, 0x8A, 0x00, 0x0B, 0x00, 0x1C, 0x00, 0x26, 0x00, 0x30, 0x00, 0x3A,
++    0x00, 0x44, 0x00, 0x4E, 0x00, 0x58, 0x00, 0x62, 0x00, 0x6C, 0x00, 0x76, 0x00, 0x80, 0x00, 0x01,
++    0x00, 0x04, 0x1B, 0x06, 0x00, 0x02, 0x1B, 0x35, 0x00, 0x01, 0x00, 0x04, 0x1B, 0x08, 0x00, 0x02,
++    0x1B, 0x35, 0x00, 0x01, 0x00, 0x04, 0x1B, 0x0A, 0x00, 0x02, 0x1B, 0x35, 0x00, 0x01, 0x00, 0x04,
++    0x1B, 0x0C, 0x00, 0x02, 0x1B, 0x35, 0x00, 0x01, 0x00, 0x04, 0x1B, 0x0E, 0x00, 0x02, 0x1B, 0x35,
++    0x00, 0x01, 0x00, 0x04, 0x1B, 0x12, 0x00, 0x02, 0x1B, 0x35, 0x00, 0x01, 0x00, 0x04, 0x1B, 0x3B,
++    0x00, 0x02, 0x1B, 0x35, 0x00, 0x01, 0x00, 0x04, 0x1B, 0x3D, 0x00, 0x02, 0x1B, 0x35, 0x00, 0x01,
++    0x00, 0x04, 0x1B, 0x40, 0x00, 0x02, 0x1B, 0x35, 0x00, 0x01, 0x00, 0x04, 0x1B, 0x41, 0x00, 0x02,
++    0x1B, 0x35, 0x00, 0x01, 0x00, 0x04, 0x1B, 0x43, 0x00, 0x02, 0x1B, 0x35, 0x00, 0x01, 0x00, 0x0B,
++    0x1B, 0x05, 0x1B, 0x07, 0x1B, 0x09, 0x1B, 0x0B, 0x1B, 0x0D, 0x1B, 0x11, 0x1B, 0x3A, 0x1B, 0x3C,
++    0x1B, 0x3E, 0x1B, 0x3F, 0x1B, 0x42, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01,
++    0x00, 0x5E, 0x00, 0x0B, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x28, 0x00, 0x2E, 0x00, 0x34, 0x00, 0x3A,
++    0x00, 0x40, 0x00, 0x46, 0x00, 0x4C, 0x00, 0x52, 0x00, 0x58, 0x00, 0x02, 0x1B, 0x05, 0x1B, 0x35,
++    0x00, 0x02, 0x1B, 0x07, 0x1B, 0x35, 0x00, 0x02, 0x1B, 0x09, 0x1B, 0x35, 0x00, 0x02, 0x1B, 0x0B,
++    0x1B, 0x35, 0x00, 0x02, 0x1B, 0x0D, 0x1B, 0x35, 0x00, 0x02, 0x1B, 0x11, 0x1B, 0x35, 0x00, 0x02,
++    0x1B, 0x3A, 0x1B, 0x35, 0x00, 0x02, 0x1B, 0x3C, 0x1B, 0x35, 0x00, 0x02, 0x1B, 0x3E, 0x1B, 0x35,
++    0x00, 0x02, 0x1B, 0x3F, 0x1B, 0x35, 0x00, 0x02, 0x1B, 0x42, 0x1B, 0x35, 0x00, 0x01, 0x00, 0x0B,
++    0x1B, 0x06, 0x1B, 0x08, 0x1B, 0x0A, 0x1B, 0x0C, 0x1B, 0x0E, 0x1B, 0x12, 0x1B, 0x3B, 0x1B, 0x3D,
++    0x1B, 0x40, 0x1B, 0x41, 0x1B, 0x43
+ };
+ 
+ const le_uint8 CanonShaping::glyphDefinitionTable[] = {
+@@ -3701,7 +3561,7 @@
+     0xFC, 0x00, 0xFC, 0x5D, 0x00, 0x02, 0xFC, 0x64, 0xFC, 0xF1, 0x00, 0x02, 0xFC, 0xF5, 0xFD, 0x3D,
+     0x00, 0x02, 0xFD, 0x50, 0xFD, 0x8F, 0x00, 0x02, 0xFD, 0x92, 0xFD, 0xC7, 0x00, 0x02, 0xFD, 0xF0,
+     0xFD, 0xFC, 0x00, 0x02, 0xFE, 0x80, 0xFE, 0xF4, 0x00, 0x01, 0xFE, 0xF5, 0xFE, 0xFC, 0x00, 0x02,
+-    0x00, 0x02, 0x00, 0xC1, 0x03, 0x00, 0x03, 0x14, 0x00, 0xE6, 0x03, 0x15, 0x03, 0x15, 0x00, 0xE8,
++    0x00, 0x02, 0x00, 0xCE, 0x03, 0x00, 0x03, 0x14, 0x00, 0xE6, 0x03, 0x15, 0x03, 0x15, 0x00, 0xE8,
+     0x03, 0x16, 0x03, 0x19, 0x00, 0xDC, 0x03, 0x1A, 0x03, 0x1A, 0x00, 0xE8, 0x03, 0x1B, 0x03, 0x1B,
+     0x00, 0xD8, 0x03, 0x1C, 0x03, 0x20, 0x00, 0xDC, 0x03, 0x21, 0x03, 0x22, 0x00, 0xCA, 0x03, 0x23,
+     0x03, 0x26, 0x00, 0xDC, 0x03, 0x27, 0x03, 0x28, 0x00, 0xCA, 0x03, 0x29, 0x03, 0x33, 0x00, 0xDC,
+@@ -3719,61 +3579,66 @@
+     0x05, 0xA7, 0x00, 0xDC, 0x05, 0xA8, 0x05, 0xA8, 0x00, 0xE6, 0x05, 0xA9, 0x05, 0xA9, 0x00, 0xE8,
+     0x05, 0xAA, 0x05, 0xAA, 0x00, 0xDC, 0x05, 0xAB, 0x05, 0xAC, 0x00, 0xE6, 0x05, 0xAD, 0x05, 0xAD,
+     0x00, 0xDE, 0x05, 0xAE, 0x05, 0xAE, 0x00, 0xE8, 0x05, 0xAF, 0x05, 0xAF, 0x00, 0xE6, 0x05, 0xB0,
+-    0x05, 0xB8, 0x00, 0xDC, 0x05, 0xB9, 0x05, 0xB9, 0x00, 0x1B, 0x05, 0xBB, 0x05, 0xBB, 0x00, 0xDC,
+-    0x05, 0xBC, 0x05, 0xBC, 0x00, 0x15, 0x05, 0xBD, 0x05, 0xBD, 0x00, 0xDC, 0x05, 0xBF, 0x05, 0xBF,
+-    0x00, 0x17, 0x05, 0xC1, 0x05, 0xC1, 0x00, 0x0A, 0x05, 0xC2, 0x05, 0xC2, 0x00, 0x0B, 0x05, 0xC4,
+-    0x05, 0xC4, 0x00, 0xE6, 0x05, 0xC5, 0x05, 0xC5, 0x00, 0xDC, 0x05, 0xC7, 0x05, 0xC7, 0x00, 0x12,
+-    0x06, 0x10, 0x06, 0x15, 0x00, 0xE6, 0x06, 0x4B, 0x06, 0x4C, 0x00, 0x1F, 0x06, 0x4D, 0x06, 0x4D,
+-    0x00, 0x1E, 0x06, 0x4E, 0x06, 0x4F, 0x00, 0x1F, 0x06, 0x50, 0x06, 0x50, 0x00, 0x1E, 0x06, 0x51,
+-    0x06, 0x51, 0x00, 0x1C, 0x06, 0x52, 0x06, 0x52, 0x00, 0x1F, 0x06, 0x53, 0x06, 0x53, 0x00, 0x20,
+-    0x06, 0x54, 0x06, 0x55, 0x00, 0x1B, 0x06, 0x56, 0x06, 0x56, 0x00, 0x1D, 0x06, 0x57, 0x06, 0x58,
+-    0x00, 0x1F, 0x06, 0x59, 0x06, 0x5B, 0x00, 0xE6, 0x06, 0x5C, 0x06, 0x5C, 0x00, 0xDC, 0x06, 0x5D,
+-    0x06, 0x5E, 0x00, 0xE6, 0x06, 0x70, 0x06, 0x70, 0x00, 0x1D, 0x06, 0xD6, 0x06, 0xDC, 0x00, 0xE6,
+-    0x06, 0xDF, 0x06, 0xE0, 0x00, 0xE6, 0x06, 0xE1, 0x06, 0xE1, 0x00, 0x1F, 0x06, 0xE2, 0x06, 0xE2,
+-    0x00, 0xE6, 0x06, 0xE3, 0x06, 0xE3, 0x00, 0xDC, 0x06, 0xE4, 0x06, 0xE4, 0x00, 0xE6, 0x06, 0xE7,
+-    0x06, 0xE8, 0x00, 0xE6, 0x06, 0xEA, 0x06, 0xEA, 0x00, 0xDC, 0x06, 0xEB, 0x06, 0xEC, 0x00, 0xE6,
+-    0x06, 0xED, 0x06, 0xED, 0x00, 0xDC, 0x07, 0x11, 0x07, 0x11, 0x00, 0x24, 0x07, 0x30, 0x07, 0x30,
+-    0x00, 0xE6, 0x07, 0x31, 0x07, 0x31, 0x00, 0xDC, 0x07, 0x32, 0x07, 0x33, 0x00, 0xE6, 0x07, 0x34,
+-    0x07, 0x34, 0x00, 0xDC, 0x07, 0x35, 0x07, 0x36, 0x00, 0xE6, 0x07, 0x37, 0x07, 0x39, 0x00, 0xDC,
+-    0x07, 0x3A, 0x07, 0x3A, 0x00, 0xE6, 0x07, 0x3B, 0x07, 0x3C, 0x00, 0xDC, 0x07, 0x3D, 0x07, 0x3D,
+-    0x00, 0xE6, 0x07, 0x3E, 0x07, 0x3E, 0x00, 0xDC, 0x07, 0x3F, 0x07, 0x41, 0x00, 0xE6, 0x07, 0x42,
+-    0x07, 0x42, 0x00, 0xDC, 0x07, 0x43, 0x07, 0x43, 0x00, 0xE6, 0x07, 0x44, 0x07, 0x44, 0x00, 0xDC,
+-    0x07, 0x45, 0x07, 0x45, 0x00, 0xE6, 0x07, 0x46, 0x07, 0x46, 0x00, 0xDC, 0x07, 0x47, 0x07, 0x47,
+-    0x00, 0xE6, 0x07, 0x48, 0x07, 0x48, 0x00, 0xDC, 0x07, 0x49, 0x07, 0x4A, 0x00, 0xE6, 0x09, 0x3C,
+-    0x09, 0x3C, 0x00, 0x07, 0x09, 0x4D, 0x09, 0x4D, 0x00, 0x09, 0x09, 0x51, 0x09, 0x51, 0x00, 0xE6,
+-    0x09, 0x52, 0x09, 0x52, 0x00, 0xDC, 0x09, 0x53, 0x09, 0x54, 0x00, 0xE6, 0x09, 0xBC, 0x09, 0xBC,
+-    0x00, 0x07, 0x09, 0xCD, 0x09, 0xCD, 0x00, 0x09, 0x0A, 0x3C, 0x0A, 0x3C, 0x00, 0x07, 0x0A, 0x4D,
+-    0x0A, 0x4D, 0x00, 0x09, 0x0A, 0xBC, 0x0A, 0xBC, 0x00, 0x07, 0x0A, 0xCD, 0x0A, 0xCD, 0x00, 0x09,
+-    0x0B, 0x3C, 0x0B, 0x3C, 0x00, 0x07, 0x0B, 0x4D, 0x0B, 0x4D, 0x00, 0x09, 0x0B, 0xCD, 0x0B, 0xCD,
+-    0x00, 0x09, 0x0C, 0x4D, 0x0C, 0x4D, 0x00, 0x09, 0x0C, 0x55, 0x0C, 0x55, 0x00, 0x54, 0x0C, 0x56,
+-    0x0C, 0x56, 0x00, 0x5B, 0x0C, 0xBC, 0x0C, 0xBC, 0x00, 0x07, 0x0C, 0xCD, 0x0C, 0xCD, 0x00, 0x09,
+-    0x0D, 0x4D, 0x0D, 0x4D, 0x00, 0x09, 0x0D, 0xCA, 0x0D, 0xCA, 0x00, 0x09, 0x0E, 0x38, 0x0E, 0x39,
+-    0x00, 0x67, 0x0E, 0x3A, 0x0E, 0x3A, 0x00, 0x09, 0x0E, 0x48, 0x0E, 0x4B, 0x00, 0x6B, 0x0E, 0xB8,
+-    0x0E, 0xB9, 0x00, 0x76, 0x0E, 0xC8, 0x0E, 0xCB, 0x00, 0x7A, 0x0F, 0x18, 0x0F, 0x19, 0x00, 0xDC,
+-    0x0F, 0x35, 0x0F, 0x35, 0x00, 0xDC, 0x0F, 0x37, 0x0F, 0x37, 0x00, 0xDC, 0x0F, 0x39, 0x0F, 0x39,
+-    0x00, 0xD8, 0x0F, 0x71, 0x0F, 0x71, 0x00, 0x81, 0x0F, 0x72, 0x0F, 0x72, 0x00, 0x82, 0x0F, 0x74,
+-    0x0F, 0x74, 0x00, 0x84, 0x0F, 0x7A, 0x0F, 0x7D, 0x00, 0x82, 0x0F, 0x80, 0x0F, 0x80, 0x00, 0x82,
+-    0x0F, 0x82, 0x0F, 0x83, 0x00, 0xE6, 0x0F, 0x84, 0x0F, 0x84, 0x00, 0x09, 0x0F, 0x86, 0x0F, 0x87,
+-    0x00, 0xE6, 0x0F, 0xC6, 0x0F, 0xC6, 0x00, 0xDC, 0x10, 0x37, 0x10, 0x37, 0x00, 0x07, 0x10, 0x39,
+-    0x10, 0x39, 0x00, 0x09, 0x13, 0x5F, 0x13, 0x5F, 0x00, 0xE6, 0x17, 0x14, 0x17, 0x14, 0x00, 0x09,
+-    0x17, 0x34, 0x17, 0x34, 0x00, 0x09, 0x17, 0xD2, 0x17, 0xD2, 0x00, 0x09, 0x17, 0xDD, 0x17, 0xDD,
+-    0x00, 0xE6, 0x18, 0xA9, 0x18, 0xA9, 0x00, 0xE4, 0x19, 0x39, 0x19, 0x39, 0x00, 0xDE, 0x19, 0x3A,
+-    0x19, 0x3A, 0x00, 0xE6, 0x19, 0x3B, 0x19, 0x3B, 0x00, 0xDC, 0x1A, 0x17, 0x1A, 0x17, 0x00, 0xE6,
+-    0x1A, 0x18, 0x1A, 0x18, 0x00, 0xDC, 0x1D, 0xC0, 0x1D, 0xC1, 0x00, 0xE6, 0x1D, 0xC2, 0x1D, 0xC2,
+-    0x00, 0xDC, 0x1D, 0xC3, 0x1D, 0xC3, 0x00, 0xE6, 0x20, 0xD0, 0x20, 0xD1, 0x00, 0xE6, 0x20, 0xD2,
+-    0x20, 0xD3, 0x00, 0x01, 0x20, 0xD4, 0x20, 0xD7, 0x00, 0xE6, 0x20, 0xD8, 0x20, 0xDA, 0x00, 0x01,
+-    0x20, 0xDB, 0x20, 0xDC, 0x00, 0xE6, 0x20, 0xE1, 0x20, 0xE1, 0x00, 0xE6, 0x20, 0xE5, 0x20, 0xE6,
+-    0x00, 0x01, 0x20, 0xE7, 0x20, 0xE7, 0x00, 0xE6, 0x20, 0xE8, 0x20, 0xE8, 0x00, 0xDC, 0x20, 0xE9,
+-    0x20, 0xE9, 0x00, 0xE6, 0x20, 0xEA, 0x20, 0xEB, 0x00, 0x01, 0x30, 0x2A, 0x30, 0x2A, 0x00, 0xDA,
+-    0x30, 0x2B, 0x30, 0x2B, 0x00, 0xE4, 0x30, 0x2C, 0x30, 0x2C, 0x00, 0xE8, 0x30, 0x2D, 0x30, 0x2D,
+-    0x00, 0xDE, 0x30, 0x2E, 0x30, 0x2F, 0x00, 0xE0, 0x30, 0x99, 0x30, 0x9A, 0x00, 0x08, 0xA8, 0x06,
+-    0xA8, 0x06, 0x00, 0x09, 0xFB, 0x1E, 0xFB, 0x1E, 0x00, 0x1A, 0xFE, 0x20, 0xFE, 0x23, 0x00, 0xE6,
+-    0x0A, 0x0D, 0x0A, 0x0D, 0x00, 0xDC, 0x0A, 0x0F, 0x0A, 0x0F, 0x00, 0xE6, 0x0A, 0x38, 0x0A, 0x38,
+-    0x00, 0xE6, 0x0A, 0x39, 0x0A, 0x39, 0x00, 0x01, 0x0A, 0x3A, 0x0A, 0x3A, 0x00, 0xDC, 0x0A, 0x3F,
+-    0x0A, 0x3F, 0x00, 0x09, 0xD1, 0x65, 0xD1, 0x66, 0x00, 0xD8, 0xD1, 0x67, 0xD1, 0x69, 0x00, 0x01,
+-    0xD1, 0x6D, 0xD1, 0x6D, 0x00, 0xE2, 0xD1, 0x6E, 0xD1, 0x72, 0x00, 0xD8, 0xD1, 0x7B, 0xD1, 0x82,
+-    0x00, 0xDC, 0xD1, 0x85, 0xD1, 0x89, 0x00, 0xE6, 0xD1, 0x8A, 0xD1, 0x8B, 0x00, 0xDC, 0xD1, 0xAA,
+-    0xD1, 0xAD, 0x00, 0xE6, 0xD2, 0x42, 0xD2, 0x44, 0x00, 0xE6
++    0x05, 0xB8, 0x00, 0xDC, 0x05, 0xB9, 0x05, 0xB9, 0x00, 0x1B, 0x05, 0xBA, 0x05, 0xBA, 0x00, 0x13,
++    0x05, 0xBB, 0x05, 0xBB, 0x00, 0xDC, 0x05, 0xBC, 0x05, 0xBC, 0x00, 0x15, 0x05, 0xBD, 0x05, 0xBD,
++    0x00, 0xDC, 0x05, 0xBF, 0x05, 0xBF, 0x00, 0x17, 0x05, 0xC1, 0x05, 0xC1, 0x00, 0x0A, 0x05, 0xC2,
++    0x05, 0xC2, 0x00, 0x0B, 0x05, 0xC4, 0x05, 0xC4, 0x00, 0xE6, 0x05, 0xC5, 0x05, 0xC5, 0x00, 0xDC,
++    0x05, 0xC7, 0x05, 0xC7, 0x00, 0x12, 0x06, 0x10, 0x06, 0x15, 0x00, 0xE6, 0x06, 0x4B, 0x06, 0x4C,
++    0x00, 0x1F, 0x06, 0x4D, 0x06, 0x4D, 0x00, 0x1E, 0x06, 0x4E, 0x06, 0x4F, 0x00, 0x1F, 0x06, 0x50,
++    0x06, 0x50, 0x00, 0x1E, 0x06, 0x51, 0x06, 0x51, 0x00, 0x1C, 0x06, 0x52, 0x06, 0x52, 0x00, 0x1F,
++    0x06, 0x53, 0x06, 0x53, 0x00, 0x20, 0x06, 0x54, 0x06, 0x55, 0x00, 0x1B, 0x06, 0x56, 0x06, 0x56,
++    0x00, 0x1D, 0x06, 0x57, 0x06, 0x58, 0x00, 0x1F, 0x06, 0x59, 0x06, 0x5B, 0x00, 0xE6, 0x06, 0x5C,
++    0x06, 0x5C, 0x00, 0xDC, 0x06, 0x5D, 0x06, 0x5E, 0x00, 0xE6, 0x06, 0x70, 0x06, 0x70, 0x00, 0x1D,
++    0x06, 0xD6, 0x06, 0xDC, 0x00, 0xE6, 0x06, 0xDF, 0x06, 0xE0, 0x00, 0xE6, 0x06, 0xE1, 0x06, 0xE1,
++    0x00, 0x1F, 0x06, 0xE2, 0x06, 0xE2, 0x00, 0xE6, 0x06, 0xE3, 0x06, 0xE3, 0x00, 0xDC, 0x06, 0xE4,
++    0x06, 0xE4, 0x00, 0xE6, 0x06, 0xE7, 0x06, 0xE8, 0x00, 0xE6, 0x06, 0xEA, 0x06, 0xEA, 0x00, 0xDC,
++    0x06, 0xEB, 0x06, 0xEC, 0x00, 0xE6, 0x06, 0xED, 0x06, 0xED, 0x00, 0xDC, 0x07, 0x11, 0x07, 0x11,
++    0x00, 0x24, 0x07, 0x30, 0x07, 0x30, 0x00, 0xE6, 0x07, 0x31, 0x07, 0x31, 0x00, 0xDC, 0x07, 0x32,
++    0x07, 0x33, 0x00, 0xE6, 0x07, 0x34, 0x07, 0x34, 0x00, 0xDC, 0x07, 0x35, 0x07, 0x36, 0x00, 0xE6,
++    0x07, 0x37, 0x07, 0x39, 0x00, 0xDC, 0x07, 0x3A, 0x07, 0x3A, 0x00, 0xE6, 0x07, 0x3B, 0x07, 0x3C,
++    0x00, 0xDC, 0x07, 0x3D, 0x07, 0x3D, 0x00, 0xE6, 0x07, 0x3E, 0x07, 0x3E, 0x00, 0xDC, 0x07, 0x3F,
++    0x07, 0x41, 0x00, 0xE6, 0x07, 0x42, 0x07, 0x42, 0x00, 0xDC, 0x07, 0x43, 0x07, 0x43, 0x00, 0xE6,
++    0x07, 0x44, 0x07, 0x44, 0x00, 0xDC, 0x07, 0x45, 0x07, 0x45, 0x00, 0xE6, 0x07, 0x46, 0x07, 0x46,
++    0x00, 0xDC, 0x07, 0x47, 0x07, 0x47, 0x00, 0xE6, 0x07, 0x48, 0x07, 0x48, 0x00, 0xDC, 0x07, 0x49,
++    0x07, 0x4A, 0x00, 0xE6, 0x07, 0xEB, 0x07, 0xF1, 0x00, 0xE6, 0x07, 0xF2, 0x07, 0xF2, 0x00, 0xDC,
++    0x07, 0xF3, 0x07, 0xF3, 0x00, 0xE6, 0x09, 0x3C, 0x09, 0x3C, 0x00, 0x07, 0x09, 0x4D, 0x09, 0x4D,
++    0x00, 0x09, 0x09, 0x51, 0x09, 0x51, 0x00, 0xE6, 0x09, 0x52, 0x09, 0x52, 0x00, 0xDC, 0x09, 0x53,
++    0x09, 0x54, 0x00, 0xE6, 0x09, 0xBC, 0x09, 0xBC, 0x00, 0x07, 0x09, 0xCD, 0x09, 0xCD, 0x00, 0x09,
++    0x0A, 0x3C, 0x0A, 0x3C, 0x00, 0x07, 0x0A, 0x4D, 0x0A, 0x4D, 0x00, 0x09, 0x0A, 0xBC, 0x0A, 0xBC,
++    0x00, 0x07, 0x0A, 0xCD, 0x0A, 0xCD, 0x00, 0x09, 0x0B, 0x3C, 0x0B, 0x3C, 0x00, 0x07, 0x0B, 0x4D,
++    0x0B, 0x4D, 0x00, 0x09, 0x0B, 0xCD, 0x0B, 0xCD, 0x00, 0x09, 0x0C, 0x4D, 0x0C, 0x4D, 0x00, 0x09,
++    0x0C, 0x55, 0x0C, 0x55, 0x00, 0x54, 0x0C, 0x56, 0x0C, 0x56, 0x00, 0x5B, 0x0C, 0xBC, 0x0C, 0xBC,
++    0x00, 0x07, 0x0C, 0xCD, 0x0C, 0xCD, 0x00, 0x09, 0x0D, 0x4D, 0x0D, 0x4D, 0x00, 0x09, 0x0D, 0xCA,
++    0x0D, 0xCA, 0x00, 0x09, 0x0E, 0x38, 0x0E, 0x39, 0x00, 0x67, 0x0E, 0x3A, 0x0E, 0x3A, 0x00, 0x09,
++    0x0E, 0x48, 0x0E, 0x4B, 0x00, 0x6B, 0x0E, 0xB8, 0x0E, 0xB9, 0x00, 0x76, 0x0E, 0xC8, 0x0E, 0xCB,
++    0x00, 0x7A, 0x0F, 0x18, 0x0F, 0x19, 0x00, 0xDC, 0x0F, 0x35, 0x0F, 0x35, 0x00, 0xDC, 0x0F, 0x37,
++    0x0F, 0x37, 0x00, 0xDC, 0x0F, 0x39, 0x0F, 0x39, 0x00, 0xD8, 0x0F, 0x71, 0x0F, 0x71, 0x00, 0x81,
++    0x0F, 0x72, 0x0F, 0x72, 0x00, 0x82, 0x0F, 0x74, 0x0F, 0x74, 0x00, 0x84, 0x0F, 0x7A, 0x0F, 0x7D,
++    0x00, 0x82, 0x0F, 0x80, 0x0F, 0x80, 0x00, 0x82, 0x0F, 0x82, 0x0F, 0x83, 0x00, 0xE6, 0x0F, 0x84,
++    0x0F, 0x84, 0x00, 0x09, 0x0F, 0x86, 0x0F, 0x87, 0x00, 0xE6, 0x0F, 0xC6, 0x0F, 0xC6, 0x00, 0xDC,
++    0x10, 0x37, 0x10, 0x37, 0x00, 0x07, 0x10, 0x39, 0x10, 0x39, 0x00, 0x09, 0x13, 0x5F, 0x13, 0x5F,
++    0x00, 0xE6, 0x17, 0x14, 0x17, 0x14, 0x00, 0x09, 0x17, 0x34, 0x17, 0x34, 0x00, 0x09, 0x17, 0xD2,
++    0x17, 0xD2, 0x00, 0x09, 0x17, 0xDD, 0x17, 0xDD, 0x00, 0xE6, 0x18, 0xA9, 0x18, 0xA9, 0x00, 0xE4,
++    0x19, 0x39, 0x19, 0x39, 0x00, 0xDE, 0x19, 0x3A, 0x19, 0x3A, 0x00, 0xE6, 0x19, 0x3B, 0x19, 0x3B,
++    0x00, 0xDC, 0x1A, 0x17, 0x1A, 0x17, 0x00, 0xE6, 0x1A, 0x18, 0x1A, 0x18, 0x00, 0xDC, 0x1B, 0x34,
++    0x1B, 0x34, 0x00, 0x07, 0x1B, 0x44, 0x1B, 0x44, 0x00, 0x09, 0x1B, 0x6B, 0x1B, 0x6B, 0x00, 0xE6,
++    0x1B, 0x6C, 0x1B, 0x6C, 0x00, 0xDC, 0x1B, 0x6D, 0x1B, 0x73, 0x00, 0xE6, 0x1D, 0xC0, 0x1D, 0xC1,
++    0x00, 0xE6, 0x1D, 0xC2, 0x1D, 0xC2, 0x00, 0xDC, 0x1D, 0xC3, 0x1D, 0xC9, 0x00, 0xE6, 0x1D, 0xCA,
++    0x1D, 0xCA, 0x00, 0xDC, 0x1D, 0xFE, 0x1D, 0xFE, 0x00, 0xE6, 0x1D, 0xFF, 0x1D, 0xFF, 0x00, 0xDC,
++    0x20, 0xD0, 0x20, 0xD1, 0x00, 0xE6, 0x20, 0xD2, 0x20, 0xD3, 0x00, 0x01, 0x20, 0xD4, 0x20, 0xD7,
++    0x00, 0xE6, 0x20, 0xD8, 0x20, 0xDA, 0x00, 0x01, 0x20, 0xDB, 0x20, 0xDC, 0x00, 0xE6, 0x20, 0xE1,
++    0x20, 0xE1, 0x00, 0xE6, 0x20, 0xE5, 0x20, 0xE6, 0x00, 0x01, 0x20, 0xE7, 0x20, 0xE7, 0x00, 0xE6,
++    0x20, 0xE8, 0x20, 0xE8, 0x00, 0xDC, 0x20, 0xE9, 0x20, 0xE9, 0x00, 0xE6, 0x20, 0xEA, 0x20, 0xEB,
++    0x00, 0x01, 0x20, 0xEC, 0x20, 0xEF, 0x00, 0xDC, 0x30, 0x2A, 0x30, 0x2A, 0x00, 0xDA, 0x30, 0x2B,
++    0x30, 0x2B, 0x00, 0xE4, 0x30, 0x2C, 0x30, 0x2C, 0x00, 0xE8, 0x30, 0x2D, 0x30, 0x2D, 0x00, 0xDE,
++    0x30, 0x2E, 0x30, 0x2F, 0x00, 0xE0, 0x30, 0x99, 0x30, 0x9A, 0x00, 0x08, 0xA8, 0x06, 0xA8, 0x06,
++    0x00, 0x09, 0xFB, 0x1E, 0xFB, 0x1E, 0x00, 0x1A, 0xFE, 0x20, 0xFE, 0x23, 0x00, 0xE6, 0x0A, 0x0D,
++    0x0A, 0x0D, 0x00, 0xDC, 0x0A, 0x0F, 0x0A, 0x0F, 0x00, 0xE6, 0x0A, 0x38, 0x0A, 0x38, 0x00, 0xE6,
++    0x0A, 0x39, 0x0A, 0x39, 0x00, 0x01, 0x0A, 0x3A, 0x0A, 0x3A, 0x00, 0xDC, 0x0A, 0x3F, 0x0A, 0x3F,
++    0x00, 0x09, 0xD1, 0x65, 0xD1, 0x66, 0x00, 0xD8, 0xD1, 0x67, 0xD1, 0x69, 0x00, 0x01, 0xD1, 0x6D,
++    0xD1, 0x6D, 0x00, 0xE2, 0xD1, 0x6E, 0xD1, 0x72, 0x00, 0xD8, 0xD1, 0x7B, 0xD1, 0x82, 0x00, 0xDC,
++    0xD1, 0x85, 0xD1, 0x89, 0x00, 0xE6, 0xD1, 0x8A, 0xD1, 0x8B, 0x00, 0xDC, 0xD1, 0xAA, 0xD1, 0xAD,
++    0x00, 0xE6, 0xD2, 0x42, 0xD2, 0x44, 0x00, 0xE6
+ };
+ 
+ U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/CanonShaping.h b/src/share/native/sun/font/layout/CanonShaping.h
+--- jdk/src/share/native/sun/font/layout/CanonShaping.h
++++ jdk/src/share/native/sun/font/layout/CanonShaping.h
+@@ -38,7 +38,7 @@
+ 
+ class LEGlyphStorage;
+ 
+-class CanonShaping /* not : public UObject because all members are static */
++class U_LAYOUT_API CanonShaping /* not : public UObject because all members are static */
+ {
+ public:
+     static const le_uint8 glyphSubstitutionTable[];
+diff --git a/src/share/native/sun/font/layout/ClassDefinitionTables.cpp b/src/share/native/sun/font/layout/ClassDefinitionTables.cpp
+--- jdk/src/share/native/sun/font/layout/ClassDefinitionTables.cpp
++++ jdk/src/share/native/sun/font/layout/ClassDefinitionTables.cpp
+@@ -93,7 +93,7 @@
+     TTGlyphID firstGlyph = SWAPW(startGlyph);
+     TTGlyphID lastGlyph  = firstGlyph + SWAPW(glyphCount);
+ 
+-    if (ttGlyphID > firstGlyph && ttGlyphID < lastGlyph) {
++    if (ttGlyphID >= firstGlyph && ttGlyphID < lastGlyph) {
+         return SWAPW(classValueArray[ttGlyphID - firstGlyph]);
+     }
+ 
+diff --git a/src/share/native/sun/font/layout/ContextualSubstSubtables.cpp b/src/share/native/sun/font/layout/ContextualSubstSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/ContextualSubstSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/ContextualSubstSubtables.cpp
+@@ -52,18 +52,23 @@
+         le_uint16 substCount,
+         GlyphIterator *glyphIterator,
+         const LEFontInstance *fontInstance,
+-        le_int32 position)
++        le_int32 position,
++        LEErrorCode& success)
+ {
++    if (LE_FAILURE(success)) {
++        return;
++    }
++
+     GlyphIterator tempIterator(*glyphIterator);
+ 
+-    for (le_int16 subst = 0; subst < substCount; subst += 1) {
++    for (le_int16 subst = 0; subst < substCount && LE_SUCCESS(success); subst += 1) {
+         le_uint16 sequenceIndex = SWAPW(substLookupRecordArray[subst].sequenceIndex);
+         le_uint16 lookupListIndex = SWAPW(substLookupRecordArray[subst].lookupListIndex);
+ 
+         tempIterator.setCurrStreamPosition(position);
+         tempIterator.next(sequenceIndex);
+ 
+-        lookupProcessor->applySingleLookup(lookupListIndex, &tempIterator, fontInstance);
++        lookupProcessor->applySingleLookup(lookupListIndex, &tempIterator, fontInstance, success);
+     }
+ }
+ 
+@@ -165,9 +170,15 @@
+     return TRUE;
+ }
+ 
+-le_uint32 ContextualSubstitutionSubtable::process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator,
+-                                               const LEFontInstance *fontInstance) const
++le_uint32 ContextualSubstitutionSubtable::process(const LookupProcessor *lookupProcessor,
++                                                  GlyphIterator *glyphIterator,
++                                                  const LEFontInstance *fontInstance,
++                                                  LEErrorCode& success) const
+ {
++    if (LE_FAILURE(success)) {
++        return 0;
++    }
++
+     switch(SWAPW(subtableFormat))
+     {
+     case 0:
+@@ -176,22 +187,19 @@
+     case 1:
+     {
+         const ContextualSubstitutionFormat1Subtable *subtable = (const ContextualSubstitutionFormat1Subtable *) this;
+-
+-        return subtable->process(lookupProcessor, glyphIterator, fontInstance);
++        return subtable->process(lookupProcessor, glyphIterator, fontInstance, success);
+     }
+ 
+     case 2:
+     {
+         const ContextualSubstitutionFormat2Subtable *subtable = (const ContextualSubstitutionFormat2Subtable *) this;
+-
+-        return subtable->process(lookupProcessor, glyphIterator, fontInstance);
++        return subtable->process(lookupProcessor, glyphIterator, fontInstance, success);
+     }
+ 
+     case 3:
+     {
+         const ContextualSubstitutionFormat3Subtable *subtable = (const ContextualSubstitutionFormat3Subtable *) this;
+-
+-        return subtable->process(lookupProcessor, glyphIterator, fontInstance);
++        return subtable->process(lookupProcessor, glyphIterator, fontInstance, success);
+     }
+ 
+     default:
+@@ -199,9 +207,15 @@
+     }
+ }
+ 
+-le_uint32 ContextualSubstitutionFormat1Subtable::process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator,
+-                                                      const LEFontInstance *fontInstance) const
++le_uint32 ContextualSubstitutionFormat1Subtable::process(const LookupProcessor *lookupProcessor,
++                                                         GlyphIterator *glyphIterator,
++                                                         const LEFontInstance *fontInstance,
++                                                         LEErrorCode& success) const
+ {
++    if (LE_FAILURE(success)) {
++        return 0;
++    }
++
+     LEGlyphID glyph = glyphIterator->getCurrGlyphID();
+     le_int32 coverageIndex = getGlyphCoverage(glyph);
+ 
+@@ -227,7 +241,7 @@
+                     const SubstitutionLookupRecord *substLookupRecordArray =
+                         (const SubstitutionLookupRecord *) &subRuleTable->inputGlyphArray[matchCount];
+ 
+-                    applySubstitutionLookups(lookupProcessor, substLookupRecordArray, substCount, glyphIterator, fontInstance, position);
++                    applySubstitutionLookups(lookupProcessor, substLookupRecordArray, substCount, glyphIterator, fontInstance, position, success);
+ 
+                     return matchCount + 1;
+                 }
+@@ -242,9 +256,15 @@
+     return 0;
+ }
+ 
+-le_uint32 ContextualSubstitutionFormat2Subtable::process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator,
+-                                                      const LEFontInstance *fontInstance) const
++le_uint32 ContextualSubstitutionFormat2Subtable::process(const LookupProcessor *lookupProcessor,
++                                                         GlyphIterator *glyphIterator,
++                                                         const LEFontInstance *fontInstance,
++                                                         LEErrorCode& success) const
+ {
++    if (LE_FAILURE(success)) {
++        return 0;
++    }
++
+     LEGlyphID glyph = glyphIterator->getCurrGlyphID();
+     le_int32 coverageIndex = getGlyphCoverage(glyph);
+ 
+@@ -273,7 +293,7 @@
+                     const SubstitutionLookupRecord *substLookupRecordArray =
+                         (const SubstitutionLookupRecord *) &subClassRuleTable->classArray[matchCount];
+ 
+-                    applySubstitutionLookups(lookupProcessor, substLookupRecordArray, substCount, glyphIterator, fontInstance, position);
++                    applySubstitutionLookups(lookupProcessor, substLookupRecordArray, substCount, glyphIterator, fontInstance, position, success);
+ 
+                     return matchCount + 1;
+                 }
+@@ -288,9 +308,15 @@
+     return 0;
+ }
+ 
+-le_uint32 ContextualSubstitutionFormat3Subtable::process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator,
+-                                                      const LEFontInstance *fontInstance)const
++le_uint32 ContextualSubstitutionFormat3Subtable::process(const LookupProcessor *lookupProcessor,
++                                                         GlyphIterator *glyphIterator,
++                                                         const LEFontInstance *fontInstance,
++                                                         LEErrorCode& success)const
+ {
++    if (LE_FAILURE(success)) {
++        return 0;
++    }
++
+     le_uint16 gCount = SWAPW(glyphCount);
+     le_uint16 subCount = SWAPW(substCount);
+     le_int32 position = glyphIterator->getCurrStreamPosition();
+@@ -305,7 +331,7 @@
+         const SubstitutionLookupRecord *substLookupRecordArray =
+             (const SubstitutionLookupRecord *) &coverageTableOffsetArray[gCount];
+ 
+-        ContextualSubstitutionBase::applySubstitutionLookups(lookupProcessor, substLookupRecordArray, subCount, glyphIterator, fontInstance, position);
++        ContextualSubstitutionBase::applySubstitutionLookups(lookupProcessor, substLookupRecordArray, subCount, glyphIterator, fontInstance, position, success);
+ 
+         return gCount + 1;
+     }
+@@ -315,9 +341,15 @@
+     return 0;
+ }
+ 
+-le_uint32 ChainingContextualSubstitutionSubtable::process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator,
+-                                                       const LEFontInstance *fontInstance) const
++le_uint32 ChainingContextualSubstitutionSubtable::process(const LookupProcessor *lookupProcessor,
++                                                          GlyphIterator *glyphIterator,
++                                                          const LEFontInstance *fontInstance,
++                                                          LEErrorCode& success) const
+ {
++    if (LE_FAILURE(success)) {
++        return 0;
++    }
++
+     switch(SWAPW(subtableFormat))
+     {
+     case 0:
+@@ -326,22 +358,19 @@
+     case 1:
+     {
+         const ChainingContextualSubstitutionFormat1Subtable *subtable = (const ChainingContextualSubstitutionFormat1Subtable *) this;
+-
+-        return subtable->process(lookupProcessor, glyphIterator, fontInstance);
++        return subtable->process(lookupProcessor, glyphIterator, fontInstance, success);
+     }
+ 
+     case 2:
+     {
+         const ChainingContextualSubstitutionFormat2Subtable *subtable = (const ChainingContextualSubstitutionFormat2Subtable *) this;
+-
+-        return subtable->process(lookupProcessor, glyphIterator, fontInstance);
++        return subtable->process(lookupProcessor, glyphIterator, fontInstance, success);
+     }
+ 
+     case 3:
+     {
+         const ChainingContextualSubstitutionFormat3Subtable *subtable = (const ChainingContextualSubstitutionFormat3Subtable *) this;
+-
+-        return subtable->process(lookupProcessor, glyphIterator, fontInstance);
++        return subtable->process(lookupProcessor, glyphIterator, fontInstance, success);
+     }
+ 
+     default:
+@@ -355,9 +384,15 @@
+ // emptyFeatureList matches an le_uint32 or an le_uint16...
+ static const FeatureMask emptyFeatureList = 0x00000000UL;
+ 
+-le_uint32 ChainingContextualSubstitutionFormat1Subtable::process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator,
+-                                                              const LEFontInstance *fontInstance) const
++le_uint32 ChainingContextualSubstitutionFormat1Subtable::process(const LookupProcessor *lookupProcessor,
++                                                                 GlyphIterator *glyphIterator,
++                                                                 const LEFontInstance *fontInstance,
++                                                                 LEErrorCode& success) const
+ {
++    if (LE_FAILURE(success)) {
++        return 0;
++    }
++
+     LEGlyphID glyph = glyphIterator->getCurrGlyphID();
+     le_int32 coverageIndex = getGlyphCoverage(glyph);
+ 
+@@ -405,7 +440,7 @@
+                     const SubstitutionLookupRecord *substLookupRecordArray =
+                         (const SubstitutionLookupRecord *) &lookaheadGlyphArray[lookaheadGlyphCount + 1];
+ 
+-                    applySubstitutionLookups(lookupProcessor, substLookupRecordArray, substCount, glyphIterator, fontInstance, position);
++                    applySubstitutionLookups(lookupProcessor, substLookupRecordArray, substCount, glyphIterator, fontInstance, position, success);
+ 
+                     return inputGlyphCount + 1;
+                 }
+@@ -420,9 +455,15 @@
+     return 0;
+ }
+ 
+-le_uint32 ChainingContextualSubstitutionFormat2Subtable::process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator,
+-                                                              const LEFontInstance *fontInstance) const
++le_uint32 ChainingContextualSubstitutionFormat2Subtable::process(const LookupProcessor *lookupProcessor,
++                                                                 GlyphIterator *glyphIterator,
++                                                                 const LEFontInstance *fontInstance,
++                                                                 LEErrorCode& success) const
+ {
++    if (LE_FAILURE(success)) {
++        return 0;
++    }
++
+     LEGlyphID glyph = glyphIterator->getCurrGlyphID();
+     le_int32 coverageIndex = getGlyphCoverage(glyph);
+ 
+@@ -479,7 +520,7 @@
+                     const SubstitutionLookupRecord *substLookupRecordArray =
+                         (const SubstitutionLookupRecord *) &lookaheadClassArray[lookaheadGlyphCount + 1];
+ 
+-                    applySubstitutionLookups(lookupProcessor, substLookupRecordArray, substCount, glyphIterator, fontInstance, position);
++                    applySubstitutionLookups(lookupProcessor, substLookupRecordArray, substCount, glyphIterator, fontInstance, position, success);
+ 
+                     return inputGlyphCount + 1;
+                 }
+@@ -494,9 +535,15 @@
+     return 0;
+ }
+ 
+-le_uint32 ChainingContextualSubstitutionFormat3Subtable::process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator,
+-                                                              const LEFontInstance *fontInstance) const
++le_uint32 ChainingContextualSubstitutionFormat3Subtable::process(const LookupProcessor *lookupProcessor,
++                                                                 GlyphIterator *glyphIterator,
++                                                                 const LEFontInstance *fontInstance,
++                                                                 LEErrorCode & success) const
+ {
++    if (LE_FAILURE(success)) {
++        return 0;
++    }
++
+     le_uint16 backtrkGlyphCount = SWAPW(backtrackGlyphCount);
+     le_uint16 inputGlyphCount = (le_uint16) SWAPW(backtrackCoverageTableOffsetArray[backtrkGlyphCount]);
+     const Offset *inputCoverageTableOffsetArray = &backtrackCoverageTableOffsetArray[backtrkGlyphCount + 1];
+@@ -534,7 +581,7 @@
+         const SubstitutionLookupRecord *substLookupRecordArray =
+             (const SubstitutionLookupRecord *) &lookaheadCoverageTableOffsetArray[lookaheadGlyphCount + 1];
+ 
+-        ContextualSubstitutionBase::applySubstitutionLookups(lookupProcessor, substLookupRecordArray, substCount, glyphIterator, fontInstance, position);
++        ContextualSubstitutionBase::applySubstitutionLookups(lookupProcessor, substLookupRecordArray, substCount, glyphIterator, fontInstance, position, success);
+ 
+         return inputGlyphCount;
+     }
+diff --git a/src/share/native/sun/font/layout/ContextualSubstSubtables.h b/src/share/native/sun/font/layout/ContextualSubstSubtables.h
+--- jdk/src/share/native/sun/font/layout/ContextualSubstSubtables.h
++++ jdk/src/share/native/sun/font/layout/ContextualSubstSubtables.h
+@@ -72,12 +72,13 @@
+         le_uint16 substCount,
+         GlyphIterator *glyphIterator,
+         const LEFontInstance *fontInstance,
+-        le_int32 position);
++        le_int32 position,
++        LEErrorCode& success);
+ };
+ 
+ struct ContextualSubstitutionSubtable : ContextualSubstitutionBase
+ {
+-    le_uint32  process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
++    le_uint32  process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const;
+ };
+ 
+ struct ContextualSubstitutionFormat1Subtable : ContextualSubstitutionSubtable
+@@ -85,7 +86,7 @@
+     le_uint16  subRuleSetCount;
+     Offset  subRuleSetTableOffsetArray[ANY_NUMBER];
+ 
+-    le_uint32  process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
++    le_uint32  process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const;
+ };
+ 
+ struct SubRuleSetTable
+@@ -110,7 +111,7 @@
+     le_uint16  subClassSetCount;
+     Offset  subClassSetTableOffsetArray[ANY_NUMBER];
+ 
+-    le_uint32  process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
++    le_uint32  process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const;
+ };
+ 
+ struct SubClassSetTable
+@@ -140,12 +141,12 @@
+     Offset  coverageTableOffsetArray[ANY_NUMBER];
+   //SubstitutionLookupRecord substLookupRecord[ANY_NUMBER];
+ 
+-    le_uint32  process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
++    le_uint32  process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const;
+ };
+ 
+ struct ChainingContextualSubstitutionSubtable : ContextualSubstitutionBase
+ {
+-    le_uint32  process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
++    le_uint32  process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const;
+ };
+ 
+ struct ChainingContextualSubstitutionFormat1Subtable : ChainingContextualSubstitutionSubtable
+@@ -153,7 +154,7 @@
+     le_uint16  chainSubRuleSetCount;
+     Offset  chainSubRuleSetTableOffsetArray[ANY_NUMBER];
+ 
+-    le_uint32  process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
++    le_uint32  process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const;
+ };
+ 
+ struct ChainSubRuleSetTable
+@@ -184,7 +185,7 @@
+     le_uint16  chainSubClassSetCount;
+     Offset  chainSubClassSetTableOffsetArray[ANY_NUMBER];
+ 
+-    le_uint32  process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
++    le_uint32  process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const;
+ };
+ 
+ struct ChainSubClassSetTable
+@@ -222,7 +223,7 @@
+   //le_uint16  substCount;
+   //SubstitutionLookupRecord substLookupRecord[ANY_NUMBER];
+ 
+-    le_uint32  process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
++    le_uint32  process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const;
+ };
+ 
+ U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/CoverageTables.cpp b/src/share/native/sun/font/layout/CoverageTables.cpp
+--- jdk/src/share/native/sun/font/layout/CoverageTables.cpp
++++ jdk/src/share/native/sun/font/layout/CoverageTables.cpp
+@@ -73,6 +73,10 @@
+     le_uint16 probe = power;
+     le_uint16 index = 0;
+ 
++        if (count == 0) {
++                return -1;
++        }
++
+     if (SWAPW(glyphArray[extra]) <= ttGlyphID) {
+         index = extra;
+     }
+diff --git a/src/share/native/sun/font/layout/CursiveAttachmentSubtables.cpp b/src/share/native/sun/font/layout/CursiveAttachmentSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/CursiveAttachmentSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/CursiveAttachmentSubtables.cpp
+@@ -59,6 +59,8 @@
+ 
+         entryAnchorTable->getAnchor(glyphID, fontInstance, entryAnchor);
+         glyphIterator->setCursiveEntryPoint(entryAnchor);
++    } else {
++        //glyphIterator->clearCursiveEntryPoint();
+     }
+ 
+     if (exitOffset != 0) {
+@@ -66,6 +68,8 @@
+ 
+         exitAnchorTable->getAnchor(glyphID, fontInstance, exitAnchor);
+         glyphIterator->setCursiveExitPoint(exitAnchor);
++    } else {
++        //glyphIterator->clearCursiveExitPoint();
+     }
+ 
+     return 1;
+diff --git a/src/share/native/sun/font/layout/DeviceTables.cpp b/src/share/native/sun/font/layout/DeviceTables.cpp
+--- jdk/src/share/native/sun/font/layout/DeviceTables.cpp
++++ jdk/src/share/native/sun/font/layout/DeviceTables.cpp
+@@ -41,13 +41,15 @@
+ const le_uint16 DeviceTable::fieldSignBits[] = {0x0002, 0x0008, 0x0080};
+ const le_uint16 DeviceTable::fieldBits[]     = {     2,      4,      8};
+ 
++#define FORMAT_COUNT LE_ARRAY_SIZE(fieldBits)
++
+ le_int16 DeviceTable::getAdjustment(le_uint16 ppem) const
+ {
+     le_uint16 start = SWAPW(startSize);
+     le_uint16 format = SWAPW(deltaFormat) - 1;
+     le_int16 result = 0;
+ 
+-    if (ppem >= start && ppem <= SWAPW(endSize)) {
++    if (ppem >= start && ppem <= SWAPW(endSize) && format < FORMAT_COUNT) {
+         le_uint16 sizeIndex = ppem - start;
+         le_uint16 bits = fieldBits[format];
+         le_uint16 count = 16 / bits;
+diff --git a/src/share/native/sun/font/layout/ExtensionSubtables.cpp b/src/share/native/sun/font/layout/ExtensionSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/ExtensionSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/ExtensionSubtables.cpp
+@@ -40,18 +40,24 @@
+ 
+ U_NAMESPACE_BEGIN
+ 
++// read a 32-bit value that might only be 16-bit-aligned in memory
++#define READ_LONG(code) (le_uint32)((SWAPW(*(le_uint16*)&code) << 16) + SWAPW(*(((le_uint16*)&code) + 1)))
+ 
+ // FIXME: should look at the format too... maybe have a sub-class for it?
+ le_uint32 ExtensionSubtable::process(const LookupProcessor *lookupProcessor, le_uint16 lookupType,
+-                                      GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
++                                      GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const
+ {
++    if (LE_FAILURE(success)) {
++        return 0;
++    }
++
+     le_uint16 elt = SWAPW(extensionLookupType);
+ 
+     if (elt != lookupType) {
+-        le_uint32 extOffset = SWAPL(extensionOffset);
++        le_uint32 extOffset = READ_LONG(extensionOffset);
+         LookupSubtable *subtable = (LookupSubtable *) ((char *) this + extOffset);
+ 
+-        return lookupProcessor->applySubtable(subtable, elt, glyphIterator, fontInstance);
++        return lookupProcessor->applySubtable(subtable, elt, glyphIterator, fontInstance, success);
+     }
+ 
+     return 0;
+diff --git a/src/share/native/sun/font/layout/ExtensionSubtables.h b/src/share/native/sun/font/layout/ExtensionSubtables.h
+--- jdk/src/share/native/sun/font/layout/ExtensionSubtables.h
++++ jdk/src/share/native/sun/font/layout/ExtensionSubtables.h
+@@ -53,7 +53,7 @@
+     le_uint32 extensionOffset;
+ 
+     le_uint32 process(const LookupProcessor *lookupProcessor, le_uint16 lookupType,
+-                      GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
++                      GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const;
+ };
+ 
+ U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/Features.cpp b/src/share/native/sun/font/layout/Features.cpp
+--- jdk/src/share/native/sun/font/layout/Features.cpp
++++ jdk/src/share/native/sun/font/layout/Features.cpp
+@@ -33,7 +33,7 @@
+ #include "LETypes.h"
+ #include "OpenTypeUtilities.h"
+ #include "OpenTypeTables.h"
+-#include "Features.h"
++#include "ICUFeatures.h"
+ #include "LESwaps.h"
+ 
+ U_NAMESPACE_BEGIN
+diff --git a/src/share/native/sun/font/layout/GXLayoutEngine.cpp b/src/share/native/sun/font/layout/GXLayoutEngine.cpp
+--- jdk/src/share/native/sun/font/layout/GXLayoutEngine.cpp
++++ jdk/src/share/native/sun/font/layout/GXLayoutEngine.cpp
+@@ -41,8 +41,8 @@
+ 
+ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(GXLayoutEngine)
+ 
+-GXLayoutEngine::GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const MorphTableHeader *morphTable)
+-    : LayoutEngine(fontInstance, scriptCode, languageCode, 0), fMorphTable(morphTable)
++GXLayoutEngine::GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const MorphTableHeader *morphTable, LEErrorCode &success)
++    : LayoutEngine(fontInstance, scriptCode, languageCode, 0, success), fMorphTable(morphTable)
+ {
+     // nothing else to do?
+ }
+diff --git a/src/share/native/sun/font/layout/GXLayoutEngine.h b/src/share/native/sun/font/layout/GXLayoutEngine.h
+--- jdk/src/share/native/sun/font/layout/GXLayoutEngine.h
++++ jdk/src/share/native/sun/font/layout/GXLayoutEngine.h
+@@ -67,13 +67,14 @@
+      * @param scriptCode - the script
+      * @param langaugeCode - the language
+      * @param morphTable - the 'mort' table
++     * @param success - set to an error code if the operation fails
+      *
+      * @see LayoutEngine::layoutEngineFactory
+      * @see ScriptAndLangaugeTags.h for script and language codes
+      *
+      * @internal
+      */
+-    GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const MorphTableHeader *morphTable);
++    GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const MorphTableHeader *morphTable, LEErrorCode &success);
+ 
+     /**
+      * The destructor, virtual for correct polymorphic invocation.
+diff --git a/src/share/native/sun/font/layout/GlyphIterator.cpp b/src/share/native/sun/font/layout/GlyphIterator.cpp
+--- jdk/src/share/native/sun/font/layout/GlyphIterator.cpp
++++ jdk/src/share/native/sun/font/layout/GlyphIterator.cpp
+@@ -44,7 +44,7 @@
+                              FeatureMask theFeatureMask, const GlyphDefinitionTableHeader *theGlyphDefinitionTableHeader)
+   : direction(1), position(-1), nextLimit(-1), prevLimit(-1),
+     glyphStorage(theGlyphStorage), glyphPositionAdjustments(theGlyphPositionAdjustments),
+-    srcIndex(-1), destIndex(-1), lookupFlags(theLookupFlags), featureMask(theFeatureMask),
++    srcIndex(-1), destIndex(-1), lookupFlags(theLookupFlags), featureMask(theFeatureMask), glyphGroup(0),
+     glyphClassDefinitionTable(NULL), markAttachClassDefinitionTable(NULL)
+ 
+ {
+@@ -78,6 +78,7 @@
+     destIndex = that.destIndex;
+     lookupFlags = that.lookupFlags;
+     featureMask = that.featureMask;
++    glyphGroup  = that.glyphGroup;
+     glyphClassDefinitionTable = that.glyphClassDefinitionTable;
+     markAttachClassDefinitionTable = that.markAttachClassDefinitionTable;
+ }
+@@ -95,6 +96,7 @@
+     destIndex = that.destIndex;
+     lookupFlags = that.lookupFlags;
+     featureMask = newFeatureMask;
++    glyphGroup  = 0;
+     glyphClassDefinitionTable = that.glyphClassDefinitionTable;
+     markAttachClassDefinitionTable = that.markAttachClassDefinitionTable;
+ }
+@@ -112,6 +114,7 @@
+     destIndex = that.destIndex;
+     lookupFlags = newLookupFlags;
+     featureMask = that.featureMask;
++    glyphGroup  = that.glyphGroup;
+     glyphClassDefinitionTable = that.glyphClassDefinitionTable;
+     markAttachClassDefinitionTable = that.markAttachClassDefinitionTable;
+ }
+@@ -125,12 +128,13 @@
+ {
+     position     = prevLimit;
+     featureMask  = newFeatureMask;
++    glyphGroup   = 0;
+     lookupFlags  = newLookupFlags;
+ }
+ 
+-LEGlyphID *GlyphIterator::insertGlyphs(le_int32 count)
++LEGlyphID *GlyphIterator::insertGlyphs(le_int32 count, LEErrorCode& success)
+ {
+-    return glyphStorage.insertGlyphs(position, count);
++    return glyphStorage.insertGlyphs(position, count, success);
+ }
+ 
+ le_int32 GlyphIterator::applyInsertions()
+@@ -299,6 +303,36 @@
+     glyphPositionAdjustments->setYAdvance(position, yAdvanceAdjust);
+ }
+ 
++void GlyphIterator::clearCursiveEntryPoint()
++{
++    if (direction < 0) {
++        if (position <= nextLimit || position >= prevLimit) {
++            return;
++        }
++    } else {
++        if (position <= prevLimit || position >= nextLimit) {
++            return;
++        }
++    }
++
++    glyphPositionAdjustments->clearEntryPoint(position);
++}
++
++void GlyphIterator::clearCursiveExitPoint()
++{
++    if (direction < 0) {
++        if (position <= nextLimit || position >= prevLimit) {
++            return;
++        }
++    } else {
++        if (position <= prevLimit || position >= nextLimit) {
++            return;
++        }
++    }
++
++    glyphPositionAdjustments->clearExitPoint(position);
++}
++
+ void GlyphIterator::setCursiveEntryPoint(LEPoint &entryPoint)
+ {
+     if (direction < 0) {
+@@ -391,7 +425,7 @@
+     }
+ }
+ 
+-le_bool GlyphIterator::hasFeatureTag() const
++le_bool GlyphIterator::hasFeatureTag(le_bool matchGroup) const
+ {
+     if (featureMask == 0) {
+         return TRUE;
+@@ -400,14 +434,18 @@
+     LEErrorCode success = LE_NO_ERROR;
+     FeatureMask fm = glyphStorage.getAuxData(position, success);
+ 
+-    return (fm & featureMask) != 0;
++    return ((fm & featureMask) == featureMask) && (!matchGroup || (le_int32)(fm & LE_GLYPH_GROUP_MASK) == glyphGroup);
+ }
+ 
+ le_bool GlyphIterator::findFeatureTag()
+ {
++  //glyphGroup = 0;
++
+     while (nextInternal()) {
+-        if (hasFeatureTag()) {
+-            prevInternal();
++        if (hasFeatureTag(FALSE)) {
++            LEErrorCode success = LE_NO_ERROR;
++
++            glyphGroup = (glyphStorage.getAuxData(position, success) & LE_GLYPH_GROUP_MASK);
+             return TRUE;
+         }
+     }
+@@ -435,7 +473,7 @@
+ 
+ le_bool GlyphIterator::next(le_uint32 delta)
+ {
+-    return nextInternal(delta) && hasFeatureTag();
++    return nextInternal(delta) && hasFeatureTag(TRUE);
+ }
+ 
+ le_bool GlyphIterator::prevInternal(le_uint32 delta)
+@@ -457,7 +495,7 @@
+ 
+ le_bool GlyphIterator::prev(le_uint32 delta)
+ {
+-    return prevInternal(delta) && hasFeatureTag();
++    return prevInternal(delta) && hasFeatureTag(TRUE);
+ }
+ 
+ le_int32 GlyphIterator::getMarkComponent(le_int32 markPosition) const
+diff --git a/src/share/native/sun/font/layout/GlyphIterator.h b/src/share/native/sun/font/layout/GlyphIterator.h
+--- jdk/src/share/native/sun/font/layout/GlyphIterator.h
++++ jdk/src/share/native/sun/font/layout/GlyphIterator.h
+@@ -88,16 +88,18 @@
+     void setCurrGlyphPositionAdjustment(float xPlacementAdjust, float yPlacementAdjust,
+                                         float xAdvanceAdjust,   float yAdvanceAdjust);
+ 
++    void clearCursiveEntryPoint();
++    void clearCursiveExitPoint();
+     void setCursiveEntryPoint(LEPoint &entryPoint);
+     void setCursiveExitPoint(LEPoint &exitPoint);
+     void setCursiveGlyph();
+ 
+-    LEGlyphID *insertGlyphs(le_int32 count);
++    LEGlyphID *insertGlyphs(le_int32 count, LEErrorCode& success);
+     le_int32 applyInsertions();
+ 
+ private:
+     le_bool filterGlyph(le_uint32 index) const;
+-    le_bool hasFeatureTag() const;
++    le_bool hasFeatureTag(le_bool matchGroup) const;
+     le_bool nextInternal(le_uint32 delta = 1);
+     le_bool prevInternal(le_uint32 delta = 1);
+ 
+@@ -113,6 +115,7 @@
+     le_int32    destIndex;
+     le_uint16   lookupFlags;
+     FeatureMask featureMask;
++    le_int32    glyphGroup;
+ 
+     const GlyphClassDefinitionTable *glyphClassDefinitionTable;
+     const MarkAttachClassDefinitionTable *markAttachClassDefinitionTable;
+diff --git a/src/share/native/sun/font/layout/GlyphPositionAdjustments.cpp b/src/share/native/sun/font/layout/GlyphPositionAdjustments.cpp
+--- jdk/src/share/native/sun/font/layout/GlyphPositionAdjustments.cpp
++++ jdk/src/share/native/sun/font/layout/GlyphPositionAdjustments.cpp
+@@ -71,6 +71,20 @@
+     return fEntryExitPoints[index].getExitPoint(exitPoint);
+ }
+ 
++void GlyphPositionAdjustments::clearEntryPoint(le_int32 index)
++{
++    CHECK_ALLOCATE_ARRAY(fEntryExitPoints, EntryExitPoint, fGlyphCount);
++
++    fEntryExitPoints[index].clearEntryPoint();
++}
++
++void GlyphPositionAdjustments::clearExitPoint(le_int32 index)
++{
++    CHECK_ALLOCATE_ARRAY(fEntryExitPoints, EntryExitPoint, fGlyphCount);
++
++    fEntryExitPoints[index].clearExitPoint();
++}
++
+ void GlyphPositionAdjustments::setEntryPoint(le_int32 index, LEPoint &newEntryPoint, le_bool baselineIsLogicalEnd)
+ {
+     CHECK_ALLOCATE_ARRAY(fEntryExitPoints, EntryExitPoint, fGlyphCount);
+@@ -152,7 +166,12 @@
+                 lastExitGlyphID = glyphID;
+             } else {
+                 if (baselineIsLogicalEnd(i) && firstExitPoint >= 0 && lastExitPoint >= 0) {
+-                    le_int32 limit = lastExitPoint + dir;
++                    le_int32 limit = lastExitPoint /*+ dir*/;
++                    LEPoint dummyAnchor;
++
++                    if (getEntryPoint(i, dummyAnchor) != NULL) {
++                        limit += dir;
++                    }
+ 
+                     for (le_int32 j = firstExitPoint; j != limit; j += dir) {
+                         if (isCursiveGlyph(j)) {
+diff --git a/src/share/native/sun/font/layout/GlyphPositionAdjustments.h b/src/share/native/sun/font/layout/GlyphPositionAdjustments.h
+--- jdk/src/share/native/sun/font/layout/GlyphPositionAdjustments.h
++++ jdk/src/share/native/sun/font/layout/GlyphPositionAdjustments.h
+@@ -97,6 +97,8 @@
+         LEPoint *getEntryPoint(LEPoint &entryPoint) const;
+         LEPoint *getExitPoint(LEPoint &exitPoint) const;
+ 
++        inline void clearEntryPoint();
++        inline void clearExitPoint();
+         inline void setEntryPoint(LEPoint &newEntryPoint, le_bool baselineIsLogicalEnd);
+         inline void setExitPoint(LEPoint &newExitPoint, le_bool baselineIsLogicalEnd);
+         inline void setCursiveGlyph(le_bool baselineIsLogicalEnd);
+@@ -151,6 +153,8 @@
+     inline void adjustXAdvance(le_int32 index, float xAdjustment);
+     inline void adjustYAdvance(le_int32 index, float yAdjustment);
+ 
++    void clearEntryPoint(le_int32 index);
++    void clearExitPoint(le_int32 index);
+     void setEntryPoint(le_int32 index, LEPoint &newEntryPoint, le_bool baselineIsLogicalEnd);
+     void setExitPoint(le_int32 index, LEPoint &newExitPoint, le_bool baselineIsLogicalEnd);
+     void setCursiveGlyph(le_int32 index, le_bool baselineIsLogicalEnd);
+@@ -266,6 +270,16 @@
+     return (fFlags & EEF_BASELINE_IS_LOGICAL_END) != 0;
+ }
+ 
++inline void GlyphPositionAdjustments::EntryExitPoint::clearEntryPoint()
++{
++    fFlags &= ~EEF_HAS_ENTRY_POINT;
++}
++
++inline void GlyphPositionAdjustments::EntryExitPoint::clearExitPoint()
++{
++    fFlags &= ~EEF_HAS_EXIT_POINT;
++}
++
+ inline void GlyphPositionAdjustments::EntryExitPoint::setEntryPoint(LEPoint &newEntryPoint, le_bool baselineIsLogicalEnd)
+ {
+     if (baselineIsLogicalEnd) {
+diff --git a/src/share/native/sun/font/layout/GlyphPositioningTables.cpp b/src/share/native/sun/font/layout/GlyphPositioningTables.cpp
+--- jdk/src/share/native/sun/font/layout/GlyphPositioningTables.cpp
++++ jdk/src/share/native/sun/font/layout/GlyphPositioningTables.cpp
+@@ -43,12 +43,19 @@
+ 
+ void GlyphPositioningTableHeader::process(LEGlyphStorage &glyphStorage, GlyphPositionAdjustments *glyphPositionAdjustments, le_bool rightToLeft,
+                                           LETag scriptTag, LETag languageTag,
+-                                          const GlyphDefinitionTableHeader *glyphDefinitionTableHeader,
++                                          const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, LEErrorCode &success,
+                                           const LEFontInstance *fontInstance, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder) const
+ {
+-    GlyphPositioningLookupProcessor processor(this, scriptTag, languageTag, featureMap, featureMapCount, featureOrder);
++    if (LE_FAILURE(success)) {
++        return;
++    }
+ 
+-    processor.process(glyphStorage, glyphPositionAdjustments, rightToLeft, glyphDefinitionTableHeader, fontInstance);
++    GlyphPositioningLookupProcessor processor(this, scriptTag, languageTag, featureMap, featureMapCount, featureOrder, success);
++    if (LE_FAILURE(success)) {
++        return;
++    }
++
++    processor.process(glyphStorage, glyphPositionAdjustments, rightToLeft, glyphDefinitionTableHeader, fontInstance, success);
+ 
+     glyphPositionAdjustments->applyCursiveAdjustments(glyphStorage, rightToLeft, fontInstance);
+ }
+diff --git a/src/share/native/sun/font/layout/GlyphPositioningTables.h b/src/share/native/sun/font/layout/GlyphPositioningTables.h
+--- jdk/src/share/native/sun/font/layout/GlyphPositioningTables.h
++++ jdk/src/share/native/sun/font/layout/GlyphPositioningTables.h
+@@ -53,7 +53,7 @@
+ {
+     void    process(LEGlyphStorage &glyphStorage, GlyphPositionAdjustments *glyphPositionAdjustments,
+                 le_bool rightToLeft, LETag scriptTag, LETag languageTag,
+-                const GlyphDefinitionTableHeader *glyphDefinitionTableHeader,
++                const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, LEErrorCode &success,
+                 const LEFontInstance *fontInstance, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder) const;
+ };
+ 
+diff --git a/src/share/native/sun/font/layout/GlyphPosnLookupProc.cpp b/src/share/native/sun/font/layout/GlyphPosnLookupProc.cpp
+--- jdk/src/share/native/sun/font/layout/GlyphPosnLookupProc.cpp
++++ jdk/src/share/native/sun/font/layout/GlyphPosnLookupProc.cpp
+@@ -31,7 +31,7 @@
+ #include "LETypes.h"
+ #include "LEFontInstance.h"
+ #include "OpenTypeTables.h"
+-#include "Features.h"
++#include "ICUFeatures.h"
+ #include "Lookups.h"
+ #include "ScriptAndLanguage.h"
+ #include "GlyphDefinitionTables.h"
+@@ -58,13 +58,24 @@
+ 
+ GlyphPositioningLookupProcessor::GlyphPositioningLookupProcessor(
+         const GlyphPositioningTableHeader *glyphPositioningTableHeader,
+-        LETag scriptTag, LETag languageTag, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder)
++        LETag scriptTag,
++        LETag languageTag,
++        const FeatureMap *featureMap,
++        le_int32 featureMapCount,
++        le_bool featureOrder,
++        LEErrorCode& success)
+     : LookupProcessor(
+                       (char *) glyphPositioningTableHeader,
+                       SWAPW(glyphPositioningTableHeader->scriptListOffset),
+                       SWAPW(glyphPositioningTableHeader->featureListOffset),
+                       SWAPW(glyphPositioningTableHeader->lookupListOffset),
+-                      scriptTag, languageTag, featureMap, featureMapCount, featureOrder)
++                      scriptTag,
++                      languageTag,
++                      featureMap,
++                      featureMapCount,
++                      featureOrder,
++                      success
++                      )
+ {
+     // anything?
+ }
+@@ -75,8 +86,13 @@
+ 
+ le_uint32 GlyphPositioningLookupProcessor::applySubtable(const LookupSubtable *lookupSubtable, le_uint16 lookupType,
+                                                        GlyphIterator *glyphIterator,
+-                                                       const LEFontInstance *fontInstance) const
++                                                       const LEFontInstance *fontInstance,
++                                                       LEErrorCode& success) const
+ {
++    if (LE_FAILURE(success)) {
++        return 0;
++    }
++
+     le_uint32 delta = 0;
+ 
+     switch(lookupType)
+@@ -136,7 +152,7 @@
+     {
+         const ContextualPositioningSubtable *subtable = (const ContextualPositioningSubtable *) lookupSubtable;
+ 
+-        delta = subtable->process(this, glyphIterator, fontInstance);
++        delta = subtable->process(this, glyphIterator, fontInstance, success);
+         break;
+     }
+ 
+@@ -144,7 +160,7 @@
+     {
+         const ChainingContextualPositioningSubtable *subtable = (const ChainingContextualPositioningSubtable *) lookupSubtable;
+ 
+-        delta = subtable->process(this, glyphIterator, fontInstance);
++        delta = subtable->process(this, glyphIterator, fontInstance, success);
+         break;
+     }
+ 
+@@ -152,7 +168,7 @@
+     {
+         const ExtensionSubtable *subtable = (const ExtensionSubtable *) lookupSubtable;
+ 
+-        delta = subtable->process(this, lookupType, glyphIterator, fontInstance);
++        delta = subtable->process(this, lookupType, glyphIterator, fontInstance, success);
+         break;
+     }
+ 
+diff --git a/src/share/native/sun/font/layout/GlyphPosnLookupProc.h b/src/share/native/sun/font/layout/GlyphPosnLookupProc.h
+--- jdk/src/share/native/sun/font/layout/GlyphPosnLookupProc.h
++++ jdk/src/share/native/sun/font/layout/GlyphPosnLookupProc.h
+@@ -40,7 +40,7 @@
+ #include "LEFontInstance.h"
+ #include "OpenTypeTables.h"
+ #include "Lookups.h"
+-#include "Features.h"
++#include "ICUFeatures.h"
+ #include "GlyphDefinitionTables.h"
+ #include "GlyphPositioningTables.h"
+ #include "GlyphIterator.h"
+@@ -52,12 +52,17 @@
+ {
+ public:
+     GlyphPositioningLookupProcessor(const GlyphPositioningTableHeader *glyphPositioningTableHeader,
+-        LETag scriptTag, LETag languageTag, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder);
++        LETag scriptTag,
++        LETag languageTag,
++        const FeatureMap *featureMap,
++        le_int32 featureMapCount,
++        le_bool featureOrder,
++        LEErrorCode& success);
+ 
+     virtual ~GlyphPositioningLookupProcessor();
+ 
+     virtual le_uint32 applySubtable(const LookupSubtable *lookupSubtable, le_uint16 lookupType, GlyphIterator *glyphIterator,
+-        const LEFontInstance *fontInstance) const;
++        const LEFontInstance *fontInstance, LEErrorCode& success) const;
+ 
+ protected:
+     GlyphPositioningLookupProcessor();
+diff --git a/src/share/native/sun/font/layout/GlyphSubstLookupProc.cpp b/src/share/native/sun/font/layout/GlyphSubstLookupProc.cpp
+--- jdk/src/share/native/sun/font/layout/GlyphSubstLookupProc.cpp
++++ jdk/src/share/native/sun/font/layout/GlyphSubstLookupProc.cpp
+@@ -33,7 +33,7 @@
+ #include "LEGlyphFilter.h"
+ #include "LEFontInstance.h"
+ #include "OpenTypeTables.h"
+-#include "Features.h"
++#include "ICUFeatures.h"
+ #include "Lookups.h"
+ #include "ScriptAndLanguage.h"
+ #include "GlyphDefinitionTables.h"
+@@ -52,13 +52,19 @@
+ 
+ GlyphSubstitutionLookupProcessor::GlyphSubstitutionLookupProcessor(
+         const GlyphSubstitutionTableHeader *glyphSubstitutionTableHeader,
+-        LETag scriptTag, LETag languageTag, const LEGlyphFilter *filter, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder)
++        LETag scriptTag,
++        LETag languageTag,
++        const LEGlyphFilter *filter,
++        const FeatureMap *featureMap,
++        le_int32 featureMapCount,
++        le_bool featureOrder,
++        LEErrorCode& success)
+     : LookupProcessor(
+                       (char *) glyphSubstitutionTableHeader,
+                       SWAPW(glyphSubstitutionTableHeader->scriptListOffset),
+                       SWAPW(glyphSubstitutionTableHeader->featureListOffset),
+                       SWAPW(glyphSubstitutionTableHeader->lookupListOffset),
+-                      scriptTag, languageTag, featureMap, featureMapCount, featureOrder), fFilter(filter)
++                      scriptTag, languageTag, featureMap, featureMapCount, featureOrder, success), fFilter(filter)
+ {
+     // anything?
+ }
+@@ -68,8 +74,12 @@
+ }
+ 
+ le_uint32 GlyphSubstitutionLookupProcessor::applySubtable(const LookupSubtable *lookupSubtable, le_uint16 lookupType,
+-                                                       GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
++                                                       GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const
+ {
++    if (LE_FAILURE(success)) {
++        return 0;
++    }
++
+     le_uint32 delta = 0;
+ 
+     switch(lookupType)
+@@ -89,7 +99,7 @@
+     {
+         const MultipleSubstitutionSubtable *subtable = (const MultipleSubstitutionSubtable *) lookupSubtable;
+ 
+-        delta = subtable->process(glyphIterator, fFilter);
++        delta = subtable->process(glyphIterator, success, fFilter);
+         break;
+     }
+ 
+@@ -113,7 +123,7 @@
+     {
+         const ContextualSubstitutionSubtable *subtable = (const ContextualSubstitutionSubtable *) lookupSubtable;
+ 
+-        delta = subtable->process(this, glyphIterator, fontInstance);
++        delta = subtable->process(this, glyphIterator, fontInstance, success);
+         break;
+     }
+ 
+@@ -121,7 +131,7 @@
+     {
+         const ChainingContextualSubstitutionSubtable *subtable = (const ChainingContextualSubstitutionSubtable *) lookupSubtable;
+ 
+-        delta = subtable->process(this, glyphIterator, fontInstance);
++        delta = subtable->process(this, glyphIterator, fontInstance, success);
+         break;
+     }
+ 
+@@ -129,7 +139,7 @@
+     {
+         const ExtensionSubtable *subtable = (const ExtensionSubtable *) lookupSubtable;
+ 
+-        delta = subtable->process(this, lookupType, glyphIterator, fontInstance);
++        delta = subtable->process(this, lookupType, glyphIterator, fontInstance, success);
+         break;
+     }
+ 
+diff --git a/src/share/native/sun/font/layout/GlyphSubstLookupProc.h b/src/share/native/sun/font/layout/GlyphSubstLookupProc.h
+--- jdk/src/share/native/sun/font/layout/GlyphSubstLookupProc.h
++++ jdk/src/share/native/sun/font/layout/GlyphSubstLookupProc.h
+@@ -41,7 +41,7 @@
+ #include "LEFontInstance.h"
+ #include "OpenTypeTables.h"
+ #include "Lookups.h"
+-#include "Features.h"
++#include "ICUFeatures.h"
+ #include "GlyphDefinitionTables.h"
+ #include "GlyphSubstitutionTables.h"
+ #include "GlyphIterator.h"
+@@ -53,12 +53,18 @@
+ {
+ public:
+     GlyphSubstitutionLookupProcessor(const GlyphSubstitutionTableHeader *glyphSubstitutionTableHeader,
+-        LETag scriptTag, LETag languageTag, const LEGlyphFilter *filter, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder);
++        LETag scriptTag,
++        LETag languageTag,
++        const LEGlyphFilter *filter,
++        const FeatureMap *featureMap,
++        le_int32 featureMapCount,
++        le_bool featureOrder,
++        LEErrorCode& success);
+ 
+     virtual ~GlyphSubstitutionLookupProcessor();
+ 
+     virtual le_uint32 applySubtable(const LookupSubtable *lookupSubtable, le_uint16 lookupType, GlyphIterator *glyphIterator,
+-        const LEFontInstance *fontInstance) const;
++        const LEFontInstance *fontInstance, LEErrorCode& success) const;
+ 
+ protected:
+     GlyphSubstitutionLookupProcessor();
+diff --git a/src/share/native/sun/font/layout/GlyphSubstitutionTables.cpp b/src/share/native/sun/font/layout/GlyphSubstitutionTables.cpp
+--- jdk/src/share/native/sun/font/layout/GlyphSubstitutionTables.cpp
++++ jdk/src/share/native/sun/font/layout/GlyphSubstitutionTables.cpp
+@@ -42,13 +42,23 @@
+ 
+ U_NAMESPACE_BEGIN
+ 
+-le_int32 GlyphSubstitutionTableHeader::process(LEGlyphStorage &glyphStorage, le_bool rightToLeft, LETag scriptTag, LETag languageTag,
++le_int32 GlyphSubstitutionTableHeader::process(LEGlyphStorage &glyphStorage,
++                                               le_bool rightToLeft,
++                                               LETag scriptTag,
++                                               LETag languageTag,
+                                            const GlyphDefinitionTableHeader *glyphDefinitionTableHeader,
+-                                           const LEGlyphFilter *filter, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder) const
++                                               const LEGlyphFilter *filter,
++                                               const FeatureMap *featureMap,
++                                               le_int32 featureMapCount,
++                                               le_bool featureOrder,
++                                               LEErrorCode &success) const
+ {
+-    GlyphSubstitutionLookupProcessor processor(this, scriptTag, languageTag, filter, featureMap, featureMapCount, featureOrder);
++    if (LE_FAILURE(success)) {
++        return 0;
++    }
+ 
+-    return processor.process(glyphStorage, NULL, rightToLeft, glyphDefinitionTableHeader, NULL);
++    GlyphSubstitutionLookupProcessor processor(this, scriptTag, languageTag, filter, featureMap, featureMapCount, featureOrder, success);
++    return processor.process(glyphStorage, NULL, rightToLeft, glyphDefinitionTableHeader, NULL, success);
+ }
+ 
+ U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/GlyphSubstitutionTables.h b/src/share/native/sun/font/layout/GlyphSubstitutionTables.h
+--- jdk/src/share/native/sun/font/layout/GlyphSubstitutionTables.h
++++ jdk/src/share/native/sun/font/layout/GlyphSubstitutionTables.h
+@@ -50,9 +50,16 @@
+ 
+ struct GlyphSubstitutionTableHeader : public GlyphLookupTableHeader
+ {
+-    le_int32    process(LEGlyphStorage &glyphStorage, le_bool rightToLeft, LETag scriptTag, LETag languageTag,
+-                        const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, const LEGlyphFilter *filter,
+-                        const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder) const;
++    le_int32    process(LEGlyphStorage &glyphStorage,
++                        le_bool rightToLeft,
++                        LETag scriptTag,
++                        LETag languageTag,
++                        const GlyphDefinitionTableHeader *glyphDefinitionTableHeader,
++                        const LEGlyphFilter *filter,
++                        const FeatureMap *featureMap,
++                        le_int32 featureMapCount,
++                        le_bool featureOrder,
++                        LEErrorCode &success) const;
+ };
+ 
+ enum GlyphSubstitutionSubtableTypes
+diff --git a/src/share/native/sun/font/layout/HanLayoutEngine.cpp b/src/share/native/sun/font/layout/HanLayoutEngine.cpp
+--- jdk/src/share/native/sun/font/layout/HanLayoutEngine.cpp
++++ jdk/src/share/native/sun/font/layout/HanLayoutEngine.cpp
+@@ -26,7 +26,7 @@
+ /*
+  * HanLayoutEngine.cpp: OpenType processing for Han fonts.
+  *
+- * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved.
++ * (C) Copyright IBM Corp. 1998-2008 - All Rights Reserved.
+  */
+ 
+ #include "LETypes.h"
+@@ -64,8 +64,8 @@
+ #define features (loclFeatureMask)
+ 
+ HanOpenTypeLayoutEngine::HanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                        le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable)
+-    : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable)
++                        le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success)
++    : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success)
+ {
+     fFeatureMap      = featureMap;
+     fFeatureMapCount = featureMapCount;
+diff --git a/src/share/native/sun/font/layout/HanLayoutEngine.h b/src/share/native/sun/font/layout/HanLayoutEngine.h
+--- jdk/src/share/native/sun/font/layout/HanLayoutEngine.h
++++ jdk/src/share/native/sun/font/layout/HanLayoutEngine.h
+@@ -27,7 +27,7 @@
+ /*
+  * HanLayoutEngine.h: OpenType processing for Han fonts.
+  *
+- * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved.
++ * (C) Copyright IBM Corp. 1998-2008 - All Rights Reserved.
+  */
+ 
+ #ifndef __HANLAYOUTENGINE_H
+@@ -64,6 +64,7 @@
+      * @param scriptCode - the script
+      * @param langaugeCode - the language
+      * @param gsubTable - the GSUB table
++     * @param success - set to an error code if the operation fails
+      *
+      * @see LayoutEngine::layoutEngineFactory
+      * @see OpenTypeLayoutEngine
+@@ -72,7 +73,7 @@
+      * @internal
+      */
+     HanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                            le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable);
++                            le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTablem, LEErrorCode &success);
+ 
+ 
+     /**
+diff --git a/src/share/native/sun/font/layout/HangulLayoutEngine.cpp b/src/share/native/sun/font/layout/HangulLayoutEngine.cpp
+new file mode 100644
+--- /dev/null
++++ jdk/src/share/native/sun/font/layout/HangulLayoutEngine.cpp
+@@ -0,0 +1,363 @@
++/*
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute 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.
++ *
++ */
++
++/*
++ * HangulLayoutEngine.cpp: OpenType processing for Han fonts.
++ *
++ * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved.
++ */
++
++#include "LETypes.h"
++#include "LEScripts.h"
++#include "LELanguages.h"
++
++#include "LayoutEngine.h"
++#include "OpenTypeLayoutEngine.h"
++#include "HangulLayoutEngine.h"
++#include "ScriptAndLanguageTags.h"
++#include "LEGlyphStorage.h"
++#include "OpenTypeTables.h"
++
++U_NAMESPACE_BEGIN
++
++UOBJECT_DEFINE_RTTI_IMPLEMENTATION(HangulOpenTypeLayoutEngine)
++
++
++#define FEATURE_MAP(name) {name ## FeatureTag, name ## FeatureMask}
++
++#define LJMO_FIRST 0x1100
++#define LJMO_LAST  0x1159
++#define LJMO_FILL  0x115F
++#define LJMO_COUNT 19
++
++#define VJMO_FIRST 0x1161
++#define VJMO_LAST  0x11A2
++#define VJMO_FILL  0x1160
++#define VJMO_COUNT 21
++
++#define TJMO_FIRST 0x11A7
++#define TJMO_LAST  0x11F9
++#define TJMO_COUNT 28
++
++#define HSYL_FIRST 0xAC00
++#define HSYL_COUNT 11172
++#define HSYL_LVCNT (VJMO_COUNT * TJMO_COUNT)
++
++// Character classes
++enum
++{
++    CC_L = 0,
++    CC_V,
++    CC_T,
++    CC_LV,
++    CC_LVT,
++    CC_X,
++    CC_COUNT
++};
++
++// Action flags
++#define AF_L 1
++#define AF_V 2
++#define AF_T 4
++
++// Actions
++#define a_N   0
++#define a_L   (AF_L)
++#define a_V   (AF_V)
++#define a_T   (AF_T)
++#define a_VT  (AF_V | AF_T)
++#define a_LV  (AF_L | AF_V)
++#define a_LVT (AF_L | AF_V | AF_T)
++
++typedef struct
++{
++    le_int32 newState;
++    le_int32 actionFlags;
++} StateTransition;
++
++static const StateTransition stateTable[][CC_COUNT] =
++{
++//       L          V          T          LV         LVT           X
++    { {1, a_L},  {2, a_LV}, {3, a_LVT}, {2, a_LV}, {3, a_LVT},  {4, a_T}}, // 0 - start
++    { {1, a_L},  {2, a_V},  {3, a_VT},  {2, a_LV}, {3, a_LVT}, {-1, a_V}}, // 1 - L+
++    {{-1, a_N},  {2, a_V},  {3, a_T},  {-1, a_N}, {-1, a_N},   {-1, a_N}}, // 2 - L+V+
++    {{-1, a_N}, {-1, a_N},  {3, a_T},  {-1, a_N}, {-1, a_N},   {-1, a_N}}, // 3 - L+V+T*
++    {{-1, a_N}, {-1, a_N}, {-1, a_N},  {-1, a_N}, {-1, a_N},    {4, a_T}}  // 4 - X+
++};
++
++
++#define ccmpFeatureTag LE_CCMP_FEATURE_TAG
++#define ljmoFeatureTag LE_LJMO_FEATURE_TAG
++#define vjmoFeatureTag LE_VJMO_FEATURE_TAG
++#define tjmoFeatureTag LE_TJMO_FEATURE_TAG
++
++#define ccmpFeatureMask 0x80000000UL
++#define ljmoFeatureMask 0x40000000UL
++#define vjmoFeatureMask 0x20000000UL
++#define tjmoFeatureMask 0x10000000UL
++
++static const FeatureMap featureMap[] =
++{
++    {ccmpFeatureTag, ccmpFeatureMask},
++    {ljmoFeatureTag, ljmoFeatureMask},
++    {vjmoFeatureTag, vjmoFeatureMask},
++    {tjmoFeatureTag, tjmoFeatureMask}
++};
++
++static const le_int32 featureMapCount = LE_ARRAY_SIZE(featureMap);
++
++#define nullFeatures 0
++#define ljmoFeatures (ccmpFeatureMask | ljmoFeatureMask)
++#define vjmoFeatures (ccmpFeatureMask | vjmoFeatureMask | ljmoFeatureMask | tjmoFeatureMask)
++#define tjmoFeatures (ccmpFeatureMask | tjmoFeatureMask | ljmoFeatureMask | vjmoFeatureMask)
++
++static le_int32 compose(LEUnicode lead, LEUnicode vowel, LEUnicode trail, LEUnicode &syllable)
++{
++    le_int32 lIndex = lead  - LJMO_FIRST;
++    le_int32 vIndex = vowel - VJMO_FIRST;
++    le_int32 tIndex = trail - TJMO_FIRST;
++    le_int32 result = 3;
++
++    if ((lIndex < 0 || lIndex >= LJMO_COUNT ) || (vIndex < 0 || vIndex >= VJMO_COUNT)) {
++        return 0;
++    }
++
++    if (tIndex <= 0 || tIndex >= TJMO_COUNT) {
++        tIndex = 0;
++        result = 2;
++    }
++
++    syllable = (LEUnicode) ((lIndex * VJMO_COUNT + vIndex) * TJMO_COUNT + tIndex + HSYL_FIRST);
++
++    return result;
++}
++
++static le_int32 decompose(LEUnicode syllable, LEUnicode &lead, LEUnicode &vowel, LEUnicode &trail)
++{
++    le_int32 sIndex = syllable - HSYL_FIRST;
++
++    if (sIndex < 0 || sIndex >= HSYL_COUNT) {
++        return 0;
++    }
++
++    lead  = LJMO_FIRST + (sIndex / HSYL_LVCNT);
++    vowel = VJMO_FIRST + (sIndex % HSYL_LVCNT) / TJMO_COUNT;
++    trail = TJMO_FIRST + (sIndex % TJMO_COUNT);
++
++    if (trail == TJMO_FIRST) {
++        return 2;
++    }
++
++    return 3;
++}
++
++static le_int32 getCharClass(LEUnicode ch, LEUnicode &lead, LEUnicode &vowel, LEUnicode &trail)
++{
++    lead  = LJMO_FILL;
++    vowel = VJMO_FILL;
++    trail = TJMO_FIRST;
++
++    if (ch >= LJMO_FIRST && ch <= LJMO_LAST) {
++        lead  = ch;
++        return CC_L;
++    }
++
++    if (ch >= VJMO_FIRST && ch <= VJMO_LAST) {
++        vowel = ch;
++        return CC_V;
++    }
++
++    if (ch > TJMO_FIRST && ch <= TJMO_LAST) {
++        trail = ch;
++        return CC_T;
++    }
++
++    le_int32 c = decompose(ch, lead, vowel, trail);
++
++    if (c == 2) {
++        return CC_LV;
++    }
++
++    if (c == 3) {
++        return CC_LVT;
++    }
++
++    trail = ch;
++    return CC_X;
++}
++
++HangulOpenTypeLayoutEngine::HangulOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 /*languageCode*/,
++                                       le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success)
++    : OpenTypeLayoutEngine(fontInstance, scriptCode, korLanguageCode, typoFlags, gsubTable, success)
++{
++    fFeatureMap = featureMap;
++    fFeatureMapCount = featureMapCount;
++    fFeatureOrder = TRUE;
++}
++
++HangulOpenTypeLayoutEngine::HangulOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 /*languageCode*/,
++                                                           le_int32 typoFlags, LEErrorCode &success)
++    : OpenTypeLayoutEngine(fontInstance, scriptCode, korLanguageCode, typoFlags, success)
++{
++    fFeatureMap = featureMap;
++    fFeatureMapCount = featureMapCount;
++    fFeatureOrder = TRUE;
++}
++
++HangulOpenTypeLayoutEngine::~HangulOpenTypeLayoutEngine()
++{
++    // nothing to do
++}
++
++le_int32 HangulOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
++        LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success)
++{
++    if (LE_FAILURE(success)) {
++        return 0;
++    }
++
++    if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || offset + count > max) {
++        success = LE_ILLEGAL_ARGUMENT_ERROR;
++        return 0;
++    }
++
++    le_int32 worstCase = count * 3;
++
++    outChars = LE_NEW_ARRAY(LEUnicode, worstCase);
++
++    if (outChars == NULL) {
++        success = LE_MEMORY_ALLOCATION_ERROR;
++        return 0;
++    }
++
++    glyphStorage.allocateGlyphArray(worstCase, rightToLeft, success);
++    glyphStorage.allocateAuxData(success);
++
++    if (LE_FAILURE(success)) {
++        LE_DELETE_ARRAY(outChars);
++        return 0;
++    }
++
++    le_int32 outCharCount = 0;
++    le_int32 limit = offset + count;
++    le_int32 i = offset;
++
++    while (i < limit) {
++        le_int32 state    = 0;
++        le_int32 inStart  = i;
++        le_int32 outStart = outCharCount;
++
++        while( i < limit) {
++            LEUnicode lead  = 0;
++            LEUnicode vowel = 0;
++            LEUnicode trail = 0;
++            le_int32 chClass = getCharClass(chars[i], lead, vowel, trail);
++            const StateTransition transition = stateTable[state][chClass];
++
++            if (chClass == CC_X) {
++                /* Any character of type X will be stored as a trail jamo */
++                if ((transition.actionFlags & AF_T) != 0) {
++                    outChars[outCharCount] = trail;
++                    glyphStorage.setCharIndex(outCharCount, i-offset, success);
++                    glyphStorage.setAuxData(outCharCount++, nullFeatures, success);
++                }
++            } else {
++                /* Any Hangul will be fully decomposed. Output the decomposed characters. */
++                if ((transition.actionFlags & AF_L) != 0) {
++                    outChars[outCharCount] = lead;
++                    glyphStorage.setCharIndex(outCharCount, i-offset, success);
++                    glyphStorage.setAuxData(outCharCount++, ljmoFeatures, success);
++                }
++
++                if ((transition.actionFlags & AF_V) != 0) {
++                    outChars[outCharCount] = vowel;
++                    glyphStorage.setCharIndex(outCharCount, i-offset, success);
++                    glyphStorage.setAuxData(outCharCount++, vjmoFeatures, success);
++                }
++
++                if ((transition.actionFlags & AF_T) != 0) {
++                    outChars[outCharCount] = trail;
++                    glyphStorage.setCharIndex(outCharCount, i-offset, success);
++                    glyphStorage.setAuxData(outCharCount++, tjmoFeatures, success);
++                }
++            }
++
++            state = transition.newState;
++
++            /* Negative next state means stop. */
++            if (state < 0) {
++                break;
++            }
++
++            i += 1;
++        }
++
++        le_int32 inLength  = i - inStart;
++        le_int32 outLength = outCharCount - outStart;
++
++        /*
++         * See if the syllable can be composed into a single character. There are 5
++         * possible cases:
++         *
++         *   Input     Decomposed to    Compose to
++         *   LV        L, V             LV
++         *   LVT       L, V, T          LVT
++         *   L, V      L, V             LV, DEL
++         *   LV, T     L, V, T          LVT, DEL
++         *   L, V, T   L, V, T          LVT, DEL, DEL
++         */
++        if ((inLength >= 1 && inLength <= 3) && (outLength == 2 || outLength == 3)) {
++            LEUnicode syllable = 0x0000;
++            LEUnicode lead  = outChars[outStart];
++            LEUnicode vowel = outChars[outStart + 1];
++            LEUnicode trail = outLength == 3? outChars[outStart + 2] : TJMO_FIRST;
++
++            /*
++             * If the composition consumes the whole decomposed syllable,
++             * we can use it.
++             */
++            if (compose(lead, vowel, trail, syllable) == outLength) {
++                outCharCount = outStart;
++                outChars[outCharCount] = syllable;
++                glyphStorage.setCharIndex(outCharCount, inStart-offset, success);
++                glyphStorage.setAuxData(outCharCount++, nullFeatures, success);
++
++                /*
++                 * Replace the rest of the input characters with DEL.
++                 */
++                for(le_int32 d = inStart + 1; d < i; d += 1) {
++                    outChars[outCharCount] = 0xFFFF;
++                    glyphStorage.setCharIndex(outCharCount, d - offset, success);
++                    glyphStorage.setAuxData(outCharCount++, nullFeatures, success);
++                }
++            }
++        }
++    }
++
++    glyphStorage.adoptGlyphCount(outCharCount);
++    return outCharCount;
++}
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/HangulLayoutEngine.h b/src/share/native/sun/font/layout/HangulLayoutEngine.h
+new file mode 100644
+--- /dev/null
++++ jdk/src/share/native/sun/font/layout/HangulLayoutEngine.h
+@@ -0,0 +1,151 @@
++/*
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute 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.
++ *
++ */
++
++/*
++ *
++ * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved
++ *
++ */
++
++#ifndef __HANGULAYOUTENGINE_H
++#define __HANGULAYOUTENGINE_H
++
++#include "LETypes.h"
++#include "LEFontInstance.h"
++#include "LEGlyphFilter.h"
++#include "LayoutEngine.h"
++#include "OpenTypeLayoutEngine.h"
++
++#include "GlyphSubstitutionTables.h"
++#include "GlyphDefinitionTables.h"
++#include "GlyphPositioningTables.h"
++
++U_NAMESPACE_BEGIN
++
++class MPreFixups;
++class LEGlyphStorage;
++
++/**
++ * This class implements OpenType layout for Old Hangul OpenType fonts, as
++ * specified by Microsoft in "Creating and Supporting OpenType Fonts for
++ * The Korean Hangul Script" (http://www.microsoft.com/typography/otfntdev/hangulot/default.htm)
++ *
++ * This class overrides the characterProcessing method to do Hangul character processing.
++ * (See the MS spec. for more details)
++ *
++ * @internal
++ */
++class HangulOpenTypeLayoutEngine : public OpenTypeLayoutEngine
++{
++public:
++    /**
++     * This is the main constructor. It constructs an instance of HangulOpenTypeLayoutEngine for
++     * a particular font, script and language. It takes the GSUB table as a parameter since
++     * LayoutEngine::layoutEngineFactory has to read the GSUB table to know that it has an
++     * Hangul OpenType font.
++     *
++     * @param fontInstance - the font
++     * @param scriptCode - the script
++     * @param langaugeCode - the language
++     * @param gsubTable - the GSUB table
++     * @param success - set to an error code if the operation fails
++     *
++     * @see LayoutEngine::layoutEngineFactory
++     * @see OpenTypeLayoutEngine
++     * @see ScriptAndLangaugeTags.h for script and language codes
++     *
++     * @internal
++     */
++    HangulOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
++                            le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success);
++
++    /**
++     * This constructor is used when the font requires a "canned" GSUB table which can't be known
++     * until after this constructor has been invoked.
++     *
++     * @param fontInstance - the font
++     * @param scriptCode - the script
++     * @param langaugeCode - the language
++     * @param success - set to an error code if the operation fails
++     *
++     * @see OpenTypeLayoutEngine
++     * @see ScriptAndLangaugeTags.h for script and language codes
++     *
++     * @internal
++     */
++    HangulOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
++                              le_int32 typoFlags, LEErrorCode &success);
++
++    /**
++     * The destructor, virtual for correct polymorphic invocation.
++     *
++     * @internal
++     */
++   virtual ~HangulOpenTypeLayoutEngine();
++
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for the actual class.
++     *
++     * @stable ICU 2.8
++     */
++    virtual UClassID getDynamicClassID() const;
++
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for this class.
++     *
++     * @stable ICU 2.8
++     */
++    static UClassID getStaticClassID();
++
++protected:
++
++    /**
++     * This method does Hangul OpenType character processing. It assigns the OpenType feature
++     * tags to the characters, and may compose a character sequence into a modern Hangul syllable,
++     * or decompose a modern Hangul syllable if it forms part of an old Hangul syllable.
++     *
++     * Input parameters:
++     * @param chars - the input character context
++     * @param offset - the index of the first character to process
++     * @param count - the number of characters to process
++     * @param max - the number of characters in the input context
++     * @param rightToLeft - <code>TRUE</code> if the characters are in a right to left directional run
++     * @param glyphStorage - the glyph storage object. The glyph and character index arrays will be set.
++     *                       the auxillary data array will be set to the feature tags.
++     *
++     * Output parameters:
++     * @param success - set to an error code if the operation fails
++     *
++     * @return the output character count
++     *
++     * @internal
++     */
++    virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
++            LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
++};
++
++U_NAMESPACE_END
++#endif
++
+diff --git a/src/share/native/sun/font/layout/HebrewLigatureData.cpp b/src/share/native/sun/font/layout/HebrewLigatureData.cpp
+deleted file mode 100644
+--- jdk/src/share/native/sun/font/layout/HebrewLigatureData.cpp
++++ /dev/null
+@@ -1,80 +0,0 @@
+-/*
+- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+- *
+- * This code is free software; you can redistribute 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.
+- *
+- */
+-
+-/*
+- *
+- * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved
+- *
+- * WARNING: THIS FILE IS MACHINE GENERATED. DO NOT HAND EDIT IT UNLESS
+- * YOU REALLY KNOW WHAT YOU'RE DOING.
+- *
+- */
+-
+-#include "LETypes.h"
+-#include "HebrewShaping.h"
+-
+-const le_uint8 HebrewShaping::glyphSubstitutionTable[] = {
+-        0x00, 0x01, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x1E, 0x00, 0x2C, 0x00, 0x01, 0x68, 0x65, 0x62, 0x72,
+-        0x00, 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
+-        0x6C, 0x69, 0x67, 0x61, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04,
+-        0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x01, 0x62, 0x00, 0x16, 0x00, 0x32,
+-        0x00, 0x4C, 0x00, 0x5E, 0x00, 0x68, 0x00, 0x72, 0x00, 0x7C, 0x00, 0x8E, 0x00, 0x98, 0x00, 0xA2,
+-        0x00, 0xAC, 0x00, 0xB6, 0x00, 0xC8, 0x00, 0xD2, 0x00, 0xDC, 0x00, 0xE6, 0x00, 0xF0, 0x00, 0xFA,
+-        0x01, 0x0C, 0x01, 0x16, 0x01, 0x20, 0x01, 0x2A, 0x01, 0x58, 0x00, 0x03, 0x00, 0x08, 0x00, 0x0E,
+-        0x00, 0x14, 0xFB, 0x2E, 0x00, 0x02, 0x05, 0xB7, 0xFB, 0x2F, 0x00, 0x02, 0x05, 0xB8, 0xFB, 0x30,
+-        0x00, 0x02, 0x05, 0xBC, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0xFB, 0x31, 0x00, 0x02, 0x05, 0xBC,
+-        0xFB, 0x4C, 0x00, 0x02, 0x05, 0xBF, 0x00, 0x01, 0x00, 0x04, 0xFB, 0x32, 0x00, 0x02, 0x05, 0xBC,
+-        0x00, 0x01, 0x00, 0x04, 0xFB, 0x33, 0x00, 0x02, 0x05, 0xBC, 0x00, 0x01, 0x00, 0x04, 0xFB, 0x34,
+-        0x00, 0x02, 0x05, 0xBC, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0xFB, 0x4B, 0x00, 0x02, 0x05, 0xB9,
+-        0xFB, 0x35, 0x00, 0x02, 0x05, 0xBC, 0x00, 0x01, 0x00, 0x04, 0xFB, 0x36, 0x00, 0x02, 0x05, 0xBC,
+-        0x00, 0x01, 0x00, 0x04, 0xFB, 0x38, 0x00, 0x02, 0x05, 0xBC, 0x00, 0x01, 0x00, 0x04, 0xFB, 0x39,
+-        0x00, 0x02, 0x05, 0xBC, 0x00, 0x01, 0x00, 0x04, 0xFB, 0x3A, 0x00, 0x02, 0x05, 0xBC, 0x00, 0x02,
+-        0x00, 0x06, 0x00, 0x0C, 0xFB, 0x3B, 0x00, 0x02, 0x05, 0xBC, 0xFB, 0x4D, 0x00, 0x02, 0x05, 0xBF,
+-        0x00, 0x01, 0x00, 0x04, 0xFB, 0x3C, 0x00, 0x02, 0x05, 0xBC, 0x00, 0x01, 0x00, 0x04, 0xFB, 0x3E,
+-        0x00, 0x02, 0x05, 0xBC, 0x00, 0x01, 0x00, 0x04, 0xFB, 0x40, 0x00, 0x02, 0x05, 0xBC, 0x00, 0x01,
+-        0x00, 0x04, 0xFB, 0x41, 0x00, 0x02, 0x05, 0xBC, 0x00, 0x01, 0x00, 0x04, 0xFB, 0x43, 0x00, 0x02,
+-        0x05, 0xBC, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C, 0xFB, 0x44, 0x00, 0x02, 0x05, 0xBC, 0xFB, 0x4E,
+-        0x00, 0x02, 0x05, 0xBF, 0x00, 0x01, 0x00, 0x04, 0xFB, 0x46, 0x00, 0x02, 0x05, 0xBC, 0x00, 0x01,
+-        0x00, 0x04, 0xFB, 0x47, 0x00, 0x02, 0x05, 0xBC, 0x00, 0x01, 0x00, 0x04, 0xFB, 0x48, 0x00, 0x02,
+-        0x05, 0xBC, 0x00, 0x05, 0x00, 0x0C, 0x00, 0x14, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x28, 0xFB, 0x2C,
+-        0x00, 0x03, 0x05, 0xBC, 0x05, 0xC1, 0xFB, 0x2D, 0x00, 0x03, 0x05, 0xBC, 0x05, 0xC2, 0xFB, 0x49,
+-        0x00, 0x02, 0x05, 0xBC, 0xFB, 0x2A, 0x00, 0x02, 0x05, 0xC1, 0xFB, 0x2B, 0x00, 0x02, 0x05, 0xC2,
+-        0x00, 0x01, 0x00, 0x04, 0xFB, 0x4A, 0x00, 0x02, 0x05, 0xBC, 0x00, 0x01, 0x00, 0x16, 0x05, 0xD0,
+-        0x05, 0xD1, 0x05, 0xD2, 0x05, 0xD3, 0x05, 0xD4, 0x05, 0xD5, 0x05, 0xD6, 0x05, 0xD8, 0x05, 0xD9,
+-        0x05, 0xDA, 0x05, 0xDB, 0x05, 0xDC, 0x05, 0xDE, 0x05, 0xE0, 0x05, 0xE1, 0x05, 0xE3, 0x05, 0xE4,
+-        0x05, 0xE6, 0x05, 0xE7, 0x05, 0xE8, 0x05, 0xE9, 0x05, 0xEA
+-};
+-
+-const le_uint8 HebrewShaping::glyphDefinitionTable[] = {
+-    0x00, 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x15,
+-    0x05, 0x91, 0x05, 0xA1, 0x00, 0x03, 0x05, 0xA3, 0x05, 0xB9, 0x00, 0x03, 0x05, 0xBB, 0x05, 0xBD,
+-    0x00, 0x03, 0x05, 0xBE, 0x05, 0xBE, 0x00, 0x01, 0x05, 0xBF, 0x05, 0xBF, 0x00, 0x03, 0x05, 0xC0,
+-    0x05, 0xC0, 0x00, 0x01, 0x05, 0xC1, 0x05, 0xC2, 0x00, 0x03, 0x05, 0xC3, 0x05, 0xC3, 0x00, 0x01,
+-    0x05, 0xC4, 0x05, 0xC4, 0x00, 0x03, 0x05, 0xD0, 0x05, 0xEA, 0x00, 0x01, 0x05, 0xF0, 0x05, 0xF2,
+-    0x00, 0x02, 0x05, 0xF3, 0x05, 0xF4, 0x00, 0x01, 0xFB, 0x1E, 0xFB, 0x1E, 0x00, 0x03, 0xFB, 0x1F,
+-    0xFB, 0x1F, 0x00, 0x02, 0xFB, 0x20, 0xFB, 0x36, 0x00, 0x01, 0xFB, 0x38, 0xFB, 0x3C, 0x00, 0x01,
+-    0xFB, 0x3E, 0xFB, 0x3E, 0x00, 0x01, 0xFB, 0x40, 0xFB, 0x41, 0x00, 0x01, 0xFB, 0x43, 0xFB, 0x44,
+-    0x00, 0x01, 0xFB, 0x46, 0xFB, 0x4E, 0x00, 0x01, 0xFB, 0x4F, 0xFB, 0x4F, 0x00, 0x02
+-};
+diff --git a/src/share/native/sun/font/layout/HebrewShaping.cpp b/src/share/native/sun/font/layout/HebrewShaping.cpp
+deleted file mode 100644
+--- jdk/src/share/native/sun/font/layout/HebrewShaping.cpp
++++ /dev/null
+@@ -1,58 +0,0 @@
+-/*
+- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+- *
+- * This code is free software; you can redistribute 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.
+- *
+- */
+-
+-/*
+- *
+- * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved
+- *
+- */
+-
+-#include "LETypes.h"
+-#include "OpenTypeTables.h"
+-#include "HebrewShaping.h"
+-
+-const LETag ligaFeatureTag  = 0x6C696761; // 'liga'
+-const LETag emptyTag        = 0x00000000; // ''
+-
+-const LETag hebrewTags[] =
+-{
+-    ligaFeatureTag, emptyTag
+-};
+-
+-void HebrewShaping::shape(const LEUnicode * /*chars*/, le_int32 /*offset*/, le_int32 charCount, le_int32 /*charMax*/,
+-                          le_bool rightToLeft, const LETag **tags)
+-{
+-
+-    le_int32 count, out = 0, dir = 1;
+-
+-    if (rightToLeft) {
+-        out = charCount - 1;
+-        dir = -1;
+-    }
+-
+-    for (count = 0; count < charCount; count += 1, out += dir) {
+-                tags[out] = hebrewTags;
+-        }
+-}
+diff --git a/src/share/native/sun/font/layout/HebrewShaping.h b/src/share/native/sun/font/layout/HebrewShaping.h
+deleted file mode 100644
+--- jdk/src/share/native/sun/font/layout/HebrewShaping.h
++++ /dev/null
+@@ -1,52 +0,0 @@
+-/*
+- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+- *
+- * This code is free software; you can redistribute 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.
+- *
+- */
+-
+-/*
+- *
+- * (C) Copyright IBM Corp. 1998, 1999, 2000 - All Rights Reserved
+- *
+- */
+-
+-#ifndef __HEBREWSHAPING_H
+-#define __HEBREWSHAPING_H
+-
+-#include "LETypes.h"
+-#include "OpenTypeTables.h"
+-
+-class HebrewShaping
+-{
+-public:
+-    static void shape(const LEUnicode *chars, le_int32 offset, le_int32 charCount, le_int32 charMax,
+-                      le_bool rightToLeft, const LETag **tags);
+-
+-    static const le_uint8 glyphSubstitutionTable[];
+-    static const le_uint8 glyphDefinitionTable[];
+-
+-private:
+-    // forbid instantiation
+-    HebrewShaping();
+-};
+-
+-#endif
+diff --git a/src/share/native/sun/font/layout/ICUFeatures.h b/src/share/native/sun/font/layout/ICUFeatures.h
+new file mode 100644
+--- /dev/null
++++ jdk/src/share/native/sun/font/layout/ICUFeatures.h
+@@ -0,0 +1,69 @@
++/*
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute 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.
++ *
++ */
++
++/*
++ *
++ * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved
++ *
++ */
++
++#ifndef __ICUFEATURES_H
++#define __ICUFEATURES_H
++
++/**
++ * \file
++ * \internal
++ */
++
++#include "LETypes.h"
++#include "OpenTypeTables.h"
++
++U_NAMESPACE_BEGIN
++
++struct FeatureRecord
++{
++    ATag        featureTag;
++    Offset      featureTableOffset;
++};
++
++struct FeatureTable
++{
++    Offset      featureParamsOffset;
++    le_uint16   lookupCount;
++    le_uint16   lookupListIndexArray[ANY_NUMBER];
++};
++
++struct FeatureListTable
++{
++    le_uint16           featureCount;
++    FeatureRecord       featureRecordArray[ANY_NUMBER];
++
++    const FeatureTable  *getFeatureTable(le_uint16 featureIndex, LETag *featureTag) const;
++
++    const FeatureTable *getFeatureTable(LETag featureTag) const;
++};
++
++U_NAMESPACE_END
++#endif
+diff --git a/src/share/native/sun/font/layout/IndicClassTables.cpp b/src/share/native/sun/font/layout/IndicClassTables.cpp
+--- jdk/src/share/native/sun/font/layout/IndicClassTables.cpp
++++ jdk/src/share/native/sun/font/layout/IndicClassTables.cpp
+@@ -25,7 +25,7 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
++ * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved
+  *
+  */
+ 
+@@ -73,6 +73,7 @@
+ #define _m2  (CC_SPLIT_VOWEL_PIECE_2 | CF_LENGTH_MARK)
+ #define _m3  (CC_SPLIT_VOWEL_PIECE_3 | CF_LENGTH_MARK)
+ #define _vr  (CC_VIRAMA)
++#define _al  (CC_AL_LAKUNA)
+ 
+ // split matras
+ #define _s1  (_dv | _x1)
+@@ -90,6 +91,7 @@
+ // special forms... (Bengali RA?)
+ #define _bb  (_ct | CF_BELOW_BASE)
+ #define _pb  (_ct | CF_POST_BASE)
++#define _fb  (_ct | CF_PRE_BASE)
+ #define _vt  (_bb | CF_VATTU)
+ #define _rv  (_vt | CF_REPH)
+ #define _rp  (_pb | CF_REPH)
+@@ -119,7 +121,7 @@
+     _dr, _db, _db, _db, _db, _xx, _xx, _l1, _dl, _xx, _xx, _s1, _s2, _vr, _xx, _xx, // 09C0 - 09CF
+     _xx, _xx, _xx, _xx, _xx, _xx, _xx, _m2, _xx, _xx, _xx, _xx, _cn, _cn, _xx, _cn, // 09D0 - 09DF
+     _iv, _iv, _dv, _dv, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 09E0 - 09EF
+-    _ct, _ct, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx                           // 09F0 - 09FA
++    _rv, _ct, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx                           // 09F0 - 09FA
+ };
+ 
+ static const IndicClassTable::CharClass punjCharClasses[] =
+@@ -142,9 +144,22 @@
+     _rv, _xx, _ct, _ct, _xx, _ct, _ct, _ct, _ct, _ct, _xx, _xx, _nu, _xx, _dr, _dl, // 0AB0 - 0ABF
+     _dr, _db, _db, _db, _db, _da, _xx, _da, _da, _dr, _xx, _dr, _dr, _vr, _xx, _xx, // 0AC0 - 0ACF
+     _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0AD0 - 0ADF
+-    _iv, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx  // 0AE0 - 0AEF
++    _iv, _iv, _db, _db, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx  // 0AE0 - 0AEF
+ };
+ 
++#if 1
++static const IndicClassTable::CharClass oryaCharClasses[] =
++{
++    _xx, _ma, _mp, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _xx, _iv, /* 0B00 - 0B0F */
++    _iv, _xx, _xx, _iv, _iv, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _ct, _bb, /* 0B10 - 0B1F */
++    _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _xx, _bb, _bb, _bb, _bb, _bb, _pb, /* 0B20 - 0B2F */
++    _rb, _xx, _bb, _bb, _xx, _bb, _bb, _bb, _bb, _bb, _xx, _xx, _nu, _xx, _dr, _da, /* 0B30 - 0B3F */
++    _dr, _db, _db, _db, _xx, _xx, _xx, _dl, _s1, _xx, _xx, _s2, _s3, _vr, _xx, _xx, /* 0B40 - 0B4F */
++    _xx, _xx, _xx, _xx, _xx, _xx, _da, _dr, _xx, _xx, _xx, _xx, _cn, _cn, _xx, _pb, /* 0B50 - 0B5F */
++    _iv, _iv, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, /* 0B60 - 0B6F */
++    _xx, _bb                                                                        /* 0B70 - 0B71 */
++};
++#else
+ static const IndicClassTable::CharClass oryaCharClasses[] =
+ {
+     _xx, _ma, _mp, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _xx, _iv, // 0B00 - 0B0F
+@@ -156,13 +171,14 @@
+     _iv, _iv, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0B60 - 0B6F
+     _xx, _ct                                                                        // 0B70 - 0B71
+ };
++#endif
+ 
+ static const IndicClassTable::CharClass tamlCharClasses[] =
+ {
+-    _xx, _xx, _ma, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _xx, _xx, _iv, _iv, // 0B80 - 0B8F
++    _xx, _xx, _ma, _xx, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _xx, _xx, _iv, _iv, // 0B80 - 0B8F
+     _iv, _xx, _iv, _iv, _iv, _ct, _xx, _xx, _xx, _ct, _ct, _xx, _ct, _xx, _ct, _ct, // 0B90 - 0B9F
+     _xx, _xx, _xx, _ct, _ct, _xx, _xx, _xx, _ct, _ct, _ct, _xx, _xx, _xx, _ct, _ct, // 0BA0 - 0BAF
+-    _ct, _ct, _ct, _ct, _ct, _ct, _xx, _ct, _ct, _ct, _xx, _xx, _xx, _xx, _r2, _dr, // 0BB0 - 0BBF
++    _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _xx, _xx, _xx, _xx, _r2, _dr, // 0BB0 - 0BBF
+     _da, _dr, _dr, _xx, _xx, _xx, _l1, _l1, _dl, _xx, _s1, _s2, _s3, _vr, _xx, _xx, // 0BC0 - 0BCF
+     _xx, _xx, _xx, _xx, _xx, _xx, _xx, _m2, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0BD0 - 0BDF
+     _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0BE0 - 0BEF
+@@ -175,7 +191,7 @@
+     _xx, _mp, _mp, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _iv, _iv, // 0C00 - 0C0F
+     _iv, _xx, _iv, _iv, _iv, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, // 0C10 - 0C1F
+     _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _xx, _bb, _bb, _bb, _bb, _bb, _bb, // 0C20 - 0C2F
+-    _bb, _ct, _bb, _bb, _xx, _bb, _bb, _bb, _bb, _bb, _xx, _xx, _xx, _xx, _da, _da, // 0C30 - 0C3F
++    _bb, _bb, _bb, _bb, _xx, _bb, _bb, _bb, _bb, _bb, _xx, _xx, _xx, _xx, _da, _da, // 0C30 - 0C3F
+     _da, _dr, _dr, _dr, _dr, _xx, _a1, _da, _s1, _xx, _da, _da, _da, _vr, _xx, _xx, // 0C40 - 0C4F
+     _xx, _xx, _xx, _xx, _xx, _da, _m2, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0C50 - 0C5F
+     _iv, _iv, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx  // 0C60 - 0C6F
+@@ -189,7 +205,7 @@
+ //  http://brahmi.sourceforge.net/docs/KannadaComputing.html
+ static const IndicClassTable::CharClass kndaCharClasses[] =
+ {
+-    _xx, _xx, _mp, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _iv, // 0C80 - 0C8F
++    _xx, _xx, _mp, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _iv, _iv, // 0C80 - 0C8F
+     _iv, _xx, _iv, _iv, _iv, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, // 0C90 - 0C9F
+     _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _xx, _bb, _bb, _bb, _bb, _bb, _bb, // 0CA0 - 0CAF
+     _rb, _ct, _bb, _bb, _xx, _bb, _bb, _bb, _bb, _bb, _xx, _xx, _xx, _xx, _dr, _da, // 0CB0 - 0CBF
+@@ -203,9 +219,9 @@
+ static const IndicClassTable::CharClass mlymCharClasses[] =
+ {
+     _xx, _xx, _mp, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _iv, _iv, // 0D00 - 0D0F
+-    _iv, _xx, _iv, _iv, _iv, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _bb, // 0D10 - 0D1F
+-    _ct, _ct, _ct, _bb, _ct, _bb, _bb, _ct, _ct, _xx, _ct, _ct, _ct, _ct, _ct, _pb, // 0D20 - 0D2F
+-    _pb, _cn, _bb, _ct, _ct, _pb, _ct, _ct, _ct, _ct, _xx, _xx, _xx, _xx, _r2, _dr, // 0D30 - 0D3F
++    _iv, _xx, _iv, _iv, _iv, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, // 0D10 - 0D1F
++    _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _xx, _ct, _ct, _ct, _ct, _ct, _pb, // 0D20 - 0D2F
++    _fb, _fb, _bb, _ct, _ct, _pb, _ct, _ct, _ct, _ct, _xx, _xx, _xx, _xx, _r2, _dr, // 0D30 - 0D3F
+     _dr, _dr, _dr, _dr, _xx, _xx, _l1, _l1, _dl, _xx, _s1, _s2, _s3, _vr, _xx, _xx, // 0D40 - 0D4F
+     _xx, _xx, _xx, _xx, _xx, _xx, _xx, _m2, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0D50 - 0D5F
+     _iv, _iv, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx  // 0D60 - 0D6F
+@@ -217,7 +233,7 @@
+     _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _xx, _xx, _ct, _ct, _ct, _ct, _ct, _ct, // 0D90 - 0D9F
+     _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, // 0DA0 - 0DAF
+     _ct, _ct, _xx, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _xx, _ct, _xx, _xx, // 0DB0 - 0DBF
+-    _ct, _ct, _ct, _ct, _ct, _ct, _ct, _xx, _xx, _xx, _vr, _xx, _xx, _xx, _xx, _dr, // 0DC0 - 0DCF
++    _ct, _ct, _ct, _ct, _ct, _ct, _ct, _xx, _xx, _xx, _al, _xx, _xx, _xx, _xx, _dr, // 0DC0 - 0DCF
+     _dr, _dr, _da, _da, _db, _xx, _db, _xx, _dr, _dl, _s1, _dl, _s2, _s3, _s4, _dr, // 0DD0 - 0DDF
+     _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0DE0 - 0DEF
+     _xx, _xx, _dr, _dr, _xx                                                         // 0DF0 - 0DF4
+@@ -248,17 +264,18 @@
+ 
+ // FIXME: post 'GSUB' reordering of MATRA_PRE's for Malayalam and Tamil
+ // FIXME: reformed Malayalam needs to reorder VATTU to before base glyph...
++// FIXME: not sure passing ZWJ/ZWNJ is best way to render Malayalam Cillu...
+ // FIXME: eyelash RA only for Devanagari??
+-#define DEVA_SCRIPT_FLAGS (SF_EYELASH_RA | SF_NO_POST_BASE_LIMIT)
+-#define BENG_SCRIPT_FLAGS (SF_REPH_AFTER_BELOW | SF_NO_POST_BASE_LIMIT)
+-#define PUNJ_SCRIPT_FLAGS (SF_NO_POST_BASE_LIMIT)
+-#define GUJR_SCRIPT_FLAGS (SF_NO_POST_BASE_LIMIT)
+-#define ORYA_SCRIPT_FLAGS (SF_REPH_AFTER_BELOW | SF_NO_POST_BASE_LIMIT)
+-#define TAML_SCRIPT_FLAGS (SF_MPRE_FIXUP | SF_NO_POST_BASE_LIMIT)
+-#define TELU_SCRIPT_FLAGS (SF_MATRAS_AFTER_BASE | 3)
+-#define KNDA_SCRIPT_FLAGS (SF_MATRAS_AFTER_BASE | 3)
+-#define MLYM_SCRIPT_FLAGS (SF_MPRE_FIXUP | SF_NO_POST_BASE_LIMIT)
+-#define SINH_SCRIPT_FLAGS (SF_MPRE_FIXUP | SF_NO_POST_BASE_LIMIT)
++#define DEVA_SCRIPT_FLAGS (SF_EYELASH_RA | SF_NO_POST_BASE_LIMIT | SF_FILTER_ZERO_WIDTH)
++#define BENG_SCRIPT_FLAGS (SF_REPH_AFTER_BELOW | SF_NO_POST_BASE_LIMIT | SF_FILTER_ZERO_WIDTH)
++#define PUNJ_SCRIPT_FLAGS (SF_NO_POST_BASE_LIMIT | SF_FILTER_ZERO_WIDTH)
++#define GUJR_SCRIPT_FLAGS (SF_NO_POST_BASE_LIMIT | SF_FILTER_ZERO_WIDTH)
++#define ORYA_SCRIPT_FLAGS (SF_REPH_AFTER_BELOW | SF_NO_POST_BASE_LIMIT | SF_FILTER_ZERO_WIDTH)
++#define TAML_SCRIPT_FLAGS (SF_MPRE_FIXUP | SF_NO_POST_BASE_LIMIT | SF_FILTER_ZERO_WIDTH)
++#define TELU_SCRIPT_FLAGS (SF_MATRAS_AFTER_BASE | SF_FILTER_ZERO_WIDTH | 3)
++#define KNDA_SCRIPT_FLAGS (SF_MATRAS_AFTER_BASE | SF_FILTER_ZERO_WIDTH | 3)
++#define MLYM_SCRIPT_FLAGS (SF_MPRE_FIXUP | SF_NO_POST_BASE_LIMIT /*| SF_FILTER_ZERO_WIDTH*/)
++#define SINH_SCRIPT_FLAGS (SF_NO_POST_BASE_LIMIT)
+ 
+ //
+ // Indic Class Tables
+@@ -286,7 +303,7 @@
+ //
+ // IndicClassTable addresses
+ //
+-static const IndicClassTable * const indicClassTables[] = {
++static const IndicClassTable * const indicClassTables[scriptCodeCount] = {
+     NULL,            /* 'zyyy' (COMMON) */
+     NULL,            /* 'qaai' (INHERITED) */
+     NULL,            /* 'arab' (ARABIC) */
+@@ -348,7 +365,79 @@
+     NULL,            /* 'sylo' (SYLOTI_NAGRI) */
+     NULL,            /* 'talu' (NEW_TAI_LUE) */
+     NULL,            /* 'tfng' (TIFINAGH) */
+-    NULL             /* 'xpeo' (OLD_PERSIAN) */
++    NULL,            /* 'xpeo' (OLD_PERSIAN) */
++    NULL,            /* 'bali' (BALINESE) */
++    NULL,            /* 'batk' (BATK) */
++    NULL,            /* 'blis' (BLIS) */
++    NULL,            /* 'brah' (BRAH) */
++    NULL,            /* 'cham' (CHAM) */
++    NULL,            /* 'cirt' (CIRT) */
++    NULL,            /* 'cyrs' (CYRS) */
++    NULL,            /* 'egyd' (EGYD) */
++    NULL,            /* 'egyh' (EGYH) */
++    NULL,            /* 'egyp' (EGYP) */
++    NULL,            /* 'geok' (GEOK) */
++    NULL,            /* 'hans' (HANS) */
++    NULL,            /* 'hant' (HANT) */
++    NULL,            /* 'hmng' (HMNG) */
++    NULL,            /* 'hung' (HUNG) */
++    NULL,            /* 'inds' (INDS) */
++    NULL,            /* 'java' (JAVA) */
++    NULL,            /* 'kali' (KALI) */
++    NULL,            /* 'latf' (LATF) */
++    NULL,            /* 'latg' (LATG) */
++    NULL,            /* 'lepc' (LEPC) */
++    NULL,            /* 'lina' (LINA) */
++    NULL,            /* 'mand' (MAND) */
++    NULL,            /* 'maya' (MAYA) */
++    NULL,            /* 'mero' (MERO) */
++    NULL,            /* 'nko ' (NKO) */
++    NULL,            /* 'orkh' (ORKH) */
++    NULL,            /* 'perm' (PERM) */
++    NULL,            /* 'phag' (PHAGS_PA) */
++    NULL,            /* 'phnx' (PHOENICIAN) */
++    NULL,            /* 'plrd' (PLRD) */
++    NULL,            /* 'roro' (RORO) */
++    NULL,            /* 'sara' (SARA) */
++    NULL,            /* 'syre' (SYRE) */
++    NULL,            /* 'syrj' (SYRJ) */
++    NULL,            /* 'syrn' (SYRN) */
++    NULL,            /* 'teng' (TENG) */
++    NULL,            /* 'vai ' (VAII) */
++    NULL,            /* 'visp' (VISP) */
++    NULL,            /* 'xsux' (CUNEIFORM) */
++    NULL,            /* 'zxxx' (ZXXX) */
++    NULL,            /* 'zzzz' (UNKNOWN) */
++    NULL,            /* 'cari' (CARI) */
++    NULL,            /* 'jpan' (JPAN) */
++    NULL,            /* 'lana' (LANA) */
++    NULL,            /* 'lyci' (LYCI) */
++    NULL,            /* 'lydi' (LYDI) */
++    NULL,            /* 'olck' (OLCK) */
++    NULL,            /* 'rjng' (RJNG) */
++    NULL,            /* 'saur' (SAUR) */
++    NULL,            /* 'sgnw' (SGNW) */
++    NULL,            /* 'sund' (SUND) */
++    NULL,            /* 'moon' (MOON) */
++    NULL,            /* 'mtei' (MTEI) */
++    NULL,            /* 'armi' (ARMI) */
++    NULL,            /* 'avst' (AVST) */
++    NULL,            /* 'cakm' (CAKM) */
++    NULL,            /* 'kore' (KORE) */
++    NULL,            /* 'kthi' (KTHI) */
++    NULL,            /* 'mani' (MANI) */
++    NULL,            /* 'phli' (PHLI) */
++    NULL,            /* 'phlp' (PHLP) */
++    NULL,            /* 'phlv' (PHLV) */
++    NULL,            /* 'prti' (PRTI) */
++    NULL,            /* 'samr' (SAMR) */
++    NULL,            /* 'tavt' (TAVT) */
++    NULL,            /* 'zmth' (ZMTH) */
++    NULL,            /* 'zsym' (ZSYM) */
++    NULL,            /* 'bamu' (BAMUM) */
++    NULL,            /* 'lisu' (LISU) */
++    NULL,            /* 'nkgb' (NKGB) */
++    NULL             /* 'sarb' (OLD_SOUTH_ARABIAN) */
+ };
+ 
+ IndicClassTable::CharClass IndicClassTable::getCharClass(LEUnicode ch) const
+@@ -388,4 +477,15 @@
+     return classTable->getWorstCaseExpansion();
+ }
+ 
++le_bool IndicReordering::getFilterZeroWidth(le_int32 scriptCode)
++{
++    const IndicClassTable *classTable = IndicClassTable::getScriptClassTable(scriptCode);
++
++    if (classTable == NULL) {
++        return TRUE;
++    }
++
++    return classTable->getFilterZeroWidth();
++}
++
+ U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/IndicLayoutEngine.cpp b/src/share/native/sun/font/layout/IndicLayoutEngine.cpp
+--- jdk/src/share/native/sun/font/layout/IndicLayoutEngine.cpp
++++ jdk/src/share/native/sun/font/layout/IndicLayoutEngine.cpp
+@@ -26,7 +26,7 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
++ * (C) Copyright IBM Corp. 1998-2009 - All Rights Reserved
+  *
+  */
+ 
+@@ -44,24 +44,31 @@
+ #include "LEGlyphStorage.h"
+ 
+ #include "IndicReordering.h"
+-
++#include <stdio.h>
+ U_NAMESPACE_BEGIN
+ 
+ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(IndicOpenTypeLayoutEngine)
+ 
+ IndicOpenTypeLayoutEngine::IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                    le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable)
+-    : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable), fMPreFixups(NULL)
++                    le_int32 typoFlags, le_bool version2, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success)
++    : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success), fMPreFixups(NULL)
++{
++        if ( version2 ) {
++                fFeatureMap = IndicReordering::getv2FeatureMap(fFeatureMapCount);
++        } else {
++    fFeatureMap = IndicReordering::getFeatureMap(fFeatureMapCount);
++        }
++    fFeatureOrder = TRUE;
++    fVersion2 = version2;
++    fFilterZeroWidth = IndicReordering::getFilterZeroWidth(fScriptCode);
++}
++
++IndicOpenTypeLayoutEngine::IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags, LEErrorCode &success)
++    : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success), fMPreFixups(NULL)
+ {
+     fFeatureMap = IndicReordering::getFeatureMap(fFeatureMapCount);
+     fFeatureOrder = TRUE;
+-}
+-
+-IndicOpenTypeLayoutEngine::IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags)
+-    : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags), fMPreFixups(NULL)
+-{
+-    fFeatureMap = IndicReordering::getFeatureMap(fFeatureMapCount);
+-    fFeatureOrder = TRUE;
++        fVersion2 =  FALSE;
+ }
+ 
+ IndicOpenTypeLayoutEngine::~IndicOpenTypeLayoutEngine()
+@@ -89,8 +96,13 @@
+         return 0;
+     }
+ 
+-    IndicReordering::adjustMPres(fMPreFixups, glyphStorage);
+-
++    if (fVersion2) {
++        IndicReordering::finalReordering(glyphStorage,retCount);
++        IndicReordering::applyPresentationForms(glyphStorage,retCount);
++        OpenTypeLayoutEngine::glyphSubstitution(count,max, rightToLeft, glyphStorage, success);
++    } else {
++        IndicReordering::adjustMPres(fMPreFixups, glyphStorage, success);
++    }
+     return retCount;
+ }
+ 
+@@ -128,7 +140,18 @@
+ 
+     // NOTE: assumes this allocates featureTags...
+     // (probably better than doing the worst case stuff here...)
+-    le_int32 outCharCount = IndicReordering::reorder(&chars[offset], count, fScriptCode, outChars, glyphStorage, &fMPreFixups);
++
++    le_int32 outCharCount;
++    if (fVersion2) {
++        outCharCount = IndicReordering::v2process(&chars[offset], count, fScriptCode, outChars, glyphStorage);
++    } else {
++        outCharCount = IndicReordering::reorder(&chars[offset], count, fScriptCode, outChars, glyphStorage, &fMPreFixups, success);
++    }
++
++    if (LE_FAILURE(success)) {
++        LE_DELETE_ARRAY(outChars);
++        return 0;
++    }
+ 
+     glyphStorage.adoptGlyphCount(outCharCount);
+     return outCharCount;
+diff --git a/src/share/native/sun/font/layout/IndicLayoutEngine.h b/src/share/native/sun/font/layout/IndicLayoutEngine.h
+--- jdk/src/share/native/sun/font/layout/IndicLayoutEngine.h
++++ jdk/src/share/native/sun/font/layout/IndicLayoutEngine.h
+@@ -26,7 +26,7 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
++ * (C) Copyright IBM Corp. 1998-2009 - All Rights Reserved
+  *
+  */
+ 
+@@ -72,6 +72,7 @@
+      * @param scriptCode - the script
+      * @param langaugeCode - the language
+      * @param gsubTable - the GSUB table
++     * @param success - set to an error code if the operation fails
+      *
+      * @see LayoutEngine::layoutEngineFactory
+      * @see OpenTypeLayoutEngine
+@@ -80,7 +81,7 @@
+      * @internal
+      */
+     IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                            le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable);
++                            le_int32 typoFlags, le_bool version2, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success);
+ 
+     /**
+      * This constructor is used when the font requires a "canned" GSUB table which can't be known
+@@ -89,6 +90,7 @@
+      * @param fontInstance - the font
+      * @param scriptCode - the script
+      * @param langaugeCode - the language
++     * @param success - set to an error code if the operation fails
+      *
+      * @see OpenTypeLayoutEngine
+      * @see ScriptAndLangaugeTags.h for script and language codes
+@@ -96,7 +98,7 @@
+      * @internal
+      */
+     IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                              le_int32 typoFlags);
++                              le_int32 typoFlags, LEErrorCode &success);
+ 
+     /**
+      * The destructor, virtual for correct polymorphic invocation.
+@@ -177,9 +179,12 @@
+     virtual le_int32 glyphProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
+             LEGlyphStorage &glyphStorage, LEErrorCode &success);
+ 
++    le_bool fVersion2;
++
+ private:
+ 
+     MPreFixups *fMPreFixups;
++
+ };
+ 
+ U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/IndicReordering.cpp b/src/share/native/sun/font/layout/IndicReordering.cpp
+--- jdk/src/share/native/sun/font/layout/IndicReordering.cpp
++++ jdk/src/share/native/sun/font/layout/IndicReordering.cpp
+@@ -25,7 +25,7 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
++ * (C) Copyright IBM Corp. 1998-2009 - All Rights Reserved
+  *
+  */
+ 
+@@ -38,10 +38,12 @@
+ 
+ U_NAMESPACE_BEGIN
+ 
++#define loclFeatureTag LE_LOCL_FEATURE_TAG
+ #define initFeatureTag LE_INIT_FEATURE_TAG
+ #define nuktFeatureTag LE_NUKT_FEATURE_TAG
+ #define akhnFeatureTag LE_AKHN_FEATURE_TAG
+ #define rphfFeatureTag LE_RPHF_FEATURE_TAG
++#define rkrfFeatureTag LE_RKRF_FEATURE_TAG
+ #define blwfFeatureTag LE_BLWF_FEATURE_TAG
+ #define halfFeatureTag LE_HALF_FEATURE_TAG
+ #define pstfFeatureTag LE_PSTF_FEATURE_TAG
+@@ -51,30 +53,69 @@
+ #define abvsFeatureTag LE_ABVS_FEATURE_TAG
+ #define pstsFeatureTag LE_PSTS_FEATURE_TAG
+ #define halnFeatureTag LE_HALN_FEATURE_TAG
+-
++#define cjctFeatureTag LE_CJCT_FEATURE_TAG
+ #define blwmFeatureTag LE_BLWM_FEATURE_TAG
+ #define abvmFeatureTag LE_ABVM_FEATURE_TAG
+ #define distFeatureTag LE_DIST_FEATURE_TAG
++#define caltFeatureTag LE_CALT_FEATURE_TAG
++#define kernFeatureTag LE_KERN_FEATURE_TAG
+ 
+-#define rphfFeatureMask 0x80000000UL
+-#define blwfFeatureMask 0x40000000UL
+-#define halfFeatureMask 0x20000000UL
+-#define pstfFeatureMask 0x10000000UL
+-#define nuktFeatureMask 0x08000000UL
+-#define akhnFeatureMask 0x04000000UL
+-#define vatuFeatureMask 0x02000000UL
+-#define presFeatureMask 0x01000000UL
+-#define blwsFeatureMask 0x00800000UL
+-#define abvsFeatureMask 0x00400000UL
+-#define pstsFeatureMask 0x00200000UL
+-#define halnFeatureMask 0x00100000UL
+-#define blwmFeatureMask 0x00080000UL
+-#define abvmFeatureMask 0x00040000UL
+-#define distFeatureMask 0x00020000UL
+-#define initFeatureMask 0x00010000UL
++#define loclFeatureMask 0x80000000UL
++#define rphfFeatureMask 0x40000000UL
++#define blwfFeatureMask 0x20000000UL
++#define halfFeatureMask 0x10000000UL
++#define pstfFeatureMask 0x08000000UL
++#define nuktFeatureMask 0x04000000UL
++#define akhnFeatureMask 0x02000000UL
++#define vatuFeatureMask 0x01000000UL
++#define presFeatureMask 0x00800000UL
++#define blwsFeatureMask 0x00400000UL
++#define abvsFeatureMask 0x00200000UL
++#define pstsFeatureMask 0x00100000UL
++#define halnFeatureMask 0x00080000UL
++#define blwmFeatureMask 0x00040000UL
++#define abvmFeatureMask 0x00020000UL
++#define distFeatureMask 0x00010000UL
++#define initFeatureMask 0x00008000UL
++#define cjctFeatureMask 0x00004000UL
++#define rkrfFeatureMask 0x00002000UL
++#define caltFeatureMask 0x00001000UL
++#define kernFeatureMask 0x00000800UL
+ 
+-class ReorderingOutput : public UMemory {
++// Syllable structure bits
++#define baseConsonantMask       0x00000400UL
++#define consonantMask           0x00000200UL
++#define halfConsonantMask       0x00000100UL
++#define rephConsonantMask       0x00000080UL
++#define matraMask               0x00000040UL
++#define vowelModifierMask       0x00000020UL
++#define markPositionMask        0x00000018UL
++
++#define postBasePosition        0x00000000UL
++#define preBasePosition         0x00000008UL
++#define aboveBasePosition       0x00000010UL
++#define belowBasePosition       0x00000018UL
++
++#define repositionedGlyphMask   0x00000002UL
++
++#define basicShapingFormsMask ( loclFeatureMask | nuktFeatureMask | akhnFeatureMask | rkrfFeatureMask | blwfFeatureMask | halfFeatureMask | vatuFeatureMask | cjctFeatureMask )
++#define positioningFormsMask ( kernFeatureMask | distFeatureMask | abvmFeatureMask | blwmFeatureMask )
++#define presentationFormsMask ( presFeatureMask | abvsFeatureMask | blwsFeatureMask | pstsFeatureMask | halnFeatureMask | caltFeatureMask )
++
++
++#define C_MALAYALAM_VOWEL_SIGN_U 0x0D41
++#define C_DOTTED_CIRCLE 0x25CC
++#define NO_GLYPH 0xFFFF
++
++// Some level of debate as to the proper value for MAX_CONSONANTS_PER_SYLLABLE.  Ticket 5588 states that 4
++// is the magic number according to ISCII, but 5 seems to be the more consistent with XP.
++#define MAX_CONSONANTS_PER_SYLLABLE 5
++
++#define INDIC_BLOCK_SIZE 0x7F
++
++class IndicReorderingOutput : public UMemory {
+ private:
++    le_int32   fSyllableCount;
+     le_int32   fOutIndex;
+     LEUnicode *fOutChars;
+ 
+@@ -95,8 +136,8 @@
+     LEUnicode   fLengthMark;
+     le_int32    fLengthMarkIndex;
+ 
+-    LEUnicode   fVirama;
+-    le_int32    fViramaIndex;
++    LEUnicode   fAlLakuna;
++    le_int32    fAlLakunaIndex;
+ 
+     FeatureMask fMatraFeatures;
+ 
+@@ -113,15 +154,20 @@
+     le_int32    fSMIndex;
+     FeatureMask fSMFeatures;
+ 
++    LEUnicode   fPreBaseConsonant;
++    LEUnicode   fPreBaseVirama;
++    le_int32    fPBCIndex;
++    FeatureMask fPBCFeatures;
++
+     void saveMatra(LEUnicode matra, le_int32 matraIndex, IndicClassTable::CharClass matraClass)
+     {
+         // FIXME: check if already set, or if not a matra...
+         if (IndicClassTable::isLengthMark(matraClass)) {
+             fLengthMark = matra;
+             fLengthMarkIndex = matraIndex;
+-        } else if (IndicClassTable::isVirama(matraClass)) {
+-            fVirama = matra;
+-            fViramaIndex = matraIndex;
++        } else if (IndicClassTable::isAlLakuna(matraClass)) {
++            fAlLakuna = matra;
++            fAlLakunaIndex = matraIndex;
+         } else {
+             switch (matraClass & CF_POS_MASK) {
+             case CF_POS_BEFORE:
+@@ -152,29 +198,34 @@
+     }
+ 
+ public:
+-    ReorderingOutput(LEUnicode *outChars, LEGlyphStorage &glyphStorage, MPreFixups *mpreFixups)
+-        : fOutIndex(0), fOutChars(outChars), fGlyphStorage(glyphStorage),
++    IndicReorderingOutput(LEUnicode *outChars, LEGlyphStorage &glyphStorage, MPreFixups *mpreFixups)
++        : fSyllableCount(0), fOutIndex(0), fOutChars(outChars), fGlyphStorage(glyphStorage),
+           fMpre(0), fMpreIndex(0), fMbelow(0), fMbelowIndex(0), fMabove(0), fMaboveIndex(0),
+-          fMpost(0), fMpostIndex(0), fLengthMark(0), fLengthMarkIndex(0), fVirama(0), fViramaIndex(0),
++          fMpost(0), fMpostIndex(0), fLengthMark(0), fLengthMarkIndex(0), fAlLakuna(0), fAlLakunaIndex(0),
+           fMatraFeatures(0), fMPreOutIndex(-1), fMPreFixups(mpreFixups),
+           fVMabove(0), fVMpost(0), fVMIndex(0), fVMFeatures(0),
+-          fSMabove(0), fSMbelow(0), fSMIndex(0), fSMFeatures(0)
++          fSMabove(0), fSMbelow(0), fSMIndex(0), fSMFeatures(0),
++          fPreBaseConsonant(0), fPreBaseVirama(0), fPBCIndex(0), fPBCFeatures(0)
+     {
+         // nothing else to do...
+     }
+ 
+-    ~ReorderingOutput()
++    ~IndicReorderingOutput()
+     {
+         // nothing to do here...
+     }
+ 
+     void reset()
+     {
+-        fMpre = fMbelow = fMabove = fMpost = fLengthMark = fVirama = 0;
++        fSyllableCount += 1;
++
++        fMpre = fMbelow = fMabove = fMpost = fLengthMark = fAlLakuna = 0;
+         fMPreOutIndex = -1;
+ 
+         fVMabove = fVMpost  = 0;
+         fSMabove = fSMbelow = 0;
++
++        fPreBaseConsonant = fPreBaseVirama = 0;
+     }
+ 
+     void writeChar(LEUnicode ch, le_uint32 charIndex, FeatureMask charFeatures)
+@@ -184,11 +235,113 @@
+         fOutChars[fOutIndex] = ch;
+ 
+         fGlyphStorage.setCharIndex(fOutIndex, charIndex, success);
+-        fGlyphStorage.setAuxData(fOutIndex, charFeatures, success);
++        fGlyphStorage.setAuxData(fOutIndex, charFeatures | (fSyllableCount & LE_GLYPH_GROUP_MASK), success);
+ 
+         fOutIndex += 1;
+     }
+ 
++    void setFeatures ( le_uint32 charIndex, FeatureMask charFeatures)
++    {
++        LEErrorCode success = LE_NO_ERROR;
++
++        fGlyphStorage.setAuxData( charIndex, charFeatures, success );
++
++    }
++
++    FeatureMask getFeatures ( le_uint32 charIndex )
++    {
++        LEErrorCode success = LE_NO_ERROR;
++        return fGlyphStorage.getAuxData(charIndex,success);
++    }
++
++        void decomposeReorderMatras ( const IndicClassTable *classTable, le_int32 beginSyllable, le_int32 nextSyllable, le_int32 inv_count ) {
++                le_int32 i;
++        LEErrorCode success = LE_NO_ERROR;
++
++                for ( i = beginSyllable ; i < nextSyllable ; i++ ) {
++                        if ( classTable->isMatra(fOutChars[i+inv_count])) {
++                                IndicClassTable::CharClass matraClass = classTable->getCharClass(fOutChars[i+inv_count]);
++                                if ( classTable->isSplitMatra(matraClass)) {
++                                        le_int32 saveIndex = fGlyphStorage.getCharIndex(i+inv_count,success);
++                                        le_uint32 saveAuxData = fGlyphStorage.getAuxData(i+inv_count,success);
++                    const SplitMatra *splitMatra = classTable->getSplitMatra(matraClass);
++                    int j;
++                    for (j = 0 ; *(splitMatra)[j] != 0 ; j++) {
++                        LEUnicode piece = (*splitMatra)[j];
++                                                if ( j == 0 ) {
++                                                        fOutChars[i+inv_count] = piece;
++                                                        matraClass = classTable->getCharClass(piece);
++                                                } else {
++                                                        insertCharacter(piece,i+1+inv_count,saveIndex,saveAuxData);
++                                                        nextSyllable++;
++                                                }
++                                    }
++                                }
++
++                                if ((matraClass & CF_POS_MASK) == CF_POS_BEFORE) {
++                    moveCharacter(i+inv_count,beginSyllable+inv_count);
++                                }
++                        }
++                }
++        }
++
++        void moveCharacter( le_int32 fromPosition, le_int32 toPosition ) {
++                le_int32 i,saveIndex;
++                le_uint32 saveAuxData;
++                LEUnicode saveChar = fOutChars[fromPosition];
++            LEErrorCode success = LE_NO_ERROR;
++                LEErrorCode success2 = LE_NO_ERROR;
++                saveIndex = fGlyphStorage.getCharIndex(fromPosition,success);
++        saveAuxData = fGlyphStorage.getAuxData(fromPosition,success);
++
++                if ( fromPosition > toPosition ) {
++                        for ( i = fromPosition ; i > toPosition ; i-- ) {
++                                fOutChars[i] = fOutChars[i-1];
++                                fGlyphStorage.setCharIndex(i,fGlyphStorage.getCharIndex(i-1,success2),success);
++                                fGlyphStorage.setAuxData(i,fGlyphStorage.getAuxData(i-1,success2), success);
++
++                        }
++                } else {
++                        for ( i = fromPosition ; i < toPosition ; i++ ) {
++                                fOutChars[i] = fOutChars[i+1];
++                                fGlyphStorage.setCharIndex(i,fGlyphStorage.getCharIndex(i+1,success2),success);
++                                fGlyphStorage.setAuxData(i,fGlyphStorage.getAuxData(i+1,success2), success);
++                        }
++
++                }
++                fOutChars[toPosition] = saveChar;
++                fGlyphStorage.setCharIndex(toPosition,saveIndex,success);
++                fGlyphStorage.setAuxData(toPosition,saveAuxData,success);
++
++        }
++        void insertCharacter( LEUnicode ch, le_int32 toPosition, le_int32 charIndex, le_uint32 auxData ) {
++            LEErrorCode success = LE_NO_ERROR;
++        le_int32 i;
++                fOutIndex += 1;
++
++                for ( i = fOutIndex ; i > toPosition ; i--) {
++                                fOutChars[i] = fOutChars[i-1];
++                                fGlyphStorage.setCharIndex(i,fGlyphStorage.getCharIndex(i-1,success),success);
++                                fGlyphStorage.setAuxData(i,fGlyphStorage.getAuxData(i-1,success), success);
++                }
++
++                fOutChars[toPosition] = ch;
++                fGlyphStorage.setCharIndex(toPosition,charIndex,success);
++                fGlyphStorage.setAuxData(toPosition,auxData,success);
++
++        }
++        void removeCharacter( le_int32 fromPosition ) {
++            LEErrorCode success = LE_NO_ERROR;
++        le_int32 i;
++                fOutIndex -= 1;
++
++                for ( i = fromPosition ; i < fOutIndex ; i--) {
++                                fOutChars[i] = fOutChars[i+1];
++                                fGlyphStorage.setCharIndex(i,fGlyphStorage.getCharIndex(i+1,success),success);
++                                fGlyphStorage.setAuxData(i,fGlyphStorage.getAuxData(i+1,success), success);
++                }
++        }
++
+     le_bool noteMatra(const IndicClassTable *classTable, LEUnicode matra, le_uint32 matraIndex, FeatureMask matraFeatures, le_bool wordStart)
+     {
+         IndicClassTable::CharClass matraClass = classTable->getCharClass(matra);
+@@ -268,6 +421,14 @@
+         }
+     }
+ 
++    void notePreBaseConsonant(le_uint32 index,LEUnicode PBConsonant, LEUnicode PBVirama, FeatureMask features)
++    {
++        fPBCIndex = index;
++        fPreBaseConsonant = PBConsonant;
++        fPreBaseVirama = PBVirama;
++        fPBCFeatures = features;
++    }
++
+     void noteBaseConsonant()
+     {
+         if (fMPreFixups != NULL && fMPreOutIndex >= 0) {
+@@ -275,11 +436,11 @@
+         }
+     }
+ 
+-    // Handles virama in Sinhala split vowels.
+-    void writeVirama()
++    // Handles Al-Lakuna in Sinhala split vowels.
++    void writeAlLakuna()
+     {
+-        if (fVirama != 0) {
+-            writeChar(fVirama, fViramaIndex, fMatraFeatures);
++        if (fAlLakuna != 0) {
++            writeChar(fAlLakuna, fAlLakunaIndex, fMatraFeatures);
+         }
+     }
+ 
+@@ -347,26 +508,39 @@
+         }
+     }
+ 
++    void writePreBaseConsonant()
++    {
++        // The TDIL spec says that consonant + virama + RRA should produce a rakar in Malayalam.  However,
++        // it seems that almost none of the fonts for Malayalam are set up to handle this.
++        // So, we're going to force the issue here by using the rakar as defined with RA in most fonts.
++
++        if (fPreBaseConsonant == 0x0d31) { // RRA
++            fPreBaseConsonant = 0x0d30; // RA
++        }
++
++        if (fPreBaseConsonant != 0) {
++            writeChar(fPreBaseConsonant, fPBCIndex, fPBCFeatures);
++            writeChar(fPreBaseVirama,fPBCIndex-1,fPBCFeatures);
++        }
++    }
++
+     le_int32 getOutputIndex()
+     {
+         return fOutIndex;
+     }
+ };
+ 
+-enum
+-{
+-    C_DOTTED_CIRCLE = 0x25CC
+-};
++
+ 
+ // TODO: Find better names for these!
+-#define tagArray4 (nuktFeatureMask | akhnFeatureMask | vatuFeatureMask | presFeatureMask | blwsFeatureMask | abvsFeatureMask | pstsFeatureMask | halnFeatureMask | blwmFeatureMask | abvmFeatureMask | distFeatureMask)
++#define tagArray4 (loclFeatureMask | nuktFeatureMask | akhnFeatureMask | vatuFeatureMask | presFeatureMask | blwsFeatureMask | abvsFeatureMask | pstsFeatureMask | halnFeatureMask | blwmFeatureMask | abvmFeatureMask | distFeatureMask)
+ #define tagArray3 (pstfFeatureMask | tagArray4)
+ #define tagArray2 (halfFeatureMask | tagArray3)
+ #define tagArray1 (blwfFeatureMask | tagArray2)
+ #define tagArray0 (rphfFeatureMask | tagArray1)
+ 
+-static const FeatureMap featureMap[] =
+-{
++static const FeatureMap featureMap[] = {
++    {loclFeatureTag, loclFeatureMask},
+     {initFeatureTag, initFeatureMask},
+     {nuktFeatureTag, nuktFeatureMask},
+     {akhnFeatureTag, akhnFeatureMask},
+@@ -387,21 +561,47 @@
+ 
+ static const le_int32 featureCount = LE_ARRAY_SIZE(featureMap);
+ 
++static const FeatureMap v2FeatureMap[] = {
++        {loclFeatureTag, loclFeatureMask},
++    {nuktFeatureTag, nuktFeatureMask},
++    {akhnFeatureTag, akhnFeatureMask},
++    {rphfFeatureTag, rphfFeatureMask},
++        {rkrfFeatureTag, rkrfFeatureMask},
++        {blwfFeatureTag, blwfFeatureMask},
++    {halfFeatureTag, halfFeatureMask},
++    {vatuFeatureTag, vatuFeatureMask},
++    {cjctFeatureTag, cjctFeatureMask},
++    {presFeatureTag, presFeatureMask},
++    {abvsFeatureTag, abvsFeatureMask},
++    {blwsFeatureTag, blwsFeatureMask},
++    {pstsFeatureTag, pstsFeatureMask},
++        {halnFeatureTag, halnFeatureMask},
++        {caltFeatureTag, caltFeatureMask},
++    {kernFeatureTag, kernFeatureMask},
++    {distFeatureTag, distFeatureMask},
++    {abvmFeatureTag, abvmFeatureMask},
++    {blwmFeatureTag, blwmFeatureMask}
++};
++
++static const le_int32 v2FeatureMapCount = LE_ARRAY_SIZE(v2FeatureMap);
++
+ static const le_int8 stateTable[][CC_COUNT] =
+ {
+-//   xx  vm  sm  iv  i2  i3  ct  cn  nu  dv  s1  s2  s3  vr  zw
+-    { 1,  1,  1,  5,  8, 11,  3,  2,  1,  5,  9,  5,  1,  1,  1}, //  0 - ground state
+-    {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, //  1 - exit state
+-    {-1,  6,  1, -1, -1, -1, -1, -1, -1,  5,  9,  5,  5,  4, -1}, //  2 - consonant with nukta
+-    {-1,  6,  1, -1, -1, -1, -1, -1,  2,  5,  9,  5,  5,  4, -1}, //  3 - consonant
+-    {-1, -1, -1, -1, -1, -1,  3,  2, -1, -1, -1, -1, -1, -1,  7}, //  4 - consonant virama
+-    {-1,  6,  1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, //  5 - dependent vowels
+-    {-1, -1,  1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, //  6 - vowel mark
+-    {-1, -1, -1, -1, -1, -1,  3,  2, -1, -1, -1, -1, -1, -1, -1}, //  7 - ZWJ, ZWNJ
+-    {-1,  6,  1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,  4, -1}, //  8 - independent vowels that can take a virama
+-    {-1,  6,  1, -1, -1, -1, -1, -1, -1, -1, -1, 10,  5, -1, -1}, //  9 - first part of split vowel
+-    {-1,  6,  1, -1, -1, -1, -1, -1, -1, -1, -1, -1,  5, -1, -1}, // 10 - second part of split vowel
+-    {-1,  6,  1, -1, -1, -1, -1, -1, -1,  5,  9,  5,  5,  4, -1}  // 11 - independent vowels that can take an iv
++//   xx  vm  sm  iv  i2  i3  ct  cn  nu  dv  s1  s2  s3  vr  zw  al
++    { 1,  6,  1,  5,  8, 11,  3,  2,  1,  5,  9,  5,  5,  1,  1,  1}, //  0 - ground state
++    {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, //  1 - exit state
++    {-1,  6,  1, -1, -1, -1, -1, -1, -1,  5,  9,  5,  5,  4, 12, -1}, //  2 - consonant with nukta
++    {-1,  6,  1, -1, -1, -1, -1, -1,  2,  5,  9,  5,  5,  4, 12, 13}, //  3 - consonant
++    {-1, -1, -1, -1, -1, -1,  3,  2, -1, -1, -1, -1, -1, -1,  7, -1}, //  4 - consonant virama
++    {-1,  6,  1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, //  5 - dependent vowels
++    {-1, -1,  1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, //  6 - vowel mark
++    {-1, -1, -1, -1, -1, -1,  3,  2, -1, -1, -1, -1, -1, -1, -1, -1}, //  7 - consonant virama ZWJ, consonant ZWJ virama
++    {-1,  6,  1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,  4, -1, -1}, //  8 - independent vowels that can take a virama
++    {-1,  6,  1, -1, -1, -1, -1, -1, -1, -1, -1, 10,  5, -1, -1, -1}, //  9 - first part of split vowel
++    {-1,  6,  1, -1, -1, -1, -1, -1, -1, -1, -1, -1,  5, -1, -1, -1}, // 10 - second part of split vowel
++    {-1,  6,  1, -1, -1, -1, -1, -1, -1,  5,  9,  5,  5,  4, -1, -1}, // 11 - independent vowels that can take an iv
++    {-1, -1,  1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,  7, -1,  7}, // 12 - consonant ZWJ (TODO: Take everything else that can be after a consonant?)
++    {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,  7, -1}  // 13 - consonant al-lakuna ZWJ consonant
+ };
+ 
+ 
+@@ -412,14 +612,29 @@
+     return featureMap;
+ }
+ 
++const FeatureMap *IndicReordering::getv2FeatureMap(le_int32 &count)
++{
++    count = v2FeatureMapCount;
++
++    return v2FeatureMap;
++}
++
+ le_int32 IndicReordering::findSyllable(const IndicClassTable *classTable, const LEUnicode *chars, le_int32 prev, le_int32 charCount)
+ {
+     le_int32 cursor = prev;
+     le_int8 state = 0;
++    le_int8 consonant_count = 0;
+ 
+     while (cursor < charCount) {
+         IndicClassTable::CharClass charClass = classTable->getCharClass(chars[cursor]);
+ 
++        if ( IndicClassTable::isConsonant(charClass) ) {
++            consonant_count++;
++            if ( consonant_count > MAX_CONSONANTS_PER_SYLLABLE ) {
++                break;
++            }
++        }
++
+         state = stateTable[state][charClass & CF_CLASS_MASK];
+ 
+         if (state < 0) {
+@@ -434,16 +649,24 @@
+ 
+ le_int32 IndicReordering::reorder(const LEUnicode *chars, le_int32 charCount, le_int32 scriptCode,
+                                   LEUnicode *outChars, LEGlyphStorage &glyphStorage,
+-                                  MPreFixups **outMPreFixups)
++                                  MPreFixups **outMPreFixups, LEErrorCode& success)
+ {
++    if (LE_FAILURE(success)) {
++        return 0;
++    }
++
+     MPreFixups *mpreFixups = NULL;
+     const IndicClassTable *classTable = IndicClassTable::getScriptClassTable(scriptCode);
+ 
+     if (classTable->scriptFlags & SF_MPRE_FIXUP) {
+         mpreFixups = new MPreFixups(charCount);
++        if (mpreFixups == NULL) {
++            success = LE_MEMORY_ALLOCATION_ERROR;
++            return 0;
++    }
+     }
+ 
+-    ReorderingOutput output(outChars, glyphStorage, mpreFixups);
++    IndicReorderingOutput output(outChars, glyphStorage, mpreFixups);
+     le_int32 i, prev = 0;
+     le_bool lastInWord = FALSE;
+ 
+@@ -458,7 +681,7 @@
+             output.noteStressMark(classTable, chars[markStart], markStart, tagArray1);
+         }
+ 
+-        if (classTable->isVowelModifier(chars[markStart - 1])) {
++        if (markStart != prev && classTable->isVowelModifier(chars[markStart - 1])) {
+             markStart -= 1;
+             output.noteVowelModifier(classTable, chars[markStart], markStart, tagArray1);
+         }
+@@ -484,9 +707,20 @@
+ 
+             break;
+ 
++        case CC_AL_LAKUNA:
+         case CC_NUKTA:
++            output.writeChar(C_DOTTED_CIRCLE, prev, tagArray1);
++            output.writeChar(chars[prev], prev, tagArray1);
++            break;
++
+         case CC_VIRAMA:
++            // A lone virama is illegal unless it follows a
++            // MALAYALAM_VOWEL_SIGN_U. Such a usage is called
++            // "samvruthokaram".
++            if (chars[prev - 1] != C_MALAYALAM_VOWEL_SIGN_U) {
+             output.writeChar(C_DOTTED_CIRCLE, prev, tagArray1);
++            }
++
+             output.writeChar(chars[prev], prev, tagArray1);
+             break;
+ 
+@@ -518,7 +752,7 @@
+             }
+ 
+             output.writeLengthMark();
+-            output.writeVirama();
++            output.writeAlLakuna();
+ 
+             if ((classTable->scriptFlags & SF_REPH_AFTER_BELOW) == 0) {
+                 output.writeVMabove();
+@@ -538,7 +772,7 @@
+             le_int32  baseLimit = prev;
+ 
+             // Check for REPH at front of syllable
+-            if (length > 2 && classTable->isReph(chars[prev]) && classTable->isVirama(chars[prev + 1])) {
++            if (length > 2 && classTable->isReph(chars[prev]) && classTable->isVirama(chars[prev + 1]) && chars[prev + 2] != C_SIGN_ZWNJ) {
+                 baseLimit += 2;
+ 
+                 // Check for eyelash RA, if the script supports it
+@@ -556,35 +790,59 @@
+                 lastConsonant -= 1;
+             }
+ 
++
++            IndicClassTable::CharClass charClass = CC_RESERVED;
++            IndicClassTable::CharClass nextClass = CC_RESERVED;
+             le_int32 baseConsonant = lastConsonant;
+             le_int32 postBase = lastConsonant + 1;
+             le_int32 postBaseLimit = classTable->scriptFlags & SF_POST_BASE_LIMIT_MASK;
+             le_bool  seenVattu = FALSE;
+             le_bool  seenBelowBaseForm = FALSE;
++            le_bool  seenPreBaseForm = FALSE;
++            le_bool  hasNukta = FALSE;
++            le_bool  hasBelowBaseForm = FALSE;
++            le_bool  hasPostBaseForm = FALSE;
++            le_bool  hasPreBaseForm = FALSE;
+ 
+             if (postBase < markStart && classTable->isNukta(chars[postBase])) {
++                charClass = CC_NUKTA;
+                 postBase += 1;
+             }
+ 
+             while (baseConsonant > baseLimit) {
+-                IndicClassTable::CharClass charClass = classTable->getCharClass(chars[baseConsonant]);
++                nextClass = charClass;
++                hasNukta  = IndicClassTable::isNukta(nextClass);
++                charClass = classTable->getCharClass(chars[baseConsonant]);
++
++                hasBelowBaseForm = IndicClassTable::hasBelowBaseForm(charClass) && !hasNukta;
++                hasPostBaseForm  = IndicClassTable::hasPostBaseForm(charClass)  && !hasNukta;
++                hasPreBaseForm = IndicClassTable::hasPreBaseForm(charClass) && !hasNukta;
+ 
+                 if (IndicClassTable::isConsonant(charClass)) {
+                     if (postBaseLimit == 0 || seenVattu ||
+                         (baseConsonant > baseLimit && !classTable->isVirama(chars[baseConsonant - 1])) ||
+-                        !IndicClassTable::hasPostOrBelowBaseForm(charClass)) {
++                        !(hasBelowBaseForm || hasPostBaseForm || hasPreBaseForm)) {
+                         break;
+                     }
+ 
+-                    seenVattu = IndicClassTable::isVattu(charClass);
++                    // Note any pre-base consonants
++                    if ( baseConsonant == lastConsonant && lastConsonant > 0 &&
++                         hasPreBaseForm && classTable->isVirama(chars[baseConsonant - 1])) {
++                        output.notePreBaseConsonant(lastConsonant,chars[lastConsonant],chars[lastConsonant-1],tagArray2);
++                        seenPreBaseForm = TRUE;
+ 
+-                    if (IndicClassTable::hasPostBaseForm(charClass)) {
++                    }
++                    // consonants with nuktas are never vattus
++                    seenVattu = IndicClassTable::isVattu(charClass) && !hasNukta;
++
++                    // consonants with nuktas never have below- or post-base forms
++                    if (hasPostBaseForm) {
+                         if (seenBelowBaseForm) {
+                             break;
+                         }
+ 
+                         postBase = baseConsonant;
+-                    } else if (IndicClassTable::hasBelowBaseForm(charClass)) {
++                    } else if (hasBelowBaseForm) {
+                         seenBelowBaseForm = TRUE;
+                     }
+ 
+@@ -606,20 +864,25 @@
+             }
+ 
+             // write any pre-base consonants
++            output.writePreBaseConsonant();
++
+             le_bool supressVattu = TRUE;
+ 
+             for (i = baseLimit; i < baseConsonant; i += 1) {
+                 LEUnicode ch = chars[i];
+-                // Don't put 'blwf' on first consonant.
+-                FeatureMask features = (i == baseLimit? tagArray2 : tagArray1);
+-                IndicClassTable::CharClass charClass = classTable->getCharClass(ch);
++                // Don't put 'pstf' or 'blwf' on anything before the base consonant.
++                FeatureMask features = tagArray1 & ~( pstfFeatureMask | blwfFeatureMask );
++
++                charClass = classTable->getCharClass(ch);
++                nextClass = classTable->getCharClass(chars[i + 1]);
++                hasNukta  = IndicClassTable::isNukta(nextClass);
+ 
+                 if (IndicClassTable::isConsonant(charClass)) {
+-                    if (IndicClassTable::isVattu(charClass) && supressVattu) {
++                    if (IndicClassTable::isVattu(charClass) && !hasNukta && supressVattu) {
+                         features = tagArray4;
+                     }
+ 
+-                    supressVattu = IndicClassTable::isVattu(charClass);
++                    supressVattu = IndicClassTable::isVattu(charClass) && !hasNukta;
+                 } else if (IndicClassTable::isVirama(charClass) && chars[i + 1] == C_SIGN_ZWNJ)
+                 {
+                     features = tagArray4;
+@@ -634,7 +897,8 @@
+                 bcSpan += 1;
+             }
+ 
+-            if (baseConsonant == lastConsonant && bcSpan < markStart && classTable->isVirama(chars[bcSpan])) {
++            if (baseConsonant == lastConsonant && bcSpan < markStart &&
++                 (classTable->isVirama(chars[bcSpan]) || classTable->isAlLakuna(chars[bcSpan]))) {
+                 bcSpan += 1;
+ 
+                 if (bcSpan < markStart && chars[bcSpan] == C_SIGN_ZWNJ) {
+@@ -658,7 +922,7 @@
+             }
+ 
+             // write below-base consonants
+-            if (baseConsonant != lastConsonant) {
++            if (baseConsonant != lastConsonant && !seenPreBaseForm) {
+                 for (i = bcSpan + 1; i < postBase; i += 1) {
+                     output.writeChar(chars[i], i, tagArray1);
+                 }
+@@ -688,7 +952,7 @@
+ 
+             // write post-base consonants
+             // FIXME: does this put the right tags on post-base consonants?
+-            if (baseConsonant != lastConsonant) {
++            if (baseConsonant != lastConsonant && !seenPreBaseForm) {
+                 if (postBase <= lastConsonant) {
+                     for (i = postBase; i <= lastConsonant; i += 1) {
+                         output.writeChar(chars[i], i, tagArray3);
+@@ -710,7 +974,7 @@
+             }
+ 
+             output.writeLengthMark();
+-            output.writeVirama();
++            output.writeAlLakuna();
+ 
+             // write reph
+             if ((classTable->scriptFlags & SF_REPH_AFTER_BELOW) == 0) {
+@@ -740,13 +1004,250 @@
+     return output.getOutputIndex();
+ }
+ 
+-void IndicReordering::adjustMPres(MPreFixups *mpreFixups, LEGlyphStorage &glyphStorage)
++void IndicReordering::adjustMPres(MPreFixups *mpreFixups, LEGlyphStorage &glyphStorage, LEErrorCode& success)
+ {
+     if (mpreFixups != NULL) {
+-        mpreFixups->apply(glyphStorage);
++        mpreFixups->apply(glyphStorage, success);
+ 
+         delete mpreFixups;
+     }
+ }
+ 
++void IndicReordering::applyPresentationForms(LEGlyphStorage &glyphStorage, le_int32 count)
++{
++    LEErrorCode success = LE_NO_ERROR;
++
++//  This sets us up for 2nd pass of glyph substitution as well as setting the feature masks for the
++//  GPOS table lookups
++
++    for ( le_int32 i = 0 ; i < count ; i++ ) {
++        glyphStorage.setAuxData(i, ( presentationFormsMask | positioningFormsMask ), success);
++    }
++
++}
++void IndicReordering::finalReordering(LEGlyphStorage &glyphStorage, le_int32 count)
++{
++    LEErrorCode success = LE_NO_ERROR;
++
++    // Reposition REPH as appropriate
++
++    for ( le_int32 i = 0 ; i < count ; i++ ) {
++
++        le_int32 tmpAuxData = glyphStorage.getAuxData(i,success);
++        LEGlyphID tmpGlyph = glyphStorage.getGlyphID(i,success);
++
++        if ( ( tmpGlyph != NO_GLYPH ) && (tmpAuxData & rephConsonantMask) && !(tmpAuxData & repositionedGlyphMask))  {
++
++            le_bool targetPositionFound = false;
++            le_int32 targetPosition = i+1;
++            le_int32 baseConsonantData;
++
++            while (!targetPositionFound) {
++                tmpGlyph = glyphStorage.getGlyphID(targetPosition,success);
++                tmpAuxData = glyphStorage.getAuxData(targetPosition,success);
++
++                if ( tmpAuxData & baseConsonantMask ) {
++                    baseConsonantData = tmpAuxData;
++                    targetPositionFound = true;
++                } else {
++                    targetPosition++;
++                }
++            }
++
++            // Make sure we are not putting the reph into an empty hole
++
++            le_bool targetPositionHasGlyph = false;
++            while (!targetPositionHasGlyph) {
++                tmpGlyph = glyphStorage.getGlyphID(targetPosition,success);
++                if ( tmpGlyph != NO_GLYPH ) {
++                    targetPositionHasGlyph = true;
++                } else {
++                    targetPosition--;
++                }
++            }
++
++            // Make sure that REPH is positioned after any above base or post base matras
++            //
++            le_bool checkMatraDone = false;
++            le_int32 checkMatraPosition = targetPosition+1;
++            while ( !checkMatraDone ) {
++               tmpAuxData = glyphStorage.getAuxData(checkMatraPosition,success);
++               if ( checkMatraPosition >= count || ( (tmpAuxData ^ baseConsonantData) & LE_GLYPH_GROUP_MASK)) {
++                   checkMatraDone = true;
++                   continue;
++               }
++               if ( (tmpAuxData & matraMask) &&
++                    (((tmpAuxData & markPositionMask) == aboveBasePosition) ||
++                      ((tmpAuxData & markPositionMask) == postBasePosition))) {
++                   targetPosition = checkMatraPosition;
++               }
++               checkMatraPosition++;
++            }
++
++            glyphStorage.moveGlyph(i,targetPosition,repositionedGlyphMask);
++        }
++    }
++}
++
++
++le_int32 IndicReordering::v2process(const LEUnicode *chars, le_int32 charCount, le_int32 scriptCode,
++                                  LEUnicode *outChars, LEGlyphStorage &glyphStorage)
++{
++    const IndicClassTable *classTable = IndicClassTable::getScriptClassTable(scriptCode);
++
++    DynamicProperties dynProps[INDIC_BLOCK_SIZE];
++    IndicReordering::getDynamicProperties(dynProps,classTable);
++
++    IndicReorderingOutput output(outChars, glyphStorage, NULL);
++    le_int32 i, firstConsonant, baseConsonant, secondConsonant, inv_count = 0, beginSyllable = 0;
++    //le_bool lastInWord = FALSE;
++
++    while (beginSyllable < charCount) {
++        le_int32 nextSyllable = findSyllable(classTable, chars, beginSyllable, charCount);
++
++        output.reset();
++
++                // Find the First Consonant
++                for ( firstConsonant = beginSyllable ; firstConsonant < nextSyllable ; firstConsonant++ ) {
++                         if ( classTable->isConsonant(chars[firstConsonant]) ) {
++                                        break;
++                                }
++                }
++
++        // Find the base consonant
++
++        baseConsonant = nextSyllable - 1;
++        secondConsonant = firstConsonant;
++
++        // TODO: Use Dynamic Properties for hasBelowBaseForm and hasPostBaseForm()
++
++        while ( baseConsonant > firstConsonant ) {
++            if ( classTable->isConsonant(chars[baseConsonant]) &&
++                 !classTable->hasBelowBaseForm(chars[baseConsonant]) &&
++                 !classTable->hasPostBaseForm(chars[baseConsonant]) ) {
++                break;
++            }
++            else {
++                if ( classTable->isConsonant(chars[baseConsonant]) ) {
++                    secondConsonant = baseConsonant;
++                }
++                baseConsonant--;
++            }
++        }
++
++        // If the syllable starts with Ra + Halant ( in a script that has Reph ) and has more than one
++        // consonant, Ra is excluced from candidates for base consonants
++
++        if ( classTable->isReph(chars[beginSyllable]) &&
++             beginSyllable+1 < nextSyllable && classTable->isVirama(chars[beginSyllable+1]) &&
++             secondConsonant != firstConsonant) {
++            baseConsonant = secondConsonant;
++        }
++
++            // Populate the output
++                for ( i = beginSyllable ; i < nextSyllable ; i++ ) {
++
++            // Handle invalid combinartions
++
++            if ( classTable->isVirama(chars[beginSyllable]) ||
++                             classTable->isMatra(chars[beginSyllable]) ||
++                             classTable->isVowelModifier(chars[beginSyllable]) ||
++                             classTable->isNukta(chars[beginSyllable]) ) {
++                     output.writeChar(C_DOTTED_CIRCLE,beginSyllable,basicShapingFormsMask);
++                     inv_count++;
++            }
++             output.writeChar(chars[i],i, basicShapingFormsMask);
++
++        }
++
++        // Adjust features and set syllable structure bits
++
++        for ( i = beginSyllable ; i < nextSyllable ; i++ ) {
++
++            FeatureMask outMask = output.getFeatures(i+inv_count);
++            FeatureMask saveMask = outMask;
++
++            // Since reph can only validly occur at the beginning of a syllable
++            // We only apply it to the first 2 characters in the syllable, to keep it from
++            // conflicting with other features ( i.e. rkrf )
++
++            // TODO : Use the dynamic property for determining isREPH
++            if ( i == beginSyllable && i < baseConsonant && classTable->isReph(chars[i]) &&
++                 i+1 < nextSyllable && classTable->isVirama(chars[i+1])) {
++                outMask |= rphfFeatureMask;
++                outMask |= rephConsonantMask;
++                output.setFeatures(i+1+inv_count,outMask);
++
++            }
++
++            if ( i == baseConsonant ) {
++                outMask |= baseConsonantMask;
++            }
++
++            if ( classTable->isMatra(chars[i])) {
++                    outMask |= matraMask;
++                    if ( classTable->hasAboveBaseForm(chars[i])) {
++                        outMask |= aboveBasePosition;
++                    } else if ( classTable->hasBelowBaseForm(chars[i])) {
++                        outMask |= belowBasePosition;
++                    }
++            }
++
++            // Don't apply half form to virama that stands alone at the end of a syllable
++            // to prevent half forms from forming when syllable ends with virama
++
++            if ( classTable->isVirama(chars[i]) && (i+1 == nextSyllable) ) {
++                outMask ^= halfFeatureMask;
++                if ( classTable->isConsonant(chars[i-1]) ) {
++                    FeatureMask tmp = output.getFeatures(i-1+inv_count);
++                    tmp ^= halfFeatureMask;
++                    output.setFeatures(i-1+inv_count,tmp);
++                }
++            }
++
++            if ( outMask != saveMask ) {
++                output.setFeatures(i+inv_count,outMask);
++            }
++                }
++
++            output.decomposeReorderMatras(classTable,beginSyllable,nextSyllable,inv_count);
++
++        beginSyllable = nextSyllable;
++        }
++
++
++    return output.getOutputIndex();
++}
++
++
++void IndicReordering::getDynamicProperties( DynamicProperties *, const IndicClassTable *classTable ) {
++
++
++    LEUnicode currentChar;
++    LEUnicode virama;
++    LEUnicode workChars[2];
++    LEGlyphStorage workGlyphs;
++
++    IndicReorderingOutput workOutput(workChars, workGlyphs, NULL);
++
++    //le_int32 offset = 0;
++
++    // First find the relevant virama for the script we are dealing with
++
++    for ( currentChar = classTable->firstChar ; currentChar <= classTable->lastChar ; currentChar++ ) {
++        if ( classTable->isVirama(currentChar)) {
++            virama = currentChar;
++            break;
++        }
++    }
++
++    for ( currentChar = classTable->firstChar ; currentChar <= classTable->lastChar ; currentChar++ ) {
++        if ( classTable->isConsonant(currentChar)) {
++            workOutput.reset();
++        }
++    }
++
++
++}
++
+ U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/IndicReordering.h b/src/share/native/sun/font/layout/IndicReordering.h
+--- jdk/src/share/native/sun/font/layout/IndicReordering.h
++++ jdk/src/share/native/sun/font/layout/IndicReordering.h
+@@ -25,7 +25,7 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
++ * (C) Copyright IBM Corp. 1998-2009 - All Rights Reserved
+  *
+  */
+ 
+@@ -62,7 +62,8 @@
+ #define CC_SPLIT_VOWEL_PIECE_3   12U
+ #define CC_VIRAMA                13U
+ #define CC_ZERO_WIDTH_MARK       14U
+-#define CC_COUNT                 15U
++#define CC_AL_LAKUNA             15U
++#define CC_COUNT                 16U
+ 
+ // Character class flags
+ #define CF_CLASS_MASK    0x0000FFFFU
+@@ -74,6 +75,7 @@
+ #define CF_BELOW_BASE    0x10000000U
+ #define CF_POST_BASE     0x08000000U
+ #define CF_LENGTH_MARK   0x04000000U
++#define CF_PRE_BASE      0x02000000U
+ 
+ #define CF_POS_BEFORE    0x00300000U
+ #define CF_POS_BELOW     0x00200000U
+@@ -89,6 +91,7 @@
+ #define SF_REPH_AFTER_BELOW      0x40000000U
+ #define SF_EYELASH_RA            0x20000000U
+ #define SF_MPRE_FIXUP            0x10000000U
++#define SF_FILTER_ZERO_WIDTH     0x08000000U
+ 
+ #define SF_POST_BASE_LIMIT_MASK  0x0000FFFFU
+ #define SF_NO_POST_BASE_LIMIT    0x00007FFFU
+@@ -98,6 +101,15 @@
+ class MPreFixups;
+ class LEGlyphStorage;
+ 
++// Dynamic Properties ( v2 fonts only )
++typedef le_uint32 DynamicProperties;
++
++#define DP_REPH               0x80000000U
++#define DP_HALF               0x40000000U
++#define DP_PREF               0x20000000U
++#define DP_BLWF               0x10000000U
++#define DP_PSTF               0x08000000U
++
+ struct IndicClassTable
+ {
+     typedef le_uint32 CharClass;
+@@ -111,6 +123,7 @@
+     const SplitMatra *splitMatraTable;
+ 
+     inline le_int32 getWorstCaseExpansion() const;
++    inline le_bool getFilterZeroWidth() const;
+ 
+     CharClass getCharClass(LEUnicode ch) const;
+ 
+@@ -121,6 +134,7 @@
+     inline le_bool isConsonant(LEUnicode ch) const;
+     inline le_bool isReph(LEUnicode ch) const;
+     inline le_bool isVirama(LEUnicode ch) const;
++    inline le_bool isAlLakuna(LEUnicode ch) const;
+     inline le_bool isNukta(LEUnicode ch) const;
+     inline le_bool isVattu(LEUnicode ch) const;
+     inline le_bool isMatra(LEUnicode ch) const;
+@@ -129,12 +143,15 @@
+     inline le_bool hasPostOrBelowBaseForm(LEUnicode ch) const;
+     inline le_bool hasPostBaseForm(LEUnicode ch) const;
+     inline le_bool hasBelowBaseForm(LEUnicode ch) const;
++    inline le_bool hasAboveBaseForm(LEUnicode ch) const;
++    inline le_bool hasPreBaseForm(LEUnicode ch) const;
+ 
+     inline static le_bool isVowelModifier(CharClass charClass);
+     inline static le_bool isStressMark(CharClass charClass);
+     inline static le_bool isConsonant(CharClass charClass);
+     inline static le_bool isReph(CharClass charClass);
+     inline static le_bool isVirama(CharClass charClass);
++    inline static le_bool isAlLakuna(CharClass charClass);
+     inline static le_bool isNukta(CharClass charClass);
+     inline static le_bool isVattu(CharClass charClass);
+     inline static le_bool isMatra(CharClass charClass);
+@@ -143,6 +160,8 @@
+     inline static le_bool hasPostOrBelowBaseForm(CharClass charClass);
+     inline static le_bool hasPostBaseForm(CharClass charClass);
+     inline static le_bool hasBelowBaseForm(CharClass charClass);
++    inline static le_bool hasAboveBaseForm(CharClass charClass);
++    inline static le_bool hasPreBaseForm(CharClass charClass);
+ 
+     static const IndicClassTable *getScriptClassTable(le_int32 scriptCode);
+ };
+@@ -151,14 +170,27 @@
+ public:
+     static le_int32 getWorstCaseExpansion(le_int32 scriptCode);
+ 
++    static le_bool getFilterZeroWidth(le_int32 scriptCode);
++
+     static le_int32 reorder(const LEUnicode *theChars, le_int32 charCount, le_int32 scriptCode,
+         LEUnicode *outChars, LEGlyphStorage &glyphStorage,
+-        MPreFixups **outMPreFixups);
++        MPreFixups **outMPreFixups, LEErrorCode& success);
+ 
+-    static void adjustMPres(MPreFixups *mpreFixups, LEGlyphStorage &glyphStorage);
++    static void adjustMPres(MPreFixups *mpreFixups, LEGlyphStorage &glyphStorage, LEErrorCode& success);
++
++    static le_int32 v2process(const LEUnicode *theChars, le_int32 charCount, le_int32 scriptCode,
++        LEUnicode *outChars, LEGlyphStorage &glyphStorage);
+ 
+     static const FeatureMap *getFeatureMap(le_int32 &count);
+ 
++        static const FeatureMap *getv2FeatureMap(le_int32 &count);
++
++    static void applyPresentationForms(LEGlyphStorage &glyphStorage, le_int32 count);
++
++    static void finalReordering(LEGlyphStorage &glyphStorage, le_int32 count);
++
++    static void getDynamicProperties(DynamicProperties *dProps, const IndicClassTable *classTable);
++
+ private:
+     // do not instantiate
+     IndicReordering();
+@@ -172,6 +204,11 @@
+     return worstCaseExpansion;
+ }
+ 
++inline le_bool IndicClassTable::getFilterZeroWidth() const
++{
++    return (scriptFlags & SF_FILTER_ZERO_WIDTH) != 0;
++}
++
+ inline const SplitMatra *IndicClassTable::getSplitMatra(CharClass charClass) const
+ {
+     le_int32 index = (charClass & CF_INDEX_MASK) >> CF_INDEX_SHIFT;
+@@ -209,6 +246,11 @@
+     return (charClass & CF_CLASS_MASK) == CC_VIRAMA;
+ }
+ 
++inline le_bool IndicClassTable::isAlLakuna(CharClass charClass)
++{
++    return (charClass & CF_CLASS_MASK) == CC_AL_LAKUNA;
++}
++
+ inline le_bool IndicClassTable::isVattu(CharClass charClass)
+ {
+     return (charClass & CF_VATTU) != 0;
+@@ -241,11 +283,21 @@
+     return (charClass & CF_POST_BASE) != 0;
+ }
+ 
++inline le_bool IndicClassTable::hasPreBaseForm(CharClass charClass)
++{
++    return (charClass & CF_PRE_BASE) != 0;
++}
++
+ inline le_bool IndicClassTable::hasBelowBaseForm(CharClass charClass)
+ {
+     return (charClass & CF_BELOW_BASE) != 0;
+ }
+ 
++inline le_bool IndicClassTable::hasAboveBaseForm(CharClass charClass)
++{
++    return ((charClass & CF_POS_MASK) == CF_POS_ABOVE);
++}
++
+ inline le_bool IndicClassTable::isVowelModifier(LEUnicode ch) const
+ {
+     return isVowelModifier(getCharClass(ch));
+@@ -271,6 +323,11 @@
+     return isVirama(getCharClass(ch));
+ }
+ 
++inline le_bool IndicClassTable::isAlLakuna(LEUnicode ch) const
++{
++    return isAlLakuna(getCharClass(ch));
++}
++
+ inline le_bool IndicClassTable::isNukta(LEUnicode ch) const
+ {
+     return isNukta(getCharClass(ch));
+@@ -311,5 +368,14 @@
+     return hasBelowBaseForm(getCharClass(ch));
+ }
+ 
++inline le_bool IndicClassTable::hasPreBaseForm(LEUnicode ch) const
++{
++    return hasPreBaseForm(getCharClass(ch));
++}
++
++inline le_bool IndicClassTable::hasAboveBaseForm(LEUnicode ch) const
++{
++    return hasAboveBaseForm(getCharClass(ch));
++}
+ U_NAMESPACE_END
+ #endif
+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
+@@ -26,7 +26,7 @@
+ /*
+  *
+  *
+- * (C) Copyright IBM Corp. 2004-2005 - All Rights Reserved
++ * (C) Copyright IBM Corp. 2004-2010 - All Rights Reserved
+  *
+  */
+ 
+@@ -35,6 +35,7 @@
+ #include "LEGlyphStorage.h"
+ 
+ #include "LESwaps.h"
++#include "OpenTypeUtilities.h"
+ 
+ #include <stdio.h>
+ 
+@@ -91,8 +92,8 @@
+  * TODO: support multiple subtables
+  * TODO: respect header flags
+  */
+-KernTable::KernTable(const LEFontInstance* font, const void* tableData)
+-  : pairs(0), font(font)
++KernTable::KernTable(const LEFontInstance* font_, const void* tableData)
++  : pairs(0), font(font_)
+ {
+   const KernTableHeader* header = (const KernTableHeader*)tableData;
+   if (header == 0) {
+@@ -120,10 +121,18 @@
+       coverage = SWAPW(subhead->coverage);
+       if (coverage & COVERAGE_HORIZONTAL) { // only handle horizontal kerning
+         const Subtable_0* table = (const Subtable_0*)((char*)subhead + KERN_SUBTABLE_HEADER_SIZE);
+-        nPairs = SWAPW(table->nPairs);
+-        searchRange = SWAPW(table->searchRange) / KERN_PAIRINFO_SIZE ;
++
++        nPairs        = SWAPW(table->nPairs);
++
++#if 0   // some old fonts have bad values here...
++        searchRange   = SWAPW(table->searchRange);
+         entrySelector = SWAPW(table->entrySelector);
+-        rangeShift = SWAPW(table->rangeShift) / KERN_PAIRINFO_SIZE;
++        rangeShift    = SWAPW(table->rangeShift);
++#else
++        entrySelector = OpenTypeUtilities::highBit(nPairs);
++        searchRange   = (1 << entrySelector) * KERN_PAIRINFO_SIZE;
++        rangeShift    = (nPairs * KERN_PAIRINFO_SIZE) - searchRange;
++#endif
+ 
+         pairs = (PairInfo*)font->getKernPairs();
+         if (pairs == NULL) {
+diff --git a/src/share/native/sun/font/layout/KhmerLayoutEngine.cpp b/src/share/native/sun/font/layout/KhmerLayoutEngine.cpp
+--- jdk/src/share/native/sun/font/layout/KhmerLayoutEngine.cpp
++++ jdk/src/share/native/sun/font/layout/KhmerLayoutEngine.cpp
+@@ -25,7 +25,7 @@
+ 
+ 
+ /*
+- * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
++ * (C) Copyright IBM Corp. 1998-2008 - All Rights Reserved
+  *
+  * This file is a modification of the ICU file IndicLayoutEngine.cpp
+  * by Jens Herden and Javier Sola for Khmer language
+@@ -43,16 +43,16 @@
+ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(KhmerOpenTypeLayoutEngine)
+ 
+ KhmerOpenTypeLayoutEngine::KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                    le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable)
+-    : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable)
++                    le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success)
++    : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success)
+ {
+     fFeatureMap   = KhmerReordering::getFeatureMap(fFeatureMapCount);
+     fFeatureOrder = TRUE;
+ }
+ 
+ KhmerOpenTypeLayoutEngine::KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                                                     le_int32 typoFlags)
+-    : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags)
++                                                     le_int32 typoFlags, LEErrorCode &success)
++    : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success)
+ {
+     fFeatureMap   = KhmerReordering::getFeatureMap(fFeatureMapCount);
+     fFeatureOrder = TRUE;
+diff --git a/src/share/native/sun/font/layout/KhmerLayoutEngine.h b/src/share/native/sun/font/layout/KhmerLayoutEngine.h
+--- jdk/src/share/native/sun/font/layout/KhmerLayoutEngine.h
++++ jdk/src/share/native/sun/font/layout/KhmerLayoutEngine.h
+@@ -26,7 +26,7 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
++ * (C) Copyright IBM Corp. 1998-2008 - All Rights Reserved
+  *
+  * This file is a modification of the ICU file IndicLayoutEngine.h
+  * by Jens Herden and Javier Sola for Khmer language
+@@ -72,8 +72,9 @@
+      *
+      * @param fontInstance - the font
+      * @param scriptCode - the script
+-     * @param languageCode - the language
++     * @param langaugeCode - the language
+      * @param gsubTable - the GSUB table
++     * @param success - set to an error code if the operation fails
+      *
+      * @see LayoutEngine::layoutEngineFactory
+      * @see OpenTypeLayoutEngine
+@@ -82,7 +83,7 @@
+      * @internal
+      */
+     KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                            le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable);
++                            le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success);
+ 
+     /**
+      * This constructor is used when the font requires a "canned" GSUB table which can't be known
+@@ -91,6 +92,7 @@
+      * @param fontInstance - the font
+      * @param scriptCode - the script
+      * @param langaugeCode - the language
++     * @param success - set to an error code if the operation fails
+      *
+      * @see OpenTypeLayoutEngine
+      * @see ScriptAndLangaugeTags.h for script and language codes
+@@ -98,7 +100,7 @@
+      * @internal
+      */
+     KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                              le_int32 typoFlags);
++                              le_int32 typoFlags, LEErrorCode &success);
+ 
+     /**
+      * The destructor, virtual for correct polymorphic invocation.
+diff --git a/src/share/native/sun/font/layout/KhmerReordering.cpp b/src/share/native/sun/font/layout/KhmerReordering.cpp
+--- jdk/src/share/native/sun/font/layout/KhmerReordering.cpp
++++ jdk/src/share/native/sun/font/layout/KhmerReordering.cpp
+@@ -25,7 +25,7 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
++ * (C) Copyright IBM Corp. 1998-2007 - All Rights Reserved
+  *
+  * This file is a modification of the ICU file IndicReordering.cpp
+  * by Jens Herden and Javier Sola for Khmer language
+@@ -149,8 +149,9 @@
+ 
+ 
+ 
+-class ReorderingOutput : public UMemory {
++class KhmerReorderingOutput : public UMemory {
+ private:
++    le_int32 fSyllableCount;
+     le_int32 fOutIndex;
+     LEUnicode *fOutChars;
+ 
+@@ -158,17 +159,22 @@
+ 
+ 
+ public:
+-    ReorderingOutput(LEUnicode *outChars, LEGlyphStorage &glyphStorage)
+-        : fOutIndex(0), fOutChars(outChars), fGlyphStorage(glyphStorage)
++    KhmerReorderingOutput(LEUnicode *outChars, LEGlyphStorage &glyphStorage)
++        : fSyllableCount(0), fOutIndex(0), fOutChars(outChars), fGlyphStorage(glyphStorage)
+     {
+         // nothing else to do...
+     }
+ 
+-    ~ReorderingOutput()
++    ~KhmerReorderingOutput()
+     {
+         // nothing to do here...
+     }
+ 
++    void reset()
++    {
++        fSyllableCount += 1;
++    }
++
+     void writeChar(LEUnicode ch, le_uint32 charIndex, FeatureMask charFeatures)
+     {
+         LEErrorCode success = LE_NO_ERROR;
+@@ -176,7 +182,7 @@
+         fOutChars[fOutIndex] = ch;
+ 
+         fGlyphStorage.setCharIndex(fOutIndex, charIndex, success);
+-        fGlyphStorage.setAuxData(fOutIndex, charFeatures, success);
++        fGlyphStorage.setAuxData(fOutIndex, charFeatures | (fSyllableCount & LE_GLYPH_GROUP_MASK), success);
+ 
+         fOutIndex += 1;
+     }
+@@ -328,12 +334,12 @@
+     {-1, -1, -1, -1, 12, 13, -1, 10, 16, 17,  1, 14}, //  9 - First consonant or type 3 after ceong
+     {-1, 11, 11, 11, -1, -1, -1, -1, -1, -1, -1, -1}, // 10 - Second Coeng (no register shifter before)
+     {-1, -1, -1, -1, 15, -1, -1, -1, 16, 17,  1, 14}, // 11 - Second coeng consonant (or ind. vowel) no register shifter before
+-    {-1, -1,  1, -1, -1, 13, -1, -1, 16, -1, -1, -1}, // 12 - Second ZWNJ before a register shifter
++    {-1, -1, -1, -1, -1, 13, -1, -1, 16, -1, -1, -1}, // 12 - Second ZWNJ before a register shifter
+     {-1, -1, -1, -1, 15, -1, -1, -1, 16, 17,  1, 14}, // 13 - Second register shifter
+     {-1, -1, -1, -1, -1, -1, -1, -1, 16, -1, -1, -1}, // 14 - ZWJ before vowel
+     {-1, -1, -1, -1, -1, -1, -1, -1, 16, -1, -1, -1}, // 15 - ZWNJ before vowel
+     {-1, -1, -1, -1, -1, -1, -1, -1, -1, 17,  1, 18}, // 16 - dependent vowel
+-    {-1, -1,  1, -1, -1, -1, -1, -1, -1, -1,  1, 18}, // 17 - sign above
++    {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,  1, 18}, // 17 - sign above
+     {-1, -1, -1, -1, -1, -1, -1, 19, -1, -1, -1, -1}, // 18 - ZWJ after vowel
+     {-1,  1, -1,  1, -1, -1, -1, -1, -1, -1, -1, -1}, // 19 - Third coeng
+     {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,  1, -1}, // 20 - dependent vowel after a Robat
+@@ -380,7 +386,7 @@
+ {
+     const KhmerClassTable *classTable = KhmerClassTable::getKhmerClassTable();
+ 
+-    ReorderingOutput output(outChars, glyphStorage);
++    KhmerReorderingOutput output(outChars, glyphStorage);
+     KhmerClassTable::CharClass charClass;
+     le_int32 i, prev = 0, coengRo;
+ 
+@@ -390,6 +396,8 @@
+     while (prev < charCount) {
+         le_int32 syllable = findSyllable(classTable, chars, prev, charCount);
+ 
++        output.reset();
++
+         // write a pre vowel or the pre part of a split vowel first
+         // and look out for coeng + ro. RO is the only vowel of type 2, and
+         // therefore the only one that requires saving space before the base.
+diff --git a/src/share/native/sun/font/layout/LEFontInstance.cpp b/src/share/native/sun/font/layout/LEFontInstance.cpp
+--- jdk/src/share/native/sun/font/layout/LEFontInstance.cpp
++++ jdk/src/share/native/sun/font/layout/LEFontInstance.cpp
+@@ -26,7 +26,7 @@
+ /*
+  *******************************************************************************
+  *
+- *   Copyright (C) 1999-2005, International Business Machines
++ *   Copyright (C) 1999-2007, International Business Machines
+  *   Corporation and others.  All Rights Reserved.
+  *
+  *******************************************************************************
+@@ -45,6 +45,16 @@
+ 
+ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LEFontInstance)
+ 
++LECharMapper::~LECharMapper()
++{
++    // nothing to do.
++}
++
++LEFontInstance::~LEFontInstance()
++{
++    // nothing to do
++}
++
+ const LEFontInstance *LEFontInstance::getSubFont(const LEUnicode chars[], le_int32 *offset, le_int32 limit,
+                                                        le_int32 script, LEErrorCode &success) const
+ {
+@@ -62,7 +72,7 @@
+ }
+ 
+ void LEFontInstance::mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count,
+-                                      le_bool reverse, const LECharMapper *mapper, LEGlyphStorage &glyphStorage) const
++                                      le_bool reverse, const LECharMapper *mapper, le_bool filterZeroWidth, LEGlyphStorage &glyphStorage) const
+ {
+     le_int32 i, out = 0, dir = 1;
+ 
+@@ -83,7 +93,7 @@
+             }
+         }
+ 
+-        glyphStorage[out] = mapCharToGlyph(code, mapper);
++        glyphStorage[out] = mapCharToGlyph(code, mapper, filterZeroWidth);
+ 
+         if (code >= 0x10000) {
+             i += 1;
+@@ -94,14 +104,71 @@
+ 
+ LEGlyphID LEFontInstance::mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const
+ {
++    return mapCharToGlyph(ch, mapper, TRUE);
++}
++
++LEGlyphID LEFontInstance::mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper, le_bool filterZeroWidth) const
++{
+     LEUnicode32 mappedChar = mapper->mapChar(ch);
+ 
+-    if (mappedChar == 0xFFFE || mappedChar == 0xFFFF ||
+-        mappedChar == 0x200C || mappedChar == 0x200D) {
++    if (mappedChar == 0xFFFE || mappedChar == 0xFFFF) {
+         return 0xFFFF;
+     }
+ 
++    if (filterZeroWidth && (mappedChar == 0x200C || mappedChar == 0x200D)) {
++        return canDisplay(mappedChar)? 0x0001 : 0xFFFF;
++    }
++
+     return mapCharToGlyph(mappedChar);
+ }
++
++le_bool LEFontInstance::canDisplay(LEUnicode32 ch) const
++{
++    return LE_GET_GLYPH(mapCharToGlyph(ch)) != 0;
++}
++
++float LEFontInstance::xUnitsToPoints(float xUnits) const
++{
++    return (xUnits * getXPixelsPerEm()) / (float) getUnitsPerEM();
++}
++
++float LEFontInstance::yUnitsToPoints(float yUnits) const
++{
++    return (yUnits * getYPixelsPerEm()) / (float) getUnitsPerEM();
++}
++
++void LEFontInstance::unitsToPoints(LEPoint &units, LEPoint &points) const
++{
++    points.fX = xUnitsToPoints(units.fX);
++    points.fY = yUnitsToPoints(units.fY);
++}
++
++float LEFontInstance::xPixelsToUnits(float xPixels) const
++{
++    return (xPixels * getUnitsPerEM()) / (float) getXPixelsPerEm();
++}
++
++float LEFontInstance::yPixelsToUnits(float yPixels) const
++{
++    return (yPixels * getUnitsPerEM()) / (float) getYPixelsPerEm();
++}
++
++void LEFontInstance::pixelsToUnits(LEPoint &pixels, LEPoint &units) const
++{
++    units.fX = xPixelsToUnits(pixels.fX);
++    units.fY = yPixelsToUnits(pixels.fY);
++}
++
++void LEFontInstance::transformFunits(float xFunits, float yFunits, LEPoint &pixels) const
++{
++    pixels.fX = xUnitsToPoints(xFunits) * getScaleFactorX();
++    pixels.fY = yUnitsToPoints(yFunits) * getScaleFactorY();
++}
++
++le_int32 LEFontInstance::getLineHeight() const
++{
++    return getAscent() + getDescent() + getLeading();
++}
++
+ U_NAMESPACE_END
+ 
+diff --git a/src/share/native/sun/font/layout/LEFontInstance.h b/src/share/native/sun/font/layout/LEFontInstance.h
+--- jdk/src/share/native/sun/font/layout/LEFontInstance.h
++++ jdk/src/share/native/sun/font/layout/LEFontInstance.h
+@@ -26,7 +26,7 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
++ * (C) Copyright IBM Corp. 1998-2007 - All Rights Reserved
+  *
+  */
+ 
+@@ -57,7 +57,7 @@
+      * Destructor.
+      * @stable ICU 3.2
+      */
+-    virtual inline ~LECharMapper() {};
++    virtual ~LECharMapper();
+ 
+     /**
+      * This method does the adjustments.
+@@ -75,7 +75,7 @@
+  * This is a forward reference to the class which holds the per-glyph
+  * storage.
+  *
+- * @draft ICU 3.0
++ * @stable ICU 3.0
+  */
+ class LEGlyphStorage;
+ 
+@@ -101,7 +101,7 @@
+  * methods with some default behavior such as returning constant values, or using the
+  * values from the first subfont.
+  *
+- * @draft ICU 3.0
++ * @stable ICU 3.0
+  */
+ class U_LAYOUT_API LEFontInstance : public UObject
+ {
+@@ -113,7 +113,7 @@
+      *
+      * @stable ICU 2.8
+      */
+-    virtual inline ~LEFontInstance() {};
++    virtual ~LEFontInstance();
+ 
+     /**
+      * Get a physical font which can render the given text. For composite fonts,
+@@ -209,7 +209,7 @@
+      *
+      * @stable ICU 3.2
+      */
+-    virtual inline le_bool canDisplay(LEUnicode32 ch) const;
++    virtual le_bool canDisplay(LEUnicode32 ch) const;
+ 
+     /**
+      * This method returns the number of design units in
+@@ -237,13 +237,31 @@
+      * @param count - the number of characters
+      * @param reverse - if <code>TRUE</code>, store the glyph indices in reverse order.
+      * @param mapper - the character mapper.
++     * @param filterZeroWidth - <code>TRUE</code> if ZWJ / ZWNJ characters should map to a glyph w/ no contours.
+      * @param glyphStorage - the object which contains the output glyph array
+      *
+      * @see LECharMapper
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 3.6
+      */
+-    virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, const LECharMapper *mapper, LEGlyphStorage &glyphStorage) const;
++    virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, const LECharMapper *mapper, le_bool filterZeroWidth, LEGlyphStorage &glyphStorage) const;
++
++    /**
++     * This method maps a single character to a glyph index, using the
++     * font's character to glyph map. The default implementation of this
++     * method calls the mapper, and then calls <code>mapCharToGlyph(mappedCh)</code>.
++     *
++     * @param ch - the character
++     * @param mapper - the character mapper
++     * @param filterZeroWidth - <code>TRUE</code> if ZWJ / ZWNJ characters should map to a glyph w/ no contours.
++     *
++     * @return the glyph index
++     *
++     * @see LECharMapper
++     *
++     * @stable ICU 3.6
++     */
++    virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper, le_bool filterZeroWidth) const;
+ 
+     /**
+      * This method maps a single character to a glyph index, using the
+@@ -335,7 +353,7 @@
+      *
+      * @stable ICU 3.2
+      */
+-    virtual inline float xUnitsToPoints(float xUnits) const;
++    virtual float xUnitsToPoints(float xUnits) const;
+ 
+     /**
+      * This method converts font design units in the
+@@ -347,7 +365,7 @@
+      *
+      * @stable ICU 3.2
+      */
+-    virtual inline float yUnitsToPoints(float yUnits) const;
++    virtual float yUnitsToPoints(float yUnits) const;
+ 
+     /**
+      * This method converts font design units to points.
+@@ -357,7 +375,7 @@
+      *
+      * @stable ICU 3.2
+      */
+-    virtual inline void unitsToPoints(LEPoint &units, LEPoint &points) const;
++    virtual void unitsToPoints(LEPoint &units, LEPoint &points) const;
+ 
+     /**
+      * This method converts pixels in the
+@@ -369,7 +387,7 @@
+      *
+      * @stable ICU 3.2
+      */
+-    virtual inline float xPixelsToUnits(float xPixels) const;
++    virtual float xPixelsToUnits(float xPixels) const;
+ 
+     /**
+      * This method converts pixels in the
+@@ -381,7 +399,7 @@
+      *
+      * @stable ICU 3.2
+      */
+-    virtual inline float yPixelsToUnits(float yPixels) const;
++    virtual float yPixelsToUnits(float yPixels) const;
+ 
+     /**
+      * This method converts pixels to font design units.
+@@ -391,7 +409,7 @@
+      *
+      * @stable ICU 3.2
+      */
+-    virtual inline void pixelsToUnits(LEPoint &pixels, LEPoint &units) const;
++    virtual void pixelsToUnits(LEPoint &pixels, LEPoint &units) const;
+ 
+     /**
+      * Get the X scale factor from the font's transform. The default
+@@ -433,7 +451,7 @@
+      *
+      * @stable ICU 3.2
+      */
+-    virtual inline void transformFunits(float xFunits, float yFunits, LEPoint &pixels) const;
++    virtual void transformFunits(float xFunits, float yFunits, LEPoint &pixels) const;
+ 
+     /**
+      * This is a convenience method used to convert
+@@ -523,49 +541,6 @@
+ 
+ };
+ 
+-inline le_bool LEFontInstance::canDisplay(LEUnicode32 ch) const
+-{
+-    return LE_GET_GLYPH(mapCharToGlyph(ch)) != 0;
+-}
+-
+-inline float LEFontInstance::xUnitsToPoints(float xUnits) const
+-{
+-    return (xUnits * getXPixelsPerEm()) / (float) getUnitsPerEM();
+-}
+-
+-inline float LEFontInstance::yUnitsToPoints(float yUnits) const
+-{
+-    return (yUnits * getYPixelsPerEm()) / (float) getUnitsPerEM();
+-}
+-
+-inline void LEFontInstance::unitsToPoints(LEPoint &units, LEPoint &points) const
+-{
+-    points.fX = xUnitsToPoints(units.fX);
+-    points.fY = yUnitsToPoints(units.fY);
+-}
+-
+-inline float LEFontInstance::xPixelsToUnits(float xPixels) const
+-{
+-    return (xPixels * getUnitsPerEM()) / (float) getXPixelsPerEm();
+-}
+-
+-inline float LEFontInstance::yPixelsToUnits(float yPixels) const
+-{
+-    return (yPixels * getUnitsPerEM()) / (float) getYPixelsPerEm();
+-}
+-
+-inline void LEFontInstance::pixelsToUnits(LEPoint &pixels, LEPoint &units) const
+-{
+-    units.fX = xPixelsToUnits(pixels.fX);
+-    units.fY = yPixelsToUnits(pixels.fY);
+-}
+-
+-inline void LEFontInstance::transformFunits(float xFunits, float yFunits, LEPoint &pixels) const
+-{
+-    pixels.fX = xUnitsToPoints(xFunits) * getScaleFactorX();
+-    pixels.fY = yUnitsToPoints(yFunits) * getScaleFactorY();
+-}
+-
+ inline float LEFontInstance::fixedToFloat(le_int32 fixed)
+ {
+     return (float) (fixed / 65536.0);
+@@ -576,11 +551,6 @@
+     return (le_int32) (theFloat * 65536.0);
+ }
+ 
+-inline le_int32 LEFontInstance::getLineHeight() const
+-{
+-    return getAscent() + getDescent() + getLeading();
+-}
+-
+ U_NAMESPACE_END
+ #endif
+ 
+diff --git a/src/share/native/sun/font/layout/LEGlyphStorage.cpp b/src/share/native/sun/font/layout/LEGlyphStorage.cpp
+--- jdk/src/share/native/sun/font/layout/LEGlyphStorage.cpp
++++ jdk/src/share/native/sun/font/layout/LEGlyphStorage.cpp
+@@ -25,7 +25,7 @@
+ 
+ /*
+  **********************************************************************
+- *   Copyright (C) 1998-2005, International Business Machines
++ *   Copyright (C) 1998-2009, International Business Machines
+  *   Corporation and others.  All Rights Reserved.
+  **********************************************************************
+  */
+@@ -38,6 +38,11 @@
+ 
+ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LEGlyphStorage)
+ 
++LEInsertionCallback::~LEInsertionCallback()
++{
++        // nothing to do...
++}
++
+ LEGlyphStorage::LEGlyphStorage()
+     : fGlyphCount(0), fGlyphs(NULL), fCharIndices(NULL), fPositions(NULL),
+       fAuxData(NULL), fInsertionList(NULL), fSrcIndex(0), fDestIndex(0)
+@@ -129,8 +134,18 @@
+     if (fInsertionList == NULL) {
+         // FIXME: check this for failure?
+         fInsertionList = new LEInsertionList(rightToLeft);
++        if (fInsertionList == NULL) {
++            LE_DELETE_ARRAY(fCharIndices);
++            fCharIndices = NULL;
++
++            LE_DELETE_ARRAY(fGlyphs);
++            fGlyphs = NULL;
++
++            success = LE_MEMORY_ALLOCATION_ERROR;
++            return;
+     }
+ }
++}
+ 
+ // FIXME: do we want to initialize the positions to [0, 0]?
+ le_int32 LEGlyphStorage::allocatePositions(LEErrorCode &success)
+@@ -139,6 +154,11 @@
+         return -1;
+     }
+ 
++    if (fPositions != NULL) {
++        success = LE_INTERNAL_ERROR;
++        return -1;
++    }
++
+     fPositions = LE_NEW_ARRAY(float, 2 * (fGlyphCount + 1));
+ 
+     if (fPositions == NULL) {
+@@ -156,6 +176,11 @@
+         return -1;
+     }
+ 
++    if (fAuxData != NULL) {
++        success = LE_INTERNAL_ERROR;
++        return -1;
++    }
++
+     fAuxData = LE_NEW_ARRAY(le_uint32, fGlyphCount);
+ 
+     if (fAuxData == NULL) {
+@@ -510,10 +535,49 @@
+     fGlyphCount = newGlyphCount;
+ }
+ 
+-// FIXME: add error checking?
++// Move a glyph to a different position in the LEGlyphStorage ( used for Indic v2 processing )
++
++void LEGlyphStorage::moveGlyph(le_int32 fromPosition, le_int32 toPosition, le_uint32 marker )
++{
++
++    LEErrorCode success = LE_NO_ERROR;
++
++    LEGlyphID holdGlyph = getGlyphID(fromPosition,success);
++    le_int32 holdCharIndex = getCharIndex(fromPosition,success);
++    le_uint32 holdAuxData = getAuxData(fromPosition,success);
++
++    if ( fromPosition < toPosition ) {
++        for ( le_int32 i = fromPosition ; i < toPosition ; i++ ) {
++            setGlyphID(i,getGlyphID(i+1,success),success);
++            setCharIndex(i,getCharIndex(i+1,success),success);
++            setAuxData(i,getAuxData(i+1,success),success);
++        }
++    } else {
++        for ( le_int32 i = toPosition ; i > fromPosition ; i-- ) {
++            setGlyphID(i,getGlyphID(i-1,success),success);
++            setCharIndex(i,getCharIndex(i-1,success),success);
++            setAuxData(i,getAuxData(i-1,success),success);
++
++        }
++    }
++
++    setGlyphID(toPosition,holdGlyph,success);
++    setCharIndex(toPosition,holdCharIndex,success);
++    setAuxData(toPosition,holdAuxData | marker,success);
++
++}
++
++// Glue code for existing stable API
+ LEGlyphID *LEGlyphStorage::insertGlyphs(le_int32  atIndex, le_int32 insertCount)
+ {
+-    return fInsertionList->insert(atIndex, insertCount);
++    LEErrorCode ignored = LE_NO_LAYOUT_ERROR;
++    return insertGlyphs(atIndex, insertCount, ignored);
++}
++
++// FIXME: add error checking?
++LEGlyphID *LEGlyphStorage::insertGlyphs(le_int32  atIndex, le_int32 insertCount, LEErrorCode& success)
++{
++    return fInsertionList->insert(atIndex, insertCount, success);
+ }
+ 
+ le_int32 LEGlyphStorage::applyInsertions()
+@@ -526,11 +590,27 @@
+ 
+     le_int32 newGlyphCount = fGlyphCount + growAmount;
+ 
+-    fGlyphs      = (LEGlyphID *) LE_GROW_ARRAY(fGlyphs,      newGlyphCount);
+-    fCharIndices = (le_int32 *)  LE_GROW_ARRAY(fCharIndices, newGlyphCount);
++    LEGlyphID *newGlyphs = (LEGlyphID *) LE_GROW_ARRAY(fGlyphs, newGlyphCount);
++    if (newGlyphs == NULL) {
++        // Could not grow the glyph array
++        return fGlyphCount;
++    }
++    fGlyphs = newGlyphs;
++
++    le_int32 *newCharIndices = (le_int32 *) LE_GROW_ARRAY(fCharIndices, newGlyphCount);
++    if (newCharIndices == NULL) {
++        // Could not grow the glyph array
++        return fGlyphCount;
++    }
++    fCharIndices = newCharIndices;
+ 
+     if (fAuxData != NULL) {
+-        fAuxData = (le_uint32 *) LE_GROW_ARRAY(fAuxData,     newGlyphCount);
++        le_uint32 *newAuxData = (le_uint32 *) LE_GROW_ARRAY(fAuxData, newGlyphCount);
++        if (newAuxData == NULL) {
++            // could not grow the aux data array
++            return fGlyphCount;
++    }
++        fAuxData = (le_uint32 *)newAuxData;
+     }
+ 
+     fSrcIndex  = fGlyphCount - 1;
+diff --git a/src/share/native/sun/font/layout/LEGlyphStorage.h b/src/share/native/sun/font/layout/LEGlyphStorage.h
+--- jdk/src/share/native/sun/font/layout/LEGlyphStorage.h
++++ jdk/src/share/native/sun/font/layout/LEGlyphStorage.h
+@@ -25,7 +25,7 @@
+ 
+ /*
+  **********************************************************************
+- *   Copyright (C) 1998-2005, International Business Machines
++ *   Copyright (C) 1998-2010, International Business Machines
+  *   Corporation and others.  All Rights Reserved.
+  **********************************************************************
+  */
+@@ -54,7 +54,7 @@
+  *
+  * @see LEInsertionList.h
+  *
+- * @draft ICU 3.6
++ * @stable ICU 3.6
+  */
+ class U_LAYOUT_API LEGlyphStorage : public UObject, protected LEInsertionCallback
+ {
+@@ -130,7 +130,7 @@
+      *
+      * @see LEInsertionList.h
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 3.0
+      */
+     virtual le_bool applyInsertion(le_int32 atPosition, le_int32 count, LEGlyphID newGlyphs[]);
+ 
+@@ -141,14 +141,14 @@
+      * <code>allocateGlyphArray, allocatePositions and allocateAuxData</code>
+      * to allocate the data.
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 3.0
+      */
+     LEGlyphStorage();
+ 
+     /**
+      * The destructor. This will deallocate all of the arrays.
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 3.0
+      */
+     ~LEGlyphStorage();
+ 
+@@ -157,7 +157,7 @@
+      *
+      * @return the number of glyphs in the glyph array
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 3.0
+      */
+     inline le_int32 getGlyphCount() const;
+ 
+@@ -169,7 +169,7 @@
+      * @param glyphs - the destiniation glyph array
+      * @param success - set to an error code if the operation fails
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 3.0
+      */
+     void getGlyphs(LEGlyphID glyphs[], LEErrorCode &success) const;
+ 
+@@ -183,7 +183,7 @@
+      * @param extraBits - this value will be ORed with each glyph index
+      * @param success - set to an error code if the operation fails
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 3.0
+      */
+     void getGlyphs(le_uint32 glyphs[], le_uint32 extraBits, LEErrorCode &success) const;
+ 
+@@ -195,7 +195,7 @@
+      * @param charIndices - the destiniation character index array
+      * @param success - set to an error code if the operation fails
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 3.0
+      */
+     void getCharIndices(le_int32 charIndices[], LEErrorCode &success) const;
+ 
+@@ -208,7 +208,7 @@
+      * @param indexBase - an offset which will be added to each index
+      * @param success - set to an error code if the operation fails
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 3.0
+      */
+     void getCharIndices(le_int32 charIndices[], le_int32 indexBase, LEErrorCode &success) const;
+ 
+@@ -221,7 +221,7 @@
+      * @param positions - the destiniation position array
+      * @param success - set to an error code if the operation fails
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 3.0
+      */
+     void getGlyphPositions(float positions[], LEErrorCode &success) const;
+ 
+@@ -237,7 +237,7 @@
+      * @param y - the glyph's Y position
+      * @param success - set to an error code if the operation fails
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 3.0
+      */
+     void getGlyphPosition(le_int32 glyphIndex, float &x, float &y, LEErrorCode &success) const;
+ 
+@@ -251,7 +251,7 @@
+      * @param success set to an error code if the storage cannot be allocated of if the initial
+      *        glyph count is not positive.
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 3.0
+      */
+     void allocateGlyphArray(le_int32 initialGlyphCount, le_bool rightToLeft, LEErrorCode &success);
+ 
+@@ -263,7 +263,7 @@
+      *
+      * @return the number of X, Y position pairs allocated.
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 3.0
+      */
+     le_int32 allocatePositions(LEErrorCode &success);
+ 
+@@ -274,7 +274,7 @@
+      *
+      * @return the size of the auxillary data array.
+      *
+-     * @draft ICU 3.6
++     * @stable ICU 3.6
+      */
+     le_int32 allocateAuxData(LEErrorCode &success);
+ 
+@@ -284,7 +284,7 @@
+      * @param auxData the auxillary data array will be copied to this address
+      * @param success set to an error code if the data cannot be copied
+      *
+-     * @draft ICU 3.6
++     * @stable ICU 3.6
+      */
+     void getAuxData(le_uint32 auxData[], LEErrorCode &success) const;
+ 
+@@ -296,7 +296,7 @@
+      *
+      * @return the glyph ID
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 3.0
+      */
+     LEGlyphID getGlyphID(le_int32 glyphIndex, LEErrorCode &success) const;
+ 
+@@ -308,7 +308,7 @@
+      *
+      * @return the character index
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 3.0
+      */
+     le_int32  getCharIndex(le_int32 glyphIndex, LEErrorCode &success) const;
+ 
+@@ -321,7 +321,7 @@
+      *
+      * @return the auxillary data
+      *
+-     * @draft ICU 3.6
++     * @stable ICU 3.6
+      */
+     le_uint32 getAuxData(le_int32 glyphIndex, LEErrorCode &success) const;
+ 
+@@ -333,7 +333,7 @@
+      *
+      * @return a reference to the given location in the glyph array
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 3.0
+      */
+     inline LEGlyphID &operator[](le_int32 glyphIndex) const;
+ 
+@@ -346,16 +346,52 @@
+      *
+      * @param atIndex the index of the glyph to be replaced
+      * @param insertCount the number of glyphs to replace it with
++     * @param success set to an error code if the auxillary data cannot be retrieved.
+      *
+      * @return the address at which to store the replacement glyphs.
+      *
+-     * @see LEInsetionList.h
++     * @see LEInsertionList.h
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 4.2
++     */
++    LEGlyphID *insertGlyphs(le_int32 atIndex, le_int32 insertCount, LEErrorCode& success);
++
++    /**
++     * Call this method to replace a single glyph in the glyph array
++     * with multiple glyphs. This method uses the <code>LEInsertionList</code>
++     * to do the insertion. It returns the address of storage where the new
++     * glyph IDs can be stored. They will not actually be inserted into the
++     * glyph array until <code>applyInsertions</code> is called.
++     *
++     * Note: Don't use this version, use the other version of this function which has an error code.
++     *
++     * @param atIndex the index of the glyph to be replaced
++     * @param insertCount the number of glyphs to replace it with
++     *
++     * @return the address at which to store the replacement glyphs.
++     *
++     * @see LEInsertionList.h
++     *
++     * @stable ICU 3.0
+      */
+     LEGlyphID *insertGlyphs(le_int32 atIndex, le_int32 insertCount);
+ 
+     /**
++     * This method is used to reposition glyphs during Indic v2 processing.  It moves
++     * all of the relevant glyph information ( glyph, indices, positions, and auxData ),
++     * from the source position to the target position, and also allows for a marker bit
++     * to be set in the target glyph's auxData so that it won't be reprocessed later in the
++     * cycle.
++     *
++     * @param fromPosition - position of the glyph to be moved
++     * @param toPosition - target position of the glyph
++     * @param marker marker bit
++     *
++     * @stable ICU 4.2
++     */
++    void moveGlyph(le_int32 fromPosition, le_int32 toPosition, le_uint32 marker);
++
++    /**
+      * This method causes all of the glyph insertions recorded by
+      * <code>insertGlyphs</code> to be applied to the glyph array. The
+      * new slots in the char indices and the auxillary data arrays
+@@ -365,7 +401,7 @@
+      *
+      * @see LEInsertionList.h
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 3.0
+      */
+     le_int32 applyInsertions();
+ 
+@@ -376,7 +412,7 @@
+      * @param glyphID the new glyph ID
+      * @param success will be set to an error code if the glyph ID cannot be set.
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 3.0
+      */
+     void setGlyphID(le_int32 glyphIndex, LEGlyphID glyphID, LEErrorCode &success);
+ 
+@@ -387,7 +423,7 @@
+      * @param charIndex the new char index
+      * @param success will be set to an error code if the char index cannot be set.
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 3.0
+      */
+     void setCharIndex(le_int32 glyphIndex, le_int32 charIndex, LEErrorCode &success);
+ 
+@@ -399,7 +435,7 @@
+      * @param y the new Y position
+      * @param success will be set to an error code if the position cannot be set.
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 3.0
+      */
+     void setPosition(le_int32 glyphIndex, float x, float y, LEErrorCode &success);
+ 
+@@ -411,7 +447,7 @@
+      * @param yAdjust the adjustment to the glyph's Y position
+      * @param success will be set to an error code if the glyph's position cannot be adjusted.
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 3.0
+      */
+     void adjustPosition(le_int32 glyphIndex, float xAdjust, float yAdjust, LEErrorCode &success);
+ 
+@@ -422,7 +458,7 @@
+      * @param auxData the new auxillary data
+      * @param success will be set to an error code if the auxillary data cannot be set.
+      *
+-     * @draft ICU 3.6
++     * @stable ICU 3.6
+      */
+     void setAuxData(le_int32 glyphIndex, le_uint32 auxData, LEErrorCode &success);
+ 
+@@ -434,7 +470,7 @@
+      * @param from the <code>LEGlyphStorage</code> object from which
+      *             to get the new glyph array.
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 3.0
+      */
+     void adoptGlyphArray(LEGlyphStorage &from);
+ 
+@@ -446,7 +482,7 @@
+      * @param from the <code>LEGlyphStorage</code> object from which
+      *             to get the new char indices array.
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 3.0
+      */
+     void adoptCharIndicesArray(LEGlyphStorage &from);
+ 
+@@ -458,7 +494,7 @@
+      * @param from the <code>LEGlyphStorage</code> object from which
+      *             to get the new position array.
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 3.0
+      */
+     void adoptPositionArray(LEGlyphStorage &from);
+ 
+@@ -470,7 +506,7 @@
+      * @param from the <code>LEGlyphStorage</code> object from which
+      *             to get the new auxillary data array.
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 3.0
+      */
+     void adoptAuxDataArray(LEGlyphStorage &from);
+ 
+@@ -481,7 +517,7 @@
+      * @param from the <code>LEGlyphStorage</code> object from which
+      *             to get the new glyph count.
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 3.0
+      */
+     void adoptGlyphCount(LEGlyphStorage &from);
+ 
+@@ -490,7 +526,7 @@
+      *
+      * @param newGlyphCount the new glyph count.
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 3.0
+      */
+     void adoptGlyphCount(le_int32 newGlyphCount);
+ 
+@@ -500,21 +536,21 @@
+      * to layout a different characer array. (This method is also called
+      * by the destructor)
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 3.0
+      */
+     void reset();
+ 
+     /**
+      * ICU "poor man's RTTI", returns a UClassID for the actual class.
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 3.0
+      */
+     virtual UClassID getDynamicClassID() const;
+ 
+     /**
+      * ICU "poor man's RTTI", returns a UClassID for this class.
+      *
+-     * @draft ICU 3.0
++     * @stable ICU 3.0
+      */
+     static UClassID getStaticClassID();
+ };
+diff --git a/src/share/native/sun/font/layout/LEInsertionList.cpp b/src/share/native/sun/font/layout/LEInsertionList.cpp
+--- jdk/src/share/native/sun/font/layout/LEInsertionList.cpp
++++ jdk/src/share/native/sun/font/layout/LEInsertionList.cpp
+@@ -25,7 +25,7 @@
+ 
+ /*
+  **********************************************************************
+- *   Copyright (C) 1998-2004, International Business Machines
++ *   Copyright (C) 1998-2008, International Business Machines
+  *   Corporation and others.  All Rights Reserved.
+  **********************************************************************
+  */
+@@ -76,9 +76,17 @@
+     return growAmount;
+ }
+ 
+-LEGlyphID *LEInsertionList::insert(le_int32 position, le_int32 count)
++LEGlyphID *LEInsertionList::insert(le_int32 position, le_int32 count, LEErrorCode &success)
+ {
++    if (LE_FAILURE(success)) {
++        return 0;
++    }
++
+     InsertionRecord *insertion = (InsertionRecord *) LE_NEW_ARRAY(char, sizeof(InsertionRecord) + (count - ANY_NUMBER) * sizeof (LEGlyphID));
++    if (insertion == NULL) {
++        success = LE_MEMORY_ALLOCATION_ERROR;
++        return 0;
++    }
+ 
+     insertion->position = position;
+     insertion->count = count;
+diff --git a/src/share/native/sun/font/layout/LEInsertionList.h b/src/share/native/sun/font/layout/LEInsertionList.h
+--- jdk/src/share/native/sun/font/layout/LEInsertionList.h
++++ jdk/src/share/native/sun/font/layout/LEInsertionList.h
+@@ -25,7 +25,7 @@
+ 
+ /*
+  **********************************************************************
+- *   Copyright (C) 1998-2004, International Business Machines
++ *   Copyright (C) 1998-2008, International Business Machines
+  *   Corporation and others.  All Rights Reserved.
+  **********************************************************************
+  */
+@@ -45,7 +45,7 @@
+  *
+  * @internal
+  */
+-class LEInsertionCallback
++class U_LAYOUT_API LEInsertionCallback
+ {
+ public:
+     /**
+@@ -62,6 +62,11 @@
+      * @internal
+      */
+     virtual le_bool applyInsertion(le_int32 atPosition, le_int32 count, LEGlyphID newGlyphs[]) = 0;
++
++    /**
++     * The destructor
++     */
++     virtual ~LEInsertionCallback();
+ };
+ 
+ /**
+@@ -103,13 +108,14 @@
+      * @param position the glyph at this position in the array will be
+      *                 replaced by the new glyphs.
+      * @param count the number of new glyphs
++     * @param success set to an error code if the auxillary data cannot be retrieved.
+      *
+      * @return the address of an array in which to store the new glyphs. This will
+      *         <em>not</em> be in the glyph array.
+      *
+      * @internal
+      */
+-    LEGlyphID *insert(le_int32 position, le_int32 count);
++    LEGlyphID *insert(le_int32 position, le_int32 count, LEErrorCode &success);
+ 
+     /**
+      * Return the number of new glyphs that have been inserted.
+diff --git a/src/share/native/sun/font/layout/LELanguages.h b/src/share/native/sun/font/layout/LELanguages.h
+--- jdk/src/share/native/sun/font/layout/LELanguages.h
++++ jdk/src/share/native/sun/font/layout/LELanguages.h
+@@ -25,12 +25,12 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 1998-2005. All Rights Reserved.
++ * (C) Copyright IBM Corp. 1998-2010. All Rights Reserved.
+  *
+  * WARNING: THIS FILE IS MACHINE GENERATED. DO NOT HAND EDIT IT UNLESS
+  * YOU REALLY KNOW WHAT YOU'RE DOING.
+  *
+- * Generated on: 07/19/2005 01:01:08 PM PDT
++ * Generated on: 10/26/2010 02:53:33 PM PDT
+  */
+ 
+ #ifndef __LELANGUAGES_H
+@@ -50,7 +50,7 @@
+  * this is just a list of languages which the LayoutEngine
+  * supports.
+  *
+- * @draft ICU 3.4
++ * @stable ICU 2.6
+  */
+ 
+ enum LanguageCodes {
+@@ -85,7 +85,51 @@
+     zhsLanguageCode = 28,
+     zhtLanguageCode = 29,
+ 
+-    languageCodeCount = 30
++    /** New language codes added 03/13/2008 @stable ICU 4.0 */
++    afkLanguageCode = 30,
++    belLanguageCode = 31,
++    bgrLanguageCode = 32,
++    catLanguageCode = 33,
++    cheLanguageCode = 34,
++    copLanguageCode = 35,
++    csyLanguageCode = 36,
++    danLanguageCode = 37,
++    deuLanguageCode = 38,
++    dznLanguageCode = 39,
++    ellLanguageCode = 40,
++    engLanguageCode = 41,
++    espLanguageCode = 42,
++    etiLanguageCode = 43,
++    euqLanguageCode = 44,
++    finLanguageCode = 45,
++    fraLanguageCode = 46,
++    gaeLanguageCode = 47,
++    hauLanguageCode = 48,
++    hrvLanguageCode = 49,
++    hunLanguageCode = 50,
++    hyeLanguageCode = 51,
++    indLanguageCode = 52,
++    itaLanguageCode = 53,
++    khmLanguageCode = 54,
++    mngLanguageCode = 55,
++    mtsLanguageCode = 56,
++    nepLanguageCode = 57,
++    nldLanguageCode = 58,
++    pasLanguageCode = 59,
++    plkLanguageCode = 60,
++    ptgLanguageCode = 61,
++    romLanguageCode = 62,
++    rusLanguageCode = 63,
++    skyLanguageCode = 64,
++    slvLanguageCode = 65,
++    sqiLanguageCode = 66,
++    srbLanguageCode = 67,
++    sveLanguageCode = 68,
++    tibLanguageCode = 69,
++    trkLanguageCode = 70,
++    welLanguageCode = 71,
++
++    languageCodeCount = 72
+ };
+ 
+ U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/LEScripts.h b/src/share/native/sun/font/layout/LEScripts.h
+--- jdk/src/share/native/sun/font/layout/LEScripts.h
++++ jdk/src/share/native/sun/font/layout/LEScripts.h
+@@ -25,40 +25,43 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 1998-2005. All Rights Reserved.
++ * (C) Copyright IBM Corp. 1998-2010. All Rights Reserved.
+  *
+  * WARNING: THIS FILE IS MACHINE GENERATED. DO NOT HAND EDIT IT UNLESS
+  * YOU REALLY KNOW WHAT YOU'RE DOING.
++ *
++ * Generated on: 10/26/2010 02:53:33 PM PDT
+  */
+ 
+ #ifndef __LESCRIPTS_H
+ #define __LESCRIPTS_H
+ 
+ #include "LETypes.h"
++
+ /**
+  * \file
+  * \brief C++ API: Constants for Unicode script values
+  */
+ 
+-
+ U_NAMESPACE_BEGIN
+ 
+ /**
+  * Constants for Unicode script values, generated using
+  * ICU4J's <code>UScript</code> class.
+  *
+- * @draft ICU 3.0
++ * @stable ICU 2.2
+  */
+ 
+ enum ScriptCodes {
+     zyyyScriptCode =  0,
+-    qaaiScriptCode =  1,
++    zinhScriptCode =  1,
++    qaaiScriptCode = zinhScriptCode,  /* manually added alias, for API stability */
+     arabScriptCode =  2,
+     armnScriptCode =  3,
+     bengScriptCode =  4,
+     bopoScriptCode =  5,
+     cherScriptCode =  6,
+-    qaacScriptCode =  7,
++    coptScriptCode =  7,
+     cyrlScriptCode =  8,
+     dsrtScriptCode =  9,
+     devaScriptCode = 10,
+@@ -91,12 +94,24 @@
+     thaaScriptCode = 37,
+     thaiScriptCode = 38,
+     tibtScriptCode = 39,
++/**
++ * @stable ICU 2.6
++ */
++
+     cansScriptCode = 40,
++/**
++ * @stable ICU 2.2
++ */
++
+     yiiiScriptCode = 41,
+     tglgScriptCode = 42,
+     hanoScriptCode = 43,
+     buhdScriptCode = 44,
+     tagbScriptCode = 45,
++/**
++ * @stable ICU 2.6
++ */
++
+     braiScriptCode = 46,
+     cprtScriptCode = 47,
+     limbScriptCode = 48,
+@@ -105,9 +120,129 @@
+     shawScriptCode = 51,
+     taleScriptCode = 52,
+     ugarScriptCode = 53,
++/**
++ * @stable ICU 3.0
++ */
++
+     hrktScriptCode = 54,
++/**
++ * @stable ICU 3.4
++ */
+ 
+-    scriptCodeCount = 55
++    bugiScriptCode = 55,
++    glagScriptCode = 56,
++    kharScriptCode = 57,
++    syloScriptCode = 58,
++    taluScriptCode = 59,
++    tfngScriptCode = 60,
++    xpeoScriptCode = 61,
++/**
++ * @stable ICU 3.6
++ */
++
++    baliScriptCode = 62,
++    batkScriptCode = 63,
++    blisScriptCode = 64,
++    brahScriptCode = 65,
++    chamScriptCode = 66,
++    cirtScriptCode = 67,
++    cyrsScriptCode = 68,
++    egydScriptCode = 69,
++    egyhScriptCode = 70,
++    egypScriptCode = 71,
++    geokScriptCode = 72,
++    hansScriptCode = 73,
++    hantScriptCode = 74,
++    hmngScriptCode = 75,
++    hungScriptCode = 76,
++    indsScriptCode = 77,
++    javaScriptCode = 78,
++    kaliScriptCode = 79,
++    latfScriptCode = 80,
++    latgScriptCode = 81,
++    lepcScriptCode = 82,
++    linaScriptCode = 83,
++    mandScriptCode = 84,
++    mayaScriptCode = 85,
++    meroScriptCode = 86,
++    nkooScriptCode = 87,
++    orkhScriptCode = 88,
++    permScriptCode = 89,
++    phagScriptCode = 90,
++    phnxScriptCode = 91,
++    plrdScriptCode = 92,
++    roroScriptCode = 93,
++    saraScriptCode = 94,
++    syreScriptCode = 95,
++    syrjScriptCode = 96,
++    syrnScriptCode = 97,
++    tengScriptCode = 98,
++    vaiiScriptCode = 99,
++    vispScriptCode = 100,
++    xsuxScriptCode = 101,
++    zxxxScriptCode = 102,
++    zzzzScriptCode = 103,
++/**
++ * @stable ICU 3.8
++ */
++
++    cariScriptCode = 104,
++    jpanScriptCode = 105,
++    lanaScriptCode = 106,
++    lyciScriptCode = 107,
++    lydiScriptCode = 108,
++    olckScriptCode = 109,
++    rjngScriptCode = 110,
++    saurScriptCode = 111,
++    sgnwScriptCode = 112,
++    sundScriptCode = 113,
++    moonScriptCode = 114,
++    mteiScriptCode = 115,
++/**
++ * @stable ICU 4.0
++ */
++
++    armiScriptCode = 116,
++    avstScriptCode = 117,
++    cakmScriptCode = 118,
++    koreScriptCode = 119,
++    kthiScriptCode = 120,
++    maniScriptCode = 121,
++    phliScriptCode = 122,
++    phlpScriptCode = 123,
++    phlvScriptCode = 124,
++    prtiScriptCode = 125,
++    samrScriptCode = 126,
++    tavtScriptCode = 127,
++    zmthScriptCode = 128,
++    zsymScriptCode = 129,
++/**
++ * @stable ICU 4.4
++ */
++
++    bamuScriptCode = 130,
++    lisuScriptCode = 131,
++    nkgbScriptCode = 132,
++    sarbScriptCode = 133,
++/**
++ * @stable ICU 4.6
++ */
++
++    bassScriptCode = 134,
++    duplScriptCode = 135,
++    elbaScriptCode = 136,
++    granScriptCode = 137,
++    kpelScriptCode = 138,
++    lomaScriptCode = 139,
++    mendScriptCode = 140,
++    mercScriptCode = 141,
++    narbScriptCode = 142,
++    nbatScriptCode = 143,
++    palmScriptCode = 144,
++    sindScriptCode = 145,
++    waraScriptCode = 146,
++
++    scriptCodeCount = 147
+ };
+ 
+ U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/LEStandalone.h b/src/share/native/sun/font/layout/LEStandalone.h
+--- jdk/src/share/native/sun/font/layout/LEStandalone.h
++++ jdk/src/share/native/sun/font/layout/LEStandalone.h
+@@ -26,6 +26,15 @@
+ #ifndef __LESTANDALONE
+ #define __LESTANDALONE
+ 
++#ifndef U_COPYRIGHT_STRING
++#define U_COPYRIGHT_STRING " (C) Copyright IBM Corp and Others. 1998-2010 - All Rights Reserved"
++#endif
++
++/* ICU Version number */
++#ifndef U_ICU_VERSION
++#define U_ICU_VERSION "4.6"
++#endif
++
+ /* Definitions to make Layout Engine work away from ICU. */
+ #ifndef U_NAMESPACE_BEGIN
+ #define U_NAMESPACE_BEGIN
+diff --git a/src/share/native/sun/font/layout/LESwaps.h b/src/share/native/sun/font/layout/LESwaps.h
+--- jdk/src/share/native/sun/font/layout/LESwaps.h
++++ jdk/src/share/native/sun/font/layout/LESwaps.h
+@@ -26,7 +26,7 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
++ * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved
+  *
+  */
+ 
+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
+@@ -25,7 +25,7 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
++ * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved
+  *
+  */
+ 
+@@ -500,6 +500,7 @@
+     LE_CALT_FEATURE_TAG = 0x63616C74UL, /**< 'calt' */
+     LE_CASE_FEATURE_TAG = 0x63617365UL, /**< 'case' */
+     LE_CCMP_FEATURE_TAG = 0x63636D70UL, /**< 'ccmp' */
++        LE_CJCT_FEATURE_TAG = 0x636A6374UL, /**< 'cjct' */
+     LE_CLIG_FEATURE_TAG = 0x636C6967UL, /**< 'clig' */
+     LE_CPSP_FEATURE_TAG = 0x63707370UL, /**< 'cpsp' */
+     LE_CSWH_FEATURE_TAG = 0x63737768UL, /**< 'cswh' */
+@@ -563,6 +564,7 @@
+     LE_RAND_FEATURE_TAG = 0x72616E64UL, /**< 'rand' */
+     LE_RLIG_FEATURE_TAG = 0x726C6967UL, /**< 'rlig' */
+     LE_RPHF_FEATURE_TAG = 0x72706866UL, /**< 'rphf' */
++        LE_RKRF_FEATURE_TAG = 0x726B7266UL, /**< 'rkrf' */
+     LE_RTBD_FEATURE_TAG = 0x72746264UL, /**< 'rtbd' */
+     LE_RTLA_FEATURE_TAG = 0x72746C61UL, /**< 'rtla' */
+     LE_RUBY_FEATURE_TAG = 0x72756279UL, /**< 'ruby' */
+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
+@@ -39,10 +39,11 @@
+ #include "ArabicLayoutEngine.h"
+ #include "CanonShaping.h"
+ #include "HanLayoutEngine.h"
++#include "HangulLayoutEngine.h"
+ #include "IndicLayoutEngine.h"
+ #include "KhmerLayoutEngine.h"
+ #include "ThaiLayoutEngine.h"
+-//#include "TibetanLayoutEngine.h"
++#include "TibetanLayoutEngine.h"
+ #include "GXLayoutEngine.h"
+ #include "ScriptAndLanguageTags.h"
+ #include "CharSubstitutionFilter.h"
+@@ -60,6 +61,9 @@
+ 
+ U_NAMESPACE_BEGIN
+ 
++/* Leave this copyright notice here! It needs to go somewhere in this library. */
++static const char copyright[] = U_COPYRIGHT_STRING;
++
+ const LEUnicode32 DefaultCharMapper::controlChars[] = {
+     0x0009, 0x000A, 0x000D,
+     /*0x200C, 0x200D,*/ 0x200E, 0x200F,
+@@ -97,9 +101,8 @@
+     }
+ 
+     if (fFilterControls) {
+-        le_int32 index = OpenTypeUtilities::search((le_uint32)ch,
+-                                                   (le_uint32 *)controlChars,
+-                                                   controlCharsCount);
++        le_int32 index = OpenTypeUtilities::search((le_uint32)ch, (le_uint32 *)controlChars, controlCharsCount);
++
+         if (controlChars[index] == ch) {
+             return 0xFFFF;
+         }
+@@ -135,56 +138,7 @@
+     // nothing to do
+ }
+ 
+-
+-UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LayoutEngine)
+-
+-#define ccmpFeatureTag  LE_CCMP_FEATURE_TAG
+-
+-#define ccmpFeatureMask 0x80000000UL
+-
+-#define canonFeatures (ccmpFeatureMask)
+-
+-static const FeatureMap canonFeatureMap[] =
+-{
+-    {ccmpFeatureTag, ccmpFeatureMask}
+-};
+-
+-static const le_int32 canonFeatureMapCount = LE_ARRAY_SIZE(canonFeatureMap);
+-
+-LayoutEngine::LayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags)
+-  : fGlyphStorage(NULL), fFontInstance(fontInstance), fScriptCode(scriptCode), fLanguageCode(languageCode),
+-    fTypoFlags(typoFlags)
+-{
+-    fGlyphStorage = new LEGlyphStorage();
+-}
+-
+-le_int32 LayoutEngine::getGlyphCount() const
+-{
+-    return fGlyphStorage->getGlyphCount();
+-}
+-
+-void LayoutEngine::getCharIndices(le_int32 charIndices[], le_int32 indexBase, LEErrorCode &success) const
+-{
+-    fGlyphStorage->getCharIndices(charIndices, indexBase, success);
+-}
+-
+-void LayoutEngine::getCharIndices(le_int32 charIndices[], LEErrorCode &success) const
+-{
+-    fGlyphStorage->getCharIndices(charIndices, success);
+-}
+-
+-// Copy the glyphs into caller's (32-bit) glyph array, OR in extraBits
+-void LayoutEngine::getGlyphs(le_uint32 glyphs[], le_uint32 extraBits, LEErrorCode &success) const
+-{
+-    fGlyphStorage->getGlyphs(glyphs, extraBits, success);
+-}
+-
+-void LayoutEngine::getGlyphs(LEGlyphID glyphs[], LEErrorCode &success) const
+-{
+-    fGlyphStorage->getGlyphs(glyphs, success);
+-}
+-
+-class CanonMarkFilter : public LEGlyphFilter
++class CanonMarkFilter : public UMemory, public LEGlyphFilter
+ {
+ private:
+     const GlyphClassDefinitionTable *classDefTable;
+@@ -216,6 +170,66 @@
+     return glyphClass != 0;
+ }
+ 
++UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LayoutEngine)
++
++#define ccmpFeatureTag  LE_CCMP_FEATURE_TAG
++
++#define ccmpFeatureMask 0x80000000UL
++
++#define canonFeatures (ccmpFeatureMask)
++
++static const FeatureMap canonFeatureMap[] =
++{
++    {ccmpFeatureTag, ccmpFeatureMask}
++};
++
++static const le_int32 canonFeatureMapCount = LE_ARRAY_SIZE(canonFeatureMap);
++
++LayoutEngine::LayoutEngine(const LEFontInstance *fontInstance,
++                           le_int32 scriptCode,
++                           le_int32 languageCode,
++                           le_int32 typoFlags,
++                           LEErrorCode &success)
++  : fGlyphStorage(NULL), fFontInstance(fontInstance), fScriptCode(scriptCode), fLanguageCode(languageCode),
++    fTypoFlags(typoFlags), fFilterZeroWidth(TRUE)
++{
++    if (LE_FAILURE(success)) {
++        return;
++    }
++
++    fGlyphStorage = new LEGlyphStorage();
++    if (fGlyphStorage == NULL) {
++        success = LE_MEMORY_ALLOCATION_ERROR;
++}
++}
++
++le_int32 LayoutEngine::getGlyphCount() const
++{
++    return fGlyphStorage->getGlyphCount();
++}
++
++void LayoutEngine::getCharIndices(le_int32 charIndices[], le_int32 indexBase, LEErrorCode &success) const
++{
++    fGlyphStorage->getCharIndices(charIndices, indexBase, success);
++}
++
++void LayoutEngine::getCharIndices(le_int32 charIndices[], LEErrorCode &success) const
++{
++    fGlyphStorage->getCharIndices(charIndices, success);
++}
++
++// Copy the glyphs into caller's (32-bit) glyph array, OR in extraBits
++void LayoutEngine::getGlyphs(le_uint32 glyphs[], le_uint32 extraBits, LEErrorCode &success) const
++{
++    fGlyphStorage->getGlyphs(glyphs, extraBits, success);
++}
++
++void LayoutEngine::getGlyphs(LEGlyphID glyphs[], LEErrorCode &success) const
++{
++    fGlyphStorage->getGlyphs(glyphs, success);
++}
++
++
+ void LayoutEngine::getGlyphPositions(float positions[], LEErrorCode &success) const
+ {
+     fGlyphStorage->getGlyphPositions(positions, success);
+@@ -245,8 +259,21 @@
+ 
+     if (canonGSUBTable->coversScript(scriptTag)) {
+         CharSubstitutionFilter *substitutionFilter = new CharSubstitutionFilter(fFontInstance);
++        if (substitutionFilter == NULL) {
++            success = LE_MEMORY_ALLOCATION_ERROR;
++            return 0;
++        }
++
+                 const LEUnicode *inChars = &chars[offset];
+                 LEUnicode *reordered = NULL;
++        LEGlyphStorage fakeGlyphStorage;
++
++        fakeGlyphStorage.allocateGlyphArray(count, rightToLeft, success);
++
++        if (LE_FAILURE(success)) {
++            delete substitutionFilter;
++            return 0;
++        }
+ 
+                 // This is the cheapest way to get mark reordering only for Hebrew.
+                 // We could just do the mark reordering for all scripts, but most
+@@ -255,18 +282,19 @@
+                         reordered = LE_NEW_ARRAY(LEUnicode, count);
+ 
+                         if (reordered == NULL) {
++                delete substitutionFilter;
+                                 success = LE_MEMORY_ALLOCATION_ERROR;
+                                 return 0;
+                         }
+ 
+-                        CanonShaping::reorderMarks(&chars[offset], count, rightToLeft, reordered, glyphStorage);
++                        CanonShaping::reorderMarks(&chars[offset], count, rightToLeft, reordered, fakeGlyphStorage);
+                         inChars = reordered;
+                 }
+ 
+-        glyphStorage.allocateGlyphArray(count, rightToLeft, success);
+-        glyphStorage.allocateAuxData(success);
++        fakeGlyphStorage.allocateAuxData(success);
+ 
+         if (LE_FAILURE(success)) {
++            delete substitutionFilter;
+             return 0;
+         }
+ 
+@@ -276,21 +304,41 @@
+         }
+ 
+         for (i = 0; i < count; i += 1, out += dir) {
+-            glyphStorage[out] = (LEGlyphID) inChars[i];
+-            glyphStorage.setAuxData(out, canonFeatures, success);
++            fakeGlyphStorage[out] = (LEGlyphID) inChars[i];
++            fakeGlyphStorage.setAuxData(out, canonFeatures, success);
+         }
+ 
+                 if (reordered != NULL) {
+                         LE_DELETE_ARRAY(reordered);
+                 }
+ 
+-        outCharCount = canonGSUBTable->process(glyphStorage, rightToLeft, scriptTag, langSysTag, NULL, substitutionFilter, canonFeatureMap, canonFeatureMapCount, FALSE);
++        outCharCount = canonGSUBTable->process(fakeGlyphStorage, rightToLeft, scriptTag, langSysTag, NULL, substitutionFilter, canonFeatureMap, canonFeatureMapCount, FALSE, success);
++
++        if (LE_FAILURE(success)) {
++            delete substitutionFilter;
++            return 0;
++        }
+ 
+         out = (rightToLeft? outCharCount - 1 : 0);
+ 
++        /*
++         * The char indices array in fakeGlyphStorage has the correct mapping
++         * back to the original input characters. Save it in glyphStorage. The
++         * subsequent call to glyphStoratge.allocateGlyphArray will keep this
++         * array rather than allocating and initializing a new one.
++         */
++        glyphStorage.adoptCharIndicesArray(fakeGlyphStorage);
++
+         outChars = LE_NEW_ARRAY(LEUnicode, outCharCount);
++
++        if (outChars == NULL) {
++            delete substitutionFilter;
++            success = LE_MEMORY_ALLOCATION_ERROR;
++            return 0;
++        }
++
+         for (i = 0; i < outCharCount; i += 1, out += dir) {
+-            outChars[out] = (LEUnicode) LE_GET_GLYPH(glyphStorage[i]);
++            outChars[out] = (LEUnicode) LE_GET_GLYPH(fakeGlyphStorage[i]);
+         }
+ 
+         delete substitutionFilter;
+@@ -475,7 +523,7 @@
+ 
+     DefaultCharMapper charMapper(TRUE, mirror);
+ 
+-    fFontInstance->mapCharsToGlyphs(chars, offset, count, reverse, &charMapper, glyphStorage);
++    fFontInstance->mapCharsToGlyphs(chars, offset, count, reverse, &charMapper, fFilterZeroWidth, glyphStorage);
+ }
+ 
+ // Input: characters, font?
+@@ -495,6 +543,10 @@
+ 
+     le_int32 glyphCount;
+ 
++    if (fGlyphStorage->getGlyphCount() > 0) {
++        fGlyphStorage->reset();
++    }
++
+     glyphCount = computeGlyphs(chars, offset, count, max, rightToLeft, *fGlyphStorage, success);
+     positionGlyphs(*fGlyphStorage, x, y, success);
+     adjustGlyphPositions(chars, offset, count, rightToLeft, *fGlyphStorage, success);
+@@ -526,8 +578,15 @@
+     LayoutEngine *result = NULL;
+     LETag scriptTag   = 0x00000000;
+     LETag languageTag = 0x00000000;
++        LETag v2ScriptTag = OpenTypeLayoutEngine::getV2ScriptTag(scriptCode);
+ 
+-    if (gsubTable != NULL && gsubTable->coversScript(scriptTag = OpenTypeLayoutEngine::getScriptTag(scriptCode))) {
++    // Right now, only invoke V2 processing for Devanagari.  TODO: Allow more V2 scripts as they are
++    // properly tested.
++
++        if ( v2ScriptTag == dev2ScriptTag && gsubTable != NULL && gsubTable->coversScript( v2ScriptTag )) {
++                result = new IndicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, TRUE, gsubTable, success);
++        }
++    else if (gsubTable != NULL && gsubTable->coversScript(scriptTag = OpenTypeLayoutEngine::getScriptTag(scriptCode))) {
+         switch (scriptCode) {
+         case bengScriptCode:
+         case devaScriptCode:
+@@ -539,11 +598,15 @@
+         case tamlScriptCode:
+         case teluScriptCode:
+         case sinhScriptCode:
+-            result = new IndicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable);
++            result = new IndicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, FALSE, gsubTable, success);
+             break;
+ 
+         case arabScriptCode:
+-            result = new ArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable);
++            result = new ArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success);
++            break;
++
++        case hangScriptCode:
++            result = new HangulOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success);
+             break;
+ 
+         case haniScriptCode:
+@@ -555,36 +618,35 @@
+             case zhtLanguageCode:
+             case zhsLanguageCode:
+                 if (gsubTable->coversScriptAndLanguage(scriptTag, languageTag, TRUE)) {
+-                    result = new HanOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable);
++                    result = new HanOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success);
+                     break;
+                 }
+ 
+                 // note: falling through to default case.
+             default:
+-                result = new OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable);
++                result = new OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success);
+                 break;
+             }
+ 
+             break;
+-#if 0
++
+         case tibtScriptCode:
+-             result = new TibetanOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable);
++            result = new TibetanOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success);
+             break;
+-#endif
+ 
+         case khmrScriptCode:
+-            result = new KhmerOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable);
++            result = new KhmerOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success);
+             break;
+ 
+         default:
+-            result = new OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable);
++            result = new OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success);
+             break;
+         }
+     } else {
+         const MorphTableHeader *morphTable = (MorphTableHeader *) fontInstance->getFontTable(mortTableTag);
+ 
+         if (morphTable != NULL && SWAPL(morphTable->version)==0x00010000) {
+-            result = new GXLayoutEngine(fontInstance, scriptCode, languageCode, morphTable);
++            result = new GXLayoutEngine(fontInstance, scriptCode, languageCode, morphTable, success);
+         } else {
+             switch (scriptCode) {
+             case bengScriptCode:
+@@ -598,29 +660,38 @@
+             case teluScriptCode:
+             case sinhScriptCode:
+             {
+-                result = new IndicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags);
++                result = new IndicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success);
+                 break;
+             }
+ 
+             case arabScriptCode:
+             //case hebrScriptCode:
+-                result = new UnicodeArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags);
++                result = new UnicodeArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success);
+                 break;
+ 
+             //case hebrScriptCode:
+             //    return new HebrewOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags);
+ 
+             case thaiScriptCode:
+-                result = new ThaiLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags);
++                result = new ThaiLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success);
++                break;
++
++            case hangScriptCode:
++                result = new HangulOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success);
+                 break;
+ 
+             default:
+-                result = new LayoutEngine(fontInstance, scriptCode, languageCode, typoFlags);
++                result = new LayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success);
+                 break;
+             }
+         }
+     }
+ 
++    if (result && LE_FAILURE(success)) {
++                delete result;
++                result = NULL;
++        }
++
+     if (result == NULL) {
+         success = LE_MEMORY_ALLOCATION_ERROR;
+     }
+diff --git a/src/share/native/sun/font/layout/LayoutEngine.h b/src/share/native/sun/font/layout/LayoutEngine.h
+--- jdk/src/share/native/sun/font/layout/LayoutEngine.h
++++ jdk/src/share/native/sun/font/layout/LayoutEngine.h
+@@ -26,7 +26,7 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
++ * (C) Copyright IBM Corp. 1998-2008 - All Rights Reserved
+  *
+  */
+ 
+@@ -133,6 +133,14 @@
+     le_int32 fTypoFlags;
+ 
+     /**
++     * <code>TRUE</code> if <code>mapCharsToGlyphs</code> should replace ZWJ / ZWNJ with a glyph
++     * with no contours.
++     *
++     * @internal
++     */
++    le_bool fFilterZeroWidth;
++
++    /**
+      * This constructs an instance for a given font, script and language. Subclass constructors
+      * must call this constructor.
+      *
+@@ -141,13 +149,18 @@
+      * @param languageCode - the language for the text
+      * @param typoFlags - the typographic control flags for the text.  Set bit 1 if kerning
+      * is desired, set bit 2 if ligature formation is desired.  Others are reserved.
++     * @param success - set to an error code if the operation fails
+      *
+      * @see LEFontInstance
+      * @see ScriptAndLanguageTags.h
+      *
+      * @internal
+      */
+-    LayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags);
++    LayoutEngine(const LEFontInstance *fontInstance,
++                 le_int32 scriptCode,
++                 le_int32 languageCode,
++                 le_int32 typoFlags,
++                 LEErrorCode &success);
+ 
+     /**
+      * This overrides the default no argument constructor to make it
+@@ -338,7 +351,7 @@
+ 
+     /**
+      * This method will invoke the layout steps in their correct order by calling
+-     * the computeGlyphs, positionGlyphs and adjustGlyphPosition methods.. It will
++     * the computeGlyphs, positionGlyphs and adjustGlyphPosition methods. It will
+      * compute the glyph, character index and position arrays.
+      *
+      * @param chars - the input character context
+@@ -352,8 +365,12 @@
+      *
+      * @return the number of glyphs in the glyph array
+      *
+-     * Note; the glyph, character index and position array can be accessed
+-     * using the getter method below.
++     * Note: The glyph, character index and position array can be accessed
++     * using the getter methods below.
++     *
++     * Note: If you call this method more than once, you must call the reset()
++     * method first to free the glyph, character index and position arrays
++     * allocated by the previous call.
+      *
+      * @stable ICU 2.8
+      */
+@@ -479,7 +496,7 @@
+ 
+     /**
+      * Override of existing call that provides flags to control typography.
+-     * @draft ICU 3.4
++     * @stable ICU 3.4
+      */
+     static LayoutEngine *layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typo_flags, LEErrorCode &success);
+ 
+diff --git a/src/share/native/sun/font/layout/LigatureSubstSubtables.cpp b/src/share/native/sun/font/layout/LigatureSubstSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/LigatureSubstSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/LigatureSubstSubtables.cpp
+@@ -26,7 +26,7 @@
+ /*
+  *
+  *
+- * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved
++ * (C) Copyright IBM Corp. 1998-2006 - All Rights Reserved
+  *
+  */
+ 
+@@ -58,10 +58,6 @@
+             TTGlyphID ligGlyph = SWAPW(ligTable->ligGlyph);
+             le_uint16 comp;
+ 
+-            if (filter != NULL && ! filter->accept(LE_SET_GLYPH(glyph, ligGlyph))) {
+-                continue;
+-            }
+-
+             for (comp = 0; comp < compCount; comp += 1) {
+                 if (! glyphIterator->next()) {
+                     break;
+@@ -72,7 +68,7 @@
+                 }
+             }
+ 
+-            if (comp == compCount) {
++            if (comp == compCount && (filter == NULL || filter->accept(LE_SET_GLYPH(glyph, ligGlyph)))) {
+                 GlyphIterator tempIterator(*glyphIterator);
+                 TTGlyphID deletedGlyph = tempIterator.ignoresMarks()? 0xFFFE : 0xFFFF;
+ 
+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
+@@ -25,7 +25,7 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
++ * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved
+  *
+  */
+ 
+@@ -33,7 +33,7 @@
+ #include "OpenTypeUtilities.h"
+ #include "LEFontInstance.h"
+ #include "OpenTypeTables.h"
+-#include "Features.h"
++#include "ICUFeatures.h"
+ #include "Lookups.h"
+ #include "ScriptAndLanguage.h"
+ #include "GlyphDefinitionTables.h"
+@@ -45,8 +45,12 @@
+ U_NAMESPACE_BEGIN
+ 
+ le_uint32 LookupProcessor::applyLookupTable(const LookupTable *lookupTable, GlyphIterator *glyphIterator,
+-                                         const LEFontInstance *fontInstance) const
++                                         const LEFontInstance *fontInstance, LEErrorCode& success) const
+ {
++    if (LE_FAILURE(success)) {
++        return 0;
++    }
++
+     le_uint16 lookupType = SWAPW(lookupTable->lookupType);
+     le_uint16 subtableCount = SWAPW(lookupTable->subTableCount);
+     le_int32 startPosition = glyphIterator->getCurrStreamPosition();
+@@ -55,9 +59,9 @@
+     for (le_uint16 subtable = 0; subtable < subtableCount; subtable += 1) {
+         const LookupSubtable *lookupSubtable = lookupTable->getLookupSubtable(subtable);
+ 
+-        delta = applySubtable(lookupSubtable, lookupType, glyphIterator, fontInstance);
++        delta = applySubtable(lookupSubtable, lookupType, glyphIterator, fontInstance, success);
+ 
+-        if (delta > 0) {
++        if (delta > 0 && LE_FAILURE(success)) {
+             return 1;
+         }
+ 
+@@ -69,8 +73,12 @@
+ 
+ le_int32 LookupProcessor::process(LEGlyphStorage &glyphStorage, GlyphPositionAdjustments *glyphPositionAdjustments,
+                               le_bool rightToLeft, const GlyphDefinitionTableHeader *glyphDefinitionTableHeader,
+-                              const LEFontInstance *fontInstance) const
++                              const LEFontInstance *fontInstance, LEErrorCode& success) const
+ {
++    if (LE_FAILURE(success)) {
++        return 0;
++    }
++
+     le_int32 glyphCount = glyphStorage.getGlyphCount();
+ 
+     if (lookupSelectArray == NULL) {
+@@ -96,10 +104,9 @@
+             glyphIterator.reset(lookupFlags, selectMask);
+ 
+             while (glyphIterator.findFeatureTag()) {
+-                le_uint32 delta = 1;
+-
+-                while (glyphIterator.next(delta)) {
+-                    delta = applyLookupTable(lookupTable, &glyphIterator, fontInstance);
++                applyLookupTable(lookupTable, &glyphIterator, fontInstance, success);
++                if (LE_FAILURE(success)) {
++                    return 0;
+                 }
+             }
+ 
+@@ -111,12 +118,16 @@
+ }
+ 
+ le_uint32 LookupProcessor::applySingleLookup(le_uint16 lookupTableIndex, GlyphIterator *glyphIterator,
+-                                          const LEFontInstance *fontInstance) const
++                                          const LEFontInstance *fontInstance, LEErrorCode& success) const
+ {
++    if (LE_FAILURE(success)) {
++        return 0;
++    }
++
+     const LookupTable *lookupTable = lookupListTable->getLookupTable(lookupTableIndex);
+     le_uint16 lookupFlags = SWAPW(lookupTable->lookupFlags);
+     GlyphIterator tempIterator(*glyphIterator, lookupFlags);
+-    le_uint32 delta = applyLookupTable(lookupTable, &tempIterator, fontInstance);
++    le_uint32 delta = applyLookupTable(lookupTable, &tempIterator, fontInstance, success);
+ 
+     return delta;
+ }
+@@ -141,7 +152,8 @@
+ 
+ LookupProcessor::LookupProcessor(const char *baseAddress,
+         Offset scriptListOffset, Offset featureListOffset, Offset lookupListOffset,
+-        LETag scriptTag, LETag languageTag, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool orderFeatures)
++        LETag scriptTag, LETag languageTag, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool orderFeatures,
++        LEErrorCode& success)
+     : lookupListTable(NULL), featureListTable(NULL), lookupSelectArray(NULL), lookupSelectCount(0),
+       lookupOrderArray(NULL), lookupOrderCount(0)
+ {
+@@ -151,6 +163,10 @@
+     le_uint16 lookupListCount = 0;
+     le_uint16 requiredFeatureIndex;
+ 
++    if (LE_FAILURE(success)) {
++        return;
++    }
++
+     if (scriptListOffset != 0) {
+         scriptListTable = (const ScriptListTable *) (baseAddress + scriptListOffset);
+         langSysTable = scriptListTable->findLanguage(scriptTag, languageTag);
+@@ -177,6 +193,10 @@
+     requiredFeatureIndex = SWAPW(langSysTable->reqFeatureIndex);
+ 
+     lookupSelectArray = LE_NEW_ARRAY(FeatureMask, lookupListCount);
++    if (lookupSelectArray == NULL) {
++        success = LE_MEMORY_ALLOCATION_ERROR;
++        return;
++    }
+ 
+     for (int i = 0; i < lookupListCount; i += 1) {
+         lookupSelectArray[i] = 0;
+@@ -213,6 +233,10 @@
+     }
+ 
+     lookupOrderArray = LE_NEW_ARRAY(le_uint16, featureReferences);
++    if (lookupOrderArray == NULL) {
++        success = LE_MEMORY_ALLOCATION_ERROR;
++        return;
++    }
+ 
+     for (le_int32 f = 0; f < featureMapCount; f += 1) {
+         FeatureMap fm = featureMap[f];
+@@ -302,6 +326,8 @@
+ 
+ LookupProcessor::LookupProcessor()
+ {
++        lookupOrderArray = NULL;
++        lookupSelectArray = NULL;
+ }
+ 
+ LookupProcessor::~LookupProcessor()
+diff --git a/src/share/native/sun/font/layout/LookupProcessor.h b/src/share/native/sun/font/layout/LookupProcessor.h
+--- jdk/src/share/native/sun/font/layout/LookupProcessor.h
++++ jdk/src/share/native/sun/font/layout/LookupProcessor.h
+@@ -26,7 +26,7 @@
+ /*
+  *
+  *
+- * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
++ * (C) Copyright IBM Corp. 1998-2008 - All Rights Reserved
+  *
+  */
+ 
+@@ -59,21 +59,28 @@
+ class LookupProcessor : public UMemory {
+ public:
+     le_int32 process(LEGlyphStorage &glyphStorage, GlyphPositionAdjustments *glyphPositionAdjustments,
+-                 le_bool rightToLeft, const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, const LEFontInstance *fontInstance) const;
++                 le_bool rightToLeft, const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, const LEFontInstance *fontInstance, LEErrorCode& success) const;
+ 
+-    le_uint32 applyLookupTable(const LookupTable *lookupTable, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
++    le_uint32 applyLookupTable(const LookupTable *lookupTable, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const;
+ 
+-    le_uint32 applySingleLookup(le_uint16 lookupTableIndex, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
++    le_uint32 applySingleLookup(le_uint16 lookupTableIndex, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const;
+ 
+     virtual le_uint32 applySubtable(const LookupSubtable *lookupSubtable, le_uint16 subtableType,
+-        GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const = 0;
++        GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const = 0;
+ 
+     virtual ~LookupProcessor();
+ 
+ protected:
+      LookupProcessor(const char *baseAddress,
+-        Offset scriptListOffset, Offset featureListOffset, Offset lookupListOffset,
+-        LETag scriptTag, LETag languageTag, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool orderFeatures);
++        Offset scriptListOffset,
++        Offset featureListOffset,
++        Offset lookupListOffset,
++        LETag scriptTag,
++        LETag languageTag,
++        const FeatureMap *featureMap,
++        le_int32 featureMapCount,
++        le_bool orderFeatures,
++        LEErrorCode& success);
+ 
+    LookupProcessor();
+ 
+diff --git a/src/share/native/sun/font/layout/MPreFixups.cpp b/src/share/native/sun/font/layout/MPreFixups.cpp
+--- jdk/src/share/native/sun/font/layout/MPreFixups.cpp
++++ jdk/src/share/native/sun/font/layout/MPreFixups.cpp
+@@ -25,7 +25,7 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 2002-2004 - All Rights Reserved
++ * (C) Copyright IBM Corp. 2002-2008 - All Rights Reserved
+  *
+  */
+ 
+@@ -65,8 +65,12 @@
+     }
+ }
+ 
+-void MPreFixups::apply(LEGlyphStorage &glyphStorage)
++void MPreFixups::apply(LEGlyphStorage &glyphStorage, LEErrorCode& success)
+ {
++    if (LE_FAILURE(success)) {
++        return;
++    }
++
+     for (le_int32 fixup = 0; fixup < fFixupCount; fixup += 1) {
+         le_int32 baseIndex = fFixupData[fixup].fBaseIndex;
+         le_int32 mpreIndex = fFixupData[fixup].fMPreIndex;
+@@ -90,6 +94,14 @@
+         le_int32   mpreDest  = baseIndex - mpreCount;
+         LEGlyphID *mpreSave  = LE_NEW_ARRAY(LEGlyphID, mpreCount);
+         le_int32  *indexSave = LE_NEW_ARRAY(le_int32, mpreCount);
++
++        if (mpreSave == NULL || indexSave == NULL) {
++            LE_DELETE_ARRAY(mpreSave);
++            LE_DELETE_ARRAY(indexSave);
++            success = LE_MEMORY_ALLOCATION_ERROR;
++            return;
++        }
++
+         le_int32   i;
+ 
+         for (i = 0; i < mpreCount; i += 1) {
+diff --git a/src/share/native/sun/font/layout/MPreFixups.h b/src/share/native/sun/font/layout/MPreFixups.h
+--- jdk/src/share/native/sun/font/layout/MPreFixups.h
++++ jdk/src/share/native/sun/font/layout/MPreFixups.h
+@@ -25,7 +25,7 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 2002-2004 - All Rights Reserved
++ * (C) Copyright IBM Corp. 2002-2008 - All Rights Reserved
+  *
+  */
+ 
+@@ -54,7 +54,7 @@
+ 
+     void add(le_int32 baseIndex, le_int32 mpreIndex);
+ 
+-    void apply(LEGlyphStorage &glyphStorage);
++    void apply(LEGlyphStorage &glyphStorage, LEErrorCode& success);
+ 
+ private:
+     FixupData *fFixupData;
+diff --git a/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp b/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp
+@@ -25,7 +25,7 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved
++ * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved
+  *
+  */
+ 
+@@ -108,11 +108,27 @@
+     glyphIterator->setCurrGlyphBaseOffset(baseIterator.getCurrStreamPosition());
+ 
+     if (glyphIterator->isRightToLeft()) {
++        // FIXME: need similar patch to below; also in MarkToLigature and MarkToMark
++        // (is there a better way to approach this for all the cases?)
+         glyphIterator->setCurrGlyphPositionAdjustment(anchorDiffX, anchorDiffY, -markAdvance.fX, -markAdvance.fY);
+     } else {
+         LEPoint baseAdvance;
+ 
+         fontInstance->getGlyphAdvance(baseGlyph, pixels);
++
++        //JK: adjustment needs to account for non-zero advance of any marks between base glyph and current mark
++        GlyphIterator gi(baseIterator, (le_uint16)0); // copy of baseIterator that won't ignore marks
++        gi.next(); // point beyond the base glyph
++        while (gi.getCurrStreamPosition() < glyphIterator->getCurrStreamPosition()) { // for all intervening glyphs (marks)...
++            LEGlyphID otherMark = gi.getCurrGlyphID();
++            LEPoint px;
++            fontInstance->getGlyphAdvance(otherMark, px); // get advance, in case it's non-zero
++            pixels.fX += px.fX; // and add that to the base glyph's advance
++            pixels.fY += px.fY;
++            gi.next();
++        }
++        // end of JK patch
++
+         fontInstance->pixelsToUnits(pixels, baseAdvance);
+ 
+         glyphIterator->setCurrGlyphPositionAdjustment(anchorDiffX - baseAdvance.fX, anchorDiffY - baseAdvance.fY, -markAdvance.fX, -markAdvance.fY);
+diff --git a/src/share/native/sun/font/layout/MultipleSubstSubtables.cpp b/src/share/native/sun/font/layout/MultipleSubstSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/MultipleSubstSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/MultipleSubstSubtables.cpp
+@@ -25,7 +25,7 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved
++ * (C) Copyright IBM Corp. 1998-2008 - All Rights Reserved
+  *
+  */
+ 
+@@ -39,8 +39,12 @@
+ 
+ U_NAMESPACE_BEGIN
+ 
+-le_uint32 MultipleSubstitutionSubtable::process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const
++le_uint32 MultipleSubstitutionSubtable::process(GlyphIterator *glyphIterator, LEErrorCode& success, const LEGlyphFilter *filter) const
+ {
++    if (LE_FAILURE(success)) {
++        return 0;
++    }
++
+     LEGlyphID glyph = glyphIterator->getCurrGlyphID();
+ 
+     // If there's a filter, we only want to do the
+@@ -87,7 +91,11 @@
+                 }
+             }
+ 
+-            LEGlyphID *newGlyphs = glyphIterator->insertGlyphs(glyphCount);
++            LEGlyphID *newGlyphs = glyphIterator->insertGlyphs(glyphCount, success);
++            if (LE_FAILURE(success)) {
++                return 0;
++            }
++
+             le_int32 insert = 0, direction = 1;
+ 
+             if (glyphIterator->isRightToLeft()) {
+diff --git a/src/share/native/sun/font/layout/MultipleSubstSubtables.h b/src/share/native/sun/font/layout/MultipleSubstSubtables.h
+--- jdk/src/share/native/sun/font/layout/MultipleSubstSubtables.h
++++ jdk/src/share/native/sun/font/layout/MultipleSubstSubtables.h
+@@ -25,7 +25,7 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved
++ * (C) Copyright IBM Corp. 1998-2008 - All Rights Reserved
+  *
+  */
+ 
+@@ -56,7 +56,7 @@
+     le_uint16 sequenceCount;
+     Offset    sequenceTableOffsetArray[ANY_NUMBER];
+ 
+-    le_uint32 process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter = NULL) const;
++    le_uint32 process(GlyphIterator *glyphIterator, LEErrorCode& success, const LEGlyphFilter *filter = NULL) const;
+ };
+ 
+ U_NAMESPACE_END
+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
+@@ -26,7 +26,7 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
++ * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved
+  *
+  */
+ 
+@@ -35,8 +35,10 @@
+ #include "LELanguages.h"
+ 
+ #include "LayoutEngine.h"
++#include "CanonShaping.h"
+ #include "OpenTypeLayoutEngine.h"
+ #include "ScriptAndLanguageTags.h"
++#include "CharSubstitutionFilter.h"
+ 
+ #include "GlyphSubstitutionTables.h"
+ #include "GlyphDefinitionTables.h"
+@@ -47,6 +49,8 @@
+ 
+ #include "GDEFMarkFilter.h"
+ 
++#include "KernTable.h"
++
+ U_NAMESPACE_BEGIN
+ 
+ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(OpenTypeLayoutEngine)
+@@ -57,6 +61,8 @@
+ #define kernFeatureTag LE_KERN_FEATURE_TAG
+ #define markFeatureTag LE_MARK_FEATURE_TAG
+ #define mkmkFeatureTag LE_MKMK_FEATURE_TAG
++#define loclFeatureTag LE_LOCL_FEATURE_TAG
++#define caltFeatureTag LE_CALT_FEATURE_TAG
+ 
+ // 'dlig' not used at the moment
+ #define dligFeatureTag 0x646C6967
+@@ -71,8 +77,10 @@
+ #define paltFeatureMask 0x08000000UL
+ #define markFeatureMask 0x04000000UL
+ #define mkmkFeatureMask 0x02000000UL
++#define loclFeatureMask 0x01000000UL
++#define caltFeatureMask 0x00800000UL
+ 
+-#define minimalFeatures     (ccmpFeatureMask | markFeatureMask | mkmkFeatureMask)
++#define minimalFeatures     (ccmpFeatureMask | markFeatureMask | mkmkFeatureMask | loclFeatureMask | caltFeatureMask)
+ #define ligaFeatures        (ligaFeatureMask | cligFeatureMask | minimalFeatures)
+ #define kernFeatures        (kernFeatureMask | paltFeatureMask | minimalFeatures)
+ #define kernAndLigaFeatures (ligaFeatures    | kernFeatures)
+@@ -85,14 +93,16 @@
+         {kernFeatureTag, kernFeatureMask},
+     {paltFeatureTag, paltFeatureMask},
+     {markFeatureTag, markFeatureMask},
+-    {mkmkFeatureTag, mkmkFeatureMask}
++    {mkmkFeatureTag, mkmkFeatureMask},
++    {loclFeatureTag, loclFeatureMask},
++    {caltFeatureTag, caltFeatureMask}
+ };
+ 
+ static const le_int32 featureMapCount = LE_ARRAY_SIZE(featureMap);
+ 
+ OpenTypeLayoutEngine::OpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                        le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable)
+-    : LayoutEngine(fontInstance, scriptCode, languageCode, typoFlags), fFeatureMask(minimalFeatures),
++                        le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success)
++    : LayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success), fFeatureMask(minimalFeatures),
+       fFeatureMap(featureMap), fFeatureMapCount(featureMapCount), fFeatureOrder(FALSE),
+       fGSUBTable(gsubTable), fGDEFTable(NULL), fGPOSTable(NULL), fSubstitutionFilter(NULL)
+ {
+@@ -102,6 +112,15 @@
+ 
+     applyTypoFlags();
+ 
++    setScriptAndLanguageTags();
++
++    fGDEFTable = (const GlyphDefinitionTableHeader *) getFontTable(gdefTableTag);
++
++// JK patch, 2008-05-30 - see Sinhala bug report and LKLUG font
++//    if (gposTable != NULL && gposTable->coversScriptAndLanguage(fScriptTag, fLangSysTag)) {
++    if (gposTable != NULL && gposTable->coversScript(fScriptTag)) {
++        fGPOSTable = gposTable;
++    }
+ }
+ 
+ void OpenTypeLayoutEngine::applyTypoFlags() {
+@@ -109,7 +128,7 @@
+     const LEFontInstance *fontInstance = fFontInstance;
+ 
+     // todo: switch to more flags and bitfield rather than list of feature tags?
+-    switch (typoFlags) {
++    switch (typoFlags & ~0x80000000L) {
+     case 0: break; // default
+     case 1: fFeatureMask = kernFeatures; break;
+     case 2: fFeatureMask = ligaFeatures; break;
+@@ -117,6 +136,10 @@
+     default: break;
+     }
+ 
++    if (typoFlags & LE_CHAR_FILTER_FEATURE_FLAG) {
++        fSubstitutionFilter = new CharSubstitutionFilter(fontInstance);
++    }
++
+ }
+ 
+ void OpenTypeLayoutEngine::reset()
+@@ -129,8 +152,8 @@
+ }
+ 
+ OpenTypeLayoutEngine::OpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                                           le_int32 typoFlags)
+-    : LayoutEngine(fontInstance, scriptCode, languageCode, typoFlags), fFeatureOrder(FALSE),
++                       le_int32 typoFlags, LEErrorCode &success)
++    : LayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success), fFeatureOrder(FALSE),
+       fGSUBTable(NULL), fGDEFTable(NULL), fGPOSTable(NULL), fSubstitutionFilter(NULL)
+ {
+     applyTypoFlags();
+@@ -151,8 +174,23 @@
+     if (scriptCode < 0 || scriptCode >= scriptCodeCount) {
+         return 0xFFFFFFFF;
+     }
++    return scriptTags[scriptCode];
++}
+ 
+-    return scriptTags[scriptCode];
++LETag OpenTypeLayoutEngine::getV2ScriptTag(le_int32 scriptCode)
++{
++        switch (scriptCode) {
++                case bengScriptCode :    return bng2ScriptTag;
++                case devaScriptCode :    return dev2ScriptTag;
++                case gujrScriptCode :    return gjr2ScriptTag;
++                case guruScriptCode :    return gur2ScriptTag;
++                case kndaScriptCode :    return knd2ScriptTag;
++                case mlymScriptCode :    return mlm2ScriptTag;
++                case oryaScriptCode :    return ory2ScriptTag;
++                case tamlScriptCode :    return tml2ScriptTag;
++                case teluScriptCode :    return tel2ScriptTag;
++                default:                 return nullScriptTag;
++        }
+ }
+ 
+ LETag OpenTypeLayoutEngine::getLangSysTag(le_int32 languageCode)
+@@ -167,6 +205,7 @@
+ void OpenTypeLayoutEngine::setScriptAndLanguageTags()
+ {
+     fScriptTag  = getScriptTag(fScriptCode);
++    fScriptTagV2 = getV2ScriptTag(fScriptCode);
+     fLangSysTag = getLangSysTag(fLanguageCode);
+ }
+ 
+@@ -182,20 +221,39 @@
+         return 0;
+     }
+ 
+-    le_int32 outCharCount = LayoutEngine::characterProcessing(chars, offset, count, max, rightToLeft, outChars, glyphStorage, success);
++    // This is the cheapest way to get mark reordering only for Hebrew.
++    // We could just do the mark reordering for all scripts, but most
++    // of them probably don't need it... Another option would be to
++    // add a HebrewOpenTypeLayoutEngine subclass, but the only thing it
++    // would need to do is mark reordering, so that seems like overkill.
++    if (fScriptCode == hebrScriptCode) {
++        outChars = LE_NEW_ARRAY(LEUnicode, count);
++
++        if (outChars == NULL) {
++            success = LE_MEMORY_ALLOCATION_ERROR;
++            return 0;
++        }
++
++    if (LE_FAILURE(success)) {
++            LE_DELETE_ARRAY(outChars);
++        return 0;
++    }
++
++        CanonShaping::reorderMarks(&chars[offset], count, rightToLeft, outChars, glyphStorage);
++    }
+ 
+     if (LE_FAILURE(success)) {
+         return 0;
+     }
+ 
+-    glyphStorage.allocateGlyphArray(outCharCount, rightToLeft, success);
++    glyphStorage.allocateGlyphArray(count, rightToLeft, success);
+     glyphStorage.allocateAuxData(success);
+ 
+-    for (le_int32 i = 0; i < outCharCount; i += 1) {
++    for (le_int32 i = 0; i < count; i += 1) {
+         glyphStorage.setAuxData(i, fFeatureMask, success);
+     }
+ 
+-    return outCharCount;
++    return count;
+ }
+ 
+ // Input: characters, tags
+@@ -219,13 +277,45 @@
+     }
+ 
+     if (fGSUBTable != NULL) {
++        if (fScriptTagV2 != nullScriptTag && fGSUBTable->coversScriptAndLanguage(fScriptTagV2,fLangSysTag)) {
++            count = fGSUBTable->process(glyphStorage, rightToLeft, fScriptTagV2, fLangSysTag, fGDEFTable, fSubstitutionFilter,
++                                    fFeatureMap, fFeatureMapCount, fFeatureOrder, success);
++
++        } else {
+         count = fGSUBTable->process(glyphStorage, rightToLeft, fScriptTag, fLangSysTag, fGDEFTable, fSubstitutionFilter,
+-                                    fFeatureMap, fFeatureMapCount, fFeatureOrder);
++                                    fFeatureMap, fFeatureMapCount, fFeatureOrder, success);
++    }
+     }
+ 
+     return count;
+ }
++// Input: characters, tags
++// Output: glyphs, char indices
++le_int32 OpenTypeLayoutEngine::glyphSubstitution(le_int32 count, le_int32 max, le_bool rightToLeft,
++                                               LEGlyphStorage &glyphStorage, LEErrorCode &success)
++{
++    if (LE_FAILURE(success)) {
++        return 0;
++    }
+ 
++    if ( count < 0 || max < 0 ) {
++        success = LE_ILLEGAL_ARGUMENT_ERROR;
++        return 0;
++    }
++
++    if (fGSUBTable != NULL) {
++        if (fScriptTagV2 != nullScriptTag && fGSUBTable->coversScriptAndLanguage(fScriptTagV2,fLangSysTag)) {
++            count = fGSUBTable->process(glyphStorage, rightToLeft, fScriptTagV2, fLangSysTag, fGDEFTable, fSubstitutionFilter,
++                                    fFeatureMap, fFeatureMapCount, fFeatureOrder, success);
++
++        } else {
++        count = fGSUBTable->process(glyphStorage, rightToLeft, fScriptTag, fLangSysTag, fGDEFTable, fSubstitutionFilter,
++                                    fFeatureMap, fFeatureMapCount, fFeatureOrder, success);
++        }
++    }
++
++    return count;
++}
+ le_int32 OpenTypeLayoutEngine::glyphPostProcessing(LEGlyphStorage &tempGlyphStorage, LEGlyphStorage &glyphStorage, LEErrorCode &success)
+ {
+     if (LE_FAILURE(success)) {
+@@ -257,6 +347,10 @@
+ 
+     outCharCount = characterProcessing(chars, offset, count, max, rightToLeft, outChars, fakeGlyphStorage, success);
+ 
++    if (LE_FAILURE(success)) {
++        return 0;
++    }
++
+     if (outChars != NULL) {
+         fakeGlyphCount = glyphProcessing(outChars, 0, outCharCount, outCharCount, rightToLeft, fakeGlyphStorage, success);
+         LE_DELETE_ARRAY(outChars); // FIXME: a subclass may have allocated this, in which case this delete might not work...
+@@ -266,6 +360,10 @@
+         //adjustGlyphs(chars, offset, count, rightToLeft, fakeGlyphs, fakeGlyphCount);
+     }
+ 
++    if (LE_FAILURE(success)) {
++        return 0;
++    }
++
+     outGlyphCount = glyphPostProcessing(fakeGlyphStorage, glyphStorage, success);
+ 
+     return outGlyphCount;
+@@ -285,8 +383,11 @@
+     }
+ 
+     le_int32 glyphCount = glyphStorage.getGlyphCount();
++    if (glyphCount == 0) {
++        return;
++    }
+ 
+-    if (glyphCount > 0 && fGPOSTable != NULL) {
++    if (fGPOSTable != NULL) {
+         GlyphPositionAdjustments *adjustments = new GlyphPositionAdjustments(glyphCount);
+         le_int32 i;
+ 
+@@ -309,9 +410,21 @@
+         }
+ #endif
+ 
+-        fGPOSTable->process(glyphStorage, adjustments, reverse, fScriptTag, fLangSysTag, fGDEFTable, fFontInstance,
++        if (fGPOSTable != NULL) {
++            if (fScriptTagV2 != nullScriptTag && fGPOSTable->coversScriptAndLanguage(fScriptTagV2,fLangSysTag)) {
++                fGPOSTable->process(glyphStorage, adjustments, reverse, fScriptTagV2, fLangSysTag, fGDEFTable, success, fFontInstance,
+                             fFeatureMap, fFeatureMapCount, fFeatureOrder);
+ 
++            } else {
++                fGPOSTable->process(glyphStorage, adjustments, reverse, fScriptTag, fLangSysTag, fGDEFTable, success, fFontInstance,
++                                fFeatureMap, fFeatureMapCount, fFeatureOrder);
++            }
++        } else if ( fTypoFlags & 0x1 ) {
++            static const le_uint32 kernTableTag = LE_KERN_TABLE_TAG;
++            KernTable kt(fFontInstance, getFontTable(kernTableTag));
++            kt.process(glyphStorage);
++        }
++
+         float xAdjust = 0, yAdjust = 0;
+ 
+         for (i = 0; i < glyphCount; i += 1) {
+@@ -344,6 +457,21 @@
+         glyphStorage.adjustPosition(glyphCount, xAdjust, -yAdjust, success);
+ 
+         delete adjustments;
++    } else {
++        // if there was no GPOS table, maybe there's non-OpenType kerning we can use
++        LayoutEngine::adjustGlyphPositions(chars, offset, count, reverse, glyphStorage, success);
++    }
++
++    LEGlyphID zwnj  = fFontInstance->mapCharToGlyph(0x200C);
++
++    if (zwnj != 0x0000) {
++        for (le_int32 g = 0; g < glyphCount; g += 1) {
++            LEGlyphID glyph = glyphStorage[g];
++
++            if (glyph == zwnj) {
++                glyphStorage[g] = LE_SET_GLYPH(glyph, 0xFFFF);
++            }
++        }
+     }
+ 
+ #if 0
+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
+@@ -24,7 +24,7 @@
+  */
+ 
+ /*
+- * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
++ * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved
+  *
+  */
+ 
+@@ -67,7 +67,7 @@
+  *
+  * @internal
+  */
+-class OpenTypeLayoutEngine : public LayoutEngine
++class U_LAYOUT_API OpenTypeLayoutEngine : public LayoutEngine
+ {
+ public:
+     /**
+@@ -80,6 +80,7 @@
+      * @param scriptCode - the script
+      * @param langaugeCode - the language
+      * @param gsubTable - the GSUB table
++     * @param success - set to an error code if the operation fails
+      *
+      * @see LayoutEngine::layoutEngineFactory
+      * @see ScriptAndLangaugeTags.h for script and language codes
+@@ -87,7 +88,7 @@
+      * @internal
+      */
+     OpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                            le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable);
++                            le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success);
+ 
+     /**
+      * This constructor is used when the font requires a "canned" GSUB table which can't be known
+@@ -96,11 +97,12 @@
+      * @param fontInstance - the font
+      * @param scriptCode - the script
+      * @param langaugeCode - the language
++     * @param success - set to an error code if the operation fails
+      *
+      * @internal
+      */
+     OpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                         le_int32 typoFlags);
++                         le_int32 typoFlags, LEErrorCode &success);
+ 
+     /**
+      * The destructor, virtual for correct polymorphic invocation.
+@@ -112,6 +114,8 @@
+     /**
+      * A convenience method used to convert the script code into
+      * the four byte script tag required by OpenType.
++         * For Indic languages where multiple script tags exist,
++         * the version 1 (old style) tag is returned.
+      *
+      * @param scriptCode - the script code
+      *
+@@ -120,6 +124,19 @@
+      * @internal
+      */
+     static LETag getScriptTag(le_int32 scriptCode);
++    /**
++     * A convenience method used to convert the script code into
++     * the four byte script tag required by OpenType.
++         * For Indic languages where multiple script tags exist,
++         * the version 2 tag is returned.
++     *
++     * @param scriptCode - the script code
++     *
++     * @return the four byte script tag
++     *
++     * @internal
++     */
++    static LETag getV2ScriptTag(le_int32 scriptCode);
+ 
+     /**
+      * A convenience method used to convert the langauge code into
+@@ -147,6 +164,13 @@
+      */
+     static UClassID getStaticClassID();
+ 
++    /**
++     * The array of language tags, indexed by language code.
++     *
++     * @internal
++     */
++    static const LETag languageTags[];
++
+ private:
+ 
+     /**
+@@ -161,11 +185,6 @@
+     static const LETag scriptTags[];
+ 
+     /**
+-     * The array of language tags, indexed by language code.
+-     */
+-    static const LETag languageTags[];
+-
+-    /**
+      * apply the typoflags. Only called by the c'tors.
+      */
+     void applyTypoFlags();
+@@ -243,6 +262,13 @@
+     LETag fScriptTag;
+ 
+     /**
++     * The four byte script tag for V2 fonts.
++     *
++     * @internal
++     */
++    LETag fScriptTagV2;
++
++    /**
+      * The four byte language tag
+      *
+      * @internal
+@@ -309,6 +335,8 @@
+     virtual le_int32 glyphProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
+             LEGlyphStorage &glyphStorage, LEErrorCode &success);
+ 
++    virtual le_int32 glyphSubstitution(le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success);
++
+     /**
+      * This method does any processing necessary to convert "fake"
+      * glyph indices used by the glyphProcessing method into "real" glyph
+diff --git a/src/share/native/sun/font/layout/OpenTypeTables.h b/src/share/native/sun/font/layout/OpenTypeTables.h
+--- jdk/src/share/native/sun/font/layout/OpenTypeTables.h
++++ jdk/src/share/native/sun/font/layout/OpenTypeTables.h
+@@ -25,7 +25,7 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
++ * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved
+  *
+  */
+ 
+@@ -46,6 +46,8 @@
+ typedef le_uint16 Offset;
+ typedef le_uint8  ATag[4];
+ typedef le_uint32 fixed32;
++
++#define LE_GLYPH_GROUP_MASK 0x00000001UL
+ typedef le_uint32 FeatureMask;
+ 
+ #define SWAPT(atag) ((LETag) ((atag[0] << 24) + (atag[1] << 16) + (atag[2] << 8) + atag[3]))
+diff --git a/src/share/native/sun/font/layout/OpenTypeUtilities.cpp b/src/share/native/sun/font/layout/OpenTypeUtilities.cpp
+--- jdk/src/share/native/sun/font/layout/OpenTypeUtilities.cpp
++++ jdk/src/share/native/sun/font/layout/OpenTypeUtilities.cpp
+@@ -25,7 +25,7 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved
++ * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved
+  *
+  */
+ 
+@@ -111,6 +111,10 @@
+     le_int32 probe = power;
+     le_int32 range = 0;
+ 
++        if (recordCount == 0) {
++                return -1;
++        }
++
+     if (SWAPW(records[extra].firstGlyph) <= glyphID) {
+         range = extra;
+     }
+diff --git a/src/share/native/sun/font/layout/PairPositioningSubtables.cpp b/src/share/native/sun/font/layout/PairPositioningSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/PairPositioningSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/PairPositioningSubtables.cpp
+@@ -101,7 +101,10 @@
+             valueRecord2->adjustPosition(SWAPW(valueFormat2), (char *) this, *glyphIterator, fontInstance);
+         }
+ 
+-        return 2;
++        // back up glyphIterator so second glyph can be
++        // first glyph in the next pair
++        glyphIterator->prev();
++        return 1;
+     }
+ 
+     return 0;
+@@ -137,7 +140,10 @@
+             valueRecord2->adjustPosition(SWAPW(valueFormat2), (const char *) this, *glyphIterator, fontInstance);
+         }
+ 
+-        return 2;
++        // back up glyphIterator so second glyph can be
++        // first glyph in the next pair
++        glyphIterator->prev();
++        return 1;
+     }
+ 
+     return 0;
+@@ -145,6 +151,20 @@
+ 
+ const PairValueRecord *PairPositioningFormat1Subtable::findPairValueRecord(TTGlyphID glyphID, const PairValueRecord *records, le_uint16 recordCount, le_uint16 recordSize) const
+ {
++#if 1
++        // The OpenType spec. says that the ValueRecord table is
++        // sorted by secondGlyph. Unfortunately, there are fonts
++        // around that have an unsorted ValueRecord table.
++        const PairValueRecord *record = records;
++
++        for(le_int32 r = 0; r < recordCount; r += 1) {
++                if (SWAPW(record->secondGlyph) == glyphID) {
++                        return record;
++                }
++
++                record = (const PairValueRecord *) ((char *) record + recordSize);
++        }
++#else
+     le_uint8 bit = OpenTypeUtilities::highBit(recordCount);
+     le_uint16 power = 1 << bit;
+     le_uint16 extra = (recordCount - power) * recordSize;
+@@ -168,6 +188,7 @@
+     if (SWAPW(record->secondGlyph) == glyphID) {
+         return record;
+     }
++#endif
+ 
+     return NULL;
+ }
+diff --git a/src/share/native/sun/font/layout/ScriptAndLanguage.cpp b/src/share/native/sun/font/layout/ScriptAndLanguage.cpp
+--- jdk/src/share/native/sun/font/layout/ScriptAndLanguage.cpp
++++ jdk/src/share/native/sun/font/layout/ScriptAndLanguage.cpp
+@@ -26,7 +26,7 @@
+ /*
+  *
+  *
+- * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved
++ * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved
+  *
+  */
+ 
+@@ -56,20 +56,45 @@
+         return (const LangSysTable *) ((char *)this + langSysTableOffset);
+     }
+ 
+-    return 0;
++    return NULL;
+ }
+ 
+ const ScriptTable *ScriptListTable::findScript(LETag scriptTag) const
+ {
++    /*
++     * There are some fonts that have a large, bogus value for scriptCount. To try
++     * and protect against this, we use the offset in the first scriptRecord,
++     * which we know has to be past the end of the scriptRecordArray, to compute
++     * a value which is greater than or equal to the actual script count.
++     *
++     * Note: normally, the first offset will point to just after the scriptRecordArray,
++     * but there's no guarantee of this, only that it's *after* the scriptRecordArray.
++     * Because of this, a binary serach isn't safe, because the new count may include
++     * data that's not actually in the scriptRecordArray and hence the array will appear
++     * to be unsorted.
++     */
+     le_uint16 count = SWAPW(scriptCount);
+-    Offset scriptTableOffset =
+-        OpenTypeUtilities::getTagOffset(scriptTag, scriptRecordArray, count);
++    le_uint16 limit = ((SWAPW(scriptRecordArray[0].offset) - sizeof(ScriptListTable)) / sizeof(scriptRecordArray)) + ANY_NUMBER;
++    Offset scriptTableOffset = 0;
++
++    if (count > limit) {
++        // the scriptCount value is bogus; do a linear search
++        // because limit may still be too large.
++        for(le_int32 s = 0; s < limit; s += 1) {
++            if (SWAPT(scriptRecordArray[s].tag) == scriptTag) {
++                scriptTableOffset = SWAPW(scriptRecordArray[s].offset);
++                break;
++            }
++        }
++    } else {
++        scriptTableOffset = OpenTypeUtilities::getTagOffset(scriptTag, scriptRecordArray, count);
++    }
+ 
+     if (scriptTableOffset != 0) {
+         return (const ScriptTable *) ((char *)this + scriptTableOffset);
+     }
+ 
+-    return 0;
++    return NULL;
+ }
+ 
+ const LangSysTable *ScriptListTable::findLanguage(LETag scriptTag, LETag languageTag, le_bool exactMatch) const
+@@ -77,7 +102,7 @@
+     const ScriptTable *scriptTable = findScript(scriptTag);
+ 
+     if (scriptTable == 0) {
+-        return 0;
++        return NULL;
+     }
+ 
+     return scriptTable->findLanguage(languageTag, exactMatch);
+diff --git a/src/share/native/sun/font/layout/ScriptAndLanguageTags.cpp b/src/share/native/sun/font/layout/ScriptAndLanguageTags.cpp
+--- jdk/src/share/native/sun/font/layout/ScriptAndLanguageTags.cpp
++++ jdk/src/share/native/sun/font/layout/ScriptAndLanguageTags.cpp
+@@ -25,10 +25,12 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 1998-2004. All Rights Reserved.
++ * (C) Copyright IBM Corp. 1998-2010. All Rights Reserved.
+  *
+  * WARNING: THIS FILE IS MACHINE GENERATED. DO NOT HAND EDIT IT UNLESS
+  * YOU REALLY KNOW WHAT YOU'RE DOING.
++ *
++ * Generated on: 10/26/2010 02:53:33 PM PDT
+  */
+ 
+ #include "LETypes.h"
+@@ -39,13 +41,13 @@
+ 
+ const LETag OpenTypeLayoutEngine::scriptTags[] = {
+     zyyyScriptTag, /* 'zyyy' (COMMON) */
+-    qaaiScriptTag, /* 'qaai' (INHERITED) */
++    zinhScriptTag, /* 'zinh' (INHERITED) */
+     arabScriptTag, /* 'arab' (ARABIC) */
+     armnScriptTag, /* 'armn' (ARMENIAN) */
+     bengScriptTag, /* 'beng' (BENGALI) */
+     bopoScriptTag, /* 'bopo' (BOPOMOFO) */
+     cherScriptTag, /* 'cher' (CHEROKEE) */
+-    qaacScriptTag, /* 'qaac' (COPTIC) */
++    coptScriptTag, /* 'copt' (COPTIC) */
+     cyrlScriptTag, /* 'cyrl' (CYRILLIC) */
+     dsrtScriptTag, /* 'dsrt' (DESERET) */
+     devaScriptTag, /* 'deva' (DEVANAGARI) */
+@@ -62,7 +64,7 @@
+     kndaScriptTag, /* 'knda' (KANNADA) */
+     kanaScriptTag, /* 'kana' (KATAKANA) */
+     khmrScriptTag, /* 'khmr' (KHMER) */
+-    laooScriptTag, /* 'laoo' (LAO) */
++    laooScriptTag, /* 'lao ' (LAO) */
+     latnScriptTag, /* 'latn' (LATIN) */
+     mlymScriptTag, /* 'mlym' (MALAYALAM) */
+     mongScriptTag, /* 'mong' (MONGOLIAN) */
+@@ -79,7 +81,7 @@
+     thaiScriptTag, /* 'thai' (THAI) */
+     tibtScriptTag, /* 'tibt' (TIBETAN) */
+     cansScriptTag, /* 'cans' (CANADIAN_ABORIGINAL) */
+-    yiiiScriptTag, /* 'yiii' (YI) */
++    yiiiScriptTag, /* 'yi  ' (YI) */
+     tglgScriptTag, /* 'tglg' (TAGALOG) */
+     hanoScriptTag, /* 'hano' (HANUNOO) */
+     buhdScriptTag, /* 'buhd' (BUHID) */
+@@ -92,7 +94,99 @@
+     shawScriptTag, /* 'shaw' (SHAVIAN) */
+     taleScriptTag, /* 'tale' (TAI_LE) */
+     ugarScriptTag, /* 'ugar' (UGARITIC) */
+-    hrktScriptTag  /* 'hrkt' (KATAKANA_OR_HIRAGANA) */
++    hrktScriptTag, /* 'hrkt' (KATAKANA_OR_HIRAGANA) */
++    bugiScriptTag, /* 'bugi' (BUGINESE) */
++    glagScriptTag, /* 'glag' (GLAGOLITIC) */
++    kharScriptTag, /* 'khar' (KHAROSHTHI) */
++    syloScriptTag, /* 'sylo' (SYLOTI_NAGRI) */
++    taluScriptTag, /* 'talu' (NEW_TAI_LUE) */
++    tfngScriptTag, /* 'tfng' (TIFINAGH) */
++    xpeoScriptTag, /* 'xpeo' (OLD_PERSIAN) */
++    baliScriptTag, /* 'bali' (BALINESE) */
++    batkScriptTag, /* 'batk' (BATAK) */
++    blisScriptTag, /* 'blis' (BLIS) */
++    brahScriptTag, /* 'brah' (BRAHMI) */
++    chamScriptTag, /* 'cham' (CHAM) */
++    cirtScriptTag, /* 'cirt' (CIRT) */
++    cyrsScriptTag, /* 'cyrs' (CYRS) */
++    egydScriptTag, /* 'egyd' (EGYD) */
++    egyhScriptTag, /* 'egyh' (EGYH) */
++    egypScriptTag, /* 'egyp' (EGYPTIAN_HIEROGLYPHS) */
++    geokScriptTag, /* 'geok' (GEOK) */
++    hansScriptTag, /* 'hans' (HANS) */
++    hantScriptTag, /* 'hant' (HANT) */
++    hmngScriptTag, /* 'hmng' (HMNG) */
++    hungScriptTag, /* 'hung' (HUNG) */
++    indsScriptTag, /* 'inds' (INDS) */
++    javaScriptTag, /* 'java' (JAVANESE) */
++    kaliScriptTag, /* 'kali' (KAYAH_LI) */
++    latfScriptTag, /* 'latf' (LATF) */
++    latgScriptTag, /* 'latg' (LATG) */
++    lepcScriptTag, /* 'lepc' (LEPCHA) */
++    linaScriptTag, /* 'lina' (LINA) */
++    mandScriptTag, /* 'mand' (MANDAIC) */
++    mayaScriptTag, /* 'maya' (MAYA) */
++    meroScriptTag, /* 'mero' (MERO) */
++    nkooScriptTag, /* 'nko ' (NKO) */
++    orkhScriptTag, /* 'orkh' (OLD_TURKIC) */
++    permScriptTag, /* 'perm' (PERM) */
++    phagScriptTag, /* 'phag' (PHAGS_PA) */
++    phnxScriptTag, /* 'phnx' (PHOENICIAN) */
++    plrdScriptTag, /* 'plrd' (PLRD) */
++    roroScriptTag, /* 'roro' (RORO) */
++    saraScriptTag, /* 'sara' (SARA) */
++    syreScriptTag, /* 'syre' (SYRE) */
++    syrjScriptTag, /* 'syrj' (SYRJ) */
++    syrnScriptTag, /* 'syrn' (SYRN) */
++    tengScriptTag, /* 'teng' (TENG) */
++    vaiiScriptTag, /* 'vai ' (VAI) */
++    vispScriptTag, /* 'visp' (VISP) */
++    xsuxScriptTag, /* 'xsux' (CUNEIFORM) */
++    zxxxScriptTag, /* 'zxxx' (ZXXX) */
++    zzzzScriptTag, /* 'zzzz' (UNKNOWN) */
++    cariScriptTag, /* 'cari' (CARIAN) */
++    jpanScriptTag, /* 'jpan' (JPAN) */
++    lanaScriptTag, /* 'lana' (TAI_THAM) */
++    lyciScriptTag, /* 'lyci' (LYCIAN) */
++    lydiScriptTag, /* 'lydi' (LYDIAN) */
++    olckScriptTag, /* 'olck' (OL_CHIKI) */
++    rjngScriptTag, /* 'rjng' (REJANG) */
++    saurScriptTag, /* 'saur' (SAURASHTRA) */
++    sgnwScriptTag, /* 'sgnw' (SGNW) */
++    sundScriptTag, /* 'sund' (SUNDANESE) */
++    moonScriptTag, /* 'moon' (MOON) */
++    mteiScriptTag, /* 'mtei' (MEETEI_MAYEK) */
++    armiScriptTag, /* 'armi' (IMPERIAL_ARAMAIC) */
++    avstScriptTag, /* 'avst' (AVESTAN) */
++    cakmScriptTag, /* 'cakm' (CAKM) */
++    koreScriptTag, /* 'kore' (KORE) */
++    kthiScriptTag, /* 'kthi' (KAITHI) */
++    maniScriptTag, /* 'mani' (MANI) */
++    phliScriptTag, /* 'phli' (INSCRIPTIONAL_PAHLAVI) */
++    phlpScriptTag, /* 'phlp' (PHLP) */
++    phlvScriptTag, /* 'phlv' (PHLV) */
++    prtiScriptTag, /* 'prti' (INSCRIPTIONAL_PARTHIAN) */
++    samrScriptTag, /* 'samr' (SAMARITAN) */
++    tavtScriptTag, /* 'tavt' (TAI_VIET) */
++    zmthScriptTag, /* 'zmth' (ZMTH) */
++    zsymScriptTag, /* 'zsym' (ZSYM) */
++    bamuScriptTag, /* 'bamu' (BAMUM) */
++    lisuScriptTag, /* 'lisu' (LISU) */
++    nkgbScriptTag, /* 'nkgb' (NKGB) */
++    sarbScriptTag, /* 'sarb' (OLD_SOUTH_ARABIAN) */
++    bassScriptTag, /* 'bass' (BASS) */
++    duplScriptTag, /* 'dupl' (DUPL) */
++    elbaScriptTag, /* 'elba' (ELBA) */
++    granScriptTag, /* 'gran' (GRAN) */
++    kpelScriptTag, /* 'kpel' (KPEL) */
++    lomaScriptTag, /* 'loma' (LOMA) */
++    mendScriptTag, /* 'mend' (MEND) */
++    mercScriptTag, /* 'merc' (MERC) */
++    narbScriptTag, /* 'narb' (NARB) */
++    nbatScriptTag, /* 'nbat' (NBAT) */
++    palmScriptTag, /* 'palm' (PALM) */
++    sindScriptTag, /* 'sind' (SIND) */
++    waraScriptTag  /* 'wara' (WARA) */
+ };
+ 
+ const LETag OpenTypeLayoutEngine::languageTags[] = {
+@@ -125,7 +219,49 @@
+     urdLanguageTag, /* 'URD' (Urdu) */
+     zhpLanguageTag, /* 'ZHP' (Chinese (Phonetic)) */
+     zhsLanguageTag, /* 'ZHS' (Chinese (Simplified)) */
+-    zhtLanguageTag  /* 'ZHT' (Chinese (Traditional)) */
++    zhtLanguageTag, /* 'ZHT' (Chinese (Traditional)) */
++    afkLanguageTag, /* 'AFK' (Afrikaans) */
++    belLanguageTag, /* 'BEL' (Belarussian) */
++    bgrLanguageTag, /* 'BGR' (Bulgarian) */
++    catLanguageTag, /* 'CAT' (Catalan) */
++    cheLanguageTag, /* 'CHE' (Chechen) */
++    copLanguageTag, /* 'COP' (Coptic) */
++    csyLanguageTag, /* 'CSY' (Czech) */
++    danLanguageTag, /* 'DAN' (Danish) */
++    deuLanguageTag, /* 'DEU' (German) */
++    dznLanguageTag, /* 'DZN' (Dzongkha) */
++    ellLanguageTag, /* 'ELL' (Greek) */
++    engLanguageTag, /* 'ENG' (English) */
++    espLanguageTag, /* 'ESP' (Spanish) */
++    etiLanguageTag, /* 'ETI' (Estonian) */
++    euqLanguageTag, /* 'EUQ' (Basque) */
++    finLanguageTag, /* 'FIN' (Finnish) */
++    fraLanguageTag, /* 'FRA' (French) */
++    gaeLanguageTag, /* 'GAE' (Gaelic) */
++    hauLanguageTag, /* 'HAU' (Hausa) */
++    hrvLanguageTag, /* 'HRV' (Croation) */
++    hunLanguageTag, /* 'HUN' (Hungarian) */
++    hyeLanguageTag, /* 'HYE' (Armenian) */
++    indLanguageTag, /* 'IND' (Indonesian) */
++    itaLanguageTag, /* 'ITA' (Italian) */
++    khmLanguageTag, /* 'KHM' (Khmer) */
++    mngLanguageTag, /* 'MNG' (Mongolian) */
++    mtsLanguageTag, /* 'MTS' (Maltese) */
++    nepLanguageTag, /* 'NEP' (Nepali) */
++    nldLanguageTag, /* 'NLD' (Dutch) */
++    pasLanguageTag, /* 'PAS' (Pashto) */
++    plkLanguageTag, /* 'PLK' (Polish) */
++    ptgLanguageTag, /* 'PTG' (Portuguese) */
++    romLanguageTag, /* 'ROM' (Romanian) */
++    rusLanguageTag, /* 'RUS' (Russian) */
++    skyLanguageTag, /* 'SKY' (Slovak) */
++    slvLanguageTag, /* 'SLV' (Slovenian) */
++    sqiLanguageTag, /* 'SQI' (Albanian) */
++    srbLanguageTag, /* 'SRB' (Serbian) */
++    sveLanguageTag, /* 'SVE' (Swedish) */
++    tibLanguageTag, /* 'TIB' (Tibetan) */
++    trkLanguageTag, /* 'TRK' (Turkish) */
++    welLanguageTag  /* 'WEL' (Welsh) */
+ };
+ 
+ U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/ScriptAndLanguageTags.h b/src/share/native/sun/font/layout/ScriptAndLanguageTags.h
+--- jdk/src/share/native/sun/font/layout/ScriptAndLanguageTags.h
++++ jdk/src/share/native/sun/font/layout/ScriptAndLanguageTags.h
+@@ -25,10 +25,12 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 1998-2004. All Rights Reserved.
++ * (C) Copyright IBM Corp. 1998-2010. All Rights Reserved.
+  *
+  * WARNING: THIS FILE IS MACHINE GENERATED. DO NOT HAND EDIT IT UNLESS
+  * YOU REALLY KNOW WHAT YOU'RE DOING.
++ *
++ * Generated on: 10/26/2010 02:53:33 PM PDT
+  */
+ 
+ #ifndef __SCRIPTANDLANGUAGES_H
+@@ -36,55 +38,64 @@
+ 
+ #include "LETypes.h"
+ 
+-U_NAMESPACE_BEGIN
+-
+ /**
+  * \file
+  * \internal
+  */
+ 
++U_NAMESPACE_BEGIN
++
+ const LETag zyyyScriptTag = 0x7A797979; /* 'zyyy' (COMMON) */
+-const LETag qaaiScriptTag = 0x71616169; /* 'qaai' (INHERITED) */
++const LETag zinhScriptTag = 0x7A696E68; /* 'zinh' (INHERITED) */
+ const LETag arabScriptTag = 0x61726162; /* 'arab' (ARABIC) */
+ const LETag armnScriptTag = 0x61726D6E; /* 'armn' (ARMENIAN) */
+ const LETag bengScriptTag = 0x62656E67; /* 'beng' (BENGALI) */
++const LETag bng2ScriptTag = 0x626E6732; /* 'bng2' (BENGALI v.2) (manually added) */
+ const LETag bopoScriptTag = 0x626F706F; /* 'bopo' (BOPOMOFO) */
+ const LETag cherScriptTag = 0x63686572; /* 'cher' (CHEROKEE) */
+-const LETag qaacScriptTag = 0x71616163; /* 'qaac' (COPTIC) */
++const LETag coptScriptTag = 0x636F7074; /* 'copt' (COPTIC) */
+ const LETag cyrlScriptTag = 0x6379726C; /* 'cyrl' (CYRILLIC) */
+ const LETag dsrtScriptTag = 0x64737274; /* 'dsrt' (DESERET) */
+ const LETag devaScriptTag = 0x64657661; /* 'deva' (DEVANAGARI) */
++const LETag dev2ScriptTag = 0x64657632; /* 'dev2' (DEVANAGARI v.2) (manually added) */
+ const LETag ethiScriptTag = 0x65746869; /* 'ethi' (ETHIOPIC) */
+ const LETag georScriptTag = 0x67656F72; /* 'geor' (GEORGIAN) */
+ const LETag gothScriptTag = 0x676F7468; /* 'goth' (GOTHIC) */
+ const LETag grekScriptTag = 0x6772656B; /* 'grek' (GREEK) */
+ const LETag gujrScriptTag = 0x67756A72; /* 'gujr' (GUJARATI) */
++const LETag gjr2ScriptTag = 0x676A7232; /* 'gjr2' (GUJARATI v.2) (manually added) */
+ const LETag guruScriptTag = 0x67757275; /* 'guru' (GURMUKHI) */
++const LETag gur2ScriptTag = 0x67757232; /* 'gur2' (GURMUKHI v.2) (manually added) */
+ const LETag haniScriptTag = 0x68616E69; /* 'hani' (HAN) */
+ const LETag hangScriptTag = 0x68616E67; /* 'hang' (HANGUL) */
+ const LETag hebrScriptTag = 0x68656272; /* 'hebr' (HEBREW) */
+ const LETag hiraScriptTag = 0x68697261; /* 'hira' (HIRAGANA) */
+ const LETag kndaScriptTag = 0x6B6E6461; /* 'knda' (KANNADA) */
++const LETag knd2ScriptTag = 0x6B6E6432; /* 'knd2' (KANNADA v.2) (manually added) */
+ const LETag kanaScriptTag = 0x6B616E61; /* 'kana' (KATAKANA) */
+ const LETag khmrScriptTag = 0x6B686D72; /* 'khmr' (KHMER) */
+-const LETag laooScriptTag = 0x6C616F6F; /* 'laoo' (LAO) */
++const LETag laooScriptTag = 0x6C616F20; /* 'lao ' (LAO) */
+ const LETag latnScriptTag = 0x6C61746E; /* 'latn' (LATIN) */
+ const LETag mlymScriptTag = 0x6D6C796D; /* 'mlym' (MALAYALAM) */
++const LETag mlm2ScriptTag = 0x6D6C6D32; /* 'mlm2' (MALAYALAM v.2) (manually added) */
+ const LETag mongScriptTag = 0x6D6F6E67; /* 'mong' (MONGOLIAN) */
+ const LETag mymrScriptTag = 0x6D796D72; /* 'mymr' (MYANMAR) */
+ const LETag ogamScriptTag = 0x6F67616D; /* 'ogam' (OGHAM) */
+ const LETag italScriptTag = 0x6974616C; /* 'ital' (OLD_ITALIC) */
+ const LETag oryaScriptTag = 0x6F727961; /* 'orya' (ORIYA) */
++const LETag ory2ScriptTag = 0x6F727932; /* 'ory2' (ORIYA v.2) (manually added) */
+ const LETag runrScriptTag = 0x72756E72; /* 'runr' (RUNIC) */
+ const LETag sinhScriptTag = 0x73696E68; /* 'sinh' (SINHALA) */
+ const LETag syrcScriptTag = 0x73797263; /* 'syrc' (SYRIAC) */
+ const LETag tamlScriptTag = 0x74616D6C; /* 'taml' (TAMIL) */
++const LETag tml2ScriptTag = 0x746D6C32; /* 'tml2' (TAMIL v.2) (manually added) */
+ const LETag teluScriptTag = 0x74656C75; /* 'telu' (TELUGU) */
++const LETag tel2ScriptTag = 0x74656C32; /* 'tel2' (TELUGU v.2) (manually added) */
+ const LETag thaaScriptTag = 0x74686161; /* 'thaa' (THAANA) */
+ const LETag thaiScriptTag = 0x74686169; /* 'thai' (THAI) */
+ const LETag tibtScriptTag = 0x74696274; /* 'tibt' (TIBETAN) */
+ const LETag cansScriptTag = 0x63616E73; /* 'cans' (CANADIAN_ABORIGINAL) */
+-const LETag yiiiScriptTag = 0x79696969; /* 'yiii' (YI) */
++const LETag yiiiScriptTag = 0x79692020; /* 'yi  ' (YI) */
+ const LETag tglgScriptTag = 0x74676C67; /* 'tglg' (TAGALOG) */
+ const LETag hanoScriptTag = 0x68616E6F; /* 'hano' (HANUNOO) */
+ const LETag buhdScriptTag = 0x62756864; /* 'buhd' (BUHID) */
+@@ -98,6 +109,98 @@
+ const LETag taleScriptTag = 0x74616C65; /* 'tale' (TAI_LE) */
+ const LETag ugarScriptTag = 0x75676172; /* 'ugar' (UGARITIC) */
+ const LETag hrktScriptTag = 0x68726B74; /* 'hrkt' (KATAKANA_OR_HIRAGANA) */
++const LETag bugiScriptTag = 0x62756769; /* 'bugi' (BUGINESE) */
++const LETag glagScriptTag = 0x676C6167; /* 'glag' (GLAGOLITIC) */
++const LETag kharScriptTag = 0x6B686172; /* 'khar' (KHAROSHTHI) */
++const LETag syloScriptTag = 0x73796C6F; /* 'sylo' (SYLOTI_NAGRI) */
++const LETag taluScriptTag = 0x74616C75; /* 'talu' (NEW_TAI_LUE) */
++const LETag tfngScriptTag = 0x74666E67; /* 'tfng' (TIFINAGH) */
++const LETag xpeoScriptTag = 0x7870656F; /* 'xpeo' (OLD_PERSIAN) */
++const LETag baliScriptTag = 0x62616C69; /* 'bali' (BALINESE) */
++const LETag batkScriptTag = 0x6261746B; /* 'batk' (BATAK) */
++const LETag blisScriptTag = 0x626C6973; /* 'blis' (BLIS) */
++const LETag brahScriptTag = 0x62726168; /* 'brah' (BRAHMI) */
++const LETag chamScriptTag = 0x6368616D; /* 'cham' (CHAM) */
++const LETag cirtScriptTag = 0x63697274; /* 'cirt' (CIRT) */
++const LETag cyrsScriptTag = 0x63797273; /* 'cyrs' (CYRS) */
++const LETag egydScriptTag = 0x65677964; /* 'egyd' (EGYD) */
++const LETag egyhScriptTag = 0x65677968; /* 'egyh' (EGYH) */
++const LETag egypScriptTag = 0x65677970; /* 'egyp' (EGYPTIAN_HIEROGLYPHS) */
++const LETag geokScriptTag = 0x67656F6B; /* 'geok' (GEOK) */
++const LETag hansScriptTag = 0x68616E73; /* 'hans' (HANS) */
++const LETag hantScriptTag = 0x68616E74; /* 'hant' (HANT) */
++const LETag hmngScriptTag = 0x686D6E67; /* 'hmng' (HMNG) */
++const LETag hungScriptTag = 0x68756E67; /* 'hung' (HUNG) */
++const LETag indsScriptTag = 0x696E6473; /* 'inds' (INDS) */
++const LETag javaScriptTag = 0x6A617661; /* 'java' (JAVANESE) */
++const LETag kaliScriptTag = 0x6B616C69; /* 'kali' (KAYAH_LI) */
++const LETag latfScriptTag = 0x6C617466; /* 'latf' (LATF) */
++const LETag latgScriptTag = 0x6C617467; /* 'latg' (LATG) */
++const LETag lepcScriptTag = 0x6C657063; /* 'lepc' (LEPCHA) */
++const LETag linaScriptTag = 0x6C696E61; /* 'lina' (LINA) */
++const LETag mandScriptTag = 0x6D616E64; /* 'mand' (MANDAIC) */
++const LETag mayaScriptTag = 0x6D617961; /* 'maya' (MAYA) */
++const LETag meroScriptTag = 0x6D65726F; /* 'mero' (MERO) */
++const LETag nkooScriptTag = 0x6E6B6F20; /* 'nko ' (NKO) */
++const LETag orkhScriptTag = 0x6F726B68; /* 'orkh' (OLD_TURKIC) */
++const LETag permScriptTag = 0x7065726D; /* 'perm' (PERM) */
++const LETag phagScriptTag = 0x70686167; /* 'phag' (PHAGS_PA) */
++const LETag phnxScriptTag = 0x70686E78; /* 'phnx' (PHOENICIAN) */
++const LETag plrdScriptTag = 0x706C7264; /* 'plrd' (PLRD) */
++const LETag roroScriptTag = 0x726F726F; /* 'roro' (RORO) */
++const LETag saraScriptTag = 0x73617261; /* 'sara' (SARA) */
++const LETag syreScriptTag = 0x73797265; /* 'syre' (SYRE) */
++const LETag syrjScriptTag = 0x7379726A; /* 'syrj' (SYRJ) */
++const LETag syrnScriptTag = 0x7379726E; /* 'syrn' (SYRN) */
++const LETag tengScriptTag = 0x74656E67; /* 'teng' (TENG) */
++const LETag vaiiScriptTag = 0x76616920; /* 'vai ' (VAI) */
++const LETag vispScriptTag = 0x76697370; /* 'visp' (VISP) */
++const LETag xsuxScriptTag = 0x78737578; /* 'xsux' (CUNEIFORM) */
++const LETag zxxxScriptTag = 0x7A787878; /* 'zxxx' (ZXXX) */
++const LETag zzzzScriptTag = 0x7A7A7A7A; /* 'zzzz' (UNKNOWN) */
++const LETag cariScriptTag = 0x63617269; /* 'cari' (CARIAN) */
++const LETag jpanScriptTag = 0x6A70616E; /* 'jpan' (JPAN) */
++const LETag lanaScriptTag = 0x6C616E61; /* 'lana' (TAI_THAM) */
++const LETag lyciScriptTag = 0x6C796369; /* 'lyci' (LYCIAN) */
++const LETag lydiScriptTag = 0x6C796469; /* 'lydi' (LYDIAN) */
++const LETag olckScriptTag = 0x6F6C636B; /* 'olck' (OL_CHIKI) */
++const LETag rjngScriptTag = 0x726A6E67; /* 'rjng' (REJANG) */
++const LETag saurScriptTag = 0x73617572; /* 'saur' (SAURASHTRA) */
++const LETag sgnwScriptTag = 0x73676E77; /* 'sgnw' (SGNW) */
++const LETag sundScriptTag = 0x73756E64; /* 'sund' (SUNDANESE) */
++const LETag moonScriptTag = 0x6D6F6F6E; /* 'moon' (MOON) */
++const LETag mteiScriptTag = 0x6D746569; /* 'mtei' (MEETEI_MAYEK) */
++const LETag armiScriptTag = 0x61726D69; /* 'armi' (IMPERIAL_ARAMAIC) */
++const LETag avstScriptTag = 0x61767374; /* 'avst' (AVESTAN) */
++const LETag cakmScriptTag = 0x63616B6D; /* 'cakm' (CAKM) */
++const LETag koreScriptTag = 0x6B6F7265; /* 'kore' (KORE) */
++const LETag kthiScriptTag = 0x6B746869; /* 'kthi' (KAITHI) */
++const LETag maniScriptTag = 0x6D616E69; /* 'mani' (MANI) */
++const LETag phliScriptTag = 0x70686C69; /* 'phli' (INSCRIPTIONAL_PAHLAVI) */
++const LETag phlpScriptTag = 0x70686C70; /* 'phlp' (PHLP) */
++const LETag phlvScriptTag = 0x70686C76; /* 'phlv' (PHLV) */
++const LETag prtiScriptTag = 0x70727469; /* 'prti' (INSCRIPTIONAL_PARTHIAN) */
++const LETag samrScriptTag = 0x73616D72; /* 'samr' (SAMARITAN) */
++const LETag tavtScriptTag = 0x74617674; /* 'tavt' (TAI_VIET) */
++const LETag zmthScriptTag = 0x7A6D7468; /* 'zmth' (ZMTH) */
++const LETag zsymScriptTag = 0x7A73796D; /* 'zsym' (ZSYM) */
++const LETag bamuScriptTag = 0x62616D75; /* 'bamu' (BAMUM) */
++const LETag lisuScriptTag = 0x6C697375; /* 'lisu' (LISU) */
++const LETag nkgbScriptTag = 0x6E6B6762; /* 'nkgb' (NKGB) */
++const LETag sarbScriptTag = 0x73617262; /* 'sarb' (OLD_SOUTH_ARABIAN) */
++const LETag bassScriptTag = 0x62617373; /* 'bass' (BASS) */
++const LETag duplScriptTag = 0x6475706C; /* 'dupl' (DUPL) */
++const LETag elbaScriptTag = 0x656C6261; /* 'elba' (ELBA) */
++const LETag granScriptTag = 0x6772616E; /* 'gran' (GRAN) */
++const LETag kpelScriptTag = 0x6B70656C; /* 'kpel' (KPEL) */
++const LETag lomaScriptTag = 0x6C6F6D61; /* 'loma' (LOMA) */
++const LETag mendScriptTag = 0x6D656E64; /* 'mend' (MEND) */
++const LETag mercScriptTag = 0x6D657263; /* 'merc' (MERC) */
++const LETag narbScriptTag = 0x6E617262; /* 'narb' (NARB) */
++const LETag nbatScriptTag = 0x6E626174; /* 'nbat' (NBAT) */
++const LETag palmScriptTag = 0x70616C6D; /* 'palm' (PALM) */
++const LETag sindScriptTag = 0x73696E64; /* 'sind' (SIND) */
++const LETag waraScriptTag = 0x77617261; /* 'wara' (WARA) */
+ 
+ const LETag nullScriptTag = 0x00000000; /* ''     (NULL) */
+ 
+@@ -132,6 +235,48 @@
+ const LETag zhpLanguageTag = 0x5A485020; /* 'ZHP' (Chinese (Phonetic)) */
+ const LETag zhsLanguageTag = 0x5A485320; /* 'ZHS' (Chinese (Simplified)) */
+ const LETag zhtLanguageTag = 0x5A485420; /* 'ZHT' (Chinese (Traditional)) */
++const LETag afkLanguageTag = 0x41464B20; /* 'AFK' (Afrikaans) */
++const LETag belLanguageTag = 0x42454C20; /* 'BEL' (Belarussian) */
++const LETag bgrLanguageTag = 0x42475220; /* 'BGR' (Bulgarian) */
++const LETag catLanguageTag = 0x43415420; /* 'CAT' (Catalan) */
++const LETag cheLanguageTag = 0x43484520; /* 'CHE' (Chechen) */
++const LETag copLanguageTag = 0x434F5020; /* 'COP' (Coptic) */
++const LETag csyLanguageTag = 0x43535920; /* 'CSY' (Czech) */
++const LETag danLanguageTag = 0x44414E20; /* 'DAN' (Danish) */
++const LETag deuLanguageTag = 0x44455520; /* 'DEU' (German) */
++const LETag dznLanguageTag = 0x445A4E20; /* 'DZN' (Dzongkha) */
++const LETag ellLanguageTag = 0x454C4C20; /* 'ELL' (Greek) */
++const LETag engLanguageTag = 0x454E4720; /* 'ENG' (English) */
++const LETag espLanguageTag = 0x45535020; /* 'ESP' (Spanish) */
++const LETag etiLanguageTag = 0x45544920; /* 'ETI' (Estonian) */
++const LETag euqLanguageTag = 0x45555120; /* 'EUQ' (Basque) */
++const LETag finLanguageTag = 0x46494E20; /* 'FIN' (Finnish) */
++const LETag fraLanguageTag = 0x46524120; /* 'FRA' (French) */
++const LETag gaeLanguageTag = 0x47414520; /* 'GAE' (Gaelic) */
++const LETag hauLanguageTag = 0x48415520; /* 'HAU' (Hausa) */
++const LETag hrvLanguageTag = 0x48525620; /* 'HRV' (Croation) */
++const LETag hunLanguageTag = 0x48554E20; /* 'HUN' (Hungarian) */
++const LETag hyeLanguageTag = 0x48594520; /* 'HYE' (Armenian) */
++const LETag indLanguageTag = 0x494E4420; /* 'IND' (Indonesian) */
++const LETag itaLanguageTag = 0x49544120; /* 'ITA' (Italian) */
++const LETag khmLanguageTag = 0x4B484D20; /* 'KHM' (Khmer) */
++const LETag mngLanguageTag = 0x4D4E4720; /* 'MNG' (Mongolian) */
++const LETag mtsLanguageTag = 0x4D545320; /* 'MTS' (Maltese) */
++const LETag nepLanguageTag = 0x4E455020; /* 'NEP' (Nepali) */
++const LETag nldLanguageTag = 0x4E4C4420; /* 'NLD' (Dutch) */
++const LETag pasLanguageTag = 0x50415320; /* 'PAS' (Pashto) */
++const LETag plkLanguageTag = 0x504C4B20; /* 'PLK' (Polish) */
++const LETag ptgLanguageTag = 0x50544720; /* 'PTG' (Portuguese) */
++const LETag romLanguageTag = 0x524F4D20; /* 'ROM' (Romanian) */
++const LETag rusLanguageTag = 0x52555320; /* 'RUS' (Russian) */
++const LETag skyLanguageTag = 0x534B5920; /* 'SKY' (Slovak) */
++const LETag slvLanguageTag = 0x534C5620; /* 'SLV' (Slovenian) */
++const LETag sqiLanguageTag = 0x53514920; /* 'SQI' (Albanian) */
++const LETag srbLanguageTag = 0x53524220; /* 'SRB' (Serbian) */
++const LETag sveLanguageTag = 0x53564520; /* 'SVE' (Swedish) */
++const LETag tibLanguageTag = 0x54494220; /* 'TIB' (Tibetan) */
++const LETag trkLanguageTag = 0x54524B20; /* 'TRK' (Turkish) */
++const LETag welLanguageTag = 0x57454C20; /* 'WEL' (Welsh) */
+ 
+ 
+ U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp b/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp
+--- jdk/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp
++++ jdk/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp
+@@ -74,7 +74,7 @@
+ 
+             if (offset != 0) {
+                 TTGlyphID  *glyphArray = (TTGlyphID *) ((char *) subtableHeader + offset);
+-                TTGlyphID   newGlyph   = (TTGlyphID)SWAPW(glyphArray[LE_GET_GLYPH(thisGlyph) - firstGlyph]);
++                TTGlyphID   newGlyph   = SWAPW(glyphArray[LE_GET_GLYPH(thisGlyph) - firstGlyph]);
+ 
+                 glyphStorage[glyph] = LE_SET_GLYPH(thisGlyph, newGlyph);
+             }
+diff --git a/src/share/native/sun/font/layout/ShapingTypeData.cpp b/src/share/native/sun/font/layout/ShapingTypeData.cpp
+--- jdk/src/share/native/sun/font/layout/ShapingTypeData.cpp
++++ jdk/src/share/native/sun/font/layout/ShapingTypeData.cpp
+@@ -25,7 +25,7 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 1998-2005. All Rights Reserved.
++ * (C) Copyright IBM Corp. 1998-2010. All Rights Reserved.
+  *
+  * WARNING: THIS FILE IS MACHINE GENERATED. DO NOT HAND EDIT IT UNLESS
+  * YOU REALLY KNOW WHAT YOU'RE DOING.
+@@ -39,72 +39,87 @@
+ U_NAMESPACE_BEGIN
+ 
+ const le_uint8 ArabicShaping::shapingTypeTable[] = {
+-    0x00, 0x02, 0x00, 0xAD, 0x00, 0xAD, 0x00, 0xAD, 0x00, 0x05, 0x03, 0x00, 0x03, 0x6F, 0x00, 0x05,
+-    0x04, 0x83, 0x04, 0x86, 0x00, 0x05, 0x04, 0x88, 0x04, 0x89, 0x00, 0x05, 0x05, 0x91, 0x05, 0xB9,
+-    0x00, 0x05, 0x05, 0xBB, 0x05, 0xBD, 0x00, 0x05, 0x05, 0xBF, 0x05, 0xBF, 0x00, 0x05, 0x05, 0xC1,
+-    0x05, 0xC2, 0x00, 0x05, 0x05, 0xC4, 0x05, 0xC5, 0x00, 0x05, 0x05, 0xC7, 0x05, 0xC7, 0x00, 0x05,
+-    0x06, 0x10, 0x06, 0x15, 0x00, 0x05, 0x06, 0x22, 0x06, 0x25, 0x00, 0x04, 0x06, 0x26, 0x06, 0x26,
+-    0x00, 0x02, 0x06, 0x27, 0x06, 0x27, 0x00, 0x04, 0x06, 0x28, 0x06, 0x28, 0x00, 0x02, 0x06, 0x29,
+-    0x06, 0x29, 0x00, 0x04, 0x06, 0x2A, 0x06, 0x2E, 0x00, 0x02, 0x06, 0x2F, 0x06, 0x32, 0x00, 0x04,
+-    0x06, 0x33, 0x06, 0x3A, 0x00, 0x02, 0x06, 0x40, 0x06, 0x40, 0x00, 0x01, 0x06, 0x41, 0x06, 0x47,
+-    0x00, 0x02, 0x06, 0x48, 0x06, 0x48, 0x00, 0x04, 0x06, 0x49, 0x06, 0x4A, 0x00, 0x02, 0x06, 0x4B,
+-    0x06, 0x5E, 0x00, 0x05, 0x06, 0x6E, 0x06, 0x6F, 0x00, 0x02, 0x06, 0x70, 0x06, 0x70, 0x00, 0x05,
+-    0x06, 0x71, 0x06, 0x73, 0x00, 0x04, 0x06, 0x75, 0x06, 0x77, 0x00, 0x04, 0x06, 0x78, 0x06, 0x87,
+-    0x00, 0x02, 0x06, 0x88, 0x06, 0x99, 0x00, 0x04, 0x06, 0x9A, 0x06, 0xBF, 0x00, 0x02, 0x06, 0xC0,
+-    0x06, 0xC0, 0x00, 0x04, 0x06, 0xC1, 0x06, 0xC2, 0x00, 0x02, 0x06, 0xC3, 0x06, 0xCB, 0x00, 0x04,
+-    0x06, 0xCC, 0x06, 0xCC, 0x00, 0x02, 0x06, 0xCD, 0x06, 0xCD, 0x00, 0x04, 0x06, 0xCE, 0x06, 0xCE,
+-    0x00, 0x02, 0x06, 0xCF, 0x06, 0xCF, 0x00, 0x04, 0x06, 0xD0, 0x06, 0xD1, 0x00, 0x02, 0x06, 0xD2,
+-    0x06, 0xD3, 0x00, 0x04, 0x06, 0xD5, 0x06, 0xD5, 0x00, 0x04, 0x06, 0xD6, 0x06, 0xDC, 0x00, 0x05,
+-    0x06, 0xDE, 0x06, 0xE4, 0x00, 0x05, 0x06, 0xE7, 0x06, 0xE8, 0x00, 0x05, 0x06, 0xEA, 0x06, 0xED,
+-    0x00, 0x05, 0x06, 0xEE, 0x06, 0xEF, 0x00, 0x04, 0x06, 0xFA, 0x06, 0xFC, 0x00, 0x02, 0x06, 0xFF,
+-    0x06, 0xFF, 0x00, 0x02, 0x07, 0x0F, 0x07, 0x0F, 0x00, 0x05, 0x07, 0x10, 0x07, 0x10, 0x00, 0x04,
+-    0x07, 0x11, 0x07, 0x11, 0x00, 0x05, 0x07, 0x12, 0x07, 0x14, 0x00, 0x02, 0x07, 0x15, 0x07, 0x19,
+-    0x00, 0x04, 0x07, 0x1A, 0x07, 0x1D, 0x00, 0x02, 0x07, 0x1E, 0x07, 0x1E, 0x00, 0x04, 0x07, 0x1F,
+-    0x07, 0x27, 0x00, 0x02, 0x07, 0x28, 0x07, 0x28, 0x00, 0x04, 0x07, 0x29, 0x07, 0x29, 0x00, 0x02,
+-    0x07, 0x2A, 0x07, 0x2A, 0x00, 0x04, 0x07, 0x2B, 0x07, 0x2B, 0x00, 0x02, 0x07, 0x2C, 0x07, 0x2C,
+-    0x00, 0x04, 0x07, 0x2D, 0x07, 0x2E, 0x00, 0x02, 0x07, 0x2F, 0x07, 0x2F, 0x00, 0x04, 0x07, 0x30,
+-    0x07, 0x4A, 0x00, 0x05, 0x07, 0x4D, 0x07, 0x4D, 0x00, 0x04, 0x07, 0x4E, 0x07, 0x58, 0x00, 0x02,
+-    0x07, 0x59, 0x07, 0x5B, 0x00, 0x04, 0x07, 0x5C, 0x07, 0x6A, 0x00, 0x02, 0x07, 0x6B, 0x07, 0x6C,
+-    0x00, 0x04, 0x07, 0x6D, 0x07, 0x6D, 0x00, 0x02, 0x07, 0xA6, 0x07, 0xB0, 0x00, 0x05, 0x09, 0x01,
+-    0x09, 0x02, 0x00, 0x05, 0x09, 0x3C, 0x09, 0x3C, 0x00, 0x05, 0x09, 0x41, 0x09, 0x48, 0x00, 0x05,
+-    0x09, 0x4D, 0x09, 0x4D, 0x00, 0x05, 0x09, 0x51, 0x09, 0x54, 0x00, 0x05, 0x09, 0x62, 0x09, 0x63,
+-    0x00, 0x05, 0x09, 0x81, 0x09, 0x81, 0x00, 0x05, 0x09, 0xBC, 0x09, 0xBC, 0x00, 0x05, 0x09, 0xC1,
+-    0x09, 0xC4, 0x00, 0x05, 0x09, 0xCD, 0x09, 0xCD, 0x00, 0x05, 0x09, 0xE2, 0x09, 0xE3, 0x00, 0x05,
+-    0x0A, 0x01, 0x0A, 0x02, 0x00, 0x05, 0x0A, 0x3C, 0x0A, 0x3C, 0x00, 0x05, 0x0A, 0x41, 0x0A, 0x42,
+-    0x00, 0x05, 0x0A, 0x47, 0x0A, 0x48, 0x00, 0x05, 0x0A, 0x4B, 0x0A, 0x4D, 0x00, 0x05, 0x0A, 0x70,
+-    0x0A, 0x71, 0x00, 0x05, 0x0A, 0x81, 0x0A, 0x82, 0x00, 0x05, 0x0A, 0xBC, 0x0A, 0xBC, 0x00, 0x05,
+-    0x0A, 0xC1, 0x0A, 0xC5, 0x00, 0x05, 0x0A, 0xC7, 0x0A, 0xC8, 0x00, 0x05, 0x0A, 0xCD, 0x0A, 0xCD,
+-    0x00, 0x05, 0x0A, 0xE2, 0x0A, 0xE3, 0x00, 0x05, 0x0B, 0x01, 0x0B, 0x01, 0x00, 0x05, 0x0B, 0x3C,
+-    0x0B, 0x3C, 0x00, 0x05, 0x0B, 0x3F, 0x0B, 0x3F, 0x00, 0x05, 0x0B, 0x41, 0x0B, 0x43, 0x00, 0x05,
+-    0x0B, 0x4D, 0x0B, 0x4D, 0x00, 0x05, 0x0B, 0x56, 0x0B, 0x56, 0x00, 0x05, 0x0B, 0x82, 0x0B, 0x82,
+-    0x00, 0x05, 0x0B, 0xC0, 0x0B, 0xC0, 0x00, 0x05, 0x0B, 0xCD, 0x0B, 0xCD, 0x00, 0x05, 0x0C, 0x3E,
+-    0x0C, 0x40, 0x00, 0x05, 0x0C, 0x46, 0x0C, 0x48, 0x00, 0x05, 0x0C, 0x4A, 0x0C, 0x4D, 0x00, 0x05,
+-    0x0C, 0x55, 0x0C, 0x56, 0x00, 0x05, 0x0C, 0xBC, 0x0C, 0xBC, 0x00, 0x05, 0x0C, 0xBF, 0x0C, 0xBF,
+-    0x00, 0x05, 0x0C, 0xC6, 0x0C, 0xC6, 0x00, 0x05, 0x0C, 0xCC, 0x0C, 0xCD, 0x00, 0x05, 0x0D, 0x41,
+-    0x0D, 0x43, 0x00, 0x05, 0x0D, 0x4D, 0x0D, 0x4D, 0x00, 0x05, 0x0D, 0xCA, 0x0D, 0xCA, 0x00, 0x05,
+-    0x0D, 0xD2, 0x0D, 0xD4, 0x00, 0x05, 0x0D, 0xD6, 0x0D, 0xD6, 0x00, 0x05, 0x0E, 0x31, 0x0E, 0x31,
+-    0x00, 0x05, 0x0E, 0x34, 0x0E, 0x3A, 0x00, 0x05, 0x0E, 0x47, 0x0E, 0x4E, 0x00, 0x05, 0x0E, 0xB1,
+-    0x0E, 0xB1, 0x00, 0x05, 0x0E, 0xB4, 0x0E, 0xB9, 0x00, 0x05, 0x0E, 0xBB, 0x0E, 0xBC, 0x00, 0x05,
+-    0x0E, 0xC8, 0x0E, 0xCD, 0x00, 0x05, 0x0F, 0x18, 0x0F, 0x19, 0x00, 0x05, 0x0F, 0x35, 0x0F, 0x35,
+-    0x00, 0x05, 0x0F, 0x37, 0x0F, 0x37, 0x00, 0x05, 0x0F, 0x39, 0x0F, 0x39, 0x00, 0x05, 0x0F, 0x71,
+-    0x0F, 0x7E, 0x00, 0x05, 0x0F, 0x80, 0x0F, 0x84, 0x00, 0x05, 0x0F, 0x86, 0x0F, 0x87, 0x00, 0x05,
+-    0x0F, 0x90, 0x0F, 0x97, 0x00, 0x05, 0x0F, 0x99, 0x0F, 0xBC, 0x00, 0x05, 0x0F, 0xC6, 0x0F, 0xC6,
+-    0x00, 0x05, 0x10, 0x2D, 0x10, 0x30, 0x00, 0x05, 0x10, 0x32, 0x10, 0x32, 0x00, 0x05, 0x10, 0x36,
+-    0x10, 0x37, 0x00, 0x05, 0x10, 0x39, 0x10, 0x39, 0x00, 0x05, 0x10, 0x58, 0x10, 0x59, 0x00, 0x05,
+-    0x13, 0x5F, 0x13, 0x5F, 0x00, 0x05, 0x17, 0x12, 0x17, 0x14, 0x00, 0x05, 0x17, 0x32, 0x17, 0x34,
+-    0x00, 0x05, 0x17, 0x52, 0x17, 0x53, 0x00, 0x05, 0x17, 0x72, 0x17, 0x73, 0x00, 0x05, 0x17, 0xB4,
+-    0x17, 0xB5, 0x00, 0x05, 0x17, 0xB7, 0x17, 0xBD, 0x00, 0x05, 0x17, 0xC6, 0x17, 0xC6, 0x00, 0x05,
+-    0x17, 0xC9, 0x17, 0xD3, 0x00, 0x05, 0x17, 0xDD, 0x17, 0xDD, 0x00, 0x05, 0x18, 0x0B, 0x18, 0x0D,
+-    0x00, 0x05, 0x18, 0xA9, 0x18, 0xA9, 0x00, 0x05, 0x19, 0x20, 0x19, 0x22, 0x00, 0x05, 0x19, 0x27,
+-    0x19, 0x28, 0x00, 0x05, 0x19, 0x32, 0x19, 0x32, 0x00, 0x05, 0x19, 0x39, 0x19, 0x3B, 0x00, 0x05,
+-    0x1A, 0x17, 0x1A, 0x18, 0x00, 0x05, 0x1D, 0xC0, 0x1D, 0xC3, 0x00, 0x05, 0x20, 0x0B, 0x20, 0x0B,
+-    0x00, 0x05, 0x20, 0x0D, 0x20, 0x0D, 0x00, 0x01, 0x20, 0x0E, 0x20, 0x0F, 0x00, 0x05, 0x20, 0x2A,
+-    0x20, 0x2E, 0x00, 0x05, 0x20, 0x60, 0x20, 0x63, 0x00, 0x05, 0x20, 0x6A, 0x20, 0x6F, 0x00, 0x05,
+-    0x20, 0xD0, 0x20, 0xEB, 0x00, 0x05, 0x30, 0x2A, 0x30, 0x2F, 0x00, 0x05, 0x30, 0x99, 0x30, 0x9A,
+-    0x00, 0x05, 0xA8, 0x06, 0xA8, 0x06, 0x00, 0x05, 0xA8, 0x0B, 0xA8, 0x0B, 0x00, 0x05, 0xA8, 0x25,
+-    0xA8, 0x26, 0x00, 0x05, 0xFB, 0x1E, 0xFB, 0x1E, 0x00, 0x05, 0xFE, 0x00, 0xFE, 0x0F, 0x00, 0x05,
+-    0xFE, 0x20, 0xFE, 0x23, 0x00, 0x05, 0xFE, 0xFF, 0xFE, 0xFF, 0x00, 0x05, 0xFF, 0xF9, 0xFF, 0xFB,
+-    0x00, 0x05
++    0x00, 0x02, 0x00, 0xD7, 0x00, 0xAD, 0x00, 0xAD, 0x00, 0x05, 0x03, 0x00, 0x03, 0x6F, 0x00, 0x05,
++    0x04, 0x83, 0x04, 0x89, 0x00, 0x05, 0x05, 0x91, 0x05, 0xBD, 0x00, 0x05, 0x05, 0xBF, 0x05, 0xBF,
++    0x00, 0x05, 0x05, 0xC1, 0x05, 0xC2, 0x00, 0x05, 0x05, 0xC4, 0x05, 0xC5, 0x00, 0x05, 0x05, 0xC7,
++    0x05, 0xC7, 0x00, 0x05, 0x06, 0x10, 0x06, 0x1A, 0x00, 0x05, 0x06, 0x22, 0x06, 0x25, 0x00, 0x04,
++    0x06, 0x26, 0x06, 0x26, 0x00, 0x02, 0x06, 0x27, 0x06, 0x27, 0x00, 0x04, 0x06, 0x28, 0x06, 0x28,
++    0x00, 0x02, 0x06, 0x29, 0x06, 0x29, 0x00, 0x04, 0x06, 0x2A, 0x06, 0x2E, 0x00, 0x02, 0x06, 0x2F,
++    0x06, 0x32, 0x00, 0x04, 0x06, 0x33, 0x06, 0x3F, 0x00, 0x02, 0x06, 0x40, 0x06, 0x40, 0x00, 0x01,
++    0x06, 0x41, 0x06, 0x47, 0x00, 0x02, 0x06, 0x48, 0x06, 0x48, 0x00, 0x04, 0x06, 0x49, 0x06, 0x4A,
++    0x00, 0x02, 0x06, 0x4B, 0x06, 0x5E, 0x00, 0x05, 0x06, 0x6E, 0x06, 0x6F, 0x00, 0x02, 0x06, 0x70,
++    0x06, 0x70, 0x00, 0x05, 0x06, 0x71, 0x06, 0x73, 0x00, 0x04, 0x06, 0x75, 0x06, 0x77, 0x00, 0x04,
++    0x06, 0x78, 0x06, 0x87, 0x00, 0x02, 0x06, 0x88, 0x06, 0x99, 0x00, 0x04, 0x06, 0x9A, 0x06, 0xBF,
++    0x00, 0x02, 0x06, 0xC0, 0x06, 0xC0, 0x00, 0x04, 0x06, 0xC1, 0x06, 0xC2, 0x00, 0x02, 0x06, 0xC3,
++    0x06, 0xCB, 0x00, 0x04, 0x06, 0xCC, 0x06, 0xCC, 0x00, 0x02, 0x06, 0xCD, 0x06, 0xCD, 0x00, 0x04,
++    0x06, 0xCE, 0x06, 0xCE, 0x00, 0x02, 0x06, 0xCF, 0x06, 0xCF, 0x00, 0x04, 0x06, 0xD0, 0x06, 0xD1,
++    0x00, 0x02, 0x06, 0xD2, 0x06, 0xD3, 0x00, 0x04, 0x06, 0xD5, 0x06, 0xD5, 0x00, 0x04, 0x06, 0xD6,
++    0x06, 0xDC, 0x00, 0x05, 0x06, 0xDE, 0x06, 0xE4, 0x00, 0x05, 0x06, 0xE7, 0x06, 0xE8, 0x00, 0x05,
++    0x06, 0xEA, 0x06, 0xED, 0x00, 0x05, 0x06, 0xEE, 0x06, 0xEF, 0x00, 0x04, 0x06, 0xFA, 0x06, 0xFC,
++    0x00, 0x02, 0x06, 0xFF, 0x06, 0xFF, 0x00, 0x02, 0x07, 0x0F, 0x07, 0x0F, 0x00, 0x05, 0x07, 0x10,
++    0x07, 0x10, 0x00, 0x04, 0x07, 0x11, 0x07, 0x11, 0x00, 0x05, 0x07, 0x12, 0x07, 0x14, 0x00, 0x02,
++    0x07, 0x15, 0x07, 0x19, 0x00, 0x04, 0x07, 0x1A, 0x07, 0x1D, 0x00, 0x02, 0x07, 0x1E, 0x07, 0x1E,
++    0x00, 0x04, 0x07, 0x1F, 0x07, 0x27, 0x00, 0x02, 0x07, 0x28, 0x07, 0x28, 0x00, 0x04, 0x07, 0x29,
++    0x07, 0x29, 0x00, 0x02, 0x07, 0x2A, 0x07, 0x2A, 0x00, 0x04, 0x07, 0x2B, 0x07, 0x2B, 0x00, 0x02,
++    0x07, 0x2C, 0x07, 0x2C, 0x00, 0x04, 0x07, 0x2D, 0x07, 0x2E, 0x00, 0x02, 0x07, 0x2F, 0x07, 0x2F,
++    0x00, 0x04, 0x07, 0x30, 0x07, 0x4A, 0x00, 0x05, 0x07, 0x4D, 0x07, 0x4D, 0x00, 0x04, 0x07, 0x4E,
++    0x07, 0x58, 0x00, 0x02, 0x07, 0x59, 0x07, 0x5B, 0x00, 0x04, 0x07, 0x5C, 0x07, 0x6A, 0x00, 0x02,
++    0x07, 0x6B, 0x07, 0x6C, 0x00, 0x04, 0x07, 0x6D, 0x07, 0x70, 0x00, 0x02, 0x07, 0x71, 0x07, 0x71,
++    0x00, 0x04, 0x07, 0x72, 0x07, 0x72, 0x00, 0x02, 0x07, 0x73, 0x07, 0x74, 0x00, 0x04, 0x07, 0x75,
++    0x07, 0x77, 0x00, 0x02, 0x07, 0x78, 0x07, 0x79, 0x00, 0x04, 0x07, 0x7A, 0x07, 0x7F, 0x00, 0x02,
++    0x07, 0xA6, 0x07, 0xB0, 0x00, 0x05, 0x07, 0xCA, 0x07, 0xEA, 0x00, 0x02, 0x07, 0xEB, 0x07, 0xF3,
++    0x00, 0x05, 0x07, 0xFA, 0x07, 0xFA, 0x00, 0x01, 0x09, 0x01, 0x09, 0x02, 0x00, 0x05, 0x09, 0x3C,
++    0x09, 0x3C, 0x00, 0x05, 0x09, 0x41, 0x09, 0x48, 0x00, 0x05, 0x09, 0x4D, 0x09, 0x4D, 0x00, 0x05,
++    0x09, 0x51, 0x09, 0x54, 0x00, 0x05, 0x09, 0x62, 0x09, 0x63, 0x00, 0x05, 0x09, 0x81, 0x09, 0x81,
++    0x00, 0x05, 0x09, 0xBC, 0x09, 0xBC, 0x00, 0x05, 0x09, 0xC1, 0x09, 0xC4, 0x00, 0x05, 0x09, 0xCD,
++    0x09, 0xCD, 0x00, 0x05, 0x09, 0xE2, 0x09, 0xE3, 0x00, 0x05, 0x0A, 0x01, 0x0A, 0x02, 0x00, 0x05,
++    0x0A, 0x3C, 0x0A, 0x3C, 0x00, 0x05, 0x0A, 0x41, 0x0A, 0x42, 0x00, 0x05, 0x0A, 0x47, 0x0A, 0x48,
++    0x00, 0x05, 0x0A, 0x4B, 0x0A, 0x4D, 0x00, 0x05, 0x0A, 0x51, 0x0A, 0x51, 0x00, 0x05, 0x0A, 0x70,
++    0x0A, 0x71, 0x00, 0x05, 0x0A, 0x75, 0x0A, 0x75, 0x00, 0x05, 0x0A, 0x81, 0x0A, 0x82, 0x00, 0x05,
++    0x0A, 0xBC, 0x0A, 0xBC, 0x00, 0x05, 0x0A, 0xC1, 0x0A, 0xC5, 0x00, 0x05, 0x0A, 0xC7, 0x0A, 0xC8,
++    0x00, 0x05, 0x0A, 0xCD, 0x0A, 0xCD, 0x00, 0x05, 0x0A, 0xE2, 0x0A, 0xE3, 0x00, 0x05, 0x0B, 0x01,
++    0x0B, 0x01, 0x00, 0x05, 0x0B, 0x3C, 0x0B, 0x3C, 0x00, 0x05, 0x0B, 0x3F, 0x0B, 0x3F, 0x00, 0x05,
++    0x0B, 0x41, 0x0B, 0x44, 0x00, 0x05, 0x0B, 0x4D, 0x0B, 0x4D, 0x00, 0x05, 0x0B, 0x56, 0x0B, 0x56,
++    0x00, 0x05, 0x0B, 0x62, 0x0B, 0x63, 0x00, 0x05, 0x0B, 0x82, 0x0B, 0x82, 0x00, 0x05, 0x0B, 0xC0,
++    0x0B, 0xC0, 0x00, 0x05, 0x0B, 0xCD, 0x0B, 0xCD, 0x00, 0x05, 0x0C, 0x3E, 0x0C, 0x40, 0x00, 0x05,
++    0x0C, 0x46, 0x0C, 0x48, 0x00, 0x05, 0x0C, 0x4A, 0x0C, 0x4D, 0x00, 0x05, 0x0C, 0x55, 0x0C, 0x56,
++    0x00, 0x05, 0x0C, 0x62, 0x0C, 0x63, 0x00, 0x05, 0x0C, 0xBC, 0x0C, 0xBC, 0x00, 0x05, 0x0C, 0xBF,
++    0x0C, 0xBF, 0x00, 0x05, 0x0C, 0xC6, 0x0C, 0xC6, 0x00, 0x05, 0x0C, 0xCC, 0x0C, 0xCD, 0x00, 0x05,
++    0x0C, 0xE2, 0x0C, 0xE3, 0x00, 0x05, 0x0D, 0x41, 0x0D, 0x44, 0x00, 0x05, 0x0D, 0x4D, 0x0D, 0x4D,
++    0x00, 0x05, 0x0D, 0x62, 0x0D, 0x63, 0x00, 0x05, 0x0D, 0xCA, 0x0D, 0xCA, 0x00, 0x05, 0x0D, 0xD2,
++    0x0D, 0xD4, 0x00, 0x05, 0x0D, 0xD6, 0x0D, 0xD6, 0x00, 0x05, 0x0E, 0x31, 0x0E, 0x31, 0x00, 0x05,
++    0x0E, 0x34, 0x0E, 0x3A, 0x00, 0x05, 0x0E, 0x47, 0x0E, 0x4E, 0x00, 0x05, 0x0E, 0xB1, 0x0E, 0xB1,
++    0x00, 0x05, 0x0E, 0xB4, 0x0E, 0xB9, 0x00, 0x05, 0x0E, 0xBB, 0x0E, 0xBC, 0x00, 0x05, 0x0E, 0xC8,
++    0x0E, 0xCD, 0x00, 0x05, 0x0F, 0x18, 0x0F, 0x19, 0x00, 0x05, 0x0F, 0x35, 0x0F, 0x35, 0x00, 0x05,
++    0x0F, 0x37, 0x0F, 0x37, 0x00, 0x05, 0x0F, 0x39, 0x0F, 0x39, 0x00, 0x05, 0x0F, 0x71, 0x0F, 0x7E,
++    0x00, 0x05, 0x0F, 0x80, 0x0F, 0x84, 0x00, 0x05, 0x0F, 0x86, 0x0F, 0x87, 0x00, 0x05, 0x0F, 0x90,
++    0x0F, 0x97, 0x00, 0x05, 0x0F, 0x99, 0x0F, 0xBC, 0x00, 0x05, 0x0F, 0xC6, 0x0F, 0xC6, 0x00, 0x05,
++    0x10, 0x2D, 0x10, 0x30, 0x00, 0x05, 0x10, 0x32, 0x10, 0x37, 0x00, 0x05, 0x10, 0x39, 0x10, 0x3A,
++    0x00, 0x05, 0x10, 0x3D, 0x10, 0x3E, 0x00, 0x05, 0x10, 0x58, 0x10, 0x59, 0x00, 0x05, 0x10, 0x5E,
++    0x10, 0x60, 0x00, 0x05, 0x10, 0x71, 0x10, 0x74, 0x00, 0x05, 0x10, 0x82, 0x10, 0x82, 0x00, 0x05,
++    0x10, 0x85, 0x10, 0x86, 0x00, 0x05, 0x10, 0x8D, 0x10, 0x8D, 0x00, 0x05, 0x13, 0x5F, 0x13, 0x5F,
++    0x00, 0x05, 0x17, 0x12, 0x17, 0x14, 0x00, 0x05, 0x17, 0x32, 0x17, 0x34, 0x00, 0x05, 0x17, 0x52,
++    0x17, 0x53, 0x00, 0x05, 0x17, 0x72, 0x17, 0x73, 0x00, 0x05, 0x17, 0xB4, 0x17, 0xB5, 0x00, 0x05,
++    0x17, 0xB7, 0x17, 0xBD, 0x00, 0x05, 0x17, 0xC6, 0x17, 0xC6, 0x00, 0x05, 0x17, 0xC9, 0x17, 0xD3,
++    0x00, 0x05, 0x17, 0xDD, 0x17, 0xDD, 0x00, 0x05, 0x18, 0x0B, 0x18, 0x0D, 0x00, 0x05, 0x18, 0xA9,
++    0x18, 0xA9, 0x00, 0x05, 0x19, 0x20, 0x19, 0x22, 0x00, 0x05, 0x19, 0x27, 0x19, 0x28, 0x00, 0x05,
++    0x19, 0x32, 0x19, 0x32, 0x00, 0x05, 0x19, 0x39, 0x19, 0x3B, 0x00, 0x05, 0x1A, 0x17, 0x1A, 0x18,
++    0x00, 0x05, 0x1B, 0x00, 0x1B, 0x03, 0x00, 0x05, 0x1B, 0x34, 0x1B, 0x34, 0x00, 0x05, 0x1B, 0x36,
++    0x1B, 0x3A, 0x00, 0x05, 0x1B, 0x3C, 0x1B, 0x3C, 0x00, 0x05, 0x1B, 0x42, 0x1B, 0x42, 0x00, 0x05,
++    0x1B, 0x6B, 0x1B, 0x73, 0x00, 0x05, 0x1B, 0x80, 0x1B, 0x81, 0x00, 0x05, 0x1B, 0xA2, 0x1B, 0xA5,
++    0x00, 0x05, 0x1B, 0xA8, 0x1B, 0xA9, 0x00, 0x05, 0x1C, 0x2C, 0x1C, 0x33, 0x00, 0x05, 0x1C, 0x36,
++    0x1C, 0x37, 0x00, 0x05, 0x1D, 0xC0, 0x1D, 0xE6, 0x00, 0x05, 0x1D, 0xFE, 0x1D, 0xFF, 0x00, 0x05,
++    0x20, 0x0B, 0x20, 0x0B, 0x00, 0x05, 0x20, 0x0D, 0x20, 0x0D, 0x00, 0x01, 0x20, 0x0E, 0x20, 0x0F,
++    0x00, 0x05, 0x20, 0x2A, 0x20, 0x2E, 0x00, 0x05, 0x20, 0x60, 0x20, 0x64, 0x00, 0x05, 0x20, 0x6A,
++    0x20, 0x6F, 0x00, 0x05, 0x20, 0xD0, 0x20, 0xF0, 0x00, 0x05, 0x2D, 0xE0, 0x2D, 0xFF, 0x00, 0x05,
++    0x30, 0x2A, 0x30, 0x2F, 0x00, 0x05, 0x30, 0x99, 0x30, 0x9A, 0x00, 0x05, 0xA6, 0x6F, 0xA6, 0x72,
++    0x00, 0x05, 0xA6, 0x7C, 0xA6, 0x7D, 0x00, 0x05, 0xA8, 0x02, 0xA8, 0x02, 0x00, 0x05, 0xA8, 0x06,
++    0xA8, 0x06, 0x00, 0x05, 0xA8, 0x0B, 0xA8, 0x0B, 0x00, 0x05, 0xA8, 0x25, 0xA8, 0x26, 0x00, 0x05,
++    0xA8, 0xC4, 0xA8, 0xC4, 0x00, 0x05, 0xA9, 0x26, 0xA9, 0x2D, 0x00, 0x05, 0xA9, 0x47, 0xA9, 0x51,
++    0x00, 0x05, 0xAA, 0x29, 0xAA, 0x2E, 0x00, 0x05, 0xAA, 0x31, 0xAA, 0x32, 0x00, 0x05, 0xAA, 0x35,
++    0xAA, 0x36, 0x00, 0x05, 0xAA, 0x43, 0xAA, 0x43, 0x00, 0x05, 0xAA, 0x4C, 0xAA, 0x4C, 0x00, 0x05,
++    0xFB, 0x1E, 0xFB, 0x1E, 0x00, 0x05, 0xFE, 0x00, 0xFE, 0x0F, 0x00, 0x05, 0xFE, 0x20, 0xFE, 0x26,
++    0x00, 0x05, 0xFE, 0xFF, 0xFE, 0xFF, 0x00, 0x05, 0xFF, 0xF9, 0xFF, 0xFB, 0x00, 0x05
+ };
+ 
+ U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/SubstitutionLookups.cpp b/src/share/native/sun/font/layout/SubstitutionLookups.cpp
+--- jdk/src/share/native/sun/font/layout/SubstitutionLookups.cpp
++++ jdk/src/share/native/sun/font/layout/SubstitutionLookups.cpp
+@@ -25,7 +25,7 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved
++ * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved
+  *
+  */
+ 
+@@ -53,18 +53,23 @@
+         le_uint16 substCount,
+         GlyphIterator *glyphIterator,
+         const LEFontInstance *fontInstance,
+-        le_int32 position)
++        le_int32 position,
++        LEErrorCode& success)
+ {
++    if (LE_FAILURE(success)) {
++        return;
++    }
++
+     GlyphIterator tempIterator(*glyphIterator);
+ 
+-    for (le_uint16 subst = 0; subst < substCount; subst += 1) {
++    for (le_uint16 subst = 0; subst < substCount && LE_SUCCESS(success); subst += 1) {
+         le_uint16 sequenceIndex = SWAPW(substLookupRecordArray[subst].sequenceIndex);
+         le_uint16 lookupListIndex = SWAPW(substLookupRecordArray[subst].lookupListIndex);
+ 
+         tempIterator.setCurrStreamPosition(position);
+         tempIterator.next(sequenceIndex);
+ 
+-        lookupProcessor->applySingleLookup(lookupListIndex, &tempIterator, fontInstance);
++        lookupProcessor->applySingleLookup(lookupListIndex, &tempIterator, fontInstance, success);
+     }
+ }
+ 
+diff --git a/src/share/native/sun/font/layout/SubstitutionLookups.h b/src/share/native/sun/font/layout/SubstitutionLookups.h
+--- jdk/src/share/native/sun/font/layout/SubstitutionLookups.h
++++ jdk/src/share/native/sun/font/layout/SubstitutionLookups.h
+@@ -25,7 +25,7 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved
++ * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved
+  *
+  */
+ 
+@@ -60,7 +60,8 @@
+         le_uint16 substCount,
+         GlyphIterator *glyphIterator,
+         const LEFontInstance *fontInstance,
+-        le_int32 position);
++        le_int32 position,
++                LEErrorCode& success);
+ };
+ 
+ U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/ThaiLayoutEngine.cpp b/src/share/native/sun/font/layout/ThaiLayoutEngine.cpp
+--- jdk/src/share/native/sun/font/layout/ThaiLayoutEngine.cpp
++++ jdk/src/share/native/sun/font/layout/ThaiLayoutEngine.cpp
+@@ -26,7 +26,7 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
++ * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved
+  *
+  */
+ 
+@@ -36,19 +36,24 @@
+ #include "ScriptAndLanguageTags.h"
+ #include "LEGlyphStorage.h"
+ 
++#include "KernTable.h"
++
+ #include "ThaiShaping.h"
+ 
+ U_NAMESPACE_BEGIN
+ 
+ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ThaiLayoutEngine)
+ 
+-ThaiLayoutEngine::ThaiLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags)
+-    : LayoutEngine(fontInstance, scriptCode, languageCode, typoFlags)
++ThaiLayoutEngine::ThaiLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags, LEErrorCode &success)
++    : LayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success)
+ {
+     fErrorChar = 0x25CC;
+ 
+     // Figure out which presentation forms the font uses
+-    if (fontInstance->canDisplay(0x0E64)) {
++    if (! fontInstance->canDisplay(0x0E01)) {
++        // No Thai in font; don't use presentation forms.
++        fGlyphSet = 3;
++    } else if (fontInstance->canDisplay(0x0E64)) {
+         // WorldType uses reserved space in Thai block
+         fGlyphSet = 0;
+     } else if (fontInstance->canDisplay(0xF701)) {
+@@ -116,4 +121,28 @@
+     return glyphCount;
+ }
+ 
++// This is the same as LayoutEngline::adjustGlyphPositions() except that it doesn't call adjustMarkGlyphs
++void ThaiLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool  /*reverse*/,
++                                        LEGlyphStorage &glyphStorage, LEErrorCode &success)
++{
++    if (LE_FAILURE(success)) {
++        return;
++    }
++
++    if (chars == NULL || offset < 0 || count < 0) {
++        success = LE_ILLEGAL_ARGUMENT_ERROR;
++        return;
++    }
++
++    if (fTypoFlags & 0x1) { /* kerning enabled */
++      static const le_uint32 kernTableTag = LE_KERN_TABLE_TAG;
++
++      KernTable kt(fFontInstance, getFontTable(kernTableTag));
++      kt.process(glyphStorage);
++    }
++
++    // default is no adjustments
++    return;
++}
++
+ U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/ThaiLayoutEngine.h b/src/share/native/sun/font/layout/ThaiLayoutEngine.h
+--- jdk/src/share/native/sun/font/layout/ThaiLayoutEngine.h
++++ jdk/src/share/native/sun/font/layout/ThaiLayoutEngine.h
+@@ -26,7 +26,7 @@
+ 
+ /*
+  *
+- * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
++ * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved
+  *
+  */
+ 
+@@ -62,13 +62,14 @@
+      * @param fontInstance - the font
+      * @param scriptCode - the script
+      * @param languageCode - the language
++     * @param success - set to an error code if the operation fails
+      *
+      * @see LEFontInstance
+      * @see ScriptAndLanguageTags.h for script and language codes
+      *
+      * @internal
+      */
+-    ThaiLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags);
++    ThaiLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags, LEErrorCode &success);
+ 
+     /**
+      * The destructor, virtual for correct polymorphic invocation.
+@@ -139,6 +140,28 @@
+     virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
+         LEGlyphStorage &glyphStorage, LEErrorCode &success);
+ 
++    /**
++     * This method does positioning adjustments like accent positioning and
++     * kerning. The default implementation does nothing. Subclasses needing
++     * position adjustments must override this method.
++     *
++     * Note that this method has both characters and glyphs as input so that
++     * it can use the character codes to determine glyph types if that information
++     * isn't directly available. (e.g. Some Arabic OpenType fonts don't have a GDEF
++     * table)
++     *
++     * @param chars - the input character context
++     * @param offset - the offset of the first character to process
++     * @param count - the number of characters to process
++     * @param reverse - <code>TRUE</code> if the glyphs in the glyph array have been reordered
++     * @param glyphStorage - the object which holds the per-glyph storage. The glyph positions will be
++     *                       adjusted as needed.
++     * @param success - output parameter set to an error code if the operation fails
++     *
++     * @internal
++     */
++    virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success);
++
+ };
+ 
+ U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/TibetanLayoutEngine.cpp b/src/share/native/sun/font/layout/TibetanLayoutEngine.cpp
+new file mode 100644
+--- /dev/null
++++ jdk/src/share/native/sun/font/layout/TibetanLayoutEngine.cpp
+@@ -0,0 +1,112 @@
++/*
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute 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.
++ *
++ */
++
++/*
++ *
++ * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved
++ *
++ * Developed at DIT - Government of Bhutan
++ *
++ * Contact person: Pema Geyleg - <pema_geyleg at druknet.bt>
++ *
++ * This file is a modification of the ICU file KhmerReordering.cpp
++ * by Jens Herden and Javier Sola who have given all their possible rights to IBM and the Governement of Bhutan
++ * A first module for Dzongkha was developed by Karunakar under Panlocalisation funding.
++ * Assistance for this module has been received from Namgay Thinley, Christopher Fynn and Javier Sola
++ *
++ */
++
++
++#include "OpenTypeLayoutEngine.h"
++#include "TibetanLayoutEngine.h"
++#include "LEGlyphStorage.h"
++#include "TibetanReordering.h"
++
++U_NAMESPACE_BEGIN
++
++UOBJECT_DEFINE_RTTI_IMPLEMENTATION(TibetanOpenTypeLayoutEngine)
++
++TibetanOpenTypeLayoutEngine::TibetanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
++                    le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success)
++    : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success)
++{
++    fFeatureMap   = TibetanReordering::getFeatureMap(fFeatureMapCount);
++    fFeatureOrder = TRUE;
++}
++
++TibetanOpenTypeLayoutEngine::TibetanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
++                                                     le_int32 typoFlags, LEErrorCode &success)
++    : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success)
++{
++    fFeatureMap   = TibetanReordering::getFeatureMap(fFeatureMapCount);
++    fFeatureOrder = TRUE;
++}
++
++TibetanOpenTypeLayoutEngine::~TibetanOpenTypeLayoutEngine()
++{
++    // nothing to do
++}
++
++// Input: characters
++// Output: characters, char indices, tags
++// Returns: output character count
++le_int32 TibetanOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
++        LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success)
++{
++    if (LE_FAILURE(success)) {
++        return 0;
++    }
++
++    if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || offset + count > max) {
++        success = LE_ILLEGAL_ARGUMENT_ERROR;
++        return 0;
++    }
++
++    le_int32 worstCase = count * 3;  // worst case is 3 for Khmer  TODO check if 2 is enough
++
++    outChars = LE_NEW_ARRAY(LEUnicode, worstCase);
++
++    if (outChars == NULL) {
++        success = LE_MEMORY_ALLOCATION_ERROR;
++        return 0;
++    }
++
++    glyphStorage.allocateGlyphArray(worstCase, rightToLeft, success);
++    glyphStorage.allocateAuxData(success);
++
++    if (LE_FAILURE(success)) {
++        LE_DELETE_ARRAY(outChars);
++        return 0;
++    }
++
++    // NOTE: assumes this allocates featureTags...
++    // (probably better than doing the worst case stuff here...)
++    le_int32 outCharCount = TibetanReordering::reorder(&chars[offset], count, fScriptCode, outChars, glyphStorage);
++
++    glyphStorage.adoptGlyphCount(outCharCount);
++    return outCharCount;
++}
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/TibetanLayoutEngine.h b/src/share/native/sun/font/layout/TibetanLayoutEngine.h
+new file mode 100644
+--- /dev/null
++++ jdk/src/share/native/sun/font/layout/TibetanLayoutEngine.h
+@@ -0,0 +1,156 @@
++/*
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute 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.
++ *
++ */
++
++/*
++ *
++ * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved
++ *
++ * Developed at DIT - Government of Bhutan
++ *
++ * Contact person: Pema Geyleg - <pema_geyleg at druknet.bt>
++ *
++ * This file is a modification of the ICU file KhmerReordering.cpp
++ * by Jens Herden and Javier Sola who have given all their possible rights to IBM and the Governement of Bhutan
++ * A first module for Dzongkha was developed by Karunakar under Panlocalisation funding.
++ * Assistance for this module has been received from Namgay Thinley, Christopher Fynn and Javier Sola
++ *
++ */
++
++#ifndef __TIBETANLAYOUTENGINE_H
++#define __TIBETANLAYOUTENGINE_H
++
++// #include "LETypes.h"
++// #include "LEFontInstance.h"
++// #include "LEGlyphFilter.h"
++// #include "LayoutEngine.h"
++// #include "OpenTypeLayoutEngine.h"
++
++// #include "GlyphSubstitutionTables.h"
++// #include "GlyphDefinitionTables.h"
++// #include "GlyphPositioningTables.h"
++
++U_NAMESPACE_BEGIN
++
++// class MPreFixups;
++// class LEGlyphStorage;
++
++/**
++ * This class implements OpenType layout for Dzongkha and Tibetan OpenType fonts
++ *
++ * @internal
++ */
++class TibetanOpenTypeLayoutEngine : public OpenTypeLayoutEngine
++{
++public:
++    /**
++     * This is the main constructor. It constructs an instance of TibetanOpenTypeLayoutEngine for
++     * a particular font, script and language. It takes the GSUB table as a parameter since
++     * LayoutEngine::layoutEngineFactory has to read the GSUB table to know that it has an
++     * Tibetan OpenType font.
++     *
++     * @param fontInstance - the font
++     * @param scriptCode - the script
++     * @param langaugeCode - the language
++     * @param gsubTable - the GSUB table
++     * @param success - set to an error code if the operation fails
++     *
++     * @see LayoutEngine::layoutEngineFactory
++     * @see OpenTypeLayoutEngine
++     * @see ScriptAndLangaugeTags.h for script and language codes
++     *
++     * @internal
++     */
++    TibetanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
++                            le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success);
++
++    /**
++     * This constructor is used when the font requires a "canned" GSUB table which can't be known
++     * until after this constructor has been invoked.
++     *
++     * @param fontInstance - the font
++     * @param scriptCode - the script
++     * @param langaugeCode - the language
++     * @param success - set to an error code if the operation fails
++     *
++     * @see OpenTypeLayoutEngine
++     * @see ScriptAndLangaugeTags.h for script and language codes
++     *
++     * @internal
++     */
++    TibetanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
++                                le_int32 typoFlags, LEErrorCode &success);
++
++    /**
++     * The destructor, virtual for correct polymorphic invocation.
++     *
++     * @internal
++     */
++   virtual ~TibetanOpenTypeLayoutEngine();
++
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for the actual class.
++     *
++     * @internal ICU 3.6
++     */
++    virtual UClassID getDynamicClassID() const;
++
++    /**
++     * ICU "poor man's RTTI", returns a UClassID for this class.
++     *
++     * @internal ICU 3.6
++     */
++    static UClassID getStaticClassID();
++
++protected:
++
++    /**
++     * This method does Tibetan OpenType character processing. It assigns the OpenType feature
++     * tags to the characters, and may generate output characters which have been reordered.
++     * It may also split some vowels, resulting in more output characters than input characters.
++     *
++     * Input parameters:
++     * @param chars - the input character context
++     * @param offset - the index of the first character to process
++     * @param count - the number of characters to process
++     * @param max - the number of characters in the input context
++     * @param rightToLeft - <code>TRUE</code> if the characters are in a right to left directional run
++     * @param glyphStorage - the glyph storage object. The glyph and character index arrays will be set.
++     *                       the auxillary data array will be set to the feature tags.
++     *
++     * Output parameters:
++     * @param success - set to an error code if the operation fails
++     *
++     * @return the output character count
++     *
++     * @internal
++     */
++    virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
++            LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
++
++};
++
++U_NAMESPACE_END
++#endif
++
+diff --git a/src/share/native/sun/font/layout/TibetanReordering.cpp b/src/share/native/sun/font/layout/TibetanReordering.cpp
+new file mode 100644
+--- /dev/null
++++ jdk/src/share/native/sun/font/layout/TibetanReordering.cpp
+@@ -0,0 +1,414 @@
++/*
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute 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.
++ *
++ */
++
++/*
++ *
++ * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved
++ *
++ * Developed at DIT - Government of Bhutan
++ *
++ * Contact person: Pema Geyleg - <pema_geyleg at druknet.bt>
++ *
++ * This file is a modification of the ICU file KhmerReordering.cpp
++ * by Jens Herden and Javier Sola who have given all their possible rights to IBM and the Governement of Bhutan
++ * A first module for Dzongkha was developed by Karunakar under Panlocalisation funding.
++ * Assistance for this module has been received from Namgay Thinley, Christopher Fynn and Javier Sola
++ *
++ */
++
++//#include <stdio.h>
++#include "LETypes.h"
++#include "OpenTypeTables.h"
++#include "TibetanReordering.h"
++#include "LEGlyphStorage.h"
++
++
++U_NAMESPACE_BEGIN
++
++// Characters that get refered to by name...
++enum
++{
++    C_DOTTED_CIRCLE = 0x25CC,
++    C_PRE_NUMBER_MARK = 0x0F3F
++ };
++
++
++enum
++{
++    // simple classes, they are used in the statetable (in this file) to control the length of a syllable
++    // they are also used to know where a character should be placed (location in reference to the base character)
++    // and also to know if a character, when independtly displayed, should be displayed with a dotted-circle to
++    // indicate error in syllable construction
++    _xx = TibetanClassTable::CC_RESERVED,
++    _ba = TibetanClassTable::CC_BASE,
++    _sj = TibetanClassTable::CC_SUBJOINED | TibetanClassTable::CF_DOTTED_CIRCLE | TibetanClassTable::CF_POS_BELOW,
++    _tp = TibetanClassTable::CC_TSA_PHRU  | TibetanClassTable::CF_DOTTED_CIRCLE | TibetanClassTable::CF_POS_ABOVE,
++    _ac = TibetanClassTable::CC_A_CHUNG |  TibetanClassTable::CF_DOTTED_CIRCLE | TibetanClassTable::CF_POS_BELOW,
++    _cs = TibetanClassTable::CC_COMP_SANSKRIT | TibetanClassTable::CF_DOTTED_CIRCLE | TibetanClassTable::CF_POS_BELOW,
++    _ha = TibetanClassTable::CC_HALANTA | TibetanClassTable::CF_DOTTED_CIRCLE | TibetanClassTable::CF_POS_BELOW,
++    _bv = TibetanClassTable::CC_BELOW_VOWEL | TibetanClassTable::CF_DOTTED_CIRCLE | TibetanClassTable::CF_POS_BELOW,
++    _av = TibetanClassTable::CC_ABOVE_VOWEL | TibetanClassTable::CF_DOTTED_CIRCLE | TibetanClassTable::CF_POS_ABOVE,
++    _an = TibetanClassTable::CC_ANUSVARA | TibetanClassTable::CF_DOTTED_CIRCLE | TibetanClassTable::CF_POS_ABOVE,
++    _cb = TibetanClassTable::CC_CANDRABINDU | TibetanClassTable::CF_DOTTED_CIRCLE | TibetanClassTable::CF_POS_ABOVE,
++    _vs = TibetanClassTable::CC_VISARGA | TibetanClassTable::CF_DOTTED_CIRCLE| TibetanClassTable::CF_POS_AFTER,
++    _as = TibetanClassTable::CC_ABOVE_S_MARK | TibetanClassTable::CF_DOTTED_CIRCLE | TibetanClassTable::CF_POS_ABOVE,
++    _bs = TibetanClassTable::CC_BELOW_S_MARK | TibetanClassTable::CF_DOTTED_CIRCLE | TibetanClassTable::CF_POS_BELOW,
++    _di = TibetanClassTable::CC_DIGIT | TibetanClassTable::CF_DIGIT,
++    _pd = TibetanClassTable::CC_PRE_DIGIT_MARK | TibetanClassTable::CF_DOTTED_CIRCLE | TibetanClassTable::CF_PREDIGIT | TibetanClassTable::CF_POS_BEFORE ,
++    _bd = TibetanClassTable::CC_POST_BELOW_DIGIT_M | TibetanClassTable::CF_DOTTED_CIRCLE | TibetanClassTable::CF_POS_AFTER
++};
++
++
++// Character class tables
++//_xx Non Combining characters
++//_ba Base Consonants
++//_sj Subjoined consonants
++//_tp Tsa - phru
++//_ac A-chung, Vowel Lengthening mark
++//_cs Precomposed Sanskrit vowel + subjoined consonants
++//_ha Halanta/Virama
++//_bv Below vowel
++//_av above vowel
++//_an Anusvara
++//_cb Candrabindu
++//_vs Visaraga/Post mark
++//_as Upper Stress marks
++//_bs Lower Stress marks
++//_di Digit
++//_pd Number pre combining, Needs reordering
++//_bd Other number combining marks
++
++static const TibetanClassTable::CharClass tibetanCharClasses[] =
++{
++   // 0    1    2    3    4    5    6    7    8    9   a     b   c    d     e   f
++    _xx, _ba, _xx, _xx, _ba, _ba, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0F00 - 0F0F 0
++    _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _bd, _bd, _xx, _xx, _xx, _xx, _xx, _xx, // 0F10 - 0F1F 1
++    _di, _di, _di, _di, _di, _di, _di, _di, _di, _di, _xx, _xx, _xx, _xx, _xx, _xx, // 0F20 - 0F2F 2
++    _xx, _xx, _xx, _xx, _xx, _bs, _xx, _bs, _xx, _tp, _xx, _xx, _xx, _xx, _bd, _pd, // 0F30 - 0F3F 3
++    _ba, _ba, _ba, _ba, _ba, _ba, _ba, _ba, _xx, _ba, _ba, _ba, _ba, _ba, _ba, _ba, // 0F40 - 0F4F 4
++    _ba, _ba, _ba, _ba, _ba, _ba, _ba, _ba, _ba, _ba, _ba, _ba, _ba, _ba, _ba, _ba, // 0F50 - 0F5F 5
++    _ba, _ba, _ba, _ba, _ba, _ba, _ba, _ba, _ba, _ba, _ba, _xx, _xx, _xx, _xx, _xx, // 0F60 - 0F6F 6
++    _xx, _ac, _av, _cs, _bv, _bv, _cs, _cs, _cs, _cs, _av, _av, _av, _av, _an, _vs, // 0F70 - 0F7F 7
++    _av, _cs, _cb, _cb, _ha, _xx, _as, _as, _ba, _ba, _ba, _ba, _xx, _xx, _xx, _xx, // 0F80 - 0F8F 8
++    _sj, _sj, _sj, _sj, _sj, _sj, _sj, _sj, _xx, _sj, _sj, _sj, _sj, _sj, _sj, _sj, // 0F90 - 0F9F 9
++    _sj, _sj, _sj, _sj, _sj, _sj, _sj, _sj, _sj, _sj, _sj, _sj, _sj, _sj, _sj, _sj, // 0FA0 - 0FAF a
++    _sj, _sj, _sj, _sj, _sj, _sj, _sj, _sj, _sj, _sj, _sj, _sj, _sj, _xx, _sj, _sj, // 0FB0 - 0FBF b
++    _xx, _xx, _xx, _xx, _xx, _xx, _bs, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0FC0 - 0FCF c
++    _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx,// 0FD0 - 0FDF  d
++    _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0FE0 - 0FEF e
++    _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0FF0 - 0FFF f
++};
++
++
++//
++// Tibetan Class Tables
++//
++
++//
++// The range of characters defined in the above table is defined here. For Tibetan 0F00 to 0FFF
++// Even if the Tibetan range is bigger, most of the characters are not combinable, and therefore treated
++// as _xx
++static const TibetanClassTable tibetanClassTable = {0x0F00, 0x0FFF, tibetanCharClasses};
++
++
++// Below we define how a character in the input string is either in the tibetanCharClasses table
++// (in which case we get its type back), or an unknown object in which case we get _xx (CC_RESERVED) back
++TibetanClassTable::CharClass TibetanClassTable::getCharClass(LEUnicode ch) const
++{
++    if (ch < firstChar || ch > lastChar) {
++        return CC_RESERVED;
++    }
++
++    return classTable[ch - firstChar];
++}
++
++const TibetanClassTable *TibetanClassTable::getTibetanClassTable()
++{
++    return &tibetanClassTable;
++}
++
++
++
++class TibetanReorderingOutput : public UMemory {
++private:
++    le_int32 fSyllableCount;
++    le_int32 fOutIndex;
++    LEUnicode *fOutChars;
++
++    LEGlyphStorage &fGlyphStorage;
++
++
++public:
++    TibetanReorderingOutput(LEUnicode *outChars, LEGlyphStorage &glyphStorage)
++        : fSyllableCount(0), fOutIndex(0), fOutChars(outChars), fGlyphStorage(glyphStorage)
++    {
++        // nothing else to do...
++    }
++
++    ~TibetanReorderingOutput()
++    {
++        // nothing to do here...
++    }
++
++    void reset()
++    {
++        fSyllableCount += 1;
++    }
++
++    void writeChar(LEUnicode ch, le_uint32 charIndex, FeatureMask featureMask)
++    {
++        LEErrorCode success = LE_NO_ERROR;
++
++        fOutChars[fOutIndex] = ch;
++
++        fGlyphStorage.setCharIndex(fOutIndex, charIndex, success);
++        fGlyphStorage.setAuxData(fOutIndex, featureMask, success);
++
++        fOutIndex += 1;
++    }
++
++    le_int32 getOutputIndex()
++    {
++        return fOutIndex;
++    }
++};
++
++
++//TODO remove unused flags
++#define ccmpFeatureTag LE_CCMP_FEATURE_TAG
++#define blwfFeatureTag LE_BLWF_FEATURE_TAG
++#define pstfFeatureTag LE_PSTF_FEATURE_TAG
++#define presFeatureTag LE_PRES_FEATURE_TAG
++#define blwsFeatureTag LE_BLWS_FEATURE_TAG
++#define abvsFeatureTag LE_ABVS_FEATURE_TAG
++#define pstsFeatureTag LE_PSTS_FEATURE_TAG
++
++#define blwmFeatureTag LE_BLWM_FEATURE_TAG
++#define abvmFeatureTag LE_ABVM_FEATURE_TAG
++#define distFeatureTag LE_DIST_FEATURE_TAG
++
++#define prefFeatureTag LE_PREF_FEATURE_TAG
++#define abvfFeatureTag LE_ABVF_FEATURE_TAG
++#define cligFeatureTag LE_CLIG_FEATURE_TAG
++#define mkmkFeatureTag LE_MKMK_FEATURE_TAG
++
++// Shaping features
++#define prefFeatureMask 0x80000000UL
++#define blwfFeatureMask 0x40000000UL
++#define abvfFeatureMask 0x20000000UL
++#define pstfFeatureMask 0x10000000UL
++#define presFeatureMask 0x08000000UL
++#define blwsFeatureMask 0x04000000UL
++#define abvsFeatureMask 0x02000000UL
++#define pstsFeatureMask 0x01000000UL
++#define cligFeatureMask 0x00800000UL
++#define ccmpFeatureMask 0x00040000UL
++
++// Positioning features
++#define distFeatureMask 0x00400000UL
++#define blwmFeatureMask 0x00200000UL
++#define abvmFeatureMask 0x00100000UL
++#define mkmkFeatureMask 0x00080000UL
++
++#define tagPref    (ccmpFeatureMask | prefFeatureMask | presFeatureMask | cligFeatureMask | distFeatureMask)
++#define tagAbvf    (ccmpFeatureMask | abvfFeatureMask | abvsFeatureMask | cligFeatureMask | distFeatureMask | abvmFeatureMask | mkmkFeatureMask)
++#define tagPstf    (ccmpFeatureMask | blwfFeatureMask | blwsFeatureMask | prefFeatureMask | presFeatureMask | pstfFeatureMask | pstsFeatureMask | cligFeatureMask | distFeatureMask | blwmFeatureMask)
++#define tagBlwf    (ccmpFeatureMask | blwfFeatureMask | blwsFeatureMask | cligFeatureMask | distFeatureMask | blwmFeatureMask | mkmkFeatureMask)
++#define tagDefault (ccmpFeatureMask | prefFeatureMask | blwfFeatureMask | presFeatureMask | blwsFeatureMask | cligFeatureMask | distFeatureMask | abvmFeatureMask | blwmFeatureMask | mkmkFeatureMask)
++
++
++
++// These are in the order in which the features need to be applied
++// for correct processing
++static const FeatureMap featureMap[] =
++{
++    // Shaping features
++    {ccmpFeatureTag, ccmpFeatureMask},
++    {prefFeatureTag, prefFeatureMask},
++    {blwfFeatureTag, blwfFeatureMask},
++    {abvfFeatureTag, abvfFeatureMask},
++    {pstfFeatureTag, pstfFeatureMask},
++    {presFeatureTag, presFeatureMask},
++    {blwsFeatureTag, blwsFeatureMask},
++    {abvsFeatureTag, abvsFeatureMask},
++    {pstsFeatureTag, pstsFeatureMask},
++    {cligFeatureTag, cligFeatureMask},
++
++    // Positioning features
++    {distFeatureTag, distFeatureMask},
++    {blwmFeatureTag, blwmFeatureMask},
++    {abvmFeatureTag, abvmFeatureMask},
++    {mkmkFeatureTag, mkmkFeatureMask},
++};
++
++static const le_int32 featureMapCount = LE_ARRAY_SIZE(featureMap);
++
++// The stateTable is used to calculate the end (the length) of a well
++// formed Tibetan Syllable.
++//
++// Each horizontal line is ordered exactly the same way as the values in TibetanClassTable
++// CharClassValues in TibetanReordering.h This coincidence of values allows the
++// follow up of the table.
++//
++// Each line corresponds to a state, which does not necessarily need to be a type
++// of component... for example, state 2 is a base, with is always a first character
++// in the syllable, but the state could be produced a consonant of any type when
++// it is the first character that is analysed (in ground state).
++//
++static const le_int8 tibetanStateTable[][TibetanClassTable::CC_COUNT] =
++{
++
++
++    //Dzongkha state table
++    //xx  ba  sj  tp  ac  cs  ha  bv  av  an  cb  vs  as  bs  di  pd  bd
++    { 1,  2,  4,  3,  8,  7,  9, 10, 14, 13, 17, 18, 19, 19, 20, 21, 21,}, //  0 - ground state
++    {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,}, //  1 - exit state (or sign to the right of the syllable)
++    {-1, -1,  4,  3,  8,  7,  9, 10, 14, 13, 17, 18, 19, 19, -1, -1, -1,}, //  2 - Base consonant
++    {-1, -1,  5, -1,  8,  7, -1, 10, 14, 13, 17, 18, 19, 19, -1, -1, -1,}, //  3 - Tsa phru after base
++    {-1, -1,  4,  6,  8,  7,  9, 10, 14, 13, 17, 18, 19, 19, -1, -1, -1,}, //  4 - Subjoined consonant after base
++    {-1, -1,  5, -1,  8,  7, -1, 10, 14, 13, 17, 18, 19, 19, -1, -1, -1,}, //  5 - Subjoined consonant after tsa phru
++    {-1, -1, -1, -1,  8,  7, -1, 10, 14, 13, 17, 18, 19, 19, -1, -1, -1,}, //  6 - Tsa phru after subjoined consonant
++    {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, 19, -1, -1, -1,}, //  7 - Pre Composed Sanskrit
++    {-1, -1, -1, -1, -1, -1, -1, 10, 14, 13, 17, 18, 19, 19, -1, -1, -1,}, //  8 - A-chung
++    {-1, -1, -1, -1, -1, -1, -1, -1, 14, 13, 17, -1, 19, 19, -1, -1, -1,}, //  9 - Halanta
++    {-1, -1, -1, -1, -1, -1, -1, 11, 14, 13, 17, 18, 19, 19, -1, -1, -1,}, // 10 - below vowel 1
++    {-1, -1, -1, -1, -1, -1, -1, 12, 14, 13, 17, 18, 19, 19, -1, -1, -1,}, // 11 - below vowel 2
++    {-1, -1, -1, -1, -1, -1, -1, -1, 14, 13, 17, 18, 19, 19, -1, -1, -1,}, // 12 - below vowel 3
++    {-1, -1, -1, -1, -1, -1, -1, -1, 14, 17, 17, 18, 19, 19, -1, -1, -1,}, // 13 - Anusvara before vowel
++    {-1, -1, -1, -1, -1, -1, -1, -1, 15, 17, 17, 18, 19, 19, -1, -1, -1,}, // 14 - above vowel 1
++    {-1, -1, -1, -1, -1, -1, -1, -1, 16, 17, 17, 18, 19, 19, -1, -1, -1,}, // 15 - above vowel 2
++    {-1, -1, -1, -1, -1, -1, -1, -1, -1, 17, 17, 18, 19, 19, -1, -1, -1,}, // 16 - above vowel 3
++    {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 18, 19, 19, -1, -1, -1,}, // 17 - Anusvara or Candrabindu after vowel
++    {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, 19, -1, -1, -1,}, // 18 - Visarga
++    {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,}, // 19 - strss mark
++    {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 21, 21,}, // 20 - digit
++    {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,}, // 21 - digit mark
++
++
++};
++
++
++const FeatureMap *TibetanReordering::getFeatureMap(le_int32 &count)
++{
++    count = featureMapCount;
++
++    return featureMap;
++}
++
++
++// Given an input string of characters and a location in which to start looking
++// calculate, using the state table, which one is the last character of the syllable
++// that starts in the starting position.
++le_int32 TibetanReordering::findSyllable(const TibetanClassTable *classTable, const LEUnicode *chars, le_int32 prev, le_int32 charCount)
++{
++    le_int32 cursor = prev;
++    le_int8 state = 0;
++
++    while (cursor < charCount) {
++        TibetanClassTable::CharClass charClass = (classTable->getCharClass(chars[cursor]) & TibetanClassTable::CF_CLASS_MASK);
++
++        state = tibetanStateTable[state][charClass];
++
++        if (state < 0) {
++            break;
++        }
++
++        cursor += 1;
++    }
++
++    return cursor;
++}
++
++
++// This is the real reordering function as applied to the Tibetan language
++
++le_int32 TibetanReordering::reorder(const LEUnicode *chars, le_int32 charCount, le_int32,
++                                  LEUnicode *outChars, LEGlyphStorage &glyphStorage)
++{
++    const TibetanClassTable *classTable = TibetanClassTable::getTibetanClassTable();
++
++    TibetanReorderingOutput output(outChars, glyphStorage);
++    TibetanClassTable::CharClass charClass;
++    le_int32 i, prev = 0;
++
++    // This loop only exits when we reach the end of a run, which may contain
++    // several syllables.
++    while (prev < charCount) {
++        le_int32 syllable = findSyllable(classTable, chars, prev, charCount);
++
++        output.reset();
++
++        // shall we add a dotted circle?
++        // If in the position in which the base should be (first char in the string) there is
++        // a character that has the Dotted circle flag (a character that cannot be a base)
++        // then write a dotted circle
++        if (classTable->getCharClass(chars[prev]) & TibetanClassTable::CF_DOTTED_CIRCLE) {
++            output.writeChar(C_DOTTED_CIRCLE, prev, tagDefault);
++        }
++
++        // copy the rest to output, inverting the pre-number mark if present after a digit.
++        for (i = prev; i < syllable; i += 1) {
++            charClass = classTable->getCharClass(chars[i]);
++
++           if ((TibetanClassTable::CF_DIGIT & charClass)
++              && ( classTable->getCharClass(chars[i+1]) & TibetanClassTable::CF_PREDIGIT))
++           {
++                         output.writeChar(C_PRE_NUMBER_MARK, i, tagPref);
++                         output.writeChar(chars[i], i+1 , tagPref);
++                        i += 1;
++          } else {
++            switch (charClass & TibetanClassTable::CF_POS_MASK) {
++
++                // If the present character is a number, and the next character is a pre-number combining mark
++            // then the two characters are reordered
++
++                case TibetanClassTable::CF_POS_ABOVE :
++                    output.writeChar(chars[i], i, tagAbvf);
++                    break;
++
++                case TibetanClassTable::CF_POS_AFTER :
++                    output.writeChar(chars[i], i, tagPstf);
++                    break;
++
++                case TibetanClassTable::CF_POS_BELOW :
++                    output.writeChar(chars[i], i, tagBlwf);
++                    break;
++
++                default:
++                    // default - any other characters
++                   output.writeChar(chars[i], i, tagDefault);
++                    break;
++            } // switch
++          } // if
++        } // for
++
++        prev = syllable; // move the pointer to the start of next syllable
++    }
++
++    return output.getOutputIndex();
++}
++
++
++U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/TibetanReordering.h b/src/share/native/sun/font/layout/TibetanReordering.h
+new file mode 100644
+--- /dev/null
++++ jdk/src/share/native/sun/font/layout/TibetanReordering.h
+@@ -0,0 +1,176 @@
++/*
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute 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.
++ *
++ */
++
++/*
++ *
++ * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved
++ *
++ * Developed at DIT - Government of Bhutan
++ *
++ * Contact person: Pema Geyleg - <pema_geyleg at druknet.bt>
++ *
++ * This file is a modification of the ICU file KhmerReordering.h
++ * by Jens Herden and Javier Sola who have given all their possible rights to IBM and the Governement of Bhutan
++ * A first module for Dzongkha was developed by Karunakar under Panlocalisation funding.
++ * Assistance for this module has been received from Namgay Thinley, Christopher Fynn and Javier Sola
++ *
++ */
++
++#ifndef __TIBETANREORDERING_H
++#define __TIBETANORDERING_H
++
++/**
++ * \file
++ * \internal
++ */
++
++// #include "LETypes.h"
++// #include "OpenTypeTables.h"
++
++U_NAMESPACE_BEGIN
++
++class LEGlyphStorage;
++
++// Vocabulary
++//     Base ->         A consonant in its full (not subscript) form. It is the
++//                     center of the syllable, it can be souranded by subjoined consonants, vowels,
++//                     signs... but there is only one base in a stack, it has to be coded as
++//                     the first character of the syllable.Included here are also groups of base + subjoined
++//                                                                               which are represented by one single code point in unicode (e.g. 0F43) Also other characters that might take
++//                     subjoined consonants or other combining characters.
++//     Subjoined ->    Subjoined consonants and groups of subjoined consonants which have a single code-point
++//                     to repersent the group (even if each subjoined consonant is represented independently
++//                     by anothe code-point
++//     Tsa Phru -->    Tsa Phru character, Bhutanese people will always place it right after the base, but sometimes, due to
++//                                                                              "normalization"
++//                                                                               is placed after all the subjoined consonants, and it is also permitted there.
++//     A Chung  Vowel lengthening mark --> . 0F71 It is placed after the base and any subjoined consonants but before any vowels
++//     Precomposed Sanskrit vowels --> The are combinations of subjoined consonants + vowels that have been assigned
++//                     a given code-point (in spite of each single part of them having also a code-point
++//                     They are avoided, and users are encouraged to use the combination of code-points that
++//                     represents the same sound instead of using this combined characters. This is included here
++//                     for compatibility with possible texts that use them (they are not in the Dzongkha keyboard).
++//     Halanta ->      The Halanta or Virama character 0F84 indicates that a consonant should not use its inheernt vowel,
++//                     in spite of not having other vowels present. It is usually placed immediatly after a base consonant,
++//                     but in some special cases it can also be placed after a subjoined consonant, so this is also
++//                     permitted in this algorithm. (Halanta is always displayed in Tibetan not used as a connecting char)
++//
++//     Subjoined vowels -> Dependent vowels (matras) placed below the base and below all subjoined consonants. There
++//                     might be as much as three subjoined vowels in a given stack (only one in general text, but up
++//                     to three for abreviations, they have to be permitted).
++//     Superscript vowels -> There are three superscript vowels, and they can be repeated or combined (up to three
++//                     times. They can combine with subjoined vowels, and are always coded after these.
++//     Anusvara -->    Nasalisation sign. Traditioinally placed in absence of vowels, but also after vowels. In some
++//                     special cases it can be placed before a vowel, so this is also permitted
++//     Candrabindu ->  Forms of the Anusvara with different glyphs (and different in identity) which can be placed
++//                     without vowel or after the vowel, but never before. Cannot combine with Anusvara.
++//     Stress marks -> Marks placed above or below a syllable, affecting the whole syllable. They are combining
++//                     marks, so they have to be attached to a specific stack. The are using to emphasise a syllable.
++//
++//     Digits ->       Digits are not considered as non-combining characters because there are a few characters which
++//                     combine with them, so they have to be considered independently.
++//     Digit combining marks -> dependent marks that combine with digits.
++//
++//     TODO
++//     There are a number of characters in the CJK block that are used in Tibetan script, two of these are symbols
++//     are used as bases for combining glyphs, and have not been encoded in Tibetan. As these characters are outside
++//     of the tibetan block, they have not been treated in this program.
++
++
++struct TibetanClassTable    // This list must include all types of components that can be used inside a syllable
++{
++    enum CharClassValues  // order is important here! This order must be the same that is found in each horizontal
++                          // line in the statetable for Tibetan (file TibetanReordering.cpp). It assigns one number
++                          // to each type of character that has to be considered when analysing the order in which
++                          // characters can be placed
++    {
++        CC_RESERVED             =  0, //Non Combining Characters
++        CC_BASE                 =  1, // Base Consonants, Base Consonants with Subjoined attached in code point, Sanskrit base marks
++        CC_SUBJOINED            =  2, // Subjoined Consonats, combination of more than Subjoined Consonants in the code point
++        CC_TSA_PHRU             =  3, // Tsa-Phru character 0F39
++        CC_A_CHUNG              =  4, // Vowel Lenthening a-chung mark 0F71
++        CC_COMP_SANSKRIT        =  5, // Precomposed Sanskrit vowels including Subjoined characters and vowels
++        CC_HALANTA              =  6, // Halanta Character 0F84
++        CC_BELOW_VOWEL          =  7, // Subjoined vowels
++        CC_ABOVE_VOWEL          =  8, // Superscript vowels
++        CC_ANUSVARA             =  9, // Tibetan sign Rjes Su Nga Ro 0F7E
++        CC_CANDRABINDU          = 10, // Tibetan sign Sna Ldan and Nyi Zla Naa Da 0F82, 0F83
++        CC_VISARGA              = 11, // Tibetan sign Rnam Bcad (0F7F)
++        CC_ABOVE_S_MARK         = 12, // Stress Marks placed above the text
++        CC_BELOW_S_MARK         = 13, // Stress Marks placed below the text
++        CC_DIGIT                = 14, // Dzongkha Digits
++        CC_PRE_DIGIT_MARK       = 15, // Mark placed before the digit
++        CC_POST_BELOW_DIGIT_M   = 16, // Mark placed below or after the digit
++        CC_COUNT                = 17  // This is the number of character classes
++    };
++
++    enum CharClassFlags
++    {
++        CF_CLASS_MASK    = 0x0000FFFF,
++
++        CF_DOTTED_CIRCLE = 0x04000000,  // add a dotted circle if a character with this flag is the first in a syllable
++        CF_DIGIT         = 0x01000000,  // flag to speed up comparaisson
++        CF_PREDIGIT      = 0x02000000,  // flag to detect pre-digit marks for reordering
++
++        // position flags
++        CF_POS_BEFORE    = 0x00080000,
++        CF_POS_BELOW     = 0x00040000,
++        CF_POS_ABOVE     = 0x00020000,
++        CF_POS_AFTER     = 0x00010000,
++        CF_POS_MASK      = 0x000f0000
++    };
++
++    typedef le_uint32 CharClass;
++
++    typedef le_int32 ScriptFlags;
++
++    LEUnicode firstChar;   // for Tibetan this will become xOF00
++    LEUnicode lastChar;    //  and this x0FFF
++    const CharClass *classTable;
++
++    CharClass getCharClass(LEUnicode ch) const;
++
++    static const TibetanClassTable *getTibetanClassTable();
++};
++
++
++class TibetanReordering /* not : public UObject because all methods are static */ {
++public:
++    static le_int32 reorder(const LEUnicode *theChars, le_int32 charCount, le_int32 scriptCode,
++        LEUnicode *outChars, LEGlyphStorage &glyphStorage);
++
++    static const FeatureMap *getFeatureMap(le_int32 &count);
++
++private:
++    // do not instantiate
++    TibetanReordering();
++
++    static le_int32 findSyllable(const TibetanClassTable *classTable, const LEUnicode *chars, le_int32 prev, le_int32 charCount);
++
++};
++
++
++U_NAMESPACE_END
++#endif
+diff --git a/test/java/awt/font/TextLayout/TestOldHangul.java b/test/java/awt/font/TextLayout/TestOldHangul.java
+new file mode 100644
+--- /dev/null
++++ jdk/test/java/awt/font/TextLayout/TestOldHangul.java
+@@ -0,0 +1,83 @@
++/*
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License version 2 only, as
++ * published by the Free Software Foundation.
++ *
++ * This code is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
++ * version 2 for more details (a copy is included in the LICENSE file that
++ * accompanied this code).
++ *
++ * You should have received a copy of the GNU General Public License version
++ * 2 along with this work; if not, write to the Free Software Foundation,
++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++ *
++ * Please 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 @(#)TestOldHangul.java
++ * @summary Verify Old Hangul display
++ * @bug 6886358
++ * @ignore Requires a special font installed.
++ */
++
++import javax.swing.*;
++import javax.swing.border.LineBorder;
++import java.awt.*;
++import java.awt.event.ActionEvent;
++
++public class TestOldHangul {
++    public static void main(String[] args) {
++        SwingUtilities.invokeLater(new Runnable() {
++            public void run() {
++                new TestOldHangul().run();
++            }
++        });
++    }
++    public static boolean AUTOMATIC_TEST=true;  // true; run test automatically, else manually at button push
++
++    private void run()  {
++        Font ourFont = null;
++        final String fontName = "UnBatangOdal.ttf";  // download from http://chem.skku.ac.kr/~wkpark/project/font/GSUB/UnbatangOdal/  and place in {user.home}/fonts/
++        try {
++            ourFont = Font.createFont(Font.TRUETYPE_FONT, new java.io.File(new java.io.File(System.getProperty("user.home"),"fonts"), fontName));
++            ourFont = ourFont.deriveFont((float)48.0);
++        } catch(Throwable t) {
++            t.printStackTrace();
++            System.err.println("Fail: " + t);
++            return;
++        }
++        JFrame frame = new JFrame(System.getProperty("java.version"));
++        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
++        JPanel panel = new JPanel();
++        final JTextArea label = new JTextArea("(empty)");
++        label.setSize(400, 300);
++        label.setBorder(new LineBorder(Color.black));
++        label.setFont(ourFont);
++        final String str = "\u110A\u119E\u11B7\u0020\u1112\u119E\u11AB\uAE00\u0020\u1100\u119E\u11F9\u0020\u112B\u119E\u11BC\n";
++
++        if(AUTOMATIC_TEST) {  /* run the test automatically (else, manually) */
++            label.setText(str);
++        } else {
++        JButton button = new JButton("Old Hangul");
++        button.addActionListener(new AbstractAction() {
++            public void actionPerformed(ActionEvent actionEvent) {
++                label.setText(str);
++            }
++        });
++        panel.add(button);
++        }
++        panel.add(label);
++
++        frame.getContentPane().add(panel);
++        frame.pack();
++        frame.setVisible(true);
++    }
++}
++
+diff --git a/test/java/awt/font/TextLayout/TestTibetan.java b/test/java/awt/font/TextLayout/TestTibetan.java
+new file mode 100644
+--- /dev/null
++++ jdk/test/java/awt/font/TextLayout/TestTibetan.java
+@@ -0,0 +1,87 @@
++/*
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License version 2 only, as
++ * published by the Free Software Foundation.
++ *
++ * This code is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
++ * version 2 for more details (a copy is included in the LICENSE file that
++ * accompanied this code).
++ *
++ * You should have received a copy of the GNU General Public License version
++ * 2 along with this work; if not, write to the Free Software Foundation,
++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++ *
++ * Please 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 @(#)TestTibetan.java
++ * @summary verify tibetan output
++ * @bug 6886358
++ * @ignore Requires a special font installed
++ */
++
++import javax.swing.*;
++import javax.swing.border.LineBorder;
++import java.awt.*;
++import java.awt.event.ActionEvent;
++
++public class TestTibetan {
++    public static void main(String[] args) {
++        SwingUtilities.invokeLater(new Runnable() {
++            public void run() {
++                new TestTibetan().run();
++            }
++        });
++    }
++    public static boolean AUTOMATIC_TEST=true;  // true; run test automatically, else manually at button push
++
++    private void run()  {
++        Font ourFont = null;
++        try {
++            //For best results: Font from:  http://download.savannah.gnu.org/releases/free-tibetan/jomolhari/
++            // place in $(user.home)/fonts/
++            ourFont = Font.createFont(Font.TRUETYPE_FONT, new java.io.File(new java.io.File(System.getProperty("user.home"),"fonts"), "Jomolhari-alpha3c-0605331.ttf"));
++
++            //ourFont = new Font("serif",Font.PLAIN, 24);
++            ourFont = ourFont.deriveFont((float)24.0);
++        } catch(Throwable t) {
++            t.printStackTrace();
++            System.err.println("Fail: " + t);
++            return;
++        }
++        JFrame frame = new JFrame(System.getProperty("java.version"));
++        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
++        JPanel panel = new JPanel();
++        final JTextArea label = new JTextArea("(empty)");
++        label.setSize(400, 300);
++        label.setBorder(new LineBorder(Color.black));
++        label.setFont(ourFont);
++
++        final String str = "\u0F04\u0F05\u0F0D\u0F0D\u0020\u0F4F\u0F72\u0F53\u0F0B\u0F4F\u0F72\u0F53\u0F0B\u0F42\u0FB1\u0F72\u0F0B\u0F51\u0F54\u0F60\u0F0B\u0F62\u0FA9\u0F63";  // TinTin.
++
++        if(AUTOMATIC_TEST) {  /* run the test automatically (else, manually) */
++            label.setText(str);
++        } else {
++        JButton button = new JButton("Set Char x0DDD");
++        button.addActionListener(new AbstractAction() {
++            public void actionPerformed(ActionEvent actionEvent) {
++                label.setText(str);
++            }
++        });
++        panel.add(button);
++        }
++        panel.add(label);
++
++        frame.getContentPane().add(panel);
++        frame.pack();
++        frame.setVisible(true);
++    }
++}
++

Added: trunk/java/openjdk6/files/icedtea/openjdk/6888167-medialib_memory_leaks.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/openjdk/6888167-medialib_memory_leaks.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/openjdk/6888167-medialib_memory_leaks.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,134 @@
+# 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;
+     }
+ 

Added: trunk/java/openjdk6/files/icedtea/openjdk/6961178-doclet_xml.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/openjdk/6961178-doclet_xml.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/openjdk/6961178-doclet_xml.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,1989 @@
+# HG changeset patch
+# User andrew
+# Date 1371665441 18000
+# Node ID c9c59391b86f45e4af2a89d95e1ba83ffdaf1d66
+# Parent  694e895f2b866d36ed7f8d4ea08ec64677d3fba1
+6961178: Allow doclet.xml to contain XML attributes
+Reviewed-by: bpatel
+
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java
+@@ -92,44 +92,42 @@
+     public abstract void build() throws IOException;
+ 
+     /**
+-     * Build the documentation, as specified by the given XML elements.
++     * Build the documentation, as specified by the given XML element.
+      *
+-     * @param elements the XML elements that specify which components to
+-     *                 document.
++     * @param node the XML element that specifies which component to document.
+      */
+-    protected void build(List elements) {
+-        for (int i = 0; i < elements.size(); i++ ) {
+-            Object element = elements.get(i);
+-            String component = (String)
+-                ((element instanceof String) ?
+-                     element :
+-                    ((List) element).get(0));
+-            try {
+-                invokeMethod("build" + component,
+-                    element instanceof String ?
+-                        new Class[] {} :
+-                        new Class[] {List.class},
+-                    element instanceof String ?
+-                        new Object[] {} :
+-                        new Object[] {((List) element).subList(1,
+-                            ((List) element).size())});
+-            } catch (NoSuchMethodException e) {
+-                e.printStackTrace();
+-                configuration.root.printError("Unknown element: " + component);
+-                throw new DocletAbortException();
+-            } catch (InvocationTargetException e) {
+-                e.getCause().printStackTrace();
+-            } catch (Exception e) {
+-                e.printStackTrace();
+-                configuration.root.printError("Exception " +
+-                    e.getClass().getName() +
+-                    " thrown while processing element: " + component);
+-                throw new DocletAbortException();
+-            }
++    protected void build(XMLNode node) {
++        String component = node.name;
++        try {
++            invokeMethod("build" + component,
++                    new Class<?>[] { XMLNode.class },
++                    new Object[] { node });
++        } catch (NoSuchMethodException e) {
++            e.printStackTrace();
++            configuration.root.printError("Unknown element: " + component);
++            throw new DocletAbortException();
++        } catch (InvocationTargetException e) {
++            e.getCause().printStackTrace();
++        } catch (Exception e) {
++            e.printStackTrace();
++            configuration.root.printError("Exception " +
++                e.getClass().getName() +
++                " thrown while processing element: " + component);
++            throw new DocletAbortException();
+         }
+     }
+ 
+     /**
++     * Build the documentation, as specified by the children of the given XML element.
++     *
++     * @param node the XML element that specifies which components to document.
++     */
++    protected void buildChildren(XMLNode node) {
++        for (XMLNode child: node.children)
++            build(child);
++    }
++
++    /**
+      * Given the name and parameters, invoke the method in the builder.  This
+      * method is required to invoke the appropriate build method as instructed
+      * by the builder XML file.
+@@ -138,7 +136,14 @@
+      * @param paramClasses the types for each parameter.
+      * @param params       the parameters of the method.
+      */
+-    protected abstract void invokeMethod(String methodName, Class[] paramClasses,
+-            Object[] params)
+-    throws Exception;
++    protected void invokeMethod(String methodName, Class<?>[] paramClasses,
++             Object[] params)
++    throws Exception {
++        if (DEBUG) {
++            configuration.root.printError("DEBUG: " + this.getClass().getName()
++                + "." + methodName);
++        }
++        Method method = this.getClass().getMethod(methodName, paramClasses);
++        method.invoke(this, params);
++    }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractMemberBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractMemberBuilder.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractMemberBuilder.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractMemberBuilder.java
+@@ -27,7 +27,6 @@
+ 
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+-import java.util.*;
+ 
+ /**
+  * The superclass for all member builders.  Member builders are only executed
+@@ -69,9 +68,10 @@
+      *
+      * @param elements {@inheritDoc}
+      */
+-    public void build(List elements) {
++    @Override
++    public void build(XMLNode node) {
+         if (hasMembersToDocument()) {
+-            super.build(elements);
++            super.build(node);
+         }
+     }
+ 
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java
+@@ -30,7 +30,6 @@
+ import com.sun.javadoc.*;
+ import java.io.*;
+ import java.util.*;
+-import java.lang.reflect.*;
+ 
+ /**
+  * Builds the summary for a given annotation type.
+@@ -92,20 +91,6 @@
+     /**
+      * {@inheritDoc}
+      */
+-    public void invokeMethod(String methodName, Class[] paramClasses,
+-            Object[] params)
+-    throws Exception {
+-        if (DEBUG) {
+-            configuration.root.printError("DEBUG: " + this.getClass().getName()
+-                + "." + methodName);
+-        }
+-        Method method = this.getClass().getMethod(methodName, paramClasses);
+-        method.invoke(this, params);
+-    }
+-
+-    /**
+-     * {@inheritDoc}
+-     */
+     public void build() throws IOException {
+         build(LayoutParser.getInstance(configuration).parseXML(ROOT));
+     }
+@@ -122,8 +107,8 @@
+       *
+       * @param elements the XML elements that specify how to document a class.
+       */
+-     public void buildAnnotationTypeDoc(List elements) throws Exception {
+-        build(elements);
++     public void buildAnnotationTypeDoc(XMLNode node) throws Exception {
++        buildChildren(node);
+         writer.close();
+         copyDocFiles();
+      }
+@@ -154,7 +139,7 @@
+     /**
+      * Build the header of the page.
+      */
+-    public void buildAnnotationTypeHeader() {
++    public void buildAnnotationTypeHeader(XMLNode node) {
+         writer.writeHeader(configuration.getText("doclet.AnnotationType") +
+             " " + annotationTypeDoc.name());
+     }
+@@ -162,14 +147,14 @@
+     /**
+      * If this class is deprecated, print the appropriate information.
+      */
+-    public void buildDeprecationInfo () {
++    public void buildDeprecationInfo (XMLNode node) {
+         writer.writeAnnotationTypeDeprecationInfo();
+     }
+ 
+     /**
+      * Build the signature of the current annotation type.
+      */
+-    public void buildAnnotationTypeSignature() {
++    public void buildAnnotationTypeSignature(XMLNode node) {
+         StringBuffer modifiers = new StringBuffer(
+             annotationTypeDoc.modifiers() + " ");
+         writer.writeAnnotationTypeSignature(
+@@ -180,14 +165,14 @@
+     /**
+      * Build the class description.
+      */
+-    public void buildAnnotationTypeDescription() {
++    public void buildAnnotationTypeDescription(XMLNode node) {
+        writer.writeAnnotationTypeDescription();
+     }
+ 
+     /**
+      * Build the tag information for the current class.
+      */
+-    public void buildAnnotationTypeTagInfo() {
++    public void buildAnnotationTypeTagInfo(XMLNode node) {
+        writer.writeAnnotationTypeTagInfo();
+     }
+ 
+@@ -197,9 +182,9 @@
+      * @param elements the XML elements that specify how a member summary is
+      *                 documented.
+      */
+-    public void buildMemberSummary(List elements) throws Exception {
++    public void buildMemberSummary(XMLNode node) throws Exception {
+         configuration.getBuilderFactory().
+-            getMemberSummaryBuilder(writer).build(elements);
++            getMemberSummaryBuilder(writer).buildChildren(node);
+         writer.completeMemberSummaryBuild();
+     }
+ 
+@@ -209,10 +194,10 @@
+      * @param elements the XML elements that specify how a annotation type
+      *                 members are documented.
+      */
+-    public void buildAnnotationTypeOptionalMemberDetails(List elements)
++    public void buildAnnotationTypeOptionalMemberDetails(XMLNode node)
+     throws Exception {
+         configuration.getBuilderFactory().
+-            getAnnotationTypeOptionalMemberBuilder(writer).build(elements);
++            getAnnotationTypeOptionalMemberBuilder(writer).buildChildren(node);
+     }
+ 
+     /**
+@@ -221,17 +206,17 @@
+      * @param elements the XML elements that specify how a annotation type
+      *                 members are documented.
+      */
+-    public void buildAnnotationTypeRequiredMemberDetails(List elements)
++    public void buildAnnotationTypeRequiredMemberDetails(XMLNode node)
+     throws Exception {
+         configuration.getBuilderFactory().
+-            getAnnotationTypeRequiredMemberBuilder(writer).build(elements);
++            getAnnotationTypeRequiredMemberBuilder(writer).buildChildren(node);
+     }
+ 
+ 
+     /**
+      * Build the footer of the page.
+      */
+-    public void buildAnnotationTypeFooter() {
++    public void buildAnnotationTypeFooter(XMLNode node) {
+         writer.writeFooter();
+     }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeOptionalMemberBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeOptionalMemberBuilder.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeOptionalMemberBuilder.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeOptionalMemberBuilder.java
+@@ -30,7 +30,6 @@
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.javadoc.*;
+ import java.util.*;
+-import java.lang.reflect.*;
+ 
+ /**
+  * Builds documentation for optional annotation type members.
+@@ -85,6 +84,7 @@
+     /**
+      * {@inheritDoc}
+      */
++    @Override
+     public String getName() {
+         return "AnnotationTypeOptionalMemberDetails";
+     }
+@@ -95,34 +95,20 @@
+      * @param elements the XML elements that specify how to construct this
+      *                documentation.
+      */
+-    public void buildAnnotationTypeOptionalMember(List elements) {
++    public void buildAnnotationTypeOptionalMember(XMLNode node) {
+         if (writer == null) {
+             return;
+         }
+         for (currentMemberIndex = 0; currentMemberIndex < members.size();
+             currentMemberIndex++) {
+-            build(elements);
++            buildChildren(node);
+         }
+     }
+ 
+     /**
+-     * {@inheritDoc}
+-     */
+-    public void invokeMethod(String methodName, Class[] paramClasses,
+-            Object[] params)
+-    throws Exception {
+-        if (DEBUG) {
+-            configuration.root.printError("DEBUG: " + this.getClass().getName()
+-                + "." + methodName);
+-        }
+-        Method method = this.getClass().getMethod(methodName, paramClasses);
+-        method.invoke(this, params);
+-    }
+-
+-    /**
+      * Document the default value for this optional member.
+      */
+-    public void buildDefaultValueInfo() {
++    public void buildDefaultValueInfo(XMLNode node) {
+         ((AnnotationTypeOptionalMemberWriter) writer).writeDefaultValueInfo(
+             (MemberDoc) members.get(currentMemberIndex));
+     }
+@@ -130,6 +116,7 @@
+     /**
+      * {@inheritDoc}
+      */
++    @Override
+     public AnnotationTypeRequiredMemberWriter getWriter() {
+         return writer;
+     }
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java
+@@ -30,7 +30,6 @@
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.javadoc.*;
+ import java.util.*;
+-import java.lang.reflect.*;
+ 
+ /**
+  * Builds documentation for required annotation type members.
+@@ -114,20 +113,6 @@
+     }
+ 
+     /**
+-     * {@inheritDoc}
+-     */
+-    public void invokeMethod(String methodName, Class[] paramClasses,
+-            Object[] params)
+-    throws Exception {
+-        if (DEBUG) {
+-            configuration.root.printError("DEBUG: " + this.getClass().getName()
+-                + "." + methodName);
+-        }
+-        Method method = this.getClass().getMethod(methodName, paramClasses);
+-        method.invoke(this, params);
+-    }
+-
+-    /**
+      * Returns a list of members that will be documented for the given class.
+      * This information can be used for doclet specific documentation
+      * generation.
+@@ -161,20 +146,20 @@
+      * @param elements the XML elements that specify how to construct this
+      *                documentation.
+      */
+-    public void buildAnnotationTypeRequiredMember(List elements) {
++    public void buildAnnotationTypeRequiredMember(XMLNode node) {
+         if (writer == null) {
+             return;
+         }
+         for (currentMemberIndex = 0; currentMemberIndex < members.size();
+             currentMemberIndex++) {
+-            build(elements);
++            buildChildren(node);
+         }
+     }
+ 
+     /**
+      * Build the overall header.
+      */
+-    public void buildHeader() {
++    public void buildHeader(XMLNode node) {
+         writer.writeHeader(classDoc,
+             configuration.getText("doclet.Annotation_Type_Member_Detail"));
+     }
+@@ -182,7 +167,7 @@
+     /**
+      * Build the header for the individual members.
+      */
+-    public void buildMemberHeader() {
++    public void buildMemberHeader(XMLNode node) {
+         writer.writeMemberHeader((MemberDoc) members.get(
+                 currentMemberIndex),
+             currentMemberIndex == 0);
+@@ -191,14 +176,14 @@
+     /**
+      * Build the signature.
+      */
+-    public void buildSignature() {
++    public void buildSignature(XMLNode node) {
+         writer.writeSignature((MemberDoc) members.get(currentMemberIndex));
+     }
+ 
+     /**
+      * Build the deprecation information.
+      */
+-    public void buildDeprecationInfo() {
++    public void buildDeprecationInfo(XMLNode node) {
+         writer.writeDeprecated((MemberDoc) members.get(currentMemberIndex));
+     }
+ 
+@@ -206,7 +191,7 @@
+      * Build the comments for the member.  Do nothing if
+      * {@link Configuration#nocomment} is set to true.
+      */
+-    public void buildMemberComments() {
++    public void buildMemberComments(XMLNode node) {
+         if(! configuration.nocomment){
+             writer.writeComments((MemberDoc) members.get(currentMemberIndex));
+         }
+@@ -215,21 +200,21 @@
+     /**
+      * Build the tag information.
+      */
+-    public void buildTagInfo() {
++    public void buildTagInfo(XMLNode node) {
+         writer.writeTags((MemberDoc) members.get(currentMemberIndex));
+     }
+ 
+     /**
+      * Build the footer for the individual member.
+      */
+-    public void buildMemberFooter() {
++    public void buildMemberFooter(XMLNode node) {
+         writer.writeMemberFooter();
+     }
+ 
+     /**
+      * Build the overall footer.
+      */
+-    public void buildFooter() {
++    public void buildFooter(XMLNode node) {
+         writer.writeFooter(classDoc);
+     }
+ 
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java
+@@ -30,7 +30,6 @@
+ import com.sun.javadoc.*;
+ import java.io.*;
+ import java.util.*;
+-import java.lang.reflect.*;
+ 
+ /**
+  * Builds the summary for a given class.
+@@ -108,20 +107,6 @@
+     /**
+      * {@inheritDoc}
+      */
+-    public void invokeMethod(String methodName, Class[] paramClasses,
+-            Object[] params)
+-    throws Exception {
+-        if (DEBUG) {
+-            configuration.root.printError("DEBUG: " + this.getClass().getName()
+-                + "." + methodName);
+-        }
+-        Method method = this.getClass().getMethod(methodName, paramClasses);
+-        method.invoke(this, params);
+-    }
+-
+-    /**
+-     * {@inheritDoc}
+-     */
+     public void build() throws IOException {
+         build(LayoutParser.getInstance(configuration).parseXML(ROOT));
+     }
+@@ -138,8 +123,8 @@
+       *
+       * @param elements the XML elements that specify how to document a class.
+       */
+-     public void buildClassDoc(List elements) throws Exception {
+-        build(elements);
++     public void buildClassDoc(XMLNode node) throws Exception {
++        buildChildren(node);
+         writer.close();
+         copyDocFiles();
+      }
+@@ -169,7 +154,7 @@
+     /**
+      * Build the header of the page.
+      */
+-    public void buildClassHeader() {
++    public void buildClassHeader(XMLNode node) {
+         String key;
+         if (isInterface) {
+             key =  "doclet.Interface";
+@@ -185,7 +170,7 @@
+     /**
+      * Build the class tree documentation.
+      */
+-    public void buildClassTree() {
++    public void buildClassTree(XMLNode node) {
+         writer.writeClassTree();
+     }
+ 
+@@ -193,42 +178,42 @@
+      * If this is a class, list all interfaces
+      * implemented by this class.
+      */
+-    public void buildImplementedInterfacesInfo() {
++    public void buildImplementedInterfacesInfo(XMLNode node) {
+         writer.writeImplementedInterfacesInfo();
+     }
+ 
+     /**
+      * If this is an interface, list all super interfaces.
+      */
+-    public void buildSuperInterfacesInfo() {
++    public void buildSuperInterfacesInfo(XMLNode node) {
+         writer.writeSuperInterfacesInfo();
+     }
+ 
+     /**
+      * List the parameters of this class.
+      */
+-    public void buildTypeParamInfo() {
++    public void buildTypeParamInfo(XMLNode node) {
+         writer.writeTypeParamInfo();
+     }
+ 
+     /**
+      * List all the classes extend this one.
+      */
+-    public void buildSubClassInfo() {
++    public void buildSubClassInfo(XMLNode node) {
+         writer.writeSubClassInfo();
+     }
+ 
+     /**
+      * List all the interfaces that extend this one.
+      */
+-    public void buildSubInterfacesInfo() {
++    public void buildSubInterfacesInfo(XMLNode node) {
+         writer.writeSubInterfacesInfo();
+     }
+ 
+     /**
+      * If this is an interface, list all classes that implement this interface.
+      */
+-    public void buildInterfaceUsageInfo () {
++    public void buildInterfaceUsageInfo (XMLNode node) {
+         writer.writeInterfaceUsageInfo();
+     }
+ 
+@@ -236,21 +221,21 @@
+      * If this is an inner class or interface, list the enclosing class or
+      * interface.
+      */
+-    public void buildNestedClassInfo () {
++    public void buildNestedClassInfo (XMLNode node) {
+         writer.writeNestedClassInfo();
+     }
+ 
+     /**
+      * If this class is deprecated, print the appropriate information.
+      */
+-    public void buildDeprecationInfo () {
++    public void buildDeprecationInfo (XMLNode node) {
+         writer.writeClassDeprecationInfo();
+     }
+ 
+     /**
+      * Build the signature of the current class.
+      */
+-    public void buildClassSignature() {
++    public void buildClassSignature(XMLNode node) {
+         StringBuffer modifiers = new StringBuffer(classDoc.modifiers() + " ");
+         if (isEnum) {
+             modifiers.append("enum ");
+@@ -276,14 +261,14 @@
+     /**
+      * Build the class description.
+      */
+-    public void buildClassDescription() {
++    public void buildClassDescription(XMLNode node) {
+        writer.writeClassDescription();
+     }
+ 
+     /**
+      * Build the tag information for the current class.
+      */
+-    public void buildClassTagInfo() {
++    public void buildClassTagInfo(XMLNode node) {
+        writer.writeClassTagInfo();
+     }
+ 
+@@ -295,7 +280,7 @@
+      */
+     public void buildMemberSummary(List elements) throws Exception {
+         configuration.getBuilderFactory().
+-            getMemberSummaryBuilder(writer).build(elements);
++            getMemberSummaryBuilder(writer).buildChildren(node);
+         writer.completeMemberSummaryBuild();
+     }
+ 
+@@ -305,9 +290,9 @@
+      * @param elements the XML elements that specify how a enum constants are
+      *                 documented.
+      */
+-    public void buildEnumConstantsDetails(List elements) throws Exception {
++    public void buildEnumConstantsDetails(XMLNode node) throws Exception {
+         configuration.getBuilderFactory().
+-            getEnumConstantsBuilder(writer).build(elements);
++            getEnumConstantsBuilder(writer).buildChildren(node);
+     }
+ 
+     /**
+@@ -315,9 +300,9 @@
+      *
+      * @param elements the XML elements that specify how a field is documented.
+      */
+-    public void buildFieldDetails(List elements) throws Exception {
++    public void buildFieldDetails(XMLNode node) throws Exception {
+         configuration.getBuilderFactory().
+-            getFieldBuilder(writer).build(elements);
++            getFieldBuilder(writer).buildChildren(node);
+     }
+ 
+     /**
+@@ -326,9 +311,9 @@
+      * @param elements the XML elements that specify how to document a
+      * constructor.
+      */
+-    public void buildConstructorDetails(List elements) throws Exception {
++    public void buildConstructorDetails(XMLNode node) throws Exception {
+         configuration.getBuilderFactory().
+-            getConstructorBuilder(writer).build(elements);
++            getConstructorBuilder(writer).buildChildren(node);
+     }
+ 
+     /**
+@@ -336,15 +321,15 @@
+      *
+      * @param elements the XML elements that specify how a method is documented.
+      */
+-    public void buildMethodDetails(List elements) throws Exception {
++    public void buildMethodDetails(XMLNode node) throws Exception {
+         configuration.getBuilderFactory().
+-                getMethodBuilder(writer).build(elements);
++                getMethodBuilder(writer).buildChildren(node);
+     }
+ 
+     /**
+      * Build the footer of the page.
+      */
+-    public void buildClassFooter() {
++    public void buildClassFooter(XMLNode node) {
+         writer.writeFooter();
+     }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java
+@@ -30,7 +30,6 @@
+ import com.sun.javadoc.*;
+ import java.io.*;
+ import java.util.*;
+-import java.lang.reflect.*;
+ 
+ /**
+  * Builds the Constants Summary Page.
+@@ -109,20 +108,6 @@
+     /**
+      * {@inheritDoc}
+      */
+-    public void invokeMethod(String methodName, Class[] paramClasses,
+-            Object[] params)
+-    throws Exception {
+-        if (DEBUG) {
+-            configuration.root.printError("DEBUG: " + this.getClass().getName()
+-                + "." + methodName);
+-        }
+-        Method method = this.getClass().getMethod(methodName, paramClasses);
+-        method.invoke(this, params);
+-    }
+-
+-    /**
+-     * {@inheritDoc}
+-     */
+     public void build() throws IOException {
+         if (writer == null) {
+             //Doclet does not support this output.
+@@ -144,29 +129,29 @@
+      * @param elements the list of elements describing constant summary
+      *                 documentation.
+      */
+-    public void buildConstantSummary(List elements) throws Exception {
+-        build(elements);
++    public void buildConstantSummary(XMLNode node) throws Exception {
++        buildChildren(node);
+         writer.close();
+     }
+ 
+     /**
+      * Build the header.
+      */
+-    public void buildHeader() {
++    public void buildHeader(XMLNode node) {
+         writer.writeHeader();
+     }
+ 
+     /**
+      * Build the footer.
+      */
+-    public void buildFooter() {
++    public void buildFooter(XMLNode node) {
+         writer.writeFooter();
+     }
+ 
+     /**
+      * Build the table of contents.
+      */
+-    public void buildContents() {
++    public void buildContents(XMLNode node) {
+         writer.writeContentsHeader();
+         PackageDoc[] packages = configuration.packages;
+         printedPackageHeaders = new HashSet();
+@@ -186,14 +171,14 @@
+      * @param elements the XML elements that represent the components
+      *                 of documentation for each package.
+      */
+-    public void buildConstantSummaries(List elements) {
++    public void buildConstantSummaries(XMLNode node) {
+         PackageDoc[] packages = configuration.packages;
+         printedPackageHeaders = new HashSet();
+         for (int i = 0; i < packages.length; i++) {
+             if (hasConstantField(packages[i])) {
+                 currentPackage = packages[i];
+                 //Build the documentation for the current package.
+-                build(elements);
++                buildChildren(node);
+             }
+         }
+     }
+@@ -204,8 +189,8 @@
+      * @param elements the list of XML elements that make up package
+      *                 documentation.
+      */
+-    public void buildPackageConstantSummary(List elements) {
+-        build(elements);
++    public void buildPackageConstantSummary(XMLNode node) {
++        buildChildren(node);
+     }
+ 
+     /**
+@@ -214,7 +199,7 @@
+      * @param elements the list of XML elements that make up the class
+      *                 constant summary.
+      */
+-    public void buildClassConstantSummary(List elements) {
++    public void buildClassConstantSummary(XMLNode node) {
+         ClassDoc[] classes = currentPackage.name().length() > 0 ?
+             currentPackage.allClasses() :
+             configuration.classDocCatalog.allClasses(
+@@ -227,14 +212,14 @@
+             }
+             currentClass = classes[i];
+             //Build the documentation for the current class.
+-            build(elements);
++            buildChildren(node);
+         }
+     }
+ 
+     /**
+      * Build the header for the given class.
+      */
+-    public void buildPackageHeader() {
++    public void buildPackageHeader(XMLNode node) {
+         String parsedPackageName = parsePackageName(currentPackage.name());
+         if (! printedPackageHeaders.contains(parsedPackageName)) {
+             writer.writePackageName(currentPackage,
+@@ -246,7 +231,7 @@
+     /**
+      * Build the header for the given class.
+      */
+-    public void buildClassHeader() {
++    public void buildClassHeader(XMLNode node) {
+         writer.writeConstantMembersHeader(currentClass);
+     }
+ 
+@@ -254,14 +239,14 @@
+      * Print summary of constant members in the
+      * class.
+      */
+-    public void buildConstantMembers() {
+-        new ConstantFieldBuilder(currentClass).buildMembersSummary();
++    public void buildConstantMembers(XMLNode node) {
++        new ConstantFieldBuilder(currentClass).buildMembersSummary(node);
+     }
+ 
+     /**
+      * Build the footer for the given class.
+      */
+-    public void buildClassFooter() {
++    public void buildClassFooter(XMLNode node) {
+         writer.writeConstantMembersFooter(currentClass);
+     }
+ 
+@@ -362,7 +347,7 @@
+         /**
+          * Builds the table of constants for a given class.
+          */
+-        protected void buildMembersSummary() {
++        protected void buildMembersSummary(XMLNode node) {
+             List members = new ArrayList(members());
+             if (members.size() > 0) {
+                 Collections.sort(members);
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java
+@@ -28,7 +28,6 @@
+ import com.sun.tools.doclets.internal.toolkit.util.*;
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.javadoc.*;
+-import java.lang.reflect.*;
+ import java.util.*;
+ 
+ /**
+@@ -136,22 +135,6 @@
+         }
+ 
+         /**
+-         * {@inheritDoc}
+-         */
+-        public void invokeMethod(
+-                String methodName,
+-                Class[] paramClasses,
+-                Object[] params)
+-                throws Exception {
+-                if (DEBUG) {
+-                        configuration.root.printError(
+-                                "DEBUG: " + this.getClass().getName() + "." + methodName);
+-                }
+-                Method method = this.getClass().getMethod(methodName, paramClasses);
+-                method.invoke(this, params);
+-        }
+-
+-        /**
+          * Returns a list of constructors that will be documented for the given class.
+          * This information can be used for doclet specific documentation
+          * generation.
+@@ -177,21 +160,21 @@
+          * @param elements the XML elements that specify how to construct this
+          *                documentation.
+          */
+-        public void buildConstructorDoc(List elements) {
++        public void buildConstructorDoc(XMLNode node) {
+                 if (writer == null) {
+                         return;
+                 }
+                 for (currentMethodIndex = 0;
+                         currentMethodIndex < constructors.size();
+                         currentMethodIndex++) {
+-                        build(elements);
++                        buildChildren(node);
+                 }
+         }
+ 
+         /**
+          * Build the overall header.
+          */
+-        public void buildHeader() {
++        public void buildHeader(XMLNode node) {
+                 writer.writeHeader(
+                         classDoc,
+                         configuration.getText("doclet.Constructor_Detail"));
+@@ -200,7 +183,7 @@
+         /**
+          * Build the header for the individual constructor.
+          */
+-        public void buildConstructorHeader() {
++        public void buildConstructorHeader(XMLNode node) {
+                 writer.writeConstructorHeader(
+                         (ConstructorDoc) constructors.get(currentMethodIndex),
+                         currentMethodIndex == 0);
+@@ -209,7 +192,7 @@
+         /**
+          * Build the signature.
+          */
+-        public void buildSignature() {
++        public void buildSignature(XMLNode node) {
+                 writer.writeSignature(
+                         (ConstructorDoc) constructors.get(currentMethodIndex));
+         }
+@@ -217,7 +200,7 @@
+         /**
+          * Build the deprecation information.
+          */
+-        public void buildDeprecationInfo() {
++        public void buildDeprecationInfo(XMLNode node) {
+                 writer.writeDeprecated(
+                         (ConstructorDoc) constructors.get(currentMethodIndex));
+         }
+@@ -226,7 +209,7 @@
+          * Build the comments for the constructor.  Do nothing if
+          * {@link Configuration#nocomment} is set to true.
+          */
+-        public void buildConstructorComments() {
++        public void buildConstructorComments(XMLNode node) {
+                 if (!configuration.nocomment) {
+                         writer.writeComments(
+                                 (ConstructorDoc) constructors.get(currentMethodIndex));
+@@ -236,21 +219,21 @@
+         /**
+          * Build the tag information.
+          */
+-        public void buildTagInfo() {
++        public void buildTagInfo(XMLNode node) {
+                 writer.writeTags((ConstructorDoc) constructors.get(currentMethodIndex));
+         }
+ 
+         /**
+          * Build the footer for the individual constructor.
+          */
+-        public void buildConstructorFooter() {
++        public void buildConstructorFooter(XMLNode node) {
+                 writer.writeConstructorFooter();
+         }
+ 
+         /**
+          * Build the overall footer.
+          */
+-        public void buildFooter() {
++        public void buildFooter(XMLNode node) {
+                 writer.writeFooter(classDoc);
+         }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java
+@@ -29,7 +29,6 @@
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.javadoc.*;
+ import java.util.*;
+-import java.lang.reflect.*;
+ 
+ /**
+  * Builds documentation for a enum constants.
+@@ -116,22 +115,6 @@
+         }
+ 
+         /**
+-         * {@inheritDoc}
+-         */
+-        public void invokeMethod(
+-                String methodName,
+-                Class[] paramClasses,
+-                Object[] params)
+-                throws Exception {
+-                if (DEBUG) {
+-                        configuration.root.printError(
+-                                "DEBUG: " + this.getClass().getName() + "." + methodName);
+-                }
+-                Method method = this.getClass().getMethod(methodName, paramClasses);
+-                method.invoke(this, params);
+-        }
+-
+-        /**
+          * Returns a list of enum constants that will be documented for the given class.
+          * This information can be used for doclet specific documentation
+          * generation.
+@@ -165,21 +148,21 @@
+          * @param elements the XML elements that specify how to construct this
+          *                documentation.
+          */
+-        public void buildEnumConstant(List elements) {
++        public void buildEnumConstant(XMLNode node) {
+                 if (writer == null) {
+                         return;
+                 }
+                 for (currentEnumConstantsIndex = 0;
+                         currentEnumConstantsIndex < enumConstants.size();
+                         currentEnumConstantsIndex++) {
+-                        build(elements);
++                        buildChildren(node);
+                 }
+         }
+ 
+         /**
+          * Build the overall header.
+          */
+-        public void buildHeader() {
++        public void buildHeader(XMLNode node) {
+                 writer.writeHeader(
+                         classDoc,
+                         configuration.getText("doclet.Enum_Constant_Detail"));
+@@ -188,7 +171,7 @@
+         /**
+          * Build the header for the individual enum constants.
+          */
+-        public void buildEnumConstantHeader() {
++        public void buildEnumConstantHeader(XMLNode node) {
+                 writer.writeEnumConstantHeader(
+                         (FieldDoc) enumConstants.get(currentEnumConstantsIndex),
+                         currentEnumConstantsIndex == 0);
+@@ -197,7 +180,7 @@
+         /**
+          * Build the signature.
+          */
+-        public void buildSignature() {
++        public void buildSignature(XMLNode node) {
+                 writer.writeSignature(
+                         (FieldDoc) enumConstants.get(currentEnumConstantsIndex));
+         }
+@@ -205,7 +188,7 @@
+         /**
+          * Build the deprecation information.
+          */
+-        public void buildDeprecationInfo() {
++        public void buildDeprecationInfo(XMLNode node) {
+                 writer.writeDeprecated(
+                         (FieldDoc) enumConstants.get(currentEnumConstantsIndex));
+         }
+@@ -214,7 +197,7 @@
+          * Build the comments for the enum constant.  Do nothing if
+          * {@link Configuration#nocomment} is set to true.
+          */
+-        public void buildEnumConstantComments() {
++        public void buildEnumConstantComments(XMLNode node) {
+                 if (!configuration.nocomment) {
+                         writer.writeComments(
+                                 (FieldDoc) enumConstants.get(currentEnumConstantsIndex));
+@@ -224,7 +207,7 @@
+         /**
+          * Build the tag information.
+          */
+-        public void buildTagInfo() {
++        public void buildTagInfo(XMLNode node) {
+                 writer.writeTags(
+                         (FieldDoc) enumConstants.get(currentEnumConstantsIndex));
+         }
+@@ -232,14 +215,14 @@
+         /**
+          * Build the footer for the individual enum constants.
+          */
+-        public void buildEnumConstantFooter() {
++        public void buildEnumConstantFooter(XMLNode node) {
+                 writer.writeEnumConstantFooter();
+         }
+ 
+         /**
+          * Build the overall footer.
+          */
+-        public void buildFooter() {
++        public void buildFooter(XMLNode node) {
+                 writer.writeFooter(classDoc);
+         }
+ 
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java
+@@ -29,7 +29,6 @@
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.javadoc.*;
+ import java.util.*;
+-import java.lang.reflect.*;
+ 
+ /**
+  * Builds documentation for a field.
+@@ -117,22 +116,6 @@
+         }
+ 
+         /**
+-         * {@inheritDoc}
+-         */
+-        public void invokeMethod(
+-                String methodName,
+-                Class[] paramClasses,
+-                Object[] params)
+-                throws Exception {
+-                if (DEBUG) {
+-                        configuration.root.printError(
+-                                "DEBUG: " + this.getClass().getName() + "." + methodName);
+-                }
+-                Method method = this.getClass().getMethod(methodName, paramClasses);
+-                method.invoke(this, params);
+-        }
+-
+-        /**
+          * Returns a list of fields that will be documented for the given class.
+          * This information can be used for doclet specific documentation
+          * generation.
+@@ -166,21 +149,21 @@
+          * @param elements the XML elements that specify how to construct this
+          *                documentation.
+          */
+-        public void buildFieldDoc(List elements) {
++        public void buildFieldDoc(XMLNode node) {
+                 if (writer == null) {
+                         return;
+                 }
+                 for (currentFieldIndex = 0;
+                         currentFieldIndex < fields.size();
+                         currentFieldIndex++) {
+-                        build(elements);
++                        buildChildren(node);
+                 }
+         }
+ 
+         /**
+          * Build the overall header.
+          */
+-        public void buildHeader() {
++        public void buildHeader(XMLNode node) {
+                 writer.writeHeader(
+                         classDoc,
+                         configuration.getText("doclet.Field_Detail"));
+@@ -189,7 +172,7 @@
+         /**
+          * Build the header for the individual field.
+          */
+-        public void buildFieldHeader() {
++        public void buildFieldHeader(XMLNode node) {
+                 writer.writeFieldHeader(
+                         (FieldDoc) fields.get(currentFieldIndex),
+                         currentFieldIndex == 0);
+@@ -198,14 +181,14 @@
+         /**
+          * Build the signature.
+          */
+-        public void buildSignature() {
++        public void buildSignature(XMLNode node) {
+                 writer.writeSignature((FieldDoc) fields.get(currentFieldIndex));
+         }
+ 
+         /**
+          * Build the deprecation information.
+          */
+-        public void buildDeprecationInfo() {
++        public void buildDeprecationInfo(XMLNode node) {
+                 writer.writeDeprecated((FieldDoc) fields.get(currentFieldIndex));
+         }
+ 
+@@ -213,7 +196,7 @@
+          * Build the comments for the field.  Do nothing if
+          * {@link Configuration#nocomment} is set to true.
+          */
+-        public void buildFieldComments() {
++        public void buildFieldComments(XMLNode node) {
+                 if (!configuration.nocomment) {
+                         writer.writeComments((FieldDoc) fields.get(currentFieldIndex));
+                 }
+@@ -222,21 +205,21 @@
+         /**
+          * Build the tag information.
+          */
+-        public void buildTagInfo() {
++        public void buildTagInfo(XMLNode node) {
+                 writer.writeTags((FieldDoc) fields.get(currentFieldIndex));
+         }
+ 
+         /**
+          * Build the footer for the individual field.
+          */
+-        public void buildFieldFooter() {
++        public void buildFieldFooter(XMLNode node) {
+                 writer.writeFieldFooter();
+         }
+ 
+         /**
+          * Build the overall footer.
+          */
+-        public void buildFooter() {
++        public void buildFooter(XMLNode node) {
+                 writer.writeFooter(classDoc);
+         }
+ 
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java
+@@ -45,8 +45,8 @@
+     /**
+      * The map of XML elements that have been parsed.
+      */
+-    private Map xmlElementsMap;
+-
++    private Map<String,XMLNode> xmlElementsMap;
++    private XMLNode currentNode;
+     private Configuration configuration;
+     private static LayoutParser instance;
+     private String currentRoot;
+@@ -56,7 +56,7 @@
+      * This class is a singleton.
+      */
+     private LayoutParser(Configuration configuration) {
+-        xmlElementsMap = new HashMap();
++        xmlElementsMap = new HashMap<String,XMLNode>();
+         this.configuration = configuration;
+     }
+ 
+@@ -78,20 +78,18 @@
+      *
+      * @return List the list of XML elements parsed.
+      */
+-    public List parseXML(String root) {
++    public XMLNode parseXML(String root) {
+         if (xmlElementsMap.containsKey(root)) {
+             return (List) xmlElementsMap.get(root);
+         }
+         try {
+-            List xmlElements = new ArrayList();
+-            xmlElementsMap.put(root, xmlElements);
+             currentRoot = root;
+             isParsing = false;
+             SAXParserFactory factory = SAXParserFactory.newInstance();
+             SAXParser saxParser = factory.newSAXParser();
+             InputStream in = configuration.getBuilderXML();
+             saxParser.parse(in, this);
+-            return xmlElements;
++            return xmlElementsMap.get(root);
+         } catch (Throwable t) {
+             t.printStackTrace();
+             throw new DocletAbortException();
+@@ -106,8 +104,11 @@
+     throws SAXException {
+         if (isParsing || qName.equals(currentRoot)) {
+             isParsing = true;
+-            List xmlElements = (List) xmlElementsMap.get(currentRoot);
+-            xmlElements.add(qName);
++            currentNode = new XMLNode(currentNode, qName);
++            for (int i = 0; i < attrs.getLength(); i++)
++                currentNode.attrs.put(attrs.getLocalName(i), attrs.getValue(i));
++            if (qName.equals(currentRoot))
++                xmlElementsMap.put(qName, currentNode);
+         }
+     }
+ 
+@@ -117,23 +118,9 @@
+     public void endElement(String namespaceURI, String sName, String qName)
+     throws SAXException {
+         if (! isParsing) {
+-            isParsing = false;
+             return;
+         }
+-        List xmlElements = (List) xmlElementsMap.get(currentRoot);
+-        if (xmlElements.get(xmlElements.size()-1).equals(qName)) {
+-            return;
+-        } else {
+-            List subElements = new ArrayList();
+-            int targetIndex = xmlElements.indexOf(qName);
+-            int size = xmlElements.size();
+-            for (int i = targetIndex; i < size; i++) {
+-                subElements.add(xmlElements.get(targetIndex));
+-                xmlElements.remove(targetIndex);
+-            }
+-            //Save the sub elements as a list.
+-            xmlElements.add(subElements);
+-        }
++        currentNode = currentNode.parent;
+         isParsing = ! qName.equals(currentRoot);
+     }
+ }
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java
+@@ -29,7 +29,6 @@
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.javadoc.*;
+ import java.util.*;
+-import java.lang.reflect.*;
+ 
+ /**
+  * Builds the member summary.
+@@ -175,22 +174,6 @@
+         }
+ 
+         /**
+-         * {@inheritDoc}
+-         */
+-        public void invokeMethod(
+-                String methodName,
+-                Class[] paramClasses,
+-                Object[] params)
+-                throws Exception {
+-                if (DEBUG) {
+-                        configuration.root.printError(
+-                                "DEBUG: " + this.getClass().getName() + "." + methodName);
+-                }
+-                Method method = this.getClass().getMethod(methodName, paramClasses);
+-                method.invoke(this, params);
+-        }
+-
+-        /**
+          * Return true it there are any members to summarize.
+          *
+          * @return true if there are any members to summarize.
+@@ -211,7 +194,7 @@
+         /**
+          * Build the summary for the enum constants.
+          */
+-        public void buildEnumConstantsSummary() {
++        public void buildEnumConstantsSummary(XMLNode node) {
+                 buildSummary(
+                         memberSummaryWriters[VisibleMemberMap.ENUM_CONSTANTS],
+                         visibleMemberMaps[VisibleMemberMap.ENUM_CONSTANTS]);
+@@ -220,7 +203,7 @@
+     /**
+      * Build the summary for the optional members.
+      */
+-    public void buildAnnotationTypeOptionalMemberSummary() {
++    public void buildAnnotationTypeOptionalMemberSummary(XMLNode node) {
+         buildSummary(
+             memberSummaryWriters[VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL],
+                 visibleMemberMaps[VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL]);
+@@ -229,7 +212,7 @@
+     /**
+      * Build the summary for the optional members.
+      */
+-    public void buildAnnotationTypeRequiredMemberSummary() {
++    public void buildAnnotationTypeRequiredMemberSummary(XMLNode node) {
+         buildSummary(
+             memberSummaryWriters[VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED],
+                 visibleMemberMaps[VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED]);
+@@ -238,7 +221,7 @@
+         /**
+          * Build the summary for the fields.
+          */
+-        public void buildFieldsSummary() {
++        public void buildFieldsSummary(XMLNode node) {
+                 buildSummary(
+                         memberSummaryWriters[VisibleMemberMap.FIELDS],
+                         visibleMemberMaps[VisibleMemberMap.FIELDS]);
+@@ -247,7 +230,7 @@
+         /**
+          * Build the inherited summary for the fields.
+          */
+-        public void buildFieldsInheritedSummary() {
++        public void buildFieldsInheritedSummary(XMLNode node) {
+                 buildInheritedSummary(
+                         memberSummaryWriters[VisibleMemberMap.FIELDS],
+                         visibleMemberMaps[VisibleMemberMap.FIELDS]);
+@@ -256,7 +239,7 @@
+         /**
+          * Build the summary for the nested classes.
+          */
+-        public void buildNestedClassesSummary() {
++        public void buildNestedClassesSummary(XMLNode node) {
+                 buildSummary(
+                         memberSummaryWriters[VisibleMemberMap.INNERCLASSES],
+                         visibleMemberMaps[VisibleMemberMap.INNERCLASSES]);
+@@ -265,7 +248,7 @@
+         /**
+          * Build the inherited summary for the nested classes.
+          */
+-        public void buildNestedClassesInheritedSummary() {
++        public void buildNestedClassesInheritedSummary(XMLNode node) {
+                 buildInheritedSummary(
+                         memberSummaryWriters[VisibleMemberMap.INNERCLASSES],
+                         visibleMemberMaps[VisibleMemberMap.INNERCLASSES]);
+@@ -274,7 +257,7 @@
+         /**
+          * Build the method summary.
+          */
+-        public void buildMethodsSummary() {
++        public void buildMethodsSummary(XMLNode node) {
+                 buildSummary(
+                         memberSummaryWriters[VisibleMemberMap.METHODS],
+                         visibleMemberMaps[VisibleMemberMap.METHODS]);
+@@ -283,7 +266,7 @@
+         /**
+          * Build the inherited method summary.
+          */
+-        public void buildMethodsInheritedSummary() {
++        public void buildMethodsInheritedSummary(XMLNode node) {
+                 buildInheritedSummary(
+                         memberSummaryWriters[VisibleMemberMap.METHODS],
+                         visibleMemberMaps[VisibleMemberMap.METHODS]);
+@@ -292,7 +275,7 @@
+         /**
+          * Build the constructor summary.
+          */
+-        public void buildConstructorsSummary() {
++        public void buildConstructorsSummary(XMLNode node) {
+                 buildSummary(
+                         memberSummaryWriters[VisibleMemberMap.CONSTRUCTORS],
+                         visibleMemberMaps[VisibleMemberMap.CONSTRUCTORS]);
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java
+@@ -29,7 +29,7 @@
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.javadoc.*;
+ import java.util.*;
+-import java.lang.reflect.*;
++
+ /**
+  * Builds documentation for a method.
+  *
+@@ -112,22 +112,6 @@
+         }
+ 
+         /**
+-         * {@inheritDoc}
+-         */
+-        public void invokeMethod(
+-                String methodName,
+-                Class[] paramClasses,
+-                Object[] params)
+-                throws Exception {
+-                if (DEBUG) {
+-                        configuration.root.printError(
+-                                "DEBUG: " + this.getClass().getName() + "." + methodName);
+-                }
+-                Method method = this.getClass().getMethod(methodName, paramClasses);
+-                method.invoke(this, params);
+-        }
+-
+-        /**
+          * Returns a list of methods that will be documented for the given class.
+          * This information can be used for doclet specific documentation
+          * generation.
+@@ -158,21 +142,21 @@
+         /**
+          * Build the method documentation.
+          */
+-        public void buildMethodDoc(List elements) {
++        public void buildMethodDoc(XMLNode node) {
+                 if (writer == null) {
+                         return;
+                 }
+                 for (currentMethodIndex = 0;
+                         currentMethodIndex < methods.size();
+                         currentMethodIndex++) {
+-                        build(elements);
++                        buildChildren(node);
+                 }
+         }
+ 
+         /**
+          * Build the overall header.
+          */
+-        public void buildHeader() {
++        public void buildHeader(XMLNode node) {
+                 writer.writeHeader(
+                         classDoc,
+                         configuration.getText("doclet.Method_Detail"));
+@@ -181,7 +165,7 @@
+         /**
+          * Build the header for the individual method.
+          */
+-        public void buildMethodHeader() {
++        public void buildMethodHeader(XMLNode node) {
+                 writer.writeMethodHeader(
+                         (MethodDoc) methods.get(currentMethodIndex),
+                         currentMethodIndex == 0);
+@@ -190,14 +174,14 @@
+         /**
+          * Build the signature.
+          */
+-        public void buildSignature() {
++        public void buildSignature(XMLNode node) {
+                 writer.writeSignature((MethodDoc) methods.get(currentMethodIndex));
+         }
+ 
+         /**
+          * Build the deprecation information.
+          */
+-        public void buildDeprecationInfo() {
++        public void buildDeprecationInfo(XMLNode node) {
+                 writer.writeDeprecated((MethodDoc) methods.get(currentMethodIndex));
+         }
+ 
+@@ -205,7 +189,7 @@
+          * Build the comments for the method.  Do nothing if
+          * {@link Configuration#nocomment} is set to true.  If this method
+          */
+-        public void buildMethodComments() {
++        public void buildMethodComments(XMLNode node) {
+                 if (!configuration.nocomment) {
+             MethodDoc method = (MethodDoc) methods.get(currentMethodIndex);
+ 
+@@ -228,21 +212,21 @@
+         /**
+          * Build the tag information.
+          */
+-        public void buildTagInfo() {
++        public void buildTagInfo(XMLNode node) {
+                 writer.writeTags((MethodDoc) methods.get(currentMethodIndex));
+         }
+ 
+         /**
+          * Build the footer of the method.
+          */
+-        public void buildMethodFooter() {
++        public void buildMethodFooter(XMLNode node) {
+                 writer.writeMethodFooter();
+         }
+ 
+         /**
+          * Build the overall footer.
+          */
+-        public void buildFooter() {
++        public void buildFooter(XMLNode node) {
+                 writer.writeFooter(classDoc);
+         }
+ 
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java
+@@ -29,8 +29,6 @@
+ import com.sun.tools.doclets.internal.toolkit.*;
+ import com.sun.javadoc.*;
+ import java.io.*;
+-import java.util.*;
+-import java.lang.reflect.*;
+ 
+ /**
+  * Builds the summary for a given package.
+@@ -85,22 +83,6 @@
+         }
+ 
+         /**
+-         * {@inheritDoc}
+-         */
+-        public void invokeMethod(
+-                String methodName,
+-                Class[] paramClasses,
+-                Object[] params)
+-                throws Exception {
+-                if (DEBUG) {
+-                        configuration.root.printError(
+-                                "DEBUG: " + this.getClass().getName() + "." + methodName);
+-                }
+-                Method method = this.getClass().getMethod(methodName, paramClasses);
+-                method.invoke(this, params);
+-        }
+-
+-        /**
+          * Build the package summary.
+          */
+         public void build() throws IOException {
+@@ -121,8 +103,8 @@
+         /**
+          * Build the package documentation.
+          */
+-        public void buildPackageDoc(List elements) throws Exception {
+-                build(elements);
++        public void buildPackageDoc(XMLNode node) throws Exception {
++                buildChildren(node);
+                 packageWriter.close();
+                 Util.copyDocFiles(
+                         configuration,
+@@ -136,14 +118,14 @@
+         /**
+          * Build the header of the summary.
+          */
+-        public void buildPackageHeader() {
++        public void buildPackageHeader(XMLNode node) {
+                 packageWriter.writePackageHeader(Util.getPackageName(packageDoc));
+         }
+ 
+         /**
+          * Build the description of the summary.
+          */
+-        public void buildPackageDescription() {
++        public void buildPackageDescription(XMLNode node) {
+                 if (configuration.nocomment) {
+                         return;
+                 }
+@@ -153,7 +135,7 @@
+         /**
+          * Build the tags of the summary.
+          */
+-        public void buildPackageTags() {
++        public void buildPackageTags(XMLNode node) {
+                 if (configuration.nocomment) {
+                         return;
+                 }
+@@ -163,28 +145,28 @@
+         /**
+          * Build the package summary.
+          */
+-        public void buildSummary(List elements) {
+-                build(elements);
++        public void buildSummary(XMLNode node) {
++                buildChildren(node);
+         }
+ 
+         /**
+          * Build the overall header.
+          */
+-        public void buildSummaryHeader() {
++        public void buildSummaryHeader(XMLNode node) {
+                 packageWriter.writeSummaryHeader();
+         }
+ 
+         /**
+          * Build the overall footer.
+          */
+-        public void buildSummaryFooter() {
++        public void buildSummaryFooter(XMLNode node) {
+                 packageWriter.writeSummaryFooter();
+         }
+ 
+         /**
+          * Build the summary for the classes in this package.
+          */
+-        public void buildClassSummary() {
++        public void buildClassSummary(XMLNode node) {
+             String classTableSummary =
+                     configuration.getText("doclet.Member_Table_Summary",
+                     configuration.getText("doclet.Class_Summary"),
+@@ -209,7 +191,7 @@
+         /**
+          * Build the summary for the interfaces in this package.
+          */
+-        public void buildInterfaceSummary() {
++        public void buildInterfaceSummary(XMLNode node) {
+             String interfaceTableSummary =
+                     configuration.getText("doclet.Member_Table_Summary",
+                     configuration.getText("doclet.Interface_Summary"),
+@@ -234,7 +216,7 @@
+         /**
+          * Build the summary for the enums in this package.
+          */
+-        public void buildAnnotationTypeSummary() {
++        public void buildAnnotationTypeSummary(XMLNode node) {
+             String annotationtypeTableSummary =
+                     configuration.getText("doclet.Member_Table_Summary",
+                     configuration.getText("doclet.Annotation_Types_Summary"),
+@@ -259,7 +241,7 @@
+         /**
+          * Build the summary for the enums in this package.
+          */
+-        public void buildEnumSummary() {
++        public void buildEnumSummary(XMLNode node) {
+             String enumTableSummary =
+                     configuration.getText("doclet.Member_Table_Summary",
+                     configuration.getText("doclet.Enum_Summary"),
+@@ -284,7 +266,7 @@
+         /**
+          * Build the summary for the exceptions in this package.
+          */
+-        public void buildExceptionSummary() {
++        public void buildExceptionSummary(XMLNode node) {
+             String exceptionTableSummary =
+                     configuration.getText("doclet.Member_Table_Summary",
+                     configuration.getText("doclet.Exception_Summary"),
+@@ -309,7 +291,7 @@
+         /**
+          * Build the summary for the errors in this package.
+          */
+-        public void buildErrorSummary() {
++        public void buildErrorSummary(XMLNode node) {
+             String errorTableSummary =
+                     configuration.getText("doclet.Member_Table_Summary",
+                     configuration.getText("doclet.Error_Summary"),
+@@ -334,7 +316,7 @@
+         /**
+          * Build the footer of the summary.
+          */
+-        public void buildPackageFooter() {
++        public void buildPackageFooter(XMLNode node) {
+                 packageWriter.writePackageFooter();
+         }
+ }
+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
+@@ -26,7 +26,6 @@
+ package com.sun.tools.doclets.internal.toolkit.builders;
+ 
+ import java.io.*;
+-import java.lang.reflect.*;
+ import java.util.*;
+ 
+ import com.sun.javadoc.*;
+@@ -132,47 +131,33 @@
+     /**
+      * Build the serialized form.
+      */
+-    public void buildSerializedForm(List elements) throws Exception {
+-        build(elements);
++    public void buildSerializedForm(XMLNode node) throws Exception {
++        buildChildren(node);
+         writer.close();
+     }
+ 
+     /**
+-     * {@inheritDoc}
+-     */
+-    public void invokeMethod(String methodName, Class[] paramClasses,
+-            Object[] params)
+-    throws Exception {
+-        if (DEBUG) {
+-            configuration.root.printError("DEBUG: " + this.getClass().getName()
+-                + "." + methodName);
+-        }
+-        Method method = this.getClass().getMethod(methodName, paramClasses);
+-        method.invoke(this, params);
+-    }
+-
+-    /**
+      * Build the header.
+      */
+-    public void buildHeader() {
++    public void buildHeader(XMLNode node) {
+         writer.writeHeader(configuration.getText("doclet.Serialized_Form"));
+     }
+ 
+     /**
+      * Build the contents.
+      */
+-    public void buildSerializedFormSummaries(List elements) {
++    public void buildSerializedFormSummaries(XMLNode node) {
+         PackageDoc[] packages = configuration.packages;
+         for (int i = 0; i < packages.length; i++) {
+             currentPackage = packages[i];
+-            build(elements);
++            buildChildren(node);
+         }
+     }
+ 
+     /**
+      * Build the package serialized for for the current package being processed.
+      */
+-    public void buildPackageSerializedForm(List elements) {
++    public void buildPackageSerializedForm(XMLNode node) {
+         String foo = currentPackage.name();
+         ClassDoc[] classes = currentPackage.allClasses(false);
+         if (classes == null || classes.length == 0) {
+@@ -184,14 +169,14 @@
+         if (!serialClassFoundToDocument(classes)) {
+             return;
+         }
+-        build(elements);
++        buildChildren(node);
+     }
+ 
+-    public void buildPackageHeader() {
++    public void buildPackageHeader(XMLNode node) {
+         writer.writePackageHeader(Util.getPackageName(currentPackage));
+     }
+ 
+-    public void buildClassSerializedForm(List elements) {
++    public void buildClassSerializedForm(XMLNode node) {
+         ClassDoc[] classes = currentPackage.allClasses(false);
+         Arrays.sort(classes);
+         for (int j = 0; j < classes.length; j++) {
+@@ -202,19 +187,19 @@
+                 if(!serialClassInclude(currentClass)) {
+                     continue;
+                 }
+-                build(elements);
++                buildChildren(node);
+             }
+         }
+     }
+ 
+-    public void buildClassHeader() {
++    public void buildClassHeader(XMLNode node) {
+         writer.writeClassHeader(currentClass);
+     }
+ 
+     /**
+      * Build the serial UID information for the given class.
+      */
+-    public void buildSerialUIDInfo() {
++    public void buildSerialUIDInfo(XMLNode node) {
+         FieldDoc[] fields = currentClass.fields(false);
+         for (int i = 0; i < fields.length; i++) {
+             if (fields[i].name().equals("serialVersionUID") &&
+@@ -229,7 +214,7 @@
+     /**
+      * Build the footer.
+      */
+-    public void buildFooter() {
++    public void buildFooter(XMLNode node) {
+         writer.writeFooter();
+     }
+ 
+@@ -316,7 +301,7 @@
+     /**
+      * Build the method header.
+      */
+-    public void buildMethodHeader() {
++    public void buildMethodHeader(XMLNode node) {
+         if (currentClass.serializationMethods().length > 0) {
+             methodWriter.writeHeader(
+                 configuration.getText("doclet.Serialized_Form_methods"));
+@@ -333,28 +318,28 @@
+     /**
+      * Build the method sub header.
+      */
+-    public void buildMethodSubHeader()  {
++    public void buildMethodSubHeader(XMLNode node)  {
+         methodWriter.writeMemberHeader((MethodDoc) currentMember);
+     }
+ 
+     /**
+      * Build the deprecated method description.
+      */
+-    public void buildDeprecatedMethodInfo() {
++    public void buildDeprecatedMethodInfo(XMLNode node) {
+         methodWriter.writeDeprecatedMemberInfo((MethodDoc) currentMember);
+     }
+ 
+     /**
+      * Build method tags.
+      */
+-    public void buildMethodDescription() {
++    public void buildMethodDescription(XMLNode node) {
+         methodWriter.writeMemberDescription((MethodDoc) currentMember);
+     }
+ 
+     /**
+      * Build the method tags.
+      */
+-    public void buildMethodTags() {
++    public void buildMethodTags(XMLNode node) {
+         methodWriter.writeMemberTags((MethodDoc) currentMember);
+         MethodDoc method = (MethodDoc)currentMember;
+         if (method.name().compareTo("writeExternal") == 0
+@@ -370,24 +355,24 @@
+     /**
+      * build the information for the method.
+      */
+-    public void buildMethodInfo(List elements)  {
++    public void buildMethodInfo(XMLNode node)  {
+         if(configuration.nocomment){
+             return;
+         }
+-        build(elements);
++        buildChildren(node);
+     }
+ 
+     /**
+      * Build the method footer.
+      */
+-    public void buildMethodFooter() {
++    public void buildMethodFooter(XMLNode node) {
+         methodWriter.writeMemberFooter();
+     }
+ 
+     /**
+      * Build the field header.
+      */
+-    public void buildFieldHeader() {
++    public void buildFieldHeader(XMLNode node) {
+         if (currentClass.serializableFields().length > 0) {
+             buildFieldSerializationOverview(currentClass);
+             fieldWriter.writeHeader(configuration.getText(
+@@ -427,7 +412,7 @@
+     /**
+      * Build the field sub header.
+      */
+-    public void buildFieldSubHeader() {
++    public void buildFieldSubHeader(XMLNode node) {
+         if (! currentClass.definesSerializableFields() ){
+             FieldDoc field = (FieldDoc) currentMember;
+             fieldWriter.writeMemberHeader(field.type().asClassDoc(),
+@@ -438,7 +423,7 @@
+     /**
+      * Build the field deprecation information.
+      */
+-    public void buildFieldDeprecationInfo() {
++    public void buildFieldDeprecationInfo(XMLNode node) {
+         if (!currentClass.definesSerializableFields()) {
+             FieldDoc field = (FieldDoc)currentMember;
+             fieldWriter.writeMemberDeprecatedInfo(field);
+@@ -448,7 +433,7 @@
+     /**
+      * Build the field information.
+      */
+-    public void buildFieldInfo() {
++    public void buildFieldInfo(XMLNode node) {
+         if(configuration.nocomment){
+             return;
+         }
+@@ -484,7 +469,7 @@
+     /**
+      * Build the field sub footer.
+      */
+-    public void buildFieldSubFooter() {
++    public void buildFieldSubFooter(XMLNode node) {
+         if (! currentClass.definesSerializableFields()) {
+             fieldWriter.writeMemberFooter();
+         }
+@@ -494,12 +479,12 @@
+      * Build the summaries for the methods that belong to the given
+      * class.
+      */
+-    public void buildSerializableMethods(List elements) {
++    public void buildSerializableMethods(XMLNode node) {
+         MemberDoc[] members = currentClass.serializationMethods();
+         if (members.length > 0) {
+             for (int i = 0; i < members.length; i++) {
+                 currentMember = members[i];
+-                build(elements);
++                buildChildren(node);
+             }
+         }
+     }
+@@ -508,12 +493,12 @@
+      * Build the summaries for the fields that belong to the given
+      * class.
+      */
+-    public void buildSerializableFields(List elements) {
++    public void buildSerializableFields(XMLNode node) {
+         MemberDoc[] members = currentClass.serializableFields();
+         if (members.length > 0) {
+             for (int i = 0; i < members.length; i++) {
+                 currentMember = members[i];
+-                build(elements);
++                buildChildren(node);
+             }
+         }
+     }
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/XMLNode.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/XMLNode.java
+new file mode 100644
+--- /dev/null
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/XMLNode.java
+@@ -0,0 +1,69 @@
++/*
++ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute 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.internal.toolkit.builders;
++
++import java.util.ArrayList;
++import java.util.HashMap;
++import java.util.List;
++import java.util.Map;
++
++/**
++ * Simple class to represent the attribute and elements of an XML node.
++ */
++public class XMLNode {
++    XMLNode(XMLNode parent, String qname) {
++        this.parent = parent;
++        name = qname;
++        attrs = new HashMap<String,String>();
++        children = new ArrayList<XMLNode>();
++
++        if (parent != null)
++            parent.children.add(this);
++    }
++
++    @Override
++    public String toString() {
++        StringBuilder sb = new StringBuilder();
++        sb.append("<");
++        sb.append(name);
++        for (Map.Entry<String,String> e: attrs.entrySet())
++            sb.append(" " + e.getKey() + "=\"" + e.getValue() + "\"");
++        if (children.size() == 0)
++            sb.append("/>");
++        else {
++            sb.append(">");
++            for (XMLNode c: children)
++                sb.append(c.toString());
++            sb.append("</" + name + ">");
++        }
++        return sb.toString();
++    }
++
++    final XMLNode parent;
++    final String name;
++    final Map<String,String> attrs;
++    final List<XMLNode> children;
++}

Added: trunk/java/openjdk6/files/icedtea/openjdk/6963811-deadlock_fix.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/openjdk/6963811-deadlock_fix.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/openjdk/6963811-deadlock_fix.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,42 @@
+# 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;
+     }
+ 
+     /**

Added: trunk/java/openjdk6/files/icedtea/openjdk/7006270-regressions.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/openjdk/7006270-regressions.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/openjdk/7006270-regressions.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,299 @@
+# 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();
+     }
+ }

Added: trunk/java/openjdk6/files/icedtea/openjdk/7017324-kerning_crash.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/openjdk/7017324-kerning_crash.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/openjdk/7017324-kerning_crash.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,101 @@
+# 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);
++    }
++}

Added: trunk/java/openjdk6/files/icedtea/openjdk/7032388-work_without_cmov_instruction.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/openjdk/7032388-work_without_cmov_instruction.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/openjdk/7032388-work_without_cmov_instruction.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,178 @@
+--- 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

Added: trunk/java/openjdk6/files/icedtea/openjdk/7036559-concurrenthashmap_improvements.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/openjdk/7036559-concurrenthashmap_improvements.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/openjdk/7036559-concurrenthashmap_improvements.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,1436 @@
+# HG changeset patch
+# User dl
+# Date 1303139440 -3600
+# Node ID 005c0c85b0decf18a90ff6c9601d1b9a2c0a3fa4
+# Parent  603e70836e74e5c18fc32279f7e4df5b4c63e0b6
+7036559: ConcurrentHashMap footprint and contention improvements
+Reviewed-by: chegar
+
+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
+@@ -105,7 +105,25 @@
+ 
+     /*
+      * The basic strategy is to subdivide the table among Segments,
+-     * each of which itself is a concurrently readable hash table.
++     * each of which itself is a concurrently readable hash table.  To
++     * reduce footprint, all but one segments are constructed only
++     * when first needed (see ensureSegment). To maintain visibility
++     * in the presence of lazy construction, accesses to segments as
++     * well as elements of segment's table must use volatile access,
++     * which is done via Unsafe within methods segmentAt etc
++     * below. These provide the functionality of AtomicReferenceArrays
++     * but reduce the levels of indirection. Additionally,
++     * volatile-writes of table elements and entry "next" fields
++     * within locked operations use the cheaper "lazySet" forms of
++     * writes (via putOrderedObject) because these writes are always
++     * followed by lock releases that maintain sequential consistency
++     * of table updates.
++     *
++     * Historical note: The previous version of this class relied
++     * heavily on "final" fields, which avoided some volatile reads at
++     * the expense of a large initial footprint.  Some remnants of
++     * that design (including forced construction of segment 0) exist
++     * to ensure serialization compatibility.
+      */
+ 
+     /* ---------------- Constants -------------- */
+@@ -137,8 +155,15 @@
+     static final int MAXIMUM_CAPACITY = 1 << 30;
+ 
+     /**
++     * The minimum capacity for per-segment tables.  Must be a power
++     * of two, at least two to avoid immediate resizing on next use
++     * after lazy construction.
++     */
++    static final int MIN_SEGMENT_TABLE_CAPACITY = 2;
++
++    /**
+      * The maximum number of segments to allow; used to bound
+-     * constructor arguments.
++     * constructor arguments. Must be power of two less than 1 << 24.
+      */
+     static final int MAX_SEGMENTS = 1 << 16; // slightly conservative
+ 
+@@ -164,7 +189,7 @@
+     final int segmentShift;
+ 
+     /**
+-     * The segments, each of which is a specialized hash table
++     * The segments, each of which is a specialized hash table.
+      */
+     final Segment<K,V>[] segments;
+ 
+@@ -172,7 +197,65 @@
+     transient Set<Map.Entry<K,V>> entrySet;
+     transient Collection<V> values;
+ 
+-    /* ---------------- Small Utilities -------------- */
++    /**
++     * ConcurrentHashMap list entry. Note that this is never exported
++     * out as a user-visible Map.Entry.
++     */
++    static final class HashEntry<K,V> {
++        final int hash;
++        final K key;
++        volatile V value;
++        volatile HashEntry<K,V> next;
++
++        HashEntry(int hash, K key, V value, HashEntry<K,V> next) {
++            this.hash = hash;
++            this.key = key;
++            this.value = value;
++            this.next = next;
++        }
++
++        /**
++         * Sets next field with volatile write semantics.  (See above
++         * about use of putOrderedObject.)
++         */
++        final void setNext(HashEntry<K,V> n) {
++            UNSAFE.putOrderedObject(this, nextOffset, n);
++        }
++
++        // Unsafe mechanics
++        static final sun.misc.Unsafe UNSAFE;
++        static final long nextOffset;
++        static {
++            try {
++                UNSAFE = sun.misc.Unsafe.getUnsafe();
++                Class k = HashEntry.class;
++                nextOffset = UNSAFE.objectFieldOffset
++                    (k.getDeclaredField("next"));
++            } catch (Exception e) {
++                throw new Error(e);
++            }
++        }
++    }
++
++    /**
++     * Gets the ith element of given table (if nonnull) with volatile
++     * read semantics.
++     */
++    @SuppressWarnings("unchecked")
++    static final <K,V> HashEntry<K,V> entryAt(HashEntry<K,V>[] tab, int i) {
++        return (tab == null) ? null :
++            (HashEntry<K,V>) UNSAFE.getObjectVolatile
++            (tab, ((long)i << TSHIFT) + TBASE);
++    }
++
++    /**
++     * Sets the ith element of given table, with volatile write
++     * semantics. (See above about use of putOrderedObject.)
++     */
++    static final <K,V> void setEntryAt(HashEntry<K,V>[] tab, int i,
++                                       HashEntry<K,V> e) {
++        UNSAFE.putOrderedObject(tab, ((long)i << TSHIFT) + TBASE, e);
++    }
+ 
+     /**
+      * Applies a supplemental hash function to a given hashCode, which
+@@ -193,104 +276,67 @@
+     }
+ 
+     /**
+-     * Returns the segment that should be used for key with given hash
+-     * @param hash the hash code for the key
+-     * @return the segment
+-     */
+-    final Segment<K,V> segmentFor(int hash) {
+-        return segments[(hash >>> segmentShift) & segmentMask];
+-    }
+-
+-    /* ---------------- Inner Classes -------------- */
+-
+-    /**
+-     * ConcurrentHashMap list entry. Note that this is never exported
+-     * out as a user-visible Map.Entry.
+-     *
+-     * Because the value field is volatile, not final, it is legal wrt
+-     * the Java Memory Model for an unsynchronized reader to see null
+-     * instead of initial value when read via a data race.  Although a
+-     * reordering leading to this is not likely to ever actually
+-     * occur, the Segment.readValueUnderLock method is used as a
+-     * backup in case a null (pre-initialized) value is ever seen in
+-     * an unsynchronized access method.
+-     */
+-    static final class HashEntry<K,V> {
+-        final K key;
+-        final int hash;
+-        volatile V value;
+-        final HashEntry<K,V> next;
+-
+-        HashEntry(K key, int hash, HashEntry<K,V> next, V value) {
+-            this.key = key;
+-            this.hash = hash;
+-            this.next = next;
+-            this.value = value;
+-        }
+-
+-        @SuppressWarnings("unchecked")
+-        static final <K,V> HashEntry<K,V>[] newArray(int i) {
+-            return new HashEntry[i];
+-        }
+-    }
+-
+-    /**
+      * Segments are specialized versions of hash tables.  This
+      * subclasses from ReentrantLock opportunistically, just to
+      * simplify some locking and avoid separate construction.
+      */
+     static final class Segment<K,V> extends ReentrantLock implements Serializable {
+         /*
+-         * Segments maintain a table of entry lists that are ALWAYS
+-         * kept in a consistent state, so can be read without locking.
+-         * Next fields of nodes are immutable (final).  All list
+-         * additions are performed at the front of each bin. This
+-         * makes it easy to check changes, and also fast to traverse.
+-         * When nodes would otherwise be changed, new nodes are
+-         * created to replace them. This works well for hash tables
+-         * since the bin lists tend to be short. (The average length
+-         * is less than two for the default load factor threshold.)
++         * Segments maintain a table of entry lists that are always
++         * kept in a consistent state, so can be read (via volatile
++         * reads of segments and tables) without locking.  This
++         * requires replicating nodes when necessary during table
++         * resizing, so the old lists can be traversed by readers
++         * still using old version of table.
+          *
+-         * Read operations can thus proceed without locking, but rely
+-         * on selected uses of volatiles to ensure that completed
+-         * write operations performed by other threads are
+-         * noticed. For most purposes, the "count" field, tracking the
+-         * number of elements, serves as that volatile variable
+-         * ensuring visibility.  This is convenient because this field
+-         * needs to be read in many read operations anyway:
+-         *
+-         *   - All (unsynchronized) read operations must first read the
+-         *     "count" field, and should not look at table entries if
+-         *     it is 0.
+-         *
+-         *   - All (synchronized) write operations should write to
+-         *     the "count" field after structurally changing any bin.
+-         *     The operations must not take any action that could even
+-         *     momentarily cause a concurrent read operation to see
+-         *     inconsistent data. This is made easier by the nature of
+-         *     the read operations in Map. For example, no operation
+-         *     can reveal that the table has grown but the threshold
+-         *     has not yet been updated, so there are no atomicity
+-         *     requirements for this with respect to reads.
+-         *
+-         * As a guide, all critical volatile reads and writes to the
+-         * count field are marked in code comments.
++         * This class defines only mutative methods requiring locking.
++         * Except as noted, the methods of this class perform the
++         * per-segment versions of ConcurrentHashMap methods.  (Other
++         * methods are integrated directly into ConcurrentHashMap
++         * methods.) These mutative methods use a form of controlled
++         * spinning on contention via methods scanAndLock and
++         * scanAndLockForPut. These intersperse tryLocks with
++         * traversals to locate nodes.  The main benefit is to absorb
++         * cache misses (which are very common for hash tables) while
++         * obtaining locks so that traversal is faster once
++         * acquired. We do not actually use the found nodes since they
++         * must be re-acquired under lock anyway to ensure sequential
++         * consistency of updates (and in any case may be undetectably
++         * stale), but they will normally be much faster to re-locate.
++         * Also, scanAndLockForPut speculatively creates a fresh node
++         * to use in put if no node is found.
+          */
+ 
+         private static final long serialVersionUID = 2249069246763182397L;
+ 
+         /**
+-         * The number of elements in this segment's region.
++         * The maximum number of times to tryLock in a prescan before
++         * possibly blocking on acquire in preparation for a locked
++         * segment operation. On multiprocessors, using a bounded
++         * number of retries maintains cache acquired while locating
++         * nodes.
+          */
+-        transient volatile int count;
++        static final int MAX_SCAN_RETRIES =
++            Runtime.getRuntime().availableProcessors() > 1 ? 64 : 1;
+ 
+         /**
+-         * Number of updates that alter the size of the table. This is
+-         * used during bulk-read methods to make sure they see a
+-         * consistent snapshot: If modCounts change during a traversal
+-         * of segments computing size or checking containsValue, then
+-         * we might have an inconsistent view of state so (usually)
+-         * must retry.
++         * The per-segment table. Elements are accessed via
++         * entryAt/setEntryAt providing volatile semantics.
++         */
++        transient volatile HashEntry<K,V>[] table;
++
++        /**
++         * The number of elements. Accessed only either within locks
++         * or among other volatile reads that maintain visibility.
++         */
++        transient int count;
++
++        /**
++         * The total number of mutative operations in this segment.
++         * Even though this may overflows 32 bits, it provides
++         * sufficient accuracy for stability checks in CHM isEmpty()
++         * and size() methods.  Accessed only either within locks or
++         * among other volatile reads that maintain visibility.
+          */
+         transient int modCount;
+ 
+@@ -302,11 +348,6 @@
+         transient int threshold;
+ 
+         /**
+-         * The per-segment table.
+-         */
+-        transient volatile HashEntry<K,V>[] table;
+-
+-        /**
+          * The load factor for the hash table.  Even though this value
+          * is same for all segments, it is replicated to avoid needing
+          * links to outer object.
+@@ -314,202 +355,94 @@
+          */
+         final float loadFactor;
+ 
+-        Segment(int initialCapacity, float lf) {
+-            loadFactor = lf;
+-            setTable(HashEntry.<K,V>newArray(initialCapacity));
++        Segment(float lf, int threshold, HashEntry<K,V>[] tab) {
++            this.loadFactor = lf;
++            this.threshold = threshold;
++            this.table = tab;
+         }
+ 
+-        @SuppressWarnings("unchecked")
+-        static final <K,V> Segment<K,V>[] newArray(int i) {
+-            return new Segment[i];
++        final V put(K key, int hash, V value, boolean onlyIfAbsent) {
++            HashEntry<K,V> node = tryLock() ? null :
++                scanAndLockForPut(key, hash, value);
++            V oldValue;
++            try {
++                HashEntry<K,V>[] tab = table;
++                int index = (tab.length - 1) & hash;
++                HashEntry<K,V> first = entryAt(tab, index);
++                for (HashEntry<K,V> e = first;;) {
++                    if (e != null) {
++                        K k;
++                        if ((k = e.key) == key ||
++                            (e.hash == hash && key.equals(k))) {
++                            oldValue = e.value;
++                            if (!onlyIfAbsent) {
++                                e.value = value;
++                                ++modCount;
++                            }
++                            break;
++                        }
++                        e = e.next;
++                    }
++                    else {
++                        if (node != null)
++                            node.setNext(first);
++                        else
++                            node = new HashEntry<K,V>(hash, key, value, first);
++                        int c = count + 1;
++                        if (c > threshold && first != null &&
++                            tab.length < MAXIMUM_CAPACITY)
++                            rehash(node);
++                        else
++                            setEntryAt(tab, index, node);
++                        ++modCount;
++                        count = c;
++                        oldValue = null;
++                        break;
++                    }
++                }
++            } finally {
++                unlock();
++            }
++            return oldValue;
+         }
+ 
+         /**
+-         * Sets table to new HashEntry array.
+-         * Call only while holding lock or in constructor.
++         * Doubles size of table and repacks entries, also adding the
++         * given node to new table
+          */
+-        void setTable(HashEntry<K,V>[] newTable) {
+-            threshold = (int)(newTable.length * loadFactor);
+-            table = newTable;
+-        }
+-
+-        /**
+-         * Returns properly casted first entry of bin for given hash.
+-         */
+-        HashEntry<K,V> getFirst(int hash) {
+-            HashEntry<K,V>[] tab = table;
+-            return tab[hash & (tab.length - 1)];
+-        }
+-
+-        /**
+-         * Reads value field of an entry under lock. Called if value
+-         * field ever appears to be null. This is possible only if a
+-         * compiler happens to reorder a HashEntry initialization with
+-         * its table assignment, which is legal under memory model
+-         * but is not known to ever occur.
+-         */
+-        V readValueUnderLock(HashEntry<K,V> e) {
+-            lock();
+-            try {
+-                return e.value;
+-            } finally {
+-                unlock();
+-            }
+-        }
+-
+-        /* Specialized implementations of map methods */
+-
+-        V get(Object key, int hash) {
+-            if (count != 0) { // read-volatile
+-                HashEntry<K,V> e = getFirst(hash);
+-                while (e != null) {
+-                    if (e.hash == hash && key.equals(e.key)) {
+-                        V v = e.value;
+-                        if (v != null)
+-                            return v;
+-                        return readValueUnderLock(e); // recheck
+-                    }
+-                    e = e.next;
+-                }
+-            }
+-            return null;
+-        }
+-
+-        boolean containsKey(Object key, int hash) {
+-            if (count != 0) { // read-volatile
+-                HashEntry<K,V> e = getFirst(hash);
+-                while (e != null) {
+-                    if (e.hash == hash && key.equals(e.key))
+-                        return true;
+-                    e = e.next;
+-                }
+-            }
+-            return false;
+-        }
+-
+-        boolean containsValue(Object value) {
+-            if (count != 0) { // read-volatile
+-                HashEntry<K,V>[] tab = table;
+-                int len = tab.length;
+-                for (int i = 0 ; i < len; i++) {
+-                    for (HashEntry<K,V> e = tab[i]; e != null; e = e.next) {
+-                        V v = e.value;
+-                        if (v == null) // recheck
+-                            v = readValueUnderLock(e);
+-                        if (value.equals(v))
+-                            return true;
+-                    }
+-                }
+-            }
+-            return false;
+-        }
+-
+-        boolean replace(K key, int hash, V oldValue, V newValue) {
+-            lock();
+-            try {
+-                HashEntry<K,V> e = getFirst(hash);
+-                while (e != null && (e.hash != hash || !key.equals(e.key)))
+-                    e = e.next;
+-
+-                boolean replaced = false;
+-                if (e != null && oldValue.equals(e.value)) {
+-                    replaced = true;
+-                    e.value = newValue;
+-                }
+-                return replaced;
+-            } finally {
+-                unlock();
+-            }
+-        }
+-
+-        V replace(K key, int hash, V newValue) {
+-            lock();
+-            try {
+-                HashEntry<K,V> e = getFirst(hash);
+-                while (e != null && (e.hash != hash || !key.equals(e.key)))
+-                    e = e.next;
+-
+-                V oldValue = null;
+-                if (e != null) {
+-                    oldValue = e.value;
+-                    e.value = newValue;
+-                }
+-                return oldValue;
+-            } finally {
+-                unlock();
+-            }
+-        }
+-
+-
+-        V put(K key, int hash, V value, boolean onlyIfAbsent) {
+-            lock();
+-            try {
+-                int c = count;
+-                if (c++ > threshold) // ensure capacity
+-                    rehash();
+-                HashEntry<K,V>[] tab = table;
+-                int index = hash & (tab.length - 1);
+-                HashEntry<K,V> first = tab[index];
+-                HashEntry<K,V> e = first;
+-                while (e != null && (e.hash != hash || !key.equals(e.key)))
+-                    e = e.next;
+-
+-                V oldValue;
+-                if (e != null) {
+-                    oldValue = e.value;
+-                    if (!onlyIfAbsent)
+-                        e.value = value;
+-                }
+-                else {
+-                    oldValue = null;
+-                    ++modCount;
+-                    tab[index] = new HashEntry<K,V>(key, hash, first, value);
+-                    count = c; // write-volatile
+-                }
+-                return oldValue;
+-            } finally {
+-                unlock();
+-            }
+-        }
+-
+-        void rehash() {
++        @SuppressWarnings("unchecked")
++        private void rehash(HashEntry<K,V> node) {
++            /*
++             * Reclassify nodes in each list to new table.  Because we
++             * are using power-of-two expansion, the elements from
++             * each bin must either stay at same index, or move with a
++             * power of two offset. We eliminate unnecessary node
++             * creation by catching cases where old nodes can be
++             * reused because their next fields won't change.
++             * Statistically, at the default threshold, only about
++             * one-sixth of them need cloning when a table
++             * doubles. The nodes they replace will be garbage
++             * collectable as soon as they are no longer referenced by
++             * any reader thread that may be in the midst of
++             * concurrently traversing table. Entry accesses use plain
++             * array indexing because they are followed by volatile
++             * table write.
++             */
+             HashEntry<K,V>[] oldTable = table;
+             int oldCapacity = oldTable.length;
+-            if (oldCapacity >= MAXIMUM_CAPACITY)
+-                return;
+-
+-            /*
+-             * Reclassify nodes in each list to new Map.  Because we are
+-             * using power-of-two expansion, the elements from each bin
+-             * must either stay at same index, or move with a power of two
+-             * offset. We eliminate unnecessary node creation by catching
+-             * cases where old nodes can be reused because their next
+-             * fields won't change. Statistically, at the default
+-             * threshold, only about one-sixth of them need cloning when
+-             * a table doubles. The nodes they replace will be garbage
+-             * collectable as soon as they are no longer referenced by any
+-             * reader thread that may be in the midst of traversing table
+-             * right now.
+-             */
+-
+-            HashEntry<K,V>[] newTable = HashEntry.newArray(oldCapacity<<1);
+-            threshold = (int)(newTable.length * loadFactor);
+-            int sizeMask = newTable.length - 1;
++            int newCapacity = oldCapacity << 1;
++            threshold = (int)(newCapacity * loadFactor);
++            HashEntry<K,V>[] newTable =
++                (HashEntry<K,V>[]) new HashEntry[newCapacity];
++            int sizeMask = newCapacity - 1;
+             for (int i = 0; i < oldCapacity ; i++) {
+-                // We need to guarantee that any existing reads of old Map can
+-                //  proceed. So we cannot yet null out each bin.
+                 HashEntry<K,V> e = oldTable[i];
+-
+                 if (e != null) {
+                     HashEntry<K,V> next = e.next;
+                     int idx = e.hash & sizeMask;
+-
+-                    //  Single node on list
+-                    if (next == null)
++                    if (next == null)   //  Single node on list
+                         newTable[idx] = e;
+-
+-                    else {
+-                        // Reuse trailing consecutive sequence at same slot
++                    else { // Reuse consecutive sequence at same slot
+                         HashEntry<K,V> lastRun = e;
+                         int lastIdx = idx;
+                         for (HashEntry<K,V> last = next;
+@@ -522,74 +455,259 @@
+                             }
+                         }
+                         newTable[lastIdx] = lastRun;
+-
+-                        // Clone all remaining nodes
++                        // Clone remaining nodes
+                         for (HashEntry<K,V> p = e; p != lastRun; p = p.next) {
+-                            int k = p.hash & sizeMask;
++                            V v = p.value;
++                            int h = p.hash;
++                            int k = h & sizeMask;
+                             HashEntry<K,V> n = newTable[k];
+-                            newTable[k] = new HashEntry<K,V>(p.key, p.hash,
+-                                                             n, p.value);
++                            newTable[k] = new HashEntry<K,V>(h, p.key, v, n);
+                         }
+                     }
+                 }
+             }
++            int nodeIndex = node.hash & sizeMask; // add the new node
++            node.setNext(newTable[nodeIndex]);
++            newTable[nodeIndex] = node;
+             table = newTable;
+         }
+ 
+         /**
++         * Scans for a node containing given key while trying to
++         * acquire lock, creating and returning one if not found. Upon
++         * return, guarantees that lock is held. UNlike in most
++         * methods, calls to method equals are not screened: Since
++         * traversal speed doesn't matter, we might as well help warm
++         * up the associated code and accesses as well.
++         *
++         * @return a new node if key not found, else null
++         */
++        private HashEntry<K,V> scanAndLockForPut(K key, int hash, V value) {
++            HashEntry<K,V> first = entryForHash(this, hash);
++            HashEntry<K,V> e = first;
++            HashEntry<K,V> node = null;
++            int retries = -1; // negative while locating node
++            while (!tryLock()) {
++                HashEntry<K,V> f; // to recheck first below
++                if (retries < 0) {
++                    if (e == null) {
++                        if (node == null) // speculatively create node
++                            node = new HashEntry<K,V>(hash, key, value, null);
++                        retries = 0;
++                    }
++                    else if (key.equals(e.key))
++                        retries = 0;
++                    else
++                        e = e.next;
++                }
++                else if (++retries > MAX_SCAN_RETRIES) {
++                    lock();
++                    break;
++                }
++                else if ((retries & 1) == 0 &&
++                         (f = entryForHash(this, hash)) != first) {
++                    e = first = f; // re-traverse if entry changed
++                    retries = -1;
++                }
++            }
++            return node;
++        }
++
++        /**
++         * Scans for a node containing the given key while trying to
++         * acquire lock for a remove or replace operation. Upon
++         * return, guarantees that lock is held.  Note that we must
++         * lock even if the key is not found, to ensure sequential
++         * consistency of updates.
++         */
++        private void scanAndLock(Object key, int hash) {
++            // similar to but simpler than scanAndLockForPut
++            HashEntry<K,V> first = entryForHash(this, hash);
++            HashEntry<K,V> e = first;
++            int retries = -1;
++            while (!tryLock()) {
++                HashEntry<K,V> f;
++                if (retries < 0) {
++                    if (e == null || key.equals(e.key))
++                        retries = 0;
++                    else
++                        e = e.next;
++                }
++                else if (++retries > MAX_SCAN_RETRIES) {
++                    lock();
++                    break;
++                }
++                else if ((retries & 1) == 0 &&
++                         (f = entryForHash(this, hash)) != first) {
++                    e = first = f;
++                    retries = -1;
++                }
++            }
++        }
++
++        /**
+          * Remove; match on key only if value null, else match both.
+          */
+-        V remove(Object key, int hash, Object value) {
++        final V remove(Object key, int hash, Object value) {
++            if (!tryLock())
++                scanAndLock(key, hash);
++            V oldValue = null;
++            try {
++                HashEntry<K,V>[] tab = table;
++                int index = (tab.length - 1) & hash;
++                HashEntry<K,V> e = entryAt(tab, index);
++                HashEntry<K,V> pred = null;
++                while (e != null) {
++                    K k;
++                    HashEntry<K,V> next = e.next;
++                    if ((k = e.key) == key ||
++                        (e.hash == hash && key.equals(k))) {
++                        V v = e.value;
++                        if (value == null || value == v || value.equals(v)) {
++                            if (pred == null)
++                                setEntryAt(tab, index, next);
++                            else
++                                pred.setNext(next);
++                            ++modCount;
++                            --count;
++                            oldValue = v;
++                        }
++                        break;
++                    }
++                    pred = e;
++                    e = next;
++                }
++            } finally {
++                unlock();
++            }
++            return oldValue;
++        }
++
++        final boolean replace(K key, int hash, V oldValue, V newValue) {
++            if (!tryLock())
++                scanAndLock(key, hash);
++            boolean replaced = false;
++            try {
++                HashEntry<K,V> e;
++                for (e = entryForHash(this, hash); e != null; e = e.next) {
++                    K k;
++                    if ((k = e.key) == key ||
++                        (e.hash == hash && key.equals(k))) {
++                        if (oldValue.equals(e.value)) {
++                            e.value = newValue;
++                            ++modCount;
++                            replaced = true;
++                        }
++                        break;
++                    }
++                }
++            } finally {
++                unlock();
++            }
++            return replaced;
++        }
++
++        final V replace(K key, int hash, V value) {
++            if (!tryLock())
++                scanAndLock(key, hash);
++            V oldValue = null;
++            try {
++                HashEntry<K,V> e;
++                for (e = entryForHash(this, hash); e != null; e = e.next) {
++                    K k;
++                    if ((k = e.key) == key ||
++                        (e.hash == hash && key.equals(k))) {
++                        oldValue = e.value;
++                        e.value = value;
++                        ++modCount;
++                        break;
++                    }
++                }
++            } finally {
++                unlock();
++            }
++            return oldValue;
++        }
++
++        final void clear() {
+             lock();
+             try {
+-                int c = count - 1;
+                 HashEntry<K,V>[] tab = table;
+-                int index = hash & (tab.length - 1);
+-                HashEntry<K,V> first = tab[index];
+-                HashEntry<K,V> e = first;
+-                while (e != null && (e.hash != hash || !key.equals(e.key)))
+-                    e = e.next;
+-
+-                V oldValue = null;
+-                if (e != null) {
+-                    V v = e.value;
+-                    if (value == null || value.equals(v)) {
+-                        oldValue = v;
+-                        // All entries following removed node can stay
+-                        // in list, but all preceding ones need to be
+-                        // cloned.
+-                        ++modCount;
+-                        HashEntry<K,V> newFirst = e.next;
+-                        for (HashEntry<K,V> p = first; p != e; p = p.next)
+-                            newFirst = new HashEntry<K,V>(p.key, p.hash,
+-                                                          newFirst, p.value);
+-                        tab[index] = newFirst;
+-                        count = c; // write-volatile
+-                    }
+-                }
+-                return oldValue;
++                for (int i = 0; i < tab.length ; i++)
++                    setEntryAt(tab, i, null);
++                ++modCount;
++                count = 0;
+             } finally {
+                 unlock();
+             }
+         }
++    }
+ 
+-        void clear() {
+-            if (count != 0) {
+-                lock();
+-                try {
+-                    HashEntry<K,V>[] tab = table;
+-                    for (int i = 0; i < tab.length ; i++)
+-                        tab[i] = null;
+-                    ++modCount;
+-                    count = 0; // write-volatile
+-                } finally {
+-                    unlock();
++    // Accessing segments
++
++    /**
++     * Gets the jth element of given segment array (if nonnull) with
++     * volatile element access semantics via Unsafe.
++     */
++    @SuppressWarnings("unchecked")
++    static final <K,V> Segment<K,V> segmentAt(Segment<K,V>[] ss, int j) {
++        long u = (j << SSHIFT) + SBASE;
++        return ss == null ? null :
++            (Segment<K,V>) UNSAFE.getObjectVolatile(ss, u);
++    }
++
++    /**
++     * Returns the segment for the given index, creating it and
++     * recording in segment table (via CAS) if not already present.
++     *
++     * @param k the index
++     * @return the segment
++     */
++    @SuppressWarnings("unchecked")
++    private Segment<K,V> ensureSegment(int k) {
++        final Segment<K,V>[] ss = this.segments;
++        long u = (k << SSHIFT) + SBASE; // raw offset
++        Segment<K,V> seg;
++        if ((seg = (Segment<K,V>)UNSAFE.getObjectVolatile(ss, u)) == null) {
++            Segment<K,V> proto = ss[0]; // use segment 0 as prototype
++            int cap = proto.table.length;
++            float lf = proto.loadFactor;
++            int threshold = (int)(cap * lf);
++            HashEntry<K,V>[] tab = (HashEntry<K,V>[])new HashEntry[cap];
++            if ((seg = (Segment<K,V>)UNSAFE.getObjectVolatile(ss, u))
++                == null) { // recheck
++                Segment<K,V> s = new Segment<K,V>(lf, threshold, tab);
++                while ((seg = (Segment<K,V>)UNSAFE.getObjectVolatile(ss, u))
++                       == null) {
++                    if (UNSAFE.compareAndSwapObject(ss, u, null, seg = s))
++                        break;
+                 }
+             }
+         }
++        return seg;
+     }
+ 
++    // Hash-based segment and entry accesses
+ 
++    /**
++     * Get the segment for the given hash
++     */
++    @SuppressWarnings("unchecked")
++    private Segment<K,V> segmentForHash(int h) {
++        long u = (((h >>> segmentShift) & segmentMask) << SSHIFT) + SBASE;
++        return (Segment<K,V>) UNSAFE.getObjectVolatile(segments, u);
++    }
++
++    /**
++     * Gets the table entry for the given segment and hash
++     */
++    @SuppressWarnings("unchecked")
++    static final <K,V> HashEntry<K,V> entryForHash(Segment<K,V> seg, int h) {
++        HashEntry<K,V>[] tab;
++        return (seg == null || (tab = seg.table) == null) ? null :
++            (HashEntry<K,V>) UNSAFE.getObjectVolatile
++            (tab, ((long)(((tab.length - 1) & h)) << TSHIFT) + TBASE);
++    }
+ 
+     /* ---------------- Public operations -------------- */
+ 
+@@ -609,14 +727,13 @@
+      * negative or the load factor or concurrencyLevel are
+      * nonpositive.
+      */
++    @SuppressWarnings("unchecked")
+     public ConcurrentHashMap(int initialCapacity,
+                              float loadFactor, int concurrencyLevel) {
+         if (!(loadFactor > 0) || initialCapacity < 0 || concurrencyLevel <= 0)
+             throw new IllegalArgumentException();
+-
+         if (concurrencyLevel > MAX_SEGMENTS)
+             concurrencyLevel = MAX_SEGMENTS;
+-
+         // Find power-of-two sizes best matching arguments
+         int sshift = 0;
+         int ssize = 1;
+@@ -624,21 +741,23 @@
+             ++sshift;
+             ssize <<= 1;
+         }
+-        segmentShift = 32 - sshift;
+-        segmentMask = ssize - 1;
+-        this.segments = Segment.newArray(ssize);
+-
++        this.segmentShift = 32 - sshift;
++        this.segmentMask = ssize - 1;
+         if (initialCapacity > MAXIMUM_CAPACITY)
+             initialCapacity = MAXIMUM_CAPACITY;
+         int c = initialCapacity / ssize;
+         if (c * ssize < initialCapacity)
+             ++c;
+-        int cap = 1;
++        int cap = MIN_SEGMENT_TABLE_CAPACITY;
+         while (cap < c)
+             cap <<= 1;
+-
+-        for (int i = 0; i < this.segments.length; ++i)
+-            this.segments[i] = new Segment<K,V>(cap, loadFactor);
++        // create segments and segments[0]
++        Segment<K,V> s0 =
++            new Segment<K,V>(loadFactor, (int)(cap * loadFactor),
++                             (HashEntry<K,V>[])new HashEntry[cap]);
++        Segment<K,V>[] ss = (Segment<K,V>[])new Segment[ssize];
++        UNSAFE.putOrderedObject(ss, SBASE, s0); // ordered write of segments[0]
++        this.segments = ss;
+     }
+ 
+     /**
+@@ -701,33 +820,36 @@
+      * @return <tt>true</tt> if this map contains no key-value mappings
+      */
+     public boolean isEmpty() {
++        /*
++         * Sum per-segment modCounts to avoid mis-reporting when
++         * elements are concurrently added and removed in one segment
++         * while checking another, in which case the table was never
++         * actually empty at any point. (The sum ensures accuracy up
++         * through at least 1<<31 per-segment modifications before
++         * recheck.)  Methods size() and containsValue() use similar
++         * constructions for stability checks.
++         */
++        long sum = 0L;
+         final Segment<K,V>[] segments = this.segments;
+-        /*
+-         * We keep track of per-segment modCounts to avoid ABA
+-         * problems in which an element in one segment was added and
+-         * in another removed during traversal, in which case the
+-         * table was never actually empty at any point. Note the
+-         * similar use of modCounts in the size() and containsValue()
+-         * methods, which are the only other methods also susceptible
+-         * to ABA problems.
+-         */
+-        int[] mc = new int[segments.length];
+-        int mcsum = 0;
+-        for (int i = 0; i < segments.length; ++i) {
+-            if (segments[i].count != 0)
++        for (int j = 0; j < segments.length; ++j) {
++            Segment<K,V> seg = segmentAt(segments, j);
++            if (seg != null) {
++                if (seg.count != 0)
++                    return false;
++                sum += seg.modCount;
++            }
++        }
++        if (sum != 0L) { // recheck unless no modifications
++            for (int j = 0; j < segments.length; ++j) {
++                Segment<K,V> seg = segmentAt(segments, j);
++                if (seg != null) {
++                    if (seg.count != 0)
++                        return false;
++                    sum -= seg.modCount;
++                }
++            }
++            if (sum != 0L)
+                 return false;
+-            else
+-                mcsum += mc[i] = segments[i].modCount;
+-        }
+-        // If mcsum happens to be zero, then we know we got a snapshot
+-        // before any modifications at all were made.  This is
+-        // probably common enough to bother tracking.
+-        if (mcsum != 0) {
+-            for (int i = 0; i < segments.length; ++i) {
+-                if (segments[i].count != 0 ||
+-                    mc[i] != segments[i].modCount)
+-                    return false;
+-            }
+         }
+         return true;
+     }
+@@ -740,45 +862,43 @@
+      * @return the number of key-value mappings in this map
+      */
+     public int size() {
+-        final Segment<K,V>[] segments = this.segments;
+-        long sum = 0;
+-        long check = 0;
+-        int[] mc = new int[segments.length];
+         // Try a few times to get accurate count. On failure due to
+         // continuous async changes in table, resort to locking.
+-        for (int k = 0; k < RETRIES_BEFORE_LOCK; ++k) {
+-            check = 0;
+-            sum = 0;
+-            int mcsum = 0;
+-            for (int i = 0; i < segments.length; ++i) {
+-                sum += segments[i].count;
+-                mcsum += mc[i] = segments[i].modCount;
+-            }
+-            if (mcsum != 0) {
+-                for (int i = 0; i < segments.length; ++i) {
+-                    check += segments[i].count;
+-                    if (mc[i] != segments[i].modCount) {
+-                        check = -1; // force retry
+-                        break;
++        final Segment<K,V>[] segments = this.segments;
++        int size;
++        boolean overflow; // true if size overflows 32 bits
++        long sum;         // sum of modCounts
++        long last = 0L;   // previous sum
++        int retries = -1; // first iteration isn't retry
++        try {
++            for (;;) {
++                if (retries++ == RETRIES_BEFORE_LOCK) {
++                    for (int j = 0; j < segments.length; ++j)
++                        ensureSegment(j).lock(); // force creation
++                }
++                sum = 0L;
++                size = 0;
++                overflow = false;
++                for (int j = 0; j < segments.length; ++j) {
++                    Segment<K,V> seg = segmentAt(segments, j);
++                    if (seg != null) {
++                        sum += seg.modCount;
++                        int c = seg.count;
++                        if (c < 0 || (size += c) < 0)
++                            overflow = true;
+                     }
+                 }
++                if (sum == last)
++                    break;
++                last = sum;
+             }
+-            if (check == sum)
+-                break;
++        } finally {
++            if (retries > RETRIES_BEFORE_LOCK) {
++                for (int j = 0; j < segments.length; ++j)
++                    segmentAt(segments, j).unlock();
++            }
+         }
+-        if (check != sum) { // Resort to locking all segments
+-            sum = 0;
+-            for (int i = 0; i < segments.length; ++i)
+-                segments[i].lock();
+-            for (int i = 0; i < segments.length; ++i)
+-                sum += segments[i].count;
+-            for (int i = 0; i < segments.length; ++i)
+-                segments[i].unlock();
+-        }
+-        if (sum > Integer.MAX_VALUE)
+-            return Integer.MAX_VALUE;
+-        else
+-            return (int)sum;
++        return overflow ? Integer.MAX_VALUE : size;
+     }
+ 
+     /**
+@@ -794,7 +914,13 @@
+      */
+     public V get(Object key) {
+         int hash = hash(key.hashCode());
+-        return segmentFor(hash).get(key, hash);
++        for (HashEntry<K,V> e = entryForHash(segmentForHash(hash), hash);
++             e != null; e = e.next) {
++            K k;
++            if ((k = e.key) == key || (e.hash == hash && key.equals(k)))
++                return e.value;
++        }
++        return null;
+     }
+ 
+     /**
+@@ -808,7 +934,13 @@
+      */
+     public boolean containsKey(Object key) {
+         int hash = hash(key.hashCode());
+-        return segmentFor(hash).containsKey(key, hash);
++        for (HashEntry<K,V> e = entryForHash(segmentForHash(hash), hash);
++             e != null; e = e.next) {
++            K k;
++            if ((k = e.key) == key || (e.hash == hash && key.equals(k)))
++                return true;
++        }
++        return false;
+     }
+ 
+     /**
+@@ -823,51 +955,47 @@
+      * @throws NullPointerException if the specified value is null
+      */
+     public boolean containsValue(Object value) {
++        // Same idea as size()
+         if (value == null)
+             throw new NullPointerException();
+-
+-        // See explanation of modCount use above
+-
+         final Segment<K,V>[] segments = this.segments;
+-        int[] mc = new int[segments.length];
+-
+-        // Try a few times without locking
+-        for (int k = 0; k < RETRIES_BEFORE_LOCK; ++k) {
+-            int sum = 0;
+-            int mcsum = 0;
+-            for (int i = 0; i < segments.length; ++i) {
+-                int c = segments[i].count;
+-                mcsum += mc[i] = segments[i].modCount;
+-                if (segments[i].containsValue(value))
+-                    return true;
+-            }
+-            boolean cleanSweep = true;
+-            if (mcsum != 0) {
+-                for (int i = 0; i < segments.length; ++i) {
+-                    int c = segments[i].count;
+-                    if (mc[i] != segments[i].modCount) {
+-                        cleanSweep = false;
+-                        break;
++        boolean found = false;
++        long last = 0;
++        int retries = -1;
++        try {
++            outer: for (;;) {
++                if (retries++ == RETRIES_BEFORE_LOCK) {
++                    for (int j = 0; j < segments.length; ++j)
++                        ensureSegment(j).lock(); // force creation
++                }
++                long hashSum = 0L;
++                int sum = 0;
++                for (int j = 0; j < segments.length; ++j) {
++                    HashEntry<K,V>[] tab;
++                    Segment<K,V> seg = segmentAt(segments, j);
++                    if (seg != null && (tab = seg.table) != null) {
++                        for (int i = 0 ; i < tab.length; i++) {
++                            HashEntry<K,V> e;
++                            for (e = entryAt(tab, i); e != null; e = e.next) {
++                                V v = e.value;
++                                if (v != null && value.equals(v)) {
++                                    found = true;
++                                    break outer;
++                                }
++                            }
++                        }
++                        sum += seg.modCount;
+                     }
+                 }
+-            }
+-            if (cleanSweep)
+-                return false;
+-        }
+-        // Resort to locking all segments
+-        for (int i = 0; i < segments.length; ++i)
+-            segments[i].lock();
+-        boolean found = false;
+-        try {
+-            for (int i = 0; i < segments.length; ++i) {
+-                if (segments[i].containsValue(value)) {
+-                    found = true;
++                if (retries > 0 && sum == last)
+                     break;
+-                }
++                last = sum;
+             }
+         } finally {
+-            for (int i = 0; i < segments.length; ++i)
+-                segments[i].unlock();
++            if (retries > RETRIES_BEFORE_LOCK) {
++                for (int j = 0; j < segments.length; ++j)
++                    segmentAt(segments, j).unlock();
++            }
+         }
+         return found;
+     }
+@@ -908,7 +1036,11 @@
+         if (value == null)
+             throw new NullPointerException();
+         int hash = hash(key.hashCode());
+-        return segmentFor(hash).put(key, hash, value, false);
++        int j = (hash >>> segmentShift) & segmentMask;
++        Segment<K,V> s = segmentAt(segments, j);
++        if (s == null)
++            s = ensureSegment(j);
++        return s.put(key, hash, value, false);
+     }
+ 
+     /**
+@@ -922,7 +1054,11 @@
+         if (value == null)
+             throw new NullPointerException();
+         int hash = hash(key.hashCode());
+-        return segmentFor(hash).put(key, hash, value, true);
++        int j = (hash >>> segmentShift) & segmentMask;
++        Segment<K,V> s = segmentAt(segments, j);
++        if (s == null)
++            s = ensureSegment(j);
++        return s.put(key, hash, value, true);
+     }
+ 
+     /**
+@@ -948,7 +1084,8 @@
+      */
+     public V remove(Object key) {
+         int hash = hash(key.hashCode());
+-        return segmentFor(hash).remove(key, hash, null);
++        Segment<K,V> s = segmentForHash(hash);
++        return s == null ? null : s.remove(key, hash, null);
+     }
+ 
+     /**
+@@ -958,9 +1095,9 @@
+      */
+     public boolean remove(Object key, Object value) {
+         int hash = hash(key.hashCode());
+-        if (value == null)
+-            return false;
+-        return segmentFor(hash).remove(key, hash, value) != null;
++        Segment<K,V> s;
++        return value != null && (s = segmentForHash(hash)) != null &&
++            s.remove(key, hash, value) != null;
+     }
+ 
+     /**
+@@ -969,10 +1106,11 @@
+      * @throws NullPointerException if any of the arguments are null
+      */
+     public boolean replace(K key, V oldValue, V newValue) {
++        int hash = hash(key.hashCode());
+         if (oldValue == null || newValue == null)
+             throw new NullPointerException();
+-        int hash = hash(key.hashCode());
+-        return segmentFor(hash).replace(key, hash, oldValue, newValue);
++        Segment<K,V> s = segmentForHash(hash);
++        return s != null && s.replace(key, hash, oldValue, newValue);
+     }
+ 
+     /**
+@@ -983,18 +1121,23 @@
+      * @throws NullPointerException if the specified key or value is null
+      */
+     public V replace(K key, V value) {
++        int hash = hash(key.hashCode());
+         if (value == null)
+             throw new NullPointerException();
+-        int hash = hash(key.hashCode());
+-        return segmentFor(hash).replace(key, hash, value);
++        Segment<K,V> s = segmentForHash(hash);
++        return s == null ? null : s.replace(key, hash, value);
+     }
+ 
+     /**
+      * Removes all of the mappings from this map.
+      */
+     public void clear() {
+-        for (int i = 0; i < segments.length; ++i)
+-            segments[i].clear();
++        final Segment<K,V>[] segments = this.segments;
++        for (int j = 0; j < segments.length; ++j) {
++            Segment<K,V> s = segmentAt(segments, j);
++            if (s != null)
++                s.clear();
++        }
+     }
+ 
+     /**
+@@ -1095,42 +1238,41 @@
+             advance();
+         }
+ 
+-        public boolean hasMoreElements() { return hasNext(); }
+-
++        /**
++         * Set nextEntry to first node of next non-empty table
++         * (in backwards order, to simplify checks).
++         */
+         final void advance() {
+-            if (nextEntry != null && (nextEntry = nextEntry.next) != null)
+-                return;
+-
+-            while (nextTableIndex >= 0) {
+-                if ( (nextEntry = currentTable[nextTableIndex--]) != null)
+-                    return;
+-            }
+-
+-            while (nextSegmentIndex >= 0) {
+-                Segment<K,V> seg = segments[nextSegmentIndex--];
+-                if (seg.count != 0) {
+-                    currentTable = seg.table;
+-                    for (int j = currentTable.length - 1; j >= 0; --j) {
+-                        if ( (nextEntry = currentTable[j]) != null) {
+-                            nextTableIndex = j - 1;
+-                            return;
+-                        }
+-                    }
++            for (;;) {
++                if (nextTableIndex >= 0) {
++                    if ((nextEntry = entryAt(currentTable,
++                                             nextTableIndex--)) != null)
++                        break;
+                 }
++                else if (nextSegmentIndex >= 0) {
++                    Segment<K,V> seg = segmentAt(segments, nextSegmentIndex--);
++                    if (seg != null && (currentTable = seg.table) != null)
++                        nextTableIndex = currentTable.length - 1;
++                }
++                else
++                    break;
+             }
+         }
+ 
+-        public boolean hasNext() { return nextEntry != null; }
+-
+-        HashEntry<K,V> nextEntry() {
+-            if (nextEntry == null)
++        final HashEntry<K,V> nextEntry() {
++            HashEntry<K,V> e = nextEntry;
++            if (e == null)
+                 throw new NoSuchElementException();
+-            lastReturned = nextEntry;
+-            advance();
+-            return lastReturned;
++            lastReturned = e; // cannot assign until after null check
++            if ((nextEntry = e.next) == null)
++                advance();
++            return e;
+         }
+ 
+-        public void remove() {
++        public final boolean hasNext() { return nextEntry != null; }
++        public final boolean hasMoreElements() { return nextEntry != null; }
++
++        public final void remove() {
+             if (lastReturned == null)
+                 throw new IllegalStateException();
+             ConcurrentHashMap.this.remove(lastReturned.key);
+@@ -1142,16 +1284,16 @@
+         extends HashIterator
+         implements Iterator<K>, Enumeration<K>
+     {
+-        public K next()        { return super.nextEntry().key; }
+-        public K nextElement() { return super.nextEntry().key; }
++        public final K next()        { return super.nextEntry().key; }
++        public final K nextElement() { return super.nextEntry().key; }
+     }
+ 
+     final class ValueIterator
+         extends HashIterator
+         implements Iterator<V>, Enumeration<V>
+     {
+-        public V next()        { return super.nextEntry().value; }
+-        public V nextElement() { return super.nextEntry().value; }
++        public final V next()        { return super.nextEntry().value; }
++        public final V nextElement() { return super.nextEntry().value; }
+     }
+ 
+     /**
+@@ -1271,15 +1413,20 @@
+      * The key-value mappings are emitted in no particular order.
+      */
+     private void writeObject(java.io.ObjectOutputStream s) throws IOException  {
++        // force all segments for serialization compatibility
++        for (int k = 0; k < segments.length; ++k)
++            ensureSegment(k);
+         s.defaultWriteObject();
+ 
++        final Segment<K,V>[] segments = this.segments;
+         for (int k = 0; k < segments.length; ++k) {
+-            Segment<K,V> seg = segments[k];
++            Segment<K,V> seg = segmentAt(segments, k);
+             seg.lock();
+             try {
+                 HashEntry<K,V>[] tab = seg.table;
+                 for (int i = 0; i < tab.length; ++i) {
+-                    for (HashEntry<K,V> e = tab[i]; e != null; e = e.next) {
++                    HashEntry<K,V> e;
++                    for (e = entryAt(tab, i); e != null; e = e.next) {
+                         s.writeObject(e.key);
+                         s.writeObject(e.value);
+                     }
+@@ -1297,13 +1444,20 @@
+      * stream (i.e., deserialize it).
+      * @param s the stream
+      */
++    @SuppressWarnings("unchecked")
+     private void readObject(java.io.ObjectInputStream s)
+         throws IOException, ClassNotFoundException  {
+         s.defaultReadObject();
+ 
+-        // Initialize each segment to be minimally sized, and let grow.
+-        for (int i = 0; i < segments.length; ++i) {
+-            segments[i].setTable(new HashEntry[1]);
++        // Re-initialize segments to be minimally sized, and let grow.
++        int cap = MIN_SEGMENT_TABLE_CAPACITY;
++        final Segment<K,V>[] segments = this.segments;
++        for (int k = 0; k < segments.length; ++k) {
++            Segment<K,V> seg = segments[k];
++            if (seg != null) {
++                seg.threshold = (int)(cap * seg.loadFactor);
++                seg.table = (HashEntry<K,V>[]) new HashEntry[cap];
++            }
+         }
+ 
+         // Read the keys and values, and put the mappings in the table
+@@ -1315,4 +1469,31 @@
+             put(key, value);
+         }
+     }
++
++    // Unsafe mechanics
++    private static final sun.misc.Unsafe UNSAFE;
++    private static final long SBASE;
++    private static final int SSHIFT;
++    private static final long TBASE;
++    private static final int TSHIFT;
++
++    static {
++        int ss, ts;
++        try {
++            UNSAFE = sun.misc.Unsafe.getUnsafe();
++            Class tc = HashEntry[].class;
++            Class sc = Segment[].class;
++            TBASE = UNSAFE.arrayBaseOffset(tc);
++            SBASE = UNSAFE.arrayBaseOffset(sc);
++            ts = UNSAFE.arrayIndexScale(tc);
++            ss = UNSAFE.arrayIndexScale(sc);
++        } catch (Exception e) {
++            throw new Error(e);
++        }
++        if ((ss & (ss-1)) != 0 || (ts & (ts-1)) != 0)
++            throw new Error("data type scale not a power of two");
++        SSHIFT = 31 - Integer.numberOfLeadingZeros(ss);
++        TSHIFT = 31 - Integer.numberOfLeadingZeros(ts);
++    }
++
+ }

Added: trunk/java/openjdk6/files/icedtea/openjdk/7064279-fixup.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/openjdk/7064279-fixup.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/openjdk/7064279-fixup.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,71 @@
+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;
+-    }
+ }

Added: trunk/java/openjdk6/files/icedtea/openjdk/7064279-resource_release.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/openjdk/7064279-resource_release.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/openjdk/7064279-resource_release.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,436 @@
+# 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");

Added: trunk/java/openjdk6/files/icedtea/openjdk/7133220-factory_finder_parser_transform_useBSClassLoader.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/openjdk/7133220-factory_finder_parser_transform_useBSClassLoader.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/openjdk/7133220-factory_finder_parser_transform_useBSClassLoader.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,299 @@
+--- /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 at sun.com
+++ * @author Huizhe.Wang at 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 at sun.com
+++ * @author Huizhe.Wang at 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

Added: trunk/java/openjdk6/files/icedtea/openjdk/7195301-no_instanceof_node.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/openjdk/7195301-no_instanceof_node.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/openjdk/7195301-no_instanceof_node.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,86 @@
+# 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
+ 

Added: trunk/java/openjdk6/files/icedtea/openjdk/7197906-handle_32_bit_shifts.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/openjdk/7197906-handle_32_bit_shifts.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/openjdk/7197906-handle_32_bit_shifts.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,33 @@
+--- 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

Added: trunk/java/openjdk6/files/icedtea/openjdk/8004302-soap_test_failure.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/openjdk/8004302-soap_test_failure.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/openjdk/8004302-soap_test_failure.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,75 @@
+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.

Added: trunk/java/openjdk6/files/icedtea/openjdk/8004341-jck_dialog_failure-02.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/openjdk/8004341-jck_dialog_failure-02.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/openjdk/8004341-jck_dialog_failure-02.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,18 @@
+# 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();
+ 

Added: trunk/java/openjdk6/files/icedtea/openjdk/8004341-jck_dialog_failure.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/openjdk/8004341-jck_dialog_failure.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/openjdk/8004341-jck_dialog_failure.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,19 @@
+# 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);

Added: trunk/java/openjdk6/files/icedtea/openjdk/8005615-failure_to_load_logger_implementation.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/openjdk/8005615-failure_to_load_logger_implementation.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/openjdk/8005615-failure_to_load_logger_implementation.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,542 @@
+# 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());
+                 }

Added: trunk/java/openjdk6/files/icedtea/openjdk/8007393.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/openjdk/8007393.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/openjdk/8007393.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,78 @@
+
+# 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;
+         }
+     }
+ 
+

Added: trunk/java/openjdk6/files/icedtea/openjdk/8007611.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/openjdk/8007611.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/openjdk/8007611.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,24 @@
+
+# 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);
+                 }
+

Added: trunk/java/openjdk6/files/icedtea/security/20120830/7182135-impossible_to_use_some_editors_directly.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20120830/7182135-impossible_to_use_some_editors_directly.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20120830/7182135-impossible_to_use_some_editors_directly.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,519 @@
+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 {
++}

Added: trunk/java/openjdk6/files/icedtea/security/20130201/6563318.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130201/6563318.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130201/6563318.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,36 @@
+# 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);

Added: trunk/java/openjdk6/files/icedtea/security/20130201/6664509.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130201/6664509.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130201/6664509.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,1322 @@
+# HG changeset patch
+# User coffeys
+# Date 1355432912 0
+# Node ID eed3ef0116a18e006c4e062b3c8d6d5a5e503a43
+# Parent  bedb05bba7fc681e34f9c3ce03dc2daa4ec2ce28
+6664509: Add logging context
+6664528: Find log level matching its name or value given at construction time
+Reviewed-by: mchung
+
+diff --git a/src/share/classes/java/util/logging/Level.java b/src/share/classes/java/util/logging/Level.java
+--- jdk/src/share/classes/java/util/logging/Level.java
++++ jdk/src/share/classes/java/util/logging/Level.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2000, 2004, 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
+@@ -24,6 +24,10 @@
+  */
+ 
+ package java.util.logging;
++import java.util.ArrayList;
++import java.util.HashMap;
++import java.util.List;
++import java.util.Map;
+ import java.util.ResourceBundle;
+ 
+ /**
+@@ -59,7 +63,6 @@ import java.util.ResourceBundle;
+  */
+ 
+ public class Level implements java.io.Serializable {
+-    private static java.util.ArrayList<Level> known = new java.util.ArrayList<Level>();
+     private static String defaultBundle = "sun.util.logging.resources.logging";
+ 
+     /**
+@@ -76,6 +79,9 @@ public class Level implements java.io.Se
+      * @serial The resource bundle name to be used in localizing the level name.
+      */
+     private final String resourceBundleName;
++
++    // localized level name
++    private String localizedLevelName;
+ 
+     /**
+      * OFF is a special level that can be used to turn off logging.
+@@ -202,9 +208,8 @@ public class Level implements java.io.Se
+         this.name = name;
+         this.value = value;
+         this.resourceBundleName = resourceBundleName;
+-        synchronized (Level.class) {
+-            known.add(this);
+-        }
++        this.localizedLevelName = resourceBundleName == null ? name : null;
++        KnownLevel.add(this);
+     }
+ 
+     /**
+@@ -236,12 +241,76 @@ public class Level implements java.io.Se
+      * @return localized name
+      */
+     public String getLocalizedName() {
++        return getLocalizedLevelName();
++    }
++
++    // package-private getLevelName() is used by the implementation
++    // instead of getName() to avoid calling the subclass's version
++    final String getLevelName() {
++        return this.name;
++    }
++
++    final synchronized String getLocalizedLevelName() {
++        if (localizedLevelName != null) {
++            return localizedLevelName;
++        }
++
+         try {
+             ResourceBundle rb = ResourceBundle.getBundle(resourceBundleName);
+-            return rb.getString(name);
++            localizedLevelName = rb.getString(name);
+         } catch (Exception ex) {
+-            return name;
++            localizedLevelName = name;
+         }
++        return localizedLevelName;
++    }
++
++    // Returns a mirrored Level object that matches the given name as
++    // specified in the Level.parse method.  Returns null if not found.
++    //
++    // It returns the same Level object as the one returned by Level.parse
++    // method if the given name is a non-localized name or integer.
++    //
++    // If the name is a localized name, findLevel and parse method may
++    // return a different level value if there is a custom Level subclass
++    // that overrides Level.getLocalizedName() to return a different string
++    // than what's returned by the default implementation.
++    //
++    static Level findLevel(String name) {
++        if (name == null) {
++            throw new NullPointerException();
++        }
++
++        KnownLevel level;
++
++        // Look for a known Level with the given non-localized name.
++        level = KnownLevel.findByName(name);
++        if (level != null) {
++            return level.mirroredLevel;
++        }
++
++        // Now, check if the given name is an integer.  If so,
++        // first look for a Level with the given value and then
++        // if necessary create one.
++        try {
++            int x = Integer.parseInt(name);
++            level = KnownLevel.findByValue(x);
++            if (level == null) {
++                // add new Level
++                Level levelObject = new Level(name, x);
++                level = KnownLevel.findByValue(x);
++            }
++            return level.mirroredLevel;
++        } catch (NumberFormatException ex) {
++            // Not an integer.
++            // Drop through.
++        }
++
++        level = KnownLevel.findByLocalizedLevelName(name);
++        if (level != null) {
++            return level.mirroredLevel;
++        }
++
++        return null;
+     }
+ 
+     /**
+@@ -266,21 +335,15 @@ public class Level implements java.io.Se
+     // Serialization magic to prevent "doppelgangers".
+     // This is a performance optimization.
+     private Object readResolve() {
+-        synchronized (Level.class) {
+-            for (int i = 0; i < known.size(); i++) {
+-                Level other = known.get(i);
+-                if (this.name.equals(other.name) && this.value == other.value
+-                        && (this.resourceBundleName == other.resourceBundleName ||
+-                            (this.resourceBundleName != null &&
+-                            this.resourceBundleName.equals(other.resourceBundleName)))) {
+-                    return other;
+-                }
+-            }
+-            // Woops.  Whoever sent us this object knows
+-            // about a new log level.  Add it to our list.
+-            known.add(this);
+-            return this;
++        KnownLevel o = KnownLevel.matches(this);
++        if (o != null) {
++            return o.levelObject;
+         }
++
++        // Woops.  Whoever sent us this object knows
++        // about a new log level.  Add it to our list.
++        Level level = new Level(this.name, this.value, this.resourceBundleName);
++        return level;
+     }
+ 
+     /**
+@@ -294,6 +357,7 @@ public class Level implements java.io.Se
+      * <li>     "SEVERE"
+      * <li>     "1000"
+      * </ul>
++     *
+      * @param  name   string to be parsed
+      * @throws NullPointerException if the name is null
+      * @throws IllegalArgumentException if the value is not valid.
+@@ -313,12 +377,12 @@ public class Level implements java.io.Se
+         // Check that name is not null.
+         name.length();
+ 
++        KnownLevel level;
++
+         // Look for a known Level with the given non-localized name.
+-        for (int i = 0; i < known.size(); i++) {
+-            Level l = known.get(i);
+-            if (name.equals(l.name)) {
+-                return l;
+-            }
++        level = KnownLevel.findByName(name);
++        if (level != null) {
++            return level.levelObject;
+         }
+ 
+         // Now, check if the given name is an integer.  If so,
+@@ -326,27 +390,23 @@ public class Level implements java.io.Se
+         // if necessary create one.
+         try {
+             int x = Integer.parseInt(name);
+-            for (int i = 0; i < known.size(); i++) {
+-                Level l = known.get(i);
+-                if (l.value == x) {
+-                    return l;
+-                }
++            level = KnownLevel.findByValue(x);
++            if (level == null) {
++                // add new Level
++                Level levelObject = new Level(name, x);
++                level = KnownLevel.findByValue(x);
+             }
+-            // Create a new Level.
+-            return new Level(name, x);
++            return level.levelObject;
+         } catch (NumberFormatException ex) {
+             // Not an integer.
+             // Drop through.
+         }
+-
+-        // Finally, look for a known level with the given localized name,
++         // Finally, look for a known level with the given localized name,
+         // in the current default locale.
+         // This is relatively expensive, but not excessively so.
+-        for (int i = 0; i < known.size(); i++) {
+-            Level l =  known.get(i);
+-            if (name.equals(l.getLocalizedName())) {
+-                return l;
+-            }
++        level = KnownLevel.findByLocalizedName(name);
++        if (level != null) {
++            return level.levelObject;
+         }
+ 
+         // OK, we've tried everything and failed
+@@ -373,4 +433,125 @@ public class Level implements java.io.Se
+     public int hashCode() {
+         return this.value;
+     }
++
++    // KnownLevel class maintains the global list of all known levels.
++    // The API allows multiple custom Level instances of the same name/value
++    // be created. This class provides convenient methods to find a level
++    // by a given name, by a given value, or by a given localized name.
++    //
++    // KnownLevel wraps the following Level objects:
++    // 1. levelObject:   standard Level object or custom Level object
++    // 2. mirroredLevel: Level object representing the level specified in the
++    //                   logging configuration.
++    //
++    // Level.getName, Level.getLocalizedName, Level.getResourceBundleName methods
++    // are non-final but the name and resource bundle name are parameters to
++    // the Level constructor.  Use the mirroredLevel object instead of the
++    // levelObject to prevent the logging framework to execute foreign code
++    // implemented by untrusted Level subclass.
++    //
++    // Implementation Notes:
++    // If Level.getName, Level.getLocalizedName, Level.getResourceBundleName methods
++    // were final, the following KnownLevel implementation can be removed.
++    // Future API change should take this into consideration.
++    static final class KnownLevel {
++        private static Map<String, List<KnownLevel>> nameToLevels =
++                                    new HashMap<String, List<KnownLevel>>();
++        private static Map<Integer, List<KnownLevel>> intToLevels =
++                                    new HashMap<Integer, List<KnownLevel>>();
++        final Level levelObject;     // instance of Level class or Level subclass
++        final Level mirroredLevel;   // instance of Level class
++        KnownLevel(Level l) {
++            this.levelObject = l;
++            if (l.getClass() == Level.class) {
++                this.mirroredLevel = l;
++            } else {
++                this.mirroredLevel = new Level(l.name, l.value, l.resourceBundleName);
++            }
++        }
++
++        static synchronized void add(Level l) {
++            // the mirroredLevel object is always added to the list
++            // before the custom Level instance
++            KnownLevel o = new KnownLevel(l);
++            List<KnownLevel> list = nameToLevels.get(l.name);
++            if (list == null) {
++                list = new ArrayList<KnownLevel>();
++                nameToLevels.put(l.name, list);
++            }
++            list.add(o);
++
++            list = intToLevels.get(l.value);
++            if (list == null) {
++                list = new ArrayList<KnownLevel>();
++                intToLevels.put(l.value, list);
++            }
++            list.add(o);
++        }
++
++        // Returns a KnownLevel with the given non-localized name.
++        static synchronized KnownLevel findByName(String name) {
++            List<KnownLevel> list = nameToLevels.get(name);
++            if (list != null) {
++                return list.get(0);
++            }
++            return null;
++        }
++
++        // Returns a KnownLevel with the given value.
++        static synchronized KnownLevel findByValue(int value) {
++            List<KnownLevel> list = intToLevels.get(value);
++            if (list != null) {
++                return list.get(0);
++            }
++            return null;
++        }
++
++        // Returns a KnownLevel with the given localized name matching
++        // by calling the Level.getLocalizedLevelName() method (i.e. found
++        // from the resourceBundle associated with the Level object).
++        // This method does not call Level.getLocalizedName() that may
++        // be overridden in a subclass implementation
++        static synchronized KnownLevel findByLocalizedLevelName(String name) {
++            for (List<KnownLevel> levels : nameToLevels.values()) {
++                for (KnownLevel l : levels) {
++                    String lname = l.levelObject.getLocalizedLevelName();
++                    if (name.equals(lname)) {
++                        return l;
++                    }
++                }
++            }
++            return null;
++        }
++
++        // Returns a KnownLevel with the given localized name matching
++        // by calling the Level.getLocalizedName() method
++        static synchronized KnownLevel findByLocalizedName(String name) {
++            for (List<KnownLevel> levels : nameToLevels.values()) {
++                for (KnownLevel l : levels) {
++                    String lname = l.levelObject.getLocalizedName();
++                    if (name.equals(lname)) {
++                        return l;
++                    }
++                }
++            }
++            return null;
++        }
++
++        static synchronized KnownLevel matches(Level l) {
++            List<KnownLevel> list = nameToLevels.get(l.name);
++            if (list != null) {
++                for (KnownLevel level : list) {
++                    Level other = level.mirroredLevel;
++                    if (l.value == other.value &&
++                           (l.resourceBundleName == other.resourceBundleName ||
++                               (l.resourceBundleName != null &&
++                                l.resourceBundleName.equals(other.resourceBundleName)))) {
++                        return level;
++                    }
++                }
++            }
++            return null;
++        }
++    }
+ }
+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
+@@ -34,6 +34,8 @@ import java.beans.PropertyChangeListener
+ import java.beans.PropertyChangeListener;
+ import java.beans.PropertyChangeSupport;
+ import java.net.URL;
++import sun.misc.JavaAWTAccess;
++import sun.misc.SharedSecrets;
+ import sun.security.action.GetPropertyAction;
+ 
+ /**
+@@ -155,11 +157,9 @@ public class LogManager {
+                          = new PropertyChangeSupport(LogManager.class);
+     private final static Level defaultLevel = Level.INFO;
+ 
+-    // Table of named Loggers that maps names to Loggers.
+-    private Hashtable<String,LoggerWeakRef> namedLoggers =
+-        new Hashtable<String,LoggerWeakRef>();
+-    // Tree of named Loggers
+-    private LogNode root = new LogNode(null);
++    // LoggerContext for system loggers and user loggers
++    private final LoggerContext systemContext = new SystemLoggerContext();
++    private final LoggerContext userContext = new UserLoggerContext();
+     private Logger rootLogger;
+ 
+     // Have we done the primordial reading of the configuration file?
+@@ -197,12 +197,13 @@ public class LogManager {
+ 
+                     // Create and retain Logger for the root of the namespace.
+                     manager.rootLogger = manager.new RootLogger();
+-                    manager.addLogger(manager.rootLogger);
++                    manager.systemContext.addLogger(manager.rootLogger);
++                    manager.userContext.addLogger(manager.rootLogger);
+ 
+                     // Adding the global Logger. Doing so in the Logger.<clinit>
+                     // would deadlock with the LogManager.<clinit>.
+                     Logger.global.setLogManager(manager);
+-                    manager.addLogger(Logger.global);
++                    manager.systemContext.addLogger(Logger.global);
+ 
+                     // We don't call readConfiguration() here, as we may be running
+                     // very early in the JVM startup sequence.  Instead readConfiguration
+@@ -273,8 +274,8 @@ public class LogManager {
+                     }
+                     readPrimordialConfiguration = true;
+                     try {
+-                        AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
+-                                public Object run() throws Exception {
++                        AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() {
++                                public Void run() throws Exception {
+                                     readConfiguration();
+                                     return null;
+                                 }
+@@ -326,6 +327,296 @@ public class LogManager {
+         changes.removePropertyChangeListener(l);
+     }
+ 
++    // Returns the LoggerContext for the user code (i.e. application or AppContext).
++    // Loggers are isolated from each AppContext.
++    LoggerContext getUserContext() {
++        LoggerContext context = null;
++
++        SecurityManager sm = System.getSecurityManager();
++        JavaAWTAccess javaAwtAccess = SharedSecrets.getJavaAWTAccess();
++        if (sm != null && javaAwtAccess != null) {
++            synchronized (javaAwtAccess) {
++                // AppContext.getAppContext() returns the system AppContext if called
++                // from a system thread but Logger.getLogger might be called from
++                // an applet code. Instead, find the AppContext of the applet code
++                // from the execution stack.
++                Object ecx = javaAwtAccess.getExecutionContext();
++                if (ecx == null) {
++                    // fall back to AppContext.getAppContext()
++                    ecx = javaAwtAccess.getContext();
++                }
++                context = (LoggerContext) javaAwtAccess.get(ecx, LoggerContext.class);
++                if (context == null) {
++                    if (javaAwtAccess.isMainAppContext()) {
++                        context = userContext;
++                    } else {
++                        context = new UserLoggerContext();
++                        context.addLogger(manager.rootLogger);
++                    }
++                    javaAwtAccess.put(ecx, LoggerContext.class, context);
++                }
++            }
++        } else {
++            context = userContext;
++        }
++        return context;
++    }
++
++    LoggerContext getSystemContext() {
++        return systemContext;
++    }
++
++    private List<LoggerContext> contexts() {
++        List<LoggerContext> cxs = new ArrayList<LoggerContext>();
++        cxs.add(systemContext);
++        cxs.add(getUserContext());
++        return cxs;
++    }
++
++    static class LoggerContext {
++        // Table of named Loggers that maps names to Loggers.
++
++        private final Hashtable<String, LoggerWeakRef> namedLoggers =
++                new Hashtable<String, LoggerWeakRef>();
++        // Tree of named Loggers
++        private final LogNode root;
++
++        private LoggerContext() {
++            this.root = new LogNode(null, this);
++        }
++
++        synchronized Logger findLogger(String name) {
++            LoggerWeakRef ref = namedLoggers.get(name);
++            if (ref == null) {
++                return null;
++            }
++            Logger logger = ref.get();
++            if (logger == null) {
++                // Hashtable holds stale weak reference
++                // to a logger which has been GC-ed.
++                removeLogger(name);
++            }
++            return logger;
++        }
++
++        synchronized boolean addLogger(Logger logger) {
++            final String name = logger.getName();
++            if (name == null) {
++                throw new NullPointerException();
++            }
++
++            // cleanup some Loggers that have been GC'ed
++            manager.drainLoggerRefQueueBounded();
++
++            LoggerWeakRef ref = namedLoggers.get(name);
++            if (ref != null) {
++                if (ref.get() == null) {
++                    // It's possible that the Logger was GC'ed after the
++                    // drainLoggerRefQueueBounded() call above so allow
++                    // a new one to be registered.
++                    removeLogger(name);
++                } else {
++                    // We already have a registered logger with the given name.
++                    return false;
++                }
++            }
++
++            // We're adding a new logger.
++            // Note that we are creating a weak reference here.
++            ref = manager.new LoggerWeakRef(logger);
++            namedLoggers.put(name, ref);
++
++            // Apply any initial level defined for the new logger.
++            Level level = manager.getLevelProperty(name + ".level", null);
++            if (level != null) {
++                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.
++            LogNode node = getNode(name);
++            node.loggerRef = ref;
++            Logger parent = null;
++            LogNode nodep = node.parent;
++            while (nodep != null) {
++                LoggerWeakRef nodeRef = nodep.loggerRef;
++                if (nodeRef != null) {
++                    parent = nodeRef.get();
++                    if (parent != null) {
++                        break;
++                    }
++                }
++                nodep = nodep.parent;
++            }
++
++            if (parent != null) {
++                doSetParent(logger, parent);
++            }
++            // Walk over the children and tell them we are their new parent.
++            node.walkAndSetParent(logger);
++            // new LogNode is ready so tell the LoggerWeakRef about it
++            ref.setNode(node);
++            return true;
++        }
++
++        void removeLogger(String name) {
++            namedLoggers.remove(name);
++        }
++
++        synchronized Enumeration<String> getLoggerNames() {
++            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) {
++            int ix = 1;
++            for (;;) {
++                int ix2 = name.indexOf(".", ix);
++                if (ix2 < 0) {
++                    break;
++                }
++                String pname = name.substring(0, ix2);
++
++                if (manager.getProperty(pname + ".level") != null
++                        || manager.getProperty(pname + ".handlers") != null) {
++                    // This pname has a level/handlers definition.
++                    // Make sure it exists.
++                    demandLogger(pname);
++                }
++                ix = ix2 + 1;
++            }
++        }
++
++        // Gets a node in our tree of logger nodes.
++        // If necessary, create it.
++        LogNode getNode(String name) {
++            if (name == null || name.equals("")) {
++                return root;
++            }
++            LogNode node = root;
++            while (name.length() > 0) {
++                int ix = name.indexOf(".");
++                String head;
++                if (ix > 0) {
++                    head = name.substring(0, ix);
++                    name = name.substring(ix + 1);
++                } else {
++                    head = name;
++                    name = "";
++                }
++                if (node.children == null) {
++                    node.children = new HashMap<String, LogNode>();
++                }
++                LogNode child = node.children.get(head);
++                if (child == null) {
++                    child = new LogNode(node, this);
++                    node.children.put(head, child);
++                }
++                node = child;
++            }
++            return node;
++        }
++    }
++
++    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.
++         */
++        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);
++                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;
++        }
++    }
++
+     // Package-level method.
+     // Find or create a specified logger instance. If a logger has
+     // already been created with the given name it is returned.
+@@ -339,27 +630,6 @@ public class LogManager {
+             result = getLogger(name);
+         }
+         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) {
+-        int ix = 1;
+-        for (;;) {
+-            int ix2 = name.indexOf(".", ix);
+-            if (ix2 < 0) {
+-                break;
+-            }
+-            String pname = name.substring(0,ix2);
+-
+-            if (getProperty(pname+".level")    != null ||
+-                getProperty(pname+".handlers") != null) {
+-                // This pname has a level/handlers definition.
+-                // Make sure it exists.
+-                demandLogger(pname);
+-            }
+-            ix = ix2+1;
+-        }
+     }
+ 
+     // Add new per logger handlers.
+@@ -383,16 +653,17 @@ public class LogManager {
+                     try {
+                         Class   clz = ClassLoader.getSystemClassLoader().loadClass(word);
+                         Handler hdl = (Handler) clz.newInstance();
+-                        try {
+-                            // Check if there is a property defining the
+-                            // this handler's level.
+-                            String levs = getProperty(word + ".level");
+-                            if (levs != null) {
+-                                hdl.setLevel(Level.parse(levs));
++                        // Check if there is a property defining the
++                        // this handler's level.
++                        String levs = getProperty(word + ".level");
++                        if (levs != null) {
++                            Level l = Level.findLevel(levs);
++                            if (l != null) {
++                                hdl.setLevel(l);
++                            } else {
++                                // Probably a bad level. Drop through.
++                                System.err.println("Can't set level for " + word);
+                             }
+-                        } catch (Exception ex) {
+-                            System.err.println("Can't set level for " + word);
+-                            // Probably a bad level. Drop through.
+                         }
+                         // Add this Handler to the logger
+                         logger.addHandler(hdl);
+@@ -448,7 +719,7 @@ public class LogManager {
+             if (node != null) {
+                 // if we have a LogNode, then we were a named Logger
+                 // so clear namedLoggers weak ref to us
+-                manager.namedLoggers.remove(name);
++                node.context.removeLogger(name);
+                 name = null;  // clear our ref to the Logger's name
+ 
+                 node.loggerRef = null;  // clear LogNode's weak ref to us
+@@ -544,67 +815,11 @@ public class LogManager {
+         if (name == null) {
+             throw new NullPointerException();
+         }
+-
+-        // cleanup some Loggers that have been GC'ed
+-        drainLoggerRefQueueBounded();
+-
+-        LoggerWeakRef ref = namedLoggers.get(name);
+-        if (ref != null) {
+-            if (ref.get() == null) {
+-                // It's possible that the Logger was GC'ed after the
+-                // drainLoggerRefQueueBounded() call above so allow
+-                // a new one to be registered.
+-                namedLoggers.remove(name);
+-            } else {
+-                // We already have a registered logger with the given name.
+-                return false;
+-            }
++        if (systemContext.findLogger(name) != null) {
++            return false;
+         }
+-
+-        // We're adding a new logger.
+-        // Note that we are creating a weak reference here.
+-        ref = new LoggerWeakRef(logger);
+-        namedLoggers.put(name, ref);
+-
+-        // Apply any initial level defined for the new logger.
+-        Level level = getLevelProperty(name+".level", null);
+-        if (level != null) {
+-            doSetLevel(logger, level);
+-        }
+-
+-        // Do we have a per logger handler too?
+-        // Note: this will add a 200ms penalty
+-        loadLoggerHandlers(logger, name, name+".handlers");
+-        processParentHandlers(logger, name);
+-
+-        // Find the new node and its parent.
+-        LogNode node = findNode(name);
+-        node.loggerRef = ref;
+-        Logger parent = null;
+-        LogNode nodep = node.parent;
+-        while (nodep != null) {
+-            LoggerWeakRef nodeRef = nodep.loggerRef;
+-            if (nodeRef != null) {
+-                parent = nodeRef.get();
+-                if (parent != null) {
+-                    break;
+-                }
+-            }
+-            nodep = nodep.parent;
+-        }
+-
+-        if (parent != null) {
+-            doSetParent(logger, parent);
+-        }
+-        // Walk over the children and tell them we are their new parent.
+-        node.walkAndSetParent(logger);
+-
+-        // new LogNode is ready so tell the LoggerWeakRef about it
+-        ref.setNode(node);
+-
+-        return true;
++        return getUserContext().addLogger(logger);
+     }
+-
+ 
+     // Private method to set a level on a logger.
+     // If necessary, we raise privilege before doing the call.
+@@ -644,36 +859,6 @@ public class LogManager {
+             }});
+     }
+ 
+-    // Find a node in our tree of logger nodes.
+-    // If necessary, create it.
+-    private LogNode findNode(String name) {
+-        if (name == null || name.equals("")) {
+-            return root;
+-        }
+-        LogNode node = root;
+-        while (name.length() > 0) {
+-            int ix = name.indexOf(".");
+-            String head;
+-            if (ix > 0) {
+-                head = name.substring(0,ix);
+-                name = name.substring(ix+1);
+-            } else {
+-                head = name;
+-                name = "";
+-            }
+-            if (node.children == null) {
+-                node.children = new HashMap<String,LogNode>();
+-            }
+-            LogNode child = node.children.get(head);
+-            if (child == null) {
+-                child = new LogNode(node);
+-                node.children.put(head, child);
+-            }
+-            node = child;
+-        }
+-        return node;
+-    }
+-
+     /**
+      * Method to find a named logger.
+      * <p>
+@@ -689,18 +874,16 @@ public class LogManager {
+      * @param name name of the logger
+      * @return  matching logger or null if none is found
+      */
+-    public synchronized Logger getLogger(String name) {
+-        LoggerWeakRef ref = namedLoggers.get(name);
+-        if (ref == null) {
+-            return null;
+-        }
+-        Logger logger = ref.get();
+-        if (logger == null) {
+-            // Hashtable holds stale weak reference
+-            // to a logger which has been GC-ed.
+-            namedLoggers.remove(name);
+-        }
+-        return logger;
++    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);
+     }
+ 
+     /**
+@@ -719,8 +902,12 @@ public class LogManager {
+      * <p>
+      * @return  enumeration of logger name strings
+      */
+-    public synchronized Enumeration<String> getLoggerNames() {
+-        return namedLoggers.keys();
++    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);
+     }
+ 
+     /**
+@@ -805,20 +992,20 @@ public class LogManager {
+             // the global handlers, if they haven't been initialized yet.
+             initializedGlobalHandlers = true;
+         }
+-        Enumeration enum_ = getLoggerNames();
+-        while (enum_.hasMoreElements()) {
+-            String name = (String)enum_.nextElement();
+-            resetLogger(name);
++        for (LoggerContext cx : contexts()) {
++            Enumeration<String> enum_ = cx.getLoggerNames();
++            while (enum_.hasMoreElements()) {
++                String name = enum_.nextElement();
++                Logger logger = cx.findLogger(name);
++                if (logger != null) {
++                    resetLogger(logger);
++                }
++            }
+         }
+     }
+ 
+-
+     // Private method to reset an individual target logger.
+-    private void resetLogger(String name) {
+-        Logger logger = getLogger(name);
+-        if (logger == null) {
+-            return;
+-        }
++    private void resetLogger(Logger logger) {
+         // Close all the Logger's handlers.
+         Handler[] targets = logger.getHandlers();
+         for (int i = 0; i < targets.length; i++) {
+@@ -830,6 +1017,7 @@ public class LogManager {
+                 // Problems closing a handler?  Keep going...
+             }
+         }
++        String name = logger.getName();
+         if (name != null && name.equals("")) {
+             // This is the root logger.
+             logger.setLevel(defaultLevel);
+@@ -977,11 +1165,8 @@ public class LogManager {
+         if (val == null) {
+             return defaultValue;
+         }
+-        try {
+-            return Level.parse(val.trim());
+-        } catch (Exception ex) {
+-            return defaultValue;
+-        }
++        Level l = Level.findLevel(val.trim());
++        return l != null ? l : defaultValue;
+     }
+ 
+     // Package private method to get a filter property.
+@@ -1072,9 +1257,11 @@ public class LogManager {
+         HashMap<String,LogNode> children;
+         LoggerWeakRef loggerRef;
+         LogNode parent;
++        final LoggerContext context;
+ 
+-        LogNode(LogNode parent) {
++        LogNode(LogNode parent, LoggerContext context) {
+             this.parent = parent;
++            this.context = context;
+         }
+ 
+         // Recursive method to walk the tree below a node and set
+@@ -1133,7 +1320,7 @@ public class LogManager {
+     // Private method to be called when the configuration has
+     // changed to apply any level settings to any pre-existing loggers.
+     synchronized private void setLevelsOnExistingLoggers() {
+-        Enumeration enum_ = props.propertyNames();
++        Enumeration<?> enum_ = props.propertyNames();
+         while (enum_.hasMoreElements()) {
+             String key = (String)enum_.nextElement();
+             if (!key.endsWith(".level")) {
+@@ -1147,11 +1334,13 @@ public class LogManager {
+                 System.err.println("Bad level value for property: " + key);
+                 continue;
+             }
+-            Logger l = getLogger(name);
+-            if (l == null) {
+-                continue;
++            for (LoggerContext cx : contexts()) {
++                Logger l = cx.findLogger(name);
++                if (l == null) {
++                    continue;
++                }
++                l.setLevel(level);
+             }
+-            l.setLevel(level);
+         }
+     }
+ 
+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
+@@ -29,6 +29,7 @@ import java.util.*;
+ 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
+@@ -276,6 +277,26 @@ public class Logger {
+         }
+     }
+ 
++    // Until all JDK code converted to call sun.util.logging.PlatformLogger
++    // (see 7054233), we need to determine if Logger.getLogger is to add
++    // a system logger or user logger.
++    //
++    // 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() {
++        LogManager manager = LogManager.getLogManager();
++        SecurityManager sm = System.getSecurityManager();
++        if (sm != null) {
++            // 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.getUserContext();
++    }
++
+     /**
+      * Find or create a logger for a named subsystem.  If a logger has
+      * already been created with the given name it is returned.  Otherwise
+@@ -304,8 +325,8 @@ public class Logger {
+      * @throws NullPointerException if the name is null.
+      */
+     public static synchronized Logger getLogger(String name) {
+-        LogManager manager = LogManager.getLogManager();
+-        return manager.demandLogger(name);
++        LoggerContext context = getLoggerContext();
++        return context.demandLogger(name);
+     }
+ 
+     /**
+@@ -348,8 +369,8 @@ public class Logger {
+      * @throws NullPointerException if the name is null.
+      */
+     public static synchronized Logger getLogger(String name, String resourceBundleName) {
+-        LogManager manager = LogManager.getLogManager();
+-        Logger result = manager.demandLogger(name);
++        LoggerContext context = getLoggerContext();
++        Logger result = context.demandLogger(name, resourceBundleName);
+         if (result.resourceBundleName == null) {
+             // Note: we may get a MissingResourceException here.
+             result.setupResourceInfo(resourceBundleName);
+@@ -513,7 +534,7 @@ public class Logger {
+     private void doLog(LogRecord lr) {
+         lr.setLoggerName(name);
+         String ebname = getEffectiveResourceBundleName();
+-        if (ebname != null) {
++        if (ebname != null && !ebname.equals(SYSTEM_LOGGER_RB_NAME)) {
+             lr.setResourceBundleName(ebname);
+             lr.setResourceBundle(findResourceBundle(ebname));
+         }
+@@ -1271,6 +1292,22 @@ public class Logger {
+     // May also return null if we can't find the resource bundle and
+     // there is no suitable previous cached value.
+ 
++    static final String SYSTEM_LOGGER_RB_NAME = "sun.util.logging.resources.logging";
++
++    private static ResourceBundle findSystemResourceBundle(final Locale locale) {
++        // the resource bundle is in a restricted package
++        return AccessController.doPrivileged(new PrivilegedAction<ResourceBundle>() {
++            public ResourceBundle run() {
++                try {
++                    return ResourceBundle.getBundle(SYSTEM_LOGGER_RB_NAME,
++                                                    locale);
++                } catch (MissingResourceException e) {
++                    throw new InternalError(e.toString());
++                }
++            }
++        });
++    }
++
+     private synchronized ResourceBundle findResourceBundle(String name) {
+         // Return a null bundle for a null name.
+         if (name == null) {
+@@ -1282,6 +1319,13 @@ public class Logger {
+         // Normally we should hit on our simple one entry cache.
+         if (catalog != null && currentLocale == catalogLocale
+                                         && name == catalogName) {
++            return catalog;
++        }
++
++        if (name.equals(SYSTEM_LOGGER_RB_NAME)) {
++            catalog = findSystemResourceBundle(currentLocale);
++            catalogName = name;
++            catalogLocale = currentLocale;
+             return catalog;
+         }
+ 
+diff --git a/src/share/classes/java/util/logging/Logging.java b/src/share/classes/java/util/logging/Logging.java
+--- jdk/src/share/classes/java/util/logging/Logging.java
++++ jdk/src/share/classes/java/util/logging/Logging.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2003, 2005, 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
+@@ -34,15 +34,15 @@ import java.util.ArrayList;
+  *
+  * The <tt>LoggingMXBean</tt> interface provides a standard
+  * method for management access to the individual
+- * java.util.Logger objects available at runtime.
++ * {@code Logger} objects available at runtime.
+  *
+  * @author Ron Mann
+  * @author Mandy Chung
+  * @since 1.5
+  *
+  * @see javax.management
+- * @see java.util.Logger
+- * @see java.util.LogManager
++ * @see Logger
++ * @see LogManager
+  */
+ class Logging implements LoggingMXBean {
+ 
+@@ -75,7 +75,7 @@ class Logging implements LoggingMXBean {
+         if (level == null) {
+             return EMPTY_STRING;
+         } else {
+-            return level.getName();
++            return level.getLevelName();
+         }
+     }
+ 
+@@ -94,7 +94,10 @@ class Logging implements LoggingMXBean {
+         Level level = null;
+         if (levelName != null) {
+             // parse will throw IAE if logLevel is invalid
+-            level = Level.parse(levelName);
++            level = Level.findLevel(levelName);
++            if (level == null) {
++                throw new IllegalArgumentException("Unknown level \"" + levelName + "\"");
++            }
+         }
+ 
+         logger.setLevel(level);
+diff --git a/src/share/classes/java/util/logging/SimpleFormatter.java b/src/share/classes/java/util/logging/SimpleFormatter.java
+--- jdk/src/share/classes/java/util/logging/SimpleFormatter.java
++++ jdk/src/share/classes/java/util/logging/SimpleFormatter.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2000, 2006, 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
+@@ -83,7 +83,7 @@ public class SimpleFormatter extends For
+         }
+         sb.append(lineSeparator);
+         String message = formatMessage(record);
+-        sb.append(record.getLevel().getLocalizedName());
++        sb.append(record.getLevel().getLocalizedLevelName());
+         sb.append(": ");
+         sb.append(message);
+         sb.append(lineSeparator);
+diff --git a/src/share/classes/sun/awt/AppContext.java b/src/share/classes/sun/awt/AppContext.java
+--- jdk/src/share/classes/sun/awt/AppContext.java
++++ jdk/src/share/classes/sun/awt/AppContext.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1998, 2011, 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
+@@ -275,7 +275,7 @@ public final class AppContext {
+         if ((recent != null) && (recent.thread == currentThread))  {
+             appContext = recent.appContext; // Cache hit
+         } else {
+-          appContext = (AppContext)AccessController.doPrivileged(
++            appContext = (AppContext)AccessController.doPrivileged(
+                                             new PrivilegedAction() {
+             public Object run() {
+             // Get the current ThreadGroup, and look for it and its
+@@ -319,19 +319,25 @@ public final class AppContext {
+             // Before we return the main "system" AppContext, check to
+             // see if there's an AWTSecurityManager installed.  If so,
+             // allow it to choose the AppContext to return.
+-            SecurityManager securityManager = System.getSecurityManager();
+-            if ((securityManager != null) &&
+-                (securityManager instanceof AWTSecurityManager))  {
+-                AWTSecurityManager awtSecMgr =
+-                                      (AWTSecurityManager)securityManager;
+-                AppContext secAppContext = awtSecMgr.getAppContext();
+-                if (secAppContext != null)  {
+-                    appContext = secAppContext; // Return what we're told
+-                }
++            AppContext secAppContext = getExecutionAppContext();
++            if (secAppContext != null) {
++               appContext = secAppContext; // Return what we're told
+             }
+         }
+ 
+         return appContext;
++    }
++
++    private final static AppContext getExecutionAppContext() {
++        SecurityManager securityManager = System.getSecurityManager();
++        if ((securityManager != null) &&
++            (securityManager instanceof AWTSecurityManager))
++        {
++            AWTSecurityManager awtSecMgr = (AWTSecurityManager) securityManager;
++            AppContext secAppContext = awtSecMgr.getAppContext();
++            return secAppContext; // Return what we're told
++        }
++        return null;
+     }
+ 
+     private long DISPOSAL_TIMEOUT = 5000;  // Default to 5-second timeout
+@@ -786,6 +792,21 @@ public final class AppContext {
+             public boolean isMainAppContext() {
+                 return (numAppContexts == 1);
+             }
++            public Object getContext() {
++                return getAppContext();
++            }
++            public Object getExecutionContext() {
++                return getExecutionAppContext();
++            }
++            public Object get(Object context, Object key) {
++                return ((AppContext)context).get(key);
++            }
++            public void put(Object context, Object key, Object value) {
++                ((AppContext)context).put(key, value);
++            }
++            public void remove(Object context, Object key) {
++                ((AppContext)context).remove(key);
++            }
+         });
+     }
+ }
+diff --git a/src/share/classes/sun/misc/JavaAWTAccess.java b/src/share/classes/sun/misc/JavaAWTAccess.java
+--- jdk/src/share/classes/sun/misc/JavaAWTAccess.java
++++ jdk/src/share/classes/sun/misc/JavaAWTAccess.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2011, 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
+@@ -24,6 +24,14 @@ package sun.misc;
+ package sun.misc;
+ 
+ public interface JavaAWTAccess {
++    public Object getContext();
++    public Object getExecutionContext();
++
++    public Object get(Object context, Object key);
++    public void put(Object context, Object key, Object value);
++    public void remove(Object context, Object key);
++
++    // convenience methods whose context is the object returned by getContext()
+     public Object get(Object key);
+     public void put(Object key, Object value);
+     public void remove(Object key);
+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
+@@ -129,7 +129,10 @@ system.scope=sun.security.provider.Ident
+ # been granted.
+ package.access=sun.,\
+                com.sun.xml.internal.,\
+-               com.sun.imageio.
++               com.sun.imageio.,\
++               com.sun.istack.internal.,\
++               com.sun.jmx.defaults.,\
++               com.sun.jmx.remote.util.
+ 
+ #
+ # List of comma-separated packages that start with or equal this string
+@@ -143,7 +146,10 @@ package.access=sun.,\
+ #
+ package.definition=sun.,\
+                    com.sun.xml.internal.,\
+-                   com.sun.imageio.
++                   com.sun.imageio.,\
++                   com.sun.istack.internal.,\
++                   com.sun.jmx.defaults.,\
++                   com.sun.jmx.remote.util.
+ 
+ #
+ # Determines whether this properties file can be appended to

Added: trunk/java/openjdk6/files/icedtea/security/20130201/6776941.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130201/6776941.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130201/6776941.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,272 @@
+# 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();

Added: trunk/java/openjdk6/files/icedtea/security/20130201/7141694.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130201/7141694.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130201/7141694.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,87 @@
+# 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()

Added: trunk/java/openjdk6/files/icedtea/security/20130201/7173145.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130201/7173145.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130201/7173145.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,22 @@
+# 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);

Added: trunk/java/openjdk6/files/icedtea/security/20130201/7186945.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130201/7186945.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130201/7186945.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,10819 @@
+# HG changeset patch
+# User miroslawzn
+# Date 1354324090 28800
+# Node ID f3f9b711bb1228f4598ded7eb0380c32eba63521
+# Parent  9bbc6817b00c3e9d4eba05d53a8a20b45947ea03
+7186945: Unpack200 improvement
+7186957: Improve Pack200 data validation
+7186946: Refine unpacker resource usage
+Reviewed-by: ksrini
+
+diff --git a/src/share/classes/com/sun/java/util/jar/pack/BandStructure.java b/src/share/classes/com/sun/java/util/jar/pack/BandStructure.java
+--- jdk/src/share/classes/com/sun/java/util/jar/pack/BandStructure.java
++++ jdk/src/share/classes/com/sun/java/util/jar/pack/BandStructure.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -22,7 +22,6 @@
+  * or visit www.oracle.com if you need additional information or have any
+  * questions.
+  */
+-
+ package com.sun.java.util.jar.pack;
+ 
+ import java.io.*;
+@@ -62,20 +61,20 @@ class BandStructure implements Constants
+ 
+     /** Call this exactly once, early, to specify the archive major version. */
+     public void initPackageMajver(int packageMajver) throws IOException {
+-        assert(packageMajver > 0 && packageMajver < 0x10000);
+-        if (this.packageMajver > 0) {
+-            throw new IOException(
+-                "Package majver is already initialized to " + this.packageMajver+
+-                "; new setting is " + packageMajver);
+-        }
+-        this.packageMajver = packageMajver;
+-        adjustToMajver();
++	assert(packageMajver > 0 && packageMajver < 0x10000);
++	if (this.packageMajver > 0) {
++	    throw new IOException(
++		"Package majver is already initialized to " + this.packageMajver+
++		"; new setting is " + packageMajver);
++	}
++	this.packageMajver = packageMajver;
++	adjustToMajver();
+     }
+     public int getPackageMajver() {
+-        if (packageMajver < 0) {
+-            throw new RuntimeException("Package majver not yet initialized");
+-        }
+-        return packageMajver;
++	if (packageMajver < 0) {
++	    throw new RuntimeException("Package majver not yet initialized");
++	}
++	return packageMajver;
+     }
+ 
+     private final boolean isReader = this instanceof PackageReader;
+@@ -103,163 +102,163 @@ class BandStructure implements Constants
+     final static Coding MDELTA5 = Coding.of(5,64,2).getDeltaCoding();
+ 
+     final private static Coding[] basicCodings = {
+-        // Table of "Canonical BHSD Codings" from Pack200 spec.
+-        null,  // _meta_default
++	// Table of "Canonical BHSD Codings" from Pack200 spec.
++	null,  // _meta_default
+ 
+-        // Fixed-length codings:
+-        Coding.of(1,256,0),
+-        Coding.of(1,256,1),
+-        Coding.of(1,256,0).getDeltaCoding(),
+-        Coding.of(1,256,1).getDeltaCoding(),
+-        Coding.of(2,256,0),
+-        Coding.of(2,256,1),
+-        Coding.of(2,256,0).getDeltaCoding(),
+-        Coding.of(2,256,1).getDeltaCoding(),
+-        Coding.of(3,256,0),
+-        Coding.of(3,256,1),
+-        Coding.of(3,256,0).getDeltaCoding(),
+-        Coding.of(3,256,1).getDeltaCoding(),
+-        Coding.of(4,256,0),
+-        Coding.of(4,256,1),
+-        Coding.of(4,256,0).getDeltaCoding(),
+-        Coding.of(4,256,1).getDeltaCoding(),
++	// Fixed-length codings:
++	Coding.of(1,256,0),
++	Coding.of(1,256,1),
++	Coding.of(1,256,0).getDeltaCoding(),
++	Coding.of(1,256,1).getDeltaCoding(),
++	Coding.of(2,256,0),
++	Coding.of(2,256,1),
++	Coding.of(2,256,0).getDeltaCoding(),
++	Coding.of(2,256,1).getDeltaCoding(),
++	Coding.of(3,256,0),
++	Coding.of(3,256,1),
++	Coding.of(3,256,0).getDeltaCoding(),
++	Coding.of(3,256,1).getDeltaCoding(),
++	Coding.of(4,256,0),
++	Coding.of(4,256,1),
++	Coding.of(4,256,0).getDeltaCoding(),
++	Coding.of(4,256,1).getDeltaCoding(),
+ 
+-        // Full-range variable-length codings:
+-        Coding.of(5,  4,0),
+-        Coding.of(5,  4,1),
+-        Coding.of(5,  4,2),
+-        Coding.of(5, 16,0),
+-        Coding.of(5, 16,1),
+-        Coding.of(5, 16,2),
+-        Coding.of(5, 32,0),
+-        Coding.of(5, 32,1),
+-        Coding.of(5, 32,2),
+-        Coding.of(5, 64,0),
+-        Coding.of(5, 64,1),
+-        Coding.of(5, 64,2),
+-        Coding.of(5,128,0),
+-        Coding.of(5,128,1),
+-        Coding.of(5,128,2),
++	// Full-range variable-length codings:
++	Coding.of(5,  4,0),
++	Coding.of(5,  4,1),
++	Coding.of(5,  4,2),
++	Coding.of(5, 16,0),
++	Coding.of(5, 16,1),
++	Coding.of(5, 16,2),
++	Coding.of(5, 32,0),
++	Coding.of(5, 32,1),
++	Coding.of(5, 32,2),
++	Coding.of(5, 64,0),
++	Coding.of(5, 64,1),
++	Coding.of(5, 64,2),
++	Coding.of(5,128,0),
++	Coding.of(5,128,1),
++	Coding.of(5,128,2),
+ 
+-        Coding.of(5,  4,0).getDeltaCoding(),
+-        Coding.of(5,  4,1).getDeltaCoding(),
+-        Coding.of(5,  4,2).getDeltaCoding(),
+-        Coding.of(5, 16,0).getDeltaCoding(),
+-        Coding.of(5, 16,1).getDeltaCoding(),
+-        Coding.of(5, 16,2).getDeltaCoding(),
+-        Coding.of(5, 32,0).getDeltaCoding(),
+-        Coding.of(5, 32,1).getDeltaCoding(),
+-        Coding.of(5, 32,2).getDeltaCoding(),
+-        Coding.of(5, 64,0).getDeltaCoding(),
+-        Coding.of(5, 64,1).getDeltaCoding(),
+-        Coding.of(5, 64,2).getDeltaCoding(),
+-        Coding.of(5,128,0).getDeltaCoding(),
+-        Coding.of(5,128,1).getDeltaCoding(),
+-        Coding.of(5,128,2).getDeltaCoding(),
++	Coding.of(5,  4,0).getDeltaCoding(),
++	Coding.of(5,  4,1).getDeltaCoding(),
++	Coding.of(5,  4,2).getDeltaCoding(),
++	Coding.of(5, 16,0).getDeltaCoding(),
++	Coding.of(5, 16,1).getDeltaCoding(),
++	Coding.of(5, 16,2).getDeltaCoding(),
++	Coding.of(5, 32,0).getDeltaCoding(),
++	Coding.of(5, 32,1).getDeltaCoding(),
++	Coding.of(5, 32,2).getDeltaCoding(),
++	Coding.of(5, 64,0).getDeltaCoding(),
++	Coding.of(5, 64,1).getDeltaCoding(),
++	Coding.of(5, 64,2).getDeltaCoding(),
++	Coding.of(5,128,0).getDeltaCoding(),
++	Coding.of(5,128,1).getDeltaCoding(),
++	Coding.of(5,128,2).getDeltaCoding(),
+ 
+-        // Variable length subrange codings:
+-        Coding.of(2,192,0),
+-        Coding.of(2,224,0),
+-        Coding.of(2,240,0),
+-        Coding.of(2,248,0),
+-        Coding.of(2,252,0),
++	// Variable length subrange codings:
++	Coding.of(2,192,0),
++	Coding.of(2,224,0),
++	Coding.of(2,240,0),
++	Coding.of(2,248,0),
++	Coding.of(2,252,0),
+ 
+-        Coding.of(2,  8,0).getDeltaCoding(),
+-        Coding.of(2,  8,1).getDeltaCoding(),
+-        Coding.of(2, 16,0).getDeltaCoding(),
+-        Coding.of(2, 16,1).getDeltaCoding(),
+-        Coding.of(2, 32,0).getDeltaCoding(),
+-        Coding.of(2, 32,1).getDeltaCoding(),
+-        Coding.of(2, 64,0).getDeltaCoding(),
+-        Coding.of(2, 64,1).getDeltaCoding(),
+-        Coding.of(2,128,0).getDeltaCoding(),
+-        Coding.of(2,128,1).getDeltaCoding(),
+-        Coding.of(2,192,0).getDeltaCoding(),
+-        Coding.of(2,192,1).getDeltaCoding(),
+-        Coding.of(2,224,0).getDeltaCoding(),
+-        Coding.of(2,224,1).getDeltaCoding(),
+-        Coding.of(2,240,0).getDeltaCoding(),
+-        Coding.of(2,240,1).getDeltaCoding(),
+-        Coding.of(2,248,0).getDeltaCoding(),
+-        Coding.of(2,248,1).getDeltaCoding(),
++	Coding.of(2,  8,0).getDeltaCoding(),
++	Coding.of(2,  8,1).getDeltaCoding(),
++	Coding.of(2, 16,0).getDeltaCoding(),
++	Coding.of(2, 16,1).getDeltaCoding(),
++	Coding.of(2, 32,0).getDeltaCoding(),
++	Coding.of(2, 32,1).getDeltaCoding(),
++	Coding.of(2, 64,0).getDeltaCoding(),
++	Coding.of(2, 64,1).getDeltaCoding(),
++	Coding.of(2,128,0).getDeltaCoding(),
++	Coding.of(2,128,1).getDeltaCoding(),
++	Coding.of(2,192,0).getDeltaCoding(),
++	Coding.of(2,192,1).getDeltaCoding(),
++	Coding.of(2,224,0).getDeltaCoding(),
++	Coding.of(2,224,1).getDeltaCoding(),
++	Coding.of(2,240,0).getDeltaCoding(),
++	Coding.of(2,240,1).getDeltaCoding(),
++	Coding.of(2,248,0).getDeltaCoding(),
++	Coding.of(2,248,1).getDeltaCoding(),
+ 
+-        Coding.of(3,192,0),
+-        Coding.of(3,224,0),
+-        Coding.of(3,240,0),
+-        Coding.of(3,248,0),
+-        Coding.of(3,252,0),
++	Coding.of(3,192,0),
++	Coding.of(3,224,0),
++	Coding.of(3,240,0),
++	Coding.of(3,248,0),
++	Coding.of(3,252,0),
+ 
+-        Coding.of(3,  8,0).getDeltaCoding(),
+-        Coding.of(3,  8,1).getDeltaCoding(),
+-        Coding.of(3, 16,0).getDeltaCoding(),
+-        Coding.of(3, 16,1).getDeltaCoding(),
+-        Coding.of(3, 32,0).getDeltaCoding(),
+-        Coding.of(3, 32,1).getDeltaCoding(),
+-        Coding.of(3, 64,0).getDeltaCoding(),
+-        Coding.of(3, 64,1).getDeltaCoding(),
+-        Coding.of(3,128,0).getDeltaCoding(),
+-        Coding.of(3,128,1).getDeltaCoding(),
+-        Coding.of(3,192,0).getDeltaCoding(),
+-        Coding.of(3,192,1).getDeltaCoding(),
+-        Coding.of(3,224,0).getDeltaCoding(),
+-        Coding.of(3,224,1).getDeltaCoding(),
+-        Coding.of(3,240,0).getDeltaCoding(),
+-        Coding.of(3,240,1).getDeltaCoding(),
+-        Coding.of(3,248,0).getDeltaCoding(),
+-        Coding.of(3,248,1).getDeltaCoding(),
++	Coding.of(3,  8,0).getDeltaCoding(),
++	Coding.of(3,  8,1).getDeltaCoding(),
++	Coding.of(3, 16,0).getDeltaCoding(),
++	Coding.of(3, 16,1).getDeltaCoding(),
++	Coding.of(3, 32,0).getDeltaCoding(),
++	Coding.of(3, 32,1).getDeltaCoding(),
++	Coding.of(3, 64,0).getDeltaCoding(),
++	Coding.of(3, 64,1).getDeltaCoding(),
++	Coding.of(3,128,0).getDeltaCoding(),
++	Coding.of(3,128,1).getDeltaCoding(),
++	Coding.of(3,192,0).getDeltaCoding(),
++	Coding.of(3,192,1).getDeltaCoding(),
++	Coding.of(3,224,0).getDeltaCoding(),
++	Coding.of(3,224,1).getDeltaCoding(),
++	Coding.of(3,240,0).getDeltaCoding(),
++	Coding.of(3,240,1).getDeltaCoding(),
++	Coding.of(3,248,0).getDeltaCoding(),
++	Coding.of(3,248,1).getDeltaCoding(),
+ 
+-        Coding.of(4,192,0),
+-        Coding.of(4,224,0),
+-        Coding.of(4,240,0),
+-        Coding.of(4,248,0),
+-        Coding.of(4,252,0),
++	Coding.of(4,192,0),
++	Coding.of(4,224,0),
++	Coding.of(4,240,0),
++	Coding.of(4,248,0),
++	Coding.of(4,252,0),
+ 
+-        Coding.of(4,  8,0).getDeltaCoding(),
+-        Coding.of(4,  8,1).getDeltaCoding(),
+-        Coding.of(4, 16,0).getDeltaCoding(),
+-        Coding.of(4, 16,1).getDeltaCoding(),
+-        Coding.of(4, 32,0).getDeltaCoding(),
+-        Coding.of(4, 32,1).getDeltaCoding(),
+-        Coding.of(4, 64,0).getDeltaCoding(),
+-        Coding.of(4, 64,1).getDeltaCoding(),
+-        Coding.of(4,128,0).getDeltaCoding(),
+-        Coding.of(4,128,1).getDeltaCoding(),
+-        Coding.of(4,192,0).getDeltaCoding(),
+-        Coding.of(4,192,1).getDeltaCoding(),
+-        Coding.of(4,224,0).getDeltaCoding(),
+-        Coding.of(4,224,1).getDeltaCoding(),
+-        Coding.of(4,240,0).getDeltaCoding(),
+-        Coding.of(4,240,1).getDeltaCoding(),
+-        Coding.of(4,248,0).getDeltaCoding(),
+-        Coding.of(4,248,1).getDeltaCoding(),
++	Coding.of(4,  8,0).getDeltaCoding(),
++	Coding.of(4,  8,1).getDeltaCoding(),
++	Coding.of(4, 16,0).getDeltaCoding(),
++	Coding.of(4, 16,1).getDeltaCoding(),
++	Coding.of(4, 32,0).getDeltaCoding(),
++	Coding.of(4, 32,1).getDeltaCoding(),
++	Coding.of(4, 64,0).getDeltaCoding(),
++	Coding.of(4, 64,1).getDeltaCoding(),
++	Coding.of(4,128,0).getDeltaCoding(),
++	Coding.of(4,128,1).getDeltaCoding(),
++	Coding.of(4,192,0).getDeltaCoding(),
++	Coding.of(4,192,1).getDeltaCoding(),
++	Coding.of(4,224,0).getDeltaCoding(),
++	Coding.of(4,224,1).getDeltaCoding(),
++	Coding.of(4,240,0).getDeltaCoding(),
++	Coding.of(4,240,1).getDeltaCoding(),
++	Coding.of(4,248,0).getDeltaCoding(),
++	Coding.of(4,248,1).getDeltaCoding(),
+ 
+-        null
++	null
+     };
+     final private static HashMap basicCodingIndexes;
+     static {
+-        assert(basicCodings[_meta_default] == null);
+-        assert(basicCodings[_meta_canon_min] != null);
+-        assert(basicCodings[_meta_canon_max] != null);
+-        HashMap map = new HashMap();
+-        for (int i = 0; i < basicCodings.length; i++) {
+-            Coding c = basicCodings[i];
+-            if (c == null)  continue;
+-            assert(i >= _meta_canon_min);
+-            assert(i <= _meta_canon_max);
+-            map.put(c, new Integer(i));
+-        }
+-        basicCodingIndexes = map;
++	assert(basicCodings[_meta_default] == null);
++	assert(basicCodings[_meta_canon_min] != null);
++	assert(basicCodings[_meta_canon_max] != null);
++	HashMap map = new HashMap();
++	for (int i = 0; i < basicCodings.length; i++) {
++	    Coding c = basicCodings[i];
++	    if (c == null)  continue;
++	    assert(i >= _meta_canon_min);
++	    assert(i <= _meta_canon_max);
++	    map.put(c, new Integer(i));
++	}
++	basicCodingIndexes = map;
+     }
+     public static Coding codingForIndex(int i) {
+-        return i < basicCodings.length ? basicCodings[i] : null;
++	return i < basicCodings.length ? basicCodings[i] : null;
+     }
+     public static int indexOf(Coding c) {
+-        Integer i = (Integer) basicCodingIndexes.get(c);
+-        if (i == null)  return 0;
+-        return i.intValue();
++	Integer i = (Integer) basicCodingIndexes.get(c);
++	if (i == null)  return 0;
++	return i.intValue();
+     }
+     public static Coding[] getBasicCodings() {
+-        return (Coding[]) basicCodings.clone();
++	return (Coding[]) basicCodings.clone();
+     }
+ 
+     protected byte[] bandHeaderBytes;    // used for input only
+@@ -267,31 +266,31 @@ class BandStructure implements Constants
+     protected int    bandHeaderBytePos0; // for debug
+ 
+     protected CodingMethod getBandHeader(int XB, Coding regularCoding) {
+-        CodingMethod[] res = {null};
+-        // push back XB onto the band header bytes
+-        bandHeaderBytes[--bandHeaderBytePos] = (byte) XB;
+-        bandHeaderBytePos0 = bandHeaderBytePos;
+-        // scan forward through XB and any additional band header bytes
+-        bandHeaderBytePos = parseMetaCoding(bandHeaderBytes,
+-                                            bandHeaderBytePos,
+-                                            regularCoding,
+-                                            res);
+-        return res[0];
++	CodingMethod[] res = {null};
++	// push back XB onto the band header bytes
++	bandHeaderBytes[--bandHeaderBytePos] = (byte) XB;
++	bandHeaderBytePos0 = bandHeaderBytePos;
++	// scan forward through XB and any additional band header bytes
++	bandHeaderBytePos = parseMetaCoding(bandHeaderBytes,
++					    bandHeaderBytePos,
++					    regularCoding,
++					    res);
++	return res[0];
+     }
+ 
+     public static int parseMetaCoding(byte[] bytes, int pos, Coding dflt, CodingMethod[] res) {
+-        if ((bytes[pos] & 0xFF) == _meta_default) {
+-            res[0] = dflt;
+-            return pos+1;
+-        }
+-        int pos2;
+-        pos2 = Coding.parseMetaCoding(bytes, pos, dflt, res);
+-        if (pos2 > pos)  return pos2;
+-        pos2 = PopulationCoding.parseMetaCoding(bytes, pos, dflt, res);
+-        if (pos2 > pos)  return pos2;
+-        pos2 = AdaptiveCoding.parseMetaCoding(bytes, pos, dflt, res);
+-        if (pos2 > pos)  return pos2;
+-        throw new RuntimeException("Bad meta-coding op "+(bytes[pos]&0xFF));
++	if ((bytes[pos] & 0xFF) == _meta_default) {
++	    res[0] = dflt;
++	    return pos+1;
++	}
++	int pos2;
++	pos2 = Coding.parseMetaCoding(bytes, pos, dflt, res);
++	if (pos2 > pos)  return pos2;
++	pos2 = PopulationCoding.parseMetaCoding(bytes, pos, dflt, res);
++	if (pos2 > pos)  return pos2;
++	pos2 = AdaptiveCoding.parseMetaCoding(bytes, pos, dflt, res);
++	if (pos2 > pos)  return pos2;
++	throw new RuntimeException("Bad meta-coding op "+(bytes[pos]&0xFF));
+     }
+ 
+     static final int SHORT_BAND_HEURISTIC = 100;
+@@ -311,11 +310,11 @@ class BandStructure implements Constants
+     public static final int DONE_PHASE      = 8; // done writing or reading
+ 
+     static boolean phaseIsRead(int p) {
+-        return (p % 2) == 0;
++	return (p % 2) == 0;
+     }
+     static int phaseCmp(int p0, int p1) {
+-        assert((p0 % 2) == (p1 % 2) || (p0 % 8) == 0 || (p1 % 8) == 0);
+-        return p0 - p1;
++	assert((p0 % 2) == (p1 % 2) || (p0 % 8) == 0 || (p1 % 8) == 0);
++	return p0 - p1;
+     }
+ 
+     /** The packed file is divided up into a number of segments.
+@@ -332,7 +331,7 @@ class BandStructure implements Constants
+      *
+      *  The three phases for reading a packed file are EXPECT, READ,
+      *  and DISBURSE.
+-     *  1. For each band, the expected number of integers  is determined.
++     *	1. For each band, the expected number of integers  is determined.
+      *  2. The data is actually read from the file into the band.
+      *  3. The band pays out its values as requested, in an ad hoc order.
+      *
+@@ -340,696 +339,695 @@ class BandStructure implements Constants
+      *  Clearly, these phases must be properly ordered WRT each other.
+      */
+     abstract class Band {
+-        private int    phase = NO_PHASE;
+-        private final  String name;
++	private int    phase = NO_PHASE;
++	private final  String name;
+ 
+-        private int    valuesExpected;
++	private int    valuesExpected;
+ 
+-        protected long outputSize = -1;  // cache
++	protected long outputSize = -1;  // cache
+ 
+-        final public Coding regularCoding;
++	final public Coding regularCoding;
+ 
+-        final public int seqForDebug;
+-        public int       elementCountForDebug;
++	final public int seqForDebug;
++	public int       elementCountForDebug;
+ 
+ 
+-        protected Band(String name, Coding regularCoding) {
+-            this.name = name;
+-            this.regularCoding = regularCoding;
+-            this.seqForDebug = ++nextSeqForDebug;
+-            if (verbose > 2)
+-                Utils.log.fine("Band "+seqForDebug+" is "+name);
+-            // caller must call init
+-        }
++	protected Band(String name, Coding regularCoding) {
++	    this.name = name;
++	    this.regularCoding = regularCoding;
++	    this.seqForDebug = ++nextSeqForDebug;
++	    if (verbose > 2)
++		Utils.log.fine("Band "+seqForDebug+" is "+name);
++	    // caller must call init
++	}
+ 
+-        public Band init() {
+-            // Cannot due this from the constructor, because constructor
+-            // may wish to initialize some subclass variables.
+-            // Set initial phase for reading or writing:
+-            if (isReader)
+-                readyToExpect();
+-            else
+-                readyToCollect();
+-            return this;
+-        }
++	public Band init() {
++	    // Cannot due this from the constructor, because constructor
++	    // may wish to initialize some subclass variables.
++	    // Set initial phase for reading or writing:
++	    if (isReader)
++		readyToExpect();
++	    else
++		readyToCollect();
++	    return this;
++	}
+ 
+-        // common operations
+-        boolean isReader() { return isReader; }
+-        int phase() { return phase; }
+-        String name() { return name; }
++	// common operations
++	boolean isReader() { return isReader; }
++	int phase() { return phase; }
++	String name() { return name; }
+ 
+-        /** Return -1 if data buffer not allocated, else max length. */
+-        public abstract int capacity();
++	/** Return -1 if data buffer not allocated, else max length. */
++	public abstract int capacity();
+ 
+-        /** Allocate data buffer to specified length. */
+-        protected abstract void setCapacity(int cap);
++	/** Allocate data buffer to specified length. */
++	protected abstract void setCapacity(int cap);
+ 
+-        /** Return current number of values in buffer, which must exist. */
+-        public abstract int length();
++	/** Return current number of values in buffer, which must exist. */
++	public abstract int length();
+ 
+-        protected abstract int valuesRemainingForDebug();
++	protected abstract int valuesRemainingForDebug();
+ 
+-        public final int valuesExpected() {
+-            return valuesExpected;
+-        }
++	public final int valuesExpected() {
++	    return valuesExpected;
++	}
+ 
+-        /** Write out bytes, encoding the values. */
+-        public final void writeTo(OutputStream out) throws IOException {
+-            assert(assertReadyToWriteTo(this, out));
+-            setPhase(WRITE_PHASE);
+-            // subclasses continue by writing their contents to output
+-            writeDataTo(out);
+-            doneWriting();
+-        }
++	/** Write out bytes, encoding the values. */
++	public final void writeTo(OutputStream out) throws IOException {
++	    assert(assertReadyToWriteTo(this, out));
++	    setPhase(WRITE_PHASE);
++	    // subclasses continue by writing their contents to output
++	    writeDataTo(out);
++	    doneWriting();
++	}
+ 
+-        abstract void chooseBandCodings() throws IOException;
++	abstract void chooseBandCodings() throws IOException;
+ 
+-        public final long outputSize() {
+-            if (outputSize >= 0) {
+-                long size = outputSize;
+-                assert(size == computeOutputSize());
+-                return size;
+-            }
+-            return computeOutputSize();
+-        }
++	public final long outputSize() {
++	    if (outputSize >= 0) {
++		long size = outputSize;
++		assert(size == computeOutputSize());
++		return size;
++	    }
++	    return computeOutputSize();
++	}
+ 
+-        protected abstract long computeOutputSize();
++	protected abstract long computeOutputSize();
+ 
+-        abstract protected void writeDataTo(OutputStream out) throws IOException;
++	abstract protected void writeDataTo(OutputStream out) throws IOException;
+ 
+-        /** Expect a certain number of values. */
+-        void expectLength(int l) {
+-            assert(assertPhase(this, EXPECT_PHASE));
+-            assert(valuesExpected == 0);  // all at once
+-            assert(l >= 0);
+-            valuesExpected = l;
+-        }
+-        /** Expect more values.  (Multiple calls accumulate.) */
+-        void expectMoreLength(int l) {
+-            assert(assertPhase(this, EXPECT_PHASE));
+-            valuesExpected += l;
+-        }
++	/** Expect a certain number of values. */
++	void expectLength(int l) {
++	    assert(assertPhase(this, EXPECT_PHASE));
++	    assert(valuesExpected == 0);  // all at once
++	    assert(l >= 0);
++	    valuesExpected = l;
++	}
++	/** Expect more values.  (Multiple calls accumulate.) */
++	void expectMoreLength(int l) {
++	    assert(assertPhase(this, EXPECT_PHASE));
++	    valuesExpected += l;
++	}
+ 
+ 
+-        /// Phase change markers.
++	/// Phase change markers.
+ 
+-        private void readyToCollect() { // called implicitly by constructor
+-            setCapacity(1);
+-            setPhase(COLLECT_PHASE);
+-        }
+-        protected void doneWriting() {
+-            assert(assertPhase(this, WRITE_PHASE));
+-            setPhase(DONE_PHASE);
+-        }
+-        private void readyToExpect() { // called implicitly by constructor
+-            setPhase(EXPECT_PHASE);
+-        }
+-        /** Read in bytes, decoding the values. */
+-        public final void readFrom(InputStream in) throws IOException {
+-            assert(assertReadyToReadFrom(this, in));
+-            setCapacity(valuesExpected());
+-            setPhase(READ_PHASE);
+-            // subclasses continue by reading their contents from input:
+-            readDataFrom(in);
+-            readyToDisburse();
+-        }
+-        abstract protected void readDataFrom(InputStream in) throws IOException;
+-        protected void readyToDisburse() {
+-            if (verbose > 1)  Utils.log.fine("readyToDisburse "+this);
+-            setPhase(DISBURSE_PHASE);
+-        }
+-        public void doneDisbursing() {
+-            assert(assertPhase(this, DISBURSE_PHASE));
+-            setPhase(DONE_PHASE);
+-        }
+-        public final void doneWithUnusedBand() {
+-            if (isReader) {
+-                assert(assertPhase(this, EXPECT_PHASE));
+-                assert(valuesExpected() == 0);
+-                // Fast forward:
+-                setPhase(READ_PHASE);
+-                setPhase(DISBURSE_PHASE);
+-                setPhase(DONE_PHASE);
+-            } else {
+-                setPhase(FROZEN_PHASE);
+-            }
+-        }
++	private void readyToCollect() { // called implicitly by constructor
++	    setCapacity(1);
++	    setPhase(COLLECT_PHASE);
++	}
++	protected void doneWriting() {
++	    assert(assertPhase(this, WRITE_PHASE));
++	    setPhase(DONE_PHASE);
++	}
++	private void readyToExpect() { // called implicitly by constructor
++	    setPhase(EXPECT_PHASE);
++	}
++	/** Read in bytes, decoding the values. */
++	public final void readFrom(InputStream in) throws IOException {
++	    assert(assertReadyToReadFrom(this, in));
++	    setCapacity(valuesExpected());
++	    setPhase(READ_PHASE);
++	    // subclasses continue by reading their contents from input:
++	    readDataFrom(in);
++	    readyToDisburse();
++	}
++	abstract protected void readDataFrom(InputStream in) throws IOException;
++	protected void readyToDisburse() {
++	    if (verbose > 1)  Utils.log.fine("readyToDisburse "+this);
++	    setPhase(DISBURSE_PHASE);
++	}
++	public void doneDisbursing() {
++	    assert(assertPhase(this, DISBURSE_PHASE));
++	    setPhase(DONE_PHASE);
++	}
++	public final void doneWithUnusedBand() {
++	    if (isReader) {
++		assert(assertPhase(this, EXPECT_PHASE));
++		assert(valuesExpected() == 0);
++		// Fast forward:
++		setPhase(READ_PHASE);
++		setPhase(DISBURSE_PHASE);
++		setPhase(DONE_PHASE);
++	    } else {
++		setPhase(FROZEN_PHASE);
++	    }
++	}
+ 
+-        protected void setPhase(int newPhase) {
+-            assert(assertPhaseChangeOK(this, phase, newPhase));
+-            this.phase = newPhase;
+-        }
++	protected void setPhase(int newPhase) {
++	    assert(assertPhaseChangeOK(this, phase, newPhase));
++	    this.phase = newPhase;
++	}
+ 
+-        protected int lengthForDebug = -1;  // DEBUG ONLY
+-        public String toString() {  // DEBUG ONLY
+-            int length = (lengthForDebug != -1 ? lengthForDebug : length());
+-            String str = name;
+-            if (length != 0)
+-                str += "[" + length + "]";
+-            if (elementCountForDebug != 0)
+-                str += "(" + elementCountForDebug + ")";
+-            return str;
+-        }
++	protected int lengthForDebug = -1;  // DEBUG ONLY
++	public String toString() {  // DEBUG ONLY
++	    int length = (lengthForDebug != -1 ? lengthForDebug : length());
++	    String str = name;
++	    if (length != 0)
++		str += "[" + length + "]";
++	    if (elementCountForDebug != 0)
++		str += "(" + elementCountForDebug + ")";
++	    return str;
++	} 
+     }
+ 
+     class ValueBand extends Band {
+-        private int[]  values;   // must be null in EXPECT phase
+-        private int    length;
+-        private int    valuesDisbursed;
++	private int[]  values;   // must be null in EXPECT phase
++	private int    length;
++	private int    valuesDisbursed;
+ 
+-        private CodingMethod bandCoding;
+-        private byte[] metaCoding;
++	private CodingMethod bandCoding;
++	private byte[] metaCoding;
+ 
+-        protected ValueBand(String name, Coding regularCoding) {
+-            super(name, regularCoding);
+-        }
++	protected ValueBand(String name, Coding regularCoding) {
++	    super(name, regularCoding);
++	}
+ 
+-        public int capacity() {
+-            return values == null ? -1 : values.length;
+-        }
++	public int capacity() {
++	    return values == null ? -1 : values.length;
++	}
+ 
+-        /** Declare predicted or needed capacity. */
+-        protected void setCapacity(int cap) {
+-            assert(length <= cap);
+-            if (cap == -1) { values = null; return; }
+-            values = realloc(values, cap);
+-        }
++	/** Declare predicted or needed capacity. */
++	protected void setCapacity(int cap) {
++	    assert(length <= cap);
++	    if (cap == -1) { values = null; return; }
++	    values = realloc(values, cap);
++	}
+ 
+-        public int length() {
+-            return length;
+-        }
+-        protected int valuesRemainingForDebug() {
+-            return length - valuesDisbursed;
+-        }
+-        protected int valueAtForDebug(int i) {
+-            return values[i];
+-        }
++	public int length() {
++	    return length;
++	}
++	protected int valuesRemainingForDebug() {
++	    return length - valuesDisbursed;
++	}
++	protected int valueAtForDebug(int i) {
++	    return values[i];
++	}
+ 
+-        void patchValue(int i, int value) {
+-            // Only one use for this.
+-            assert(this == archive_header_S);
+-            assert(i == AH_ARCHIVE_SIZE_HI || i == AH_ARCHIVE_SIZE_LO);
+-            assert(i < length);  // must have already output a dummy
+-            values[i] = value;
+-            outputSize = -1;  // decache
+-        }
++	void patchValue(int i, int value) {
++	    // Only one use for this.
++	    assert(this == archive_header_S);
++	    assert(i == AH_ARCHIVE_SIZE_HI || i == AH_ARCHIVE_SIZE_LO);
++	    assert(i < length);  // must have already output a dummy
++	    values[i] = value;
++	    outputSize = -1;  // decache
++	}
+ 
+-        protected void initializeValues(int[] values) {
+-            assert(assertCanChangeLength(this));
+-            assert(length == 0);
+-            this.values = values;
+-            this.length = values.length;
+-        }
++	protected void initializeValues(int[] values) {
++	    assert(assertCanChangeLength(this));
++	    assert(length == 0);
++	    this.values = values;
++	    this.length = values.length;
++	}
+ 
+-        /** Collect one value, or store one decoded value. */
+-        protected void addValue(int x) {
+-            assert(assertCanChangeLength(this));
+-            if (length == values.length)
+-                setCapacity(length < 1000 ? length * 10 : length * 2);
+-            values[length++] = x;
+-        }
++	/** Collect one value, or store one decoded value. */
++	protected void addValue(int x) {
++	    assert(assertCanChangeLength(this));
++	    if (length == values.length)
++		setCapacity(length < 1000 ? length * 10 : length * 2);
++	    values[length++] = x;
++	}
+ 
+-        private boolean canVaryCoding() {
+-            if (!optVaryCodings)           return false;
+-            if (length == 0)               return false;
+-            // Can't read band_headers w/o the archive header:
+-            if (this == archive_header_0)  return false;
+-            if (this == archive_header_S)  return false;
+-            if (this == archive_header_1)  return false;
+-            // BYTE1 bands can't vary codings, but the others can.
+-            // All that's needed for the initial escape is at least
+-            // 256 negative values or more than 256 non-negative values
+-            return (regularCoding.min() <= -256 || regularCoding.max() >= 256);
+-        }
++	private boolean canVaryCoding() {
++	    if (!optVaryCodings)           return false;
++	    if (length == 0)               return false;
++	    // Can't read band_headers w/o the archive header:
++	    if (this == archive_header_0)  return false;
++	    if (this == archive_header_S)  return false;
++	    if (this == archive_header_1)  return false;
++	    // BYTE1 bands can't vary codings, but the others can.
++	    // All that's needed for the initial escape is at least
++	    // 256 negative values or more than 256 non-negative values
++	    return (regularCoding.min() <= -256 || regularCoding.max() >= 256);
++	}
+ 
+-        private boolean shouldVaryCoding() {
+-            assert(canVaryCoding());
+-            if (effort < MAX_EFFORT && length < SHORT_BAND_HEURISTIC)
+-                return false;
+-            return true;
+-        }
++	private boolean shouldVaryCoding() {
++	    assert(canVaryCoding());
++	    if (effort < MAX_EFFORT && length < SHORT_BAND_HEURISTIC)
++		return false;
++	    return true;
++	}
+ 
+-        protected void chooseBandCodings() throws IOException {
+-            boolean canVary = canVaryCoding();
+-            if (!canVary || !shouldVaryCoding()) {
+-                if (regularCoding.canRepresent(values, 0, length)) {
+-                    bandCoding = regularCoding;
+-                } else {
+-                    assert(canVary);
+-                    if (verbose > 1)
+-                        Utils.log.fine("regular coding fails in band "+name());
+-                    bandCoding = UNSIGNED5;
+-                }
+-                outputSize = -1;
+-            } else {
+-                int[] sizes = {0,0};
+-                bandCoding = chooseCoding(values, 0, length,
+-                                          regularCoding, name(),
+-                                          sizes);
+-                outputSize = sizes[CodingChooser.BYTE_SIZE];
+-                if (outputSize == 0)  // CodingChooser failed to size it.
+-                    outputSize = -1;
+-            }
++	protected void chooseBandCodings() throws IOException {
++	    boolean canVary = canVaryCoding();
++	    if (!canVary || !shouldVaryCoding()) {
++		if (regularCoding.canRepresent(values, 0, length)) {
++		    bandCoding = regularCoding;
++		} else {
++		    assert(canVary);
++		    if (verbose > 1)
++			Utils.log.fine("regular coding fails in band "+name());
++		    bandCoding = UNSIGNED5;
++		}
++		outputSize = -1;
++	    } else {
++		int[] sizes = {0,0};
++		bandCoding = chooseCoding(values, 0, length,
++					  regularCoding, name(),
++					  sizes);
++		outputSize = sizes[CodingChooser.BYTE_SIZE];
++		if (outputSize == 0)  // CodingChooser failed to size it.
++		    outputSize = -1;
++	    }
+ 
+-            // Compute and save the meta-coding bytes also.
+-            if (bandCoding != regularCoding) {
+-                metaCoding = bandCoding.getMetaCoding(regularCoding);
+-                if (verbose > 1) {
+-                    Utils.log.fine("alternate coding "+this+" "+bandCoding);
+-                }
+-            } else if (canVary &&
+-                       decodeEscapeValue(values[0], regularCoding) >= 0) {
+-                // Need an explicit default.
+-                metaCoding = defaultMetaCoding;
+-            } else {
+-                // Common case:  Zero bytes of meta coding.
+-                metaCoding = noMetaCoding;
+-            }
+-            if (metaCoding.length > 0
+-                && (verbose > 2 || verbose > 1 && metaCoding.length > 1)) {
+-                StringBuffer sb = new StringBuffer();
+-                for (int i = 0; i < metaCoding.length; i++) {
+-                    if (i == 1)  sb.append(" /");
+-                    sb.append(" ").append(metaCoding[i] & 0xFF);
+-                }
+-                Utils.log.fine("   meta-coding "+sb);
+-            }
++	    // Compute and save the meta-coding bytes also.
++	    if (bandCoding != regularCoding) {
++		metaCoding = bandCoding.getMetaCoding(regularCoding);
++		if (verbose > 1) {
++		    Utils.log.fine("alternate coding "+this+" "+bandCoding);
++		}
++	    } else if (canVary &&
++		       decodeEscapeValue(values[0], regularCoding) >= 0) {
++		// Need an explicit default.
++		metaCoding = defaultMetaCoding;
++	    } else {
++		// Common case:  Zero bytes of meta coding.
++		metaCoding = noMetaCoding;
++	    }
++	    if (metaCoding.length > 0
++		&& (verbose > 2 || verbose > 1 && metaCoding.length > 1)) {
++		StringBuffer sb = new StringBuffer();
++		for (int i = 0; i < metaCoding.length; i++) {
++		    if (i == 1)  sb.append(" /");
++		    sb.append(" ").append(metaCoding[i] & 0xFF);
++		}
++		Utils.log.fine("   meta-coding "+sb);
++	    }
+ 
+-            assert((outputSize < 0) ||
+-                   !(bandCoding instanceof Coding) ||
+-                   (outputSize == ((Coding)bandCoding)
+-                    .getLength(values, 0, length)))
+-                : (bandCoding+" : "+
+-                   outputSize+" != "+
+-                   ((Coding)bandCoding).getLength(values, 0, length)
+-                   +" ?= "+getCodingChooser().computeByteSize(bandCoding,values,0,length)
+-                   );
++	    assert((outputSize < 0) ||
++		   !(bandCoding instanceof Coding) ||
++		   (outputSize == ((Coding)bandCoding)
++		    .getLength(values, 0, length)))
++		: (bandCoding+" : "+
++		   outputSize+" != "+
++		   ((Coding)bandCoding).getLength(values, 0, length)
++		   +" ?= "+getCodingChooser().computeByteSize(bandCoding,values,0,length)
++		   );
+ 
+-            // Compute outputSize of the escape value X, if any.
+-            if (metaCoding.length > 0) {
+-                // First byte XB of meta-coding is treated specially,
+-                // but any other bytes go into the band headers band.
+-                // This must be done before any other output happens.
+-                if (outputSize >= 0)
+-                    outputSize += computeEscapeSize();  // good cache
+-                // Other bytes go into band_headers.
+-                for (int i = 1; i < metaCoding.length; i++) {
+-                    band_headers.putByte(metaCoding[i] & 0xFF);
+-                }
+-            }
+-        }
++	    // Compute outputSize of the escape value X, if any.
++	    if (metaCoding.length > 0) {
++		// First byte XB of meta-coding is treated specially,
++		// but any other bytes go into the band headers band.
++		// This must be done before any other output happens.
++		if (outputSize >= 0)
++		    outputSize += computeEscapeSize();  // good cache
++		// Other bytes go into band_headers.
++		for (int i = 1; i < metaCoding.length; i++) {
++		    band_headers.putByte(metaCoding[i] & 0xFF);
++		}
++	    }
++	}
+ 
+-        protected long computeOutputSize() {
+-            outputSize = getCodingChooser().computeByteSize(bandCoding,
+-                                                            values, 0, length);
+-            assert(outputSize < Integer.MAX_VALUE);
+-            outputSize += computeEscapeSize();
+-            return outputSize;
+-        }
++	protected long computeOutputSize() {
++	    outputSize = getCodingChooser().computeByteSize(bandCoding,
++							    values, 0, length);
++	    assert(outputSize < Integer.MAX_VALUE);
++	    outputSize += computeEscapeSize();
++	    return outputSize;
++	}
+ 
+-        protected int computeEscapeSize() {
+-            if (metaCoding.length == 0)  return 0;
+-            int XB = metaCoding[0] & 0xFF;
+-            int X = encodeEscapeValue(XB, regularCoding);
+-            return regularCoding.setD(0).getLength(X);
+-        }
++	protected int computeEscapeSize() {
++	    if (metaCoding.length == 0)  return 0;
++	    int XB = metaCoding[0] & 0xFF;
++	    int X = encodeEscapeValue(XB, regularCoding);
++	    return regularCoding.setD(0).getLength(X);
++	}
+ 
+-        protected void writeDataTo(OutputStream out) throws IOException {
+-            if (length == 0)  return;  // nothing to write
+-            long len0 = 0;
+-            if (out == outputCounter) {
+-                len0 = outputCounter.getCount();
+-            }
+-            if (metaCoding.length > 0) {
+-                int XB = metaCoding[0] & 0xFF;
+-                // We need an explicit band header, either because
+-                // there is a non-default coding method, or because
+-                // the first value would be parsed as an escape value.
+-                int X = encodeEscapeValue(XB, regularCoding);
+-                //System.out.println("X="+X+" XB="+XB+" in "+this);
+-                regularCoding.setD(0).writeTo(out, X);
+-            }
+-            bandCoding.writeArrayTo(out, values, 0, length);
+-            if (out == outputCounter) {
+-                long len1 = outputCounter.getCount();
+-                assert(outputSize == outputCounter.getCount() - len0)
+-                    : (outputSize+" != "+outputCounter.getCount()+"-"+len0);
+-            }
+-            if (optDumpBands)  dumpBand();
+-        }
++	protected void writeDataTo(OutputStream out) throws IOException {
++	    if (length == 0)  return;  // nothing to write
++	    long len0 = 0;
++	    if (out == outputCounter) {
++		len0 = outputCounter.getCount();
++	    }
++	    if (metaCoding.length > 0) {
++		int XB = metaCoding[0] & 0xFF;
++		// We need an explicit band header, either because
++		// there is a non-default coding method, or because
++		// the first value would be parsed as an escape value.
++		int X = encodeEscapeValue(XB, regularCoding);
++		//System.out.println("X="+X+" XB="+XB+" in "+this);
++		regularCoding.setD(0).writeTo(out, X);
++	    }
++	    bandCoding.writeArrayTo(out, values, 0, length);
++	    if (out == outputCounter) {
++		long len1 = outputCounter.getCount();
++		assert(outputSize == outputCounter.getCount() - len0)
++		    : (outputSize+" != "+outputCounter.getCount()+"-"+len0);
++	    }
++	    if (optDumpBands)  dumpBand();
++	}
+ 
+-        protected void readDataFrom(InputStream in) throws IOException {
+-            length = valuesExpected();
+-            if (length == 0)  return;  // nothing to read
+-            if (verbose > 1)
+-                Utils.log.fine("Reading band "+this);
+-            if (!canVaryCoding()) {
+-                bandCoding = regularCoding;
+-                metaCoding = noMetaCoding;
+-            } else {
+-                assert(in.markSupported());  // input must be buffered
+-                in.mark(Coding.B_MAX);
+-                int X = regularCoding.setD(0).readFrom(in);
+-                int XB = decodeEscapeValue(X, regularCoding);
+-                if (XB < 0) {
+-                    // Do not consume this value.  No alternate coding.
+-                    in.reset();
+-                    XB = _meta_default;
+-                    bandCoding = regularCoding;
+-                    metaCoding = noMetaCoding;
+-                } else if (XB == _meta_default) {
+-                    bandCoding = regularCoding;
+-                    metaCoding = defaultMetaCoding;
+-                } else {
+-                    if (verbose > 2)
+-                        Utils.log.fine("found X="+X+" => XB="+XB);
+-                    bandCoding = getBandHeader(XB, regularCoding);
+-                    // This is really used only by dumpBands.
+-                    int p0 = bandHeaderBytePos0;
+-                    int p1 = bandHeaderBytePos;
+-                    metaCoding = new byte[p1-p0];
+-                    System.arraycopy(bandHeaderBytes, p0,
+-                                     metaCoding, 0, metaCoding.length);
+-                }
+-            }
+-            if (bandCoding != regularCoding) {
+-                if (verbose > 1)
+-                    Utils.log.fine(name()+": irregular coding "+bandCoding);
+-            }
+-            bandCoding.readArrayFrom(in, values, 0, length);
+-            if (optDumpBands)  dumpBand();
+-        }
++	protected void readDataFrom(InputStream in) throws IOException {
++	    length = valuesExpected();
++	    if (length == 0)  return;  // nothing to read
++	    if (verbose > 1)
++		Utils.log.fine("Reading band "+this);
++	    if (!canVaryCoding()) {
++		bandCoding = regularCoding;
++		metaCoding = noMetaCoding;
++	    } else {
++		assert(in.markSupported());  // input must be buffered
++		in.mark(Coding.B_MAX);
++		int X = regularCoding.setD(0).readFrom(in);
++		int XB = decodeEscapeValue(X, regularCoding);
++		if (XB < 0) {
++		    // Do not consume this value.  No alternate coding.
++		    in.reset();
++		    XB = _meta_default;
++		    bandCoding = regularCoding;
++		    metaCoding = noMetaCoding;
++		} else if (XB == _meta_default) {
++		    bandCoding = regularCoding;
++		    metaCoding = defaultMetaCoding;
++		} else {
++		    if (verbose > 2)
++			Utils.log.fine("found X="+X+" => XB="+XB);
++		    bandCoding = getBandHeader(XB, regularCoding);
++		    // This is really used only by dumpBands.
++		    int p0 = bandHeaderBytePos0;
++		    int p1 = bandHeaderBytePos;
++		    metaCoding = new byte[p1-p0];
++		    System.arraycopy(bandHeaderBytes, p0,
++				     metaCoding, 0, metaCoding.length);
++		}	    
++	    }
++	    if (bandCoding != regularCoding) {
++		if (verbose > 1)
++		    Utils.log.fine(name()+": irregular coding "+bandCoding);
++	    }
++	    bandCoding.readArrayFrom(in, values, 0, length);
++	    if (optDumpBands)  dumpBand();
++	}
+ 
+-        public void doneDisbursing() {
+-            super.doneDisbursing();
+-            values = null;  // for GC
+-        }
++	public void doneDisbursing() {
++	    super.doneDisbursing();
++	    values = null;  // for GC
++	}
+ 
+-        private void dumpBand() throws IOException {
+-            assert(optDumpBands);
+-            PrintStream ps = new PrintStream(getDumpStream(this, ".txt"));
+-            String irr = (bandCoding == regularCoding) ? "" : " irregular";
+-            ps.print("# length="+length+
+-                     " size="+outputSize()+
+-                     irr+" coding="+bandCoding);
+-            if (metaCoding != noMetaCoding) {
+-                StringBuffer sb = new StringBuffer();
+-                for (int i = 0; i < metaCoding.length; i++) {
+-                    if (i == 1)  sb.append(" /");
+-                    sb.append(" ").append(metaCoding[i] & 0xFF);
+-                }
+-                ps.print(" //header: "+sb);
+-            }
+-            printArrayTo(ps, values, 0, length);
+-            ps.close();
+-            OutputStream ds = getDumpStream(this, ".bnd");
+-            bandCoding.writeArrayTo(ds, values, 0, length);
+-            ds.close();
+-        }
++	private void dumpBand() throws IOException {
++	    assert(optDumpBands);
++	    PrintStream ps = new PrintStream(getDumpStream(this, ".txt"));
++	    String irr = (bandCoding == regularCoding) ? "" : " irregular";
++	    ps.print("# length="+length+
++		     " size="+outputSize()+
++		     irr+" coding="+bandCoding);
++	    if (metaCoding != noMetaCoding) {
++		StringBuffer sb = new StringBuffer();
++		for (int i = 0; i < metaCoding.length; i++) {
++		    if (i == 1)  sb.append(" /");
++		    sb.append(" ").append(metaCoding[i] & 0xFF);
++		}
++		ps.print(" //header: "+sb);
++	    }
++	    printArrayTo(ps, values, 0, length);
++	    ps.close();
++	    OutputStream ds = getDumpStream(this, ".bnd");
++	    bandCoding.writeArrayTo(ds, values, 0, length);
++	    ds.close();
++	}
+ 
+-        /** Disburse one value. */
+-        protected int getValue() {
+-            assert(phase() == DISBURSE_PHASE);
+-            assert(valuesDisbursed < length);
+-            return values[valuesDisbursed++];
+-        }
++	/** Disburse one value. */
++	protected int getValue() {
++	    assert(phase() == DISBURSE_PHASE);
++	    assert(valuesDisbursed < length);
++	    return values[valuesDisbursed++];
++	}
+ 
+-        /** Reset for another pass over the same value set. */
+-        public void resetForSecondPass() {
+-            assert(phase() == DISBURSE_PHASE);
+-            assert(valuesDisbursed == length());  // 1st pass is complete
+-            valuesDisbursed = 0;
+-        }
++	/** Reset for another pass over the same value set. */
++	public void resetForSecondPass() {
++	    assert(phase() == DISBURSE_PHASE);
++	    assert(valuesDisbursed == length());  // 1st pass is complete
++	    valuesDisbursed = 0;
++	}
+     }
+ 
+     class ByteBand extends Band {
+-        private ByteArrayOutputStream bytes;  // input buffer
+-        private ByteArrayOutputStream bytesForDump;
+-        private InputStream in;
++	private ByteArrayOutputStream bytes;  // input buffer
++	private ByteArrayOutputStream bytesForDump;
++	private InputStream in;
+ 
+-        public ByteBand(String name) {
+-            super(name, BYTE1);
+-        }
++	public ByteBand(String name) {
++	    super(name, BYTE1);
++	}
+ 
+-        public int capacity() {
+-            return bytes == null ? -1 : Integer.MAX_VALUE;
+-        }
+-        protected void setCapacity(int cap) {
+-            assert(bytes == null);  // do this just once
+-            bytes = new ByteArrayOutputStream(cap);
+-        }
+-        public void destroy() {
+-            lengthForDebug = length();
+-            bytes = null;
+-        }
++	public int capacity() {
++	    return bytes == null ? -1 : Integer.MAX_VALUE;
++	}
++	protected void setCapacity(int cap) {
++	    assert(bytes == null);  // do this just once
++	    bytes = new ByteArrayOutputStream(cap);
++	}
++	public void destroy() {
++	    lengthForDebug = length();
++	    bytes = null;
++	}
+ 
+-        public int length() {
+-            return bytes == null ? -1 : bytes.size();
+-        }
+-        public void reset() {
+-            bytes.reset();
+-        }
+-        protected int valuesRemainingForDebug() {
+-            return (bytes == null) ? -1 : ((ByteArrayInputStream)in).available();
+-        }
++	public int length() {
++	    return bytes == null ? -1 : bytes.size();
++	}
++	public void reset() {
++	    bytes.reset();
++	}
++	protected int valuesRemainingForDebug() {
++	    return (bytes == null) ? -1 : ((ByteArrayInputStream)in).available();
++	}
+ 
+-        protected void chooseBandCodings() throws IOException {
+-            // No-op.
+-            assert(decodeEscapeValue(regularCoding.min(), regularCoding) < 0);
+-            assert(decodeEscapeValue(regularCoding.max(), regularCoding) < 0);
+-        }
++	protected void chooseBandCodings() throws IOException {
++	    // No-op.
++	    assert(decodeEscapeValue(regularCoding.min(), regularCoding) < 0);
++	    assert(decodeEscapeValue(regularCoding.max(), regularCoding) < 0);
++	}
+ 
+-        protected long computeOutputSize() {
+-            // do not cache
+-            return bytes.size();
+-        }
++	protected long computeOutputSize() {
++	    // do not cache
++	    return bytes.size();
++	}
+ 
+-        public void writeDataTo(OutputStream out) throws IOException {
+-            if (length() == 0)  return;
+-            bytes.writeTo(out);
+-            if (optDumpBands)  dumpBand();
+-            destroy();  // done with the bits!
+-        }
++	public void writeDataTo(OutputStream out) throws IOException {
++	    if (length() == 0)  return;
++	    bytes.writeTo(out);
++	    if (optDumpBands)  dumpBand();
++	    destroy();  // done with the bits!
++	}
+ 
+-        private void dumpBand() throws IOException {
+-            assert(optDumpBands);
+-            OutputStream ds = getDumpStream(this, ".bnd");
+-            if (bytesForDump != null)
+-                bytesForDump.writeTo(ds);
+-            else
+-                bytes.writeTo(ds);
+-            ds.close();
+-        }
++	private void dumpBand() throws IOException {
++	    assert(optDumpBands);
++	    OutputStream ds = getDumpStream(this, ".bnd");
++	    if (bytesForDump != null)
++		bytesForDump.writeTo(ds);
++	    else
++		bytes.writeTo(ds);
++	    ds.close();
++	}
+ 
+-        public void readDataFrom(InputStream in) throws IOException {
+-            int vex = valuesExpected();
+-            if (vex == 0)  return;
+-            if (verbose > 1) {
+-                lengthForDebug = vex;
+-                Utils.log.fine("Reading band "+this);
+-                lengthForDebug = -1;
+-            }
+-            byte[] buf = new byte[Math.min(vex, 1<<14)];
+-            while (vex > 0) {
+-                int nr = in.read(buf, 0, Math.min(vex, buf.length));
+-                if (nr < 0)  throw new EOFException();
+-                bytes.write(buf, 0, nr);
+-                vex -= nr;
+-            }
+-            if (optDumpBands)  dumpBand();
+-        }
++	public void readDataFrom(InputStream in) throws IOException {
++	    int vex = valuesExpected();
++	    if (vex == 0)  return;
++	    if (verbose > 1) {
++		lengthForDebug = vex;
++		Utils.log.fine("Reading band "+this);
++		lengthForDebug = -1;
++	    }
++	    byte[] buf = new byte[Math.min(vex, 1<<14)];
++	    while (vex > 0) {
++		int nr = in.read(buf, 0, Math.min(vex, buf.length));
++		if (nr < 0)  throw new EOFException();
++		bytes.write(buf, 0, nr);
++		vex -= nr;
++	    }
++	    if (optDumpBands)  dumpBand();
++	}
+ 
+-        public void readyToDisburse() {
+-            in = new ByteArrayInputStream(bytes.toByteArray());
+-            super.readyToDisburse();
+-        }
++	public void readyToDisburse() {
++	    in = new ByteArrayInputStream(bytes.toByteArray());
++	    super.readyToDisburse();
++	}
+ 
+-        public void doneDisbursing() {
+-            super.doneDisbursing();
+-            if (optDumpBands
+-                && bytesForDump != null && bytesForDump.size() > 0) {
+-                try {
+-                    dumpBand();
+-                } catch (IOException ee) {
+-                    throw new RuntimeException(ee);
+-                }
+-            }
+-            in = null; // GC
+-            bytes = null;  // GC
+-            bytesForDump = null;  // GC
+-        }
++	public void doneDisbursing() {
++	    super.doneDisbursing();
++	    if (optDumpBands
++		&& bytesForDump != null && bytesForDump.size() > 0) {
++		try {
++		    dumpBand();
++		} catch (IOException ee) {
++		    throw new RuntimeException(ee);
++		}
++	    }
++	    in = null; // GC
++	    bytes = null;  // GC
++	    bytesForDump = null;  // GC
++	}
+ 
+-        // alternative to readFrom:
+-        public void setInputStreamFrom(InputStream in) throws IOException {
+-            assert(bytes == null);
+-            assert(assertReadyToReadFrom(this, in));
+-            setPhase(READ_PHASE);
+-            this.in = in;
+-            if (optDumpBands) {
+-                // Tap the stream.
+-                bytesForDump = new ByteArrayOutputStream();
+-                this.in = new FilterInputStream(in) {
+-                    public int read() throws IOException {
+-                        int ch = in.read();
+-                        if (ch >= 0)  bytesForDump.write(ch);
+-                        return ch;
+-                    }
+-                    public int read(byte b[], int off, int len) throws IOException {
+-                        int nr = in.read(b, off, len);
+-                        if (nr >= 0)  bytesForDump.write(b, off, nr);
+-                        return nr;
+-                    }
+-                };
+-            }
+-            super.readyToDisburse();
+-        }
++	// alternative to readFrom:
++	public void setInputStreamFrom(InputStream in) throws IOException {
++	    assert(bytes == null);
++	    assert(assertReadyToReadFrom(this, in));
++	    setPhase(READ_PHASE);
++	    this.in = in;
++	    if (optDumpBands) {
++		// Tap the stream.
++		bytesForDump = new ByteArrayOutputStream();
++		this.in = new FilterInputStream(in) {
++		    public int read() throws IOException {
++			int ch = in.read();
++			if (ch >= 0)  bytesForDump.write(ch);
++			return ch;
++		    }
++		    public int read(byte b[], int off, int len) throws IOException {
++			int nr = in.read(b, off, len);
++			if (nr >= 0)  bytesForDump.write(b, off, nr);
++			return nr;
++		    }
++		};
++	    }
++	    super.readyToDisburse();
++	}
+ 
+-        public OutputStream collectorStream() {
+-            assert(phase() == COLLECT_PHASE);
+-            assert(bytes != null);
+-            return bytes;
+-        }
++	public OutputStream collectorStream() {
++	    assert(phase() == COLLECT_PHASE);
++	    assert(bytes != null);
++	    return bytes;
++	}
+ 
+-        public InputStream getInputStream() {
+-            assert(phase() == DISBURSE_PHASE);
+-            assert(in != null);
+-            return in;
+-        }
+-        public int getByte() throws IOException {
+-            int b = getInputStream().read();
+-            if (b < 0)  throw new EOFException();
+-            return b;
+-        }
+-        public void putByte(int b) throws IOException {
+-            assert(b == (b & 0xFF));
+-            collectorStream().write(b);
+-        }
+-        public String toString() {
+-            return "byte "+super.toString();
+-        }
++	public InputStream getInputStream() {
++	    assert(phase() == DISBURSE_PHASE);
++	    assert(in != null);
++	    return in;
++	}
++	public int getByte() throws IOException {
++	    int b = getInputStream().read();
++	    if (b < 0)  throw new EOFException();
++	    return b;
++	}
++	public void putByte(int b) throws IOException {
++	    assert(b == (b & 0xFF));
++	    collectorStream().write(b);
++	}
++	public String toString() {
++	    return "byte "+super.toString();
++	}
+     }
+ 
+     class IntBand extends ValueBand {
+-        // The usual coding for bands is 7bit/5byte/delta.
+-        public IntBand(String name, Coding regularCoding) {
+-            super(name, regularCoding);
+-        }
++	// The usual coding for bands is 7bit/5byte/delta.
++	public IntBand(String name, Coding regularCoding) {
++	    super(name, regularCoding);
++	}
+ 
+-        public void putInt(int x) {
+-            assert(phase() == COLLECT_PHASE);
+-            addValue(x);
+-        }
++	public void putInt(int x) {
++	    assert(phase() == COLLECT_PHASE);
++	    addValue(x);
++	}
+ 
+-        public int getInt() {
+-            return getValue();
+-        }
+-        /** Return the sum of all values in this band. */
+-        public int getIntTotal() {
+-            assert(phase() == DISBURSE_PHASE);
+-            // assert that this is the whole pass; no other reads allowed
+-            assert(valuesRemainingForDebug() == length());
+-            int total = 0;
+-            for (int k = length(); k > 0; k--) {
+-                total += getInt();
+-            }
+-            resetForSecondPass();
+-            return total;
+-        }
+-        /** Return the occurrence count of a specific value in this band. */
+-        public int getIntCount(int value) {
+-            assert(phase() == DISBURSE_PHASE);
+-            // assert that this is the whole pass; no other reads allowed
+-            assert(valuesRemainingForDebug() == length());
+-            int total = 0;
+-            for (int k = length(); k > 0; k--) {
+-                if (getInt() == value) {
+-                    total += 1;
+-                }
+-            }
+-            resetForSecondPass();
+-            return total;
+-        }
++	public int getInt() {
++	    return getValue();
++	}
++	/** Return the sum of all values in this band. */
++	public int getIntTotal() {
++	    assert(phase() == DISBURSE_PHASE);
++	    // assert that this is the whole pass; no other reads allowed
++	    assert(valuesRemainingForDebug() == length());
++	    int total = 0;
++	    for (int k = length(); k > 0; k--) {
++		total += getInt();
++	    }
++	    resetForSecondPass();
++	    return total;
++	}
++	/** Return the occurrence count of a specific value in this band. */
++	public int getIntCount(int value) {
++	    assert(phase() == DISBURSE_PHASE);
++	    // assert that this is the whole pass; no other reads allowed
++	    assert(valuesRemainingForDebug() == length());
++	    int total = 0;
++	    for (int k = length(); k > 0; k--) {
++		if (getInt() == value) {
++		    total += 1;
++		}
++	    }
++	    resetForSecondPass();
++	    return total;
++	}
+     }
+ 
+     static int getIntTotal(int[] values) {
+-        int total = 0;
+-        for (int i = 0; i < values.length; i++) {
+-            total += values[i];
+-        }
+-        return total;
++	int total = 0;
++	for (int i = 0; i < values.length; i++) {
++	    total += values[i];
++	}
++	return total;
+     }
+ 
+     class CPRefBand extends ValueBand {
+-        Index index;
+-        boolean nullOK;
++	Index index;
++	boolean nullOK;
+ 
+-        public CPRefBand(String name, Coding regularCoding, byte cpTag, boolean nullOK) {
+-            super(name, regularCoding);
+-            this.nullOK = nullOK;
+-            if (cpTag != CONSTANT_None)
+-                setBandIndex(this, cpTag);
+-        }
+-        public CPRefBand(String name, Coding regularCoding, byte cpTag) {
+-            this(name, regularCoding, cpTag, false);
+-        }
+-        public CPRefBand(String name, Coding regularCoding, Object undef) {
+-            this(name, regularCoding, CONSTANT_None, false);
+-        }
++	public CPRefBand(String name, Coding regularCoding, byte cpTag, boolean nullOK) {
++	    super(name, regularCoding);
++	    this.nullOK = nullOK;
++	    if (cpTag != CONSTANT_None)
++		setBandIndex(this, cpTag);
++	}
++	public CPRefBand(String name, Coding regularCoding, byte cpTag) {
++	    this(name, regularCoding, cpTag, false);
++	}
++	public CPRefBand(String name, Coding regularCoding, Object undef) {
++	    this(name, regularCoding, CONSTANT_None, false);
++	}
+ 
+-        public void setIndex(Index index) {
+-            this.index = index;
+-        }
++	public void setIndex(Index index) {
++	    this.index = index;
++	}
+ 
+-        protected void readDataFrom(InputStream in) throws IOException {
+-            super.readDataFrom(in);
+-            assert(assertValidCPRefs(this));
+-        }
++	protected void readDataFrom(InputStream in) throws IOException {
++	    super.readDataFrom(in);
++	    assert(assertValidCPRefs(this));
++	}
+ 
+-        /** Write a constant pool reference. */
+-        public void putRef(Entry e) {
+-            assert(index != null);
+-            addValue(encodeRefOrNull(e, index));
+-        }
+-        public void putRef(Entry e, Index index) {
+-            assert(this.index == null);
+-            addValue(encodeRefOrNull(e, index));
+-        }
+-        public void putRef(Entry e, byte cptag) {
+-            putRef(e, getCPIndex(cptag));
+-        }
++	/** Write a constant pool reference. */
++	public void putRef(Entry e) {
++	    addValue(encodeRefOrNull(e, index));
++	}
++	public void putRef(Entry e, Index index) {
++	    assert(this.index == null);
++	    addValue(encodeRefOrNull(e, index));
++	}
++	public void putRef(Entry e, byte cptag) {
++	    putRef(e, getCPIndex(cptag));
++	}
+ 
+-        public Entry getRef() {
+-            if (index == null)  Utils.log.warning("No index for "+this);
+-            assert(index != null);
+-            return decodeRefOrNull(getValue(), index);
+-        }
+-        public Entry getRef(Index index) {
+-            assert(this.index == null);
+-            return decodeRefOrNull(getValue(), index);
+-        }
+-        public Entry getRef(byte cptag) {
+-            return getRef(getCPIndex(cptag));
+-        }
++	public Entry getRef() {
++	    if (index == null)  Utils.log.warning("No index for "+this);
++	    assert(index != null);
++	    return decodeRefOrNull(getValue(), index);
++	}
++	public Entry getRef(Index index) {
++	    assert(this.index == null);
++	    return decodeRefOrNull(getValue(), index);
++	}
++	public Entry getRef(byte cptag) {
++	    return getRef(getCPIndex(cptag));
++	}
+ 
+-        private int encodeRefOrNull(Entry e, Index index) {
+-            int nonNullCode;  // NNC is the coding which assumes nulls are rare
+-            if (e == null) {
+-                nonNullCode = -1;  // negative values are rare
+-            } else {
+-                nonNullCode = encodeRef(e, index);
+-            }
+-            // If nulls are expected, increment, to make -1 code turn to 0.
+-            return (nullOK ? 1 : 0) + nonNullCode;
+-        }
+-        private Entry decodeRefOrNull(int code, Index index) {
+-            // Inverse to encodeRefOrNull...
+-            int nonNullCode = code - (nullOK ? 1 : 0);
+-            if (nonNullCode == -1) {
+-                return null;
+-            } else {
+-                return decodeRef(nonNullCode, index);
+-            }
+-        }
++	private int encodeRefOrNull(Entry e, Index index) {
++	    int nonNullCode;  // NNC is the coding which assumes nulls are rare
++	    if (e == null) {
++		nonNullCode = -1;  // negative values are rare
++	    } else {
++		nonNullCode = encodeRef(e, index);
++	    }
++	    // If nulls are expected, increment, to make -1 code turn to 0.
++	    return (nullOK ? 1 : 0) + nonNullCode;
++	}
++	private Entry decodeRefOrNull(int code, Index index) {
++	    // Inverse to encodeRefOrNull...
++	    int nonNullCode = code - (nullOK ? 1 : 0);
++	    if (nonNullCode == -1) {
++		return null;
++	    } else {
++		return decodeRef(nonNullCode, index);
++	    }
++	}
+     }
+ 
+     // Bootstrap support for CPRefBands.  These are needed to record
+@@ -1039,51 +1037,53 @@ class BandStructure implements Constants
+ 
+ 
+     int encodeRef(Entry e, Index ix) {
+-        int coding = ix.indexOf(e);
+-        if (verbose > 2)
+-            Utils.log.fine("putRef "+coding+" => "+e);
+-        return coding;
++	if (ix == null)
++	    throw new RuntimeException("null index for " + e.stringValue());
++	int coding = ix.indexOf(e);
++	if (verbose > 2)
++	    Utils.log.fine("putRef "+coding+" => "+e);
++	return coding;
+     }
+ 
+     Entry decodeRef(int n, Index ix) {
+-        if (n < 0 || n >= ix.size())
+-            Utils.log.warning("decoding bad ref "+n+" in "+ix);
+-        Entry e = ix.getEntry(n);
+-        if (verbose > 2)
+-            Utils.log.fine("getRef "+n+" => "+e);
+-        return e;
++	if (n < 0 || n >= ix.size())
++	    Utils.log.warning("decoding bad ref "+n+" in "+ix);
++	Entry e = ix.getEntry(n);
++	if (verbose > 2)
++	    Utils.log.fine("getRef "+n+" => "+e);
++	return e;
+     }
+ 
+     private CodingChooser codingChooser;
+     protected CodingChooser getCodingChooser() {
+-        if (codingChooser == null) {
+-            codingChooser = new CodingChooser(effort, basicCodings);
+-            if (codingChooser.stress != null
+-                && this instanceof PackageWriter) {
+-                // Twist the random state based on my first file.
+-                // This sends each segment off in a different direction.
+-                List classes = ((PackageWriter)this).pkg.classes;
+-                if (!classes.isEmpty()) {
+-                    Package.Class cls = (Package.Class) classes.get(0);
+-                    codingChooser.addStressSeed(cls.getName().hashCode());
+-                }
+-            }
+-        }
+-        return codingChooser;
++	if (codingChooser == null) {
++	    codingChooser = new CodingChooser(effort, basicCodings);
++	    if (codingChooser.stress != null
++		&& this instanceof PackageWriter) {
++		// Twist the random state based on my first file.
++		// This sends each segment off in a different direction.
++		List classes = ((PackageWriter)this).pkg.classes;
++		if (!classes.isEmpty()) {
++		    Package.Class cls = (Package.Class) classes.get(0);
++		    codingChooser.addStressSeed(cls.getName().hashCode());
++		}
++	    }
++	}
++	return codingChooser;
+     }
+ 
+     public CodingMethod chooseCoding(int[] values, int start, int end,
+-                                     Coding regular, String bandName,
+-                                     int[] sizes) {
+-        assert(optVaryCodings);
+-        if (effort <= MIN_EFFORT) {
+-            return regular;
+-        }
+-        CodingChooser cc = getCodingChooser();
+-        if (verbose > 1 || cc.verbose > 1) {
+-            Utils.log.fine("--- chooseCoding "+bandName);
+-        }
+-        return cc.choose(values, start, end, regular, sizes);
++				     Coding regular, String bandName,
++				     int[] sizes) {
++	assert(optVaryCodings);
++	if (effort <= MIN_EFFORT) {
++	    return regular;
++	}
++	CodingChooser cc = getCodingChooser();
++	if (verbose > 1 || cc.verbose > 1) {
++	    Utils.log.fine("--- chooseCoding "+bandName);
++	}
++	return cc.choose(values, start, end, regular, sizes);
+     }
+ 
+     static final byte[] defaultMetaCoding = { _meta_default };
+@@ -1108,201 +1108,201 @@ class BandStructure implements Constants
+     // Result is in [0..255] if XB was successfully extracted, else -1.
+     // See section "Coding Specifier Meta-Encoding" in the JSR 200 spec.
+     protected static int decodeEscapeValue(int X, Coding regularCoding) {
+-        // The first value in a band is always coded with the default coding D.
+-        // If this first value X is an escape value, it actually represents the
+-        // first (and perhaps only) byte of a meta-coding.
+-        // Result is in [0..255] if XB was successfully extracted, else -1.
+-        if (regularCoding.B() == 1 || regularCoding.L() == 0)
+-            return -1;  // degenerate regular coding (BYTE1)
+-        if (regularCoding.S() != 0) {
+-            if (-256 <= X && X <= -1 && regularCoding.min() <= -256) {
+-                int XB = -1-X;
+-                assert(XB >= 0 && XB < 256);
+-                return XB;
+-            }
+-        } else {
+-            int L = regularCoding.L();
+-            if (L <= X && X <= L+255 && regularCoding.max() >= L+255) {
+-                int XB = X-L;
+-                assert(XB >= 0 && XB < 256);
+-                return XB;
+-            }
+-        }
+-        return -1;  // negative value for failure
++	// The first value in a band is always coded with the default coding D.
++	// If this first value X is an escape value, it actually represents the
++	// first (and perhaps only) byte of a meta-coding.
++	// Result is in [0..255] if XB was successfully extracted, else -1.
++	if (regularCoding.B() == 1 || regularCoding.L() == 0)
++	    return -1;  // degenerate regular coding (BYTE1)
++	if (regularCoding.S() != 0) {
++	    if (-256 <= X && X <= -1 && regularCoding.min() <= -256) {
++		int XB = -1-X;
++		assert(XB >= 0 && XB < 256);
++		return XB;
++	    }
++	} else {
++	    int L = regularCoding.L();
++	    if (L <= X && X <= L+255 && regularCoding.max() >= L+255) {
++		int XB = X-L;
++		assert(XB >= 0 && XB < 256);
++		return XB;
++	    }
++	}
++	return -1;  // negative value for failure
+     }
+     // Inverse to decodeEscapeValue().
+     protected static int encodeEscapeValue(int XB, Coding regularCoding) {
+-        assert(XB >= 0 && XB < 256);
+-        assert(regularCoding.B() > 1 && regularCoding.L() > 0);
+-        int X;
+-        if (regularCoding.S() != 0) {
+-            assert(regularCoding.min() <= -256);
+-            X = -1-XB;
+-        } else {
+-            int L = regularCoding.L();
+-            assert(regularCoding.max() >= L+255);
+-            X = XB+L;
+-        }
+-        assert(decodeEscapeValue(X, regularCoding) == XB)
+-            : (regularCoding+" XB="+XB+" X="+X);
+-        return X;
++	assert(XB >= 0 && XB < 256);
++	assert(regularCoding.B() > 1 && regularCoding.L() > 0);
++	int X;
++	if (regularCoding.S() != 0) {
++	    assert(regularCoding.min() <= -256);
++	    X = -1-XB;
++	} else {
++	    int L = regularCoding.L();
++	    assert(regularCoding.max() >= L+255);
++	    X = XB+L;
++	}
++	assert(decodeEscapeValue(X, regularCoding) == XB)
++	    : (regularCoding+" XB="+XB+" X="+X);
++	return X;
+     }
+ 
+     static {
+-        boolean checkXB = false;
+-        assert(checkXB = true);
+-        if (checkXB) {
+-            for (int i = 0; i < basicCodings.length; i++) {
+-                Coding D = basicCodings[i];
+-                if (D == null)   continue;
+-                if (D.B() == 1)  continue;
+-                if (D.L() == 0)  continue;
+-                for (int XB = 0; XB <= 255; XB++) {
+-                    // The following exercises decodeEscapeValue also:
+-                    encodeEscapeValue(XB, D);
+-                }
+-            }
+-        }
++	boolean checkXB = false;
++	assert(checkXB = true);
++	if (checkXB) {
++	    for (int i = 0; i < basicCodings.length; i++) {
++		Coding D = basicCodings[i];
++		if (D == null)   continue;
++		if (D.B() == 1)  continue;
++		if (D.L() == 0)  continue;
++		for (int XB = 0; XB <= 255; XB++) {
++		    // The following exercises decodeEscapeValue also:
++		    encodeEscapeValue(XB, D);
++		}
++	    }
++	}
+     }
+ 
+     class MultiBand extends Band {
+-        MultiBand(String name, Coding regularCoding) {
+-            super(name, regularCoding);
+-        }
++	MultiBand(String name, Coding regularCoding) {
++	    super(name, regularCoding);
++	}
+ 
+-        public Band init() {
+-            super.init();
+-            // This is all just to keep the asserts happy:
+-            setCapacity(0);
+-            if (phase() == EXPECT_PHASE) {
+-                // Fast forward:
+-                setPhase(READ_PHASE);
+-                setPhase(DISBURSE_PHASE);
+-            }
+-            return this;
+-        }
++	public Band init() {
++	    super.init();
++	    // This is all just to keep the asserts happy:
++	    setCapacity(0);
++	    if (phase() == EXPECT_PHASE) {
++		// Fast forward:
++		setPhase(READ_PHASE);
++		setPhase(DISBURSE_PHASE);
++	    }
++	    return this;
++	}
+ 
+-        Band[] bands     = new Band[10];
+-        int    bandCount = 0;
++	Band[] bands     = new Band[10];
++	int    bandCount = 0;
+ 
+-        int size() {
+-            return bandCount;
+-        }
+-        Band get(int i) {
+-            assert(i < bandCount);
+-            return bands[i];
+-        }
+-        Band[] toArray() {
+-            return (Band[]) realloc(bands, bandCount);
+-        }
++	int size() {
++	    return bandCount;
++	}
++	Band get(int i) {
++	    assert(i < bandCount);
++	    return bands[i];
++	}
++	Band[] toArray() {
++	    return (Band[]) realloc(bands, bandCount);
++	}
+ 
+-        void add(Band b) {
+-            assert(bandCount == 0 || notePrevForAssert(b, bands[bandCount-1]));
+-            if (bandCount == bands.length) {
+-                bands = (Band[]) realloc(bands);
+-            }
+-            bands[bandCount++] = b;
+-        }
++	void add(Band b) {
++	    assert(bandCount == 0 || notePrevForAssert(b, bands[bandCount-1]));
++	    if (bandCount == bands.length) {
++		bands = (Band[]) realloc(bands);
++	    }
++	    bands[bandCount++] = b;
++	}
+ 
+-        ByteBand newByteBand(String name) {
+-            ByteBand b = new ByteBand(name);
+-            b.init(); add(b);
+-            return b;
+-        }
+-        IntBand newIntBand(String name) {
+-            IntBand b = new IntBand(name, regularCoding);
+-            b.init(); add(b);
+-            return b;
+-        }
+-        IntBand newIntBand(String name, Coding regularCoding) {
+-            IntBand b = new IntBand(name, regularCoding);
+-            b.init(); add(b);
+-            return b;
+-        }
+-        MultiBand newMultiBand(String name, Coding regularCoding) {
+-            MultiBand b = new MultiBand(name, regularCoding);
+-            b.init(); add(b);
+-            return b;
+-        }
+-        CPRefBand newCPRefBand(String name, byte cpTag) {
+-            CPRefBand b = new CPRefBand(name, regularCoding, cpTag);
+-            b.init(); add(b);
+-            return b;
+-        }
+-        CPRefBand newCPRefBand(String name, Coding regularCoding,
+-                               byte cpTag) {
+-            CPRefBand b = new CPRefBand(name, regularCoding, cpTag);
+-            b.init(); add(b);
+-            return b;
+-        }
+-        CPRefBand newCPRefBand(String name, Coding regularCoding,
+-                               byte cpTag, boolean nullOK) {
+-            CPRefBand b = new CPRefBand(name, regularCoding, cpTag, nullOK);
+-            b.init(); add(b);
+-            return b;
+-        }
++	ByteBand newByteBand(String name) {
++	    ByteBand b = new ByteBand(name);
++	    b.init(); add(b);
++	    return b;
++	}
++	IntBand newIntBand(String name) {
++	    IntBand b = new IntBand(name, regularCoding);
++	    b.init(); add(b);
++	    return b;
++	}
++	IntBand newIntBand(String name, Coding regularCoding) {
++	    IntBand b = new IntBand(name, regularCoding);
++	    b.init(); add(b);
++	    return b;
++	}
++	MultiBand newMultiBand(String name, Coding regularCoding) {
++	    MultiBand b = new MultiBand(name, regularCoding);
++	    b.init(); add(b);
++	    return b;
++	}
++	CPRefBand newCPRefBand(String name, byte cpTag) {
++	    CPRefBand b = new CPRefBand(name, regularCoding, cpTag);
++	    b.init(); add(b);
++	    return b;
++	}
++	CPRefBand newCPRefBand(String name, Coding regularCoding,
++			       byte cpTag) {
++	    CPRefBand b = new CPRefBand(name, regularCoding, cpTag);
++	    b.init(); add(b);
++	    return b;
++	}
++	CPRefBand newCPRefBand(String name, Coding regularCoding,
++			       byte cpTag, boolean nullOK) {
++	    CPRefBand b = new CPRefBand(name, regularCoding, cpTag, nullOK);
++	    b.init(); add(b);
++	    return b;
++	}
+ 
+-        int bandCount() { return bandCount; }
++	int bandCount() { return bandCount; }
+ 
+-        private int cap = -1;
+-        public int capacity() { return cap; }
+-        public void setCapacity(int cap) { this.cap = cap; }
++	private int cap = -1;
++	public int capacity() { return cap; }
++	public void setCapacity(int cap) { this.cap = cap; }
+ 
+-        public int length() { return 0; }
+-        public int valuesRemainingForDebug() { return 0; }
++	public int length() { return 0; }
++	public int valuesRemainingForDebug() { return 0; }
+ 
+-        protected void chooseBandCodings() throws IOException {
+-            // coding decision pass
+-            for (int i = 0; i < bandCount; i++) {
+-                Band b = bands[i];
+-                b.chooseBandCodings();
+-            }
+-        }
++	protected void chooseBandCodings() throws IOException {
++	    // coding decision pass
++	    for (int i = 0; i < bandCount; i++) {
++		Band b = bands[i];
++		b.chooseBandCodings();
++	    }
++	}
+ 
+-        protected long computeOutputSize() {
+-            // coding decision pass
+-            long sum = 0;
+-            for (int i = 0; i < bandCount; i++) {
+-                Band b = bands[i];
+-                long bsize = b.outputSize();
+-                assert(bsize >= 0) : b;
+-                sum += bsize;
+-            }
+-            // do not cache
+-            return sum;
+-        }
++	protected long computeOutputSize() {
++	    // coding decision pass
++	    long sum = 0;
++	    for (int i = 0; i < bandCount; i++) {
++		Band b = bands[i];
++		long bsize = b.outputSize();
++		assert(bsize >= 0) : b;
++		sum += bsize;
++	    }
++	    // do not cache
++	    return sum;
++	}
+ 
+-        protected void writeDataTo(OutputStream out) throws IOException {
+-            long preCount = 0;
+-            if (outputCounter != null)  preCount = outputCounter.getCount();
+-            for (int i = 0; i < bandCount; i++) {
+-                Band b = bands[i];
+-                b.writeTo(out);
+-                if (outputCounter != null) {
+-                    long postCount = outputCounter.getCount();
+-                    long len = postCount - preCount;
+-                    preCount = postCount;
+-                    if ((verbose > 0 && len > 0) || verbose > 1) {
+-                        Utils.log.info("  ...wrote "+len+" bytes from "+b);
+-                    }
+-                }
+-            }
+-        }
++	protected void writeDataTo(OutputStream out) throws IOException {
++	    long preCount = 0;
++	    if (outputCounter != null)  preCount = outputCounter.getCount();
++	    for (int i = 0; i < bandCount; i++) {
++		Band b = bands[i];
++		b.writeTo(out);
++		if (outputCounter != null) {
++		    long postCount = outputCounter.getCount();
++		    long len = postCount - preCount;
++		    preCount = postCount;
++		    if ((verbose > 0 && len > 0) || verbose > 1) {
++			Utils.log.info("  ...wrote "+len+" bytes from "+b);
++		    }
++		}
++	    }
++	}
+ 
+-        protected void readDataFrom(InputStream in) throws IOException {
+-            assert(false);  // not called?
+-            for (int i = 0; i < bandCount; i++) {
+-                Band b = bands[i];
+-                b.readFrom(in);
+-                if ((verbose > 0 && b.length() > 0) || verbose > 1) {
+-                    Utils.log.info("  ...read "+b);
+-                }
+-            }
+-        }
++	protected void readDataFrom(InputStream in) throws IOException {
++	    assert(false);  // not called?
++	    for (int i = 0; i < bandCount; i++) {
++		Band b = bands[i];
++		b.readFrom(in);
++		if ((verbose > 0 && b.length() > 0) || verbose > 1) {
++		    Utils.log.info("  ...read "+b);
++		}
++	    }
++	}
+ 
+-        public String toString() {
+-            return "{"+bandCount()+" bands: "+super.toString()+"}";
+-        }
++	public String toString() {
++	    return "{"+bandCount()+" bands: "+super.toString()+"}";
++	}
+     }
+ 
+     /**
+@@ -1310,42 +1310,42 @@ class BandStructure implements Constants
+      */
+     private static
+     class ByteCounter extends FilterOutputStream {
+-        // (should go public under the name CountingOutputStream?)
++	// (should go public under the name CountingOutputStream?)
+ 
+-        private long count;
++	private long count;
+ 
+-        public ByteCounter(OutputStream out) {
+-            super(out);
+-        }
++	public ByteCounter(OutputStream out) {
++	    super(out);
++	}
+ 
+-        public long getCount() { return count; }
+-        public void setCount(long c) { count = c; }
++	public long getCount() { return count; }
++	public void setCount(long c) { count = c; }
+ 
+-        public void write(int b) throws IOException {
+-            count++;
+-            if (out != null)  out.write(b);
+-        }
+-        public void write(byte b[], int off, int len) throws IOException {
+-            count += len;
+-            if (out != null)  out.write(b, off, len);
+-        }
+-        public String toString() {
+-            return String.valueOf(getCount());
+-        }
++	public void write(int b) throws IOException {
++	    count++;
++	    if (out != null)  out.write(b);
++	}
++	public void write(byte b[], int off, int len) throws IOException {
++	    count += len;
++	    if (out != null)  out.write(b, off, len);
++	}
++	public String toString() {
++	    return String.valueOf(getCount());
++	}
+     }
+     ByteCounter outputCounter;
+ 
+     void writeAllBandsTo(OutputStream out) throws IOException {
+-        // Wrap a byte-counter around the output stream.
+-        outputCounter = new ByteCounter(out);
+-        out = outputCounter;
+-        all_bands.writeTo(out);
+-        if (verbose > 0) {
+-            long nbytes = outputCounter.getCount();
+-            Utils.log.info("Wrote total of "+nbytes+" bytes.");
+-            assert(nbytes == archiveSize0+archiveSize1);
+-        }
+-        outputCounter = null;
++	// Wrap a byte-counter around the output stream.
++	outputCounter = new ByteCounter(out);
++	out = outputCounter;
++	all_bands.writeTo(out);
++	if (verbose > 0) {
++	    long nbytes = outputCounter.getCount();
++	    Utils.log.info("Wrote total of "+nbytes+" bytes.");
++	    assert(nbytes == archiveSize0+archiveSize1);
++	}
++	outputCounter = null;
+     }
+ 
+     // random AO_XXX bits, decoded from the archive header
+@@ -1366,7 +1366,7 @@ class BandStructure implements Constants
+     static final int AH_SPECIAL_FORMAT_LEN = 2; // layouts/band-headers
+     static final int AH_CP_NUMBER_LEN = 4;  // int/float/long/double
+     static final int AH_LENGTH_MIN = AH_LENGTH
+-        -(AH_SPECIAL_FORMAT_LEN+AH_FILE_HEADER_LEN+AH_CP_NUMBER_LEN);
++	-(AH_SPECIAL_FORMAT_LEN+AH_FILE_HEADER_LEN+AH_CP_NUMBER_LEN);
+ 
+     // Common structure of attribute band groups:
+     static final int AB_FLAGS_HI = 0;
+@@ -1376,22 +1376,22 @@ class BandStructure implements Constants
+     static final int AB_ATTR_CALLS = 4;
+ 
+     static IntBand getAttrBand(MultiBand xxx_attr_bands, int which) {
+-        IntBand b = (IntBand) xxx_attr_bands.get(which);
+-        switch (which) {
+-        case AB_FLAGS_HI:
+-            assert(b.name().endsWith("_flags_hi")); break;
+-        case AB_FLAGS_LO:
+-            assert(b.name().endsWith("_flags_lo")); break;
+-        case AB_ATTR_COUNT:
+-            assert(b.name().endsWith("_attr_count")); break;
+-        case AB_ATTR_INDEXES:
+-            assert(b.name().endsWith("_attr_indexes")); break;
+-        case AB_ATTR_CALLS:
+-            assert(b.name().endsWith("_attr_calls")); break;
+-        default:
+-            assert(false); break;
+-        }
+-        return b;
++	IntBand b = (IntBand) xxx_attr_bands.get(which);
++	switch (which) {
++	case AB_FLAGS_HI:
++	    assert(b.name().endsWith("_flags_hi")); break;
++	case AB_FLAGS_LO:
++	    assert(b.name().endsWith("_flags_lo")); break;
++	case AB_ATTR_COUNT:
++	    assert(b.name().endsWith("_attr_count")); break;
++	case AB_ATTR_INDEXES:
++	    assert(b.name().endsWith("_attr_indexes")); break;
++	case AB_ATTR_CALLS:
++	    assert(b.name().endsWith("_attr_calls")); break;
++	default:
++	    assert(false); break;
++	}
++	return b;
+     }
+ 
+     static private final boolean NULL_IS_OK = true;
+@@ -1602,55 +1602,55 @@ class BandStructure implements Constants
+ 
+     /** Given CP indexes, distribute tag-specific indexes to bands. */
+     protected void setBandIndexes() {
+-        // Handle prior calls to setBandIndex:
+-        for (Iterator i = needPredefIndex.iterator(); i.hasNext(); ) {
+-            Object[] need = (Object[]) i.next();
+-            CPRefBand b     = (CPRefBand) need[0];
+-            Byte      which = (Byte)      need[1];
+-            b.setIndex(getCPIndex(which.byteValue()));
+-        }
+-        needPredefIndex = null;  // no more predefs
++	// Handle prior calls to setBandIndex:
++	for (Iterator i = needPredefIndex.iterator(); i.hasNext(); ) {
++	    Object[] need = (Object[]) i.next();
++	    CPRefBand b     = (CPRefBand) need[0];
++	    Byte      which = (Byte)      need[1];
++	    b.setIndex(getCPIndex(which.byteValue()));
++	}
++	needPredefIndex = null;  // no more predefs
+ 
+-        if (verbose > 3) {
+-            printCDecl(all_bands);
+-        }
++	if (verbose > 3) {
++	    printCDecl(all_bands);
++	}
+     }
+ 
+     protected void setBandIndex(CPRefBand b, byte which) {
+-        Object[] need = { b, new Byte(which) };
+-        if (which == CONSTANT_Literal) {
+-            // I.e., attribute layouts KQ (no null) or KQN (null ok).
+-            allKQBands.add(b);
+-        } else if (needPredefIndex != null) {
+-            needPredefIndex.add(need);
+-        } else {
+-            // Not in predefinition mode; getCPIndex now works.
+-            b.setIndex(getCPIndex(which));
+-        }
++	Object[] need = { b, new Byte(which) };
++	if (which == CONSTANT_Literal) {
++	    // I.e., attribute layouts KQ (no null) or KQN (null ok).
++	    allKQBands.add(b);
++	} else if (needPredefIndex != null) {
++	    needPredefIndex.add(need);
++	} else {
++	    // Not in predefinition mode; getCPIndex now works.
++	    b.setIndex(getCPIndex(which));
++	}
+     }
+ 
+     protected void setConstantValueIndex(Class.Field f) {
+-        Index ix = null;
+-        if (f != null) {
+-            byte tag = f.getLiteralTag();
+-            ix = getCPIndex(tag);
+-            if (verbose > 2)
+-                Utils.log.fine("setConstantValueIndex "+f+" "+ConstantPool.tagName(tag)+" => "+ix);
+-            assert(ix != null);
+-        }
+-        // Typically, allKQBands is the singleton of field_ConstantValue_KQ.
+-        for (Iterator i = allKQBands.iterator(); i.hasNext(); ) {
+-            CPRefBand xxx_KQ = (CPRefBand) i.next();
+-            xxx_KQ.setIndex(ix);
+-        }
++	Index ix = null;
++	if (f != null) {
++	    byte tag = f.getLiteralTag();
++	    ix = getCPIndex(tag);
++	    if (verbose > 2)
++		Utils.log.fine("setConstantValueIndex "+f+" "+ConstantPool.tagName(tag)+" => "+ix);
++	    assert(ix != null);
++	}
++	// Typically, allKQBands is the singleton of field_ConstantValue_KQ.
++	for (Iterator i = allKQBands.iterator(); i.hasNext(); ) {
++	    CPRefBand xxx_KQ = (CPRefBand) i.next();
++	    xxx_KQ.setIndex(ix);
++	}
+     }
+ 
+     // Table of bands which contain metadata.
+     protected MultiBand[] metadataBands = new MultiBand[ATTR_CONTEXT_LIMIT];
+     {
+-        metadataBands[ATTR_CONTEXT_CLASS] = class_metadata_bands;
+-        metadataBands[ATTR_CONTEXT_FIELD] = field_metadata_bands;
+-        metadataBands[ATTR_CONTEXT_METHOD] = method_metadata_bands;
++	metadataBands[ATTR_CONTEXT_CLASS] = class_metadata_bands;
++	metadataBands[ATTR_CONTEXT_FIELD] = field_metadata_bands;
++	metadataBands[ATTR_CONTEXT_METHOD] = method_metadata_bands;
+     }
+ 
+     // Attribute layouts.
+@@ -1686,660 +1686,660 @@ class BandStructure implements Constants
+     // Mapping from attribute index (<32 are flag bits) to attributes.
+     protected ArrayList[] attrDefs = new ArrayList[ATTR_CONTEXT_LIMIT];
+     {
+-        for (int i = 0; i < ATTR_CONTEXT_LIMIT; i++) {
+-            assert(attrIndexLimit[i] == 0);
+-            attrIndexLimit[i] = 32;  // just for the sake of predefs.
+-            attrDefs[i] = new ArrayList(Collections.nCopies(attrIndexLimit[i], null));
+-        }
++	for (int i = 0; i < ATTR_CONTEXT_LIMIT; i++) {
++	    assert(attrIndexLimit[i] == 0);
++	    attrIndexLimit[i] = 32;  // just for the sake of predefs.
++	    attrDefs[i] = new ArrayList(Collections.nCopies(attrIndexLimit[i], null));
++	}
+ 
+-        // Add predefined attribute definitions:
+-        attrInnerClassesEmpty =
+-        predefineAttribute(CLASS_ATTR_InnerClasses, ATTR_CONTEXT_CLASS, null,
+-                           "InnerClasses", "");
+-        assert(attrInnerClassesEmpty == Package.attrInnerClassesEmpty);
+-        predefineAttribute(CLASS_ATTR_SourceFile, ATTR_CONTEXT_CLASS,
+-                           new Band[] { class_SourceFile_RUN },
+-                           "SourceFile", "RUNH");
+-        predefineAttribute(CLASS_ATTR_EnclosingMethod, ATTR_CONTEXT_CLASS,
+-                           new Band[] {
+-                               class_EnclosingMethod_RC,
+-                               class_EnclosingMethod_RDN
+-                           },
+-                           "EnclosingMethod", "RCHRDNH");
+-        attrClassFileVersion =
+-        predefineAttribute(CLASS_ATTR_ClassFile_version, ATTR_CONTEXT_CLASS,
+-                           new Band[] {
+-                               class_ClassFile_version_minor_H,
+-                               class_ClassFile_version_major_H
+-                           },
+-                           ".ClassFile.version", "HH");
+-        predefineAttribute(X_ATTR_Signature, ATTR_CONTEXT_CLASS,
+-                           new Band[] { class_Signature_RS },
+-                           "Signature", "RSH");
+-        predefineAttribute(X_ATTR_Deprecated, ATTR_CONTEXT_CLASS, null,
+-                           "Deprecated", "");
+-        //predefineAttribute(X_ATTR_Synthetic, ATTR_CONTEXT_CLASS, null,
+-        //                 "Synthetic", "");
+-        predefineAttribute(X_ATTR_OVERFLOW, ATTR_CONTEXT_CLASS, null,
+-                           ".Overflow", "");
+-        attrConstantValue =
+-        predefineAttribute(FIELD_ATTR_ConstantValue, ATTR_CONTEXT_FIELD,
+-                           new Band[] { field_ConstantValue_KQ },
+-                           "ConstantValue", "KQH");
+-        predefineAttribute(X_ATTR_Signature, ATTR_CONTEXT_FIELD,
+-                           new Band[] { field_Signature_RS },
+-                           "Signature", "RSH");
+-        predefineAttribute(X_ATTR_Deprecated, ATTR_CONTEXT_FIELD, null,
+-                           "Deprecated", "");
+-        //predefineAttribute(X_ATTR_Synthetic, ATTR_CONTEXT_FIELD, null,
+-        //                 "Synthetic", "");
+-        predefineAttribute(X_ATTR_OVERFLOW, ATTR_CONTEXT_FIELD, null,
+-                           ".Overflow", "");
+-        attrCodeEmpty =
+-        predefineAttribute(METHOD_ATTR_Code, ATTR_CONTEXT_METHOD, null,
+-                           "Code", "");
+-        predefineAttribute(METHOD_ATTR_Exceptions, ATTR_CONTEXT_METHOD,
+-                           new Band[] {
+-                               method_Exceptions_N,
+-                               method_Exceptions_RC
+-                           },
+-                           "Exceptions", "NH[RCH]");
+-        assert(attrCodeEmpty == Package.attrCodeEmpty);
+-        predefineAttribute(X_ATTR_Signature, ATTR_CONTEXT_METHOD,
+-                           new Band[] { method_Signature_RS },
+-                           "Signature", "RSH");
+-        predefineAttribute(X_ATTR_Deprecated, ATTR_CONTEXT_METHOD, null,
+-                           "Deprecated", "");
+-        //predefineAttribute(X_ATTR_Synthetic, ATTR_CONTEXT_METHOD, null,
+-        //                 "Synthetic", "");
+-        predefineAttribute(X_ATTR_OVERFLOW, ATTR_CONTEXT_METHOD, null,
+-                           ".Overflow", "");
++	// Add predefined attribute definitions:
++	attrInnerClassesEmpty =
++	predefineAttribute(CLASS_ATTR_InnerClasses, ATTR_CONTEXT_CLASS, null,
++			   "InnerClasses", "");
++	assert(attrInnerClassesEmpty == Package.attrInnerClassesEmpty);
++	predefineAttribute(CLASS_ATTR_SourceFile, ATTR_CONTEXT_CLASS,
++			   new Band[] { class_SourceFile_RUN },
++			   "SourceFile", "RUNH");
++	predefineAttribute(CLASS_ATTR_EnclosingMethod, ATTR_CONTEXT_CLASS,
++			   new Band[] {
++			       class_EnclosingMethod_RC,
++			       class_EnclosingMethod_RDN
++			   },
++			   "EnclosingMethod", "RCHRDNH");
++	attrClassFileVersion =
++	predefineAttribute(CLASS_ATTR_ClassFile_version, ATTR_CONTEXT_CLASS,
++			   new Band[] {
++			       class_ClassFile_version_minor_H,
++			       class_ClassFile_version_major_H
++			   },
++			   ".ClassFile.version", "HH");
++	predefineAttribute(X_ATTR_Signature, ATTR_CONTEXT_CLASS,
++			   new Band[] { class_Signature_RS },
++			   "Signature", "RSH");
++	predefineAttribute(X_ATTR_Deprecated, ATTR_CONTEXT_CLASS, null,
++			   "Deprecated", "");
++	//predefineAttribute(X_ATTR_Synthetic, ATTR_CONTEXT_CLASS, null,
++	//		   "Synthetic", "");
++	predefineAttribute(X_ATTR_OVERFLOW, ATTR_CONTEXT_CLASS, null,
++			   ".Overflow", "");
++	attrConstantValue =
++	predefineAttribute(FIELD_ATTR_ConstantValue, ATTR_CONTEXT_FIELD,
++			   new Band[] { field_ConstantValue_KQ },
++			   "ConstantValue", "KQH");
++	predefineAttribute(X_ATTR_Signature, ATTR_CONTEXT_FIELD,
++			   new Band[] { field_Signature_RS },
++			   "Signature", "RSH");
++	predefineAttribute(X_ATTR_Deprecated, ATTR_CONTEXT_FIELD, null,
++			   "Deprecated", "");
++	//predefineAttribute(X_ATTR_Synthetic, ATTR_CONTEXT_FIELD, null,
++	//		   "Synthetic", "");
++	predefineAttribute(X_ATTR_OVERFLOW, ATTR_CONTEXT_FIELD, null,
++			   ".Overflow", "");
++	attrCodeEmpty =
++	predefineAttribute(METHOD_ATTR_Code, ATTR_CONTEXT_METHOD, null,
++			   "Code", "");
++	predefineAttribute(METHOD_ATTR_Exceptions, ATTR_CONTEXT_METHOD,
++			   new Band[] {
++			       method_Exceptions_N,
++			       method_Exceptions_RC
++			   },
++			   "Exceptions", "NH[RCH]");
++	assert(attrCodeEmpty == Package.attrCodeEmpty);
++	predefineAttribute(X_ATTR_Signature, ATTR_CONTEXT_METHOD,
++			   new Band[] { method_Signature_RS },
++			   "Signature", "RSH");
++	predefineAttribute(X_ATTR_Deprecated, ATTR_CONTEXT_METHOD, null,
++			   "Deprecated", "");
++	//predefineAttribute(X_ATTR_Synthetic, ATTR_CONTEXT_METHOD, null,
++	//		   "Synthetic", "");
++	predefineAttribute(X_ATTR_OVERFLOW, ATTR_CONTEXT_METHOD, null,
++			   ".Overflow", "");
+ 
+-        for (int ctype = 0; ctype < ATTR_CONTEXT_LIMIT; ctype++) {
+-            MultiBand xxx_metadata_bands = metadataBands[ctype];
+-            if (xxx_metadata_bands == null)
+-                continue;  // no code attrs
++	for (int ctype = 0; ctype < ATTR_CONTEXT_LIMIT; ctype++) {
++	    MultiBand xxx_metadata_bands = metadataBands[ctype];
++	    if (xxx_metadata_bands == null)
++		continue;  // no code attrs
+ 
+-            // These arguments cause the bands to be built
+-            // automatically for this complicated layout:
+-            predefineAttribute(X_ATTR_RuntimeVisibleAnnotations,
+-                               ATTR_CONTEXT_NAME[ctype]+"_RVA_",
+-                               xxx_metadata_bands,
+-                               Attribute.lookup(null, ctype,
+-                                                "RuntimeVisibleAnnotations"));
+-            predefineAttribute(X_ATTR_RuntimeInvisibleAnnotations,
+-                               ATTR_CONTEXT_NAME[ctype]+"_RIA_",
+-                               xxx_metadata_bands,
+-                               Attribute.lookup(null, ctype,
+-                                                "RuntimeInvisibleAnnotations"));
+-            if (ctype != ATTR_CONTEXT_METHOD)
+-                continue;
++	    // These arguments cause the bands to be built
++	    // automatically for this complicated layout:
++	    predefineAttribute(X_ATTR_RuntimeVisibleAnnotations,
++			       ATTR_CONTEXT_NAME[ctype]+"_RVA_",
++			       xxx_metadata_bands,
++			       Attribute.lookup(null, ctype,
++						"RuntimeVisibleAnnotations"));
++	    predefineAttribute(X_ATTR_RuntimeInvisibleAnnotations,
++			       ATTR_CONTEXT_NAME[ctype]+"_RIA_",
++			       xxx_metadata_bands,
++			       Attribute.lookup(null, ctype,
++						"RuntimeInvisibleAnnotations"));
++	    if (ctype != ATTR_CONTEXT_METHOD)
++		continue;
+ 
+-            predefineAttribute(METHOD_ATTR_RuntimeVisibleParameterAnnotations,
+-                               "method_RVPA_", xxx_metadata_bands,
+-                               Attribute.lookup(null, ctype,
+-                                                "RuntimeVisibleParameterAnnotations"));
+-            predefineAttribute(METHOD_ATTR_RuntimeInvisibleParameterAnnotations,
+-                               "method_RIPA_", xxx_metadata_bands,
+-                               Attribute.lookup(null, ctype,
+-                                                "RuntimeInvisibleParameterAnnotations"));
+-            predefineAttribute(METHOD_ATTR_AnnotationDefault,
+-                               "method_AD_", xxx_metadata_bands,
+-                               Attribute.lookup(null, ctype,
+-                                                "AnnotationDefault"));
+-        }
++	    predefineAttribute(METHOD_ATTR_RuntimeVisibleParameterAnnotations,
++			       "method_RVPA_", xxx_metadata_bands,
++			       Attribute.lookup(null, ctype,
++						"RuntimeVisibleParameterAnnotations"));
++	    predefineAttribute(METHOD_ATTR_RuntimeInvisibleParameterAnnotations,
++			       "method_RIPA_", xxx_metadata_bands,
++			       Attribute.lookup(null, ctype,
++						"RuntimeInvisibleParameterAnnotations"));
++	    predefineAttribute(METHOD_ATTR_AnnotationDefault,
++			       "method_AD_", xxx_metadata_bands,
++			       Attribute.lookup(null, ctype,
++						"AnnotationDefault"));
++	}
+ 
+ 
+-        Attribute.Layout stackMapDef = Attribute.lookup(null, ATTR_CONTEXT_CODE, "StackMapTable").layout();
+-        predefineAttribute(CODE_ATTR_StackMapTable, ATTR_CONTEXT_CODE,
+-                           stackmap_bands.toArray(),
+-                           stackMapDef.name(), stackMapDef.layout());
++	Attribute.Layout stackMapDef = Attribute.lookup(null, ATTR_CONTEXT_CODE, "StackMapTable").layout();
++	predefineAttribute(CODE_ATTR_StackMapTable, ATTR_CONTEXT_CODE,
++			   stackmap_bands.toArray(),
++			   stackMapDef.name(), stackMapDef.layout());
+ 
+-        predefineAttribute(CODE_ATTR_LineNumberTable, ATTR_CONTEXT_CODE,
+-                           new Band[] {
+-                               code_LineNumberTable_N,
+-                               code_LineNumberTable_bci_P,
+-                               code_LineNumberTable_line
+-                           },
+-                           "LineNumberTable", "NH[PHH]");
+-        predefineAttribute(CODE_ATTR_LocalVariableTable, ATTR_CONTEXT_CODE,
+-                           new Band[] {
+-                               code_LocalVariableTable_N,
+-                               code_LocalVariableTable_bci_P,
+-                               code_LocalVariableTable_span_O,
+-                               code_LocalVariableTable_name_RU,
+-                               code_LocalVariableTable_type_RS,
+-                               code_LocalVariableTable_slot
+-                           },
+-                           "LocalVariableTable", "NH[PHOHRUHRSHH]");
+-        predefineAttribute(CODE_ATTR_LocalVariableTypeTable, ATTR_CONTEXT_CODE,
+-                           new Band[] {
+-                               code_LocalVariableTypeTable_N,
+-                               code_LocalVariableTypeTable_bci_P,
+-                               code_LocalVariableTypeTable_span_O,
+-                               code_LocalVariableTypeTable_name_RU,
+-                               code_LocalVariableTypeTable_type_RS,
+-                               code_LocalVariableTypeTable_slot
+-                           },
+-                           "LocalVariableTypeTable", "NH[PHOHRUHRSHH]");
+-        predefineAttribute(X_ATTR_OVERFLOW, ATTR_CONTEXT_CODE, null,
+-                           ".Overflow", "");
++	predefineAttribute(CODE_ATTR_LineNumberTable, ATTR_CONTEXT_CODE,
++			   new Band[] {
++			       code_LineNumberTable_N,
++			       code_LineNumberTable_bci_P,
++			       code_LineNumberTable_line
++			   },
++			   "LineNumberTable", "NH[PHH]");
++	predefineAttribute(CODE_ATTR_LocalVariableTable, ATTR_CONTEXT_CODE,
++			   new Band[] {
++			       code_LocalVariableTable_N,
++			       code_LocalVariableTable_bci_P,
++			       code_LocalVariableTable_span_O,
++			       code_LocalVariableTable_name_RU,
++			       code_LocalVariableTable_type_RS,
++			       code_LocalVariableTable_slot
++			   },
++			   "LocalVariableTable", "NH[PHOHRUHRSHH]");
++	predefineAttribute(CODE_ATTR_LocalVariableTypeTable, ATTR_CONTEXT_CODE,
++			   new Band[] {
++			       code_LocalVariableTypeTable_N,
++			       code_LocalVariableTypeTable_bci_P,
++			       code_LocalVariableTypeTable_span_O,
++			       code_LocalVariableTypeTable_name_RU,
++			       code_LocalVariableTypeTable_type_RS,
++			       code_LocalVariableTypeTable_slot
++			   },
++			   "LocalVariableTypeTable", "NH[PHOHRUHRSHH]");
++	predefineAttribute(X_ATTR_OVERFLOW, ATTR_CONTEXT_CODE, null,
++			   ".Overflow", "");
+ 
+-        // Clear the record of having seen these definitions,
+-        // so they may be redefined without error.
+-        for (int i = 0; i < ATTR_CONTEXT_LIMIT; i++) {
+-            attrDefSeen[i] = 0;
+-        }
++	// Clear the record of having seen these definitions,
++	// so they may be redefined without error.
++	for (int i = 0; i < ATTR_CONTEXT_LIMIT; i++) {
++	    attrDefSeen[i] = 0;
++	}
+ 
+-        // Set up the special masks:
+-        for (int i = 0; i < ATTR_CONTEXT_LIMIT; i++) {
+-            attrOverflowMask[i] = (1<<X_ATTR_OVERFLOW);
+-            attrIndexLimit[i] = 0;  // will make a final decision later
+-        }
+-        attrClassFileVersionMask = (1<<CLASS_ATTR_ClassFile_version);
++	// Set up the special masks:
++	for (int i = 0; i < ATTR_CONTEXT_LIMIT; i++) {
++	    attrOverflowMask[i] = (1<<X_ATTR_OVERFLOW);
++	    attrIndexLimit[i] = 0;  // will make a final decision later
++	}
++	attrClassFileVersionMask = (1<<CLASS_ATTR_ClassFile_version);
+     }
+ 
+     private void adjustToMajver() {
+-        if (getPackageMajver() < JAVA6_PACKAGE_MAJOR_VERSION) {
+-            if (verbose > 0)  Utils.log.fine("Legacy package version");
+-            // Revoke definition of pre-1.6 attribute type.
+-            undefineAttribute(CODE_ATTR_StackMapTable, ATTR_CONTEXT_CODE);
+-        }
++	if (getPackageMajver() < JAVA6_PACKAGE_MAJOR_VERSION) {
++	    if (verbose > 0)  Utils.log.fine("Legacy package version");
++	    // Revoke definition of pre-1.6 attribute type.
++	    undefineAttribute(CODE_ATTR_StackMapTable, ATTR_CONTEXT_CODE);
++	}
+     }
+ 
+     protected void initAttrIndexLimit() {
+-        for (int i = 0; i < ATTR_CONTEXT_LIMIT; i++) {
+-            assert(attrIndexLimit[i] == 0);  // decide on it now!
+-            attrIndexLimit[i] = (haveFlagsHi(i)? 63: 32);
+-            assert(attrDefs[i].size() == 32);  // all predef indexes are <32
+-            int addMore = attrIndexLimit[i] - attrDefs[i].size();
+-            attrDefs[i].addAll(Collections.nCopies(addMore, null));
+-        }
++	for (int i = 0; i < ATTR_CONTEXT_LIMIT; i++) {
++	    assert(attrIndexLimit[i] == 0);  // decide on it now!
++	    attrIndexLimit[i] = (haveFlagsHi(i)? 63: 32);
++	    assert(attrDefs[i].size() == 32);  // all predef indexes are <32
++	    int addMore = attrIndexLimit[i] - attrDefs[i].size();
++	    attrDefs[i].addAll(Collections.nCopies(addMore, null));
++	}
+     }
+ 
+     protected boolean haveFlagsHi(int ctype) {
+-        int mask = 1<<(LG_AO_HAVE_XXX_FLAGS_HI+ctype);
+-        switch (ctype) {
+-        case ATTR_CONTEXT_CLASS:
+-            assert(mask == AO_HAVE_CLASS_FLAGS_HI); break;
+-        case ATTR_CONTEXT_FIELD:
+-            assert(mask == AO_HAVE_FIELD_FLAGS_HI); break;
+-        case ATTR_CONTEXT_METHOD:
+-            assert(mask == AO_HAVE_METHOD_FLAGS_HI); break;
+-        case ATTR_CONTEXT_CODE:
+-            assert(mask == AO_HAVE_CODE_FLAGS_HI); break;
+-        default:
+-            assert(false);
+-        }
+-        return testBit(archiveOptions, mask);
++	int mask = 1<<(LG_AO_HAVE_XXX_FLAGS_HI+ctype);
++	switch (ctype) {
++	case ATTR_CONTEXT_CLASS:
++	    assert(mask == AO_HAVE_CLASS_FLAGS_HI); break;
++	case ATTR_CONTEXT_FIELD:
++	    assert(mask == AO_HAVE_FIELD_FLAGS_HI); break;
++	case ATTR_CONTEXT_METHOD:
++	    assert(mask == AO_HAVE_METHOD_FLAGS_HI); break;
++	case ATTR_CONTEXT_CODE:
++	    assert(mask == AO_HAVE_CODE_FLAGS_HI); break;
++	default:
++	    assert(false);
++	}
++	return testBit(archiveOptions, mask);
+     }
+ 
+     protected ArrayList getPredefinedAttrs(int ctype) {
+-        assert(attrIndexLimit[ctype] != 0);
+-        ArrayList res = new ArrayList(attrIndexLimit[ctype]);
+-        // Remove nulls and non-predefs.
+-        for (int ai = 0; ai < attrIndexLimit[ctype]; ai++) {
+-            if (testBit(attrDefSeen[ctype], 1L<<ai))  continue;
+-            Attribute.Layout def = (Attribute.Layout) attrDefs[ctype].get(ai);
+-            if (def == null)  continue;  // unused flag bit
+-            assert(isPredefinedAttr(ctype, ai));
+-            res.add(def);
+-        }
+-        return res;
++	assert(attrIndexLimit[ctype] != 0);
++	ArrayList res = new ArrayList(attrIndexLimit[ctype]);
++	// Remove nulls and non-predefs.
++	for (int ai = 0; ai < attrIndexLimit[ctype]; ai++) {
++	    if (testBit(attrDefSeen[ctype], 1L<<ai))  continue;
++	    Attribute.Layout def = (Attribute.Layout) attrDefs[ctype].get(ai);
++	    if (def == null)  continue;  // unused flag bit
++	    assert(isPredefinedAttr(ctype, ai));
++	    res.add(def);
++	}
++	return res;
+     }
+ 
+     protected boolean isPredefinedAttr(int ctype, int ai) {
+-        assert(attrIndexLimit[ctype] != 0);
+-        // Overflow attrs are never predefined.
+-        if (ai >= attrIndexLimit[ctype])          return false;
+-        // If the bit is set, it was explicitly def'd.
+-        if (testBit(attrDefSeen[ctype], 1L<<ai))  return false;
+-        return (attrDefs[ctype].get(ai) != null);
++	assert(attrIndexLimit[ctype] != 0);
++	// Overflow attrs are never predefined.
++	if (ai >= attrIndexLimit[ctype])          return false;
++	// If the bit is set, it was explicitly def'd.
++	if (testBit(attrDefSeen[ctype], 1L<<ai))  return false;
++	return (attrDefs[ctype].get(ai) != null);
+     }
+ 
+     protected void adjustSpecialAttrMasks() {
+-        // Clear special masks if new definitions have been seen for them.
+-        attrClassFileVersionMask &= ~ attrDefSeen[ATTR_CONTEXT_CLASS];
+-        // It is possible to clear the overflow mask (bit 16).
+-        for (int i = 0; i < ATTR_CONTEXT_LIMIT; i++) {
+-            attrOverflowMask[i] &= ~ attrDefSeen[i];
+-        }
++	// Clear special masks if new definitions have been seen for them.
++	attrClassFileVersionMask &= ~ attrDefSeen[ATTR_CONTEXT_CLASS];
++	// It is possible to clear the overflow mask (bit 16).
++	for (int i = 0; i < ATTR_CONTEXT_LIMIT; i++) {
++	    attrOverflowMask[i] &= ~ attrDefSeen[i];
++	}
+     }
+ 
+     protected Attribute makeClassFileVersionAttr(int minver, int majver) {
+-        byte[] bytes = {
+-            (byte)(minver >> 8), (byte)minver,
+-            (byte)(majver >> 8), (byte)majver
+-        };
+-        return attrClassFileVersion.addContent(bytes);
++	byte[] bytes = {
++	    (byte)(minver >> 8), (byte)minver,
++	    (byte)(majver >> 8), (byte)majver
++	};
++	return attrClassFileVersion.addContent(bytes);
+     }
+ 
+     protected short[] parseClassFileVersionAttr(Attribute attr) {
+-        assert(attr.layout() == attrClassFileVersion);
+-        assert(attr.size() == 4);
+-        byte[] bytes = attr.bytes();
+-        int minver = ((bytes[0] & 0xFF) << 8) | (bytes[1] & 0xFF);
+-        int majver = ((bytes[2] & 0xFF) << 8) | (bytes[3] & 0xFF);
+-        return new short[]{ (short) minver, (short) majver };
++	assert(attr.layout() == attrClassFileVersion);
++	assert(attr.size() == 4);
++	byte[] bytes = attr.bytes();
++	int minver = ((bytes[0] & 0xFF) << 8) | (bytes[1] & 0xFF);
++	int majver = ((bytes[2] & 0xFF) << 8) | (bytes[3] & 0xFF);
++	return new short[]{ (short) minver, (short) majver };
+     }
+ 
+     private boolean assertBandOKForElems(Band[] ab, Attribute.Layout.Element[] elems) {
+-        for (int i = 0; i < elems.length; i++) {
+-            assert(assertBandOKForElem(ab, elems[i]));
+-        }
+-        return true;
++	for (int i = 0; i < elems.length; i++) {
++	    assert(assertBandOKForElem(ab, elems[i]));
++	}
++	return true;
+     }
+     private boolean assertBandOKForElem(Band[] ab, Attribute.Layout.Element e) {
+-        Band b = null;
+-        if (e.bandIndex != Attribute.NO_BAND_INDEX)
+-            b = ab[e.bandIndex];
+-        Coding rc = UNSIGNED5;
+-        boolean wantIntBand = true;
+-        switch (e.kind) {
+-        case Attribute.EK_INT:
+-            if (e.flagTest(Attribute.EF_SIGN)) {
+-                rc = SIGNED5;
+-            } else if (e.len == 1) {
+-                rc = BYTE1;
+-            }
+-            break;
+-        case Attribute.EK_BCI:
+-            if (!e.flagTest(Attribute.EF_DELTA)) {
+-                rc = BCI5;
+-            } else {
+-                rc = BRANCH5;
+-            }
+-            break;
+-        case Attribute.EK_BCO:
+-            rc = BRANCH5;
+-            break;
+-        case Attribute.EK_FLAG:
+-            if (e.len == 1)  rc = BYTE1;
+-            break;
+-        case Attribute.EK_REPL:
+-            if (e.len == 1)  rc = BYTE1;
+-            assertBandOKForElems(ab, e.body);
+-            break;
+-        case Attribute.EK_UN:
+-            if (e.flagTest(Attribute.EF_SIGN)) {
+-                rc = SIGNED5;
+-            } else if (e.len == 1) {
+-                rc = BYTE1;
+-            }
+-            assertBandOKForElems(ab, e.body);
+-            break;
+-        case Attribute.EK_CASE:
+-            assert(b == null);
+-            assertBandOKForElems(ab, e.body);
+-            return true;  // no direct band
+-        case Attribute.EK_CALL:
+-            assert(b == null);
+-            return true;  // no direct band
+-        case Attribute.EK_CBLE:
+-            assert(b == null);
+-            assertBandOKForElems(ab, e.body);
+-            return true;  // no direct band
+-        case Attribute.EK_REF:
+-            wantIntBand = false;
+-            assert(b instanceof CPRefBand);
+-            assert(((CPRefBand)b).nullOK == e.flagTest(Attribute.EF_NULL));
+-            break;
+-        default: assert(false);
+-        }
+-        assert(b.regularCoding == rc)
+-            : (e+" // "+b);
+-        if (wantIntBand)
+-            assert(b instanceof IntBand);
+-        return true;
++	Band b = null;
++	if (e.bandIndex != Attribute.NO_BAND_INDEX)
++	    b = ab[e.bandIndex];
++	Coding rc = UNSIGNED5;
++	boolean wantIntBand = true;
++	switch (e.kind) {
++	case Attribute.EK_INT:
++	    if (e.flagTest(Attribute.EF_SIGN)) {
++		rc = SIGNED5;
++	    } else if (e.len == 1) {
++		rc = BYTE1;
++	    }
++	    break;
++	case Attribute.EK_BCI:
++	    if (!e.flagTest(Attribute.EF_DELTA)) {
++		rc = BCI5;
++	    } else {
++		rc = BRANCH5;
++	    }
++	    break;
++	case Attribute.EK_BCO:
++	    rc = BRANCH5;
++	    break;
++	case Attribute.EK_FLAG:
++	    if (e.len == 1)  rc = BYTE1;
++	    break;
++	case Attribute.EK_REPL:
++	    if (e.len == 1)  rc = BYTE1;
++	    assertBandOKForElems(ab, e.body);
++	    break;
++	case Attribute.EK_UN:
++	    if (e.flagTest(Attribute.EF_SIGN)) {
++		rc = SIGNED5;
++	    } else if (e.len == 1) {
++		rc = BYTE1;
++	    }
++	    assertBandOKForElems(ab, e.body);
++	    break;
++	case Attribute.EK_CASE:
++	    assert(b == null);
++	    assertBandOKForElems(ab, e.body);
++	    return true;  // no direct band
++	case Attribute.EK_CALL:
++	    assert(b == null);
++	    return true;  // no direct band
++	case Attribute.EK_CBLE:
++	    assert(b == null);
++	    assertBandOKForElems(ab, e.body);
++	    return true;  // no direct band
++	case Attribute.EK_REF:
++	    wantIntBand = false;
++	    assert(b instanceof CPRefBand);
++	    assert(((CPRefBand)b).nullOK == e.flagTest(Attribute.EF_NULL));
++	    break;
++	default: assert(false);
++	}
++	assert(b.regularCoding == rc)
++	    : (e+" // "+b);
++	if (wantIntBand)
++	    assert(b instanceof IntBand);
++	return true;
+     }
+ 
+     private
+     Attribute.Layout predefineAttribute(int index, int ctype, Band[] ab,
+-                                        String name, String layout) {
+-        // Use Attribute.find to get uniquification of layouts.
+-        Attribute.Layout def = Attribute.find(ctype, name, layout).layout();
+-        //def.predef = true;
+-        if (index >= 0) {
+-            setAttributeLayoutIndex(def, index);
+-        }
+-        if (ab == null) {
+-            ab = new Band[0];
+-        }
+-        assert(attrBandTable.get(def) == null);  // no redef
+-        attrBandTable.put(def, ab);
+-        assert(def.bandCount == ab.length)
+-            : (def+" // "+Arrays.asList(ab));
+-        // Let's make sure the band types match:
+-        assert(assertBandOKForElems(ab, def.elems));
+-        return def;
++					String name, String layout) {
++	// Use Attribute.find to get uniquification of layouts.
++	Attribute.Layout def = Attribute.find(ctype, name, layout).layout();
++	//def.predef = true;
++	if (index >= 0) {
++	    setAttributeLayoutIndex(def, index);
++	}
++	if (ab == null) {
++	    ab = new Band[0];
++	}
++	assert(attrBandTable.get(def) == null);  // no redef
++	attrBandTable.put(def, ab);
++	assert(def.bandCount == ab.length)
++	    : (def+" // "+Arrays.asList(ab));
++	// Let's make sure the band types match:
++	assert(assertBandOKForElems(ab, def.elems));
++	return def;
+     }
+ 
+     // This version takes bandPrefix/addHere instead of prebuilt Band[] ab.
+     private
+     Attribute.Layout predefineAttribute(int index,
+-                                        String bandPrefix, MultiBand addHere,
+-                                        Attribute attr) {
+-        //Attribute.Layout def = Attribute.find(ctype, name, layout).layout();
+-        Attribute.Layout def = attr.layout();
+-        int ctype = def.ctype();
+-        return predefineAttribute(index, ctype,
+-                                  makeNewAttributeBands(bandPrefix, def,
+-                                                        addHere),
+-                                  def.name(), def.layout());
++					String bandPrefix, MultiBand addHere,
++					Attribute attr) {
++	//Attribute.Layout def = Attribute.find(ctype, name, layout).layout();
++	Attribute.Layout def = attr.layout();
++	int ctype = def.ctype();
++	return predefineAttribute(index, ctype,
++				  makeNewAttributeBands(bandPrefix, def,
++							addHere),
++				  def.name(), def.layout());
+     }
+ 
+     private
+     void undefineAttribute(int index, int ctype) {
+-        if (verbose > 1) {
+-            System.out.println("Removing predefined "+ATTR_CONTEXT_NAME[ctype]+
+-                               " attribute on bit "+index);
+-        }
+-        List defList = attrDefs[ctype];
+-        Attribute.Layout def = (Attribute.Layout) defList.get(index);
+-        assert(def != null);
+-        defList.set(index, null);
+-        attrIndexTable.put(def, null);
+-        // Clear the def bit.  (For predefs, it's already clear.)
+-        assert(index < 64);
+-        attrDefSeen[ctype]  &= ~(1L<<index);
+-        attrFlagMask[ctype] &= ~(1L<<index);
+-        Band[] ab = (Band[]) attrBandTable.get(def);
+-        for (int j = 0; j < ab.length; j++) {
+-            ab[j].doneWithUnusedBand();
+-        }
++	if (verbose > 1) {
++	    System.out.println("Removing predefined "+ATTR_CONTEXT_NAME[ctype]+
++			       " attribute on bit "+index);
++	}
++	List defList = attrDefs[ctype];
++	Attribute.Layout def = (Attribute.Layout) defList.get(index);
++	assert(def != null);
++	defList.set(index, null);
++	attrIndexTable.put(def, null);
++	// Clear the def bit.  (For predefs, it's already clear.)
++	assert(index < 64);
++	attrDefSeen[ctype]  &= ~(1L<<index);
++	attrFlagMask[ctype] &= ~(1L<<index);
++	Band[] ab = (Band[]) attrBandTable.get(def);
++	for (int j = 0; j < ab.length; j++) {
++	    ab[j].doneWithUnusedBand();
++	}
+     }
+ 
+     // Bands which contain non-predefined attrs.
+     protected MultiBand[] attrBands = new MultiBand[ATTR_CONTEXT_LIMIT];
+     {
+-        attrBands[ATTR_CONTEXT_CLASS] = class_attr_bands;
+-        attrBands[ATTR_CONTEXT_FIELD] = field_attr_bands;
+-        attrBands[ATTR_CONTEXT_METHOD] = method_attr_bands;
+-        attrBands[ATTR_CONTEXT_CODE] = code_attr_bands;
++	attrBands[ATTR_CONTEXT_CLASS] = class_attr_bands;
++	attrBands[ATTR_CONTEXT_FIELD] = field_attr_bands;
++	attrBands[ATTR_CONTEXT_METHOD] = method_attr_bands;
++	attrBands[ATTR_CONTEXT_CODE] = code_attr_bands;
+     }
+ 
+     // Create bands for all non-predefined attrs.
+     void makeNewAttributeBands() {
+-        // Retract special flag bit bindings, if they were taken over.
+-        adjustSpecialAttrMasks();
++	// Retract special flag bit bindings, if they were taken over.
++	adjustSpecialAttrMasks();
+ 
+-        for (int ctype = 0; ctype < ATTR_CONTEXT_LIMIT; ctype++) {
+-            String cname = ATTR_CONTEXT_NAME[ctype];
+-            MultiBand xxx_attr_bands = attrBands[ctype];
+-            long defSeen = attrDefSeen[ctype];
+-            // Note: attrDefSeen is always a subset of attrFlagMask.
+-            assert((defSeen & ~attrFlagMask[ctype]) == 0);
+-            for (int i = 0; i < attrDefs[ctype].size(); i++) {
+-                Attribute.Layout def = (Attribute.Layout)
+-                    attrDefs[ctype].get(i);
+-                if (def == null)  continue;  // unused flag bit
+-                if (def.bandCount == 0)  continue;  // empty attr
+-                if (i < attrIndexLimit[ctype] && !testBit(defSeen, 1L<<i)) {
+-                    // There are already predefined bands here.
+-                    assert(attrBandTable.get(def) != null);
+-                    continue;
+-                }
+-                int base = xxx_attr_bands.size();
+-                String pfx = cname+"_"+def.name()+"_";  // debug only
+-                if (verbose > 1)
+-                    Utils.log.fine("Making new bands for "+def);
+-                Band[] newAB  = makeNewAttributeBands(pfx, def,
+-                                                      xxx_attr_bands);
+-                assert(newAB.length == def.bandCount);
+-                Band[] prevAB = (Band[]) attrBandTable.put(def, newAB);
+-                if (prevAB != null) {
+-                    // We won't be using these predefined bands.
+-                    for (int j = 0; j < prevAB.length; j++) {
+-                        prevAB[j].doneWithUnusedBand();
+-                    }
+-                }
+-            }
+-        }
+-        //System.out.println(prevForAssertMap);
++	for (int ctype = 0; ctype < ATTR_CONTEXT_LIMIT; ctype++) {
++	    String cname = ATTR_CONTEXT_NAME[ctype];
++	    MultiBand xxx_attr_bands = attrBands[ctype];
++	    long defSeen = attrDefSeen[ctype];
++	    // Note: attrDefSeen is always a subset of attrFlagMask.
++	    assert((defSeen & ~attrFlagMask[ctype]) == 0);
++	    for (int i = 0; i < attrDefs[ctype].size(); i++) {
++		Attribute.Layout def = (Attribute.Layout)
++		    attrDefs[ctype].get(i);
++		if (def == null)  continue;  // unused flag bit
++		if (def.bandCount == 0)  continue;  // empty attr
++		if (i < attrIndexLimit[ctype] && !testBit(defSeen, 1L<<i)) {
++		    // There are already predefined bands here.
++		    assert(attrBandTable.get(def) != null);
++		    continue;
++		}
++		int base = xxx_attr_bands.size();
++		String pfx = cname+"_"+def.name()+"_";  // debug only
++		if (verbose > 1)
++		    Utils.log.fine("Making new bands for "+def);
++		Band[] newAB  = makeNewAttributeBands(pfx, def,
++						      xxx_attr_bands);
++		assert(newAB.length == def.bandCount);
++		Band[] prevAB = (Band[]) attrBandTable.put(def, newAB);
++		if (prevAB != null) {
++		    // We won't be using these predefined bands.
++		    for (int j = 0; j < prevAB.length; j++) {
++			prevAB[j].doneWithUnusedBand();
++		    }
++		}
++	    }
++	}
++	//System.out.println(prevForAssertMap);
+     }
+     private
+     Band[] makeNewAttributeBands(String pfx, Attribute.Layout def,
+-                                 MultiBand addHere) {
+-        int base = addHere.size();
+-        makeNewAttributeBands(pfx, def.elems, addHere);
+-        int nb = addHere.size() - base;
+-        Band[] newAB = new Band[nb];
+-        for (int i = 0; i < nb; i++) {
+-            newAB[i] = addHere.get(base+i);
+-        }
+-        return newAB;
++				 MultiBand addHere) {
++	int base = addHere.size();
++	makeNewAttributeBands(pfx, def.elems, addHere);
++	int nb = addHere.size() - base;
++	Band[] newAB = new Band[nb];
++	for (int i = 0; i < nb; i++) {
++	    newAB[i] = addHere.get(base+i);
++	}
++	return newAB;
+     }
+     // Recursive helper, operates on a "body" or other sequence of elems:
+     private
+     void makeNewAttributeBands(String pfx, Attribute.Layout.Element[] elems,
+-                               MultiBand ab) {
+-        for (int i = 0; i < elems.length; i++) {
+-            Attribute.Layout.Element e = elems[i];
+-            String name = pfx+ab.size()+"_"+e.layout;
+-            {
+-                int tem;
+-                if ((tem = name.indexOf('[')) > 0)
+-                    name = name.substring(0, tem);
+-                if ((tem = name.indexOf('(')) > 0)
+-                    name = name.substring(0, tem);
+-                if (name.endsWith("H"))
+-                    name = name.substring(0, name.length()-1);
+-            }
+-            Band nb;
+-            switch (e.kind) {
+-            case Attribute.EK_INT:
+-                nb = newElemBand(e, name, ab);
+-                break;
+-            case Attribute.EK_BCI:
+-                if (!e.flagTest(Attribute.EF_DELTA)) {
+-                    // PH:  transmit R(bci), store bci
+-                    nb = ab.newIntBand(name, BCI5);
+-                } else {
+-                    // POH:  transmit D(R(bci)), store bci
+-                    nb = ab.newIntBand(name, BRANCH5);
+-                }
+-                // Note:  No case for BYTE1 here.
+-                break;
+-            case Attribute.EK_BCO:
+-                // OH:  transmit D(R(bci)), store D(bci)
+-                nb = ab.newIntBand(name, BRANCH5);
+-                // Note:  No case for BYTE1 here.
+-                break;
+-            case Attribute.EK_FLAG:
+-                assert(!e.flagTest(Attribute.EF_SIGN));
+-                nb = newElemBand(e, name, ab);
+-                break;
+-            case Attribute.EK_REPL:
+-                assert(!e.flagTest(Attribute.EF_SIGN));
+-                nb = newElemBand(e, name, ab);
+-                makeNewAttributeBands(pfx, e.body, ab);
+-                break;
+-            case Attribute.EK_UN:
+-                nb = newElemBand(e, name, ab);
+-                makeNewAttributeBands(pfx, e.body, ab);
+-                break;
+-            case Attribute.EK_CASE:
+-                if (!e.flagTest(Attribute.EF_BACK)) {
+-                    // If it's not a duplicate body, make the bands.
+-                    makeNewAttributeBands(pfx, e.body, ab);
+-                }
+-                continue;  // no new band to make
+-            case Attribute.EK_REF:
+-                byte    refKind = e.refKind;
+-                boolean nullOK  = e.flagTest(Attribute.EF_NULL);
+-                nb = ab.newCPRefBand(name, UNSIGNED5, refKind, nullOK);
+-                // Note:  No case for BYTE1 here.
+-                break;
+-            case Attribute.EK_CALL:
+-                continue;  // no new band to make
+-            case Attribute.EK_CBLE:
+-                makeNewAttributeBands(pfx, e.body, ab);
+-                continue;  // no new band to make
+-            default: assert(false); continue;
+-            }
+-            if (verbose > 1) {
+-                Utils.log.fine("New attribute band "+nb);
+-            }
+-        }
++			       MultiBand ab) {
++	for (int i = 0; i < elems.length; i++) {
++	    Attribute.Layout.Element e = elems[i];
++	    String name = pfx+ab.size()+"_"+e.layout;
++	    {
++		int tem;
++		if ((tem = name.indexOf('[')) > 0)
++		    name = name.substring(0, tem);
++		if ((tem = name.indexOf('(')) > 0)
++		    name = name.substring(0, tem);
++		if (name.endsWith("H"))
++		    name = name.substring(0, name.length()-1);
++	    }
++	    Band nb;
++	    switch (e.kind) {
++	    case Attribute.EK_INT:
++		nb = newElemBand(e, name, ab);
++		break;
++	    case Attribute.EK_BCI:
++		if (!e.flagTest(Attribute.EF_DELTA)) {
++		    // PH:  transmit R(bci), store bci
++		    nb = ab.newIntBand(name, BCI5);
++		} else {
++		    // POH:  transmit D(R(bci)), store bci
++		    nb = ab.newIntBand(name, BRANCH5);
++		}
++		// Note:  No case for BYTE1 here.
++		break;
++	    case Attribute.EK_BCO:
++		// OH:  transmit D(R(bci)), store D(bci)
++		nb = ab.newIntBand(name, BRANCH5);
++		// Note:  No case for BYTE1 here.
++		break;
++	    case Attribute.EK_FLAG:
++		assert(!e.flagTest(Attribute.EF_SIGN));
++		nb = newElemBand(e, name, ab);
++		break;
++	    case Attribute.EK_REPL:
++		assert(!e.flagTest(Attribute.EF_SIGN));
++		nb = newElemBand(e, name, ab);
++		makeNewAttributeBands(pfx, e.body, ab);
++		break;
++	    case Attribute.EK_UN:
++		nb = newElemBand(e, name, ab);
++		makeNewAttributeBands(pfx, e.body, ab);
++		break;
++	    case Attribute.EK_CASE:
++		if (!e.flagTest(Attribute.EF_BACK)) {
++		    // If it's not a duplicate body, make the bands.
++		    makeNewAttributeBands(pfx, e.body, ab);
++		}
++		continue;  // no new band to make
++	    case Attribute.EK_REF:
++		byte    refKind = e.refKind;
++		boolean nullOK  = e.flagTest(Attribute.EF_NULL);
++		nb = ab.newCPRefBand(name, UNSIGNED5, refKind, nullOK);
++		// Note:  No case for BYTE1 here.
++		break;
++	    case Attribute.EK_CALL:
++		continue;  // no new band to make
++	    case Attribute.EK_CBLE:
++		makeNewAttributeBands(pfx, e.body, ab);
++		continue;  // no new band to make
++	    default: assert(false); continue;
++	    }
++	    if (verbose > 1) {
++		Utils.log.fine("New attribute band "+nb);
++	    }
++	}
+     }
+     private
+     Band newElemBand(Attribute.Layout.Element e, String name, MultiBand ab) {
+-        if (e.flagTest(Attribute.EF_SIGN)) {
+-            return ab.newIntBand(name, SIGNED5);
+-        } else if (e.len == 1) {
+-            return ab.newIntBand(name, BYTE1);  // Not ByteBand, please.
+-        } else {
+-            return ab.newIntBand(name, UNSIGNED5);
+-        }
++	if (e.flagTest(Attribute.EF_SIGN)) {
++	    return ab.newIntBand(name, SIGNED5);
++	} else if (e.len == 1) {
++	    return ab.newIntBand(name, BYTE1);  // Not ByteBand, please.
++	} else {
++	    return ab.newIntBand(name, UNSIGNED5);
++	}
+     }
+ 
+     protected int setAttributeLayoutIndex(Attribute.Layout def, int index) {
+-        int ctype = def.ctype;
+-        assert(ATTR_INDEX_OVERFLOW <= index && index < attrIndexLimit[ctype]);
+-        List defList = attrDefs[ctype];
+-        if (index == ATTR_INDEX_OVERFLOW) {
+-            // Overflow attribute.
+-            index = defList.size();
+-            defList.add(def);
+-            if (verbose > 0)
+-                Utils.log.info("Adding new attribute at "+def +": "+index);
+-            attrIndexTable.put(def, new Integer(index));
+-            return index;
+-        }
++	int ctype = def.ctype;
++	assert(ATTR_INDEX_OVERFLOW <= index && index < attrIndexLimit[ctype]);
++	List defList = attrDefs[ctype];
++	if (index == ATTR_INDEX_OVERFLOW) {
++	    // Overflow attribute.
++	    index = defList.size();
++	    defList.add(def);
++	    if (verbose > 0)
++		Utils.log.info("Adding new attribute at "+def +": "+index);
++	    attrIndexTable.put(def, new Integer(index));
++	    return index;
++	}
+ 
+-        // Detect redefinitions:
+-        if (testBit(attrDefSeen[ctype], 1L<<index)) {
+-            throw new RuntimeException("Multiple explicit definition at "+index+": "+def);
+-        }
+-        attrDefSeen[ctype] |= (1L<<index);
++	// Detect redefinitions:
++	if (testBit(attrDefSeen[ctype], 1L<<index)) {
++	    throw new RuntimeException("Multiple explicit definition at "+index+": "+def);
++	}
++	attrDefSeen[ctype] |= (1L<<index);
+ 
+-        // Adding a new fixed attribute.
+-        assert(0 <= index && index < attrIndexLimit[ctype]);
+-        if (verbose > (attrClassFileVersionMask == 0? 2:0))
+-            Utils.log.fine("Fixing new attribute at "+index
+-                               +": "+def
+-                               +(defList.get(index) == null? "":
+-                                 "; replacing "+defList.get(index)));
+-        attrFlagMask[ctype] |= (1L<<index);
+-        // Remove index binding of any previous fixed attr.
+-        attrIndexTable.put(defList.get(index), null);
+-        defList.set(index, def);
+-        attrIndexTable.put(def, new Integer(index));
+-        return index;
++	// Adding a new fixed attribute.
++	assert(0 <= index && index < attrIndexLimit[ctype]);
++	if (verbose > (attrClassFileVersionMask == 0? 2:0))
++	    Utils.log.fine("Fixing new attribute at "+index
++			       +": "+def
++			       +(defList.get(index) == null? "":
++				 "; replacing "+defList.get(index)));
++	attrFlagMask[ctype] |= (1L<<index);
++	// Remove index binding of any previous fixed attr.
++	attrIndexTable.put(defList.get(index), null);
++	defList.set(index, def);
++	attrIndexTable.put(def, new Integer(index));
++	return index;
+     }
+ 
+     // encodings found in the code_headers band
+     private static final int[][] shortCodeLimits = {
+-        { 12, 12 }, // s<12, l<12, e=0 [1..144]
+-        {  8,  8 }, //  s<8,  l<8, e=1 [145..208]
+-        {  7,  7 }, //  s<7,  l<7, e=2 [209..256]
++	{ 12, 12 }, // s<12, l<12, e=0 [1..144]
++	{  8,  8 }, //  s<8,  l<8, e=1 [145..208]
++	{  7,  7 }, //  s<7,  l<7, e=2 [209..256]
+     };
+     public final int shortCodeHeader_h_limit = shortCodeLimits.length;
+ 
+     // return 0 if it won't encode, else a number in [1..255]
+     static int shortCodeHeader(Code code) {
+-        int s = code.max_stack;
+-        int l0 = code.max_locals;
+-        int h = code.handler_class.length;
+-        if (h >= shortCodeLimits.length)  return LONG_CODE_HEADER;
+-        int siglen = code.getMethod().getArgumentSize();
+-        assert(l0 >= siglen);  // enough locals for signature!
+-        if (l0 < siglen)  return LONG_CODE_HEADER;
+-        int l1 = l0 - siglen;  // do not count locals required by the signature
+-        int lims = shortCodeLimits[h][0];
+-        int liml = shortCodeLimits[h][1];
+-        if (s >= lims || l1 >= liml)  return LONG_CODE_HEADER;
+-        int sc = shortCodeHeader_h_base(h);
+-        sc += s + lims*l1;
+-        if (sc > 255)  return LONG_CODE_HEADER;
+-        assert(shortCodeHeader_max_stack(sc) == s);
+-        assert(shortCodeHeader_max_na_locals(sc) == l1);
+-        assert(shortCodeHeader_handler_count(sc) == h);
+-        return sc;
++	int s = code.max_stack;
++	int l0 = code.max_locals;
++	int h = code.handler_class.length;
++	if (h >= shortCodeLimits.length)  return LONG_CODE_HEADER;
++	int siglen = code.getMethod().getArgumentSize();
++	assert(l0 >= siglen);  // enough locals for signature!
++	if (l0 < siglen)  return LONG_CODE_HEADER;
++	int l1 = l0 - siglen;  // do not count locals required by the signature
++	int lims = shortCodeLimits[h][0];
++	int liml = shortCodeLimits[h][1];
++	if (s >= lims || l1 >= liml)  return LONG_CODE_HEADER;
++	int sc = shortCodeHeader_h_base(h);
++	sc += s + lims*l1;
++	if (sc > 255)  return LONG_CODE_HEADER;
++	assert(shortCodeHeader_max_stack(sc) == s);
++	assert(shortCodeHeader_max_na_locals(sc) == l1);
++	assert(shortCodeHeader_handler_count(sc) == h);
++	return sc;
+     }
+ 
+     static final int LONG_CODE_HEADER = 0;
+     static int shortCodeHeader_handler_count(int sc) {
+-        assert(sc > 0 && sc <= 255);
+-        for (int h = 0; ; h++) {
+-            if (sc < shortCodeHeader_h_base(h+1))
+-                return h;
+-        }
++	assert(sc > 0 && sc <= 255);
++	for (int h = 0; ; h++) {
++	    if (sc < shortCodeHeader_h_base(h+1))
++		return h;
++	}
+     }
+     static int shortCodeHeader_max_stack(int sc) {
+-        int h = shortCodeHeader_handler_count(sc);
+-        int lims = shortCodeLimits[h][0];
+-        return (sc - shortCodeHeader_h_base(h)) % lims;
++	int h = shortCodeHeader_handler_count(sc);
++	int lims = shortCodeLimits[h][0];
++	return (sc - shortCodeHeader_h_base(h)) % lims;
+     }
+     static int shortCodeHeader_max_na_locals(int sc) {
+-        int h = shortCodeHeader_handler_count(sc);
+-        int lims = shortCodeLimits[h][0];
+-        return (sc - shortCodeHeader_h_base(h)) / lims;
++	int h = shortCodeHeader_handler_count(sc);
++	int lims = shortCodeLimits[h][0];
++	return (sc - shortCodeHeader_h_base(h)) / lims;
+     }
+ 
+     private static int shortCodeHeader_h_base(int h) {
+-        assert(h <= shortCodeLimits.length);
+-        int sc = 1;
+-        for (int h0 = 0; h0 < h; h0++) {
+-            int lims = shortCodeLimits[h0][0];
+-            int liml = shortCodeLimits[h0][1];
+-            sc += lims * liml;
+-        }
+-        return sc;
++	assert(h <= shortCodeLimits.length);
++	int sc = 1;
++	for (int h0 = 0; h0 < h; h0++) {
++	    int lims = shortCodeLimits[h0][0];
++	    int liml = shortCodeLimits[h0][1];
++	    sc += lims * liml;
++	}
++	return sc;
+     }
+ 
+     // utilities for accessing the bc_label band:
+     protected void putLabel(IntBand bc_label, Code c, int pc, int targetPC) {
+-        bc_label.putInt(c.encodeBCI(targetPC) - c.encodeBCI(pc));
++	bc_label.putInt(c.encodeBCI(targetPC) - c.encodeBCI(pc));
+     }
+     protected int getLabel(IntBand bc_label, Code c, int pc) {
+-        return c.decodeBCI(bc_label.getInt() + c.encodeBCI(pc));
++	return c.decodeBCI(bc_label.getInt() + c.encodeBCI(pc));
+     }
+ 
+     protected CPRefBand getCPRefOpBand(int bc) {
+-        switch (Instruction.getCPRefOpTag(bc)) {
+-        case CONSTANT_Class:
+-            return bc_classref;
+-        case CONSTANT_Fieldref:
+-            return bc_fieldref;
+-        case CONSTANT_Methodref:
+-            return bc_methodref;
+-        case CONSTANT_InterfaceMethodref:
+-            return bc_imethodref;
+-        case CONSTANT_Literal:
+-            switch (bc) {
+-            case _ildc: case _ildc_w:
+-                return bc_intref;
+-            case _fldc: case _fldc_w:
+-                return bc_floatref;
+-            case _lldc2_w:
+-                return bc_longref;
+-            case _dldc2_w:
+-                return bc_doubleref;
+-            case _aldc: case _aldc_w:
+-                return bc_stringref;
+-            case _cldc: case _cldc_w:
+-                return bc_classref;
+-            }
+-            break;
+-        }
+-        assert(false);
+-        return null;
++	switch (Instruction.getCPRefOpTag(bc)) {
++	case CONSTANT_Class:
++	    return bc_classref;
++	case CONSTANT_Fieldref:
++	    return bc_fieldref;
++	case CONSTANT_Methodref:
++	    return bc_methodref;
++	case CONSTANT_InterfaceMethodref:
++	    return bc_imethodref;
++	case CONSTANT_Literal:
++	    switch (bc) {
++	    case _ildc: case _ildc_w:
++		return bc_intref;
++	    case _fldc: case _fldc_w:
++		return bc_floatref;
++	    case _lldc2_w:
++		return bc_longref;
++	    case _dldc2_w:
++		return bc_doubleref;
++	    case _aldc: case _aldc_w:
++		return bc_stringref;
++	    case _cldc: case _cldc_w:
++		return bc_classref;
++	    }
++	    break;
++	}
++	assert(false);
++	return null;
+     }
+ 
+     protected CPRefBand selfOpRefBand(int self_bc) {
+-        assert(Instruction.isSelfLinkerOp(self_bc));
+-        int idx = (self_bc - _self_linker_op);
+-        boolean isSuper = (idx >= _self_linker_super_flag);
+-        if (isSuper)  idx -= _self_linker_super_flag;
+-        boolean isAload = (idx >= _self_linker_aload_flag);
+-        if (isAload)  idx -= _self_linker_aload_flag;
+-        int origBC = _first_linker_op + idx;
+-        boolean isField = Instruction.isFieldOp(origBC);
+-        if (!isSuper)
+-            return isField? bc_thisfield: bc_thismethod;
+-        else
+-            return isField? bc_superfield: bc_supermethod;
++	assert(Instruction.isSelfLinkerOp(self_bc));
++	int idx = (self_bc - _self_linker_op);
++	boolean isSuper = (idx >= _self_linker_super_flag);
++	if (isSuper)  idx -= _self_linker_super_flag;
++	boolean isAload = (idx >= _self_linker_aload_flag);
++	if (isAload)  idx -= _self_linker_aload_flag;
++	int origBC = _first_linker_op + idx;
++	boolean isField = Instruction.isFieldOp(origBC);
++	if (!isSuper)
++	    return isField? bc_thisfield: bc_thismethod;
++	else
++	    return isField? bc_superfield: bc_supermethod;
+     }
+ 
+     ////////////////////////////////////////////////////////////////////
+@@ -2347,317 +2347,319 @@ class BandStructure implements Constants
+     static int nextSeqForDebug;
+     static File dumpDir;
+     static OutputStream getDumpStream(Band b, String ext) throws IOException {
+-        return getDumpStream(b.name, b.seqForDebug, ext, b);
++	return getDumpStream(b.name, b.seqForDebug, ext, b);
+     }
+     static OutputStream getDumpStream(Index ix, String ext) throws IOException {
+-        if (ix.size() == 0)  return new ByteArrayOutputStream();
+-        int seq = ConstantPool.TAG_ORDER[ix.cpMap[0].tag];
+-        return getDumpStream(ix.debugName, seq, ext, ix);
++	if (ix.size() == 0)  return new ByteArrayOutputStream();
++	int seq = ConstantPool.TAG_ORDER[ix.cpMap[0].tag];
++	return getDumpStream(ix.debugName, seq, ext, ix);
+     }
+     static OutputStream getDumpStream(String name, int seq, String ext, Object b) throws IOException {
+-        if (dumpDir == null) {
+-            dumpDir = File.createTempFile("BD_", "", new File("."));
+-            dumpDir.delete();
+-            if (dumpDir.mkdir())
+-                Utils.log.info("Dumping bands to "+dumpDir);
+-        }
+-        name = name.replace('(', ' ').replace(')', ' ');
+-        name = name.replace('/', ' ');
+-        name = name.replace('*', ' ');
+-        name = name.trim().replace(' ','_');
+-        name = ((10000+seq) + "_" + name).substring(1);
+-        File dumpFile = new File(dumpDir, name+ext);
+-        Utils.log.info("Dumping "+b+" to "+dumpFile);
+-        return new BufferedOutputStream(new FileOutputStream(dumpFile));
++	if (dumpDir == null) {
++	    dumpDir = File.createTempFile("BD_", "", new File("."));
++	    dumpDir.delete();
++	    if (dumpDir.mkdir())
++		Utils.log.info("Dumping bands to "+dumpDir);
++	}
++	name = name.replace('(', ' ').replace(')', ' ');
++	name = name.replace('/', ' ');
++	name = name.replace('*', ' ');
++	name = name.trim().replace(' ','_');
++	name = ((10000+seq) + "_" + name).substring(1);
++	File dumpFile = new File(dumpDir, name+ext);
++	Utils.log.info("Dumping "+b+" to "+dumpFile);
++	return new BufferedOutputStream(new FileOutputStream(dumpFile));
+     }
+ 
+     // DEBUG ONLY:  Validate me at each length change.
+     static boolean assertCanChangeLength(Band b) {
+-        switch (b.phase) {
+-        case COLLECT_PHASE:
+-        case READ_PHASE:
+-            return true;
+-        }
+-        return false;
++	switch (b.phase) {
++	case COLLECT_PHASE:
++	case READ_PHASE:
++	    return true;
++	}
++	return false;
+     }
+ 
+     // DEBUG ONLY:  Validate a phase.
+     static boolean assertPhase(Band b, int phaseExpected) {
+-        if (b.phase() != phaseExpected) {
+-            Utils.log.warning("phase expected "+phaseExpected+" was "+b.phase()+" in "+b);
+-            return false;
+-        }
+-        return true;
++	if (b.phase() != phaseExpected) {
++	    Utils.log.warning("phase expected "+phaseExpected+" was "+b.phase()+" in "+b);
++	    return false;
++	}
++	return true;
+     }
+ 
+ 
+     // DEBUG ONLY:  Tells whether verbosity is turned on.
+     static int verbose() {
+-        return Utils.currentPropMap().getInteger(Utils.DEBUG_VERBOSE);
++	return Utils.currentPropMap().getInteger(Utils.DEBUG_VERBOSE);
+     }
+ 
+ 
+     // DEBUG ONLY:  Validate me at each phase change.
+     static boolean assertPhaseChangeOK(Band b, int p0, int p1) {
+-        switch (p0*10+p1) {
+-        /// Writing phases:
+-        case NO_PHASE*10+COLLECT_PHASE:
+-            // Ready to collect data from the input classes.
+-            assert(!b.isReader());
+-            assert(b.capacity() >= 0);
+-            assert(b.length() == 0);
+-            return true;
+-        case COLLECT_PHASE*10+FROZEN_PHASE:
+-        case FROZEN_PHASE*10+FROZEN_PHASE:
+-            assert(b.length() == 0);
+-            return true;
+-        case COLLECT_PHASE*10+WRITE_PHASE:
+-        case FROZEN_PHASE*10+WRITE_PHASE:
+-            // Data is all collected.  Ready to write bytes to disk.
+-            return true;
+-        case WRITE_PHASE*10+DONE_PHASE:
+-            // Done writing to disk.  Ready to reset, in principle.
+-            return true;
++	switch (p0*10+p1) {
++	/// Writing phases:
++	case NO_PHASE*10+COLLECT_PHASE:
++	    // Ready to collect data from the input classes.
++	    assert(!b.isReader());
++	    assert(b.capacity() >= 0);
++	    assert(b.length() == 0);
++	    return true;
++	case COLLECT_PHASE*10+FROZEN_PHASE:
++	case FROZEN_PHASE*10+FROZEN_PHASE:
++	    assert(b.length() == 0);
++	    return true;
++	case COLLECT_PHASE*10+WRITE_PHASE:
++	case FROZEN_PHASE*10+WRITE_PHASE:
++	    // Data is all collected.  Ready to write bytes to disk.
++	    return true;
++	case WRITE_PHASE*10+DONE_PHASE:
++	    // Done writing to disk.  Ready to reset, in principle.
++	    return true;
+ 
+-        /// Reading phases:
+-        case NO_PHASE*10+EXPECT_PHASE:
+-            assert(b.isReader());
+-            assert(b.capacity() < 0);
+-            return true;
+-        case EXPECT_PHASE*10+READ_PHASE:
+-            // Ready to read values from disk.
+-            assert(Math.max(0,b.capacity()) >= b.valuesExpected());
+-            assert(b.length() <= 0);
+-            return true;
+-        case READ_PHASE*10+DISBURSE_PHASE:
+-            // Ready to disburse values.
+-            assert(b.valuesRemainingForDebug() == b.length());
+-            return true;
+-        case DISBURSE_PHASE*10+DONE_PHASE:
+-            // Done disbursing values.  Ready to reset, in principle.
+-            assert(assertDoneDisbursing(b));
+-            return true;
+-        }
+-        if (p0 == p1)
+-            Utils.log.warning("Already in phase "+p0);
+-        else
+-            Utils.log.warning("Unexpected phase "+p0+" -> "+p1);
+-        return false;
++	/// Reading phases:
++	case NO_PHASE*10+EXPECT_PHASE:
++	    assert(b.isReader());
++	    assert(b.capacity() < 0);
++	    return true;
++	case EXPECT_PHASE*10+READ_PHASE:
++	    // Ready to read values from disk.
++	    assert(Math.max(0,b.capacity()) >= b.valuesExpected());
++	    assert(b.length() <= 0);
++	    return true;
++	case READ_PHASE*10+DISBURSE_PHASE:
++	    // Ready to disburse values.
++	    assert(b.valuesRemainingForDebug() == b.length());
++	    return true;
++	case DISBURSE_PHASE*10+DONE_PHASE:
++	    // Done disbursing values.  Ready to reset, in principle.
++	    assert(assertDoneDisbursing(b));
++	    return true;
++	}
++	if (p0 == p1)
++	    Utils.log.warning("Already in phase "+p0);
++	else
++	    Utils.log.warning("Unexpected phase "+p0+" -> "+p1);
++	return false;
+     }
+ 
+     static private boolean assertDoneDisbursing(Band b) {
+-        if (b.phase != DISBURSE_PHASE) {
+-            Utils.log.warning("assertDoneDisbursing: still in phase "+b.phase+": "+b);
+-            if (verbose() <= 1)  return false;  // fail now
+-        }
+-        int left = b.valuesRemainingForDebug();
+-        if (left > 0) {
+-            Utils.log.warning("assertDoneDisbursing: "+left+" values left in "+b);
+-            if (verbose() <= 1)  return false;  // fail now
+-        }
+-        if (b instanceof MultiBand) {
+-            MultiBand mb = (MultiBand) b;
+-            for (int i = 0; i < mb.bandCount; i++) {
+-                Band sub = mb.bands[i];
+-                if (sub.phase != DONE_PHASE) {
+-                    Utils.log.warning("assertDoneDisbursing: sub-band still in phase "+sub.phase+": "+sub);
+-                    if (verbose() <= 1)  return false;  // fail now
+-                }
+-            }
+-        }
+-        return true;
++	if (b.phase != DISBURSE_PHASE) {
++	    Utils.log.warning("assertDoneDisbursing: still in phase "+b.phase+": "+b);
++	    if (verbose() <= 1)  return false;  // fail now
++	}
++	int left = b.valuesRemainingForDebug();
++	if (left > 0) {
++	    Utils.log.warning("assertDoneDisbursing: "+left+" values left in "+b);
++	    if (verbose() <= 1)  return false;  // fail now
++	}
++	if (b instanceof MultiBand) {
++	    MultiBand mb = (MultiBand) b;
++	    for (int i = 0; i < mb.bandCount; i++) {
++		Band sub = mb.bands[i];
++		if (sub.phase != DONE_PHASE) {
++		    Utils.log.warning("assertDoneDisbursing: sub-band still in phase "+sub.phase+": "+sub);
++		    if (verbose() <= 1)  return false;  // fail now
++		}
++	    }
++	}
++	return true;
+     }
+ 
+     static private void printCDecl(Band b) {
+-        if (b instanceof MultiBand) {
+-            MultiBand mb = (MultiBand) b;
+-            for (int i = 0; i < mb.bandCount; i++) {
+-                printCDecl(mb.bands[i]);
+-            }
+-            return;
+-        }
+-        String ixS = "NULL";
+-        if (b instanceof CPRefBand) {
+-            Index ix = ((CPRefBand)b).index;
+-            if (ix != null)  ixS = "INDEX("+ix.debugName+")";
+-        }
+-        Coding[] knownc = { BYTE1, CHAR3, BCI5, BRANCH5, UNSIGNED5,
+-                            UDELTA5, SIGNED5, DELTA5, MDELTA5 };
+-        String[] knowns = { "BYTE1", "CHAR3", "BCI5", "BRANCH5", "UNSIGNED5",
+-                            "UDELTA5", "SIGNED5", "DELTA5", "MDELTA5" };
+-        Coding rc = b.regularCoding;
+-        int rci = Arrays.asList(knownc).indexOf(rc);
+-        String cstr;
+-        if (rci >= 0)
+-            cstr = knowns[rci];
+-        else
+-            cstr = "CODING"+rc.keyString();
+-        System.out.println("  BAND_INIT(\""+b.name()+"\""
+-                           +", "+cstr+", "+ixS+"),");
++	if (b instanceof MultiBand) {
++	    MultiBand mb = (MultiBand) b;
++	    for (int i = 0; i < mb.bandCount; i++) {
++		printCDecl(mb.bands[i]);
++	    }
++	    return;
++	}
++	String ixS = "NULL";
++	if (b instanceof CPRefBand) {
++	    Index ix = ((CPRefBand)b).index;
++	    if (ix != null)  ixS = "INDEX("+ix.debugName+")";
++	}
++	Coding[] knownc = { BYTE1, CHAR3, BCI5, BRANCH5, UNSIGNED5,
++			    UDELTA5, SIGNED5, DELTA5, MDELTA5 };
++	String[] knowns = { "BYTE1", "CHAR3", "BCI5", "BRANCH5", "UNSIGNED5",
++			    "UDELTA5", "SIGNED5", "DELTA5", "MDELTA5" };
++	Coding rc = b.regularCoding;
++	int rci = Arrays.asList(knownc).indexOf(rc);
++	String cstr;
++	if (rci >= 0)
++	    cstr = knowns[rci];
++	else
++	    cstr = "CODING"+rc.keyString();
++	System.out.println("  BAND_INIT(\""+b.name()+"\""
++			   +", "+cstr+", "+ixS+"),");
+     }
+ 
+     private HashMap prevForAssertMap;
+ 
+     // DEBUG ONLY:  Record something about the band order.
+     boolean notePrevForAssert(Band b, Band p) {
+-        if (prevForAssertMap == null)
+-            prevForAssertMap = new HashMap();
+-        prevForAssertMap.put(b, p);
+-        return true;
++	if (prevForAssertMap == null)
++	    prevForAssertMap = new HashMap();
++	prevForAssertMap.put(b, p);
++	return true;
+     }
+ 
+     // DEBUG ONLY:  Validate next input band.
+     private boolean assertReadyToReadFrom(Band b, InputStream in) throws IOException {
+-        Band p = (Band) prevForAssertMap.get(b);
+-        // Any previous band must be done reading before this one starts.
+-        if (p != null && phaseCmp(p.phase(), DISBURSE_PHASE) < 0) {
+-            Utils.log.warning("Previous band not done reading.");
+-            Utils.log.info("    Previous band: "+p);
+-            Utils.log.info("        Next band: "+b);
+-            Thread.dumpStack();
+-            assert(verbose > 0);  // die unless verbose is true
+-        }
+-        String name = b.name;
+-        if (optDebugBands && !name.startsWith("(")) {
+-            // Verify synchronization between reader & writer:
+-            StringBuffer buf = new StringBuffer();
+-            int ch;
+-            while ((ch = in.read()) > 0)
+-                buf.append((char)ch);
+-            String inName = buf.toString();
+-            if (!inName.equals(name)) {
+-                StringBuffer sb = new StringBuffer();
+-                sb.append("Expected "+name+" but read: ");
+-                inName += (char)ch;
+-                while (inName.length() < 10)
+-                    inName += (char)in.read();
+-                for (int i = 0; i < inName.length(); i++)
+-                    sb.append(inName.charAt(i));
+-                Utils.log.warning(sb.toString());
+-                return false;
+-            }
+-        }
+-        return true;
++	Band p = (Band) prevForAssertMap.get(b);
++	// Any previous band must be done reading before this one starts.
++	if (p != null && phaseCmp(p.phase(), DISBURSE_PHASE) < 0) {
++	    Utils.log.warning("Previous band not done reading.");
++	    Utils.log.info("    Previous band: "+p);
++	    Utils.log.info("        Next band: "+b);
++	    Thread.dumpStack();
++	    assert(verbose > 0);  // die unless verbose is true
++	}
++	String name = b.name;
++	if (optDebugBands && !name.startsWith("(")) {
++	    // Verify synchronization between reader & writer:
++	    StringBuffer buf = new StringBuffer();
++	    int ch;
++	    while ((ch = in.read()) > 0)
++		buf.append((char)ch);
++	    String inName = buf.toString();
++	    if (!inName.equals(name)) {
++		StringBuffer sb = new StringBuffer();
++		sb.append("Expected "+name+" but read: ");
++		inName += (char)ch;
++		while (inName.length() < 10)
++		    inName += (char)in.read();
++		for (int i = 0; i < inName.length(); i++)
++		    sb.append(inName.charAt(i));
++		Utils.log.warning(sb.toString());
++		return false;
++	    }
++	}
++	return true;
+     }
+ 
+     // DEBUG ONLY:  Make sure a bunch of cprefs are correct.
+     private boolean assertValidCPRefs(CPRefBand b) {
+-        if (b.index == null)  return true;
+-        int limit = b.index.size()+1;
+-        for (int i = 0; i < b.length(); i++) {
+-            int v = b.valueAtForDebug(i);
+-            if (v < 0 || v >= limit) {
+-                Utils.log.warning("CP ref out of range "+
+-                                   "["+i+"] = "+v+" in "+b);
+-                return false;
+-            }
+-        }
+-        return true;
++	if (b.index == null)  return true;
++	int limit = b.index.size()+1;
++	for (int i = 0; i < b.length(); i++) {
++	    int v = b.valueAtForDebug(i);
++	    if (v < 0 || v >= limit) {
++		Utils.log.warning("CP ref out of range "+
++				   "["+i+"] = "+v+" in "+b);
++		return false;
++	    }
++	}
++	return true;
+     }
+ 
+     // DEBUG ONLY:  Maybe write a debugging cookie to next output band.
+     private boolean assertReadyToWriteTo(Band b, OutputStream out) throws IOException {
+-        Band p = (Band) prevForAssertMap.get(b);
+-        // Any previous band must be done writing before this one starts.
+-        if (p != null && phaseCmp(p.phase(), DONE_PHASE) < 0) {
+-            Utils.log.warning("Previous band not done writing.");
+-            Utils.log.info("    Previous band: "+p);
+-            Utils.log.info("        Next band: "+b);
+-            Thread.dumpStack();
+-            assert(verbose > 0);  // die unless verbose is true
+-        }
+-        String name = b.name;
+-        if (optDebugBands && !name.startsWith("(")) {
+-            // Verify synchronization between reader & writer:
+-            for (int j = 0; j < name.length(); j++) {
+-                out.write((byte)name.charAt(j));
+-            }
+-            out.write((byte)0);
+-        }
+-        return true;
++	Band p = (Band) prevForAssertMap.get(b);
++	// Any previous band must be done writing before this one starts.
++	if (p != null && phaseCmp(p.phase(), DONE_PHASE) < 0) {
++	    Utils.log.warning("Previous band not done writing.");
++	    Utils.log.info("    Previous band: "+p);
++	    Utils.log.info("        Next band: "+b);
++	    Thread.dumpStack();
++	    assert(verbose > 0);  // die unless verbose is true
++	}
++	String name = b.name;
++	if (optDebugBands && !name.startsWith("(")) {
++	    // Verify synchronization between reader & writer:
++	    for (int j = 0; j < name.length(); j++) {
++		out.write((byte)name.charAt(j));
++	    }
++	    out.write((byte)0);
++	}
++	return true;
+     }
+ 
+     protected static boolean testBit(int flags, int bitMask) {
+-        return (flags & bitMask) != 0;
++	return (flags & bitMask) != 0;
+     }
+     protected static int setBit(int flags, int bitMask, boolean z) {
+-        return z ? (flags | bitMask) : (flags &~ bitMask);
++	return z ? (flags | bitMask) : (flags &~ bitMask);
+     }
+     protected static boolean testBit(long flags, long bitMask) {
+-        return (flags & bitMask) != 0;
++	return (flags & bitMask) != 0;
+     }
+     protected static long setBit(long flags, long bitMask, boolean z) {
+-        return z ? (flags | bitMask) : (flags &~ bitMask);
++	return z ? (flags | bitMask) : (flags &~ bitMask);
+     }
+ 
+ 
+     static void printArrayTo(PrintStream ps, int[] values, int start, int end) {
+-        int len = end-start;
+-        for (int i = 0; i < len; i++) {
+-            if (i % 10 == 0)
+-                ps.println();
+-            else
+-                ps.print(" ");
+-            ps.print(values[start+i]);
+-        }
+-        ps.println();
++	int len = end-start;
++	for (int i = 0; i < len; i++) {
++	    if (i % 10 == 0)
++		ps.println();
++	    else
++		ps.print(" ");
++	    ps.print(values[start+i]);
++	}
++	ps.println();
+     }
+ 
+     static void printArrayTo(PrintStream ps, Entry[] cpMap, int start, int end) {
+-        StringBuffer buf = new StringBuffer();
+-        int len = end-start;
+-        for (int i = 0; i < len; i++) {
+-            String s = cpMap[start+i].stringValue();
+-            buf.setLength(0);
+-            for (int j = 0; j < s.length(); j++) {
+-                char ch = s.charAt(j);
+-                if (!(ch < ' ' || ch > '~' || ch == '\\')) {
+-                    buf.append(ch);
+-                } else if (ch == '\n') {
+-                    buf.append("\\n");
+-                } else if (ch == '\t') {
+-                    buf.append("\\t");
+-                } else if (ch == '\r') {
+-                    buf.append("\\r");
+-                } else {
+-                    buf.append("\\x"+Integer.toHexString(ch));
+-                }
+-            }
+-            ps.println(buf);
+-        }
++	StringBuffer buf = new StringBuffer();
++	int len = end-start;
++	for (int i = 0; i < len; i++) {
++	    String s = cpMap[start+i].stringValue();
++	    buf.setLength(0);
++	    for (int j = 0; j < s.length(); j++) {
++		char ch = s.charAt(j);
++		if (!(ch < ' ' || ch > '~' || ch == '\\')) {
++		    buf.append(ch);
++		} else if (ch == '\n') {
++		    buf.append("\\n");
++		} else if (ch == '\t') {
++		    buf.append("\\t");
++		} else if (ch == '\r') {
++		    buf.append("\\r");
++		} else {
++		    buf.append("\\x"+Integer.toHexString(ch));
++		}
++	    }
++	    ps.println(buf);
++	}
+     }
+ 
+ 
+     // Utilities for reallocating:
+     protected static Object[] realloc(Object[] a, int len) {
+-        java.lang.Class elt = a.getClass().getComponentType();
+-        Object[] na = (Object[]) java.lang.reflect.Array.newInstance(elt, len);
+-        System.arraycopy(a, 0, na, 0, Math.min(a.length, len));
+-        return na;
++	java.lang.Class elt = a.getClass().getComponentType();
++	Object[] na = (Object[]) java.lang.reflect.Array.newInstance(elt, len);
++	System.arraycopy(a, 0, na, 0, Math.min(a.length, len));
++	return na;
+     }
+     protected static Object[] realloc(Object[] a) {
+-        return realloc(a, Math.max(10, a.length*2));
++	return realloc(a, Math.max(10, a.length*2));
+     }
+     static private int[] noInts = {};
+     protected static int[] realloc(int[] a, int len) {
+-        if (len == 0)  return noInts;
+-        if (a == null)  return new int[len];
+-        int[] na = new int[len];
+-        System.arraycopy(a, 0, na, 0, Math.min(a.length, len));
+-        return na;
++	if (len == 0)  return noInts;
++	if (a == null)  return new int[len];
++	int[] na = new int[len];
++	System.arraycopy(a, 0, na, 0, Math.min(a.length, len));
++	return na;
+     }
+     protected static int[] realloc(int[] a) {
+-        return realloc(a, Math.max(10, a.length*2));
++	return realloc(a, Math.max(10, a.length*2));
+     }
+     static private byte[] noBytes = {};
+     protected static byte[] realloc(byte[] a, int len) {
+-        if (len == 0)  return noBytes;
+-        if (a == null)  return new byte[len];
+-        byte[] na = new byte[len];
+-        System.arraycopy(a, 0, na, 0, Math.min(a.length, len));
+-        return na;
++	if (len == 0)  return noBytes;
++	if (a == null)  return new byte[len];
++	byte[] na = new byte[len];
++	System.arraycopy(a, 0, na, 0, Math.min(a.length, len));
++	return na;
+     }
+     protected static byte[] realloc(byte[] a) {
+-        return realloc(a, Math.max(10, a.length*2));
++	return realloc(a, Math.max(10, a.length*2));
+     }
+ }
++
++
+diff --git a/src/share/classes/com/sun/java/util/jar/pack/ConstantPool.java b/src/share/classes/com/sun/java/util/jar/pack/ConstantPool.java
+--- jdk/src/share/classes/com/sun/java/util/jar/pack/ConstantPool.java
++++ jdk/src/share/classes/com/sun/java/util/jar/pack/ConstantPool.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -22,7 +22,7 @@
+  * or visit www.oracle.com if you need additional information or have any
+  * questions.
+  */
+-
++ 
+ package com.sun.java.util.jar.pack;
+ 
+ import java.io.*;
+@@ -37,7 +37,7 @@ class ConstantPool implements Constants 
+     private ConstantPool() {}  // do not instantiate
+ 
+     static int verbose() {
+-        return Utils.currentPropMap().getInteger(Utils.DEBUG_VERBOSE);
++	return Utils.currentPropMap().getInteger(Utils.DEBUG_VERBOSE);
+     }
+ 
+     // Uniquification tables for factory methods:
+@@ -53,659 +53,659 @@ class ConstantPool implements Constants 
+      *  Also used to back up more complex constant pool entries, like Class.
+      */
+     public static synchronized Utf8Entry getUtf8Entry(String value) {
+-        Utf8Entry e = (Utf8Entry) utf8Entries.get(value);
+-        if (e == null) {
+-            e = new Utf8Entry(value);
+-            utf8Entries.put(e.stringValue(), e);
+-        }
+-        return e;
++	Utf8Entry e = (Utf8Entry) utf8Entries.get(value);
++	if (e == null) {
++	    e = new Utf8Entry(value);
++	    utf8Entries.put(e.stringValue(), e);
++	}
++	return e;
+     }
+     /** Factory for Class constants. */
+     public static synchronized ClassEntry getClassEntry(String name) {
+-        ClassEntry e = (ClassEntry) classEntries.get(name);
+-        if (e == null) {
+-            e = (ClassEntry) new ClassEntry(getUtf8Entry(name));
+-            assert(name.equals(e.stringValue()));
+-            classEntries.put(e.stringValue(), e);
+-        }
+-        return e;
++	ClassEntry e = (ClassEntry) classEntries.get(name);
++	if (e == null) {
++	    e = (ClassEntry) new ClassEntry(getUtf8Entry(name));
++	    assert(name.equals(e.stringValue()));
++	    classEntries.put(e.stringValue(), e);
++	}
++	return e;
+     }
+     /** Factory for literal constants (String, Integer, etc.). */
+     public static synchronized LiteralEntry getLiteralEntry(Comparable value) {
+-        LiteralEntry e = (LiteralEntry) literalEntries.get(value);
+-        if (e == null) {
+-            if (value instanceof String)
+-                e = new StringEntry(getUtf8Entry((String)value));
+-            else
+-                e = new NumberEntry((Number)value);
+-            literalEntries.put(value, e);
+-        }
+-        return e;
++	LiteralEntry e = (LiteralEntry) literalEntries.get(value);
++	if (e == null) {
++	    if (value instanceof String)
++		e = new StringEntry(getUtf8Entry((String)value));
++	    else
++		e = new NumberEntry((Number)value);
++	    literalEntries.put(value, e);
++	}
++	return e;
+     }
+     /** Factory for literal constants (String, Integer, etc.). */
+     public static synchronized StringEntry getStringEntry(String value) {
+-        return (StringEntry) getLiteralEntry(value);
++	return (StringEntry) getLiteralEntry(value);
+     }
+ 
+     /** Factory for signature (type) constants. */
+     public static synchronized SignatureEntry getSignatureEntry(String type) {
+-        SignatureEntry e = (SignatureEntry) signatureEntries.get(type);
+-        if (e == null) {
+-            e = new SignatureEntry(type);
+-            assert(e.stringValue().equals(type));
+-            signatureEntries.put(type, e);
+-        }
+-        return e;
++	SignatureEntry e = (SignatureEntry) signatureEntries.get(type);
++	if (e == null) {
++	    e = new SignatureEntry(type);
++	    assert(e.stringValue().equals(type));
++	    signatureEntries.put(type, e);
++	}
++	return e;
+     }
+     // Convenience overloading.
+     public static SignatureEntry getSignatureEntry(Utf8Entry formRef, ClassEntry[] classRefs) {
+-        return getSignatureEntry(SignatureEntry.stringValueOf(formRef, classRefs));
++	return getSignatureEntry(SignatureEntry.stringValueOf(formRef, classRefs));
+     }
+ 
+     /** Factory for descriptor (name-and-type) constants. */
+     public static synchronized DescriptorEntry getDescriptorEntry(Utf8Entry nameRef, SignatureEntry typeRef) {
+-        String key = DescriptorEntry.stringValueOf(nameRef, typeRef);
+-        DescriptorEntry e = (DescriptorEntry) descriptorEntries.get(key);
+-        if (e == null) {
+-            e = new DescriptorEntry(nameRef, typeRef);
+-            assert(e.stringValue().equals(key))
+-                : (e.stringValue()+" != "+(key));
+-            descriptorEntries.put(key, e);
+-        }
+-        return e;
++	String key = DescriptorEntry.stringValueOf(nameRef, typeRef);
++	DescriptorEntry e = (DescriptorEntry) descriptorEntries.get(key);
++	if (e == null) {
++	    e = new DescriptorEntry(nameRef, typeRef);
++	    assert(e.stringValue().equals(key))
++		: (e.stringValue()+" != "+(key));
++	    descriptorEntries.put(key, e);
++	}
++	return e;
+     }
+     // Convenience overloading.
+     public static DescriptorEntry getDescriptorEntry(Utf8Entry nameRef, Utf8Entry typeRef) {
+-        return getDescriptorEntry(nameRef, getSignatureEntry(typeRef.stringValue()));
++	return getDescriptorEntry(nameRef, getSignatureEntry(typeRef.stringValue()));
+     }
+ 
+     /** Factory for member reference constants. */
+     public static synchronized MemberEntry getMemberEntry(byte tag, ClassEntry classRef, DescriptorEntry descRef) {
+-        String key = MemberEntry.stringValueOf(tag, classRef, descRef);
+-        MemberEntry e = (MemberEntry) memberEntries.get(key);
+-        if (e == null) {
+-            e = new MemberEntry(tag, classRef, descRef);
+-            assert(e.stringValue().equals(key))
+-                : (e.stringValue()+" != "+(key));
+-            memberEntries.put(key, e);
+-        }
+-        return e;
++	String key = MemberEntry.stringValueOf(tag, classRef, descRef);
++	MemberEntry e = (MemberEntry) memberEntries.get(key);
++	if (e == null) {
++	    e = new MemberEntry(tag, classRef, descRef);
++	    assert(e.stringValue().equals(key))
++		: (e.stringValue()+" != "+(key));
++	    memberEntries.put(key, e);
++	}
++	return e;
+     }
+ 
+ 
+     /** Entries in the constant pool. */
+     public static abstract
+     class Entry implements Comparable {
+-        protected final byte tag;       // a CONSTANT_foo code
+-        protected int valueHash;        // cached hashCode
++	protected final byte tag;	// a CONSTANT_foo code
++	protected int valueHash;	// cached hashCode
+ 
+-        protected Entry(byte tag) {
+-            this.tag = tag;
+-        }
++	protected Entry(byte tag) {
++	    this.tag = tag;
++	}
+ 
+-        public final byte getTag() {
+-            return tag;
+-        }
++	public final byte getTag() {
++	    return tag;
++	}
+ 
+-        public Entry getRef(int i) {
+-            return null;
+-        }
++	public Entry getRef(int i) {
++	    return null;
++	}
+ 
+-        public boolean sameTagAs(Object o) {
+-            return (o instanceof Entry) && ((Entry)o).tag == tag;
+-        }
+-        public boolean eq(Entry that) {  // same reference
+-            assert(that != null);
+-            return this == that || this.equals(that);
+-        }
++	public boolean sameTagAs(Object o) {
++	    return (o instanceof Entry) && ((Entry)o).tag == tag;
++	}
++	public boolean eq(Entry that) {  // same reference
++	    assert(that != null);
++	    return this == that || this.equals(that);
++	}
+ 
+-        // Equality of Entries is value-based.
+-        public abstract boolean equals(Object o);
+-        public final int hashCode() {
+-            if (valueHash == 0) {
+-                valueHash = computeValueHash();
+-                if (valueHash == 0)  valueHash = 1;
+-            }
+-            return valueHash;
+-        }
+-        protected abstract int computeValueHash();
++	// Equality of Entries is value-based.
++	public abstract boolean equals(Object o);
++	public final int hashCode() {
++	    if (valueHash == 0) {
++		valueHash = computeValueHash();
++		if (valueHash == 0)  valueHash = 1;
++	    }
++	    return valueHash;
++	}
++	protected abstract int computeValueHash();
+ 
+-        public abstract int compareTo(Object o);
++	public abstract int compareTo(Object o);
+ 
+-        protected int superCompareTo(Object o) {
+-            Entry that = (Entry) o;
++	protected int superCompareTo(Object o) {
++	    Entry that = (Entry) o;
+ 
+-            if (this.tag != that.tag) {
+-                return TAG_ORDER[this.tag] - TAG_ORDER[that.tag];
+-            }
++	    if (this.tag != that.tag) {
++		return TAG_ORDER[this.tag] - TAG_ORDER[that.tag];
++	    }
+ 
+-            return 0;  // subclasses must refine this
+-        }
++	    return 0;  // subclasses must refine this
++	}
+ 
+-        public final boolean isDoubleWord() {
+-            return tag == CONSTANT_Double || tag == CONSTANT_Long;
+-        }
++	public final boolean isDoubleWord() {
++	    return tag == CONSTANT_Double || tag == CONSTANT_Long;
++	}
+ 
+-        public final boolean tagMatches(int tag) {
+-            return (this.tag == tag);
+-        }
++	public final boolean tagMatches(int tag) {
++	    return (this.tag == tag);
++	}
+ 
+-        public String toString() {
+-            String valuePrint = stringValue();
+-            if (verbose() > 4) {
+-                if (valueHash != 0)
+-                    valuePrint += " hash="+valueHash;
+-                valuePrint += " id="+System.identityHashCode(this);
+-            }
+-            return tagName(tag)+"="+valuePrint;
+-        }
+-        public abstract String stringValue();
++	public String toString() {
++	    String valuePrint = stringValue();
++	    if (verbose() > 4) {
++		if (valueHash != 0)
++		    valuePrint += " hash="+valueHash;
++		valuePrint += " id="+System.identityHashCode(this);
++	    }
++	    return tagName(tag)+"="+valuePrint;
++	}
++	public abstract String stringValue();
+     }
+ 
+     public static
+     class Utf8Entry extends Entry {
+-        final String value;
++	final String value;
+ 
+-        Utf8Entry(String value) {
+-            super(CONSTANT_Utf8);
+-            this.value = value.intern();
+-            hashCode();  // force computation of valueHash
+-        }
+-        protected int computeValueHash() {
+-            return value.hashCode();
+-        }
+-        public boolean equals(Object o) {
+-            if (!sameTagAs(o))  return false;
+-            // Use reference equality of interned strings:
+-            return ((Utf8Entry)o).value == value;
+-        }
+-        public int compareTo(Object o) {
+-            int x = superCompareTo(o);
+-            if (x == 0) {
+-                x = value.compareTo(((Utf8Entry)o).value);
+-            }
+-            return x;
+-        }
+-        public String stringValue() {
+-            return value;
+-        }
++	Utf8Entry(String value) {
++	    super(CONSTANT_Utf8);
++	    this.value = value.intern();
++	    hashCode();  // force computation of valueHash
++	}
++	protected int computeValueHash() {
++	    return value.hashCode();
++	}
++	public boolean equals(Object o) {
++	    if (!sameTagAs(o))  return false;
++	    // Use reference equality of interned strings:
++	    return ((Utf8Entry)o).value == value;
++	}
++	public int compareTo(Object o) {
++	    int x = superCompareTo(o);
++	    if (x == 0) {
++		x = value.compareTo(((Utf8Entry)o).value);
++	    }
++	    return x;
++	}
++	public String stringValue() {
++	    return value;
++	}
+     }
+ 
+     static boolean isMemberTag(byte tag) {
+-        switch (tag) {
+-        case CONSTANT_Fieldref:
+-        case CONSTANT_Methodref:
+-        case CONSTANT_InterfaceMethodref:
+-            return true;
+-        }
+-        return false;
++	switch (tag) {
++	case CONSTANT_Fieldref:
++	case CONSTANT_Methodref:
++	case CONSTANT_InterfaceMethodref:
++	    return true;
++	}
++	return false;
+     }
+ 
+     static byte numberTagOf(Number value) {
+-        if (value instanceof Integer)  return CONSTANT_Integer;
+-        if (value instanceof Float)    return CONSTANT_Float;
+-        if (value instanceof Long)     return CONSTANT_Long;
+-        if (value instanceof Double)   return CONSTANT_Double;
+-        throw new RuntimeException("bad literal value "+value);
++	if (value instanceof Integer)  return CONSTANT_Integer;
++	if (value instanceof Float)    return CONSTANT_Float;
++	if (value instanceof Long)     return CONSTANT_Long;
++	if (value instanceof Double)   return CONSTANT_Double;
++	throw new RuntimeException("bad literal value "+value);
+     }
+ 
+     public static abstract
+     class LiteralEntry extends Entry {
+-        protected LiteralEntry(byte tag) {
+-            super(tag);
+-        }
++	protected LiteralEntry(byte tag) {
++	    super(tag);
++	}
+ 
+-        public abstract Comparable literalValue();
++	public abstract Comparable literalValue();
+     }
+ 
+     public static
+     class NumberEntry extends LiteralEntry {
+-        final Number value;
+-        NumberEntry(Number value) {
+-            super(numberTagOf(value));
+-            this.value = value;
+-            hashCode();  // force computation of valueHash
+-        }
+-        protected int computeValueHash() {
+-            return value.hashCode();
+-        }
++	final Number value;
++	NumberEntry(Number value) {
++	    super(numberTagOf(value));
++	    this.value = value;
++	    hashCode();  // force computation of valueHash
++	}
++	protected int computeValueHash() {
++	    return value.hashCode();
++	}
+ 
+-        public boolean equals(Object o) {
+-            if (!sameTagAs(o))  return false;
+-            return (((NumberEntry)o).value).equals(value);
+-        }
+-        public int compareTo(Object o) {
+-            int x = superCompareTo(o);
+-            if (x == 0) {
+-                x = ((Comparable)value).compareTo(((NumberEntry)o).value);
+-            }
+-            return x;
+-        }
+-        public Number numberValue() {
+-            return value;
+-        }
+-        public Comparable literalValue() {
+-            return (Comparable) value;
+-        }
+-        public String stringValue() {
+-            return value.toString();
+-        }
++	public boolean equals(Object o) {
++	    if (!sameTagAs(o))  return false;
++	    return (((NumberEntry)o).value).equals(value);
++	}
++	public int compareTo(Object o) {
++	    int x = superCompareTo(o);
++	    if (x == 0) {
++		x = ((Comparable)value).compareTo(((NumberEntry)o).value);
++	    }
++	    return x;
++	}
++	public Number numberValue() {
++	    return value;
++	}
++	public Comparable literalValue() {
++	    return (Comparable) value;
++	}
++	public String stringValue() {
++	    return value.toString();
++	}
+     }
+ 
+     public static
+     class StringEntry extends LiteralEntry {
+-        final Utf8Entry ref;
+-        public Entry getRef(int i) { return i == 0 ? ref : null; }
++	final Utf8Entry ref;
++	public Entry getRef(int i) { return i == 0 ? ref : null; }
+ 
+-        StringEntry(Entry ref) {
+-            super(CONSTANT_String);
+-            this.ref = (Utf8Entry) ref;
+-            hashCode();  // force computation of valueHash
+-        }
+-        protected int computeValueHash() {
+-            return ref.hashCode() + tag;
+-        }
+-        public boolean equals(Object o) {
+-            if (!sameTagAs(o))  return false;
+-            return ((StringEntry)o).ref.eq(ref);
+-        }
+-        public int compareTo(Object o) {
+-            int x = superCompareTo(o);
+-            if (x == 0) {
+-                x = ref.compareTo(((StringEntry)o).ref);
+-            }
+-            return x;
+-        }
+-        public Comparable literalValue() {
+-            return ref.stringValue();
+-        }
+-        public String stringValue() {
+-            return ref.stringValue();
+-        }
++	StringEntry(Entry ref) {
++	    super(CONSTANT_String);
++	    this.ref = (Utf8Entry) ref;
++	    hashCode();  // force computation of valueHash
++	}
++	protected int computeValueHash() {
++	    return ref.hashCode() + tag;
++	}
++	public boolean equals(Object o) {
++	    if (!sameTagAs(o))  return false;
++	    return ((StringEntry)o).ref.eq(ref);
++	}
++	public int compareTo(Object o) {
++	    int x = superCompareTo(o);
++	    if (x == 0) {
++		x = ref.compareTo(((StringEntry)o).ref);
++	    }
++	    return x;
++	}
++	public Comparable literalValue() {
++	    return ref.stringValue();
++	}
++	public String stringValue() {
++	    return ref.stringValue();
++	}
+     }
+ 
+     public static
+     class ClassEntry extends Entry {
+-        final Utf8Entry ref;
+-        public Entry getRef(int i) { return i == 0 ? ref : null; }
++	final Utf8Entry ref;
++	public Entry getRef(int i) { return i == 0 ? ref : null; }
+ 
+-        protected int computeValueHash() {
+-            return ref.hashCode() + tag;
+-        }
+-        ClassEntry(Entry ref) {
+-            super(CONSTANT_Class);
+-            this.ref = (Utf8Entry) ref;
+-            hashCode();  // force computation of valueHash
+-        }
+-        public boolean equals(Object o) {
+-            if (!sameTagAs(o))  return false;
+-            return ((ClassEntry)o).ref.eq(ref);
+-        }
+-        public int compareTo(Object o) {
+-            int x = superCompareTo(o);
+-            if (x == 0) {
+-                x = ref.compareTo(((ClassEntry)o).ref);
+-            }
+-            return x;
+-        }
+-        public String stringValue() {
+-            return ref.stringValue();
+-        }
++	protected int computeValueHash() {
++	    return ref.hashCode() + tag;
++	}
++	ClassEntry(Entry ref) {
++	    super(CONSTANT_Class);
++	    this.ref = (Utf8Entry) ref;
++	    hashCode();  // force computation of valueHash
++	}
++	public boolean equals(Object o) {
++	    if (!sameTagAs(o))  return false;
++	    return ((ClassEntry)o).ref.eq(ref);
++	}
++	public int compareTo(Object o) {
++	    int x = superCompareTo(o);
++	    if (x == 0) {
++		x = ref.compareTo(((ClassEntry)o).ref);
++	    }
++	    return x;
++	}
++	public String stringValue() {
++	    return ref.stringValue();
++	}
+     }
+ 
+     public static
+     class DescriptorEntry extends Entry {
+-        final Utf8Entry      nameRef;
+-        final SignatureEntry typeRef;
+-        public Entry getRef(int i) {
+-            if (i == 0)  return nameRef;
+-            if (i == 1)  return typeRef;
+-            return null;
+-        }
+-        DescriptorEntry(Entry nameRef, Entry typeRef) {
+-            super(CONSTANT_NameandType);
+-            if (typeRef instanceof Utf8Entry) {
+-                typeRef = getSignatureEntry(typeRef.stringValue());
+-            }
+-            this.nameRef = (Utf8Entry) nameRef;
+-            this.typeRef = (SignatureEntry) typeRef;
+-            hashCode();  // force computation of valueHash
+-        }
+-        protected int computeValueHash() {
+-            int hc2 = typeRef.hashCode();
+-            return (nameRef.hashCode() + (hc2 << 8)) ^ hc2;
+-        }
+-        public boolean equals(Object o) {
+-            if (!sameTagAs(o))  return false;
+-            DescriptorEntry that = (DescriptorEntry)o;
+-            return this.nameRef.eq(that.nameRef)
+-                && this.typeRef.eq(that.typeRef);
+-        }
+-        public int compareTo(Object o) {
+-            int x = superCompareTo(o);
+-            if (x == 0) {
+-                DescriptorEntry that = (DescriptorEntry)o;
+-                // Primary key is typeRef, not nameRef.
+-                x = this.typeRef.compareTo(that.typeRef);
+-                if (x == 0)
+-                    x = this.nameRef.compareTo(that.nameRef);
+-            }
+-            return x;
+-        }
+-        public String stringValue() {
+-            return stringValueOf(nameRef, typeRef);
+-        }
+-        static
+-        String stringValueOf(Entry nameRef, Entry typeRef) {
+-            return typeRef.stringValue()+","+nameRef.stringValue();
+-        }
++	final Utf8Entry      nameRef;
++	final SignatureEntry typeRef;
++	public Entry getRef(int i) {
++	    if (i == 0)  return nameRef;
++	    if (i == 1)  return typeRef;
++	    return null;
++	}
++	DescriptorEntry(Entry nameRef, Entry typeRef) {
++	    super(CONSTANT_NameandType);
++	    if (typeRef instanceof Utf8Entry) {
++		typeRef = getSignatureEntry(typeRef.stringValue());
++	    }
++	    this.nameRef = (Utf8Entry) nameRef;
++	    this.typeRef = (SignatureEntry) typeRef;
++	    hashCode();  // force computation of valueHash
++	}
++	protected int computeValueHash() {
++	    int hc2 = typeRef.hashCode();
++	    return (nameRef.hashCode() + (hc2 << 8)) ^ hc2;
++	}
++	public boolean equals(Object o) {
++	    if (!sameTagAs(o))  return false;
++	    DescriptorEntry that = (DescriptorEntry)o;
++	    return this.nameRef.eq(that.nameRef)
++		&& this.typeRef.eq(that.typeRef);
++	}
++	public int compareTo(Object o) {
++	    int x = superCompareTo(o);
++	    if (x == 0) {
++		DescriptorEntry that = (DescriptorEntry)o;
++		// Primary key is typeRef, not nameRef.
++		x = this.typeRef.compareTo(that.typeRef);
++		if (x == 0)
++		    x = this.nameRef.compareTo(that.nameRef);
++	    }
++	    return x;
++	}
++	public String stringValue() {
++	    return stringValueOf(nameRef, typeRef);
++	}
++	static
++	String stringValueOf(Entry nameRef, Entry typeRef) {
++	    return typeRef.stringValue()+","+nameRef.stringValue();
++	}
+ 
+-        public String prettyString() {
+-            return nameRef.stringValue()+typeRef.prettyString();
+-        }
++	public String prettyString() {
++	    return nameRef.stringValue()+typeRef.prettyString();
++	}
+ 
+-        public boolean isMethod() {
+-            return typeRef.isMethod();
+-        }
++	public boolean isMethod() {
++	    return typeRef.isMethod();
++	}
+ 
+-        public byte getLiteralTag() {
+-            return typeRef.getLiteralTag();
+-        }
++	public byte getLiteralTag() {
++	    return typeRef.getLiteralTag();
++	}
+     }
+ 
+     public static
+     class MemberEntry extends Entry {
+-        final ClassEntry classRef;
+-        final DescriptorEntry descRef;
+-        public Entry getRef(int i) {
+-            if (i == 0)  return classRef;
+-            if (i == 1)  return descRef;
+-            return null;
+-        }
+-        protected int computeValueHash() {
+-            int hc2 = descRef.hashCode();
+-            return (classRef.hashCode() + (hc2 << 8)) ^ hc2;
+-        }
++	final ClassEntry classRef;
++	final DescriptorEntry descRef;
++	public Entry getRef(int i) {
++	    if (i == 0)  return classRef;
++	    if (i == 1)  return descRef;
++	    return null;
++	}
++	protected int computeValueHash() {
++	    int hc2 = descRef.hashCode();
++	    return (classRef.hashCode() + (hc2 << 8)) ^ hc2;
++	}
+ 
+-        MemberEntry(byte tag, ClassEntry classRef, DescriptorEntry descRef) {
+-            super(tag);
+-            assert(isMemberTag(tag));
+-            this.classRef = classRef;
+-            this.descRef  = descRef;
+-            hashCode();  // force computation of valueHash
+-        }
+-        public boolean equals(Object o) {
+-            if (!sameTagAs(o))  return false;
+-            MemberEntry that = (MemberEntry)o;
+-            return this.classRef.eq(that.classRef)
+-                && this.descRef.eq(that.descRef);
+-        }
+-        public int compareTo(Object o) {
+-            int x = superCompareTo(o);
+-            if (x == 0) {
+-                MemberEntry that = (MemberEntry)o;
+-                // Primary key is classRef.
+-                x = this.classRef.compareTo(that.classRef);
+-                if (x == 0)
+-                    x = this.descRef.compareTo(that.descRef);
+-            }
+-            return x;
+-        }
+-        public String stringValue() {
+-            return stringValueOf(tag, classRef, descRef);
+-        }
+-        static
+-        String stringValueOf(byte tag, ClassEntry classRef, DescriptorEntry descRef) {
+-            assert(isMemberTag(tag));
+-            String pfx;
+-            switch (tag) {
+-            case CONSTANT_Fieldref:            pfx = "Field:";   break;
+-            case CONSTANT_Methodref:           pfx = "Method:";  break;
+-            case CONSTANT_InterfaceMethodref:  pfx = "IMethod:"; break;
+-            default:                           pfx = tag+"???";  break;
+-            }
+-            return pfx+classRef.stringValue()+","+descRef.stringValue();
+-        }
++	MemberEntry(byte tag, ClassEntry classRef, DescriptorEntry descRef) {
++	    super(tag);
++	    assert(isMemberTag(tag));
++	    this.classRef = classRef;
++	    this.descRef  = descRef;
++	    hashCode();  // force computation of valueHash
++	}
++	public boolean equals(Object o) {
++	    if (!sameTagAs(o))  return false;
++	    MemberEntry that = (MemberEntry)o;
++	    return this.classRef.eq(that.classRef)
++		&& this.descRef.eq(that.descRef);
++	}
++	public int compareTo(Object o) {
++	    int x = superCompareTo(o);
++	    if (x == 0) {
++		MemberEntry that = (MemberEntry)o;
++		// Primary key is classRef.
++		x = this.classRef.compareTo(that.classRef);
++		if (x == 0)
++		    x = this.descRef.compareTo(that.descRef);
++	    }
++	    return x;
++	}
++	public String stringValue() {
++	    return stringValueOf(tag, classRef, descRef);
++	}
++	static
++	String stringValueOf(byte tag, ClassEntry classRef, DescriptorEntry descRef) {
++	    assert(isMemberTag(tag));
++	    String pfx;
++	    switch (tag) {
++	    case CONSTANT_Fieldref:            pfx = "Field:";   break;
++	    case CONSTANT_Methodref:           pfx = "Method:";  break;
++	    case CONSTANT_InterfaceMethodref:  pfx = "IMethod:"; break;
++	    default:                           pfx = tag+"???";  break;
++	    }
++	    return pfx+classRef.stringValue()+","+descRef.stringValue();
++	}
+ 
+-        public boolean isMethod() {
+-            return descRef.isMethod();
+-        }
++	public boolean isMethod() {
++	    return descRef.isMethod();
++	}
+     }
+ 
+     public static
+     class SignatureEntry extends Entry {
+-        final Utf8Entry    formRef;
+-        final ClassEntry[] classRefs;
+-        String             value;
+-        Utf8Entry          asUtf8Entry;
+-        public Entry getRef(int i) {
+-            if (i == 0)  return formRef;
+-            return i-1 < classRefs.length ? classRefs[i-1] : null;
+-        }
+-        SignatureEntry(String value) {
+-            super(CONSTANT_Signature);
+-            value = value.intern();  // always do this
+-            this.value = value;
+-            String[] parts = structureSignature(value);
+-            formRef = getUtf8Entry(parts[0]);
+-            classRefs = new ClassEntry[parts.length-1];
+-            for (int i = 1; i < parts.length; i++)
+-                classRefs[i-1] = getClassEntry(parts[i]);
+-            hashCode();  // force computation of valueHash
+-        }
+-        protected int computeValueHash() {
+-            stringValue();  // force computation of value
+-            return value.hashCode() + tag;
+-        }
++	final Utf8Entry    formRef;
++	final ClassEntry[] classRefs;
++	String             value;
++	Utf8Entry          asUtf8Entry;
++	public Entry getRef(int i) {
++	    if (i == 0)  return formRef;
++	    return i-1 < classRefs.length ? classRefs[i-1] : null;
++	}
++	SignatureEntry(String value) {
++	    super(CONSTANT_Signature);
++	    value = value.intern();  // always do this
++	    this.value = value;
++	    String[] parts = structureSignature(value);
++	    formRef = getUtf8Entry(parts[0]);
++	    classRefs = new ClassEntry[parts.length-1];
++	    for (int i = 1; i < parts.length; i++)
++		classRefs[i-1] = getClassEntry(parts[i]);
++	    hashCode();  // force computation of valueHash
++	}
++	protected int computeValueHash() {
++	    stringValue();  // force computation of value
++	    return value.hashCode() + tag;
++	}
+ 
+-        public Utf8Entry asUtf8Entry() {
+-            if (asUtf8Entry == null) {
+-                asUtf8Entry = getUtf8Entry(stringValue());
+-            }
+-            return asUtf8Entry;
+-        }
++	public Utf8Entry asUtf8Entry() {
++	    if (asUtf8Entry == null) {
++		asUtf8Entry = getUtf8Entry(stringValue());
++	    }
++	    return asUtf8Entry;
++	}
+ 
+-        public boolean equals(Object o) {
+-            if (!sameTagAs(o))  return false;
+-            return ((SignatureEntry)o).value == value;
+-        }
+-        public int compareTo(Object o) {
+-            int x = superCompareTo(o);
+-            if (x == 0) {
+-                SignatureEntry that = (SignatureEntry)o;
+-                x = compareSignatures(this.value, that.value);
+-            }
+-            return x;
+-        }
+-        public String stringValue() {
+-            if (value == null) {
+-                value = stringValueOf(formRef, classRefs);
+-            }
+-            return value;
+-        }
+-        static
+-        String stringValueOf(Utf8Entry formRef, ClassEntry[] classRefs) {
+-            String[] parts = new String[1+classRefs.length];
+-            parts[0] = formRef.stringValue();
+-            for (int i = 1; i < parts.length; i++)
+-                parts[i] = classRefs[i-1].stringValue();
+-            return flattenSignature(parts).intern();
+-        }
++	public boolean equals(Object o) {
++	    if (!sameTagAs(o))  return false;
++	    return ((SignatureEntry)o).value == value;
++	}
++	public int compareTo(Object o) {
++	    int x = superCompareTo(o);
++	    if (x == 0) {
++		SignatureEntry that = (SignatureEntry)o;
++		x = compareSignatures(this.value, that.value);
++	    }
++	    return x;
++	}
++	public String stringValue() {
++	    if (value == null) {
++		value = stringValueOf(formRef, classRefs);
++	    }
++	    return value;
++	}
++	static
++	String stringValueOf(Utf8Entry formRef, ClassEntry[] classRefs) {
++	    String[] parts = new String[1+classRefs.length];
++	    parts[0] = formRef.stringValue();
++	    for (int i = 1; i < parts.length; i++)
++		parts[i] = classRefs[i-1].stringValue();
++	    return flattenSignature(parts).intern();
++	}
+ 
+-        public int computeSize(boolean countDoublesTwice) {
+-            String form = formRef.stringValue();
+-            int min = 0;
+-            int max = 1;
+-            if (isMethod()) {
+-                min = 1;
+-                max = form.indexOf(')');
+-            }
+-            int size = 0;
+-            for (int i = min; i < max; i++) {
+-                switch (form.charAt(i)) {
+-                case 'D':
+-                case 'J':
+-                    if (countDoublesTwice) size++;
+-                    break;
+-                case '[':
+-                    // Skip rest of array info.
+-                    while (form.charAt(i) == '[') ++i;
+-                    break;
+-                case ';':
+-                    continue;
+-                default:
+-                    assert(0 <= JAVA_SIGNATURE_CHARS.indexOf(form.charAt(i)));
+-                    break;
+-                }
+-                size++;
+-            }
+-            return size;
+-        }
+-        public boolean isMethod() {
+-            return formRef.stringValue().charAt(0) == '(';
+-        }
+-        public byte getLiteralTag() {
+-            switch (formRef.stringValue().charAt(0)) {
+-            case 'L': return CONSTANT_String;
+-            case 'I': return CONSTANT_Integer;
+-            case 'J': return CONSTANT_Long;
+-            case 'F': return CONSTANT_Float;
+-            case 'D': return CONSTANT_Double;
+-            case 'B': case 'S': case 'C': case 'Z':
+-                return CONSTANT_Integer;
+-            }
+-            assert(false);
+-            return CONSTANT_None;
+-        }
+-        public String prettyString() {
+-            String s;
+-            if (isMethod()) {
+-                s = formRef.stringValue();
+-                s = s.substring(0, 1+s.indexOf(')'));
+-            } else {
+-                s = "/" + formRef.stringValue();
+-            }
+-            int i;
+-            while ((i = s.indexOf(';')) >= 0)
+-                s = s.substring(0,i) + s.substring(i+1);
+-            return s;
+-        }
++	public int computeSize(boolean countDoublesTwice) {
++	    String form = formRef.stringValue();
++	    int min = 0;
++	    int max = 1;
++	    if (isMethod()) {
++		min = 1;
++		max = form.indexOf(')');
++	    }
++	    int size = 0;
++	    for (int i = min; i < max; i++) {
++		switch (form.charAt(i)) {
++		case 'D':
++		case 'J':
++		    if (countDoublesTwice) size++;
++		    break;
++		case '[':
++		    // Skip rest of array info.
++		    while (form.charAt(i) == '[') ++i;
++		    break;
++		case ';':
++		    continue;
++		default:
++		    assert(0 <= JAVA_SIGNATURE_CHARS.indexOf(form.charAt(i)));
++		    break;
++		}
++		size++;
++	    }
++	    return size;
++	}
++	public boolean isMethod() {
++	    return formRef.stringValue().charAt(0) == '(';
++	}
++	public byte getLiteralTag() {
++	    switch (formRef.stringValue().charAt(0)) {
++	    case 'L': return CONSTANT_String;
++	    case 'I': return CONSTANT_Integer;
++	    case 'J': return CONSTANT_Long;
++	    case 'F': return CONSTANT_Float;
++	    case 'D': return CONSTANT_Double;
++	    case 'B': case 'S': case 'C': case 'Z':
++		return CONSTANT_Integer;
++	    }
++	    assert(false);
++	    return CONSTANT_None;
++	}
++	public String prettyString() {
++	    String s;
++	    if (isMethod()) {
++		s = formRef.stringValue();
++		s = s.substring(0, 1+s.indexOf(')'));
++	    } else {
++		s = "/" + formRef.stringValue();
++	    }
++	    int i;
++	    while ((i = s.indexOf(';')) >= 0)
++		s = s.substring(0,i) + s.substring(i+1);
++	    return s;
++	}
+     }
+ 
+     static int compareSignatures(String s1, String s2) {
+-        return compareSignatures(s1, s2, null, null);
++	return compareSignatures(s1, s2, null, null);
+     }
+     static int compareSignatures(String s1, String s2, String[] p1, String[] p2) {
+-        final int S1_COMES_FIRST = -1;
+-        final int S2_COMES_FIRST = +1;
+-        char c1 = s1.charAt(0);
+-        char c2 = s2.charAt(0);
+-        // fields before methods (because there are fewer of them)
+-        if (c1 != '(' && c2 == '(')  return S1_COMES_FIRST;
+-        if (c2 != '(' && c1 == '(')  return S2_COMES_FIRST;
+-        if (p1 == null)  p1 = structureSignature(s1);
+-        if (p2 == null)  p2 = structureSignature(s2);
+-        /*
+-         // non-classes before classes (because there are fewer of them)
+-         if (p1.length == 1 && p2.length > 1)  return S1_COMES_FIRST;
+-         if (p2.length == 1 && p1.length > 1)  return S2_COMES_FIRST;
+-         // all else being equal, use the same comparison as for Utf8 strings
+-         return s1.compareTo(s2);
+-         */
+-        if (p1.length != p2.length)  return p1.length - p2.length;
+-        int length = p1.length;
+-        for (int i = length; --i >= 0; ) {
+-            int res = p1[i].compareTo(p2[i]);
+-            if (res != 0)  return res;
+-        }
+-        assert(s1.equals(s2));
+-        return 0;
++	final int S1_COMES_FIRST = -1;
++	final int S2_COMES_FIRST = +1;
++	char c1 = s1.charAt(0);
++	char c2 = s2.charAt(0);
++	// fields before methods (because there are fewer of them)
++	if (c1 != '(' && c2 == '(')  return S1_COMES_FIRST;
++	if (c2 != '(' && c1 == '(')  return S2_COMES_FIRST;
++	if (p1 == null)  p1 = structureSignature(s1);
++	if (p2 == null)  p2 = structureSignature(s2);
++	/*
++	 // non-classes before classes (because there are fewer of them)
++	 if (p1.length == 1 && p2.length > 1)  return S1_COMES_FIRST;
++	 if (p2.length == 1 && p1.length > 1)  return S2_COMES_FIRST;
++	 // all else being equal, use the same comparison as for Utf8 strings
++	 return s1.compareTo(s2);
++	 */
++	if (p1.length != p2.length)  return p1.length - p2.length;
++	int length = p1.length;
++	for (int i = length; --i >= 0; ) {
++	    int res = p1[i].compareTo(p2[i]);
++	    if (res != 0)  return res;
++	}
++	assert(s1.equals(s2));
++	return 0;
+     }
+ 
+     static int countClassParts(Utf8Entry formRef) {
+-        int num = 0;
+-        String s = formRef.stringValue();
+-        for (int i = 0; i < s.length(); i++) {
+-            if (s.charAt(i) == 'L')  ++num;
+-        }
+-        return num;
++	int num = 0;
++	String s = formRef.stringValue();
++	for (int i = 0; i < s.length(); i++) {
++	    if (s.charAt(i) == 'L')  ++num;
++	}
++	return num;
+     }
+ 
+     static String flattenSignature(String[] parts) {
+-        String form = parts[0];
+-        if (parts.length == 1)  return form;
+-        int len = form.length();
+-        for (int i = 1; i < parts.length; i++) {
+-            len += parts[i].length();
+-        }
+-        char[] sig = new char[len];
+-        int j = 0;
+-        int k = 1;
+-        for (int i = 0; i < form.length(); i++) {
+-            char ch = form.charAt(i);
+-            sig[j++] = ch;
+-            if (ch == 'L') {
+-                String cls = parts[k++];
+-                cls.getChars(0, cls.length(), sig, j);
+-                j += cls.length();
+-                //sig[j++] = ';';
+-            }
+-        }
+-        assert(j == len);
+-        assert(k == parts.length);
+-        return new String(sig);
++	String form = parts[0];
++	if (parts.length == 1)  return form;
++	int len = form.length();
++	for (int i = 1; i < parts.length; i++) {
++	    len += parts[i].length();
++	}
++	char[] sig = new char[len];
++	int j = 0;
++	int k = 1;
++	for (int i = 0; i < form.length(); i++) {
++	    char ch = form.charAt(i);
++	    sig[j++] = ch;
++	    if (ch == 'L') {
++		String cls = parts[k++];
++		cls.getChars(0, cls.length(), sig, j);
++		j += cls.length();
++		//sig[j++] = ';';
++	    }
++	}
++	assert(j == len);
++	assert(k == parts.length);
++	return new String(sig);
+     }
+ 
+     static private int skipClassNameChars(String sig, int i) {
+-        int len = sig.length();
+-        for (; i < len; i++) {
+-            char ch = sig.charAt(i);
+-            if (ch <= ' ')  break;
+-            if (ch >= ';' && ch <= '@')  break;
+-        }
+-        return i;
++	int len = sig.length();
++	for (; i < len; i++) {
++	    char ch = sig.charAt(i);
++	    if (ch <= ' ')  break;
++	    if (ch >= ';' && ch <= '@')  break;
++	}
++	return i;
+     }
+ 
+     static String[] structureSignature(String sig) {
+-        sig = sig.intern();
++	sig = sig.intern();
+ 
+-        int formLen = 0;
+-        int nparts = 1;
+-        for (int i = 0; i < sig.length(); i++) {
+-            char ch = sig.charAt(i);
+-            formLen++;
+-            if (ch == 'L') {
+-                nparts++;
+-                int i2 = skipClassNameChars(sig, i+1);
+-                i = i2-1;  // keep the semicolon in the form
+-                int i3 = sig.indexOf('<', i+1);
+-                if (i3 > 0 && i3 < i2)
+-                    i = i3-1;
+-            }
+-        }
+-        char[] form = new char[formLen];
+-        if (nparts == 1) {
+-            String[] parts = { sig };
+-            return parts;
+-        }
+-        String[] parts = new String[nparts];
+-        int j = 0;
+-        int k = 1;
+-        for (int i = 0; i < sig.length(); i++) {
+-            char ch = sig.charAt(i);
+-            form[j++] = ch;
+-            if (ch == 'L') {
+-                int i2 = skipClassNameChars(sig, i+1);
+-                parts[k++] = sig.substring(i+1, i2);
+-                i = i2;
+-                --i;  // keep the semicolon in the form
+-            }
+-        }
+-        assert(j == formLen);
+-        assert(k == parts.length);
+-        parts[0] = new String(form);
+-        //assert(flattenSignature(parts).equals(sig));
+-        return parts;
++	int formLen = 0;
++	int nparts = 1;
++	for (int i = 0; i < sig.length(); i++) {
++	    char ch = sig.charAt(i);
++	    formLen++;
++	    if (ch == 'L') {
++		nparts++;
++		int i2 = skipClassNameChars(sig, i+1);
++		i = i2-1;  // keep the semicolon in the form
++		int i3 = sig.indexOf('<', i+1);
++		if (i3 > 0 && i3 < i2)
++		    i = i3-1;
++	    }
++	}
++	char[] form = new char[formLen];
++	if (nparts == 1) {
++	    String[] parts = { sig };
++	    return parts;
++	}
++	String[] parts = new String[nparts];
++	int j = 0;
++	int k = 1;
++	for (int i = 0; i < sig.length(); i++) {
++	    char ch = sig.charAt(i);
++	    form[j++] = ch;
++	    if (ch == 'L') {
++		int i2 = skipClassNameChars(sig, i+1);
++		parts[k++] = sig.substring(i+1, i2);
++		i = i2;
++		--i;  // keep the semicolon in the form
++	    }
++	}
++	assert(j == formLen);
++	assert(k == parts.length);
++	parts[0] = new String(form);
++	//assert(flattenSignature(parts).equals(sig));
++	return parts;
+     }
+ 
+     // Handy constants:
+@@ -715,182 +715,182 @@ class ConstantPool implements Constants 
+     /** An Index is a mapping between CP entries and small integers. */
+     public static
+     class Index extends AbstractList {
+-        protected String debugName;
+-        protected Entry[] cpMap;
+-        protected boolean flattenSigs;
+-        protected Entry[] getMap() {
+-            return cpMap;
+-        }
+-        protected Index(String debugName) {
+-            this.debugName = debugName;
+-        }
+-        protected Index(String debugName, Entry[] cpMap) {
+-            this(debugName);
+-            setMap(cpMap);
+-        }
+-        protected void setMap(Entry[] cpMap) {
+-            clearIndex();
+-            this.cpMap = cpMap;
+-        }
+-        protected Index(String debugName, Collection cpMapList) {
+-            this(debugName);
+-            setMap(cpMapList);
+-        }
+-        protected void setMap(Collection cpMapList) {
+-            cpMap = new Entry[cpMapList.size()];
+-            cpMapList.toArray(cpMap);
+-            setMap(cpMap);
+-        }
+-        public int size() {
+-            return cpMap.length;
+-        }
+-        public Object get(int i) {
+-            return cpMap[i];
+-        }
+-        public Entry getEntry(int i) {
+-            // same as get(), with covariant return type
+-            return cpMap[i];
+-        }
++	protected String debugName;
++	protected Entry[] cpMap;
++	protected boolean flattenSigs;
++	protected Entry[] getMap() {
++	    return cpMap;
++	}
++	protected Index(String debugName) {
++	    this.debugName = debugName;
++	}
++	protected Index(String debugName, Entry[] cpMap) {
++	    this(debugName);
++	    setMap(cpMap);
++	}
++	protected void setMap(Entry[] cpMap) {
++	    clearIndex();
++	    this.cpMap = cpMap;
++	}
++	protected Index(String debugName, Collection cpMapList) {
++	    this(debugName);
++	    setMap(cpMapList);
++	}
++	protected void setMap(Collection cpMapList) {
++	    cpMap = new Entry[cpMapList.size()];
++	    cpMapList.toArray(cpMap);
++	    setMap(cpMap);
++	}
++	public int size() {
++	    return cpMap.length;
++	}
++	public Object get(int i) {
++	    return cpMap[i];
++	}
++	public Entry getEntry(int i) {
++	    // same as get(), with covariant return type
++	    return cpMap[i];
++	}
+ 
+-        // Find index of e in cpMap, or return -1 if none.
+-        //
+-        // As a special hack, if flattenSigs, signatures are
+-        // treated as equivalent entries of cpMap.  This is wrong
+-        // fron a Collection point of view, because contains()
+-        // reports true for signatures, but the iterator()
+-        // never produces them!
+-        private int findIndexOf(Entry e) {
+-            if (indexKey == null)  initializeIndex();
+-            int probe = findIndexLocation(e);
+-            if (indexKey[probe] != e) {
+-                if (flattenSigs && e.tag == CONSTANT_Signature) {
+-                    SignatureEntry se = (SignatureEntry) e;
+-                    return findIndexOf(se.asUtf8Entry());
+-                }
+-                return -1;
+-            }
+-            int index = indexValue[probe];
+-            assert(e.equals(cpMap[index]));
+-            return index;
+-        }
+-        public boolean contains(Entry e) {
+-            return findIndexOf(e) >= 0;
+-        }
+-        // Find index of e in cpMap.  Should not return -1.
+-        public int indexOf(Entry e) {
+-            int index = findIndexOf(e);
+-            if (index < 0 && verbose() > 0) {
+-                System.out.println("not found: "+e);
+-                System.out.println("       in: "+this.dumpString());
+-                Thread.dumpStack();
+-            }
+-            assert(index >= 0);
+-            return index;
+-        }
+-        public boolean contains(Object e) {
+-            return findIndexOf((Entry)e) >= 0;
+-        }
+-        public int indexOf(Object e) {
+-            return findIndexOf((Entry)e);
+-        }
+-        public int lastIndexOf(Object e) {
+-            return indexOf(e);
+-        }
++	// Find index of e in cpMap, or return -1 if none.
++	//
++	// As a special hack, if flattenSigs, signatures are
++	// treated as equivalent entries of cpMap.  This is wrong
++	// fron a Collection point of view, because contains()
++	// reports true for signatures, but the iterator()
++	// never produces them!
++	private int findIndexOf(Entry e) {
++	    if (indexKey == null)  initializeIndex();
++	    int probe = findIndexLocation(e);
++	    if (indexKey[probe] != e) {
++		if (flattenSigs && e.tag == CONSTANT_Signature) {
++		    SignatureEntry se = (SignatureEntry) e;
++		    return findIndexOf(se.asUtf8Entry());
++		}
++		return -1;
++	    }
++	    int index = indexValue[probe];
++	    assert(e.equals(cpMap[index]));
++	    return index;
++	}
++	public boolean contains(Entry e) {
++	    return findIndexOf(e) >= 0;
++	}
++	// Find index of e in cpMap.  Should not return -1.
++	public int indexOf(Entry e) {
++	    int index = findIndexOf(e);
++	    if (index < 0 && verbose() > 0) {
++		System.out.println("not found: "+e);
++		System.out.println("       in: "+this.dumpString());
++		Thread.dumpStack();
++	    }
++	    assert(index >= 0);
++	    return index;
++	}
++	public boolean contains(Object e) {
++	    return findIndexOf((Entry)e) >= 0;
++	}
++	public int indexOf(Object e) {
++	    return findIndexOf((Entry)e);
++	}
++	public int lastIndexOf(Object e) {
++	    return indexOf(e);
++	}
+ 
+-        public boolean assertIsSorted() {
+-            for (int i = 1; i < cpMap.length; i++) {
+-                if (cpMap[i-1].compareTo(cpMap[i]) > 0) {
+-                    System.out.println("Not sorted at "+(i-1)+"/"+i+": "+this.dumpString());
+-                    return false;
+-                }
+-            }
+-            return true;
+-        }
++	public boolean assertIsSorted() {
++	    for (int i = 1; i < cpMap.length; i++) {
++		if (cpMap[i-1].compareTo(cpMap[i]) > 0) {
++		    System.out.println("Not sorted at "+(i-1)+"/"+i+": "+this.dumpString());
++		    return false;
++		}
++	    }
++	    return true;
++	}
+ 
+-        // internal hash table
+-        protected Entry[] indexKey;
+-        protected int[]   indexValue;
+-        protected void clearIndex() {
+-            indexKey   = null;
+-            indexValue = null;
+-        }
+-        private int findIndexLocation(Entry e) {
+-            int size   = indexKey.length;
+-            int hash   = e.hashCode();
+-            int probe  = hash & (size - 1);
+-            int stride = ((hash >>> 8) | 1) & (size - 1);
+-            for (;;) {
+-                Entry e1 = indexKey[probe];
+-                if (e1 == e || e1 == null)
+-                    return probe;
+-                probe += stride;
+-                if (probe >= size)  probe -= size;
+-            }
+-        }
+-        private void initializeIndex() {
+-            if (verbose() > 2)
+-                System.out.println("initialize Index "+debugName+" ["+size()+"]");
+-            int hsize0 = (int)((cpMap.length + 10) * 1.5);
+-            int hsize = 1;
+-            while (hsize < hsize0)  hsize <<= 1;
+-            indexKey   = new Entry[hsize];
+-            indexValue = new int[hsize];
+-            for (int i = 0; i < cpMap.length; i++) {
+-                Entry e = cpMap[i];
+-                if (e == null)  continue;
+-                int probe = findIndexLocation(e);
+-                assert(indexKey[probe] == null);  // e has unique index
+-                indexKey[probe] = e;
+-                indexValue[probe] = i;
+-            }
+-        }
+-        public Object[] toArray(Object[] a) {
+-            int sz = size();
+-            if (a.length < sz)  return super.toArray(a);
+-            System.arraycopy(cpMap, 0, a, 0, sz);
+-            if (a.length > sz)  a[sz] = null;
+-            return a;
+-        }
+-        public Object[] toArray() {
+-            return toArray(new Entry[size()]);
+-        }
+-        public Object clone() {
+-            return new Index(debugName, (Entry[]) cpMap.clone());
+-        }
+-        public String toString() {
+-            return "Index "+debugName+" ["+size()+"]";
+-        }
+-        public String dumpString() {
+-            String s = toString();
+-            s += " {\n";
+-            for (int i = 0; i < cpMap.length; i++) {
+-                s += "    "+i+": "+cpMap[i]+"\n";
+-            }
+-            s += "}";
+-            return s;
+-        }
++	// internal hash table
++	protected Entry[] indexKey;
++	protected int[]   indexValue;
++	protected void clearIndex() {
++	    indexKey   = null;
++	    indexValue = null;
++	}
++	private int findIndexLocation(Entry e) {
++	    int size   = indexKey.length;
++	    int hash   = e.hashCode();
++	    int probe  = hash & (size - 1);
++	    int stride = ((hash >>> 8) | 1) & (size - 1);
++	    for (;;) {
++		Entry e1 = indexKey[probe];
++		if (e1 == e || e1 == null)
++		    return probe;
++		probe += stride;
++		if (probe >= size)  probe -= size;
++	    }
++	}
++	private void initializeIndex() {
++	    if (verbose() > 2)
++		System.out.println("initialize Index "+debugName+" ["+size()+"]");
++	    int hsize0 = (int)((cpMap.length + 10) * 1.5);
++	    int hsize = 1;
++	    while (hsize < hsize0)  hsize <<= 1;
++	    indexKey   = new Entry[hsize];
++	    indexValue = new int[hsize];
++	    for (int i = 0; i < cpMap.length; i++) {
++		Entry e = cpMap[i];
++		if (e == null)  continue;
++		int probe = findIndexLocation(e);
++		assert(indexKey[probe] == null);  // e has unique index
++		indexKey[probe] = e;
++		indexValue[probe] = i;
++	    }
++	}
++	public Object[] toArray(Object[] a) {
++	    int sz = size();
++	    if (a.length < sz)  return super.toArray(a);
++	    System.arraycopy(cpMap, 0, a, 0, sz);
++	    if (a.length > sz)  a[sz] = null;
++	    return a;
++	}
++	public Object[] toArray() {
++	    return toArray(new Entry[size()]);
++	}
++	public Object clone() {
++	    return new Index(debugName, (Entry[]) cpMap.clone());
++	}
++	public String toString() {
++	    return "Index "+debugName+" ["+size()+"]";
++	}
++	public String dumpString() {
++	    String s = toString();
++	    s += " {\n";
++	    for (int i = 0; i < cpMap.length; i++) {
++		s += "    "+i+": "+cpMap[i]+"\n";
++	    }
++	    s += "}";
++	    return s;
++	}
+     }
+ 
+     // Index methods.
+ 
+     public static
+     Index makeIndex(String debugName, Entry[] cpMap) {
+-        return new Index(debugName, cpMap);
++	return new Index(debugName, cpMap);
+     }
+ 
+     public static
+     Index makeIndex(String debugName, Collection cpMapList) {
+-        return new Index(debugName, cpMapList);
++	return new Index(debugName, cpMapList);
+     }
+ 
+     /** Sort this index (destructively) into canonical order. */
+     public static
+     void sort(Index ix) {
+-        // %%% Should move this into class Index.
+-        ix.clearIndex();
+-        Arrays.sort(ix.cpMap);
+-        if (verbose() > 2)
+-            System.out.println("sorted "+ix.dumpString());
++	// %%% Should move this into class Index.
++	ix.clearIndex();
++	Arrays.sort(ix.cpMap);
++	if (verbose() > 2)
++	    System.out.println("sorted "+ix.dumpString());
+     }
+ 
+     /** Return a set of indexes partitioning these entries.
+@@ -900,210 +900,212 @@ class ConstantPool implements Constants 
+      */
+     public static
+     Index[] partition(Index ix, int[] keys) {
+-        // %%% Should move this into class Index.
+-        ArrayList parts = new ArrayList();
+-        Entry[] cpMap = ix.cpMap;
+-        assert(keys.length == cpMap.length);
+-        for (int i = 0; i < keys.length; i++) {
+-            int key = keys[i];
+-            if (key < 0)  continue;
+-            while (key >= parts.size())  parts.add(null);
+-            ArrayList part = (ArrayList) parts.get(key);
+-            if (part == null) {
+-                parts.set(key, part = new ArrayList());
+-            }
+-            part.add(cpMap[i]);
+-        }
+-        Index[] indexes = new Index[parts.size()];
+-        for (int key = 0; key < indexes.length; key++) {
+-            ArrayList part = (ArrayList) parts.get(key);
+-            if (part == null)  continue;
+-            indexes[key] = new Index(ix.debugName+"/part#"+key, part);
+-            assert(indexes[key].indexOf(part.get(0)) == 0);
+-        }
+-        return indexes;
++	// %%% Should move this into class Index.
++	ArrayList parts = new ArrayList();
++	Entry[] cpMap = ix.cpMap;
++	assert(keys.length == cpMap.length);
++	for (int i = 0; i < keys.length; i++) {
++	    int key = keys[i];
++	    if (key < 0)  continue;
++	    while (key >= parts.size())  parts.add(null);
++	    ArrayList part = (ArrayList) parts.get(key);
++	    if (part == null) {
++		parts.set(key, part = new ArrayList());
++	    }
++	    part.add(cpMap[i]);
++	}
++	Index[] indexes = new Index[parts.size()];
++	for (int key = 0; key < indexes.length; key++) {
++	    ArrayList part = (ArrayList) parts.get(key);
++	    if (part == null)  continue;
++	    indexes[key] = new Index(ix.debugName+"/part#"+key, part);
++	    assert(indexes[key].indexOf(part.get(0)) == 0);
++	}
++	return indexes;
+     }
+     public static
+     Index[] partitionByTag(Index ix) {
+-        // Partition by tag.
+-        Entry[] cpMap = ix.cpMap;
+-        int[] keys = new int[cpMap.length];
+-        for (int i = 0; i < keys.length; i++) {
+-            Entry e = cpMap[i];
+-            keys[i] = (e == null)? -1: e.tag;
+-        }
+-        Index[] byTag = partition(ix, keys);
+-        for (int tag = 0; tag < byTag.length; tag++) {
+-            if (byTag[tag] == null)  continue;
+-            byTag[tag].debugName = tagName(tag);
+-        }
+-        if (byTag.length < CONSTANT_Limit) {
+-            Index[] longer = new Index[CONSTANT_Limit];
+-            System.arraycopy(byTag, 0, longer, 0, byTag.length);
+-            byTag = longer;
+-        }
+-        return byTag;
++	// Partition by tag.
++	Entry[] cpMap = ix.cpMap;
++	int[] keys = new int[cpMap.length];
++	for (int i = 0; i < keys.length; i++) {
++	    Entry e = cpMap[i];
++	    keys[i] = (e == null)? -1: e.tag;
++	}
++	Index[] byTag = partition(ix, keys);
++	for (int tag = 0; tag < byTag.length; tag++) {
++	    if (byTag[tag] == null)  continue;
++	    byTag[tag].debugName = tagName(tag);
++	}
++	if (byTag.length < CONSTANT_Limit) {
++	    Index[] longer = new Index[CONSTANT_Limit];
++	    System.arraycopy(byTag, 0, longer, 0, byTag.length);
++	    byTag = longer;
++	}
++	return byTag;
+     }
+ 
+     /** Coherent group of constant pool indexes. */
+     public static
+     class IndexGroup {
+-        private Index indexUntyped;
+-        private Index[] indexByTag = new Index[CONSTANT_Limit];
+-        private int[]   untypedFirstIndexByTag;
+-        private int     totalSize;
+-        private Index[][] indexByTagAndClass;
++	private Index indexUntyped;
++	private Index[] indexByTag = new Index[CONSTANT_Limit];
++	private int[]   untypedFirstIndexByTag;
++	private int     totalSize;
++	private Index[][] indexByTagAndClass;
+ 
+-        /** Index of all CP entries of all types, in definition order. */
+-        public Index getUntypedIndex() {
+-            if (indexUntyped == null) {
+-                untypedIndexOf(null);  // warm up untypedFirstIndexByTag
+-                Entry[] cpMap = new Entry[totalSize];
+-                for (int tag = 0; tag < indexByTag.length; tag++) {
+-                    Index ix = indexByTag[tag];
+-                    if (ix == null)  continue;
+-                    int ixLen = ix.cpMap.length;
+-                    if (ixLen == 0)  continue;
+-                    int fillp = untypedFirstIndexByTag[tag];
+-                    assert(cpMap[fillp] == null);
+-                    assert(cpMap[fillp+ixLen-1] == null);
+-                    System.arraycopy(ix.cpMap, 0, cpMap, fillp, ixLen);
+-                }
+-                indexUntyped = new Index("untyped", cpMap);
+-            }
+-            return indexUntyped;
+-        }
++	/** Index of all CP entries of all types, in definition order. */
++	public Index getUntypedIndex() {
++	    if (indexUntyped == null) {
++		untypedIndexOf(null);  // warm up untypedFirstIndexByTag
++		Entry[] cpMap = new Entry[totalSize];
++		for (int tag = 0; tag < indexByTag.length; tag++) {
++		    Index ix = indexByTag[tag];
++		    if (ix == null)  continue;
++		    int ixLen = ix.cpMap.length;
++		    if (ixLen == 0)  continue;
++		    int fillp = untypedFirstIndexByTag[tag];
++		    assert(cpMap[fillp] == null);
++		    assert(cpMap[fillp+ixLen-1] == null);
++		    System.arraycopy(ix.cpMap, 0, cpMap, fillp, ixLen);
++		}
++		indexUntyped = new Index("untyped", cpMap);
++	    }
++	    return indexUntyped;
++	}
+ 
+-        public int untypedIndexOf(Entry e) {
+-            if (untypedFirstIndexByTag == null) {
+-                untypedFirstIndexByTag = new int[CONSTANT_Limit];
+-                int fillp = 0;
+-                for (int i = 0; i < TAGS_IN_ORDER.length; i++) {
+-                    byte tag = TAGS_IN_ORDER[i];
+-                    Index ix = indexByTag[tag];
+-                    if (ix == null)  continue;
+-                    int ixLen = ix.cpMap.length;
+-                    untypedFirstIndexByTag[tag] = fillp;
+-                    fillp += ixLen;
+-                }
+-                totalSize = fillp;
+-            }
+-            if (e == null)  return -1;
+-            int tag = e.tag;
+-            Index ix = indexByTag[tag];
+-            if (ix == null)  return -1;
+-            int idx = ix.findIndexOf(e);
+-            if (idx >= 0)
+-                idx += untypedFirstIndexByTag[tag];
+-            return idx;
+-        }
++	public int untypedIndexOf(Entry e) {
++	    if (untypedFirstIndexByTag == null) {
++		untypedFirstIndexByTag = new int[CONSTANT_Limit];
++		int fillp = 0;
++		for (int i = 0; i < TAGS_IN_ORDER.length; i++) {
++		    byte tag = TAGS_IN_ORDER[i];
++		    Index ix = indexByTag[tag];
++		    if (ix == null)  continue;
++		    int ixLen = ix.cpMap.length;
++		    untypedFirstIndexByTag[tag] = fillp;
++		    fillp += ixLen;
++		}
++		totalSize = fillp;
++	    }
++	    if (e == null)  return -1;
++	    int tag = e.tag;
++	    Index ix = indexByTag[tag];
++	    if (ix == null)  return -1;
++	    int idx = ix.findIndexOf(e);
++	    if (idx >= 0)
++		idx += untypedFirstIndexByTag[tag];
++	    return idx;
++	}
+ 
+-        public void initIndexByTag(byte tag, Index ix) {
+-            assert(indexByTag[tag] == null);  // do not init twice
+-            Entry[] cpMap = ix.cpMap;
+-            for (int i = 0; i < cpMap.length; i++) {
+-                // It must be a homogeneous Entry set.
+-                assert(cpMap[i].tag == tag);
+-            }
+-            if (tag == CONSTANT_Utf8) {
+-                // Special case:  First Utf8 must always be empty string.
+-                assert(cpMap.length == 0 || cpMap[0].stringValue().equals(""));
+-            }
+-            indexByTag[tag] = ix;
+-            // decache indexes derived from this one:
+-            untypedFirstIndexByTag = null;
+-            indexUntyped = null;
+-            if (indexByTagAndClass != null)
+-                indexByTagAndClass[tag] = null;
+-        }
++	public void initIndexByTag(byte tag, Index ix) {
++	    assert(indexByTag[tag] == null);  // do not init twice
++	    Entry[] cpMap = ix.cpMap;
++	    for (int i = 0; i < cpMap.length; i++) {
++		// It must be a homogeneous Entry set.
++		assert(cpMap[i].tag == tag);
++	    }
++	    if (tag == CONSTANT_Utf8) {
++		// Special case:  First Utf8 must always be empty string.
++		assert(cpMap.length == 0 || cpMap[0].stringValue().equals(""));
++	    }
++	    indexByTag[tag] = ix;
++	    // decache indexes derived from this one:
++	    untypedFirstIndexByTag = null;
++	    indexUntyped = null;
++	    if (indexByTagAndClass != null)
++		indexByTagAndClass[tag] = null;
++	}
+ 
+-        /** Index of all CP entries of a given tag. */
+-        public Index getIndexByTag(byte tag) {
+-            if (tag == CONSTANT_All) {
+-                return getUntypedIndex();
+-            }
+-            Index ix = indexByTag[tag];
+-            if (ix == null) {
+-                // Make an empty one by default.
+-                ix = new Index(tagName(tag), new Entry[0]);
+-                indexByTag[tag] = ix;
+-            }
+-            return ix;
+-        }
++	/** Index of all CP entries of a given tag. */
++	public Index getIndexByTag(byte tag) {
++	    if (tag == CONSTANT_All) {
++		return getUntypedIndex();
++	    }
++	    Index ix = indexByTag[tag];
++	    if (ix == null) {
++		// Make an empty one by default.
++		ix = new Index(tagName(tag), new Entry[0]);
++		indexByTag[tag] = ix;
++	    }
++	    return ix;
++	}
+ 
+-        /** Index of all CP entries of a given tag and class. */
+-        public Index getMemberIndex(byte tag, ClassEntry classRef) {
+-            if (indexByTagAndClass == null)
+-                indexByTagAndClass = new Index[CONSTANT_Limit][];
+-            Index allClasses =  getIndexByTag(CONSTANT_Class);
+-            Index[] perClassIndexes = indexByTagAndClass[tag];
+-            if (perClassIndexes == null) {
+-                // Create the partition now.
+-                // Divide up all entries of the given tag according to their class.
+-                Index allMembers = getIndexByTag(tag);
+-                int[] whichClasses = new int[allMembers.size()];
+-                for (int i = 0; i < whichClasses.length; i++) {
+-                    MemberEntry e = (MemberEntry) allMembers.get(i);
+-                    int whichClass = allClasses.indexOf(e.classRef);
+-                    whichClasses[i] = whichClass;
+-                }
+-                perClassIndexes = partition(allMembers, whichClasses);
+-                for (int i = 0; i < perClassIndexes.length; i++)
+-                    assert(perClassIndexes[i]==null
+-                            || perClassIndexes[i].assertIsSorted());
+-                indexByTagAndClass[tag] = perClassIndexes;
+-            }
+-            int whichClass = allClasses.indexOf(classRef);
+-            return perClassIndexes[whichClass];
+-        }
++	/** Index of all CP entries of a given tag and class. */
++	public Index getMemberIndex(byte tag, ClassEntry classRef) {
++	    if (classRef == null)
++		throw new RuntimeException("missing class reference for " + tagName(tag));
++	    if (indexByTagAndClass == null)
++		indexByTagAndClass = new Index[CONSTANT_Limit][];
++	    Index allClasses =  getIndexByTag(CONSTANT_Class);
++	    Index[] perClassIndexes = indexByTagAndClass[tag];
++	    if (perClassIndexes == null) {
++		// Create the partition now.
++		// Divide up all entries of the given tag according to their class.
++		Index allMembers = getIndexByTag(tag);
++		int[] whichClasses = new int[allMembers.size()];
++		for (int i = 0; i < whichClasses.length; i++) {
++		    MemberEntry e = (MemberEntry) allMembers.get(i);
++		    int whichClass = allClasses.indexOf(e.classRef);
++		    whichClasses[i] = whichClass;
++		}
++		perClassIndexes = partition(allMembers, whichClasses);
++		for (int i = 0; i < perClassIndexes.length; i++)
++		    assert(perClassIndexes[i]==null
++			    || perClassIndexes[i].assertIsSorted());
++		indexByTagAndClass[tag] = perClassIndexes;
++	    }
++	    int whichClass = allClasses.indexOf(classRef);
++	    return perClassIndexes[whichClass];
++	}
+ 
+-        // Given the sequence of all methods of the given name and class,
+-        // produce the ordinal of this particular given overloading.
+-        public int getOverloadingIndex(MemberEntry methodRef) {
+-            Index ix = getMemberIndex(methodRef.tag, methodRef.classRef);
+-            Utf8Entry nameRef = methodRef.descRef.nameRef;
+-            int ord = 0;
+-            for (int i = 0; i < ix.cpMap.length; i++) {
+-                MemberEntry e = (MemberEntry) ix.cpMap[i];
+-                if (e.equals(methodRef))
+-                    return ord;
+-                if (e.descRef.nameRef.equals(nameRef))
+-                    // Found a different overloading.  Increment the ordinal.
+-                    ord++;
+-            }
+-            throw new RuntimeException("should not reach here");
+-        }
++	// Given the sequence of all methods of the given name and class,
++	// produce the ordinal of this particular given overloading.
++	public int getOverloadingIndex(MemberEntry methodRef) {
++	    Index ix = getMemberIndex(methodRef.tag, methodRef.classRef);
++	    Utf8Entry nameRef = methodRef.descRef.nameRef;
++	    int ord = 0;
++	    for (int i = 0; i < ix.cpMap.length; i++) {
++		MemberEntry e = (MemberEntry) ix.cpMap[i];
++		if (e.equals(methodRef))
++		    return ord;
++		if (e.descRef.nameRef.equals(nameRef))
++		    // Found a different overloading.  Increment the ordinal.
++		    ord++;
++	    }
++	    throw new RuntimeException("should not reach here");
++	}
+ 
+-        // Inverse of getOverloadingIndex
+-        public MemberEntry getOverloadingForIndex(byte tag, ClassEntry classRef, String name, int which) {
+-            assert(name == name.intern());
+-            Index ix = getMemberIndex(tag, classRef);
+-            int ord = 0;
+-            for (int i = 0; i < ix.cpMap.length; i++) {
+-                MemberEntry e = (MemberEntry) ix.cpMap[i];
+-                if (e.descRef.nameRef.stringValue() == name) {
+-                    if (ord == which)  return e;
+-                    ord++;
+-                }
+-            }
+-            throw new RuntimeException("should not reach here");
+-        }
++	// Inverse of getOverloadingIndex
++	public MemberEntry getOverloadingForIndex(byte tag, ClassEntry classRef, String name, int which) {
++	    assert(name == name.intern());
++	    Index ix = getMemberIndex(tag, classRef);
++	    int ord = 0;
++	    for (int i = 0; i < ix.cpMap.length; i++) {
++		MemberEntry e = (MemberEntry) ix.cpMap[i];
++		if (e.descRef.nameRef.stringValue() == name) {
++		    if (ord == which)  return e;
++		    ord++;
++		}
++	    }
++	    throw new RuntimeException("should not reach here");
++	}
+ 
+-        public boolean haveNumbers() {
+-            for (byte tag = CONSTANT_Integer; tag <= CONSTANT_Double; tag++) {
+-                switch (tag) {
+-                case CONSTANT_Integer:
+-                case CONSTANT_Float:
+-                case CONSTANT_Long:
+-                case CONSTANT_Double:
+-                    break;
+-                default:
+-                    assert(false);
+-                }
+-                if (getIndexByTag(tag).size() > 0)  return true;
+-            }
+-            return false;
+-        }
++	public boolean haveNumbers() {
++	    for (byte tag = CONSTANT_Integer; tag <= CONSTANT_Double; tag++) {
++		switch (tag) {
++		case CONSTANT_Integer:
++		case CONSTANT_Float:
++		case CONSTANT_Long:
++		case CONSTANT_Double:
++		    break;
++		default:
++		    assert(false);
++		}
++		if (getIndexByTag(tag).size() > 0)  return true;
++	    }
++	    return false;
++	}
+ 
+     }
+ 
+@@ -1114,84 +1116,84 @@ class ConstantPool implements Constants 
+      */
+     public static
+     void completeReferencesIn(Set cpRefs, boolean flattenSigs) {
+-        cpRefs.remove(null);
+-        for (ListIterator work =
+-                 new ArrayList(cpRefs).listIterator(cpRefs.size());
+-             work.hasPrevious(); ) {
+-            Entry e = (Entry) work.previous();
+-            work.remove();          // pop stack
+-            assert(e != null);
+-            if (flattenSigs && e.tag == CONSTANT_Signature) {
+-                SignatureEntry se = (SignatureEntry) e;
+-                Utf8Entry      ue = se.asUtf8Entry();
+-                // Totally replace e by se.
+-                cpRefs.remove(se);
+-                cpRefs.add(ue);
+-                e = ue;   // do not descend into the sig
+-            }
+-            // Recursively add the refs of e to cpRefs:
+-            for (int i = 0; ; i++) {
+-                Entry re = e.getRef(i);
+-                if (re == null)
+-                    break;          // no more refs in e
+-                if (cpRefs.add(re)) // output the ref
+-                    work.add(re);   // push stack, if a new ref
+-            }
+-        }
++	cpRefs.remove(null);
++	for (ListIterator work =
++		 new ArrayList(cpRefs).listIterator(cpRefs.size());
++	     work.hasPrevious(); ) {
++	    Entry e = (Entry) work.previous();
++	    work.remove();          // pop stack
++	    assert(e != null);
++	    if (flattenSigs && e.tag == CONSTANT_Signature) {
++		SignatureEntry se = (SignatureEntry) e;
++		Utf8Entry      ue = se.asUtf8Entry();
++		// Totally replace e by se.
++		cpRefs.remove(se);
++		cpRefs.add(ue);
++		e = ue;   // do not descend into the sig
++	    }
++	    // Recursively add the refs of e to cpRefs:
++	    for (int i = 0; ; i++) {
++		Entry re = e.getRef(i);
++		if (re == null)
++		    break;          // no more refs in e
++		if (cpRefs.add(re)) // output the ref
++		    work.add(re);   // push stack, if a new ref
++	    }
++	}
+     }
+ 
+     static double percent(int num, int den) {
+-        return (int)((10000.0*num)/den + 0.5) / 100.0;
++	return (int)((10000.0*num)/den + 0.5) / 100.0;
+     }
+ 
+     public static String tagName(int tag) {
+-        switch (tag) {
+-            case CONSTANT_Utf8:                 return "Utf8";
+-            case CONSTANT_Integer:              return "Integer";
+-            case CONSTANT_Float:                return "Float";
+-            case CONSTANT_Long:                 return "Long";
+-            case CONSTANT_Double:               return "Double";
+-            case CONSTANT_Class:                return "Class";
+-            case CONSTANT_String:               return "String";
+-            case CONSTANT_Fieldref:             return "Fieldref";
+-            case CONSTANT_Methodref:            return "Methodref";
+-            case CONSTANT_InterfaceMethodref:   return "InterfaceMethodref";
+-            case CONSTANT_NameandType:          return "NameandType";
++	switch (tag) {
++	    case CONSTANT_Utf8:			return "Utf8";
++	    case CONSTANT_Integer:		return "Integer";
++	    case CONSTANT_Float:		return "Float";
++	    case CONSTANT_Long:			return "Long";
++	    case CONSTANT_Double:		return "Double";
++	    case CONSTANT_Class:		return "Class";
++	    case CONSTANT_String:		return "String";
++	    case CONSTANT_Fieldref:		return "Fieldref";
++	    case CONSTANT_Methodref:		return "Methodref";
++	    case CONSTANT_InterfaceMethodref:	return "InterfaceMethodref";
++	    case CONSTANT_NameandType:		return "NameandType";
+ 
+-                // pseudo-tags:
+-            case CONSTANT_All:                  return "*All";
+-            case CONSTANT_None:                 return "*None";
+-            case CONSTANT_Signature:            return "*Signature";
+-        }
+-        return "tag#"+tag;
++		// pseudo-tags:
++	    case CONSTANT_All:			return "*All";
++	    case CONSTANT_None:			return "*None";
++	    case CONSTANT_Signature:		return "*Signature";
++	}
++	return "tag#"+tag;
+     }
+ 
+     // archive constant pool definition order
+     static final byte TAGS_IN_ORDER[] = {
+-        CONSTANT_Utf8,
+-        CONSTANT_Integer,           // cp_Int
+-        CONSTANT_Float,
+-        CONSTANT_Long,
+-        CONSTANT_Double,
+-        CONSTANT_String,
+-        CONSTANT_Class,
+-        CONSTANT_Signature,
+-        CONSTANT_NameandType,       // cp_Descr
+-        CONSTANT_Fieldref,          // cp_Field
+-        CONSTANT_Methodref,         // cp_Method
+-        CONSTANT_InterfaceMethodref // cp_Imethod
++	CONSTANT_Utf8,
++	CONSTANT_Integer,           // cp_Int
++	CONSTANT_Float,
++	CONSTANT_Long,
++	CONSTANT_Double,
++	CONSTANT_String,
++	CONSTANT_Class,
++	CONSTANT_Signature,
++	CONSTANT_NameandType,       // cp_Descr
++	CONSTANT_Fieldref,          // cp_Field
++	CONSTANT_Methodref,         // cp_Method
++	CONSTANT_InterfaceMethodref // cp_Imethod
+     };
+     static final byte TAG_ORDER[];
+     static {
+-        TAG_ORDER = new byte[CONSTANT_Limit];
+-        for (int i = 0; i < TAGS_IN_ORDER.length; i++) {
+-            TAG_ORDER[TAGS_IN_ORDER[i]] = (byte)(i+1);
+-        }
+-        /*
+-        System.out.println("TAG_ORDER[] = {");
+-        for (int i = 0; i < TAG_ORDER.length; i++)
+-            System.out.println("  "+TAG_ORDER[i]+",");
+-        System.out.println("};");
+-        */
++	TAG_ORDER = new byte[CONSTANT_Limit];
++	for (int i = 0; i < TAGS_IN_ORDER.length; i++) {
++	    TAG_ORDER[TAGS_IN_ORDER[i]] = (byte)(i+1);
++	}
++	/*
++	System.out.println("TAG_ORDER[] = {");
++	for (int i = 0; i < TAG_ORDER.length; i++)
++	    System.out.println("  "+TAG_ORDER[i]+",");
++	System.out.println("};");
++	*/
+     }
+ }
+diff --git a/src/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java b/src/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java
+--- jdk/src/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java
++++ jdk/src/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -22,7 +22,6 @@
+  * or visit www.oracle.com if you need additional information or have any
+  * questions.
+  */
+-
+ 
+ package com.sun.java.util.jar.pack;
+ 
+@@ -81,239 +80,246 @@ class NativeUnpack {
+     private  PropMap _props;
+ 
+     static {
+-        // If loading from stand alone build uncomment this.
+-        // System.loadLibrary("unpack");
+-        java.security.AccessController.doPrivileged(
+-                new sun.security.action.LoadLibraryAction("unpack"));
+-        initIDs();
++    	// If loading from stand alone build uncomment this.
++	// System.loadLibrary("unpack");
++	java.security.AccessController.doPrivileged(
++		new sun.security.action.LoadLibraryAction("unpack"));
++	initIDs();
+     }
+-
++    
+     NativeUnpack(UnpackerImpl p200) {
+-        super();
+-        _p200  = p200;
+-        _props = p200._props;
+-        p200._nunp = this;
++	super();
++	_p200  = p200;
++	_props = p200._props;
++	p200._nunp = this;
+     }
+ 
+     // for JNI callbacks
+     static private Object currentInstance() {
+-        UnpackerImpl p200 = (UnpackerImpl) Utils.currentInstance.get();
+-        return (p200 == null)? null: p200._nunp;
++	UnpackerImpl p200 = (UnpackerImpl) Utils.currentInstance.get();
++	return (p200 == null)? null: p200._nunp;
++    }
++    
++    private synchronized long getUnpackerPtr() {
++	return unpackerPtr;
+     }
+ 
+     // Callback from the unpacker engine to get more data.
+     private long readInputFn(ByteBuffer pbuf, long minlen) throws IOException {
+-        if (in == null)  return 0;  // nothing is readable
+-        long maxlen = pbuf.capacity() - pbuf.position();
+-        assert(minlen <= maxlen);  // don't talk nonsense
+-        long numread = 0;
+-        int steps = 0;
+-        while (numread < minlen) {
+-            steps++;
+-            // read available input, up to buf.length or maxlen
+-            int readlen = _buf.length;
+-            if (readlen > (maxlen - numread))
+-                readlen = (int)(maxlen - numread);
+-            int nr = in.read(_buf, 0, readlen);
+-            if (nr <= 0)  break;
+-            numread += nr;
+-            assert(numread <= maxlen);
+-            // %%% get rid of this extra copy by using nio?
+-            pbuf.put(_buf, 0, nr);
+-        }
+-        if (_verbose > 1)
+-            Utils.log.fine("readInputFn("+minlen+","+maxlen+") => "+numread+" steps="+steps);
+-        if (maxlen > 100) {
+-            _estByteLimit = _byteCount + maxlen;
+-        } else {
+-            _estByteLimit = (_byteCount + numread) * 20;
+-        }
+-        _byteCount += numread;
+-        updateProgress();
+-        return numread;
++	if (in == null)  return 0;  // nothing is readable
++	long maxlen = pbuf.capacity() - pbuf.position();
++	assert(minlen <= maxlen);  // don't talk nonsense
++	long numread = 0;
++	int steps = 0;
++	while (numread < minlen) {
++	    steps++;
++	    // read available input, up to buf.length or maxlen
++	    int readlen = _buf.length;
++	    if (readlen > (maxlen - numread))
++		readlen = (int)(maxlen - numread);
++	    int nr = in.read(_buf, 0, readlen);
++	    if (nr <= 0)  break;
++	    numread += nr;
++	    assert(numread <= maxlen);
++	    // %%% get rid of this extra copy by using nio?
++	    pbuf.put(_buf, 0, nr);
++	}
++	if (_verbose > 1)
++	    Utils.log.fine("readInputFn("+minlen+","+maxlen+") => "+numread+" steps="+steps);
++	if (maxlen > 100) {
++	    _estByteLimit = _byteCount + maxlen;
++	} else {
++	    _estByteLimit = (_byteCount + numread) * 20;
++	}
++	_byteCount += numread;
++	updateProgress();
++	return numread;
+     }
+ 
+     private void updateProgress() {
+-        // Progress is a combination of segment reading and file writing.
+-        final double READ_WT  = 0.33;
+-        final double WRITE_WT = 0.67;
+-        double readProgress = _segCount;
+-        if (_estByteLimit > 0 && _byteCount > 0)
+-            readProgress += (double)_byteCount / _estByteLimit;
+-        double writeProgress = _fileCount;
+-        double scaledProgress
+-            = READ_WT  * readProgress  / Math.max(_estSegLimit,1)
+-            + WRITE_WT * writeProgress / Math.max(_estFileLimit,1);
+-        int percent = (int) Math.round(100*scaledProgress);
+-        if (percent > 100)  percent = 100;
+-        if (percent > _prevPercent) {
+-            _prevPercent = percent;
+-            _props.setInteger(Pack200.Unpacker.PROGRESS, percent);
+-            if (_verbose > 0)
+-                Utils.log.info("progress = "+percent);
+-        }
++	// Progress is a combination of segment reading and file writing.
++	final double READ_WT  = 0.33;
++	final double WRITE_WT = 0.67;
++	double readProgress = _segCount;
++	if (_estByteLimit > 0 && _byteCount > 0)
++	    readProgress += (double)_byteCount / _estByteLimit;
++	double writeProgress = _fileCount;
++	double scaledProgress
++	    = READ_WT  * readProgress  / Math.max(_estSegLimit,1)
++	    + WRITE_WT * writeProgress / Math.max(_estFileLimit,1);
++	int percent = (int) Math.round(100*scaledProgress);
++	if (percent > 100)  percent = 100;
++	if (percent > _prevPercent) {
++	    _prevPercent = percent;
++	    _props.setInteger(Pack200.Unpacker.PROGRESS, percent);
++	    if (_verbose > 0)
++		Utils.log.info("progress = "+percent);
++	}
+     }
+ 
+     private void copyInOption(String opt) {
+-        String val = _props.getProperty(opt);
+-        if (_verbose > 0)
+-            Utils.log.info("set "+opt+"="+val);
+-        if (val != null) {
+-            boolean set = setOption(opt, val);
+-            if (!set)
+-                Utils.log.warning("Invalid option "+opt+"="+val);
+-        }
++	String val = _props.getProperty(opt);
++	if (_verbose > 0)
++	    Utils.log.info("set "+opt+"="+val);
++	if (val != null) {
++	    boolean set = setOption(opt, val);
++	    if (!set)
++		Utils.log.warning("Invalid option "+opt+"="+val);
++	}
+     }
+ 
+     void run(InputStream inRaw, JarOutputStream jstream,
+-             ByteBuffer presetInput) throws IOException {
+-        BufferedInputStream in = new BufferedInputStream(inRaw);
+-        this.in = in;    // for readInputFn to see
+-        _verbose = _props.getInteger(Utils.DEBUG_VERBOSE);
+-        // Fix for BugId: 4902477, -unpack.modification.time = 1059010598000
++	     ByteBuffer presetInput) throws IOException {
++	BufferedInputStream in = new BufferedInputStream(inRaw);
++	this.in = in;    // for readInputFn to see
++	_verbose = _props.getInteger(Utils.DEBUG_VERBOSE);
++	// Fix for BugId: 4902477, -unpack.modification.time = 1059010598000
+         // TODO eliminate and fix in unpack.cpp
++	
++	final int modtime = Pack200.Packer.KEEP.equals(_props.getProperty(Utils.UNPACK_MODIFICATION_TIME, "0")) ?
++		Constants.NO_MODTIME : _props.getTime(Utils.UNPACK_MODIFICATION_TIME);
+ 
+-        final int modtime = Pack200.Packer.KEEP.equals(_props.getProperty(Utils.UNPACK_MODIFICATION_TIME, "0")) ?
+-                Constants.NO_MODTIME : _props.getTime(Utils.UNPACK_MODIFICATION_TIME);
++	copyInOption(Utils.DEBUG_VERBOSE);
++	copyInOption(Pack200.Unpacker.DEFLATE_HINT);
++	if (modtime == Constants.NO_MODTIME)  // Dont pass KEEP && NOW
++	    copyInOption(Utils.UNPACK_MODIFICATION_TIME);
++	updateProgress();  // reset progress bar
++	for (;;) {
++	    // Read the packed bits.
++	    long counts = start(presetInput, 0);
++	    _byteCount = _estByteLimit = 0;  // reset partial scan counts
++	    ++_segCount;  // just finished scanning a whole segment...
++	    int nextSeg  = (int)( counts >>> 32 );
++	    int nextFile = (int)( counts >>>  0 );
+ 
+-        copyInOption(Utils.DEBUG_VERBOSE);
+-        copyInOption(Pack200.Unpacker.DEFLATE_HINT);
+-        if (modtime == Constants.NO_MODTIME)  // Dont pass KEEP && NOW
+-            copyInOption(Utils.UNPACK_MODIFICATION_TIME);
+-        updateProgress();  // reset progress bar
+-        for (;;) {
+-            // Read the packed bits.
+-            long counts = start(presetInput, 0);
+-            _byteCount = _estByteLimit = 0;  // reset partial scan counts
+-            ++_segCount;  // just finished scanning a whole segment...
+-            int nextSeg  = (int)( counts >>> 32 );
+-            int nextFile = (int)( counts >>>  0 );
++	    // Estimate eventual total number of segments and files.
++	    _estSegLimit = _segCount + nextSeg;
++	    double filesAfterThisSeg = _fileCount + nextFile;
++	    _estFileLimit = (int)( (filesAfterThisSeg *
++				    _estSegLimit) / _segCount );
+ 
+-            // Estimate eventual total number of segments and files.
+-            _estSegLimit = _segCount + nextSeg;
+-            double filesAfterThisSeg = _fileCount + nextFile;
+-            _estFileLimit = (int)( (filesAfterThisSeg *
+-                                    _estSegLimit) / _segCount );
++	    // Write the files.
++	    int[] intParts = { 0,0, 0, 0 };
++	    //    intParts = {size.hi/lo, mod, defl}
++	    Object[] parts = { intParts, null, null, null };
++	    //       parts = { {intParts}, name, data0/1 }
++	    while (getNextFile(parts)) {
++		//BandStructure.printArrayTo(System.out, intParts, 0, parts.length);
++		String name = (String) parts[1];
++		long   size = ( (long)intParts[0] << 32)
++			    + (((long)intParts[1] << 32) >>> 32);
+ 
+-            // Write the files.
+-            int[] intParts = { 0,0, 0, 0 };
+-            //    intParts = {size.hi/lo, mod, defl}
+-            Object[] parts = { intParts, null, null, null };
+-            //       parts = { {intParts}, name, data0/1 }
+-            while (getNextFile(parts)) {
+-                //BandStructure.printArrayTo(System.out, intParts, 0, parts.length);
+-                String name = (String) parts[1];
+-                long   size = ( (long)intParts[0] << 32)
+-                            + (((long)intParts[1] << 32) >>> 32);
+-
+-                long   mtime = (modtime != Constants.NO_MODTIME ) ?
+-                                modtime : intParts[2] ;
+-                boolean deflateHint = (intParts[3] != 0);
+-                ByteBuffer data0 = (ByteBuffer) parts[2];
+-                ByteBuffer data1 = (ByteBuffer) parts[3];
+-                writeEntry(jstream, name, mtime, size, deflateHint,
+-                           data0, data1);
+-                ++_fileCount;
+-                updateProgress();
+-            }
+-            long consumed = finish();
+-            if (_verbose > 0)
+-                Utils.log.info("bytes consumed = "+consumed);
+-            presetInput = getUnusedInput();
+-            if (presetInput == null &&
+-                !Utils.isPackMagic(Utils.readMagic(in))) {
+-                break;
+-            }
+-            if (_verbose > 0 ) {
+-                if (presetInput != null)
+-                    Utils.log.info("unused input = "+presetInput);
+-            }
+-        }
++		long   mtime = (modtime != Constants.NO_MODTIME ) ?
++				modtime : intParts[2] ;
++		boolean deflateHint = (intParts[3] != 0);
++		ByteBuffer data0 = (ByteBuffer) parts[2];
++		ByteBuffer data1 = (ByteBuffer) parts[3];
++		writeEntry(jstream, name, mtime, size, deflateHint,
++			   data0, data1);
++		++_fileCount;
++		updateProgress();
++	    }
++	    long consumed = finish();
++	    if (_verbose > 0)
++		Utils.log.info("bytes consumed = "+consumed);
++	    presetInput = getUnusedInput();
++	    if (presetInput == null &&
++		!Utils.isPackMagic(Utils.readMagic(in))) {
++		break;
++	    }
++	    if (_verbose > 0 ) {
++		if (presetInput != null)
++		    Utils.log.info("unused input = "+presetInput);
++	    }
++	}
+     }
+ 
+     void run(InputStream in, JarOutputStream jstream) throws IOException {
+-        run(in, jstream, null);
++	run(in, jstream, null);
+     }
+ 
+     void run(File inFile, JarOutputStream jstream) throws IOException {
+-        // %%% maybe memory-map the file, and pass it straight into unpacker
+-        ByteBuffer mappedFile = null;
+-        FileInputStream fis = new FileInputStream(inFile);
+-        run(fis, jstream, mappedFile);
+-        fis.close();
+-        // Note:  caller is responsible to finish with jstream.
++	// %%% maybe memory-map the file, and pass it straight into unpacker
++	ByteBuffer mappedFile = null;
++	FileInputStream fis = new FileInputStream(inFile);
++	run(fis, jstream, mappedFile);
++	fis.close();
++	// Note:  caller is responsible to finish with jstream.
+     }
++    
++    private void writeEntry(JarOutputStream j, String name,
++			    long mtime, long lsize, boolean deflateHint,
++			    ByteBuffer data0, ByteBuffer data1) throws IOException {
++	int size = (int)lsize;
++	if (size != lsize)
++	    throw new IOException("file too large: "+lsize);
+ 
+-    private void writeEntry(JarOutputStream j, String name,
+-                            long mtime, long lsize, boolean deflateHint,
+-                            ByteBuffer data0, ByteBuffer data1) throws IOException {
+-        int size = (int)lsize;
+-        if (size != lsize)
+-            throw new IOException("file too large: "+lsize);
++	CRC32 crc32 = _crc32;
+ 
+-        CRC32 crc32 = _crc32;
++	if (_verbose > 1)
++	    Utils.log.fine("Writing entry: "+name+" size="+size
++			     +(deflateHint?" deflated":""));
+ 
+-        if (_verbose > 1)
+-            Utils.log.fine("Writing entry: "+name+" size="+size
+-                             +(deflateHint?" deflated":""));
++	if (_buf.length < size) {
++	    int newSize = size;
++	    while (newSize < _buf.length) {
++		newSize <<= 1;
++		if (newSize <= 0) {
++		    newSize = size;
++		    break;
++		}
++	    }
++	    _buf = new byte[newSize];
++	}
++	assert(_buf.length >= size);
+ 
+-        if (_buf.length < size) {
+-            int newSize = size;
+-            while (newSize < _buf.length) {
+-                newSize <<= 1;
+-                if (newSize <= 0) {
+-                    newSize = size;
+-                    break;
+-                }
+-            }
+-            _buf = new byte[newSize];
+-        }
+-        assert(_buf.length >= size);
++	int fillp = 0;
++	if (data0 != null) {
++	    int size0 = data0.capacity();
++	    data0.get(_buf, fillp, size0);
++	    fillp += size0;
++	}
++	if (data1 != null) {
++	    int size1 = data1.capacity();
++	    data1.get(_buf, fillp, size1);
++	    fillp += size1;
++	}
++	while (fillp < size) {
++	    // Fill in rest of data from the stream itself.
++	    int nr = in.read(_buf, fillp, size - fillp);
++	    if (nr <= 0)  throw new IOException("EOF at end of archive");
++	    fillp += nr;
++	}
+ 
+-        int fillp = 0;
+-        if (data0 != null) {
+-            int size0 = data0.capacity();
+-            data0.get(_buf, fillp, size0);
+-            fillp += size0;
+-        }
+-        if (data1 != null) {
+-            int size1 = data1.capacity();
+-            data1.get(_buf, fillp, size1);
+-            fillp += size1;
+-        }
+-        while (fillp < size) {
+-            // Fill in rest of data from the stream itself.
+-            int nr = in.read(_buf, fillp, size - fillp);
+-            if (nr <= 0)  throw new IOException("EOF at end of archive");
+-            fillp += nr;
+-        }
++	ZipEntry z = new ZipEntry(name);
++	z.setTime( (long)mtime * 1000);
++	
++	if (size == 0) {
++	    z.setMethod(ZipOutputStream.STORED);
++	    z.setSize(0);
++	    z.setCrc(0);
++	    z.setCompressedSize(0);
++	} else if (!deflateHint) {
++	    z.setMethod(ZipOutputStream.STORED);
++	    z.setSize(size);
++	    z.setCompressedSize(size);
++	    crc32.reset();
++	    crc32.update(_buf, 0, size);
++	    z.setCrc(crc32.getValue());
++	} else {
++	    z.setMethod(Deflater.DEFLATED);
++	    z.setSize(size);
++	}
+ 
+-        ZipEntry z = new ZipEntry(name);
+-        z.setTime( (long)mtime * 1000);
++	j.putNextEntry(z);
+ 
+-        if (size == 0) {
+-            z.setMethod(ZipOutputStream.STORED);
+-            z.setSize(0);
+-            z.setCrc(0);
+-            z.setCompressedSize(0);
+-        } else if (!deflateHint) {
+-            z.setMethod(ZipOutputStream.STORED);
+-            z.setSize(size);
+-            z.setCompressedSize(size);
+-            crc32.reset();
+-            crc32.update(_buf, 0, size);
+-            z.setCrc(crc32.getValue());
+-        } else {
+-            z.setMethod(Deflater.DEFLATED);
+-            z.setSize(size);
+-        }
++	if (size > 0)
++	    j.write(_buf, 0, size);
+ 
+-        j.putNextEntry(z);
+-
+-        if (size > 0)
+-            j.write(_buf, 0, size);
+-
+-        j.closeEntry();
+-        if (_verbose > 0) Utils.log.info("Writing " + Utils.zeString(z));
++	j.closeEntry();
++	if (_verbose > 0) Utils.log.info("Writing " + Utils.zeString(z));
+     }
+ }
++
++
++
+diff --git a/src/share/classes/com/sun/java/util/jar/pack/PackerImpl.java b/src/share/classes/com/sun/java/util/jar/pack/PackerImpl.java
+--- jdk/src/share/classes/com/sun/java/util/jar/pack/PackerImpl.java
++++ jdk/src/share/classes/com/sun/java/util/jar/pack/PackerImpl.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -22,7 +22,6 @@
+  * or visit www.oracle.com if you need additional information or have any
+  * questions.
+  */
+-
+ package com.sun.java.util.jar.pack;
+ 
+ import java.util.*;
+@@ -48,9 +47,9 @@ public class PackerImpl implements Pack2
+      * the packer engines.
+      */
+     public PackerImpl() {
+-        _props = new PropMap();
+-        //_props.getProperty() consults defaultProps invisibly.
+-        //_props.putAll(defaultProps);
++	_props = new PropMap();
++	//_props.getProperty() consults defaultProps invisibly.
++	//_props.putAll(defaultProps);
+     }
+ 
+ 
+@@ -62,7 +61,7 @@ public class PackerImpl implements Pack2
+      * @return A sorted association of option key strings to option values.
+      */
+     public SortedMap properties() {
+-        return _props;
++	return _props;
+     }
+ 
+ 
+@@ -76,24 +75,24 @@ public class PackerImpl implements Pack2
+      * @param out an OutputStream
+      * @exception IOException if an error is encountered.
+      */
+-    public void pack(JarFile in, OutputStream out) throws IOException {
+-        assert(Utils.currentInstance.get() == null);
+-        TimeZone tz = (_props.getBoolean(Utils.PACK_DEFAULT_TIMEZONE)) ? null :
+-            TimeZone.getDefault();
+-        try {
+-            Utils.currentInstance.set(this);
+-            if (tz != null) TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
++    public synchronized void pack(JarFile in, OutputStream out) throws IOException {
++	assert(Utils.currentInstance.get() == null);
++	TimeZone tz = (_props.getBoolean(Utils.PACK_DEFAULT_TIMEZONE)) ? null :
++	    TimeZone.getDefault();
++	try {
++	    Utils.currentInstance.set(this);
++	    if (tz != null) TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+ 
+-            if ("0".equals(_props.getProperty(Pack200.Packer.EFFORT))) {
+-                Utils.copyJarFile(in, out);
+-            } else {
+-                (new DoPack()).run(in, out);
+-                in.close();
+-            }
+-        } finally {
+-            Utils.currentInstance.set(null);
+-            if (tz != null) TimeZone.setDefault(tz);
+-        }
++	    if ("0".equals(_props.getProperty(Pack200.Packer.EFFORT))) {
++		Utils.copyJarFile(in, out);
++	    } else {
++		(new DoPack()).run(in, out);
++		in.close();
++	    }
++	} finally {
++	    Utils.currentInstance.set(null);
++	    if (tz != null) TimeZone.setDefault(tz);
++	}
+     }
+ 
+     /**
+@@ -110,39 +109,39 @@ public class PackerImpl implements Pack2
+      * @param out an OutputStream
+      * @exception IOException if an error is encountered.
+      */
+-    public void pack(JarInputStream in, OutputStream out) throws IOException {
+-        assert(Utils.currentInstance.get() == null);
+-        TimeZone tz = (_props.getBoolean(Utils.PACK_DEFAULT_TIMEZONE)) ? null :
+-            TimeZone.getDefault();
+-        try {
+-            Utils.currentInstance.set(this);
+-            if (tz != null) TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+-            if ("0".equals(_props.getProperty(Pack200.Packer.EFFORT))) {
+-                Utils.copyJarFile(in, out);
+-            } else {
+-                (new DoPack()).run(in, out);
+-                in.close();
+-            }
+-        } finally {
+-            Utils.currentInstance.set(null);
+-            if (tz != null) TimeZone.setDefault(tz);
++    public synchronized void pack(JarInputStream in, OutputStream out) throws IOException {
++	assert(Utils.currentInstance.get() == null);
++	TimeZone tz = (_props.getBoolean(Utils.PACK_DEFAULT_TIMEZONE)) ? null :
++	    TimeZone.getDefault();
++	try {
++	    Utils.currentInstance.set(this);
++	    if (tz != null) TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
++	    if ("0".equals(_props.getProperty(Pack200.Packer.EFFORT))) {
++		Utils.copyJarFile(in, out);
++	    } else {
++		(new DoPack()).run(in, out);
++		in.close();
++	    }
++	} finally {
++	    Utils.currentInstance.set(null);
++	    if (tz != null) TimeZone.setDefault(tz);
+ 
+-        }
++	}
+     }
+     /**
+      * Register a listener for changes to options.
+-     * @param listener  An object to be invoked when a property is changed.
++     * @param listener	An object to be invoked when a property is changed.
+      */
+     public void addPropertyChangeListener(PropertyChangeListener listener) {
+-        _props.addListener(listener);
++	_props.addListener(listener);
+     }
+ 
+     /**
+      * Remove a listener for the PropertyChange event.
+-     * @param listener  The PropertyChange listener to be removed.
++     * @param listener	The PropertyChange listener to be removed.
+      */
+     public void removePropertyChangeListener(PropertyChangeListener listener) {
+-        _props.removeListener(listener);
++	_props.removeListener(listener);
+     }
+ 
+ 
+@@ -151,471 +150,478 @@ public class PackerImpl implements Pack2
+ 
+     // The packer worker.
+     private class DoPack {
+-        final int verbose = _props.getInteger(Utils.DEBUG_VERBOSE);
++	final int verbose = _props.getInteger(Utils.DEBUG_VERBOSE);
+ 
+-        {
+-            _props.setInteger(Pack200.Packer.PROGRESS, 0);
+-            if (verbose > 0) Utils.log.info(_props.toString());
+-        }
++	{
++	    _props.setInteger(Pack200.Packer.PROGRESS, 0);
++	    if (verbose > 0) Utils.log.info(_props.toString());
++	}
+ 
+-        // Here's where the bits are collected before getting packed:
+-        final Package pkg = new Package();
++	// Here's where the bits are collected before getting packed:
++	final Package pkg = new Package();
+ 
+-        final String unknownAttrCommand;
+-        {
+-            String uaMode = _props.getProperty(Pack200.Packer.UNKNOWN_ATTRIBUTE, Pack200.Packer.PASS);
+-            if (!(Pack200.Packer.STRIP.equals(uaMode) ||
+-                  Pack200.Packer.PASS.equals(uaMode) ||
+-                  Pack200.Packer.ERROR.equals(uaMode))) {
+-                throw new RuntimeException("Bad option: " + Pack200.Packer.UNKNOWN_ATTRIBUTE + " = " + uaMode);
+-            }
+-            unknownAttrCommand = uaMode.intern();
+-        }
++	final String unknownAttrCommand;
++	{
++	    String uaMode = _props.getProperty(Pack200.Packer.UNKNOWN_ATTRIBUTE, Pack200.Packer.PASS);
++	    if (!(Pack200.Packer.STRIP.equals(uaMode) ||
++		  Pack200.Packer.PASS.equals(uaMode) ||
++		  Pack200.Packer.ERROR.equals(uaMode))) {
++		throw new RuntimeException("Bad option: " + Pack200.Packer.UNKNOWN_ATTRIBUTE + " = " + uaMode);
++	    }
++	    unknownAttrCommand = uaMode.intern();
++	}
+ 
+-        final HashMap attrDefs;
+-        final HashMap attrCommands;
+-        {
+-            HashMap attrDefs     = new HashMap();
+-            HashMap attrCommands = new HashMap();
+-            String[] keys = {
+-                Pack200.Packer.CLASS_ATTRIBUTE_PFX,
+-                Pack200.Packer.FIELD_ATTRIBUTE_PFX,
+-                Pack200.Packer.METHOD_ATTRIBUTE_PFX,
+-                Pack200.Packer.CODE_ATTRIBUTE_PFX
+-            };
+-            int[] ctypes = {
+-                Constants.ATTR_CONTEXT_CLASS,
+-                Constants.ATTR_CONTEXT_FIELD,
+-                Constants.ATTR_CONTEXT_METHOD,
+-                Constants.ATTR_CONTEXT_CODE
+-            };
+-            for (int i = 0; i < ctypes.length; i++) {
+-                String pfx = keys[i];
+-                Map map = _props.prefixMap(pfx);
+-                for (Iterator j = map.keySet().iterator(); j.hasNext(); ) {
+-                    String key = (String) j.next();
+-                    assert(key.startsWith(pfx));
+-                    String name = key.substring(pfx.length());
+-                    String layout = _props.getProperty(key);
+-                    Object lkey = Attribute.keyForLookup(ctypes[i], name);
+-                    if (Pack200.Packer.STRIP.equals(layout) ||
+-                        Pack200.Packer.PASS.equals(layout) ||
+-                        Pack200.Packer.ERROR.equals(layout)) {
+-                        attrCommands.put(lkey, layout.intern());
+-                    } else {
+-                        Attribute.define(attrDefs, ctypes[i], name, layout);
+-                        if (verbose > 1) {
+-                            Utils.log.fine("Added layout for "+Constants.ATTR_CONTEXT_NAME[i]+" attribute "+name+" = "+layout);
+-                        }
+-                        assert(attrDefs.containsKey(lkey));
+-                    }
+-                }
+-            }
+-            if (attrDefs.size() > 0)
+-                this.attrDefs = attrDefs;
+-            else
+-                this.attrDefs = null;
+-            if (attrCommands.size() > 0)
+-                this.attrCommands = attrCommands;
+-            else
+-                this.attrCommands = null;
+-        }
++	final HashMap attrDefs;
++	final HashMap attrCommands;
++	{
++	    HashMap attrDefs     = new HashMap();
++	    HashMap attrCommands = new HashMap();
++	    String[] keys = {
++		Pack200.Packer.CLASS_ATTRIBUTE_PFX,
++		Pack200.Packer.FIELD_ATTRIBUTE_PFX,
++		Pack200.Packer.METHOD_ATTRIBUTE_PFX,
++		Pack200.Packer.CODE_ATTRIBUTE_PFX
++	    };
++	    int[] ctypes = {
++		Constants.ATTR_CONTEXT_CLASS,
++		Constants.ATTR_CONTEXT_FIELD,
++		Constants.ATTR_CONTEXT_METHOD,
++		Constants.ATTR_CONTEXT_CODE
++	    };
++	    for (int i = 0; i < ctypes.length; i++) {
++		String pfx = keys[i];
++		Map map = _props.prefixMap(pfx);
++		for (Iterator j = map.keySet().iterator(); j.hasNext(); ) {
++		    String key = (String) j.next();
++		    assert(key.startsWith(pfx));
++		    String name = key.substring(pfx.length());
++		    String layout = _props.getProperty(key);
++		    Object lkey = Attribute.keyForLookup(ctypes[i], name);
++		    if (Pack200.Packer.STRIP.equals(layout) ||
++			Pack200.Packer.PASS.equals(layout) ||
++			Pack200.Packer.ERROR.equals(layout)) {
++			attrCommands.put(lkey, layout.intern());
++		    } else {
++			Attribute.define(attrDefs, ctypes[i], name, layout);
++			if (verbose > 1) {
++			    Utils.log.fine("Added layout for "+Constants.ATTR_CONTEXT_NAME[i]+" attribute "+name+" = "+layout);
++			}
++			assert(attrDefs.containsKey(lkey));
++		    }
++		}
++	    }
++	    if (attrDefs.size() > 0)
++		this.attrDefs = attrDefs;
++	    else
++		this.attrDefs = null;
++	    if (attrCommands.size() > 0)
++		this.attrCommands = attrCommands;
++	    else
++		this.attrCommands = null;
++	}
+ 
+-        final boolean keepFileOrder
+-            = _props.getBoolean(Pack200.Packer.KEEP_FILE_ORDER);
+-        final boolean keepClassOrder
+-            = _props.getBoolean(Utils.PACK_KEEP_CLASS_ORDER);
++	final boolean keepFileOrder
++	    = _props.getBoolean(Pack200.Packer.KEEP_FILE_ORDER);
++	final boolean keepClassOrder
++	    = _props.getBoolean(Utils.PACK_KEEP_CLASS_ORDER);
+ 
+-        final boolean keepModtime
+-            = Pack200.Packer.KEEP.equals(_props.getProperty(Pack200.Packer.MODIFICATION_TIME));
+-        final boolean latestModtime
+-            = Pack200.Packer.LATEST.equals(_props.getProperty(Pack200.Packer.MODIFICATION_TIME));
+-        final boolean keepDeflateHint
+-            = Pack200.Packer.KEEP.equals(_props.getProperty(Pack200.Packer.DEFLATE_HINT));
+-        {
+-            if (!keepModtime && !latestModtime) {
+-                int modtime = _props.getTime(Pack200.Packer.MODIFICATION_TIME);
+-                if (modtime != Constants.NO_MODTIME) {
+-                    pkg.default_modtime = modtime;
+-                }
+-            }
+-            if (!keepDeflateHint) {
+-                boolean deflate_hint = _props.getBoolean(Pack200.Packer.DEFLATE_HINT);
+-                if (deflate_hint) {
+-                    pkg.default_options |= Constants.AO_DEFLATE_HINT;
+-                }
+-            }
+-        }
++	final boolean keepModtime
++	    = Pack200.Packer.KEEP.equals(_props.getProperty(Pack200.Packer.MODIFICATION_TIME));
++	final boolean latestModtime
++	    = Pack200.Packer.LATEST.equals(_props.getProperty(Pack200.Packer.MODIFICATION_TIME));
++	final boolean keepDeflateHint
++	    = Pack200.Packer.KEEP.equals(_props.getProperty(Pack200.Packer.DEFLATE_HINT));
++	{
++	    if (!keepModtime && !latestModtime) {
++		int modtime = _props.getTime(Pack200.Packer.MODIFICATION_TIME);
++		if (modtime != Constants.NO_MODTIME) {
++		    pkg.default_modtime = modtime;
++		}
++	    }
++	    if (!keepDeflateHint) {
++		boolean deflate_hint = _props.getBoolean(Pack200.Packer.DEFLATE_HINT);
++		if (deflate_hint) {
++		    pkg.default_options |= Constants.AO_DEFLATE_HINT;
++		}
++	    }
++	}
+ 
+-        long totalOutputSize = 0;
+-        int  segmentCount = 0;
+-        long segmentTotalSize = 0;
+-        long segmentSize = 0;  // running counter
+-        final long segmentLimit;
+-        {
+-            long limit;
+-            if (_props.getProperty(Pack200.Packer.SEGMENT_LIMIT, "").equals(""))
+-                limit = -1;
+-            else
+-                limit = _props.getLong(Pack200.Packer.SEGMENT_LIMIT);
+-            limit = Math.min(Integer.MAX_VALUE, limit);
+-            limit = Math.max(-1, limit);
+-            if (limit == -1)
+-                limit = Long.MAX_VALUE;
+-            segmentLimit = limit;
+-        }
++	long totalOutputSize = 0;
++	int  segmentCount = 0;
++	long segmentTotalSize = 0;
++	long segmentSize = 0;  // running counter
++	final long segmentLimit;
++	{
++	    long limit;
++	    if (_props.getProperty(Pack200.Packer.SEGMENT_LIMIT, "").equals(""))
++		limit = -1;
++	    else
++		limit = _props.getLong(Pack200.Packer.SEGMENT_LIMIT);
++	    limit = Math.min(Integer.MAX_VALUE, limit);
++	    limit = Math.max(-1, limit);
++	    if (limit == -1)
++		limit = Long.MAX_VALUE;
++	    segmentLimit = limit;
++	}
+ 
+-        final List passFiles;  // parsed pack.pass.file options
+-        {
+-            // Which class files will be passed through?
+-            passFiles = _props.getProperties(Pack200.Packer.PASS_FILE_PFX);
+-            for (ListIterator i = passFiles.listIterator(); i.hasNext(); ) {
+-                String file = (String) i.next();
+-                if (file == null) { i.remove(); continue; }
+-                file = Utils.getJarEntryName(file);  // normalize '\\' to '/'
+-                if (file.endsWith("/"))
+-                    file = file.substring(0, file.length()-1);
+-                i.set(file);
+-            }
+-            if (verbose > 0) Utils.log.info("passFiles = " + passFiles);
+-        }
++	final List passFiles;  // parsed pack.pass.file options
++	{
++	    // Which class files will be passed through?
++	    passFiles = _props.getProperties(Pack200.Packer.PASS_FILE_PFX);
++	    for (ListIterator i = passFiles.listIterator(); i.hasNext(); ) {
++		String file = (String) i.next();
++		if (file == null) { i.remove(); continue; }
++		file = Utils.getJarEntryName(file);  // normalize '\\' to '/'
++		if (file.endsWith("/"))
++		    file = file.substring(0, file.length()-1);
++		i.set(file);
++	    }
++	    if (verbose > 0) Utils.log.info("passFiles = " + passFiles);
++	}
+ 
+-        {
+-            // Fill in permitted range of major/minor version numbers.
+-            int ver;
+-            if ((ver = _props.getInteger(Utils.COM_PREFIX+"min.class.majver")) != 0)
+-                pkg.min_class_majver = (short) ver;
+-            if ((ver = _props.getInteger(Utils.COM_PREFIX+"min.class.minver")) != 0)
+-                pkg.min_class_minver = (short) ver;
+-            if ((ver = _props.getInteger(Utils.COM_PREFIX+"max.class.majver")) != 0)
+-                pkg.max_class_majver = (short) ver;
+-            if ((ver = _props.getInteger(Utils.COM_PREFIX+"max.class.minver")) != 0)
+-                pkg.max_class_minver = (short) ver;
+-            if ((ver = _props.getInteger(Utils.COM_PREFIX+"package.minver")) != 0)
+-                pkg.package_minver = (short) ver;
+-            if ((ver = _props.getInteger(Utils.COM_PREFIX+"package.majver")) != 0)
+-                pkg.package_majver = (short) ver;
+-        }
++	{
++	    // Fill in permitted range of major/minor version numbers.
++	    int ver;
++	    if ((ver = _props.getInteger(Utils.COM_PREFIX+"min.class.majver")) != 0)
++		pkg.min_class_majver = (short) ver;
++	    if ((ver = _props.getInteger(Utils.COM_PREFIX+"min.class.minver")) != 0)
++		pkg.min_class_minver = (short) ver;
++	    if ((ver = _props.getInteger(Utils.COM_PREFIX+"max.class.majver")) != 0)
++		pkg.max_class_majver = (short) ver;
++	    if ((ver = _props.getInteger(Utils.COM_PREFIX+"max.class.minver")) != 0)
++		pkg.max_class_minver = (short) ver;
++	    if ((ver = _props.getInteger(Utils.COM_PREFIX+"package.minver")) != 0)
++		pkg.package_minver = (short) ver;
++	    if ((ver = _props.getInteger(Utils.COM_PREFIX+"package.majver")) != 0)
++		pkg.package_majver = (short) ver;
++	}
+ 
+-        {
+-            // Hook for testing:  Forces use of special archive modes.
+-            int opt = _props.getInteger(Utils.COM_PREFIX+"archive.options");
+-            if (opt != 0)
+-                pkg.default_options |= opt;
+-        }
++	{
++	    // Hook for testing:  Forces use of special archive modes.
++	    int opt = _props.getInteger(Utils.COM_PREFIX+"archive.options");
++	    if (opt != 0)
++		pkg.default_options |= opt;
++	}
+ 
+-        // (Done collecting options from _props.)
++	// (Done collecting options from _props.)
+ 
+-        boolean isClassFile(String name) {
+-            if (!name.endsWith(".class"))  return false;
+-            for (String prefix = name; ; ) {
+-                if (passFiles.contains(prefix))  return false;
+-                int chop = prefix.lastIndexOf('/');
+-                if (chop < 0)  break;
+-                prefix = prefix.substring(0, chop);
+-            }
+-            return true;
+-        }
++	boolean isClassFile(String name) {
++	    if (!name.endsWith(".class"))  return false;
++	    for (String prefix = name; ; ) {
++		if (passFiles.contains(prefix))  return false;
++		int chop = prefix.lastIndexOf('/');
++		if (chop < 0)  break;
++		prefix = prefix.substring(0, chop);
++	    }
++	    return true;
++	}
+ 
+-        boolean isMetaInfFile(String name) {
+-            return name.startsWith("/" + Utils.METAINF) ||
+-                        name.startsWith(Utils.METAINF);
+-        }
++	boolean isMetaInfFile(String name) {
++	    return name.startsWith("/" + Utils.METAINF) || 
++			name.startsWith(Utils.METAINF);
++	}
+ 
+-        // Get a new package, based on the old one.
+-        private void makeNextPackage() {
+-            pkg.reset();
+-        }
++	// Get a new package, based on the old one.
++	private void makeNextPackage() {
++	    pkg.reset();
++	}
+ 
+-        class InFile {
+-            final String name;
+-            final JarFile jf;
+-            final JarEntry je;
+-            final File f;
+-            int modtime = Constants.NO_MODTIME;
+-            int options;
+-            InFile(String name) {
+-                this.name = Utils.getJarEntryName(name);
+-                this.f = new File(name);
+-                this.jf = null;
+-                this.je = null;
+-                int timeSecs = getModtime(f.lastModified());
+-                if (keepModtime && timeSecs != Constants.NO_MODTIME) {
+-                    this.modtime = timeSecs;
+-                } else if (latestModtime && timeSecs > pkg.default_modtime) {
+-                    pkg.default_modtime = timeSecs;
+-                }
+-            }
+-            InFile(JarFile jf, JarEntry je) {
+-                this.name = Utils.getJarEntryName(je.getName());
+-                this.f = null;
+-                this.jf = jf;
+-                this.je = je;
+-                int timeSecs = getModtime(je.getTime());
+-                if (keepModtime && timeSecs != Constants.NO_MODTIME) {
+-                     this.modtime = timeSecs;
+-                } else if (latestModtime && timeSecs > pkg.default_modtime) {
+-                    pkg.default_modtime = timeSecs;
+-                }
+-                if (keepDeflateHint && je.getMethod() == JarEntry.DEFLATED) {
+-                    options |= Constants.FO_DEFLATE_HINT;
+-                }
+-            }
+-            InFile(JarEntry je) {
+-                this(null, je);
+-            }
+-            long getInputLength() {
+-                long len = (je != null)? je.getSize(): f.length();
+-                assert(len >= 0) : this+".len="+len;
+-                // Bump size by pathname length and modtime/def-hint bytes.
+-                return Math.max(0, len) + name.length() + 5;
+-            }
+-            int getModtime(long timeMillis) {
+-                // Convert milliseconds to seconds.
+-                long seconds = (timeMillis+500) / 1000;
+-                if ((int)seconds == seconds) {
+-                    return (int)seconds;
+-                } else {
+-                    Utils.log.warning("overflow in modtime for "+f);
+-                    return Constants.NO_MODTIME;
+-                }
+-            }
+-            void copyTo(Package.File file) {
+-                if (modtime != Constants.NO_MODTIME)
+-                    file.modtime = modtime;
+-                file.options |= options;
+-            }
+-            InputStream getInputStream() throws IOException {
+-                if (jf != null)
+-                    return jf.getInputStream(je);
+-                else
+-                    return new FileInputStream(f);
+-            }
++	class InFile {
++	    final String name;
++	    final JarFile jf;
++	    final JarEntry je;
++	    final File f;
++	    int modtime = Constants.NO_MODTIME;
++	    int options;
++	    InFile(String name) {
++		this.name = Utils.getJarEntryName(name);
++		this.f = new File(name);
++		this.jf = null;
++		this.je = null;
++		int timeSecs = getModtime(f.lastModified());
++		if (keepModtime && timeSecs != Constants.NO_MODTIME) {
++		    this.modtime = timeSecs;
++		} else if (latestModtime && timeSecs > pkg.default_modtime) {
++		    pkg.default_modtime = timeSecs;
++		}
++	    }
++	    InFile(JarFile jf, JarEntry je) {
++		this.name = Utils.getJarEntryName(je.getName());
++		this.f = null;
++		this.jf = jf;
++		this.je = je;
++		int timeSecs = getModtime(je.getTime());
++		if (keepModtime && timeSecs != Constants.NO_MODTIME) {
++		     this.modtime = timeSecs;
++		} else if (latestModtime && timeSecs > pkg.default_modtime) {
++		    pkg.default_modtime = timeSecs;
++		}
++		if (keepDeflateHint && je.getMethod() == JarEntry.DEFLATED) {
++		    options |= Constants.FO_DEFLATE_HINT;
++		}
++	    }
++	    InFile(JarEntry je) {
++		this(null, je);
++	    }
++	    long getInputLength() {
++		long len = (je != null)? je.getSize(): f.length();
++		assert(len >= 0) : this+".len="+len;
++		// Bump size by pathname length and modtime/def-hint bytes.
++		return Math.max(0, len) + name.length() + 5;
++	    }
++	    int getModtime(long timeMillis) {
++		// Convert milliseconds to seconds.
++		long seconds = (timeMillis+500) / 1000;
++		if ((int)seconds == seconds) {
++		    return (int)seconds;
++		} else {
++		    Utils.log.warning("overflow in modtime for "+f);
++		    return Constants.NO_MODTIME;
++		}
++	    }
++	    void copyTo(Package.File file) {
++		if (modtime != Constants.NO_MODTIME)
++		    file.modtime = modtime;
++		file.options |= options;
++	    }
++	    InputStream getInputStream() throws IOException {
++		if (jf != null)
++		    return jf.getInputStream(je);
++		else
++		    return new FileInputStream(f);
++	    }
+ 
+-            public String toString() {
+-                return name;
+-            }
+-        }
++	    public String toString() {
++		return name;
++	    }
++	}
+ 
+-        private int nread = 0;  // used only if (verbose > 0)
+-        private void noteRead(InFile f) {
+-            nread++;
+-            if (verbose > 2)
+-                Utils.log.fine("...read "+f.name);
+-            if (verbose > 0 && (nread % 1000) == 0)
+-                Utils.log.info("Have read "+nread+" files...");
+-        }
++	private int nread = 0;  // used only if (verbose > 0)
++	private void noteRead(InFile f) {
++	    nread++;
++	    if (verbose > 2)
++		Utils.log.fine("...read "+f.name);
++	    if (verbose > 0 && (nread % 1000) == 0)
++		Utils.log.info("Have read "+nread+" files...");
++	}
+ 
+-        void run(JarInputStream in, OutputStream out) throws IOException {
+-            // First thing we do is get the manifest, as JIS does
+-            // not provide the Manifest as an entry.
+-            if (in.getManifest() != null) {
+-                ByteArrayOutputStream tmp = new ByteArrayOutputStream();
+-                in.getManifest().write(tmp);
+-                InputStream tmpIn = new ByteArrayInputStream(tmp.toByteArray());
+-                pkg.addFile(readFile(JarFile.MANIFEST_NAME, tmpIn));
+-            }
+-            for (JarEntry je; (je = in.getNextJarEntry()) != null; ) {
+-                InFile inFile = new InFile(je);
++	void run(JarInputStream in, OutputStream out) throws IOException {
++	    // First thing we do is get the manifest, as JIS does
++	    // not provide the Manifest as an entry.
++	    if (in.getManifest() != null) {
++		ByteArrayOutputStream tmp = new ByteArrayOutputStream();
++		in.getManifest().write(tmp);
++		InputStream tmpIn = new ByteArrayInputStream(tmp.toByteArray());
++		pkg.addFile(readFile(JarFile.MANIFEST_NAME, tmpIn));
++	    }
++	    for (JarEntry je; (je = in.getNextJarEntry()) != null; ) {
++		InFile inFile = new InFile(je);
+ 
+-                String name = inFile.name;
+-                Package.File bits = readFile(name, in);
+-                Package.File file = null;
+-                // (5078608) : discount the resource files in META-INF
+-                // from segment computation.
+-                long inflen = (isMetaInfFile(name)) ?  0L :
+-                                inFile.getInputLength();
++		String name = inFile.name;
++		Package.File bits = readFile(name, in);
++		Package.File file = null;
++		// (5078608) : discount the resource files in META-INF 
++		// from segment computation.
++		long inflen = (isMetaInfFile(name)) ?  0L :
++				inFile.getInputLength();
+ 
+-                if ((segmentSize += inflen) > segmentLimit) {
+-                    segmentSize -= inflen;
+-                    int nextCount = -1;  // don't know; it's a stream
+-                    flushPartial(out, nextCount);
+-                }
+-                if (verbose > 1)
+-                    Utils.log.fine("Reading " + name);
++		if ((segmentSize += inflen) > segmentLimit) {
++		    segmentSize -= inflen;
++		    int nextCount = -1;  // don't know; it's a stream
++		    flushPartial(out, nextCount);
++		}
++		if (verbose > 1)
++		    Utils.log.fine("Reading " + name);
+ 
+-                assert(je.isDirectory() == name.endsWith("/"));
++		assert(je.isDirectory() == name.endsWith("/"));
+ 
+-                if (isClassFile(name)) {
+-                    file = readClass(name, bits.getInputStream());
+-                }
+-                if (file == null) {
+-                    file = bits;
+-                    pkg.addFile(file);
+-                }
+-                inFile.copyTo(file);
+-                noteRead(inFile);
+-            }
+-            flushAll(out);
+-        }
++		if (isClassFile(name)) {
++		    file = readClass(name, bits.getInputStream());
++		}
++		if (file == null) {
++		    file = bits;
++		    pkg.addFile(file);
++		}
++		inFile.copyTo(file);
++		noteRead(inFile);
++	    }
++	    flushAll(out);
++	}
+ 
+-        void run(JarFile in, OutputStream out) throws IOException {
+-            List inFiles = scanJar(in);
++	void run(JarFile in, OutputStream out) throws IOException {
++	    List inFiles = scanJar(in);
+ 
+-            if (verbose > 0)
+-                Utils.log.info("Reading " + inFiles.size() + " files...");
++	    if (verbose > 0)
++		Utils.log.info("Reading " + inFiles.size() + " files...");
+ 
+-            int numDone = 0;
+-            for (Iterator i = inFiles.iterator(); i.hasNext(); ) {
+-                InFile inFile = (InFile) i.next();
+-                String name      = inFile.name;
+-                // (5078608) : discount the resource files completely from segmenting
+-                long inflen = (isMetaInfFile(name)) ? 0L :
+-                                inFile.getInputLength() ;
+-                if ((segmentSize += inflen) > segmentLimit) {
+-                    segmentSize -= inflen;
+-                    // Estimate number of remaining segments:
+-                    float filesDone = numDone+1;
+-                    float segsDone  = segmentCount+1;
+-                    float filesToDo = inFiles.size() - filesDone;
+-                    float segsToDo  = filesToDo * (segsDone/filesDone);
+-                    if (verbose > 1)
+-                        Utils.log.fine("Estimated segments to do: "+segsToDo);
+-                    flushPartial(out, (int) Math.ceil(segsToDo));
+-                }
+-                InputStream strm = inFile.getInputStream();
+-                if (verbose > 1)
+-                    Utils.log.fine("Reading " + name);
+-                Package.File file = null;
+-                if (isClassFile(name)) {
+-                    file = readClass(name, strm);
+-                    if (file == null) {
+-                        strm.close();
+-                        strm = inFile.getInputStream();
+-                    }
+-                }
+-                if (file == null) {
+-                    file = readFile(name, strm);
+-                    pkg.addFile(file);
+-                }
+-                inFile.copyTo(file);
+-                strm.close();  // tidy up
+-                noteRead(inFile);
+-                numDone += 1;
+-            }
+-            flushAll(out);
+-        }
++	    int numDone = 0;
++	    for (Iterator i = inFiles.iterator(); i.hasNext(); ) {
++		InFile inFile = (InFile) i.next();
++		String name      = inFile.name;
++		// (5078608) : discount the resource files completely from segmenting
++		long inflen = (isMetaInfFile(name)) ? 0L :
++				inFile.getInputLength() ;
++		if ((segmentSize += inflen) > segmentLimit) {
++		    segmentSize -= inflen;
++		    // Estimate number of remaining segments:
++		    float filesDone = numDone+1;
++		    float segsDone  = segmentCount+1;
++		    float filesToDo = inFiles.size() - filesDone;
++		    float segsToDo  = filesToDo * (segsDone/filesDone);
++		    if (verbose > 1)
++			Utils.log.fine("Estimated segments to do: "+segsToDo);
++		    flushPartial(out, (int) Math.ceil(segsToDo));
++		}
++		InputStream strm = inFile.getInputStream();
++		if (verbose > 1)
++		    Utils.log.fine("Reading " + name);
++		Package.File file = null;
++		if (isClassFile(name)) {
++		    file = readClass(name, strm);
++		    if (file == null) {
++			strm.close();
++			strm = inFile.getInputStream();
++		    }
++		}
++		if (file == null) {
++		    file = readFile(name, strm);
++		    pkg.addFile(file);
++		}
++		inFile.copyTo(file);
++		strm.close();  // tidy up
++		noteRead(inFile);
++		numDone += 1;
++	    }
++	    flushAll(out);
++	}
+ 
+-        Package.File readClass(String fname, InputStream in) throws IOException {
+-            Package.Class cls = pkg.new Class(fname);
+-            in = new BufferedInputStream(in);
+-            ClassReader reader = new ClassReader(cls, in);
+-            reader.setAttrDefs(attrDefs);
+-            reader.setAttrCommands(attrCommands);
+-            reader.unknownAttrCommand = unknownAttrCommand;
+-            try {
+-                reader.read();
+-            } catch (Attribute.FormatException ee) {
+-                // He passed up the category to us in layout.
+-                if (ee.layout.equals(Pack200.Packer.PASS)) {
+-                    Utils.log.warning("Passing class file uncompressed due to unrecognized attribute: "+fname);
+-                    Utils.log.info(ee.toString());
+-                    return null;
+-                }
+-                // Otherwise, it must be an error.
+-                throw ee;
+-            }
+-            pkg.addClass(cls);
+-            return cls.file;
+-        }
++	Package.File readClass(String fname, InputStream in) throws IOException {
++	    Package.Class cls = pkg.new Class(fname);
++	    in = new BufferedInputStream(in);
++	    ClassReader reader = new ClassReader(cls, in);
++	    reader.setAttrDefs(attrDefs);
++	    reader.setAttrCommands(attrCommands);
++	    reader.unknownAttrCommand = unknownAttrCommand;
++	    try {
++		reader.read();
++	    } catch (Attribute.FormatException ee) {
++		// He passed up the category to us in layout.
++		if (ee.layout.equals(Pack200.Packer.PASS)) {
++		    Utils.log.warning("Passing class file uncompressed due to unrecognized attribute: "+fname);
++		    Utils.log.info(ee.toString());
++		    return null;
++		}
++		// Otherwise, it must be an error.
++		throw ee;
++	    }
++	    pkg.addClass(cls);
++	    return cls.file;
++	}
+ 
+-        // Read raw data.
+-        Package.File readFile(String fname, InputStream in) throws IOException {
++	// Read raw data.
++	Package.File readFile(String fname, InputStream in) throws IOException {
+ 
+-            Package.File file = pkg.new File(fname);
+-            file.readFrom(in);
+-            if (file.isDirectory() && file.getFileLength() != 0)
+-                throw new IllegalArgumentException("Non-empty directory: "+file.getFileName());
+-            return file;
+-        }
++	    Package.File file = pkg.new File(fname);
++	    file.readFrom(in);
++	    if (file.isDirectory() && file.getFileLength() != 0)
++		throw new IllegalArgumentException("Non-empty directory: "+file.getFileName());
++	    return file;
++	}
+ 
+-        void flushPartial(OutputStream out, int nextCount) throws IOException {
+-            if (pkg.files.size() == 0 && pkg.classes.size() == 0) {
+-                return;  // do not flush an empty segment
+-            }
+-            flushPackage(out, Math.max(1, nextCount));
+-            _props.setInteger(Pack200.Packer.PROGRESS, 25);
+-            // In case there will be another segment:
+-            makeNextPackage();
+-            segmentCount += 1;
+-            segmentTotalSize += segmentSize;
+-            segmentSize = 0;
+-        }
++	void flushPartial(OutputStream out, int nextCount) throws IOException {
++	    if (pkg.files.size() == 0 && pkg.classes.size() == 0) {
++		return;  // do not flush an empty segment
++	    }
++	    flushPackage(out, Math.max(1, nextCount));
++	    _props.setInteger(Pack200.Packer.PROGRESS, 25);
++	    // In case there will be another segment:
++	    makeNextPackage();
++	    segmentCount += 1;
++	    segmentTotalSize += segmentSize;
++	    segmentSize = 0;
++	}
+ 
+-        void flushAll(OutputStream out) throws IOException {
+-            _props.setInteger(Pack200.Packer.PROGRESS, 50);
+-            flushPackage(out, 0);
+-            out.flush();
+-            _props.setInteger(Pack200.Packer.PROGRESS, 100);
+-            segmentCount += 1;
+-            segmentTotalSize += segmentSize;
+-            segmentSize = 0;
+-            if (verbose > 0 && segmentCount > 1) {
+-                Utils.log.info("Transmitted "
+-                                 +segmentTotalSize+" input bytes in "
+-                                 +segmentCount+" segments totaling "
+-                                 +totalOutputSize+" bytes");
+-            }
+-        }
++	void flushAll(OutputStream out) throws IOException {
++	    _props.setInteger(Pack200.Packer.PROGRESS, 50);
++	    flushPackage(out, 0);
++	    out.flush();
++	    _props.setInteger(Pack200.Packer.PROGRESS, 100);
++	    segmentCount += 1;
++	    segmentTotalSize += segmentSize;
++	    segmentSize = 0;
++	    if (verbose > 0 && segmentCount > 1) {
++		Utils.log.info("Transmitted "
++				 +segmentTotalSize+" input bytes in "
++				 +segmentCount+" segments totaling "
++				 +totalOutputSize+" bytes");
++	    }
++	}
+ 
+ 
+-        /** Write all information in the current package segment
+-         *  to the output stream.
+-         */
+-        void flushPackage(OutputStream out, int nextCount) throws IOException {
+-            int nfiles = pkg.files.size();
+-            if (!keepFileOrder) {
+-                // Keeping the order of classes costs about 1%
+-                // Keeping the order of all files costs something more.
+-                if (verbose > 1)  Utils.log.fine("Reordering files.");
+-                boolean stripDirectories = true;
+-                pkg.reorderFiles(keepClassOrder, stripDirectories);
+-            } else {
+-                // Package builder must have created a stub for each class.
+-                assert(pkg.files.containsAll(pkg.getClassStubs()));
+-                // Order of stubs in file list must agree with classes.
+-                List res = pkg.files;
+-                assert((res = new ArrayList(pkg.files))
+-                       .retainAll(pkg.getClassStubs()) || true);
+-                assert(res.equals(pkg.getClassStubs()));
+-            }
+-            pkg.trimStubs();
++	/** Write all information in the current package segment
++	 *  to the output stream.
++	 */
++	void flushPackage(OutputStream out, int nextCount) throws IOException {
++	    int nfiles = pkg.files.size();
++	    if (!keepFileOrder) {
++		// Keeping the order of classes costs about 1%
++		// Keeping the order of all files costs something more.
++		if (verbose > 1)  Utils.log.fine("Reordering files.");
++		boolean stripDirectories = true;
++		pkg.reorderFiles(keepClassOrder, stripDirectories);
++	    } else {
++		// Package builder must have created a stub for each class.
++		assert(pkg.files.containsAll(pkg.getClassStubs()));
++		// Order of stubs in file list must agree with classes.
++		List res = pkg.files;
++		assert((res = new ArrayList(pkg.files))
++		       .retainAll(pkg.getClassStubs()) || true);
++		assert(res.equals(pkg.getClassStubs()));
++	    }
++	    pkg.trimStubs();
+ 
+-            // Do some stripping, maybe.
+-            if (_props.getBoolean(Utils.COM_PREFIX+"strip.debug"))        pkg.stripAttributeKind("Debug");
+-            if (_props.getBoolean(Utils.COM_PREFIX+"strip.compile"))      pkg.stripAttributeKind("Compile");
+-            if (_props.getBoolean(Utils.COM_PREFIX+"strip.constants"))    pkg.stripAttributeKind("Constant");
+-            if (_props.getBoolean(Utils.COM_PREFIX+"strip.exceptions"))   pkg.stripAttributeKind("Exceptions");
+-            if (_props.getBoolean(Utils.COM_PREFIX+"strip.innerclasses")) pkg.stripAttributeKind("InnerClasses");
++	    // Do some stripping, maybe.
++	    if (_props.getBoolean(Utils.COM_PREFIX+"strip.debug"))        pkg.stripAttributeKind("Debug");
++	    if (_props.getBoolean(Utils.COM_PREFIX+"strip.compile"))      pkg.stripAttributeKind("Compile");
++	    if (_props.getBoolean(Utils.COM_PREFIX+"strip.constants"))    pkg.stripAttributeKind("Constant");
++	    if (_props.getBoolean(Utils.COM_PREFIX+"strip.exceptions"))   pkg.stripAttributeKind("Exceptions");
++	    if (_props.getBoolean(Utils.COM_PREFIX+"strip.innerclasses")) pkg.stripAttributeKind("InnerClasses");
+ 
+-            // Must choose an archive version; PackageWriter does not.
+-            if (pkg.package_majver <= 0)  pkg.choosePackageVersion();
++	    // Must choose an archive version; PackageWriter does not.
++	    if (pkg.package_majver <= 0)  pkg.choosePackageVersion();
+ 
+-            PackageWriter pw = new PackageWriter(pkg, out);
+-            pw.archiveNextCount = nextCount;
+-            pw.write();
+-            out.flush();
+-            if (verbose > 0) {
+-                long outSize = pw.archiveSize0+pw.archiveSize1;
+-                totalOutputSize += outSize;
+-                long inSize = segmentSize;
+-                Utils.log.info("Transmitted "
+-                                 +nfiles+" files of "
+-                                 +inSize+" input bytes in a segment of "
+-                                 +outSize+" bytes");
+-            }
+-        }
++	    PackageWriter pw = new PackageWriter(pkg, out);
++	    pw.archiveNextCount = nextCount;
++	    pw.write();
++	    out.flush();
++	    if (verbose > 0) {
++		long outSize = pw.archiveSize0+pw.archiveSize1;
++		totalOutputSize += outSize;
++		long inSize = segmentSize;
++		Utils.log.info("Transmitted "
++				 +nfiles+" files of "
++				 +inSize+" input bytes in a segment of "
++				 +outSize+" bytes");
++	    }
++	}
+ 
+-        List scanJar(JarFile jf) throws IOException {
+-            // Collect jar entries, preserving order.
+-            List inFiles = new ArrayList();
+-            for (Enumeration e = jf.entries(); e.hasMoreElements(); ) {
+-                JarEntry je = (JarEntry) e.nextElement();
+-                InFile inFile = new InFile(jf, je);
+-                assert(je.isDirectory() == inFile.name.endsWith("/"));
+-                inFiles.add(inFile);
+-            }
+-            return inFiles;
+-        }
++	List scanJar(JarFile jf) throws IOException {
++	    // Collect jar entries, preserving order.
++	    List inFiles = new ArrayList();
++	    for (Enumeration e = jf.entries(); e.hasMoreElements(); ) {
++		JarEntry je = (JarEntry) e.nextElement();
++		InFile inFile = new InFile(jf, je);
++		assert(je.isDirectory() == inFile.name.endsWith("/"));
++		inFiles.add(inFile);
++	    }
++	    return inFiles;
++	}
+     }
+ }
++
++
++
++
++
++
++
+diff --git a/src/share/classes/com/sun/java/util/jar/pack/UnpackerImpl.java b/src/share/classes/com/sun/java/util/jar/pack/UnpackerImpl.java
+--- jdk/src/share/classes/com/sun/java/util/jar/pack/UnpackerImpl.java
++++ jdk/src/share/classes/com/sun/java/util/jar/pack/UnpackerImpl.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -41,53 +41,53 @@ import java.beans.PropertyChangeEvent;
+ 
+ 
+ public class UnpackerImpl implements Pack200.Unpacker {
+-
+-
++    
++    
+     /**
+      * Register a listener for changes to options.
+      * @param listener  An object to be invoked when a property is changed.
+      */
+     public void addPropertyChangeListener(PropertyChangeListener listener) {
+-        _props.addListener(listener);
++	_props.addListener(listener);
+     }
+-
+-
++ 
++    
+     /**
+      * Remove a listener for the PropertyChange event.
+      * @param listener  The PropertyChange listener to be removed.
+      */
+     public void removePropertyChangeListener(PropertyChangeListener listener) {
+-        _props.removeListener(listener);
++	_props.removeListener(listener);
+     }
+-
++    
+     public UnpackerImpl() {
+-        _props = new PropMap();
+-        //_props.getProperty() consults defaultProps invisibly.
+-        //_props.putAll(defaultProps);
++	_props = new PropMap();
++	//_props.getProperty() consults defaultProps invisibly.
++	//_props.putAll(defaultProps);
+     }
+-
++    
+     // Private stuff.
+     final PropMap _props;
+ 
+-
++    
+     /**
+      * Get the set of options for the pack and unpack engines.
+      * @return A sorted association of option key strings to option values.
+      */
+     public SortedMap properties() {
+-        return _props;
++	return _props;
+     }
+-
++    
+     // Back-pointer to NativeUnpacker, when active.
+     Object _nunp;
+-
+-
++    
++    
+     public String toString() {
+-        return Utils.getVersionString();
++	return Utils.getVersionString();
+     }
+-
++    
+     //Driver routines
+-
++    
+     // The unpack worker...
+     /**
+      * Takes a packed-stream InputStream, and writes to a JarOutputStream. Internally
+@@ -99,36 +99,36 @@ public class UnpackerImpl implements Pac
+      * @param out a JarOutputStream.
+      * @exception IOException if an error is encountered.
+      */
+-    public void unpack(InputStream in0, JarOutputStream out) throws IOException {
+-        assert(Utils.currentInstance.get() == null);
+-        TimeZone tz = (_props.getBoolean(Utils.PACK_DEFAULT_TIMEZONE)) ? null :
+-            TimeZone.getDefault();
+-
+-        try {
+-            Utils.currentInstance.set(this);
+-            if (tz != null) TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+-            final int verbose = _props.getInteger(Utils.DEBUG_VERBOSE);
+-            BufferedInputStream in = new BufferedInputStream(in0);
+-            if (Utils.isJarMagic(Utils.readMagic(in))) {
+-                if (verbose > 0)
+-                    Utils.log.info("Copying unpacked JAR file...");
+-                Utils.copyJarFile(new JarInputStream(in), out);
+-            } else if (_props.getBoolean(Utils.DEBUG_DISABLE_NATIVE)) {
+-                (new DoUnpack()).run(in, out);
+-                in.close();
+-                Utils.markJarFile(out);
+-            } else {
+-                (new NativeUnpack(this)).run(in, out);
+-                in.close();
+-                Utils.markJarFile(out);
+-            }
+-        } finally {
+-            _nunp = null;
+-            Utils.currentInstance.set(null);
+-            if (tz != null) TimeZone.setDefault(tz);
+-        }
++    public synchronized void unpack(InputStream in0, JarOutputStream out) throws IOException {
++	assert(Utils.currentInstance.get() == null);
++	TimeZone tz = (_props.getBoolean(Utils.PACK_DEFAULT_TIMEZONE)) ? null :
++	    TimeZone.getDefault();
++	
++	try {
++	    Utils.currentInstance.set(this);
++	    if (tz != null) TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
++	    final int verbose = _props.getInteger(Utils.DEBUG_VERBOSE);
++	    BufferedInputStream in = new BufferedInputStream(in0);
++	    if (Utils.isJarMagic(Utils.readMagic(in))) {
++		if (verbose > 0)
++		    Utils.log.info("Copying unpacked JAR file...");
++		Utils.copyJarFile(new JarInputStream(in), out);
++	    } else if (_props.getBoolean(Utils.DEBUG_DISABLE_NATIVE)) {
++		(new DoUnpack()).run(in, out);
++		in.close();
++		Utils.markJarFile(out);
++	    } else {
++		(new NativeUnpack(this)).run(in, out);
++		in.close();
++		Utils.markJarFile(out);
++	    }
++	} finally {
++	    _nunp = null;
++	    Utils.currentInstance.set(null);
++	    if (tz != null) TimeZone.setDefault(tz);
++	}
+     }
+-
++    
+     /**
+      * Takes an input File containing the pack file, and generates a JarOutputStream.
+      * <p>
+@@ -137,121 +137,121 @@ public class UnpackerImpl implements Pac
+      * @param out a JarOutputStream.
+      * @exception IOException if an error is encountered.
+      */
+-    public void unpack(File in, JarOutputStream out) throws IOException {
+-        // Use the stream-based implementation.
+-        // %%% Reconsider if native unpacker learns to memory-map the file.
+-        FileInputStream instr = new FileInputStream(in);
+-        unpack(instr, out);
+-        if (_props.getBoolean(Utils.UNPACK_REMOVE_PACKFILE)) {
+-            in.delete();
+-        }
++    public synchronized void unpack(File in, JarOutputStream out) throws IOException {
++	// Use the stream-based implementation.
++	// %%% Reconsider if native unpacker learns to memory-map the file.
++	FileInputStream instr = new FileInputStream(in);
++	unpack(instr, out);
++	if (_props.getBoolean(Utils.UNPACK_REMOVE_PACKFILE)) {
++	    in.delete();
++	}
+     }
+-
++    
+     private class DoUnpack {
+-        final int verbose = _props.getInteger(Utils.DEBUG_VERBOSE);
+-
+-        {
+-            _props.setInteger(Pack200.Unpacker.PROGRESS, 0);
+-        }
+-
+-        // Here's where the bits are read from disk:
+-        final Package pkg = new Package();
+-
+-        final boolean keepModtime
+-            = Pack200.Packer.KEEP.equals(_props.getProperty(Utils.UNPACK_MODIFICATION_TIME, Pack200.Packer.KEEP));
+-        final boolean keepDeflateHint
+-            = Pack200.Packer.KEEP.equals(_props.getProperty(Pack200.Unpacker.DEFLATE_HINT, Pack200.Packer.KEEP));
+-        final int modtime;
+-        final boolean deflateHint;
+-        {
+-            if (!keepModtime) {
+-                modtime = _props.getTime(Utils.UNPACK_MODIFICATION_TIME);
+-            } else {
+-                modtime = pkg.default_modtime;
+-            }
+-
+-            deflateHint = (keepDeflateHint) ? false :
+-                _props.getBoolean(java.util.jar.Pack200.Unpacker.DEFLATE_HINT);
+-        }
+-
+-        // Checksum apparatus.
+-        final CRC32 crc = new CRC32();
+-        final ByteArrayOutputStream bufOut = new ByteArrayOutputStream();
+-        final OutputStream crcOut = new CheckedOutputStream(bufOut, crc);
+-
+-        public void run(BufferedInputStream in, JarOutputStream out) throws IOException {
+-            if (verbose > 0) {
+-                _props.list(System.out);
+-            }
+-            for (int seg = 1; ; seg++) {
+-                unpackSegment(in, out);
+-
+-                // Try to get another segment.
+-                if (!Utils.isPackMagic(Utils.readMagic(in)))  break;
+-                if (verbose > 0)
+-                    Utils.log.info("Finished segment #"+seg);
+-            }
+-        }
+-
+-        private void unpackSegment(InputStream in, JarOutputStream out) throws IOException {
+-            _props.setProperty(java.util.jar.Pack200.Unpacker.PROGRESS,"0");
+-            // Process the output directory or jar output.
+-            new PackageReader(pkg, in).read();
+-
+-            if (_props.getBoolean("unpack.strip.debug"))    pkg.stripAttributeKind("Debug");
+-            if (_props.getBoolean("unpack.strip.compile"))  pkg.stripAttributeKind("Compile");
+-            _props.setProperty(java.util.jar.Pack200.Unpacker.PROGRESS,"50");
+-            pkg.ensureAllClassFiles();
+-            // Now write out the files.
+-            HashSet classesToWrite = new HashSet(pkg.getClasses());
+-            for (Iterator i = pkg.getFiles().iterator(); i.hasNext(); ) {
+-                Package.File file = (Package.File) i.next();
+-                String name = file.nameString;
+-                JarEntry je = new JarEntry(Utils.getJarEntryName(name));
+-                boolean deflate;
+-
+-                deflate = (keepDeflateHint) ? (((file.options & Constants.FO_DEFLATE_HINT) != 0) ||
+-                                                   ((pkg.default_options & Constants.AO_DEFLATE_HINT) != 0)) :
+-                    deflateHint;
+-
+-                boolean needCRC = !deflate;  // STORE mode requires CRC
+-
+-                if (needCRC)  crc.reset();
+-                bufOut.reset();
+-                if (file.isClassStub()) {
+-                    Package.Class cls = file.getStubClass();
+-                    assert(cls != null);
+-                    new ClassWriter(cls, needCRC ? crcOut : bufOut).write();
+-                    classesToWrite.remove(cls);  // for an error check
+-                } else {
+-                    // collect data & maybe CRC
+-                    file.writeTo(needCRC ? crcOut : bufOut);
+-                }
+-                je.setMethod(deflate ? JarEntry.DEFLATED : JarEntry.STORED);
+-                if (needCRC) {
+-                    if (verbose > 0)
+-                        Utils.log.info("stored size="+bufOut.size()+" and crc="+crc.getValue());
+-
+-                    je.setMethod(JarEntry.STORED);
+-                    je.setSize(bufOut.size());
+-                    je.setCrc(crc.getValue());
+-                }
+-                if (keepModtime) {
+-                    je.setTime(file.modtime);
+-                    // Convert back to milliseconds
+-                    je.setTime((long)file.modtime * 1000);
+-                } else {
+-                    je.setTime((long)modtime * 1000);
+-                }
+-                out.putNextEntry(je);
+-                bufOut.writeTo(out);
+-                out.closeEntry();
+-                if (verbose > 0)
+-                    Utils.log.info("Writing "+Utils.zeString((ZipEntry)je));
+-            }
+-            assert(classesToWrite.isEmpty());
+-            _props.setProperty(java.util.jar.Pack200.Unpacker.PROGRESS,"100");
+-            pkg.reset();  // reset for the next segment, if any
+-        }
++	final int verbose = _props.getInteger(Utils.DEBUG_VERBOSE);
++	
++	{
++	    _props.setInteger(Pack200.Unpacker.PROGRESS, 0);
++	}
++	
++	// Here's where the bits are read from disk:
++	final Package pkg = new Package();
++	
++	final boolean keepModtime
++	    = Pack200.Packer.KEEP.equals(_props.getProperty(Utils.UNPACK_MODIFICATION_TIME, Pack200.Packer.KEEP));
++	final boolean keepDeflateHint
++	    = Pack200.Packer.KEEP.equals(_props.getProperty(Pack200.Unpacker.DEFLATE_HINT, Pack200.Packer.KEEP));
++	final int modtime;
++	final boolean deflateHint;
++	{
++	    if (!keepModtime) {
++		modtime = _props.getTime(Utils.UNPACK_MODIFICATION_TIME);
++	    } else {
++		modtime = pkg.default_modtime;
++	    }
++	    
++	    deflateHint = (keepDeflateHint) ? false :
++		_props.getBoolean(java.util.jar.Pack200.Unpacker.DEFLATE_HINT);
++	}
++	
++	// Checksum apparatus.
++	final CRC32 crc = new CRC32();
++	final ByteArrayOutputStream bufOut = new ByteArrayOutputStream();
++	final OutputStream crcOut = new CheckedOutputStream(bufOut, crc);
++	
++	public void run(BufferedInputStream in, JarOutputStream out) throws IOException {
++	    if (verbose > 0) {
++		_props.list(System.out);
++	    }
++	    for (int seg = 1; ; seg++) {
++		unpackSegment(in, out);
++		
++		// Try to get another segment.
++		if (!Utils.isPackMagic(Utils.readMagic(in)))  break;
++		if (verbose > 0)
++		    Utils.log.info("Finished segment #"+seg);
++	    }
++	}
++	
++	private void unpackSegment(InputStream in, JarOutputStream out) throws IOException {
++	    _props.setProperty(java.util.jar.Pack200.Unpacker.PROGRESS,"0");
++	    // Process the output directory or jar output.
++	    new PackageReader(pkg, in).read();
++	    
++	    if (_props.getBoolean("unpack.strip.debug"))    pkg.stripAttributeKind("Debug");
++	    if (_props.getBoolean("unpack.strip.compile"))  pkg.stripAttributeKind("Compile");
++	    _props.setProperty(java.util.jar.Pack200.Unpacker.PROGRESS,"50");
++	    pkg.ensureAllClassFiles();
++	    // Now write out the files.
++	    HashSet classesToWrite = new HashSet(pkg.getClasses());
++	    for (Iterator i = pkg.getFiles().iterator(); i.hasNext(); ) {
++		Package.File file = (Package.File) i.next();
++		String name = file.nameString;
++		JarEntry je = new JarEntry(Utils.getJarEntryName(name));
++		boolean deflate;
++		
++		deflate = (keepDeflateHint) ? (((file.options & Constants.FO_DEFLATE_HINT) != 0) ||
++						   ((pkg.default_options & Constants.AO_DEFLATE_HINT) != 0)) :
++		    deflateHint;
++		
++		boolean needCRC = !deflate;  // STORE mode requires CRC
++		
++		if (needCRC)  crc.reset();
++		bufOut.reset();
++		if (file.isClassStub()) {
++		    Package.Class cls = file.getStubClass();
++		    assert(cls != null);
++		    new ClassWriter(cls, needCRC ? crcOut : bufOut).write();
++		    classesToWrite.remove(cls);  // for an error check
++		} else {
++		    // collect data & maybe CRC
++		    file.writeTo(needCRC ? crcOut : bufOut);
++		}
++		je.setMethod(deflate ? JarEntry.DEFLATED : JarEntry.STORED);
++		if (needCRC) {
++		    if (verbose > 0)
++			Utils.log.info("stored size="+bufOut.size()+" and crc="+crc.getValue());
++		    
++		    je.setMethod(JarEntry.STORED);
++		    je.setSize(bufOut.size());
++		    je.setCrc(crc.getValue());
++		}
++		if (keepModtime) {
++		    je.setTime(file.modtime);
++		    // Convert back to milliseconds
++		    je.setTime((long)file.modtime * 1000);
++		} else {
++		    je.setTime((long)modtime * 1000);
++		}
++		out.putNextEntry(je);
++		bufOut.writeTo(out);
++		out.closeEntry();
++		if (verbose > 0)
++		    Utils.log.info("Writing "+Utils.zeString((ZipEntry)je));
++	    }
++	    assert(classesToWrite.isEmpty());
++	    _props.setProperty(java.util.jar.Pack200.Unpacker.PROGRESS,"100");
++	    pkg.reset();  // reset for the next segment, if any
++	}
+     }
+ }
+diff --git a/src/share/native/com/sun/java/util/jar/pack/bands.cpp b/src/share/native/com/sun/java/util/jar/pack/bands.cpp
+--- jdk/src/share/native/com/sun/java/util/jar/pack/bands.cpp
++++ jdk/src/share/native/com/sun/java/util/jar/pack/bands.cpp
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -81,11 +81,11 @@ void band::readData(int expectedLength) 
+     assert(defc->B() > 1 && defc->L() > 0);
+     // must have already read from previous band:
+     assert(bn >= BAND_LIMIT || bn <= 0
+-           || bn == e_cp_Utf8_big_chars
+-           || endsWith(name, "_lo")  // preceded by _hi conditional band
+-           || bn == e_file_options  // preceded by conditional band
+-           || u->rp == u->all_bands[bn-1].maxRP()
+-           || u->all_bands[bn-1].defc == null);
++	   || bn == e_cp_Utf8_big_chars
++	   || endsWith(name, "_lo")  // preceded by _hi conditional band
++	   || bn == e_file_options  // preceded by conditional band
++	   || u->rp == u->all_bands[bn-1].maxRP()
++	   || u->all_bands[bn-1].defc == null);
+ 
+     value_stream xvs;
+     coding* valc = defc;
+@@ -136,7 +136,7 @@ void band::readData(int expectedLength) 
+ 
+ #ifndef PRODUCT
+   printcr(3,"readFrom %s at %p [%d values, %d bytes, cp=%d/%d]",
+-           (name?name:"(band)"), minRP(), length, size(), cp1, cp2);
++	   (name?name:"(band)"), minRP(), length, size(), cp1, cp2);
+   if (u->verbose_bands || u->verbose >= 4) dump();
+ 
+   if (ix != null && u->verbose != 0 && length > 0) {
+@@ -187,10 +187,14 @@ void band::setIndexByTag(byte tag) {
+ 
+ entry* band::getRefCommon(cpindex* ix_, bool nullOKwithCaller) {
+   CHECK_0;
++  if (ix_ == NULL) {
++      abort("no index");
++      return NULL;
++  }
+   assert(ix_->ixTag == ixTag
+-         || (ixTag == CONSTANT_Literal
+-             && ix_->ixTag >= CONSTANT_Integer
+-             && ix_->ixTag <= CONSTANT_String));
++	 || (ixTag == CONSTANT_Literal
++	     && ix_->ixTag >= CONSTANT_Integer
++	     && ix_->ixTag <= CONSTANT_String));
+   int n = vs[0].getInt() - nullOK;
+   // Note: band-local nullOK means null encodes as 0.
+   // But nullOKwithCaller means caller is willing to tolerate a null.
+@@ -245,9 +249,9 @@ int band::getIntCount(int tag) {
+       hist0 = U_NEW(int, (HIST0_MAX - HIST0_MIN)+1);
+       CHECK_0;
+       for (int k = length; k > 0; k--) {
+-        int x = vs[0].getInt();
+-        if (x >= HIST0_MIN && x <= HIST0_MAX)
+-          hist0[x - HIST0_MIN] += 1;
++	int x = vs[0].getInt();
++	if (x >= HIST0_MIN && x <= HIST0_MAX)
++	  hist0[x - HIST0_MIN] += 1;
+       }
+       rewind();
+     }
+@@ -262,7 +266,7 @@ int band::getIntCount(int tag) {
+ }
+ 
+ #define INDEX_INIT(tag, nullOK, subindex) \
+-        ((tag) + (subindex)*SUBINDEX_BIT + (nullOK)*256)
++	((tag) + (subindex)*SUBINDEX_BIT + (nullOK)*256)
+ 
+ #define INDEX(tag)          INDEX_INIT(tag, 0, 0)
+ #define NULL_OR_INDEX(tag)  INDEX_INIT(tag, 1, 0)
+@@ -437,13 +441,13 @@ const band_init all_band_inits[] = {
+   {0}
+ };
+ #define NUM_BAND_INITS \
+-        (sizeof(all_band_inits)/sizeof(all_band_inits[0]))
++	(sizeof(all_band_inits)/sizeof(all_band_inits[0]))
+ 
+ band* band::makeBands(unpacker* u) {
+   band* all_bands = U_NEW(band, BAND_LIMIT);
+   for (int i = 0; i < BAND_LIMIT; i++) {
+     assert((byte*)&all_band_inits[i+1]
+-           < (byte*)all_band_inits+sizeof(all_band_inits));
++	   < (byte*)all_band_inits+sizeof(all_band_inits));
+     const band_init& bi = all_band_inits[i];
+     band&            b  = all_bands[i];
+     coding*          defc = coding::findBySpec(bi.defc);
+@@ -472,3 +476,5 @@ void band::initIndexes(unpacker* u) {
+     }
+   }
+ }
++
++
+diff --git a/src/share/native/com/sun/java/util/jar/pack/bands.h b/src/share/native/com/sun/java/util/jar/pack/bands.h
+--- jdk/src/share/native/com/sun/java/util/jar/pack/bands.h
++++ jdk/src/share/native/com/sun/java/util/jar/pack/bands.h
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -22,7 +22,7 @@
+  * or visit www.oracle.com if you need additional information or have any
+  * questions.
+  */
+-
++ 
+ // -*- C++ -*-
+ struct entry;
+ struct cpindex;
+@@ -50,7 +50,7 @@ struct band {
+ 
+   // properties for attribute layout elements:
+   byte          le_kind;       // EK_XXX
+-  byte          le_bci;        // 0,EK_BCI,EK_BCD,EK_BCO
++  byte		le_bci;        // 0,EK_BCI,EK_BCD,EK_BCO
+   byte          le_back;       // ==EF_BACK
+   byte          le_len;        // 0,1,2,4 (size in classfile), or call addr
+   band**        le_body;       // body of repl, union, call (null-terminated)
+@@ -101,8 +101,8 @@ struct band {
+ 
+   int    getByte()  { assert(ix == null); return vs[0].getByte(); }
+   int    getInt()   { assert(ix == null); return vs[0].getInt(); }
+-  entry* getRefN()  { assert(ix != null); return getRefCommon(ix, true); }
+-  entry* getRef()   { assert(ix != null); return getRefCommon(ix, false); }
++  entry* getRefN()  { return getRefCommon(ix, true); }
++  entry* getRef()   { return getRefCommon(ix, false); }
+   entry* getRefUsing(cpindex* ix2)
+                     { assert(ix == null); return getRefCommon(ix2, true); }
+   entry* getRefCommon(cpindex* ix, bool nullOK);
+diff --git a/src/share/native/com/sun/java/util/jar/pack/defines.h b/src/share/native/com/sun/java/util/jar/pack/defines.h
+--- jdk/src/share/native/com/sun/java/util/jar/pack/defines.h
++++ jdk/src/share/native/com/sun/java/util/jar/pack/defines.h
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2001, 2009, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -22,10 +22,10 @@
+  * or visit www.oracle.com if you need additional information or have any
+  * questions.
+  */
+-
++ 
+ // random definitions
+ 
+-#ifdef _MSC_VER
++#ifdef _MSC_VER 
+ #include <windows.h>
+ #include <winuser.h>
+ #else
+@@ -94,15 +94,15 @@ typedef unsigned int uLong; // Historica
+ #else
+ typedef unsigned long uLong;
+ #endif
+-#ifdef _MSC_VER
+-typedef LONGLONG        jlong;
+-typedef DWORDLONG       julong;
+-#define MKDIR(dir)      mkdir(dir)
+-#define getpid()        _getpid()
+-#define PATH_MAX        MAX_PATH
+-#define dup2(a,b)       _dup2(a,b)
++#ifdef _MSC_VER 
++typedef LONGLONG 	jlong;
++typedef DWORDLONG 	julong;
++#define MKDIR(dir) 	mkdir(dir)
++#define getpid() 	_getpid()
++#define PATH_MAX 	MAX_PATH
++#define dup2(a,b)	_dup2(a,b)
+ #define strcasecmp(s1, s2) _stricmp(s1,s2)
+-#define tempname        _tempname
++#define tempname	_tempname
+ #define sleep Sleep
+ #else
+ typedef signed char byte;
+@@ -123,37 +123,40 @@ enum { false, true };
+ 
+ #define null (0)
+ 
+-#ifndef __sparc
++#ifndef __sparc 
+ #define intptr_t jlong
+ #endif
+ 
+ #define ptrlowbits(x)  ((int) (intptr_t)(x))
+ 
++/* Back and forth from jlong to pointer */
++#define ptr2jlong(x)  ((jlong)(size_t)(void*)(x))
++#define jlong2ptr(x)  ((void*)(size_t)(x))
+ 
+ // Keys used by Java:
+-#define UNPACK_DEFLATE_HINT             "unpack.deflate.hint"
++#define UNPACK_DEFLATE_HINT		"unpack.deflate.hint"
+ 
+-#define COM_PREFIX                      "com.sun.java.util.jar.pack."
+-#define UNPACK_MODIFICATION_TIME        COM_PREFIX"unpack.modification.time"
+-#define DEBUG_VERBOSE                   COM_PREFIX"verbose"
++#define COM_PREFIX			"com.sun.java.util.jar.pack."
++#define UNPACK_MODIFICATION_TIME	COM_PREFIX"unpack.modification.time"
++#define DEBUG_VERBOSE			COM_PREFIX"verbose"
+ 
+-#define ZIP_ARCHIVE_MARKER_COMMENT      "PACK200"
++#define ZIP_ARCHIVE_MARKER_COMMENT	"PACK200"
+ 
+ // The following are not known to the Java classes:
+-#define UNPACK_LOG_FILE                 COM_PREFIX"unpack.log.file"
+-#define UNPACK_REMOVE_PACKFILE          COM_PREFIX"unpack.remove.packfile"
++#define UNPACK_LOG_FILE			COM_PREFIX"unpack.log.file"
++#define UNPACK_REMOVE_PACKFILE		COM_PREFIX"unpack.remove.packfile"
+ 
+ 
+ // Called from unpacker layers
+-#define _CHECK_DO(t,x)          { if (t) {x;} }
++#define _CHECK_DO(t,x)	 	{ if (t) {x;} }
+ 
+-#define CHECK                   _CHECK_DO(aborting(), return)
+-#define CHECK_(y)               _CHECK_DO(aborting(), return y)
+-#define CHECK_0                 _CHECK_DO(aborting(), return 0)
++#define CHECK			_CHECK_DO(aborting(), return)
++#define CHECK_(y)		_CHECK_DO(aborting(), return y)
++#define CHECK_0			_CHECK_DO(aborting(), return 0)
+ 
+-#define CHECK_NULL(p)           _CHECK_DO((p)==null, return)
+-#define CHECK_NULL_(y,p)        _CHECK_DO((p)==null, return y)
+-#define CHECK_NULL_0(p)         _CHECK_DO((p)==null, return 0)
++#define CHECK_NULL(p)		_CHECK_DO((p)==null, return)
++#define CHECK_NULL_(y,p)	_CHECK_DO((p)==null, return y)
++#define CHECK_NULL_0(p)		_CHECK_DO((p)==null, return 0)
+ 
+ #define CHECK_COUNT(t)          if (t < 0){abort("bad value count");} CHECK
+ 
+diff --git a/src/share/native/com/sun/java/util/jar/pack/jni.cpp b/src/share/native/com/sun/java/util/jar/pack/jni.cpp
+--- jdk/src/share/native/com/sun/java/util/jar/pack/jni.cpp
++++ jdk/src/share/native/com/sun/java/util/jar/pack/jni.cpp
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -43,6 +43,9 @@
+ #include "bands.h"
+ #include "constants.h"
+ #include "zip.h"
++
++#include "jni_util.h"
++
+ #include "unpack.h"
+ 
+ 
+@@ -50,17 +53,19 @@ static jmethodID currentInstMID;
+ static jmethodID currentInstMID;
+ static jmethodID readInputMID;
+ static jclass    NIclazz;
++static jmethodID getUnpackerPtrMID;
+ 
+ static char* dbg = null;
+ 
+ #define THROW_IOE(x) JNU_ThrowIOException(env,x)
+ 
+ static jlong read_input_via_jni(unpacker* self,
+-                                void* buf, jlong minlen, jlong maxlen);
+-
++				void* buf, jlong minlen, jlong maxlen);
++				
+ static unpacker* get_unpacker(JNIEnv *env, jobject pObj, bool noCreate=false) {
+-  unpacker* uPtr = (unpacker*) env->GetLongField(pObj, unpackerPtrFID);
+-  //fprintf(stderr, "get_unpacker(%p) uPtr=%p\n", pObj, uPtr);
++  unpacker* uPtr;
++  jlong p = env->CallLongMethod(pObj, getUnpackerPtrMID);
++  uPtr = (unpacker*)jlong2ptr(p);
+   if (uPtr == null) {
+     if (noCreate)  return null;
+     uPtr = new unpacker();
+@@ -89,11 +94,15 @@ static unpacker* get_unpacker() {
+   if (env == null)
+     return null;
+   jobject pObj = env->CallStaticObjectMethod(NIclazz, currentInstMID);
+-  //fprintf(stderr, "get_unpacker() pObj=%p\n", pObj);
+-  if (pObj == null)
+-    return null;
+-  // Got pObj and env; now do it the easy way.
+-  return get_unpacker(env, pObj);
++  //fprintf(stderr, "get_unpacker0() pObj=%p\n", pObj);
++  if (pObj != null) {
++    // Got pObj and env; now do it the easy way.
++    return get_unpacker(env, pObj);
++  }
++  // this should really not happen, if it does something is seriously
++  // wrong throw an exception
++  THROW_IOE(ERROR_INTERNAL);
++  return null;
+ }
+ 
+ static void free_unpacker(JNIEnv *env, jobject pObj, unpacker* uPtr) {
+@@ -113,36 +122,47 @@ unpacker* unpacker::current() {
+ 
+ // Callback for fetching data, Java style.  Calls NativeUnpack.readInputFn().
+ static jlong read_input_via_jni(unpacker* self,
+-                                void* buf, jlong minlen, jlong maxlen) {
++				void* buf, jlong minlen, jlong maxlen) {
+   JNIEnv* env = (JNIEnv*) self->jnienv;
+   jobject pbuf = env->NewDirectByteBuffer(buf, maxlen);
+   return env->CallLongMethod((jobject) self->jniobj, readInputMID,
+-                             pbuf, minlen);
++			     pbuf, minlen);
+ }
+ 
+-JNIEXPORT void JNICALL
++JNIEXPORT void JNICALL 
+ Java_com_sun_java_util_jar_pack_NativeUnpack_initIDs(JNIEnv *env, jclass clazz) {
++#ifndef PRODUCT
+   dbg = getenv("DEBUG_ATTACH");
+   while( dbg != null) { sleep(10); }
++#endif
+   NIclazz = (jclass) env->NewGlobalRef(clazz);
+   unpackerPtrFID = env->GetFieldID(clazz, "unpackerPtr", "J");
+   currentInstMID = env->GetStaticMethodID(clazz, "currentInstance",
+-                                          "()Ljava/lang/Object;");
++					  "()Ljava/lang/Object;");
+   readInputMID = env->GetMethodID(clazz, "readInputFn",
+-                                  "(Ljava/nio/ByteBuffer;J)J");
++				  "(Ljava/nio/ByteBuffer;J)J");
++
++  getUnpackerPtrMID = env->GetMethodID(clazz, "getUnpackerPtr", "()J");
++
+   if (unpackerPtrFID == null ||
+       currentInstMID == null ||
+       readInputMID == null ||
+-      NIclazz == null) {
++      NIclazz == null ||
++      getUnpackerPtrMID == null) {
+     THROW_IOE("cannot init class members");
+   }
+ }
+ 
+-JNIEXPORT jlong JNICALL
++JNIEXPORT jlong JNICALL 
+ Java_com_sun_java_util_jar_pack_NativeUnpack_start(JNIEnv *env, jobject pObj,
+-                                   jobject pBuf, jlong offset) {
+-  unpacker* uPtr = get_unpacker(env, pObj);
+-
++				   jobject pBuf, jlong offset) {
++  // try to get the unpacker pointer the hard way first, we do this to ensure
++  // valid object pointers and env is intact, if not now is good time to bail.
++  unpacker* uPtr = get_unpacker();
++  //fprintf(stderr, "start(%p) uPtr=%p initializing\n", pObj, uPtr);
++  if (uPtr == null) {
++      return -1;
++  }
+   // redirect our io to the default log file or whatever.
+   uPtr->redirect_stdio();
+ 
+@@ -158,6 +178,13 @@ Java_com_sun_java_util_jar_pack_NativeUn
+     else
+       { buf = (char*)buf + (size_t)offset; buflen -= (size_t)offset; }
+   }
++  
++  // before we start off we make sure there is no other error by the time we
++  // get here
++  if (uPtr->aborting()) {
++      THROW_IOE(uPtr->get_abort_message());
++      return 0;
++  }
+ 
+   uPtr->start(buf, buflen);
+   if (uPtr->aborting()) {
+@@ -166,13 +193,13 @@ Java_com_sun_java_util_jar_pack_NativeUn
+   }
+ 
+   return ((jlong)
+-          uPtr->get_segments_remaining() << 32)
++	  uPtr->get_segments_remaining() << 32)
+     + uPtr->get_files_remaining();
+ }
+ 
+-JNIEXPORT jboolean JNICALL
+-Java_com_sun_java_util_jar_pack_NativeUnpack_getNextFile(JNIEnv *env, jobject pObj,
+-                                         jobjectArray pParts) {
++JNIEXPORT jboolean JNICALL 
++Java_com_sun_java_util_jar_pack_NativeUnpack_getNextFile(JNIEnv *env, jobject pObj, 
++					 jobjectArray pParts) {
+ 
+   unpacker* uPtr = get_unpacker(env, pObj);
+   unpacker::file* filep = uPtr->get_next_file();
+@@ -201,19 +228,19 @@ Java_com_sun_java_util_jar_pack_NativeUn
+   jobject pDataBuf = null;
+   if (filep->data[0].len > 0)
+     pDataBuf = env->NewDirectByteBuffer(filep->data[0].ptr,
+-                                        filep->data[0].len);
++					filep->data[0].len);
+   env->SetObjectArrayElement(pParts, pidx++, pDataBuf);
+   pDataBuf = null;
+   if (filep->data[1].len > 0)
+     pDataBuf = env->NewDirectByteBuffer(filep->data[1].ptr,
+-                                        filep->data[1].len);
++					filep->data[1].len);
+   env->SetObjectArrayElement(pParts, pidx++, pDataBuf);
+ 
+   return true;
+ }
+ 
+ 
+-JNIEXPORT jobject JNICALL
++JNIEXPORT jobject JNICALL 
+ Java_com_sun_java_util_jar_pack_NativeUnpack_getUnusedInput(JNIEnv *env, jobject pObj) {
+   unpacker* uPtr = get_unpacker(env, pObj);
+   unpacker::file* filep = &uPtr->cur_file;
+@@ -225,14 +252,18 @@ Java_com_sun_java_util_jar_pack_NativeUn
+ 
+   // We have fetched all the files.
+   // Now swallow up any remaining input.
+-  if (uPtr->input_remaining() == 0)
++  if (uPtr->input_remaining() == 0) {
+     return null;
+-  else
+-    return env->NewDirectByteBuffer(uPtr->input_scan(),
+-                                    uPtr->input_remaining());
++  }  
++  else {
++    bytes remaining_bytes;
++    remaining_bytes.malloc(uPtr->input_remaining());
++    remaining_bytes.copyFrom(uPtr->input_scan(), uPtr->input_remaining());
++    return env->NewDirectByteBuffer(remaining_bytes.ptr, remaining_bytes.len);
++  }
+ }
+ 
+-JNIEXPORT jlong JNICALL
++JNIEXPORT jlong JNICALL 
+ Java_com_sun_java_util_jar_pack_NativeUnpack_finish(JNIEnv *env, jobject pObj) {
+   unpacker* uPtr = get_unpacker(env, pObj, false);
+   if (uPtr == null)  return 0;
+@@ -241,9 +272,9 @@ Java_com_sun_java_util_jar_pack_NativeUn
+   return consumed;
+ }
+ 
+-JNIEXPORT jboolean JNICALL
+-Java_com_sun_java_util_jar_pack_NativeUnpack_setOption(JNIEnv *env, jobject pObj,
+-                                       jstring pProp, jstring pValue) {
++JNIEXPORT jboolean JNICALL 
++Java_com_sun_java_util_jar_pack_NativeUnpack_setOption(JNIEnv *env, jobject pObj, 
++				       jstring pProp, jstring pValue) {
+   unpacker*   uPtr  = get_unpacker(env, pObj);
+   const char* prop  = env->GetStringUTFChars(pProp, JNI_FALSE);
+   const char* value = env->GetStringUTFChars(pValue, JNI_FALSE);
+@@ -253,9 +284,9 @@ Java_com_sun_java_util_jar_pack_NativeUn
+   return retval;
+ }
+ 
+-JNIEXPORT jstring JNICALL
+-Java_com_sun_java_util_jar_pack_NativeUnpack_getOption(JNIEnv *env, jobject pObj,
+-                                       jstring pProp) {
++JNIEXPORT jstring JNICALL 
++Java_com_sun_java_util_jar_pack_NativeUnpack_getOption(JNIEnv *env, jobject pObj, 
++				       jstring pProp) {
+ 
+   unpacker*   uPtr  = get_unpacker(env, pObj);
+   const char* prop  = env->GetStringUTFChars(pProp, JNI_FALSE);
+diff --git a/src/share/native/com/sun/java/util/jar/pack/unpack.cpp b/src/share/native/com/sun/java/util/jar/pack/unpack.cpp
+--- jdk/src/share/native/com/sun/java/util/jar/pack/unpack.cpp
++++ jdk/src/share/native/com/sun/java/util/jar/pack/unpack.cpp
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2001, 2011, 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
+@@ -38,7 +38,7 @@
+ #include <time.h>
+ 
+ 
+-
++ 
+ 
+ #include "defines.h"
+ #include "bytes.h"
+@@ -185,9 +185,9 @@ struct entry {
+       || (tag2 == CONSTANT_Utf8 && tag == CONSTANT_Signature)
+       #ifndef PRODUCT
+       || (tag2 == CONSTANT_Literal
+-          && tag >= CONSTANT_Integer && tag <= CONSTANT_String && tag != CONSTANT_Class)
++	  && tag >= CONSTANT_Integer && tag <= CONSTANT_String && tag != CONSTANT_Class)
+       || (tag2 == CONSTANT_Member
+-          && tag >= CONSTANT_Fieldref && tag <= CONSTANT_InterfaceMethodref)
++	  && tag >= CONSTANT_Fieldref && tag <= CONSTANT_InterfaceMethodref)
+       #endif
+       ;
+   }
+@@ -238,9 +238,9 @@ int entry::typeSize() {
+       // else fall through
+     case 'L':
+       sigp = strchr(sigp, ';');
+-      if (sigp == null) {
+-          unpack_abort("bad data");
+-          return 0;
++      if (sigp == null) {  
++	  unpack_abort("bad data");
++	  return 0;
+       }
+       sigp += 1;
+       break;
+@@ -252,11 +252,13 @@ int entry::typeSize() {
+ }
+ 
+ inline cpindex* cpool::getFieldIndex(entry* classRef) {
++  if (classRef == NULL) { abort("missing class reference"); return NULL; }
+   assert(classRef->tagMatches(CONSTANT_Class));
+   assert((uint)classRef->inord < tag_count[CONSTANT_Class]);
+   return &member_indexes[classRef->inord*2+0];
+ }
+ inline cpindex* cpool::getMethodIndex(entry* classRef) {
++  if (classRef == NULL) { abort("missing class reference"); return NULL; }
+   assert(classRef->tagMatches(CONSTANT_Class));
+   assert((uint)classRef->inord < tag_count[CONSTANT_Class]);
+   return &member_indexes[classRef->inord*2+1];
+@@ -512,11 +514,10 @@ void unpacker::read_file_header() {
+     AH_CP_NUMBER_LEN = 4,  // int/float/long/double
+     AH_SPECIAL_FORMAT_LEN = 2, // layouts/band-headers
+     AH_LENGTH_MIN = AH_LENGTH
+-        -(AH_FILE_HEADER_LEN+AH_SPECIAL_FORMAT_LEN+AH_CP_NUMBER_LEN),
+-    ARCHIVE_SIZE_MIN = AH_LENGTH_MIN - (AH_LENGTH_0 + AH_ARCHIVE_SIZE_LEN),
++	-(AH_FILE_HEADER_LEN+AH_SPECIAL_FORMAT_LEN+AH_CP_NUMBER_LEN),
++    ARCHIVE_SIZE_MIN = AH_LENGTH_MIN - (AH_LENGTH_0 + AH_ARCHIVE_SIZE_LEN), 
+     FIRST_READ  = MAGIC_BYTES + AH_LENGTH_MIN
+   };
+-
+ 
+   assert(AH_LENGTH_MIN    == 15); // # of UNSIGNED5 fields required after archive_magic
+   assert(ARCHIVE_SIZE_MIN == 10); // # of UNSIGNED5 fields required after archive_size
+@@ -580,15 +581,15 @@ void unpacker::read_file_header() {
+     for (;;) {
+       jarout->write_data(rp, input_remaining());
+       if (foreign_buf)
+-        break;  // one-time use of a passed in buffer
++	break;  // one-time use of a passed in buffer
+       if (input.size() < CHUNK) {
+-        // Get some breathing room.
+-        input.set(U_NEW(byte, (size_t) CHUNK + C_SLOP), (size_t) CHUNK);
+-        CHECK;
++	// Get some breathing room.
++	input.set(U_NEW(byte, (size_t) CHUNK + C_SLOP), (size_t) CHUNK);
++	CHECK;
+       }
+       rp = rplimit = input.base();
+       if (!ensure_input(1))
+-        break;
++	break;
+     }
+     jarout->closeJarFile(false);
+ #endif
+@@ -612,16 +613,16 @@ void unpacker::read_file_header() {
+   hdrVals += 2;
+ 
+   if (magic != JAVA_PACKAGE_MAGIC ||
+-      (majver != JAVA5_PACKAGE_MAJOR_VERSION  &&
+-       majver != JAVA6_PACKAGE_MAJOR_VERSION) ||
+-      (minver != JAVA5_PACKAGE_MINOR_VERSION  &&
++      (majver != JAVA5_PACKAGE_MAJOR_VERSION  && 
++       majver != JAVA6_PACKAGE_MAJOR_VERSION) || 
++      (minver != JAVA5_PACKAGE_MINOR_VERSION  && 
+        minver != JAVA6_PACKAGE_MINOR_VERSION)) {
+     char message[200];
+     sprintf(message, "@" ERROR_FORMAT ": magic/ver = "
+-            "%08X/%d.%d should be %08X/%d.%d OR %08X/%d.%d\n",
+-            magic, majver, minver,
+-            JAVA_PACKAGE_MAGIC, JAVA5_PACKAGE_MAJOR_VERSION, JAVA5_PACKAGE_MINOR_VERSION,
+-            JAVA_PACKAGE_MAGIC, JAVA6_PACKAGE_MAJOR_VERSION, JAVA6_PACKAGE_MINOR_VERSION);
++	    "%08X/%d.%d should be %08X/%d.%d OR %08X/%d.%d\n",
++	    magic, majver, minver, 
++	    JAVA_PACKAGE_MAGIC, JAVA5_PACKAGE_MAJOR_VERSION, JAVA5_PACKAGE_MINOR_VERSION,
++	    JAVA_PACKAGE_MAGIC, JAVA6_PACKAGE_MAJOR_VERSION, JAVA6_PACKAGE_MINOR_VERSION);
+     abort(message);
+   }
+   CHECK;
+@@ -635,7 +636,7 @@ void unpacker::read_file_header() {
+ #undef ORBIT
+   if ((archive_options & ~OPTION_LIMIT) != 0) {
+     fprintf(errstrm, "Warning: Illegal archive options 0x%x\n",
+-            archive_options);
++	    archive_options);
+     abort("illegal archive options");
+     return;
+   }
+@@ -675,7 +676,7 @@ void unpacker::read_file_header() {
+     if (archive_size < header_size_1) {
+       abort("too much read-ahead");  // somehow we pre-fetched too much?
+       return;
+-    }
++    }   
+     input.set(U_NEW(byte, add_size(header_size_0, archive_size, C_SLOP)),
+               (size_t) header_size_0 + archive_size);
+     CHECK;
+@@ -756,9 +757,9 @@ void unpacker::read_file_header() {
+       case CONSTANT_Float:
+       case CONSTANT_Long:
+       case CONSTANT_Double:
+-        cp_counts[k] = 0;
+-        hdrValsSkipped += 1;
+-        continue;
++	cp_counts[k] = 0;
++	hdrValsSkipped += 1;
++	continue;
+       }
+     }
+     cp_counts[k] = hdr.getInt();
+@@ -813,7 +814,7 @@ void unpacker::read_file_header() {
+   bytes band_headers;
+   // The "1+" allows an initial byte to be pushed on the front.
+   band_headers.set(1+U_NEW(byte, 1+band_headers_size+C_SLOP),
+-                   band_headers_size);
++		   band_headers_size);
+   CHECK;
+   // Start scanning band headers here:
+   band_headers.copyFrom(rp, band_headers.len);
+@@ -874,7 +875,7 @@ void cpool::init(unpacker* u_, int count
+       IMPLICIT_ENTRY_COUNT = 1  // empty Utf8 string
+     };
+     if (len >= (1<<29) || len < 0
+-        || next_entry >= CP_SIZE_LIMIT+IMPLICIT_ENTRY_COUNT) {
++	|| next_entry >= CP_SIZE_LIMIT+IMPLICIT_ENTRY_COUNT) {
+       abort("archive too large:  constant pool limit exceeded");
+       return;
+     }
+@@ -935,9 +936,9 @@ static byte* skip_Utf8_chars(byte* cp, i
+     int ch = *cp & 0xFF;
+     if ((ch & 0xC0) != 0x80) {
+       if (len-- == 0)
+-        return cp;
++	return cp;
+       if (ch < 0x80 && len == 0)
+-        return cp+1;
++	return cp+1;
+     }
+   }
+ }
+@@ -963,9 +964,9 @@ static int compare_Utf8_chars(bytes& b1,
+       if (c1 == 0xC0 && (p1[i+1] & 0xFF) == 0x80)  c1 = 0;
+       if (c2 == 0xC0 && (p2[i+1] & 0xFF) == 0x80)  c2 = 0;
+       if (c0 == 0xC0) {
+-        assert(((c1|c2) & 0xC0) == 0x80);  // c1 & c2 are extension chars
+-        if (c1 == 0x80)  c1 = 0;  // will sort below c2
+-        if (c2 == 0x80)  c2 = 0;  // will sort below c1
++	assert(((c1|c2) & 0xC0) == 0x80);  // c1 & c2 are extension chars
++	if (c1 == 0x80)  c1 = 0;  // will sort below c2
++	if (c2 == 0x80)  c2 = 0;  // will sort below c1
+       }
+       return c1 - c2;
+     }
+@@ -1024,9 +1025,9 @@ void unpacker::read_Utf8_values(entry* c
+       chars.malloc(size3);
+     } else {
+       if (!charbuf.canAppend(size3+1)) {
+-        assert(charbuf.allocated == 0 || tmallocs.contains(charbuf.base()));
+-        charbuf.init(CHUNK);  // Reset to new buffer.
+-        tmallocs.add(charbuf.base());
++	assert(charbuf.allocated == 0 || tmallocs.contains(charbuf.base()));
++	charbuf.init(CHUNK);  // Reset to new buffer.
++	tmallocs.add(charbuf.base());
+       }
+       chars.set(charbuf.grow(size3+1), size3);
+     }
+@@ -1191,9 +1192,9 @@ void unpacker::read_single_refs(band& cp
+       // Maintain cross-reference:
+       entry* &htref = cp.hashTabRef(indexTag, e.value.b);
+       if (htref == null) {
+-        // Note that if two identical classes are transmitted,
+-        // the first is taken to be the canonical one.
+-        htref = &e;
++	// Note that if two identical classes are transmitted,
++	// the first is taken to be the canonical one.
++	htref = &e;
+       }
+     }
+   }
+@@ -1202,7 +1203,7 @@ void unpacker::read_single_refs(band& cp
+ 
+ maybe_inline
+ void unpacker::read_double_refs(band& cp_band, byte ref1Tag, byte ref2Tag,
+-                                entry* cpMap, int len) {
++				entry* cpMap, int len) {
+   band& cp_band1 = cp_band;
+   band& cp_band2 = cp_band.nextBand();
+   cp_band1.setIndexByTag(ref1Tag);
+@@ -1214,6 +1215,7 @@ void unpacker::read_double_refs(band& cp
+     entry& e = cpMap[i];
+     e.refs = U_NEW(entry*, e.nrefs = 2);
+     e.refs[0] = cp_band1.getRef();
++    CHECK;
+     e.refs[1] = cp_band2.getRef();
+     CHECK;
+   }
+@@ -1302,23 +1304,23 @@ void unpacker::read_cp() {
+       break;
+     case CONSTANT_NameandType:
+       read_double_refs(cp_Descr_name /*& cp_Descr_type*/,
+-                       CONSTANT_Utf8, CONSTANT_Signature,
+-                       cpMap, len);
++		       CONSTANT_Utf8, CONSTANT_Signature,
++		       cpMap, len);
+       break;
+     case CONSTANT_Fieldref:
+       read_double_refs(cp_Field_class /*& cp_Field_desc*/,
+-                       CONSTANT_Class, CONSTANT_NameandType,
+-                       cpMap, len);
++		       CONSTANT_Class, CONSTANT_NameandType,
++		       cpMap, len);
+       break;
+     case CONSTANT_Methodref:
+       read_double_refs(cp_Method_class /*& cp_Method_desc*/,
+-                       CONSTANT_Class, CONSTANT_NameandType,
+-                       cpMap, len);
++		       CONSTANT_Class, CONSTANT_NameandType,
++		       cpMap, len);
+       break;
+     case CONSTANT_InterfaceMethodref:
+       read_double_refs(cp_Imethod_class /*& cp_Imethod_desc*/,
+-                       CONSTANT_Class, CONSTANT_NameandType,
+-                       cpMap, len);
++		       CONSTANT_Class, CONSTANT_NameandType,
++		       cpMap, len);
+       break;
+     default:
+       assert(false);
+@@ -1384,8 +1386,8 @@ inline
+ inline
+ unpacker::layout_definition*
+ unpacker::attr_definitions::defineLayout(int idx,
+-                                         entry* nameEntry,
+-                                         const char* layout) {
++					 entry* nameEntry,
++					 const char* layout) {
+   const char* name = nameEntry->value.b.strval();
+   layout_definition* lo = defineLayout(idx, name, layout);
+   CHECK_0;
+@@ -1395,8 +1397,8 @@ unpacker::attr_definitions::defineLayout
+ 
+ unpacker::layout_definition*
+ unpacker::attr_definitions::defineLayout(int idx,
+-                                         const char* name,
+-                                         const char* layout) {
++					 const char* name,
++					 const char* layout) {
+   assert(flag_limit != 0);  // must be set up already
+   if (idx >= 0) {
+     // Fixed attr.
+@@ -1419,12 +1421,12 @@ unpacker::attr_definitions::defineLayout
+   }
+   CHECK_0;
+   layouts.get(idx) = lo;
+-  return lo;
++  return lo; 
+ }
+ 
+ band**
+ unpacker::attr_definitions::buildBands(unpacker::layout_definition* lo) {
+-  int i;
++  int i; 
+   if (lo->elems != null)
+     return lo->bands();
+   if (lo->layout[0] == '\0') {
+@@ -1448,11 +1450,11 @@ unpacker::attr_definitions::buildBands(u
+     int num_callables = 0;
+     if (hasCallables) {
+       while (bands[num_callables] != null) {
+-        if (bands[num_callables]->le_kind != EK_CBLE) {
+-          abort("garbage mixed with callables");
+-          break;
+-        }
+-        num_callables += 1;
++	if (bands[num_callables]->le_kind != EK_CBLE) {
++	  abort("garbage mixed with callables");
++	  break;
++	}
++	num_callables += 1;
+       }
+     }
+     for (i = 0; i < calls_to_link.length(); i++) {
+@@ -1461,8 +1463,8 @@ unpacker::attr_definitions::buildBands(u
+       // Determine the callee.
+       int call_num = call.le_len;
+       if (call_num < 0 || call_num >= num_callables) {
+-        abort("bad call in layout");
+-        break;
++	abort("bad call in layout");
++	break;
+       }
+       band& cble = *bands[call_num];
+       // Link the call to it.
+@@ -1540,7 +1542,7 @@ unpacker::attr_definitions::buildBands(u
+ 
+ const char*
+ unpacker::attr_definitions::parseIntLayout(const char* lp, band* &res,
+-                                           byte le_kind, bool can_be_signed) {
++					   byte le_kind, bool can_be_signed) {
+   const char* lp0 = lp;
+   band* b = U_NEW(band, 1);
+   CHECK_(lp);
+@@ -1619,7 +1621,7 @@ unpacker::attr_definitions::popBody(int 
+ 
+ const char*
+ unpacker::attr_definitions::parseLayout(const char* lp, band** &res,
+-                                        int curCble) {
++					int curCble) {
+   const char* lp0 = lp;
+   int bs_base = band_stack.length();
+   bool top_level = (bs_base == 0);
+@@ -1636,18 +1638,18 @@ unpacker::attr_definitions::parseLayout(
+       break;
+     case 'P':
+       {
+-        int le_bci = EK_BCI;
+-        if (*lp == 'O') {
+-          ++lp;
+-          le_bci = EK_BCID;
+-        }
+-        assert(*lp != 'S');  // no PSH, etc.
+-        lp = parseIntLayout(lp, b, EK_INT);
+-        b->le_bci = le_bci;
+-        if (le_bci == EK_BCI)
+-          b->defc = coding::findBySpec(BCI5_spec);
+-        else
+-          b->defc = coding::findBySpec(BRANCH5_spec);
++	int le_bci = EK_BCI;
++	if (*lp == 'O') {
++	  ++lp;
++	  le_bci = EK_BCID;
++	}
++	assert(*lp != 'S');  // no PSH, etc.
++	lp = parseIntLayout(lp, b, EK_INT);
++	b->le_bci = le_bci;
++	if (le_bci == EK_BCI)
++	  b->defc = coding::findBySpec(BCI5_spec);
++	else
++	  b->defc = coding::findBySpec(BRANCH5_spec);
+       }
+       break;
+     case 'O':
+@@ -1665,25 +1667,25 @@ unpacker::attr_definitions::parseLayout(
+     case 'T': // union: 'T' any_int union_case* '(' ')' '[' body ']'
+       lp = parseIntLayout(lp, b, EK_UN, can_be_signed);
+       {
+-        int union_base = band_stack.length();
+-        for (;;) {   // for each case
+-          band& k_case = *U_NEW(band, 1);
+-          CHECK_(lp);
+-          band_stack.add(&k_case);
+-          k_case.le_kind = EK_CASE;
+-          k_case.bn = bands_made++;
+-          if (*lp++ != '(') {
+-            abort("bad union case");
+-            return "";
+-          }
+-          if (*lp++ != ')') {
+-            --lp;  // reparse
+-            // Read some case values.  (Use band_stack for temp. storage.)
+-            int case_base = band_stack.length();
+-            for (;;) {
+-              int caseval = 0;
+-              lp = parseNumeral(lp, caseval);
+-              band_stack.add((void*)caseval);
++	int union_base = band_stack.length();
++	for (;;) {   // for each case
++	  band& k_case = *U_NEW(band, 1);
++	  CHECK_(lp);
++	  band_stack.add(&k_case);
++	  k_case.le_kind = EK_CASE;
++	  k_case.bn = bands_made++;
++	  if (*lp++ != '(') {
++	    abort("bad union case");
++            return ""; 
++	  }
++	  if (*lp++ != ')') {
++	    --lp;  // reparse
++	    // Read some case values.  (Use band_stack for temp. storage.)
++	    int case_base = band_stack.length();
++	    for (;;) {
++	      int caseval = 0;
++	      lp = parseNumeral(lp, caseval);
++	      band_stack.add((void*)caseval);
+               if (*lp == '-') {
+                 // new in version 160, allow (1-5) for (1,2,3,4,5)
+                 if (u->majver < JAVA6_PACKAGE_MAJOR_VERSION) {
+@@ -1706,111 +1708,111 @@ unpacker::attr_definitions::parseLayout(
+                   if (caseval == caselimit)  break;
+                 }
+               }
+-              if (*lp != ',')  break;
+-              lp++;
+-            }
+-            if (*lp++ != ')') {
+-              abort("bad case label");
+-              return "";
+-            }
+-            // save away the case labels
+-            int ntags = band_stack.length() - case_base;
+-            int* tags = U_NEW(int, add_size(ntags, 1));
+-            CHECK_(lp);
+-            k_case.le_casetags = tags;
+-            *tags++ = ntags;
+-            for (int i = 0; i < ntags; i++) {
+-              *tags++ = ptrlowbits(band_stack.get(case_base+i));
+-            }
+-            band_stack.popTo(case_base);
+-            CHECK_(lp);
+-          }
+-          // Got le_casetags.  Now grab the body.
+-          assert(*lp == '[');
+-          ++lp;
+-          lp = parseLayout(lp, k_case.le_body, curCble);
+-          CHECK_(lp);
+-          if (k_case.le_casetags == null)  break;  // done
+-        }
+-        b->le_body = popBody(union_base);
++	      if (*lp != ',')  break;
++	      lp++;
++	    }
++	    if (*lp++ != ')') {
++	      abort("bad case label");
++              return ""; 
++	    }
++	    // save away the case labels
++	    int ntags = band_stack.length() - case_base;
++	    int* tags = U_NEW(int, add_size(ntags, 1));
++	    CHECK_(lp);
++	    k_case.le_casetags = tags;
++	    *tags++ = ntags;
++	    for (int i = 0; i < ntags; i++) {
++	      *tags++ = ptrlowbits(band_stack.get(case_base+i));
++	    }
++	    band_stack.popTo(case_base);
++	    CHECK_(lp);
++	  }
++	  // Got le_casetags.  Now grab the body.
++	  assert(*lp == '[');
++	  ++lp;
++	  lp = parseLayout(lp, k_case.le_body, curCble);
++	  CHECK_(lp);
++	  if (k_case.le_casetags == null)  break;  // done
++	}
++	b->le_body = popBody(union_base);
+       }
+       break;
+     case '(': // call: '(' -?NN* ')'
+       {
+-        band& call = *U_NEW(band, 1);
+-        CHECK_(lp);
+-        band_stack.add(&call);
+-        call.le_kind = EK_CALL;
+-        call.bn = bands_made++;
+-        call.le_body = U_NEW(band*, 2); // fill in later
+-        int call_num = 0;
+-        lp = parseNumeral(lp, call_num);
+-        call.le_back = (call_num <= 0);
+-        call_num += curCble;  // numeral is self-relative offset
+-        call.le_len = call_num;  //use le_len as scratch
+-        calls_to_link.add(&call);
+-        CHECK_(lp);
+-        if (*lp++ != ')') {
+-          abort("bad call label");
+-          return "";
++	band& call = *U_NEW(band, 1);
++	CHECK_(lp);
++	band_stack.add(&call);
++	call.le_kind = EK_CALL;
++	call.bn = bands_made++;
++	call.le_body = U_NEW(band*, 2); // fill in later
++	int call_num = 0;
++	lp = parseNumeral(lp, call_num);
++	call.le_back = (call_num <= 0);
++	call_num += curCble;  // numeral is self-relative offset
++	call.le_len = call_num;  //use le_len as scratch
++	calls_to_link.add(&call);
++	CHECK_(lp);
++	if (*lp++ != ')') {
++	  abort("bad call label");
++          return ""; 
+         }
+       }
+       break;
+     case 'K': // reference_type: constant_ref
+     case 'R': // reference_type: schema_ref
+       {
+-        int ixTag = CONSTANT_None;
+-        if (lp[-1] == 'K') {
+-          switch (*lp++) {
+-          case 'I': ixTag = CONSTANT_Integer; break;
+-          case 'J': ixTag = CONSTANT_Long; break;
+-          case 'F': ixTag = CONSTANT_Float; break;
+-          case 'D': ixTag = CONSTANT_Double; break;
+-          case 'S': ixTag = CONSTANT_String; break;
+-          case 'Q': ixTag = CONSTANT_Literal; break;
+-          }
+-        } else {
+-          switch (*lp++) {
+-          case 'C': ixTag = CONSTANT_Class; break;
+-          case 'S': ixTag = CONSTANT_Signature; break;
+-          case 'D': ixTag = CONSTANT_NameandType; break;
+-          case 'F': ixTag = CONSTANT_Fieldref; break;
+-          case 'M': ixTag = CONSTANT_Methodref; break;
+-          case 'I': ixTag = CONSTANT_InterfaceMethodref; break;
+-          case 'U': ixTag = CONSTANT_Utf8; break; //utf8_ref
+-          case 'Q': ixTag = CONSTANT_All; break; //untyped_ref
+-          }
+-        }
+-        if (ixTag == CONSTANT_None) {
+-          abort("bad reference layout");
+-          break;
+-        }
+-        bool nullOK = false;
+-        if (*lp == 'N') {
+-          nullOK = true;
+-          lp++;
+-        }
+-        lp = parseIntLayout(lp, b, EK_REF);
+-        b->defc = coding::findBySpec(UNSIGNED5_spec);
+-        b->initRef(ixTag, nullOK);
++	int ixTag = CONSTANT_None;
++	if (lp[-1] == 'K') {
++	  switch (*lp++) {
++	  case 'I': ixTag = CONSTANT_Integer; break;
++	  case 'J': ixTag = CONSTANT_Long; break;
++	  case 'F': ixTag = CONSTANT_Float; break;
++	  case 'D': ixTag = CONSTANT_Double; break;
++	  case 'S': ixTag = CONSTANT_String; break;
++	  case 'Q': ixTag = CONSTANT_Literal; break;
++	  }
++	} else {
++	  switch (*lp++) {
++	  case 'C': ixTag = CONSTANT_Class; break;
++	  case 'S': ixTag = CONSTANT_Signature; break;
++	  case 'D': ixTag = CONSTANT_NameandType; break;
++	  case 'F': ixTag = CONSTANT_Fieldref; break;
++	  case 'M': ixTag = CONSTANT_Methodref; break;
++	  case 'I': ixTag = CONSTANT_InterfaceMethodref; break;
++	  case 'U': ixTag = CONSTANT_Utf8; break; //utf8_ref
++	  case 'Q': ixTag = CONSTANT_All; break; //untyped_ref
++	  }
++	}
++	if (ixTag == CONSTANT_None) {
++	  abort("bad reference layout");
++	  break;
++	}
++	bool nullOK = false;
++	if (*lp == 'N') {
++	  nullOK = true;
++	  lp++;
++	}
++	lp = parseIntLayout(lp, b, EK_REF);
++	b->defc = coding::findBySpec(UNSIGNED5_spec);
++	b->initRef(ixTag, nullOK);
+       }
+       break;
+     case '[':
+       {
+-        // [callable1][callable2]...
+-        if (!top_level) {
+-          abort("bad nested callable");
+-          break;
+-        }
+-        curCble += 1;
+-        NOT_PRODUCT(int call_num = band_stack.length() - bs_base);
+-        band& cble = *U_NEW(band, 1);
+-        CHECK_(lp);
+-        band_stack.add(&cble);
+-        cble.le_kind = EK_CBLE;
+-        NOT_PRODUCT(cble.le_len = call_num);
+-        cble.bn = bands_made++;
+-        lp = parseLayout(lp, cble.le_body, curCble);
++	// [callable1][callable2]...
++	if (!top_level) {
++	  abort("bad nested callable");
++	  break;
++	}
++	curCble += 1;
++	NOT_PRODUCT(int call_num = band_stack.length() - bs_base);
++	band& cble = *U_NEW(band, 1);
++	CHECK_(lp);
++	band_stack.add(&cble);
++	cble.le_kind = EK_CBLE;
++	NOT_PRODUCT(cble.le_len = call_num);
++	cble.bn = bands_made++;
++	lp = parseLayout(lp, cble.le_body, curCble);
+       }
+       break;
+     case ']':
+@@ -1880,10 +1882,10 @@ void unpacker::read_attr_defs() {
+       "(115)[RUH]"
+       "(91)[NH[(0)]]"
+       "(64)["
+-        // nested annotation:
+-        "RSH"
+-        "NH[RUH(0)]"
+-        "]"
++	// nested annotation:
++	"RSH"
++	"NH[RUH(0)]"
++	"]"
+       "()[]"
+     "]"
+     );
+@@ -1897,16 +1899,16 @@ void unpacker::read_attr_defs() {
+   for (i = 0; i < ATTR_CONTEXT_LIMIT; i++) {
+     attr_definitions& ad = attr_defs[i];
+     ad.defineLayout(X_ATTR_RuntimeVisibleAnnotations,
+-                    "RuntimeVisibleAnnotations", md_layout_A);
++		    "RuntimeVisibleAnnotations", md_layout_A);
+     ad.defineLayout(X_ATTR_RuntimeInvisibleAnnotations,
+-                    "RuntimeInvisibleAnnotations", md_layout_A);
++		    "RuntimeInvisibleAnnotations", md_layout_A);
+     if (i != ATTR_CONTEXT_METHOD)  continue;
+     ad.defineLayout(METHOD_ATTR_RuntimeVisibleParameterAnnotations,
+-                    "RuntimeVisibleParameterAnnotations", md_layout_P);
++		    "RuntimeVisibleParameterAnnotations", md_layout_P);
+     ad.defineLayout(METHOD_ATTR_RuntimeInvisibleParameterAnnotations,
+-                    "RuntimeInvisibleParameterAnnotations", md_layout_P);
++		    "RuntimeInvisibleParameterAnnotations", md_layout_P);
+     ad.defineLayout(METHOD_ATTR_AnnotationDefault,
+-                    "AnnotationDefault", md_layout_V);
++		    "AnnotationDefault", md_layout_V);
+   }
+ 
+   attr_definition_headers.readData(attr_definition_count);
+@@ -1939,6 +1941,7 @@ void unpacker::read_attr_defs() {
+     int    attrc   = ADH_BYTE_CONTEXT(header);
+     int    idx     = ADH_BYTE_INDEX(header);
+     entry* name    = attr_definition_name.getRef();
++    CHECK;
+     entry* layout  = attr_definition_layout.getRef();
+     CHECK;
+     attr_defs[attrc].defineLayout(idx, name, layout->value.b.strval());
+@@ -2043,7 +2046,9 @@ void unpacker::read_ics() {
+     if (ics[i].name == NO_ENTRY_YET) {
+       // Long form.
+       ics[i].outer = ic_outer_class.getRefN();
++      CHECK;
+       ics[i].name  = ic_name.getRefN();
++      CHECK;
+     } else {
+       // Fill in outer and name based on inner.
+       bytes& n = ics[i].inner->value.b;
+@@ -2058,48 +2063,48 @@ void unpacker::read_ics() {
+       int pkglen = lastIndexOf(SLASH_MIN,  SLASH_MAX,  n, nlen) + 1;
+       dollar2    = lastIndexOf(DOLLAR_MIN, DOLLAR_MAX, n, nlen);
+       if (dollar2 < 0) {
+-         abort();
+-         return;
++	 abort();
++	 return;
+       }
+       assert(dollar2 >= pkglen);
+       if (isDigitString(n, dollar2+1, nlen)) {
+-        // n = (<pkg>/)*<outer>$<number>
+-        number = n.slice(dollar2+1, nlen);
+-        name.set(null,0);
+-        dollar1 = dollar2;
++	// n = (<pkg>/)*<outer>$<number>
++	number = n.slice(dollar2+1, nlen);
++	name.set(null,0);
++	dollar1 = dollar2;
+       } else if (pkglen < (dollar1
+-                           = lastIndexOf(DOLLAR_MIN, DOLLAR_MAX, n, dollar2-1))
+-                 && isDigitString(n, dollar1+1, dollar2)) {
+-        // n = (<pkg>/)*<outer>$<number>$<name>
+-        number = n.slice(dollar1+1, dollar2);
+-        name = n.slice(dollar2+1, nlen);
++			   = lastIndexOf(DOLLAR_MIN, DOLLAR_MAX, n, dollar2-1))
++		 && isDigitString(n, dollar1+1, dollar2)) {
++	// n = (<pkg>/)*<outer>$<number>$<name>
++	number = n.slice(dollar1+1, dollar2);
++	name = n.slice(dollar2+1, nlen);
+       } else {
+-        // n = (<pkg>/)*<outer>$<name>
+-        dollar1 = dollar2;
+-        number.set(null,0);
+-        name = n.slice(dollar2+1, nlen);
++	// n = (<pkg>/)*<outer>$<name>
++	dollar1 = dollar2;
++	number.set(null,0);
++	name = n.slice(dollar2+1, nlen);
+       }
+       if (number.ptr == null)
+-        pkgOuter = n.slice(0, dollar1);
++	pkgOuter = n.slice(0, dollar1);
+       else
+-        pkgOuter.set(null,0);
++	pkgOuter.set(null,0);
+       printcr(5,"=> %s$ 0%s $%s",
+-              pkgOuter.string(), number.string(), name.string());
++	      pkgOuter.string(), number.string(), name.string());
+ 
+       if (pkgOuter.ptr != null)
+-        ics[i].outer = cp.ensureClass(pkgOuter);
++	ics[i].outer = cp.ensureClass(pkgOuter);
+ 
+       if (name.ptr != null)
+-        ics[i].name = cp.ensureUtf8(name);
++	ics[i].name = cp.ensureUtf8(name);
+     }
+ 
+     // update child/sibling list
+     if (ics[i].outer != null) {
+       uint outord = ics[i].outer->inord;
+       if (outord != NO_INORD) {
+-        assert(outord < cp.tag_count[CONSTANT_Class]);
+-        ics[i].next_sibling = ic_child_index[outord];
+-        ic_child_index[outord] = &ics[i];
++	assert(outord < cp.tag_count[CONSTANT_Class]);
++	ics[i].next_sibling = ic_child_index[outord];
++	ic_child_index[outord] = &ics[i];
+       }
+     }
+   }
+@@ -2149,7 +2154,7 @@ void unpacker::read_classes() {
+   read_code_headers();
+ 
+   printcr(1,"scanned %d classes, %d fields, %d methods, %d code headers",
+-          class_count, field_count, method_count, code_count);
++	  class_count, field_count, method_count, code_count);
+ }
+ 
+ maybe_inline
+@@ -2226,11 +2231,11 @@ void unpacker::read_attrs(int attrc, int
+       band** bands = ad.buildBands(lo);
+       CHECK;
+       if (lo->hasCallables()) {
+-        for (i = 0; bands[i] != null; i++) {
+-          if (bands[i]->le_back) {
+-            assert(bands[i]->le_kind == EK_CBLE);
+-            backwardCounts += 1;
+-          }
++	for (i = 0; bands[i] != null; i++) {
++	  if (bands[i]->le_back) {
++	    assert(bands[i]->le_kind == EK_CBLE);
++	    backwardCounts += 1;
++	  }
+         }
+       }
+     }
+@@ -2427,7 +2432,7 @@ void unpacker::attr_definitions::readBan
+   layout_definition* lo = getLayout(idx);
+   if (lo != null) {
+     printcr(1, "counted %d [redefined = %d predefined = %d] attributes of type %s.%s",
+-            count, isRedefined(idx), isPredefined(idx),
++	    count, isRedefined(idx), isPredefined(idx), 
+             ATTR_CONTEXT_NAME[attrc], lo->name);
+   }
+   bool hasCallables = lo->hasCallables();
+@@ -2444,10 +2449,10 @@ void unpacker::attr_definitions::readBan
+       band& j_cble = *bands[j];
+       assert(j_cble.le_kind == EK_CBLE);
+       if (j_cble.le_back) {
+-        // Add in the predicted effects of backward calls, too.
+-        int back_calls = xxx_attr_calls().getInt();
+-        j_cble.expectMoreLength(back_calls);
+-        // In a moment, more forward calls may increment j_cble.length.
++	// Add in the predicted effects of backward calls, too.
++	int back_calls = xxx_attr_calls().getInt();
++	j_cble.expectMoreLength(back_calls);
++	// In a moment, more forward calls may increment j_cble.length.
+       }
+     }
+     // Now consult whichever callables have non-zero entry counts.
+@@ -2467,38 +2472,38 @@ void unpacker::attr_definitions::readBan
+     switch (b.le_kind) {
+     case EK_REPL:
+       {
+-        int reps = b.getIntTotal();
+-        readBandData(b.le_body, reps);
++	int reps = b.getIntTotal();
++	readBandData(b.le_body, reps);
+       }
+       break;
+     case EK_UN:
+       {
+-        int remaining = count;
+-        for (k = 0; b.le_body[k] != null; k++) {
+-          band& k_case = *b.le_body[k];
+-          int   k_count = 0;
+-          if (k_case.le_casetags == null) {
+-            k_count = remaining;  // last (empty) case
+-          } else {
+-            int* tags = k_case.le_casetags;
+-            int ntags = *tags++;  // 1st element is length (why not?)
+-            while (ntags-- > 0) {
+-              int tag = *tags++;
+-              k_count += b.getIntCount(tag);
+-            }
+-          }
+-          readBandData(k_case.le_body, k_count);
+-          remaining -= k_count;
+-        }
+-        assert(remaining == 0);
++	int remaining = count;
++	for (k = 0; b.le_body[k] != null; k++) {
++	  band& k_case = *b.le_body[k];
++	  int   k_count = 0;
++	  if (k_case.le_casetags == null) {
++	    k_count = remaining;  // last (empty) case
++	  } else {
++	    int* tags = k_case.le_casetags;
++	    int ntags = *tags++;  // 1st element is length (why not?)
++	    while (ntags-- > 0) {
++	      int tag = *tags++;
++	      k_count += b.getIntCount(tag);
++	    }
++	  }
++	  readBandData(k_case.le_body, k_count);
++	  remaining -= k_count;
++	}
++	assert(remaining == 0);
+       }
+       break;
+     case EK_CALL:
+       // Push the count forward, if it is not a backward call.
+       if (!b.le_back) {
+-        band& cble = *b.le_body[0];
+-        assert(cble.le_kind == EK_CBLE);
+-        cble.expectMoreLength(count);
++	band& cble = *b.le_body[0];
++	assert(cble.le_kind == EK_CBLE);
++	cble.expectMoreLength(count);
+       }
+       break;
+     case EK_CBLE:
+@@ -2522,12 +2527,12 @@ band** findMatchingCase(int matchTag, ba
+       int* tags = k_case.le_casetags;
+       int ntags = *tags++;  // 1st element is length
+       for (; ntags > 0; ntags--) {
+-        int tag = *tags++;
+-        if (tag == matchTag)
+-          break;
++	int tag = *tags++;
++	if (tag == matchTag)
++	  break;
+       }
+       if (ntags == 0)
+-        continue;   // does not match
++	continue;   // does not match
+     }
+     return k_case.le_body;
+   }
+@@ -2549,46 +2554,47 @@ void unpacker::putlayout(band** body) {
+     if (b.defc != null) {
+       // It has data, so unparse an element.
+       if (b.ixTag != CONSTANT_None) {
+-        assert(le_kind == EK_REF);
+-        if (b.ixTag == CONSTANT_Literal)
+-          e = b.getRefUsing(cp.getKQIndex());
+-        else
+-          e = b.getRefN();
+-        switch (b.le_len) {
+-        case 0: break;
+-        case 1: putu1ref(e); break;
+-        case 2: putref(e); break;
+-        case 4: putu2(0); putref(e); break;
+-        default: assert(false);
+-        }
++	assert(le_kind == EK_REF);
++	if (b.ixTag == CONSTANT_Literal)
++	  e = b.getRefUsing(cp.getKQIndex());
++	else
++	  e = b.getRefN();
++	CHECK;  
++	switch (b.le_len) {
++	case 0: break;
++	case 1: putu1ref(e); break;
++	case 2: putref(e); break;
++	case 4: putu2(0); putref(e); break;
++	default: assert(false);
++	}
+       } else {
+-        assert(le_kind == EK_INT || le_kind == EK_REPL || le_kind == EK_UN);
+-        x = b.getInt();
+-
+-        assert(!b.le_bci || prevBCI == to_bci(prevBII));
+-        switch (b.le_bci) {
+-        case EK_BCI:   // PH:  transmit R(bci), store bci
+-          x = to_bci(prevBII = x);
+-          prevBCI = x;
+-          break;
+-        case EK_BCID:  // POH: transmit D(R(bci)), store bci
+-          x = to_bci(prevBII += x);
+-          prevBCI = x;
+-          break;
+-        case EK_BCO:   // OH:  transmit D(R(bci)), store D(bci)
+-          x = to_bci(prevBII += x) - prevBCI;
+-          prevBCI += x;
+-          break;
+-        }
+-        assert(!b.le_bci || prevBCI == to_bci(prevBII));
+-
+-        switch (b.le_len) {
+-        case 0: break;
+-        case 1: putu1(x); break;
+-        case 2: putu2(x); break;
+-        case 4: putu4(x); break;
+-        default: assert(false);
+-        }
++	assert(le_kind == EK_INT || le_kind == EK_REPL || le_kind == EK_UN);
++	x = b.getInt();
++
++	assert(!b.le_bci || prevBCI == to_bci(prevBII));
++	switch (b.le_bci) {
++	case EK_BCI:   // PH:  transmit R(bci), store bci
++	  x = to_bci(prevBII = x);
++	  prevBCI = x;
++	  break;
++	case EK_BCID:  // POH: transmit D(R(bci)), store bci
++	  x = to_bci(prevBII += x);
++	  prevBCI = x;
++	  break;
++	case EK_BCO:   // OH:  transmit D(R(bci)), store D(bci)
++	  x = to_bci(prevBII += x) - prevBCI;
++	  prevBCI += x;
++	  break;
++	}
++	assert(!b.le_bci || prevBCI == to_bci(prevBII));
++
++	switch (b.le_len) {
++	case 0: break;
++	case 1: putu1(x); break;
++	case 2: putu2(x); break;
++	case 4: putu4(x); break;
++	default: assert(false);
++	}
+       }
+     }
+ 
+@@ -2597,7 +2603,7 @@ void unpacker::putlayout(band** body) {
+     case EK_REPL:
+       // x is the repeat count
+       while (x-- > 0) {
+-        putlayout(b.le_body);
++	putlayout(b.le_body);
+       }
+       break;
+     case EK_UN:
+@@ -2606,10 +2612,10 @@ void unpacker::putlayout(band** body) {
+       break;
+     case EK_CALL:
+       {
+-        band& cble = *b.le_body[0];
+-        assert(cble.le_kind == EK_CBLE);
+-        assert(cble.le_len == b.le_len);
+-        putlayout(cble.le_body);
++	band& cble = *b.le_body[0];
++	assert(cble.le_kind == EK_CBLE);
++	assert(cble.le_len == b.le_len);
++	putlayout(cble.le_body);
+       }
+       break;
+ 
+@@ -2635,7 +2641,7 @@ void unpacker::read_files() {
+     // FO_IS_CLASS_STUB might be set, causing overlap between classes and files
+     for (int i = 0; i < file_count; i++) {
+       if ((file_options.getInt() & FO_IS_CLASS_STUB) != 0) {
+-        allFiles -= 1;  // this one counts as both class and file
++	allFiles -= 1;  // this one counts as both class and file
+       }
+     }
+     file_options.rewind();
+@@ -2646,9 +2652,9 @@ void unpacker::read_files() {
+ 
+ maybe_inline
+ void unpacker::get_code_header(int& max_stack,
+-                               int& max_na_locals,
+-                               int& handler_count,
+-                               int& cflags) {
++			       int& max_na_locals,
++			       int& handler_count,
++			       int& cflags) {
+   int sc = code_headers.getByte();
+   if (sc == 0) {
+     max_stack = max_na_locals = handler_count = cflags = -1;
+@@ -2801,7 +2807,7 @@ inline  // called exactly once => inline
+ inline  // called exactly once => inline
+ void unpacker::read_bcs() {
+   printcr(3, "reading compressed bytecodes and operands for %d codes...",
+-          code_count);
++	  code_count);
+ 
+   // read from bc_codes and bc_case_count
+   fillbytes all_switch_ops;
+@@ -2822,80 +2828,80 @@ void unpacker::read_bcs() {
+     // Scan one method:
+     for (;;) {
+       if (opptr+2 > oplimit) {
+-        rp = opptr;
+-        ensure_input(2);
+-        oplimit = rplimit;
+-        rp = rp0;  // back up
++	rp = opptr;
++	ensure_input(2);
++	oplimit = rplimit;
++	rp = rp0;  // back up
+       }
+       if (opptr == oplimit) { abort(); break; }
+       int bc = *opptr++ & 0xFF;
+       bool isWide = false;
+       if (bc == bc_wide) {
+-        if (opptr == oplimit) { abort(); break; }
+-        bc = *opptr++ & 0xFF;
+-        isWide = true;
++	if (opptr == oplimit) { abort(); break; }
++	bc = *opptr++ & 0xFF;
++	isWide = true;
+       }
+       // Adjust expectations of various band sizes.
+       switch (bc) {
+       case bc_tableswitch:
+       case bc_lookupswitch:
+-        all_switch_ops.addByte(bc);
+-        break;
++	all_switch_ops.addByte(bc);
++	break;
+       case bc_iinc:
+-        bc_local.expectMoreLength(1);
+-        bc_which = isWide ? &bc_short : &bc_byte;
+-        bc_which->expectMoreLength(1);
+-        break;
++	bc_local.expectMoreLength(1);
++	bc_which = isWide ? &bc_short : &bc_byte;
++	bc_which->expectMoreLength(1);
++	break;
+       case bc_sipush:
+-        bc_short.expectMoreLength(1);
+-        break;
++	bc_short.expectMoreLength(1);
++	break;
+       case bc_bipush:
+-        bc_byte.expectMoreLength(1);
+-        break;
++	bc_byte.expectMoreLength(1);
++	break;
+       case bc_newarray:
+-        bc_byte.expectMoreLength(1);
+-        break;
++	bc_byte.expectMoreLength(1);
++	break;
+       case bc_multianewarray:
+-        assert(ref_band_for_op(bc) == &bc_classref);
+-        bc_classref.expectMoreLength(1);
+-        bc_byte.expectMoreLength(1);
+-        break;
++	assert(ref_band_for_op(bc) == &bc_classref);
++	bc_classref.expectMoreLength(1);
++	bc_byte.expectMoreLength(1);
++	break;
+       case bc_ref_escape:
+-        bc_escrefsize.expectMoreLength(1);
+-        bc_escref.expectMoreLength(1);
+-        break;
++	bc_escrefsize.expectMoreLength(1);
++	bc_escref.expectMoreLength(1);
++	break;
+       case bc_byte_escape:
+-        bc_escsize.expectMoreLength(1);
+-        // bc_escbyte will have to be counted too
+-        break;
++	bc_escsize.expectMoreLength(1);
++	// bc_escbyte will have to be counted too
++	break;
+       default:
+-        if (is_invoke_init_op(bc)) {
+-          bc_initref.expectMoreLength(1);
+-          break;
+-        }
+-        bc_which = ref_band_for_self_op(bc, isAload, junkBC);
+-        if (bc_which != null) {
+-          bc_which->expectMoreLength(1);
+-          break;
+-        }
+-        if (is_branch_op(bc)) {
+-          bc_label.expectMoreLength(1);
+-          break;
+-        }
+-        bc_which = ref_band_for_op(bc);
+-        if (bc_which != null) {
+-          bc_which->expectMoreLength(1);
+-          assert(bc != bc_multianewarray);  // handled elsewhere
+-          break;
+-        }
+-        if (is_local_slot_op(bc)) {
+-          bc_local.expectMoreLength(1);
+-          break;
+-        }
+-        break;
++	if (is_invoke_init_op(bc)) {
++	  bc_initref.expectMoreLength(1);
++	  break;
++	}
++	bc_which = ref_band_for_self_op(bc, isAload, junkBC);
++	if (bc_which != null) {
++	  bc_which->expectMoreLength(1);
++	  break;
++	}
++	if (is_branch_op(bc)) {
++	  bc_label.expectMoreLength(1);
++	  break;
++	}
++	bc_which = ref_band_for_op(bc);
++	if (bc_which != null) {
++	  bc_which->expectMoreLength(1);
++	  assert(bc != bc_multianewarray);  // handled elsewhere
++	  break;
++	}
++	if (is_local_slot_op(bc)) {
++	  bc_local.expectMoreLength(1);
++	  break;
++	}
++	break;
+       case bc_end_marker:
+-        // Increment k and test against code_count.
+-        goto doneScanningMethod;
++	// Increment k and test against code_count.
++	goto doneScanningMethod;
+       }
+     }
+   doneScanningMethod:{}
+@@ -2929,15 +2935,15 @@ void unpacker::read_bcs() {
+   bc_escbyte.readData(bc_escsize.getIntTotal());
+ 
+   printcr(3, "scanned %d opcode and %d operand bytes for %d codes...",
+-          (int)(bc_codes.size()),
+-          (int)(bc_escsize.maxRP() - bc_case_value.minRP()),
+-          code_count);
++	  (int)(bc_codes.size()),
++	  (int)(bc_escsize.maxRP() - bc_case_value.minRP()),
++	  code_count);
+ }
+ 
+ void unpacker::read_bands() {
+   byte* rp0 = rp;
+   int i;
+-
++  CHECK;
+   read_file_header();
+   CHECK;
+ 
+@@ -3063,8 +3069,8 @@ void cpool::expandSignatures() {
+       int c = form.ptr[j];
+       buf.addByte(c);
+       if (c == 'L') {
+-        entry* cls = e.refs[refnum++];
+-        buf.append(cls->className()->asUtf8());
++	entry* cls = e.refs[refnum++];
++	buf.append(cls->className()->asUtf8());
+       }
+     }
+     assert(refnum == e.nrefs);
+@@ -3099,7 +3105,7 @@ void cpool::expandSignatures() {
+     for (int j = 0; j < e.nrefs; j++) {
+       entry*& e2 = e.refs[j];
+       if (e2 != null && e2->tag == CONSTANT_Signature)
+-        e2 = e2->refs[0];
++	e2 = e2->refs[0];
+     }
+   }
+ }
+@@ -3141,14 +3147,14 @@ void cpool::initMemberIndexes() {
+     int fc = field_counts[i];
+     int mc = method_counts[i];
+     all_indexes[i*2+0].init(fc, field_ix+fbase,
+-                            CONSTANT_Fieldref  + SUBINDEX_BIT);
++			    CONSTANT_Fieldref  + SUBINDEX_BIT);
+     all_indexes[i*2+1].init(mc, method_ix+mbase,
+-                            CONSTANT_Methodref + SUBINDEX_BIT);
++			    CONSTANT_Methodref + SUBINDEX_BIT);
+     // reuse field_counts and member_counts as fill pointers:
+     field_counts[i] = fbase;
+     method_counts[i] = mbase;
+     printcr(3, "class %d fields @%d[%d] methods @%d[%d]",
+-            i, fbase, fc, mbase, mc);
++	    i, fbase, fc, mbase, mc);
+     fbase += fc+1;
+     mbase += mc+1;
+     // (the +1 leaves a space between every subarray)
+@@ -3178,7 +3184,7 @@ void cpool::initMemberIndexes() {
+     cpindex* fix = getFieldIndex(cls);
+     cpindex* mix = getMethodIndex(cls);
+     printcr(2, "field and method index for %s [%d] [%d]",
+-            cls->string(), mix->len, fix->len);
++	    cls->string(), mix->len, fix->len);
+     prevord = -1;
+     for (j = 0, len = fix->len; j < len; j++) {
+       entry* f = fix->get(j);
+@@ -3204,7 +3210,7 @@ void cpool::initMemberIndexes() {
+   }
+   assert(fvisited == nfields);
+   assert(mvisited == nmethods);
+-#endif
++#endif  
+ 
+   // Free intermediate buffers.
+   u->free_temps();
+@@ -3438,8 +3444,8 @@ bool unpacker::set_option(const char* pr
+ bool unpacker::set_option(const char* prop, const char* value) {
+   if (prop == NULL)  return false;
+   if (strcmp(prop, UNPACK_DEFLATE_HINT) == 0) {
+-    deflate_hint_or_zero = ( (value == null || strcmp(value, "keep") == 0)
+-                                ? 0: BOOL_TF(value) ? +1: -1);
++    deflate_hint_or_zero = ( (value == null || strcmp(value, "keep") == 0)  
++				? 0: BOOL_TF(value) ? +1: -1);
+ #ifdef HAVE_STRIP
+   } else if (strcmp(prop, UNPACK_STRIP_COMPILE) == 0) {
+     strip_compile = STR_TF(value);
+@@ -3466,7 +3472,7 @@ bool unpacker::set_option(const char* pr
+     } else {
+       modification_time_or_zero = atoi(value);
+       if (modification_time_or_zero == 0)
+-        modification_time_or_zero = 1;  // make non-zero
++	modification_time_or_zero = 1;  // make non-zero
+     }
+   } else if (strcmp(prop, UNPACK_LOG_FILE) == 0) {
+     log_file = (value == null)? value: saveStr(value);
+@@ -3597,14 +3603,16 @@ void unpacker::dump_options() {
+ 
+ 
+ // Usage: unpack a byte buffer
+-// packptr is a reference to byte buffer containing a
++// packptr is a reference to byte buffer containing a 
+ // packed file and len is the length of the buffer.
+ // If null, the callback is used to fill an internal buffer.
+ void unpacker::start(void* packptr, size_t len) {
++  CHECK;
+   NOT_PRODUCT(debug_u = this);
+   if (packptr != null && len != 0) {
+     inbytes.set((byte*) packptr, len);
+   }
++  CHECK;
+   read_bands();
+ }
+ 
+@@ -3735,6 +3743,7 @@ void unpacker::write_bc_ops() {
+     NOT_PRODUCT(bc_superfield.setIndex(null));
+     NOT_PRODUCT(bc_supermethod.setIndex(null));
+   }
++  CHECK;
+ 
+   for (int curIP = 0; ; curIP++) {
+     int curPC = wpoffset() - codeBase;
+@@ -3760,196 +3769,197 @@ void unpacker::write_bc_ops() {
+     case bc_tableswitch: // apc:  (df, lo, hi, (hi-lo+1)*(label))
+     case bc_lookupswitch: // apc:  (df, nc, nc*(case, label))
+       {
+-        int caseCount = bc_case_count.getInt();
+-        while (((wpoffset() - codeBase) % 4) != 0)  putu1_fast(0);
+-        ensure_put_space(30 + caseCount*8);
+-        put_label(curIP, 4);  //int df = bc_label.getInt();
+-        if (bc == bc_tableswitch) {
+-          int lo = bc_case_value.getInt();
+-          int hi = lo + caseCount-1;
+-          putu4(lo);
+-          putu4(hi);
+-          for (int j = 0; j < caseCount; j++) {
+-            put_label(curIP, 4); //int lVal = bc_label.getInt();
+-            //int cVal = lo + j;
+-          }
+-        } else {
+-          putu4(caseCount);
+-          for (int j = 0; j < caseCount; j++) {
+-            int cVal = bc_case_value.getInt();
+-            putu4(cVal);
+-            put_label(curIP, 4); //int lVal = bc_label.getInt();
+-          }
+-        }
+-        assert(to_bci(curIP) == curPC);
+-        continue;
++	int caseCount = bc_case_count.getInt();
++	while (((wpoffset() - codeBase) % 4) != 0)  putu1_fast(0);
++	ensure_put_space(30 + caseCount*8);
++	put_label(curIP, 4);  //int df = bc_label.getInt();
++	if (bc == bc_tableswitch) {
++	  int lo = bc_case_value.getInt();
++	  int hi = lo + caseCount-1;
++	  putu4(lo);
++	  putu4(hi);
++	  for (int j = 0; j < caseCount; j++) {
++	    put_label(curIP, 4); //int lVal = bc_label.getInt();
++	    //int cVal = lo + j;
++	  }
++	} else {
++	  putu4(caseCount);
++	  for (int j = 0; j < caseCount; j++) {
++	    int cVal = bc_case_value.getInt();
++	    putu4(cVal);
++	    put_label(curIP, 4); //int lVal = bc_label.getInt();
++	  }
++	}
++	assert(to_bci(curIP) == curPC);
++	continue;
+       }
+     case bc_iinc:
+       {
+-        int local = bc_local.getInt();
+-        int delta = (isWide ? bc_short : bc_byte).getInt();
+-        if (isWide) {
+-          putu2(local);
+-          putu2(delta);
+-        } else {
+-          putu1_fast(local);
+-          putu1_fast(delta);
+-        }
+-        continue;
++	int local = bc_local.getInt();
++	int delta = (isWide ? bc_short : bc_byte).getInt();
++	if (isWide) {
++	  putu2(local);
++	  putu2(delta);
++	} else {
++	  putu1_fast(local);
++	  putu1_fast(delta);
++	}
++	continue;
+       }
+     case bc_sipush:
+       {
+-        int val = bc_short.getInt();
+-        putu2(val);
+-        continue;
++	int val = bc_short.getInt();
++	putu2(val);
++	continue;
+       }
+     case bc_bipush:
+     case bc_newarray:
+       {
+-        int val = bc_byte.getByte();
+-        putu1_fast(val);
+-        continue;
++	int val = bc_byte.getByte();
++	putu1_fast(val);
++	continue;
+       }
+     case bc_ref_escape:
+       {
+-        // Note that insnMap has one entry for this.
++	// Note that insnMap has one entry for this.
+         --wp;  // not really part of the code
+-        int size = bc_escrefsize.getInt();
+-        entry* ref = bc_escref.getRefN();
+-        CHECK;
+-        switch (size) {
+-        case 1: putu1ref(ref); break;
+-        case 2: putref(ref);   break;
+-        default: assert(false);
+-        }
+-        continue;
++	int size = bc_escrefsize.getInt();
++	entry* ref = bc_escref.getRefN();
++	CHECK;
++	switch (size) {
++	case 1: putu1ref(ref); break;
++	case 2: putref(ref);   break;
++	default: assert(false);
++	}
++	continue;
+       }
+     case bc_byte_escape:
+       {
+-        // Note that insnMap has one entry for all these bytes.
++	// Note that insnMap has one entry for all these bytes.
+         --wp;  // not really part of the code
+-        int size = bc_escsize.getInt();
+-        ensure_put_space(size);
+-        for (int j = 0; j < size; j++)
+-          putu1_fast(bc_escbyte.getByte());
+-        continue;
++	int size = bc_escsize.getInt();
++	ensure_put_space(size);
++	for (int j = 0; j < size; j++)
++	  putu1_fast(bc_escbyte.getByte());
++	continue;
+       }
+     default:
+       if (is_invoke_init_op(bc)) {
+-        origBC = bc_invokespecial;
+-        entry* classRef;
+-        switch (bc - _invokeinit_op) {
+-        case _invokeinit_self_option:   classRef = thisClass;  break;
+-        case _invokeinit_super_option:  classRef = superClass; break;
+-        default: assert(bc == _invokeinit_op+_invokeinit_new_option);
+-        case _invokeinit_new_option:    classRef = newClass;   break;
+-        }
+-        wp[-1] = origBC;  // overwrite with origBC
+-        int coding = bc_initref.getInt();
+-        // Find the nth overloading of <init> in classRef.
+-        entry*   ref = null;
+-        cpindex* ix = (classRef == null)? null: cp.getMethodIndex(classRef);
+-        for (int j = 0, which_init = 0; ; j++) {
+-          ref = (ix == null)? null: ix->get(j);
+-          if (ref == null)  break;  // oops, bad input
+-          assert(ref->tag == CONSTANT_Methodref);
+-          if (ref->memberDescr()->descrName() == cp.sym[cpool::s_lt_init_gt]) {
+-            if (which_init++ == coding)  break;
+-          }
+-        }
+-        putref(ref);
+-        continue;
++	origBC = bc_invokespecial;
++	entry* classRef;
++	switch (bc - _invokeinit_op) {
++	case _invokeinit_self_option:   classRef = thisClass;  break;
++	case _invokeinit_super_option:  classRef = superClass; break;
++	default: assert(bc == _invokeinit_op+_invokeinit_new_option);
++	case _invokeinit_new_option:    classRef = newClass;   break;
++	}
++	wp[-1] = origBC;  // overwrite with origBC
++	int coding = bc_initref.getInt();
++	// Find the nth overloading of <init> in classRef.
++	entry*   ref = null;
++	cpindex* ix = cp.getMethodIndex(classRef);
++	CHECK;
++	for (int j = 0, which_init = 0; ; j++) {
++	  ref = (ix == null)? null: ix->get(j);
++	  if (ref == null)  break;  // oops, bad input
++	  assert(ref->tag == CONSTANT_Methodref);
++	  if (ref->memberDescr()->descrName() == cp.sym[cpool::s_lt_init_gt]) {
++	    if (which_init++ == coding)  break;
++	  }
++	}
++	putref(ref);
++	continue;
+       }
+       bc_which = ref_band_for_self_op(bc, isAload, origBC);
+       if (bc_which != null) {
+-        if (!isAload) {
+-          wp[-1] = origBC;  // overwrite with origBC
+-        } else {
+-          wp[-1] = bc_aload_0;  // overwrite with _aload_0
+-          // Note: insnMap keeps the _aload_0 separate.
+-          bcimap.add(++curPC);
+-          ++curIP;
+-          putu1_fast(origBC);
+-        }
+-        entry* ref = bc_which->getRef();
+-        CHECK;
+-        putref(ref);
+-        continue;
++	if (!isAload) {
++	  wp[-1] = origBC;  // overwrite with origBC
++	} else {
++	  wp[-1] = bc_aload_0;  // overwrite with _aload_0
++	  // Note: insnMap keeps the _aload_0 separate.
++	  bcimap.add(++curPC);
++	  ++curIP;
++	  putu1_fast(origBC);
++	}
++	entry* ref = bc_which->getRef();
++	CHECK;
++	putref(ref);
++	continue;
+       }
+       if (is_branch_op(bc)) {
+-        //int lVal = bc_label.getInt();
+-        if (bc < bc_goto_w) {
+-          put_label(curIP, 2);  //putu2(lVal & 0xFFFF);
+-        } else {
+-          assert(bc <= bc_jsr_w);
+-          put_label(curIP, 4);  //putu4(lVal);
+-        }
+-        assert(to_bci(curIP) == curPC);
+-        continue;
++	//int lVal = bc_label.getInt();
++	if (bc < bc_goto_w) {
++	  put_label(curIP, 2);  //putu2(lVal & 0xFFFF);
++	} else {
++	  assert(bc <= bc_jsr_w);
++	  put_label(curIP, 4);  //putu4(lVal);
++	}
++	assert(to_bci(curIP) == curPC);
++	continue;
+       }
+       bc_which = ref_band_for_op(bc);
+       if (bc_which != null) {
+-        entry* ref = bc_which->getRefCommon(bc_which->ix, bc_which->nullOK);
+-        CHECK;
+-        if (ref == null && bc_which == &bc_classref) {
+-          // Shorthand for class self-references.
+-          ref = thisClass;
+-        }
+-        origBC = bc;
+-        switch (bc) {
+-        case bc_ildc:
+-        case bc_cldc:
+-        case bc_fldc:
+-        case bc_aldc:
+-          origBC = bc_ldc;
+-          break;
+-        case bc_ildc_w:
+-        case bc_cldc_w:
+-        case bc_fldc_w:
+-        case bc_aldc_w:
+-          origBC = bc_ldc_w;
+-          break;
+-        case bc_lldc2_w:
+-        case bc_dldc2_w:
+-          origBC = bc_ldc2_w;
+-          break;
+-        case bc_new:
+-          newClass = ref;
+-          break;
+-        }
+-        wp[-1] = origBC;  // overwrite with origBC
+-        if (origBC == bc_ldc) {
+-          putu1ref(ref);
+-        } else {
+-          putref(ref);
+-        }
+-        if (origBC == bc_multianewarray) {
+-          // Copy the trailing byte also.
+-          int val = bc_byte.getByte();
+-          putu1_fast(val);
+-        } else if (origBC == bc_invokeinterface) {
+-          int argSize = ref->memberDescr()->descrType()->typeSize();
+-          putu1_fast(1 + argSize);
+-          putu1_fast(0);
+-        }
+-        continue;
++	entry* ref = bc_which->getRefCommon(bc_which->ix, bc_which->nullOK);
++	CHECK;
++	if (ref == null && bc_which == &bc_classref) {
++	  // Shorthand for class self-references.
++	  ref = thisClass;
++	}
++	origBC = bc;
++	switch (bc) {
++	case bc_ildc:
++	case bc_cldc:
++	case bc_fldc:
++	case bc_aldc:
++	  origBC = bc_ldc;
++	  break;
++	case bc_ildc_w:
++	case bc_cldc_w:
++	case bc_fldc_w:
++	case bc_aldc_w:
++	  origBC = bc_ldc_w;
++	  break;
++	case bc_lldc2_w:
++	case bc_dldc2_w:
++	  origBC = bc_ldc2_w;
++	  break;
++	case bc_new:
++	  newClass = ref;
++	  break;
++	}
++	wp[-1] = origBC;  // overwrite with origBC
++	if (origBC == bc_ldc) {
++	  putu1ref(ref);
++	} else {
++	  putref(ref);
++	}
++	if (origBC == bc_multianewarray) {
++	  // Copy the trailing byte also.
++	  int val = bc_byte.getByte();
++	  putu1_fast(val);
++	} else if (origBC == bc_invokeinterface) {
++	  int argSize = ref->memberDescr()->descrType()->typeSize();
++	  putu1_fast(1 + argSize);
++	  putu1_fast(0);
++	}
++	continue;
+       }
+       if (is_local_slot_op(bc)) {
+-        int local = bc_local.getInt();
+-        if (isWide) {
+-          putu2(local);
+-          if (bc == bc_iinc) {
+-            int iVal = bc_short.getInt();
+-            putu2(iVal);
+-          }
+-        } else {
+-          putu1_fast(local);
+-          if (bc == bc_iinc) {
+-            int iVal = bc_byte.getByte();
+-            putu1_fast(iVal);
+-          }
+-        }
+-        continue;
++	int local = bc_local.getInt();
++	if (isWide) {
++	  putu2(local);
++	  if (bc == bc_iinc) {
++	    int iVal = bc_short.getInt();
++	    putu2(iVal);
++	  }
++	} else {
++	  putu1_fast(local);
++	  if (bc == bc_iinc) {
++	    int iVal = bc_byte.getByte();
++	    putu1_fast(iVal);
++	  }
++	}
++	continue;
+       }
+       // Random bytecode.  Just copy it.
+       assert(bc < bc_bytecode_limit);
+@@ -4073,78 +4083,80 @@ int unpacker::write_attrs(int attrc, jul
+       case ADH_BYTE(ATTR_CONTEXT_FIELD,  X_ATTR_OVERFLOW):
+       case ADH_BYTE(ATTR_CONTEXT_METHOD, X_ATTR_OVERFLOW):
+       case ADH_BYTE(ATTR_CONTEXT_CODE,   X_ATTR_OVERFLOW):
+-        // no attribute at all, so back up on this one
+-        wp = wp_at(abase);
+-        continue;
++	// no attribute at all, so back up on this one
++	wp = wp_at(abase);
++	continue;
+ 
+       case ADH_BYTE(ATTR_CONTEXT_CLASS, CLASS_ATTR_ClassFile_version):
+-        cur_class_minver = class_ClassFile_version_minor_H.getInt();
+-        cur_class_majver = class_ClassFile_version_major_H.getInt();
+-        // back up; not a real attribute
+-        wp = wp_at(abase);
+-        continue;
++	cur_class_minver = class_ClassFile_version_minor_H.getInt();
++	cur_class_majver = class_ClassFile_version_major_H.getInt();
++	// back up; not a real attribute
++	wp = wp_at(abase);
++	continue;
+ 
+       case ADH_BYTE(ATTR_CONTEXT_CLASS, CLASS_ATTR_InnerClasses):
+-        // note the existence of this attr, but save for later
+-        if (cur_class_has_local_ics)
+-          abort("too many InnerClasses attrs");
+-        cur_class_has_local_ics = true;
+-        wp = wp_at(abase);
+-        continue;
++	// note the existence of this attr, but save for later
++	if (cur_class_has_local_ics)
++	  abort("too many InnerClasses attrs");
++	cur_class_has_local_ics = true;
++	wp = wp_at(abase);
++	continue;
+ 
+       case ADH_BYTE(ATTR_CONTEXT_CLASS, CLASS_ATTR_SourceFile):
+-        aname = cp.sym[cpool::s_SourceFile];
+-        ref = class_SourceFile_RUN.getRefN();
+-        CHECK_0;
+-        if (ref == null) {
+-          bytes& n = cur_class->ref(0)->value.b;
+-          // parse n = (<pkg>/)*<outer>?($<id>)*
+-          int pkglen = lastIndexOf(SLASH_MIN,  SLASH_MAX,  n, n.len)+1;
+-          bytes prefix = n.slice(pkglen, n.len);
+-          for (;;) {
+-            // Work backwards, finding all '$', '#', etc.
+-            int dollar = lastIndexOf(DOLLAR_MIN, DOLLAR_MAX, prefix, prefix.len);
+-            if (dollar < 0)  break;
+-            prefix = prefix.slice(0, dollar);
+-          }
+-          const char* suffix = ".java";
+-          int len = prefix.len + strlen(suffix);
+-          bytes name; name.set(T_NEW(byte, add_size(len, 1)), len);
+-          name.strcat(prefix).strcat(suffix);
+-          ref = cp.ensureUtf8(name);
+-        }
+-        putref(ref);
+-        break;
++	aname = cp.sym[cpool::s_SourceFile];
++	ref = class_SourceFile_RUN.getRefN();
++	CHECK_0;
++	if (ref == null) {
++	  bytes& n = cur_class->ref(0)->value.b;
++	  // parse n = (<pkg>/)*<outer>?($<id>)*
++	  int pkglen = lastIndexOf(SLASH_MIN,  SLASH_MAX,  n, n.len)+1;
++	  bytes prefix = n.slice(pkglen, n.len);
++	  for (;;) {
++	    // Work backwards, finding all '$', '#', etc.
++	    int dollar = lastIndexOf(DOLLAR_MIN, DOLLAR_MAX, prefix, prefix.len);
++	    if (dollar < 0)  break;
++	    prefix = prefix.slice(0, dollar);
++	  }
++	  const char* suffix = ".java";
++	  int len = prefix.len + strlen(suffix);
++	  bytes name; name.set(T_NEW(byte, add_size(len, 1)), len);
++	  name.strcat(prefix).strcat(suffix);
++	  ref = cp.ensureUtf8(name);
++	}
++	putref(ref);
++	break;
+ 
+       case ADH_BYTE(ATTR_CONTEXT_CLASS, CLASS_ATTR_EnclosingMethod):
+-        aname = cp.sym[cpool::s_EnclosingMethod];
+-        putref(class_EnclosingMethod_RC.getRefN());
+-        putref(class_EnclosingMethod_RDN.getRefN());
+-        break;
++	aname = cp.sym[cpool::s_EnclosingMethod];
++	putref(class_EnclosingMethod_RC.getRefN());
++	CHECK_0;
++	putref(class_EnclosingMethod_RDN.getRefN());
++	break;
+ 
+       case ADH_BYTE(ATTR_CONTEXT_FIELD, FIELD_ATTR_ConstantValue):
+-        aname = cp.sym[cpool::s_ConstantValue];
+-        putref(field_ConstantValue_KQ.getRefUsing(cp.getKQIndex()));
+-        break;
++	aname = cp.sym[cpool::s_ConstantValue];
++	putref(field_ConstantValue_KQ.getRefUsing(cp.getKQIndex()));
++	break;
+ 
+       case ADH_BYTE(ATTR_CONTEXT_METHOD, METHOD_ATTR_Code):
+-        aname = cp.sym[cpool::s_Code];
+-        write_code();
+-        break;
++	aname = cp.sym[cpool::s_Code];
++	write_code();
++	break;
+ 
+       case ADH_BYTE(ATTR_CONTEXT_METHOD, METHOD_ATTR_Exceptions):
+-        aname = cp.sym[cpool::s_Exceptions];
+-        putu2(count = method_Exceptions_N.getInt());
+-        for (j = 0; j < count; j++) {
+-          putref(method_Exceptions_RC.getRefN());
+-        }
+-        break;
++	aname = cp.sym[cpool::s_Exceptions];
++	putu2(count = method_Exceptions_N.getInt());
++	for (j = 0; j < count; j++) {
++	  putref(method_Exceptions_RC.getRefN());
++	  CHECK_0;
++	}
++	break;
+ 
+       case ADH_BYTE(ATTR_CONTEXT_CODE, CODE_ATTR_StackMapTable):
+-        aname = cp.sym[cpool::s_StackMapTable];
++	aname = cp.sym[cpool::s_StackMapTable];
+         // (keep this code aligned with its brother in unpacker::read_attrs)
+-        putu2(count = code_StackMapTable_N.getInt());
+-        for (j = 0; j < count; j++) {
++	putu2(count = code_StackMapTable_N.getInt());
++	for (j = 0; j < count; j++) {
+           int tag = code_StackMapTable_frame_T.getByte();
+           putu1(tag);
+           if (tag <= 127) {
+@@ -4160,109 +4172,115 @@ int unpacker::write_attrs(int attrc, jul
+             // (253)     [(1)(2)(2)]
+             // (254)     [(1)(2)(2)(2)]
+             putu2(code_StackMapTable_offset.getInt());
++            CHECK_0;
+             for (int j2 = (tag - 251); j2 > 0; j2--) {
+               put_stackmap_type();
++              CHECK_0;
+             }
+           } else {
+             // (255)     [(1)NH[(2)]NH[(2)]]
+             putu2(code_StackMapTable_offset.getInt());
+             putu2(j2 = code_StackMapTable_local_N.getInt());
+-            while (j2-- > 0)  put_stackmap_type();
++            while (j2-- > 0) {put_stackmap_type(); CHECK_0;}
+             putu2(j2 = code_StackMapTable_stack_N.getInt());
+-            while (j2-- > 0)  put_stackmap_type();
++            while (j2-- > 0) {put_stackmap_type(); CHECK_0;}
+           }
+-        }
+-        break;
++	}
++	break;
+ 
+       case ADH_BYTE(ATTR_CONTEXT_CODE, CODE_ATTR_LineNumberTable):
+-        aname = cp.sym[cpool::s_LineNumberTable];
+-        putu2(count = code_LineNumberTable_N.getInt());
+-        for (j = 0; j < count; j++) {
+-          putu2(to_bci(code_LineNumberTable_bci_P.getInt()));
+-          putu2(code_LineNumberTable_line.getInt());
+-        }
+-        break;
++	aname = cp.sym[cpool::s_LineNumberTable];
++	putu2(count = code_LineNumberTable_N.getInt());
++	for (j = 0; j < count; j++) {
++	  putu2(to_bci(code_LineNumberTable_bci_P.getInt()));
++	  putu2(code_LineNumberTable_line.getInt());
++	}
++	break;
+ 
+       case ADH_BYTE(ATTR_CONTEXT_CODE, CODE_ATTR_LocalVariableTable):
+-        aname = cp.sym[cpool::s_LocalVariableTable];
+-        putu2(count = code_LocalVariableTable_N.getInt());
+-        for (j = 0; j < count; j++) {
+-          int bii = code_LocalVariableTable_bci_P.getInt();
+-          int bci = to_bci(bii);
+-          putu2(bci);
+-          bii    += code_LocalVariableTable_span_O.getInt();
+-          putu2(to_bci(bii) - bci);
+-          putref(code_LocalVariableTable_name_RU.getRefN());
+-          putref(code_LocalVariableTable_type_RS.getRefN());
+-          putu2(code_LocalVariableTable_slot.getInt());
+-        }
+-        break;
++	aname = cp.sym[cpool::s_LocalVariableTable];
++	putu2(count = code_LocalVariableTable_N.getInt());
++	for (j = 0; j < count; j++) {
++	  int bii = code_LocalVariableTable_bci_P.getInt();
++	  int bci = to_bci(bii);
++	  putu2(bci);
++	  bii    += code_LocalVariableTable_span_O.getInt();
++	  putu2(to_bci(bii) - bci);
++	  putref(code_LocalVariableTable_name_RU.getRefN());
++	  CHECK_0;
++	  putref(code_LocalVariableTable_type_RS.getRefN());
++	  CHECK_0;
++	  putu2(code_LocalVariableTable_slot.getInt());
++	}
++	break;
+ 
+       case ADH_BYTE(ATTR_CONTEXT_CODE, CODE_ATTR_LocalVariableTypeTable):
+-        aname = cp.sym[cpool::s_LocalVariableTypeTable];
+-        putu2(count = code_LocalVariableTypeTable_N.getInt());
+-        for (j = 0; j < count; j++) {
+-          int bii = code_LocalVariableTypeTable_bci_P.getInt();
+-          int bci = to_bci(bii);
+-          putu2(bci);
+-          bii    += code_LocalVariableTypeTable_span_O.getInt();
+-          putu2(to_bci(bii) - bci);
+-          putref(code_LocalVariableTypeTable_name_RU.getRefN());
+-          putref(code_LocalVariableTypeTable_type_RS.getRefN());
+-          putu2(code_LocalVariableTypeTable_slot.getInt());
+-        }
+-        break;
++	aname = cp.sym[cpool::s_LocalVariableTypeTable];
++	putu2(count = code_LocalVariableTypeTable_N.getInt());
++	for (j = 0; j < count; j++) {
++	  int bii = code_LocalVariableTypeTable_bci_P.getInt();
++	  int bci = to_bci(bii);
++	  putu2(bci);
++	  bii    += code_LocalVariableTypeTable_span_O.getInt();
++	  putu2(to_bci(bii) - bci);
++	  putref(code_LocalVariableTypeTable_name_RU.getRefN());
++	  CHECK_0;
++	  putref(code_LocalVariableTypeTable_type_RS.getRefN());
++	  CHECK_0;
++	  putu2(code_LocalVariableTypeTable_slot.getInt());
++	}
++	break;
+ 
+       case ADH_BYTE(ATTR_CONTEXT_CLASS, X_ATTR_Signature):
+-        aname = cp.sym[cpool::s_Signature];
+-        putref(class_Signature_RS.getRefN());
+-        break;
++	aname = cp.sym[cpool::s_Signature];
++	putref(class_Signature_RS.getRefN());
++	break;
+ 
+       case ADH_BYTE(ATTR_CONTEXT_FIELD, X_ATTR_Signature):
+-        aname = cp.sym[cpool::s_Signature];
+-        putref(field_Signature_RS.getRefN());
+-        break;
++	aname = cp.sym[cpool::s_Signature];
++	putref(field_Signature_RS.getRefN());
++	break;
+ 
+       case ADH_BYTE(ATTR_CONTEXT_METHOD, X_ATTR_Signature):
+-        aname = cp.sym[cpool::s_Signature];
+-        putref(method_Signature_RS.getRefN());
+-        break;
++	aname = cp.sym[cpool::s_Signature];
++	putref(method_Signature_RS.getRefN());
++	break;
+ 
+       case ADH_BYTE(ATTR_CONTEXT_CLASS,  X_ATTR_Deprecated):
+       case ADH_BYTE(ATTR_CONTEXT_FIELD,  X_ATTR_Deprecated):
+       case ADH_BYTE(ATTR_CONTEXT_METHOD, X_ATTR_Deprecated):
+-        aname = cp.sym[cpool::s_Deprecated];
+-        // no data
+-        break;
+-      }
+-    }
+-
++	aname = cp.sym[cpool::s_Deprecated];
++	// no data
++	break;
++      }
++    }
++    CHECK_0;
+     if (aname == null) {
+       // Unparse a compressor-defined attribute.
+       layout_definition* lo = ad.getLayout(idx);
+       if (lo == null) {
+-        abort("bad layout index");
+-        break;
++	abort("bad layout index");
++	break;
+       }
+       assert(lo->idx == idx);
+       aname = lo->nameEntry;
+       if (aname == null) {
+-        bytes nameb; nameb.set(lo->name);
+-        aname = cp.ensureUtf8(nameb);
+-        // Cache the name entry for next time.
+-        lo->nameEntry = aname;
++	bytes nameb; nameb.set(lo->name);
++	aname = cp.ensureUtf8(nameb);
++	// Cache the name entry for next time.
++	lo->nameEntry = aname;
+       }
+       // Execute all the layout elements.
+       band** bands = lo->bands();
+       if (lo->hasCallables()) {
+-        band& cble = *bands[0];
+-        assert(cble.le_kind == EK_CBLE);
+-        bands = cble.le_body;
++	band& cble = *bands[0];
++	assert(cble.le_kind == EK_CBLE);
++	bands = cble.le_body;
+       }
+       putlayout(bands);
+     }
+ 
+-    if (aname == null)
++    if (aname == null) 
+       abort("bad attribute index");
+     CHECK_0;
+ 
+@@ -4335,8 +4353,8 @@ void unpacker::write_classfile_tail() {
+   julong indexMask = ad.flagIndexMask();
+ 
+   cur_class = class_this.getRef();
++  CHECK;
+   cur_super = class_super.getRef();
+-
+   CHECK;
+ 
+   if (cur_super == cur_class)  cur_super = null;
+@@ -4349,6 +4367,7 @@ void unpacker::write_classfile_tail() {
+   putu2(num = class_interface_count.getInt());
+   for (i = 0; i < num; i++) {
+     putref(class_interface.getRef());
++    CHECK;
+   }
+ 
+   write_members(class_field_count.getInt(),  ATTR_CONTEXT_FIELD);
+@@ -4389,8 +4408,8 @@ void unpacker::write_classfile_tail() {
+     entry& e = *oes[i];
+     if (e.tag != CONSTANT_Class)  continue;  // wrong sort
+     for (inner_class* ic = cp.getIC(&e);
+-         ic != null;
+-         ic = cp.getIC(ic->outer)) {
++	 ic != null;
++	 ic = cp.getIC(ic->outer)) {
+       if (ic->requested)  break;  // already processed
+       ic->requested = true;
+       requested_ics.add(ic);
+@@ -4421,22 +4440,24 @@ void unpacker::write_classfile_tail() {
+     if (flags == 0) {
+       // The extra IC is simply a copy of a global IC.
+       if (global_ic == null) {
+-        abort("bad reference to inner class");
+-        break;
++	abort("bad reference to inner class");
++	break;
+       }
+       extra_ic = (*global_ic);  // fill in rest of fields
+     } else {
+       flags &= ~ACC_IC_LONG_FORM;  // clear high bit if set to get clean zero
+       extra_ic.flags = flags;
+       extra_ic.outer = class_InnerClasses_outer_RCN.getRefN();
++      CHECK;
+       extra_ic.name  = class_InnerClasses_name_RUN.getRefN();
++      CHECK;
+       // Detect if this is an exact copy of the global tuple.
+       if (global_ic != null) {
+-        if (global_ic->flags != extra_ic.flags ||
+-            global_ic->outer != extra_ic.outer ||
+-            global_ic->name  != extra_ic.name) {
+-          global_ic = null;  // not really the same, so break the link
+-        }
++	if (global_ic->flags != extra_ic.flags ||
++	    global_ic->outer != extra_ic.outer ||
++	    global_ic->name  != extra_ic.name) {
++	  global_ic = null;  // not really the same, so break the link
++	}
+       }
+     }
+     if (global_ic != null && global_ic->requested) {
+@@ -4465,15 +4486,15 @@ void unpacker::write_classfile_tail() {
+     for (i = -num_global_ics; i < num_extra_ics; i++) {
+       inner_class* ic;
+       if (i < 0)
+-        ic = (inner_class*) requested_ics.get(num_global_ics+i);
++	ic = (inner_class*) requested_ics.get(num_global_ics+i);
+       else
+-        ic = &extra_ics[i];
++	ic = &extra_ics[i];
+       if (ic->requested) {
+-        putref(ic->inner);
+-        putref(ic->outer);
+-        putref(ic->name);
+-        putu2(ic->flags);
+-        NOT_PRODUCT(local_ics--);
++	putref(ic->inner);
++	putref(ic->outer);
++	putref(ic->name);
++	putu2(ic->flags);
++	NOT_PRODUCT(local_ics--);
+       }
+     }
+     assert(local_ics == 0);           // must balance
+@@ -4573,7 +4594,7 @@ unpacker::file* unpacker::get_next_file(
+     if (archive_size != 0) {
+       julong predicted_size = unsized_bytes_read + archive_size;
+       if (predicted_size != bytes_read)
+-        abort("archive header had incorrect size");
++	abort("archive header had incorrect size");
+     }
+     return null;
+   }
+@@ -4637,7 +4658,7 @@ unpacker::file* unpacker::get_next_file(
+     size_t rpleft = input_remaining();
+     if (rpleft > 0) {
+       if (rpleft > cur_file.size)
+-        rpleft = (size_t) cur_file.size;
++	rpleft = (size_t) cur_file.size;
+       cur_file.data[0].set(rp, rpleft);
+       rp += rpleft;
+     }
+@@ -4655,7 +4676,7 @@ unpacker::file* unpacker::get_next_file(
+ 
+ // Write a file to jarout.
+ void unpacker::write_file_to_jar(unpacker::file* f) {
+-  size_t htsize = f->data[0].len + f->data[1].len;
++  size_t htsize = f->data[0].len + f->data[1].len; 
+   julong fsize = f->size;
+ #ifndef PRODUCT
+   if (nowrite NOT_PRODUCT(|| skipfiles-- > 0)) {
+@@ -4665,7 +4686,7 @@ void unpacker::write_file_to_jar(unpacke
+ #endif
+   if (htsize == fsize) {
+     jarout->addJarEntry(f->name, f->deflate_hint(), f->modtime,
+-                        f->data[0], f->data[1]);
++			f->data[0], f->data[1]);
+   } else {
+     assert(input_remaining() == 0);
+     bytes part1, part2;
+@@ -4680,27 +4701,27 @@ void unpacker::write_file_to_jar(unpacke
+     if (fleft > 0) {
+       // Must read some more.
+       if (live_input) {
+-        // Stop using the input buffer.  Make a new one:
+-        if (free_input)  input.free();
+-        input.init(fleft > (1<<12) ? fleft : (1<<12));
+-        free_input = true;
+-        live_input = false;
++	// Stop using the input buffer.  Make a new one:
++	if (free_input)  input.free();
++	input.init(fleft > (1<<12) ? fleft : (1<<12));
++	free_input = true;
++	live_input = false;
+       } else {
+-        // Make it large enough.
+-        assert(free_input);  // must be reallocable
+-        input.ensureSize(fleft);
++	// Make it large enough.
++	assert(free_input);  // must be reallocable
++	input.ensureSize(fleft);
+       }
+       rplimit = rp = input.base();
+       CHECK;
+       input.setLimit(rp + fleft);
+       if (!ensure_input(fleft))
+-        abort("EOF reading resource file");
++	abort("EOF reading resource file");
+       part2.ptr = input_scan();
+       part2.len = input_remaining();
+       rplimit = rp = input.base();
+     }
+     jarout->addJarEntry(f->name, f->deflate_hint(), f->modtime,
+-                        part1, part2);
++			part1, part2);
+   }
+   if (verbose >= 3) {
+     fprintf(errstrm, "Wrote %lld bytes to: %s\n", fsize, f->name);
+@@ -4722,7 +4743,7 @@ void unpacker::redirect_stdio() {
+   } else if (strcmp(log_file, LOGFILE_STDOUT) == 0) {
+     errstrm = stdout;
+     return;
+-  } else if (log_file[0] != '\0' && (errstrm = fopen(log_file,"a+")) != NULL) {
++  } else if (log_file[0] != '\0' && (errstrm = fopen(log_file,"a+")) != NULL) { 
+     return;
+   } else {
+     char log_file_name[PATH_MAX+100];
+@@ -4732,7 +4753,7 @@ void unpacker::redirect_stdio() {
+     if (n < 1 || n > PATH_MAX) {
+       sprintf(tmpdir,"C:\\");
+     }
+-    sprintf(log_file_name, "%sunpack.log", tmpdir);
++    sprintf(log_file_name, "%sunpack.log", tmpdir); 
+ #else
+     sprintf(tmpdir,"/tmp");
+     sprintf(log_file_name, "/tmp/unpack.log");
+@@ -4742,7 +4763,7 @@ void unpacker::redirect_stdio() {
+       return ;
+     }
+ 
+-    char *tname = tempnam(tmpdir,"#upkg");
++    char *tname = tempnam(tmpdir,"#upkg");	
+     sprintf(log_file_name, "%s", tname);
+     if ((errstrm = fopen(log_file_name, "a+")) != NULL) {
+       log_file = errstrm_name = saveStr(log_file_name);
+@@ -4758,7 +4779,7 @@ void unpacker::redirect_stdio() {
+ #endif
+     // Last resort
+     // (Do not use stdout, since it might be jarout->jarfp.)
+-    errstrm = stderr;
++    errstrm = stderr;  
+     log_file = errstrm_name = LOGFILE_STDERR;
+   }
+ }
+@@ -4799,3 +4820,5 @@ void unpacker::abort(const char* message
+ #endif
+ #endif // JNI
+ }
++
++

Added: trunk/java/openjdk6/files/icedtea/security/20130201/7186948.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130201/7186948.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130201/7186948.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,20 @@
+# 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) {

Added: trunk/java/openjdk6/files/icedtea/security/20130201/7186952.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130201/7186952.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130201/7186952.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,127 @@
+# 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();
+ 

Added: trunk/java/openjdk6/files/icedtea/security/20130201/7186954.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130201/7186954.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130201/7186954.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,81 @@
+# 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;

Added: trunk/java/openjdk6/files/icedtea/security/20130201/7192392.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130201/7192392.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130201/7192392.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,695 @@
+# 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.
++    }
++}

Added: trunk/java/openjdk6/files/icedtea/security/20130201/7192393.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130201/7192393.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130201/7192393.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,60 @@
+# 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

Added: trunk/java/openjdk6/files/icedtea/security/20130201/7192977.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130201/7192977.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130201/7192977.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,436 @@
+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));
+         }
+     }
+ 

Added: trunk/java/openjdk6/files/icedtea/security/20130201/7197546.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130201/7197546.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130201/7197546.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,479 @@
+# 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";
+ }

Added: trunk/java/openjdk6/files/icedtea/security/20130201/7200491.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130201/7200491.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130201/7200491.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,49 @@
+# 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);

Added: trunk/java/openjdk6/files/icedtea/security/20130201/7200500.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130201/7200500.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130201/7200500.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,60 @@
+# 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);

Added: trunk/java/openjdk6/files/icedtea/security/20130201/7201064.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130201/7201064.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130201/7201064.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,117 @@
+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;
++
+     }
+ 
+     /*

Added: trunk/java/openjdk6/files/icedtea/security/20130201/7201066.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130201/7201066.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130201/7201066.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,66 @@
+# 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.

Added: trunk/java/openjdk6/files/icedtea/security/20130201/7201068.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130201/7201068.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130201/7201068.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,83 @@
+# 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

Added: trunk/java/openjdk6/files/icedtea/security/20130201/7201070.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130201/7201070.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130201/7201070.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,31 @@
+# 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;

Added: trunk/java/openjdk6/files/icedtea/security/20130201/7201071.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130201/7201071.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130201/7201071.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,553 @@
+# 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();
+     }

Added: trunk/java/openjdk6/files/icedtea/security/20130201/8000210.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130201/8000210.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130201/8000210.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,104 @@
+# 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;
+ 

Added: trunk/java/openjdk6/files/icedtea/security/20130201/8000537.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130201/8000537.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130201/8000537.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,334 @@
+# 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 at 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;
+     }
+ 
+ 

Added: trunk/java/openjdk6/files/icedtea/security/20130201/8000540.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130201/8000540.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130201/8000540.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,187 @@
+# 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 ;
+-        }
+     }
+ 
+     /*

Added: trunk/java/openjdk6/files/icedtea/security/20130201/8000631.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130201/8000631.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130201/8000631.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,3964 @@
+# HG changeset patch
+# User coffeys
+# Date 1354992561 0
+# Node ID c5203e9e0e07559914a9c46dbba4fe85df945624
+# Parent  7f904eacf818c104549b94b957f34896a8548d9b
+8000631: Restrict access to class constructor
+Reviewed-by: alanb, ahgross
+
+diff --git a/make/com/sun/corba/minclude/com_sun_corba_se_impl_orbutil.jmk b/make/com/sun/corba/minclude/com_sun_corba_se_impl_orbutil.jmk
+--- corba/make/com/sun/corba/minclude/com_sun_corba_se_impl_orbutil.jmk
++++ corba/make/com/sun/corba/minclude/com_sun_corba_se_impl_orbutil.jmk
+@@ -1,5 +1,5 @@
+ #
+-# Copyright (c) 2000, 2003, 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
+@@ -29,10 +29,6 @@ com_sun_corba_se_impl_orbutil_java = \
+ 	com/sun/corba/se/impl/orbutil/DenseIntMapImpl.java \
+ 	com/sun/corba/se/impl/orbutil/GetPropertyAction.java \
+ 	com/sun/corba/se/impl/orbutil/HexOutputStream.java \
+-	com/sun/corba/se/impl/orbutil/IIOPInputStream_1_3.java \
+-	com/sun/corba/se/impl/orbutil/IIOPInputStream_1_3_1.java \
+-	com/sun/corba/se/impl/orbutil/IIOPOutputStream_1_3.java \
+-	com/sun/corba/se/impl/orbutil/IIOPOutputStream_1_3_1.java \
+ 	com/sun/corba/se/impl/orbutil/LegacyHookGetFields.java \
+ 	com/sun/corba/se/impl/orbutil/LegacyHookPutFields.java \
+ 	com/sun/corba/se/impl/orbutil/LogKeywords.java \
+@@ -45,19 +41,11 @@ com_sun_corba_se_impl_orbutil_java = \
+ 	com/sun/corba/se/impl/orbutil/ORBUtility.java \
+ 	com/sun/corba/se/impl/orbutil/ORBClassLoader.java \
+ 	com/sun/corba/se/impl/orbutil/RepIdDelegator.java \
+-	com/sun/corba/se/impl/orbutil/RepIdDelegator_1_3.java \
+-	com/sun/corba/se/impl/orbutil/RepIdDelegator_1_3_1.java \
+-	com/sun/corba/se/impl/orbutil/RepositoryIdCache_1_3.java \
+-	com/sun/corba/se/impl/orbutil/RepositoryId_1_3.java \
+ 	com/sun/corba/se/impl/orbutil/RepositoryIdFactory.java \
+ 	com/sun/corba/se/impl/orbutil/RepositoryIdStrings.java \
+ 	com/sun/corba/se/impl/orbutil/RepositoryIdUtility.java \
+ 	com/sun/corba/se/impl/orbutil/RepositoryIdInterface.java \
+-	com/sun/corba/se/impl/orbutil/RepositoryIdCache_1_3_1.java \
+-	com/sun/corba/se/impl/orbutil/RepositoryId_1_3_1.java \
+ 	com/sun/corba/se/impl/orbutil/StackImpl.java \
+-	com/sun/corba/se/impl/orbutil/ValueHandlerImpl_1_3_1.java \
+-	com/sun/corba/se/impl/orbutil/ValueHandlerImpl_1_3.java \
+ 	com/sun/corba/se/impl/orbutil/closure/Future.java \
+ 	com/sun/corba/se/impl/orbutil/closure/Constant.java \
+ 	com/sun/corba/se/impl/orbutil/concurrent/Sync.java \
+diff --git a/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java b/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java
+--- corba/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java
++++ corba/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2004, 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
+@@ -1218,7 +1218,7 @@ public class AnyImpl extends Any
+         // See bug 4391648 for more info about the tcORB in this
+         // case.
+         RepositoryIdStrings repStrs
+-            = RepositoryIdFactory.getRepIdStringsFactory(tcORB);
++            = RepositoryIdFactory.getRepIdStringsFactory();
+ 
+ 
+         // Assertion: c instanceof Serializable?
+@@ -1251,7 +1251,7 @@ public class AnyImpl extends Any
+         // Anything else
+         // We know that this is a TypeCodeImpl since it is our ORB
+         classTC = (TypeCodeImpl)ValueUtility.createTypeCodeForClass(
+-            tcORB, c, ORBUtility.createValueHandler(tcORB));
++            tcORB, c, ORBUtility.createValueHandler());
+         // Intruct classTC to store its buffer
+         classTC.setCaching(true);
+         // Update the cache
+diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_0.java b/src/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_0.java
+--- corba/src/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_0.java
++++ corba/src/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_0.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2004, 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
+@@ -269,8 +269,8 @@ public class CDRInputStream_1_0 extends 
+ 
+     private final void createRepositoryIdHandlers()
+     {
+-        repIdUtil = RepositoryIdFactory.getRepIdUtility(orb);
+-        repIdStrs = RepositoryIdFactory.getRepIdStringsFactory(orb);
++        repIdUtil = RepositoryIdFactory.getRepIdUtility();
++        repIdStrs = RepositoryIdFactory.getRepIdStringsFactory();
+     }
+ 
+     public GIOPVersion getGIOPVersion() {
+@@ -564,10 +564,7 @@ public class CDRInputStream_1_0 extends 
+ 
+         checkForNegativeLength(len);
+ 
+-        if (orb != null && ORBUtility.isLegacyORB((ORB)orb))
+-            return legacyReadString(len);
+-        else
+-            return internalReadString(len);
++        return internalReadString(len);
+     }
+ 
+     private final String internalReadString(int len) {
+@@ -586,54 +583,6 @@ public class CDRInputStream_1_0 extends 
+         read_octet();
+ 
+         return new String(result, 0, getCharConverter().getNumChars());
+-    }
+-
+-    private final String legacyReadString(int len) {
+-
+-        //
+-        // Workaround for ORBs which send string lengths of
+-        // zero to mean empty string.
+-        //
+-        //
+-        // IMPORTANT: Do not replace 'new String("")' with "", it may result
+-        // in a Serialization bug (See serialization.zerolengthstring) and
+-        // bug id: 4728756 for details
+-        if (len == 0)
+-            return new String("");
+-
+-        len--;
+-        char[] c = new char[len];
+-
+-        int n = 0;
+-        while (n < len) {
+-            int avail;
+-            int bytes;
+-            int wanted;
+-
+-            avail = bbwi.buflen - bbwi.position();
+-            if (avail <= 0) {
+-                grow(1, 1);
+-                avail = bbwi.buflen - bbwi.position();
+-            }
+-            wanted = len - n;
+-            bytes = (wanted < avail) ? wanted : avail;
+-            // Microbenchmarks are showing a loop of ByteBuffer.get(int) being
+-            // faster than ByteBuffer.get(byte[], int, int).
+-            for (int i=0; i<bytes; i++) {
+-                c[n+i] = (char) (bbwi.byteBuffer.get(bbwi.position()+i) & 0xFF);
+-            }
+-            bbwi.position(bbwi.position() + bytes);
+-            n += bytes;
+-        }
+-
+-        //
+-        // Skip past terminating null byte
+-        //
+-        if (bbwi.position() + 1 > bbwi.buflen)
+-            alignAndCheck(1, 1);
+-        bbwi.position(bbwi.position() + 1);
+-
+-        return new String(c);
+     }
+ 
+     public final String read_string() {
+@@ -1045,7 +994,7 @@ public class CDRInputStream_1_0 extends 
+ 
+                 try {
+                     if (valueHandler == null)
+-                        valueHandler = ORBUtility.createValueHandler(orb);
++                        valueHandler = ORBUtility.createValueHandler();
+ 
+                     value = valueHandler.readValue(parent,
+                                                    indirection,
+diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_0.java b/src/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_0.java
+--- corba/src/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_0.java
++++ corba/src/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_0.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2004, 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
+@@ -189,18 +189,8 @@ public class CDROutputStream_1_0 extends
+ 
+     private final void createRepositoryIdHandlers()
+     {
+-        if (orb != null) {
+-            // Get the appropriate versions based on the ORB version.  The
+-            // ORB versioning info is only in the core ORB.
+-            repIdUtil
+-                = RepositoryIdFactory.getRepIdUtility(orb);
+-            repIdStrs
+-                = RepositoryIdFactory.getRepIdStringsFactory(orb);
+-        } else {
+-            // Get the latest versions
+-            repIdUtil = RepositoryIdFactory.getRepIdUtility();
+-            repIdStrs = RepositoryIdFactory.getRepIdStringsFactory();
+-        }
++        repIdUtil = RepositoryIdFactory.getRepIdUtility();
++        repIdStrs = RepositoryIdFactory.getRepIdStringsFactory();
+     }
+ 
+     public BufferManagerWrite getBufferManager()
+@@ -705,7 +695,7 @@ public class CDROutputStream_1_0 extends
+     private void writeArray(Serializable array, Class clazz) {
+ 
+         if (valueHandler == null)
+-            valueHandler = ORBUtility.createValueHandler(orb); //d11638
++            valueHandler = ORBUtility.createValueHandler(); //d11638
+ 
+         // Write value_tag
+         int indirection = writeValueTag(mustChunk, true,
+@@ -768,7 +758,7 @@ public class CDROutputStream_1_0 extends
+ 
+     private void writeRMIIIOPValueType(Serializable object, Class clazz) {
+         if (valueHandler == null)
+-            valueHandler = ORBUtility.createValueHandler(orb); //d11638
++            valueHandler = ORBUtility.createValueHandler(); //d11638
+ 
+         Serializable key = object;
+ 
+diff --git a/src/share/classes/com/sun/corba/se/impl/io/FVDCodeBaseImpl.java b/src/share/classes/com/sun/corba/se/impl/io/FVDCodeBaseImpl.java
+--- corba/src/share/classes/com/sun/corba/se/impl/io/FVDCodeBaseImpl.java
++++ corba/src/share/classes/com/sun/corba/se/impl/io/FVDCodeBaseImpl.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1999, 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
+@@ -86,7 +86,7 @@ public class FVDCodeBaseImpl extends _Co
+             // default to using the current ORB version in case the
+             // vhandler is not set
+             if (vhandler == null) {
+-                vhandler = new ValueHandlerImpl(false);
++                vhandler = ValueHandlerImpl.getInstance(false);
+             }
+ 
+             // Util.getCodebase may return null which would
+@@ -120,7 +120,7 @@ public class FVDCodeBaseImpl extends _Co
+                 // default to using the current ORB version in case the
+                 // vhandler is not set
+                 if (vhandler == null) {
+-                    vhandler = new ValueHandlerImpl(false);
++                    vhandler = ValueHandlerImpl.getInstance(false);
+                 }
+ 
+                 try{
+@@ -161,7 +161,7 @@ public class FVDCodeBaseImpl extends _Co
+             // default to using the current ORB version in case the
+             // vhandler is not set
+             if (vhandler == null) {
+-                vhandler = new ValueHandlerImpl(false);
++                vhandler = ValueHandlerImpl.getInstance(false);
+             }
+ 
+             Stack repIds = new Stack();
+diff --git a/src/share/classes/com/sun/corba/se/impl/io/ValueHandlerImpl.java b/src/share/classes/com/sun/corba/se/impl/io/ValueHandlerImpl.java
+--- corba/src/share/classes/com/sun/corba/se/impl/io/ValueHandlerImpl.java
++++ corba/src/share/classes/com/sun/corba/se/impl/io/ValueHandlerImpl.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1998, 2010, 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
+@@ -53,7 +53,7 @@ import com.sun.corba.se.impl.logging.OMG
+ import com.sun.corba.se.impl.logging.OMGSystemException;
+ import com.sun.corba.se.impl.logging.UtilSystemException;
+ 
+-public class ValueHandlerImpl implements javax.rmi.CORBA.ValueHandlerMultiFormat {
++public final class ValueHandlerImpl implements javax.rmi.CORBA.ValueHandlerMultiFormat {
+ 
+     // Property to override our maximum stream format version
+     public static final String FORMAT_VERSION_PROPERTY
+@@ -150,12 +150,20 @@ public class ValueHandlerImpl implements
+         writeValueWithVersion(out, value, streamFormatVersion);
+     }
+ 
+-    public ValueHandlerImpl(){}
++    private ValueHandlerImpl(){}
+ 
+-    public ValueHandlerImpl(boolean isInputStream) {
++    private ValueHandlerImpl(boolean isInputStream) {
+         this();
+         useHashtables = false;
+         this.isInputStream = isInputStream;
++    }
++
++    static ValueHandlerImpl getInstance() {
++        return new ValueHandlerImpl();
++    }
++
++    static ValueHandlerImpl getInstance(boolean isInputStream) {
++        return new ValueHandlerImpl(isInputStream);
+     }
+ 
+     /**
+@@ -458,12 +466,7 @@ public class ValueHandlerImpl implements
+         return ObjectStreamClass.lookup(value.getClass()).writeReplace(value);
+     }
+ 
+-    /**
+-     * Encapsulates writing of Java char arrays so that the 1.3 subclass
+-     * can override it without exposing internals across packages.  This
+-     * is a fix for bug 4367783.
+-     */
+-    protected void writeCharArray(org.omg.CORBA_2_3.portable.OutputStream out,
++    private void writeCharArray(org.omg.CORBA_2_3.portable.OutputStream out,
+                                 char[] array,
+                                 int offset,
+                                 int length)
+@@ -576,12 +579,7 @@ public class ValueHandlerImpl implements
+         }
+     }
+ 
+-    /**
+-     * Encapsulates reading of Java char arrays so that the 1.3 subclass
+-     * can override it without exposing internals across packages.  This
+-     * is a fix for bug 4367783.
+-     */
+-    protected void readCharArray(org.omg.CORBA_2_3.portable.InputStream in,
++    private void readCharArray(org.omg.CORBA_2_3.portable.InputStream in,
+                                  char[] array,
+                                  int offset,
+                                  int length)
+@@ -795,7 +793,7 @@ public class ValueHandlerImpl implements
+         return RepositoryId.cache.getId(repId).isSequence();
+     }
+ 
+-    protected String getOutputStreamClassName() {
++    private String getOutputStreamClassName() {
+         return "com.sun.corba.se.impl.io.IIOPOutputStream";
+     }
+ 
+@@ -843,29 +841,11 @@ public class ValueHandlerImpl implements
+     private IIOPOutputStream createOutputStreamBuiltInNoPriv(
+         final String name
+     ) throws IOException {
+-        return 
+-            name.equals(
+-                IIOPOutputStream
+-                    .class.getName()
+-            ) ?
+-            new IIOPOutputStream() :
+-
+-            name.equals(
+-                com.sun.corba.se.impl.orbutil.IIOPOutputStream_1_3
+-                    .class.getName()
+-            ) ?
+-            new com.sun.corba.se.impl.orbutil.IIOPOutputStream_1_3() :
+-
+-            name.equals(
+-                com.sun.corba.se.impl.orbutil.IIOPOutputStream_1_3_1
+-                    .class.getName()
+-            ) ?
+-            new com.sun.corba.se.impl.orbutil.IIOPOutputStream_1_3_1() :
+-
+-            null;
++        return name.equals(IIOPOutputStream.class.getName()) ?
++                new IIOPOutputStream() : null;
+     }
+ 
+-    protected String getInputStreamClassName() {
++    private String getInputStreamClassName() {
+         return "com.sun.corba.se.impl.io.IIOPInputStream";
+     }
+ 
+@@ -913,26 +893,8 @@ public class ValueHandlerImpl implements
+      private IIOPInputStream createInputStreamBuiltInNoPriv(
+          final String name
+      ) throws IOException {
+-         return 
+-             name.equals(
+-                 IIOPInputStream
+-                     .class.getName()
+-             ) ?
+-             new IIOPInputStream() :
+- 
+-             name.equals(
+-                 com.sun.corba.se.impl.orbutil.IIOPInputStream_1_3
+-                     .class.getName()
+-             ) ?
+-             new com.sun.corba.se.impl.orbutil.IIOPInputStream_1_3() :
+- 
+-             name.equals(
+-                 com.sun.corba.se.impl.orbutil.IIOPInputStream_1_3_1
+-                     .class.getName()
+-             ) ?
+-             new com.sun.corba.se.impl.orbutil.IIOPInputStream_1_3_1() :
+- 
+-             null;
++         return name.equals(IIOPInputStream.class.getName()) ?
++                new IIOPInputStream() : null;
+      }
+ 
+      /**
+@@ -958,12 +920,7 @@ public class ValueHandlerImpl implements
+ 
+     }
+ 
+-    /**
+-     * Our JDK 1.3 and JDK 1.3.1 behavior subclasses override this.
+-     * The correct behavior is for a Java char to map to a CORBA wchar,
+-     * but our older code mapped it to a CORBA char.
+-     */
+-    protected TCKind getJavaCharTCKind() {
++    TCKind getJavaCharTCKind() {
+         return TCKind.tk_wchar;
+     }
+ }
+diff --git a/src/share/classes/com/sun/corba/se/impl/io/ValueUtility.java b/src/share/classes/com/sun/corba/se/impl/io/ValueUtility.java
+--- corba/src/share/classes/com/sun/corba/se/impl/io/ValueUtility.java
++++ corba/src/share/classes/com/sun/corba/se/impl/io/ValueUtility.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1999, 2002, 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
+@@ -92,6 +92,14 @@ public class ValueUtility {
+         null,       // tk_native       31
+         null,       // tk_abstract_interface 32
+     };
++
++    static {
++        sun.corba.SharedSecrets.setJavaCorbaAccess(new sun.corba.JavaCorbaAccess() {
++            public ValueHandlerImpl newValueHandlerImpl() {
++                return ValueHandlerImpl.getInstance();
++            }
++        });
++    }
+ 
+     public static String getSignature(ValueMember member)
+         throws ClassNotFoundException {
+diff --git a/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java b/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java
+--- corba/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java
++++ corba/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java
+@@ -112,6 +112,9 @@ import com.sun.corba.se.impl.orbutil.ORB
+ import com.sun.corba.se.impl.orbutil.ORBClassLoader;
+ import com.sun.corba.se.impl.logging.UtilSystemException;
+ import com.sun.corba.se.spi.logging.CORBALogDomains;
++import sun.corba.SharedSecrets;
++import sun.corba.JavaCorbaAccess;
++
+ 
+ /**
+  * Provides utility methods that can be used by stubs and ties to
+@@ -125,7 +128,8 @@ public class Util implements javax.rmi.C
+     // Maps targets to ties.
+     private static IdentityHashtable exportedServants = new IdentityHashtable();
+ 
+-    private static ValueHandlerImpl valueHandlerSingleton = new ValueHandlerImpl();
++    private static final ValueHandlerImpl valueHandlerSingleton =
++        SharedSecrets.getJavaCorbaAccess().newValueHandlerImpl();
+ 
+     private UtilSystemException utilWrapper = UtilSystemException.get(
+                                                   CORBALogDomains.RPC_ENCODING);
+diff --git a/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java b/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java
+--- corba/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java
++++ corba/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java
+@@ -848,7 +848,7 @@ public class ORBImpl extends com.sun.cor
+         // backward compatability 4365188
+         CodeBase cb;
+ 
+-        ValueHandler vh = ORBUtility.createValueHandler(this);
++        ValueHandler vh = ORBUtility.createValueHandler();
+ 
+         cb = (CodeBase)vh.getRunTimeCodeBase();
+         return ORBUtility.connectAndGetIOR( this, cb ) ;
+diff --git a/src/share/classes/com/sun/corba/se/impl/orbutil/IIOPInputStream_1_3.java b/src/share/classes/com/sun/corba/se/impl/orbutil/IIOPInputStream_1_3.java
+deleted file mode 100644
+--- corba/src/share/classes/com/sun/corba/se/impl/orbutil/IIOPInputStream_1_3.java
++++ /dev/null
+@@ -1,57 +0,0 @@
+-/*
+- * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
+- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+- *
+- * This code is free software; you can redistribute 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.corba.se.impl.orbutil;
+-
+-import java.io.*;
+-import java.util.Hashtable;
+-
+-/**
+- * Implements legacy behavior from before Ladybird to maintain
+- * backwards compatibility.
+- */
+-public class IIOPInputStream_1_3 extends com.sun.corba.se.impl.io.IIOPInputStream
+-{
+-    // The newer version in the io package correctly reads a wstring instead.
+-    // This concerns bug 4379597.
+-    protected String internalReadUTF(org.omg.CORBA.portable.InputStream stream)
+-    {
+-        return stream.read_string();
+-    }
+-
+-    /**
+-     * Before JDK 1.3.1_01, the PutField/GetField implementation
+-     * actually sent a Hashtable.
+-     */
+-    public ObjectInputStream.GetField readFields()
+-        throws IOException, ClassNotFoundException, NotActiveException {
+-        Hashtable fields = (Hashtable)readObject();
+-        return new LegacyHookGetFields(fields);
+-    }
+-
+-    public IIOPInputStream_1_3()
+-        throws java.io.IOException {
+-        super();
+-    }
+-}
+diff --git a/src/share/classes/com/sun/corba/se/impl/orbutil/IIOPInputStream_1_3_1.java b/src/share/classes/com/sun/corba/se/impl/orbutil/IIOPInputStream_1_3_1.java
+deleted file mode 100644
+--- corba/src/share/classes/com/sun/corba/se/impl/orbutil/IIOPInputStream_1_3_1.java
++++ /dev/null
+@@ -1,54 +0,0 @@
+-/*
+- * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
+- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+- *
+- * This code is free software; you can redistribute 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.corba.se.impl.orbutil;
+-
+-import java.io.*;
+-import java.util.Hashtable;
+-
+-/**
+- * Implements legacy behavior from Ladybird to maintain
+- * backwards compatibility.
+- */
+-public class IIOPInputStream_1_3_1 extends com.sun.corba.se.impl.io.IIOPInputStream
+-{
+-    public IIOPInputStream_1_3_1()
+-        throws java.io.IOException {
+-        super();
+-    }
+-
+-    /**
+-     * Before JDK 1.3.1_01, the PutField/GetField implementation
+-     * actually sent a Hashtable.
+-     */
+-    public ObjectInputStream.GetField readFields()
+-        throws IOException, ClassNotFoundException, NotActiveException {
+-
+-        Hashtable fields = (Hashtable)readObject();
+-        return new LegacyHookGetFields(fields);
+-    }
+-}
+diff --git a/src/share/classes/com/sun/corba/se/impl/orbutil/IIOPOutputStream_1_3.java b/src/share/classes/com/sun/corba/se/impl/orbutil/IIOPOutputStream_1_3.java
+deleted file mode 100644
+--- corba/src/share/classes/com/sun/corba/se/impl/orbutil/IIOPOutputStream_1_3.java
++++ /dev/null
+@@ -1,68 +0,0 @@
+-/*
+- * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
+- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+- *
+- * This code is free software; you can redistribute 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.corba.se.impl.orbutil;
+-
+-import java.io.*;
+-
+-/**
+- * Implements legacy behavior from before Ladybird to maintain
+- * backwards compatibility.
+- */
+-public class IIOPOutputStream_1_3 extends com.sun.corba.se.impl.io.IIOPOutputStream
+-{
+-    // We can't assume that the superclass's putFields
+-    // member will be non-private.  We must allow
+-    // the RI to run on JDK 1.3.1 FCS as well as
+-    // the JDK 1.3.1_01 patch.
+-    private ObjectOutputStream.PutField putFields_1_3;
+-
+-    // The newer version in the io package correctly writes a wstring instead.
+-    // This concerns bug 4379597.
+-    protected void internalWriteUTF(org.omg.CORBA.portable.OutputStream stream,
+-                                    String data)
+-    {
+-        stream.write_string(data);
+-    }
+-
+-    public IIOPOutputStream_1_3()
+-        throws java.io.IOException {
+-        super();
+-    }
+-
+-    /**
+-     * Before JDK 1.3.1_01, the PutField/GetField implementation
+-     * actually sent a Hashtable.
+-     */
+-    public ObjectOutputStream.PutField putFields()
+-        throws IOException {
+-        putFields_1_3 = new LegacyHookPutFields();
+-        return putFields_1_3;
+-    }
+-
+-    public void writeFields()
+-        throws IOException {
+-        putFields_1_3.write(this);
+-    }
+-}
+diff --git a/src/share/classes/com/sun/corba/se/impl/orbutil/IIOPOutputStream_1_3_1.java b/src/share/classes/com/sun/corba/se/impl/orbutil/IIOPOutputStream_1_3_1.java
+deleted file mode 100644
+--- corba/src/share/classes/com/sun/corba/se/impl/orbutil/IIOPOutputStream_1_3_1.java
++++ /dev/null
+@@ -1,66 +0,0 @@
+-/*
+- * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
+- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+- *
+- * This code is free software; you can redistribute 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.corba.se.impl.orbutil;
+-
+-import java.io.*;
+-import java.util.Hashtable;
+-
+-/**
+- * Implements legacy behavior from Ladybird to maintain
+- * backwards compatibility.
+- */
+-public class IIOPOutputStream_1_3_1 extends com.sun.corba.se.impl.io.IIOPOutputStream
+-{
+-    // We can't assume that the superclass's putFields
+-    // member will be non-private.  We must allow
+-    // the RI to run on JDK 1.3.1 FCS as well as
+-    // the JDK 1.3.1_01 patch.
+-    private ObjectOutputStream.PutField putFields_1_3_1;
+-
+-    public IIOPOutputStream_1_3_1()
+-        throws java.io.IOException {
+-        super();
+-    }
+-
+-    /**
+-     * Before JDK 1.3.1_01, the PutField/GetField implementation
+-     * actually sent a Hashtable.
+-     */
+-    public ObjectOutputStream.PutField putFields()
+-        throws IOException {
+-
+-        putFields_1_3_1 = new LegacyHookPutFields();
+-        return putFields_1_3_1;
+-    }
+-
+-    public void writeFields()
+-        throws IOException {
+-
+-        putFields_1_3_1.write(this);
+-    }
+-}
+diff --git a/src/share/classes/com/sun/corba/se/impl/orbutil/ORBUtility.java b/src/share/classes/com/sun/corba/se/impl/orbutil/ORBUtility.java
+--- corba/src/share/classes/com/sun/corba/se/impl/orbutil/ORBUtility.java
++++ corba/src/share/classes/com/sun/corba/se/impl/orbutil/ORBUtility.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2000, 2006, 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
+@@ -160,42 +160,10 @@ public final class ORBUtility {
+     }
+ 
+     /**
+-     * Creates the correct ValueHandler for the given ORB,
+-     * querying ORBVersion information.  If the ORB or
+-     * ORBVersion is null, gets the ValueHandler from
+-     * Util.createValueHandler.
++     * Return default ValueHandler
+      */
+-    public static ValueHandler createValueHandler(ORB orb) {
+-
+-        if (orb == null)
+-            return Util.createValueHandler();
+-
+-        ORBVersion version = orb.getORBVersion();
+-
+-        if (version == null)
+-            return Util.createValueHandler();
+-
+-        if (version.equals(ORBVersionFactory.getOLD()))
+-            return new ValueHandlerImpl_1_3();
+-        if (version.equals(ORBVersionFactory.getNEW()))
+-            return new ValueHandlerImpl_1_3_1();
+-
++    public static ValueHandler createValueHandler() {
+         return Util.createValueHandler();
+-    }
+-
+-    /**
+-     * Returns true if the given ORB could accurately be determined to be a
+-     * Kestrel or earlier ORB.  Note: If passed the ORBSingleton, this will return
+-     * false.
+-     */
+-    public static boolean isLegacyORB(ORB orb)
+-    {
+-        try {
+-            ORBVersion currentORB = orb.getORBVersion();
+-            return currentORB.equals( ORBVersionFactory.getOLD() ) ;
+-        } catch (SecurityException se) {
+-            return false;
+-        }
+     }
+ 
+     /**
+diff --git a/src/share/classes/com/sun/corba/se/impl/orbutil/RepIdDelegator_1_3.java b/src/share/classes/com/sun/corba/se/impl/orbutil/RepIdDelegator_1_3.java
+deleted file mode 100644
+--- corba/src/share/classes/com/sun/corba/se/impl/orbutil/RepIdDelegator_1_3.java
++++ /dev/null
+@@ -1,177 +0,0 @@
+-/*
+- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+- *
+- * This code is free software; you can redistribute 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.corba.se.impl.orbutil;
+-
+-import org.omg.CORBA.ORB;
+-import java.io.Serializable;
+-import java.util.Hashtable;
+-import java.net.MalformedURLException;
+-import com.sun.corba.se.impl.io.TypeMismatchException;
+-import com.sun.corba.se.impl.util.RepositoryId;
+-
+-/**
+- * Delegates to the RepositoryId_1_3 implementation in
+- * com.sun.corba.se.impl.orbutil.  This is necessary to
+- * overcome the fact that many of RepositoryId's methods
+- * are static.
+- */
+-public final class RepIdDelegator_1_3
+-    implements RepositoryIdStrings,
+-               RepositoryIdUtility,
+-               RepositoryIdInterface
+-{
+-    // RepositoryIdFactory methods
+-
+-    public String createForAnyType(Class type) {
+-        return RepositoryId_1_3.createForAnyType(type);
+-    }
+-
+-    public String createForJavaType(Serializable ser)
+-        throws TypeMismatchException
+-    {
+-        return RepositoryId_1_3.createForJavaType(ser);
+-    }
+-
+-    public String createForJavaType(Class clz)
+-        throws TypeMismatchException
+-    {
+-        return RepositoryId_1_3.createForJavaType(clz);
+-    }
+-
+-    public String createSequenceRepID(java.lang.Object ser) {
+-        return RepositoryId_1_3.createSequenceRepID(ser);
+-    }
+-
+-    public String createSequenceRepID(Class clazz) {
+-        return RepositoryId_1_3.createSequenceRepID(clazz);
+-    }
+-
+-    public RepositoryIdInterface getFromString(String repIdString) {
+-        return new RepIdDelegator_1_3(RepositoryId_1_3.cache.getId(repIdString));
+-    }
+-
+-    // RepositoryIdUtility methods
+-
+-    public boolean isChunkedEncoding(int valueTag) {
+-        return RepositoryId.isChunkedEncoding(valueTag);
+-    }
+-
+-    public boolean isCodeBasePresent(int valueTag) {
+-        return RepositoryId.isCodeBasePresent(valueTag);
+-    }
+-
+-    public String getClassDescValueRepId() {
+-        return RepositoryId_1_3.kClassDescValueRepID;
+-    }
+-
+-    public String getWStringValueRepId() {
+-        return RepositoryId_1_3.kWStringValueRepID;
+-    }
+-
+-    public int getTypeInfo(int valueTag) {
+-        return RepositoryId.getTypeInfo(valueTag);
+-    }
+-
+-    public int getStandardRMIChunkedNoRepStrId() {
+-        return RepositoryId.kPreComputed_StandardRMIChunked_NoRep;
+-    }
+-
+-    public int getCodeBaseRMIChunkedNoRepStrId() {
+-        return RepositoryId.kPreComputed_CodeBaseRMIChunked_NoRep;
+-    }
+-
+-    public int getStandardRMIChunkedId() {
+-        return RepositoryId.kPreComputed_StandardRMIChunked;
+-    }
+-
+-    public int getCodeBaseRMIChunkedId() {
+-        return RepositoryId.kPreComputed_CodeBaseRMIChunked;
+-    }
+-
+-    public int getStandardRMIUnchunkedId() {
+-        return RepositoryId.kPreComputed_StandardRMIUnchunked;
+-    }
+-
+-    public int getCodeBaseRMIUnchunkedId() {
+-        return RepositoryId.kPreComputed_CodeBaseRMIUnchunked;
+-    }
+-
+-    public int getStandardRMIUnchunkedNoRepStrId() {
+-        return RepositoryId.kPreComputed_StandardRMIUnchunked_NoRep;
+-    }
+-
+-    public int getCodeBaseRMIUnchunkedNoRepStrId() {
+-        return RepositoryId.kPreComputed_CodeBaseRMIUnchunked_NoRep;
+-    }
+-
+-    // RepositoryIdInterface methods
+-
+-    public Class getClassFromType() throws ClassNotFoundException {
+-        return delegate.getClassFromType();
+-    }
+-
+-    public Class getClassFromType(String codebaseURL)
+-        throws ClassNotFoundException, MalformedURLException
+-    {
+-        return delegate.getClassFromType(codebaseURL);
+-    }
+-
+-    public Class getClassFromType(Class expectedType,
+-                                  String codebaseURL)
+-        throws ClassNotFoundException, MalformedURLException
+-    {
+-        return delegate.getClassFromType(expectedType, codebaseURL);
+-    }
+-
+-    public String getClassName() {
+-        return delegate.getClassName();
+-    }
+-
+-    // Constructor used for factory/utility cases
+-    public RepIdDelegator_1_3() {}
+-
+-    // Constructor used by getIdFromString.  All non-static
+-    // RepositoryId methods will use the provided delegate.
+-    private RepIdDelegator_1_3(RepositoryId_1_3 _delegate) {
+-        this.delegate = _delegate;
+-    }
+-
+-    private RepositoryId_1_3 delegate = null;
+-
+-    public String toString() {
+-        if (delegate != null)
+-            return delegate.toString();
+-        else
+-            return this.getClass().getName();
+-    }
+-
+-    public boolean equals(Object obj) {
+-        if (delegate != null)
+-            return delegate.equals(obj);
+-        else
+-            return super.equals(obj);
+-    }
+-}
+diff --git a/src/share/classes/com/sun/corba/se/impl/orbutil/RepIdDelegator_1_3_1.java b/src/share/classes/com/sun/corba/se/impl/orbutil/RepIdDelegator_1_3_1.java
+deleted file mode 100644
+--- corba/src/share/classes/com/sun/corba/se/impl/orbutil/RepIdDelegator_1_3_1.java
++++ /dev/null
+@@ -1,177 +0,0 @@
+-/*
+- * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
+- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+- *
+- * This code is free software; you can redistribute 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.corba.se.impl.orbutil;
+-
+-import org.omg.CORBA.ORB;
+-import java.io.Serializable;
+-import java.util.Hashtable;
+-import java.net.MalformedURLException;
+-import com.sun.corba.se.impl.io.TypeMismatchException;
+-import com.sun.corba.se.impl.util.RepositoryId;
+-
+-/**
+- * Delegates to the RepositoryId_1_3_1 implementation in
+- * com.sun.corba.se.impl.orbutil.  This is necessary to
+- * overcome the fact that many of RepositoryId's methods
+- * are static.
+- */
+-public final class RepIdDelegator_1_3_1
+-    implements RepositoryIdStrings,
+-               RepositoryIdUtility,
+-               RepositoryIdInterface
+-{
+-    // RepositoryIdFactory methods
+-
+-    public String createForAnyType(Class type) {
+-        return RepositoryId_1_3_1.createForAnyType(type);
+-    }
+-
+-    public String createForJavaType(Serializable ser)
+-        throws TypeMismatchException
+-    {
+-        return RepositoryId_1_3_1.createForJavaType(ser);
+-    }
+-
+-    public String createForJavaType(Class clz)
+-        throws TypeMismatchException
+-    {
+-        return RepositoryId_1_3_1.createForJavaType(clz);
+-    }
+-
+-    public String createSequenceRepID(java.lang.Object ser) {
+-        return RepositoryId_1_3_1.createSequenceRepID(ser);
+-    }
+-
+-    public String createSequenceRepID(Class clazz) {
+-        return RepositoryId_1_3_1.createSequenceRepID(clazz);
+-    }
+-
+-    public RepositoryIdInterface getFromString(String repIdString) {
+-        return new RepIdDelegator_1_3_1(RepositoryId_1_3_1.cache.getId(repIdString));
+-    }
+-
+-    // RepositoryIdUtility methods
+-
+-    public boolean isChunkedEncoding(int valueTag) {
+-        return RepositoryId.isChunkedEncoding(valueTag);
+-    }
+-
+-    public boolean isCodeBasePresent(int valueTag) {
+-        return RepositoryId.isCodeBasePresent(valueTag);
+-    }
+-
+-    public String getClassDescValueRepId() {
+-        return RepositoryId_1_3_1.kClassDescValueRepID;
+-    }
+-
+-    public String getWStringValueRepId() {
+-        return RepositoryId_1_3_1.kWStringValueRepID;
+-    }
+-
+-    public int getTypeInfo(int valueTag) {
+-        return RepositoryId.getTypeInfo(valueTag);
+-    }
+-
+-    public int getStandardRMIChunkedNoRepStrId() {
+-        return RepositoryId.kPreComputed_StandardRMIChunked_NoRep;
+-    }
+-
+-    public int getCodeBaseRMIChunkedNoRepStrId() {
+-        return RepositoryId.kPreComputed_CodeBaseRMIChunked_NoRep;
+-    }
+-
+-    public int getStandardRMIChunkedId() {
+-        return RepositoryId.kPreComputed_StandardRMIChunked;
+-    }
+-
+-    public int getCodeBaseRMIChunkedId() {
+-        return RepositoryId.kPreComputed_CodeBaseRMIChunked;
+-    }
+-
+-    public int getStandardRMIUnchunkedId() {
+-        return RepositoryId.kPreComputed_StandardRMIUnchunked;
+-    }
+-
+-    public int getCodeBaseRMIUnchunkedId() {
+-        return RepositoryId.kPreComputed_CodeBaseRMIUnchunked;
+-    }
+-
+-    public int getStandardRMIUnchunkedNoRepStrId() {
+-        return RepositoryId.kPreComputed_StandardRMIUnchunked_NoRep;
+-    }
+-
+-    public int getCodeBaseRMIUnchunkedNoRepStrId() {
+-        return RepositoryId.kPreComputed_CodeBaseRMIUnchunked_NoRep;
+-    }
+-
+-    // RepositoryIdInterface methods
+-
+-    public Class getClassFromType() throws ClassNotFoundException {
+-        return delegate.getClassFromType();
+-    }
+-
+-    public Class getClassFromType(String codebaseURL)
+-        throws ClassNotFoundException, MalformedURLException
+-    {
+-        return delegate.getClassFromType(codebaseURL);
+-    }
+-
+-    public Class getClassFromType(Class expectedType,
+-                                  String codebaseURL)
+-        throws ClassNotFoundException, MalformedURLException
+-    {
+-        return delegate.getClassFromType(expectedType, codebaseURL);
+-    }
+-
+-    public String getClassName() {
+-        return delegate.getClassName();
+-    }
+-
+-    // Constructor used for factory/utility cases
+-    public RepIdDelegator_1_3_1() {}
+-
+-    // Constructor used by getIdFromString.  All non-static
+-    // RepositoryId methods will use the provided delegate.
+-    private RepIdDelegator_1_3_1(RepositoryId_1_3_1 _delegate) {
+-        this.delegate = _delegate;
+-    }
+-
+-    private RepositoryId_1_3_1 delegate = null;
+-
+-    public String toString() {
+-        if (delegate != null)
+-            return delegate.toString();
+-        else
+-            return this.getClass().getName();
+-    }
+-
+-    public boolean equals(Object obj) {
+-        if (delegate != null)
+-            return delegate.equals(obj);
+-        else
+-            return super.equals(obj);
+-    }
+-}
+diff --git a/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdCache_1_3.java b/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdCache_1_3.java
+deleted file mode 100644
+--- corba/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdCache_1_3.java
++++ /dev/null
+@@ -1,108 +0,0 @@
+-/*
+- * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
+- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+- *
+- * This code is free software; you can redistribute 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.
+- */
+-/*
+- * Licensed Materials - Property of IBM
+- * RMI-IIOP v1.0
+- * Copyright IBM Corp. 1998 1999  All Rights Reserved
+- *
+- */
+-
+-package com.sun.corba.se.impl.orbutil;
+-
+-import java.util.Stack;
+-import java.util.Hashtable;
+-import java.util.EmptyStackException;
+-import java.util.Enumeration;
+-
+-// Really limited pool - in this case just creating several at a time...
+-class RepositoryIdPool_1_3 extends Stack {
+-
+-    private static int MAX_CACHE_SIZE = 4;
+-    private RepositoryIdCache_1_3 cache;
+-
+-    public final synchronized RepositoryId_1_3 popId() {
+-
+-        try {
+-            return (RepositoryId_1_3)super.pop();
+-        }
+-        catch(EmptyStackException e) {
+-            increasePool(5);
+-            return (RepositoryId_1_3)super.pop();
+-        }
+-
+-    }
+-
+-    // Pool management
+-    final void increasePool(int size) {
+-        //if (cache.size() <= MAX_CACHE_SIZE)
+-        for (int i = size; i > 0; i--)
+-            push(new RepositoryId_1_3());
+-        /*
+-          // _REVISIT_ This will not work w/out either thread tracing or weak references.  I am
+-          // betting that thread tracing almost completely negates benefit of reuse.  Until either
+-          // 1.2 only inclusion or proof to the contrary, I'll leave it this way...
+-          else {
+-          int numToReclaim = cache.size() / 2;
+-          Enumeration keys = cache.keys();
+-          Enumeration elements = cache.elements();
+-          for (int i = numToReclaim; i > 0; i--) {
+-          Object key = keys.nextElement();
+-          Object element = elements.nextElement();
+-
+-          push(element);
+-          cache.remove(key);
+-          }
+-          }
+-        */
+-    }
+-
+-    final void setCaches(RepositoryIdCache_1_3 cache) {
+-        this.cache = cache;
+-    }
+-
+-}
+-
+-public class RepositoryIdCache_1_3 extends Hashtable {
+-
+-    private RepositoryIdPool_1_3 pool = new RepositoryIdPool_1_3();
+-
+-    public RepositoryIdCache_1_3() {
+-        pool.setCaches(this);
+-    }
+-
+-    public final synchronized RepositoryId_1_3 getId(String key) {
+-        RepositoryId_1_3 repId = (RepositoryId_1_3)super.get(key);
+-
+-        if (repId != null)
+-            return repId;
+-        else {
+-            //repId = pool.popId().init(key);
+-            repId = new RepositoryId_1_3(key);
+-            put(key, repId);
+-            return repId;
+-        }
+-
+-    }
+-}
+diff --git a/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdCache_1_3_1.java b/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdCache_1_3_1.java
+deleted file mode 100644
+--- corba/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdCache_1_3_1.java
++++ /dev/null
+@@ -1,102 +0,0 @@
+-/*
+- * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
+- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+- *
+- * This code is free software; you can redistribute 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.corba.se.impl.orbutil;
+-
+-import java.util.Stack;
+-import java.util.Hashtable;
+-import java.util.EmptyStackException;
+-import java.util.Enumeration;
+-
+-// Really limited pool - in this case just creating several at a time...
+-class RepositoryIdPool_1_3_1 extends Stack {
+-
+-    private static int MAX_CACHE_SIZE = 4;
+-    private RepositoryIdCache_1_3_1 cache;
+-
+-    public final synchronized RepositoryId_1_3_1 popId() {
+-
+-        try {
+-            return (RepositoryId_1_3_1)super.pop();
+-        }
+-        catch(EmptyStackException e) {
+-            increasePool(5);
+-            return (RepositoryId_1_3_1)super.pop();
+-        }
+-
+-    }
+-
+-    // Pool management
+-    final void increasePool(int size) {
+-        //if (cache.size() <= MAX_CACHE_SIZE)
+-        for (int i = size; i > 0; i--)
+-            push(new RepositoryId_1_3_1());
+-        /*
+-          // _REVISIT_ This will not work w/out either thread tracing or weak references.  I am
+-          // betting that thread tracing almost completely negates benefit of reuse.  Until either
+-          // 1.2 only inclusion or proof to the contrary, I'll leave it this way...
+-          else {
+-          int numToReclaim = cache.size() / 2;
+-          Enumeration keys = cache.keys();
+-          Enumeration elements = cache.elements();
+-          for (int i = numToReclaim; i > 0; i--) {
+-          Object key = keys.nextElement();
+-          Object element = elements.nextElement();
+-
+-          push(element);
+-          cache.remove(key);
+-          }
+-          }
+-        */
+-    }
+-
+-    final void setCaches(RepositoryIdCache_1_3_1 cache) {
+-        this.cache = cache;
+-    }
+-
+-}
+-
+-public class RepositoryIdCache_1_3_1 extends Hashtable {
+-
+-    private RepositoryIdPool_1_3_1 pool = new RepositoryIdPool_1_3_1();
+-
+-    public RepositoryIdCache_1_3_1() {
+-        pool.setCaches(this);
+-    }
+-
+-    public final synchronized RepositoryId_1_3_1 getId(String key) {
+-        RepositoryId_1_3_1 repId = (RepositoryId_1_3_1)super.get(key);
+-
+-        if (repId != null)
+-            return repId;
+-        else {
+-            //repId = pool.popId().init(key);
+-            repId = new RepositoryId_1_3_1(key);
+-            put(key, repId);
+-            return repId;
+-        }
+-
+-    }
+-}
+diff --git a/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdFactory.java b/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdFactory.java
+--- corba/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdFactory.java
++++ corba/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdFactory.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2000, 2003, 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
+@@ -30,12 +30,6 @@ import com.sun.corba.se.spi.orb.ORB;
+ 
+ public abstract class RepositoryIdFactory
+ {
+-    private static final RepIdDelegator_1_3 legacyDelegator
+-        = new RepIdDelegator_1_3();
+-
+-    private static final RepIdDelegator_1_3_1 ladybirdDelegator
+-        = new RepIdDelegator_1_3_1();
+-
+     private static final RepIdDelegator currentDelegator
+         = new RepIdDelegator();
+ 
+@@ -48,29 +42,6 @@ public abstract class RepositoryIdFactor
+     }
+ 
+     /**
+-     * Checks the version of the ORB and returns the appropriate
+-     * RepositoryIdStrings instance.
+-     */
+-    public static RepositoryIdStrings getRepIdStringsFactory(ORB orb)
+-    {
+-        if (orb != null) {
+-            switch (orb.getORBVersion().getORBType()) {
+-                case ORBVersion.NEWER:
+-                case ORBVersion.FOREIGN:
+-                case ORBVersion.JDK1_3_1_01:
+-                    return currentDelegator;
+-                case ORBVersion.OLD:
+-                    return legacyDelegator;
+-                case ORBVersion.NEW:
+-                    return ladybirdDelegator;
+-                default:
+-                    return currentDelegator;
+-            }
+-        } else
+-            return currentDelegator;
+-    }
+-
+-    /**
+      * Returns the latest version RepositoryIdUtility instance
+      */
+     public static RepositoryIdUtility getRepIdUtility()
+@@ -78,26 +49,4 @@ public abstract class RepositoryIdFactor
+         return currentDelegator;
+     }
+ 
+-    /**
+-     * Checks the version of the ORB and returns the appropriate
+-     * RepositoryIdUtility instance.
+-     */
+-    public static RepositoryIdUtility getRepIdUtility(ORB orb)
+-    {
+-        if (orb != null) {
+-            switch (orb.getORBVersion().getORBType()) {
+-                case ORBVersion.NEWER:
+-                case ORBVersion.FOREIGN:
+-                case ORBVersion.JDK1_3_1_01:
+-                    return currentDelegator;
+-                case ORBVersion.OLD:
+-                    return legacyDelegator;
+-                case ORBVersion.NEW:
+-                    return ladybirdDelegator;
+-                default:
+-                    return currentDelegator;
+-            }
+-        } else
+-            return currentDelegator;
+-    }
+ }
+diff --git a/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryId_1_3.java b/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryId_1_3.java
+deleted file mode 100644
+--- corba/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryId_1_3.java
++++ /dev/null
+@@ -1,990 +0,0 @@
+-/*
+- * 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
+- * 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.
+- */
+-/*
+- * Licensed Materials - Property of IBM
+- * RMI-IIOP v1.0
+- * Copyright IBM Corp. 1998 1999  All Rights Reserved
+- *
+- */
+-
+-package com.sun.corba.se.impl.orbutil;
+-
+-import java.util.StringTokenizer;
+-import java.util.Hashtable;
+-import java.io.IOException;
+-import java.lang.reflect.Method;
+-
+-// Imports for using codebase URL to load class
+-import java.net.MalformedURLException;
+-import org.omg.CORBA.portable.ValueBase;
+-import org.omg.CORBA.portable.IDLEntity;
+-
+-import com.sun.corba.se.impl.util.JDKBridge;
+-import com.sun.corba.se.impl.util.Utility;
+-import com.sun.corba.se.impl.util.PackagePrefixChecker;
+-import com.sun.corba.se.impl.util.IdentityHashtable;
+-import com.sun.corba.se.impl.io.ObjectStreamClass;
+-
+-import javax.rmi.CORBA.Util;
+-
+-// keeping the original RepositoryId class that was shipped in
+-// JDK 1.3.  It has interoperability bugs
+-
+-public class RepositoryId_1_3 {
+-
+-    // Legal IDL Identifier characters (1 = legal). Note
+-    // that '.' (2E) is marked as legal even though it is
+-    // not legal in IDL. This allows us to treat a fully
+-    // qualified Java name with '.' package separators
+-    // uniformly, and is safe because that is the only
+-    // legal use of '.' in a Java name.
+-
+-    public static final RepositoryIdCache_1_3 cache = new RepositoryIdCache_1_3();
+-    private static final byte[] IDL_IDENTIFIER_CHARS = {
+-
+-        // 0 1 2 3  4 5 6 7  8 9 a b  c d e f
+-        0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 00-0f
+-        0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 10-1f
+-        0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,1,0, // 20-2f
+-        1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0, // 30-3f
+-        0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 40-4f
+-        1,1,1,1, 1,1,1,1, 1,1,1,0, 0,0,0,1, // 50-5f
+-        0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 60-6f
+-        1,1,1,1, 1,1,1,1, 1,1,1,0, 0,0,0,0, // 70-7f
+-        0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 80-8f
+-        0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 90-9f
+-        0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // a0-af
+-        0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // b0-bf
+-        1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // c0-cf
+-        0,1,1,1, 1,1,1,0, 1,1,1,1, 1,0,0,1, // d0-df
+-        1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // e0-ef
+-        0,1,1,1, 1,1,1,0, 1,1,1,1, 1,0,0,1, // f0-ff
+-    };
+-
+-    private static String defaultServerURL = null;
+-    private static boolean useCodebaseOnly = false;
+-
+-    static {
+-        if (defaultServerURL == null)
+-            defaultServerURL = (String)JDKBridge.getLocalCodebase();
+-        useCodebaseOnly = JDKBridge.useCodebaseOnly();
+-
+-    }
+-
+-    private static IdentityHashtable classToRepStr = new IdentityHashtable();
+-    private static IdentityHashtable classIDLToRepStr = new IdentityHashtable();
+-    private static IdentityHashtable classSeqToRepStr = new IdentityHashtable();
+-
+-    private static IdentityHashtable repStrToByteArray = new IdentityHashtable();
+-    private static Hashtable repStrToClass = new Hashtable();
+-
+-    private String repId = null;
+-    private boolean isSupportedFormat = true;
+-    private String typeString = null;
+-    private String versionString = null;
+-    private boolean isSequence = false;
+-    private boolean isRMIValueType = false;
+-    private boolean isIDLType = false;
+-    private String completeClassName = null;
+-    private String unqualifiedName = null;
+-    private String definedInId = null;
+-    private Class clazz = null;
+-    private String suid = null, actualSuid = null;
+-    private long suidLong = ObjectStreamClass.kDefaultUID, actualSuidLong = ObjectStreamClass.kDefaultUID;
+-
+-    // Repository ID fragments
+-    private static final String kValuePrefix = "RMI:";
+-    private static final String kIDLPrefix = "IDL:";
+-    private static final String kIDLNamePrefix = "omg.org/";
+-    private static final String kIDLClassnamePrefix = "org.omg.";
+-    private static final String kSequencePrefix = "[";
+-    private static final String kCORBAPrefix = "CORBA/";
+-    private static final String kArrayPrefix = kValuePrefix + kSequencePrefix + kCORBAPrefix;
+-    private static final int kValuePrefixLength = kValuePrefix.length();
+-    private static final int kIDLPrefixLength = kIDLPrefix.length();
+-    private static final int kSequencePrefixLength = kSequencePrefix.length();
+-    private static final String kInterfaceHashCode = ":0000000000000000";
+-    private static final String kInterfaceOnlyHashStr = "0000000000000000";
+-    private static final String kExternalizableHashStr = "0000000000000001";
+-
+-    // Value tag utility methods and constants
+-    public static final int kInitialValueTag= 0x7fffff00;
+-    public static final int kNoTypeInfo = 0;
+-    public static final int kSingleRepTypeInfo = 0x02;
+-    public static final int  kPartialListTypeInfo = 0x06;
+-    public static final int  kChunkedMask = 0x08;
+-
+-    // Public, well known repository IDs
+-
+-    // _REVISIT_ : A table structure with a good search routine for all of this
+-    // would be more efficient and easier to maintain...
+-
+-    // String
+-    public static final String kWStringValueVersion = "1.0";
+-    public static final String kWStringValueHash = ":"+kWStringValueVersion;
+-    public static final String kWStringStubValue = "WStringValue";
+-    public static final String kWStringTypeStr = "omg.org/CORBA/"+kWStringStubValue;
+-    public static final String kWStringValueRepID = kIDLPrefix + kWStringTypeStr + kWStringValueHash;
+-
+-    // Any
+-    public static final String kAnyRepID = kIDLPrefix + "omg.org/CORBA/Any";
+-
+-    // Class
+-    public static final String kClassDescValueHash = ":" + Long.toHexString(
+-       ObjectStreamClass.getSerialVersionUID(javax.rmi.CORBA.ClassDesc.class));
+-    public static final String kClassDescStubValue = "ClassDesc";
+-    public static final String kClassDescTypeStr = "javax.rmi.CORBA."+kClassDescStubValue;
+-    public static final String kClassDescValueRepID = kValuePrefix + kClassDescTypeStr + kClassDescValueHash;
+-
+-    // Object
+-    public static final String kObjectValueHash = ":1.0";
+-    public static final String kObjectStubValue = "Object";
+-
+-    // Sequence
+-    public static final String kSequenceValueHash = ":1.0";
+-    public static final String kPrimitiveSequenceValueHash = ":0000000000000000";
+-
+-    // Serializable
+-    public static final String kSerializableValueHash = ":1.0";
+-    public static final String kSerializableStubValue = "Serializable";
+-
+-    // Externalizable
+-    public static final String kExternalizableValueHash = ":1.0";
+-    public static final String kExternalizableStubValue = "Externalizable";
+-
+-    // Remote (The empty string is used for java.rmi.Remote)
+-    public static final String kRemoteValueHash = "";
+-    public static final String kRemoteStubValue = "";
+-    public static final String kRemoteTypeStr = "";
+-    public static final String kRemoteValueRepID = "";
+-
+-    private static final Hashtable kSpecialArrayTypeStrings = new Hashtable();
+-
+-    static {
+-        kSpecialArrayTypeStrings.put("CORBA.WStringValue", new StringBuffer(java.lang.String.class.getName()));
+-        kSpecialArrayTypeStrings.put("javax.rmi.CORBA.ClassDesc", new StringBuffer(java.lang.Class.class.getName()));
+-        kSpecialArrayTypeStrings.put("CORBA.Object", new StringBuffer(java.rmi.Remote.class.getName()));
+-
+-    }
+-
+-    private static final Hashtable kSpecialCasesRepIDs = new Hashtable();
+-
+-    static {
+-        kSpecialCasesRepIDs.put(java.lang.String.class, kWStringValueRepID);
+-        kSpecialCasesRepIDs.put(java.lang.Class.class, kClassDescValueRepID);
+-        kSpecialCasesRepIDs.put(java.rmi.Remote.class, kRemoteValueRepID);
+-    }
+-
+-    private static final Hashtable kSpecialCasesStubValues = new Hashtable();
+-
+-    static {
+-        kSpecialCasesStubValues.put(java.lang.String.class, kWStringStubValue);
+-        kSpecialCasesStubValues.put(java.lang.Class.class, kClassDescStubValue);
+-        kSpecialCasesStubValues.put(java.lang.Object.class, kObjectStubValue);
+-        kSpecialCasesStubValues.put(java.io.Serializable.class, kSerializableStubValue);
+-        kSpecialCasesStubValues.put(java.io.Externalizable.class, kExternalizableStubValue);
+-        kSpecialCasesStubValues.put(java.rmi.Remote.class, kRemoteStubValue);
+-    }
+-
+-
+-    private static final Hashtable kSpecialCasesVersions = new Hashtable();
+-
+-    static {
+-        kSpecialCasesVersions.put(java.lang.String.class, kWStringValueHash);
+-        kSpecialCasesVersions.put(java.lang.Class.class, kClassDescValueHash);
+-        kSpecialCasesVersions.put(java.lang.Object.class, kObjectValueHash);
+-        kSpecialCasesVersions.put(java.io.Serializable.class, kSerializableValueHash);
+-        kSpecialCasesVersions.put(java.io.Externalizable.class, kExternalizableValueHash);
+-        kSpecialCasesVersions.put(java.rmi.Remote.class, kRemoteValueHash);
+-    }
+-
+-    private static final Hashtable kSpecialCasesClasses = new Hashtable();
+-
+-    static {
+-        kSpecialCasesClasses.put(kWStringTypeStr, java.lang.String.class);
+-        kSpecialCasesClasses.put(kClassDescTypeStr, java.lang.Class.class);
+-        kSpecialCasesClasses.put(kRemoteTypeStr, java.rmi.Remote.class);
+-
+-        kSpecialCasesClasses.put("org.omg.CORBA.WStringValue", java.lang.String.class);
+-        kSpecialCasesClasses.put("javax.rmi.CORBA.ClassDesc", java.lang.Class.class);
+-        //kSpecialCasesClasses.put(kRemoteTypeStr, java.rmi.Remote.class);
+-    }
+-
+-    private static final Hashtable kSpecialCasesArrayPrefix = new Hashtable();
+-
+-    static {
+-        kSpecialCasesArrayPrefix.put(java.lang.String.class, kValuePrefix + kSequencePrefix + kCORBAPrefix);
+-        kSpecialCasesArrayPrefix.put(java.lang.Class.class, kValuePrefix + kSequencePrefix + "javax/rmi/CORBA/");
+-        kSpecialCasesArrayPrefix.put(java.lang.Object.class, kValuePrefix + kSequencePrefix + "java/lang/");
+-        kSpecialCasesArrayPrefix.put(java.io.Serializable.class, kValuePrefix + kSequencePrefix + "java/io/");
+-        kSpecialCasesArrayPrefix.put(java.io.Externalizable.class, kValuePrefix + kSequencePrefix + "java/io/");
+-        kSpecialCasesArrayPrefix.put(java.rmi.Remote.class, kValuePrefix + kSequencePrefix + kCORBAPrefix);
+-    }
+-
+-    private static final Hashtable kSpecialPrimitives = new Hashtable();
+-
+-    static {
+-        kSpecialPrimitives.put("int","long");
+-        kSpecialPrimitives.put("long","longlong");
+-        kSpecialPrimitives.put("byte","octet");
+-    }
+-
+-    /**
+-     * Used to convert ascii to hex.
+-     */
+-    private static final byte ASCII_HEX[] =     {
+-        (byte)'0',
+-        (byte)'1',
+-        (byte)'2',
+-        (byte)'3',
+-        (byte)'4',
+-        (byte)'5',
+-        (byte)'6',
+-        (byte)'7',
+-        (byte)'8',
+-        (byte)'9',
+-        (byte)'A',
+-        (byte)'B',
+-        (byte)'C',
+-        (byte)'D',
+-        (byte)'E',
+-        (byte)'F',
+-    };
+-
+-
+-    // Interface Rep ID Strings
+-    public static final String kjava_rmi_Remote = createForAnyType(java.rmi.Remote.class);
+-    public static final String korg_omg_CORBA_Object = createForAnyType(org.omg.CORBA.Object.class);
+-
+-    // Dummy arguments for getIdFromHelper method
+-    public static final Class kNoParamTypes[] ={};
+-    public static final Object kNoArgs[] = {};
+-
+-
+-    RepositoryId_1_3(){}
+-
+-    RepositoryId_1_3(String aRepId){
+-        init(aRepId);
+-    }
+-
+-    RepositoryId_1_3 init(String aRepId){
+-
+-        this.repId = aRepId;
+-
+-        // Special case for remote
+-        if (aRepId.length() == 0) {
+-            clazz = java.rmi.Remote.class;
+-            typeString = "";
+-            isRMIValueType = true;
+-            suid = kInterfaceOnlyHashStr;
+-            return this;
+-        }
+-        else if (aRepId.equals(kWStringValueRepID)) {
+-            clazz = java.lang.String.class;
+-            typeString = kWStringTypeStr;
+-            isIDLType = true;
+-            versionString = kWStringValueVersion;
+-            return this;
+-        }
+-        else {
+-
+-        String repId = convertFromISOLatin1(aRepId);
+-
+-        versionString = repId.substring(repId.indexOf(':', repId.indexOf(':')+1));
+-        if (repId.startsWith(kIDLPrefix)) {
+-            typeString =
+-                repId.substring(kIDLPrefixLength, repId.indexOf(':', kIDLPrefixLength));
+-            isIDLType = true;
+-            if (typeString.startsWith(kIDLNamePrefix))
+-                completeClassName = kIDLClassnamePrefix +
+-                    typeString.substring(kIDLNamePrefix.length()).replace('/','.');
+-            else completeClassName = typeString.replace('/','.');
+-
+-        }
+-        else if (repId.startsWith(kValuePrefix)) {
+-            typeString =
+-                repId.substring(kValuePrefixLength, repId.indexOf(':', kValuePrefixLength));
+-            isRMIValueType = true;
+-
+-            if (versionString.indexOf('.') == -1) {
+-                    actualSuid = versionString.substring(1);
+-                    suid = actualSuid;  // default if not explicitly specified
+-
+-                    if (actualSuid.indexOf(':') != -1){
+-                    // we have a declared hash also
+-                        int pos = actualSuid.indexOf(':')+1;
+-                        // actualSuid = suid.substring(pos);
+-                        // suid = suid.substring(0, pos-1);
+-                        suid = actualSuid.substring(pos);
+-                        actualSuid = actualSuid.substring(0, pos-1);
+-                }
+-
+-            }
+-            else {
+-                    // _REVISIT_ : Special case version failure ?
+-            }
+-        }
+-        else isSupportedFormat = false;
+-
+-        if (typeString.startsWith(kSequencePrefix)) {
+-            isSequence = true;
+-        }
+-
+-
+-        return this;
+-    }
+-    }
+-
+-    public final String getUnqualifiedName() {
+-        if (unqualifiedName == null){
+-            String className = getClassName();
+-            int index = (className != null) ? className.lastIndexOf('.') : -1;
+-            if (index == -1){
+-                unqualifiedName = className;
+-                definedInId = "IDL::1.0";
+-            }
+-            else {
+-                unqualifiedName = className.substring(index);
+-                definedInId = "IDL:" + className.substring(0, index).replace('.','/') + ":1.0";
+-            }
+-        }
+-
+-        return unqualifiedName;
+-    }
+-
+-    public final String getDefinedInId() {
+-        if (definedInId == null){
+-            getUnqualifiedName();
+-        }
+-
+-        return definedInId;
+-    }
+-
+-    public final String getTypeString() {
+-        return typeString;
+-    }
+-
+-    public final String getVersionString() {
+-        return versionString;
+-    }
+-
+-    public final String getSerialVersionUID() {
+-        return suid;
+-    }
+-
+-    public final String getActualSerialVersionUID() {
+-        return actualSuid;
+-    }
+-    public final long getSerialVersionUIDAsLong() {
+-        return suidLong;
+-    }
+-
+-    public final long getActualSerialVersionUIDAsLong() {
+-        return actualSuidLong;
+-    }
+-
+-    public final boolean isRMIValueType() {
+-        return isRMIValueType;
+-    }
+-
+-    public final boolean isIDLType() {
+-        return isIDLType;
+-    }
+-
+-    public final String getRepositoryId() {
+-        return repId;
+-    }
+-
+-    public static byte[] getByteArray(String repStr) {
+-        synchronized (repStrToByteArray){
+-            return (byte[]) repStrToByteArray.get(repStr);
+-        }
+-    }
+-
+-    public static void setByteArray(String repStr, byte[] repStrBytes) {
+-        synchronized (repStrToByteArray){
+-            repStrToByteArray.put(repStr, repStrBytes);
+-        }
+-    }
+-
+-    public final boolean isSequence() {
+-        return isSequence;
+-    }
+-
+-    public final boolean isSupportedFormat() {
+-        return isSupportedFormat;
+-    }
+-
+-
+-    // This method will return the classname from the typestring OR if the classname turns out to be
+-    // a special class "pseudo" name, then the matching real classname is returned.
+-    public final String getClassName() {
+-
+-        if (isRMIValueType)
+-            return typeString;
+-        else if (isIDLType)
+-            return completeClassName;
+-        else return null;
+-
+-    }
+-
+-    // This method calls getClazzFromType() and falls back to the repStrToClass
+-    // cache if no class was found.  It's used where any class matching the
+-    // given repid is an acceptable result.
+-    public final Class getAnyClassFromType() throws ClassNotFoundException {
+-        try {
+-            return getClassFromType();
+-        } catch (ClassNotFoundException cnfe) {
+-            Class clz = (Class)repStrToClass.get(repId);
+-            if (clz != null)
+-                return clz;
+-            else
+-                throw cnfe;
+-        }
+-    }
+-
+-    public final Class getClassFromType()
+-        throws ClassNotFoundException {
+-        if (clazz != null)
+-            return clazz;
+-
+-        Class specialCase = (Class)kSpecialCasesClasses.get(getClassName());
+-
+-        if (specialCase != null){
+-            clazz = specialCase;
+-            return specialCase;
+-        }
+-        else
+-            {
+-                try{
+-                    return Util.loadClass(getClassName(), null, null);
+-                }
+-                catch(ClassNotFoundException cnfe){
+-                    if (defaultServerURL != null) {
+-                        try{
+-                            return getClassFromType(defaultServerURL);
+-                        }
+-                        catch(MalformedURLException mue){
+-                            throw cnfe;
+-                        }
+-                    }
+-                    else throw cnfe;
+-                }
+-            }
+-
+-    }
+-
+-    public final Class getClassFromType(Class expectedType, String codebase)
+-        throws ClassNotFoundException {
+-        if (clazz != null)
+-            return clazz;
+-
+-        Class specialCase = (Class)kSpecialCasesClasses.get(getClassName());
+-
+-        if (specialCase != null){
+-            clazz = specialCase;
+-            return specialCase;
+-        } else {
+-            ClassLoader expectedTypeClassLoader = (expectedType == null ? null : expectedType.getClassLoader());
+-            return loadClassOfType(getClassName(),
+-                                            codebase,
+-                                            expectedTypeClassLoader,
+-                                            expectedType,
+-                                            expectedTypeClassLoader);
+-        }
+-
+-    }
+-
+-    public final Class getClassFromType(String url)
+-        throws ClassNotFoundException, MalformedURLException {
+-        return Util.loadClass(getClassName(), url, null);
+-    }
+-
+-    public final String toString() {
+-        return repId;
+-    }
+-
+-    private static String createHashString(java.io.Serializable ser) {
+-
+-        return createHashString(ser.getClass());
+-    }
+-
+-    private static String createHashString(java.lang.Class clazz) {
+-
+-        if (clazz.isInterface() || !java.io.Serializable.class.isAssignableFrom(clazz))
+-            return kInterfaceHashCode;
+-
+-
+-        long actualLong = ObjectStreamClassUtil_1_3.computeStructuralUID(false, clazz);
+-        String hash = null;
+-        if (actualLong == 0)
+-            hash = kInterfaceOnlyHashStr;
+-        else if (actualLong == 1)
+-            hash = kExternalizableHashStr;
+-        else
+-            hash = Long.toHexString(actualLong).toUpperCase();
+-        while(hash.length() < 16){
+-            hash = "0" + hash;
+-        }
+-
+-        long declaredLong = ObjectStreamClassUtil_1_3.computeSerialVersionUID(clazz);
+-        String declared = null;
+-        if (declaredLong == 0)
+-            declared = kInterfaceOnlyHashStr;
+-        else if (declaredLong == 1)
+-            declared = kExternalizableHashStr;
+-        else
+-            declared = Long.toHexString(declaredLong).toUpperCase();
+-        while (declared.length() < 16){
+-            declared = "0" + declared;
+-    }
+-        hash = hash + ":" + declared;
+-
+-        return ":" + hash;
+-    }
+-
+-    /**
+-     * Creates a repository ID for a sequence.  This is for expert users only as
+-     * this method assumes the object passed is an array.  If passed an object
+-     * that is not an array, it will produce a rep id for a sequence of zero
+-     * length.  This would be an error.
+-     * @param ser The Java object to create a repository ID for
+-     **/
+-    public static String createSequenceRepID(java.lang.Object ser){
+-        return createSequenceRepID(ser.getClass());
+-    }
+-
+-    /**
+-     * Creates a repository ID for a sequence.  This is for expert users only as
+-     * this method assumes the object passed is an array.  If passed an object
+-     * that is not an array, it will produce a malformed rep id.
+-     * @param clazz The Java class to create a repository ID for
+-     **/
+-    public static String createSequenceRepID(java.lang.Class clazz){
+-        synchronized (classSeqToRepStr){
+-
+-        String repid = (String)classSeqToRepStr.get(clazz);
+-        if (repid != null)
+-            return repid;
+-
+-        Class originalClazz = clazz;
+-
+-        Class type = null;
+-        int numOfDims = 0;
+-
+-        while ((type = clazz.getComponentType()) != null) {
+-            numOfDims++;
+-            clazz = type;
+-        }
+-
+-        if (clazz.isPrimitive())
+-            repid = kValuePrefix + originalClazz.getName() + kPrimitiveSequenceValueHash;
+-        else {
+-            StringBuffer buf = new StringBuffer();
+-            buf.append(kValuePrefix);
+-            while(numOfDims-- > 0) {
+-                buf.append("[");
+-            }
+-            buf.append("L");
+-            buf.append(convertToISOLatin1(clazz.getName()));
+-            buf.append(";");
+-            buf.append(createHashString(clazz));
+-            repid = buf.toString();
+-        }
+-        classSeqToRepStr.put(originalClazz,repid);
+-        return repid;
+-        }
+-
+-    }
+-
+-
+-    public static String createForSpecialCase(java.lang.Class clazz){
+-        if (clazz.isArray()){
+-            return createSequenceRepID(clazz);
+-        }
+-        else {
+-            return (String)kSpecialCasesRepIDs.get(clazz);
+-        }
+-    }
+-
+-    public static String createForSpecialCase(java.io.Serializable ser){
+-        Class clazz = ser.getClass();
+-        if (clazz.isArray()){
+-            return createSequenceRepID(ser);
+-        }
+-        else
+-            return createForSpecialCase(clazz);
+-    }
+-
+-    /**
+-     * Creates a repository ID for a normal Java Type.
+-     * @param ser The Java object to create a repository ID for
+-     * @exception com.sun.corba.se.impl.io.TypeMismatchException if ser implements the
+-     * org.omg.CORBA.portable.IDLEntity interface which indicates it is an IDL Value type.
+-     **/
+-    public static String createForJavaType(java.io.Serializable ser)
+-        throws com.sun.corba.se.impl.io.TypeMismatchException
+-    {
+-        synchronized (classToRepStr) {
+-        String repid = createForSpecialCase(ser);
+-        if (repid != null)
+-            return repid;
+-        Class clazz = ser.getClass();
+-        repid = (String)classToRepStr.get(clazz);
+-
+-        if (repid != null)
+-            return repid;
+-
+-        repid = kValuePrefix + convertToISOLatin1(clazz.getName()) +
+-            createHashString(clazz);
+-
+-        classToRepStr.put(clazz, repid);
+-            repStrToClass.put(repid, clazz);
+-        return repid;
+-    }
+-    }
+-
+-    /**
+-     * Creates a repository ID for a normal Java Type.
+-     * @param clz The Java class to create a repository ID for
+-     * @exception com.sun.corba.se.impl.io.TypeMismatchException if ser implements the
+-     * org.omg.CORBA.portable.IDLEntity interface which indicates it is an IDL Value type.
+-     **/
+-    public static String createForJavaType(Class clz)
+-        throws com.sun.corba.se.impl.io.TypeMismatchException
+-    {
+-        synchronized (classToRepStr){
+-        String repid = createForSpecialCase(clz);
+-        if (repid != null)
+-            return repid;
+-
+-        repid = (String)classToRepStr.get(clz);
+-        if (repid != null)
+-            return repid;
+-
+-        repid = kValuePrefix + convertToISOLatin1(clz.getName()) +
+-            createHashString(clz);
+-
+-        classToRepStr.put(clz, repid);
+-            repStrToClass.put(repid, clz);
+-        return repid;
+-    }
+-    }
+-
+-    /**
+-     * Creates a repository ID for an IDL Java Type.
+-     * @param ser The IDL Value object to create a repository ID for
+-     * @param major The major version number
+-     * @param minor The minor version number
+-     * @exception com.sun.corba.se.impl.io.TypeMismatchException if ser does not implement the
+-     * org.omg.CORBA.portable.IDLEntity interface which indicates it is an IDL Value type.
+-     **/
+-    public static String createForIDLType(Class ser, int major, int minor)
+-        throws com.sun.corba.se.impl.io.TypeMismatchException
+-    {
+-        synchronized (classIDLToRepStr){
+-        String repid = (String)classIDLToRepStr.get(ser);
+-        if (repid != null)
+-            return repid;
+-
+-        repid = kIDLPrefix + convertToISOLatin1(ser.getName()).replace('.','/') +
+-            ":" + major + "." + minor;
+-        classIDLToRepStr.put(ser, repid);
+-        return repid;
+-    }
+-    }
+-
+-    private static String getIdFromHelper(Class clazz){
+-        try {
+-            Class helperClazz = Utility.loadClassForClass(clazz.getName()+"Helper", null,
+-                                    clazz.getClassLoader(), clazz, clazz.getClassLoader());
+-            Method idMethod = helperClazz.getDeclaredMethod("id", kNoParamTypes);
+-            return (String)idMethod.invoke(null, kNoArgs);
+-        }
+-        catch(java.lang.ClassNotFoundException cnfe)
+-            {
+-                throw new org.omg.CORBA.MARSHAL(cnfe.toString());
+-            }
+-        catch(java.lang.NoSuchMethodException nsme)
+-            {
+-                throw new org.omg.CORBA.MARSHAL(nsme.toString());
+-            }
+-        catch(java.lang.reflect.InvocationTargetException ite)
+-            {
+-                throw new org.omg.CORBA.MARSHAL(ite.toString());
+-            }
+-        catch(java.lang.IllegalAccessException iae)
+-            {
+-                throw new org.omg.CORBA.MARSHAL(iae.toString());
+-    }
+-    }
+-
+-    /**
+-     * Createa a repository ID for the type if it is either a java type
+-     * or an IDL type.
+-     * @param type The type to create rep. id for
+-     * @return The rep. id.
+-     **/
+-    public static String createForAnyType(Class type) {
+-        try{
+-            if (type.isArray())
+-                return createSequenceRepID(type);
+-            else if (IDLEntity.class.isAssignableFrom(type))
+-                {
+-                    try{
+-                        return getIdFromHelper(type);
+-                    }
+-                    catch(Throwable t) {
+-                        return createForIDLType(type, 1, 0);
+-                    }
+-                }
+-            else return createForJavaType(type);
+-        }
+-        catch(com.sun.corba.se.impl.io.TypeMismatchException e){
+-            return null;
+-        }
+-
+-    }
+-
+-    public static boolean isAbstractBase(Class clazz) {
+-        return (clazz.isInterface() &&
+-                IDLEntity.class.isAssignableFrom(clazz) &&
+-                (!ValueBase.class.isAssignableFrom(clazz)) &&
+-                (!org.omg.CORBA.Object.class.isAssignableFrom(clazz)));
+-
+-    }
+-
+-    /**
+-     * Convert strings with illegal IDL identifier characters.
+-     * <p>
+-     * Section 5.5.7 of OBV spec.
+-     */
+-    private static String convertToISOLatin1 (String name) {
+-
+-        int length = name.length();
+-        if (length == 0) {
+-            return name;
+-        }
+-        StringBuffer buffer = null;
+-
+-        for (int i = 0; i < length; i++) {
+-
+-            char c = name.charAt(i);
+-
+-            if (c > 255 || IDL_IDENTIFIER_CHARS[c] == 0) {
+-
+-                // We gotta convert. Have we already started?
+-
+-                if (buffer == null) {
+-
+-                    // No, so get set up...
+-
+-                    buffer = new StringBuffer(name.substring(0,i));
+-                }
+-
+-                // Convert the character into the IDL escape syntax...
+-                buffer.append(
+-                              "\\U" +
+-                              (char)ASCII_HEX[(c & 0xF000) >>> 12] +
+-                              (char)ASCII_HEX[(c & 0x0F00) >>> 8] +
+-                              (char)ASCII_HEX[(c & 0x00F0) >>> 4] +
+-                              (char)ASCII_HEX[(c & 0x000F)]);
+-
+-            } else {
+-                if (buffer != null) {
+-                    buffer.append(c);
+-                }
+-            }
+-        }
+-
+-        if (buffer != null) {
+-            name = buffer.toString();
+-        }
+-
+-        return name;
+-    }
+-
+-    /**
+-     * Convert strings with ISO Latin 1 escape sequences back to original strings.
+-     * <p>
+-     * Section 5.5.7 of OBV spec.
+-     */
+-    private static String convertFromISOLatin1 (String name) {
+-
+-        int index = -1;
+-        StringBuffer buf = new StringBuffer(name);
+-
+-        while ((index = buf.toString().indexOf("\\U")) != -1){
+-            String str = "0000" + buf.toString().substring(index+2, index+6);
+-
+-            // Convert Hexadecimal
+-            byte[] buffer = new byte[(str.length() - 4) / 2];
+-            for (int i=4, j=0; i < str.length(); i +=2, j++) {
+-                buffer[j] = (byte)((ORBUtility.hexOf(str.charAt(i)) << 4) & 0xF0);
+-                buffer[j] |= (byte)((ORBUtility.hexOf(str.charAt(i+1)) << 0) & 0x0F);
+-            }
+-            buf = new StringBuffer(delete(buf.toString(), index, index+6));
+-            buf.insert(index, (char)buffer[1]);
+-        }
+-
+-        return buf.toString();
+-
+-
+-    }
+-
+-    private static String delete(String str, int from, int to)
+-    {
+-        return str.substring(0, from) + str.substring(to, str.length());
+-    }
+-
+-    private static String replace(String target, String arg, String source)
+-    {
+-        int i = 0;
+-        i = target.indexOf(arg);
+-
+-        while(i != -1)
+-            {
+-                String left = target.substring(0, i);
+-                String right = target.substring(i+arg.length());
+-                target = new String(left+source+right);
+-                i = target.indexOf(arg);
+-            }
+-        return target;
+-    }
+-
+-    /*
+-     * Load a class and check that it is assignable to a given type.
+-     * @param className the class name.
+-     * @param remoteCodebase the codebase to use. May be null.
+-     * @param loader the class loader of last resort. May be null.
+-     * @param expectedType the expected type. May be null.
+-     * @return the loaded class.
+-     */
+-    private Class loadClassOfType (String className,
+-                                  String remoteCodebase,
+-                                  ClassLoader loader,
+-                                  Class expectedType,
+-                                  ClassLoader expectedTypeClassLoader)
+-        throws ClassNotFoundException {
+-
+-        Class loadedClass = null;
+-
+-        try {
+-            //Sequence finding of the stubs according to spec
+-            try{
+-                //If-else is put here for speed up of J2EE.
+-                //According to the OMG spec, the if clause is not dead code.
+-                //It can occur if some compiler has allowed generation
+-                //into org.omg.stub hierarchy for non-offending
+-                //classes. This will encourage people to
+-                //produce non-offending class stubs in their own hierarchy.
+-                if(!PackagePrefixChecker
+-                   .hasOffendingPrefix(PackagePrefixChecker
+-                                       .withoutPackagePrefix(className))){
+-                    loadedClass = Util.loadClass
+-                        (PackagePrefixChecker.withoutPackagePrefix(className),
+-                         remoteCodebase,
+-                         loader);
+-                } else {
+-                    loadedClass = Util.loadClass
+-                        (className,
+-                         remoteCodebase,
+-                         loader);
+-                }
+-            } catch (ClassNotFoundException cnfe) {
+-                loadedClass = Util.loadClass
+-                    (className,
+-                     remoteCodebase,
+-                     loader);
+-            }
+-            if (expectedType == null)
+-                return loadedClass;
+-        } catch (ClassNotFoundException cnfe) {
+-            if (expectedType == null)
+-                throw cnfe;
+-        }
+-
+-        // If no class was not loaded, or if the loaded class is not of the
+-        // correct type, make a further attempt to load the correct class
+-        // using the classloader of the expected type.
+-        // _REVISIT_ Is this step necessary, or should the Util,loadClass
+-        // algorithm always produce a valid class if the setup is correct?
+-        // Does the OMG standard algorithm need to be changed to include
+-        // this step?
+-        if (loadedClass == null || !expectedType.isAssignableFrom(loadedClass)) {
+-            if (expectedType.getClassLoader() != expectedTypeClassLoader)
+-                throw new IllegalArgumentException("expectedTypeClassLoader not class loader of expectedType.");
+-
+-            if (expectedTypeClassLoader != null)
+-                loadedClass = expectedTypeClassLoader.loadClass(className);
+-            else
+-                loadedClass = ORBClassLoader.loadClass(className);
+-        }
+-
+-        return loadedClass;
+-    }
+-
+-    /**
+-     * Checks to see if the FullValueDescription should be retrieved.
+-     * @exception Throws IOException if suids do not match or if the repositoryID
+-     * is not an RMIValueType
+-     */
+-    public static boolean useFullValueDescription(Class clazz, String repositoryID)
+-        throws IOException{
+-
+-        String clazzRepIDStr = createForAnyType(clazz);
+-
+-        if (clazzRepIDStr.equals(repositoryID))
+-            return false;
+-
+-        RepositoryId_1_3 targetRepid;
+-        RepositoryId_1_3 clazzRepid;
+-
+-        synchronized(cache) {
+-        // to avoid race condition where multiple threads could be
+-        // accessing this method, and their access to the cache may
+-        // be interleaved giving unexpected results
+-
+-            targetRepid = cache.getId(repositoryID);
+-            clazzRepid = cache.getId(clazzRepIDStr);
+-        }
+-
+-        if ((targetRepid.isRMIValueType()) && (clazzRepid.isRMIValueType())){
+-            if (!targetRepid.getSerialVersionUID().equals(clazzRepid.getSerialVersionUID())) {
+-
+-                String mssg = "Mismatched serialization UIDs : Source (Rep. ID" +
+-                    clazzRepid + ") = " +
+-                    clazzRepid.getSerialVersionUID() + " whereas Target (Rep. ID " + repositoryID +
+-                    ") = " + targetRepid.getSerialVersionUID();
+-                throw new IOException(mssg);
+-            } else {
+-                return true;
+-            }
+-        } else {
+-
+-            throw new IOException("The repository ID is not of an RMI value type (Expected ID = " + clazzRepIDStr + "; Received ID = " + repositoryID +")");
+-        }
+-    }
+-}
+diff --git a/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryId_1_3_1.java b/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryId_1_3_1.java
+deleted file mode 100644
+--- corba/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryId_1_3_1.java
++++ /dev/null
+@@ -1,1065 +0,0 @@
+-/*
+- * 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
+- * 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.corba.se.impl.orbutil;
+-
+-import java.util.StringTokenizer;
+-import java.util.Hashtable;
+-import java.io.IOException;
+-import java.lang.reflect.Method;
+-import java.net.MalformedURLException;
+-import org.omg.CORBA.portable.ValueBase;
+-import org.omg.CORBA.portable.IDLEntity;
+-
+-//d11638 files in the same package, therefore remove their reference
+-//import com.sun.corba.se.impl.util.JDKBridge;
+-//import com.sun.corba.se.impl.util.IdentityHashtable;
+-import com.sun.corba.se.impl.util.JDKBridge;
+-import com.sun.corba.se.impl.util.Utility;
+-import com.sun.corba.se.impl.util.PackagePrefixChecker;
+-import com.sun.corba.se.impl.util.IdentityHashtable;
+-
+-import javax.rmi.CORBA.Util;
+-
+-/**
+- * Because all methods in RepositoryId are static, we have
+- * to duplicate all of this code, freezing it in its 1.3.1
+- * form for backwards compatibility.
+- *
+- * For security reasons, we can't expose enough of
+- * io/ObjectStreamClass, so it has to be duplicated in
+- * orbutil.
+- */
+-public class RepositoryId_1_3_1 {
+-
+-    // Legal IDL Identifier characters (1 = legal). Note
+-    // that '.' (2E) is marked as legal even though it is
+-    // not legal in IDL. This allows us to treat a fully
+-    // qualified Java name with '.' package separators
+-    // uniformly, and is safe because that is the only
+-    // legal use of '.' in a Java name.
+-
+-    private static final byte[] IDL_IDENTIFIER_CHARS = {
+-
+-        // 0 1 2 3  4 5 6 7  8 9 a b  c d e f
+-        0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 00-0f
+-        0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 10-1f
+-        0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,1,0, // 20-2f
+-        1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0, // 30-3f
+-        0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 40-4f
+-        1,1,1,1, 1,1,1,1, 1,1,1,0, 0,0,0,1, // 50-5f
+-        0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 60-6f
+-        1,1,1,1, 1,1,1,1, 1,1,1,0, 0,0,0,0, // 70-7f
+-        0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 80-8f
+-        0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 90-9f
+-        0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // a0-af
+-        0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // b0-bf
+-        1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // c0-cf
+-        0,1,1,1, 1,1,1,0, 1,1,1,1, 1,0,0,1, // d0-df
+-        1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // e0-ef
+-        0,1,1,1, 1,1,1,0, 1,1,1,1, 1,0,0,1, // f0-ff
+-    };
+-
+-
+-    private static final long serialVersionUID = 123456789L;
+-
+-    private static String defaultServerURL = null;
+-    private static boolean useCodebaseOnly = false;
+-
+-    static {
+-        if (defaultServerURL == null)
+-            defaultServerURL = (String)JDKBridge.getLocalCodebase();
+-        useCodebaseOnly = JDKBridge.useCodebaseOnly();
+-
+-    }
+-
+-    private static IdentityHashtable classToRepStr = new IdentityHashtable();
+-    private static IdentityHashtable classIDLToRepStr = new IdentityHashtable();
+-    private static IdentityHashtable classSeqToRepStr = new IdentityHashtable();
+-
+-    private static IdentityHashtable repStrToByteArray = new IdentityHashtable();
+-    private static Hashtable repStrToClass = new Hashtable();
+-
+-    private String repId = null;
+-    private boolean isSupportedFormat = true;
+-    private String typeString = null;
+-    private String versionString = null;
+-    private boolean isSequence = false;
+-    private boolean isRMIValueType = false;
+-    private boolean isIDLType = false;
+-    private String completeClassName = null;
+-    private String unqualifiedName = null;
+-    private String definedInId = null;
+-    private Class clazz = null;
+-    private String suid = null, actualSuid = null;
+-    private long suidLong = ObjectStreamClass_1_3_1.kDefaultUID, actualSuidLong = ObjectStreamClass_1_3_1.kDefaultUID;
+-
+-    // Repository ID fragments
+-    private static final String kSequenceKeyword = "seq";
+-    private static final String kValuePrefix = "RMI:";
+-    private static final String kIDLPrefix = "IDL:";
+-    private static final String kIDLNamePrefix = "omg.org/";
+-    private static final String kIDLClassnamePrefix = "org.omg.";
+-    private static final String kSequencePrefix = "[";
+-    private static final String kCORBAPrefix = "CORBA/";
+-    private static final String kArrayPrefix = kValuePrefix + kSequencePrefix + kCORBAPrefix;
+-    private static final int kValuePrefixLength = kValuePrefix.length();
+-    private static final int kIDLPrefixLength = kIDLPrefix.length();
+-    private static final int kSequencePrefixLength = kSequencePrefix.length();
+-    private static final String kInterfaceHashCode = ":0000000000000000";
+-    private static final String kInterfaceOnlyHashStr = "0000000000000000";
+-    private static final String kExternalizableHashStr = "0000000000000001";
+-
+-    // Value tag utility methods and constants
+-    public static final int kInitialValueTag= 0x7fffff00;
+-    public static final int kNoTypeInfo = 0;
+-    public static final int kSingleRepTypeInfo = 0x02;
+-    public static final int  kPartialListTypeInfo = 0x06;
+-    public static final int  kChunkedMask = 0x08;
+-    public static final int kPreComputed_StandardRMIUnchunked = RepositoryId_1_3_1.computeValueTag(false, RepositoryId_1_3_1.kSingleRepTypeInfo, false);
+-    public static final int kPreComputed_CodeBaseRMIUnchunked = RepositoryId_1_3_1.computeValueTag(true, RepositoryId_1_3_1.kSingleRepTypeInfo, false);
+-    public static final int kPreComputed_StandardRMIChunked = RepositoryId_1_3_1.computeValueTag(false, RepositoryId_1_3_1.kSingleRepTypeInfo, true);
+-    public static final int kPreComputed_CodeBaseRMIChunked = RepositoryId_1_3_1.computeValueTag(true, RepositoryId_1_3_1.kSingleRepTypeInfo, true);
+-
+-    public static final int kPreComputed_StandardRMIUnchunked_NoRep = RepositoryId_1_3_1.computeValueTag(false, RepositoryId_1_3_1.kNoTypeInfo, false);
+-    public static final int kPreComputed_CodeBaseRMIUnchunked_NoRep = RepositoryId_1_3_1.computeValueTag(true, RepositoryId_1_3_1.kNoTypeInfo, false);
+-    public static final int kPreComputed_StandardRMIChunked_NoRep = RepositoryId_1_3_1.computeValueTag(false, RepositoryId_1_3_1.kNoTypeInfo, true);
+-    public static final int kPreComputed_CodeBaseRMIChunked_NoRep = RepositoryId_1_3_1.computeValueTag(true, RepositoryId_1_3_1.kNoTypeInfo, true);
+-
+-    // Public, well known repository IDs
+-
+-    // _REVISIT_ : A table structure with a good search routine for all of this
+-    // would be more efficient and easier to maintain...
+-
+-    // String
+-    public static final String kWStringValueVersion = "1.0";
+-    public static final String kWStringValueHash = ":"+kWStringValueVersion;
+-    public static final String kWStringStubValue = "WStringValue";
+-    public static final String kWStringTypeStr = "omg.org/CORBA/"+kWStringStubValue;
+-    public static final String kWStringValueRepID = kIDLPrefix + kWStringTypeStr + kWStringValueHash;
+-
+-    // Any
+-    public static final String kAnyRepID = kIDLPrefix + "omg.org/CORBA/Any";
+-
+-    // Class
+-    // Anita4: convert to uppercase
+-    public static final String kClassDescValueHash = ":" +
+-       Long.toHexString(
+-       ObjectStreamClass_1_3_1.getActualSerialVersionUID(javax.rmi.CORBA.ClassDesc.class)).toUpperCase() + ":" +
+-      Long.toHexString(
+-       ObjectStreamClass_1_3_1.getSerialVersionUID(javax.rmi.CORBA.ClassDesc.class)).toUpperCase();
+-    public static final String kClassDescStubValue = "ClassDesc";
+-    public static final String kClassDescTypeStr = "javax.rmi.CORBA."+kClassDescStubValue;
+-    public static final String kClassDescValueRepID = kValuePrefix + kClassDescTypeStr + kClassDescValueHash;
+-
+-    // Object
+-    public static final String kObjectValueHash = ":1.0";
+-    public static final String kObjectStubValue = "Object";
+-
+-    // Sequence
+-    public static final String kSequenceValueHash = ":1.0";
+-    public static final String kPrimitiveSequenceValueHash = ":0000000000000000";
+-
+-    // Serializable
+-    public static final String kSerializableValueHash = ":1.0";
+-    public static final String kSerializableStubValue = "Serializable";
+-
+-    // Externalizable
+-    public static final String kExternalizableValueHash = ":1.0";
+-    public static final String kExternalizableStubValue = "Externalizable";
+-
+-    // Remote (The empty string is used for java.rmi.Remote)
+-    public static final String kRemoteValueHash = "";
+-    public static final String kRemoteStubValue = "";
+-    public static final String kRemoteTypeStr = "";
+-    public static final String kRemoteValueRepID = "";
+-
+-    private static final Hashtable kSpecialArrayTypeStrings = new Hashtable();
+-
+-    static {
+-        kSpecialArrayTypeStrings.put("CORBA.WStringValue", new StringBuffer(java.lang.String.class.getName()));
+-        kSpecialArrayTypeStrings.put("javax.rmi.CORBA.ClassDesc", new StringBuffer(java.lang.Class.class.getName()));
+-        kSpecialArrayTypeStrings.put("CORBA.Object", new StringBuffer(java.rmi.Remote.class.getName()));
+-
+-    }
+-
+-    private static final Hashtable kSpecialCasesRepIDs = new Hashtable();
+-
+-    static {
+-        kSpecialCasesRepIDs.put(java.lang.String.class, kWStringValueRepID);
+-        kSpecialCasesRepIDs.put(java.lang.Class.class, kClassDescValueRepID);
+-        kSpecialCasesRepIDs.put(java.rmi.Remote.class, kRemoteValueRepID);
+-    }
+-
+-    private static final Hashtable kSpecialCasesStubValues = new Hashtable();
+-
+-    static {
+-        kSpecialCasesStubValues.put(java.lang.String.class, kWStringStubValue);
+-        kSpecialCasesStubValues.put(java.lang.Class.class, kClassDescStubValue);
+-        kSpecialCasesStubValues.put(java.lang.Object.class, kObjectStubValue);
+-        kSpecialCasesStubValues.put(java.io.Serializable.class, kSerializableStubValue);
+-        kSpecialCasesStubValues.put(java.io.Externalizable.class, kExternalizableStubValue);
+-        kSpecialCasesStubValues.put(java.rmi.Remote.class, kRemoteStubValue);
+-    }
+-
+-
+-    private static final Hashtable kSpecialCasesVersions = new Hashtable();
+-
+-    static {
+-        kSpecialCasesVersions.put(java.lang.String.class, kWStringValueHash);
+-        kSpecialCasesVersions.put(java.lang.Class.class, kClassDescValueHash);
+-        kSpecialCasesVersions.put(java.lang.Object.class, kObjectValueHash);
+-        kSpecialCasesVersions.put(java.io.Serializable.class, kSerializableValueHash);
+-        kSpecialCasesVersions.put(java.io.Externalizable.class, kExternalizableValueHash);
+-        kSpecialCasesVersions.put(java.rmi.Remote.class, kRemoteValueHash);
+-    }
+-
+-    private static final Hashtable kSpecialCasesClasses = new Hashtable();
+-
+-    static {
+-        kSpecialCasesClasses.put(kWStringTypeStr, java.lang.String.class);
+-        kSpecialCasesClasses.put(kClassDescTypeStr, java.lang.Class.class);
+-        kSpecialCasesClasses.put(kRemoteTypeStr, java.rmi.Remote.class);
+-
+-        kSpecialCasesClasses.put("org.omg.CORBA.WStringValue", java.lang.String.class);
+-        kSpecialCasesClasses.put("javax.rmi.CORBA.ClassDesc", java.lang.Class.class);
+-        //kSpecialCasesClasses.put(kRemoteTypeStr, java.rmi.Remote.class);
+-    }
+-
+-    private static final Hashtable kSpecialCasesArrayPrefix = new Hashtable();
+-
+-    static {
+-        kSpecialCasesArrayPrefix.put(java.lang.String.class, kValuePrefix + kSequencePrefix + kCORBAPrefix);
+-        kSpecialCasesArrayPrefix.put(java.lang.Class.class, kValuePrefix + kSequencePrefix + "javax/rmi/CORBA/");
+-        kSpecialCasesArrayPrefix.put(java.lang.Object.class, kValuePrefix + kSequencePrefix + "java/lang/");
+-        kSpecialCasesArrayPrefix.put(java.io.Serializable.class, kValuePrefix + kSequencePrefix + "java/io/");
+-        kSpecialCasesArrayPrefix.put(java.io.Externalizable.class, kValuePrefix + kSequencePrefix + "java/io/");
+-        kSpecialCasesArrayPrefix.put(java.rmi.Remote.class, kValuePrefix + kSequencePrefix + kCORBAPrefix);
+-    }
+-
+-    private static final Hashtable kSpecialPrimitives = new Hashtable();
+-
+-    static {
+-        kSpecialPrimitives.put("int","long");
+-        kSpecialPrimitives.put("long","longlong");
+-        kSpecialPrimitives.put("byte","octet");
+-    }
+-
+-    /**
+-     * Used to convert ascii to hex.
+-     */
+-    private static final byte ASCII_HEX[] =     {
+-        (byte)'0',
+-        (byte)'1',
+-        (byte)'2',
+-        (byte)'3',
+-        (byte)'4',
+-        (byte)'5',
+-        (byte)'6',
+-        (byte)'7',
+-        (byte)'8',
+-        (byte)'9',
+-        (byte)'A',
+-        (byte)'B',
+-        (byte)'C',
+-        (byte)'D',
+-        (byte)'E',
+-        (byte)'F',
+-    };
+-
+-
+-    // bug fix for 4328952; to eliminate possibility of overriding this
+-    // in a subclass.
+-    public static final RepositoryIdCache_1_3_1 cache = new RepositoryIdCache_1_3_1();
+-
+-    // Interface Rep ID Strings
+-    public static final String kjava_rmi_Remote = createForAnyType(java.rmi.Remote.class);
+-    public static final String korg_omg_CORBA_Object = createForAnyType(org.omg.CORBA.Object.class);
+-
+-    // Dummy arguments for getIdFromHelper method
+-    public static final Class kNoParamTypes[] ={};
+-    public static final Object kNoArgs[] = {};
+-
+-
+-    // To create a RepositoryID, use code similar to the following:
+-    // RepositoryId.cache.getId( id );
+-
+-    RepositoryId_1_3_1(){}
+-
+-    RepositoryId_1_3_1(String aRepId){
+-        init(aRepId);
+-    }
+-
+-    RepositoryId_1_3_1 init(String aRepId){
+-
+-        this.repId = aRepId;
+-
+-        // Special case for remote
+-        if (aRepId.length() == 0) {
+-            clazz = java.rmi.Remote.class;
+-            typeString = "";
+-            isRMIValueType = true;
+-            suid = kInterfaceOnlyHashStr;
+-            return this;
+-        }
+-        else if (aRepId.equals(kWStringValueRepID)) {
+-            clazz = java.lang.String.class;
+-            typeString = kWStringTypeStr;
+-            isIDLType = true;
+-            // fix where Attempting to obtain a FullValueDescription
+-            // for an RMI value type with a String field causes an exception.
+-            completeClassName = "java.lang.String";
+-            versionString = kWStringValueVersion;
+-            return this;
+-        }
+-        else {
+-
+-        String repId = convertFromISOLatin1(aRepId);
+-
+-        versionString = repId.substring(repId.indexOf(':', repId.indexOf(':')+1));
+-        if (repId.startsWith(kIDLPrefix)) {
+-            typeString =
+-                repId.substring(kIDLPrefixLength, repId.indexOf(':', kIDLPrefixLength));
+-            isIDLType = true;
+-            if (typeString.startsWith(kIDLNamePrefix))
+-                completeClassName = kIDLClassnamePrefix +
+-                    typeString.substring(kIDLNamePrefix.length()).replace('/','.');
+-            else completeClassName = typeString.replace('/','.');
+-
+-        }
+-        else if (repId.startsWith(kValuePrefix)) {
+-            typeString =
+-                repId.substring(kValuePrefixLength, repId.indexOf(':', kValuePrefixLength));
+-            isRMIValueType = true;
+-
+-            if (versionString.indexOf('.') == -1) {
+-                    actualSuid = versionString.substring(1);
+-                    suid = actualSuid;  // default if not explicitly specified
+-
+-                    if (actualSuid.indexOf(':') != -1){
+-                    // we have a declared hash also
+-                        int pos = actualSuid.indexOf(':')+1;
+-                        // actualSuid = suid.substring(pos);
+-                        // suid = suid.substring(0, pos-1);
+-                        suid = actualSuid.substring(pos);
+-                        actualSuid = actualSuid.substring(0, pos-1);
+-                }
+-
+-            }
+-            else {
+-                    // _REVISIT_ : Special case version failure ?
+-            }
+-        }
+-        else isSupportedFormat = false;
+-
+-        if (typeString.startsWith(kSequencePrefix)) {
+-            isSequence = true;
+-        }
+-
+-
+-        return this;
+-    }
+-    }
+-
+-    public final String getUnqualifiedName() {
+-        if (unqualifiedName == null){
+-            String className = getClassName();
+-            int index = className.lastIndexOf('.');
+-            if (index == -1){
+-                unqualifiedName = className;
+-                definedInId = "IDL::1.0";
+-            }
+-            else {
+-                unqualifiedName = className.substring(index);
+-                definedInId = "IDL:" + className.substring(0, index).replace('.','/') + ":1.0";
+-            }
+-        }
+-
+-        return unqualifiedName;
+-    }
+-
+-    public final String getDefinedInId() {
+-        if (definedInId == null){
+-            getUnqualifiedName();
+-        }
+-
+-        return definedInId;
+-    }
+-
+-    public final String getTypeString() {
+-        return typeString;
+-    }
+-
+-    public final String getVersionString() {
+-        return versionString;
+-    }
+-
+-    public final String getSerialVersionUID() {
+-        return suid;
+-    }
+-
+-    public final String getActualSerialVersionUID() {
+-        return actualSuid;
+-    }
+-    public final long getSerialVersionUIDAsLong() {
+-        return suidLong;
+-    }
+-
+-    public final long getActualSerialVersionUIDAsLong() {
+-        return actualSuidLong;
+-    }
+-
+-    public final boolean isRMIValueType() {
+-        return isRMIValueType;
+-    }
+-
+-    public final boolean isIDLType() {
+-        return isIDLType;
+-    }
+-
+-    public final String getRepositoryId() {
+-        return repId;
+-    }
+-
+-    public static byte[] getByteArray(String repStr) {
+-        synchronized (repStrToByteArray){
+-            return (byte[]) repStrToByteArray.get(repStr);
+-        }
+-    }
+-
+-    public static void setByteArray(String repStr, byte[] repStrBytes) {
+-        synchronized (repStrToByteArray){
+-            repStrToByteArray.put(repStr, repStrBytes);
+-        }
+-    }
+-
+-    public final boolean isSequence() {
+-        return isSequence;
+-    }
+-
+-    public final boolean isSupportedFormat() {
+-        return isSupportedFormat;
+-    }
+-
+-
+-    // This method will return the classname from the typestring OR if the classname turns out to be
+-    // a special class "pseudo" name, then the matching real classname is returned.
+-    public final String getClassName() {
+-
+-        if (isRMIValueType)
+-            return typeString;
+-        else if (isIDLType)
+-            return completeClassName;
+-        else return null;
+-
+-    }
+-
+-    // This method calls getClazzFromType() and falls back to the repStrToClass
+-    // cache if no class was found.  It's used where any class matching the
+-    // given repid is an acceptable result.
+-    public final Class getAnyClassFromType() throws ClassNotFoundException {
+-        try {
+-            return getClassFromType();
+-        } catch (ClassNotFoundException cnfe) {
+-            Class clz = (Class)repStrToClass.get(repId);
+-            if (clz != null)
+-                return clz;
+-            else
+-                throw cnfe;
+-        }
+-    }
+-
+-    public final Class getClassFromType()
+-        throws ClassNotFoundException {
+-        if (clazz != null)
+-            return clazz;
+-
+-        Class specialCase = (Class)kSpecialCasesClasses.get(getClassName());
+-
+-        if (specialCase != null){
+-            clazz = specialCase;
+-            return specialCase;
+-        }
+-        else
+-            {
+-                try{
+-                    return Util.loadClass(getClassName(), null, null);
+-                }
+-                catch(ClassNotFoundException cnfe){
+-                    if (defaultServerURL != null) {
+-                        try{
+-                            return getClassFromType(defaultServerURL);
+-                        }
+-                        catch(MalformedURLException mue){
+-                            throw cnfe;
+-                        }
+-                    }
+-                    else throw cnfe;
+-                }
+-            }
+-
+-    }
+-
+-    public final Class getClassFromType(Class expectedType, String codebase)
+-        throws ClassNotFoundException {
+-        if (clazz != null)
+-            return clazz;
+-
+-        Class specialCase = (Class)kSpecialCasesClasses.get(getClassName());
+-
+-        if (specialCase != null){
+-            clazz = specialCase;
+-            return specialCase;
+-        } else {
+-            ClassLoader expectedTypeClassLoader = (expectedType == null ? null : expectedType.getClassLoader());
+-            return loadClassOfType(getClassName(),
+-                                   codebase,
+-                                   expectedTypeClassLoader,
+-                                   expectedType,
+-                                   expectedTypeClassLoader);
+-        }
+-
+-    }
+-
+-    public final Class getClassFromType(String url)
+-        throws ClassNotFoundException, MalformedURLException {
+-        return Util.loadClass(getClassName(), url, null);
+-    }
+-
+-    public final String toString() {
+-        return repId;
+-    }
+-
+-    /**
+-     * Checks to see if the FullValueDescription should be retrieved.
+-     * @exception Throws IOException if suids do not match or if the repositoryID
+-     * is not an RMIValueType
+-     */
+-    public static boolean useFullValueDescription(Class clazz, String repositoryID)
+-        throws IOException{
+-
+-        String clazzRepIDStr = createForAnyType(clazz);
+-
+-        if (clazzRepIDStr.equals(repositoryID))
+-            return false;
+-
+-        RepositoryId_1_3_1 targetRepid;
+-        RepositoryId_1_3_1 clazzRepid;
+-
+-        synchronized(cache) {
+-        // to avoid race condition where multiple threads could be
+-        // accessing this method, and their access to the cache may
+-        // be interleaved giving unexpected results
+-
+-            targetRepid = cache.getId(repositoryID);
+-            clazzRepid = cache.getId(clazzRepIDStr);
+-        }
+-        //ObjectStreamClass osc = ObjectStreamClass.lookup(clazz);
+-
+-        if ((targetRepid.isRMIValueType()) && (clazzRepid.isRMIValueType())){
+-            if (!targetRepid.getSerialVersionUID().equals(clazzRepid.getSerialVersionUID())) {
+-
+-                String mssg = "Mismatched serialization UIDs : Source (Rep. ID" +
+-                    clazzRepid + ") = " +
+-                    clazzRepid.getSerialVersionUID() + " whereas Target (Rep. ID " + repositoryID +
+-                    ") = " + targetRepid.getSerialVersionUID();
+-                                //com.sun.corba.se.impl.io.ValueUtility.log("RepositoryId",mssg);
+-                throw new IOException(mssg);
+-        }
+-            else {
+-                return true;
+-            }
+-        }
+-        else {
+-
+-            throw new IOException("The repository ID is not of an RMI value type (Expected ID = " + clazzRepIDStr + "; Received ID = " + repositoryID +")");
+-    }
+-    }
+-
+-    private static String createHashString(java.io.Serializable ser) {
+-
+-        return createHashString(ser.getClass());
+-    }
+-
+-    private static String createHashString(java.lang.Class clazz) {
+-
+-        if (clazz.isInterface() || !java.io.Serializable.class.isAssignableFrom(clazz))
+-            return kInterfaceHashCode;
+-
+-        //ObjectStreamClass osc = ObjectStreamClass.lookup(clazz);
+-
+-        long actualLong = ObjectStreamClass_1_3_1.getActualSerialVersionUID(clazz);
+-        String hash = null;
+-        if (actualLong == 0)
+-            hash = kInterfaceOnlyHashStr;
+-        else if (actualLong == 1)
+-            hash = kExternalizableHashStr;
+-        else
+-            hash = Long.toHexString(actualLong).toUpperCase();
+-        while(hash.length() < 16){
+-            hash = "0" + hash;
+-        }
+-
+-        long declaredLong = ObjectStreamClass_1_3_1.getSerialVersionUID(clazz);
+-        String declared = null;
+-        if (declaredLong == 0)
+-            declared = kInterfaceOnlyHashStr;
+-        else if (declaredLong == 1)
+-            declared = kExternalizableHashStr;
+-        else
+-            declared = Long.toHexString(declaredLong).toUpperCase();
+-        while (declared.length() < 16){
+-            declared = "0" + declared;
+-    }
+-        hash = hash + ":" + declared;
+-
+-        return ":" + hash;
+-    }
+-
+-    /**
+-     * Creates a repository ID for a sequence.  This is for expert users only as
+-     * this method assumes the object passed is an array.  If passed an object
+-     * that is not an array, it will produce a rep id for a sequence of zero
+-     * length.  This would be an error.
+-     * @param ser The Java object to create a repository ID for
+-     **/
+-    public static String createSequenceRepID(java.lang.Object ser){
+-        return createSequenceRepID(ser.getClass());
+-    }
+-
+-    /**
+-     * Creates a repository ID for a sequence.  This is for expert users only as
+-     * this method assumes the object passed is an array.  If passed an object
+-     * that is not an array, it will produce a malformed rep id.
+-     * @param clazz The Java class to create a repository ID for
+-     **/
+-    public static String createSequenceRepID(java.lang.Class clazz){
+-        synchronized (classSeqToRepStr){
+-
+-        String repid = (String)classSeqToRepStr.get(clazz);
+-        if (repid != null)
+-            return repid;
+-
+-        Class originalClazz = clazz;
+-
+-        Class type = null;
+-        int numOfDims = 0;
+-
+-        while ((type = clazz.getComponentType()) != null) {
+-            numOfDims++;
+-            clazz = type;
+-        }
+-
+-        if (clazz.isPrimitive())
+-            repid = kValuePrefix + originalClazz.getName() + kPrimitiveSequenceValueHash;
+-        else {
+-            StringBuffer buf = new StringBuffer();
+-            buf.append(kValuePrefix);
+-            while(numOfDims-- > 0) {
+-                buf.append("[");
+-            }
+-            buf.append("L");
+-            buf.append(convertToISOLatin1(clazz.getName()));
+-            buf.append(";");
+-            buf.append(createHashString(clazz));
+-            repid = buf.toString();
+-        }
+-        classSeqToRepStr.put(originalClazz,repid);
+-        return repid;
+-        }
+-
+-    }
+-
+-
+-    public static String createForSpecialCase(java.lang.Class clazz){
+-        if (clazz.isArray()){
+-            return createSequenceRepID(clazz);
+-        }
+-        else {
+-            return (String)kSpecialCasesRepIDs.get(clazz);
+-        }
+-    }
+-
+-    public static String createForSpecialCase(java.io.Serializable ser){
+-        Class clazz = ser.getClass();
+-        if (clazz.isArray()){
+-            return createSequenceRepID(ser);
+-        }
+-        else
+-            return createForSpecialCase(clazz);
+-    }
+-
+-    /**
+-     * Creates a repository ID for a normal Java Type.
+-     * @param ser The Java object to create a repository ID for
+-     * @exception com.sun.corba.se.impl.io.TypeMismatchException if ser implements the
+-     * org.omg.CORBA.portable.IDLEntity interface which indicates it is an IDL Value type.
+-     **/
+-    public static String createForJavaType(java.io.Serializable ser)
+-        throws com.sun.corba.se.impl.io.TypeMismatchException
+-    {
+-        synchronized (classToRepStr) {
+-        String repid = createForSpecialCase(ser);
+-        if (repid != null)
+-            return repid;
+-        Class clazz = ser.getClass();
+-        repid = (String)classToRepStr.get(clazz);
+-
+-        if (repid != null)
+-            return repid;
+-
+-        repid = kValuePrefix + convertToISOLatin1(clazz.getName()) +
+-            createHashString(clazz);
+-
+-        classToRepStr.put(clazz, repid);
+-            repStrToClass.put(repid, clazz);
+-        return repid;
+-    }
+-    }
+-
+-    /**
+-     * Creates a repository ID for a normal Java Type.
+-     * @param clz The Java class to create a repository ID for
+-     * @exception com.sun.corba.se.impl.io.TypeMismatchException if ser implements the
+-     * org.omg.CORBA.portable.IDLEntity interface which indicates it is an IDL Value type.
+-     **/
+-    public static String createForJavaType(Class clz)
+-        throws com.sun.corba.se.impl.io.TypeMismatchException
+-    {
+-        synchronized (classToRepStr){
+-        String repid = createForSpecialCase(clz);
+-        if (repid != null)
+-            return repid;
+-
+-        repid = (String)classToRepStr.get(clz);
+-        if (repid != null)
+-            return repid;
+-
+-        repid = kValuePrefix + convertToISOLatin1(clz.getName()) +
+-            createHashString(clz);
+-
+-        classToRepStr.put(clz, repid);
+-            repStrToClass.put(repid, clz);
+-        return repid;
+-    }
+-    }
+-
+-    /**
+-     * Creates a repository ID for an IDL Java Type.
+-     * @param ser The IDL Value object to create a repository ID for
+-     * @param major The major version number
+-     * @param minor The minor version number
+-     * @exception com.sun.corba.se.impl.io.TypeMismatchException if ser does not implement the
+-     * org.omg.CORBA.portable.IDLEntity interface which indicates it is an IDL Value type.
+-     **/
+-    public static String createForIDLType(Class ser, int major, int minor)
+-        throws com.sun.corba.se.impl.io.TypeMismatchException
+-    {
+-        synchronized (classIDLToRepStr){
+-        String repid = (String)classIDLToRepStr.get(ser);
+-        if (repid != null)
+-            return repid;
+-
+-        repid = kIDLPrefix + convertToISOLatin1(ser.getName()).replace('.','/') +
+-            ":" + major + "." + minor;
+-        classIDLToRepStr.put(ser, repid);
+-        return repid;
+-    }
+-    }
+-
+-    private static String getIdFromHelper(Class clazz){
+-        try {
+-            Class helperClazz = Utility.loadClassForClass(clazz.getName()+"Helper", null,
+-                                    clazz.getClassLoader(), clazz, clazz.getClassLoader());
+-            Method idMethod = helperClazz.getDeclaredMethod("id", kNoParamTypes);
+-            return (String)idMethod.invoke(null, kNoArgs);
+-        }
+-        catch(java.lang.ClassNotFoundException cnfe)
+-            {
+-                throw new org.omg.CORBA.MARSHAL(cnfe.toString());
+-            }
+-        catch(java.lang.NoSuchMethodException nsme)
+-            {
+-                throw new org.omg.CORBA.MARSHAL(nsme.toString());
+-            }
+-        catch(java.lang.reflect.InvocationTargetException ite)
+-            {
+-                throw new org.omg.CORBA.MARSHAL(ite.toString());
+-            }
+-        catch(java.lang.IllegalAccessException iae)
+-            {
+-                throw new org.omg.CORBA.MARSHAL(iae.toString());
+-    }
+-    }
+-
+-    /**
+-     * Createa a repository ID for the type if it is either a java type
+-     * or an IDL type.
+-     * @param type The type to create rep. id for
+-     * @return The rep. id.
+-     **/
+-    public static String createForAnyType(Class type) {
+-        try{
+-            if (type.isArray())
+-                return createSequenceRepID(type);
+-            else if (IDLEntity.class.isAssignableFrom(type))
+-                {
+-                    try{
+-                        return getIdFromHelper(type);
+-                    }
+-                    catch(Throwable t) {
+-                        return createForIDLType(type, 1, 0);
+-                    }
+-                }
+-            else return createForJavaType(type);
+-        }
+-        catch(com.sun.corba.se.impl.io.TypeMismatchException e){
+-            return null;
+-        }
+-
+-    }
+-
+-    public static boolean isAbstractBase(Class clazz) {
+-        return (clazz.isInterface() &&
+-                IDLEntity.class.isAssignableFrom(clazz) &&
+-                (!ValueBase.class.isAssignableFrom(clazz)) &&
+-                (!org.omg.CORBA.Object.class.isAssignableFrom(clazz)));
+-
+-    }
+-
+-    public static boolean isAnyRequired(Class clazz) {
+-        return ((clazz == java.lang.Object.class) ||
+-                (clazz == java.io.Serializable.class) ||
+-                (clazz == java.io.Externalizable.class));
+-    }
+-
+-    public static long fromHex(String hexNumber) {
+-        if (hexNumber.startsWith("0x"))
+-            return Long.valueOf(hexNumber.substring(2), 16).longValue();
+-        else return Long.valueOf(hexNumber, 16).longValue();
+-    }
+-
+-    /**
+-     * Convert strings with illegal IDL identifier characters.
+-     * <p>
+-     * Section 5.5.7 of OBV spec.
+-     */
+-    private static String convertToISOLatin1 (String name) {
+-
+-        int length = name.length();
+-        if (length == 0) {
+-            return name;
+-        }
+-        StringBuffer buffer = null;
+-
+-        for (int i = 0; i < length; i++) {
+-
+-            char c = name.charAt(i);
+-
+-            if (c > 255 || IDL_IDENTIFIER_CHARS[c] == 0) {
+-
+-                // We gotta convert. Have we already started?
+-
+-                if (buffer == null) {
+-
+-                    // No, so get set up...
+-
+-                    buffer = new StringBuffer(name.substring(0,i));
+-                }
+-
+-                // Convert the character into the IDL escape syntax...
+-                buffer.append(
+-                              "\\U" +
+-                              (char)ASCII_HEX[(c & 0xF000) >>> 12] +
+-                              (char)ASCII_HEX[(c & 0x0F00) >>> 8] +
+-                              (char)ASCII_HEX[(c & 0x00F0) >>> 4] +
+-                              (char)ASCII_HEX[(c & 0x000F)]);
+-
+-            } else {
+-                if (buffer != null) {
+-                    buffer.append(c);
+-                }
+-            }
+-        }
+-
+-        if (buffer != null) {
+-            name = buffer.toString();
+-        }
+-
+-        return name;
+-    }
+-
+-    /**
+-     * Convert strings with ISO Latin 1 escape sequences back to original strings.
+-     * <p>
+-     * Section 5.5.7 of OBV spec.
+-     */
+-    private static String convertFromISOLatin1 (String name) {
+-
+-        int index = -1;
+-        StringBuffer buf = new StringBuffer(name);
+-
+-        while ((index = buf.toString().indexOf("\\U")) != -1){
+-            String str = "0000" + buf.toString().substring(index+2, index+6);
+-
+-            // Convert Hexadecimal
+-            byte[] buffer = new byte[(str.length() - 4) / 2];
+-            for (int i=4, j=0; i < str.length(); i +=2, j++) {
+-                buffer[j] = (byte)((ORBUtility.hexOf(str.charAt(i)) << 4) & 0xF0);
+-                buffer[j] |= (byte)((ORBUtility.hexOf(str.charAt(i+1)) << 0) & 0x0F);
+-            }
+-            buf = new StringBuffer(delete(buf.toString(), index, index+6));
+-            buf.insert(index, (char)buffer[1]);
+-        }
+-
+-        return buf.toString();
+-
+-
+-    }
+-
+-    private static String delete(String str, int from, int to)
+-    {
+-        return str.substring(0, from) + str.substring(to, str.length());
+-    }
+-
+-    private static String replace(String target, String arg, String source)
+-    {
+-        int i = 0;
+-        i = target.indexOf(arg);
+-
+-        while(i != -1)
+-            {
+-                String left = target.substring(0, i);
+-                String right = target.substring(i+arg.length());
+-                target = new String(left+source+right);
+-                i = target.indexOf(arg);
+-            }
+-        return target;
+-    }
+-
+-    public static int computeValueTag(boolean codeBasePresent, int typeInfo, boolean chunkedEncoding){
+-        int value_tag = kInitialValueTag;
+-
+-        if (codeBasePresent)
+-            value_tag = value_tag | 0x00000001;
+-
+-        value_tag = value_tag | typeInfo;
+-
+-        if (chunkedEncoding)
+-            value_tag = value_tag | kChunkedMask;
+-
+-        return value_tag;
+-    }
+-
+-    public static boolean isCodeBasePresent(int value_tag){
+-        return ((value_tag & 0x00000001) == 1);
+-    }
+-
+-    public static int getTypeInfo(int value_tag){
+-        return (value_tag & 0x00000006);
+-    }
+-
+-    public static boolean isChunkedEncoding(int value_tag){
+-        return ((value_tag & kChunkedMask) != 0);
+-    }
+-
+-    public static String getServerURL(){
+-        return defaultServerURL;
+-    }
+-
+-    /*
+-     * Load a class and check that it is assignable to a given type.
+-     * @param className the class name.
+-     * @param remoteCodebase the codebase to use. May be null.
+-     * @param loader the class loader of last resort. May be null.
+-     * @param expectedType the expected type. May be null.
+-     * @return the loaded class.
+-     */
+-    private Class loadClassOfType (String className,
+-                                  String remoteCodebase,
+-                                  ClassLoader loader,
+-                                  Class expectedType,
+-                                  ClassLoader expectedTypeClassLoader)
+-        throws ClassNotFoundException {
+-
+-        Class loadedClass = null;
+-
+-        try {
+-            //Sequence finding of the stubs according to spec
+-            try{
+-                //If-else is put here for speed up of J2EE.
+-                //According to the OMG spec, the if clause is not dead code.
+-                //It can occur if some compiler has allowed generation
+-                //into org.omg.stub hierarchy for non-offending
+-                //classes. This will encourage people to
+-                //produce non-offending class stubs in their own hierarchy.
+-                if(!PackagePrefixChecker
+-                   .hasOffendingPrefix(PackagePrefixChecker
+-                                       .withoutPackagePrefix(className))){
+-                    loadedClass = Util.loadClass
+-                        (PackagePrefixChecker.withoutPackagePrefix(className),
+-                         remoteCodebase,
+-                         loader);
+-                } else {
+-                    loadedClass = Util.loadClass
+-                        (className,
+-                         remoteCodebase,
+-                         loader);
+-                }
+-            } catch (ClassNotFoundException cnfe) {
+-                loadedClass = Util.loadClass
+-                    (className,
+-                     remoteCodebase,
+-                     loader);
+-            }
+-            if (expectedType == null)
+-                return loadedClass;
+-        } catch (ClassNotFoundException cnfe) {
+-            if (expectedType == null)
+-                throw cnfe;
+-        }
+-
+-        // If no class was not loaded, or if the loaded class is not of the
+-        // correct type, make a further attempt to load the correct class
+-        // using the classloader of the expected type.
+-        // _REVISIT_ Is this step necessary, or should the Util,loadClass
+-        // algorithm always produce a valid class if the setup is correct?
+-        // Does the OMG standard algorithm need to be changed to include
+-        // this step?
+-        if (loadedClass == null || !expectedType.isAssignableFrom(loadedClass)) {
+-            if (expectedType.getClassLoader() != expectedTypeClassLoader)
+-                throw new IllegalArgumentException("expectedTypeClassLoader not class loader of expectedType.");
+-
+-            if (expectedTypeClassLoader != null)
+-                loadedClass = expectedTypeClassLoader.loadClass(className);
+-            else
+-                loadedClass = Class.forName(className);
+-        }
+-
+-        return loadedClass;
+-    }
+-}
+diff --git a/src/share/classes/com/sun/corba/se/impl/orbutil/ValueHandlerImpl_1_3.java b/src/share/classes/com/sun/corba/se/impl/orbutil/ValueHandlerImpl_1_3.java
+deleted file mode 100644
+--- corba/src/share/classes/com/sun/corba/se/impl/orbutil/ValueHandlerImpl_1_3.java
++++ /dev/null
+@@ -1,251 +0,0 @@
+-/*
+- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+- *
+- * This code is free software; you can redistribute 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.
+- */
+-/*
+- * Licensed Materials - Property of IBM
+- * RMI-IIOP v1.0
+- * Copyright IBM Corp. 1998 1999  All Rights Reserved
+- *
+- */
+-
+-package com.sun.corba.se.impl.orbutil;
+-
+-import javax.rmi.CORBA.Util;
+-import javax.rmi.PortableRemoteObject;
+-
+-import java.util.Hashtable;
+-import java.util.Stack;
+-import java.io.IOException;
+-import java.util.EmptyStackException;
+-
+-import com.sun.corba.se.impl.util.Utility;
+-import com.sun.corba.se.impl.io.IIOPInputStream;
+-import com.sun.corba.se.impl.io.IIOPOutputStream;
+-import com.sun.corba.se.impl.util.RepositoryId;
+-import com.sun.corba.se.impl.util.Utility;
+-
+-import org.omg.CORBA.TCKind;
+-import org.omg.CORBA.MARSHAL;
+-import org.omg.CORBA.CompletionStatus;
+-import org.omg.CORBA.portable.IndirectionException;
+-import com.sun.org.omg.SendingContext.CodeBase;
+-
+-import java.security.AccessController;
+-import java.security.PrivilegedAction;
+-
+-/**
+- * This class overrides behavior of our current ValueHandlerImpl to
+- * provide backwards compatibility with JDK 1.3.0.
+- */
+-public class ValueHandlerImpl_1_3 extends com.sun.corba.se.impl.io.ValueHandlerImpl {
+-
+-    public ValueHandlerImpl_1_3(){
+-        super();
+-    }
+-
+-    public ValueHandlerImpl_1_3(boolean isInputStream) {
+-        super(isInputStream);
+-    }
+-
+-    /**
+-     * Writes the value to the stream using java semantics.
+-     * @param out The stream to write the value to
+-     * @param value The value to be written to the stream
+-     **/
+-    public void writeValue(org.omg.CORBA.portable.OutputStream _out, java.io.Serializable value) {
+-        super.writeValue(_out, value);
+-    }
+-
+-    /**
+-     * Reads a value from the stream using java semantics.
+-     * @param in The stream to read the value from
+-     * @param clazz The type of the value to be read in
+-     * @param sender The sending context runtime
+-     **/
+-    public java.io.Serializable readValue(org.omg.CORBA.portable.InputStream _in,
+-                                          int offset,
+-                                          java.lang.Class clazz,
+-                                          String repositoryID,
+-                                          org.omg.SendingContext.RunTime _sender)
+-    {
+-        return super.readValue(_in, offset, clazz, repositoryID, _sender);
+-    }
+-
+-    /**
+-     * Returns the repository ID for the given RMI value Class.
+-     * @param clz The class to return a repository ID for.
+-     * @return the repository ID of the Class.
+-     **/
+-    public java.lang.String getRMIRepositoryID(java.lang.Class clz) {
+-        return RepositoryId_1_3.createForJavaType(clz);
+-    }
+-
+-    /**
+-     * Indicates whether the given Class performs custom or
+-     * default marshaling.
+-     * @param clz The class to test for custom marshaling.
+-     * @return True if the class performs custom marshaling, false
+-     * if it does not.
+-     **/
+-    public boolean isCustomMarshaled(java.lang.Class clz) {
+-        return super.isCustomMarshaled(clz);
+-    }
+-
+-    /**
+-     * Returns the CodeBase for this ValueHandler.  This is used by
+-     * the ORB runtime.  The server sends the service context containing
+-     * the IOR for this CodeBase on the first GIOP reply.  The clients
+-     * do the same on the first GIOP request.
+-     * @return the SendingContext.CodeBase of this ValueHandler.
+-     **/
+-    public org.omg.SendingContext.RunTime getRunTimeCodeBase() {
+-        return super.getRunTimeCodeBase();
+-    }
+-
+-    /**
+-     * If the value contains a writeReplace method then the result
+-     * is returned.  Otherwise, the value itself is returned.
+-     * @return the true value to marshal on the wire.
+-     **/
+-    public java.io.Serializable writeReplace(java.io.Serializable value) {
+-        return super.writeReplace(value);
+-    }
+-
+-    // methods supported for backward compatability so that the appropriate
+-    // Rep-id calculations take place based on the ORB version
+-
+-    /**
+-     *  Returns a boolean of whether or not RepositoryId indicates
+-     *  FullValueDescriptor.
+-     *  used for backward compatability
+-     */
+-
+-     public boolean useFullValueDescription(Class clazz, String repositoryID)
+-        throws IOException
+-
+-     {
+-        return RepositoryId_1_3.useFullValueDescription(clazz, repositoryID);
+-     }
+-
+-     public String getClassName(String id)
+-     {
+-        RepositoryId_1_3 repID = RepositoryId_1_3.cache.getId(id);
+-        return repID.getClassName();
+-     }
+-
+-     public Class getClassFromType(String id)
+-        throws ClassNotFoundException
+-     {
+-        RepositoryId_1_3 repId = RepositoryId_1_3.cache.getId(id);
+-        return repId.getClassFromType();
+-     }
+-
+-     public Class getAnyClassFromType(String id)
+-        throws ClassNotFoundException
+-     {
+-        RepositoryId_1_3 repId = RepositoryId_1_3.cache.getId(id);
+-        return repId.getAnyClassFromType();
+-     }
+-
+-     public String createForAnyType(Class cl)
+-     {
+-        return RepositoryId_1_3.createForAnyType(cl);
+-     }
+-
+-     public String getDefinedInId(String id)
+-     {
+-        RepositoryId_1_3 repId = RepositoryId_1_3.cache.getId(id);
+-        return repId.getDefinedInId();
+-     }
+-
+-     public String getUnqualifiedName(String id)
+-     {
+-        RepositoryId_1_3 repId = RepositoryId_1_3.cache.getId(id);
+-        return repId.getUnqualifiedName();
+-     }
+-
+-     public String getSerialVersionUID(String id)
+-     {
+-        RepositoryId_1_3 repId = RepositoryId_1_3.cache.getId(id);
+-        return repId.getSerialVersionUID();
+-     }
+-
+-     public boolean isAbstractBase(Class clazz)
+-     {
+-        return RepositoryId_1_3.isAbstractBase(clazz);
+-     }
+-
+-     public boolean isSequence(String id)
+-     {
+-        RepositoryId_1_3 repId = RepositoryId_1_3.cache.getId(id);
+-        return repId.isSequence();
+-     }
+-
+-    /**
+-     * Preserves the incorrect 1.3 behavior which truncates Java chars in
+-     * arrays to 8-bit CORBA chars.  Bug 4367783.  This enables us to
+-     * continue interoperating with our legacy ORBs.  If this goes into
+-     * Ladybird, then Ladybird and Kestrel will interoperate as long as
+-     * people don't use chars greater than 8-bits.
+-     */
+-    protected void writeCharArray(org.omg.CORBA_2_3.portable.OutputStream out,
+-                                char[] array,
+-                                int offset,
+-                                int length)
+-    {
+-        out.write_char_array(array, offset, length);
+-    }
+-
+-    /**
+-     * Preserves the incorrect 1.3 behavior which truncates Java chars in
+-     * arrays to 8-bit CORBA chars.  Bug 4367783.  This enables us to
+-     * continue interoperating with our legacy ORBs.  If this goes into
+-     * Ladybird, then Ladybird and Kestrel will interoperate as long as
+-     * people don't use chars greater than 8-bits.
+-     */
+-    protected void readCharArray(org.omg.CORBA_2_3.portable.InputStream in,
+-                                 char[] array,
+-                                 int offset,
+-                                 int length)
+-    {
+-        in.read_char_array(array, offset, length);
+-    }
+-
+-    protected final String getOutputStreamClassName() {
+-        return "com.sun.corba.se.impl.orbutil.IIOPOutputStream_1_3";
+-    }
+-
+-    protected final String getInputStreamClassName() {
+-        return "com.sun.corba.se.impl.orbutil.IIOPInputStream_1_3";
+-    }
+-
+-    /**
+-     * Our JDK 1.3 and JDK 1.3.1 behavior subclasses override this.
+-     * The correct behavior is for a Java char to map to a CORBA wchar,
+-     * but our older code mapped it to a CORBA char.
+-     */
+-    protected TCKind getJavaCharTCKind() {
+-        return TCKind.tk_char;
+-    }
+-}
+diff --git a/src/share/classes/com/sun/corba/se/impl/orbutil/ValueHandlerImpl_1_3_1.java b/src/share/classes/com/sun/corba/se/impl/orbutil/ValueHandlerImpl_1_3_1.java
+deleted file mode 100644
+--- corba/src/share/classes/com/sun/corba/se/impl/orbutil/ValueHandlerImpl_1_3_1.java
++++ /dev/null
+@@ -1,77 +0,0 @@
+-/*
+- * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
+- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+- *
+- * This code is free software; you can redistribute 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.corba.se.impl.orbutil;
+-
+-import org.omg.CORBA.TCKind;
+-
+-/**
+- * This class overrides behavior of our current ValueHandlerImpl to
+- * provide backwards compatibility with JDK 1.3.1.
+- */
+-public class ValueHandlerImpl_1_3_1
+-    extends com.sun.corba.se.impl.io.ValueHandlerImpl
+-{
+-    public ValueHandlerImpl_1_3_1() {}
+-
+-    public ValueHandlerImpl_1_3_1(boolean isInputStream) {
+-        super(isInputStream);
+-    }
+-
+-    /**
+-     * Our JDK 1.3 and JDK 1.3.1 behavior subclasses override this.
+-     * The correct behavior is for a Java char to map to a CORBA wchar,
+-     * but our older code mapped it to a CORBA char.
+-     */
+-    protected TCKind getJavaCharTCKind() {
+-        return TCKind.tk_char;
+-    }
+-
+-    /**
+-     * RepositoryId_1_3_1 performs an incorrect repId calculation
+-     * when using serialPersistentFields and one of the fields no longer
+-     * exists on the class itself.
+-     */
+-    public boolean useFullValueDescription(Class clazz, String repositoryID)
+-        throws java.io.IOException
+-    {
+-        return RepositoryId_1_3_1.useFullValueDescription(clazz, repositoryID);
+-    }
+-
+-    /**
+-     * Installs the legacy IIOPOutputStream_1_3_1 which does
+-     * PutFields/GetFields incorrectly.  Bug 4407244.
+-     */
+-    protected final String getOutputStreamClassName() {
+-        return "com.sun.corba.se.impl.orbutil.IIOPOutputStream_1_3_1";
+-    }
+-
+-    /**
+-     * Installs the legacy IIOPInputStream_1_3_1 which does
+-     * PutFields/GetFields incorrectly.  Bug 4407244.
+-     */
+-    protected final String getInputStreamClassName() {
+-        return "com.sun.corba.se.impl.orbutil.IIOPInputStream_1_3_1";
+-    }
+-}
+diff --git a/src/share/classes/sun/corba/JavaCorbaAccess.java b/src/share/classes/sun/corba/JavaCorbaAccess.java
+new file mode 100644
+--- /dev/null
++++ corba/src/share/classes/sun/corba/JavaCorbaAccess.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.corba;
++
++import com.sun.corba.se.impl.io.ValueHandlerImpl;
++
++public interface JavaCorbaAccess {
++    public ValueHandlerImpl newValueHandlerImpl();
++}
+diff --git a/src/share/classes/sun/corba/SharedSecrets.java b/src/share/classes/sun/corba/SharedSecrets.java
+new file mode 100644
+--- /dev/null
++++ corba/src/share/classes/sun/corba/SharedSecrets.java
+@@ -0,0 +1,60 @@
++/*
++ * 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.corba;
++
++import com.sun.corba.se.impl.io.ValueUtility;
++import sun.misc.Unsafe;
++
++import java.security.AccessController;
++
++/** A repository of "shared secrets", which are a mechanism for
++    calling implementation-private methods in another package without
++    using reflection. A package-private class implements a public
++    interface and provides the ability to call package-private methods
++    within that package; the object implementing that interface is
++    provided through a third package to which access is restricted.
++    This framework avoids the primary disadvantage of using reflection
++    for this purpose, namely the loss of compile-time checking. */
++
++// SharedSecrets cloned in corba repo to avoid build issues
++public class SharedSecrets {
++    private static final Unsafe unsafe = Unsafe.getUnsafe();
++    private static JavaCorbaAccess javaCorbaAccess;
++
++    public static JavaCorbaAccess getJavaCorbaAccess() {
++        if (javaCorbaAccess == null) {
++            // Ensure ValueUtility is initialized; we know that that class
++            // provides the shared secret
++            unsafe.ensureClassInitialized(ValueUtility.class);
++        }
++        return javaCorbaAccess;
++    }
++
++    public static void setJavaCorbaAccess(JavaCorbaAccess access) {
++        javaCorbaAccess = access;
++    }
++
++}

Added: trunk/java/openjdk6/files/icedtea/security/20130201/8001242.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130201/8001242.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130201/8001242.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,61 @@
+# 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.

Added: trunk/java/openjdk6/files/icedtea/security/20130201/8001307.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130201/8001307.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130201/8001307.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,27 @@
+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

Added: trunk/java/openjdk6/files/icedtea/security/20130201/8001972.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130201/8001972.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130201/8001972.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,438 @@
+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__

Added: trunk/java/openjdk6/files/icedtea/security/20130201/8002325.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130201/8002325.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130201/8002325.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,59 @@
+# 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 */

Added: trunk/java/openjdk6/files/icedtea/security/20130219/8006446.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130219/8006446.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130219/8006446.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,395 @@
+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");

Added: trunk/java/openjdk6/files/icedtea/security/20130219/8006777.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130219/8006777.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130219/8006777.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,1036 @@
+# HG changeset patch
+# User coffeys
+# Date 1360882104 0
+# Node ID 85b3b034fdecdc94f082efa8d74e014366502deb
+# Parent  617e68a3948824283f15c36fcd8cf264c1dd0a99
+8006777: Improve TLS handling of invalid messages
+Reviewed-by: wetmore
+
+diff --git a/src/share/classes/sun/security/ssl/CipherBox.java b/src/share/classes/sun/security/ssl/CipherBox.java
+--- jdk/src/share/classes/sun/security/ssl/CipherBox.java
++++ jdk/src/share/classes/sun/security/ssl/CipherBox.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1996, 2011, 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
+@@ -244,7 +244,8 @@ final class CipherBox {
+      * Decrypts a block of data, returning the size of the
+      * resulting block if padding was required.
+      */
+-    int decrypt(byte[] buf, int offset, int len) throws BadPaddingException {
++    int decrypt(byte[] buf, int offset, int len,
++            int tagLen) throws BadPaddingException {
+         if (cipher == null) {
+             return len;
+         }
+@@ -268,8 +269,8 @@ final class CipherBox {
+                 } catch (IOException e) { }
+             }
+             if (blockSize != 0) {
+-                newLen = removePadding(buf, offset, newLen,
+-                             blockSize, protocolVersion);
++                newLen = removePadding(
++                    buf, offset, newLen, tagLen, blockSize, protocolVersion); 
+             }
+             return newLen;
+         } catch (ShortBufferException e) {
+@@ -285,7 +286,7 @@ final class CipherBox {
+      * limit and new limit may be different, given we may
+      * have stripped off some padding bytes.
+      */
+-    int decrypt(ByteBuffer bb) throws BadPaddingException {
++    int decrypt(ByteBuffer bb, int tagLen) throws BadPaddingException {
+ 
+         int len = bb.remaining();
+ 
+@@ -309,7 +310,6 @@ final class CipherBox {
+             }
+ 
+             if (debug != null && Debug.isOn("plaintext")) {
+-                bb.position(pos);
+                 try {
+                     HexDumpEncoder hd = new HexDumpEncoder();
+ 
+@@ -317,7 +317,8 @@ final class CipherBox {
+                         "Padded plaintext after DECRYPTION:  len = "
+                         + newLen);
+ 
+-                    hd.encodeBuffer(bb, System.out);
++                    hd.encodeBuffer(
++                        (ByteBuffer)bb.duplicate().position(pos), System.out);
+                 } catch (IOException e) { }
+             }
+ 
+@@ -326,7 +327,8 @@ final class CipherBox {
+              */
+             if (blockSize != 0) {
+                 bb.position(pos);
+-                newLen = removePadding(bb, blockSize, protocolVersion);
++                newLen = removePadding(
++                    bb, tagLen, blockSize, protocolVersion);
+             }
+             return newLen;
+         } catch (ShortBufferException e) {
+@@ -400,6 +402,65 @@ final class CipherBox {
+         return newlen;
+     }
+ 
++    /*
++     * A constant-time check of the padding.
++     *
++     * NOTE that we are checking both the padding and the padLen bytes here.
++     *
++     * The caller MUST ensure that the len parameter is a positive number.
++     */
++    private static int[] checkPadding(
++            byte[] buf, int offset, int len, byte pad) {
++
++        if (len <= 0) {
++            throw new RuntimeException("padding len must be positive");
++        }
++
++        // An array of hits is used to prevent Hotspot optimization for
++        // the purpose of a constant-time check
++        int[] results = {0, 0};    // {missed #, matched #}
++        for (int i = 0; i <= 256;) {
++            for (int j = 0; j < len && i <= 256; j++, i++) {     // j <= i
++                if (buf[offset + j] != pad) {
++                    results[0]++;       // mismatched padding data
++                } else {
++                    results[1]++;       // matched padding data
++                }
++            }
++        }
++
++        return results;
++    }
++
++    /*
++     * A constant-time check of the padding.
++     *
++     * NOTE that we are checking both the padding and the padLen bytes here.
++     *
++     * The caller MUST ensure that the bb parameter has remaining.
++     */
++    private static int[] checkPadding(ByteBuffer bb, byte pad) {
++
++        if (!bb.hasRemaining()) {
++            throw new RuntimeException("hasRemaining() must be positive");
++        }
++
++        // An array of hits is used to prevent Hotspot optimization for
++        // the purpose of a constant-time check.
++        int[] results = {0, 0};    // {missed #, matched #}
++        bb.mark();
++        for (int i = 0; i <= 256; bb.reset()) {
++            for (; bb.hasRemaining() && i <= 256; i++) {
++                if (bb.get() != pad) {
++                    results[0]++;       // mismatched padding data
++                } else {
++                    results[1]++;       // matched padding data
++                }
++            }
++        }
++
++        return results;
++    }
+ 
+     /*
+      * Typical TLS padding format for a 64 bit block cipher is as follows:
+@@ -412,86 +473,95 @@ final class CipherBox {
+      * as it makes the data a multiple of the block size
+      */
+     private static int removePadding(byte[] buf, int offset, int len,
+-            int blockSize, ProtocolVersion protocolVersion)
+-            throws BadPaddingException {
++            int tagLen, int blockSize,
++            ProtocolVersion protocolVersion) throws BadPaddingException {
++
+         // last byte is length byte (i.e. actual padding length - 1)
+         int padOffset = offset + len - 1;
+-        int pad = buf[padOffset] & 0x0ff;
++        int padLen = buf[padOffset] & 0xFF;
+ 
+-        int newlen = len - (pad + 1);
+-        if (newlen < 0) {
+-            throw new BadPaddingException("Padding length invalid: " + pad);
++        int newLen = len - (padLen + 1);
++        if ((newLen - tagLen) < 0) {
++            // If the buffer is not long enough to contain the padding plus
++            // a MAC tag, do a dummy constant-time padding check.
++            //
++            // Note that it is a dummy check, so we won't care about what is
++            // the actual padding data.
++            checkPadding(buf, offset, len, (byte)(padLen & 0xFF));
++
++            throw new BadPaddingException("Invalid Padding length: " + padLen);
+         }
+ 
++        // The padding data should be filled with the padding length value.
++        int[] results = checkPadding(buf, offset + newLen,
++                        padLen + 1, (byte)(padLen & 0xFF));
+         if (protocolVersion.v >= ProtocolVersion.TLS10.v) {
+-            for (int i = 1; i <= pad; i++) {
+-                int val = buf[padOffset - i] & 0xff;
+-                if (val != pad) {
+-                    throw new BadPaddingException
+-                                        ("Invalid TLS padding: " + val);
+-                }
++            if (results[0] != 0) {          // padding data has invalid bytes
++                throw new BadPaddingException("Invalid TLS padding data");
+             }
+         } else { // SSLv3
+             // SSLv3 requires 0 <= length byte < block size
+             // some implementations do 1 <= length byte <= block size,
+             // so accept that as well
+             // v3 does not require any particular value for the other bytes
+-            if (pad > blockSize) {
+-                throw new BadPaddingException("Invalid SSLv3 padding: " + pad);
++            if (padLen > blockSize) {
++                throw new BadPaddingException("Invalid SSLv3 padding");
+             }
+         }
+-        return newlen;
++        return newLen;
+     }
+ 
+     /*
+      * Position/limit is equal the removed padding.
+      */
+     private static int removePadding(ByteBuffer bb,
+-            int blockSize, ProtocolVersion protocolVersion)
+-            throws BadPaddingException {
++            int tagLen, int blockSize,
++            ProtocolVersion protocolVersion) throws BadPaddingException {
+ 
+         int len = bb.remaining();
+         int offset = bb.position();
+ 
+         // last byte is length byte (i.e. actual padding length - 1)
+         int padOffset = offset + len - 1;
+-        int pad = bb.get(padOffset) & 0x0ff;
++        int padLen = bb.get(padOffset) & 0xFF;
+ 
+-        int newlen = len - (pad + 1);
+-        if (newlen < 0) {
+-            throw new BadPaddingException("Padding length invalid: " + pad);
++        int newLen = len - (padLen + 1);
++        if ((newLen - tagLen) < 0) {
++            // If the buffer is not long enough to contain the padding plus
++            // a MAC tag, do a dummy constant-time padding check.
++            //
++            // Note that it is a dummy check, so we won't care about what is
++            // the actual padding data.
++            checkPadding(bb.duplicate(), (byte)(padLen & 0xFF));
++
++            throw new BadPaddingException("Invalid Padding length: " + padLen);
+         }
+ 
+-        /*
+-         * We could zero the padding area, but not much useful
+-         * information there.
+-         */
++        // The padding data should be filled with the padding length value.
++        int[] results = checkPadding(
++                (ByteBuffer)bb.duplicate().position(offset + newLen),
++                (byte)(padLen & 0xFF));
+         if (protocolVersion.v >= ProtocolVersion.TLS10.v) {
+-            bb.put(padOffset, (byte)0);         // zero the padding.
+-            for (int i = 1; i <= pad; i++) {
+-                int val = bb.get(padOffset - i) & 0xff;
+-                if (val != pad) {
+-                    throw new BadPaddingException
+-                                        ("Invalid TLS padding: " + val);
+-                }
++            if (results[0] != 0) {          // padding data has invalid bytes
++                throw new BadPaddingException("Invalid TLS padding data");
+             }
+         } else { // SSLv3
+             // SSLv3 requires 0 <= length byte < block size
+             // some implementations do 1 <= length byte <= block size,
+             // so accept that as well
+             // v3 does not require any particular value for the other bytes
+-            if (pad > blockSize) {
+-                throw new BadPaddingException("Invalid SSLv3 padding: " + pad);
++           if (padLen > blockSize) {
++                throw new BadPaddingException("Invalid SSLv3 padding");
+             }
+         }
+ 
+         /*
+          * Reset buffer limit to remove padding.
+          */
+-        bb.position(offset + newlen);
+-        bb.limit(offset + newlen);
++        bb.position(offset + newLen);
++        bb.limit(offset + newLen);
+ 
+-        return newlen;
++        return newLen;
+     }
+ 
+     /*
+@@ -502,4 +572,40 @@ final class CipherBox {
+     boolean isCBCMode() {
+         return isCBCMode;
+     }
++
++    /**
++     * Is the cipher null?
++     *
++     * @return true if the cipher is null, false otherwise.
++     */
++    boolean isNullCipher() {
++        return cipher == null;
++    }
++
++    /**
++     * Sanity check the length of a fragment before decryption.
++     *
++     * In CBC mode, check that the fragment length is one or multiple times
++     * of the block size of the cipher suite, and is at least one (one is the
++     * smallest size of padding in CBC mode) bigger than the tag size of the
++     * MAC algorithm.
++     *
++     * In non-CBC mode, check that the fragment length is not less than the
++     * tag size of the MAC algorithm.
++     *
++     * @return true if the length of a fragment matches above requirements
++     */
++    boolean sanityCheck(int tagLen, int fragmentLen) {
++        if (!isCBCMode) {
++            return fragmentLen >= tagLen;
++        }
++
++        if ((fragmentLen % blockSize) == 0) {
++            int minimal = tagLen + 1;
++            minimal = (minimal >= blockSize) ? minimal : blockSize;
++            return (fragmentLen >= minimal);
++        }
++
++        return false;
++    }
+ }
+diff --git a/src/share/classes/sun/security/ssl/CipherSuite.java b/src/share/classes/sun/security/ssl/CipherSuite.java
+--- jdk/src/share/classes/sun/security/ssl/CipherSuite.java
++++ jdk/src/share/classes/sun/security/ssl/CipherSuite.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2002, 2011, 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
+@@ -451,9 +451,18 @@ final class CipherSuite implements Compa
+         // size of the MAC value (and MAC key) in bytes
+         final int size;
+ 
+-        MacAlg(String name, int size) {
++        // block size of the underlying hash algorithm
++        final int hashBlockSize;
++
++        // minimal padding size of the underlying hash algorithm
++        final int minimalPaddingSize;
++
++        MacAlg(String name, int size,
++                int hashBlockSize, int minimalPaddingSize) {
+             this.name = name;
+             this.size = size;
++            this.hashBlockSize = hashBlockSize;
++            this.minimalPaddingSize = minimalPaddingSize;
+         }
+ 
+         /**
+@@ -497,9 +506,9 @@ final class CipherSuite implements Compa
+                         new BulkCipher(CIPHER_AES,     32, 16, true);
+ 
+     // MACs
+-    final static MacAlg M_NULL = new MacAlg("NULL", 0);
+-    final static MacAlg M_MD5  = new MacAlg("MD5", 16);
+-    final static MacAlg M_SHA  = new MacAlg("SHA", 20);
++    final static MacAlg M_NULL    = new MacAlg("NULL",     0,   0,   0);
++    final static MacAlg M_MD5     = new MacAlg("MD5",     16,  64,   9);
++    final static MacAlg M_SHA     = new MacAlg("SHA",     20,  64,   9);
+ 
+     static {
+         idMap = new HashMap<Integer,CipherSuite>();
+diff --git a/src/share/classes/sun/security/ssl/EngineInputRecord.java b/src/share/classes/sun/security/ssl/EngineInputRecord.java
+--- jdk/src/share/classes/sun/security/ssl/EngineInputRecord.java
++++ jdk/src/share/classes/sun/security/ssl/EngineInputRecord.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -177,71 +177,6 @@ final class EngineInputRecord extends In
+     }
+ 
+     /*
+-     * Verifies and removes the MAC value.  Returns true if
+-     * the MAC checks out OK.
+-     *
+-     * On entry:
+-     *     position = beginning of app/MAC data
+-     *     limit = end of MAC data.
+-     *
+-     * On return:
+-     *     position = beginning of app data
+-     *     limit = end of app data
+-     */
+-    boolean checkMAC(MAC signer, ByteBuffer bb) {
+-        if (internalData) {
+-            return checkMAC(signer);
+-        }
+-
+-        int len = signer.MAClen();
+-        if (len == 0) { // no mac
+-            return true;
+-        }
+-
+-        /*
+-         * Grab the original limit
+-         */
+-        int lim = bb.limit();
+-
+-        /*
+-         * Delineate the area to apply a MAC on.
+-         */
+-        int macData = lim - len;
+-        bb.limit(macData);
+-
+-        byte[] mac = signer.compute(contentType(), bb);
+-
+-        if (len != mac.length) {
+-            throw new RuntimeException("Internal MAC error");
+-        }
+-
+-        /*
+-         * Delineate the MAC values, position was already set
+-         * by doing the compute above.
+-         *
+-         * We could zero the MAC area, but not much useful information
+-         * there anyway.
+-         */
+-        bb.position(macData);
+-        bb.limit(lim);
+-
+-        try {
+-            for (int i = 0; i < len; i++) {
+-                if (bb.get() != mac[i]) {  // No BB.equals(byte []); !
+-                    return false;
+-                }
+-            }
+-            return true;
+-        } finally {
+-            /*
+-             * Position to the data.
+-             */
+-            bb.rewind();
+-            bb.limit(macData);
+-        }
+-    }
+-
+-    /*
+      * Pass the data down if it's internally cached, otherwise
+      * do it here.
+      *
+@@ -250,18 +185,161 @@ final class EngineInputRecord extends In
+      * If external data(app), return a new ByteBuffer with data to
+      * process.
+      */
+-    ByteBuffer decrypt(CipherBox box, ByteBuffer bb)
+-            throws BadPaddingException {
++    ByteBuffer decrypt(MAC signer,
++            CipherBox box, ByteBuffer bb) throws BadPaddingException {
+ 
+         if (internalData) {
+-            decrypt(box);
++            decrypt(signer, box);   // MAC is checked during decryption
+             return tmpBB;
+         }
+ 
+-        box.decrypt(bb);
+-        bb.rewind();
++        BadPaddingException reservedBPE = null;
++        int tagLen = signer.MAClen();
++        int cipheredLength = bb.remaining();
++
++        if (!box.isNullCipher()) {
++            // sanity check length of the ciphertext
++            if (!box.sanityCheck(tagLen, cipheredLength)) {
++                throw new BadPaddingException(
++                    "ciphertext sanity check failed");
++            }
++
++            try {
++                // Note that the CipherBox.decrypt() does not change
++                // the capacity of the buffer.
++                box.decrypt(bb, tagLen);
++            } catch (BadPaddingException bpe) {
++                // RFC 2246 states that decryption_failed should be used
++                // for this purpose. However, that allows certain attacks,
++                // so we just send bad record MAC. We also need to make
++                // sure to always check the MAC to avoid a timing attack
++                // for the same issue. See paper by Vaudenay et al and the
++                // update in RFC 4346/5246.
++                //
++                // Failover to message authentication code checking.
++                reservedBPE = bpe;
++            } finally {
++                bb.rewind();
++            }
++        }
++
++        if (tagLen != 0) {
++            int macOffset = bb.limit() - tagLen;
++
++            // Note that although it is not necessary, we run the same MAC
++            // computation and comparison on the payload for both stream
++            // cipher and CBC block cipher.
++            if (bb.remaining() < tagLen) {
++                // negative data length, something is wrong
++                if (reservedBPE == null) {
++                    reservedBPE = new BadPaddingException("bad record");
++                }
++
++                // set offset of the dummy MAC
++                macOffset = cipheredLength - tagLen;
++                bb.limit(cipheredLength);
++            }
++
++            // Run MAC computation and comparison on the payload.
++            if (checkMacTags(contentType(), bb, signer, false)) {
++                if (reservedBPE == null) {
++                    reservedBPE = new BadPaddingException("bad record MAC");
++                }
++            }
++
++            // Run MAC computation and comparison on the remainder.
++            //
++            // It is only necessary for CBC block cipher.  It is used to get a
++            // constant time of MAC computation and comparison on each record.
++            if (box.isCBCMode()) {
++                int remainingLen = calculateRemainingLen(
++                                        signer, cipheredLength, macOffset);
++
++                // NOTE: here we use the InputRecord.buf because I did not find
++                // an effective way to work on ByteBuffer when its capacity is 
++                // less than remainingLen.
++
++                // NOTE: remainingLen may be bigger (less than 1 block of the
++                // hash algorithm of the MAC) than the cipheredLength. However,
++                // We won't need to worry about it because we always use a
++                // maximum buffer for every record.  We need a change here if
++                // we use small buffer size in the future.
++                if (remainingLen > buf.length) {
++                    // unlikely to happen, just a placehold
++                    throw new RuntimeException(
++                        "Internal buffer capacity error");
++                }
++
++                // Won't need to worry about the result on the remainder. And
++                // then we won't need to worry about what's actual data to
++                // check MAC tag on.  We start the check from the header of the
++                // buffer so that we don't need to construct a new byte buffer.
++                checkMacTags(contentType(), buf, 0, remainingLen, signer, true);
++            }
++
++            bb.limit(macOffset);
++        }
++
++        // Is it a failover?
++        if (reservedBPE != null) {
++            throw reservedBPE;
++        }
+ 
+         return bb.slice();
++    }
++
++    /*
++     * Run MAC computation and comparison
++     *
++     * Please DON'T change the content of the ByteBuffer parameter!
++     */
++    private static boolean checkMacTags(byte contentType, ByteBuffer bb,
++            MAC signer, boolean isSimulated) {
++
++        int tagLen = signer.MAClen();
++        int lim = bb.limit();
++        int macData = lim - tagLen;
++
++        bb.limit(macData);
++        byte[] hash = signer.compute(contentType, bb, isSimulated);
++        if (hash == null || tagLen != hash.length) {
++            // Something is wrong with MAC implementation.
++            throw new RuntimeException("Internal MAC error");
++        }
++
++        bb.position(macData);
++        bb.limit(lim);
++        try {
++            int[] results = compareMacTags(bb, hash);
++            return (results[0] != 0);
++        } finally {
++            bb.rewind();
++            bb.limit(macData);
++        }
++    }
++
++    /*
++     * A constant-time comparison of the MAC tags.
++     *
++     * Please DON'T change the content of the ByteBuffer parameter!
++     */
++    private static int[] compareMacTags(ByteBuffer bb, byte[] tag) {
++
++        // An array of hits is used to prevent Hotspot optimization for
++        // the purpose of a constant-time check.
++        int[] results = {0, 0};     // {missed #, matched #}
++
++        // The caller ensures there are enough bytes available in the buffer.
++        // So we won't need to check the remaining of the buffer.
++        for (int i = 0; i < tag.length; i++) {
++            if (bb.get() != tag[i]) {
++                results[0]++;       // mismatched bytes
++            } else {
++                results[1]++;       // matched bytes
++            }
++        }
++
++        return results;
+     }
+ 
+     /*
+diff --git a/src/share/classes/sun/security/ssl/EngineOutputRecord.java b/src/share/classes/sun/security/ssl/EngineOutputRecord.java
+--- jdk/src/share/classes/sun/security/ssl/EngineOutputRecord.java
++++ jdk/src/share/classes/sun/security/ssl/EngineOutputRecord.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -120,7 +120,7 @@ final class EngineOutputRecord extends O
+             throws IOException {
+ 
+         if (signer.MAClen() != 0) {
+-            byte[] hash = signer.compute(contentType(), bb);
++            byte[] hash = signer.compute(contentType(), bb, false);
+ 
+             /*
+              * position was advanced to limit in compute above.
+diff --git a/src/share/classes/sun/security/ssl/InputRecord.java b/src/share/classes/sun/security/ssl/InputRecord.java
+--- jdk/src/share/classes/sun/security/ssl/InputRecord.java
++++ jdk/src/share/classes/sun/security/ssl/InputRecord.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
+@@ -135,43 +135,173 @@ class InputRecord extends ByteArrayInput
+         return handshakeHash;
+     }
+ 
+-    /*
+-     * Verify and remove the MAC ... used for all records.
+-     */
+-    boolean checkMAC(MAC signer) {
+-        int len = signer.MAClen();
+-        if (len == 0) { // no mac
+-            return true;
++    void decrypt(MAC signer, CipherBox box) throws BadPaddingException {
++
++        BadPaddingException reservedBPE = null;
++        int tagLen = signer.MAClen();
++        int cipheredLength = count - headerSize;
++
++        if (!box.isNullCipher()) {
++            // sanity check length of the ciphertext
++            if (!box.sanityCheck(tagLen, cipheredLength)) {
++                throw new BadPaddingException(
++                    "ciphertext sanity check failed");
++            }
++
++            try {
++                // Note that the CipherBox.decrypt() does not change
++                // the capacity of the buffer.
++                count = headerSize +
++                        box.decrypt(buf, headerSize, cipheredLength, tagLen);
++            } catch (BadPaddingException bpe) {
++                // RFC 2246 states that decryption_failed should be used
++                // for this purpose. However, that allows certain attacks,
++                // so we just send bad record MAC. We also need to make
++                // sure to always check the MAC to avoid a timing attack
++                // for the same issue. See paper by Vaudenay et al and the
++                // update in RFC 4346/5246.
++                //
++                // Failover to message authentication code checking.
++                reservedBPE = bpe;
++            }
+         }
+ 
+-        int offset = count - len;
++        if (tagLen != 0) {
++            int macOffset = count - tagLen;
++            int contentLen = macOffset - headerSize;
+ 
+-        if (offset < headerSize) {
+-            // data length would be negative, something is wrong
+-            return false;
++            // Note that although it is not necessary, we run the same MAC
++            // computation and comparison on the payload for both stream
++            // cipher and CBC block cipher.
++            if (contentLen < 0) {
++                // negative data length, something is wrong
++                if (reservedBPE == null) {
++                    reservedBPE = new BadPaddingException("bad record");
++                }
++
++                // set offset of the dummy MAC
++                macOffset = headerSize + cipheredLength - tagLen;
++                contentLen = macOffset - headerSize;
++            }
++
++            count -= tagLen;  // Set the count before any MAC checking
++                              // exception occurs, so that the following
++                              // process can read the actual decrypted
++                              // content (minus the MAC) in the fragment
++                              // if necessary.
++
++            // Run MAC computation and comparison on the payload.
++            if (checkMacTags(contentType(),
++                    buf, headerSize, contentLen, signer, false)) {
++                if (reservedBPE == null) {
++                    reservedBPE = new BadPaddingException("bad record MAC");
++                }
++            }
++
++            // Run MAC computation and comparison on the remainder.
++            //
++            // It is only necessary for CBC block cipher.  It is used to get a
++            // constant time of MAC computation and comparison on each record.
++            if (box.isCBCMode()) {
++                int remainingLen = calculateRemainingLen(
++                                        signer, cipheredLength, contentLen);
++
++                // NOTE: remainingLen may be bigger (less than 1 block of the
++                // hash algorithm of the MAC) than the cipheredLength. However,
++                // We won't need to worry about it because we always use a
++                // maximum buffer for every record.  We need a change here if
++                // we use small buffer size in the future. 
++                if (remainingLen > buf.length) {
++                    // unlikely to happen, just a placehold
++                    throw new RuntimeException(
++                        "Internal buffer capacity error");
++                }
++
++                // Won't need to worry about the result on the remainder. And
++                // then we won't need to worry about what's actual data to
++                // check MAC tag on.  We start the check from the header of the
++                // buffer so that we don't need to construct a new byte buffer.
++                checkMacTags(contentType(), buf, 0, remainingLen, signer, true);
++            }
+         }
+ 
+-        byte[] mac = signer.compute(contentType(), buf,
+-            headerSize, offset - headerSize);
++        // Is it a failover?
++        if (reservedBPE != null) {
++            throw reservedBPE;
++        }
++    }
+ 
+-        if (len != mac.length) {
++    /*
++     * Run MAC computation and comparison
++     *
++     * Please DON'T change the content of the byte buffer parameter!
++     */
++    static boolean checkMacTags(byte contentType, byte[] buffer,
++            int offset, int contentLen, MAC signer, boolean isSimulated) {
++
++        int tagLen = signer.MAClen();
++        byte[] hash = signer.compute(
++                contentType, buffer, offset, contentLen, isSimulated);
++        if (hash == null || tagLen != hash.length) {
++            // Something is wrong with MAC implementation.
+             throw new RuntimeException("Internal MAC error");
+         }
+ 
+-        for (int i = 0; i < len; i++) {
+-            if (buf[offset + i] != mac[i]) {
+-                return false;
++        int[] results = compareMacTags(buffer, offset + contentLen, hash);
++        return (results[0] != 0);
++    }
++
++    /*
++     * A constant-time comparison of the MAC tags.
++     *
++     * Please DON'T change the content of the byte buffer parameter!
++     */
++    private static int[] compareMacTags(
++            byte[] buffer, int offset, byte[] tag) {
++
++        // An array of hits is used to prevent Hotspot optimization for
++        // the purpose of a constant-time check.
++        int[] results = {0, 0};    // {missed #, matched #}
++
++        // The caller ensures there are enough bytes available in the buffer.
++        // So we won't need to check the length of the buffer.
++        for (int i = 0; i < tag.length; i++) {
++            if (buffer[offset + i] != tag[i]) {
++                results[0]++;       // mismatched bytes
++            } else {
++                results[1]++;       // matched bytes
+             }
+         }
+-        count -= len;
+-        return true;
++
++        return results;
+     }
+ 
+-    void decrypt(CipherBox box) throws BadPaddingException {
+-        int len = count - headerSize;
+-        count = headerSize + box.decrypt(buf, headerSize, len);
++    /*
++     * Calculate the length of a dummy buffer to run MAC computation
++     * and comparison on the remainder.
++     *
++     * The caller MUST ensure that the fullLen is not less than usedLen.
++     */
++    static int calculateRemainingLen(
++            MAC signer, int fullLen, int usedLen) {
++
++        int blockLen = signer.hashBlockLen();
++        int minimalPaddingLen = signer.minimalPaddingLen();
++
++        // (blockLen - minimalPaddingLen) is the maximum message size of
++        // the last block of hash function operation. See FIPS 180-4, or
++        // MD5 specification.
++        fullLen += 13 - (blockLen - minimalPaddingLen);
++        usedLen += 13 - (blockLen - minimalPaddingLen);
++
++        // Note: fullLen is always not less than usedLen, and blockLen
++        // is always bigger than minimalPaddingLen, so we don't worry
++        // about negative values. 0x01 is added to the result to ensure
++        // that the return value is positive.  The extra one byte does
++        // not impact the overall MAC compression function evaluations.
++        return 0x01 + (int)(Math.ceil(fullLen/(1.0d * blockLen)) -
++                Math.ceil(usedLen/(1.0d * blockLen))) * signer.hashBlockLen();
+     }
+-
+ 
+     /*
+      * Well ... hello_request messages are _never_ hashed since we can't
+diff --git a/src/share/classes/sun/security/ssl/MAC.java b/src/share/classes/sun/security/ssl/MAC.java
+--- jdk/src/share/classes/sun/security/ssl/MAC.java
++++ jdk/src/share/classes/sun/security/ssl/MAC.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
+@@ -44,7 +44,8 @@ import static sun.security.ssl.CipherSui
+  * one of several keyed hashes, as associated with the cipher suite and
+  * protocol version.  (SSL v3.0 uses one construct, TLS uses another.)
+  *
+- * <P>NOTE: MAC computation is the only place in the SSL protocol that the
++ * <P>
++ * NOTE: MAC computation is the only place in the SSL protocol that the
+  * sequence number is used.  It's also reset to zero with each change of
+  * a cipher spec, so this is the only place this state is needed.
+  *
+@@ -129,15 +130,31 @@ final class MAC {
+     }
+ 
+     /**
++     * Returns the hash function block length of the MAC alorithm.
++     */
++    int hashBlockLen() {
++        return macAlg.hashBlockSize;
++    }
++
++    /**
++     * Returns the hash function minimal padding length of the MAC alorithm.
++     */
++    int minimalPaddingLen() {
++        return macAlg.minimalPaddingSize;
++    }
++
++    /**
+      * Computes and returns the MAC for the data in this byte array.
+      *
+      * @param type record type
+      * @param buf compressed record on which the MAC is computed
+      * @param offset start of compressed record data
+      * @param len the size of the compressed record
++     * @param isSimulated if true, simulate the the MAC computation
+      */
+-    final byte[] compute(byte type, byte buf[], int offset, int len) {
+-        return compute(type, null, buf, offset, len);
++    final byte[] compute(byte type, byte buf[],
++            int offset, int len, boolean isSimulated) {
++        return compute(type, null, buf, offset, len, isSimulated);
+     }
+ 
+     /**
+@@ -150,9 +167,10 @@ final class MAC {
+      * @param type record type
+      * @param bb a ByteBuffer in which the position and limit
+      *          demarcate the data to be MAC'd.
++     * @param isSimulated if true, simulate the the MAC computation
+      */
+-    final byte[] compute(byte type, ByteBuffer bb) {
+-        return compute(type, bb, null, 0, bb.remaining());
++    final byte[] compute(byte type, ByteBuffer bb, boolean isSimulated) {
++        return compute(type, bb, null, 0, bb.remaining(), isSimulated);
+     }
+ 
+     // increment the sequence number in the block array
+@@ -168,18 +186,22 @@ final class MAC {
+      * Compute based on either buffer type, either bb.position/limit
+      * or buf/offset/len.
+      */
+-    private byte[] compute(byte type, ByteBuffer bb, byte[] buf, int offset, int len) {
++    private byte[] compute(byte type, ByteBuffer bb, byte[] buf,
++            int offset, int len, boolean isSimulated) {
+ 
+         if (macSize == 0) {
+             return nullMAC;
+         }
+ 
+-        block[BLOCK_OFFSET_TYPE] = type;
+-        block[block.length - 2]  = (byte)(len >> 8);
+-        block[block.length - 1]  = (byte)(len     );
++        // MUST NOT increase the sequence number for a simulated computation.
++        if (!isSimulated) {
++            block[BLOCK_OFFSET_TYPE] = type;
++            block[block.length - 2]  = (byte)(len >> 8);
++            block[block.length - 1]  = (byte)(len     );
+ 
+-        mac.update(block);
+-        incrementSequenceNumber();
++            mac.update(block);
++            incrementSequenceNumber();
++        }
+ 
+         // content
+         if (bb != null) {
+diff --git a/src/share/classes/sun/security/ssl/OutputRecord.java b/src/share/classes/sun/security/ssl/OutputRecord.java
+--- jdk/src/share/classes/sun/security/ssl/OutputRecord.java
++++ jdk/src/share/classes/sun/security/ssl/OutputRecord.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1996, 2012, 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
+@@ -204,7 +204,7 @@ class OutputRecord extends ByteArrayOutp
+         }
+         if (signer.MAClen() != 0) {
+             byte[] hash = signer.compute(contentType, buf,
+-                    headerSize, count - headerSize);
++                    headerSize, count - headerSize, false);
+             write(hash);
+         }
+     }
+diff --git a/src/share/classes/sun/security/ssl/SSLEngineImpl.java b/src/share/classes/sun/security/ssl/SSLEngineImpl.java
+--- jdk/src/share/classes/sun/security/ssl/SSLEngineImpl.java
++++ jdk/src/share/classes/sun/security/ssl/SSLEngineImpl.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -919,34 +919,13 @@ final public class SSLEngineImpl extends
+              * throw a fatal alert if the integrity check fails.
+              */
+             try {
+-                decryptedBB = inputRecord.decrypt(readCipher, readBB);
++                decryptedBB = inputRecord.decrypt(readMAC, readCipher, readBB);
+             } catch (BadPaddingException e) {
+-                // RFC 2246 states that decryption_failed should be used
+-                // for this purpose. However, that allows certain attacks,
+-                // so we just send bad record MAC. We also need to make
+-                // sure to always check the MAC to avoid a timing attack
+-                // for the same issue. See paper by Vaudenay et al.
+-                //
+-                // rewind the BB if necessary.
+-                readBB.rewind();
+-
+-                inputRecord.checkMAC(readMAC, readBB);
+-
+-                // use the same alert types as for MAC failure below
+                 byte alertType = (inputRecord.contentType() ==
+                     Record.ct_handshake) ?
+                         Alerts.alert_handshake_failure :
+                         Alerts.alert_bad_record_mac;
+-                fatal(alertType, "Invalid padding", e);
+-            }
+-
+-            if (!inputRecord.checkMAC(readMAC, decryptedBB)) {
+-                if (inputRecord.contentType() == Record.ct_handshake) {
+-                    fatal(Alerts.alert_handshake_failure,
+-                        "bad handshake record MAC");
+-                } else {
+-                    fatal(Alerts.alert_bad_record_mac, "bad record MAC");
+-                }
++                fatal(alertType, e.getMessage(), e);
+             }
+ 
+             // if (!inputRecord.decompress(c))
+diff --git a/src/share/classes/sun/security/ssl/SSLSocketImpl.java b/src/share/classes/sun/security/ssl/SSLSocketImpl.java
+--- jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java
++++ jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1996, 2012, 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
+@@ -922,27 +922,12 @@ final public class SSLSocketImpl extends
+              * throw a fatal alert if the integrity check fails.
+              */
+             try {
+-                r.decrypt(readCipher);
++                r.decrypt(readMAC, readCipher);
+             } catch (BadPaddingException e) {
+-                // RFC 2246 states that decryption_failed should be used
+-                // for this purpose. However, that allows certain attacks,
+-                // so we just send bad record MAC. We also need to make
+-                // sure to always check the MAC to avoid a timing attack
+-                // for the same issue. See paper by Vaudenay et al.
+-                r.checkMAC(readMAC);
+-                // use the same alert types as for MAC failure below
+                 byte alertType = (r.contentType() == Record.ct_handshake)
+                                         ? Alerts.alert_handshake_failure
+                                         : Alerts.alert_bad_record_mac;
+-                fatal(alertType, "Invalid padding", e);
+-            }
+-            if (!r.checkMAC(readMAC)) {
+-                if (r.contentType() == Record.ct_handshake) {
+-                    fatal(Alerts.alert_handshake_failure,
+-                        "bad handshake record MAC");
+-                } else {
+-                    fatal(Alerts.alert_bad_record_mac, "bad record MAC");
+-                }
++                fatal(alertType, e.getMessage(), e);
+             }
+ 
+             // if (!r.decompress(c))

Added: trunk/java/openjdk6/files/icedtea/security/20130219/8007688.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130219/8007688.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130219/8007688.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,130 @@
+# 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-----");
++
+     }
+ }

Added: trunk/java/openjdk6/files/icedtea/security/20130304/8007014.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130304/8007014.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130304/8007014.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,463 @@
+# 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__
+

Added: trunk/java/openjdk6/files/icedtea/security/20130304/8007675.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130304/8007675.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130304/8007675.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,509 @@
+# 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;
+     }
+ }

Added: trunk/java/openjdk6/files/icedtea/security/20130416/6657673-factory_finder.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130416/6657673-factory_finder.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130416/6657673-factory_finder.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,54 @@
+--- /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 at 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 at 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();

Added: trunk/java/openjdk6/files/icedtea/security/20130416/6657673-fixup.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130416/6657673-fixup.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130416/6657673-fixup.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,228 @@
+--- /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);
++ 

Added: trunk/java/openjdk6/files/icedtea/security/20130416/6657673.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130416/6657673.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130416/6657673.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,9381 @@
+--- /dev/null	2013-04-25 14:33:00.000000000 -0400
++++ jaxp/patches/jaxp_src/6657673.patch	2013-04-25 14:43:01.000000000 -0400
+@@ -0,0 +1,9198 @@
++--- src/com/sun/org/apache/bcel/internal/classfile/JavaClass.java	2013-04-16 14:28:09.232148559 +0100
+++++ src/com/sun/org/apache/bcel/internal/classfile/JavaClass.java	2013-04-16 14:29:26.549394382 +0100
++@@ -63,6 +63,7 @@
++ import  com.sun.org.apache.bcel.internal.util.ClassVector;
++ import  com.sun.org.apache.bcel.internal.util.ClassQueue;
++ import  com.sun.org.apache.bcel.internal.generic.Type;
+++import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
++ 
++ import  java.io.*;
++ import  java.util.StringTokenizer;
++@@ -77,6 +78,7 @@
++  * class file.  Those interested in programatically generating classes
++  * should see the <a href="../generic/ClassGen.html">ClassGen</a> class.
++ 
+++ * @version $Id: JavaClass.java,v 1.4 2007-07-19 04:34:42 ofung Exp $
++  * @see com.sun.org.apache.bcel.internal.generic.ClassGen
++  * @author  <A HREF="mailto:markus.dahm at berlin.de">M. Dahm</A>
++  */
++@@ -451,9 +453,9 @@
++     String debug = null, sep = null;
++ 
++     try {
++-      debug = System.getProperty("JavaClass.debug");
+++      debug = SecuritySupport.getSystemProperty("JavaClass.debug");
++       // Get path separator either / or \ usually
++-      sep = System.getProperty("file.separator");
+++      sep = SecuritySupport.getSystemProperty("file.separator");
++     }
++     catch (SecurityException e) {
++         // falls through
++--- src/com/sun/org/apache/bcel/internal/util/Class2HTML.java	2013-04-16 14:28:09.312149848 +0100
+++++ src/com/sun/org/apache/bcel/internal/util/Class2HTML.java	2013-04-16 14:29:26.549394382 +0100
++@@ -82,6 +82,7 @@
++  * method in the Method's frame will jump to the appropiate method in
++  * the Code frame.
++  *
+++ * @version $Id: Class2HTML.java,v 1.3 2007-07-19 04:34:52 ofung Exp $
++  * @author <A HREF="mailto:markus.dahm at berlin.de">M. Dahm</A>
++ */
++ public class Class2HTML implements Constants
++@@ -137,7 +138,7 @@
++     ClassParser parser=null;
++     JavaClass   java_class=null;
++     String      zip_file = null;
++-    char        sep = System.getProperty("file.separator").toCharArray()[0];
+++    char        sep = SecuritySupport.getSystemProperty("file.separator").toCharArray()[0];
++     String      dir = "." + sep; // Where to store HTML files
++ 
++     try {
++--- src/com/sun/org/apache/bcel/internal/util/ClassPath.java	2013-04-16 14:28:09.316149912 +0100
+++++ src/com/sun/org/apache/bcel/internal/util/ClassPath.java	2013-04-16 14:29:26.549394382 +0100
++@@ -66,6 +66,7 @@
++  * Responsible for loading (class) files from the CLASSPATH. Inspired by
++  * sun.tools.ClassPath.
++  *
+++ * @version $Id: ClassPath.java,v 1.4 2007-07-19 04:34:52 ofung Exp $
++  * @author  <A HREF="mailto:markus.dahm at berlin.de">M. Dahm</A>
++  */
++ public class ClassPath implements Serializable {
++@@ -83,7 +84,7 @@
++     ArrayList vec = new ArrayList();
++ 
++     for(StringTokenizer tok=new StringTokenizer(class_path,
++-                                                System.getProperty("path.separator"));
+++                            SecuritySupport.getSystemProperty("path.separator"));
++         tok.hasMoreTokens();)
++     {
++       String path = tok.nextToken();
++@@ -92,7 +93,7 @@
++         File file = new File(path);
++ 
++         try {
++-          if(file.exists()) {
+++          if(SecuritySupport.getFileExists(file)) {
++             if(file.isDirectory())
++               vec.add(new Dir(path));
++             else
++@@ -143,8 +144,9 @@
++         String name = tok.nextToken();
++         File   file = new File(name);
++ 
++-        if(file.exists())
+++        if(SecuritySupport.getFileExists(file)) {
++           list.add(name);
+++        }
++       }
++     }
++   }
++@@ -159,9 +161,9 @@
++     String class_path, boot_path, ext_path;
++ 
++     try {
++-      class_path = System.getProperty("java.class.path");
++-      boot_path  = System.getProperty("sun.boot.class.path");
++-      ext_path   = System.getProperty("java.ext.dirs");
+++      class_path = SecuritySupport.getSystemProperty("java.class.path");
+++      boot_path  = SecuritySupport.getSystemProperty("sun.boot.class.path");
+++      ext_path   = SecuritySupport.getSystemProperty("java.ext.dirs");
++     }
++     catch (SecurityException e) {
++         return "";
++@@ -176,8 +178,8 @@
++     getPathComponents(ext_path, dirs);
++ 
++     for(Iterator e = dirs.iterator(); e.hasNext(); ) {
++-      File     ext_dir    = new File((String)e.next());
++-      String[] extensions = ext_dir.list(new FilenameFilter() {
+++      File ext_dir = new File((String)e.next());
+++      String[] extensions = SecuritySupport.getFileList(ext_dir, new FilenameFilter() {
++         public boolean accept(File dir, String name) {
++           name = name.toLowerCase();
++           return name.endsWith(".zip") || name.endsWith(".jar");
++@@ -342,7 +344,7 @@
++       final File file = new File(dir + File.separatorChar +
++                                  name.replace('.', File.separatorChar) + suffix);
++ 
++-      return file.exists()? new ClassFile() {
+++      return SecuritySupport.getFileExists(file)? new ClassFile() {
++         public InputStream getInputStream() throws IOException { return new FileInputStream(file); }
++ 
++         public String      getPath()        { try {
++--- src/com/sun/org/apache/bcel/internal/util/JavaWrapper.java	2013-04-16 14:28:09.316149912 +0100
+++++ src/com/sun/org/apache/bcel/internal/util/JavaWrapper.java	2013-04-16 14:29:26.549394382 +0100
++@@ -72,6 +72,7 @@
++  * <pre>java com.sun.org.apache.bcel.internal.util.JavaWrapper -Dbcel.classloader=foo.MyLoader <real.class.name> [arguments]</pre>
++  * </p>
++  *
+++ * @version $Id: JavaWrapper.java,v 1.3 2007-07-19 04:34:52 ofung Exp $
++  * @author  <A HREF="mailto:markus.dahm at berlin.de">M. Dahm</A>
++  * @see ClassLoader
++  */
++@@ -79,7 +80,7 @@
++   private java.lang.ClassLoader loader;
++ 
++   private static java.lang.ClassLoader getClassLoader() {
++-    String s = System.getProperty("bcel.classloader");
+++    String s = SecuritySupport.getSystemProperty("bcel.classloader");
++ 
++     if((s == null) || "".equals(s))
++       s = "com.sun.org.apache.bcel.internal.util.ClassLoader";
++--- src/com/sun/org/apache/bcel/internal/util/SecuritySupport.java	1970-01-01 01:00:00.000000000 +0100
+++++ src/com/sun/org/apache/bcel/internal/util/SecuritySupport.java	2013-04-16 14:29:26.549394382 +0100
++@@ -0,0 +1,223 @@
+++/*
+++ * reserved comment block
+++ * DO NOT REMOVE OR ALTER!
+++ */
+++/*
+++ * Copyright 2002-2004 The Apache Software Foundation.
+++ *
+++ * Licensed under the Apache License, Version 2.0 (the "License");
+++ * you may not use this file except in compliance with the License.
+++ * You may obtain a copy of the License at
+++ *
+++ *     http://www.apache.org/licenses/LICENSE-2.0
+++ *
+++ * Unless required by applicable law or agreed to in writing, software
+++ * distributed under the License is distributed on an "AS IS" BASIS,
+++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+++ * See the License for the specific language governing permissions and
+++ * limitations under the License.
+++ */
+++
+++package com.sun.org.apache.bcel.internal.util;
+++
+++import java.io.File;
+++import java.io.FileInputStream;
+++import java.io.FileNotFoundException;
+++import java.io.FilenameFilter;
+++import java.io.InputStream;
+++import java.lang.ClassLoader;
+++import java.security.AccessController;
+++import java.security.PrivilegedAction;
+++import java.security.PrivilegedActionException;
+++import java.security.PrivilegedExceptionAction;
+++import java.util.ListResourceBundle;
+++import java.util.Locale;
+++import java.util.MissingResourceException;
+++import java.util.ResourceBundle;
+++
+++/**
+++ * This class is duplicated for each subpackage so keep it in sync. It is
+++ * package private and therefore is not exposed as part of any API.
+++ *
+++ * @xerces.internal
+++ */
+++public final class SecuritySupport {
+++
+++    private static final SecuritySupport securitySupport = new SecuritySupport();
+++
+++    /**
+++     * Return an instance of this class.
+++     */
+++    public static SecuritySupport getInstance() {
+++        return securitySupport;
+++    }
+++
+++    static ClassLoader getContextClassLoader() {
+++        return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
+++            public Object run() {
+++                ClassLoader cl = null;
+++                try {
+++                    cl = Thread.currentThread().getContextClassLoader();
+++                } catch (SecurityException ex) {
+++                }
+++                return cl;
+++            }
+++        });
+++    }
+++
+++    static ClassLoader getSystemClassLoader() {
+++        return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
+++            public Object run() {
+++                ClassLoader cl = null;
+++                try {
+++                    cl = ClassLoader.getSystemClassLoader();
+++                } catch (SecurityException ex) {
+++                }
+++                return cl;
+++            }
+++        });
+++    }
+++
+++    static ClassLoader getParentClassLoader(final ClassLoader cl) {
+++        return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
+++            public Object run() {
+++                ClassLoader parent = null;
+++                try {
+++                    parent = cl.getParent();
+++                } catch (SecurityException ex) {
+++                }
+++
+++                // eliminate loops in case of the boot
+++                // ClassLoader returning itself as a parent
+++                return (parent == cl) ? null : parent;
+++            }
+++        });
+++    }
+++
+++    public static String getSystemProperty(final String propName) {
+++        return (String) AccessController.doPrivileged(new PrivilegedAction() {
+++            public Object run() {
+++                return System.getProperty(propName);
+++            }
+++        });
+++    }
+++
+++    static FileInputStream getFileInputStream(final File file)
+++            throws FileNotFoundException {
+++        try {
+++            return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() {
+++                public Object run() throws FileNotFoundException {
+++                    return new FileInputStream(file);
+++                }
+++            });
+++        } catch (PrivilegedActionException e) {
+++            throw (FileNotFoundException) e.getException();
+++        }
+++    }
+++
+++    /**
+++     * Return resource using the same classloader for the ObjectFactory by
+++     * default or bootclassloader when Security Manager is in place
+++     */
+++    public static InputStream getResourceAsStream(final String name) {
+++        if (System.getSecurityManager() != null) {
+++            return getResourceAsStream(null, name);
+++        } else {
+++            return getResourceAsStream(findClassLoader(), name);
+++        }
+++    }
+++
+++    public static InputStream getResourceAsStream(final ClassLoader cl,
+++            final String name) {
+++        return (InputStream) AccessController.doPrivileged(new PrivilegedAction() {
+++            public Object run() {
+++                InputStream ris;
+++                if (cl == null) {
+++                    ris = Object.class.getResourceAsStream("/" + name);
+++                } else {
+++                    ris = cl.getResourceAsStream(name);
+++                }
+++                return ris;
+++            }
+++        });
+++    }
+++
+++    /**
+++     * Gets a resource bundle using the specified base name, the default locale,
+++     * and the caller's class loader.
+++     *
+++     * @param bundle the base name of the resource bundle, a fully qualified
+++     * class name
+++     * @return a resource bundle for the given base name and the default locale
+++     */
+++    public static ListResourceBundle getResourceBundle(String bundle) {
+++        return getResourceBundle(bundle, Locale.getDefault());
+++    }
+++
+++    /**
+++     * Gets a resource bundle using the specified base name and locale, and the
+++     * caller's class loader.
+++     *
+++     * @param bundle the base name of the resource bundle, a fully qualified
+++     * class name
+++     * @param locale the locale for which a resource bundle is desired
+++     * @return a resource bundle for the given base name and locale
+++     */
+++    public static ListResourceBundle getResourceBundle(final String bundle, final Locale locale) {
+++        return AccessController.doPrivileged(new PrivilegedAction<ListResourceBundle>() {
+++            public ListResourceBundle run() {
+++                try {
+++                    return (ListResourceBundle) ResourceBundle.getBundle(bundle, locale);
+++                } catch (MissingResourceException e) {
+++                    try {
+++                        return (ListResourceBundle) ResourceBundle.getBundle(bundle, new Locale("en", "US"));
+++                    } catch (MissingResourceException e2) {
+++                        throw new MissingResourceException(
+++                                "Could not load any resource bundle by " + bundle, bundle, "");
+++                    }
+++                }
+++            }
+++        });
+++    }
+++
+++    public static String[] getFileList(final File f, final FilenameFilter filter) {
+++        return ((String[]) AccessController.doPrivileged(new PrivilegedAction() {
+++            public Object run() {
+++                return f.list(filter);
+++            }
+++        }));
+++    }
+++
+++    public static boolean getFileExists(final File f) {
+++        return ((Boolean) AccessController.doPrivileged(new PrivilegedAction() {
+++            public Object run() {
+++                return f.exists() ? Boolean.TRUE : Boolean.FALSE;
+++            }
+++        })).booleanValue();
+++    }
+++
+++    static long getLastModified(final File f) {
+++        return ((Long) AccessController.doPrivileged(new PrivilegedAction() {
+++            public Object run() {
+++                return new Long(f.lastModified());
+++            }
+++        })).longValue();
+++    }
+++
+++
+++    /**
+++     * Figure out which ClassLoader to use.
+++     */
+++    public static ClassLoader findClassLoader()
+++    {
+++        if (System.getSecurityManager()!=null) {
+++            //this will ensure bootclassloader is used
+++            return null;
+++        } else {
+++            return SecuritySupport.class.getClassLoader();
+++        }
+++    } // findClassLoader():ClassLoader
+++
+++    private SecuritySupport() {
+++    }
+++}
++--- src/com/sun/org/apache/xalan/internal/res/XSLMessages.java	2013-04-16 14:28:09.324150042 +0100
+++++ src/com/sun/org/apache/xalan/internal/res/XSLMessages.java	2013-04-16 14:29:26.549394382 +0100
++@@ -22,68 +22,72 @@
++  */
++ package com.sun.org.apache.xalan.internal.res;
++ 
+++import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
++ import java.util.ListResourceBundle;
++ 
++ import com.sun.org.apache.xpath.internal.res.XPATHMessages;
++ 
++ /**
++- * Sets things up for issuing error messages.  This class is misnamed, and
++- * should be called XalanMessages, or some such.
+++ * Sets things up for issuing error messages. This class is misnamed, and should
+++ * be called XalanMessages, or some such.
+++ *
++  * @xsl.usage internal
++  */
++-public class XSLMessages extends XPATHMessages
++-{
+++public class XSLMessages extends XPATHMessages {
++ 
++-  /** The language specific resource object for Xalan messages.  */
++-  private static ListResourceBundle XSLTBundle = null;
++-
++-  /** The class name of the Xalan error message string table.    */
++-  private static final String XSLT_ERROR_RESOURCES =
++-    "com.sun.org.apache.xalan.internal.res.XSLTErrorResources";
++-
++-  /**
++-   * Creates a message from the specified key and replacement
++-   * arguments, localized to the given locale.
++-   *
++-   * @param msgKey    The key for the message text.
++-   * @param args      The arguments to be used as replacement text
++-   *                  in the message created.
++-   *
++-   * @return The formatted message string.
++-   */
++-  public static final String createMessage(String msgKey, Object args[])  //throws Exception
++-  {
++-    if (XSLTBundle == null)
++-      XSLTBundle = loadResourceBundle(XSLT_ERROR_RESOURCES);
++-
++-    if (XSLTBundle != null)
+++    /**
+++     * The language specific resource object for Xalan messages.
+++     */
+++    private static ListResourceBundle XSLTBundle = null;
+++    /**
+++     * The class name of the Xalan error message string table.
+++     */
+++    private static final String XSLT_ERROR_RESOURCES =
+++            "com.sun.org.apache.xalan.internal.res.XSLTErrorResources";
+++
+++    /**
+++     * Creates a message from the specified key and replacement arguments,
+++     * localized to the given locale.
+++     *
+++     * @param msgKey The key for the message text.
+++     * @param args The arguments to be used as replacement text in the message
+++     * created.
+++     *
+++     * @return The formatted message string.
+++     */
+++    public static String createMessage(String msgKey, Object args[]) //throws Exception
++     {
++-      return createMsg(XSLTBundle, msgKey, args);
+++        if (XSLTBundle == null) {
+++            XSLTBundle = SecuritySupport.getResourceBundle(XSLT_ERROR_RESOURCES);
+++        }
+++
+++        if (XSLTBundle != null) {
+++            return createMsg(XSLTBundle, msgKey, args);
+++        } else {
+++            return "Could not load any resource bundles.";
+++        }
++     }
++-    else
++-      return "Could not load any resource bundles.";
++-  }
++-
++-  /**
++-   * Creates a message from the specified key and replacement
++-   * arguments, localized to the given locale.
++-   *
++-   * @param msgKey    The key for the message text.
++-   * @param args      The arguments to be used as replacement text
++-   *                  in the message created.
++-   *
++-   * @return The formatted warning string.
++-   */
++-  public static final String createWarning(String msgKey, Object args[])  //throws Exception
++-  {
++-    if (XSLTBundle == null)
++-      XSLTBundle = loadResourceBundle(XSLT_ERROR_RESOURCES);
++ 
++-    if (XSLTBundle != null)
+++    /**
+++     * Creates a message from the specified key and replacement arguments,
+++     * localized to the given locale.
+++     *
+++     * @param msgKey The key for the message text.
+++     * @param args The arguments to be used as replacement text in the message
+++     * created.
+++     *
+++     * @return The formatted warning string.
+++     */
+++    public static String createWarning(String msgKey, Object args[]) //throws Exception
++     {
++-      return createMsg(XSLTBundle, msgKey, args);
+++        if (XSLTBundle == null) {
+++            XSLTBundle = SecuritySupport.getResourceBundle(XSLT_ERROR_RESOURCES);
+++        }
+++
+++        if (XSLTBundle != null) {
+++            return createMsg(XSLTBundle, msgKey, args);
+++        } else {
+++            return "Could not load any resource bundles.";
+++        }
++     }
++-    else
++-      return "Could not load any resource bundles.";
++-  }
++ }
++--- src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java	2013-04-16 14:28:09.328150105 +0100
+++++ src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java	2013-04-16 14:29:26.549394382 +0100
++@@ -2410,68 +2410,4 @@
++   public static final String QUERY_HEADER = "MUSTER ";
++ 
++ 
++-  /**
++-   *   Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   *   of ResourceBundle.getBundle().
++-   *
++-   *   @param className the name of the class that implements the resource bundle.
++-   *   @return the ResourceBundle
++-   *   @throws MissingResourceException
++-   */
++-  public static final XSLTErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XSLTErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XSLTErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("en", "US"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "Could not load any resource bundles.", className, "");
++-      }
++     }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++-
++-}
++--- src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_es.java	2013-04-16 14:28:09.332150170 +0100
+++++ src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_es.java	2013-04-16 14:29:26.549394382 +0100
++@@ -2409,69 +2409,4 @@
++    * @deprecated  */
++   public static final String QUERY_HEADER = "PATTERN ";
++ 
++-
++-  /**
++-   *   Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   *   of ResourceBundle.getBundle().
++-   *
++-   *   @param className the name of the class that implements the resource bundle.
++-   *   @return the ResourceBundle
++-   *   @throws MissingResourceException
++-   */
++-  public static final XSLTErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XSLTErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XSLTErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("es", "ES"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "Could not load any resource bundles.", className, "");
++-      }
++-    }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++-
++ }
++--- src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_fr.java	2013-04-16 14:28:09.332150170 +0100
+++++ src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_fr.java	2013-04-16 14:29:26.549394382 +0100
++@@ -2410,68 +2410,4 @@
++   public static final String QUERY_HEADER = "PATTERN ";
++ 
++ 
++-  /**
++-   *   Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   *   of ResourceBundle.getBundle().
++-   *
++-   *   @param className the name of the class that implements the resource bundle.
++-   *   @return the ResourceBundle
++-   *   @throws MissingResourceException
++-   */
++-  public static final XSLTErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XSLTErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XSLTErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("en", "US"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "Could not load any resource bundles.", className, "");
++-      }
++     }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++-
++-}
++--- src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_it.java	2013-04-16 14:28:09.336150235 +0100
+++++ src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_it.java	2013-04-16 14:29:26.549394382 +0100
++@@ -2409,69 +2409,4 @@
++    * @deprecated  */
++   public static final String QUERY_HEADER = "MODELLO ";
++ 
++-
++-  /**
++-   *   Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   *   of ResourceBundle.getBundle().
++-   *
++-   *   @param className the name of the class that implements the resource bundle.
++-   *   @return the ResourceBundle
++-   *   @throws MissingResourceException
++-   */
++-  public static final XSLTErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XSLTErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XSLTErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("it", "IT"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "Could not load any resource bundles.", className, "");
++-      }
++-    }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++-
++ }
++--- src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ja.java	2013-04-16 14:28:09.336150235 +0100
+++++ src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ja.java	2013-04-16 14:29:26.549394382 +0100
++@@ -2410,68 +2410,4 @@
++   public static final String QUERY_HEADER = "PATTERN ";
++ 
++ 
++-  /**
++-   *   Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   *   of ResourceBundle.getBundle().
++-   *
++-   *   @param className the name of the class that implements the resource bundle.
++-   *   @return the ResourceBundle
++-   *   @throws MissingResourceException
++-   */
++-  public static final XSLTErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XSLTErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XSLTErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("en", "US"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "Could not load any resource bundles.", className, "");
++-      }
++     }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++-
++-}
++--- src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources.java	2013-04-16 14:28:09.324150042 +0100
+++++ src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources.java	2013-04-16 14:29:26.549394382 +0100
++@@ -1446,68 +1446,4 @@
++   public static final String QUERY_HEADER = "PATTERN ";
++ 
++ 
++-  /**
++-   *   Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   *   of ResourceBundle.getBundle().
++-   *
++-   *   @param className the name of the class that implements the resource bundle.
++-   *   @return the ResourceBundle
++-   *   @throws MissingResourceException
++-   */
++-  public static final XSLTErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XSLTErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XSLTErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("en", "US"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "Could not load any resource bundles.", className, "");
++-      }
++     }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++-
++-}
++--- src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ko.java	2013-04-16 14:28:09.340150299 +0100
+++++ src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ko.java	2013-04-16 14:29:26.553394447 +0100
++@@ -2409,69 +2409,4 @@
++    * @deprecated  */
++   public static final String QUERY_HEADER = "PATTERN ";
++ 
++-
++-  /**
++-   *   Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   *   of ResourceBundle.getBundle().
++-   *
++-   *   @param className the name of the class that implements the resource bundle.
++-   *   @return the ResourceBundle
++-   *   @throws MissingResourceException
++-   */
++-  public static final XSLTErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XSLTErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XSLTErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("ko", "KR"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "Could not load any resource bundles.", className, "");
++-      }
++-    }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++-
++ }
++--- src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_CN.java	2013-04-16 14:28:09.340150299 +0100
+++++ src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_CN.java	2013-04-16 14:29:26.553394447 +0100
++@@ -2409,69 +2409,4 @@
++    * @deprecated  */
++   public static final String QUERY_HEADER = "PATTERN ";
++ 
++-
++-  /**
++-   *   Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   *   of ResourceBundle.getBundle().
++-   *
++-   *   @param className the name of the class that implements the resource bundle.
++-   *   @return the ResourceBundle
++-   *   @throws MissingResourceException
++-   */
++-  public static final XSLTErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XSLTErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XSLTErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("zh", "CN"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "\u65e0\u6cd5\u88c5\u5165\u4efb\u4f55\u8d44\u6e90\u5305\u3002", className, "");
++-      }
++-    }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++-
++ }
++--- src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_TW.java	2013-04-16 14:28:09.344150364 +0100
+++++ src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_TW.java	2013-04-16 14:29:26.553394447 +0100
++@@ -2409,69 +2409,4 @@
++    * @deprecated  */
++   public static final String QUERY_HEADER = "PATTERN ";
++ 
++-
++-  /**
++-   *   Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   *   of ResourceBundle.getBundle().
++-   *
++-   *   @param className the name of the class that implements the resource bundle.
++-   *   @return the ResourceBundle
++-   *   @throws MissingResourceException
++-   */
++-  public static final XSLTErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XSLTErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XSLTErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("zh", "TW"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "Could not load any resource bundles.", className, "");
++-      }
++-    }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++-
++ }
++--- src/com/sun/org/apache/xalan/internal/utils/ConfigurationError.java	1970-01-01 01:00:00.000000000 +0100
+++++ src/com/sun/org/apache/xalan/internal/utils/ConfigurationError.java	2013-04-16 14:29:26.553394447 +0100
++@@ -0,0 +1,61 @@
+++/*
+++ * 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 02:39:54 jeffsuttor Exp $
+++ */
+++
+++package com.sun.org.apache.xalan.internal.utils;
+++
+++/**
+++ * A configuration error. This was an internal class in ObjectFactory previously
+++ */
+++public final class ConfigurationError
+++    extends Error {
+++
+++    //
+++    // 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)
+++
+++    //
+++    // methods
+++    //
+++
+++    /** Returns the exception associated to this error. */
+++    public Exception getException() {
+++        return exception;
+++    } // getException():Exception
+++
+++} // class ConfigurationError
++--- src/com/sun/org/apache/xalan/internal/utils/ObjectFactory.java	1970-01-01 01:00:00.000000000 +0100
+++++ src/com/sun/org/apache/xalan/internal/utils/ObjectFactory.java	2013-04-16 14:29:26.553394447 +0100
++@@ -0,0 +1,659 @@
+++/*
+++ * 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 02:39:54 jeffsuttor Exp $
+++ */
+++
+++package com.sun.org.apache.xalan.internal.utils;
+++
+++import java.io.InputStream;
+++import java.io.IOException;
+++import java.io.File;
+++import java.io.FileInputStream;
+++
+++import java.util.Properties;
+++import java.io.BufferedReader;
+++import java.io.InputStreamReader;
+++
+++/**
+++ * 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.
+++ *
+++ * @version $Id: ObjectFactory.java,v 1.11 2010-11-01 04:34:25 joehw Exp $
+++ */
+++public class ObjectFactory {
+++
+++    //
+++    // Constants
+++    //
+++     private static final String XALAN_INTERNAL = "com.sun.org.apache.xalan.internal";
+++     private static final String XERCES_INTERNAL = "com.sun.org.apache.xerces.internal";
+++
+++    // 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;
+++
+++    //
+++    // Public static methods
+++    //
+++
+++    /**
+++     * Finds the implementation Class object in the specified order.  The
+++     * specified order is the following:
+++     * <ol>
+++     *  <li>query the system property using <code>System.getProperty</code>
+++     *  <li>read <code>META-INF/services/<i>factoryId</i></code> file
+++     *  <li>use fallback classname
+++     * </ol>
+++     *
+++     * @return instance of factory, never null
+++     *
+++     * @param factoryId             Name of the factory to find, same as
+++     *                              a property name
+++     * @param fallbackClassName     Implementation class name, if nothing else
+++     *                              is found.  Use null to mean no fallback.
+++     *
+++     * @exception ObjectFactory.ConfigurationError
+++     */
+++    public static Object createObject(String factoryId, String fallbackClassName)
+++        throws ConfigurationError {
+++        return createObject(factoryId, null, fallbackClassName);
+++    } // createObject(String,String):Object
+++
+++    /**
+++     * Finds the implementation Class object in the specified order.  The
+++     * specified order is the following:
+++     * <ol>
+++     *  <li>query the system property using <code>System.getProperty</code>
+++     *  <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file
+++     *  <li>read <code>META-INF/services/<i>factoryId</i></code> file
+++     *  <li>use fallback classname
+++     * </ol>
+++     *
+++     * @return instance of factory, never null
+++     *
+++     * @param factoryId             Name of the factory to find, same as
+++     *                              a property name
+++     * @param propertiesFilename The filename in the $java.home/lib directory
+++     *                           of the properties file.  If none specified,
+++     *                           ${java.home}/lib/xalan.properties will be used.
+++     * @param fallbackClassName     Implementation class name, if nothing else
+++     *                              is found.  Use null to mean no fallback.
+++     *
+++     * @exception ObjectFactory.ConfigurationError
+++     */
+++    static Object createObject(String factoryId,
+++                                      String propertiesFilename,
+++                                      String fallbackClassName)
+++        throws ConfigurationError
+++    {
+++        Class factoryClass = lookUpFactoryClass(factoryId,
+++                                                propertiesFilename,
+++                                                fallbackClassName);
+++
+++        if (factoryClass == null) {
+++            throw new ConfigurationError(
+++                "Provider for " + factoryId + " cannot be found", null);
+++        }
+++
+++        try{
+++            Object instance = factoryClass.newInstance();
+++            if (DEBUG) debugPrintln("created new instance of factory " + factoryId);
+++            return instance;
+++        } catch (Exception x) {
+++            throw new ConfigurationError(
+++                "Provider for factory " + factoryId
+++                    + " could not be instantiated: " + x, x);
+++        }
+++    } // createObject(String,String,String):Object
+++
+++    /**
+++     * Finds the implementation Class object in the specified order.  The
+++     * specified order is the following:
+++     * <ol>
+++     *  <li>query the system property using <code>System.getProperty</code>
+++     *  <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file
+++     *  <li>read <code>META-INF/services/<i>factoryId</i></code> file
+++     *  <li>use fallback classname
+++     * </ol>
+++     *
+++     * @return Class object of factory, never null
+++     *
+++     * @param factoryId             Name of the factory to find, same as
+++     *                              a property name
+++     * @param propertiesFilename The filename in the $java.home/lib directory
+++     *                           of the properties file.  If none specified,
+++     *                           ${java.home}/lib/xalan.properties will be used.
+++     * @param fallbackClassName     Implementation class name, if nothing else
+++     *                              is found.  Use null to mean no fallback.
+++     *
+++     * @exception ObjectFactory.ConfigurationError
+++     */
+++    public static Class lookUpFactoryClass(String factoryId)
+++        throws ConfigurationError
+++    {
+++        return lookUpFactoryClass(factoryId, null, null);
+++    } // lookUpFactoryClass(String):Class
+++
+++    /**
+++     * Finds the implementation Class object in the specified order.  The
+++     * specified order is the following:
+++     * <ol>
+++     *  <li>query the system property using <code>System.getProperty</code>
+++     *  <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file
+++     *  <li>read <code>META-INF/services/<i>factoryId</i></code> file
+++     *  <li>use fallback classname
+++     * </ol>
+++     *
+++     * @return Class object that provides factory service, never null
+++     *
+++     * @param factoryId             Name of the factory to find, same as
+++     *                              a property name
+++     * @param propertiesFilename The filename in the $java.home/lib directory
+++     *                           of the properties file.  If none specified,
+++     *                           ${java.home}/lib/xalan.properties will be used.
+++     * @param fallbackClassName     Implementation class name, if nothing else
+++     *                              is found.  Use null to mean no fallback.
+++     *
+++     * @exception ObjectFactory.ConfigurationError
+++     */
+++    public static Class lookUpFactoryClass(String factoryId,
+++                                           String propertiesFilename,
+++                                           String fallbackClassName)
+++        throws ConfigurationError
+++    {
+++        String factoryClassName = lookUpFactoryClassName(factoryId,
+++                                                         propertiesFilename,
+++                                                         fallbackClassName);
+++        ClassLoader cl = findClassLoader();
+++
+++        if (factoryClassName == null) {
+++            factoryClassName = fallbackClassName;
+++        }
+++
+++        // assert(className != null);
+++        try{
+++            Class providerClass = findProviderClass(factoryClassName,
+++                                                    cl,
+++                                                    true);
+++            if (DEBUG) debugPrintln("created new instance of " + providerClass +
+++                   " using ClassLoader: " + cl);
+++            return providerClass;
+++        } catch (ClassNotFoundException x) {
+++            throw new ConfigurationError(
+++                "Provider " + factoryClassName + " not found", x);
+++        } catch (Exception x) {
+++            throw new ConfigurationError(
+++                "Provider "+factoryClassName+" could not be instantiated: "+x,
+++                x);
+++        }
+++    } // lookUpFactoryClass(String,String,String):Class
+++
+++    /**
+++     * Finds the name of the required implementation class in the specified
+++     * order.  The specified order is the following:
+++     * <ol>
+++     *  <li>query the system property using <code>System.getProperty</code>
+++     *  <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file
+++     *  <li>read <code>META-INF/services/<i>factoryId</i></code> file
+++     *  <li>use fallback classname
+++     * </ol>
+++     *
+++     * @return name of class that provides factory service, never null
+++     *
+++     * @param factoryId             Name of the factory to find, same as
+++     *                              a property name
+++     * @param propertiesFilename The filename in the $java.home/lib directory
+++     *                           of the properties file.  If none specified,
+++     *                           ${java.home}/lib/xalan.properties will be used.
+++     * @param fallbackClassName     Implementation class name, if nothing else
+++     *                              is found.  Use null to mean no fallback.
+++     *
+++     * @exception ObjectFactory.ConfigurationError
+++     */
+++    static String lookUpFactoryClassName(String factoryId,
+++                                                String propertiesFilename,
+++                                                String fallbackClassName)
+++    {
+++        // Use the system property first
+++        try {
+++            String systemProp = SecuritySupport.getSystemProperty(factoryId);
+++            if (systemProp != null) {
+++                if (DEBUG) debugPrintln("found system property, value=" + systemProp);
+++                return systemProp;
+++            }
+++        } catch (SecurityException se) {
+++            // Ignore and continue w/ next location
+++        }
+++
+++        // Try to read from propertiesFilename, or
+++        // $java.home/lib/xalan.properties
+++        String factoryClassName = null;
+++        // no properties file name specified; use
+++        // $JAVA_HOME/lib/xalan.properties:
+++        if (propertiesFilename == null) {
+++            File propertiesFile = null;
+++            boolean propertiesFileExists = false;
+++            try {
+++                String javah = SecuritySupport.getSystemProperty("java.home");
+++                propertiesFilename = javah + File.separator +
+++                    "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME;
+++                propertiesFile = new File(propertiesFilename);
+++                propertiesFileExists = SecuritySupport.getFileExists(propertiesFile);
+++            } catch (SecurityException e) {
+++                // try again...
+++                fLastModified = -1;
+++                fXalanProperties = null;
+++            }
+++
+++            synchronized (ObjectFactory.class) {
+++                boolean loadProperties = false;
+++                FileInputStream fis = null;
+++                try {
+++                    // file existed last time
+++                    if(fLastModified >= 0) {
+++                        if(propertiesFileExists &&
+++                                (fLastModified < (fLastModified = SecuritySupport.getLastModified(propertiesFile)))) {
+++                            loadProperties = true;
+++                        } else {
+++                            // file has stopped existing...
+++                            if(!propertiesFileExists) {
+++                                fLastModified = -1;
+++                                fXalanProperties = null;
+++                            } // else, file wasn't modified!
+++                        }
+++                    } else {
+++                        // file has started to exist:
+++                        if(propertiesFileExists) {
+++                            loadProperties = true;
+++                            fLastModified = SecuritySupport.getLastModified(propertiesFile);
+++                        } // else, nothing's changed
+++                    }
+++                    if(loadProperties) {
+++                        // must never have attempted to read xalan.properties
+++                        // before (or it's outdeated)
+++                        fXalanProperties = new Properties();
+++                        fis = SecuritySupport.getFileInputStream(propertiesFile);
+++                        fXalanProperties.load(fis);
+++                    }
+++                } catch (Exception x) {
+++                    fXalanProperties = null;
+++                    fLastModified = -1;
+++                    // assert(x instanceof FileNotFoundException
+++                    //        || x instanceof SecurityException)
+++                    // In both cases, ignore and continue w/ next location
+++                }
+++                finally {
+++                    // try to close the input stream if one was opened.
+++                    if (fis != null) {
+++                        try {
+++                            fis.close();
+++                        }
+++                        // Ignore the exception.
+++                        catch (IOException exc) {}
+++                    }
+++                }
+++            }
+++            if(fXalanProperties != null) {
+++                factoryClassName = fXalanProperties.getProperty(factoryId);
+++            }
+++        } else {
+++            FileInputStream fis = null;
+++            try {
+++                fis = SecuritySupport.getFileInputStream(new File(propertiesFilename));
+++                Properties props = new Properties();
+++                props.load(fis);
+++                factoryClassName = props.getProperty(factoryId);
+++            } catch (Exception x) {
+++                // assert(x instanceof FileNotFoundException
+++                //        || x instanceof SecurityException)
+++                // In both cases, ignore and continue w/ next location
+++            }
+++            finally {
+++                // try to close the input stream if one was opened.
+++                if (fis != null) {
+++                    try {
+++                        fis.close();
+++                    }
+++                    // Ignore the exception.
+++                    catch (IOException exc) {}
+++                }
+++            }
+++        }
+++        if (factoryClassName != null) {
+++            if (DEBUG) debugPrintln("found in " + propertiesFilename + ", value="
+++                          + factoryClassName);
+++            return factoryClassName;
+++        }
+++
+++        // Try Jar Service Provider Mechanism
+++        return findJarServiceProviderName(factoryId);
+++    } // lookUpFactoryClass(String,String):String
+++
+++    //
+++    // Private static methods
+++    //
+++
+++    /** Prints a message to standard error if debugging is enabled. */
+++    private static void debugPrintln(String msg) {
+++        if (DEBUG) {
+++            System.err.println("JAXP: " + msg);
+++        }
+++    } // debugPrintln(String)
+++
+++    /**
+++     * Figure out which ClassLoader to use.  For JDK 1.2 and later use
+++     * the context ClassLoader.
+++     */
+++    public static ClassLoader findClassLoader()
+++        throws ConfigurationError
+++    {
+++        if (System.getSecurityManager()!=null) {
+++            //this will ensure bootclassloader is used
+++            return null;
+++        }
+++
+++        // Figure out which ClassLoader to use for loading the provider
+++        // class.  If there is a Context ClassLoader then use it.
+++        ClassLoader context = SecuritySupport.getContextClassLoader();
+++        ClassLoader system = SecuritySupport.getSystemClassLoader();
+++
+++        ClassLoader chain = system;
+++        while (true) {
+++            if (context == chain) {
+++                // Assert: we are on JDK 1.1 or we have no Context ClassLoader
+++                // or any Context ClassLoader in chain of system classloader
+++                // (including extension ClassLoader) so extend to widest
+++                // ClassLoader (always look in system ClassLoader if Xalan
+++                // is in boot/extension/system classpath and in current
+++                // ClassLoader otherwise); normal classloaders delegate
+++                // back to system ClassLoader first so this widening doesn't
+++                // change the fact that context ClassLoader will be consulted
+++                ClassLoader current = ObjectFactory.class.getClassLoader();
+++
+++                chain = system;
+++                while (true) {
+++                    if (current == chain) {
+++                        // Assert: Current ClassLoader in chain of
+++                        // boot/extension/system ClassLoaders
+++                        return system;
+++                    }
+++                    if (chain == null) {
+++                        break;
+++                    }
+++                    chain = SecuritySupport.getParentClassLoader(chain);
+++                }
+++
+++                // Assert: Current ClassLoader not in chain of
+++                // boot/extension/system ClassLoaders
+++                return current;
+++            }
+++
+++            if (chain == null) {
+++                // boot ClassLoader reached
+++                break;
+++            }
+++
+++            // Check for any extension ClassLoaders in chain up to
+++            // boot ClassLoader
+++            chain = SecuritySupport.getParentClassLoader(chain);
+++        }
+++
+++        // Assert: Context ClassLoader not in chain of
+++        // boot/extension/system ClassLoaders
+++        return context;
+++    } // findClassLoader():ClassLoader
+++
+++    /**
+++     * Create an instance of a class using the same classloader for the ObjectFactory by default
+++     * or bootclassloader when Security Manager is in place
+++     */
+++    public static Object newInstance(String className, boolean doFallback)
+++        throws ConfigurationError
+++    {
+++        if (System.getSecurityManager()!=null) {
+++            return newInstance(className, null, doFallback);
+++        } else {
+++            return newInstance(className,
+++                findClassLoader (), doFallback);
+++        }
+++    }
+++
+++    /**
+++     * 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();
+++            if (DEBUG) debugPrintln("created new instance of " + providerClass +
+++                   " using ClassLoader: " + cl);
+++            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 same classloader for the ObjectFactory by default
+++     * or bootclassloader when Security Manager is in place
+++     */
+++    public static Class findProviderClass(String className, boolean doFallback)
+++        throws ClassNotFoundException, ConfigurationError
+++    {
+++        if (System.getSecurityManager()!=null) {
+++            return Class.forName(className);
+++        } else {
+++            return findProviderClass (className,
+++                findClassLoader (), doFallback);
+++        }
+++    }
+++
+++    /**
+++     * 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){
+++                if (className.startsWith(XALAN_INTERNAL) ||
+++                    className.startsWith(XERCES_INTERNAL)) {
+++                    cl = null;
+++                } else {
+++                    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;
+++    }
+++
+++    /**
+++     * Find the name of service provider using Jar Service Provider Mechanism
+++     *
+++     * @return instance of provider class if found or null
+++     */
+++    private static String findJarServiceProviderName(String factoryId)
+++    {
+++        String serviceId = SERVICES_PATH + factoryId;
+++        InputStream is = null;
+++
+++        // First try the Context ClassLoader
+++        ClassLoader cl = findClassLoader();
+++
+++        is = SecuritySupport.getResourceAsStream(cl, serviceId);
+++
+++        // If no provider found then try the current ClassLoader
+++        if (is == null) {
+++            ClassLoader current = ObjectFactory.class.getClassLoader();
+++            if (cl != current) {
+++                cl = current;
+++                is = SecuritySupport.getResourceAsStream(cl, serviceId);
+++            }
+++        }
+++
+++        if (is == null) {
+++            // No provider found
+++            return null;
+++        }
+++
+++        if (DEBUG) debugPrintln("found jar resource=" + serviceId +
+++               " using ClassLoader: " + cl);
+++
+++        // Read the service provider name in UTF-8 as specified in
+++        // the jar spec.  Unfortunately this fails in Microsoft
+++        // VJ++, which does not implement the UTF-8
+++        // encoding. Theoretically, we should simply let it fail in
+++        // that case, since the JVM is obviously broken if it
+++        // doesn't support such a basic standard.  But since there
+++        // are still some users attempting to use VJ++ for
+++        // development, we have dropped in a fallback which makes a
+++        // second attempt using the platform's default encoding. In
+++        // VJ++ this is apparently ASCII, which is a subset of
+++        // UTF-8... and since the strings we'll be reading here are
+++        // also primarily limited to the 7-bit ASCII range (at
+++        // least, in English versions), this should work well
+++        // enough to keep us on the air until we're ready to
+++        // officially decommit from VJ++. [Edited comment from
+++        // jkesselm]
+++        BufferedReader rd;
+++        try {
+++            rd = new BufferedReader(new InputStreamReader(is, "UTF-8"));
+++        } catch (java.io.UnsupportedEncodingException e) {
+++            rd = new BufferedReader(new InputStreamReader(is));
+++        }
+++
+++        String factoryClassName = null;
+++        try {
+++            // XXX Does not handle all possible input as specified by the
+++            // Jar Service Provider specification
+++            factoryClassName = rd.readLine();
+++        } catch (IOException x) {
+++            // No provider found
+++            return null;
+++        }
+++        finally {
+++            try {
+++                // try to close the reader.
+++                rd.close();
+++            }
+++            // Ignore the exception.
+++            catch (IOException exc) {}
+++        }
+++
+++        if (factoryClassName != null &&
+++            ! "".equals(factoryClassName)) {
+++            if (DEBUG) debugPrintln("found in resource, value="
+++                   + factoryClassName);
+++
+++            // Note: here we do not want to fall back to the current
+++            // 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 factoryClassName;
+++        }
+++
+++        // No provider found
+++        return null;
+++    }
+++
+++} // class ObjectFactory
++--- src/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java	1970-01-01 01:00:00.000000000 +0100
+++++ src/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java	2013-04-16 14:29:26.553394447 +0100
++@@ -0,0 +1,206 @@
+++/*
+++ * reserved comment block
+++ * DO NOT REMOVE OR ALTER!
+++ */
+++/*
+++ * Copyright 2002-2004 The Apache Software Foundation.
+++ *
+++ * Licensed under the Apache License, Version 2.0 (the "License");
+++ * you may not use this file except in compliance with the License.
+++ * You may obtain a copy of the License at
+++ *
+++ *     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: SecuritySupport.java,v 1.1.2.1 2005/08/01 02:08:48 jeffsuttor Exp $
+++ */
+++
+++package com.sun.org.apache.xalan.internal.utils;
+++
+++import java.io.File;
+++import java.io.FileInputStream;
+++import java.io.FileNotFoundException;
+++import java.io.InputStream;
+++
+++import java.security.AccessController;
+++import java.security.PrivilegedAction;
+++import java.security.PrivilegedActionException;
+++import java.security.PrivilegedExceptionAction;
+++import java.util.ListResourceBundle;
+++import java.util.Locale;
+++import java.util.MissingResourceException;
+++import java.util.ResourceBundle;
+++
+++/**
+++ * This class is duplicated for each subpackage so keep it in sync. It is
+++ * package private and therefore is not exposed as part of any API.
+++ *
+++ * @xerces.internal
+++ */
+++public final class SecuritySupport {
+++
+++    private static final SecuritySupport securitySupport = new SecuritySupport();
+++
+++    /**
+++     * Return an instance of this class.
+++     */
+++    public static SecuritySupport getInstance() {
+++        return securitySupport;
+++    }
+++
+++    static ClassLoader getContextClassLoader() {
+++        return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
+++            public Object run() {
+++                ClassLoader cl = null;
+++                try {
+++                    cl = Thread.currentThread().getContextClassLoader();
+++                } catch (SecurityException ex) {
+++                }
+++                return cl;
+++            }
+++        });
+++    }
+++
+++    static ClassLoader getSystemClassLoader() {
+++        return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
+++            public Object run() {
+++                ClassLoader cl = null;
+++                try {
+++                    cl = ClassLoader.getSystemClassLoader();
+++                } catch (SecurityException ex) {
+++                }
+++                return cl;
+++            }
+++        });
+++    }
+++
+++    static ClassLoader getParentClassLoader(final ClassLoader cl) {
+++        return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
+++            public Object run() {
+++                ClassLoader parent = null;
+++                try {
+++                    parent = cl.getParent();
+++                } catch (SecurityException ex) {
+++                }
+++
+++                // eliminate loops in case of the boot
+++                // ClassLoader returning itself as a parent
+++                return (parent == cl) ? null : parent;
+++            }
+++        });
+++    }
+++
+++    public static String getSystemProperty(final String propName) {
+++        return (String) AccessController.doPrivileged(new PrivilegedAction() {
+++            public Object run() {
+++                return System.getProperty(propName);
+++            }
+++        });
+++    }
+++
+++    public static String getSystemProperty(final String propName, final String def) {
+++        return (String) AccessController.doPrivileged(new PrivilegedAction() {
+++            public Object run() {
+++                return System.getProperty(propName, def);
+++            }
+++        });
+++    }
+++
+++    static FileInputStream getFileInputStream(final File file)
+++            throws FileNotFoundException {
+++        try {
+++            return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() {
+++                public Object run() throws FileNotFoundException {
+++                    return new FileInputStream(file);
+++                }
+++            });
+++        } catch (PrivilegedActionException e) {
+++            throw (FileNotFoundException)e.getException();
+++        }
+++    }
+++
+++    /**
+++     * Return resource using the same classloader for the ObjectFactory by
+++     * default or bootclassloader when Security Manager is in place
+++     */
+++    public static InputStream getResourceAsStream(final String name) {
+++        if (System.getSecurityManager()!=null) {
+++            return getResourceAsStream(null, name);
+++        } else {
+++            return getResourceAsStream(ObjectFactory.findClassLoader(), name);
+++        }
+++    }
+++
+++    public static InputStream getResourceAsStream(final ClassLoader cl,
+++            final String name) {
+++        return (InputStream) AccessController.doPrivileged(new PrivilegedAction() {
+++            public Object run() {
+++                InputStream ris;
+++                if (cl == null) {
+++                    ris = Object.class.getResourceAsStream("/"+name);
+++                } else {
+++                    ris = cl.getResourceAsStream(name);
+++                }
+++                return ris;
+++            }
+++        });
+++    }
+++
+++    /**
+++     * Gets a resource bundle using the specified base name, the default locale, and the caller's class loader.
+++     * @param bundle the base name of the resource bundle, a fully qualified class name
+++     * @return a resource bundle for the given base name and the default locale
+++     */
+++    public static ListResourceBundle getResourceBundle(String bundle) {
+++        return getResourceBundle(bundle, Locale.getDefault());
+++    }
+++
+++    /**
+++     * Gets a resource bundle using the specified base name and locale, and the caller's class loader.
+++     * @param bundle the base name of the resource bundle, a fully qualified class name
+++     * @param locale the locale for which a resource bundle is desired
+++     * @return a resource bundle for the given base name and locale
+++     */
+++    public static ListResourceBundle getResourceBundle(final String bundle, final Locale locale) {
+++        return AccessController.doPrivileged(new PrivilegedAction<ListResourceBundle>() {
+++            public ListResourceBundle run() {
+++                try {
+++                    return (ListResourceBundle)ResourceBundle.getBundle(bundle, locale);
+++                } catch (MissingResourceException e) {
+++                    try {
+++                        return (ListResourceBundle)ResourceBundle.getBundle(bundle, new Locale("en", "US"));
+++                    } catch (MissingResourceException e2) {
+++                        throw new MissingResourceException(
+++                                "Could not load any resource bundle by " + bundle, bundle, "");
+++                    }
+++                }
+++            }
+++        });
+++    }
+++
+++    public static boolean getFileExists(final File f) {
+++        return ((Boolean) AccessController.doPrivileged(new PrivilegedAction() {
+++                    public Object run() {
+++                        return f.exists() ? Boolean.TRUE : Boolean.FALSE;
+++                    }
+++                })).booleanValue();
+++    }
+++
+++    static long getLastModified(final File f) {
+++        return ((Long) AccessController.doPrivileged(new PrivilegedAction() {
+++                    public Object run() {
+++                        return new Long(f.lastModified());
+++                    }
+++                })).longValue();
+++    }
+++
+++
+++    private SecuritySupport() {
+++    }
+++}
++--- src/com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.java	2013-04-16 14:28:09.344150364 +0100
+++++ src/com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.java	2013-04-16 14:29:26.553394447 +0100
++@@ -22,6 +22,8 @@
++  */
++ package com.sun.org.apache.xalan.internal.xslt;
++ 
+++import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
+++
++ import java.io.File;
++ import java.io.FileWriter;
++ import java.io.PrintWriter;
++@@ -569,7 +571,7 @@
++     // Grab java version for later use
++     try
++     {
++-      String javaVersion = System.getProperty("java.version");
+++      String javaVersion = SecuritySupport.getSystemProperty("java.version");
++ 
++       h.put("java.version", javaVersion);
++     }
++@@ -588,7 +590,7 @@
++     {
++ 
++       // This is present in all JVM's
++-      String cp = System.getProperty("java.class.path");
+++      String cp = SecuritySupport.getSystemProperty("java.class.path");
++ 
++       h.put("java.class.path", cp);
++ 
++@@ -598,7 +600,7 @@
++         h.put(FOUNDCLASSES + "java.class.path", classpathJars);
++ 
++       // Also check for JDK 1.2+ type classpaths
++-      String othercp = System.getProperty("sun.boot.class.path");
+++      String othercp = SecuritySupport.getSystemProperty("sun.boot.class.path");
++ 
++       if (null != othercp)
++       {
++@@ -612,7 +614,7 @@
++ 
++       //@todo NOTE: We don't actually search java.ext.dirs for
++       //  *.jar files therein! This should be updated
++-      othercp = System.getProperty("java.ext.dirs");
+++      othercp = SecuritySupport.getSystemProperty("java.ext.dirs");
++ 
++       if (null != othercp)
++       {
++--- src/com/sun/org/apache/xalan/internal/xslt/Process.java	2013-04-16 14:28:09.348150428 +0100
+++++ src/com/sun/org/apache/xalan/internal/xslt/Process.java	2013-04-16 14:29:26.553394447 +0100
++@@ -55,6 +55,7 @@
++ import com.sun.org.apache.xalan.internal.Version;
++ import com.sun.org.apache.xalan.internal.res.XSLMessages;
++ import com.sun.org.apache.xalan.internal.res.XSLTErrorResources;
+++import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
++ 
++ //J2SE does not support Xalan interpretive
++ /*
++@@ -178,7 +179,7 @@
++     java.io.PrintWriter diagnosticsWriter = new PrintWriter(System.err, true);
++     java.io.PrintWriter dumpWriter = diagnosticsWriter;
++     ResourceBundle resbundle =
++-      (XSLMessages.loadResourceBundle(
+++      (SecuritySupport.getResourceBundle(
++         com.sun.org.apache.xml.internal.utils.res.XResourceBundle.ERROR_RESOURCES));
++     String flavor = "s2s";
++ 
++--- src/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java	2013-04-16 14:28:09.380150944 +0100
+++++ src/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java	2013-04-16 14:29:26.553394447 +0100
++@@ -400,7 +400,7 @@
++             }
++         }
++         catch (TypeCheckError e) {
++-            reportError(ERROR, new ErrorMsg(e));
+++            reportError(ERROR, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e));
++         }
++     }
++ 
++@@ -420,7 +420,7 @@
++         }
++         catch (IOException e) {
++             if (_xsltc.debug()) e.printStackTrace();
++-            reportError(ERROR,new ErrorMsg(e));
+++            reportError(ERROR,new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e));
++         }
++         catch (SAXException e) {
++             Throwable ex = e.getException();
++@@ -428,15 +428,15 @@
++                 e.printStackTrace();
++                 if (ex != null) ex.printStackTrace();
++             }
++-            reportError(ERROR, new ErrorMsg(e));
+++            reportError(ERROR, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e));
++         }
++         catch (CompilerException e) {
++             if (_xsltc.debug()) e.printStackTrace();
++-            reportError(ERROR, new ErrorMsg(e));
+++            reportError(ERROR, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e));
++         }
++         catch (Exception e) {
++             if (_xsltc.debug()) e.printStackTrace();
++-            reportError(ERROR, new ErrorMsg(e));
+++            reportError(ERROR, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e));
++         }
++         return null;
++     }
++--- src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages.java	2013-04-16 14:28:09.400151266 +0100
+++++ src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages.java	2013-04-16 14:29:26.553394447 +0100
++@@ -947,7 +947,12 @@
++         "Cannot set the feature ''{0}'' on this TransformerFactory."},
++ 
++         {ErrorMsg.JAXP_SECUREPROCESSING_FEATURE,
++-        "FEATURE_SECURE_PROCESSING: Cannot set the feature to false when security manager is present."}
+++	 "FEATURE_SECURE_PROCESSING: Cannot set the feature to false when security manager is present."},
+++
+++	{ErrorMsg.DESERIALIZE_TRANSLET_ERR, "When Java security is enabled, " +
+++                        "support for deserializing TemplatesImpl is disabled." +
+++                        "This can be overridden by setting the jdk.xml.enableTemplatesImplDeserialization" +
+++                        " system property to true."}
++     };
++     }
++ }
++--- src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMsg.java	2013-04-16 14:28:09.420151588 +0100
+++++ src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMsg.java	2013-04-16 14:29:26.553394447 +0100
++@@ -23,6 +23,7 @@
++ 
++ package com.sun.org.apache.xalan.internal.xsltc.compiler.util;
++ 
+++import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
++ import java.text.MessageFormat;
++ import java.util.Locale;
++ import java.util.ResourceBundle;
++@@ -46,6 +47,8 @@
++     Object[] _params = null;
++     private boolean _isWarningError;
++ 
+++    Throwable _cause;
+++
++     // Compiler error messages
++     public static final String MULTIPLE_STYLESHEET_ERR = "MULTIPLE_STYLESHEET_ERR";
++     public static final String TEMPLATE_REDEF_ERR = "TEMPLATE_REDEF_ERR";
++@@ -157,6 +160,8 @@
++     public static final String INVALID_NCNAME_ERR = "INVALID_NCNAME_ERR";
++     public static final String INVALID_METHOD_IN_OUTPUT = "INVALID_METHOD_IN_OUTPUT";
++                                                      
+++    public static final String DESERIALIZE_TRANSLET_ERR = "DESERIALIZE_TEMPLATES_ERR";
+++
++     // All error messages are localized and are stored in resource bundles.
++     // This array and the following 4 strings are read from that bundle.
++     private static ResourceBundle _bundle;
++@@ -167,7 +172,7 @@
++     public final static String RUNTIME_ERROR_KEY    = "RUNTIME_ERROR_KEY";
++ 
++     static {
++-        _bundle = ResourceBundle.getBundle(
+++        _bundle = SecuritySupport.getResourceBundle(
++                           "com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMessages",
++                           Locale.getDefault());
++     }
++@@ -177,10 +182,11 @@
++ 	_line = 0;
++     }
++ 	
++-    public ErrorMsg(Throwable e) {
++-   	_code = null;
+++    public ErrorMsg(String code, Throwable e) {
+++        _code = code;
++ 	_message = e.getMessage();
++ 	_line = 0;
+++        _cause = e;
++     }
++ 
++     public ErrorMsg(String message, int line) {
++@@ -232,6 +238,10 @@
++ 	_params[1] = param2;
++     }
++ 
+++    public Throwable getCause() {
+++        return _cause;
+++    }
+++
++     private String getFileName(SyntaxTreeNode node) {
++ 	Stylesheet stylesheet = node.getStylesheet();
++ 	if (stylesheet != null)
++--- src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/Util.java	2013-04-16 14:28:09.428151717 +0100
+++++ src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/Util.java	2013-04-16 14:29:26.553394447 +0100
++@@ -26,6 +26,7 @@
++ import java.util.StringTokenizer;
++ 
++ import com.sun.org.apache.bcel.internal.generic.Type;
+++import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
++ import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants;
++ import com.sun.org.apache.xml.internal.utils.XML11Char;
++ 
++@@ -37,7 +38,7 @@
++     private static char filesep;
++ 
++     static {
++-        String temp = System.getProperty("file.separator", "/");
+++        String temp = SecuritySupport.getSystemProperty("file.separator", "/");
++         filesep = temp.charAt(0);
++     }
++ 
++--- src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java	2013-04-16 14:28:09.396151201 +0100
+++++ src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java	2013-04-16 14:29:26.553394447 +0100
++@@ -41,10 +41,12 @@
++ import java.util.jar.Manifest;
++ 
++ import com.sun.org.apache.bcel.internal.classfile.JavaClass;
+++import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
++ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
++ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
++ import com.sun.org.apache.xml.internal.dtm.DTM;
++ 
+++import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
++ import org.xml.sax.InputSource;
++ import org.xml.sax.XMLReader;
++ 
++@@ -257,7 +259,7 @@
++             return compile(input, _className);
++         }
++         catch (IOException e) {
++-            _parser.reportError(Constants.FATAL, new ErrorMsg(e));
+++            _parser.reportError(Constants.FATAL, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e));
++             return false;
++         }
++     }
++@@ -276,7 +278,7 @@
++             return compile(input, name);
++         }
++         catch (IOException e) {
++-            _parser.reportError(Constants.FATAL, new ErrorMsg(e));
+++            _parser.reportError(Constants.FATAL, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e));
++             return false;
++         }
++     }
++@@ -361,11 +363,11 @@
++         }
++         catch (Exception e) {
++             /*if (_debug)*/ e.printStackTrace();
++-            _parser.reportError(Constants.FATAL, new ErrorMsg(e));
+++            _parser.reportError(Constants.FATAL, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e));
++         }
++         catch (Error e) {
++             if (_debug) e.printStackTrace();
++-            _parser.reportError(Constants.FATAL, new ErrorMsg(e));
+++            _parser.reportError(Constants.FATAL, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e));
++         }
++         finally {
++             _reader = null; // reset this here to be sure it is not re-used
++@@ -573,7 +575,7 @@
++      */
++     public boolean setDestDirectory(String dstDirName) {
++         final File dir = new File(dstDirName);
++-        if (dir.exists() || dir.mkdirs()) {
+++        if (SecuritySupport.getFileExists(dir) || dir.mkdirs()) {
++             _destDir = dir;
++             return true;
++         }
++@@ -746,7 +748,7 @@
++             String parentDir = outFile.getParent();
++             if (parentDir != null) {
++                 File parentFile = new File(parentDir);
++-                if (!parentFile.exists())
+++                if (!SecuritySupport.getFileExists(parentFile))
++                     parentFile.mkdirs();
++             }
++         }
++--- src/com/sun/org/apache/xalan/internal/xsltc/dom/NodeSortRecord.java	2013-04-16 14:28:09.444151975 +0100
+++++ src/com/sun/org/apache/xalan/internal/xsltc/dom/NodeSortRecord.java	2013-04-16 14:29:26.553394447 +0100
++@@ -32,6 +32,7 @@
++ import com.sun.org.apache.xalan.internal.xsltc.TransletException;
++ import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet;
++ import com.sun.org.apache.xml.internal.utils.StringComparable;
+++import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
++ 
++ /**
++  * Base class for sort records containing application specific sort keys
++@@ -111,7 +112,7 @@
++         try {
++             // -- W. Eliot Kimber (eliot at isogen.com)
++             colFactClassname =
++-                System.getProperty("com.sun.org.apache.xalan.internal.xsltc.COLLATOR_FACTORY");
+++                SecuritySupport.getSystemProperty("com.sun.org.apache.xalan.internal.xsltc.COLLATOR_FACTORY");
++         }
++         catch (SecurityException e) {
++             // If we can't read the propery, just use default collator
++--- src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java	2013-04-16 14:28:09.448152039 +0100
+++++ src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java	2013-04-16 14:29:26.553394447 +0100
++@@ -23,6 +23,7 @@
++ 
++ package com.sun.org.apache.xalan.internal.xsltc.runtime;
++ 
+++import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
++ import java.text.DecimalFormat;
++ import java.text.DecimalFormatSymbols;
++ import java.text.FieldPosition;
++@@ -1518,7 +1519,7 @@
++ 
++     static {
++ 	String resource = "com.sun.org.apache.xalan.internal.xsltc.runtime.ErrorMessages";
++-	m_bundle = ResourceBundle.getBundle(resource);
+++        m_bundle = SecuritySupport.getResourceBundle(resource);
++     }
++ 
++     /**
++--- src/com/sun/org/apache/xalan/internal/xsltc/runtime/output/WriterOutputBuffer.java	2013-04-16 14:28:09.456152168 +0100
+++++ src/com/sun/org/apache/xalan/internal/xsltc/runtime/output/WriterOutputBuffer.java	2013-04-16 14:29:26.557394511 +0100
++@@ -23,6 +23,7 @@
++ 
++ package com.sun.org.apache.xalan.internal.xsltc.runtime.output;
++ 
+++import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
++ import java.io.BufferedWriter;
++ import java.io.IOException;
++ import java.io.Writer;
++@@ -36,7 +37,7 @@
++ 
++     static {
++         // Set a larger buffer size for Solaris
++-        final String osName = System.getProperty("os.name");
+++        final String osName = SecuritySupport.getSystemProperty("os.name");
++         if (osName.equalsIgnoreCase("solaris")) {
++             BUFFER_SIZE = 32 * KB;
++         }
++--- src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java	2013-04-16 14:28:09.460152233 +0100
+++++ src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java	2013-04-16 14:29:26.557394511 +0100
++@@ -42,6 +42,7 @@
++ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
++ import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet;
++ import com.sun.org.apache.xalan.internal.xsltc.runtime.Hashtable;
+++import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
++ 
++ /**
++  * @author Morten Jorgensen
++@@ -51,6 +52,8 @@
++  */
++ public final class TemplatesImpl implements Templates, Serializable {
++     static final long serialVersionUID = 673094361519270707L;
+++    public final static String DESERIALIZE_TRANSLET = "jdk.xml.enableTemplatesImplDeserialization";
+++
++     /**
++      * Name of the superclass of all translets. This is needed to
++      * determine which, among all classes comprising a translet,
++@@ -181,6 +184,15 @@
++     private void  readObject(ObjectInputStream is)
++       throws IOException, ClassNotFoundException
++     {
+++        SecurityManager security = System.getSecurityManager();
+++        if (security != null){
+++            String temp = SecuritySupport.getSystemProperty(DESERIALIZE_TRANSLET);
+++            if (temp == null || !(temp.length()==0 || temp.equalsIgnoreCase("true"))) {
+++                ErrorMsg err = new ErrorMsg(ErrorMsg.DESERIALIZE_TRANSLET_ERR);
+++                throw new UnsupportedOperationException(err.toString());
+++            }
+++        }
+++
++         is.defaultReadObject();
++         if (is.readBoolean()) {
++             _uriResolver = (URIResolver) is.readObject();
++--- src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java	2013-04-16 14:28:09.460152233 +0100
+++++ src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java	2013-04-16 14:29:26.557394511 +0100
++@@ -69,7 +69,7 @@
++ import com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC;
++ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
++ import com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager;
++-
+++import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
++ 
++ import org.xml.sax.InputSource;
++ import org.xml.sax.XMLFilter;
++@@ -839,8 +839,14 @@
++ 	// Check that the transformation went well before returning
++     if (bytecodes == null) {
++         
++-        ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR);
++-        TransformerConfigurationException exc =  new TransformerConfigurationException(err.toString());
+++        Vector errs = xsltc.getErrors();
+++        ErrorMsg err = null;
+++        if (errs != null) {
+++            err = (ErrorMsg)errs.get(errs.size()-1);
+++        } else {
+++            err = new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR);
+++        }
+++        TransformerConfigurationException exc =  new TransformerConfigurationException(err.toString(), err.getCause());
++         
++         // Pass compiler errors to the error listener
++         if (_errorListener != null) {
++@@ -1187,7 +1193,7 @@
++     	// Find the parent directory of the translet.
++     	String transletParentDir = transletFile.getParent();
++     	if (transletParentDir == null)
++-    	    transletParentDir = System.getProperty("user.dir");
+++            transletParentDir = SecuritySupport.getSystemProperty("user.dir");
++     	  
++     	File transletParentFile = new File(transletParentDir);
++     	
++--- src/com/sun/org/apache/xerces/internal/dom/DOMMessageFormatter.java	2013-04-16 14:28:09.472152426 +0100
+++++ src/com/sun/org/apache/xerces/internal/dom/DOMMessageFormatter.java	2013-04-16 14:29:26.557394511 +0100
++@@ -20,10 +20,10 @@
++ 
++ 
++ package com.sun.org.apache.xerces.internal.dom;
+++import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
++ import java.util.Locale;
++ import java.util.MissingResourceException;
++ import java.util.ResourceBundle;
++-import java.util.PropertyResourceBundle;
++ 
++ /**
++  * Used to format DOM error messages, using the system locale.
++@@ -31,6 +31,7 @@
++  * @xerces.internal
++  *
++  * @author Sandy Gao, IBM
+++ * @version $Id: DOMMessageFormatter.java,v 1.6 2010-11-01 04:39:38 joehw Exp $
++  */
++ public class DOMMessageFormatter {
++     public static final String DOM_DOMAIN = "http://www.w3.org/dom/DOMTR";
++@@ -122,13 +123,13 @@
++      */
++     public static void init(){
++         if (locale != null) {
++-            domResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.DOMMessages", locale);
++-            serResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSerializerMessages", locale);
++-            xmlResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
+++            domResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.DOMMessages", locale);
+++            serResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSerializerMessages", locale);
+++            xmlResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
++         }else{
++-            domResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.DOMMessages");
++-            serResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSerializerMessages");
++-            xmlResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
+++            domResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.DOMMessages");
+++            serResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSerializerMessages");
+++            xmlResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
++         }
++     }
++ 
++--- src/com/sun/org/apache/xerces/internal/impl/dv/DatatypeException.java	2013-04-16 14:28:09.532153393 +0100
+++++ src/com/sun/org/apache/xerces/internal/impl/dv/DatatypeException.java	2013-04-16 14:29:26.557394511 +0100
++@@ -20,6 +20,7 @@
++ 
++ package com.sun.org.apache.xerces.internal.impl.dv;
++ 
+++import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
++ import java.util.ResourceBundle;
++ import java.util.PropertyResourceBundle;
++ import java.util.MissingResourceException;
++@@ -34,6 +35,7 @@
++  *
++  * @author Sandy Gao, IBM
++  *
+++ * @version $Id: DatatypeException.java,v 1.6 2010-11-01 04:39:43 joehw Exp $
++  */
++ public class DatatypeException extends Exception {
++ 
++@@ -84,7 +86,7 @@
++      */
++     public String getMessage() {
++         ResourceBundle resourceBundle = null;
++-        resourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages");
+++        resourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages");
++         if (resourceBundle == null)
++             throw new MissingResourceException("Property file not found!", "com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages", key);
++ 
++--- src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter.java	2013-04-16 14:28:09.552153715 +0100
+++++ src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter.java	2013-04-16 14:29:26.557394511 +0100
++@@ -20,12 +20,11 @@
++ 
++ package com.sun.org.apache.xerces.internal.impl.msg;
++ 
+++import com.sun.org.apache.xerces.internal.util.MessageFormatter;
+++import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
++ import java.util.Locale;
++ import java.util.MissingResourceException;
++ import java.util.ResourceBundle;
++-import java.util.PropertyResourceBundle;
++-
++-import com.sun.org.apache.xerces.internal.util.MessageFormatter;
++ 
++ /**
++  * XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for
++@@ -71,12 +70,12 @@
++ 
++         if (fResourceBundle == null || locale != fLocale) {
++             if (locale != null) {
++-                fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
+++                fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
++                 // memorize the most-recent locale
++                 fLocale = locale;
++             }
++             if (fResourceBundle == null)
++-                fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
+++                fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
++         }
++ 
++         // format message
++--- src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java	2013-04-16 14:28:09.504152942 +0100
+++++ src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java	2013-04-16 14:29:26.557394511 +0100
++@@ -52,6 +52,7 @@
++ import com.sun.org.apache.xerces.internal.xni.XNIException;
++ import com.sun.org.apache.xerces.internal.xni.parser.*;
++ import com.sun.org.apache.xerces.internal.impl.Constants;
+++import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
++ import com.sun.xml.internal.stream.Entity;
++ import com.sun.org.apache.xerces.internal.xni.Augmentations;
++ 
++@@ -1811,7 +1812,7 @@
++         // get the user.dir property
++         String userDir = "";
++         try {
++-            userDir = System.getProperty("user.dir");
+++            userDir = SecuritySupport.getSystemProperty("user.dir");
++         }
++         catch (SecurityException se) {
++         }
++@@ -2155,9 +2156,6 @@
++     private static String expandSystemIdStrictOff(String systemId, String baseSystemId)
++         throws URI.MalformedURIException {
++ 
++-        systemId = escapeNonUSAscii(systemId);
++-        baseSystemId = escapeNonUSAscii(baseSystemId);
++-
++         URI systemURI = new URI(systemId, true);
++         // If it's already an absolute one, return it
++         if (systemURI.isAbsoluteURI()) {
++@@ -2623,64 +2621,6 @@
++ 
++     } // fixURI(String):String
++     
++-    /**
++-     * Escape invalid URI characters.
++-     *
++-     * Passed a URI that contains invalid characters (like spaces, non-ASCII Unicode characters, and the like),
++-     * this function percent encodes the invalid characters per the URI specification (i.e., as a sequence of
++-     * %-encoded UTF-8 octets).
++-     *
++-     * N.B. There are two problems. If the URI contains a '%' character, that might be an indication that
++-     * the URI has already been escaped by the author, or it might be an invalid '%'. In the former case,
++-     * it's important not to escape it, or we'll wind up with invalid, doubly-escaped '%'s. In the latter,
++-     * the URI is broken if we don't encode it. Similarly, a '#' character might be the start of a fragment
++-     * identifier or it might be an invalid '#'.
++-     *
++-     * Given that the former is vastly more likely than the latter in each case (most users are familiar with
++-     * the magic status of '%' and '#' and they occur relatively infrequently in filenames, and if the user parses
++-     * a proper Java File, we will already have %-escaped the URI), we simply assume that %'s and #'s are legit.
++-     *
++-     * Very rarely, we may be wrong. If so, tell the user to fix the clearly broken URI.
++-     */
++-    protected static String escapeNonUSAscii(String str) {
++-        if (str == null) {
++-            return str;
++-        }
++-        
++-        // get UTF-8 bytes for the string
++-        StringBuffer buffer = new StringBuffer();
++-        byte[] bytes = null;
++-        byte b;
++-        try {
++-            bytes = str.getBytes("UTF-8");
++-        } catch (java.io.UnsupportedEncodingException e) {
++-            // should never happen
++-            return str;
++-        }
++-        int len = bytes.length;
++-        int ch;
++-
++-        // for each byte
++-        for (int i = 0; i < len; i++) {
++-            b = bytes[i];
++-            // for non-ascii character: make it positive, then escape
++-            if (b < 0) {
++-                ch = b + 256;
++-                buffer.append('%');
++-                buffer.append(gHexChs[ch >> 4]);
++-                buffer.append(gHexChs[ch & 0xf]);
++-            }
++-            else if (b != '%' && b != '#' && gNeedEscaping[b]) {
++-                buffer.append('%');
++-                buffer.append(gAfterEscaping1[b]);
++-                buffer.append(gAfterEscaping2[b]);
++-            }
++-            else {
++-                buffer.append((char)b);
++-            }
++-        }
++-        return buffer.toString();
++-    } 
++ 
++     //
++     // Package visible methods
++--- src/com/sun/org/apache/xerces/internal/impl/xpath/regex/RegexParser.java	2013-04-16 14:28:09.560153844 +0100
+++++ src/com/sun/org/apache/xerces/internal/impl/xpath/regex/RegexParser.java	2013-04-16 14:29:26.557394511 +0100
++@@ -20,6 +20,7 @@
++ 
++ package com.sun.org.apache.xerces.internal.impl.xpath.regex;
++ 
+++import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
++ import java.util.Locale;
++ import java.util.MissingResourceException;
++ import java.util.ResourceBundle;
++@@ -94,10 +95,10 @@
++     public void setLocale(Locale locale) {
++         try {
++             if (locale != null) {
++-                this.resources = ResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.xpath.regex.message", locale);
+++                this.resources = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.xpath.regex.message", locale);
++             }
++             else {
++-                this.resources = ResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.xpath.regex.message");
+++                this.resources = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.xpath.regex.message");
++             }
++         }
++         catch (MissingResourceException mre) {
++--- src/com/sun/org/apache/xerces/internal/impl/xs/XSMessageFormatter.java	2013-04-16 14:28:09.572154037 +0100
+++++ src/com/sun/org/apache/xerces/internal/impl/xs/XSMessageFormatter.java	2013-04-16 14:29:26.557394511 +0100
++@@ -20,11 +20,11 @@
++ 
++ package com.sun.org.apache.xerces.internal.impl.xs;
++ 
+++import com.sun.org.apache.xerces.internal.util.MessageFormatter;
+++import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
++ import java.util.Locale;
++ import java.util.MissingResourceException;
++ import java.util.ResourceBundle;
++-import java.util.PropertyResourceBundle;
++-import com.sun.org.apache.xerces.internal.util.MessageFormatter;
++ 
++ 
++ /**
++@@ -34,6 +34,7 @@
++  * @xerces.internal
++  *
++  * @author Elena Litani, IBM
+++ * @version $Id: XSMessageFormatter.java,v 1.6 2010-11-01 04:39:55 joehw Exp $
++  */
++ public class XSMessageFormatter implements MessageFormatter {
++     /**
++@@ -66,12 +67,12 @@
++ 
++         if (fResourceBundle == null || locale != fLocale) {
++             if (locale != null) {
++-                fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages", locale);
+++                fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages", locale);
++                 // memorize the most-recent locale
++                 fLocale = locale;
++             }
++             if (fResourceBundle == null)
++-                fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages");
+++                fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages");
++         }
++ 
++         String msg = fResourceBundle.getString(key);
++--- src/com/sun/org/apache/xerces/internal/jaxp/validation/JAXPValidationMessageFormatter.java	2013-04-16 14:28:09.600154489 +0100
+++++ src/com/sun/org/apache/xerces/internal/jaxp/validation/JAXPValidationMessageFormatter.java	2013-04-16 14:29:26.557394511 +0100
++@@ -20,15 +20,16 @@
++ 
++ package com.sun.org.apache.xerces.internal.jaxp.validation;
++ 
+++import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
++ import java.util.Locale;
++ import java.util.MissingResourceException;
++ import java.util.ResourceBundle;
++-import java.util.PropertyResourceBundle;
++ 
++ /**
++  * <p>Used to format JAXP Validation API error messages using a specified locale.</p>
++  *
++  * @author Michael Glavassevich, IBM
+++ * @version $Id: JAXPValidationMessageFormatter.java,v 1.5 2010-11-01 04:40:08 joehw Exp $
++  */
++ final class JAXPValidationMessageFormatter {
++ 
++@@ -54,11 +55,11 @@
++         ResourceBundle resourceBundle = null;
++         if (locale != null) {
++             resourceBundle =
++-                PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.JAXPValidationMessages", locale);
+++                SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.JAXPValidationMessages", locale);
++         }
++         else {
++             resourceBundle =
++-                PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.JAXPValidationMessages");
+++                SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.JAXPValidationMessages");
++         }
++ 
++         // format message
++--- src/com/sun/org/apache/xerces/internal/util/DatatypeMessageFormatter.java	2013-04-16 14:28:09.616154746 +0100
+++++ src/com/sun/org/apache/xerces/internal/util/DatatypeMessageFormatter.java	2013-04-16 14:29:26.557394511 +0100
++@@ -20,15 +20,16 @@
++ 
++ package com.sun.org.apache.xerces.internal.util;
++ 
+++import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
++ import java.util.Locale;
++ import java.util.MissingResourceException;
++-import java.util.PropertyResourceBundle;
++ import java.util.ResourceBundle;
++ 
++ /**
++  * <p>Used to format JAXP 1.3 Datatype API error messages using a specified locale.</p>
++  *
++  * @author  Neeraj Bajaj, Sun Microsystems
+++ * @version $Id: DatatypeMessageFormatter.java,v 1.6 2010-11-01 04:40:14 joehw Exp $
++  */
++ public class DatatypeMessageFormatter {
++ 
++@@ -56,11 +57,11 @@
++         ResourceBundle resourceBundle = null;
++         if (locale != null) {
++             resourceBundle =
++-                PropertyResourceBundle.getBundle(BASE_NAME, locale);
+++                SecuritySupport.getResourceBundle(BASE_NAME, locale);
++         }
++         else {
++             resourceBundle =
++-                PropertyResourceBundle.getBundle(BASE_NAME);
+++                SecuritySupport.getResourceBundle(BASE_NAME);
++         }
++ 
++         // format message
++--- src/com/sun/org/apache/xerces/internal/util/SAXMessageFormatter.java	2013-04-16 14:28:09.620154811 +0100
+++++ src/com/sun/org/apache/xerces/internal/util/SAXMessageFormatter.java	2013-04-16 14:29:26.557394511 +0100
++@@ -19,16 +19,17 @@
++  */
++ package com.sun.org.apache.xerces.internal.util;
++ 
+++import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
++ import java.util.Locale;
++ import java.util.MissingResourceException;
++ import java.util.ResourceBundle;
++-import java.util.PropertyResourceBundle;
++ 
++ /**
++  * Used to format SAX error messages using a specified locale.
++  *
++  * @author Michael Glavassevich, IBM
++  *
+++ * @version $Id: SAXMessageFormatter.java,v 1.6 2010-11-01 04:40:14 joehw Exp $
++  */
++ public class SAXMessageFormatter {
++ 
++@@ -54,11 +55,11 @@
++         ResourceBundle resourceBundle = null;
++         if (locale != null) {
++             resourceBundle =
++-                PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.SAXMessages", locale);
+++                SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.SAXMessages", locale);
++         }
++         else {
++             resourceBundle =
++-                PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.SAXMessages");
+++                SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.SAXMessages");
++         }
++ 
++         // format message
++--- src/com/sun/org/apache/xerces/internal/util/SecurityManager.java	2013-04-16 14:28:09.620154811 +0100
+++++ src/com/sun/org/apache/xerces/internal/util/SecurityManager.java	2013-04-16 14:29:26.557394511 +0100
++@@ -61,6 +61,8 @@
++ 
++ package com.sun.org.apache.xerces.internal.util;
++ import com.sun.org.apache.xerces.internal.impl.Constants;
+++import java.security.AccessController;
+++import java.security.PrivilegedAction;
++ /**
++  * This class is a container for parser settings that relate to
++  * security, or more specifically, it is intended to be used to prevent denial-of-service
++@@ -77,6 +79,7 @@
++  *
++  * @author  Neil Graham, IBM
++  *
+++ * @version $Id: SecurityManager.java,v 1.5 2010-11-01 04:40:14 joehw Exp $
++  */
++ public final class SecurityManager {
++ 
++@@ -176,41 +179,48 @@
++ 
++         private void readSystemProperties(){
++ 
++-                //TODO: also read SYSTEM_PROPERTY_ELEMENT_ATTRIBUTE_LIMIT
++-                try {
++-                        String value = System.getProperty(Constants.ENTITY_EXPANSION_LIMIT);
++-                        if(value != null && !value.equals("")){
++-                                entityExpansionLimit = Integer.parseInt(value);
++-                                if (entityExpansionLimit < 0)
++-                                        entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT;
++-                        }
++-                        else
++-                                entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT;
++-                }catch(Exception ex){}
++-
++-                try {
++-                        String value = System.getProperty(Constants.MAX_OCCUR_LIMIT);
++-                        if(value != null && !value.equals("")){
++-                                maxOccurLimit = Integer.parseInt(value);
++-                                if (maxOccurLimit < 0)
++-                                        maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT;
++-                        }
++-                        else
++-                                maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT;
++-                }catch(Exception ex){}
++-
++-                try {
++-                        String value = System.getProperty(Constants.SYSTEM_PROPERTY_ELEMENT_ATTRIBUTE_LIMIT);
++-                        if(value != null && !value.equals("")){
++-                                fElementAttributeLimit = Integer.parseInt(value);
++-                                if ( fElementAttributeLimit < 0)
++-                                        fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT;
++-                        }
++-                        else
++-                                fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT;
+++            //TODO: also read SYSTEM_PROPERTY_ELEMENT_ATTRIBUTE_LIMIT
+++            try {
+++                    String value = getSystemProperty(Constants.ENTITY_EXPANSION_LIMIT);
+++                    if(value != null && !value.equals("")){
+++                            entityExpansionLimit = Integer.parseInt(value);
+++                            if (entityExpansionLimit < 0)
+++                                    entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT;
+++                    }
+++                    else
+++                            entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT;
+++            }catch(Exception ex){}
+++
+++            try {
+++                    String value = getSystemProperty(Constants.MAX_OCCUR_LIMIT);
+++                    if(value != null && !value.equals("")){
+++                            maxOccurLimit = Integer.parseInt(value);
+++                            if (maxOccurLimit < 0)
+++                                    maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT;
+++                    }
+++                    else
+++                            maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT;
+++            }catch(Exception ex){}
+++
+++            try {
+++                    String value = getSystemProperty(Constants.SYSTEM_PROPERTY_ELEMENT_ATTRIBUTE_LIMIT);
+++                    if(value != null && !value.equals("")){
+++                            fElementAttributeLimit = Integer.parseInt(value);
+++                            if ( fElementAttributeLimit < 0)
+++                                    fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT;
+++                    }
+++                    else
+++                            fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT;
++ 
++                 }catch(Exception ex){}
++ 
++         }
++ 
+++    private String getSystemProperty(final String propName) {
+++        return AccessController.doPrivileged(new PrivilegedAction<String>() {
+++            public String run() {
+++                return System.getProperty(propName);
+++            }
+++        });
+++    }
++ } // class SecurityManager
++--- src/com/sun/org/apache/xerces/internal/utils/ConfigurationError.java	1970-01-01 01:00:00.000000000 +0100
+++++ src/com/sun/org/apache/xerces/internal/utils/ConfigurationError.java	2013-04-16 14:29:26.557394511 +0100
++@@ -0,0 +1,58 @@
+++/*
+++ * reserved comment block
+++ * DO NOT REMOVE OR ALTER!
+++ */
+++/*
+++ * Copyright 2001-2005 The Apache Software Foundation.
+++ *
+++ * Licensed under the Apache License, Version 2.0 (the "License");
+++ * you may not use this file except in compliance with the License.
+++ * You may obtain a copy of the License at
+++ *
+++ *      http://www.apache.org/licenses/LICENSE-2.0
+++ *
+++ * Unless required by applicable law or agreed to in writing, software
+++ * distributed under the License is distributed on an "AS IS" BASIS,
+++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+++ * See the License for the specific language governing permissions and
+++ * limitations under the License.
+++ */
+++
+++package com.sun.org.apache.xerces.internal.utils;
+++
+++/**
+++ * A configuration error. This was an internal class in ObjectFactory previously
+++ */
+++public final class ConfigurationError
+++    extends Error {
+++
+++    //
+++    // 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)
+++
+++    //
+++    // methods
+++    //
+++
+++    /** Returns the exception associated to this error. */
+++    public Exception getException() {
+++        return exception;
+++    } // getException():Exception
+++
+++} // class ConfigurationError
++--- src/com/sun/org/apache/xerces/internal/utils/ObjectFactory.java	1970-01-01 01:00:00.000000000 +0100
+++++ src/com/sun/org/apache/xerces/internal/utils/ObjectFactory.java	2013-04-16 14:29:26.557394511 +0100
++@@ -0,0 +1,436 @@
+++/*
+++ * reserved comment block
+++ * DO NOT REMOVE OR ALTER!
+++ */
+++/*
+++ * Copyright 2001-2005 The Apache Software Foundation.
+++ *
+++ * Licensed under the Apache License, Version 2.0 (the "License");
+++ * you may not use this file except in compliance with the License.
+++ * You may obtain a copy of the License at
+++ *
+++ *      http://www.apache.org/licenses/LICENSE-2.0
+++ *
+++ * Unless required by applicable law or agreed to in writing, software
+++ * distributed under the License is distributed on an "AS IS" BASIS,
+++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+++ * See the License for the specific language governing permissions and
+++ * limitations under the License.
+++ */
+++
+++package com.sun.org.apache.xerces.internal.utils;
+++
+++import java.io.InputStream;
+++import java.io.IOException;
+++import java.io.File;
+++import java.io.FileInputStream;
+++
+++import java.util.Properties;
+++import java.io.BufferedReader;
+++import java.io.InputStreamReader;
+++
+++/**
+++ * 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>
+++ *
+++ * @version $Id: ObjectFactory.java,v 1.6 2010/04/23 01:44:34 joehw Exp $
+++ */
+++public final class ObjectFactory {
+++
+++    //
+++    // Constants
+++    //
+++    private static final String DEFAULT_INTERNAL_CLASSES = "com.sun.org.apache.";
+++
+++    // name of default properties file to look for in JDK's jre/lib directory
+++    private static final String DEFAULT_PROPERTIES_FILENAME = "xerces.properties";
+++
+++    /** Set to true for debugging */
+++    private static final boolean DEBUG = isDebugEnabled();
+++
+++    /**
+++     * Default columns per line.
+++     */
+++    private static final int DEFAULT_LINE_LENGTH = 80;
+++
+++    /** cache the contents of the xerces.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 fXercesProperties = null;
+++
+++    /***
+++     * Cache the time stamp of the xerces.properties file so
+++     * that we know if it's been modified and can invalidate
+++     * the cache when necessary.
+++     */
+++    private static long fLastModified = -1;
+++
+++    //
+++    // static methods
+++    //
+++
+++    /**
+++     * Finds the implementation Class object in the specified order.  The
+++     * specified order is the following:
+++     * <ol>
+++     *  <li>query the system property using <code>System.getProperty</code>
+++     *  <li>read <code>META-INF/services/<i>factoryId</i></code> file
+++     *  <li>use fallback classname
+++     * </ol>
+++     *
+++     * @return Class object of factory, never null
+++     *
+++     * @param factoryId             Name of the factory to find, same as
+++     *                              a property name
+++     * @param fallbackClassName     Implementation class name, if nothing else
+++     *                              is found.  Use null to mean no fallback.
+++     *
+++     * @exception ObjectFactory.ConfigurationError
+++     */
+++    public static Object createObject(String factoryId, String fallbackClassName)
+++        throws ConfigurationError {
+++        return createObject(factoryId, null, fallbackClassName);
+++    } // createObject(String,String):Object
+++
+++    /**
+++     * Finds the implementation Class object in the specified order.  The
+++     * specified order is the following:
+++     * <ol>
+++     *  <li>query the system property using <code>System.getProperty</code>
+++     *  <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file
+++     *  <li>read <code>META-INF/services/<i>factoryId</i></code> file
+++     *  <li>use fallback classname
+++     * </ol>
+++     *
+++     * @return Class object of factory, never null
+++     *
+++     * @param factoryId             Name of the factory to find, same as
+++     *                              a property name
+++     * @param propertiesFilename The filename in the $java.home/lib directory
+++     *                           of the properties file.  If none specified,
+++     *                           ${java.home}/lib/xerces.properties will be used.
+++     * @param fallbackClassName     Implementation class name, if nothing else
+++     *                              is found.  Use null to mean no fallback.
+++     *
+++     * @exception ObjectFactory.ConfigurationError
+++     */
+++    public static Object createObject(String factoryId,
+++                                      String propertiesFilename,
+++                                      String fallbackClassName)
+++        throws ConfigurationError
+++    {
+++        if (DEBUG) debugPrintln("debug is on");
+++
+++        ClassLoader cl = findClassLoader();
+++
+++        // Use the system property first
+++        try {
+++            String systemProp = SecuritySupport.getSystemProperty(factoryId);
+++            if (systemProp != null && systemProp.length() > 0) {
+++                if (DEBUG) debugPrintln("found system property, value=" + systemProp);
+++                return newInstance(systemProp, cl, true);
+++            }
+++        } catch (SecurityException se) {
+++            // Ignore and continue w/ next location
+++        }
+++
+++        // JAXP specific change
+++        // always use fallback class to avoid the expense of constantly
+++        // "stat"ing a non-existent "xerces.properties" and jar SPI entry
+++        // see CR 6400863: Expensive creating of SAX parser in Mustang
+++        if (fallbackClassName == null) {
+++            throw new ConfigurationError(
+++                "Provider for " + factoryId + " cannot be found", null);
+++        }
+++
+++        if (DEBUG) debugPrintln("using fallback, value=" + fallbackClassName);
+++        return newInstance(fallbackClassName, cl, true);
+++
+++    } // createObject(String,String,String):Object
+++
+++    //
+++    // Private static methods
+++    //
+++
+++    /** Returns true if debug has been enabled. */
+++    private static boolean isDebugEnabled() {
+++        try {
+++            String val = SecuritySupport.getSystemProperty("xerces.debug");
+++            // Allow simply setting the prop to turn on debug
+++            return (val != null && (!"false".equals(val)));
+++        }
+++        catch (SecurityException se) {}
+++        return false;
+++    } // isDebugEnabled()
+++
+++    /** Prints a message to standard error if debugging is enabled. */
+++    private static void debugPrintln(String msg) {
+++        if (DEBUG) {
+++            System.err.println("XERCES: " + msg);
+++        }
+++    } // debugPrintln(String)
+++
+++    /**
+++     * Figure out which ClassLoader to use.  For JDK 1.2 and later use
+++     * the context ClassLoader.
+++     */
+++    public static ClassLoader findClassLoader()
+++        throws ConfigurationError
+++    {
+++        if (System.getSecurityManager()!=null) {
+++            //this will ensure bootclassloader is used
+++            return null;
+++        }
+++        // Figure out which ClassLoader to use for loading the provider
+++        // class.  If there is a Context ClassLoader then use it.
+++        ClassLoader context = SecuritySupport.getContextClassLoader();
+++        ClassLoader system = SecuritySupport.getSystemClassLoader();
+++
+++        ClassLoader chain = system;
+++        while (true) {
+++            if (context == chain) {
+++                // Assert: we are on JDK 1.1 or we have no Context ClassLoader
+++                // or any Context ClassLoader in chain of system classloader
+++                // (including extension ClassLoader) so extend to widest
+++                // ClassLoader (always look in system ClassLoader if Xerces
+++                // is in boot/extension/system classpath and in current
+++                // ClassLoader otherwise); normal classloaders delegate
+++                // back to system ClassLoader first so this widening doesn't
+++                // change the fact that context ClassLoader will be consulted
+++                ClassLoader current = ObjectFactory.class.getClassLoader();
+++
+++                chain = system;
+++                while (true) {
+++                    if (current == chain) {
+++                        // Assert: Current ClassLoader in chain of
+++                        // boot/extension/system ClassLoaders
+++                        return system;
+++                    }
+++                    if (chain == null) {
+++                        break;
+++                    }
+++                    chain = SecuritySupport.getParentClassLoader(chain);
+++                }
+++
+++                // Assert: Current ClassLoader not in chain of
+++                // boot/extension/system ClassLoaders
+++                return current;
+++            }
+++
+++            if (chain == null) {
+++                // boot ClassLoader reached
+++                break;
+++            }
+++
+++            // Check for any extension ClassLoaders in chain up to
+++            // boot ClassLoader
+++            chain = SecuritySupport.getParentClassLoader(chain);
+++        };
+++
+++        // Assert: Context ClassLoader not in chain of
+++        // boot/extension/system ClassLoaders
+++        return context;
+++    } // findClassLoader():ClassLoader
+++
+++    /**
+++     * Create an instance of a class using the same classloader for the ObjectFactory by default
+++     * or bootclassloader when Security Manager is in place
+++     */
+++    public static Object newInstance(String className, boolean doFallback)
+++        throws ConfigurationError
+++    {
+++        if (System.getSecurityManager()!=null) {
+++            return newInstance(className, null, doFallback);
+++        } else {
+++            return newInstance(className,
+++                findClassLoader (), doFallback);
+++        }
+++    }
+++
+++    /**
+++     * Create an instance of a class using the specified ClassLoader
+++     */
+++    public 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();
+++            if (DEBUG) debugPrintln("created new instance of " + providerClass +
+++                   " using ClassLoader: " + cl);
+++            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 same classloader for the ObjectFactory by default
+++     * or bootclassloader when Security Manager is in place
+++     */
+++    public static Class findProviderClass(String className, boolean doFallback)
+++        throws ClassNotFoundException, ConfigurationError
+++    {
+++        if (System.getSecurityManager()!=null) {
+++            return Class.forName(className);
+++        } else {
+++            return findProviderClass (className,
+++                findClassLoader (), doFallback);
+++        }
+++    }
+++    /**
+++     * Find a Class using the specified ClassLoader
+++     */
+++    public 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 package
+++        //restrict the access to package as speicified in java.security policy
+++        SecurityManager security = System.getSecurityManager();
+++        if (security != null) {
+++            if (className.startsWith(DEFAULT_INTERNAL_CLASSES)) {
+++                cl = null;
+++            } else {
+++                final int lastDot = className.lastIndexOf(".");
+++                String packageName = className;
+++                if (lastDot != -1) packageName = className.substring(0, lastDot);
+++                security.checkPackageAccess(packageName);
+++            }
+++        }
+++        Class providerClass;
+++        if (cl == null) {
+++            //use 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;
+++    }
+++
+++    /*
+++     * Try to find provider using Jar Service Provider Mechanism
+++     *
+++     * @return instance of provider class if found or null
+++     */
+++    private static Object findJarServiceProvider(String factoryId)
+++        throws ConfigurationError
+++    {
+++        String serviceId = "META-INF/services/" + factoryId;
+++        InputStream is = null;
+++
+++        // First try the Context ClassLoader
+++        ClassLoader cl = findClassLoader();
+++
+++        is = SecuritySupport.getResourceAsStream(cl, serviceId);
+++
+++        // If no provider found then try the current ClassLoader
+++        if (is == null) {
+++            ClassLoader current = ObjectFactory.class.getClassLoader();
+++            if (cl != current) {
+++                cl = current;
+++                is = SecuritySupport.getResourceAsStream(cl, serviceId);
+++            }
+++        }
+++
+++        if (is == null) {
+++            // No provider found
+++            return null;
+++        }
+++
+++        if (DEBUG) debugPrintln("found jar resource=" + serviceId +
+++               " using ClassLoader: " + cl);
+++
+++        // Read the service provider name in UTF-8 as specified in
+++        // the jar spec.  Unfortunately this fails in Microsoft
+++        // VJ++, which does not implement the UTF-8
+++        // encoding. Theoretically, we should simply let it fail in
+++        // that case, since the JVM is obviously broken if it
+++        // doesn't support such a basic standard.  But since there
+++        // are still some users attempting to use VJ++ for
+++        // development, we have dropped in a fallback which makes a
+++        // second attempt using the platform's default encoding. In
+++        // VJ++ this is apparently ASCII, which is a subset of
+++        // UTF-8... and since the strings we'll be reading here are
+++        // also primarily limited to the 7-bit ASCII range (at
+++        // least, in English versions), this should work well
+++        // enough to keep us on the air until we're ready to
+++        // officially decommit from VJ++. [Edited comment from
+++        // jkesselm]
+++        BufferedReader rd;
+++        try {
+++            rd = new BufferedReader(new InputStreamReader(is, "UTF-8"), DEFAULT_LINE_LENGTH);
+++        } catch (java.io.UnsupportedEncodingException e) {
+++            rd = new BufferedReader(new InputStreamReader(is), DEFAULT_LINE_LENGTH);
+++        }
+++
+++        String factoryClassName = null;
+++        try {
+++            // XXX Does not handle all possible input as specified by the
+++            // Jar Service Provider specification
+++            factoryClassName = rd.readLine();
+++        } catch (IOException x) {
+++            // No provider found
+++            return null;
+++        }
+++        finally {
+++            try {
+++                // try to close the reader.
+++                rd.close();
+++            }
+++            // Ignore the exception.
+++            catch (IOException exc) {}
+++        }
+++
+++        if (factoryClassName != null &&
+++            ! "".equals(factoryClassName)) {
+++            if (DEBUG) debugPrintln("found in resource, value="
+++                   + factoryClassName);
+++
+++            // Note: here we do not want to fall back to the current
+++            // 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);
+++        }
+++
+++        // No provider found
+++        return null;
+++    }
+++
+++} // class ObjectFactory
++--- src/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java	1970-01-01 01:00:00.000000000 +0100
+++++ src/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java	2013-04-16 14:29:26.557394511 +0100
++@@ -0,0 +1,199 @@
+++/*
+++ * reserved comment block
+++ * DO NOT REMOVE OR ALTER!
+++ */
+++/*
+++ * Copyright 2002,2004 The Apache Software Foundation.
+++ *
+++ * Licensed under the Apache License, Version 2.0 (the "License");
+++ * you may not use this file except in compliance with the License.
+++ * You may obtain a copy of the License at
+++ *
+++ *      http://www.apache.org/licenses/LICENSE-2.0
+++ *
+++ * Unless required by applicable law or agreed to in writing, software
+++ * distributed under the License is distributed on an "AS IS" BASIS,
+++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+++ * See the License for the specific language governing permissions and
+++ * limitations under the License.
+++ */
+++
+++package com.sun.org.apache.xerces.internal.utils;
+++
+++import java.io.File;
+++import java.io.FileInputStream;
+++import java.io.FileNotFoundException;
+++import java.io.InputStream;
+++
+++import java.security.AccessController;
+++import java.security.PrivilegedAction;
+++import java.security.PrivilegedActionException;
+++import java.security.PrivilegedExceptionAction;
+++import java.util.Locale;
+++import java.util.MissingResourceException;
+++import java.util.PropertyResourceBundle;
+++import java.util.ResourceBundle;
+++
+++/**
+++ * This class is duplicated for each subpackage so keep it in sync.
+++ * It is package private and therefore is not exposed as part of any API.
+++ *
+++ * @xerces.internal
+++ */
+++public final class SecuritySupport {
+++
+++    private static final SecuritySupport securitySupport = new SecuritySupport();
+++
+++    /**
+++     * Return an instance of this class.
+++     */
+++    public static SecuritySupport getInstance() {
+++        return securitySupport;
+++    }
+++
+++    static ClassLoader getContextClassLoader() {
+++        return (ClassLoader)
+++        AccessController.doPrivileged(new PrivilegedAction() {
+++            public Object run() {
+++                ClassLoader cl = null;
+++                try {
+++                    cl = Thread.currentThread().getContextClassLoader();
+++                } catch (SecurityException ex) { }
+++                return cl;
+++            }
+++        });
+++    }
+++
+++    static ClassLoader getSystemClassLoader() {
+++        return (ClassLoader)
+++        AccessController.doPrivileged(new PrivilegedAction() {
+++            public Object run() {
+++                ClassLoader cl = null;
+++                try {
+++                    cl = ClassLoader.getSystemClassLoader();
+++                } catch (SecurityException ex) {}
+++                return cl;
+++            }
+++        });
+++    }
+++
+++    static ClassLoader getParentClassLoader(final ClassLoader cl) {
+++        return (ClassLoader)
+++        AccessController.doPrivileged(new PrivilegedAction() {
+++            public Object run() {
+++                ClassLoader parent = null;
+++                try {
+++                    parent = cl.getParent();
+++                } catch (SecurityException ex) {}
+++
+++                // eliminate loops in case of the boot
+++                // ClassLoader returning itself as a parent
+++                return (parent == cl) ? null : parent;
+++            }
+++        });
+++    }
+++
+++    public static String getSystemProperty(final String propName) {
+++        return (String)
+++        AccessController.doPrivileged(new PrivilegedAction() {
+++            public Object run() {
+++                return System.getProperty(propName);
+++            }
+++        });
+++    }
+++
+++    static FileInputStream getFileInputStream(final File file)
+++    throws FileNotFoundException
+++    {
+++        try {
+++            return (FileInputStream)
+++            AccessController.doPrivileged(new PrivilegedExceptionAction() {
+++                public Object run() throws FileNotFoundException {
+++                    return new FileInputStream(file);
+++                }
+++            });
+++        } catch (PrivilegedActionException e) {
+++            throw (FileNotFoundException)e.getException();
+++        }
+++    }
+++    /**
+++     * Return resource using the same classloader for the ObjectFactory by default
+++     * or bootclassloader when Security Manager is in place
+++     */
+++    public static InputStream getResourceAsStream(final String name) {
+++        if (System.getSecurityManager()!=null) {
+++            return getResourceAsStream(null, name);
+++        } else {
+++            return getResourceAsStream(ObjectFactory.findClassLoader(), name);
+++        }
+++    }
+++
+++    public static InputStream getResourceAsStream(final ClassLoader cl,
+++            final String name)
+++    {
+++        return (InputStream)
+++        AccessController.doPrivileged(new PrivilegedAction() {
+++            public Object run() {
+++                InputStream ris;
+++                if (cl == null) {
+++                    ris = Object.class.getResourceAsStream("/"+name);
+++                } else {
+++                    ris = cl.getResourceAsStream(name);
+++                }
+++                return ris;
+++            }
+++        });
+++    }
+++
+++    /**
+++     * Gets a resource bundle using the specified base name, the default locale, and the caller's class loader.
+++     * @param bundle the base name of the resource bundle, a fully qualified class name
+++     * @return a resource bundle for the given base name and the default locale
+++     */
+++    public static ResourceBundle getResourceBundle(String bundle) {
+++        return getResourceBundle(bundle, Locale.getDefault());
+++    }
+++
+++    /**
+++     * Gets a resource bundle using the specified base name and locale, and the caller's class loader.
+++     * @param bundle the base name of the resource bundle, a fully qualified class name
+++     * @param locale the locale for which a resource bundle is desired
+++     * @return a resource bundle for the given base name and locale
+++     */
+++    public static ResourceBundle getResourceBundle(final String bundle, final Locale locale) {
+++        return AccessController.doPrivileged(new PrivilegedAction<ResourceBundle>() {
+++            public ResourceBundle run() {
+++                try {
+++                    return PropertyResourceBundle.getBundle(bundle, locale);
+++                } catch (MissingResourceException e) {
+++                    try {
+++                        return PropertyResourceBundle.getBundle(bundle, new Locale("en", "US"));
+++                    } catch (MissingResourceException e2) {
+++                        throw new MissingResourceException(
+++                                "Could not load any resource bundle by " + bundle, bundle, "");
+++                    }
+++                }
+++            }
+++        });
+++    }
+++
+++    static boolean getFileExists(final File f) {
+++        return ((Boolean)
+++                AccessController.doPrivileged(new PrivilegedAction() {
+++                    public Object run() {
+++                        return f.exists() ? Boolean.TRUE : Boolean.FALSE;
+++                    }
+++                })).booleanValue();
+++    }
+++
+++    static long getLastModified(final File f) {
+++        return ((Long)
+++                AccessController.doPrivileged(new PrivilegedAction() {
+++                    public Object run() {
+++                        return new Long(f.lastModified());
+++                    }
+++                })).longValue();
+++    }
+++
+++    private SecuritySupport () {}
+++}
++--- src/com/sun/org/apache/xerces/internal/xinclude/XIncludeMessageFormatter.java	2013-04-16 14:28:09.628154939 +0100
+++++ src/com/sun/org/apache/xerces/internal/xinclude/XIncludeMessageFormatter.java	2013-04-16 14:29:26.557394511 +0100
++@@ -20,11 +20,11 @@
++ 
++ package com.sun.org.apache.xerces.internal.xinclude;
++ 
+++import com.sun.org.apache.xerces.internal.util.MessageFormatter;
+++import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
++ import java.util.Locale;
++ import java.util.MissingResourceException;
++ import java.util.ResourceBundle;
++-import java.util.PropertyResourceBundle;
++-import com.sun.org.apache.xerces.internal.util.MessageFormatter;
++ 
++ // TODO: fix error messages in XIncludeMessages.properties
++ /**
++@@ -32,6 +32,7 @@
++  *
++  * @author Peter McCracken, IBM
++  *
+++ * @version $Id: XIncludeMessageFormatter.java,v 1.7 2010-11-01 04:40:18 joehw Exp $
++  */
++ public class XIncludeMessageFormatter implements MessageFormatter {
++ 
++@@ -61,12 +62,12 @@
++ 
++         if (fResourceBundle == null || locale != fLocale) {
++             if (locale != null) {
++-                fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XIncludeMessages", locale);
+++                fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XIncludeMessages", locale);
++                 // memorize the most-recent locale
++                 fLocale = locale;
++             }
++             if (fResourceBundle == null)
++-                fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XIncludeMessages");
+++                fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XIncludeMessages");
++         }
++ 
++         String msg = fResourceBundle.getString(key);
++--- src/com/sun/org/apache/xerces/internal/xpointer/XPointerMessageFormatter.java	2013-04-16 14:28:09.636155069 +0100
+++++ src/com/sun/org/apache/xerces/internal/xpointer/XPointerMessageFormatter.java	2013-04-16 14:29:26.557394511 +0100
++@@ -24,6 +24,7 @@
++ import java.util.ResourceBundle;
++ import java.util.PropertyResourceBundle;
++ import com.sun.org.apache.xerces.internal.util.MessageFormatter;
+++import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
++ 
++ /**
++  * XPointerMessageFormatter provides error messages for the XPointer Framework
++@@ -31,6 +32,7 @@
++  *
++  * @xerces.internal
++  *
+++ * @version $Id: XPointerMessageFormatter.java,v 1.5 2010-11-01 04:40:26 joehw Exp $
++  */
++ class XPointerMessageFormatter implements MessageFormatter {
++ 
++@@ -64,14 +66,14 @@
++ 
++         if (fResourceBundle == null || locale != fLocale) {
++             if (locale != null) {
++-                fResourceBundle = PropertyResourceBundle.getBundle(
+++                fResourceBundle = SecuritySupport.getResourceBundle(
++                         "com.sun.org.apache.xerces.internal.impl.msg.XPointerMessages", locale);
++                 // memorize the most-recent locale
++                 fLocale = locale;
++             }
++             if (fResourceBundle == null)
++-                fResourceBundle = PropertyResourceBundle
++-                        .getBundle("com.sun.org.apache.xerces.internal.impl.msg.XPointerMessages");
+++                fResourceBundle = SecuritySupport.getResourceBundle(
+++                        "com.sun.org.apache.xerces.internal.impl.msg.XPointerMessages");
++         }
++ 
++         String msg = fResourceBundle.getString(key);
++--- src/com/sun/org/apache/xml/internal/dtm/DTMManager.java	2013-04-16 14:28:09.644155197 +0100
+++++ src/com/sun/org/apache/xml/internal/dtm/DTMManager.java	2013-04-16 14:29:26.557394511 +0100
++@@ -26,6 +26,7 @@
++ import com.sun.org.apache.xml.internal.res.XMLMessages;
++ import com.sun.org.apache.xml.internal.utils.PrefixResolver;
++ import com.sun.org.apache.xml.internal.utils.XMLStringFactory;
+++import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
++ 
++ /**
++  * A DTMManager instance can be used to create DTM and
++@@ -358,7 +359,7 @@
++   {
++     try
++     {
++-      debug = System.getProperty("dtm.debug") != null;
+++      debug = SecuritySupport.getSystemProperty("dtm.debug") != null;
++     }
++     catch (SecurityException ex){}
++   }
++--- src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ca.java	2013-04-16 14:28:09.664155519 +0100
+++++ src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ca.java	2013-04-16 14:29:26.557394511 +0100
++@@ -24,9 +24,6 @@
++ 
++ 
++ import java.util.ListResourceBundle;
++-import java.util.Locale;
++-import java.util.MissingResourceException;
++-import java.util.ResourceBundle;
++ 
++ /**
++  * Set up error messages.
++@@ -442,67 +439,4 @@
++   };
++   }
++ 
++-  /**
++-   *   Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   *   of ResourceBundle.getBundle().
++-   *
++-   *   @param className the name of the class that implements the resource bundle.
++-   *   @return the ResourceBundle
++-   *   @throws MissingResourceException
++-   */
++-  public static final XMLErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XMLErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XMLErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("ca", "ES"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "Could not load any resource bundles.", className, "");
++-      }
++-    }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++ }
++--- src/com/sun/org/apache/xml/internal/res/XMLErrorResources_cs.java	2013-04-16 14:28:09.664155519 +0100
+++++ src/com/sun/org/apache/xml/internal/res/XMLErrorResources_cs.java	2013-04-16 14:29:26.557394511 +0100
++@@ -24,9 +24,6 @@
++ 
++ 
++ import java.util.ListResourceBundle;
++-import java.util.Locale;
++-import java.util.MissingResourceException;
++-import java.util.ResourceBundle;
++ 
++ /**
++  * Set up error messages.
++@@ -442,67 +439,4 @@
++   };
++   }
++ 
++-  /**
++-   *   Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   *   of ResourceBundle.getBundle().
++-   *
++-   *   @param className the name of the class that implements the resource bundle.
++-   *   @return the ResourceBundle
++-   *   @throws MissingResourceException
++-   */
++-  public static final XMLErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XMLErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XMLErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("cs", "CZ"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "Could not load any resource bundles.", className, "");
++-      }
++-    }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++ }
++--- src/com/sun/org/apache/xml/internal/res/XMLErrorResources_de.java	2013-04-16 14:28:09.664155519 +0100
+++++ src/com/sun/org/apache/xml/internal/res/XMLErrorResources_de.java	2013-04-16 14:29:26.561394576 +0100
++@@ -24,9 +24,6 @@
++ 
++ 
++ import java.util.ListResourceBundle;
++-import java.util.Locale;
++-import java.util.MissingResourceException;
++-import java.util.ResourceBundle;
++ 
++ /**
++  * Set up error messages.
++@@ -442,67 +439,4 @@
++   };
++   }
++ 
++-  /**
++-   *   Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   *   of ResourceBundle.getBundle().
++-   *
++-   *   @param className the name of the class that implements the resource bundle.
++-   *   @return the ResourceBundle
++-   *   @throws MissingResourceException
++-   */
++-  public static final XMLErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XMLErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XMLErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("en", "US"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "Could not load any resource bundles.", className, "");
++-      }
++-    }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++ }
++--- src/com/sun/org/apache/xml/internal/res/XMLErrorResources_es.java	2013-04-16 14:28:09.664155519 +0100
+++++ src/com/sun/org/apache/xml/internal/res/XMLErrorResources_es.java	2013-04-16 14:29:26.561394576 +0100
++@@ -24,9 +24,6 @@
++ 
++ 
++ import java.util.ListResourceBundle;
++-import java.util.Locale;
++-import java.util.MissingResourceException;
++-import java.util.ResourceBundle;
++ 
++ /**
++  * Set up error messages.
++@@ -442,67 +439,4 @@
++   };
++   }
++ 
++-  /**
++-   *   Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   *   of ResourceBundle.getBundle().
++-   *
++-   *   @param className the name of the class that implements the resource bundle.
++-   *   @return the ResourceBundle
++-   *   @throws MissingResourceException
++-   */
++-  public static final XMLErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XMLErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XMLErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("es", "ES"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "Could not load any resource bundles.", className, "");
++-      }
++-    }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++ }
++--- src/com/sun/org/apache/xml/internal/res/XMLErrorResources_fr.java	2013-04-16 14:28:09.664155519 +0100
+++++ src/com/sun/org/apache/xml/internal/res/XMLErrorResources_fr.java	2013-04-16 14:29:26.561394576 +0100
++@@ -24,9 +24,6 @@
++ 
++ 
++ import java.util.ListResourceBundle;
++-import java.util.Locale;
++-import java.util.MissingResourceException;
++-import java.util.ResourceBundle;
++ 
++ /**
++  * Set up error messages.
++@@ -442,67 +439,4 @@
++   };
++   }
++ 
++-  /**
++-   *   Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   *   of ResourceBundle.getBundle().
++-   *
++-   *   @param className the name of the class that implements the resource bundle.
++-   *   @return the ResourceBundle
++-   *   @throws MissingResourceException
++-   */
++-  public static final XMLErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XMLErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XMLErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("en", "US"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "Could not load any resource bundles.", className, "");
++-      }
++-    }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++ }
++--- src/com/sun/org/apache/xml/internal/res/XMLErrorResources_it.java	2013-04-16 14:28:09.664155519 +0100
+++++ src/com/sun/org/apache/xml/internal/res/XMLErrorResources_it.java	2013-04-16 14:29:26.561394576 +0100
++@@ -24,9 +24,6 @@
++ 
++ 
++ import java.util.ListResourceBundle;
++-import java.util.Locale;
++-import java.util.MissingResourceException;
++-import java.util.ResourceBundle;
++ 
++ /**
++  * Set up error messages.
++@@ -442,67 +439,4 @@
++   };
++   }
++ 
++-  /**
++-   *   Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   *   of ResourceBundle.getBundle().
++-   *
++-   *   @param className the name of the class that implements the resource bundle.
++-   *   @return the ResourceBundle
++-   *   @throws MissingResourceException
++-   */
++-  public static final XMLErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XMLErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XMLErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("it", "IT"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "Could not load any resource bundles.", className, "");
++-      }
++-    }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++ }
++--- src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ja.java	2013-04-16 14:28:09.664155519 +0100
+++++ src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ja.java	2013-04-16 14:29:26.561394576 +0100
++@@ -24,9 +24,6 @@
++ 
++ 
++ import java.util.ListResourceBundle;
++-import java.util.Locale;
++-import java.util.MissingResourceException;
++-import java.util.ResourceBundle;
++ 
++ /**
++  * Set up error messages.
++@@ -442,67 +439,4 @@
++   };
++   }
++ 
++-  /**
++-   *   Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   *   of ResourceBundle.getBundle().
++-   *
++-   *   @param className the name of the class that implements the resource bundle.
++-   *   @return the ResourceBundle
++-   *   @throws MissingResourceException
++-   */
++-  public static final XMLErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XMLErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XMLErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("en", "US"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "Could not load any resource bundles.", className, "");
++-      }
++-    }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++ }
++--- src/com/sun/org/apache/xml/internal/res/XMLErrorResources.java	2013-04-16 14:28:09.660155456 +0100
+++++ src/com/sun/org/apache/xml/internal/res/XMLErrorResources.java	2013-04-16 14:29:26.557394511 +0100
++@@ -24,9 +24,6 @@
++ 
++ 
++ import java.util.ListResourceBundle;
++-import java.util.Locale;
++-import java.util.MissingResourceException;
++-import java.util.ResourceBundle;
++ 
++ /**
++  * Set up error messages.
++@@ -461,67 +458,4 @@
++         return msgCopy;
++     }
++ 
++-  /**
++-   *   Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   *   of ResourceBundle.getBundle().
++-   *
++-   *   @param className the name of the class that implements the resource bundle.
++-   *   @return the ResourceBundle
++-   *   @throws MissingResourceException
++-   */
++-  public static final XMLErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XMLErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XMLErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("en", "US"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "Could not load any resource bundles.", className, "");
++-      }
++-    }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++ }
++--- src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ko.java	2013-04-16 14:28:09.664155519 +0100
+++++ src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ko.java	2013-04-16 14:29:26.561394576 +0100
++@@ -24,9 +24,6 @@
++ 
++ 
++ import java.util.ListResourceBundle;
++-import java.util.Locale;
++-import java.util.MissingResourceException;
++-import java.util.ResourceBundle;
++ 
++ /**
++  * Set up error messages.
++@@ -442,67 +439,4 @@
++   };
++   }
++ 
++-  /**
++-   *   Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   *   of ResourceBundle.getBundle().
++-   *
++-   *   @param className the name of the class that implements the resource bundle.
++-   *   @return the ResourceBundle
++-   *   @throws MissingResourceException
++-   */
++-  public static final XMLErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XMLErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XMLErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("ko", "US"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "Could not load any resource bundles.", className, "");
++-      }
++-    }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++ }
++--- src/com/sun/org/apache/xml/internal/res/XMLErrorResources_sk.java	2013-04-16 14:28:09.664155519 +0100
+++++ src/com/sun/org/apache/xml/internal/res/XMLErrorResources_sk.java	2013-04-16 14:29:26.561394576 +0100
++@@ -24,9 +24,6 @@
++ 
++ 
++ import java.util.ListResourceBundle;
++-import java.util.Locale;
++-import java.util.MissingResourceException;
++-import java.util.ResourceBundle;
++ 
++ /**
++  * Set up error messages.
++@@ -442,67 +439,4 @@
++   };
++   }
++ 
++-  /**
++-   *   Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   *   of ResourceBundle.getBundle().
++-   *
++-   *   @param className the name of the class that implements the resource bundle.
++-   *   @return the ResourceBundle
++-   *   @throws MissingResourceException
++-   */
++-  public static final XMLErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XMLErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XMLErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("en", "US"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "Could not load any resource bundles.", className, "");
++-      }
++-    }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++ }
++--- src/com/sun/org/apache/xml/internal/res/XMLErrorResources_tr.java	2013-04-16 14:28:09.668155584 +0100
+++++ src/com/sun/org/apache/xml/internal/res/XMLErrorResources_tr.java	2013-04-16 14:29:26.561394576 +0100
++@@ -24,9 +24,6 @@
++ 
++ 
++ import java.util.ListResourceBundle;
++-import java.util.Locale;
++-import java.util.MissingResourceException;
++-import java.util.ResourceBundle;
++ 
++ /**
++  * Set up error messages.
++@@ -442,67 +439,4 @@
++   };
++   }
++ 
++-  /**
++-   *   Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   *   of ResourceBundle.getBundle().
++-   *
++-   *   @param className the name of the class that implements the resource bundle.
++-   *   @return the ResourceBundle
++-   *   @throws MissingResourceException
++-   */
++-  public static final XMLErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XMLErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XMLErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("tr", "TR"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "Could not load any resource bundles.", className, "");
++-      }
++-    }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++ }
++--- src/com/sun/org/apache/xml/internal/res/XMLErrorResources_zh_CN.java	2013-04-16 14:28:09.668155584 +0100
+++++ src/com/sun/org/apache/xml/internal/res/XMLErrorResources_zh_CN.java	2013-04-16 14:29:26.561394576 +0100
++@@ -24,9 +24,6 @@
++ 
++ 
++ import java.util.ListResourceBundle;
++-import java.util.Locale;
++-import java.util.MissingResourceException;
++-import java.util.ResourceBundle;
++ 
++ /**
++  * Set up error messages.
++@@ -442,67 +439,4 @@
++   };
++   }
++ 
++-  /**
++-   *   Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   *   of ResourceBundle.getBundle().
++-   *
++-   *   @param className the name of the class that implements the resource bundle.
++-   *   @return the ResourceBundle
++-   *   @throws MissingResourceException
++-   */
++-  public static final XMLErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XMLErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XMLErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("zh", "CN"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "\u65e0\u6cd5\u88c5\u5165\u4efb\u4f55\u8d44\u6e90\u5305\u3002", className, "");
++-      }
++-    }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++ }
++--- src/com/sun/org/apache/xml/internal/res/XMLErrorResources_zh_TW.java	2013-04-16 14:28:09.668155584 +0100
+++++ src/com/sun/org/apache/xml/internal/res/XMLErrorResources_zh_TW.java	2013-04-16 14:29:26.561394576 +0100
++@@ -24,9 +24,6 @@
++ 
++ 
++ import java.util.ListResourceBundle;
++-import java.util.Locale;
++-import java.util.MissingResourceException;
++-import java.util.ResourceBundle;
++ 
++ /**
++  * Set up error messages.
++@@ -442,67 +439,4 @@
++   };
++   }
++ 
++-  /**
++-   *   Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   *   of ResourceBundle.getBundle().
++-   *
++-   *   @param className the name of the class that implements the resource bundle.
++-   *   @return the ResourceBundle
++-   *   @throws MissingResourceException
++-   */
++-  public static final XMLErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XMLErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XMLErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("zh", "TW"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "Could not load any resource bundles.", className, "");
++-      }
++-    }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++ }
++--- src/com/sun/org/apache/xml/internal/res/XMLMessages.java	2013-04-16 14:28:09.668155584 +0100
+++++ src/com/sun/org/apache/xml/internal/res/XMLMessages.java	2013-04-16 14:29:26.561394576 +0100
++@@ -22,10 +22,9 @@
++  */
++ package com.sun.org.apache.xml.internal.res;
++ 
+++import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
++ import java.util.ListResourceBundle;
++ import java.util.Locale;
++-import java.util.MissingResourceException;
++-import java.util.ResourceBundle;
++ 
++ /**
++  * A utility class for issuing XML error messages.
++@@ -82,8 +81,9 @@
++    */
++   public static final String createXMLMessage(String msgKey, Object args[])
++   {
++-    if (XMLBundle == null)
++-      XMLBundle = loadResourceBundle(XML_ERROR_RESOURCES);
+++    if (XMLBundle == null) {
+++        XMLBundle = SecuritySupport.getResourceBundle(XML_ERROR_RESOURCES);
+++    }
++ 
++     if (XMLBundle != null)
++     {
++@@ -156,61 +156,4 @@
++     return fmsg;
++   }
++ 
++-  /**
++-   * Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   * of ResourceBundle.getBundle().
++-   *
++-   * @param className The class name of the resource bundle.
++-   * @return the ResourceBundle
++-   * @throws MissingResourceException
++-   */
++-  public static ListResourceBundle loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-    Locale locale = Locale.getDefault();
++-
++-    try
++-    {
++-      return (ListResourceBundle)ResourceBundle.getBundle(className, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (ListResourceBundle)ResourceBundle.getBundle(
++-          className, new Locale("en", "US"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "Could not load any resource bundles." + className, className, "");
++-      }
++-    }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which can be appended to a resource name
++-   */
++-  protected static String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++ }
++--- src/com/sun/org/apache/xml/internal/resolver/Catalog.java	2013-04-16 14:28:09.668155584 +0100
+++++ src/com/sun/org/apache/xml/internal/resolver/Catalog.java	2013-04-16 14:29:26.561394576 +0100
++@@ -23,6 +23,8 @@
++ 
++ package com.sun.org.apache.xml.internal.resolver;
++ 
+++import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
+++
++ import java.io.IOException;
++ import java.io.FileNotFoundException;
++ import java.io.InputStream;
++@@ -819,7 +821,7 @@
++       // tack on a basename because URLs point to files not dirs
++       catalogCwd = FileURL.makeURL("basename");
++     } catch (MalformedURLException e) {
++-      String userdir = System.getProperty("user.dir");
+++      String userdir = SecuritySupport.getSystemProperty("user.dir");
++       userdir.replace('\\', '/');
++       catalogManager.debug.message(1, "Malformed URL on cwd", userdir);
++       catalogCwd = null;
++@@ -1715,7 +1717,7 @@
++   protected String resolveLocalSystem(String systemId)
++     throws MalformedURLException, IOException {
++ 
++-    String osname = System.getProperty("os.name");
+++    String osname = SecuritySupport.getSystemProperty("os.name");
++     boolean windows = (osname.indexOf("Windows") >= 0);
++     Enumeration en = catalogEntries.elements();
++     while (en.hasMoreElements()) {
++--- src/com/sun/org/apache/xml/internal/resolver/CatalogManager.java	2013-04-16 14:28:09.668155584 +0100
+++++ src/com/sun/org/apache/xml/internal/resolver/CatalogManager.java	2013-04-16 14:29:26.561394576 +0100
++@@ -23,6 +23,7 @@
++ 
++ package com.sun.org.apache.xml.internal.resolver;
++ 
+++import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
++ import java.io.InputStream;
++ 
++ import java.net.URL;
++@@ -141,8 +142,8 @@
++ 
++   /** Flag to ignore missing property files and/or properties */
++   private boolean ignoreMissingProperties
++-    = (System.getProperty(pIgnoreMissing) != null
++-       || System.getProperty(pFiles) != null);
+++    = (SecuritySupport.getSystemProperty(pIgnoreMissing) != null
+++       || SecuritySupport.getSystemProperty(pFiles) != null);
++ 
++   /** Holds the resources after they are loaded from the file. */
++   private ResourceBundle resources;
++@@ -331,7 +332,7 @@
++   private int queryVerbosity () {
++     String defaultVerbStr = Integer.toString(defaultVerbosity);
++ 
++-    String verbStr = System.getProperty(pVerbosity);
+++    String verbStr = SecuritySupport.getSystemProperty(pVerbosity);
++ 
++     if (verbStr == null) {
++       if (resources==null) readProperties();
++@@ -466,7 +467,7 @@
++    * @return A semicolon delimited list of catlog file URIs
++    */
++   private String queryCatalogFiles () {
++-    String catalogList = System.getProperty(pFiles);
+++    String catalogList = SecuritySupport.getSystemProperty(pFiles);
++     fromPropertiesFile = false;
++ 
++     if (catalogList == null) {
++@@ -551,7 +552,7 @@
++    * defaultPreferSetting.
++    */
++   private boolean queryPreferPublic () {
++-    String prefer = System.getProperty(pPrefer);
+++    String prefer = SecuritySupport.getSystemProperty(pPrefer);
++ 
++     if (prefer == null) {
++       if (resources==null) readProperties();
++@@ -610,7 +611,7 @@
++    * defaultUseStaticCatalog.
++    */
++   private boolean queryUseStaticCatalog () {
++-    String staticCatalog = System.getProperty(pStatic);
+++    String staticCatalog = SecuritySupport.getSystemProperty(pStatic);
++ 
++     if (staticCatalog == null) {
++       if (resources==null) readProperties();
++@@ -741,7 +742,7 @@
++    * defaultOasisXMLCatalogPI.
++    */
++   public boolean queryAllowOasisXMLCatalogPI () {
++-    String allow = System.getProperty(pAllowPI);
+++    String allow = SecuritySupport.getSystemProperty(pAllowPI);
++ 
++     if (allow == null) {
++       if (resources==null) readProperties();
++@@ -794,7 +795,7 @@
++    *
++    */
++   public String queryCatalogClassName () {
++-    String className = System.getProperty(pClassname);
+++    String className = SecuritySupport.getSystemProperty(pClassname);
++ 
++     if (className == null) {
++       if (resources==null) readProperties();
++--- src/com/sun/org/apache/xml/internal/resolver/Resolver.java	2013-04-16 14:28:09.668155584 +0100
+++++ src/com/sun/org/apache/xml/internal/resolver/Resolver.java	2013-04-16 14:29:26.561394576 +0100
++@@ -31,6 +31,7 @@
++ import java.net.URL;
++ import java.net.URLConnection;
++ import java.net.MalformedURLException;
+++import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
++ import com.sun.org.apache.xml.internal.resolver.readers.SAXCatalogReader;
++ import com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader;
++ import com.sun.org.apache.xml.internal.resolver.readers.TR9401CatalogReader;
++@@ -521,7 +522,7 @@
++      */
++     private Vector resolveAllLocalSystem(String systemId) {
++         Vector map = new Vector();
++-        String osname = System.getProperty("os.name");
+++        String osname = SecuritySupport.getSystemProperty("os.name");
++         boolean windows = (osname.indexOf("Windows") >= 0);
++         Enumeration en = catalogEntries.elements();
++         while (en.hasMoreElements()) {
++@@ -549,7 +550,7 @@
++      */
++     private Vector resolveLocalSystemReverse(String systemId) {
++         Vector map = new Vector();
++-        String osname = System.getProperty("os.name");
+++        String osname = SecuritySupport.getSystemProperty("os.name");
++         boolean windows = (osname.indexOf("Windows") >= 0);
++         Enumeration en = catalogEntries.elements();
++         while (en.hasMoreElements()) {
++--- src/com/sun/org/apache/xml/internal/serialize/SerializerFactory.java	2013-04-16 14:28:09.684155841 +0100
+++++ src/com/sun/org/apache/xml/internal/serialize/SerializerFactory.java	2013-04-16 14:29:26.561394576 +0100
++@@ -21,6 +21,7 @@
++ 
++ package com.sun.org.apache.xml.internal.serialize;
++ 
+++import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
++ 
++ import java.io.OutputStream;
++ import java.io.Writer;
++@@ -63,7 +64,7 @@
++         factory =  new SerializerFactoryImpl( Method.TEXT );
++         registerSerializerFactory( factory );
++ 
++-        list = System.getProperty( FactoriesProperty );
+++        list = SecuritySupport.getSystemProperty( FactoriesProperty );
++         if ( list != null ) {
++             token = new StringTokenizer( list, " ;,:" );
++             while ( token.hasMoreTokens() ) {
++--- src/com/sun/org/apache/xml/internal/serializer/Encodings.java	2013-04-16 14:28:09.684155841 +0100
+++++ src/com/sun/org/apache/xml/internal/serializer/Encodings.java	2013-04-16 14:29:26.561394576 +0100
++@@ -34,6 +34,7 @@
++ import java.util.Properties;
++ import java.util.StringTokenizer;
++ 
+++import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
++ 
++ /**
++  * Provides information about encodings. Depends on the Java runtime
++@@ -218,7 +219,7 @@
++                 // Get the default system character encoding.  This may be
++                 // incorrect if they passed in a writer, but right now there
++                 // seems to be no way to get the encoding from a writer.
++-                encoding = System.getProperty("file.encoding", "UTF8");
+++                encoding = SecuritySupport.getSystemProperty("file.encoding", "UTF8");
++ 
++                 if (null != encoding)
++                 {
++@@ -312,7 +313,7 @@
++ 
++             try
++             {
++-                urlString = System.getProperty(ENCODINGS_PROP, "");
+++                urlString = SecuritySupport.getSystemProperty(ENCODINGS_PROP, "");
++             }
++             catch (SecurityException e)
++             {
++@@ -324,9 +325,7 @@
++             }
++ 
++             if (is == null) {
++-                SecuritySupport ss = SecuritySupport.getInstance();
++-                is = ss.getResourceAsStream(ObjectFactory.findClassLoader(),
++-                                            ENCODINGS_FILE);
+++                is = SecuritySupport.getResourceAsStream(ENCODINGS_FILE);
++             }
++ 
++             Properties props = new Properties();
++--- src/com/sun/org/apache/xml/internal/serializer/ObjectFactory.java	2013-04-16 14:28:09.688155906 +0100
+++++ src/com/sun/org/apache/xml/internal/serializer/ObjectFactory.java	1970-01-01 01:00:00.000000000 +0100
++@@ -1,662 +0,0 @@
++-/*
++- * 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;
++-
++-    //
++-    // Public static methods
++-    //
++-
++-    /**
++-     * Finds the implementation Class object in the specified order.  The
++-     * specified order is the following:
++-     * <ol>
++-     *  <li>query the system property using <code>System.getProperty</code>
++-     *  <li>read <code>META-INF/services/<i>factoryId</i></code> file
++-     *  <li>use fallback classname
++-     * </ol>
++-     *
++-     * @return instance of factory, never null
++-     *
++-     * @param factoryId             Name of the factory to find, same as
++-     *                              a property name
++-     * @param fallbackClassName     Implementation class name, if nothing else
++-     *                              is found.  Use null to mean no fallback.
++-     *
++-     * @exception ObjectFactory.ConfigurationError
++-     */
++-    static Object createObject(String factoryId, String fallbackClassName)
++-        throws ConfigurationError {
++-        return createObject(factoryId, null, fallbackClassName);
++-    } // createObject(String,String):Object
++-
++-    /**
++-     * Finds the implementation Class object in the specified order.  The
++-     * specified order is the following:
++-     * <ol>
++-     *  <li>query the system property using <code>System.getProperty</code>
++-     *  <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file
++-     *  <li>read <code>META-INF/services/<i>factoryId</i></code> file
++-     *  <li>use fallback classname
++-     * </ol>
++-     *
++-     * @return instance of factory, never null
++-     *
++-     * @param factoryId             Name of the factory to find, same as
++-     *                              a property name
++-     * @param propertiesFilename The filename in the $java.home/lib directory
++-     *                           of the properties file.  If none specified,
++-     *                           ${java.home}/lib/xalan.properties will be used.
++-     * @param fallbackClassName     Implementation class name, if nothing else
++-     *                              is found.  Use null to mean no fallback.
++-     *
++-     * @exception ObjectFactory.ConfigurationError
++-     */
++-    static Object createObject(String factoryId, 
++-                                      String propertiesFilename,
++-                                      String fallbackClassName)
++-        throws ConfigurationError
++-    {
++-        Class factoryClass = lookUpFactoryClass(factoryId,
++-                                                propertiesFilename,
++-                                                fallbackClassName);
++-
++-        if (factoryClass == null) {
++-            throw new ConfigurationError(
++-                "Provider for " + factoryId + " cannot be found", null);
++-        }
++-
++-        try{
++-            Object instance = factoryClass.newInstance();
++-            if (DEBUG) debugPrintln("created new instance of factory " + factoryId);
++-            return instance;
++-        } catch (Exception x) {
++-            throw new ConfigurationError(
++-                "Provider for factory " + factoryId
++-                    + " could not be instantiated: " + x, x);
++-        }
++-    } // createObject(String,String,String):Object
++-
++-    /**
++-     * Finds the implementation Class object in the specified order.  The
++-     * specified order is the following:
++-     * <ol>
++-     *  <li>query the system property using <code>System.getProperty</code>
++-     *  <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file
++-     *  <li>read <code>META-INF/services/<i>factoryId</i></code> file
++-     *  <li>use fallback classname
++-     * </ol>
++-     *
++-     * @return Class object of factory, never null
++-     *
++-     * @param factoryId             Name of the factory to find, same as
++-     *                              a property name
++-     * @param propertiesFilename The filename in the $java.home/lib directory
++-     *                           of the properties file.  If none specified,
++-     *                           ${java.home}/lib/xalan.properties will be used.
++-     * @param fallbackClassName     Implementation class name, if nothing else
++-     *                              is found.  Use null to mean no fallback.
++-     *
++-     * @exception ObjectFactory.ConfigurationError
++-     */
++-    static Class lookUpFactoryClass(String factoryId) 
++-        throws ConfigurationError
++-    {
++-        return lookUpFactoryClass(factoryId, null, null);
++-    } // lookUpFactoryClass(String):Class
++-
++-    /**
++-     * Finds the implementation Class object in the specified order.  The
++-     * specified order is the following:
++-     * <ol>
++-     *  <li>query the system property using <code>System.getProperty</code>
++-     *  <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file
++-     *  <li>read <code>META-INF/services/<i>factoryId</i></code> file
++-     *  <li>use fallback classname
++-     * </ol>
++-     *
++-     * @return Class object that provides factory service, never null
++-     *
++-     * @param factoryId             Name of the factory to find, same as
++-     *                              a property name
++-     * @param propertiesFilename The filename in the $java.home/lib directory
++-     *                           of the properties file.  If none specified,
++-     *                           ${java.home}/lib/xalan.properties will be used.
++-     * @param fallbackClassName     Implementation class name, if nothing else
++-     *                              is found.  Use null to mean no fallback.
++-     *
++-     * @exception ObjectFactory.ConfigurationError
++-     */
++-    static Class lookUpFactoryClass(String factoryId,
++-                                           String propertiesFilename,
++-                                           String fallbackClassName)
++-        throws ConfigurationError
++-    {
++-        String factoryClassName = lookUpFactoryClassName(factoryId,
++-                                                         propertiesFilename,
++-                                                         fallbackClassName);
++-        ClassLoader cl = findClassLoader();
++-
++-        if (factoryClassName == null) {
++-            factoryClassName = fallbackClassName;
++-        }
++-
++-        // assert(className != null);
++-        try{
++-            Class providerClass = findProviderClass(factoryClassName,
++-                                                    cl,
++-                                                    true);
++-            if (DEBUG) debugPrintln("created new instance of " + providerClass +
++-                   " using ClassLoader: " + cl);
++-            return providerClass;
++-        } catch (ClassNotFoundException x) {
++-            throw new ConfigurationError(
++-                "Provider " + factoryClassName + " not found", x);
++-        } catch (Exception x) {
++-            throw new ConfigurationError(
++-                "Provider "+factoryClassName+" could not be instantiated: "+x,
++-                x);
++-        }
++-    } // lookUpFactoryClass(String,String,String):Class
++-
++-    /**
++-     * Finds the name of the required implementation class in the specified
++-     * order.  The specified order is the following:
++-     * <ol>
++-     *  <li>query the system property using <code>System.getProperty</code>
++-     *  <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file
++-     *  <li>read <code>META-INF/services/<i>factoryId</i></code> file
++-     *  <li>use fallback classname
++-     * </ol>
++-     *
++-     * @return name of class that provides factory service, never null
++-     *
++-     * @param factoryId             Name of the factory to find, same as
++-     *                              a property name
++-     * @param propertiesFilename The filename in the $java.home/lib directory
++-     *                           of the properties file.  If none specified,
++-     *                           ${java.home}/lib/xalan.properties will be used.
++-     * @param fallbackClassName     Implementation class name, if nothing else
++-     *                              is found.  Use null to mean no fallback.
++-     *
++-     * @exception ObjectFactory.ConfigurationError
++-     */
++-    static String lookUpFactoryClassName(String factoryId,
++-                                                String propertiesFilename,
++-                                                String fallbackClassName)
++-    {
++-        SecuritySupport ss = SecuritySupport.getInstance();
++-
++-        // Use the system property first
++-        try {
++-            String systemProp = ss.getSystemProperty(factoryId);
++-            if (systemProp != null) {
++-                if (DEBUG) debugPrintln("found system property, value=" + systemProp);
++-                return systemProp;
++-            }
++-        } catch (SecurityException se) {
++-            // Ignore and continue w/ next location
++-        }
++-
++-        // Try to read from propertiesFilename, or
++-        // $java.home/lib/xalan.properties
++-        String factoryClassName = null;
++-        // no properties file name specified; use
++-        // $JAVA_HOME/lib/xalan.properties:
++-        if (propertiesFilename == null) {
++-            File propertiesFile = null;
++-            boolean propertiesFileExists = false;
++-            try {
++-                String javah = ss.getSystemProperty("java.home");
++-                propertiesFilename = javah + File.separator +
++-                    "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME;
++-                propertiesFile = new File(propertiesFilename);
++-                propertiesFileExists = ss.getFileExists(propertiesFile);
++-            } catch (SecurityException e) {
++-                // try again...
++-                fLastModified = -1;
++-                fXalanProperties = null;
++-            }
++-
++-            synchronized (ObjectFactory.class) {
++-                boolean loadProperties = false;
++-                FileInputStream fis = null;
++-                try {
++-                    // file existed last time
++-                    if(fLastModified >= 0) {
++-                        if(propertiesFileExists &&
++-                                (fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) {
++-                            loadProperties = true;
++-                        } else {
++-                            // file has stopped existing...
++-                            if(!propertiesFileExists) {
++-                                fLastModified = -1;
++-                                fXalanProperties = null;
++-                            } // else, file wasn't modified!
++-                        }
++-                    } else {
++-                        // file has started to exist:
++-                        if(propertiesFileExists) {
++-                            loadProperties = true;
++-                            fLastModified = ss.getLastModified(propertiesFile);
++-                        } // else, nothing's changed
++-                    }
++-                    if(loadProperties) {
++-                        // must never have attempted to read xalan.properties
++-                        // before (or it's outdeated)
++-                        fXalanProperties = new Properties();
++-                        fis = ss.getFileInputStream(propertiesFile);
++-                        fXalanProperties.load(fis);
++-                    }
++-	        } catch (Exception x) {
++-	            fXalanProperties = null;
++-	            fLastModified = -1;
++-                    // assert(x instanceof FileNotFoundException
++-	            //        || x instanceof SecurityException)
++-	            // In both cases, ignore and continue w/ next location
++-	        }
++-                finally {
++-                    // try to close the input stream if one was opened.
++-                    if (fis != null) {
++-                        try {
++-                            fis.close();
++-                        }
++-                        // Ignore the exception.
++-                        catch (IOException exc) {}
++-                    }
++-                }	            
++-            }
++-            if(fXalanProperties != null) {
++-                factoryClassName = fXalanProperties.getProperty(factoryId);
++-            }
++-        } else {
++-            FileInputStream fis = null;
++-            try {
++-                fis = ss.getFileInputStream(new File(propertiesFilename));
++-                Properties props = new Properties();
++-                props.load(fis);
++-                factoryClassName = props.getProperty(factoryId);
++-            } catch (Exception x) {
++-                // assert(x instanceof FileNotFoundException
++-                //        || x instanceof SecurityException)
++-                // In both cases, ignore and continue w/ next location
++-            }
++-            finally {
++-                // try to close the input stream if one was opened.
++-                if (fis != null) {
++-                    try {
++-                        fis.close();
++-                    }
++-                    // Ignore the exception.
++-                    catch (IOException exc) {}
++-                }
++-            }               
++-        }
++-        if (factoryClassName != null) {
++-            if (DEBUG) debugPrintln("found in " + propertiesFilename + ", value="
++-                          + factoryClassName);
++-            return factoryClassName;
++-        }
++-
++-        // Try Jar Service Provider Mechanism
++-        return findJarServiceProviderName(factoryId);
++-    } // lookUpFactoryClass(String,String):String
++-
++-    //
++-    // Private static methods
++-    //
++-
++-    /** Prints a message to standard error if debugging is enabled. */
++-    private static void debugPrintln(String msg) {
++-        if (DEBUG) {
++-            System.err.println("JAXP: " + msg);
++-        }
++-    } // debugPrintln(String)
++-
++-    /**
++-     * Figure out which ClassLoader to use.  For JDK 1.2 and later use
++-     * the context ClassLoader.
++-     */
++-    static ClassLoader findClassLoader()
++-        throws ConfigurationError
++-    { 
++-        SecuritySupport ss = SecuritySupport.getInstance();
++-
++-        // Figure out which ClassLoader to use for loading the provider
++-        // class.  If there is a Context ClassLoader then use it.
++-        ClassLoader context = ss.getContextClassLoader();
++-        ClassLoader system = ss.getSystemClassLoader();
++-
++-        ClassLoader chain = system;
++-        while (true) {
++-            if (context == chain) {
++-                // Assert: we are on JDK 1.1 or we have no Context ClassLoader
++-                // or any Context ClassLoader in chain of system classloader
++-                // (including extension ClassLoader) so extend to widest
++-                // ClassLoader (always look in system ClassLoader if Xalan
++-                // is in boot/extension/system classpath and in current
++-                // ClassLoader otherwise); normal classloaders delegate
++-                // back to system ClassLoader first so this widening doesn't
++-                // change the fact that context ClassLoader will be consulted
++-                ClassLoader current = ObjectFactory.class.getClassLoader();
++-
++-                chain = system;
++-                while (true) {
++-                    if (current == chain) {
++-                        // Assert: Current ClassLoader in chain of
++-                        // boot/extension/system ClassLoaders
++-                        return system;
++-                    }
++-                    if (chain == null) {
++-                        break;
++-                    }
++-                    chain = ss.getParentClassLoader(chain);
++-                }
++-
++-                // Assert: Current ClassLoader not in chain of
++-                // boot/extension/system ClassLoaders
++-                return current;
++-            }
++-
++-            if (chain == null) {
++-                // boot ClassLoader reached
++-                break;
++-            }
++-
++-            // Check for any extension ClassLoaders in chain up to
++-            // boot ClassLoader
++-            chain = ss.getParentClassLoader(chain);
++-        };
++-
++-        // Assert: Context ClassLoader not in chain of
++-        // boot/extension/system ClassLoaders
++-        return context;
++-    } // findClassLoader():ClassLoader
++-
++-    /**
++-     * 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();
++-            if (DEBUG) debugPrintln("created new instance of " + providerClass +
++-                   " using ClassLoader: " + cl);
++-            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;
++-    }
++-
++-    /**
++-     * Find the name of service provider using Jar Service Provider Mechanism
++-     *
++-     * @return instance of provider class if found or null
++-     */
++-    private static String findJarServiceProviderName(String factoryId)
++-    {
++-        SecuritySupport ss = SecuritySupport.getInstance();
++-        String serviceId = SERVICES_PATH + factoryId;
++-        InputStream is = null;
++-
++-        // First try the Context ClassLoader
++-        ClassLoader cl = findClassLoader();
++-
++-        is = ss.getResourceAsStream(cl, serviceId);
++-
++-        // If no provider found then try the current ClassLoader
++-        if (is == null) {
++-            ClassLoader current = ObjectFactory.class.getClassLoader();
++-            if (cl != current) {
++-                cl = current;
++-                is = ss.getResourceAsStream(cl, serviceId);
++-            }
++-        }
++-
++-        if (is == null) {
++-            // No provider found
++-            return null;
++-        }
++-
++-        if (DEBUG) debugPrintln("found jar resource=" + serviceId +
++-               " using ClassLoader: " + cl);
++-
++-        // Read the service provider name in UTF-8 as specified in
++-        // the jar spec.  Unfortunately this fails in Microsoft
++-        // VJ++, which does not implement the UTF-8
++-        // encoding. Theoretically, we should simply let it fail in
++-        // that case, since the JVM is obviously broken if it
++-        // doesn't support such a basic standard.  But since there
++-        // are still some users attempting to use VJ++ for
++-        // development, we have dropped in a fallback which makes a
++-        // second attempt using the platform's default encoding. In
++-        // VJ++ this is apparently ASCII, which is a subset of
++-        // UTF-8... and since the strings we'll be reading here are
++-        // also primarily limited to the 7-bit ASCII range (at
++-        // least, in English versions), this should work well
++-        // enough to keep us on the air until we're ready to
++-        // officially decommit from VJ++. [Edited comment from
++-        // jkesselm]
++-        BufferedReader rd;
++-        try {
++-            rd = new BufferedReader(new InputStreamReader(is, "UTF-8"));
++-        } catch (java.io.UnsupportedEncodingException e) {
++-            rd = new BufferedReader(new InputStreamReader(is));
++-        }
++-        
++-        String factoryClassName = null;
++-        try {
++-            // XXX Does not handle all possible input as specified by the
++-            // Jar Service Provider specification
++-            factoryClassName = rd.readLine();
++-        } catch (IOException x) {
++-            // No provider found
++-            return null;
++-        }
++-        finally {
++-            try {
++-                // try to close the reader.
++-                rd.close();
++-            }
++-            // Ignore the exception.
++-            catch (IOException exc) {}
++-        }          
++-
++-        if (factoryClassName != null &&
++-            ! "".equals(factoryClassName)) {
++-            if (DEBUG) debugPrintln("found in resource, value="
++-                   + factoryClassName);
++-
++-            // Note: here we do not want to fall back to the current
++-            // 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 factoryClassName;
++-        }
++-
++-        // No provider found
++-        return null;
++-    }
++-
++-    //
++-    // 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/OutputPropertiesFactory.java	2013-04-16 14:28:09.688155906 +0100
+++++ src/com/sun/org/apache/xml/internal/serializer/OutputPropertiesFactory.java	2013-04-16 14:29:26.561394576 +0100
++@@ -22,6 +22,7 @@
++  */
++ package com.sun.org.apache.xml.internal.serializer;
++ 
+++import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
++ import java.io.BufferedInputStream;
++ import java.io.IOException;
++ import java.io.InputStream;
++@@ -451,7 +452,7 @@
++             String value = null;
++             try
++             {
++-                value = System.getProperty(key);
+++                value = SecuritySupport.getSystemProperty(key);
++             }
++             catch (SecurityException se)
++             {
++@@ -464,7 +465,7 @@
++             String newValue = null;
++             try
++             {
++-                newValue = System.getProperty(newKey);
+++                newValue = SecuritySupport.getSystemProperty(newKey);
++             }
++             catch (SecurityException se)
++             {
++--- src/com/sun/org/apache/xml/internal/serializer/SecuritySupport12.java	2013-04-16 14:28:09.688155906 +0100
+++++ src/com/sun/org/apache/xml/internal/serializer/SecuritySupport12.java	1970-01-01 01:00:00.000000000 +0100
++@@ -1,145 +0,0 @@
++-/*
++- * reserved comment block
++- * DO NOT REMOVE OR ALTER!
++- */
++-/*
++- * Copyright 2002-2004 The Apache Software Foundation.
++- *
++- * Licensed under the Apache License, Version 2.0 (the "License");
++- * you may not use this file except in compliance with the License.
++- * You may obtain a copy of the License at
++- *
++- *     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: SecuritySupport12.java,v 1.2.4.1 2005/09/15 08:15:22 suresh_emailid Exp $
++- */
++-
++-package com.sun.org.apache.xml.internal.serializer;
++-
++-import java.io.File;
++-import java.io.FileInputStream;
++-import java.io.FileNotFoundException;
++-import java.io.InputStream;
++-import java.security.AccessController;
++-import java.security.PrivilegedAction;
++-import java.security.PrivilegedActionException;
++-import java.security.PrivilegedExceptionAction;
++-
++-/**
++- * This class is duplicated for each Xalan-Java subpackage so keep it in sync.
++- * It is package private and therefore is not exposed as part of the Xalan-Java
++- * API.
++- *
++- * Security related methods that only work on J2SE 1.2 and newer.
++- */
++-class SecuritySupport12 extends SecuritySupport {
++-
++-    ClassLoader getContextClassLoader() {
++-        return (ClassLoader)
++-                AccessController.doPrivileged(new PrivilegedAction() {
++-            public Object run() {
++-                ClassLoader cl = null;
++-                try {
++-                    cl = Thread.currentThread().getContextClassLoader();
++-                } catch (SecurityException ex) { }
++-                return cl;
++-            }
++-        });
++-    }
++-
++-    ClassLoader getSystemClassLoader() {
++-        return (ClassLoader)
++-            AccessController.doPrivileged(new PrivilegedAction() {
++-                public Object run() {
++-                    ClassLoader cl = null;
++-                    try {
++-                        cl = ClassLoader.getSystemClassLoader();
++-                    } catch (SecurityException ex) {}
++-                    return cl;
++-                }
++-            });
++-    }
++-
++-    ClassLoader getParentClassLoader(final ClassLoader cl) {
++-        return (ClassLoader)
++-            AccessController.doPrivileged(new PrivilegedAction() {
++-                public Object run() {
++-                    ClassLoader parent = null;
++-                    try {
++-                        parent = cl.getParent();
++-                    } catch (SecurityException ex) {}
++-
++-                    // eliminate loops in case of the boot
++-                    // ClassLoader returning itself as a parent
++-                    return (parent == cl) ? null : parent;
++-                }
++-            });
++-    }
++-
++-    String getSystemProperty(final String propName) {
++-        return (String)
++-            AccessController.doPrivileged(new PrivilegedAction() {
++-                public Object run() {
++-                    return System.getProperty(propName);
++-                }
++-            });
++-    }
++-
++-    FileInputStream getFileInputStream(final File file)
++-        throws FileNotFoundException
++-    {
++-        try {
++-            return (FileInputStream)
++-                AccessController.doPrivileged(new PrivilegedExceptionAction() {
++-                    public Object run() throws FileNotFoundException {
++-                        return new FileInputStream(file);
++-                    }
++-                });
++-        } catch (PrivilegedActionException e) {
++-            throw (FileNotFoundException)e.getException();
++-        }
++-    }
++-
++-    InputStream getResourceAsStream(final ClassLoader cl,
++-                                           final String name)
++-    {
++-        return (InputStream)
++-            AccessController.doPrivileged(new PrivilegedAction() {
++-                public Object run() {
++-                    InputStream ris;
++-                    if (cl == null) {
++-                        ris = ClassLoader.getSystemResourceAsStream(name);
++-                    } else {
++-                        ris = cl.getResourceAsStream(name);
++-                    }
++-                    return ris;
++-                }
++-            });
++-    }
++-
++-    boolean getFileExists(final File f) {
++-    return ((Boolean)
++-            AccessController.doPrivileged(new PrivilegedAction() {
++-                public Object run() {
++-                    return new Boolean(f.exists());
++-                }
++-            })).booleanValue();
++-    }
++-
++-    long getLastModified(final File f) {
++-    return ((Long)
++-            AccessController.doPrivileged(new PrivilegedAction() {
++-                public Object run() {
++-                    return new Long(f.lastModified());
++-                }
++-            })).longValue();
++-    }
++-
++-}
++--- src/com/sun/org/apache/xml/internal/serializer/SecuritySupport.java	2013-04-16 14:28:09.688155906 +0100
+++++ src/com/sun/org/apache/xml/internal/serializer/SecuritySupport.java	1970-01-01 01:00:00.000000000 +0100
++@@ -1,125 +0,0 @@
++-/*
++- * reserved comment block
++- * DO NOT REMOVE OR ALTER!
++- */
++-/*
++- * Copyright 2002-2004 The Apache Software Foundation.
++- *
++- * Licensed under the Apache License, Version 2.0 (the "License");
++- * you may not use this file except in compliance with the License.
++- * You may obtain a copy of the License at
++- *
++- *     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: SecuritySupport.java,v 1.2.4.1 2005/09/15 08:15:21 suresh_emailid Exp $
++- */
++-
++-package com.sun.org.apache.xml.internal.serializer;
++-
++-import java.io.File;
++-import java.io.FileInputStream;
++-import java.io.FileNotFoundException;
++-import java.io.InputStream;
++-
++-/**
++- * This class is duplicated for each Xalan-Java subpackage so keep it in sync.
++- * It is package private and therefore is not exposed as part of the Xalan-Java
++- * API.
++- *
++- * Base class with security related methods that work on JDK 1.1.
++- */
++-class SecuritySupport {
++-
++-    /*
++-     * Make this of type Object so that the verifier won't try to
++-     * prove its type, thus possibly trying to load the SecuritySupport12
++-     * class.
++-     */
++-    private static final Object securitySupport;
++-
++-    static {
++-        SecuritySupport ss = null;
++-        try {
++-            Class c = Class.forName("java.security.AccessController");
++-            // if that worked, we're on 1.2.
++-            /*
++-            // don't reference the class explicitly so it doesn't
++-            // get dragged in accidentally.
++-            c = Class.forName("javax.mail.SecuritySupport12");
++-            Constructor cons = c.getConstructor(new Class[] { });
++-            ss = (SecuritySupport)cons.newInstance(new Object[] { });
++-            */
++-            /*
++-             * Unfortunately, we can't load the class using reflection
++-             * because the class is package private.  And the class has
++-             * to be package private so the APIs aren't exposed to other
++-             * code that could use them to circumvent security.  Thus,
++-             * we accept the risk that the direct reference might fail
++-             * on some JDK 1.1 JVMs, even though we would never execute
++-             * this code in such a case.  Sigh...
++-             */
++-            ss = new SecuritySupport12();
++-        } catch (Exception ex) {
++-            // ignore it
++-        } finally {
++-            if (ss == null)
++-                ss = new SecuritySupport();
++-            securitySupport = ss;
++-        }
++-    }
++-
++-    /**
++-     * Return an appropriate instance of this class, depending on whether
++-     * we're on a JDK 1.1 or J2SE 1.2 (or later) system.
++-     */
++-    static SecuritySupport getInstance() {
++-        return (SecuritySupport)securitySupport;
++-    }
++-
++-    ClassLoader getContextClassLoader() {
++-        return null;
++-    }
++-
++-    ClassLoader getSystemClassLoader() {
++-        return null;
++-    }
++-
++-    ClassLoader getParentClassLoader(ClassLoader cl) {
++-        return null;
++-    }
++-
++-    String getSystemProperty(String propName) {
++-        return System.getProperty(propName);
++-    }
++-
++-    FileInputStream getFileInputStream(File file)
++-        throws FileNotFoundException
++-    {
++-        return new FileInputStream(file);
++-    }
++-
++-    InputStream getResourceAsStream(ClassLoader cl, String name) {
++-        InputStream ris;
++-        if (cl == null) {
++-            ris = ClassLoader.getSystemResourceAsStream(name);
++-        } else {
++-            ris = cl.getResourceAsStream(name);
++-        }
++-        return ris;
++-    }
++-
++-    boolean getFileExists(File f) {
++-        return f.exists();
++-    }
++-
++-    long getLastModified(File f) {
++-        return f.lastModified();
++-    }
++-}
++--- src/com/sun/org/apache/xml/internal/serializer/ToStream.java	2013-04-16 14:28:09.700156100 +0100
+++++ src/com/sun/org/apache/xml/internal/serializer/ToStream.java	2013-04-16 14:29:26.565394640 +0100
++@@ -22,6 +22,7 @@
++  */
++ package com.sun.org.apache.xml.internal.serializer;
++ 
+++import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
++ import java.io.IOException;
++ import java.io.OutputStream;
++ import java.io.UnsupportedEncodingException;
++@@ -140,7 +141,7 @@
++      * extension attribute xalan:line-separator.
++      */
++     protected char[] m_lineSep =
++-        System.getProperty("line.separator").toCharArray();
+++        SecuritySupport.getSystemProperty("line.separator").toCharArray();
++ 
++     /**
++      * True if the the system line separator is to be used.
++--- src/com/sun/org/apache/xml/internal/serializer/TreeWalker.java	2013-04-16 14:28:09.704156164 +0100
+++++ src/com/sun/org/apache/xml/internal/serializer/TreeWalker.java	2013-04-16 14:29:26.565394640 +0100
++@@ -22,6 +22,7 @@
++  */
++ package com.sun.org.apache.xml.internal.serializer;
++ 
+++import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
++ import java.io.File;
++ 
++ import com.sun.org.apache.xml.internal.serializer.utils.AttList;
++@@ -104,7 +105,7 @@
++       else {
++           try {
++             // Bug see Bugzilla  26741
++-            m_locator.setSystemId(System.getProperty("user.dir") + File.separator + "dummy.xsl");
+++            m_locator.setSystemId(SecuritySupport.getSystemProperty("user.dir") + File.separator + "dummy.xsl");
++            }
++            catch (SecurityException se) {// user.dir not accessible from applet
++            }
++@@ -115,7 +116,7 @@
++                         m_contentHandler.setDocumentLocator(m_locator);
++                 try {
++                    // Bug see Bugzilla  26741
++-                  m_locator.setSystemId(System.getProperty("user.dir") + File.separator + "dummy.xsl");
+++                  m_locator.setSystemId(SecuritySupport.getSystemProperty("user.dir") + File.separator + "dummy.xsl");
++                 }
++                 catch (SecurityException se){// user.dir not accessible from applet
++ 
++--- src/com/sun/org/apache/xml/internal/serializer/utils/Messages.java	2013-04-16 14:28:09.708156229 +0100
+++++ src/com/sun/org/apache/xml/internal/serializer/utils/Messages.java	2013-04-16 14:29:26.565394640 +0100
++@@ -22,6 +22,7 @@
++  */
++ package com.sun.org.apache.xml.internal.serializer.utils;
++ 
+++import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
++ import java.util.ListResourceBundle;
++ import java.util.Locale;
++ import java.util.MissingResourceException;
++@@ -87,9 +88,6 @@
++  * can have the Message strings translated in an alternate language
++  * in a errorResourceClass with a language suffix.
++  *
++- * More sophisticated use of this class would be to pass null
++- * when contructing it, but then call loadResourceBundle()
++- * before creating any messages.
++  *
++  * This class is not a public API, it is only public because it is
++  * used in com.sun.org.apache.xml.internal.serializer.
++@@ -126,18 +124,6 @@
++         m_resourceBundleName = resourceBundle;
++     }
++ 
++-    /*
++-     * Set the Locale object to use. If this method is not called the
++-     * default locale is used. This method needs to be called before
++-     * loadResourceBundle().
++-     *
++-     * @param locale non-null reference to Locale object.
++-     * @xsl.usage internal
++-     */
++-//    public void setLocale(Locale locale)
++-//    {
++-//        m_locale = locale;
++-//    }
++ 
++     /**
++      * Get the Locale object that is being used.
++@@ -151,16 +137,6 @@
++     }
++ 
++     /**
++-     * Get the ListResourceBundle being used by this Messages instance which was
++-     * previously set by a call to loadResourceBundle(className)
++-     * @xsl.usage internal
++-     */
++-    private ListResourceBundle getResourceBundle()
++-    {
++-        return m_resourceBundle;
++-    }
++-
++-    /**
++      * Creates a message from the specified key and replacement
++      * arguments, localized to the given locale.
++      *
++@@ -174,7 +150,7 @@
++     public final String createMessage(String msgKey, Object args[])
++     {
++         if (m_resourceBundle == null)
++-            m_resourceBundle = loadResourceBundle(m_resourceBundleName);
+++            m_resourceBundle = SecuritySupport.getResourceBundle(m_resourceBundleName);
++ 
++         if (m_resourceBundle != null)
++         {
++@@ -293,76 +269,4 @@
++         return fmsg;
++     }
++ 
++-    /**
++-     * Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-     * of ResourceBundle.getBundle().
++-     *
++-     * @param className the name of the class that implements ListResourceBundle,
++-     * without language suffix.
++-     * @return the ResourceBundle
++-     * @throws MissingResourceException
++-     * @xsl.usage internal
++-     */
++-    private ListResourceBundle loadResourceBundle(String resourceBundle)
++-        throws MissingResourceException
++-    {
++-        m_resourceBundleName = resourceBundle;
++-        Locale locale = getLocale();
++-
++-        ListResourceBundle lrb;
++-
++-        try
++-        {
++-
++-            ResourceBundle rb =
++-                ResourceBundle.getBundle(m_resourceBundleName, locale);
++-            lrb = (ListResourceBundle) rb;
++-        }
++-        catch (MissingResourceException e)
++-        {
++-            try // try to fall back to en_US if we can't load
++-                {
++-
++-                // Since we can't find the localized property file,
++-                // fall back to en_US.
++-                lrb =
++-                    (ListResourceBundle) ResourceBundle.getBundle(
++-                        m_resourceBundleName,
++-                        new Locale("en", "US"));
++-            }
++-            catch (MissingResourceException e2)
++-            {
++-
++-                // Now we are really in trouble.
++-                // very bad, definitely very bad...not going to get very far
++-                throw new MissingResourceException(
++-                    "Could not load any resource bundles." + m_resourceBundleName,
++-                    m_resourceBundleName,
++-                    "");
++-            }
++-        }
++-        m_resourceBundle = lrb;
++-        return lrb;
++-    }
++-
++-    /**
++-     * Return the resource file suffic for the indicated locale
++-     * For most locales, this will be based the language code.  However
++-     * for Chinese, we do distinguish between Taiwan and PRC
++-     *
++-     * @param locale the locale
++-     * @return an String suffix which can be appended to a resource name
++-     * @xsl.usage internal
++-     */
++-    private static String getResourceSuffix(Locale locale)
++-    {
++-
++-        String suffix = "_" + locale.getLanguage();
++-        String country = locale.getCountry();
++-
++-        if (country.equals("TW"))
++-            suffix += "_" + country;
++-
++-        return suffix;
++-    }
++ }
++--- src/com/sun/org/apache/xml/internal/utils/res/XResourceBundle.java	2013-04-16 14:28:09.728156552 +0100
+++++ src/com/sun/org/apache/xml/internal/utils/res/XResourceBundle.java	2013-04-16 14:29:26.565394640 +0100
++@@ -22,6 +22,8 @@
++  */
++ package com.sun.org.apache.xml.internal.utils.res;
++ 
+++import java.security.AccessController;
+++import java.security.PrivilegedAction;
++ import java.util.ListResourceBundle;
++ import java.util.Locale;
++ import java.util.MissingResourceException;
++@@ -29,114 +31,45 @@
++ 
++ /**
++  * The default (english) resource bundle.
+++ *
++  * @xsl.usage internal
++  */
++-public class XResourceBundle extends ListResourceBundle
++-{
+++public class XResourceBundle extends ListResourceBundle {
++ 
++-  /** Error resource constants */
++-  public static final String ERROR_RESOURCES =
++-    "com.sun.org.apache.xalan.internal.res.XSLTErrorResources", XSLT_RESOURCE =
++-    "com.sun.org.apache.xml.internal.utils.res.XResourceBundle", LANG_BUNDLE_NAME =
++-    "com.sun.org.apache.xml.internal.utils.res.XResources", MULT_ORDER =
++-    "multiplierOrder", MULT_PRECEDES = "precedes", MULT_FOLLOWS =
++-    "follows", LANG_ORIENTATION = "orientation", LANG_RIGHTTOLEFT =
++-    "rightToLeft", LANG_LEFTTORIGHT = "leftToRight", LANG_NUMBERING =
++-    "numbering", LANG_ADDITIVE = "additive", LANG_MULT_ADD =
++-    "multiplicative-additive", LANG_MULTIPLIER =
++-    "multiplier", LANG_MULTIPLIER_CHAR =
++-    "multiplierChar", LANG_NUMBERGROUPS = "numberGroups", LANG_NUM_TABLES =
++-    "tables", LANG_ALPHABET = "alphabet", LANG_TRAD_ALPHABET = "tradAlphabet";
++-
++-  /**
++-   * Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   * of ResourceBundle.getBundle().
++-   *
++-   * @param className Name of local-specific subclass.
++-   * @param locale the locale to prefer when searching for the bundle
++-   */
++-  public static final XResourceBundle loadResourceBundle(
++-          String className, Locale locale) throws MissingResourceException
++-  {
++-
++-    String suffix = getResourceSuffix(locale);
++-
++-    //System.out.println("resource " + className + suffix);
++-    try
++-    {
++-
++-      // first try with the given locale
++-      String resourceName = className + suffix;
++-      return (XResourceBundle) ResourceBundle.getBundle(resourceName, locale);
+++    /**
+++     * Error resource constants
+++     */
+++    public static final String ERROR_RESOURCES =
+++            "com.sun.org.apache.xalan.internal.res.XSLTErrorResources", XSLT_RESOURCE =
+++            "com.sun.org.apache.xml.internal.utils.res.XResourceBundle", LANG_BUNDLE_NAME =
+++            "com.sun.org.apache.xml.internal.utils.res.XResources", MULT_ORDER =
+++            "multiplierOrder", MULT_PRECEDES = "precedes", MULT_FOLLOWS =
+++            "follows", LANG_ORIENTATION = "orientation", LANG_RIGHTTOLEFT =
+++            "rightToLeft", LANG_LEFTTORIGHT = "leftToRight", LANG_NUMBERING =
+++            "numbering", LANG_ADDITIVE = "additive", LANG_MULT_ADD =
+++            "multiplicative-additive", LANG_MULTIPLIER =
+++            "multiplier", LANG_MULTIPLIER_CHAR =
+++            "multiplierChar", LANG_NUMBERGROUPS = "numberGroups", LANG_NUM_TABLES =
+++            "tables", LANG_ALPHABET = "alphabet", LANG_TRAD_ALPHABET = "tradAlphabet";
+++
+++
+++    /**
+++     * Get the association list.
+++     *
+++     * @return The association list.
+++     */
+++    public Object[][] getContents() {
+++        return new Object[][]{
+++                    {"ui_language", "en"}, {"help_language", "en"}, {"language", "en"},
+++                    {"alphabet", new CharArrayWrapper(new char[]{'A', 'B', 'C', 'D', 'E', 'F', 'G',
+++                            'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U',
+++                            'V', 'W', 'X', 'Y', 'Z'})},
+++                    {"tradAlphabet", new CharArrayWrapper(new char[]{'A', 'B', 'C', 'D', 'E', 'F',
+++                            'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
+++                            'U', 'V', 'W', 'X', 'Y', 'Z'})},
+++                    //language orientation
+++                    {"orientation", "LeftToRight"},
+++                    //language numbering
+++                    {"numbering", "additive"},};
++     }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XResourceBundle) ResourceBundle.getBundle(
++-          XSLT_RESOURCE, new Locale("en", "US"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "Could not load any resource bundles.", className, "");
++-      }
++-    }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String lang = locale.getLanguage();
++-    String country = locale.getCountry();
++-    String variant = locale.getVariant();
++-    String suffix = "_" + locale.getLanguage();
++-
++-    if (lang.equals("zh"))
++-      suffix += "_" + country;
++-
++-    if (country.equals("JP"))
++-      suffix += "_" + country + "_" + variant;
++-
++-    return suffix;
++-  }
++-
++-  /**
++-   * Get the association list.
++-   *
++-   * @return The association list.
++-   */
++-  public Object[][] getContents()
++-  {
++-    return new Object[][]
++-  {
++-    { "ui_language", "en" }, { "help_language", "en" }, { "language", "en" },
++-    { "alphabet", new CharArrayWrapper(new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G',
++-         'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U',
++-         'V', 'W', 'X', 'Y', 'Z' })},
++-    { "tradAlphabet", new CharArrayWrapper(new char[]{ 'A', 'B', 'C', 'D', 'E', 'F',
++-         'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
++-         'U', 'V', 'W', 'X', 'Y', 'Z' }) },
++-
++-    //language orientation
++-    { "orientation", "LeftToRight" },
++-
++-    //language numbering
++-    { "numbering", "additive" },
++-  };
++-  }
++ }
++--- src/com/sun/org/apache/xml/internal/utils/TreeWalker.java	2013-04-16 14:28:09.720156422 +0100
+++++ src/com/sun/org/apache/xml/internal/utils/TreeWalker.java	2013-04-16 14:29:26.565394640 +0100
++@@ -22,6 +22,7 @@
++  */
++ package com.sun.org.apache.xml.internal.utils;
++ 
+++import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
++ import java.io.File;
++ 
++ import org.w3c.dom.Comment;
++@@ -93,7 +94,7 @@
++     else {
++         try {
++           // Bug see Bugzilla  26741
++-          m_locator.setSystemId(System.getProperty("user.dir") + File.separator + "dummy.xsl");
+++          m_locator.setSystemId(SecuritySupport.getSystemProperty("user.dir") + File.separator + "dummy.xsl");
++          }
++          catch (SecurityException se) {// user.dir not accessible from applet
++          }
++@@ -112,7 +113,7 @@
++     m_contentHandler.setDocumentLocator(m_locator);
++     try {
++        // Bug see Bugzilla  26741
++-      m_locator.setSystemId(System.getProperty("user.dir") + File.separator + "dummy.xsl");
+++      m_locator.setSystemId(SecuritySupport.getSystemProperty("user.dir") + File.separator + "dummy.xsl");
++     }
++     catch (SecurityException se){// user.dir not accessible from applet
++     }
++@@ -131,7 +132,7 @@
++                         m_contentHandler.setDocumentLocator(m_locator);
++                 try {
++                    // Bug see Bugzilla  26741
++-                  m_locator.setSystemId(System.getProperty("user.dir") + File.separator + "dummy.xsl");
+++                  m_locator.setSystemId(SecuritySupport.getSystemProperty("user.dir") + File.separator + "dummy.xsl");
++                 }
++                 catch (SecurityException se){// user.dir not accessible from applet
++ 
++--- src/com/sun/org/apache/xpath/internal/functions/FuncSystemProperty.java	2013-04-16 14:28:09.752156937 +0100
+++++ src/com/sun/org/apache/xpath/internal/functions/FuncSystemProperty.java	2013-04-16 14:29:26.565394640 +0100
++@@ -31,6 +31,8 @@
++ import com.sun.org.apache.xpath.internal.objects.XObject;
++ import com.sun.org.apache.xpath.internal.objects.XString;
++ import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
+++import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
+++import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
++ 
++ /**
++  * Execute the SystemProperty() function.
++@@ -100,7 +102,7 @@
++ 
++         try
++         {
++-          result = System.getProperty(propName);
+++          result = SecuritySupport.getSystemProperty(propName);
++ 
++           if (null == result)
++           {
++@@ -122,7 +124,7 @@
++     {
++       try
++       {
++-        result = System.getProperty(fullName);
+++        result = SecuritySupport.getSystemProperty(fullName);
++ 
++         if (null == result)
++         {
++@@ -163,14 +165,12 @@
++    * should already be fully qualified as path/filename
++    * @param target The target property bag the file will be placed into.
++    */
++-  private void loadPropertyFile(String file, Properties target)
+++  public void loadPropertyFile(String file, Properties target)
++   {
++     try
++     {
++       // Use SecuritySupport class to provide priveleged access to property file
++-      SecuritySupport ss = SecuritySupport.getInstance();
++-
++-      InputStream is = ss.getResourceAsStream(ObjectFactory.findClassLoader(),
+++      InputStream is = SecuritySupport.getResourceAsStream(ObjectFactory.findClassLoader(),
++                                               file);
++ 
++       // get a buffered version
++--- src/com/sun/org/apache/xpath/internal/functions/ObjectFactory.java	2013-04-16 14:28:09.752156937 +0100
+++++ src/com/sun/org/apache/xpath/internal/functions/ObjectFactory.java	1970-01-01 01:00:00.000000000 +0100
++@@ -1,663 +0,0 @@
++-/*
++- * 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/14 20:25:54 jeffsuttor Exp $
++- */
++-
++-package com.sun.org.apache.xpath.internal.functions;
++-
++-import java.io.InputStream;
++-import java.io.IOException;
++-import java.io.File;
++-import java.io.FileInputStream;
++-
++-import java.util.Properties;
++-import java.io.BufferedReader;
++-import java.io.InputStreamReader;
++-
++-/**
++- * 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.
++- *
++- * @version $Id: ObjectFactory.java,v 1.7 2008/04/02 00:40:59 joehw Exp $
++- */
++-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;
++-
++-    //
++-    // Public static methods
++-    //
++-
++-    /**
++-     * Finds the implementation Class object in the specified order.  The
++-     * specified order is the following:
++-     * <ol>
++-     *  <li>query the system property using <code>System.getProperty</code>
++-     *  <li>read <code>META-INF/services/<i>factoryId</i></code> file
++-     *  <li>use fallback classname
++-     * </ol>
++-     *
++-     * @return instance of factory, never null
++-     *
++-     * @param factoryId             Name of the factory to find, same as
++-     *                              a property name
++-     * @param fallbackClassName     Implementation class name, if nothing else
++-     *                              is found.  Use null to mean no fallback.
++-     *
++-     * @exception ObjectFactory.ConfigurationError
++-     */
++-    static Object createObject(String factoryId, String fallbackClassName)
++-        throws ConfigurationError {
++-        return createObject(factoryId, null, fallbackClassName);
++-    } // createObject(String,String):Object
++-
++-    /**
++-     * Finds the implementation Class object in the specified order.  The
++-     * specified order is the following:
++-     * <ol>
++-     *  <li>query the system property using <code>System.getProperty</code>
++-     *  <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file
++-     *  <li>read <code>META-INF/services/<i>factoryId</i></code> file
++-     *  <li>use fallback classname
++-     * </ol>
++-     *
++-     * @return instance of factory, never null
++-     *
++-     * @param factoryId             Name of the factory to find, same as
++-     *                              a property name
++-     * @param propertiesFilename The filename in the $java.home/lib directory
++-     *                           of the properties file.  If none specified,
++-     *                           ${java.home}/lib/xalan.properties will be used.
++-     * @param fallbackClassName     Implementation class name, if nothing else
++-     *                              is found.  Use null to mean no fallback.
++-     *
++-     * @exception ObjectFactory.ConfigurationError
++-     */
++-    static Object createObject(String factoryId, 
++-                                      String propertiesFilename,
++-                                      String fallbackClassName)
++-        throws ConfigurationError
++-    {
++-        Class factoryClass = lookUpFactoryClass(factoryId,
++-                                                propertiesFilename,
++-                                                fallbackClassName);
++-
++-        if (factoryClass == null) {
++-            throw new ConfigurationError(
++-                "Provider for " + factoryId + " cannot be found", null);
++-        }
++-
++-        try{
++-            Object instance = factoryClass.newInstance();
++-            if (DEBUG) debugPrintln("created new instance of factory " + factoryId);
++-            return instance;
++-        } catch (Exception x) {
++-            throw new ConfigurationError(
++-                "Provider for factory " + factoryId
++-                    + " could not be instantiated: " + x, x);
++-        }
++-    } // createObject(String,String,String):Object
++-
++-    /**
++-     * Finds the implementation Class object in the specified order.  The
++-     * specified order is the following:
++-     * <ol>
++-     *  <li>query the system property using <code>System.getProperty</code>
++-     *  <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file
++-     *  <li>read <code>META-INF/services/<i>factoryId</i></code> file
++-     *  <li>use fallback classname
++-     * </ol>
++-     *
++-     * @return Class object of factory, never null
++-     *
++-     * @param factoryId             Name of the factory to find, same as
++-     *                              a property name
++-     * @param propertiesFilename The filename in the $java.home/lib directory
++-     *                           of the properties file.  If none specified,
++-     *                           ${java.home}/lib/xalan.properties will be used.
++-     * @param fallbackClassName     Implementation class name, if nothing else
++-     *                              is found.  Use null to mean no fallback.
++-     *
++-     * @exception ObjectFactory.ConfigurationError
++-     */
++-    static Class lookUpFactoryClass(String factoryId) 
++-        throws ConfigurationError
++-    {
++-        return lookUpFactoryClass(factoryId, null, null);
++-    } // lookUpFactoryClass(String):Class
++-
++-    /**
++-     * Finds the implementation Class object in the specified order.  The
++-     * specified order is the following:
++-     * <ol>
++-     *  <li>query the system property using <code>System.getProperty</code>
++-     *  <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file
++-     *  <li>read <code>META-INF/services/<i>factoryId</i></code> file
++-     *  <li>use fallback classname
++-     * </ol>
++-     *
++-     * @return Class object that provides factory service, never null
++-     *
++-     * @param factoryId             Name of the factory to find, same as
++-     *                              a property name
++-     * @param propertiesFilename The filename in the $java.home/lib directory
++-     *                           of the properties file.  If none specified,
++-     *                           ${java.home}/lib/xalan.properties will be used.
++-     * @param fallbackClassName     Implementation class name, if nothing else
++-     *                              is found.  Use null to mean no fallback.
++-     *
++-     * @exception ObjectFactory.ConfigurationError
++-     */
++-    static Class lookUpFactoryClass(String factoryId,
++-                                           String propertiesFilename,
++-                                           String fallbackClassName)
++-        throws ConfigurationError
++-    {
++-        String factoryClassName = lookUpFactoryClassName(factoryId,
++-                                                         propertiesFilename,
++-                                                         fallbackClassName);
++-        ClassLoader cl = findClassLoader();
++-
++-        if (factoryClassName == null) {
++-            factoryClassName = fallbackClassName;
++-        }
++-
++-        // assert(className != null);
++-        try{
++-            Class providerClass = findProviderClass(factoryClassName,
++-                                                    cl,
++-                                                    true);
++-            if (DEBUG) debugPrintln("created new instance of " + providerClass +
++-                   " using ClassLoader: " + cl);
++-            return providerClass;
++-        } catch (ClassNotFoundException x) {
++-            throw new ConfigurationError(
++-                "Provider " + factoryClassName + " not found", x);
++-        } catch (Exception x) {
++-            throw new ConfigurationError(
++-                "Provider "+factoryClassName+" could not be instantiated: "+x,
++-                x);
++-        }
++-    } // lookUpFactoryClass(String,String,String):Class
++-
++-    /**
++-     * Finds the name of the required implementation class in the specified
++-     * order.  The specified order is the following:
++-     * <ol>
++-     *  <li>query the system property using <code>System.getProperty</code>
++-     *  <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file
++-     *  <li>read <code>META-INF/services/<i>factoryId</i></code> file
++-     *  <li>use fallback classname
++-     * </ol>
++-     *
++-     * @return name of class that provides factory service, never null
++-     *
++-     * @param factoryId             Name of the factory to find, same as
++-     *                              a property name
++-     * @param propertiesFilename The filename in the $java.home/lib directory
++-     *                           of the properties file.  If none specified,
++-     *                           ${java.home}/lib/xalan.properties will be used.
++-     * @param fallbackClassName     Implementation class name, if nothing else
++-     *                              is found.  Use null to mean no fallback.
++-     *
++-     * @exception ObjectFactory.ConfigurationError
++-     */
++-    static String lookUpFactoryClassName(String factoryId,
++-                                                String propertiesFilename,
++-                                                String fallbackClassName)
++-    {
++-        SecuritySupport ss = SecuritySupport.getInstance();
++-
++-        // Use the system property first
++-        try {
++-            String systemProp = ss.getSystemProperty(factoryId);
++-            if (systemProp != null) {
++-                if (DEBUG) debugPrintln("found system property, value=" + systemProp);
++-                return systemProp;
++-            }
++-        } catch (SecurityException se) {
++-            // Ignore and continue w/ next location
++-        }
++-
++-        // Try to read from propertiesFilename, or
++-        // $java.home/lib/xalan.properties
++-        String factoryClassName = null;
++-        // no properties file name specified; use
++-        // $JAVA_HOME/lib/xalan.properties:
++-        if (propertiesFilename == null) {
++-            File propertiesFile = null;
++-            boolean propertiesFileExists = false;
++-            try {
++-                String javah = ss.getSystemProperty("java.home");
++-                propertiesFilename = javah + File.separator +
++-                    "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME;
++-                propertiesFile = new File(propertiesFilename);
++-                propertiesFileExists = ss.getFileExists(propertiesFile);
++-            } catch (SecurityException e) {
++-                // try again...
++-                fLastModified = -1;
++-                fXalanProperties = null;
++-            }
++-
++-            synchronized (ObjectFactory.class) {
++-                boolean loadProperties = false;
++-                FileInputStream fis = null;
++-                try {
++-                    // file existed last time
++-                    if(fLastModified >= 0) {
++-                        if(propertiesFileExists &&
++-                                (fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) {
++-                            loadProperties = true;
++-                        } else {
++-                            // file has stopped existing...
++-                            if(!propertiesFileExists) {
++-                                fLastModified = -1;
++-                                fXalanProperties = null;
++-                            } // else, file wasn't modified!
++-                        }
++-                    } else {
++-                        // file has started to exist:
++-                        if(propertiesFileExists) {
++-                            loadProperties = true;
++-                            fLastModified = ss.getLastModified(propertiesFile);
++-                        } // else, nothing's changed
++-                    }
++-                    if(loadProperties) {
++-                        // must never have attempted to read xalan.properties
++-                        // before (or it's outdeated)
++-                        fXalanProperties = new Properties();
++-                        fis = ss.getFileInputStream(propertiesFile);
++-                        fXalanProperties.load(fis);
++-                    }
++-	        } catch (Exception x) {
++-	            fXalanProperties = null;
++-	            fLastModified = -1;
++-                    // assert(x instanceof FileNotFoundException
++-	            //        || x instanceof SecurityException)
++-	            // In both cases, ignore and continue w/ next location
++-	        }
++-                finally {
++-                    // try to close the input stream if one was opened.
++-                    if (fis != null) {
++-                        try {
++-                            fis.close();
++-                        }
++-                        // Ignore the exception.
++-                        catch (IOException exc) {}
++-                    }
++-                }	            
++-            }
++-            if(fXalanProperties != null) {
++-                factoryClassName = fXalanProperties.getProperty(factoryId);
++-            }
++-        } else {
++-            FileInputStream fis = null;
++-            try {
++-                fis = ss.getFileInputStream(new File(propertiesFilename));
++-                Properties props = new Properties();
++-                props.load(fis);
++-                factoryClassName = props.getProperty(factoryId);
++-            } catch (Exception x) {
++-                // assert(x instanceof FileNotFoundException
++-                //        || x instanceof SecurityException)
++-                // In both cases, ignore and continue w/ next location
++-            }
++-            finally {
++-                // try to close the input stream if one was opened.
++-                if (fis != null) {
++-                    try {
++-                        fis.close();
++-                    }
++-                    // Ignore the exception.
++-                    catch (IOException exc) {}
++-                }
++-            }               
++-        }
++-        if (factoryClassName != null) {
++-            if (DEBUG) debugPrintln("found in " + propertiesFilename + ", value="
++-                          + factoryClassName);
++-            return factoryClassName;
++-        }
++-
++-        // Try Jar Service Provider Mechanism
++-        return findJarServiceProviderName(factoryId);
++-    } // lookUpFactoryClass(String,String):String
++-
++-    //
++-    // Private static methods
++-    //
++-
++-    /** Prints a message to standard error if debugging is enabled. */
++-    private static void debugPrintln(String msg) {
++-        if (DEBUG) {
++-            System.err.println("JAXP: " + msg);
++-        }
++-    } // debugPrintln(String)
++-
++-    /**
++-     * Figure out which ClassLoader to use.  For JDK 1.2 and later use
++-     * the context ClassLoader.
++-     */
++-    static ClassLoader findClassLoader()
++-        throws ConfigurationError
++-    { 
++-        SecuritySupport ss = SecuritySupport.getInstance();
++-
++-        // Figure out which ClassLoader to use for loading the provider
++-        // class.  If there is a Context ClassLoader then use it.
++-        ClassLoader context = ss.getContextClassLoader();
++-        ClassLoader system = ss.getSystemClassLoader();
++-
++-        ClassLoader chain = system;
++-        while (true) {
++-            if (context == chain) {
++-                // Assert: we are on JDK 1.1 or we have no Context ClassLoader
++-                // or any Context ClassLoader in chain of system classloader
++-                // (including extension ClassLoader) so extend to widest
++-                // ClassLoader (always look in system ClassLoader if Xalan
++-                // is in boot/extension/system classpath and in current
++-                // ClassLoader otherwise); normal classloaders delegate
++-                // back to system ClassLoader first so this widening doesn't
++-                // change the fact that context ClassLoader will be consulted
++-                ClassLoader current = ObjectFactory.class.getClassLoader();
++-
++-                chain = system;
++-                while (true) {
++-                    if (current == chain) {
++-                        // Assert: Current ClassLoader in chain of
++-                        // boot/extension/system ClassLoaders
++-                        return system;
++-                    }
++-                    if (chain == null) {
++-                        break;
++-                    }
++-                    chain = ss.getParentClassLoader(chain);
++-                }
++-
++-                // Assert: Current ClassLoader not in chain of
++-                // boot/extension/system ClassLoaders
++-                return current;
++-            }
++-
++-            if (chain == null) {
++-                // boot ClassLoader reached
++-                break;
++-            }
++-
++-            // Check for any extension ClassLoaders in chain up to
++-            // boot ClassLoader
++-            chain = ss.getParentClassLoader(chain);
++-        };
++-
++-        // Assert: Context ClassLoader not in chain of
++-        // boot/extension/system ClassLoaders
++-        return context;
++-    } // findClassLoader():ClassLoader
++-
++-    /**
++-     * 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();
++-            if (DEBUG) debugPrintln("created new instance of " + providerClass +
++-                   " using ClassLoader: " + cl);
++-            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;
++-    }
++-
++-    /**
++-     * Find the name of service provider using Jar Service Provider Mechanism
++-     *
++-     * @return instance of provider class if found or null
++-     */
++-    private static String findJarServiceProviderName(String factoryId)
++-    {
++-        SecuritySupport ss = SecuritySupport.getInstance();
++-        String serviceId = SERVICES_PATH + factoryId;
++-        InputStream is = null;
++-
++-        // First try the Context ClassLoader
++-        ClassLoader cl = findClassLoader();
++-
++-        is = ss.getResourceAsStream(cl, serviceId);
++-
++-        // If no provider found then try the current ClassLoader
++-        if (is == null) {
++-            ClassLoader current = ObjectFactory.class.getClassLoader();
++-            if (cl != current) {
++-                cl = current;
++-                is = ss.getResourceAsStream(cl, serviceId);
++-            }
++-        }
++-
++-        if (is == null) {
++-            // No provider found
++-            return null;
++-        }
++-
++-        if (DEBUG) debugPrintln("found jar resource=" + serviceId +
++-               " using ClassLoader: " + cl);
++-
++-        // Read the service provider name in UTF-8 as specified in
++-        // the jar spec.  Unfortunately this fails in Microsoft
++-        // VJ++, which does not implement the UTF-8
++-        // encoding. Theoretically, we should simply let it fail in
++-        // that case, since the JVM is obviously broken if it
++-        // doesn't support such a basic standard.  But since there
++-        // are still some users attempting to use VJ++ for
++-        // development, we have dropped in a fallback which makes a
++-        // second attempt using the platform's default encoding. In
++-        // VJ++ this is apparently ASCII, which is a subset of
++-        // UTF-8... and since the strings we'll be reading here are
++-        // also primarily limited to the 7-bit ASCII range (at
++-        // least, in English versions), this should work well
++-        // enough to keep us on the air until we're ready to
++-        // officially decommit from VJ++. [Edited comment from
++-        // jkesselm]
++-        BufferedReader rd;
++-        try {
++-            rd = new BufferedReader(new InputStreamReader(is, "UTF-8"));
++-        } catch (java.io.UnsupportedEncodingException e) {
++-            rd = new BufferedReader(new InputStreamReader(is));
++-        }
++-        
++-        String factoryClassName = null;
++-        try {
++-            // XXX Does not handle all possible input as specified by the
++-            // Jar Service Provider specification
++-            factoryClassName = rd.readLine();
++-        } catch (IOException x) {
++-            // No provider found
++-            return null;
++-        }
++-        finally {
++-            try {
++-                // try to close the reader.
++-                rd.close();
++-            }
++-            // Ignore the exception.
++-            catch (IOException exc) {}
++-        }          
++-
++-        if (factoryClassName != null &&
++-            ! "".equals(factoryClassName)) {
++-            if (DEBUG) debugPrintln("found in resource, value="
++-                   + factoryClassName);
++-
++-            // Note: here we do not want to fall back to the current
++-            // 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 factoryClassName;
++-        }
++-
++-        // No provider found
++-        return null;
++-    }
++-
++-    //
++-    // Classes
++-    //
++-
++-    /**
++-     * A configuration error.
++-     */
++-    static class ConfigurationError 
++-        extends Error {
++-                static final long serialVersionUID = -5782303800588797207L;
++-        //
++-        // 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/xpath/internal/functions/SecuritySupport12.java	2013-04-16 14:28:09.752156937 +0100
+++++ src/com/sun/org/apache/xpath/internal/functions/SecuritySupport12.java	1970-01-01 01:00:00.000000000 +0100
++@@ -1,148 +0,0 @@
++-/*
++- * reserved comment block
++- * DO NOT REMOVE OR ALTER!
++- */
++-/*
++- * Copyright 2002-2004 The Apache Software Foundation.
++- *
++- * Licensed under the Apache License, Version 2.0 (the "License");
++- * you may not use this file except in compliance with the License.
++- * You may obtain a copy of the License at
++- *
++- *     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: SecuritySupport12.java,v 1.1.2.1 2005/08/01 01:29:45 jeffsuttor Exp $
++- */
++-
++-package com.sun.org.apache.xpath.internal.functions;
++-
++-import java.io.File;
++-import java.io.FileInputStream;
++-import java.io.FileNotFoundException;
++-import java.io.InputStream;
++-
++-import java.security.AccessController;
++-import java.security.PrivilegedAction;
++-import java.security.PrivilegedActionException;
++-import java.security.PrivilegedExceptionAction;
++-
++-import java.util.Properties;
++-
++-/**
++- * This class is duplicated for each Xalan-Java subpackage so keep it in sync.
++- * It is package private and therefore is not exposed as part of the Xalan-Java
++- * API.
++- *
++- * Security related methods that only work on J2SE 1.2 and newer.
++- */
++-class SecuritySupport12 extends SecuritySupport {
++-
++-    ClassLoader getContextClassLoader() {
++-        return (ClassLoader)
++-                AccessController.doPrivileged(new PrivilegedAction() {
++-            public Object run() {
++-                ClassLoader cl = null;
++-                try {
++-                    cl = Thread.currentThread().getContextClassLoader();
++-                } catch (SecurityException ex) { }
++-                return cl;
++-            }
++-        });
++-    }
++-
++-    ClassLoader getSystemClassLoader() {
++-        return (ClassLoader)
++-            AccessController.doPrivileged(new PrivilegedAction() {
++-                public Object run() {
++-                    ClassLoader cl = null;
++-                    try {
++-                        cl = ClassLoader.getSystemClassLoader();
++-                    } catch (SecurityException ex) {}
++-                    return cl;
++-                }
++-            });
++-    }
++-
++-    ClassLoader getParentClassLoader(final ClassLoader cl) {
++-        return (ClassLoader)
++-            AccessController.doPrivileged(new PrivilegedAction() {
++-                public Object run() {
++-                    ClassLoader parent = null;
++-                    try {
++-                        parent = cl.getParent();
++-                    } catch (SecurityException ex) {}
++-
++-                    // eliminate loops in case of the boot
++-                    // ClassLoader returning itself as a parent
++-                    return (parent == cl) ? null : parent;
++-                }
++-            });
++-    }
++-
++-    String getSystemProperty(final String propName) {
++-        return (String)
++-            AccessController.doPrivileged(new PrivilegedAction() {
++-                public Object run() {
++-                    return System.getProperty(propName);
++-                }
++-            });
++-    }
++-
++-    FileInputStream getFileInputStream(final File file)
++-        throws FileNotFoundException
++-    {
++-        try {
++-            return (FileInputStream)
++-                AccessController.doPrivileged(new PrivilegedExceptionAction() {
++-                    public Object run() throws FileNotFoundException {
++-                        return new FileInputStream(file);
++-                    }
++-                });
++-        } catch (PrivilegedActionException e) {
++-            throw (FileNotFoundException)e.getException();
++-        }
++-    }
++-
++-    InputStream getResourceAsStream(final ClassLoader cl,
++-                                           final String name)
++-    {
++-        return (InputStream)
++-            AccessController.doPrivileged(new PrivilegedAction() {
++-                public Object run() {
++-                    InputStream ris;
++-                    if (cl == null) {
++-                        ris = ClassLoader.getSystemResourceAsStream(name);
++-                    } else {
++-                        ris = cl.getResourceAsStream(name);
++-                    }
++-                    return ris;
++-                }
++-            });
++-    }
++-
++-    boolean getFileExists(final File f) {
++-    return ((Boolean)
++-            AccessController.doPrivileged(new PrivilegedAction() {
++-                public Object run() {
++-                    return new Boolean(f.exists());
++-                }
++-            })).booleanValue();
++-    }
++-
++-    long getLastModified(final File f) {
++-    return ((Long)
++-            AccessController.doPrivileged(new PrivilegedAction() {
++-                public Object run() {
++-                    return new Long(f.lastModified());
++-                }
++-            })).longValue();
++-    }
++-
++-}
++--- src/com/sun/org/apache/xpath/internal/functions/SecuritySupport.java	2013-04-16 14:28:09.752156937 +0100
+++++ src/com/sun/org/apache/xpath/internal/functions/SecuritySupport.java	1970-01-01 01:00:00.000000000 +0100
++@@ -1,127 +0,0 @@
++-/*
++- * reserved comment block
++- * DO NOT REMOVE OR ALTER!
++- */
++-/*
++- * Copyright 2002-2004 The Apache Software Foundation.
++- *
++- * Licensed under the Apache License, Version 2.0 (the "License");
++- * you may not use this file except in compliance with the License.
++- * You may obtain a copy of the License at
++- *
++- *     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: SecuritySupport.java,v 1.1.2.1 2005/08/01 01:29:39 jeffsuttor Exp $
++- */
++-
++-package com.sun.org.apache.xpath.internal.functions;
++-
++-import java.io.File;
++-import java.io.FileInputStream;
++-import java.io.FileNotFoundException;
++-import java.io.InputStream;
++-
++-import java.util.Properties;
++-
++-/**
++- * This class is duplicated for each Xalan-Java subpackage so keep it in sync.
++- * It is package private and therefore is not exposed as part of the Xalan-Java
++- * API.
++- *
++- * Base class with security related methods that work on JDK 1.1.
++- */
++-class SecuritySupport {
++-
++-    /*
++-     * Make this of type Object so that the verifier won't try to
++-     * prove its type, thus possibly trying to load the SecuritySupport12
++-     * class.
++-     */
++-    private static final Object securitySupport;
++-
++-    static {
++-        SecuritySupport ss = null;
++-        try {
++-            Class c = Class.forName("java.security.AccessController");
++-            // if that worked, we're on 1.2.
++-            /*
++-            // don't reference the class explicitly so it doesn't
++-            // get dragged in accidentally.
++-            c = Class.forName("javax.mail.SecuritySupport12");
++-            Constructor cons = c.getConstructor(new Class[] { });
++-            ss = (SecuritySupport)cons.newInstance(new Object[] { });
++-            */
++-            /*
++-             * Unfortunately, we can't load the class using reflection
++-             * because the class is package private.  And the class has
++-             * to be package private so the APIs aren't exposed to other
++-             * code that could use them to circumvent security.  Thus,
++-             * we accept the risk that the direct reference might fail
++-             * on some JDK 1.1 JVMs, even though we would never execute
++-             * this code in such a case.  Sigh...
++-             */
++-            ss = new SecuritySupport12();
++-        } catch (Exception ex) {
++-            // ignore it
++-        } finally {
++-            if (ss == null)
++-                ss = new SecuritySupport();
++-            securitySupport = ss;
++-        }
++-    }
++-
++-    /**
++-     * Return an appropriate instance of this class, depending on whether
++-     * we're on a JDK 1.1 or J2SE 1.2 (or later) system.
++-     */
++-    static SecuritySupport getInstance() {
++-        return (SecuritySupport)securitySupport;
++-    }
++-
++-    ClassLoader getContextClassLoader() {
++-        return null;
++-    }
++-
++-    ClassLoader getSystemClassLoader() {
++-        return null;
++-    }
++-
++-    ClassLoader getParentClassLoader(ClassLoader cl) {
++-        return null;
++-    }
++-
++-    String getSystemProperty(String propName) {
++-        return System.getProperty(propName);
++-    }
++-
++-    FileInputStream getFileInputStream(File file)
++-        throws FileNotFoundException
++-    {
++-        return new FileInputStream(file);
++-    }
++-
++-    InputStream getResourceAsStream(ClassLoader cl, String name) {
++-        InputStream ris;
++-        if (cl == null) {
++-            ris = ClassLoader.getSystemResourceAsStream(name);
++-        } else {
++-            ris = cl.getResourceAsStream(name);
++-        }
++-        return ris;
++-    }
++-
++-    boolean getFileExists(File f) {
++-        return f.exists();
++-    }
++-
++-    long getLastModified(File f) {
++-        return f.lastModified();
++-    }
++-}
++--- src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_de.java	2013-04-16 14:28:09.764157131 +0100
+++++ src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_de.java	2013-04-16 14:29:26.565394640 +0100
++@@ -23,9 +23,6 @@
++ package com.sun.org.apache.xpath.internal.res;
++ 
++ import java.util.ListResourceBundle;
++-import java.util.Locale;
++-import java.util.MissingResourceException;
++-import java.util.ResourceBundle;
++ 
++ /**
++  * Set up error messages.
++@@ -1269,68 +1266,4 @@
++   /** Field QUERY_HEADER          */
++   public static final String QUERY_HEADER = "MUSTER ";
++ 
++-
++-  /**
++-   * Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   * of ResourceBundle.getBundle().
++-   *
++-   * @param className Name of local-specific subclass.
++-   * @return the ResourceBundle
++-   * @throws MissingResourceException
++-   */
++-  public static final XPATHErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XPATHErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XPATHErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("en", "US"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "Could not load any resource bundles.", className, "");
++-      }
++-    }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++ }
++--- src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_es.java	2013-04-16 14:28:09.764157131 +0100
+++++ src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_es.java	2013-04-16 14:29:26.565394640 +0100
++@@ -23,9 +23,6 @@
++ package com.sun.org.apache.xpath.internal.res;
++ 
++ import java.util.ListResourceBundle;
++-import java.util.Locale;
++-import java.util.MissingResourceException;
++-import java.util.ResourceBundle;
++ 
++ /**
++  * Set up error messages.
++@@ -1273,68 +1270,4 @@
++   /** Field QUERY_HEADER          */
++   public static final String QUERY_HEADER = "PATTERN ";
++ 
++-
++-  /**
++-   * Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   * of ResourceBundle.getBundle().
++-   *
++-   * @param className Name of local-specific subclass.
++-   * @return the ResourceBundle
++-   * @throws MissingResourceException
++-   */
++-  public static final XPATHErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XPATHErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XPATHErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("es", "ES"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "Could not load any resource bundles.", className, "");
++-      }
++-    }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++ }
++--- src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_fr.java	2013-04-16 14:28:09.768157196 +0100
+++++ src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_fr.java	2013-04-16 14:29:26.565394640 +0100
++@@ -23,9 +23,6 @@
++ package com.sun.org.apache.xpath.internal.res;
++ 
++ import java.util.ListResourceBundle;
++-import java.util.Locale;
++-import java.util.MissingResourceException;
++-import java.util.ResourceBundle;
++ 
++ /**
++  * Set up error messages.
++@@ -1270,68 +1267,4 @@
++   /** Field QUERY_HEADER          */
++   public static final String QUERY_HEADER = "PATTERN ";
++ 
++-
++-  /**
++-   * Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   * of ResourceBundle.getBundle().
++-   *
++-   * @param className Name of local-specific subclass.
++-   * @return the ResourceBundle
++-   * @throws MissingResourceException
++-   */
++-  public static final XPATHErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XPATHErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XPATHErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("en", "US"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "Could not load any resource bundles.", className, "");
++-      }
++-    }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++ }
++--- src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_it.java	2013-04-16 14:28:09.768157196 +0100
+++++ src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_it.java	2013-04-16 14:29:26.565394640 +0100
++@@ -23,9 +23,6 @@
++ package com.sun.org.apache.xpath.internal.res;
++ 
++ import java.util.ListResourceBundle;
++-import java.util.Locale;
++-import java.util.MissingResourceException;
++-import java.util.ResourceBundle;
++ 
++ /**
++  * Set up error messages.
++@@ -1272,68 +1269,4 @@
++   /** Field QUERY_HEADER          */
++   public static final String QUERY_HEADER = "MODELLO ";
++ 
++-
++-  /**
++-   * Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   * of ResourceBundle.getBundle().
++-   *
++-   * @param className Name of local-specific subclass.
++-   * @return the ResourceBundle
++-   * @throws MissingResourceException
++-   */
++-  public static final XPATHErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XPATHErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XPATHErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("it", "IT"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "Could not load any resource bundles.", className, "");
++-      }
++-    }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++ }
++--- src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ja.java	2013-04-16 14:28:09.768157196 +0100
+++++ src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ja.java	2013-04-16 14:29:26.565394640 +0100
++@@ -23,9 +23,6 @@
++ package com.sun.org.apache.xpath.internal.res;
++ 
++ import java.util.ListResourceBundle;
++-import java.util.Locale;
++-import java.util.MissingResourceException;
++-import java.util.ResourceBundle;
++ 
++ /**
++  * Set up error messages.
++@@ -1269,68 +1266,4 @@
++   /** Field QUERY_HEADER          */
++   public static final String QUERY_HEADER = "\u30d1\u30bf\u30fc\u30f3 ";
++ 
++-
++-  /**
++-   * Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   * of ResourceBundle.getBundle().
++-   *
++-   * @param className Name of local-specific subclass.
++-   * @return the ResourceBundle
++-   * @throws MissingResourceException
++-   */
++-  public static final XPATHErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XPATHErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XPATHErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("en", "US"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "Could not load any resource bundles.", className, "");
++-      }
++-    }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++ }
++--- src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources.java	2013-04-16 14:28:09.764157131 +0100
+++++ src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources.java	2013-04-16 14:29:26.565394640 +0100
++@@ -23,9 +23,6 @@
++ package com.sun.org.apache.xpath.internal.res;
++ 
++ import java.util.ListResourceBundle;
++-import java.util.Locale;
++-import java.util.MissingResourceException;
++-import java.util.ResourceBundle;
++ 
++ /**
++  * Set up error messages.
++@@ -938,68 +935,4 @@
++   /** Field QUERY_HEADER          */
++   public static final String QUERY_HEADER = "PATTERN ";
++ 
++-
++-  /**
++-   * Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   * of ResourceBundle.getBundle().
++-   *
++-   * @param className Name of local-specific subclass.
++-   * @return the ResourceBundle
++-   * @throws MissingResourceException
++-   */
++-  public static final XPATHErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XPATHErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XPATHErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("en", "US"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "Could not load any resource bundles.", className, "");
++-      }
++-    }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++ }
++--- src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ko.java	2013-04-16 14:28:09.768157196 +0100
+++++ src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ko.java	2013-04-16 14:29:26.565394640 +0100
++@@ -23,9 +23,6 @@
++ package com.sun.org.apache.xpath.internal.res;
++ 
++ import java.util.ListResourceBundle;
++-import java.util.Locale;
++-import java.util.MissingResourceException;
++-import java.util.ResourceBundle;
++ 
++ /**
++  * Set up error messages.
++@@ -1269,68 +1266,4 @@
++   /** Field QUERY_HEADER          */
++   public static final String QUERY_HEADER = "PATTERN ";
++ 
++-
++-  /**
++-   * Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   * of ResourceBundle.getBundle().
++-   *
++-   * @param className Name of local-specific subclass.
++-   * @return the ResourceBundle
++-   * @throws MissingResourceException
++-   */
++-  public static final XPATHErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XPATHErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XPATHErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("ko", "KR"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "Could not load any resource bundles.", className, "");
++-      }
++-    }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++ }
++--- src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_CN.java	2013-04-16 14:28:09.772157260 +0100
+++++ src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_CN.java	2013-04-16 14:29:26.565394640 +0100
++@@ -23,9 +23,6 @@
++ package com.sun.org.apache.xpath.internal.res;
++ 
++ import java.util.ListResourceBundle;
++-import java.util.Locale;
++-import java.util.MissingResourceException;
++-import java.util.ResourceBundle;
++ 
++ /**
++  * Set up error messages.
++@@ -1270,68 +1267,4 @@
++   /** Field QUERY_HEADER          */
++   public static final String QUERY_HEADER = "PATTERN ";
++ 
++-
++-  /**
++-   * Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   * of ResourceBundle.getBundle().
++-   *
++-   * @param className Name of local-specific subclass.
++-   * @return the ResourceBundle
++-   * @throws MissingResourceException
++-   */
++-  public static final XPATHErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XPATHErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XPATHErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("zh", "CN"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "\u65e0\u6cd5\u88c5\u5165\u4efb\u4f55\u8d44\u6e90\u5305\u3002", className, "");
++-      }
++-    }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++ }
++--- src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_TW.java	2013-04-16 14:28:09.772157260 +0100
+++++ src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_TW.java	2013-04-16 14:29:26.565394640 +0100
++@@ -23,9 +23,6 @@
++ package com.sun.org.apache.xpath.internal.res;
++ 
++ import java.util.ListResourceBundle;
++-import java.util.Locale;
++-import java.util.MissingResourceException;
++-import java.util.ResourceBundle;
++ 
++ /**
++  * Set up error messages.
++@@ -1270,68 +1267,4 @@
++   /** Field QUERY_HEADER          */
++   public static final String QUERY_HEADER = "PATTERN ";
++ 
++-
++-  /**
++-   * Return a named ResourceBundle for a particular locale.  This method mimics the behavior
++-   * of ResourceBundle.getBundle().
++-   *
++-   * @param className Name of local-specific subclass.
++-   * @return the ResourceBundle
++-   * @throws MissingResourceException
++-   */
++-  public static final XPATHErrorResources loadResourceBundle(String className)
++-          throws MissingResourceException
++-  {
++-
++-    Locale locale = Locale.getDefault();
++-    String suffix = getResourceSuffix(locale);
++-
++-    try
++-    {
++-
++-      // first try with the given locale
++-      return (XPATHErrorResources) ResourceBundle.getBundle(className
++-              + suffix, locale);
++-    }
++-    catch (MissingResourceException e)
++-    {
++-      try  // try to fall back to en_US if we can't load
++-      {
++-
++-        // Since we can't find the localized property file,
++-        // fall back to en_US.
++-        return (XPATHErrorResources) ResourceBundle.getBundle(className,
++-                new Locale("zh", "TW"));
++-      }
++-      catch (MissingResourceException e2)
++-      {
++-
++-        // Now we are really in trouble.
++-        // very bad, definitely very bad...not going to get very far
++-        throw new MissingResourceException(
++-          "Could not load any resource bundles.", className, "");
++-      }
++-    }
++-  }
++-
++-  /**
++-   * Return the resource file suffic for the indicated locale
++-   * For most locales, this will be based the language code.  However
++-   * for Chinese, we do distinguish between Taiwan and PRC
++-   *
++-   * @param locale the locale
++-   * @return an String suffix which canbe appended to a resource name
++-   */
++-  private static final String getResourceSuffix(Locale locale)
++-  {
++-
++-    String suffix = "_" + locale.getLanguage();
++-    String country = locale.getCountry();
++-
++-    if (country.equals("TW"))
++-      suffix += "_" + country;
++-
++-    return suffix;
++-  }
++-
++ }
++--- src/com/sun/org/apache/xpath/internal/res/XPATHMessages.java	2013-04-16 14:28:09.772157260 +0100
+++++ src/com/sun/org/apache/xpath/internal/res/XPATHMessages.java	2013-04-16 14:29:26.569394704 +0100
++@@ -22,130 +22,128 @@
++  */
++ package com.sun.org.apache.xpath.internal.res;
++ 
++-import java.util.ListResourceBundle;
++-
+++import com.sun.org.apache.bcel.internal.util.SecuritySupport;
++ import com.sun.org.apache.xml.internal.res.XMLMessages;
+++import java.util.ListResourceBundle;
++ 
++ /**
++  * A utility class for issuing XPath error messages.
+++ *
++  * @xsl.usage internal
++  */
++-public class XPATHMessages extends XMLMessages
++-{
++-  /** The language specific resource object for XPath messages.  */
++-  private static ListResourceBundle XPATHBundle = null;
++-
++-  /** The class name of the XPath error message string table.     */
++-  private static final String XPATH_ERROR_RESOURCES =
++-    "com.sun.org.apache.xpath.internal.res.XPATHErrorResources";
++-
++-  /**
++-   * Creates a message from the specified key and replacement
++-   * arguments, localized to the given locale.
++-   *
++-   * @param msgKey    The key for the message text.
++-   * @param args      The arguments to be used as replacement text
++-   *                  in the message created.
++-   *
++-   * @return The formatted message string.
++-   */
++-  public static final String createXPATHMessage(String msgKey, Object args[])  //throws Exception
++-  {
++-    if (XPATHBundle == null)
++-      XPATHBundle = loadResourceBundle(XPATH_ERROR_RESOURCES);
+++public class XPATHMessages extends XMLMessages {
++ 
++-    if (XPATHBundle != null)
+++    /**
+++     * The language specific resource object for XPath messages.
+++     */
+++    private static ListResourceBundle XPATHBundle = null;
+++    /**
+++     * The class name of the XPath error message string table.
+++     */
+++    private static final String XPATH_ERROR_RESOURCES =
+++            "com.sun.org.apache.xpath.internal.res.XPATHErrorResources";
+++
+++    /**
+++     * Creates a message from the specified key and replacement arguments,
+++     * localized to the given locale.
+++     *
+++     * @param msgKey The key for the message text.
+++     * @param args The arguments to be used as replacement text in the message
+++     * created.
+++     *
+++     * @return The formatted message string.
+++     */
+++    public static final String createXPATHMessage(String msgKey, Object args[]) //throws Exception
++     {
++-      return createXPATHMsg(XPATHBundle, msgKey, args);
++-    }
++-    else
++-      return "Could not load any resource bundles.";
++-  }
++-
++-  /**
++-   * Creates a message from the specified key and replacement
++-   * arguments, localized to the given locale.
++-   *
++-   * @param msgKey The key for the message text.
++-   * @param args      The arguments to be used as replacement text
++-   *                  in the message created.
++-   *
++-   * @return The formatted warning string.
++-   */
++-  public static final String createXPATHWarning(String msgKey, Object args[])  //throws Exception
++-  {
++-    if (XPATHBundle == null)
++-      XPATHBundle = loadResourceBundle(XPATH_ERROR_RESOURCES);
+++        if (XPATHBundle == null) {
+++            XPATHBundle = SecuritySupport.getResourceBundle(XPATH_ERROR_RESOURCES);
+++        }
++ 
++-    if (XPATHBundle != null)
++-    {
++-      return createXPATHMsg(XPATHBundle, msgKey, args);
+++        if (XPATHBundle != null) {
+++            return createXPATHMsg(XPATHBundle, msgKey, args);
+++        } else {
+++            return "Could not load any resource bundles.";
+++        }
++     }
++-    else
++-      return "Could not load any resource bundles.";
++-  }
++-
++-  /**
++-   * Creates a message from the specified key and replacement
++-   * arguments, localized to the given locale.
++-   *
++-   * @param fResourceBundle The resource bundle to use.
++-   * @param msgKey  The message key to use.
++-   * @param args      The arguments to be used as replacement text
++-   *                  in the message created.
++-   *
++-   * @return The formatted message string.
++-   */
++-  public static final String createXPATHMsg(ListResourceBundle fResourceBundle,
++-                                            String msgKey, Object args[])  //throws Exception
++-  {
++-
++-    String fmsg = null;
++-    boolean throwex = false;
++-    String msg = null;
++-
++-    if (msgKey != null)
++-      msg = fResourceBundle.getString(msgKey);
++ 
++-    if (msg == null)
+++    /**
+++     * Creates a message from the specified key and replacement arguments,
+++     * localized to the given locale.
+++     *
+++     * @param msgKey The key for the message text.
+++     * @param args The arguments to be used as replacement text in the message
+++     * created.
+++     *
+++     * @return The formatted warning string.
+++     */
+++    public static final String createXPATHWarning(String msgKey, Object args[]) //throws Exception
++     {
++-      msg = fResourceBundle.getString(XPATHErrorResources.BAD_CODE);
++-      throwex = true;
+++        if (XPATHBundle == null) {
+++            XPATHBundle = SecuritySupport.getResourceBundle(XPATH_ERROR_RESOURCES);
+++        }
+++
+++        if (XPATHBundle != null) {
+++            return createXPATHMsg(XPATHBundle, msgKey, args);
+++        } else {
+++            return "Could not load any resource bundles.";
+++        }
++     }
++ 
++-    if (args != null)
+++    /**
+++     * Creates a message from the specified key and replacement arguments,
+++     * localized to the given locale.
+++     *
+++     * @param fResourceBundle The resource bundle to use.
+++     * @param msgKey The message key to use.
+++     * @param args The arguments to be used as replacement text in the message
+++     * created.
+++     *
+++     * @return The formatted message string.
+++     */
+++    public static final String createXPATHMsg(ListResourceBundle fResourceBundle,
+++            String msgKey, Object args[]) //throws Exception
++     {
++-      try
++-      {
++ 
++-        // Do this to keep format from crying.
++-        // This is better than making a bunch of conditional
++-        // code all over the place.
++-        int n = args.length;
++-
++-        for (int i = 0; i < n; i++)
++-        {
++-          if (null == args[i])
++-            args[i] = "";
++-        }
++-
++-        fmsg = java.text.MessageFormat.format(msg, args);
++-      }
++-      catch (Exception e)
++-      {
++-        fmsg = fResourceBundle.getString(XPATHErrorResources.FORMAT_FAILED);
++-        fmsg += " " + msg;
++-      }
++-    }
++-    else
++-      fmsg = msg;
+++        String fmsg = null;
+++        boolean throwex = false;
+++        String msg = null;
++ 
++-    if (throwex)
++-    {
++-      throw new RuntimeException(fmsg);
++-    }
+++        if (msgKey != null) {
+++            msg = fResourceBundle.getString(msgKey);
+++        }
+++
+++        if (msg == null) {
+++            msg = fResourceBundle.getString(XPATHErrorResources.BAD_CODE);
+++            throwex = true;
+++        }
++ 
++-    return fmsg;
++-  }
+++        if (args != null) {
+++            try {
++ 
+++                // Do this to keep format from crying.
+++                // This is better than making a bunch of conditional
+++                // code all over the place.
+++                int n = args.length;
+++
+++                for (int i = 0; i < n; i++) {
+++                    if (null == args[i]) {
+++                        args[i] = "";
+++                    }
+++                }
+++
+++                fmsg = java.text.MessageFormat.format(msg, args);
+++            } catch (Exception e) {
+++                fmsg = fResourceBundle.getString(XPATHErrorResources.FORMAT_FAILED);
+++                fmsg += " " + msg;
+++            }
+++        } else {
+++            fmsg = msg;
+++        }
+++
+++        if (throwex) {
+++            throw new RuntimeException(fmsg);
+++        }
+++
+++        return fmsg;
+++    }
++ }
++--- src/com/sun/xml/internal/stream/writers/WriterUtility.java	2013-04-16 14:28:09.780157389 +0100
+++++ src/com/sun/xml/internal/stream/writers/WriterUtility.java	2013-04-16 14:29:26.569394704 +0100
++@@ -32,6 +32,7 @@
++ import java.nio.charset.Charset;
++ import java.nio.charset.CharsetEncoder;
++ import com.sun.org.apache.xerces.internal.util.XMLChar;
+++import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
++ 
++ /**
++  * Implements common xml writer functions.
++@@ -240,7 +241,7 @@
++ 
++     private CharsetEncoder getDefaultEncoder(){
++         try{
++-            String encoding = System.getProperty("file.encoding");
+++            String encoding = SecuritySupport.getSystemProperty("file.encoding");
++             if(encoding != null){
++                 return Charset.forName(encoding).newEncoder();
++             }
++--- src/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java	2013-04-16 14:28:09.780157389 +0100
+++++ src/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java	2013-04-16 14:29:26.569394704 +0100
++@@ -53,6 +53,7 @@
++ import com.sun.org.apache.xerces.internal.impl.PropertyManager;
++ import com.sun.org.apache.xerces.internal.util.NamespaceSupport;
++ import com.sun.org.apache.xerces.internal.util.SymbolTable;
+++import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
++ import com.sun.org.apache.xerces.internal.xni.QName;
++ 
++ import com.sun.xml.internal.stream.util.ReadOnlyIterator;
++@@ -339,7 +340,7 @@
++                 fEncoder = Charset.forName(encoding).newEncoder();
++             }
++         } else {
++-            encoding = System.getProperty("file.encoding");
+++            encoding = SecuritySupport.getSystemProperty("file.encoding");
++             if (encoding != null && encoding.equalsIgnoreCase("utf-8")) {
++                 fWriter = new UTF8OutputStreamWriter(os);
++             } else {
++--- src/com/sun/xml/internal/stream/XMLEntityStorage.java	2013-04-16 14:28:09.772157260 +0100
+++++ src/com/sun/xml/internal/stream/XMLEntityStorage.java	2013-04-16 14:29:26.569394704 +0100
++@@ -36,6 +36,7 @@
++ import com.sun.org.apache.xerces.internal.impl.PropertyManager;
++ import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter;
++ import com.sun.org.apache.xerces.internal.impl.Constants;
+++import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
++ 
++ /**
++  *
++@@ -410,7 +411,7 @@
++         // get the user.dir property
++         String userDir = "";
++         try {
++-            userDir = System.getProperty("user.dir");
+++            userDir = SecuritySupport.getSystemProperty("user.dir");
++         }
++         catch (SecurityException se) {
++         }
++--- src/javax/xml/datatype/FactoryFinder.java	2013-04-16 14:28:09.784157453 +0100
+++++ src/javax/xml/datatype/FactoryFinder.java	2013-04-16 14:29:26.569394704 +0100
++@@ -44,6 +44,7 @@
++  * @author Santiago.PericasGeertsen at sun.com
++  */
++ class FactoryFinder {
+++    private static final String DEFAULT_PACKAGE = "com.sun.org.apache.xerces.internal";
++     
++     /**
++      * Internal debug flag.
++@@ -95,18 +96,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 +138,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 +147,38 @@
++     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 ClassLoader to use to load the class, null means to use
+++     * the bootstrap ClassLoader
+++     *
+++     * @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
+++    {
+++        // 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);                        
+++            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 +281,7 @@
++         
++         // First try the Context ClassLoader
++         ClassLoader cl = ss.getContextClassLoader();
+++        boolean useBSClsLoader = false;
++         if (cl != null) {
++             is = ss.getResourceAsStream(cl, serviceId);
++             
++@@ -251,11 +289,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 +333,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/stream/FactoryFinder.java	2013-04-16 14:28:09.788157518 +0100
+++++ src/javax/xml/stream/FactoryFinder.java	2013-04-16 14:29:26.569394704 +0100
++@@ -25,14 +25,12 @@
++ 
++ package javax.xml.stream;
++ 
++-import java.io.InputStream;
++-import java.io.IOException;
++-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.util.Properties;
++ 
++ /**
++  * <p>Implements pluggable Datatypes.</p>
++@@ -43,6 +41,8 @@
++  * @author Santiago.PericasGeertsen at sun.com
++  */
++ class FactoryFinder {
+++    // Check we have access to package.
+++    private static final String DEFAULT_PACKAGE = "com.sun.xml.internal.";
++ 
++     /**
++      * Internal debug flag.
++@@ -94,18 +94,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 {
++@@ -130,8 +136,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
++@@ -139,8 +145,38 @@
++     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
+++    {
+++        // 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);
+++            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 +
++@@ -233,11 +269,11 @@
++                             if (ss.doesFileExist(f)) {
++                                 dPrint("Read properties file "+f);
++                                 cacheProps.load(ss.getFileInputStream(f));
++-                            }
++-                        }
++                     }
++                 }
++             }
+++                }
+++            }
++             factoryClassName = cacheProps.getProperty(factoryId);
++ 
++             if (factoryClassName != null) {
++@@ -276,6 +312,7 @@
++ 
++         // First try the Context ClassLoader
++         ClassLoader cl = ss.getContextClassLoader();
+++        boolean useBSClsLoader = false;
++         if (cl != null) {
++             is = ss.getResourceAsStream(cl, serviceId);
++ 
++@@ -283,11 +320,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) {
++@@ -325,7 +364,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/validation/SchemaFactoryFinder.java	2013-04-16 14:28:09.800157711 +0100
+++++ src/javax/xml/validation/SchemaFactoryFinder.java	2013-04-16 14:29:26.569394704 +0100
++@@ -53,6 +53,7 @@
++      *<p> Take care of restrictions imposed by java security model </p>
++      */
++     private static SecuritySupport ss = new SecuritySupport();
+++    private static final String DEFAULT_PACKAGE = "com.sun.org.apache.xerces.internal";
++     /**
++      * <p>Cache properties for performance.</p>
++      */
++@@ -212,28 +213,6 @@
++             }
++         }
++ 
++-        /**
++-        // try to read from $java.home/lib/jaxp.properties
++-        try {
++-            String javah = ss.getSystemProperty( "java.home" );
++-            String configFile = javah + File.separator +
++-            "lib" + File.separator + "jaxp.properties";
++-            File f = new File( configFile );
++-            if( ss.doesFileExist(f)) {
++-                sf = loadFromProperty(
++-                        propertyName,f.getAbsolutePath(), new FileInputStream(f));
++-                if(sf!=null)    return sf;
++-            } else {
++-                debugPrintln("Tried to read "+ f.getAbsolutePath()+", but it doesn't exist.");
++-            }
++-        } catch(Throwable e) {
++-            if( debug ) {
++-                debugPrintln("failed to read $java.home/lib/jaxp.properties");
++-                e.printStackTrace();
++-            }
++-        }
++-         */
++-
++         // try META-INF/services files
++         Iterator sitr = createServiceFileIterator();
++         while(sitr.hasNext()) {
++@@ -268,14 +247,20 @@
++      */
++     private Class createClass(String className) {
++             Class clazz;
+++        // make sure we have access to restricted packages
+++        boolean internal = false;
+++        if (System.getSecurityManager() != null) {
+++            if (className != null && className.startsWith(DEFAULT_PACKAGE)) {
+++                internal = true;
+++            }
+++        }
++ 
++-            // use approprite ClassLoader
++             try {
++-                    if (classLoader != null) {
++-                            clazz = classLoader.loadClass(className);
++-                    } else {
++-                            clazz = Class.forName(className);
++-                    }
+++                if (classLoader != null && !internal) {
+++                        clazz = classLoader.loadClass(className);
+++                } else {
+++                        clazz = Class.forName(className);
+++                }
++             } catch (Throwable t) {
++                 if(debug)   t.printStackTrace();
++                     return null;
++--- src/javax/xml/xpath/XPathFactoryFinder.java	2013-04-16 14:28:09.800157711 +0100
+++++ src/javax/xml/xpath/XPathFactoryFinder.java	2013-04-16 14:29:26.569394704 +0100
++@@ -47,6 +47,7 @@
++  * @since 1.5
++  */
++ class XPathFactoryFinder  {
+++    private static final String DEFAULT_PACKAGE = "com.sun.org.apache.xpath.internal";
++ 
++     private static SecuritySupport ss = new SecuritySupport() ;
++     /** debug support code. */
++@@ -245,18 +246,25 @@
++      */
++     private Class createClass(String className) {
++             Class clazz;
++-
++-            // use approprite ClassLoader
++-            try {
++-                    if (classLoader != null) {
++-                            clazz = classLoader.loadClass(className);
++-                    } else {
++-                            clazz = Class.forName(className);
++-                    }
++-            } catch (Throwable t) {
++-                if(debug)   t.printStackTrace();
++-                    return null;
+++        // make sure we have access to restricted packages
+++        boolean internal = false;
+++        if (System.getSecurityManager() != null) {
+++            if (className != null && className.startsWith(DEFAULT_PACKAGE)) {
+++                internal = true;
++             }
+++        }
+++
+++        // use approprite ClassLoader
+++        try {
+++            if (classLoader != null && !internal) {
+++                    clazz = classLoader.loadClass(className);
+++            } else {
+++                    clazz = Class.forName(className);
+++            }
+++        } catch (Throwable t) {
+++            if(debug)   t.printStackTrace();
+++                return null;
+++        }
++ 
++             return clazz;
++     }
++--- src/org/w3c/dom/bootstrap/DOMImplementationRegistry.java	2013-04-16 14:28:09.808157841 +0100
+++++ src/org/w3c/dom/bootstrap/DOMImplementationRegistry.java	2013-04-16 14:29:26.569394704 +0100
++@@ -104,6 +104,8 @@
++      */
++     private static final String FALLBACK_CLASS = 
++             "com.sun.org.apache.xerces.internal.dom.DOMXSImplementationSourceImpl";
+++    private static final String DEFAULT_PACKAGE =
+++            "com.sun.org.apache.xerces.internal.dom";
++     /**
++      * Private constructor.
++      * @param srcs Vector List of DOMImplementationSources
++@@ -168,10 +170,15 @@
++ 	    StringTokenizer st = new StringTokenizer(p);
++ 	    while (st.hasMoreTokens()) {
++ 		String sourceName = st.nextToken();
++-		// Use context class loader, falling back to Class.forName
++-		// if and only if this fails...
+++                // make sure we have access to restricted packages
+++                boolean internal = false;
+++                if (System.getSecurityManager() != null) {
+++                    if (sourceName != null && sourceName.startsWith(DEFAULT_PACKAGE)) {
+++                        internal = true;
+++                    }
+++                }
++ 		Class sourceClass = null;
++-		if (classLoader != null) {
+++                if (classLoader != null && !internal) {
++ 		    sourceClass = classLoader.loadClass(sourceName);
++ 		} else {
++ 		    sourceClass = Class.forName(sourceName);
++--- src/org/xml/sax/helpers/NewInstance.java	2013-04-16 14:28:09.832158226 +0100
+++++ src/org/xml/sax/helpers/NewInstance.java	2013-04-16 14:29:26.569394704 +0100
++@@ -54,9 +54,10 @@
++  * including versions of Java 2.</p>
++  *
++  * @author Edwin Goei, David Brownell
+++ * @version 2.0.1 (sax2r2)
++  */
++ class NewInstance {
++-
+++    private static final String DEFAULT_PACKAGE = "com.sun.org.apache.xerces.internal";
++     /**
++      * Creates a new instance of the specified class name
++      *
++@@ -66,8 +67,16 @@
++         throws ClassNotFoundException, IllegalAccessException,
++             InstantiationException
++     {
+++        // make sure we have access to restricted packages
+++        boolean internal = false;
+++        if (System.getSecurityManager() != null) {
+++            if (className != null && className.startsWith(DEFAULT_PACKAGE)) {
+++                internal = true;
+++            }
+++        }
+++
++         Class driverClass;
++-        if (classLoader == null) {
+++        if (classLoader == null || internal) {
++             driverClass = Class.forName(className);
++         } else {
++             driverClass = classLoader.loadClass(className);
++@@ -75,29 +84,4 @@
++         return driverClass.newInstance();
++     }
++ 
++-    /**
++-     * Figure out which ClassLoader to use.  For JDK 1.2 and later use
++-     * the context ClassLoader.
++-     */
++-    static ClassLoader getClassLoader ()
++-    {
++-        Method m = null;
++-
++-        try {
++-            m = Thread.class.getMethod("getContextClassLoader", (Class[]) null);
++-        } catch (NoSuchMethodException e) {
++-            // Assume that we are running JDK 1.1, use the current ClassLoader
++-            return NewInstance.class.getClassLoader();
++-        }
++-
++-        try {
++-            return (ClassLoader) m.invoke(Thread.currentThread(), (Object[]) null);
++-        } catch (IllegalAccessException e) {
++-            // assert(false)
++-            throw new UnknownError(e.getMessage());
++-        } catch (InvocationTargetException e) {
++-            // assert(e.getTargetException() instanceof SecurityException)
++-            throw new UnknownError(e.getMessage());
++-        }
++-    }
++ }
++--- src/org/xml/sax/helpers/ParserAdapter.java	2013-04-16 14:28:09.836158291 +0100
+++++ src/org/xml/sax/helpers/ParserAdapter.java	2013-04-16 14:29:26.569394704 +0100
++@@ -74,13 +74,14 @@
++  *
++  * @since SAX 2.0
++  * @author David Megginson
+++ * @version 2.0.1 (sax2r2)
++  * @see org.xml.sax.helpers.XMLReaderAdapter
++  * @see org.xml.sax.XMLReader
++  * @see org.xml.sax.Parser
++  */
++ public class ParserAdapter implements XMLReader, DocumentHandler
++ {
++-
+++    private static SecuritySupport ss = new SecuritySupport();
++ 
++     ////////////////////////////////////////////////////////////////////
++     // Constructors.
++@@ -102,7 +103,7 @@
++     {
++         super();
++ 
++-        String driver = System.getProperty("org.xml.sax.parser");
+++        String driver = ss.getSystemProperty("org.xml.sax.parser");
++ 
++         try {
++             setup(ParserFactory.makeParser());
++--- src/org/xml/sax/helpers/ParserFactory.java	2013-04-16 14:28:09.836158291 +0100
+++++ src/org/xml/sax/helpers/ParserFactory.java	2013-04-16 14:29:26.569394704 +0100
++@@ -30,12 +30,6 @@
++ 
++ package org.xml.sax.helpers;
++ 
++-import java.lang.ClassNotFoundException;
++-import java.lang.IllegalAccessException;
++-import java.lang.InstantiationException;
++-import java.lang.SecurityException;
++-import java.lang.ClassCastException;
++-
++ import org.xml.sax.Parser;
++ 
++ 
++@@ -69,9 +63,10 @@
++  *             interface.
++  * @since SAX 1.0
++  * @author David Megginson
+++ * @version 2.0.1 (sax2r2)
++  */
++ public class ParserFactory {
++-
+++    private static SecuritySupport ss = new SecuritySupport();
++ 
++     /**
++      * Private null constructor.
++@@ -109,7 +104,7 @@
++         NullPointerException,
++         ClassCastException
++     {
++-        String className = System.getProperty("org.xml.sax.parser");
+++        String className = ss.getSystemProperty("org.xml.sax.parser");
++         if (className == null) {
++             throw new NullPointerException("No value for sax.parser property");
++         } else {
++@@ -146,7 +141,7 @@
++         ClassCastException
++     {
++         return (Parser) NewInstance.newInstance (
++-                NewInstance.getClassLoader (), className);
+++                ss.getContextClassLoader(), className);
++     }
++ 
++ }
++--- src/org/xml/sax/helpers/SecuritySupport.java	1970-01-01 01:00:00.000000000 +0100
+++++ src/org/xml/sax/helpers/SecuritySupport.java	2013-04-16 14:29:26.569394704 +0100
++@@ -0,0 +1,108 @@
+++/*
+++ * Copyright (c) 2004, 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 org.xml.sax.helpers;
+++
+++import java.io.*;
+++import java.security.*;
+++
+++/**
+++ * 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.
+++ *
+++ * Security related methods that only work on J2SE 1.2 and newer.
+++ */
+++class SecuritySupport  {
+++
+++
+++    ClassLoader getContextClassLoader() throws SecurityException{
+++        return (ClassLoader)
+++                AccessController.doPrivileged(new PrivilegedAction() {
+++            public Object run() {
+++                ClassLoader cl = null;
+++                //try {
+++                cl = Thread.currentThread().getContextClassLoader();
+++                //} catch (SecurityException ex) { }
+++
+++                if (cl == null)
+++                    cl = ClassLoader.getSystemClassLoader();
+++
+++                return cl;
+++            }
+++        });
+++    }
+++
+++    String getSystemProperty(final String propName) {
+++        return (String)
+++            AccessController.doPrivileged(new PrivilegedAction() {
+++                public Object run() {
+++                    return System.getProperty(propName);
+++                }
+++            });
+++    }
+++
+++    FileInputStream getFileInputStream(final File file)
+++        throws FileNotFoundException
+++    {
+++        try {
+++            return (FileInputStream)
+++                AccessController.doPrivileged(new PrivilegedExceptionAction() {
+++                    public Object run() throws FileNotFoundException {
+++                        return new FileInputStream(file);
+++                    }
+++                });
+++        } catch (PrivilegedActionException e) {
+++            throw (FileNotFoundException)e.getException();
+++        }
+++    }
+++
+++    InputStream getResourceAsStream(final ClassLoader cl,
+++                                           final String name)
+++    {
+++        return (InputStream)
+++            AccessController.doPrivileged(new PrivilegedAction() {
+++                public Object run() {
+++                    InputStream ris;
+++                    if (cl == null) {
+++                        ris = Object.class.getResourceAsStream(name);
+++                    } else {
+++                        ris = cl.getResourceAsStream(name);
+++                    }
+++                    return ris;
+++                }
+++            });
+++    }
+++
+++    boolean doesFileExist(final File f) {
+++    return ((Boolean)
+++            AccessController.doPrivileged(new PrivilegedAction() {
+++                public Object run() {
+++                    return new Boolean(f.exists());
+++                }
+++            })).booleanValue();
+++    }
+++
+++}
++--- src/org/xml/sax/helpers/XMLReaderFactory.java	2013-04-16 14:28:09.836158291 +0100
+++++ src/org/xml/sax/helpers/XMLReaderFactory.java	2013-04-16 14:29:26.569394704 +0100
++@@ -34,8 +34,6 @@
++ import java.io.BufferedReader;
++ import java.io.InputStream;
++ import java.io.InputStreamReader;
++-import java.security.AccessController;
++-import java.security.PrivilegedAction;
++ import org.xml.sax.XMLReader;
++ import org.xml.sax.SAXException;
++ 
++@@ -85,8 +83,8 @@
++     }
++ 
++     private static final String property = "org.xml.sax.driver";
+++    private static SecuritySupport ss = new SecuritySupport();
++ 
++-    private static String _clsFromJar = null;
++     private static boolean _jarread = false;
++     /**
++      * Attempt to create an XMLReader from system defaults.
++@@ -134,43 +132,45 @@
++ 	throws SAXException
++     {
++ 	String		className = null;
++-	ClassLoader	loader = NewInstance.getClassLoader ();
+++        ClassLoader     cl = ss.getContextClassLoader();
++ 	
++ 	// 1. try the JVM-instance-wide system property
++-	try { className = System.getProperty (property); }
++-	catch (RuntimeException e) { /* normally fails for applets */ }
+++        try {
+++            className = ss.getSystemProperty(property);
+++        }
+++        catch (RuntimeException e) { /* continue searching */ }
++ 
++ 	// 2. if that fails, try META-INF/services/
++ 	if (className == null) {
++             if (!_jarread) {
++-                final ClassLoader	loader1 = loader;
++                 _jarread = true;
++-                _clsFromJar =  (String)
++-                AccessController.doPrivileged(new PrivilegedAction() {
++-                    public Object run() {
++-                        String clsName = null;
++-                        try {
++-                            String      service = "META-INF/services/" + property;
++-                            InputStream	in;
++-                            BufferedReader	reader;
++-                            if (loader1 == null)
++-                                in = ClassLoader.getSystemResourceAsStream (service);
++-                            else
++-                                in = loader1.getResourceAsStream (service);
++-
++-                            if (in != null) {
++-                                reader = new BufferedReader (
++-                                        new InputStreamReader (in, "UTF8"));
++-                                clsName = reader.readLine ();
++-                                in.close ();
++-                            }
++-                        } catch (Exception e) {
+++                String      service = "META-INF/services/" + property;
+++                InputStream in;
+++                BufferedReader      reader;
+++
+++                try {
+++                    if (cl != null) {
+++                        in = ss.getResourceAsStream(cl, service);
+++
+++                        // If no provider found then try the current ClassLoader
+++                        if (in == null) {
+++                            cl = null;
+++                            in = ss.getResourceAsStream(cl, service);
++                         }
++-                        return clsName;
+++                    } else {
+++                        // No Context ClassLoader, try the current ClassLoader
+++                        in = ss.getResourceAsStream(cl, service);
++                     }
++-                });
+++
+++                    if (in != null) {
+++                        reader = new BufferedReader (
+++                                new InputStreamReader (in, "UTF8"));
+++                        className = reader.readLine ();
+++                        in.close ();
+++                    }
+++                } catch (Exception e) {
+++                }
++             }
++-            className = _clsFromJar;
++ 	}
++ 
++ 	// 3. Distro-specific fallback
++@@ -187,7 +187,7 @@
++ 	
++ 	// do we know the XMLReader implementation class yet?
++ 	if (className != null)
++-	    return loadClass (loader, className);
+++            return loadClass (cl, className);
++ 
++ 	// 4. panic -- adapt any SAX1 parser
++ 	try {
++@@ -217,7 +217,7 @@
++     public static XMLReader createXMLReader (String className)
++ 	throws SAXException
++     {
++-	return loadClass (NewInstance.getClassLoader (), className);
+++        return loadClass (ss.getContextClassLoader(), className);
++     }
++ 
++     private static XMLReader loadClass (ClassLoader loader, String className)
+--- jdk/src/share/lib/security/java.security	2013-04-16 14:28:12.392199476 +0100
++++ jdk/src/share/lib/security/java.security	2013-04-16 14:29:26.545394318 +0100
+@@ -130,10 +130,27 @@
+ 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.imageio.,\
+                com.sun.istack.internal.,\
+-               com.sun.jmx.
++               com.sun.jmx.,\
++               com.sun.org.apache.bcel.internal.,\
++               com.sun.org.apache.regexp.internal.,\
++               com.sun.org.apache.xerces.internal.,\
++               com.sun.org.apache.xpath.internal.,\
++               com.sun.org.apache.xalan.internal.extensions.,\
++               com.sun.org.apache.xalan.internal.lib.,\
++               com.sun.org.apache.xalan.internal.res.,\
++               com.sun.org.apache.xalan.internal.templates.,\
++               com.sun.org.apache.xalan.internal.xslt.,\
++               com.sun.org.apache.xalan.internal.xsltc.cmdline.,\
++               com.sun.org.apache.xalan.internal.xsltc.compiler.,\
++               com.sun.org.apache.xalan.internal.xsltc.trax.,\
++               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.
+ 
+ #
+ # List of comma-separated packages that start with or equal this string
+@@ -148,10 +165,27 @@
+ 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.imageio.,\
+                    com.sun.istack.internal.,\
+-                   com.sun.jmx.
++                   com.sun.jmx.,\
++                   com.sun.org.apache.bcel.internal.,\
++                   com.sun.org.apache.regexp.internal.,\
++                   com.sun.org.apache.xerces.internal.,\
++                   com.sun.org.apache.xpath.internal.,\
++                   com.sun.org.apache.xalan.internal.extensions.,\
++                   com.sun.org.apache.xalan.internal.lib.,\
++                   com.sun.org.apache.xalan.internal.res.,\
++                   com.sun.org.apache.xalan.internal.templates.,\
++                   com.sun.org.apache.xalan.internal.xslt.,\
++                   com.sun.org.apache.xalan.internal.xsltc.cmdline.,\
++                   com.sun.org.apache.xalan.internal.xsltc.compiler.,\
++                   com.sun.org.apache.xalan.internal.xsltc.trax.,\
++                   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.
+ 
+ #
+ # Determines whether this properties file can be appended to
+--- jdk/src/share/lib/security/java.security-solaris	2013-04-16 14:28:12.396199540 +0100
++++ jdk/src/share/lib/security/java.security-solaris	2013-04-16 14:30:42.026610629 +0100
+@@ -131,10 +131,27 @@
+ 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.imageio.
+                com.sun.istack.internal.,\
+-               com.sun.jmx.
++               com.sun.jmx.,\
++               com.sun.org.apache.bcel.internal.,\
++               com.sun.org.apache.regexp.internal.,\
++               com.sun.org.apache.xerces.internal.,\
++               com.sun.org.apache.xpath.internal.,\
++               com.sun.org.apache.xalan.internal.extensions.,\
++               com.sun.org.apache.xalan.internal.lib.,\
++               com.sun.org.apache.xalan.internal.res.,\
++               com.sun.org.apache.xalan.internal.templates.,\
++               com.sun.org.apache.xalan.internal.xslt.,\
++               com.sun.org.apache.xalan.internal.xsltc.cmdline.,\
++               com.sun.org.apache.xalan.internal.xsltc.compiler.,\
++               com.sun.org.apache.xalan.internal.xsltc.trax.,\
++               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.
+ 
+ #
+ # List of comma-separated packages that start with or equal this string
+@@ -149,10 +166,27 @@
+ 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.imageio.
+                    com.sun.istack.internal.,\
+-                   com.sun.jmx.
++                   com.sun.jmx.,\
++                   com.sun.org.apache.bcel.internal.,\
++                   com.sun.org.apache.regexp.internal.,\
++                   com.sun.org.apache.xerces.internal.,\
++                   com.sun.org.apache.xpath.internal.,\
++                   com.sun.org.apache.xalan.internal.extensions.,\
++                   com.sun.org.apache.xalan.internal.lib.,\
++                   com.sun.org.apache.xalan.internal.res.,\
++                   com.sun.org.apache.xalan.internal.templates.,\
++                   com.sun.org.apache.xalan.internal.xslt.,\
++                   com.sun.org.apache.xalan.internal.xsltc.cmdline.,\
++                   com.sun.org.apache.xalan.internal.xsltc.compiler.,\
++                   com.sun.org.apache.xalan.internal.xsltc.trax.,\
++                   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.
+ 
+ #
+ # Determines whether this properties file can be appended to
+--- jdk/src/share/lib/security/java.security-windows	2013-04-16 14:28:12.396199540 +0100
++++ jdk/src/share/lib/security/java.security-windows	2013-04-16 14:31:35.027464728 +0100
+@@ -131,10 +131,27 @@
+ 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.imageio.
+                com.sun.istack.internal.,\
+-               com.sun.jmx.
++               com.sun.jmx.,\
++               com.sun.org.apache.bcel.internal.,\
++               com.sun.org.apache.regexp.internal.,\
++               com.sun.org.apache.xerces.internal.,\
++               com.sun.org.apache.xpath.internal.,\
++               com.sun.org.apache.xalan.internal.extensions.,\
++               com.sun.org.apache.xalan.internal.lib.,\
++               com.sun.org.apache.xalan.internal.res.,\
++               com.sun.org.apache.xalan.internal.templates.,\
++               com.sun.org.apache.xalan.internal.xslt.,\
++               com.sun.org.apache.xalan.internal.xsltc.cmdline.,\
++               com.sun.org.apache.xalan.internal.xsltc.compiler.,\
++               com.sun.org.apache.xalan.internal.xsltc.trax.,\
++               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.
+ 
+ #
+ # List of comma-separated packages that start with or equal this string
+@@ -149,10 +166,27 @@
+ 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.imageio.
+                    com.sun.istack.internal.,\
+-                   com.sun.jmx.
++                   com.sun.jmx.,\
++                   com.sun.org.apache.bcel.internal.,\
++                   com.sun.org.apache.regexp.internal.,\
++                   com.sun.org.apache.xerces.internal.,\
++                   com.sun.org.apache.xpath.internal.,\
++                   com.sun.org.apache.xalan.internal.extensions.,\
++                   com.sun.org.apache.xalan.internal.lib.,\
++                   com.sun.org.apache.xalan.internal.res.,\
++                   com.sun.org.apache.xalan.internal.templates.,\
++                   com.sun.org.apache.xalan.internal.xslt.,\
++                   com.sun.org.apache.xalan.internal.xsltc.cmdline.,\
++                   com.sun.org.apache.xalan.internal.xsltc.compiler.,\
++                   com.sun.org.apache.xalan.internal.xsltc.trax.,\
++                   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.
+ 
+ #
+ # Determines whether this properties file can be appended to

Added: trunk/java/openjdk6/files/icedtea/security/20130416/7200507.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130416/7200507.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130416/7200507.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,230 @@
+# 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());
++        }
++    }
++}

Added: trunk/java/openjdk6/files/icedtea/security/20130416/8000724.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130416/8000724.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130416/8000724.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,1368 @@
+# HG changeset patch
+# User andrew
+# Date 1365736051 -3600
+# Node ID a5bbb8808ac9a6a8e20c5f267044bb0cef0bbdc1
+# Parent  a98937f9777091ef36ec58b79962336d2b1ae538
+8000724: Improve networking serialization
+Summary: delegate InetAddress fields to a holder object
+Reviewed-by: alanb, chegar
+
+diff --git a/src/share/classes/java/net/AbstractPlainDatagramSocketImpl.java b/src/share/classes/java/net/AbstractPlainDatagramSocketImpl.java
+--- jdk/src/share/classes/java/net/AbstractPlainDatagramSocketImpl.java
++++ jdk/src/share/classes/java/net/AbstractPlainDatagramSocketImpl.java
+@@ -114,7 +114,7 @@
+      * not connected already.
+      */
+     protected void disconnect() {
+-        disconnect0(connectedAddress.family);
++        disconnect0(connectedAddress.holder().getFamily());
+         connected = false;
+         connectedAddress = null;
+         connectedPort = -1;
+diff --git a/src/share/classes/java/net/Inet4Address.java b/src/share/classes/java/net/Inet4Address.java
+--- jdk/src/share/classes/java/net/Inet4Address.java
++++ jdk/src/share/classes/java/net/Inet4Address.java
+@@ -102,27 +102,28 @@
+ 
+     Inet4Address() {
+         super();
+-        hostName = null;
+-        address = 0;
+-        family = IPv4;
++        holder().hostName = null;
++        holder().address = 0;
++        holder().family = IPv4;
+     }
+ 
+     Inet4Address(String hostName, byte addr[]) {
+-        this.hostName = hostName;
+-        this.family = IPv4;
++        holder().hostName = hostName;
++        holder().family = IPv4;
+         if (addr != null) {
+             if (addr.length == INADDRSZ) {
+-                address  = addr[3] & 0xFF;
++                int address  = addr[3] & 0xFF;
+                 address |= ((addr[2] << 8) & 0xFF00);
+                 address |= ((addr[1] << 16) & 0xFF0000);
+                 address |= ((addr[0] << 24) & 0xFF000000);
++                holder().address = address;
+             }
+         }
+     }
+     Inet4Address(String hostName, int address) {
+-        this.hostName = hostName;
+-        this.family = IPv4;
+-        this.address = address;
++        holder().hostName = hostName;
++        holder().family = IPv4;
++        holder().address = address;
+     }
+ 
+     /**
+@@ -136,8 +137,8 @@
+     private Object writeReplace() throws ObjectStreamException {
+         // will replace the to be serialized 'this' object
+         InetAddress inet = new InetAddress();
+-        inet.hostName = this.hostName;
+-        inet.address = this.address;
++        inet.holder().hostName = holder().getHostName();
++        inet.holder().address = holder().getAddress();
+ 
+         /**
+          * Prior to 1.4 an InetAddress was created with a family
+@@ -145,7 +146,7 @@
+          * For compatibility reasons we must therefore write the
+          * the InetAddress with this family.
+          */
+-        inet.family = 2;
++        inet.holder().family = 2;
+ 
+         return inet;
+     }
+@@ -159,7 +160,7 @@
+      * @since   JDK1.1
+      */
+     public boolean isMulticastAddress() {
+-        return ((address & 0xf0000000) == 0xe0000000);
++        return ((holder().getAddress() & 0xf0000000) == 0xe0000000);
+     }
+ 
+     /**
+@@ -169,7 +170,7 @@
+      * @since 1.4
+      */
+     public boolean isAnyLocalAddress() {
+-        return address == 0;
++        return holder().getAddress() == 0;
+     }
+ 
+     /**
+@@ -198,6 +199,7 @@
+         // defined in "Documenting Special Use IPv4 Address Blocks
+         // that have been Registered with IANA" by Bill Manning
+         // draft-manning-dsua-06.txt
++        int address = holder().getAddress();
+         return (((address >>> 24) & 0xFF) == 169)
+             && (((address >>> 16) & 0xFF) == 254);
+     }
+@@ -214,6 +216,7 @@
+         // 10/8 prefix
+         // 172.16/12 prefix
+         // 192.168/16 prefix
++        int address = holder().getAddress();
+         return (((address >>> 24) & 0xFF) == 10)
+             || ((((address >>> 24) & 0xFF) == 172)
+                 && (((address >>> 16) & 0xF0) == 16))
+@@ -260,6 +263,7 @@
+      */
+     public boolean isMCLinkLocal() {
+         // 224.0.0/24 prefix and ttl == 1
++        int address = holder().getAddress();
+         return (((address >>> 24) & 0xFF) == 224)
+             && (((address >>> 16) & 0xFF) == 0)
+             && (((address >>> 8) & 0xFF) == 0);
+@@ -275,6 +279,7 @@
+      */
+     public boolean isMCSiteLocal() {
+         // 239.255/16 prefix or ttl < 32
++        int address = holder().getAddress();
+         return (((address >>> 24) & 0xFF) == 239)
+             && (((address >>> 16) & 0xFF) == 255);
+     }
+@@ -290,6 +295,7 @@
+      */
+     public boolean isMCOrgLocal() {
+         // 239.192 - 239.195
++        int address = holder().getAddress();
+         return (((address >>> 24) & 0xFF) == 239)
+             && (((address >>> 16) & 0xFF) >= 192)
+             && (((address >>> 16) & 0xFF) <= 195);
+@@ -303,6 +309,7 @@
+      * @return  the raw IP address of this object.
+      */
+     public byte[] getAddress() {
++        int address = holder().getAddress();
+         byte[] addr = new byte[INADDRSZ];
+ 
+         addr[0] = (byte) ((address >>> 24) & 0xFF);
+@@ -328,7 +335,7 @@
+      * @return  a hash code value for this IP address.
+      */
+     public int hashCode() {
+-        return address;
++        return holder().getAddress();
+     }
+ 
+     /**
+@@ -349,7 +356,7 @@
+      */
+     public boolean equals(Object obj) {
+         return (obj != null) && (obj instanceof Inet4Address) &&
+-            (((InetAddress)obj).address == address);
++            (((InetAddress)obj).holder().getAddress() == holder().getAddress());
+     }
+ 
+     // Utilities
+diff --git a/src/share/classes/java/net/Inet4AddressImpl.java b/src/share/classes/java/net/Inet4AddressImpl.java
+--- jdk/src/share/classes/java/net/Inet4AddressImpl.java
++++ jdk/src/share/classes/java/net/Inet4AddressImpl.java
+@@ -40,7 +40,7 @@
+     public synchronized InetAddress anyLocalAddress() {
+         if (anyLocalAddress == null) {
+             anyLocalAddress = new Inet4Address(); // {0x00,0x00,0x00,0x00}
+-            anyLocalAddress.hostName = "0.0.0.0";
++            anyLocalAddress.holder().hostName = "0.0.0.0";
+         }
+         return anyLocalAddress;
+     }
+diff --git a/src/share/classes/java/net/Inet6Address.java b/src/share/classes/java/net/Inet6Address.java
+--- jdk/src/share/classes/java/net/Inet6Address.java
++++ jdk/src/share/classes/java/net/Inet6Address.java
+@@ -216,18 +216,18 @@
+ 
+     Inet6Address() {
+         super();
+-        hostName = null;
++        holder().hostName = null;
+         ipaddress = new byte[INADDRSZ];
+-        family = IPv6;
++        holder().family = IPv6;
+     }
+ 
+     /* checking of value for scope_id should be done by caller
+      * scope_id must be >= 0, or -1 to indicate not being set
+      */
+     Inet6Address(String hostName, byte addr[], int scope_id) {
+-        this.hostName = hostName;
++        holder().hostName = hostName;
+         if (addr.length == INADDRSZ) { // normal IPv6 address
+-            family = IPv6;
++            holder().family = IPv6;
+             ipaddress = addr.clone();
+         }
+         if (scope_id >= 0) {
+@@ -328,9 +328,9 @@
+     }
+ 
+     private void initif(String hostName, byte addr[],NetworkInterface nif) throws UnknownHostException {
+-        this.hostName = hostName;
++        holder().hostName = hostName;
+         if (addr.length == INADDRSZ) { // normal IPv6 address
+-            family = IPv6;
++            holder().family = IPv6;
+             ipaddress = addr.clone();
+         }
+         if (nif != null) {
+@@ -415,6 +415,11 @@
+         throws IOException, ClassNotFoundException {
+         scope_ifname = null;
+         scope_ifname_set = false;
++
++        if (getClass().getClassLoader() != null) {
++            throw new SecurityException ("invalid address type");
++        }
++
+         s.defaultReadObject();
+ 
+         if (ifname != null && !"".equals (ifname)) {
+@@ -446,7 +451,7 @@
+                                              ipaddress.length);
+         }
+ 
+-        if (family != IPv6) {
++        if (holder().getFamily() != IPv6) {
+             throw new InvalidObjectException("invalid address family type");
+         }
+     }
+diff --git a/src/share/classes/java/net/Inet6AddressImpl.java b/src/share/classes/java/net/Inet6AddressImpl.java
+--- jdk/src/share/classes/java/net/Inet6AddressImpl.java
++++ jdk/src/share/classes/java/net/Inet6AddressImpl.java
+@@ -81,7 +81,7 @@
+         if (anyLocalAddress == null) {
+             if (InetAddress.preferIPv6Address) {
+                 anyLocalAddress = new Inet6Address();
+-                anyLocalAddress.hostName = "::";
++                anyLocalAddress.holder().hostName = "::";
+             } else {
+                 anyLocalAddress = (new Inet4AddressImpl()).anyLocalAddress();
+             }
+diff --git a/src/share/classes/java/net/InetAddress.java b/src/share/classes/java/net/InetAddress.java
+--- jdk/src/share/classes/java/net/InetAddress.java
++++ jdk/src/share/classes/java/net/InetAddress.java
+@@ -34,8 +34,12 @@
+ import java.util.ArrayList;
+ import java.security.AccessController;
+ import java.io.ObjectStreamException;
++import java.io.ObjectStreamField;
+ import java.io.IOException;
+ import java.io.ObjectInputStream;
++import java.io.ObjectInputStream.GetField;
++import java.io.ObjectOutputStream;
++import java.io.ObjectOutputStream.PutField;
+ import sun.security.action.*;
+ import sun.net.InetAddressCachePolicy;
+ import sun.net.util.IPAddressUtil;
+@@ -196,25 +200,47 @@
+     /* Specify address family preference */
+     static transient boolean preferIPv6Address = false;
+ 
+-    /**
+-     * @serial
+-     */
+-    String hostName;
++    static class InetAddressHolder {
+ 
+-    /**
+-     * Holds a 32-bit IPv4 address.
+-     *
+-     * @serial
+-     */
+-    int address;
++        InetAddressHolder() {}
+ 
+-    /**
+-     * Specifies the address family type, for instance, '1' for IPv4
+-     * addresses, and '2' for IPv6 addresses.
+-     *
+-     * @serial
+-     */
+-    int family;
++        InetAddressHolder(String hostName, int address, int family) {
++            this.hostName = hostName;
++            this.address = address;
++            this.family = family;
++        }
++
++        String hostName;
++
++        String getHostName() {
++            return hostName;
++        }
++
++        /**
++         * Holds a 32-bit IPv4 address.
++         */
++        int address;
++
++        int getAddress() {
++            return address;
++        }
++
++        /**
++         * Specifies the address family type, for instance, '1' for IPv4
++         * addresses, and '2' for IPv6 addresses.
++         */
++        int family;
++
++        int getFamily() {
++            return family;
++        }
++    }
++
++    final transient InetAddressHolder holder;
++
++    InetAddressHolder holder() {
++        return holder;
++    }
+ 
+     /* Used to store the name service provider */
+     private static List<NameService> nameServices = null;
+@@ -242,6 +268,7 @@
+      * put in the address cache, since it is not created by name.
+      */
+     InetAddress() {
++        holder = new InetAddressHolder();
+     }
+ 
+     /**
+@@ -254,7 +281,7 @@
+      */
+     private Object readResolve() throws ObjectStreamException {
+         // will replace the deserialized 'this' object
+-        return new Inet4Address(this.hostName, this.address);
++        return new Inet4Address(holder().getHostName(), holder().getAddress());
+     }
+ 
+     /**
+@@ -491,10 +518,10 @@
+      * @see SecurityManager#checkConnect
+      */
+     String getHostName(boolean check) {
+-        if (hostName == null) {
+-            hostName = InetAddress.getHostFromNameService(this, check);
++        if (holder().getHostName() == null) {
++            holder().hostName = InetAddress.getHostFromNameService(this, check);
+         }
+-        return hostName;
++        return holder().getHostName();
+     }
+ 
+     /**
+@@ -657,6 +684,7 @@
+      * @return  a string representation of this IP address.
+      */
+     public String toString() {
++        String hostName = holder().getHostName();
+         return ((hostName != null) ? hostName : "")
+             + "/" + getHostAddress();
+     }
+@@ -1500,14 +1528,58 @@
+         }
+     }
+ 
++    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(
++                InetAddress.class.getDeclaredField("holder")
++            );
++            UNSAFE = unsafe;
++        } catch (NoSuchFieldException e) {
++            throw new Error(e);
++        }
++    }
++
+     private void readObject (ObjectInputStream s) throws
+                          IOException, ClassNotFoundException {
+-        s.defaultReadObject ();
+         if (getClass().getClassLoader() != null) {
+-            hostName = null;
+-            address = 0;
+             throw new SecurityException ("invalid address type");
+         }
++        GetField gf = s.readFields();
++        String host = (String)gf.get("hostName", null);
++        int address= gf.get("address", 0);
++        int family= gf.get("family", 0);
++        InetAddressHolder h = new InetAddressHolder(host, address, family);
++        UNSAFE.putObject(this, FIELDS_OFFSET, h);
++    }
++
++    /* needed because the serializable fields no longer exist */
++
++    /**
++     * @serialField hostName String
++     * @serialField address int
++     * @serialField family int
++     */
++    private static final ObjectStreamField[] serialPersistentFields = {
++        new ObjectStreamField("hostName", String.class),
++        new ObjectStreamField("address", int.class),
++        new ObjectStreamField("family", int.class),
++    };
++
++    private void writeObject (ObjectOutputStream s) throws
++                        IOException {
++        if (getClass().getClassLoader() != null) {
++            throw new SecurityException ("invalid address type");
++        }
++        PutField pf = s.putFields();
++        pf.put("hostName", holder().hostName);
++        pf.put("address", holder().address);
++        pf.put("family", holder().family);
++        s.writeFields();
++        s.flush();
+     }
+ }
+ 
+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
+@@ -87,8 +87,8 @@
+             if (hostname != null)
+                 return hostname;
+             if (addr != null) {
+-                if (addr.hostName != null)
+-                    return addr.hostName;
++                if (addr.holder().getHostName() != null)
++                    return addr.holder().getHostName();
+                 else
+                     return addr.getHostAddress();
+             }
+diff --git a/src/share/native/java/net/InetAddress.c b/src/share/native/java/net/InetAddress.c
+--- jdk/src/share/native/java/net/InetAddress.c
++++ jdk/src/share/native/java/net/InetAddress.c
+@@ -33,8 +33,11 @@
+  */
+ 
+ jclass ia_class;
+-jfieldID ia_addressID;
+-jfieldID ia_familyID;
++jclass iac_class;
++jfieldID ia_holderID;
++jfieldID iac_addressID;
++jfieldID iac_familyID;
++jfieldID iac_hostNameID;
+ jfieldID ia_preferIPv6AddressID;
+ 
+ /*
+@@ -48,10 +51,18 @@
+     CHECK_NULL(c);
+     ia_class = (*env)->NewGlobalRef(env, c);
+     CHECK_NULL(ia_class);
+-    ia_addressID = (*env)->GetFieldID(env, ia_class, "address", "I");
+-    CHECK_NULL(ia_addressID);
+-    ia_familyID = (*env)->GetFieldID(env, ia_class, "family", "I");
+-    CHECK_NULL(ia_familyID);
++    c = (*env)->FindClass(env,"java/net/InetAddress$InetAddressHolder");
++    CHECK_NULL(c);
++    iac_class = (*env)->NewGlobalRef(env, c);
++    ia_holderID = (*env)->GetFieldID(env, ia_class, "holder", "Ljava/net/InetAddress$InetAddressHolder;");
++    CHECK_NULL(ia_holderID);
+     ia_preferIPv6AddressID = (*env)->GetStaticFieldID(env, ia_class, "preferIPv6Address", "Z");
+     CHECK_NULL(ia_preferIPv6AddressID);
++
++    iac_addressID = (*env)->GetFieldID(env, iac_class, "address", "I");
++    CHECK_NULL(iac_addressID);
++    iac_familyID = (*env)->GetFieldID(env, iac_class, "family", "I");
++    CHECK_NULL(iac_familyID);
++    iac_hostNameID = (*env)->GetFieldID(env, iac_class, "hostName", "Ljava/lang/String;");
++    CHECK_NULL(iac_hostNameID);
+ }
+diff --git a/src/share/native/java/net/net_util.c b/src/share/native/java/net/net_util.c
+--- jdk/src/share/native/java/net/net_util.c
++++ jdk/src/share/native/java/net/net_util.c
+@@ -84,6 +84,58 @@
+     }
+ }
+ 
++/* The address, and family fields used to be in InetAddress
++ * but are now in an implementation object. So, there is an extra
++ * level of indirection to access them now.
++ */
++
++extern jclass iac_class;
++extern jfieldID ia_holderID;
++extern jfieldID iac_addressID;
++extern jfieldID iac_familyID;
++
++void setInetAddress_addr(JNIEnv *env, jobject iaObj, int address) {
++    jobject holder;
++    init(env);
++    holder = (*env)->GetObjectField(env, iaObj, ia_holderID);
++    (*env)->SetIntField(env, holder, iac_addressID, address);
++}
++
++void setInetAddress_family(JNIEnv *env, jobject iaObj, int family) {
++    jobject holder;
++    init(env);
++    holder = (*env)->GetObjectField(env, iaObj, ia_holderID);
++    (*env)->SetIntField(env, holder, iac_familyID, family);
++}
++
++void setInetAddress_hostName(JNIEnv *env, jobject iaObj, jobject host) {
++    jobject holder;
++    init(env);
++    holder = (*env)->GetObjectField(env, iaObj, ia_holderID);
++    (*env)->SetObjectField(env, holder, iac_hostNameID, host);
++}
++
++int getInetAddress_addr(JNIEnv *env, jobject iaObj) {
++    jobject holder;
++    init(env);
++    holder = (*env)->GetObjectField(env, iaObj, ia_holderID);
++    return (*env)->GetIntField(env, holder, iac_addressID);
++}
++
++int getInetAddress_family(JNIEnv *env, jobject iaObj) {
++    jobject holder;
++    init(env);
++    holder = (*env)->GetObjectField(env, iaObj, ia_holderID);
++    return (*env)->GetIntField(env, holder, iac_familyID);
++}
++
++jobject getInetAddress_hostName(JNIEnv *env, jobject iaObj) {
++    jobject holder;
++    init(env);
++    holder = (*env)->GetObjectField(env, iaObj, ia_holderID);
++    return (*env)->GetObjectField(env, holder, iac_hostNameID);
++}
++
+ jobject
+ NET_SockaddrToInetAddress(JNIEnv *env, struct sockaddr *him, int *port) {
+     jobject iaObj;
+@@ -110,8 +162,8 @@
+             iaObj = (*env)->NewObject(env, inet4Cls, ia4_ctrID);
+             CHECK_NULL_RETURN(iaObj, NULL);
+             address = NET_IPv4MappedToIPv4(caddr);
+-            (*env)->SetIntField(env, iaObj, ia_addressID, address);
+-            (*env)->SetIntField(env, iaObj, ia_familyID, IPv4);
++            setInetAddress_addr(env, iaObj, address);
++            setInetAddress_family(env, iaObj, IPv4);
+         } else {
+             static jclass inet6Cls = 0;
+             if (inet6Cls == 0) {
+@@ -130,7 +182,7 @@
+ 
+             (*env)->SetObjectField(env, iaObj, ia6_ipaddressID, ipaddress);
+ 
+-            (*env)->SetIntField(env, iaObj, ia_familyID, IPv6);
++            setInetAddress_family(env, iaObj, IPv6);
+             (*env)->SetIntField(env, iaObj, ia6_scopeidID, getScopeID(him));
+         }
+         *port = ntohs(him6->sin6_port);
+@@ -149,9 +201,8 @@
+             }
+             iaObj = (*env)->NewObject(env, inet4Cls, ia4_ctrID);
+             CHECK_NULL_RETURN(iaObj, NULL);
+-            (*env)->SetIntField(env, iaObj, ia_familyID, IPv4);
+-            (*env)->SetIntField(env, iaObj, ia_addressID,
+-                                ntohl(him4->sin_addr.s_addr));
++            setInetAddress_family(env, iaObj, IPv4);
++            setInetAddress_addr(env, iaObj, ntohl(him4->sin_addr.s_addr));
+             *port = ntohs(him4->sin_port);
+         }
+     return iaObj;
+@@ -160,8 +211,7 @@
+ jint
+ NET_SockaddrEqualsInetAddress(JNIEnv *env, struct sockaddr *him, jobject iaObj)
+ {
+-    jint family = (*env)->GetIntField(env, iaObj, ia_familyID) == IPv4?
+-        AF_INET : AF_INET6;
++    jint family = getInetAddress_family(env, iaObj) == IPv4?AF_INET : AF_INET6;
+ 
+ #ifdef AF_INET6
+     if (him->sa_family == AF_INET6) {
+@@ -178,7 +228,7 @@
+                 return JNI_FALSE;
+             }
+             addrNew = NET_IPv4MappedToIPv4(caddrNew);
+-            addrCur = (*env)->GetIntField(env, iaObj, ia_addressID);
++            addrCur = getInetAddress_addr(env, iaObj);
+             if (addrNew == addrCur) {
+                 return JNI_TRUE;
+             } else {
+@@ -210,7 +260,7 @@
+                 return JNI_FALSE;
+             }
+             addrNew = ntohl(him4->sin_addr.s_addr);
+-            addrCur = (*env)->GetIntField(env, iaObj, ia_addressID);
++            addrCur = getInetAddress_addr(env, iaObj);
+             if (addrNew == addrCur) {
+                 return JNI_TRUE;
+             } else {
+diff --git a/src/share/native/java/net/net_util.h b/src/share/native/java/net/net_util.h
+--- jdk/src/share/native/java/net/net_util.h
++++ jdk/src/share/native/java/net/net_util.h
+@@ -53,10 +53,18 @@
+  * i.e. psi_timeoutID is PlainSocketImpl's timeout field's ID.
+  */
+ extern jclass ia_class;
+-extern jfieldID ia_addressID;
+-extern jfieldID ia_familyID;
++extern jfieldID iac_addressID;
++extern jfieldID iac_familyID;
++extern jfieldID iac_hostNameID;
+ extern jfieldID ia_preferIPv6AddressID;
+ 
++extern void setInetAddress_addr(JNIEnv *env, jobject iaObj, int address);
++extern void setInetAddress_family(JNIEnv *env, jobject iaObj, int family);
++extern void setInetAddress_hostName(JNIEnv *env, jobject iaObj, jobject h);
++extern int getInetAddress_addr(JNIEnv *env, jobject iaObj);
++extern int getInetAddress_family(JNIEnv *env, jobject iaObj);
++extern jobject getInetAddress_hostName(JNIEnv *env, jobject iaObj);
++
+ extern jclass ia4_class;
+ extern jmethodID ia4_ctrID;
+ 
+diff --git a/src/solaris/native/java/net/Inet4AddressImpl.c b/src/solaris/native/java/net/Inet4AddressImpl.c
+--- jdk/src/solaris/native/java/net/Inet4AddressImpl.c
++++ jdk/src/solaris/native/java/net/Inet4AddressImpl.c
+@@ -118,9 +118,6 @@
+ static jclass ni_iacls;
+ static jclass ni_ia4cls;
+ static jmethodID ni_ia4ctrID;
+-static jfieldID ni_iaaddressID;
+-static jfieldID ni_iahostID;
+-static jfieldID ni_iafamilyID;
+ static int initialized = 0;
+ 
+ /*
+@@ -153,9 +150,6 @@
+       ni_ia4cls = (*env)->FindClass(env, "java/net/Inet4Address");
+       ni_ia4cls = (*env)->NewGlobalRef(env, ni_ia4cls);
+       ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V");
+-      ni_iaaddressID = (*env)->GetFieldID(env, ni_iacls, "address", "I");
+-      ni_iafamilyID = (*env)->GetFieldID(env, ni_iacls, "family", "I");
+-      ni_iahostID = (*env)->GetFieldID(env, ni_iacls, "hostName", "Ljava/lang/String;");
+       initialized = 1;
+     }
+ 
+@@ -229,9 +223,8 @@
+             ret = NULL;
+             goto cleanupAndReturn;
+           }
+-          (*env)->SetIntField(env, iaObj, ni_iaaddressID,
+-                              ntohl((*addrp)->s_addr));
+-          (*env)->SetObjectField(env, iaObj, ni_iahostID, name);
++          setInetAddress_addr(env, iaObj, ntohl((*addrp)->s_addr));
++	  setInetAddress_hostName(env, iaObj, name);
+           (*env)->SetObjectArrayElement(env, ret, i, iaObj);
+           addrp++;
+           i++;
+diff --git a/src/solaris/native/java/net/Inet6AddressImpl.c b/src/solaris/native/java/net/Inet6AddressImpl.c
+--- jdk/src/solaris/native/java/net/Inet6AddressImpl.c
++++ jdk/src/solaris/native/java/net/Inet6AddressImpl.c
+@@ -120,9 +120,6 @@
+ static jclass ni_ia6cls;
+ static jmethodID ni_ia4ctrID;
+ static jmethodID ni_ia6ctrID;
+-static jfieldID ni_iaaddressID;
+-static jfieldID ni_iahostID;
+-static jfieldID ni_iafamilyID;
+ static jfieldID ni_ia6ipaddressID;
+ static int initialized = 0;
+ 
+@@ -161,9 +158,6 @@
+       ni_ia6cls = (*env)->NewGlobalRef(env, ni_ia6cls);
+       ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V");
+       ni_ia6ctrID = (*env)->GetMethodID(env, ni_ia6cls, "<init>", "()V");
+-      ni_iaaddressID = (*env)->GetFieldID(env, ni_iacls, "address", "I");
+-      ni_iafamilyID = (*env)->GetFieldID(env, ni_iacls, "family", "I");
+-      ni_iahostID = (*env)->GetFieldID(env, ni_iacls, "hostName", "Ljava/lang/String;");
+       ni_ia6ipaddressID = (*env)->GetFieldID(env, ni_ia6cls, "ipaddress", "[B");
+       initialized = 1;
+     }
+@@ -322,9 +316,8 @@
+                   ret = NULL;
+                   goto cleanupAndReturn;
+                 }
+-                (*env)->SetIntField(env, iaObj, ni_iaaddressID,
+-                                    ntohl(((struct sockaddr_in*)iterator->ai_addr)->sin_addr.s_addr));
+-                (*env)->SetObjectField(env, iaObj, ni_iahostID, name);
++                setInetAddress_addr(env, iaObj, ntohl(((struct sockaddr_in*)iterator->ai_addr)->sin_addr.s_addr));
++                setInetAddress_hostName(env, iaObj, name);
+                 (*env)->SetObjectArrayElement(env, ret, inetIndex, iaObj);
+                 inetIndex++;
+               } else if (iterator->ai_family == AF_INET6) {
+@@ -355,7 +348,7 @@
+                   (*env)->SetBooleanField(env, iaObj, ia6_scopeidsetID, JNI_TRUE);
+                 }
+                 (*env)->SetObjectField(env, iaObj, ni_ia6ipaddressID, ipaddress);
+-                (*env)->SetObjectField(env, iaObj, ni_iahostID, name);
++                setInetAddress_hostName(env, iaObj, name);
+                 (*env)->SetObjectArrayElement(env, ret, inet6Index, iaObj);
+                 inet6Index++;
+               }
+diff --git a/src/solaris/native/java/net/NetworkInterface.c b/src/solaris/native/java/net/NetworkInterface.c
+--- jdk/src/solaris/native/java/net/NetworkInterface.c
++++ jdk/src/solaris/native/java/net/NetworkInterface.c
+@@ -101,8 +101,6 @@
+ static jmethodID ni_ia4ctrID;
+ static jmethodID ni_ia6ctrID;
+ static jmethodID ni_ibctrID;
+-static jfieldID ni_iaaddressID;
+-static jfieldID ni_iafamilyID;
+ static jfieldID ni_ia6ipaddressID;
+ static jfieldID ni_ibaddressID;
+ static jfieldID ni_ib4broadcastID;
+@@ -153,8 +151,6 @@
+     ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V");
+     ni_ia6ctrID = (*env)->GetMethodID(env, ni_ia6cls, "<init>", "()V");
+     ni_ibctrID = (*env)->GetMethodID(env, ni_ibcls, "<init>", "()V");
+-    ni_iaaddressID = (*env)->GetFieldID(env, ni_iacls, "address", "I");
+-    ni_iafamilyID = (*env)->GetFieldID(env, ni_iacls, "family", "I");
+     ni_ia6ipaddressID = (*env)->GetFieldID(env, ni_ia6cls, "ipaddress", "[B");
+     ni_ibaddressID = (*env)->GetFieldID(env, ni_ibcls, "address", "Ljava/net/InetAddress;");
+     ni_ib4broadcastID = (*env)->GetFieldID(env, ni_ibcls, "broadcast", "Ljava/net/Inet4Address;");
+@@ -253,8 +249,7 @@
+     (JNIEnv *env, jclass cls, jobject iaObj) {
+ 
+     netif *ifs, *curr;
+-    int family = (*env)->GetIntField(env, iaObj, ni_iafamilyID) == IPv4?
+-        AF_INET : AF_INET6;
++    int family = (getInetAddress_family(env, iaObj) == IPv4) ? AF_INET : AF_INET6;
+     jobject obj = NULL;
+     jboolean match = JNI_FALSE;
+ 
+@@ -275,7 +270,7 @@
+             if (family == addrP->family) {
+                 if (family == AF_INET) {
+                     int address1 = htonl(((struct sockaddr_in*)addrP->addr)->sin_addr.s_addr);
+-                    int address2 = (*env)->GetIntField(env, iaObj, ni_iaaddressID);
++                    int address2 = getInetAddress_addr(env, iaObj);
+ 
+                     if (address1 == address2) {
+                         match = JNI_TRUE;
+@@ -450,8 +445,7 @@
+         if (addrP->family == AF_INET) {
+             iaObj = (*env)->NewObject(env, ni_ia4cls, ni_ia4ctrID);
+             if (iaObj) {
+-                 (*env)->SetIntField(env, iaObj, ni_iaaddressID,
+-                     htonl(((struct sockaddr_in*)addrP->addr)->sin_addr.s_addr));
++                 setInetAddress_addr(env, iaObj, htonl(((struct sockaddr_in*)addrP->addr)->sin_addr.s_addr));
+             }
+             ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID);
+             if (ibObj) {
+@@ -460,8 +454,7 @@
+                 jobject ia2Obj = NULL;
+                 ia2Obj = (*env)->NewObject(env, ni_ia4cls, ni_ia4ctrID);
+                 if (ia2Obj) {
+-                  (*env)->SetIntField(env, ia2Obj, ni_iaaddressID,
+-                                      htonl(((struct sockaddr_in*)addrP->brdcast)->sin_addr.s_addr));
++		  setInetAddress_addr(env, ia2Obj, htonl(((struct sockaddr_in*)addrP->brdcast)->sin_addr.s_addr));
+                   (*env)->SetObjectField(env, ibObj, ni_ib4broadcastID, ia2Obj);
+                   (*env)->SetShortField(env, ibObj, ni_ib4maskID, addrP->mask);
+                 }
+diff --git a/src/solaris/native/java/net/PlainDatagramSocketImpl.c b/src/solaris/native/java/net/PlainDatagramSocketImpl.c
+--- jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
++++ jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
+@@ -610,11 +610,10 @@
+     }
+ 
+     iaObj = NET_SockaddrToInetAddress(env, (struct sockaddr *)&remote_addr, &port);
+-    family = (*env)->GetIntField(env, iaObj, ia_familyID) == IPv4?
+-        AF_INET : AF_INET6;
++    family = getInetAddress_family(env, iaObj) == IPv4? AF_INET : AF_INET6;
+     if (family == AF_INET) { /* this api can't handle IPV6 addresses */
+-        int address = (*env)->GetIntField(env, iaObj, ia_addressID);
+-        (*env)->SetIntField(env, addressObj, ia_addressID, address);
++        int address = getInetAddress_addr(env, iaObj);
++        setInetAddress_addr(env, addressObj, address);
+     }
+     return port;
+ }
+@@ -1142,7 +1141,6 @@
+  */
+ static void mcast_set_if_by_if_v4(JNIEnv *env, jobject this, int fd, jobject value) {
+     static jfieldID ni_addrsID;
+-    static jfieldID ia_addressID;
+     struct in_addr in;
+     jobjectArray addrArray;
+     jsize len;
+@@ -1155,10 +1153,6 @@
+         ni_addrsID = (*env)->GetFieldID(env, c, "addrs",
+                                         "[Ljava/net/InetAddress;");
+         CHECK_NULL(ni_addrsID);
+-        c = (*env)->FindClass(env,"java/net/InetAddress");
+-        CHECK_NULL(c);
+-        ia_addressID = (*env)->GetFieldID(env, c, "address", "I");
+-        CHECK_NULL(ia_addressID);
+     }
+ 
+     addrArray = (*env)->GetObjectField(env, value, ni_addrsID);
+@@ -1179,8 +1173,8 @@
+      */
+     for (i = 0; i < len; i++) {
+         addr = (*env)->GetObjectArrayElement(env, addrArray, i);
+-        if ((*env)->GetIntField(env, addr, ia_familyID) == IPv4) {
+-            in.s_addr = htonl((*env)->GetIntField(env, addr, ia_addressID));
++        if (getInetAddress_family(env, addr) == IPv4) {
++            in.s_addr = htonl(getInetAddress_addr(env, addr));
+             break;
+         }
+     }
+@@ -1238,17 +1232,9 @@
+  * Throw exception if failed.
+  */
+ static void mcast_set_if_by_addr_v4(JNIEnv *env, jobject this, int fd, jobject value) {
+-    static jfieldID ia_addressID;
+     struct in_addr in;
+ 
+-    if (ia_addressID == NULL) {
+-        jclass c = (*env)->FindClass(env,"java/net/InetAddress");
+-        CHECK_NULL(c);
+-        ia_addressID = (*env)->GetFieldID(env, c, "address", "I");
+-        CHECK_NULL(ia_addressID);
+-    }
+-
+-    in.s_addr = htonl( (*env)->GetIntField(env, value, ia_addressID) );
++    in.s_addr = htonl( getInetAddress_addr(env, value) );
+ 
+     if (JVM_SetSockOpt(fd, IPPROTO_IP, IP_MULTICAST_IF,
+                        (const char*)&in, sizeof(in)) < 0) {
+@@ -1583,7 +1569,6 @@
+     if (isIPV4) {
+         static jclass inet4_class;
+         static jmethodID inet4_ctrID;
+-        static jfieldID inet4_addrID;
+ 
+         static jclass ni_class;
+         static jmethodID ni_ctrID;
+@@ -1621,8 +1606,6 @@
+             CHECK_NULL_RETURN(c, NULL);
+             inet4_ctrID = (*env)->GetMethodID(env, c, "<init>", "()V");
+             CHECK_NULL_RETURN(inet4_ctrID, NULL);
+-            inet4_addrID = (*env)->GetFieldID(env, c, "address", "I");
+-            CHECK_NULL_RETURN(inet4_addrID, NULL);
+             inet4_class = (*env)->NewGlobalRef(env, c);
+             CHECK_NULL_RETURN(inet4_class, NULL);
+         }
+@@ -1630,10 +1613,10 @@
+         CHECK_NULL_RETURN(addr, NULL);
+ 
+ #ifdef __linux__
+-        (*env)->SetIntField(env, addr, inet4_addrID,
+-                (isOldKernel ? ntohl(mreqn.imr_address.s_addr) : ntohl(in.s_addr)) );
++        setInetAddress_addr(env, addr, (isOldKernel ?
++                ntohl(mreqn.imr_address.s_addr) : ntohl(in.s_addr)));
+ #else
+-        (*env)->SetIntField(env, addr, inet4_addrID, ntohl(in.s_addr));
++        setInetAddress_addr(env, addr, ntohl(in.s_addr));
+ #endif
+ 
+         /*
+@@ -2112,7 +2095,7 @@
+     ipv6_join_leave = ipv6_available();
+ 
+ #ifdef __linux__
+-    if ((*env)->GetIntField(env, iaObj, ia_familyID) == IPv4) {
++    if (getInetAddress_family(env, iaObj) == IPv4) {
+         ipv6_join_leave = JNI_FALSE;
+     }
+ #endif
+@@ -2159,7 +2142,7 @@
+                     CHECK_NULL(ni_indexID);
+                 }
+ 
+-                mname.imr_multiaddr.s_addr = htonl((*env)->GetIntField(env, iaObj, ia_addressID));
++                mname.imr_multiaddr.s_addr = htonl(getInetAddress_addr(env, iaObj));
+                 mname.imr_address.s_addr = 0;
+                 mname.imr_ifindex =  (*env)->GetIntField(env, niObj, ni_indexID);
+                 mname_len = sizeof(struct ip_mreqn);
+@@ -2177,11 +2160,11 @@
+                 }
+                 addr = (*env)->GetObjectArrayElement(env, addrArray, 0);
+ 
+-                mname.imr_multiaddr.s_addr = htonl((*env)->GetIntField(env, iaObj, ia_addressID));
++                mname.imr_multiaddr.s_addr = htonl(getInetAddress_addr(env, iaObj));
+ #ifdef __linux__
+-                mname.imr_address.s_addr = htonl((*env)->GetIntField(env, addr, ia_addressID));
++                mname.imr_address.s_addr = htonl(getInetAddress_addr(env, addr));
+ #else
+-                mname.imr_interface.s_addr = htonl((*env)->GetIntField(env, addr, ia_addressID));
++                mname.imr_interface.s_addr = htonl(getInetAddress_addr(env, addr));
+ #endif
+                 mname_len = sizeof(struct ip_mreq);
+             }
+@@ -2220,7 +2203,7 @@
+                     }
+                 }
+ 
+-                mname.imr_multiaddr.s_addr = htonl((*env)->GetIntField(env, iaObj, ia_addressID));
++                mname.imr_multiaddr.s_addr = htonl(getInetAddress_addr(env, iaObj));
+                 mname.imr_address.s_addr = 0 ;
+                 mname.imr_ifindex = index;
+                 mname_len = sizeof(struct ip_mreqn);
+@@ -2250,7 +2233,7 @@
+ #else
+                 mname.imr_interface.s_addr = in.s_addr;
+ #endif
+-                mname.imr_multiaddr.s_addr = htonl((*env)->GetIntField(env, iaObj, ia_addressID));
++                mname.imr_multiaddr.s_addr = htonl(getInetAddress_addr(env, iaObj));
+                 mname_len = sizeof(struct ip_mreq);
+             }
+         }
+@@ -2315,10 +2298,10 @@
+         jbyte caddr[16];
+         jint family;
+         jint address;
+-        family = (*env)->GetIntField(env, iaObj, ia_familyID) == IPv4? AF_INET : AF_INET6;
++        family = getInetAddress_family(env, iaObj) == IPv4? AF_INET : AF_INET6;
+         if (family == AF_INET) { /* will convert to IPv4-mapped address */
+             memset((char *) caddr, 0, 16);
+-            address = (*env)->GetIntField(env, iaObj, ia_addressID);
++            address = getInetAddress_addr(env, iaObj);
+ 
+             caddr[10] = 0xff;
+             caddr[11] = 0xff;
+diff --git a/src/solaris/native/java/net/net_util_md.c b/src/solaris/native/java/net/net_util_md.c
+--- jdk/src/solaris/native/java/net/net_util_md.c
++++ jdk/src/solaris/native/java/net/net_util_md.c
+@@ -675,7 +675,7 @@
+ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr *him,
+                           int *len, jboolean v4MappedAddress) {
+     jint family;
+-    family = (*env)->GetIntField(env, iaObj, ia_familyID);
++    family = getInetAddress_family(env, iaObj);
+ #ifdef AF_INET6
+     /* needs work. 1. family 2. clean up him6 etc deallocate memory */
+     if (ipv6_available() && !(family == IPv4 && v4MappedAddress == JNI_FALSE)) {
+@@ -687,7 +687,7 @@
+ 
+         if (family == IPv4) { /* will convert to IPv4-mapped address */
+             memset((char *) caddr, 0, 16);
+-            address = (*env)->GetIntField(env, iaObj, ia_addressID);
++            address = getInetAddress_addr(env, iaObj);
+             if (address == INADDR_ANY) {
+                 /* we would always prefer IPv6 wildcard address
+                    caddr[10] = 0xff;
+@@ -794,7 +794,7 @@
+               return -1;
+             }
+             memset((char *) him4, 0, sizeof(struct sockaddr_in));
+-            address = (*env)->GetIntField(env, iaObj, ia_addressID);
++            address = getInetAddress_addr(env, iaObj);
+             him4->sin_port = htons((short) port);
+             him4->sin_addr.s_addr = (uint32_t) htonl(address);
+             him4->sin_family = AF_INET;
+diff --git a/src/windows/native/java/net/Inet4AddressImpl.c b/src/windows/native/java/net/Inet4AddressImpl.c
+--- jdk/src/windows/native/java/net/Inet4AddressImpl.c
++++ jdk/src/windows/native/java/net/Inet4AddressImpl.c
+@@ -113,9 +113,6 @@
+ static jclass ni_iacls;
+ static jclass ni_ia4cls;
+ static jmethodID ni_ia4ctrID;
+-static jfieldID ni_iaaddressID;
+-static jfieldID ni_iahostID;
+-static jfieldID ni_iafamilyID;
+ static int initialized = 0;
+ 
+ /*
+@@ -150,9 +147,6 @@
+       ni_ia4cls = (*env)->FindClass(env, "java/net/Inet4Address");
+       ni_ia4cls = (*env)->NewGlobalRef(env, ni_ia4cls);
+       ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V");
+-      ni_iaaddressID = (*env)->GetFieldID(env, ni_iacls, "address", "I");
+-      ni_iafamilyID = (*env)->GetFieldID(env, ni_iacls, "family", "I");
+-      ni_iahostID = (*env)->GetFieldID(env, ni_iacls, "hostName", "Ljava/lang/String;");
+       initialized = 1;
+     }
+ 
+@@ -209,8 +203,7 @@
+           ret = NULL;
+           goto cleanupAndReturn;
+         }
+-        (*env)->SetIntField(env, iaObj, ni_iaaddressID,
+-                            ntohl(address));
++        setInetAddress_addr(env, iaObj, ntohl(address));
+         (*env)->SetObjectArrayElement(env, ret, 0, iaObj);
+         JNU_ReleaseStringPlatformChars(env, host, hostname);
+         return ret;
+@@ -247,9 +240,8 @@
+             ret = NULL;
+             goto cleanupAndReturn;
+           }
+-          (*env)->SetIntField(env, iaObj, ni_iaaddressID,
+-                              ntohl((*addrp)->s_addr));
+-          (*env)->SetObjectField(env, iaObj, ni_iahostID, name);
++          setInetAddress_addr(env, iaObj, ntohl((*addrp)->s_addr));
++          setInetAddress_hostName(env, iaObj, name);
+           (*env)->SetObjectArrayElement(env, ret, i, iaObj);
+           addrp++;
+           i++;
+diff --git a/src/windows/native/java/net/Inet6AddressImpl.c b/src/windows/native/java/net/Inet6AddressImpl.c
+--- jdk/src/windows/native/java/net/Inet6AddressImpl.c
++++ jdk/src/windows/native/java/net/Inet6AddressImpl.c
+@@ -76,9 +76,6 @@
+ static jclass ni_ia6cls;
+ static jmethodID ni_ia4ctrID;
+ static jmethodID ni_ia6ctrID;
+-static jfieldID ni_iaaddressID;
+-static jfieldID ni_iahostID;
+-static jfieldID ni_iafamilyID;
+ static jfieldID ni_ia6ipaddressID;
+ static int initialized = 0;
+ 
+@@ -103,9 +100,6 @@
+       ni_ia6cls = (*env)->NewGlobalRef(env, ni_ia6cls);
+       ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V");
+       ni_ia6ctrID = (*env)->GetMethodID(env, ni_ia6cls, "<init>", "()V");
+-      ni_iaaddressID = (*env)->GetFieldID(env, ni_iacls, "address", "I");
+-      ni_iafamilyID = (*env)->GetFieldID(env, ni_iacls, "family", "I");
+-      ni_iahostID = (*env)->GetFieldID(env, ni_iacls, "hostName", "Ljava/lang/String;");
+       ni_ia6ipaddressID = (*env)->GetFieldID(env, ni_ia6cls, "ipaddress", "[B");
+       initialized = 1;
+     }
+@@ -250,9 +244,8 @@
+                     ret = NULL;
+                     goto cleanupAndReturn;
+                   }
+-                  (*env)->SetIntField(env, iaObj, ni_iaaddressID,
+-                                      ntohl(((struct sockaddr_in*)iterator->ai_addr)->sin_addr.s_addr));
+-                  (*env)->SetObjectField(env, iaObj, ni_iahostID, name);
++		  setInetAddress_addr(env, iaObj, ntohl(((struct sockaddr_in*)iterator->ai_addr)->sin_addr.s_addr));
++		  setInetAddress_hostName(env, iaObj, name);
+                   (*env)->SetObjectArrayElement(env, ret, inetIndex, iaObj);
+                     inetIndex ++;
+                 } else if (iterator->ai_family == AF_INET6) {
+@@ -276,7 +269,7 @@
+                     (*env)->SetBooleanField(env, iaObj, ia6_scopeidsetID, JNI_TRUE);
+                   }
+                   (*env)->SetObjectField(env, iaObj, ni_ia6ipaddressID, ipaddress);
+-                  (*env)->SetObjectField(env, iaObj, ni_iahostID, name);
++		  setInetAddress_hostName(env, iaObj, name);
+                   (*env)->SetObjectArrayElement(env, ret, inet6Index, iaObj);
+                   inet6Index ++;
+                 }
+diff --git a/src/windows/native/java/net/NetworkInterface.c b/src/windows/native/java/net/NetworkInterface.c
+--- jdk/src/windows/native/java/net/NetworkInterface.c
++++ jdk/src/windows/native/java/net/NetworkInterface.c
+@@ -97,7 +97,6 @@
+ jfieldID ni_displayNameID;  /* NetworkInterface.displayName */
+ jfieldID ni_childsID;       /* NetworkInterface.childs */
+ jclass ni_iacls;            /* InetAddress */
+-jfieldID ni_iaAddr;         /* InetAddress.address */
+ 
+ jclass ni_ia4cls;           /* Inet4Address */
+ jmethodID ni_ia4Ctor;       /* Inet4Address() */
+@@ -558,7 +557,6 @@
+ 
+     ni_iacls = (*env)->FindClass(env, "Ljava/net/InetAddress;");
+     ni_iacls = (*env)->NewGlobalRef(env, ni_iacls);
+-    ni_iaAddr = (*env)->GetFieldID(env, ni_iacls, "address", "I");
+ 
+     ni_ia4cls = (*env)->FindClass(env, "Ljava/net/Inet4Address;");
+     ni_ia4cls = (*env)->NewGlobalRef(env, ni_ia4cls);
+@@ -645,7 +643,7 @@
+             }
+             /* default ctor will set family to AF_INET */
+ 
+-            (*env)->SetIntField(env, iaObj, ni_iaAddr, ntohl(addrs->addr.him4.sin_addr.s_addr));
++            setInetAddress_addr(env, iaObj, ntohl(addrs->addr.him4.sin_addr.s_addr));
+             if (addrs->mask != -1) {
+               ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID);
+               if (ibObj == NULL) {
+@@ -658,8 +656,7 @@
+                 free_netaddr(netaddrP);
+                 return NULL;
+               }
+-              (*env)->SetIntField(env, ia2Obj, ni_iaAddr,
+-                                  ntohl(addrs->brdcast.him4.sin_addr.s_addr));
++              setInetAddress_addr(env, ia2Obj, ntohl(addrs->brdcast.him4.sin_addr.s_addr));
+               (*env)->SetObjectField(env, ibObj, ni_ibbroadcastID, ia2Obj);
+               (*env)->SetShortField(env, ibObj, ni_ibmaskID, addrs->mask);
+               (*env)->SetObjectArrayElement(env, bindsArr, bind_index++, ibObj);
+@@ -811,7 +808,7 @@
+     (JNIEnv *env, jclass cls, jobject iaObj)
+ {
+     netif *ifList, *curr;
+-    jint addr = (*env)->GetIntField(env, iaObj, ni_iaAddr);
++    jint addr = getInetAddress_addr(env, iaObj);
+     jobject netifObj = NULL;
+ 
+     if (os_supports_ipv6 && ipv6_available()) {
+diff --git a/src/windows/native/java/net/NetworkInterface.h b/src/windows/native/java/net/NetworkInterface.h
+--- jdk/src/windows/native/java/net/NetworkInterface.h
++++ jdk/src/windows/native/java/net/NetworkInterface.h
+@@ -70,7 +70,6 @@
+ extern jfieldID ni_childsID;        /* NetworkInterface.childs */
+ 
+ extern jclass ni_iacls;             /* InetAddress */
+-extern jfieldID ni_iaAddr;          /* InetAddress.address */
+ 
+ extern jclass ni_ia4cls;            /* Inet4Address */
+ extern jmethodID ni_ia4Ctor;        /* Inet4Address() */
+diff --git a/src/windows/native/java/net/NetworkInterface_winXP.c b/src/windows/native/java/net/NetworkInterface_winXP.c
+--- jdk/src/windows/native/java/net/NetworkInterface_winXP.c
++++ jdk/src/windows/native/java/net/NetworkInterface_winXP.c
+@@ -33,6 +33,7 @@
+ #include "jni_util.h"
+ 
+ #include "NetworkInterface.h"
++#include "net_util.h"
+ 
+ /*
+  * Windows implementation of the java.net.NetworkInterface native methods.
+@@ -468,7 +469,7 @@
+             }
+             /* default ctor will set family to AF_INET */
+ 
+-            (*env)->SetIntField(env, iaObj, ni_iaAddr, ntohl(addrs->addr.him4.sin_addr.s_addr));
++            setInetAddress_addr(env, iaObj, ntohl(addrs->addr.him4.sin_addr.s_addr));
+ 
+             ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID);
+             if (ibObj == NULL) {
+@@ -481,8 +482,7 @@
+               free_netaddr(netaddrP);
+               return NULL;
+             }
+-            (*env)->SetIntField(env, ia2Obj, ni_iaAddr,
+-                                ntohl(addrs->brdcast.him4.sin_addr.s_addr));
++            setInetAddress_addr(env, ia2Obj, ntohl(addrs->brdcast.him4.sin_addr.s_addr));
+             (*env)->SetObjectField(env, ibObj, ni_ibbroadcastID, ia2Obj);
+             (*env)->SetShortField(env, ibObj, ni_ibmaskID, addrs->mask);
+             (*env)->SetObjectArrayElement(env, bindsArr, bind_index++, ibObj);
+diff --git a/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c b/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c
+--- jdk/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c
++++ jdk/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c
+@@ -432,7 +432,7 @@
+     int lcladdrlen;
+     int address;
+ 
+-    family = (*env)->GetIntField(env, addressObj, ia_familyID);
++    family = getInetAddress_family(env, addressObj);
+     if (family == IPv6 && !ipv6_supported) {
+         JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
+                         "Protocol family not supported");
+@@ -452,7 +452,7 @@
+         JNU_ThrowNullPointerException(env, "argument address");
+         return;
+     } else {
+-        address = (*env)->GetIntField(env, addressObj, ia_addressID);
++        address = getInetAddress_addr(env, addressObj);
+     }
+ 
+     if (NET_InetAddressToSockaddr(env, addressObj, port, (struct sockaddr *)&lcladdr, &lcladdrlen, JNI_FALSE) != 0) {
+@@ -552,9 +552,9 @@
+         return;
+     }
+ 
+-    addr = (*env)->GetIntField(env, address, ia_addressID);
++    addr = getInetAddress_addr(env, address);
+ 
+-    family = (*env)->GetIntField(env, address, ia_familyID);
++    family = getInetAddress_family(env, address);
+     if (family == IPv6 && !ipv6_supported) {
+         JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
+                         "Protocol family not supported");
+@@ -671,7 +671,7 @@
+         return;
+     }
+ 
+-    family = (*env)->GetIntField(env, iaObj, ia_familyID);
++    family = getInetAddress_family(env, iaObj);
+     if (family == IPv4) {
+         fdObj = (*env)->GetObjectField(env, this, pdsi_fdID);
+     } else {
+@@ -715,7 +715,7 @@
+         if (!w2k_or_later) { /* avoid this check on Win 2K or better. Does not work with IPv6.
+                       * Check is not necessary on these OSes */
+             if (connected) {
+-                address = (*env)->GetIntField(env, iaObj, ia_addressID);
++                address = getInetAddress_addr(env, iaObj);
+             } else {
+                 address = ntohl(rmtaddr.him4.sin_addr.s_addr);
+             }
+@@ -824,7 +824,7 @@
+     if (IS_NULL(addressObj)) {
+         JNU_ThrowNullPointerException(env, "Null address in peek()");
+     } else {
+-        address = (*env)->GetIntField(env, addressObj, ia_addressID);
++        address = getInetAddress_addr(env, addressObj);
+         /* We only handle IPv4 for now. Will support IPv6 once its in the os */
+         family = AF_INET;
+     }
+@@ -906,9 +906,8 @@
+         JNU_ThrowByName(env, JNU_JAVAIOPKG "InterruptedIOException", 0);
+         return 0;
+     }
+-    (*env)->SetIntField(env, addressObj, ia_addressID,
+-                        ntohl(remote_addr.sin_addr.s_addr));
+-    (*env)->SetIntField(env, addressObj, ia_familyID, IPv4);
++    setInetAddress_addr(env, addressObj, ntohl(remote_addr.sin_addr.s_addr));
++    setInetAddress_family(env, addressObj, IPv4);
+ 
+     /* return port */
+     return ntohs(remote_addr.sin_port);
+@@ -1578,7 +1577,6 @@
+ {
+     jobjectArray addrArray;
+     static jfieldID ni_addrsID=0;
+-    static jfieldID ia_familyID=0;
+     jsize len;
+     jobject addr;
+     int i;
+@@ -1589,10 +1587,6 @@
+         ni_addrsID = (*env)->GetFieldID(env, c, "addrs",
+                                         "[Ljava/net/InetAddress;");
+         CHECK_NULL_RETURN (ni_addrsID, -1);
+-        c = (*env)->FindClass(env,"java/net/InetAddress");
+-        CHECK_NULL_RETURN (c, -1);
+-        ia_familyID = (*env)->GetFieldID(env, c, "family", "I");
+-        CHECK_NULL_RETURN (ia_familyID, -1);
+     }
+ 
+     addrArray = (*env)->GetObjectField(env, nif, ni_addrsID);
+@@ -1610,7 +1604,7 @@
+     for (i=0; i<len; i++) {
+         int fam;
+         addr = (*env)->GetObjectArrayElement(env, addrArray, i);
+-        fam = (*env)->GetIntField(env, addr, ia_familyID);
++        fam = getInetAddress_family(env, addr);
+         if (fam == family) {
+             *iaddr = addr;
+             return 0;
+@@ -1622,20 +1616,13 @@
+ static int getInet4AddrFromIf (JNIEnv *env, jobject nif, struct in_addr *iaddr)
+ {
+     jobject addr;
+-    static jfieldID ia_addressID;
+ 
+     int ret = getInetAddrFromIf (env, IPv4, nif, &addr);
+     if (ret == -1) {
+         return -1;
+     }
+ 
+-    if (ia_addressID == 0) {
+-        jclass c = (*env)->FindClass(env,"java/net/InetAddress");
+-        CHECK_NULL_RETURN (c, -1);
+-        ia_addressID = (*env)->GetFieldID(env, c, "address", "I");
+-        CHECK_NULL_RETURN (ia_addressID, -1);
+-    }
+-    iaddr->s_addr = htonl((*env)->GetIntField(env, addr, ia_addressID));
++    iaddr->s_addr = htonl(getInetAddress_addr(env, addr));
+     return 0;
+ }
+ 
+@@ -1710,17 +1697,9 @@
+             }
+             opt = java_net_SocketOptions_IP_MULTICAST_IF2;
+         } else {
+-            static jfieldID ia_addressID;
+             struct in_addr in;
+ 
+-            if (ia_addressID == NULL) {
+-                        jclass c = (*env)->FindClass(env,"java/net/InetAddress");
+-                CHECK_NULL(c);
+-                ia_addressID = (*env)->GetFieldID(env, c, "address", "I");
+-                CHECK_NULL(ia_addressID);
+-            }
+-
+-            in.s_addr = htonl((*env)->GetIntField(env, value, ia_addressID));
++            in.s_addr = htonl(getInetAddress_addr(env, value));
+ 
+             if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF,
+                                (const char*)&in, sizeof(in)) < 0) {
+@@ -1949,7 +1928,6 @@
+     if (isIPV4) {
+         static jclass inet4_class;
+         static jmethodID inet4_ctrID;
+-        static jfieldID inet4_addrID;
+ 
+         static jclass ni_class;
+         static jmethodID ni_ctrID;
+@@ -1979,15 +1957,13 @@
+             CHECK_NULL_RETURN(c, NULL);
+             inet4_ctrID = (*env)->GetMethodID(env, c, "<init>", "()V");
+             CHECK_NULL_RETURN(inet4_ctrID, NULL);
+-            inet4_addrID = (*env)->GetFieldID(env, c, "address", "I");
+-            CHECK_NULL_RETURN(inet4_addrID, NULL);
+             inet4_class = (*env)->NewGlobalRef(env, c);
+             CHECK_NULL_RETURN(inet4_class, NULL);
+         }
+         addr = (*env)->NewObject(env, inet4_class, inet4_ctrID, 0);
+         CHECK_NULL_RETURN(addr, NULL);
+ 
+-        (*env)->SetIntField(env, addr, inet4_addrID, ntohl(in.s_addr));
++        setInetAddress_addr(env, addr, ntohl(in.s_addr));
+ 
+         /*
+          * For IP_MULTICAST_IF return InetAddress
+diff --git a/src/windows/native/java/net/TwoStacksPlainSocketImpl.c b/src/windows/native/java/net/TwoStacksPlainSocketImpl.c
+--- jdk/src/windows/native/java/net/TwoStacksPlainSocketImpl.c
++++ jdk/src/windows/native/java/net/TwoStacksPlainSocketImpl.c
+@@ -410,7 +410,7 @@
+     fdObj = (*env)->GetObjectField(env, this, psi_fdID);
+     fd1Obj = (*env)->GetObjectField(env, this, psi_fd1ID);
+ 
+-    family = (*env)->GetIntField(env, iaObj, ia_familyID);
++    family = getInetAddress_family(env, iaObj);
+ 
+     if (family == IPv6 && !ipv6_supported) {
+         JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
+@@ -722,9 +722,8 @@
+             return;
+         }
+ 
+-        (*env)->SetIntField(env, socketAddressObj, ia_addressID,
+-                            ntohl(him.him4.sin_addr.s_addr));
+-        (*env)->SetIntField(env, socketAddressObj, ia_familyID, IPv4);
++        setInetAddress_addr(env, socketAddressObj, ntohl(him.him4.sin_addr.s_addr));
++        setInetAddress_family(env, socketAddressObj, IPv4);
+         (*env)->SetObjectField(env, socket, psi_addressID, socketAddressObj);
+     } else {
+         jbyteArray addr;
+@@ -752,7 +751,7 @@
+         }
+         addr = (*env)->GetObjectField (env, socketAddressObj, ia6_ipaddressID);
+         (*env)->SetByteArrayRegion (env, addr, 0, 16, (const char *)&him.him6.sin6_addr);
+-        (*env)->SetIntField(env, socketAddressObj, ia_familyID, IPv6);
++        setInetAddress_family(env, socketAddressObj, IPv6);
+         (*env)->SetIntField(env, socketAddressObj, ia6_scopeidID, him.him6.sin6_scope_id);
+     }
+     /* fields common to AF_INET and AF_INET6 */
+diff --git a/src/windows/native/java/net/net_util_md.c b/src/windows/native/java/net/net_util_md.c
+--- jdk/src/windows/native/java/net/net_util_md.c
++++ jdk/src/windows/native/java/net/net_util_md.c
+@@ -832,7 +832,7 @@
+ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr *him,
+                           int *len, jboolean v4MappedAddress) {
+     jint family, iafam;
+-    iafam = (*env)->GetIntField(env, iaObj, ia_familyID);
++    iafam = getInetAddress_family(env, iaObj);
+     family = (iafam == IPv4)? AF_INET : AF_INET6;
+     if (ipv6_available() && !(family == AF_INET && v4MappedAddress == JNI_FALSE)) {
+         struct SOCKADDR_IN6 *him6 = (struct SOCKADDR_IN6 *)him;
+@@ -843,7 +843,7 @@
+ 
+         if (family == AF_INET) { /* will convert to IPv4-mapped address */
+             memset((char *) caddr, 0, 16);
+-            address = (*env)->GetIntField(env, iaObj, ia_addressID);
++            address = getInetAddress_addr(env, iaObj);
+             if (address == INADDR_ANY) {
+                 /* we would always prefer IPv6 wildcard address
+                 caddr[10] = 0xff;
+@@ -882,7 +882,7 @@
+           return -1;
+         }
+         memset((char *) him4, 0, sizeof(struct sockaddr_in));
+-        address = (int)(*env)->GetIntField(env, iaObj, ia_addressID);
++        address = getInetAddress_addr(env, iaObj);
+         him4->sin_port = htons((short) port);
+         him4->sin_addr.s_addr = (u_long) htonl(address);
+         him4->sin_family = AF_INET;

Added: trunk/java/openjdk6/files/icedtea/security/20130416/8001031.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130416/8001031.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130416/8001031.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,5457 @@
+# HG changeset patch
+# User andrew
+# Date 1365744917 -3600
+# Node ID d79bfc0c6371d1174209585a8d2bf08e3f3625f9
+# Parent  ec8a935f0737e033e4ffd401c4d554cd73739c39
+8001031: Better font processing.
+Reviewed-by: vadim, prr, mschoene
+
+diff --git a/src/share/native/sun/font/FontInstanceAdapter.cpp b/src/share/native/sun/font/FontInstanceAdapter.cpp
+--- jdk/src/share/native/sun/font/FontInstanceAdapter.cpp
++++ jdk/src/share/native/sun/font/FontInstanceAdapter.cpp
+@@ -66,8 +66,21 @@
+     yScalePixelsToUnits = upem / yppem;
+ };
+ 
++
+ const void *FontInstanceAdapter::getFontTable(LETag tableTag) const
+ {
++  size_t ignored = 0;
++  return getFontTable(tableTag, ignored);
++}
++
++static const LETag cacheMap[LAYOUTCACHE_ENTRIES] = {
++  GPOS_TAG, GDEF_TAG, GSUB_TAG, MORT_TAG, MORX_TAG, KERN_TAG
++};
++
++const void *FontInstanceAdapter::getFontTable(LETag tableTag, size_t &length) const
++{
++  length = 0;
++
+   if (!layoutTables) { // t1 font
+     return 0;
+   }
+@@ -75,14 +88,19 @@
+   // cache in font's pscaler object
+   // font disposer will handle for us
+ 
+-  switch(tableTag) {
+-  case GSUB_TAG: if (layoutTables->gsub_len != -1) return (void*)layoutTables->gsub; break;
+-  case GPOS_TAG: if (layoutTables->gpos_len != -1) return (void*)layoutTables->gpos; break;
+-  case GDEF_TAG: if (layoutTables->gdef_len != -1) return (void*)layoutTables->gdef; break;
+-  case MORT_TAG: if (layoutTables->mort_len != -1) return (void*)layoutTables->mort; break;
+-  case KERN_TAG: if (layoutTables->kern_len != -1) return (void*)layoutTables->kern; break;
+-  default:
+-   //fprintf(stderr, "unexpected table request from font instance adapter: %x\n", tableTag);
++  int cacheIdx;
++  for (cacheIdx=0;cacheIdx<LAYOUTCACHE_ENTRIES;cacheIdx++) {
++    if (tableTag==cacheMap[cacheIdx]) break;
++  }
++
++  if (cacheIdx<LAYOUTCACHE_ENTRIES) { // if found
++    if (layoutTables->entries[cacheIdx].len != -1) {
++      length = layoutTables->entries[cacheIdx].len;
++      return layoutTables->entries[cacheIdx].ptr;
++    }
++  } else {
++    //fprintf(stderr, "unexpected table request from font instance adapter: %x\n", tableTag);
++    // (don't load any other tables)
+     return 0;
+   }
+ 
+@@ -96,16 +114,13 @@
+     env->GetByteArrayRegion(tableBytes, 0, len, result);
+   }
+ 
+-  switch(tableTag) {
+-  case GSUB_TAG: layoutTables->gsub = (void*)result; layoutTables->gsub_len = len; break;
+-  case GPOS_TAG: layoutTables->gpos = (void*)result; layoutTables->gpos_len = len; break;
+-  case GDEF_TAG: layoutTables->gdef = (void*)result; layoutTables->gdef_len = len; break;
+-  case MORT_TAG: layoutTables->mort = (void*)result; layoutTables->mort_len = len; break;
+-  case KERN_TAG: layoutTables->kern = (void*)result; layoutTables->kern_len = len; break;
+-  default: break;
++  if (cacheIdx<LAYOUTCACHE_ENTRIES) { // if cacheable table
++    layoutTables->entries[cacheIdx].len = len;
++    layoutTables->entries[cacheIdx].ptr = (const void*)result;
+   }
+ 
+-  return (void*)result;
++  length = len;
++  return (const void*)result;
+ };
+ 
+ LEGlyphID FontInstanceAdapter::mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const
+diff --git a/src/share/native/sun/font/FontInstanceAdapter.h b/src/share/native/sun/font/FontInstanceAdapter.h
+--- jdk/src/share/native/sun/font/FontInstanceAdapter.h
++++ jdk/src/share/native/sun/font/FontInstanceAdapter.h
+@@ -86,6 +86,7 @@
+     // tables are cached with the native font scaler data
+     // only supports gsub, gpos, gdef, mort tables at present
+     virtual const void *getFontTable(LETag tableTag) const;
++    virtual const void *getFontTable(LETag tableTag, size_t &len) const;
+ 
+     virtual void *getKernPairs() const {
+         return layoutTables->kernPairs;
+diff --git a/src/share/native/sun/font/fontscalerdefs.h b/src/share/native/sun/font/fontscalerdefs.h
+--- jdk/src/share/native/sun/font/fontscalerdefs.h
++++ jdk/src/share/native/sun/font/fontscalerdefs.h
+@@ -107,20 +107,19 @@
+ #define GPOS_TAG 0x47504F53 /* 'GPOS' */
+ #define GDEF_TAG 0x47444546 /* 'GDEF' */
+ #define MORT_TAG 0x6D6F7274 /* 'mort' */
++#define MORX_TAG 0x6D6F7278 /* 'morx' */
+ #define KERN_TAG 0x6B65726E /* 'kern' */
+ 
++typedef struct TTLayoutTableCacheEntry {
++  const void* ptr;
++  int   len;
++} TTLayoutTableCacheEntry;
++
++#define LAYOUTCACHE_ENTRIES 6
++
+ typedef struct TTLayoutTableCache {
+-    void* gsub;
+-    void* gpos;
+-    void* gdef;
+-    void* mort;
+-    void* kern;
+-    void* kernPairs;
+-    int gsub_len;
+-    int gpos_len;
+-    int gdef_len;
+-    int mort_len;
+-    int kern_len;
++  TTLayoutTableCacheEntry entries[LAYOUTCACHE_ENTRIES];
++  void* kernPairs;
+ } TTLayoutTableCache;
+ 
+ #include "sunfontids.h"
+diff --git a/src/share/native/sun/font/layout/AlternateSubstSubtables.cpp b/src/share/native/sun/font/layout/AlternateSubstSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/AlternateSubstSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/AlternateSubstSubtables.cpp
+@@ -39,19 +39,20 @@
+ 
+ U_NAMESPACE_BEGIN
+ 
+-le_uint32 AlternateSubstitutionSubtable::process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const
++le_uint32 AlternateSubstitutionSubtable::process(const LEReferenceTo<AlternateSubstitutionSubtable> &base,
++                                       GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter) const
+ {
+     // NOTE: For now, we'll just pick the first alternative...
+     LEGlyphID glyph = glyphIterator->getCurrGlyphID();
+-    le_int32 coverageIndex = getGlyphCoverage(glyph);
++    le_int32 coverageIndex = getGlyphCoverage(base, glyph, success);
+ 
+-    if (coverageIndex >= 0) {
++    if (coverageIndex >= 0 && LE_SUCCESS(success)) {
+         le_uint16 altSetCount = SWAPW(alternateSetCount);
+ 
+         if (coverageIndex < altSetCount) {
+             Offset alternateSetTableOffset = SWAPW(alternateSetTableOffsetArray[coverageIndex]);
+-            const AlternateSetTable *alternateSetTable =
+-                (const AlternateSetTable *) ((char *) this + alternateSetTableOffset);
++            const LEReferenceTo<AlternateSetTable> alternateSetTable(base, success,
++                                  (const AlternateSetTable *) ((char *) this + alternateSetTableOffset));
+             TTGlyphID alternate = SWAPW(alternateSetTable->alternateArray[0]);
+ 
+             if (filter == NULL || filter->accept(LE_SET_GLYPH(glyph, alternate))) {
+diff --git a/src/share/native/sun/font/layout/AlternateSubstSubtables.h b/src/share/native/sun/font/layout/AlternateSubstSubtables.h
+--- jdk/src/share/native/sun/font/layout/AlternateSubstSubtables.h
++++ jdk/src/share/native/sun/font/layout/AlternateSubstSubtables.h
+@@ -51,13 +51,17 @@
+     TTGlyphID alternateArray[ANY_NUMBER];
+ };
+ 
++LE_VAR_ARRAY(AlternateSetTable, alternateArray)
++
+ struct AlternateSubstitutionSubtable : GlyphSubstitutionSubtable
+ {
+     le_uint16 alternateSetCount;
+     Offset    alternateSetTableOffsetArray[ANY_NUMBER];
+ 
+-    le_uint32 process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter = NULL) const;
++    le_uint32 process(const LEReferenceTo<AlternateSubstitutionSubtable> &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter = NULL) const;
+ };
+ 
++LE_VAR_ARRAY(AlternateSubstitutionSubtable, alternateSetTableOffsetArray)
++
+ U_NAMESPACE_END
+ #endif
+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
+@@ -58,15 +58,18 @@
+ 
+ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ArabicOpenTypeLayoutEngine)
+ 
+-ArabicOpenTypeLayoutEngine::ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                        le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success)
++ArabicOpenTypeLayoutEngine::ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode,
++                                                       le_int32 languageCode, le_int32 typoFlags,
++                                                       const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable,
++                                                       LEErrorCode &success)
+     : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success)
+ {
+     fFeatureMap = ArabicShaping::getFeatureMap(fFeatureMapCount);
+     fFeatureOrder = TRUE;
+ }
+ 
+-ArabicOpenTypeLayoutEngine::ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
++ArabicOpenTypeLayoutEngine::ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode,
++                                                       le_int32 languageCode,
+                                                        le_int32 typoFlags, LEErrorCode &success)
+     : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success)
+ {
+@@ -88,8 +91,9 @@
+ // Input: characters
+ // Output: characters, char indices, tags
+ // Returns: output character count
+-le_int32 ArabicOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
+-        LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success)
++le_int32 ArabicOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count,
++                                                         le_int32 max, le_bool rightToLeft, LEUnicode *&outChars,
++                                                         LEGlyphStorage &glyphStorage, LEErrorCode &success)
+ {
+     if (LE_FAILURE(success)) {
+         return 0;
+@@ -137,22 +141,21 @@
+         return;
+     }
+ 
+-    if (fGPOSTable != NULL) {
++    if (!fGPOSTable.isEmpty()) {
+         OpenTypeLayoutEngine::adjustGlyphPositions(chars, offset, count, reverse, glyphStorage, success);
+-    } else if (fGDEFTable != NULL) {
+-        GDEFMarkFilter filter(fGDEFTable);
+-
++    } else if (!fGDEFTable.isEmpty()) {
++        GDEFMarkFilter filter(fGDEFTable, success);
+         adjustMarkGlyphs(glyphStorage, &filter, success);
+     } else {
+-        GlyphDefinitionTableHeader *gdefTable = (GlyphDefinitionTableHeader *) CanonShaping::glyphDefinitionTable;
+-        GDEFMarkFilter filter(gdefTable);
++        LEReferenceTo<GlyphDefinitionTableHeader> gdefTable(CanonShaping::glyphDefinitionTable, CanonShaping::glyphDefinitionTableLen);
++        GDEFMarkFilter filter(gdefTable, success);
+ 
+         adjustMarkGlyphs(&chars[offset], count, reverse, glyphStorage, &filter, success);
+     }
+ }
+ 
+ UnicodeArabicOpenTypeLayoutEngine::UnicodeArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags, LEErrorCode &success)
+-    : ArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags | LE_CHAR_FILTER_FEATURE_FLAG, success)
++  : ArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags | LE_CHAR_FILTER_FEATURE_FLAG, success)
+ {
+     fGSUBTable = (const GlyphSubstitutionTableHeader *) CanonShaping::glyphSubstitutionTable;
+     fGDEFTable = (const GlyphDefinitionTableHeader *) CanonShaping::glyphDefinitionTable;
+@@ -232,7 +235,7 @@
+         return;
+     }
+ 
+-    GDEFMarkFilter filter(fGDEFTable);
++    GDEFMarkFilter filter(fGDEFTable, success);
+ 
+     adjustMarkGlyphs(&chars[offset], count, reverse, glyphStorage, &filter, success);
+ }
+diff --git a/src/share/native/sun/font/layout/ArabicLayoutEngine.h b/src/share/native/sun/font/layout/ArabicLayoutEngine.h
+--- jdk/src/share/native/sun/font/layout/ArabicLayoutEngine.h
++++ jdk/src/share/native/sun/font/layout/ArabicLayoutEngine.h
+@@ -75,7 +75,7 @@
+      * @internal
+      */
+     ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                            le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success);
++                            le_int32 typoFlags, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, LEErrorCode &success);
+ 
+     /**
+      * This constructor is used when the font requires a "canned" GSUB table which can't be known
+diff --git a/src/share/native/sun/font/layout/ArabicShaping.cpp b/src/share/native/sun/font/layout/ArabicShaping.cpp
+--- jdk/src/share/native/sun/font/layout/ArabicShaping.cpp
++++ jdk/src/share/native/sun/font/layout/ArabicShaping.cpp
+@@ -58,14 +58,16 @@
+ */
+ ArabicShaping::ShapeType ArabicShaping::getShapeType(LEUnicode c)
+ {
+-    const ClassDefinitionTable *joiningTypes = (const ClassDefinitionTable *) ArabicShaping::shapingTypeTable;
+-    le_int32 joiningType = joiningTypes->getGlyphClass(c);
++  LEErrorCode success = LE_NO_ERROR;
++  const LEReferenceTo<ClassDefinitionTable> joiningTypes((const ClassDefinitionTable *) ArabicShaping::shapingTypeTable,
++                                                         ArabicShaping::shapingTypeTableLen);
++  le_int32 joiningType = joiningTypes->getGlyphClass(joiningTypes, c, success);
+ 
+-    if (joiningType >= 0 && joiningType < ArabicShaping::JT_COUNT) {
+-        return ArabicShaping::shapeTypes[joiningType];
+-    }
++  if (joiningType >= 0 && joiningType < ArabicShaping::JT_COUNT && LE_SUCCESS(success)) {
++    return ArabicShaping::shapeTypes[joiningType];
++  }
+ 
+-    return ArabicShaping::ST_NOSHAPE_NONE;
++  return ArabicShaping::ST_NOSHAPE_NONE;
+ }
+ 
+ #define isolFeatureTag LE_ISOL_FEATURE_TAG
+diff --git a/src/share/native/sun/font/layout/ArabicShaping.h b/src/share/native/sun/font/layout/ArabicShaping.h
+--- jdk/src/share/native/sun/font/layout/ArabicShaping.h
++++ jdk/src/share/native/sun/font/layout/ArabicShaping.h
+@@ -93,6 +93,8 @@
+     static ShapeType getShapeType(LEUnicode c);
+ 
+     static const le_uint8 shapingTypeTable[];
++    static const size_t   shapingTypeTableLen;
++
+     static const ShapeType shapeTypes[];
+ 
+     static void adjustTags(le_int32 outIndex, le_int32 shapeOffset, LEGlyphStorage &glyphStorage);
+diff --git a/src/share/native/sun/font/layout/AttachmentPosnSubtables.h b/src/share/native/sun/font/layout/AttachmentPosnSubtables.h
+--- jdk/src/share/native/sun/font/layout/AttachmentPosnSubtables.h
++++ jdk/src/share/native/sun/font/layout/AttachmentPosnSubtables.h
+@@ -52,14 +52,14 @@
+     Offset    markArrayOffset;
+     Offset    baseArrayOffset;
+ 
+-    inline le_int32  getBaseCoverage(LEGlyphID baseGlyphId) const;
++    inline le_int32  getBaseCoverage(const LETableReference &base, LEGlyphID baseGlyphId, LEErrorCode &success) const;
+ 
+     le_uint32 process(GlyphIterator *glyphIterator) const;
+ };
+ 
+-inline le_int32 AttachmentPositioningSubtable::getBaseCoverage(LEGlyphID baseGlyphID) const
++inline le_int32 AttachmentPositioningSubtable::getBaseCoverage(const LETableReference &base, LEGlyphID baseGlyphID, LEErrorCode &success) const
+ {
+-    return getGlyphCoverage(baseCoverageTableOffset, baseGlyphID);
++  return getGlyphCoverage(base, baseCoverageTableOffset, baseGlyphID, success);
+ }
+ 
+ U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/CanonData.cpp b/src/share/native/sun/font/layout/CanonData.cpp
+--- jdk/src/share/native/sun/font/layout/CanonData.cpp
++++ jdk/src/share/native/sun/font/layout/CanonData.cpp
+@@ -3641,4 +3641,9 @@
+     0x00, 0xE6, 0xD2, 0x42, 0xD2, 0x44, 0x00, 0xE6
+ };
+ 
++
++const size_t CanonShaping::glyphSubstitutionTableLen = sizeof(glyphSubstitutionTable)/sizeof(glyphSubstitutionTable[0]);
++
++const size_t CanonShaping::glyphDefinitionTableLen = sizeof(glyphDefinitionTable)/sizeof(glyphDefinitionTable[0]);
++
+ U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/CanonShaping.cpp b/src/share/native/sun/font/layout/CanonShaping.cpp
+--- jdk/src/share/native/sun/font/layout/CanonShaping.cpp
++++ jdk/src/share/native/sun/font/layout/CanonShaping.cpp
+@@ -59,15 +59,15 @@
+ void CanonShaping::reorderMarks(const LEUnicode *inChars, le_int32 charCount, le_bool rightToLeft,
+                                 LEUnicode *outChars, LEGlyphStorage &glyphStorage)
+ {
+-    const GlyphDefinitionTableHeader *gdefTable = (const GlyphDefinitionTableHeader *) glyphDefinitionTable;
+-    const ClassDefinitionTable *classTable = gdefTable->getMarkAttachClassDefinitionTable();
++    LEErrorCode success = LE_NO_ERROR;
++    LEReferenceTo<GlyphDefinitionTableHeader> gdefTable(CanonShaping::glyphDefinitionTable, CanonShaping::glyphDefinitionTableLen);
++    LEReferenceTo<ClassDefinitionTable> classTable = gdefTable->getMarkAttachClassDefinitionTable(gdefTable, success);
+     le_int32 *combiningClasses = LE_NEW_ARRAY(le_int32, charCount);
+     le_int32 *indices = LE_NEW_ARRAY(le_int32, charCount);
+-    LEErrorCode status = LE_NO_ERROR;
+     le_int32 i;
+ 
+     for (i = 0; i < charCount; i += 1) {
+-        combiningClasses[i] = classTable->getGlyphClass((LEGlyphID) inChars[i]);
++      combiningClasses[i] = classTable->getGlyphClass(classTable, (LEGlyphID) inChars[i], success);
+         indices[i] = i;
+     }
+ 
+@@ -96,7 +96,7 @@
+         le_int32 index = indices[i];
+ 
+         outChars[i] = inChars[index];
+-        glyphStorage.setCharIndex(out, index, status);
++        glyphStorage.setCharIndex(out, index, success);
+     }
+ 
+     LE_DELETE_ARRAY(indices);
+diff --git a/src/share/native/sun/font/layout/CanonShaping.h b/src/share/native/sun/font/layout/CanonShaping.h
+--- jdk/src/share/native/sun/font/layout/CanonShaping.h
++++ jdk/src/share/native/sun/font/layout/CanonShaping.h
+@@ -42,7 +42,9 @@
+ {
+ public:
+     static const le_uint8 glyphSubstitutionTable[];
++    static const size_t   glyphSubstitutionTableLen;
+     static const le_uint8 glyphDefinitionTable[];
++    static const size_t   glyphDefinitionTableLen;
+ 
+     static void reorderMarks(const LEUnicode *inChars, le_int32 charCount, le_bool rightToLeft,
+                                    LEUnicode *outChars, LEGlyphStorage &glyphStorage);
+diff --git a/src/share/native/sun/font/layout/ClassDefinitionTables.cpp b/src/share/native/sun/font/layout/ClassDefinitionTables.cpp
+--- jdk/src/share/native/sun/font/layout/ClassDefinitionTables.cpp
++++ jdk/src/share/native/sun/font/layout/ClassDefinitionTables.cpp
+@@ -37,24 +37,51 @@
+ 
+ U_NAMESPACE_BEGIN
+ 
+-le_int32 ClassDefinitionTable::getGlyphClass(LEGlyphID glyphID) const
++le_int32 ClassDefinitionTable::getGlyphClass(const LETableReference& base, LEGlyphID glyphID, LEErrorCode &success) const
+ {
++  LEReferenceTo<ClassDefinitionTable> thisRef(base, success);
++  if (LE_FAILURE(success)) return 0;
++
++  switch(SWAPW(classFormat)) {
++    case 0:
++        return 0;
++
++    case 1:
++    {
++      const LEReferenceTo<ClassDefFormat1Table> f1Table(thisRef, success);
++      return f1Table->getGlyphClass(f1Table, glyphID, success);
++    }
++
++    case 2:
++    {
++      const LEReferenceTo<ClassDefFormat2Table> f2Table(thisRef, success);
++      return  f2Table->getGlyphClass(f2Table, glyphID, success);
++    }
++
++    default:
++        return 0;
++  }
++}
++
++le_bool ClassDefinitionTable::hasGlyphClass(const LETableReference &base, le_int32 glyphClass, LEErrorCode &success) const
++{
++    LEReferenceTo<ClassDefinitionTable> thisRef(base, success);
++    if (LE_FAILURE(success)) return 0;
++
+     switch(SWAPW(classFormat)) {
+     case 0:
+         return 0;
+ 
+     case 1:
+     {
+-        const ClassDefFormat1Table *f1Table = (const ClassDefFormat1Table *) this;
+-
+-        return f1Table->getGlyphClass(glyphID);
++      const LEReferenceTo<ClassDefFormat1Table> f1Table(thisRef, success);
++      return f1Table->hasGlyphClass(f1Table, glyphClass, success);
+     }
+ 
+     case 2:
+     {
+-        const ClassDefFormat2Table *f2Table = (const ClassDefFormat2Table *) this;
+-
+-        return f2Table->getGlyphClass(glyphID);
++      const LEReferenceTo<ClassDefFormat2Table> f2Table(thisRef, success);
++      return f2Table->hasGlyphClass(f2Table, glyphClass, success);
+     }
+ 
+     default:
+@@ -62,51 +89,32 @@
+     }
+ }
+ 
+-le_bool ClassDefinitionTable::hasGlyphClass(le_int32 glyphClass) const
++le_int32 ClassDefFormat1Table::getGlyphClass(const LETableReference& base, LEGlyphID glyphID, LEErrorCode &success) const
+ {
+-    switch(SWAPW(classFormat)) {
+-    case 0:
+-        return 0;
++    if(LE_FAILURE(success)) return 0;
+ 
+-    case 1:
+-    {
+-        const ClassDefFormat1Table *f1Table = (const ClassDefFormat1Table *) this;
+-
+-        return f1Table->hasGlyphClass(glyphClass);
+-    }
+-
+-    case 2:
+-    {
+-        const ClassDefFormat2Table *f2Table = (const ClassDefFormat2Table *) this;
+-
+-        return f2Table->hasGlyphClass(glyphClass);
+-    }
+-
+-    default:
+-        return 0;
+-    }
+-}
+-
+-le_int32 ClassDefFormat1Table::getGlyphClass(LEGlyphID glyphID) const
+-{
++    le_uint16 count = SWAPW(glyphCount);
++    LEReferenceToArrayOf<le_uint16> classValueArrayRef(base, success, &classValueArray[0], count);
+     TTGlyphID ttGlyphID  = (TTGlyphID) LE_GET_GLYPH(glyphID);
+     TTGlyphID firstGlyph = SWAPW(startGlyph);
+-    TTGlyphID lastGlyph  = firstGlyph + SWAPW(glyphCount);
++    TTGlyphID lastGlyph  = firstGlyph + count;
+ 
+-    if (ttGlyphID >= firstGlyph && ttGlyphID < lastGlyph) {
+-        return SWAPW(classValueArray[ttGlyphID - firstGlyph]);
++    if (LE_SUCCESS(success) && ttGlyphID >= firstGlyph && ttGlyphID < lastGlyph) {
++      return SWAPW( classValueArrayRef(ttGlyphID - firstGlyph, success) );
+     }
+ 
+     return 0;
+ }
+ 
+-le_bool ClassDefFormat1Table::hasGlyphClass(le_int32 glyphClass) const
++le_bool ClassDefFormat1Table::hasGlyphClass(const LETableReference &base, le_int32 glyphClass, LEErrorCode &success) const
+ {
+-    le_uint16 count  = SWAPW(glyphCount);
++    if(LE_FAILURE(success)) return 0;
++    le_uint16 count = SWAPW(glyphCount);
++    LEReferenceToArrayOf<le_uint16> classValueArrayRef(base, success, &classValueArray[0], count);
+     int i;
+ 
+-    for (i = 0; i < count; i += 1) {
+-        if (SWAPW(classValueArray[i]) == glyphClass) {
++    for (i = 0; LE_SUCCESS(success)&& (i < count); i += 1) {
++      if (SWAPW(classValueArrayRef(i,success)) == glyphClass) {
+             return TRUE;
+         }
+     }
+@@ -114,27 +122,31 @@
+     return FALSE;
+ }
+ 
+-le_int32 ClassDefFormat2Table::getGlyphClass(LEGlyphID glyphID) const
++le_int32 ClassDefFormat2Table::getGlyphClass(const LETableReference& base, LEGlyphID glyphID, LEErrorCode &success) const
+ {
++    if(LE_FAILURE(success)) return 0;
+     TTGlyphID ttGlyph    = (TTGlyphID) LE_GET_GLYPH(glyphID);
+     le_uint16 rangeCount = SWAPW(classRangeCount);
++    LEReferenceToArrayOf<GlyphRangeRecord> classRangeRecordArrayRef(base, success, &classRangeRecordArray[0], rangeCount);
+     le_int32  rangeIndex =
+-        OpenTypeUtilities::getGlyphRangeIndex(ttGlyph, classRangeRecordArray, rangeCount);
++      OpenTypeUtilities::getGlyphRangeIndex(ttGlyph, classRangeRecordArrayRef, success);
+ 
+-    if (rangeIndex < 0) {
++    if (rangeIndex < 0 || LE_FAILURE(success)) {
+         return 0;
+     }
+ 
+-    return SWAPW(classRangeRecordArray[rangeIndex].rangeValue);
++    return SWAPW(classRangeRecordArrayRef(rangeIndex, success).rangeValue);
+ }
+ 
+-le_bool ClassDefFormat2Table::hasGlyphClass(le_int32 glyphClass) const
++le_bool ClassDefFormat2Table::hasGlyphClass(const LETableReference &base, le_int32 glyphClass, LEErrorCode &success) const
+ {
++    if(LE_FAILURE(success)) return 0;
+     le_uint16 rangeCount = SWAPW(classRangeCount);
++    LEReferenceToArrayOf<GlyphRangeRecord> classRangeRecordArrayRef(base, success, &classRangeRecordArray[0], rangeCount);
+     int i;
+ 
+-    for (i = 0; i < rangeCount; i += 1) {
+-        if (SWAPW(classRangeRecordArray[i].rangeValue) == glyphClass) {
++    for (i = 0; i < rangeCount && LE_SUCCESS(success); i += 1) {
++      if (SWAPW(classRangeRecordArrayRef(i,success).rangeValue) == glyphClass) {
+             return TRUE;
+         }
+     }
+diff --git a/src/share/native/sun/font/layout/ClassDefinitionTables.h b/src/share/native/sun/font/layout/ClassDefinitionTables.h
+--- jdk/src/share/native/sun/font/layout/ClassDefinitionTables.h
++++ jdk/src/share/native/sun/font/layout/ClassDefinitionTables.h
+@@ -46,8 +46,20 @@
+ {
+     le_uint16 classFormat;
+ 
+-    le_int32  getGlyphClass(LEGlyphID glyphID) const;
+-    le_bool   hasGlyphClass(le_int32 glyphClass) const;
++    le_int32  getGlyphClass(const LETableReference &base, LEGlyphID glyphID, LEErrorCode &success) const;
++    le_bool   hasGlyphClass(const LETableReference &base, le_int32 glyphClass, LEErrorCode &success) const;
++
++  le_int32 getGlyphClass(LEGlyphID glyphID) const {
++    LETableReference base((const le_uint8*)this);
++    LEErrorCode ignored = LE_NO_ERROR;
++    return getGlyphClass(base,glyphID,ignored);
++  }
++
++  le_bool hasGlyphClass(le_int32 glyphClass) const {
++    LETableReference base((const le_uint8*)this);
++    LEErrorCode ignored = LE_NO_ERROR;
++    return hasGlyphClass(base,glyphClass,ignored);
++  }
+ };
+ 
+ struct ClassDefFormat1Table : ClassDefinitionTable
+@@ -56,9 +68,11 @@
+     le_uint16  glyphCount;
+     le_uint16  classValueArray[ANY_NUMBER];
+ 
+-    le_int32 getGlyphClass(LEGlyphID glyphID) const;
+-    le_bool  hasGlyphClass(le_int32 glyphClass) const;
++    le_int32 getGlyphClass(const LETableReference &base, LEGlyphID glyphID, LEErrorCode &success) const;
++    le_bool  hasGlyphClass(const LETableReference &base, le_int32 glyphClass, LEErrorCode &success) const;
+ };
++LE_VAR_ARRAY(ClassDefFormat1Table, classValueArray)
++
+ 
+ struct ClassRangeRecord
+ {
+@@ -72,9 +86,10 @@
+     le_uint16        classRangeCount;
+     GlyphRangeRecord classRangeRecordArray[ANY_NUMBER];
+ 
+-    le_int32 getGlyphClass(LEGlyphID glyphID) const;
+-    le_bool hasGlyphClass(le_int32 glyphClass) const;
++    le_int32 getGlyphClass(const LETableReference &base, LEGlyphID glyphID, LEErrorCode &success) const;
++    le_bool hasGlyphClass(const LETableReference &base, le_int32 glyphClass, LEErrorCode &success) const;
+ };
++LE_VAR_ARRAY(ClassDefFormat2Table, classRangeRecordArray)
+ 
+ U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/ContextualGlyphSubstProc.cpp b/src/share/native/sun/font/layout/ContextualGlyphSubstProc.cpp
+--- jdk/src/share/native/sun/font/layout/ContextualGlyphSubstProc.cpp
++++ jdk/src/share/native/sun/font/layout/ContextualGlyphSubstProc.cpp
+@@ -43,13 +43,18 @@
+ 
+ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ContextualGlyphSubstitutionProcessor)
+ 
+-ContextualGlyphSubstitutionProcessor::ContextualGlyphSubstitutionProcessor(const MorphSubtableHeader *morphSubtableHeader)
+-  : StateTableProcessor(morphSubtableHeader)
++ContextualGlyphSubstitutionProcessor::ContextualGlyphSubstitutionProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success)
++  : StateTableProcessor(morphSubtableHeader, success), entryTable(), contextualGlyphSubstitutionHeader(morphSubtableHeader, success)
+ {
+-    contextualGlyphSubstitutionHeader = (const ContextualGlyphSubstitutionHeader *) morphSubtableHeader;
+-    substitutionTableOffset = SWAPW(contextualGlyphSubstitutionHeader->substitutionTableOffset);
++  contextualGlyphSubstitutionHeader.orphan();
++  substitutionTableOffset = SWAPW(contextualGlyphSubstitutionHeader->substitutionTableOffset);
+ 
+-    entryTable = (const ContextualGlyphSubstitutionStateEntry *) ((char *) &stateTableHeader->stHeader + entryTableOffset);
++
++  entryTable = LEReferenceToArrayOf<ContextualGlyphSubstitutionStateEntry>(stateTableHeader, success,
++                                                                           (const ContextualGlyphSubstitutionStateEntry*)(&stateTableHeader->stHeader),
++                                                                           entryTableOffset, LE_UNBOUNDED_ARRAY);
++  int16Table = LEReferenceToArrayOf<le_int16>(stateTableHeader, success, (const le_int16*)(&stateTableHeader->stHeader),
++                                              0, LE_UNBOUNDED_ARRAY); // rest of the table as le_int16s
+ }
+ 
+ ContextualGlyphSubstitutionProcessor::~ContextualGlyphSubstitutionProcessor()
+@@ -63,27 +68,26 @@
+ 
+ ByteOffset ContextualGlyphSubstitutionProcessor::processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index)
+ {
+-    const ContextualGlyphSubstitutionStateEntry *entry = &entryTable[index];
+-    ByteOffset newState = SWAPW(entry->newStateOffset);
+-    le_int16 flags = SWAPW(entry->flags);
+-    WordOffset markOffset = SWAPW(entry->markOffset);
+-    WordOffset currOffset = SWAPW(entry->currOffset);
++  LEErrorCode success = LE_NO_ERROR;
++  const ContextualGlyphSubstitutionStateEntry *entry = entryTable.getAlias(index, success);
++  ByteOffset newState = SWAPW(entry->newStateOffset);
++  le_int16 flags = SWAPW(entry->flags);
++  WordOffset markOffset = SWAPW(entry->markOffset);
++  WordOffset currOffset = SWAPW(entry->currOffset);
+ 
+-    if (markOffset != 0) {
+-        const le_int16 *table = (const le_int16 *) ((char *) &stateTableHeader->stHeader + markOffset * 2);
+-        LEGlyphID mGlyph = glyphStorage[markGlyph];
+-        TTGlyphID newGlyph = SWAPW(table[LE_GET_GLYPH(mGlyph)]);
++  if (markOffset != 0 && LE_SUCCESS(success)) {
++    LEGlyphID mGlyph = glyphStorage[markGlyph];
++    TTGlyphID newGlyph = SWAPW(int16Table.getObject(markOffset + LE_GET_GLYPH(mGlyph), success)); // whew.
+ 
+-         glyphStorage[markGlyph] = LE_SET_GLYPH(mGlyph, newGlyph);
+-    }
++    glyphStorage[markGlyph] = LE_SET_GLYPH(mGlyph, newGlyph);
++  }
+ 
+-    if (currOffset != 0) {
+-        const le_int16 *table = (const le_int16 *) ((char *) &stateTableHeader->stHeader + currOffset * 2);
+-        LEGlyphID thisGlyph = glyphStorage[currGlyph];
+-        TTGlyphID newGlyph = SWAPW(table[LE_GET_GLYPH(thisGlyph)]);
++  if (currOffset != 0) {
++    LEGlyphID thisGlyph = glyphStorage[currGlyph];
++    TTGlyphID newGlyph = SWAPW(int16Table.getObject(currOffset + LE_GET_GLYPH(thisGlyph), success)); // whew.
+ 
+-        glyphStorage[currGlyph] = LE_SET_GLYPH(thisGlyph, newGlyph);
+-    }
++    glyphStorage[currGlyph] = LE_SET_GLYPH(thisGlyph, newGlyph);
++  }
+ 
+     if (flags & cgsSetMark) {
+         markGlyph = currGlyph;
+diff --git a/src/share/native/sun/font/layout/ContextualGlyphSubstProc.h b/src/share/native/sun/font/layout/ContextualGlyphSubstProc.h
+--- jdk/src/share/native/sun/font/layout/ContextualGlyphSubstProc.h
++++ jdk/src/share/native/sun/font/layout/ContextualGlyphSubstProc.h
+@@ -56,7 +56,7 @@
+ 
+     virtual void endStateTable();
+ 
+-    ContextualGlyphSubstitutionProcessor(const MorphSubtableHeader *morphSubtableHeader);
++    ContextualGlyphSubstitutionProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success);
+     virtual ~ContextualGlyphSubstitutionProcessor();
+ 
+     /**
+@@ -78,11 +78,11 @@
+ 
+ protected:
+     ByteOffset substitutionTableOffset;
+-    const ContextualGlyphSubstitutionStateEntry *entryTable;
+-
++    LEReferenceToArrayOf<ContextualGlyphSubstitutionStateEntry> entryTable;
++    LEReferenceToArrayOf<le_int16> int16Table;
+     le_int32 markGlyph;
+ 
+-    const ContextualGlyphSubstitutionHeader *contextualGlyphSubstitutionHeader;
++    LEReferenceTo<ContextualGlyphSubstitutionHeader> contextualGlyphSubstitutionHeader;
+ 
+ };
+ 
+diff --git a/src/share/native/sun/font/layout/ContextualSubstSubtables.cpp b/src/share/native/sun/font/layout/ContextualSubstSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/ContextualSubstSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/ContextualSubstSubtables.cpp
+@@ -217,7 +217,7 @@
+     }
+ 
+     LEGlyphID glyph = glyphIterator->getCurrGlyphID();
+-    le_int32 coverageIndex = getGlyphCoverage(glyph);
++    le_int32 coverageIndex = getGlyphCoverage(lookupProcessor->getReference(), glyph, success);
+ 
+     if (coverageIndex >= 0) {
+         le_uint16 srSetCount = SWAPW(subRuleSetCount);
+@@ -266,7 +266,7 @@
+     }
+ 
+     LEGlyphID glyph = glyphIterator->getCurrGlyphID();
+-    le_int32 coverageIndex = getGlyphCoverage(glyph);
++    le_int32 coverageIndex = getGlyphCoverage(lookupProcessor->getReference(), glyph, success);
+ 
+     if (coverageIndex >= 0) {
+         const ClassDefinitionTable *classDefinitionTable =
+@@ -394,7 +394,7 @@
+     }
+ 
+     LEGlyphID glyph = glyphIterator->getCurrGlyphID();
+-    le_int32 coverageIndex = getGlyphCoverage(glyph);
++    le_int32 coverageIndex = getGlyphCoverage(lookupProcessor->getReference(), glyph, success);
+ 
+     if (coverageIndex >= 0) {
+         le_uint16 srSetCount = SWAPW(chainSubRuleSetCount);
+@@ -465,7 +465,7 @@
+     }
+ 
+     LEGlyphID glyph = glyphIterator->getCurrGlyphID();
+-    le_int32 coverageIndex = getGlyphCoverage(glyph);
++    le_int32 coverageIndex = getGlyphCoverage(lookupProcessor->getReference(), glyph, success);
+ 
+     if (coverageIndex >= 0) {
+         const ClassDefinitionTable *backtrackClassDefinitionTable =
+diff --git a/src/share/native/sun/font/layout/ContextualSubstSubtables.h b/src/share/native/sun/font/layout/ContextualSubstSubtables.h
+--- jdk/src/share/native/sun/font/layout/ContextualSubstSubtables.h
++++ jdk/src/share/native/sun/font/layout/ContextualSubstSubtables.h
+@@ -43,6 +43,7 @@
+ #include "GlyphSubstitutionTables.h"
+ #include "GlyphIterator.h"
+ #include "LookupProcessor.h"
++#include "LETableReference.h"
+ 
+ U_NAMESPACE_BEGIN
+ 
+@@ -88,6 +89,8 @@
+ 
+     le_uint32  process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const;
+ };
++LE_VAR_ARRAY(ContextualSubstitutionFormat1Subtable, subRuleSetTableOffsetArray)
++
+ 
+ struct SubRuleSetTable
+ {
+@@ -95,6 +98,7 @@
+     Offset  subRuleTableOffsetArray[ANY_NUMBER];
+ 
+ };
++LE_VAR_ARRAY(SubRuleSetTable, subRuleTableOffsetArray)
+ 
+ // NOTE: Multiple variable size arrays!!
+ struct SubRuleTable
+@@ -104,6 +108,7 @@
+     TTGlyphID inputGlyphArray[ANY_NUMBER];
+   //SubstitutionLookupRecord substLookupRecordArray[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(SubRuleTable, inputGlyphArray)
+ 
+ struct ContextualSubstitutionFormat2Subtable : ContextualSubstitutionSubtable
+ {
+@@ -113,12 +118,16 @@
+ 
+     le_uint32  process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const;
+ };
++LE_VAR_ARRAY(ContextualSubstitutionFormat2Subtable, subClassSetTableOffsetArray)
++
+ 
+ struct SubClassSetTable
+ {
+     le_uint16  subClassRuleCount;
+     Offset  subClassRuleTableOffsetArray[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(SubClassSetTable, subClassRuleTableOffsetArray)
++
+ 
+ // NOTE: Multiple variable size arrays!!
+ struct SubClassRuleTable
+@@ -128,6 +137,8 @@
+     le_uint16  classArray[ANY_NUMBER];
+   //SubstitutionLookupRecord substLookupRecordArray[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(SubClassRuleTable, classArray)
++
+ 
+ // NOTE: This isn't a subclass of GlyphSubstitutionSubtable 'cause
+ // it has an array of coverage tables instead of a single coverage table...
+@@ -143,6 +154,7 @@
+ 
+     le_uint32  process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const;
+ };
++LE_VAR_ARRAY(ContextualSubstitutionFormat3Subtable, coverageTableOffsetArray)
+ 
+ struct ChainingContextualSubstitutionSubtable : ContextualSubstitutionBase
+ {
+@@ -156,6 +168,8 @@
+ 
+     le_uint32  process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const;
+ };
++LE_VAR_ARRAY(ChainingContextualSubstitutionFormat1Subtable, chainSubRuleSetTableOffsetArray)
++
+ 
+ struct ChainSubRuleSetTable
+ {
+@@ -163,6 +177,7 @@
+     Offset  chainSubRuleTableOffsetArray[ANY_NUMBER];
+ 
+ };
++LE_VAR_ARRAY(ChainSubRuleSetTable, chainSubRuleTableOffsetArray)
+ 
+ // NOTE: Multiple variable size arrays!!
+ struct ChainSubRuleTable
+@@ -176,6 +191,7 @@
+   //le_uint16  substCount;
+   //SubstitutionLookupRecord substLookupRecordArray[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(ChainSubRuleTable, backtrackGlyphArray)
+ 
+ struct ChainingContextualSubstitutionFormat2Subtable : ChainingContextualSubstitutionSubtable
+ {
+@@ -187,12 +203,15 @@
+ 
+     le_uint32  process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const;
+ };
++LE_VAR_ARRAY(ChainingContextualSubstitutionFormat2Subtable, chainSubClassSetTableOffsetArray)
+ 
+ struct ChainSubClassSetTable
+ {
+     le_uint16  chainSubClassRuleCount;
+     Offset  chainSubClassRuleTableOffsetArray[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(ChainSubClassSetTable, chainSubClassRuleTableOffsetArray)
++
+ 
+ // NOTE: Multiple variable size arrays!!
+ struct ChainSubClassRuleTable
+@@ -206,6 +225,7 @@
+   //le_uint16  substCount;
+   //SubstitutionLookupRecord substLookupRecordArray[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(ChainSubClassRuleTable, backtrackClassArray)
+ 
+ // NOTE: This isn't a subclass of GlyphSubstitutionSubtable 'cause
+ // it has arrays of coverage tables instead of a single coverage table...
+@@ -225,6 +245,8 @@
+ 
+     le_uint32  process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const;
+ };
++LE_VAR_ARRAY(ChainingContextualSubstitutionFormat3Subtable, backtrackCoverageTableOffsetArray)
++
+ 
+ U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/CoverageTables.h b/src/share/native/sun/font/layout/CoverageTables.h
+--- jdk/src/share/native/sun/font/layout/CoverageTables.h
++++ jdk/src/share/native/sun/font/layout/CoverageTables.h
+@@ -56,6 +56,8 @@
+ 
+     le_int32 getGlyphCoverage(LEGlyphID glyphID) const;
+ };
++LE_VAR_ARRAY(CoverageFormat1Table, glyphArray)
++
+ 
+ struct CoverageFormat2Table : CoverageTable
+ {
+@@ -64,6 +66,7 @@
+ 
+     le_int32 getGlyphCoverage(LEGlyphID glyphID) const;
+ };
++LE_VAR_ARRAY(CoverageFormat2Table, rangeRecordArray)
+ 
+ U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/CursiveAttachmentSubtables.cpp b/src/share/native/sun/font/layout/CursiveAttachmentSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/CursiveAttachmentSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/CursiveAttachmentSubtables.cpp
+@@ -39,10 +39,10 @@
+ 
+ U_NAMESPACE_BEGIN
+ 
+-le_uint32 CursiveAttachmentSubtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
++le_uint32 CursiveAttachmentSubtable::process(const LEReferenceTo<CursiveAttachmentSubtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const
+ {
+     LEGlyphID glyphID       = glyphIterator->getCurrGlyphID();
+-    le_int32  coverageIndex = getGlyphCoverage(glyphID);
++    le_int32  coverageIndex = getGlyphCoverage(base, glyphID, success);
+     le_uint16 eeCount       = SWAPW(entryExitCount);
+ 
+     if (coverageIndex < 0 || coverageIndex >= eeCount) {
+@@ -51,7 +51,7 @@
+     }
+ 
+     LEPoint entryAnchor, exitAnchor;
+-    Offset entryOffset = SWAPW(entryExitRecords[coverageIndex].entryAnchor);
++    Offset entryOffset = SWAPW(entryExitRecords[coverageIndex].entryAnchor); // TODO
+     Offset exitOffset  = SWAPW(entryExitRecords[coverageIndex].exitAnchor);
+ 
+     if (entryOffset != 0) {
+diff --git a/src/share/native/sun/font/layout/CursiveAttachmentSubtables.h b/src/share/native/sun/font/layout/CursiveAttachmentSubtables.h
+--- jdk/src/share/native/sun/font/layout/CursiveAttachmentSubtables.h
++++ jdk/src/share/native/sun/font/layout/CursiveAttachmentSubtables.h
+@@ -57,8 +57,9 @@
+     le_uint16 entryExitCount;
+     EntryExitRecord entryExitRecords[ANY_NUMBER];
+ 
+-    le_uint32  process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
++    le_uint32  process(const LEReferenceTo<CursiveAttachmentSubtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const;
+ };
++LE_VAR_ARRAY(CursiveAttachmentSubtable, entryExitRecords)
+ 
+ U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/DeviceTables.h b/src/share/native/sun/font/layout/DeviceTables.h
+--- jdk/src/share/native/sun/font/layout/DeviceTables.h
++++ jdk/src/share/native/sun/font/layout/DeviceTables.h
+@@ -57,6 +57,7 @@
+     static const le_uint16 fieldSignBits[];
+     static const le_uint16 fieldBits[];
+ };
++LE_VAR_ARRAY(DeviceTable, deltaValues)
+ 
+ U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/ExtensionSubtables.cpp b/src/share/native/sun/font/layout/ExtensionSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/ExtensionSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/ExtensionSubtables.cpp
+@@ -47,6 +47,8 @@
+ le_uint32 ExtensionSubtable::process(const LookupProcessor *lookupProcessor, le_uint16 lookupType,
+                                       GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const
+ {
++    const LEReferenceTo<ExtensionSubtable> thisRef(lookupProcessor->getReference(), success); // create a reference to this
++
+     if (LE_FAILURE(success)) {
+         return 0;
+     }
+@@ -55,9 +57,11 @@
+ 
+     if (elt != lookupType) {
+         le_uint32 extOffset = READ_LONG(extensionOffset);
+-        LookupSubtable *subtable = (LookupSubtable *) ((char *) this + extOffset);
++        LEReferenceTo<LookupSubtable> subtable(thisRef, success, extOffset);
+ 
+-        return lookupProcessor->applySubtable(subtable, elt, glyphIterator, fontInstance, success);
++        if(LE_SUCCESS(success)) {
++          return lookupProcessor->applySubtable(subtable, elt, glyphIterator, fontInstance, success);
++        }
+     }
+ 
+     return 0;
+diff --git a/src/share/native/sun/font/layout/Features.cpp b/src/share/native/sun/font/layout/Features.cpp
+--- jdk/src/share/native/sun/font/layout/Features.cpp
++++ jdk/src/share/native/sun/font/layout/Features.cpp
+@@ -38,19 +38,20 @@
+ 
+ U_NAMESPACE_BEGIN
+ 
+-const FeatureTable *FeatureListTable::getFeatureTable(le_uint16 featureIndex, LETag *featureTag) const
++LEReferenceTo<FeatureTable> FeatureListTable::getFeatureTable(const LETableReference &base, le_uint16 featureIndex, LETag *featureTag, LEErrorCode &success) const
+ {
+-    if (featureIndex >= SWAPW(featureCount)) {
+-        return 0;
+-    }
++  if (featureIndex >= SWAPW(featureCount) || LE_FAILURE(success)) {
++    return LEReferenceTo<FeatureTable>();
++  }
+ 
+     Offset featureTableOffset = featureRecordArray[featureIndex].featureTableOffset;
+ 
+     *featureTag = SWAPT(featureRecordArray[featureIndex].featureTag);
+ 
+-    return (const FeatureTable *) ((char *) this + SWAPW(featureTableOffset));
++    return LEReferenceTo<FeatureTable>(base, success, SWAPW(featureTableOffset));
+ }
+ 
++#if 0
+ /*
+  * Note: according to the OpenType Spec. v 1.4, the entries in the Feature
+  * List Table are sorted alphabetically by feature tag; however, there seem
+@@ -82,5 +83,6 @@
+     return 0;
+ #endif
+ }
++#endif
+ 
+ U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/GDEFMarkFilter.cpp b/src/share/native/sun/font/layout/GDEFMarkFilter.cpp
+--- jdk/src/share/native/sun/font/layout/GDEFMarkFilter.cpp
++++ jdk/src/share/native/sun/font/layout/GDEFMarkFilter.cpp
+@@ -36,9 +36,12 @@
+ 
+ U_NAMESPACE_BEGIN
+ 
+-GDEFMarkFilter::GDEFMarkFilter(const GlyphDefinitionTableHeader *gdefTable)
++GDEFMarkFilter::GDEFMarkFilter(const LEReferenceTo<GlyphDefinitionTableHeader> &gdefTable, LEErrorCode &success)
++  : classDefTable(gdefTable->getGlyphClassDefinitionTable(gdefTable, success))
+ {
+-    classDefTable = gdefTable->getGlyphClassDefinitionTable();
++  if(!classDefTable.isValid()) {
++    success = LE_INTERNAL_ERROR;
++  }
+ }
+ 
+ GDEFMarkFilter::~GDEFMarkFilter()
+diff --git a/src/share/native/sun/font/layout/GDEFMarkFilter.h b/src/share/native/sun/font/layout/GDEFMarkFilter.h
+--- jdk/src/share/native/sun/font/layout/GDEFMarkFilter.h
++++ jdk/src/share/native/sun/font/layout/GDEFMarkFilter.h
+@@ -46,13 +46,13 @@
+ class GDEFMarkFilter : public UMemory, public LEGlyphFilter
+ {
+ private:
+-    const GlyphClassDefinitionTable *classDefTable;
++    const LEReferenceTo<GlyphClassDefinitionTable> classDefTable;
+ 
+     GDEFMarkFilter(const GDEFMarkFilter &other); // forbid copying of this class
+     GDEFMarkFilter &operator=(const GDEFMarkFilter &other); // forbid copying of this class
+ 
+ public:
+-    GDEFMarkFilter(const GlyphDefinitionTableHeader *gdefTable);
++    GDEFMarkFilter(const LEReferenceTo<GlyphDefinitionTableHeader> &gdefTable, LEErrorCode &success);
+     virtual ~GDEFMarkFilter();
+ 
+     virtual le_bool accept(LEGlyphID glyph) const;
+diff --git a/src/share/native/sun/font/layout/GXLayoutEngine.cpp b/src/share/native/sun/font/layout/GXLayoutEngine.cpp
+--- jdk/src/share/native/sun/font/layout/GXLayoutEngine.cpp
++++ jdk/src/share/native/sun/font/layout/GXLayoutEngine.cpp
+@@ -41,9 +41,10 @@
+ 
+ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(GXLayoutEngine)
+ 
+-GXLayoutEngine::GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const MorphTableHeader *morphTable, LEErrorCode &success)
++  GXLayoutEngine::GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const LEReferenceTo<MorphTableHeader> &morphTable, LEErrorCode &success)
+     : LayoutEngine(fontInstance, scriptCode, languageCode, 0, success), fMorphTable(morphTable)
+ {
++  fMorphTable.orphan();
+     // nothing else to do?
+ }
+ 
+@@ -70,7 +71,7 @@
+         return 0;
+     }
+ 
+-    fMorphTable->process(glyphStorage);
++    fMorphTable->process(fMorphTable, glyphStorage, success);
+ 
+     return count;
+ }
+diff --git a/src/share/native/sun/font/layout/GXLayoutEngine.h b/src/share/native/sun/font/layout/GXLayoutEngine.h
+--- jdk/src/share/native/sun/font/layout/GXLayoutEngine.h
++++ jdk/src/share/native/sun/font/layout/GXLayoutEngine.h
+@@ -74,7 +74,7 @@
+      *
+      * @internal
+      */
+-    GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const MorphTableHeader *morphTable, LEErrorCode &success);
++    GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const LEReferenceTo<MorphTableHeader> &morphTable, LEErrorCode &success);
+ 
+     /**
+      * The destructor, virtual for correct polymorphic invocation.
+@@ -104,7 +104,7 @@
+      *
+      * @internal
+      */
+-    const MorphTableHeader *fMorphTable;
++    LEReferenceTo<MorphTableHeader> fMorphTable;
+ 
+     /**
+      * This method does GX layout using the font's 'mort' table. It converts the
+diff --git a/src/share/native/sun/font/layout/GlyphDefinitionTables.cpp b/src/share/native/sun/font/layout/GlyphDefinitionTables.cpp
+--- jdk/src/share/native/sun/font/layout/GlyphDefinitionTables.cpp
++++ jdk/src/share/native/sun/font/layout/GlyphDefinitionTables.cpp
+@@ -36,24 +36,36 @@
+ 
+ U_NAMESPACE_BEGIN
+ 
+-const GlyphClassDefinitionTable *GlyphDefinitionTableHeader::getGlyphClassDefinitionTable() const
++const LEReferenceTo<GlyphClassDefinitionTable>
++GlyphDefinitionTableHeader::getGlyphClassDefinitionTable(const LEReferenceTo<GlyphDefinitionTableHeader>& base,
++                                                         LEErrorCode &success) const
+ {
+-    return (const GlyphClassDefinitionTable *) ((char *) this + SWAPW(glyphClassDefOffset));
++  if(LE_FAILURE(success)) return LEReferenceTo<GlyphClassDefinitionTable>();
++  return LEReferenceTo<GlyphClassDefinitionTable>(base, success, SWAPW(glyphClassDefOffset));
+ }
+ 
+-const AttachmentListTable *GlyphDefinitionTableHeader::getAttachmentListTable() const
++const LEReferenceTo<AttachmentListTable>
++GlyphDefinitionTableHeader::getAttachmentListTable(const LEReferenceTo<GlyphDefinitionTableHeader>& base,
++                                                         LEErrorCode &success) const
+ {
+-    return (const AttachmentListTable *) ((char *) this + SWAPW(attachListOffset));
++    if(LE_FAILURE(success)) return LEReferenceTo<AttachmentListTable>();
++    return LEReferenceTo<AttachmentListTable>(base, success, SWAPW(attachListOffset));
+ }
+ 
+-const LigatureCaretListTable *GlyphDefinitionTableHeader::getLigatureCaretListTable() const
++const LEReferenceTo<LigatureCaretListTable>
++GlyphDefinitionTableHeader::getLigatureCaretListTable(const LEReferenceTo<GlyphDefinitionTableHeader>& base,
++                                                         LEErrorCode &success) const
+ {
+-    return (const LigatureCaretListTable *) ((char *) this + SWAPW(ligCaretListOffset));
++    if(LE_FAILURE(success)) return LEReferenceTo<LigatureCaretListTable>();
++    return LEReferenceTo<LigatureCaretListTable>(base, success, SWAPW(ligCaretListOffset));
+ }
+ 
+-const MarkAttachClassDefinitionTable *GlyphDefinitionTableHeader::getMarkAttachClassDefinitionTable() const
++const LEReferenceTo<MarkAttachClassDefinitionTable>
++GlyphDefinitionTableHeader::getMarkAttachClassDefinitionTable(const LEReferenceTo<GlyphDefinitionTableHeader>& base,
++                                                         LEErrorCode &success) const
+ {
+-    return (const MarkAttachClassDefinitionTable *) ((char *) this + SWAPW(MarkAttachClassDefOffset));
++    if(LE_FAILURE(success)) return LEReferenceTo<MarkAttachClassDefinitionTable>();
++    return LEReferenceTo<MarkAttachClassDefinitionTable>(base, success, SWAPW(MarkAttachClassDefOffset));
+ }
+ 
+ U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/GlyphDefinitionTables.h b/src/share/native/sun/font/layout/GlyphDefinitionTables.h
+--- jdk/src/share/native/sun/font/layout/GlyphDefinitionTables.h
++++ jdk/src/share/native/sun/font/layout/GlyphDefinitionTables.h
+@@ -60,12 +60,14 @@
+     le_uint16  glyphCount;
+     Offset  attachPointTableOffsetArray[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(AttachmentListTable, attachPointTableOffsetArray)
+ 
+ struct AttachPointTable
+ {
+     le_uint16  pointCount;
+     le_uint16  pointIndexArray[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(AttachPointTable, pointIndexArray)
+ 
+ struct LigatureCaretListTable
+ {
+@@ -73,12 +75,14 @@
+     le_uint16  ligGlyphCount;
+     Offset  ligGlyphTableOffsetArray[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(LigatureCaretListTable, ligGlyphTableOffsetArray)
+ 
+ struct LigatureGlyphTable
+ {
+     le_uint16  caretCount;
+     Offset  caretValueTableOffsetArray[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(LigatureGlyphTable, caretValueTableOffsetArray)
+ 
+ struct CaretValueTable
+ {
+@@ -111,10 +115,18 @@
+     Offset  ligCaretListOffset;
+     Offset  MarkAttachClassDefOffset;
+ 
+-    const GlyphClassDefinitionTable *getGlyphClassDefinitionTable() const;
+-    const AttachmentListTable *getAttachmentListTable()const ;
+-    const LigatureCaretListTable *getLigatureCaretListTable() const;
+-    const MarkAttachClassDefinitionTable *getMarkAttachClassDefinitionTable() const;
++    const LEReferenceTo<GlyphClassDefinitionTable>
++    getGlyphClassDefinitionTable(const LEReferenceTo<GlyphDefinitionTableHeader>& base,
++                                 LEErrorCode &success) const;
++    const LEReferenceTo<AttachmentListTable>
++    getAttachmentListTable(const LEReferenceTo<GlyphDefinitionTableHeader>& base,
++                           LEErrorCode &success)const ;
++    const LEReferenceTo<LigatureCaretListTable>
++    getLigatureCaretListTable(const LEReferenceTo<GlyphDefinitionTableHeader>& base,
++                              LEErrorCode &success) const;
++    const LEReferenceTo<MarkAttachClassDefinitionTable>
++    getMarkAttachClassDefinitionTable(const LEReferenceTo<GlyphDefinitionTableHeader>& base,
++                                      LEErrorCode &success) const;
+ };
+ 
+ U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/GlyphIterator.cpp b/src/share/native/sun/font/layout/GlyphIterator.cpp
+--- jdk/src/share/native/sun/font/layout/GlyphIterator.cpp
++++ jdk/src/share/native/sun/font/layout/GlyphIterator.cpp
+@@ -41,18 +41,21 @@
+ U_NAMESPACE_BEGIN
+ 
+ GlyphIterator::GlyphIterator(LEGlyphStorage &theGlyphStorage, GlyphPositionAdjustments *theGlyphPositionAdjustments, le_bool rightToLeft, le_uint16 theLookupFlags,
+-                             FeatureMask theFeatureMask, const GlyphDefinitionTableHeader *theGlyphDefinitionTableHeader)
++                             FeatureMask theFeatureMask, const LEReferenceTo<GlyphDefinitionTableHeader> &theGlyphDefinitionTableHeader)
+   : direction(1), position(-1), nextLimit(-1), prevLimit(-1),
+     glyphStorage(theGlyphStorage), glyphPositionAdjustments(theGlyphPositionAdjustments),
+     srcIndex(-1), destIndex(-1), lookupFlags(theLookupFlags), featureMask(theFeatureMask), glyphGroup(0),
+-    glyphClassDefinitionTable(NULL), markAttachClassDefinitionTable(NULL)
++    glyphClassDefinitionTable(), markAttachClassDefinitionTable()
+ 
+ {
++  LEErrorCode success = LE_NO_ERROR; // TODO
+     le_int32 glyphCount = glyphStorage.getGlyphCount();
+ 
+-    if (theGlyphDefinitionTableHeader != NULL) {
+-        glyphClassDefinitionTable = theGlyphDefinitionTableHeader->getGlyphClassDefinitionTable();
+-        markAttachClassDefinitionTable = theGlyphDefinitionTableHeader->getMarkAttachClassDefinitionTable();
++    if (theGlyphDefinitionTableHeader.isValid()) {
++      glyphClassDefinitionTable = theGlyphDefinitionTableHeader
++        -> getGlyphClassDefinitionTable(theGlyphDefinitionTableHeader, success);
++      markAttachClassDefinitionTable = theGlyphDefinitionTableHeader
++        ->getMarkAttachClassDefinitionTable(theGlyphDefinitionTableHeader, success);
+     }
+ 
+     nextLimit = glyphCount;
+@@ -380,6 +383,7 @@
+ 
+ le_bool GlyphIterator::filterGlyph(le_uint32 index) const
+ {
++    LEErrorCode success = LE_NO_ERROR;
+     LEGlyphID glyphID = glyphStorage[index];
+     le_int32 glyphClass = gcdNoGlyphClass;
+ 
+@@ -387,8 +391,8 @@
+         return TRUE;
+     }
+ 
+-    if (glyphClassDefinitionTable != NULL) {
+-        glyphClass = glyphClassDefinitionTable->getGlyphClass(glyphID);
++    if (glyphClassDefinitionTable.isValid()) {
++      glyphClass = glyphClassDefinitionTable->getGlyphClass(glyphClassDefinitionTable, glyphID, success);
+     }
+ 
+     switch (glyphClass)
+@@ -410,8 +414,9 @@
+ 
+         le_uint16 markAttachType = (lookupFlags & lfMarkAttachTypeMask) >> lfMarkAttachTypeShift;
+ 
+-        if ((markAttachType != 0) && (markAttachClassDefinitionTable != NULL)) {
+-            return markAttachClassDefinitionTable->getGlyphClass(glyphID) != markAttachType;
++        if ((markAttachType != 0) && (markAttachClassDefinitionTable.isValid())) {
++          return markAttachClassDefinitionTable
++            -> getGlyphClass(markAttachClassDefinitionTable, glyphID, success) != markAttachType;
+         }
+ 
+         return FALSE;
+@@ -461,6 +466,7 @@
+     while (newPosition != nextLimit && delta > 0) {
+         do {
+             newPosition += direction;
++            //fprintf(stderr,"%s:%d:%s: newPosition = %d, delta = %d\n", __FILE__, __LINE__, __FUNCTION__, newPosition, delta);
+         } while (newPosition != nextLimit && filterGlyph(newPosition));
+ 
+         delta -= 1;
+@@ -468,6 +474,7 @@
+ 
+     position = newPosition;
+ 
++    //fprintf(stderr,"%s:%d:%s: exit position = %d, delta = %d\n", __FILE__, __LINE__, __FUNCTION__, position, delta);
+     return position != nextLimit;
+ }
+ 
+@@ -483,6 +490,7 @@
+     while (newPosition != prevLimit && delta > 0) {
+         do {
+             newPosition -= direction;
++            //fprintf(stderr,"%s:%d:%s: newPosition = %d, delta = %d\n", __FILE__, __LINE__, __FUNCTION__, newPosition, delta);
+         } while (newPosition != prevLimit && filterGlyph(newPosition));
+ 
+         delta -= 1;
+@@ -490,6 +498,7 @@
+ 
+     position = newPosition;
+ 
++    //fprintf(stderr,"%s:%d:%s: exit position = %d, delta = %d\n", __FILE__, __LINE__, __FUNCTION__, position, delta);
+     return position != prevLimit;
+ }
+ 
+diff --git a/src/share/native/sun/font/layout/GlyphIterator.h b/src/share/native/sun/font/layout/GlyphIterator.h
+--- jdk/src/share/native/sun/font/layout/GlyphIterator.h
++++ jdk/src/share/native/sun/font/layout/GlyphIterator.h
+@@ -49,7 +49,7 @@
+ class GlyphIterator : public UMemory {
+ public:
+     GlyphIterator(LEGlyphStorage &theGlyphStorage, GlyphPositionAdjustments *theGlyphPositionAdjustments, le_bool rightToLeft, le_uint16 theLookupFlags,
+-        FeatureMask theFeatureMask, const GlyphDefinitionTableHeader *theGlyphDefinitionTableHeader);
++                  FeatureMask theFeatureMask, const LEReferenceTo<GlyphDefinitionTableHeader> &theGlyphDefinitionTableHeader);
+ 
+     GlyphIterator(GlyphIterator &that);
+ 
+@@ -117,8 +117,8 @@
+     FeatureMask featureMask;
+     le_int32    glyphGroup;
+ 
+-    const GlyphClassDefinitionTable *glyphClassDefinitionTable;
+-    const MarkAttachClassDefinitionTable *markAttachClassDefinitionTable;
++    LEReferenceTo<GlyphClassDefinitionTable> glyphClassDefinitionTable;
++    LEReferenceTo<MarkAttachClassDefinitionTable> markAttachClassDefinitionTable;
+ 
+     GlyphIterator &operator=(const GlyphIterator &other); // forbid copying of this class
+ };
+diff --git a/src/share/native/sun/font/layout/GlyphLookupTables.cpp b/src/share/native/sun/font/layout/GlyphLookupTables.cpp
+--- jdk/src/share/native/sun/font/layout/GlyphLookupTables.cpp
++++ jdk/src/share/native/sun/font/layout/GlyphLookupTables.cpp
+@@ -37,21 +37,22 @@
+ 
+ U_NAMESPACE_BEGIN
+ 
+-le_bool GlyphLookupTableHeader::coversScript(LETag scriptTag) const
++le_bool GlyphLookupTableHeader::coversScript(const LETableReference &base, LETag scriptTag, LEErrorCode &success) const
+ {
+-    const ScriptListTable *scriptListTable = (const ScriptListTable *) ((char *)this + SWAPW(scriptListOffset));
++  LEReferenceTo<ScriptListTable> scriptListTable(base, success, SWAPW(scriptListOffset));
+ 
+-    return scriptListOffset != 0 && scriptListTable->findScript(scriptTag) != NULL;
++  return (scriptListOffset != 0) && scriptListTable->findScript(scriptListTable, scriptTag, success) .isValid();
+ }
+ 
+-le_bool GlyphLookupTableHeader::coversScriptAndLanguage(LETag scriptTag, LETag languageTag, le_bool exactMatch) const
++le_bool GlyphLookupTableHeader::coversScriptAndLanguage(const LETableReference &base, LETag scriptTag, LETag languageTag, LEErrorCode &success, le_bool exactMatch) const
+ {
+-    const ScriptListTable *scriptListTable = (const ScriptListTable *) ((char *)this + SWAPW(scriptListOffset));
+-    const LangSysTable    *langSysTable    = scriptListTable->findLanguage(scriptTag, languageTag, exactMatch);
++  LEReferenceTo<ScriptListTable> scriptListTable(base, success, SWAPW(scriptListOffset));
++  LEReferenceTo<LangSysTable> langSysTable = scriptListTable->findLanguage(scriptListTable,
++                                    scriptTag, languageTag, success, exactMatch);
+ 
+     // FIXME: could check featureListOffset, lookupListOffset, and lookup count...
+     // Note: don't have to SWAPW langSysTable->featureCount to check for non-zero.
+-    return langSysTable != NULL && langSysTable->featureCount != 0;
++  return LE_SUCCESS(success)&&langSysTable.isValid() && langSysTable->featureCount != 0;
+ }
+ 
+ U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/GlyphLookupTables.h b/src/share/native/sun/font/layout/GlyphLookupTables.h
+--- jdk/src/share/native/sun/font/layout/GlyphLookupTables.h
++++ jdk/src/share/native/sun/font/layout/GlyphLookupTables.h
+@@ -49,8 +49,8 @@
+     Offset  featureListOffset;
+     Offset  lookupListOffset;
+ 
+-    le_bool coversScript(LETag scriptTag) const;
+-    le_bool coversScriptAndLanguage(LETag scriptTag, LETag languageTag, le_bool exactMatch = FALSE) const;
++  le_bool coversScript(const LETableReference &base, LETag scriptTag, LEErrorCode &success) const;
++  le_bool coversScriptAndLanguage(const LETableReference &base, LETag scriptTag, LETag languageTag, LEErrorCode &success, le_bool exactMatch = FALSE) const;
+ };
+ 
+ U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/GlyphPositioningTables.cpp b/src/share/native/sun/font/layout/GlyphPositioningTables.cpp
+--- jdk/src/share/native/sun/font/layout/GlyphPositioningTables.cpp
++++ jdk/src/share/native/sun/font/layout/GlyphPositioningTables.cpp
+@@ -41,16 +41,16 @@
+ 
+ U_NAMESPACE_BEGIN
+ 
+-void GlyphPositioningTableHeader::process(LEGlyphStorage &glyphStorage, GlyphPositionAdjustments *glyphPositionAdjustments, le_bool rightToLeft,
++void GlyphPositioningTableHeader::process(const LEReferenceTo<GlyphPositioningTableHeader> &base, LEGlyphStorage &glyphStorage, GlyphPositionAdjustments *glyphPositionAdjustments, le_bool rightToLeft,
+                                           LETag scriptTag, LETag languageTag,
+-                                          const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, LEErrorCode &success,
++                                          const LEReferenceTo<GlyphDefinitionTableHeader> &glyphDefinitionTableHeader, LEErrorCode &success,
+                                           const LEFontInstance *fontInstance, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder) const
+ {
+     if (LE_FAILURE(success)) {
+         return;
+     }
+ 
+-    GlyphPositioningLookupProcessor processor(this, scriptTag, languageTag, featureMap, featureMapCount, featureOrder, success);
++    GlyphPositioningLookupProcessor processor(base, scriptTag, languageTag, featureMap, featureMapCount, featureOrder, success);
+     if (LE_FAILURE(success)) {
+         return;
+     }
+diff --git a/src/share/native/sun/font/layout/GlyphPositioningTables.h b/src/share/native/sun/font/layout/GlyphPositioningTables.h
+--- jdk/src/share/native/sun/font/layout/GlyphPositioningTables.h
++++ jdk/src/share/native/sun/font/layout/GlyphPositioningTables.h
+@@ -40,6 +40,7 @@
+ #include "OpenTypeTables.h"
+ #include "Lookups.h"
+ #include "GlyphLookupTables.h"
++#include "LETableReference.h"
+ 
+ U_NAMESPACE_BEGIN
+ 
+@@ -51,9 +52,9 @@
+ 
+ struct GlyphPositioningTableHeader : public GlyphLookupTableHeader
+ {
+-    void    process(LEGlyphStorage &glyphStorage, GlyphPositionAdjustments *glyphPositionAdjustments,
++  void    process(const LEReferenceTo<GlyphPositioningTableHeader> &base, LEGlyphStorage &glyphStorage, GlyphPositionAdjustments *glyphPositionAdjustments,
+                 le_bool rightToLeft, LETag scriptTag, LETag languageTag,
+-                const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, LEErrorCode &success,
++                const LEReferenceTo<GlyphDefinitionTableHeader> &glyphDefinitionTableHeader, LEErrorCode &success,
+                 const LEFontInstance *fontInstance, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder) const;
+ };
+ 
+diff --git a/src/share/native/sun/font/layout/GlyphPosnLookupProc.cpp b/src/share/native/sun/font/layout/GlyphPosnLookupProc.cpp
+--- jdk/src/share/native/sun/font/layout/GlyphPosnLookupProc.cpp
++++ jdk/src/share/native/sun/font/layout/GlyphPosnLookupProc.cpp
+@@ -57,7 +57,7 @@
+ typedef ChainingContextualSubstitutionSubtable ChainingContextualPositioningSubtable;
+ 
+ GlyphPositioningLookupProcessor::GlyphPositioningLookupProcessor(
+-        const GlyphPositioningTableHeader *glyphPositioningTableHeader,
++        const LEReferenceTo<GlyphPositioningTableHeader> &glyphPositioningTableHeader,
+         LETag scriptTag,
+         LETag languageTag,
+         const FeatureMap *featureMap,
+@@ -65,7 +65,7 @@
+         le_bool featureOrder,
+         LEErrorCode& success)
+     : LookupProcessor(
+-                      (char *) glyphPositioningTableHeader,
++                      glyphPositioningTableHeader,
+                       SWAPW(glyphPositioningTableHeader->scriptListOffset),
+                       SWAPW(glyphPositioningTableHeader->featureListOffset),
+                       SWAPW(glyphPositioningTableHeader->lookupListOffset),
+@@ -84,7 +84,7 @@
+ {
+ }
+ 
+-le_uint32 GlyphPositioningLookupProcessor::applySubtable(const LookupSubtable *lookupSubtable, le_uint16 lookupType,
++le_uint32 GlyphPositioningLookupProcessor::applySubtable(const LEReferenceTo<LookupSubtable> &lookupSubtable, le_uint16 lookupType,
+                                                        GlyphIterator *glyphIterator,
+                                                        const LEFontInstance *fontInstance,
+                                                        LEErrorCode& success) const
+@@ -102,55 +102,55 @@
+ 
+     case gpstSingle:
+     {
+-        const SinglePositioningSubtable *subtable = (const SinglePositioningSubtable *) lookupSubtable;
++      LEReferenceTo<SinglePositioningSubtable> subtable(lookupSubtable, success);
+ 
+-        delta = subtable->process(glyphIterator, fontInstance);
++        delta = subtable->process(subtable, glyphIterator, fontInstance, success);
+         break;
+     }
+ 
+     case gpstPair:
+     {
+-        const PairPositioningSubtable *subtable = (const PairPositioningSubtable *) lookupSubtable;
++        LEReferenceTo<PairPositioningSubtable> subtable(lookupSubtable, success);
+ 
+-        delta = subtable->process(glyphIterator, fontInstance);
++        delta = subtable->process(subtable, glyphIterator, fontInstance, success);
+         break;
+     }
+ 
+     case gpstCursive:
+     {
+-        const CursiveAttachmentSubtable *subtable = (const CursiveAttachmentSubtable *) lookupSubtable;
++        LEReferenceTo<CursiveAttachmentSubtable> subtable(lookupSubtable, success);
+ 
+-        delta = subtable->process(glyphIterator, fontInstance);
++        delta = subtable->process(subtable, glyphIterator, fontInstance, success);
+         break;
+     }
+ 
+     case gpstMarkToBase:
+     {
+-        const MarkToBasePositioningSubtable *subtable = (const MarkToBasePositioningSubtable *) lookupSubtable;
++        LEReferenceTo<MarkToBasePositioningSubtable> subtable(lookupSubtable, success);
+ 
+-        delta = subtable->process(glyphIterator, fontInstance);
++        delta = subtable->process(subtable, glyphIterator, fontInstance, success);
+         break;
+     }
+ 
+      case gpstMarkToLigature:
+     {
+-        const MarkToLigaturePositioningSubtable *subtable = (const MarkToLigaturePositioningSubtable *) lookupSubtable;
++        LEReferenceTo<MarkToLigaturePositioningSubtable> subtable(lookupSubtable, success);
+ 
+-        delta = subtable->process(glyphIterator, fontInstance);
++        delta = subtable->process(subtable, glyphIterator, fontInstance, success);
+         break;
+     }
+ 
+     case gpstMarkToMark:
+     {
+-        const MarkToMarkPositioningSubtable *subtable = (const MarkToMarkPositioningSubtable *) lookupSubtable;
++        LEReferenceTo<MarkToMarkPositioningSubtable> subtable(lookupSubtable, success);
+ 
+-        delta = subtable->process(glyphIterator, fontInstance);
++        delta = subtable->process(subtable, glyphIterator, fontInstance, success);
+         break;
+     }
+ 
+    case gpstContext:
+     {
+-        const ContextualPositioningSubtable *subtable = (const ContextualPositioningSubtable *) lookupSubtable;
++        LEReferenceTo<ContextualPositioningSubtable> subtable(lookupSubtable, success);
+ 
+         delta = subtable->process(this, glyphIterator, fontInstance, success);
+         break;
+@@ -158,7 +158,7 @@
+ 
+     case gpstChainedContext:
+     {
+-        const ChainingContextualPositioningSubtable *subtable = (const ChainingContextualPositioningSubtable *) lookupSubtable;
++        LEReferenceTo<ChainingContextualPositioningSubtable> subtable(lookupSubtable, success);
+ 
+         delta = subtable->process(this, glyphIterator, fontInstance, success);
+         break;
+@@ -166,7 +166,7 @@
+ 
+     case gpstExtension:
+     {
+-        const ExtensionSubtable *subtable = (const ExtensionSubtable *) lookupSubtable;
++        LEReferenceTo<ExtensionSubtable> subtable(lookupSubtable, success);
+ 
+         delta = subtable->process(this, lookupType, glyphIterator, fontInstance, success);
+         break;
+diff --git a/src/share/native/sun/font/layout/GlyphPosnLookupProc.h b/src/share/native/sun/font/layout/GlyphPosnLookupProc.h
+--- jdk/src/share/native/sun/font/layout/GlyphPosnLookupProc.h
++++ jdk/src/share/native/sun/font/layout/GlyphPosnLookupProc.h
+@@ -51,7 +51,7 @@
+ class GlyphPositioningLookupProcessor : public LookupProcessor
+ {
+ public:
+-    GlyphPositioningLookupProcessor(const GlyphPositioningTableHeader *glyphPositioningTableHeader,
++    GlyphPositioningLookupProcessor(const LEReferenceTo<GlyphPositioningTableHeader> &glyphPositioningTableHeader,
+         LETag scriptTag,
+         LETag languageTag,
+         const FeatureMap *featureMap,
+@@ -61,7 +61,7 @@
+ 
+     virtual ~GlyphPositioningLookupProcessor();
+ 
+-    virtual le_uint32 applySubtable(const LookupSubtable *lookupSubtable, le_uint16 lookupType, GlyphIterator *glyphIterator,
++    virtual le_uint32 applySubtable(const LEReferenceTo<LookupSubtable> &lookupSubtable, le_uint16 lookupType, GlyphIterator *glyphIterator,
+         const LEFontInstance *fontInstance, LEErrorCode& success) const;
+ 
+ protected:
+diff --git a/src/share/native/sun/font/layout/GlyphSubstLookupProc.cpp b/src/share/native/sun/font/layout/GlyphSubstLookupProc.cpp
+--- jdk/src/share/native/sun/font/layout/GlyphSubstLookupProc.cpp
++++ jdk/src/share/native/sun/font/layout/GlyphSubstLookupProc.cpp
+@@ -51,7 +51,7 @@
+ U_NAMESPACE_BEGIN
+ 
+ GlyphSubstitutionLookupProcessor::GlyphSubstitutionLookupProcessor(
+-        const GlyphSubstitutionTableHeader *glyphSubstitutionTableHeader,
++        const LEReferenceTo<GlyphSubstitutionTableHeader> &glyphSubstitutionTableHeader,
+         LETag scriptTag,
+         LETag languageTag,
+         const LEGlyphFilter *filter,
+@@ -60,7 +60,7 @@
+         le_bool featureOrder,
+         LEErrorCode& success)
+     : LookupProcessor(
+-                      (char *) glyphSubstitutionTableHeader,
++                      glyphSubstitutionTableHeader,
+                       SWAPW(glyphSubstitutionTableHeader->scriptListOffset),
+                       SWAPW(glyphSubstitutionTableHeader->featureListOffset),
+                       SWAPW(glyphSubstitutionTableHeader->lookupListOffset),
+@@ -73,7 +73,7 @@
+ {
+ }
+ 
+-le_uint32 GlyphSubstitutionLookupProcessor::applySubtable(const LookupSubtable *lookupSubtable, le_uint16 lookupType,
++le_uint32 GlyphSubstitutionLookupProcessor::applySubtable(const LEReferenceTo<LookupSubtable> &lookupSubtable, le_uint16 lookupType,
+                                                        GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const
+ {
+     if (LE_FAILURE(success)) {
+@@ -89,39 +89,39 @@
+ 
+     case gsstSingle:
+     {
+-        const SingleSubstitutionSubtable *subtable = (const SingleSubstitutionSubtable *) lookupSubtable;
++        const LEReferenceTo<SingleSubstitutionSubtable> subtable(lookupSubtable, success);
+ 
+-        delta = subtable->process(glyphIterator, fFilter);
++        delta = subtable->process(subtable, glyphIterator, success, fFilter);
+         break;
+     }
+ 
+     case gsstMultiple:
+     {
+-        const MultipleSubstitutionSubtable *subtable = (const MultipleSubstitutionSubtable *) lookupSubtable;
++        const LEReferenceTo<MultipleSubstitutionSubtable> subtable(lookupSubtable, success);
+ 
+-        delta = subtable->process(glyphIterator, success, fFilter);
++        delta = subtable->process(subtable, glyphIterator, success, fFilter);
+         break;
+     }
+ 
+     case gsstAlternate:
+     {
+-        const AlternateSubstitutionSubtable *subtable = (const AlternateSubstitutionSubtable *) lookupSubtable;
++        const LEReferenceTo<AlternateSubstitutionSubtable> subtable(lookupSubtable, success);
+ 
+-        delta = subtable->process(glyphIterator, fFilter);
++        delta = subtable->process(subtable, glyphIterator, success, fFilter);
+         break;
+     }
+ 
+     case gsstLigature:
+     {
+-        const LigatureSubstitutionSubtable *subtable = (const LigatureSubstitutionSubtable *) lookupSubtable;
++        const LEReferenceTo<LigatureSubstitutionSubtable> subtable(lookupSubtable, success);
+ 
+-        delta = subtable->process(glyphIterator, fFilter);
++        delta = subtable->process(subtable, glyphIterator, success, fFilter);
+         break;
+     }
+ 
+     case gsstContext:
+     {
+-        const ContextualSubstitutionSubtable *subtable = (const ContextualSubstitutionSubtable *) lookupSubtable;
++        const LEReferenceTo<ContextualSubstitutionSubtable> subtable(lookupSubtable, success);
+ 
+         delta = subtable->process(this, glyphIterator, fontInstance, success);
+         break;
+@@ -129,7 +129,7 @@
+ 
+     case gsstChainingContext:
+     {
+-        const ChainingContextualSubstitutionSubtable *subtable = (const ChainingContextualSubstitutionSubtable *) lookupSubtable;
++        const LEReferenceTo<ChainingContextualSubstitutionSubtable> subtable(lookupSubtable, success);
+ 
+         delta = subtable->process(this, glyphIterator, fontInstance, success);
+         break;
+@@ -137,7 +137,7 @@
+ 
+     case gsstExtension:
+     {
+-        const ExtensionSubtable *subtable = (const ExtensionSubtable *) lookupSubtable;
++        const LEReferenceTo<ExtensionSubtable> subtable(lookupSubtable, success);
+ 
+         delta = subtable->process(this, lookupType, glyphIterator, fontInstance, success);
+         break;
+diff --git a/src/share/native/sun/font/layout/GlyphSubstLookupProc.h b/src/share/native/sun/font/layout/GlyphSubstLookupProc.h
+--- jdk/src/share/native/sun/font/layout/GlyphSubstLookupProc.h
++++ jdk/src/share/native/sun/font/layout/GlyphSubstLookupProc.h
+@@ -52,7 +52,7 @@
+ class GlyphSubstitutionLookupProcessor : public LookupProcessor
+ {
+ public:
+-    GlyphSubstitutionLookupProcessor(const GlyphSubstitutionTableHeader *glyphSubstitutionTableHeader,
++    GlyphSubstitutionLookupProcessor(const LEReferenceTo<GlyphSubstitutionTableHeader> &glyphSubstitutionTableHeader,
+         LETag scriptTag,
+         LETag languageTag,
+         const LEGlyphFilter *filter,
+@@ -63,7 +63,7 @@
+ 
+     virtual ~GlyphSubstitutionLookupProcessor();
+ 
+-    virtual le_uint32 applySubtable(const LookupSubtable *lookupSubtable, le_uint16 lookupType, GlyphIterator *glyphIterator,
++    virtual le_uint32 applySubtable(const LEReferenceTo<LookupSubtable> &lookupSubtable, le_uint16 lookupType, GlyphIterator *glyphIterator,
+         const LEFontInstance *fontInstance, LEErrorCode& success) const;
+ 
+ protected:
+diff --git a/src/share/native/sun/font/layout/GlyphSubstitutionTables.cpp b/src/share/native/sun/font/layout/GlyphSubstitutionTables.cpp
+--- jdk/src/share/native/sun/font/layout/GlyphSubstitutionTables.cpp
++++ jdk/src/share/native/sun/font/layout/GlyphSubstitutionTables.cpp
+@@ -42,11 +42,12 @@
+ 
+ U_NAMESPACE_BEGIN
+ 
+-le_int32 GlyphSubstitutionTableHeader::process(LEGlyphStorage &glyphStorage,
++le_int32 GlyphSubstitutionTableHeader::process(const LEReferenceTo<GlyphSubstitutionTableHeader> &base,
++                                               LEGlyphStorage &glyphStorage,
+                                                le_bool rightToLeft,
+                                                LETag scriptTag,
+                                                LETag languageTag,
+-                                           const GlyphDefinitionTableHeader *glyphDefinitionTableHeader,
++                                               const LEReferenceTo<GlyphDefinitionTableHeader> &glyphDefinitionTableHeader,
+                                                const LEGlyphFilter *filter,
+                                                const FeatureMap *featureMap,
+                                                le_int32 featureMapCount,
+@@ -57,7 +58,7 @@
+         return 0;
+     }
+ 
+-    GlyphSubstitutionLookupProcessor processor(this, scriptTag, languageTag, filter, featureMap, featureMapCount, featureOrder, success);
++    GlyphSubstitutionLookupProcessor processor(base, scriptTag, languageTag, filter, featureMap, featureMapCount, featureOrder, success);
+     return processor.process(glyphStorage, NULL, rightToLeft, glyphDefinitionTableHeader, NULL, success);
+ }
+ 
+diff --git a/src/share/native/sun/font/layout/GlyphSubstitutionTables.h b/src/share/native/sun/font/layout/GlyphSubstitutionTables.h
+--- jdk/src/share/native/sun/font/layout/GlyphSubstitutionTables.h
++++ jdk/src/share/native/sun/font/layout/GlyphSubstitutionTables.h
+@@ -50,11 +50,12 @@
+ 
+ struct GlyphSubstitutionTableHeader : public GlyphLookupTableHeader
+ {
+-    le_int32    process(LEGlyphStorage &glyphStorage,
++  le_int32    process(const LEReferenceTo<GlyphSubstitutionTableHeader> &base,
++                      LEGlyphStorage &glyphStorage,
+                         le_bool rightToLeft,
+                         LETag scriptTag,
+                         LETag languageTag,
+-                        const GlyphDefinitionTableHeader *glyphDefinitionTableHeader,
++                        const LEReferenceTo<GlyphDefinitionTableHeader> &glyphDefinitionTableHeader,
+                         const LEGlyphFilter *filter,
+                         const FeatureMap *featureMap,
+                         le_int32 featureMapCount,
+diff --git a/src/share/native/sun/font/layout/HanLayoutEngine.cpp b/src/share/native/sun/font/layout/HanLayoutEngine.cpp
+--- jdk/src/share/native/sun/font/layout/HanLayoutEngine.cpp
++++ jdk/src/share/native/sun/font/layout/HanLayoutEngine.cpp
+@@ -64,7 +64,7 @@
+ #define features (loclFeatureMask)
+ 
+ HanOpenTypeLayoutEngine::HanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                        le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success)
++                                                 le_int32 typoFlags, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, LEErrorCode &success)
+     : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success)
+ {
+     fFeatureMap      = featureMap;
+diff --git a/src/share/native/sun/font/layout/HanLayoutEngine.h b/src/share/native/sun/font/layout/HanLayoutEngine.h
+--- jdk/src/share/native/sun/font/layout/HanLayoutEngine.h
++++ jdk/src/share/native/sun/font/layout/HanLayoutEngine.h
+@@ -73,7 +73,7 @@
+      * @internal
+      */
+     HanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                            le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTablem, LEErrorCode &success);
++                            le_int32 typoFlags, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTablem, LEErrorCode &success);
+ 
+ 
+     /**
+diff --git a/src/share/native/sun/font/layout/HangulLayoutEngine.cpp b/src/share/native/sun/font/layout/HangulLayoutEngine.cpp
+--- jdk/src/share/native/sun/font/layout/HangulLayoutEngine.cpp
++++ jdk/src/share/native/sun/font/layout/HangulLayoutEngine.cpp
+@@ -209,7 +209,7 @@
+ }
+ 
+ HangulOpenTypeLayoutEngine::HangulOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 /*languageCode*/,
+-                                       le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success)
++                                                       le_int32 typoFlags, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, LEErrorCode &success)
+     : OpenTypeLayoutEngine(fontInstance, scriptCode, korLanguageCode, typoFlags, gsubTable, success)
+ {
+     fFeatureMap = featureMap;
+diff --git a/src/share/native/sun/font/layout/HangulLayoutEngine.h b/src/share/native/sun/font/layout/HangulLayoutEngine.h
+--- jdk/src/share/native/sun/font/layout/HangulLayoutEngine.h
++++ jdk/src/share/native/sun/font/layout/HangulLayoutEngine.h
+@@ -79,7 +79,7 @@
+      * @internal
+      */
+     HangulOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                            le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success);
++                               le_int32 typoFlags, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, LEErrorCode &success);
+ 
+     /**
+      * This constructor is used when the font requires a "canned" GSUB table which can't be known
+diff --git a/src/share/native/sun/font/layout/ICUFeatures.h b/src/share/native/sun/font/layout/ICUFeatures.h
+--- jdk/src/share/native/sun/font/layout/ICUFeatures.h
++++ jdk/src/share/native/sun/font/layout/ICUFeatures.h
+@@ -54,16 +54,21 @@
+     le_uint16   lookupCount;
+     le_uint16   lookupListIndexArray[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(FeatureTable, lookupListIndexArray)
+ 
+ struct FeatureListTable
+ {
+     le_uint16           featureCount;
+     FeatureRecord       featureRecordArray[ANY_NUMBER];
+ 
+-    const FeatureTable  *getFeatureTable(le_uint16 featureIndex, LETag *featureTag) const;
++  LEReferenceTo<FeatureTable>  getFeatureTable(const LETableReference &base, le_uint16 featureIndex, LETag *featureTag, LEErrorCode &success) const;
+ 
+-    const FeatureTable *getFeatureTable(LETag featureTag) const;
++#if 0
++  const LEReferenceTo<FeatureTable>  getFeatureTable(const LETableReference &base, LETag featureTag, LEErrorCode &success) const;
++#endif
+ };
+ 
++LE_VAR_ARRAY(FeatureListTable, featureRecordArray)
++
+ U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/IndicLayoutEngine.cpp b/src/share/native/sun/font/layout/IndicLayoutEngine.cpp
+--- jdk/src/share/native/sun/font/layout/IndicLayoutEngine.cpp
++++ jdk/src/share/native/sun/font/layout/IndicLayoutEngine.cpp
+@@ -50,7 +50,7 @@
+ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(IndicOpenTypeLayoutEngine)
+ 
+ IndicOpenTypeLayoutEngine::IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                    le_int32 typoFlags, le_bool version2, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success)
++                                                     le_int32 typoFlags, le_bool version2, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, LEErrorCode &success)
+     : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success), fMPreFixups(NULL)
+ {
+         if ( version2 ) {
+diff --git a/src/share/native/sun/font/layout/IndicLayoutEngine.h b/src/share/native/sun/font/layout/IndicLayoutEngine.h
+--- jdk/src/share/native/sun/font/layout/IndicLayoutEngine.h
++++ jdk/src/share/native/sun/font/layout/IndicLayoutEngine.h
+@@ -81,7 +81,7 @@
+      * @internal
+      */
+     IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                            le_int32 typoFlags, le_bool version2, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success);
++                            le_int32 typoFlags, le_bool version2, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, LEErrorCode &success);
+ 
+     /**
+      * This constructor is used when the font requires a "canned" GSUB table which can't be known
+diff --git a/src/share/native/sun/font/layout/IndicRearrangementProcessor.cpp b/src/share/native/sun/font/layout/IndicRearrangementProcessor.cpp
+--- jdk/src/share/native/sun/font/layout/IndicRearrangementProcessor.cpp
++++ jdk/src/share/native/sun/font/layout/IndicRearrangementProcessor.cpp
+@@ -43,11 +43,14 @@
+ 
+ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(IndicRearrangementProcessor)
+ 
+-IndicRearrangementProcessor::IndicRearrangementProcessor(const MorphSubtableHeader *morphSubtableHeader)
+-  : StateTableProcessor(morphSubtableHeader)
++  IndicRearrangementProcessor::IndicRearrangementProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success)
++  : StateTableProcessor(morphSubtableHeader, success),
++  indicRearrangementSubtableHeader(morphSubtableHeader, success),
++  entryTable(stateTableHeader, success, (const IndicRearrangementStateEntry*)(&stateTableHeader->stHeader),
++             entryTableOffset, LE_UNBOUNDED_ARRAY),
++  int16Table(stateTableHeader, success, (const le_int16*)entryTable.getAlias(), 0, LE_UNBOUNDED_ARRAY)
++
+ {
+-    indicRearrangementSubtableHeader = (const IndicRearrangementSubtableHeader *) morphSubtableHeader;
+-    entryTable = (const IndicRearrangementStateEntry *) ((char *) &stateTableHeader->stHeader + entryTableOffset);
+ }
+ 
+ IndicRearrangementProcessor::~IndicRearrangementProcessor()
+@@ -62,7 +65,8 @@
+ 
+ ByteOffset IndicRearrangementProcessor::processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index)
+ {
+-    const IndicRearrangementStateEntry *entry = &entryTable[index];
++  LEErrorCode success = LE_NO_ERROR; // todo- make a param?
++  const IndicRearrangementStateEntry *entry = entryTable.getAlias(index,success);
+     ByteOffset newState = SWAPW(entry->newStateOffset);
+     IndicRearrangementFlags flags = (IndicRearrangementFlags) SWAPW(entry->flags);
+ 
+diff --git a/src/share/native/sun/font/layout/IndicRearrangementProcessor.h b/src/share/native/sun/font/layout/IndicRearrangementProcessor.h
+--- jdk/src/share/native/sun/font/layout/IndicRearrangementProcessor.h
++++ jdk/src/share/native/sun/font/layout/IndicRearrangementProcessor.h
+@@ -58,7 +58,7 @@
+ 
+     void doRearrangementAction(LEGlyphStorage &glyphStorage, IndicRearrangementVerb verb) const;
+ 
+-    IndicRearrangementProcessor(const MorphSubtableHeader *morphSubtableHeader);
++    IndicRearrangementProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success);
+     virtual ~IndicRearrangementProcessor();
+ 
+     /**
+@@ -79,8 +79,9 @@
+     le_int32 firstGlyph;
+     le_int32 lastGlyph;
+ 
+-    const IndicRearrangementStateEntry *entryTable;
+-    const IndicRearrangementSubtableHeader *indicRearrangementSubtableHeader;
++    LEReferenceTo<IndicRearrangementSubtableHeader> indicRearrangementSubtableHeader;
++    LEReferenceToArrayOf<IndicRearrangementStateEntry> entryTable;
++    LEReferenceToArrayOf<le_int16> int16Table;
+ 
+ };
+ 
+diff --git a/src/share/native/sun/font/layout/IndicReordering.cpp b/src/share/native/sun/font/layout/IndicReordering.cpp
+--- jdk/src/share/native/sun/font/layout/IndicReordering.cpp
++++ jdk/src/share/native/sun/font/layout/IndicReordering.cpp
+@@ -658,6 +658,11 @@
+     MPreFixups *mpreFixups = NULL;
+     const IndicClassTable *classTable = IndicClassTable::getScriptClassTable(scriptCode);
+ 
++    if(classTable==NULL) {
++      success = LE_MEMORY_ALLOCATION_ERROR;
++      return 0;
++    }
++
+     if (classTable->scriptFlags & SF_MPRE_FIXUP) {
+         mpreFixups = new MPreFixups(charCount);
+         if (mpreFixups == NULL) {
+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
+@@ -92,16 +92,16 @@
+  * TODO: support multiple subtables
+  * TODO: respect header flags
+  */
+-KernTable::KernTable(const LEFontInstance* font_, const void* tableData)
+-  : pairs(0), font(font_)
++KernTable::KernTable(const LETableReference &table, LEErrorCode &success)
++  : pairs(table, success), pairsSwapped(NULL), fTable(table)
+ {
+-  const KernTableHeader* header = (const KernTableHeader*)tableData;
+-  if (header == 0) {
++  if(LE_FAILURE(success) || (fTable.isEmpty())) {
+ #if DEBUG
+     fprintf(stderr, "no kern data\n");
+ #endif
+     return;
+   }
++  LEReferenceTo<KernTableHeader> header(fTable, success);
+ 
+ #if DEBUG
+   // dump first 32 bytes of header
+@@ -115,12 +115,17 @@
+   }
+ #endif
+ 
+-  if (header->version == 0 && SWAPW(header->nTables) > 0) {
+-    const SubtableHeader* subhead = (const SubtableHeader*)((char*)tableData + KERN_TABLE_HEADER_SIZE);
+-    if (subhead->version == 0) {
++  if(LE_FAILURE(success)) return;
++
++  if (!header.isEmpty() && header->version == 0 && SWAPW(header->nTables) > 0) {
++    LEReferenceTo<SubtableHeader> subhead(header, success, KERN_TABLE_HEADER_SIZE);
++
++    if (LE_SUCCESS(success) && !subhead.isEmpty() && subhead->version == 0) {
+       coverage = SWAPW(subhead->coverage);
+       if (coverage & COVERAGE_HORIZONTAL) { // only handle horizontal kerning
+-        const Subtable_0* table = (const Subtable_0*)((char*)subhead + KERN_SUBTABLE_HEADER_SIZE);
++        LEReferenceTo<Subtable_0> table(subhead, success, KERN_SUBTABLE_HEADER_SIZE);
++
++        if(table.isEmpty() || LE_FAILURE(success)) return;
+ 
+         nPairs        = SWAPW(table->nPairs);
+ 
+@@ -134,17 +139,17 @@
+         rangeShift    = (nPairs * KERN_PAIRINFO_SIZE) - searchRange;
+ #endif
+ 
+-        pairs = (PairInfo*)font->getKernPairs();
+-        if (pairs == NULL) {
+-            char *pairData = (char*)table + KERN_SUBTABLE_0_HEADER_SIZE;
+-            char *pptr = pairData;
+-            pairs =  (PairInfo*)(malloc(nPairs*sizeof(PairInfo)));
+-            PairInfo *p = (PairInfo*)pairs;
+-            for (int i = 0; i < nPairs; i++, pptr += KERN_PAIRINFO_SIZE, p++) {
+-              memcpy(p, pptr, KERN_PAIRINFO_SIZE);
++        if(LE_SUCCESS(success) && nPairs>0) {
++          pairs.setToOffsetInParent(table, KERN_SUBTABLE_0_HEADER_SIZE, nPairs, success);
++        }
++        if (LE_SUCCESS(success) && pairs.isValid()) {
++            pairsSwapped =  (PairInfo*)(malloc(nPairs*sizeof(PairInfo)));
++            PairInfo *p = (PairInfo*)pairsSwapped;
++            for (int i = 0; LE_SUCCESS(success) && i < nPairs; i++, p++) {
++              memcpy(p, pairs.getAlias(i,success), KERN_PAIRINFO_SIZE);
+               p->key = SWAPL(p->key);
+             }
+-            font->setKernPairs((void*)pairs);
++            fTable.getFont()->setKernPairs((void*)pairsSwapped); // store it
+         }
+ 
+ #if DEBUG
+@@ -162,7 +167,7 @@
+               ids[id] = (char)i;
+             }
+           }
+-          PairInfo *p = pairs;
++	  PairInfo* p = pairs;
+           for (int i = 0; i < nPairs; ++i, p++) {
+             le_uint32 k = p->key;
+             le_uint16 left = (k >> 16) & 0xffff;
+@@ -194,10 +199,12 @@
+  * Process the glyph positions.  The positions array has two floats for each
+  * glyph, plus a trailing pair to mark the end of the last glyph.
+  */
+-void KernTable::process(LEGlyphStorage& storage)
++void KernTable::process(LEGlyphStorage& storage, LEErrorCode &success)
+ {
+-  if (pairs) {
+-    LEErrorCode success = LE_NO_ERROR;
++  if(LE_FAILURE(success)) return;
++
++  if (pairsSwapped) {
++    success = LE_NO_ERROR;
+ 
+     le_uint32 key = storage[0]; // no need to mask off high bits
+     float adjust = 0;
+@@ -209,7 +216,7 @@
+       // so either I have to swap the element each time I examine it, or I have to swap
+       // all the elements ahead of time and store them in the font
+ 
+-      const PairInfo* p = pairs;
++      const PairInfo* p = pairsSwapped;
+       const PairInfo* tp = (const PairInfo*)(p + rangeShift);
+       if (key > tp->key) {
+         p = tp;
+@@ -225,7 +232,7 @@
+         tp = (const PairInfo*)(p + probe);
+         le_uint32 tkey = tp->key;
+ #if DEBUG
+-        fprintf(stdout, "   %.3d (%0.8x)\n", (tp - pairs), tkey);
++        fprintf(stdout, "   %.3d (%0.8x)\n", (tp - pairsSwapped), tkey);
+ #endif
+         if (tkey <= key) {
+           if (tkey == key) {
+@@ -240,10 +247,10 @@
+             // device transform, or a faster way, such as moving the
+             // entire kern table up to Java.
+             LEPoint pt;
+-            pt.fX = font->xUnitsToPoints(value);
++            pt.fX = fTable.getFont()->xUnitsToPoints(value);
+             pt.fY = 0;
+ 
+-            font->getKerningAdjustment(pt);
++            fTable.getFont()->getKerningAdjustment(pt);
+             adjust += pt.fX;
+             break;
+           }
+diff --git a/src/share/native/sun/font/layout/KernTable.h b/src/share/native/sun/font/layout/KernTable.h
+--- jdk/src/share/native/sun/font/layout/KernTable.h
++++ jdk/src/share/native/sun/font/layout/KernTable.h
+@@ -26,7 +26,7 @@
+ /*
+  *
+  *
+- * (C) Copyright IBM Corp. 2004-2005 - All Rights Reserved
++ * (C) Copyright IBM Corp. 2004-2013 - All Rights Reserved
+  *
+  */
+ 
+@@ -38,6 +38,7 @@
+ #endif
+ 
+ #include "LETypes.h"
++#include "LETableReference.h"
+ //#include "LEFontInstance.h"
+ //#include "LEGlyphStorage.h"
+ 
+@@ -56,19 +57,20 @@
+  private:
+   le_uint16 coverage;
+   le_uint16 nPairs;
+-  const PairInfo* pairs;
+-  const LEFontInstance* font;
++  LEReferenceToArrayOf<PairInfo> pairs;
++  PairInfo  *pairsSwapped;
++  const LETableReference &fTable;
+   le_uint16 searchRange;
+   le_uint16 entrySelector;
+   le_uint16 rangeShift;
+ 
+  public:
+-  KernTable(const LEFontInstance* font, const void* tableData);
++  KernTable(const LETableReference &table, LEErrorCode &success);
+ 
+   /*
+    * Process the glyph positions.
+    */
+-  void process(LEGlyphStorage& storage);
++  void process(LEGlyphStorage& storage, LEErrorCode &success);
+ };
+ 
+ U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/KhmerLayoutEngine.cpp b/src/share/native/sun/font/layout/KhmerLayoutEngine.cpp
+--- jdk/src/share/native/sun/font/layout/KhmerLayoutEngine.cpp
++++ jdk/src/share/native/sun/font/layout/KhmerLayoutEngine.cpp
+@@ -43,7 +43,7 @@
+ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(KhmerOpenTypeLayoutEngine)
+ 
+ KhmerOpenTypeLayoutEngine::KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                    le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success)
++                                                     le_int32 typoFlags, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, LEErrorCode &success)
+     : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success)
+ {
+     fFeatureMap   = KhmerReordering::getFeatureMap(fFeatureMapCount);
+diff --git a/src/share/native/sun/font/layout/KhmerLayoutEngine.h b/src/share/native/sun/font/layout/KhmerLayoutEngine.h
+--- jdk/src/share/native/sun/font/layout/KhmerLayoutEngine.h
++++ jdk/src/share/native/sun/font/layout/KhmerLayoutEngine.h
+@@ -83,7 +83,7 @@
+      * @internal
+      */
+     KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                            le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success);
++                            le_int32 typoFlags, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, LEErrorCode &success);
+ 
+     /**
+      * This constructor is used when the font requires a "canned" GSUB table which can't be known
+diff --git a/src/share/native/sun/font/layout/LEFontInstance.h b/src/share/native/sun/font/layout/LEFontInstance.h
+--- jdk/src/share/native/sun/font/layout/LEFontInstance.h
++++ jdk/src/share/native/sun/font/layout/LEFontInstance.h
+@@ -194,6 +194,25 @@
+     virtual void  setKernPairs(void *pairs) const = 0;
+ 
+     /**
++     * This method reads a table from the font. Note that in general,
++     * it only makes sense to call this method on an <code>LEFontInstance</code>
++     * which represents a physical font - i.e. one which has been returned by
++     * <code>getSubFont()</code>. This is because each subfont in a composite font
++     * will have different tables, and there's no way to know which subfont to access.
++     *
++     * Subclasses which represent composite fonts should always return <code>NULL</code>.
++     * 
++     * This version sets a length, for range checking.
++     *
++     * @param tableTag - the four byte table tag. (e.g. 'cmap') 
++     * @param length - ignored on entry, on exit will be the length of the table if known, or -1 if unknown.
++     * @return the address of the table in memory, or <code>NULL</code>
++     *         if the table doesn't exist.
++     * @internal
++     */
++    virtual const void* getFontTable(LETag tableTag, size_t &length) const { length=-1; return getFontTable(tableTag); }  /* -1 = unknown length */
++
++    /**
+      * This method is used to determine if the font can
+      * render the given character. This can usually be done
+      * by looking the character up in the font's character
+diff --git a/src/share/native/sun/font/layout/LEScripts.h b/src/share/native/sun/font/layout/LEScripts.h
+--- jdk/src/share/native/sun/font/layout/LEScripts.h
++++ jdk/src/share/native/sun/font/layout/LEScripts.h
+@@ -241,8 +241,28 @@
+     palmScriptCode = 144,
+     sindScriptCode = 145,
+     waraScriptCode = 146,
++/**
++ * @stable ICU 4.8
++ */
+ 
+-    scriptCodeCount = 147
++    afakScriptCode = 147,
++    jurcScriptCode = 148,
++    mrooScriptCode = 149,
++    nshuScriptCode = 150,
++    shrdScriptCode = 151,
++    soraScriptCode = 152,
++    takrScriptCode = 153,
++    tangScriptCode = 154,
++    woleScriptCode = 155,
++/**
++ * @stable ICU 49
++ */
++
++    hluwScriptCode = 156, /* bump to match current ICU */
++    khojScriptCode = 157,
++    tirhScriptCode = 158,
++
++    scriptCodeCount = 159
+ };
+ 
+ U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/LETableReference.h b/src/share/native/sun/font/layout/LETableReference.h
+new file mode 100644
+--- /dev/null
++++ jdk/src/share/native/sun/font/layout/LETableReference.h
+@@ -0,0 +1,497 @@
++/*
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute 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.
++ *
++ */
++
++/*
++ * -*- c++ -*-
++ *
++ * (C) Copyright IBM Corp. and others 2013 - All Rights Reserved
++ *
++ * Range checking
++ *
++ */
++
++#ifndef __LETABLEREFERENCE_H
++#define __LETABLEREFERENCE_H
++
++#include "LETypes.h"
++#include "LEFontInstance.h"
++
++
++#define kQuestionmarkTableTag  0x3F3F3F3FUL
++#define kTildeTableTag  0x7e7e7e7eUL
++#ifdef __cplusplus
++
++// internal - interface for range checking
++U_NAMESPACE_BEGIN
++
++#if LE_ASSERT_BAD_FONT
++class LETableReference; // fwd
++/**
++ *  defined in OpenTypeUtilities.cpp
++ * @internal
++ */
++U_INTERNAL void U_EXPORT2 _debug_LETableReference(const char *f, int l, const char *msg, const LETableReference *what, const void *ptr, size_t len);
++
++#define LE_DEBUG_TR(x) _debug_LETableReference(__FILE__, __LINE__, x, this, NULL, 0);
++#define LE_DEBUG_TR3(x,y,z) _debug_LETableReference(__FILE__, __LINE__, x, this, (const void*)y, (size_t)z);
++#if 0
++#define LE_TRACE_TR(x) _debug_LETableReference(__FILE__, __LINE__, x, this, NULL, 0);
++#else
++#define LE_TRACE_TR(x)
++#endif
++
++#else
++#define LE_DEBUG_TR(x)
++#define LE_DEBUG_TR3(x,y,z)
++#define LE_TRACE_TR(x)
++#endif
++
++/**
++ * @internal
++ */
++class LETableReference {
++public:
++/**
++ * @internal
++ * Construct from a specific tag
++ */
++  LETableReference(const LEFontInstance* font, LETag tableTag, LEErrorCode &success) :
++    fFont(font), fTag(tableTag), fParent(NULL), fStart(NULL),fLength(LE_UINTPTR_MAX) {
++      loadTable(success);
++    LE_TRACE_TR("INFO: new table load")
++  }
++
++  LETableReference(const LETableReference &parent, LEErrorCode &success) : fFont(parent.fFont), fTag(parent.fTag), fParent(&parent), fStart(parent.fStart), fLength(parent.fLength) {
++    if(LE_FAILURE(success)) {
++      clear();
++    }
++    LE_TRACE_TR("INFO: new clone")
++  }
++
++   LETableReference(const le_uint8* data, size_t length = LE_UINTPTR_MAX) :
++    fFont(NULL), fTag(kQuestionmarkTableTag), fParent(NULL), fStart(data), fLength(length) {
++    LE_TRACE_TR("INFO: new raw")
++  }
++  LETableReference() :
++    fFont(NULL), fTag(kQuestionmarkTableTag), fParent(NULL), fStart(NULL), fLength(0) {
++    LE_TRACE_TR("INFO: new empty")
++  }
++
++  ~LETableReference() {
++    fTag=kTildeTableTag;
++    LE_TRACE_TR("INFO: new dtor")
++  }
++
++  /**
++   * @internal
++   * @param length  if LE_UINTPTR_MAX means "whole table"
++   * subset
++   */
++  LETableReference(const LETableReference &parent, size_t offset, size_t length,
++                   LEErrorCode &err) :
++    fFont(parent.fFont), fTag(parent.fTag), fParent(&parent),
++    fStart((parent.fStart)+offset), fLength(length) {
++    if(LE_SUCCESS(err)) {
++      if(isEmpty()) {
++        //err = LE_MISSING_FONT_TABLE_ERROR;
++        clear(); // it's just empty. Not an error.
++      } else if(offset >= fParent->fLength) {
++        LE_DEBUG_TR3("offset out of range: (%p) +%d", NULL, offset);
++        err = LE_INDEX_OUT_OF_BOUNDS_ERROR;
++        clear();
++      } else {
++        if(fLength == LE_UINTPTR_MAX &&
++           fParent->fLength != LE_UINTPTR_MAX) {
++          fLength = (fParent->fLength) - offset; // decrement length as base address is incremented
++        }
++        if(fLength != LE_UINTPTR_MAX) {  // if we have bounds:
++          if(offset+fLength > fParent->fLength) {
++            LE_DEBUG_TR3("offset+fLength out of range: (%p) +%d", NULL, offset+fLength);
++            err = LE_INDEX_OUT_OF_BOUNDS_ERROR; // exceeded
++            clear();
++          }
++        }
++      }
++    } else {
++      clear();
++    }
++    LE_TRACE_TR("INFO: new subset")
++  }
++
++  const void* getAlias() const { return (const void*)fStart; }
++  const void* getAliasTODO() const { LE_DEBUG_TR("getAliasTODO()"); return (const void*)fStart; }
++  le_bool isEmpty() const { return fStart==NULL || fLength==0; }
++  le_bool isValid() const { return !isEmpty(); }
++  le_bool hasBounds() const { return fLength!=LE_UINTPTR_MAX; }
++  void clear() { fLength=0; fStart=NULL; }
++  size_t getLength() const { return fLength; }
++  const LEFontInstance* getFont() const { return fFont; }
++  LETag getTag() const { return fTag; }
++  const LETableReference* getParent() const { return fParent; }
++
++  void addOffset(size_t offset, LEErrorCode &success) {
++    if(hasBounds()) {
++      if(offset > fLength) {
++        LE_DEBUG_TR("addOffset off end");
++        success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
++        return;
++      } else {
++        fLength -= offset;
++      }
++    }
++    fStart += offset;
++  }
++
++  size_t ptrToOffset(const void *atPtr, LEErrorCode &success) const {
++    if(atPtr==NULL) return 0;
++    if(LE_FAILURE(success)) return LE_UINTPTR_MAX;
++    if((atPtr < fStart) ||
++       (hasBounds() && (atPtr > fStart+fLength))) {
++      LE_DEBUG_TR3("ptrToOffset args out of range: %p", atPtr, 0);
++      success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
++      return LE_UINTPTR_MAX;
++    }
++    return ((const le_uint8*)atPtr)-fStart;
++  }
++
++  /**
++   * Clamp down the length, for range checking.
++   */
++  size_t contractLength(size_t newLength) {
++    if(fLength!=LE_UINTPTR_MAX&&newLength>0&&newLength<=fLength) {
++      fLength = newLength;
++    }
++    return fLength;
++  }
++
++  /**
++   * Throw an error if offset+length off end
++   */
++public:
++  size_t verifyLength(size_t offset, size_t length, LEErrorCode &success) {
++    if(isValid()&&
++       LE_SUCCESS(success) &&
++       fLength!=LE_UINTPTR_MAX && length!=LE_UINTPTR_MAX && offset!=LE_UINTPTR_MAX &&
++       (offset+length)>fLength) {
++      LE_DEBUG_TR3("verifyLength failed (%p) %d",NULL, offset+length);
++      success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
++#if LE_ASSERT_BAD_FONT
++      fprintf(stderr, "offset=%lu, len=%lu, would be at %p, (%lu) off end. End at %p\n", offset,length, fStart+offset+length, (offset+length-fLength), (offset+length-fLength)+fStart);
++#endif
++    }
++    return fLength;
++  }
++
++  le_bool isSubsetOf(const LETableReference& base) const {
++    if(this == &base) return true;
++    if(fStart < base.fStart) return false;
++    if(base.hasBounds()) {
++      if(fStart >= base.fStart + base.fLength) return false;
++      if(hasBounds()) {
++        if(fStart + fLength > base.fStart + base.fLength) return false;
++      }
++    }
++    return true;
++  }
++
++  /**
++   * Change parent link to another
++   */
++  LETableReference &reparent(const LETableReference &base) {
++    fParent = &base;
++    return *this;
++  }
++
++  /**
++   * remove parent link. Factory functions should do this.
++   */
++  void orphan(void) {
++    fParent=NULL;
++  }
++
++protected:
++  const LEFontInstance* fFont;
++  LETag  fTag;
++  const LETableReference *fParent;
++  const le_uint8 *fStart; // keep as 8 bit internally, for pointer math
++  size_t fLength;
++
++  void loadTable(LEErrorCode &success) {
++    if(LE_SUCCESS(success)) {
++      fStart = (const le_uint8*)(fFont->getFontTable(fTag, fLength)); // note - a null table is not an error.
++    }
++  }
++
++  void setRaw(const void *data, size_t length = LE_UINTPTR_MAX) {
++    fFont = NULL;
++    fTag = kQuestionmarkTableTag;
++    fParent = NULL;
++    fStart = (const le_uint8*)data;
++    fLength = length;
++  }
++};
++
++
++template<class T>
++class LETableVarSizer {
++ public:
++  inline static size_t getSize();
++};
++
++// base definition- could override for adjustments
++template<class T> inline
++size_t LETableVarSizer<T>::getSize() {
++  return sizeof(T);
++}
++
++/**
++ * \def LE_VAR_ARRAY
++ * @param x Type (T)
++ * @param y some member that is of length ANY_NUMBER
++ * Call this after defining a class, for example:
++ *   LE_VAR_ARRAY(FeatureListTable,featureRecordArray)
++ * this is roughly equivalent to:
++ *   template<> inline size_t LETableVarSizer<FeatureListTable>::getSize() { return sizeof(FeatureListTable) - (sizeof(le_uint16)*ANY_NUMBER); }
++ * it's a specialization that informs the LETableReference subclasses to NOT include the variable array in the size.
++ * dereferencing NULL is valid here because we never actually dereference it, just inside sizeof.
++ */
++#define LE_VAR_ARRAY(x,y) template<> inline size_t LETableVarSizer<x>::getSize() { return sizeof(x) - (sizeof(((const x*)0)->y)); }
++
++/**
++ * Open a new entry based on an existing table
++ */
++
++/**
++ * \def LE_UNBOUNDED_ARRAY
++ * define an array with no *known* bound. Will trim to available size.
++ * @internal
++ */
++#define LE_UNBOUNDED_ARRAY LE_UINT32_MAX
++
++template<class T>
++class LEReferenceToArrayOf : public LETableReference {
++public:
++  LEReferenceToArrayOf(const LETableReference &parent, LEErrorCode &success, size_t offset, le_uint32 count)
++    : LETableReference(parent, offset, LE_UINTPTR_MAX, success), fCount(count) {
++    LE_TRACE_TR("INFO: new RTAO by offset")
++    if(LE_SUCCESS(success)) {
++      if(count == LE_UNBOUNDED_ARRAY) { // not a known length
++        count = getLength()/LETableVarSizer<T>::getSize(); // fit to max size
++      }
++      LETableReference::verifyLength(0, LETableVarSizer<T>::getSize()*count, success);
++    }
++    if(LE_FAILURE(success)) {
++      fCount=0;
++      clear();
++    }
++  }
++
++  LEReferenceToArrayOf(const LETableReference &parent, LEErrorCode &success, const T* array, le_uint32 count)
++    : LETableReference(parent, parent.ptrToOffset(array, success), LE_UINTPTR_MAX, success), fCount(count) {
++LE_TRACE_TR("INFO: new RTAO")
++    if(LE_SUCCESS(success)) {
++      if(count == LE_UNBOUNDED_ARRAY) { // not a known length
++        count = getLength()/LETableVarSizer<T>::getSize(); // fit to max size
++      }
++      LETableReference::verifyLength(0, LETableVarSizer<T>::getSize()*count, success);
++    }
++    if(LE_FAILURE(success)) clear();
++  }
++ LEReferenceToArrayOf(const LETableReference &parent, LEErrorCode &success, const T* array, size_t offset, le_uint32 count)
++   : LETableReference(parent, parent.ptrToOffset(array, success)+offset, LE_UINTPTR_MAX, success), fCount(count) {
++LE_TRACE_TR("INFO: new RTAO")
++    if(LE_SUCCESS(success)) {
++      if(count == LE_UNBOUNDED_ARRAY) { // not a known length
++        count = getLength()/LETableVarSizer<T>::getSize(); // fit to max size
++      }
++      LETableReference::verifyLength(0, LETableVarSizer<T>::getSize()*count, success);
++    }
++    if(LE_FAILURE(success)) clear();
++  }
++
++ LEReferenceToArrayOf() :LETableReference(), fCount(0) {}
++
++  le_uint32 getCount() const { return fCount; }
++
++  using LETableReference::getAlias;
++
++  const T *getAlias(le_uint32 i, LEErrorCode &success) const {
++    if(LE_SUCCESS(success)&& i<getCount()) {
++      return  ((const T*)getAlias())+i;
++    } else {
++      if(LE_SUCCESS(success)) {
++        LE_DEBUG_TR("getAlias(subscript) out of range");
++        success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
++      }
++      return ((const T*)getAlias());  // return first item, so there's no crash
++    }
++  }
++
++  const T *getAliasTODO() const { LE_DEBUG_TR("getAliasTODO<>"); return (const T*)fStart; }
++
++  const T& getObject(le_uint32 i, LEErrorCode &success) const {
++    return *getAlias(i,success);
++  }
++
++  const T& operator()(le_uint32 i, LEErrorCode &success) const {
++    return *getAlias(i,success);
++  }
++
++  size_t getOffsetFor(le_uint32 i, LEErrorCode &success) const {
++    if(LE_SUCCESS(success)&&i<getCount()) {
++      return LETableVarSizer<T>::getSize()*i;
++    } else {
++      success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
++    }
++    return 0;
++  }
++
++  LEReferenceToArrayOf<T> &reparent(const LETableReference &base) {
++    fParent = &base;
++    return *this;
++  }
++
++ LEReferenceToArrayOf(const LETableReference& parent, LEErrorCode & success) : LETableReference(parent,0, LE_UINTPTR_MAX, success), fCount(0) {
++    LE_TRACE_TR("INFO: null RTAO")
++  }
++
++  /**
++   * set this to point within our fParent, but based on 'base' as a subtable.
++   */
++  void setToOffsetInParent(const LETableReference& base, size_t offset, le_uint32 count, LEErrorCode &success) {
++LE_TRACE_TR("INFO: sTOIP")
++    if(LE_FAILURE(success)) return;
++    if(!fParent->isSubsetOf(base)) {  // Ensure that 'base' is containable within our parent.
++      clear();                        // otherwise, it's not a subtable of our parent.
++      LE_DEBUG_TR("setToOffsetInParents called on non subsets");
++      success = LE_ILLEGAL_ARGUMENT_ERROR; return;
++    }
++    size_t baseOffset = fParent->ptrToOffset(((const le_uint8*)base.getAlias())+offset, success);
++    if(LE_FAILURE(success)) return; // base was outside of parent's range
++    if(fParent->hasBounds()) {
++      if((baseOffset >= fParent->getLength()) || // start off end of parent
++         (baseOffset+(count*LETableVarSizer<T>::getSize()) >= fParent->getLength()) || // or off end of parent
++         count > LE_UINTPTR_MAX/LETableVarSizer<T>::getSize()) { // or more than would fit in memory
++        LE_DEBUG_TR("setToOffsetInParent called with bad length");
++        success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
++        clear();
++        return; // start would go off end of parent
++      }
++    }
++    fStart = (const le_uint8*)(fParent->getAlias()) + baseOffset;
++    //fLength = count*LETableVarSizer<T>::getSize(); - no- do not shrink fLength.
++    if(fParent->hasBounds()) {
++      fLength = (fParent->getLength() - (fStart-(const le_uint8*)fParent->getAlias())); // reduces fLength accordingly.
++    } else {
++      fLength = LE_UINTPTR_MAX; // unbounded
++    }
++    if((fStart < fParent->getAlias()) ||
++       (hasBounds()&&(fStart+fLength < fStart))) { // wrapped
++        LE_DEBUG_TR("setToOffsetInParent called with bad length");
++        success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
++        clear();
++        return; // start would go off end of parent
++    }
++    fCount = count;
++  }
++
++private:
++  le_uint32 fCount;
++};
++
++
++template<class T>
++class LEReferenceTo : public LETableReference {
++public:
++  /**
++   * open a sub reference.
++   * @param parent parent reference
++   * @param success error status
++   * @param atPtr location of reference - if NULL, will be at offset zero (i.e. downcast of parent). Otherwise must be a pointer within parent's bounds.
++   */
++  LEReferenceTo(const LETableReference &parent, LEErrorCode &success, const void* atPtr)
++    : LETableReference(parent, parent.ptrToOffset(atPtr, success), LE_UINTPTR_MAX, success) {
++    verifyLength(parent.ptrToOffset(atPtr,success), LETableVarSizer<T>::getSize(), success);
++    if(LE_FAILURE(success)) clear();
++  }
++  /**
++   * ptr plus offset
++   */
++ LEReferenceTo(const LETableReference &parent, LEErrorCode &success, const void* atPtr, size_t offset)
++    : LETableReference(parent, parent.ptrToOffset(atPtr, success)+offset, LE_UINTPTR_MAX, success) {
++    verifyLength(0, LETableVarSizer<T>::getSize(), success);
++    if(LE_FAILURE(success)) clear();
++  }
++  LEReferenceTo(const LETableReference &parent, LEErrorCode &success, size_t offset)
++    : LETableReference(parent, offset, LE_UINTPTR_MAX, success) {
++    verifyLength(0, LETableVarSizer<T>::getSize(), success);
++    if(LE_FAILURE(success)) clear();
++  }
++  LEReferenceTo(const LETableReference &parent, LEErrorCode &success)
++    : LETableReference(parent, 0, LE_UINTPTR_MAX, success) {
++    verifyLength(0, LETableVarSizer<T>::getSize(), success);
++    if(LE_FAILURE(success)) clear();
++  }
++ LEReferenceTo(const LEFontInstance *font, LETag tableTag, LEErrorCode &success)
++   : LETableReference(font, tableTag, success) {
++    verifyLength(0, LETableVarSizer<T>::getSize(), success);
++    if(LE_FAILURE(success)) clear();
++  }
++ LEReferenceTo(const le_uint8 *data, size_t length = LE_UINTPTR_MAX) : LETableReference(data, length) {}
++ LEReferenceTo(const T *data, size_t length = LE_UINTPTR_MAX) : LETableReference((const le_uint8*)data, length) {}
++  LEReferenceTo() : LETableReference(NULL) {}
++
++  LEReferenceTo<T>& operator=(const T* other) {
++    setRaw(other);
++    return *this;
++  }
++
++  LEReferenceTo<T> &reparent(const LETableReference &base) {
++    fParent = &base;
++    return *this;
++  }
++
++  /**
++   * roll forward by one <T> size.
++   * same as addOffset(LETableVarSizer<T>::getSize(),success)
++   */
++  void addObject(LEErrorCode &success) {
++    addOffset(LETableVarSizer<T>::getSize(), success);
++  }
++  void addObject(size_t count, LEErrorCode &success) {
++    addOffset(LETableVarSizer<T>::getSize()*count, success);
++  }
++
++  const T *operator->() const { return getAlias(); }
++  const T *getAlias() const { return (const T*)fStart; }
++  const T *getAliasTODO() const { LE_DEBUG_TR("getAliasTODO<>"); return (const T*)fStart; }
++};
++
++
++U_NAMESPACE_END
++
++#endif
++
++#endif
+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
+@@ -245,12 +245,15 @@
+ /**
+  * Max value representable by a uintptr
+  */
++
++#ifndef UINT32_MAX
++#define LE_UINT32_MAX 0xFFFFFFFFU
++#else
++#define LE_UINT32_MAX UINT32_MAX
++#endif
++
+ #ifndef UINTPTR_MAX
+-#ifndef UINT32_MAX
+-#define LE_UINTPTR_MAX 0xFFFFFFFFU
+-#else
+-#define LE_UINTPTR_MAX UINT32_MAX
+-#endif
++#define LE_UINTPTR_MAX LE_UINT32_MAX
+ #else
+ #define LE_UINTPTR_MAX UINTPTR_MAX
+ #endif
+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
+@@ -141,21 +141,21 @@
+ class CanonMarkFilter : public UMemory, public LEGlyphFilter
+ {
+ private:
+-    const GlyphClassDefinitionTable *classDefTable;
++  const LEReferenceTo<GlyphClassDefinitionTable> classDefTable;
+ 
+     CanonMarkFilter(const CanonMarkFilter &other); // forbid copying of this class
+     CanonMarkFilter &operator=(const CanonMarkFilter &other); // forbid copying of this class
+ 
+ public:
+-    CanonMarkFilter(const GlyphDefinitionTableHeader *gdefTable);
++    CanonMarkFilter(const LEReferenceTo<GlyphDefinitionTableHeader> &gdefTable, LEErrorCode &success);
+     virtual ~CanonMarkFilter();
+ 
+     virtual le_bool accept(LEGlyphID glyph) const;
+ };
+ 
+-CanonMarkFilter::CanonMarkFilter(const GlyphDefinitionTableHeader *gdefTable)
++CanonMarkFilter::CanonMarkFilter(const LEReferenceTo<GlyphDefinitionTableHeader> &gdefTable, LEErrorCode &success)
++  : classDefTable(gdefTable->getMarkAttachClassDefinitionTable(gdefTable, success))
+ {
+-    classDefTable = gdefTable->getMarkAttachClassDefinitionTable();
+ }
+ 
+ CanonMarkFilter::~CanonMarkFilter()
+@@ -165,9 +165,10 @@
+ 
+ le_bool CanonMarkFilter::accept(LEGlyphID glyph) const
+ {
+-    le_int32 glyphClass = classDefTable->getGlyphClass(glyph);
+-
+-    return glyphClass != 0;
++  LEErrorCode success = LE_NO_ERROR;
++  le_int32 glyphClass = classDefTable->getGlyphClass(classDefTable, glyph, success);
++  if(LE_FAILURE(success)) return false;
++  return glyphClass != 0;
+ }
+ 
+ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LayoutEngine)
+@@ -252,20 +253,20 @@
+         return 0;
+     }
+ 
+-    const GlyphSubstitutionTableHeader *canonGSUBTable = (GlyphSubstitutionTableHeader *) CanonShaping::glyphSubstitutionTable;
++    LEReferenceTo<GlyphSubstitutionTableHeader> canonGSUBTable((GlyphSubstitutionTableHeader *) CanonShaping::glyphSubstitutionTable);
+     LETag scriptTag  = OpenTypeLayoutEngine::getScriptTag(fScriptCode);
+     LETag langSysTag = OpenTypeLayoutEngine::getLangSysTag(fLanguageCode);
+     le_int32 i, dir = 1, out = 0, outCharCount = count;
+ 
+-    if (canonGSUBTable->coversScript(scriptTag)) {
++    if (canonGSUBTable->coversScript(canonGSUBTable,scriptTag, success) || LE_SUCCESS(success)) {
+         CharSubstitutionFilter *substitutionFilter = new CharSubstitutionFilter(fFontInstance);
+         if (substitutionFilter == NULL) {
+             success = LE_MEMORY_ALLOCATION_ERROR;
+             return 0;
+         }
+ 
+-                const LEUnicode *inChars = &chars[offset];
+-                LEUnicode *reordered = NULL;
++        const LEUnicode *inChars = &chars[offset];
++        LEUnicode *reordered = NULL;
+         LEGlyphStorage fakeGlyphStorage;
+ 
+         fakeGlyphStorage.allocateGlyphArray(count, rightToLeft, success);
+@@ -275,20 +276,20 @@
+             return 0;
+         }
+ 
+-                // This is the cheapest way to get mark reordering only for Hebrew.
+-                // We could just do the mark reordering for all scripts, but most
+-                // of them probably don't need it...
+-                if (fScriptCode == hebrScriptCode) {
+-                        reordered = LE_NEW_ARRAY(LEUnicode, count);
++        // This is the cheapest way to get mark reordering only for Hebrew.
++        // We could just do the mark reordering for all scripts, but most
++        // of them probably don't need it...
++        if (fScriptCode == hebrScriptCode) {
++          reordered = LE_NEW_ARRAY(LEUnicode, count);
+ 
+-                        if (reordered == NULL) {
+-                delete substitutionFilter;
+-                                success = LE_MEMORY_ALLOCATION_ERROR;
+-                                return 0;
+-                        }
++          if (reordered == NULL) {
++            delete substitutionFilter;
++            success = LE_MEMORY_ALLOCATION_ERROR;
++            return 0;
++          }
+ 
+-                        CanonShaping::reorderMarks(&chars[offset], count, rightToLeft, reordered, fakeGlyphStorage);
+-                        inChars = reordered;
++          CanonShaping::reorderMarks(&chars[offset], count, rightToLeft, reordered, fakeGlyphStorage);
++          inChars = reordered;
+                 }
+ 
+         fakeGlyphStorage.allocateAuxData(success);
+@@ -308,11 +309,11 @@
+             fakeGlyphStorage.setAuxData(out, canonFeatures, success);
+         }
+ 
+-                if (reordered != NULL) {
+-                        LE_DELETE_ARRAY(reordered);
+-                }
++        if (reordered != NULL) {
++          LE_DELETE_ARRAY(reordered);
++        }
+ 
+-        outCharCount = canonGSUBTable->process(fakeGlyphStorage, rightToLeft, scriptTag, langSysTag, NULL, substitutionFilter, canonFeatureMap, canonFeatureMapCount, FALSE, success);
++        outCharCount = canonGSUBTable->process(canonGSUBTable, fakeGlyphStorage, rightToLeft, scriptTag, langSysTag, (const GlyphDefinitionTableHeader*)NULL, substitutionFilter, canonFeatureMap, canonFeatureMapCount, FALSE, success);
+ 
+         if (LE_FAILURE(success)) {
+             delete substitutionFilter;
+@@ -413,16 +414,16 @@
+         return;
+     }
+ 
+-    GlyphDefinitionTableHeader *gdefTable = (GlyphDefinitionTableHeader *) CanonShaping::glyphDefinitionTable;
+-    CanonMarkFilter filter(gdefTable);
++    LEReferenceTo<GlyphDefinitionTableHeader> gdefTable((GlyphDefinitionTableHeader *) CanonShaping::glyphDefinitionTable,
++                                                        CanonShaping::glyphDefinitionTableLen);
++    CanonMarkFilter filter(gdefTable, success);
+ 
+     adjustMarkGlyphs(&chars[offset], count, reverse, glyphStorage, &filter, success);
+ 
+     if (fTypoFlags & LE_Kerning_FEATURE_FLAG) { /* kerning enabled */
+-      static const le_uint32 kernTableTag = LE_KERN_TABLE_TAG;
+-
+-      KernTable kt(fFontInstance, getFontTable(kernTableTag));
+-      kt.process(glyphStorage);
++      LETableReference kernTable(fFontInstance, LE_KERN_TABLE_TAG, success);
++      KernTable kt(kernTable, success);
++      kt.process(glyphStorage, success);
+     }
+ 
+     // default is no adjustments
+@@ -507,9 +508,9 @@
+     glyphStorage.adjustPosition(glyphCount, xAdjust, 0, success);
+ }
+ 
+-const void *LayoutEngine::getFontTable(LETag tableTag) const
++const void *LayoutEngine::getFontTable(LETag tableTag, size_t &length) const
+ {
+-    return fFontInstance->getFontTable(tableTag);
++  return fFontInstance->getFontTable(tableTag, length);
+ }
+ 
+ void LayoutEngine::mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, le_bool mirror,
+@@ -556,7 +557,10 @@
+ 
+ void LayoutEngine::reset()
+ {
++  if(fGlyphStorage!=NULL) {
+     fGlyphStorage->reset();
++    fGlyphStorage = NULL;
++  }
+ }
+ 
+ LayoutEngine *LayoutEngine::layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, LEErrorCode &success)
+@@ -574,19 +578,19 @@
+         return NULL;
+     }
+ 
+-    const GlyphSubstitutionTableHeader *gsubTable = (const GlyphSubstitutionTableHeader *) fontInstance->getFontTable(gsubTableTag);
++    LEReferenceTo<GlyphSubstitutionTableHeader> gsubTable(fontInstance,gsubTableTag,success);
+     LayoutEngine *result = NULL;
+     LETag scriptTag   = 0x00000000;
+     LETag languageTag = 0x00000000;
+-        LETag v2ScriptTag = OpenTypeLayoutEngine::getV2ScriptTag(scriptCode);
++    LETag v2ScriptTag = OpenTypeLayoutEngine::getV2ScriptTag(scriptCode);
+ 
+     // Right now, only invoke V2 processing for Devanagari.  TODO: Allow more V2 scripts as they are
+     // properly tested.
+ 
+-        if ( v2ScriptTag == dev2ScriptTag && gsubTable != NULL && gsubTable->coversScript( v2ScriptTag )) {
+-                result = new IndicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, TRUE, gsubTable, success);
+-        }
+-    else if (gsubTable != NULL && gsubTable->coversScript(scriptTag = OpenTypeLayoutEngine::getScriptTag(scriptCode))) {
++    if ( v2ScriptTag == dev2ScriptTag && gsubTable.isValid() && gsubTable->coversScript(gsubTable, v2ScriptTag, success )) {
++      result = new IndicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, TRUE, gsubTable, success);
++    }
++    else if (gsubTable.isValid() && gsubTable->coversScript(gsubTable, scriptTag = OpenTypeLayoutEngine::getScriptTag(scriptCode), success)) {
+         switch (scriptCode) {
+         case bengScriptCode:
+         case devaScriptCode:
+@@ -617,10 +621,10 @@
+             case janLanguageCode:
+             case zhtLanguageCode:
+             case zhsLanguageCode:
+-                if (gsubTable->coversScriptAndLanguage(scriptTag, languageTag, TRUE)) {
++              if (gsubTable->coversScriptAndLanguage(gsubTable, scriptTag, languageTag, success, TRUE)) {
+                     result = new HanOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success);
+                     break;
+-                }
++              }
+ 
+                 // note: falling through to default case.
+             default:
+@@ -643,10 +647,10 @@
+             break;
+         }
+     } else {
+-        const MorphTableHeader *morphTable = (MorphTableHeader *) fontInstance->getFontTable(mortTableTag);
++        LEReferenceTo<MorphTableHeader> mortTable(fontInstance, mortTableTag, success);
+ 
+-        if (morphTable != NULL && SWAPL(morphTable->version)==0x00010000) {
+-            result = new GXLayoutEngine(fontInstance, scriptCode, languageCode, morphTable, success);
++        if (LE_SUCCESS(success) && mortTable.isValid() && SWAPL(mortTable->version)==0x00010000) { // mort
++           result = new GXLayoutEngine(fontInstance, scriptCode, languageCode, mortTable, success);
+         } else {
+             switch (scriptCode) {
+             case bengScriptCode:
+diff --git a/src/share/native/sun/font/layout/LayoutEngine.h b/src/share/native/sun/font/layout/LayoutEngine.h
+--- jdk/src/share/native/sun/font/layout/LayoutEngine.h
++++ jdk/src/share/native/sun/font/layout/LayoutEngine.h
+@@ -268,12 +268,18 @@
+      * some other way must override this method.
+      *
+      * @param tableTag - the four byte table tag.
++     * @param length - length to use
+      *
+      * @return the address of the table.
+      *
+      * @internal
+      */
+-    virtual const void *getFontTable(LETag tableTag) const;
++    virtual const void *getFontTable(LETag tableTag, size_t &length) const;
++
++    /**
++     * @deprecated
++     */
++    virtual const void *getFontTable(LETag tableTag) const { size_t ignored; return getFontTable(tableTag, ignored); }
+ 
+     /**
+      * This method does character to glyph mapping. The default implementation
+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
+@@ -47,15 +47,15 @@
+ 
+ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LigatureSubstitutionProcessor)
+ 
+-LigatureSubstitutionProcessor::LigatureSubstitutionProcessor(const MorphSubtableHeader *morphSubtableHeader)
+-  : StateTableProcessor(morphSubtableHeader)
++  LigatureSubstitutionProcessor::LigatureSubstitutionProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success)
++: StateTableProcessor(morphSubtableHeader, success), ligatureSubstitutionHeader(morphSubtableHeader, success)
+ {
+-    ligatureSubstitutionHeader = (const LigatureSubstitutionHeader *) morphSubtableHeader;
++    if(LE_FAILURE(success)) return;
+     ligatureActionTableOffset = SWAPW(ligatureSubstitutionHeader->ligatureActionTableOffset);
+     componentTableOffset = SWAPW(ligatureSubstitutionHeader->componentTableOffset);
+     ligatureTableOffset = SWAPW(ligatureSubstitutionHeader->ligatureTableOffset);
+ 
+-    entryTable = (const LigatureSubstitutionStateEntry *) ((char *) &stateTableHeader->stHeader + entryTableOffset);
++    entryTable = LEReferenceToArrayOf<LigatureSubstitutionStateEntry>(stHeader, success, entryTableOffset, LE_UNBOUNDED_ARRAY);
+ }
+ 
+ LigatureSubstitutionProcessor::~LigatureSubstitutionProcessor()
+@@ -69,7 +69,9 @@
+ 
+ ByteOffset LigatureSubstitutionProcessor::processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index)
+ {
+-    const LigatureSubstitutionStateEntry *entry = &entryTable[index];
++  LEErrorCode success = LE_NO_ERROR;
++  const LigatureSubstitutionStateEntry *entry = entryTable.getAlias(index, success);
++
+     ByteOffset newState = SWAPW(entry->newStateOffset);
+     le_int16 flags = SWAPW(entry->flags);
+ 
+@@ -88,7 +90,7 @@
+     ByteOffset actionOffset = flags & lsfActionOffsetMask;
+ 
+     if (actionOffset != 0) {
+-        const LigatureActionEntry *ap = (const LigatureActionEntry *) ((char *) &ligatureSubstitutionHeader->stHeader + actionOffset);
++      LEReferenceTo<LigatureActionEntry> ap(stHeader, success, actionOffset);
+         LigatureActionEntry action;
+         le_int32 offset, i = 0;
+         le_int32 stack[nComponents];
+@@ -97,7 +99,8 @@
+         do {
+             le_uint32 componentGlyph = componentStack[m--];
+ 
+-            action = SWAPL(*ap++);
++            action = SWAPL(*ap.getAlias());
++            ap.addObject(success); // ap++
+ 
+             if (m < 0) {
+                 m = nComponents - 1;
+@@ -105,37 +108,33 @@
+ 
+             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));
++              LEReferenceToArrayOf<le_int16> offsetTable(stHeader, success, 2 * SignExtend(offset, lafComponentOffsetMask), LE_UNBOUNDED_ARRAY);
+ 
+-                // 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?
++              if(LE_FAILURE(success)) {
+                   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(componentGlyph > glyphStorage.getGlyphCount()) {
++                LE_DEBUG_BAD_FONT("preposterous componentGlyph");
++                currGlyph++;
++                return newState; // get out! bad font
++              }
++              i += SWAPW(offsetTable.getObject(LE_GET_GLYPH(glyphStorage[componentGlyph]), success));
+ 
+                 if (action & (lafLast | lafStore))  {
+-                    const TTGlyphID *ligatureOffset = (const TTGlyphID *) ((char *) &ligatureSubstitutionHeader->stHeader + i);
+-                    TTGlyphID ligatureGlyph = SWAPW(*ligatureOffset);
++                  LEReferenceTo<TTGlyphID> ligatureOffset(stHeader, success, i);
++                  TTGlyphID ligatureGlyph = SWAPW(*ligatureOffset.getAlias());
+ 
+-                    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;
++                  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);
++                  glyphStorage[componentGlyph] = LE_SET_GLYPH(glyphStorage[componentGlyph], 0xFFFF);
+                 }
+             }
+ #if LE_ASSERT_BAD_FONT
+@@ -146,11 +145,11 @@
+         } while (!(action & lafLast)  && (m>=0) ); // stop if last bit is set, or if run out of items
+ 
+         while (mm >= 0) {
+-            if (++m >= nComponents) {
+-                m = 0;
+-            }
++          if (++m >= nComponents) {
++            m = 0;
++          }
+ 
+-            componentStack[m] = stack[mm--];
++          componentStack[m] = stack[mm--];
+         }
+     }
+ 
+diff --git a/src/share/native/sun/font/layout/LigatureSubstProc.h b/src/share/native/sun/font/layout/LigatureSubstProc.h
+--- jdk/src/share/native/sun/font/layout/LigatureSubstProc.h
++++ jdk/src/share/native/sun/font/layout/LigatureSubstProc.h
+@@ -58,7 +58,7 @@
+ 
+     virtual void endStateTable();
+ 
+-    LigatureSubstitutionProcessor(const MorphSubtableHeader *morphSubtableHeader);
++    LigatureSubstitutionProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success);
+     virtual ~LigatureSubstitutionProcessor();
+ 
+     /**
+@@ -83,12 +83,12 @@
+     ByteOffset componentTableOffset;
+     ByteOffset ligatureTableOffset;
+ 
+-    const LigatureSubstitutionStateEntry *entryTable;
++    LEReferenceToArrayOf<LigatureSubstitutionStateEntry> entryTable;
+ 
+     le_int32 componentStack[nComponents];
+     le_int16 m;
+ 
+-    const LigatureSubstitutionHeader *ligatureSubstitutionHeader;
++    LEReferenceTo<LigatureSubstitutionHeader> ligatureSubstitutionHeader;
+ 
+ };
+ 
+diff --git a/src/share/native/sun/font/layout/LigatureSubstSubtables.cpp b/src/share/native/sun/font/layout/LigatureSubstSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/LigatureSubstSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/LigatureSubstSubtables.cpp
+@@ -40,10 +40,10 @@
+ 
+ U_NAMESPACE_BEGIN
+ 
+-le_uint32 LigatureSubstitutionSubtable::process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const
++le_uint32 LigatureSubstitutionSubtable::process(const LETableReference &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter) const
+ {
+     LEGlyphID glyph = glyphIterator->getCurrGlyphID();
+-    le_int32 coverageIndex = getGlyphCoverage(glyph);
++    le_int32 coverageIndex = getGlyphCoverage(base, glyph, success);
+ 
+     if (coverageIndex >= 0) {
+         Offset ligSetTableOffset = SWAPW(ligSetTableOffsetArray[coverageIndex]);
+diff --git a/src/share/native/sun/font/layout/LigatureSubstSubtables.h b/src/share/native/sun/font/layout/LigatureSubstSubtables.h
+--- jdk/src/share/native/sun/font/layout/LigatureSubstSubtables.h
++++ jdk/src/share/native/sun/font/layout/LigatureSubstSubtables.h
+@@ -50,6 +50,7 @@
+     le_uint16 ligatureCount;
+     Offset    ligatureTableOffsetArray[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(LigatureSetTable, ligatureTableOffsetArray)
+ 
+ struct LigatureTable
+ {
+@@ -57,14 +58,16 @@
+     le_uint16 compCount;
+     TTGlyphID componentArray[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(LigatureTable, componentArray)
+ 
+ struct LigatureSubstitutionSubtable : GlyphSubstitutionSubtable
+ {
+     le_uint16 ligSetCount;
+     Offset    ligSetTableOffsetArray[ANY_NUMBER];
+ 
+-    le_uint32  process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter = NULL) const;
++    le_uint32  process(const LETableReference &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter = NULL) const;
+ };
++LE_VAR_ARRAY(LigatureSubstitutionSubtable, ligSetTableOffsetArray)
+ 
+ U_NAMESPACE_END
+ #endif
+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
+@@ -44,7 +44,7 @@
+ 
+ U_NAMESPACE_BEGIN
+ 
+-le_uint32 LookupProcessor::applyLookupTable(const LookupTable *lookupTable, GlyphIterator *glyphIterator,
++le_uint32 LookupProcessor::applyLookupTable(const LEReferenceTo<LookupTable> &lookupTable, GlyphIterator *glyphIterator,
+                                          const LEFontInstance *fontInstance, LEErrorCode& success) const
+ {
+     if (LE_FAILURE(success)) {
+@@ -57,7 +57,7 @@
+     le_uint32 delta;
+ 
+     for (le_uint16 subtable = 0; subtable < subtableCount; subtable += 1) {
+-        const LookupSubtable *lookupSubtable = lookupTable->getLookupSubtable(subtable);
++      LEReferenceTo<LookupSubtable> lookupSubtable = lookupTable->getLookupSubtable(lookupTable, subtable, success);
+ 
+         delta = applySubtable(lookupSubtable, lookupType, glyphIterator, fontInstance, success);
+ 
+@@ -72,7 +72,7 @@
+ }
+ 
+ le_int32 LookupProcessor::process(LEGlyphStorage &glyphStorage, GlyphPositionAdjustments *glyphPositionAdjustments,
+-                              le_bool rightToLeft, const GlyphDefinitionTableHeader *glyphDefinitionTableHeader,
++                                  le_bool rightToLeft, const LEReferenceTo<GlyphDefinitionTableHeader> &glyphDefinitionTableHeader,
+                               const LEFontInstance *fontInstance, LEErrorCode& success) const
+ {
+     if (LE_FAILURE(success)) {
+@@ -89,22 +89,21 @@
+                                 rightToLeft, 0, 0, glyphDefinitionTableHeader);
+     le_int32 newGlyphCount = glyphCount;
+ 
+-    for (le_uint16 order = 0; order < lookupOrderCount; order += 1) {
++    for (le_uint16 order = 0; order < lookupOrderCount && LE_SUCCESS(success); order += 1) {
+         le_uint16 lookup = lookupOrderArray[order];
+         FeatureMask selectMask = lookupSelectArray[lookup];
+ 
+         if (selectMask != 0) {
+-            const LookupTable *lookupTable = lookupListTable->getLookupTable(lookup);
+-
+-            if (!lookupTable)
+-                continue;
+-
+-            le_uint16 lookupFlags = SWAPW(lookupTable->lookupFlags);
++            const LEReferenceTo<LookupTable> lookupTable = lookupListTable->getLookupTable(lookupListTable, lookup, success);
++            if (!lookupTable.isValid() ||LE_FAILURE(success) ) {
++               continue;
++            }
++	    le_uint16 lookupFlags = SWAPW(lookupTable->lookupFlags);
+ 
+             glyphIterator.reset(lookupFlags, selectMask);
+ 
+             while (glyphIterator.findFeatureTag()) {
+-                applyLookupTable(lookupTable, &glyphIterator, fontInstance, success);
++              applyLookupTable(lookupTable, &glyphIterator, fontInstance, success); // TODO
+                 if (LE_FAILURE(success)) {
+                     return 0;
+                 }
+@@ -124,7 +123,11 @@
+         return 0;
+     }
+ 
+-    const LookupTable *lookupTable = lookupListTable->getLookupTable(lookupTableIndex);
++    const LEReferenceTo<LookupTable> lookupTable = lookupListTable->getLookupTable(lookupListTable, lookupTableIndex, success);
++    if (!lookupTable.isValid()) {
++        success = LE_INTERNAL_ERROR;
++        return 0;
++    }
+     le_uint16 lookupFlags = SWAPW(lookupTable->lookupFlags);
+     GlyphIterator tempIterator(*glyphIterator, lookupFlags);
+     le_uint32 delta = applyLookupTable(lookupTable, &tempIterator, fontInstance, success);
+@@ -132,33 +135,35 @@
+     return delta;
+ }
+ 
+-le_int32 LookupProcessor::selectLookups(const FeatureTable *featureTable, FeatureMask featureMask, le_int32 order)
++le_int32 LookupProcessor::selectLookups(const LEReferenceTo<FeatureTable> &featureTable, FeatureMask featureMask, le_int32 order, LEErrorCode &success)
+ {
+-    le_uint16 lookupCount = featureTable? SWAPW(featureTable->lookupCount) : 0;
++    le_uint16 lookupCount = featureTable.isValid()? SWAPW(featureTable->lookupCount) : 0;
+     le_int32  store = order;
+ 
+-    for (le_uint16 lookup = 0; lookup < lookupCount; lookup += 1) {
+-        le_uint16 lookupListIndex = SWAPW(featureTable->lookupListIndexArray[lookup]);
++    LEReferenceToArrayOf<le_uint16> lookupListIndexArray(featureTable, success, featureTable->lookupListIndexArray, lookupCount);
+ 
+-        if (lookupListIndex >= lookupSelectCount)
+-            continue;
++    for (le_uint16 lookup = 0; LE_SUCCESS(success) && lookup < lookupCount; lookup += 1) {
++      le_uint16 lookupListIndex = SWAPW(lookupListIndexArray.getObject(lookup,success));
++      if (lookupListIndex >= lookupSelectCount) {
++        continue;
++      }
+ 
+-        lookupSelectArray[lookupListIndex] |= featureMask;
+-        lookupOrderArray[store++] = lookupListIndex;
++      lookupSelectArray[lookupListIndex] |= featureMask;
++      lookupOrderArray[store++] = lookupListIndex;
+     }
+ 
+     return store - order;
+ }
+ 
+-LookupProcessor::LookupProcessor(const char *baseAddress,
++LookupProcessor::LookupProcessor(const LETableReference &baseAddress,
+         Offset scriptListOffset, Offset featureListOffset, Offset lookupListOffset,
+         LETag scriptTag, LETag languageTag, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool orderFeatures,
+         LEErrorCode& success)
+-    : lookupListTable(NULL), featureListTable(NULL), lookupSelectArray(NULL), lookupSelectCount(0),
+-      lookupOrderArray(NULL), lookupOrderCount(0)
++    : lookupListTable(), featureListTable(), lookupSelectArray(NULL), lookupSelectCount(0),
++      lookupOrderArray(NULL), lookupOrderCount(0), fReference(baseAddress)
+ {
+-    const ScriptListTable *scriptListTable = NULL;
+-    const LangSysTable *langSysTable = NULL;
++    LEReferenceTo<ScriptListTable> scriptListTable;
++    LEReferenceTo<LangSysTable> langSysTable;
+     le_uint16 featureCount = 0;
+     le_uint16 lookupListCount = 0;
+     le_uint16 requiredFeatureIndex;
+@@ -168,29 +173,33 @@
+     }
+ 
+     if (scriptListOffset != 0) {
+-        scriptListTable = (const ScriptListTable *) (baseAddress + scriptListOffset);
+-        langSysTable = scriptListTable->findLanguage(scriptTag, languageTag);
++      scriptListTable = LEReferenceTo<ScriptListTable>(baseAddress, success, scriptListOffset);
++      langSysTable = scriptListTable->findLanguage(scriptListTable, scriptTag, languageTag, success);
+ 
+-        if (langSysTable != 0) {
+-            featureCount = SWAPW(langSysTable->featureCount);
+-        }
++      if (langSysTable.isValid() && LE_SUCCESS(success)) {
++        featureCount = SWAPW(langSysTable->featureCount);
++      }
+     }
+ 
+     if (featureListOffset != 0) {
+-        featureListTable = (const FeatureListTable *) (baseAddress + featureListOffset);
++      featureListTable = LEReferenceTo<FeatureListTable>(baseAddress, success, featureListOffset);
+     }
+ 
+     if (lookupListOffset != 0) {
+-        lookupListTable = (const LookupListTable *) (baseAddress + lookupListOffset);
++      lookupListTable = LEReferenceTo<LookupListTable>(baseAddress,success, lookupListOffset);
++      if(LE_SUCCESS(success) && lookupListTable.isValid()) {
+         lookupListCount = SWAPW(lookupListTable->lookupCount);
++      }
+     }
+ 
+-    if (langSysTable == NULL || featureListTable == NULL || lookupListTable == NULL ||
++    if (langSysTable.isEmpty() || featureListTable.isEmpty() || lookupListTable.isEmpty() ||
+         featureCount == 0 || lookupListCount == 0) {
+         return;
+     }
+ 
+-    requiredFeatureIndex = SWAPW(langSysTable->reqFeatureIndex);
++    if(langSysTable.isValid()) {
++      requiredFeatureIndex = SWAPW(langSysTable->reqFeatureIndex);
++    }
+ 
+     lookupSelectArray = LE_NEW_ARRAY(FeatureMask, lookupListCount);
+     if (lookupSelectArray == NULL) {
+@@ -206,30 +215,38 @@
+ 
+     le_int32 count, order = 0;
+     le_uint32 featureReferences = 0;
+-    const FeatureTable *featureTable = NULL;
++    LEReferenceTo<FeatureTable> featureTable;
+     LETag featureTag;
+ 
+-    const FeatureTable *requiredFeatureTable = NULL;
++    LEReferenceTo<FeatureTable> requiredFeatureTable;
+     LETag requiredFeatureTag = 0x00000000U;
+ 
+     // Count the total number of lookups referenced by all features. This will
+     // 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_uint32 feature = 0; feature < featureCount; feature += 1) {
+-        le_uint16 featureIndex = SWAPW(langSysTable->featureIndexArray[feature]);
++    if(featureListTable.isValid() && LE_SUCCESS(success)) {
++      LEReferenceToArrayOf<le_uint16> featureIndexArray(langSysTable, success, langSysTable->featureIndexArray, featureCount);
+ 
+-        featureTable = featureListTable->getFeatureTable(featureIndex, &featureTag);
++      for (le_uint32 feature = 0; LE_SUCCESS(success)&&(feature < featureCount); feature += 1) {
++        le_uint16 featureIndex = SWAPW(featureIndexArray.getObject(feature, success));
+ 
+-        if (!featureTable)
+-            continue;
++        featureTable = featureListTable->getFeatureTable(featureListTable, featureIndex,  &featureTag, success);
++        if (!featureTable.isValid() || LE_FAILURE(success)) {
++          continue;
++	}
++        featureReferences += SWAPW(featureTable->lookupCount);
++      }
++    }
+ 
+-        featureReferences += SWAPW(featureTable->lookupCount);
++    if (!featureTable.isValid() || LE_FAILURE(success)) {
++        success = LE_INTERNAL_ERROR;
++        return;
+     }
+ 
+     if (requiredFeatureIndex != 0xFFFF) {
+-        requiredFeatureTable = featureListTable->getFeatureTable(requiredFeatureIndex, &requiredFeatureTag);
+-        featureReferences += SWAPW(featureTable->lookupCount);
++      requiredFeatureTable = featureListTable->getFeatureTable(featureListTable, requiredFeatureIndex, &requiredFeatureTag, success);
++      featureReferences += SWAPW(featureTable->lookupCount);
+     }
+ 
+     lookupOrderArray = LE_NEW_ARRAY(le_uint16, featureReferences);
+@@ -244,7 +261,7 @@
+ 
+         // If this is the required feature, add its lookups
+         if (requiredFeatureTag == fm.tag) {
+-            count += selectLookups(requiredFeatureTable, fm.mask, order);
++          count += selectLookups(requiredFeatureTable, fm.mask, order, success);
+         }
+ 
+         if (orderFeatures) {
+@@ -254,7 +271,8 @@
+             }
+ 
+             for (le_uint16 feature = 0; feature < featureCount; feature += 1) {
+-                le_uint16 featureIndex = SWAPW(langSysTable->featureIndexArray[feature]);
++              LEReferenceToArrayOf<le_uint16> featureIndexArray(langSysTable, success, langSysTable->featureIndexArray, featureCount);
++              le_uint16 featureIndex = SWAPW(featureIndexArray.getObject(feature,success));
+ 
+                 // don't add the required feature to the list more than once...
+                 // TODO: Do we need this check? (Spec. says required feature won't be in feature list...)
+@@ -262,10 +280,10 @@
+                     continue;
+                 }
+ 
+-                featureTable = featureListTable->getFeatureTable(featureIndex, &featureTag);
++                featureTable = featureListTable->getFeatureTable(featureListTable, featureIndex, &featureTag, success);
+ 
+                 if (featureTag == fm.tag) {
+-                    count += selectLookups(featureTable, fm.mask, order + count);
++                  count += selectLookups(featureTable, fm.mask, order + count, success);
+                 }
+             }
+ 
+@@ -274,9 +292,10 @@
+             }
+ 
+             order += count;
+-        } else {
+-            for (le_uint16 feature = 0; feature < featureCount; feature += 1) {
+-                le_uint16 featureIndex = SWAPW(langSysTable->featureIndexArray[feature]);
++        } else if(langSysTable.isValid()) {
++          LEReferenceToArrayOf<le_uint16> featureIndexArray(langSysTable, success, langSysTable->featureIndexArray, featureCount);
++          for (le_uint16 feature = 0; LE_SUCCESS(success)&& (feature < featureCount); feature += 1) {
++            le_uint16 featureIndex = SWAPW(featureIndexArray.getObject(feature,success));
+ 
+                 // don't add the required feature to the list more than once...
+                 // NOTE: This check is commented out because the spec. says that
+@@ -288,10 +307,10 @@
+                 }
+ #endif
+ 
+-                featureTable = featureListTable->getFeatureTable(featureIndex, &featureTag);
++                featureTable = featureListTable->getFeatureTable(featureListTable, featureIndex, &featureTag, success);
+ 
+                 if (featureTag == fm.tag) {
+-                    order += selectLookups(featureTable, fm.mask, order);
++                  order += selectLookups(featureTable, fm.mask, order, success);
+                 }
+             }
+         }
+diff --git a/src/share/native/sun/font/layout/LookupProcessor.h b/src/share/native/sun/font/layout/LookupProcessor.h
+--- jdk/src/share/native/sun/font/layout/LookupProcessor.h
++++ jdk/src/share/native/sun/font/layout/LookupProcessor.h
+@@ -41,6 +41,7 @@
+ #include "LETypes.h"
+ #include "LEFontInstance.h"
+ #include "OpenTypeTables.h"
++#include "LETableReference.h"
+ //#include "Lookups.h"
+ //#include "Features.h"
+ 
+@@ -59,19 +60,21 @@
+ class LookupProcessor : public UMemory {
+ public:
+     le_int32 process(LEGlyphStorage &glyphStorage, GlyphPositionAdjustments *glyphPositionAdjustments,
+-                 le_bool rightToLeft, const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, const LEFontInstance *fontInstance, LEErrorCode& success) const;
++                 le_bool rightToLeft, const LEReferenceTo<GlyphDefinitionTableHeader> &glyphDefinitionTableHeader, const LEFontInstance *fontInstance, LEErrorCode& success) const;
+ 
+-    le_uint32 applyLookupTable(const LookupTable *lookupTable, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const;
++    le_uint32 applyLookupTable(const LEReferenceTo<LookupTable> &lookupTable, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const;
+ 
+     le_uint32 applySingleLookup(le_uint16 lookupTableIndex, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const;
+ 
+-    virtual le_uint32 applySubtable(const LookupSubtable *lookupSubtable, le_uint16 subtableType,
++    virtual le_uint32 applySubtable(const LEReferenceTo<LookupSubtable> &lookupSubtable, le_uint16 subtableType,
+         GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const = 0;
+ 
+     virtual ~LookupProcessor();
+ 
++    const LETableReference &getReference() const { return fReference; }
++
+ protected:
+-     LookupProcessor(const char *baseAddress,
++    LookupProcessor(const LETableReference &baseAddress,
+         Offset scriptListOffset,
+         Offset featureListOffset,
+         Offset lookupListOffset,
+@@ -84,10 +87,10 @@
+ 
+    LookupProcessor();
+ 
+-    le_int32 selectLookups(const FeatureTable *featureTable, FeatureMask featureMask, le_int32 order);
++    le_int32 selectLookups(const LEReferenceTo<FeatureTable> &featureTable, FeatureMask featureMask, le_int32 order, LEErrorCode &success);
+ 
+-    const LookupListTable   *lookupListTable;
+-    const FeatureListTable  *featureListTable;
++    LEReferenceTo<LookupListTable>   lookupListTable;
++    LEReferenceTo<FeatureListTable>  featureListTable;
+ 
+     FeatureMask            *lookupSelectArray;
+     le_uint32               lookupSelectCount;
+@@ -95,6 +98,8 @@
+     le_uint16               *lookupOrderArray;
+     le_uint32               lookupOrderCount;
+ 
++    LETableReference        fReference;
++
+ private:
+ 
+     LookupProcessor(const LookupProcessor &other); // forbid copying of this class
+diff --git a/src/share/native/sun/font/layout/LookupTables.cpp b/src/share/native/sun/font/layout/LookupTables.cpp
+--- jdk/src/share/native/sun/font/layout/LookupTables.cpp
++++ jdk/src/share/native/sun/font/layout/LookupTables.cpp
+@@ -49,22 +49,26 @@
+     of the derived classes, and implement it in the others by casting
+     the "this" pointer to the type that has the implementation.
+ */
+-const LookupSegment *BinarySearchLookupTable::lookupSegment(const LookupSegment *segments, LEGlyphID glyph) const
++const LookupSegment *BinarySearchLookupTable::lookupSegment(const LETableReference &base, const LookupSegment *segments, LEGlyphID glyph, LEErrorCode &success) const
+ {
++
+     le_int16  unity = SWAPW(unitSize);
+     le_int16  probe = SWAPW(searchRange);
+     le_int16  extra = SWAPW(rangeShift);
+     TTGlyphID ttGlyph = (TTGlyphID) LE_GET_GLYPH(glyph);
+-    const LookupSegment *entry = segments;
+-    const LookupSegment *trial = (const LookupSegment *) ((char *) entry + extra);
++    LEReferenceTo<LookupSegment> entry(base, success, segments);
++    LEReferenceTo<LookupSegment> trial(entry, success, extra);
++
++    if(LE_FAILURE(success)) return NULL;
+ 
+     if (SWAPW(trial->lastGlyph) <= ttGlyph) {
+         entry = trial;
+     }
+ 
+-    while (probe > unity) {
++    while (probe > unity && LE_SUCCESS(success)) {
+         probe >>= 1;
+-        trial = (const LookupSegment *) ((char *) entry + probe);
++        trial = entry; // copy
++        trial.addOffset(probe, success);
+ 
+         if (SWAPW(trial->lastGlyph) <= ttGlyph) {
+             entry = trial;
+@@ -72,28 +76,29 @@
+     }
+ 
+     if (SWAPW(entry->firstGlyph) <= ttGlyph) {
+-        return entry;
++      return entry.getAlias();
+     }
+ 
+     return NULL;
+ }
+ 
+-const LookupSingle *BinarySearchLookupTable::lookupSingle(const LookupSingle *entries, LEGlyphID glyph) const
++const LookupSingle *BinarySearchLookupTable::lookupSingle(const LETableReference &base, const LookupSingle *entries, LEGlyphID glyph, LEErrorCode &success) const
+ {
+     le_int16  unity = SWAPW(unitSize);
+     le_int16  probe = SWAPW(searchRange);
+     le_int16  extra = SWAPW(rangeShift);
+     TTGlyphID ttGlyph = (TTGlyphID) LE_GET_GLYPH(glyph);
+-    const LookupSingle *entry = entries;
+-    const LookupSingle *trial = (const LookupSingle *) ((char *) entry + extra);
++    LEReferenceTo<LookupSingle> entry(base, success, entries);
++    LEReferenceTo<LookupSingle> trial(entry, success, extra);
+ 
+     if (SWAPW(trial->glyph) <= ttGlyph) {
+         entry = trial;
+     }
+ 
+-    while (probe > unity) {
++    while (probe > unity && LE_SUCCESS(success)) {
+         probe >>= 1;
+-        trial = (const LookupSingle *) ((char *) entry + probe);
++        trial = entry;
++        trial.addOffset(probe, success);
+ 
+         if (SWAPW(trial->glyph) <= ttGlyph) {
+             entry = trial;
+@@ -101,7 +106,7 @@
+     }
+ 
+     if (SWAPW(entry->glyph) == ttGlyph) {
+-        return entry;
++      return entry.getAlias();
+     }
+ 
+     return NULL;
+diff --git a/src/share/native/sun/font/layout/LookupTables.h b/src/share/native/sun/font/layout/LookupTables.h
+--- jdk/src/share/native/sun/font/layout/LookupTables.h
++++ jdk/src/share/native/sun/font/layout/LookupTables.h
+@@ -39,6 +39,7 @@
+ 
+ #include "LETypes.h"
+ #include "LayoutTables.h"
++#include "LETableReference.h"
+ 
+ U_NAMESPACE_BEGIN
+ 
+@@ -79,30 +80,34 @@
+     le_int16 entrySelector;
+     le_int16 rangeShift;
+ 
+-    const LookupSegment *lookupSegment(const LookupSegment *segments, LEGlyphID glyph) const;
++    const LookupSegment *lookupSegment(const LETableReference &base, const LookupSegment *segments, LEGlyphID glyph, LEErrorCode &success) const;
+ 
+-    const LookupSingle *lookupSingle(const LookupSingle *entries, LEGlyphID glyph) const;
++    const LookupSingle *lookupSingle(const LETableReference &base, const LookupSingle *entries, LEGlyphID glyph, LEErrorCode &success) const;
+ };
+ 
+ struct SimpleArrayLookupTable : LookupTable
+ {
+     LookupValue valueArray[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(SimpleArrayLookupTable, valueArray)
+ 
+ struct SegmentSingleLookupTable : BinarySearchLookupTable
+ {
+     LookupSegment segments[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(SegmentSingleLookupTable, segments)
+ 
+ struct SegmentArrayLookupTable : BinarySearchLookupTable
+ {
+     LookupSegment segments[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(SegmentArrayLookupTable, segments)
+ 
+ struct SingleTableLookupTable : BinarySearchLookupTable
+ {
+     LookupSingle entries[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(SingleTableLookupTable, entries)
+ 
+ struct TrimmedArrayLookupTable : LookupTable
+ {
+@@ -110,6 +115,7 @@
+     TTGlyphID   glyphCount;
+     LookupValue valueArray[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(TrimmedArrayLookupTable, valueArray)
+ 
+ U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/Lookups.cpp b/src/share/native/sun/font/layout/Lookups.cpp
+--- jdk/src/share/native/sun/font/layout/Lookups.cpp
++++ jdk/src/share/native/sun/font/layout/Lookups.cpp
+@@ -37,33 +37,35 @@
+ 
+ U_NAMESPACE_BEGIN
+ 
+-const LookupTable *LookupListTable::getLookupTable(le_uint16 lookupTableIndex) const
++const LEReferenceTo<LookupTable> LookupListTable::getLookupTable(const LEReferenceTo<LookupListTable> &base, le_uint16 lookupTableIndex, LEErrorCode &success) const
+ {
+-    if (lookupTableIndex >= SWAPW(lookupCount)) {
+-        return 0;
+-    }
++  LEReferenceToArrayOf<Offset> lookupTableOffsetArrayRef(base, success, (const Offset*)&lookupTableOffsetArray, SWAPW(lookupCount));
+ 
+-    Offset lookupTableOffset = lookupTableOffsetArray[lookupTableIndex];
+-
+-    return (const LookupTable *) ((char *) this + SWAPW(lookupTableOffset));
++  if(LE_FAILURE(success) || lookupTableIndex>lookupTableOffsetArrayRef.getCount()) {
++    return LEReferenceTo<LookupTable>();
++  } else {
++    return LEReferenceTo<LookupTable>(base, success, SWAPW(lookupTableOffsetArrayRef.getObject(lookupTableIndex, success)));
++  }
+ }
+ 
+-const LookupSubtable *LookupTable::getLookupSubtable(le_uint16 subtableIndex) const
++const LEReferenceTo<LookupSubtable> LookupTable::getLookupSubtable(const LEReferenceTo<LookupTable> &base, le_uint16 subtableIndex, LEErrorCode &success) const
+ {
+-    if (subtableIndex >= SWAPW(subTableCount)) {
+-        return 0;
+-    }
++  LEReferenceToArrayOf<Offset> subTableOffsetArrayRef(base, success, (const Offset*)&subTableOffsetArray, SWAPW(subTableCount));
+ 
+-    Offset subtableOffset = subTableOffsetArray[subtableIndex];
+-
+-    return (const LookupSubtable *) ((char *) this + SWAPW(subtableOffset));
++  if(LE_FAILURE(success) || subtableIndex>subTableOffsetArrayRef.getCount()) {
++    return LEReferenceTo<LookupSubtable>();
++  } else {
++    return LEReferenceTo<LookupSubtable>(base, success, SWAPW(subTableOffsetArrayRef.getObject(subtableIndex, success)));
++  }
+ }
+ 
+-le_int32 LookupSubtable::getGlyphCoverage(Offset tableOffset, LEGlyphID glyphID) const
++le_int32 LookupSubtable::getGlyphCoverage(const LEReferenceTo<LookupSubtable> &base, Offset tableOffset, LEGlyphID glyphID, LEErrorCode &success) const
+ {
+-    const CoverageTable *coverageTable = (const CoverageTable *) ((char *) this + SWAPW(tableOffset));
++  const LEReferenceTo<CoverageTable> coverageTable(base, success, SWAPW(tableOffset));
+ 
+-    return coverageTable->getGlyphCoverage(glyphID);
++  if(LE_FAILURE(success)) return 0;
++
++  return coverageTable->getGlyphCoverage(glyphID);
+ }
+ 
+ U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/Lookups.h b/src/share/native/sun/font/layout/Lookups.h
+--- jdk/src/share/native/sun/font/layout/Lookups.h
++++ jdk/src/share/native/sun/font/layout/Lookups.h
+@@ -58,9 +58,14 @@
+     le_uint16 subtableFormat;
+     Offset    coverageTableOffset;
+ 
+-    inline le_int32  getGlyphCoverage(LEGlyphID glyphID) const;
++  inline le_int32  getGlyphCoverage(const LEReferenceTo<LookupSubtable> &base, LEGlyphID glyphID, LEErrorCode &success) const;
+ 
+-    le_int32  getGlyphCoverage(Offset tableOffset, LEGlyphID glyphID) const;
++  le_int32  getGlyphCoverage(const LEReferenceTo<LookupSubtable> &base, Offset tableOffset, LEGlyphID glyphID, LEErrorCode &success) const;
++
++  // convenience
++  inline le_int32  getGlyphCoverage(const LETableReference &base, LEGlyphID glyphID, LEErrorCode &success) const;
++
++  inline le_int32  getGlyphCoverage(const LETableReference &base, Offset tableOffset, LEGlyphID glyphID, LEErrorCode &success) const;
+ };
+ 
+ struct LookupTable
+@@ -70,20 +75,32 @@
+     le_uint16       subTableCount;
+     Offset          subTableOffsetArray[ANY_NUMBER];
+ 
+-    const LookupSubtable  *getLookupSubtable(le_uint16 subtableIndex) const;
++  const LEReferenceTo<LookupSubtable> getLookupSubtable(const LEReferenceTo<LookupTable> &base, le_uint16 subtableIndex, LEErrorCode &success) const;
+ };
++LE_VAR_ARRAY(LookupTable, subTableOffsetArray)
+ 
+ struct LookupListTable
+ {
+     le_uint16   lookupCount;
+     Offset      lookupTableOffsetArray[ANY_NUMBER];
+ 
+-    const LookupTable *getLookupTable(le_uint16 lookupTableIndex) const;
++  const LEReferenceTo<LookupTable> getLookupTable(const LEReferenceTo<LookupListTable> &base, le_uint16 lookupTableIndex, LEErrorCode &success) const;
+ };
++LE_VAR_ARRAY(LookupListTable, lookupTableOffsetArray)
+ 
+-inline le_int32 LookupSubtable::getGlyphCoverage(LEGlyphID glyphID) const
++inline le_int32 LookupSubtable::getGlyphCoverage(const LEReferenceTo<LookupSubtable> &base, LEGlyphID glyphID, LEErrorCode &success) const
+ {
+-    return getGlyphCoverage(coverageTableOffset, glyphID);
++  return getGlyphCoverage(base, coverageTableOffset, glyphID, success);
++}
++
++inline le_int32  LookupSubtable::getGlyphCoverage(const LETableReference &base, LEGlyphID glyphID, LEErrorCode &success) const {
++  LEReferenceTo<LookupSubtable> thisRef(base, success, this);
++  return getGlyphCoverage(thisRef, glyphID, success);
++}
++
++inline le_int32  LookupSubtable::getGlyphCoverage(const LETableReference &base, Offset tableOffset, LEGlyphID glyphID, LEErrorCode &success) const {
++  LEReferenceTo<LookupSubtable> thisRef(base, success, this);
++  return getGlyphCoverage(thisRef, tableOffset, glyphID, success);
+ }
+ 
+ U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/MarkArrays.h b/src/share/native/sun/font/layout/MarkArrays.h
+--- jdk/src/share/native/sun/font/layout/MarkArrays.h
++++ jdk/src/share/native/sun/font/layout/MarkArrays.h
+@@ -57,6 +57,7 @@
+     le_int32 getMarkClass(LEGlyphID glyphID, le_int32 coverageIndex, const LEFontInstance *fontInstance,
+         LEPoint &anchor) const;
+ };
++LE_VAR_ARRAY(MarkArray, markRecordArray)
+ 
+ U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp b/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp
+@@ -51,10 +51,10 @@
+     return 0xFFFF;
+ }
+ 
+-le_int32 MarkToBasePositioningSubtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
++le_int32 MarkToBasePositioningSubtable::process(const LETableReference &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const
+ {
+     LEGlyphID markGlyph = glyphIterator->getCurrGlyphID();
+-    le_int32 markCoverage = getGlyphCoverage((LEGlyphID) markGlyph);
++    le_int32 markCoverage = getGlyphCoverage(base, (LEGlyphID) markGlyph, success);
+ 
+     if (markCoverage < 0) {
+         // markGlyph isn't a covered mark glyph
+@@ -75,7 +75,7 @@
+     // FIXME: We probably don't want to find a base glyph before a previous ligature...
+     GlyphIterator baseIterator(*glyphIterator, (le_uint16) (lfIgnoreMarks /*| lfIgnoreLigatures*/));
+     LEGlyphID baseGlyph = findBaseGlyph(&baseIterator);
+-    le_int32 baseCoverage = getBaseCoverage((LEGlyphID) baseGlyph);
++    le_int32 baseCoverage = getBaseCoverage(base, (LEGlyphID) baseGlyph, success);
+     const BaseArray *baseArray = (const BaseArray *) ((char *) this + SWAPW(baseArrayOffset));
+     le_uint16 baseCount = SWAPW(baseArray->baseRecordCount);
+ 
+diff --git a/src/share/native/sun/font/layout/MarkToBasePosnSubtables.h b/src/share/native/sun/font/layout/MarkToBasePosnSubtables.h
+--- jdk/src/share/native/sun/font/layout/MarkToBasePosnSubtables.h
++++ jdk/src/share/native/sun/font/layout/MarkToBasePosnSubtables.h
+@@ -48,7 +48,7 @@
+ 
+ struct MarkToBasePositioningSubtable : AttachmentPositioningSubtable
+ {
+-    le_int32   process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
++  le_int32   process(const LETableReference &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const;
+     LEGlyphID  findBaseGlyph(GlyphIterator *glyphIterator) const;
+ };
+ 
+@@ -56,12 +56,14 @@
+ {
+     Offset baseAnchorTableOffsetArray[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(BaseRecord, baseAnchorTableOffsetArray)
+ 
+ struct BaseArray
+ {
+     le_int16 baseRecordCount;
+     BaseRecord baseRecordArray[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(BaseArray, baseRecordArray)
+ 
+ U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.cpp b/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.cpp
+@@ -50,10 +50,10 @@
+     return 0xFFFF;
+ }
+ 
+-le_int32 MarkToLigaturePositioningSubtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
++le_int32 MarkToLigaturePositioningSubtable::process(const LETableReference &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const
+ {
+     LEGlyphID markGlyph = glyphIterator->getCurrGlyphID();
+-    le_int32 markCoverage = getGlyphCoverage((LEGlyphID) markGlyph);
++    le_int32 markCoverage = getGlyphCoverage(base, (LEGlyphID) markGlyph, success);
+ 
+     if (markCoverage < 0) {
+         // markGlyph isn't a covered mark glyph
+@@ -74,7 +74,7 @@
+     // FIXME: we probably don't want to find a ligature before a previous base glyph...
+     GlyphIterator ligatureIterator(*glyphIterator, (le_uint16) (lfIgnoreMarks /*| lfIgnoreBaseGlyphs*/));
+     LEGlyphID ligatureGlyph = findLigatureGlyph(&ligatureIterator);
+-    le_int32 ligatureCoverage = getBaseCoverage((LEGlyphID) ligatureGlyph);
++    le_int32 ligatureCoverage = getBaseCoverage(base, (LEGlyphID) ligatureGlyph, success);
+     const LigatureArray *ligatureArray = (const LigatureArray *) ((char *) this + SWAPW(baseArrayOffset));
+     le_uint16 ligatureCount = SWAPW(ligatureArray->ligatureCount);
+ 
+diff --git a/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.h b/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.h
+--- jdk/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.h
++++ jdk/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.h
+@@ -48,7 +48,7 @@
+ 
+ struct MarkToLigaturePositioningSubtable : AttachmentPositioningSubtable
+ {
+-    le_int32   process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
++  le_int32   process(const LETableReference &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const;
+     LEGlyphID  findLigatureGlyph(GlyphIterator *glyphIterator) const;
+ };
+ 
+@@ -56,18 +56,21 @@
+ {
+     Offset ligatureAnchorTableOffsetArray[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(ComponentRecord, ligatureAnchorTableOffsetArray)
+ 
+ struct LigatureAttachTable
+ {
+     le_uint16 componentCount;
+     ComponentRecord componentRecordArray[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(LigatureAttachTable, componentRecordArray)
+ 
+ struct LigatureArray
+ {
+     le_uint16 ligatureCount;
+     Offset ligatureAttachTableOffsetArray[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(LigatureArray, ligatureAttachTableOffsetArray)
+ 
+ U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.cpp b/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.cpp
+@@ -51,10 +51,10 @@
+     return 0xFFFF;
+ }
+ 
+-le_int32 MarkToMarkPositioningSubtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
++le_int32 MarkToMarkPositioningSubtable::process(const LETableReference &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const
+ {
+     LEGlyphID markGlyph = glyphIterator->getCurrGlyphID();
+-    le_int32 markCoverage = getGlyphCoverage((LEGlyphID) markGlyph);
++    le_int32 markCoverage = getGlyphCoverage(base, (LEGlyphID) markGlyph, success);
+ 
+     if (markCoverage < 0) {
+         // markGlyph isn't a covered mark glyph
+@@ -74,7 +74,7 @@
+ 
+     GlyphIterator mark2Iterator(*glyphIterator);
+     LEGlyphID mark2Glyph = findMark2Glyph(&mark2Iterator);
+-    le_int32 mark2Coverage = getBaseCoverage((LEGlyphID) mark2Glyph);
++    le_int32 mark2Coverage = getBaseCoverage(base, (LEGlyphID) mark2Glyph, success);
+     const Mark2Array *mark2Array = (const Mark2Array *) ((char *) this + SWAPW(baseArrayOffset));
+     le_uint16 mark2Count = SWAPW(mark2Array->mark2RecordCount);
+ 
+diff --git a/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.h b/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.h
+--- jdk/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.h
++++ jdk/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.h
+@@ -48,7 +48,7 @@
+ 
+ struct MarkToMarkPositioningSubtable : AttachmentPositioningSubtable
+ {
+-    le_int32   process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
++  le_int32   process(const LETableReference &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const;
+     LEGlyphID  findMark2Glyph(GlyphIterator *glyphIterator) const;
+ };
+ 
+@@ -56,12 +56,14 @@
+ {
+     Offset mark2AnchorTableOffsetArray[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(Mark2Record, mark2AnchorTableOffsetArray)
+ 
+ struct Mark2Array
+ {
+     le_uint16 mark2RecordCount;
+     Mark2Record mark2RecordArray[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(Mark2Array, mark2RecordArray)
+ 
+ U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/MorphTables.cpp b/src/share/native/sun/font/layout/MorphTables.cpp
+--- jdk/src/share/native/sun/font/layout/MorphTables.cpp
++++ jdk/src/share/native/sun/font/layout/MorphTables.cpp
+@@ -44,61 +44,61 @@
+ 
+ U_NAMESPACE_BEGIN
+ 
+-void MorphTableHeader::process(LEGlyphStorage &glyphStorage) const
++void MorphTableHeader::process(const LETableReference &base, LEGlyphStorage &glyphStorage, LEErrorCode &success) const
+ {
+-    const ChainHeader *chainHeader = chains;
+-    le_uint32 chainCount = SWAPL(this->nChains);
++  le_uint32 chainCount = SWAPL(this->nChains);
++  LEReferenceTo<ChainHeader> chainHeader(base, success, chains); // moving header
++    LEReferenceToArrayOf<ChainHeader> chainHeaderArray(base, success, chains, chainCount);
+     le_uint32 chain;
+ 
+-    for (chain = 0; chain < chainCount; chain += 1) {
++    for (chain = 0; LE_SUCCESS(success) && (chain < chainCount); chain += 1) {
+         FeatureFlags defaultFlags = SWAPL(chainHeader->defaultFlags);
+         le_uint32 chainLength = SWAPL(chainHeader->chainLength);
+         le_int16 nFeatureEntries = SWAPW(chainHeader->nFeatureEntries);
+         le_int16 nSubtables = SWAPW(chainHeader->nSubtables);
+-        const MorphSubtableHeader *subtableHeader =
+-            (const MorphSubtableHeader *)&chainHeader->featureTable[nFeatureEntries];
++        LEReferenceTo<MorphSubtableHeader> subtableHeader =
++          LEReferenceTo<MorphSubtableHeader>(chainHeader,success, &(chainHeader->featureTable[nFeatureEntries]));
+         le_int16 subtable;
+ 
+-        for (subtable = 0; subtable < nSubtables; subtable += 1) {
++        for (subtable = 0; LE_SUCCESS(success) && (subtable < nSubtables); subtable += 1) {
+             le_int16 length = SWAPW(subtableHeader->length);
+             SubtableCoverage coverage = SWAPW(subtableHeader->coverage);
+             FeatureFlags subtableFeatures = SWAPL(subtableHeader->subtableFeatures);
+ 
+             // should check coverage more carefully...
+-            if ((coverage & scfVertical) == 0 && (subtableFeatures & defaultFlags) != 0) {
+-                subtableHeader->process(glyphStorage);
++            if ((coverage & scfVertical) == 0 && (subtableFeatures & defaultFlags) != 0  && LE_SUCCESS(success)) {
++              subtableHeader->process(subtableHeader, glyphStorage, success);
+             }
+ 
+-            subtableHeader = (const MorphSubtableHeader *) ((char *)subtableHeader + length);
++            subtableHeader.addOffset(length, success);
+         }
+-
+-        chainHeader = (const ChainHeader *)((char *)chainHeader + chainLength);
++        chainHeader.addOffset(chainLength, success);
+     }
+ }
+ 
+-void MorphSubtableHeader::process(LEGlyphStorage &glyphStorage) const
++void MorphSubtableHeader::process(const LEReferenceTo<MorphSubtableHeader> &base, LEGlyphStorage &glyphStorage, LEErrorCode &success) const
+ {
+     SubtableProcessor *processor = NULL;
+ 
+     switch (SWAPW(coverage) & scfTypeMask)
+     {
+     case mstIndicRearrangement:
+-        processor = new IndicRearrangementProcessor(this);
++      processor = new IndicRearrangementProcessor(base, success);
+         break;
+ 
+     case mstContextualGlyphSubstitution:
+-        processor = new ContextualGlyphSubstitutionProcessor(this);
++      processor = new ContextualGlyphSubstitutionProcessor(base, success);
+         break;
+ 
+     case mstLigatureSubstitution:
+-        processor = new LigatureSubstitutionProcessor(this);
++      processor = new LigatureSubstitutionProcessor(base, success);
+         break;
+ 
+     case mstReservedUnused:
+         break;
+ 
+     case mstNonContextualGlyphSubstitution:
+-        processor = NonContextualGlyphSubstitutionProcessor::createInstance(this);
++      processor = NonContextualGlyphSubstitutionProcessor::createInstance(base, success);
+         break;
+ 
+     /*
+@@ -112,8 +112,10 @@
+     }
+ 
+     if (processor != NULL) {
+-        processor->process(glyphStorage);
+-        delete processor;
++      if(LE_SUCCESS(success)) {
++        processor->process(glyphStorage, success);
++      }
++      delete processor;
+     }
+ }
+ 
+diff --git a/src/share/native/sun/font/layout/MorphTables.h b/src/share/native/sun/font/layout/MorphTables.h
+--- jdk/src/share/native/sun/font/layout/MorphTables.h
++++ jdk/src/share/native/sun/font/layout/MorphTables.h
+@@ -39,6 +39,7 @@
+ 
+ #include "LETypes.h"
+ #include "LayoutTables.h"
++#include "LETableReference.h"
+ 
+ U_NAMESPACE_BEGIN
+ 
+@@ -65,6 +66,7 @@
+     le_int16           nSubtables;
+     FeatureTableEntry   featureTable[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(ChainHeader, featureTable)
+ 
+ struct MorphTableHeader
+ {
+@@ -72,8 +74,9 @@
+     le_uint32   nChains;
+     ChainHeader chains[ANY_NUMBER];
+ 
+-    void process(LEGlyphStorage &glyphStorage) const;
++  void process(const LETableReference& base, LEGlyphStorage &glyphStorage, LEErrorCode &success) const;
+ };
++LE_VAR_ARRAY(MorphTableHeader, chains)
+ 
+ typedef le_int16 SubtableCoverage;
+ 
+@@ -102,7 +105,7 @@
+     SubtableCoverage    coverage;
+     FeatureFlags        subtableFeatures;
+ 
+-    void process(LEGlyphStorage &glyphStorage) const;
++  void process(const LEReferenceTo<MorphSubtableHeader> &base, LEGlyphStorage &glyphStorage, LEErrorCode &success) const;
+ };
+ 
+ U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/MultipleSubstSubtables.cpp b/src/share/native/sun/font/layout/MultipleSubstSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/MultipleSubstSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/MultipleSubstSubtables.cpp
+@@ -39,7 +39,7 @@
+ 
+ U_NAMESPACE_BEGIN
+ 
+-le_uint32 MultipleSubstitutionSubtable::process(GlyphIterator *glyphIterator, LEErrorCode& success, const LEGlyphFilter *filter) const
++le_uint32 MultipleSubstitutionSubtable::process(const LETableReference &base, GlyphIterator *glyphIterator, LEErrorCode& success, const LEGlyphFilter *filter) const
+ {
+     if (LE_FAILURE(success)) {
+         return 0;
+@@ -58,7 +58,7 @@
+         return 0;
+     }
+ 
+-    le_int32 coverageIndex = getGlyphCoverage(glyph);
++    le_int32 coverageIndex = getGlyphCoverage(base, glyph, success);
+     le_uint16 seqCount = SWAPW(sequenceCount);
+ 
+     if (coverageIndex >= 0 && coverageIndex < seqCount) {
+diff --git a/src/share/native/sun/font/layout/MultipleSubstSubtables.h b/src/share/native/sun/font/layout/MultipleSubstSubtables.h
+--- jdk/src/share/native/sun/font/layout/MultipleSubstSubtables.h
++++ jdk/src/share/native/sun/font/layout/MultipleSubstSubtables.h
+@@ -50,14 +50,16 @@
+     le_uint16 glyphCount;
+     TTGlyphID substituteArray[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(SequenceTable, substituteArray)
+ 
+ struct MultipleSubstitutionSubtable : GlyphSubstitutionSubtable
+ {
+     le_uint16 sequenceCount;
+     Offset    sequenceTableOffsetArray[ANY_NUMBER];
+ 
+-    le_uint32 process(GlyphIterator *glyphIterator, LEErrorCode& success, const LEGlyphFilter *filter = NULL) const;
++    le_uint32 process(const LETableReference &base, GlyphIterator *glyphIterator, LEErrorCode& success, const LEGlyphFilter *filter = NULL) const;
+ };
++LE_VAR_ARRAY(MultipleSubstitutionSubtable, sequenceTableOffsetArray)
+ 
+ U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.cpp b/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.cpp
+--- jdk/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.cpp
++++ jdk/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.cpp
+@@ -47,8 +47,8 @@
+ {
+ }
+ 
+-NonContextualGlyphSubstitutionProcessor::NonContextualGlyphSubstitutionProcessor(const MorphSubtableHeader *morphSubtableHeader)
+-    : SubtableProcessor(morphSubtableHeader)
++NonContextualGlyphSubstitutionProcessor::NonContextualGlyphSubstitutionProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success)
++  : SubtableProcessor(morphSubtableHeader, success)
+ {
+ }
+ 
+@@ -56,26 +56,27 @@
+ {
+ }
+ 
+-SubtableProcessor *NonContextualGlyphSubstitutionProcessor::createInstance(const MorphSubtableHeader *morphSubtableHeader)
++SubtableProcessor *NonContextualGlyphSubstitutionProcessor::createInstance(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success)
+ {
+-    const NonContextualGlyphSubstitutionHeader *header = (const NonContextualGlyphSubstitutionHeader *) morphSubtableHeader;
++  LEReferenceTo<NonContextualGlyphSubstitutionHeader> header(morphSubtableHeader, success);
+ 
+-    switch (SWAPW(header->table.format))
+-    {
++  if(LE_FAILURE(success)) return NULL;
++
++  switch (SWAPW(header->table.format)) {
+     case ltfSimpleArray:
+-        return new SimpleArrayProcessor(morphSubtableHeader);
++      return new SimpleArrayProcessor(morphSubtableHeader, success);
+ 
+     case ltfSegmentSingle:
+-        return new SegmentSingleProcessor(morphSubtableHeader);
++      return new SegmentSingleProcessor(morphSubtableHeader, success);
+ 
+     case ltfSegmentArray:
+-        return new SegmentArrayProcessor(morphSubtableHeader);
++      return new SegmentArrayProcessor(morphSubtableHeader, success);
+ 
+     case ltfSingleTable:
+-        return new SingleTableProcessor(morphSubtableHeader);
++      return new SingleTableProcessor(morphSubtableHeader, success);
+ 
+     case ltfTrimmedArray:
+-        return new TrimmedArrayProcessor(morphSubtableHeader);
++      return new TrimmedArrayProcessor(morphSubtableHeader, success);
+ 
+     default:
+         return NULL;
+diff --git a/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.h b/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.h
+--- jdk/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.h
++++ jdk/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.h
+@@ -49,13 +49,13 @@
+ class NonContextualGlyphSubstitutionProcessor : public SubtableProcessor
+ {
+ public:
+-    virtual void process(LEGlyphStorage &glyphStorage) = 0;
++  virtual void process(LEGlyphStorage &glyphStorage, LEErrorCode &success) = 0;
+ 
+-    static SubtableProcessor *createInstance(const MorphSubtableHeader *morphSubtableHeader);
++    static SubtableProcessor *createInstance(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success);
+ 
+ protected:
+     NonContextualGlyphSubstitutionProcessor();
+-    NonContextualGlyphSubstitutionProcessor(const MorphSubtableHeader *morphSubtableHeader);
++    NonContextualGlyphSubstitutionProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &status);
+ 
+     virtual ~NonContextualGlyphSubstitutionProcessor();
+ 
+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
+@@ -101,25 +101,21 @@
+ static const le_int32 featureMapCount = LE_ARRAY_SIZE(featureMap);
+ 
+ OpenTypeLayoutEngine::OpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                        le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success)
++                     le_int32 typoFlags, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, LEErrorCode &success)
+     : LayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success), fFeatureMask(minimalFeatures),
+       fFeatureMap(featureMap), fFeatureMapCount(featureMapCount), fFeatureOrder(FALSE),
+-      fGSUBTable(gsubTable), fGDEFTable(NULL), fGPOSTable(NULL), fSubstitutionFilter(NULL)
++      fGSUBTable(gsubTable),
++      fGDEFTable(fontInstance, LE_GDEF_TABLE_TAG, success),
++      fGPOSTable(fontInstance, LE_GPOS_TABLE_TAG, success), fSubstitutionFilter(NULL)
+ {
+-    static const le_uint32 gdefTableTag = LE_GDEF_TABLE_TAG;
+-    static const le_uint32 gposTableTag = LE_GPOS_TABLE_TAG;
+-    const GlyphPositioningTableHeader *gposTable = (const GlyphPositioningTableHeader *) getFontTable(gposTableTag);
+-
+     applyTypoFlags();
+ 
+     setScriptAndLanguageTags();
+ 
+-    fGDEFTable = (const GlyphDefinitionTableHeader *) getFontTable(gdefTableTag);
+-
+ // JK patch, 2008-05-30 - see Sinhala bug report and LKLUG font
+ //    if (gposTable != NULL && gposTable->coversScriptAndLanguage(fScriptTag, fLangSysTag)) {
+-    if (gposTable != NULL && gposTable->coversScript(fScriptTag)) {
+-        fGPOSTable = gposTable;
++    if (!fGPOSTable.isEmpty()&& !fGPOSTable->coversScript(fGPOSTable, fScriptTag, success)) {
++      fGPOSTable.clear(); // already loaded
+     }
+ }
+ 
+@@ -154,7 +150,7 @@
+ OpenTypeLayoutEngine::OpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+                        le_int32 typoFlags, LEErrorCode &success)
+     : LayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success), fFeatureOrder(FALSE),
+-      fGSUBTable(NULL), fGDEFTable(NULL), fGPOSTable(NULL), fSubstitutionFilter(NULL)
++      fGSUBTable(), fGDEFTable(), fGPOSTable(), fSubstitutionFilter(NULL)
+ {
+     applyTypoFlags();
+     setScriptAndLanguageTags();
+@@ -276,13 +272,13 @@
+         return 0;
+     }
+ 
+-    if (fGSUBTable != NULL) {
+-        if (fScriptTagV2 != nullScriptTag && fGSUBTable->coversScriptAndLanguage(fScriptTagV2,fLangSysTag)) {
+-            count = fGSUBTable->process(glyphStorage, rightToLeft, fScriptTagV2, fLangSysTag, fGDEFTable, fSubstitutionFilter,
++    if (fGSUBTable.isValid()) {
++      if (fScriptTagV2 != nullScriptTag && fGSUBTable->coversScriptAndLanguage(fGSUBTable, fScriptTagV2, fLangSysTag, success)) {
++          count = fGSUBTable->process(fGSUBTable, glyphStorage, rightToLeft, fScriptTagV2, fLangSysTag, fGDEFTable, fSubstitutionFilter,
+                                     fFeatureMap, fFeatureMapCount, fFeatureOrder, success);
+ 
+         } else {
+-        count = fGSUBTable->process(glyphStorage, rightToLeft, fScriptTag, fLangSysTag, fGDEFTable, fSubstitutionFilter,
++          count = fGSUBTable->process(fGSUBTable, glyphStorage, rightToLeft, fScriptTag, fLangSysTag, fGDEFTable, fSubstitutionFilter,
+                                     fFeatureMap, fFeatureMapCount, fFeatureOrder, success);
+     }
+     }
+@@ -303,13 +299,13 @@
+         return 0;
+     }
+ 
+-    if (fGSUBTable != NULL) {
+-        if (fScriptTagV2 != nullScriptTag && fGSUBTable->coversScriptAndLanguage(fScriptTagV2,fLangSysTag)) {
+-            count = fGSUBTable->process(glyphStorage, rightToLeft, fScriptTagV2, fLangSysTag, fGDEFTable, fSubstitutionFilter,
++    if (fGSUBTable.isValid()) {
++       if (fScriptTagV2 != nullScriptTag && fGSUBTable->coversScriptAndLanguage(fGSUBTable,fScriptTagV2,fLangSysTag,success)) {
++          count = fGSUBTable->process(fGSUBTable, glyphStorage, rightToLeft, fScriptTagV2, fLangSysTag, fGDEFTable, fSubstitutionFilter,
+                                     fFeatureMap, fFeatureMapCount, fFeatureOrder, success);
+ 
+         } else {
+-        count = fGSUBTable->process(glyphStorage, rightToLeft, fScriptTag, fLangSysTag, fGDEFTable, fSubstitutionFilter,
++          count = fGSUBTable->process(fGSUBTable, glyphStorage, rightToLeft, fScriptTag, fLangSysTag, fGDEFTable, fSubstitutionFilter,
+                                     fFeatureMap, fFeatureMapCount, fFeatureOrder, success);
+         }
+     }
+@@ -387,7 +383,7 @@
+         return;
+     }
+ 
+-    if (fGPOSTable != NULL) {
++    if (!fGPOSTable.isEmpty()) {
+         GlyphPositionAdjustments *adjustments = new GlyphPositionAdjustments(glyphCount);
+         le_int32 i;
+ 
+@@ -410,19 +406,20 @@
+         }
+ #endif
+ 
+-        if (fGPOSTable != NULL) {
+-            if (fScriptTagV2 != nullScriptTag && fGPOSTable->coversScriptAndLanguage(fScriptTagV2,fLangSysTag)) {
+-                fGPOSTable->process(glyphStorage, adjustments, reverse, fScriptTagV2, fLangSysTag, fGDEFTable, success, fFontInstance,
+-                            fFeatureMap, fFeatureMapCount, fFeatureOrder);
++        if (!fGPOSTable.isEmpty()) {
++            if (fScriptTagV2 != nullScriptTag &&
++                fGPOSTable->coversScriptAndLanguage(fGPOSTable, fScriptTagV2,fLangSysTag,success)) {
++              fGPOSTable->process(fGPOSTable, glyphStorage, adjustments, reverse, fScriptTagV2, fLangSysTag,
++                                  fGDEFTable, success, fFontInstance, fFeatureMap, fFeatureMapCount, fFeatureOrder);
+ 
+             } else {
+-                fGPOSTable->process(glyphStorage, adjustments, reverse, fScriptTag, fLangSysTag, fGDEFTable, success, fFontInstance,
+-                                fFeatureMap, fFeatureMapCount, fFeatureOrder);
++              fGPOSTable->process(fGPOSTable, glyphStorage, adjustments, reverse, fScriptTag, fLangSysTag,
++                                  fGDEFTable, success, fFontInstance, fFeatureMap, fFeatureMapCount, fFeatureOrder);
+             }
+-        } else if ( fTypoFlags & 0x1 ) {
+-            static const le_uint32 kernTableTag = LE_KERN_TABLE_TAG;
+-            KernTable kt(fFontInstance, getFontTable(kernTableTag));
+-            kt.process(glyphStorage);
++        } else if (fTypoFlags & LE_Kerning_FEATURE_FLAG) { /* kerning enabled */
++          LETableReference kernTable(fFontInstance, LE_KERN_TABLE_TAG, success);
++          KernTable kt(kernTable, success);
++          kt.process(glyphStorage, success);
+         }
+ 
+         float xAdjust = 0, yAdjust = 0;
+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
+@@ -35,6 +35,7 @@
+ #include "LEGlyphFilter.h"
+ #include "LEFontInstance.h"
+ #include "LayoutEngine.h"
++#include "LETableReference.h"
+ 
+ #include "GlyphSubstitutionTables.h"
+ #include "GlyphDefinitionTables.h"
+@@ -88,7 +89,7 @@
+      * @internal
+      */
+     OpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                            le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success);
++                            le_int32 typoFlags, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, LEErrorCode &success);
+ 
+     /**
+      * This constructor is used when the font requires a "canned" GSUB table which can't be known
+@@ -228,21 +229,21 @@
+      *
+      * @internal
+      */
+-    const GlyphSubstitutionTableHeader *fGSUBTable;
++    LEReferenceTo<GlyphSubstitutionTableHeader> fGSUBTable;
+ 
+     /**
+      * The address of the GDEF table.
+      *
+      * @internal
+      */
+-    const GlyphDefinitionTableHeader   *fGDEFTable;
++    LEReferenceTo<GlyphDefinitionTableHeader> fGDEFTable;
+ 
+     /**
+      * The address of the GPOS table.
+      *
+      * @internal
+      */
+-    const GlyphPositioningTableHeader  *fGPOSTable;
++    LEReferenceTo<GlyphPositioningTableHeader> fGPOSTable;
+ 
+     /**
+      * An optional filter used to inhibit substitutions
+diff --git a/src/share/native/sun/font/layout/OpenTypeTables.h b/src/share/native/sun/font/layout/OpenTypeTables.h
+--- jdk/src/share/native/sun/font/layout/OpenTypeTables.h
++++ jdk/src/share/native/sun/font/layout/OpenTypeTables.h
+@@ -38,6 +38,7 @@
+  */
+ 
+ #include "LETypes.h"
++#include "LETableReference.h"
+ 
+ U_NAMESPACE_BEGIN
+ 
+@@ -50,7 +51,7 @@
+ #define LE_GLYPH_GROUP_MASK 0x00000001UL
+ typedef le_uint32 FeatureMask;
+ 
+-#define SWAPT(atag) ((LETag) ((atag[0] << 24) + (atag[1] << 16) + (atag[2] << 8) + atag[3]))
++#define SWAPT(atag) ((LETag) (((atag[0]) << 24) + ((atag[1]) << 16) + ((atag[2]) << 8) + (atag[3])))
+ 
+ struct TagAndOffsetRecord
+ {
+diff --git a/src/share/native/sun/font/layout/OpenTypeUtilities.cpp b/src/share/native/sun/font/layout/OpenTypeUtilities.cpp
+--- jdk/src/share/native/sun/font/layout/OpenTypeUtilities.cpp
++++ jdk/src/share/native/sun/font/layout/OpenTypeUtilities.cpp
+@@ -76,58 +76,74 @@
+     return bit;
+ }
+ 
+-Offset OpenTypeUtilities::getTagOffset(LETag tag, const TagAndOffsetRecord *records, le_int32 recordCount)
++
++Offset OpenTypeUtilities::getTagOffset(LETag tag, const LEReferenceToArrayOf<TagAndOffsetRecord> &records, LEErrorCode &success)
+ {
+-    le_uint8 bit = highBit(recordCount);
+-    le_int32 power = 1 << bit;
+-    le_int32 extra = recordCount - power;
+-    le_int32 probe = power;
+-    le_int32 index = 0;
++  if(LE_FAILURE(success)) return 0;
+ 
+-    if (SWAPT(records[extra].tag) <= tag) {
+-        index = extra;
++  le_uint32 recordCount = records.getCount();
++  le_uint8 bit = highBit(recordCount);
++  le_int32 power = 1 << bit;
++  le_int32 extra = recordCount - power;
++  le_int32 probe = power;
++  le_int32 index = 0;
++
++  {
++    const ATag &aTag = records.getAlias(extra,success)->tag;
++    if (SWAPT(aTag) <= tag) {
++      index = extra;
+     }
++  }
+ 
+-    while (probe > (1 << 0)) {
+-        probe >>= 1;
++  while (probe > (1 << 0) && LE_SUCCESS(success)) {
++    probe >>= 1;
+ 
+-        if (SWAPT(records[index + probe].tag) <= tag) {
+-            index += probe;
+-        }
++    {
++      const ATag &aTag = records.getAlias(index+probe,success)->tag;
++      if (SWAPT(aTag) <= tag) {
++        index += probe;
++      }
+     }
++  }
+ 
+-    if (SWAPT(records[index].tag) == tag) {
+-        return SWAPW(records[index].offset);
++  {
++    const ATag &aTag = records.getAlias(index,success)->tag;
++    if (SWAPT(aTag) == tag) {
++      return SWAPW(records.getAlias(index,success)->offset);
+     }
++  }
+ 
+-    return 0;
++  return 0;
+ }
+ 
+-le_int32 OpenTypeUtilities::getGlyphRangeIndex(TTGlyphID glyphID, const GlyphRangeRecord *records, le_int32 recordCount)
++le_int32 OpenTypeUtilities::getGlyphRangeIndex(TTGlyphID glyphID, const LEReferenceToArrayOf<GlyphRangeRecord> &records, LEErrorCode &success)
+ {
++  if(LE_FAILURE(success)) return -1;
++
++    le_uint32 recordCount = records.getCount();
+     le_uint8 bit = highBit(recordCount);
+     le_int32 power = 1 << bit;
+     le_int32 extra = recordCount - power;
+     le_int32 probe = power;
+     le_int32 range = 0;
+ 
+-        if (recordCount == 0) {
+-                return -1;
+-        }
++    if (recordCount == 0) {
++      return -1;
++    }
+ 
+-    if (SWAPW(records[extra].firstGlyph) <= glyphID) {
++    if (SWAPW(records(extra,success).firstGlyph) <= glyphID) {
+         range = extra;
+     }
+ 
+-    while (probe > (1 << 0)) {
++    while (probe > (1 << 0) && LE_SUCCESS(success)) {
+         probe >>= 1;
+ 
+-        if (SWAPW(records[range + probe].firstGlyph) <= glyphID) {
++        if (SWAPW(records(range + probe,success).firstGlyph) <= glyphID) {
+             range += probe;
+         }
+     }
+ 
+-    if (SWAPW(records[range].firstGlyph) <= glyphID && SWAPW(records[range].lastGlyph) >= glyphID) {
++    if (SWAPW(records(range,success).firstGlyph) <= glyphID && SWAPW(records(range,success).lastGlyph) >= glyphID) {
+         return range;
+     }
+ 
+@@ -199,6 +215,38 @@
+     }
+ }
+ 
++U_NAMESPACE_END
+ 
++#if LE_ASSERT_BAD_FONT
++#include <stdio.h>
+ 
+-U_NAMESPACE_END
++static const char *letagToStr(LETag tag, char *str) {
++  str[0]= 0xFF & (tag>>24);
++  str[1]= 0xFF & (tag>>16);
++  str[2]= 0xFF & (tag>>8);
++  str[3]= 0xFF & (tag>>0);
++  str[4]= 0;
++  return str;
++}
++
++U_CAPI void U_EXPORT2 _debug_LETableReference(const char *f, int l, const char *msg, const LETableReference *what, const void *ptr, size_t len) {
++  char tagbuf[5];
++
++  fprintf(stderr, "%s:%d: LETableReference at 0x%p: ", f, l, what);
++  fprintf(stderr, msg, ptr, len);
++  fprintf(stderr, "\n");
++
++  for(int depth=0;depth<10&&(what!=NULL);depth++) {
++    for(int i=0;i<depth;i++) {
++      fprintf(stderr, " "); // indent
++    }
++    if(!what->isValid()) {
++      fprintf(stderr, "(invalid)");
++    }
++    fprintf(stderr, "@%p: tag (%s) font (0x%p), [0x%p+0x%lx]\n", what, letagToStr(what->getTag(), tagbuf), what->getFont(),
++            what->getAlias(), what->getLength());
++
++    what = what->getParent();
++  }
++}
++#endif
+diff --git a/src/share/native/sun/font/layout/OpenTypeUtilities.h b/src/share/native/sun/font/layout/OpenTypeUtilities.h
+--- jdk/src/share/native/sun/font/layout/OpenTypeUtilities.h
++++ jdk/src/share/native/sun/font/layout/OpenTypeUtilities.h
+@@ -45,8 +45,17 @@
+ class OpenTypeUtilities /* not : public UObject because all methods are static */ {
+ public:
+     static le_int8 highBit(le_int32 value);
+-    static Offset getTagOffset(LETag tag, const TagAndOffsetRecord *records, le_int32 recordCount);
+-    static le_int32 getGlyphRangeIndex(TTGlyphID glyphID, const GlyphRangeRecord *records, le_int32 recordCount);
++    static Offset getTagOffset(LETag tag, const LEReferenceToArrayOf<TagAndOffsetRecord> &records, LEErrorCode &success);
++    /**
++     * @deprecated TODO remove
++     */
++    static le_int32 getGlyphRangeIndex(TTGlyphID glyphID, const GlyphRangeRecord *records, le_int32 recordCount) {
++      LEErrorCode success = LE_NO_ERROR;
++      LETableReference recordRef0((const le_uint8*)records);
++      LEReferenceToArrayOf<GlyphRangeRecord> recordRef(recordRef0, success, (size_t)0, recordCount);
++      return getGlyphRangeIndex(glyphID, recordRef, success);
++    }
++    static le_int32 getGlyphRangeIndex(TTGlyphID glyphID, const LEReferenceToArrayOf<GlyphRangeRecord> &records, LEErrorCode &success);
+     static le_int32 search(le_uint16 value, const le_uint16 array[], le_int32 count);
+     static le_int32 search(le_uint32 value, const le_uint32 array[], le_int32 count);
+     static void sort(le_uint16 *array, le_int32 count);
+diff --git a/src/share/native/sun/font/layout/PairPositioningSubtables.cpp b/src/share/native/sun/font/layout/PairPositioningSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/PairPositioningSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/PairPositioningSubtables.cpp
+@@ -41,7 +41,7 @@
+ 
+ U_NAMESPACE_BEGIN
+ 
+-le_uint32 PairPositioningSubtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
++le_uint32 PairPositioningSubtable::process(const LEReferenceTo<PairPositioningSubtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const
+ {
+     switch(SWAPW(subtableFormat))
+     {
+@@ -50,27 +50,32 @@
+ 
+     case 1:
+     {
+-        const PairPositioningFormat1Subtable *subtable = (const PairPositioningFormat1Subtable *) this;
++      const LEReferenceTo<PairPositioningFormat1Subtable> subtable(base, success, (const PairPositioningFormat1Subtable *) this);
+ 
+-        return subtable->process(glyphIterator, fontInstance);
++      if(LE_SUCCESS(success))
++      return subtable->process(subtable, glyphIterator, fontInstance, success);
++      else
++        return 0;
+     }
+ 
+     case 2:
+     {
+-        const PairPositioningFormat2Subtable *subtable = (const PairPositioningFormat2Subtable *) this;
++      const LEReferenceTo<PairPositioningFormat2Subtable> subtable(base, success, (const PairPositioningFormat2Subtable *) this);
+ 
+-        return subtable->process(glyphIterator, fontInstance);
++      if(LE_SUCCESS(success))
++      return subtable->process(subtable, glyphIterator, fontInstance, success);
++      else
++        return 0;
+     }
+-
+     default:
+-        return 0;
++      return 0;
+     }
+ }
+ 
+-le_uint32 PairPositioningFormat1Subtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
++le_uint32 PairPositioningFormat1Subtable::process(const LEReferenceTo<PairPositioningFormat1Subtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const
+ {
+     LEGlyphID firstGlyph = glyphIterator->getCurrGlyphID();
+-    le_int32 coverageIndex = getGlyphCoverage(firstGlyph);
++    le_int32 coverageIndex = getGlyphCoverage(base, firstGlyph, success);
+     GlyphIterator tempIterator(*glyphIterator);
+ 
+     if (coverageIndex >= 0 && glyphIterator->next()) {
+@@ -110,10 +115,10 @@
+     return 0;
+ }
+ 
+-le_uint32 PairPositioningFormat2Subtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
++le_uint32 PairPositioningFormat2Subtable::process(const LEReferenceTo<PairPositioningFormat2Subtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const
+ {
+     LEGlyphID firstGlyph = glyphIterator->getCurrGlyphID();
+-    le_int32 coverageIndex = getGlyphCoverage(firstGlyph);
++    le_int32 coverageIndex = getGlyphCoverage(base, firstGlyph, success);
+     GlyphIterator tempIterator(*glyphIterator);
+ 
+     if (coverageIndex >= 0 && glyphIterator->next()) {
+diff --git a/src/share/native/sun/font/layout/PairPositioningSubtables.h b/src/share/native/sun/font/layout/PairPositioningSubtables.h
+--- jdk/src/share/native/sun/font/layout/PairPositioningSubtables.h
++++ jdk/src/share/native/sun/font/layout/PairPositioningSubtables.h
+@@ -59,13 +59,14 @@
+     le_uint16       pairValueCount;
+     PairValueRecord pairValueRecordArray[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(PairSetTable, pairValueRecordArray)
+ 
+ struct PairPositioningSubtable : GlyphPositioningSubtable
+ {
+     ValueFormat valueFormat1;
+     ValueFormat valueFormat2;
+ 
+-    le_uint32  process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
++    le_uint32  process(const LEReferenceTo<PairPositioningSubtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const;
+ };
+ 
+ struct PairPositioningFormat1Subtable : PairPositioningSubtable
+@@ -73,12 +74,13 @@
+     le_uint16   pairSetCount;
+     Offset      pairSetTableOffsetArray[ANY_NUMBER];
+ 
+-    le_uint32  process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
++    le_uint32  process(const LEReferenceTo<PairPositioningFormat1Subtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const;
+ 
+ private:
+     const PairValueRecord *findPairValueRecord(TTGlyphID glyphID, const PairValueRecord *records,
+         le_uint16 recordCount, le_uint16 recordSize) const;
+ };
++LE_VAR_ARRAY(PairPositioningFormat1Subtable, pairSetTableOffsetArray)
+ 
+ // NOTE: ValueRecord has a variable size
+ struct Class2Record
+@@ -91,6 +93,7 @@
+ {
+     Class2Record class2RecordArray[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(Class1Record, class2RecordArray)
+ 
+ struct PairPositioningFormat2Subtable : PairPositioningSubtable
+ {
+@@ -100,8 +103,9 @@
+     le_uint16    class2Count;
+     Class1Record class1RecordArray[ANY_NUMBER];
+ 
+-    le_uint32  process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
++    le_uint32  process(const LEReferenceTo<PairPositioningFormat2Subtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const;
+ };
++LE_VAR_ARRAY(PairPositioningFormat2Subtable, class1RecordArray)
+ 
+ U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/ScriptAndLanguage.cpp b/src/share/native/sun/font/layout/ScriptAndLanguage.cpp
+--- jdk/src/share/native/sun/font/layout/ScriptAndLanguage.cpp
++++ jdk/src/share/native/sun/font/layout/ScriptAndLanguage.cpp
+@@ -38,29 +38,33 @@
+ 
+ U_NAMESPACE_BEGIN
+ 
+-const LangSysTable *ScriptTable::findLanguage(LETag languageTag, le_bool exactMatch) const
++LEReferenceTo<LangSysTable> ScriptTable::findLanguage(const LETableReference& base, LETag languageTag, LEErrorCode &success, le_bool exactMatch) const
+ {
+     le_uint16 count = SWAPW(langSysCount);
+     Offset langSysTableOffset = exactMatch? 0 : SWAPW(defaultLangSysTableOffset);
+ 
+     if (count > 0) {
+-        Offset foundOffset =
+-            OpenTypeUtilities::getTagOffset(languageTag, langSysRecordArray, count);
++      LEReferenceToArrayOf<TagAndOffsetRecord> langSysRecords(base, success, langSysRecordArray, count);
++      Offset foundOffset =
++        OpenTypeUtilities::getTagOffset(languageTag, langSysRecords, success);
+ 
+-        if (foundOffset != 0) {
+-            langSysTableOffset = foundOffset;
+-        }
++      if (foundOffset != 0 && LE_SUCCESS(success)) {
++        langSysTableOffset = foundOffset;
++      }
+     }
+ 
+     if (langSysTableOffset != 0) {
+-        return (const LangSysTable *) ((char *)this + langSysTableOffset);
++      return LEReferenceTo<LangSysTable>(base, success, langSysTableOffset);
+     }
+ 
+-    return NULL;
++    return LEReferenceTo<LangSysTable>();
+ }
+ 
+-const ScriptTable *ScriptListTable::findScript(LETag scriptTag) const
++LEReferenceTo<ScriptTable> ScriptListTable::findScript(const LETableReference &base, LETag scriptTag, LEErrorCode &success) const
+ {
++    if (LE_FAILURE(success) ) {
++      return LEReferenceTo<ScriptTable>(); // get out
++    }
+     /*
+      * There are some fonts that have a large, bogus value for scriptCount. To try
+      * and protect against this, we use the offset in the first scriptRecord,
+@@ -74,38 +78,53 @@
+      * to be unsorted.
+      */
+     le_uint16 count = SWAPW(scriptCount);
++
++    if (count == 0) {
++      return LEReferenceTo<ScriptTable>(); // no items, no search
++    }
++
++    // attempt to construct a ref with at least one element
++    LEReferenceToArrayOf<ScriptRecord> oneElementTable(base, success, &scriptRecordArray[0], 1);
++
++    if( LE_FAILURE(success) ) {
++      return LEReferenceTo<ScriptTable>(); // couldn't even read the first record - bad font.
++    }
++
+     le_uint16 limit = ((SWAPW(scriptRecordArray[0].offset) - sizeof(ScriptListTable)) / sizeof(scriptRecordArray)) + ANY_NUMBER;
+     Offset scriptTableOffset = 0;
+ 
++
+     if (count > limit) {
+         // the scriptCount value is bogus; do a linear search
+         // because limit may still be too large.
+-        for(le_int32 s = 0; s < limit; s += 1) {
+-            if (SWAPT(scriptRecordArray[s].tag) == scriptTag) {
+-                scriptTableOffset = SWAPW(scriptRecordArray[s].offset);
+-                break;
+-            }
++        LEReferenceToArrayOf<ScriptRecord> scriptRecordArrayRef(base, success, &scriptRecordArray[0], limit);
++        for(le_int32 s = 0; (s < limit)&&LE_SUCCESS(success); s += 1) {
++          if (SWAPT(scriptRecordArrayRef(s,success).tag) == scriptTag) {
++            scriptTableOffset = SWAPW(scriptRecordArrayRef(s,success).offset);
++            break;
++          }
+         }
+     } else {
+-        scriptTableOffset = OpenTypeUtilities::getTagOffset(scriptTag, scriptRecordArray, count);
++      LEReferenceToArrayOf<ScriptRecord> scriptRecordArrayRef(base, success, &scriptRecordArray[0], count);
++      scriptTableOffset = OpenTypeUtilities::getTagOffset(scriptTag, scriptRecordArrayRef, success); // TODO
+     }
+ 
+     if (scriptTableOffset != 0) {
+-        return (const ScriptTable *) ((char *)this + scriptTableOffset);
++      return LEReferenceTo<ScriptTable>(base, success, scriptTableOffset);
+     }
+ 
+-    return NULL;
++  return LEReferenceTo<ScriptTable>();
+ }
+ 
+-const LangSysTable *ScriptListTable::findLanguage(LETag scriptTag, LETag languageTag, le_bool exactMatch) const
++LEReferenceTo<LangSysTable>  ScriptListTable::findLanguage(const LETableReference &base, LETag scriptTag, LETag languageTag, LEErrorCode &success, le_bool exactMatch) const
+ {
+-    const ScriptTable *scriptTable = findScript(scriptTag);
++  const LEReferenceTo<ScriptTable> scriptTable = findScript(base, scriptTag, success);
+ 
+-    if (scriptTable == 0) {
+-        return NULL;
+-    }
++  if (scriptTable.isEmpty()) {
++    return LEReferenceTo<LangSysTable>();
++  }
+ 
+-    return scriptTable->findLanguage(languageTag, exactMatch);
++  return scriptTable->findLanguage(scriptTable, languageTag, success, exactMatch).reparent(base);
+ }
+ 
+ U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/ScriptAndLanguage.h b/src/share/native/sun/font/layout/ScriptAndLanguage.h
+--- jdk/src/share/native/sun/font/layout/ScriptAndLanguage.h
++++ jdk/src/share/native/sun/font/layout/ScriptAndLanguage.h
+@@ -51,6 +51,7 @@
+     le_uint16 featureCount;
+     le_uint16 featureIndexArray[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(LangSysTable, featureIndexArray)
+ 
+ struct ScriptTable
+ {
+@@ -58,8 +59,9 @@
+     le_uint16           langSysCount;
+     LangSysRecord       langSysRecordArray[ANY_NUMBER];
+ 
+-    const LangSysTable  *findLanguage(LETag languageTag, le_bool exactMatch = FALSE) const;
++  LEReferenceTo<LangSysTable>  findLanguage(const LETableReference &base, LETag languageTag, LEErrorCode &success, le_bool exactMatch = FALSE) const;
+ };
++LE_VAR_ARRAY(ScriptTable, langSysRecordArray)
+ 
+ typedef TagAndOffsetRecord ScriptRecord;
+ 
+@@ -68,9 +70,10 @@
+     le_uint16           scriptCount;
+     ScriptRecord        scriptRecordArray[ANY_NUMBER];
+ 
+-    const ScriptTable   *findScript(LETag scriptTag) const;
+-    const LangSysTable  *findLanguage(LETag scriptTag, LETag languageTag, le_bool exactMatch = FALSE) const;
++  LEReferenceTo<ScriptTable>   findScript(const LETableReference &base, LETag scriptTag, LEErrorCode &success) const;
++  LEReferenceTo<LangSysTable>  findLanguage(const LETableReference &base, LETag scriptTag, LETag languageTag, LEErrorCode &success, le_bool exactMatch = FALSE) const;
+ };
++LE_VAR_ARRAY(ScriptListTable, scriptRecordArray)
+ 
+ U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp b/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp
+--- jdk/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp
++++ jdk/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp
+@@ -46,19 +46,18 @@
+ {
+ }
+ 
+-SegmentArrayProcessor::SegmentArrayProcessor(const MorphSubtableHeader *morphSubtableHeader)
+-  : NonContextualGlyphSubstitutionProcessor(morphSubtableHeader)
++SegmentArrayProcessor::SegmentArrayProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success)
++  : NonContextualGlyphSubstitutionProcessor(morphSubtableHeader, success)
+ {
+-    const NonContextualGlyphSubstitutionHeader *header = (const NonContextualGlyphSubstitutionHeader *) morphSubtableHeader;
+-
+-    segmentArrayLookupTable = (const SegmentArrayLookupTable *) &header->table;
++  LEReferenceTo<NonContextualGlyphSubstitutionHeader> header(morphSubtableHeader, success);
++  segmentArrayLookupTable = LEReferenceTo<SegmentArrayLookupTable>(morphSubtableHeader, success, (const SegmentArrayLookupTable*)&header->table);
+ }
+ 
+ SegmentArrayProcessor::~SegmentArrayProcessor()
+ {
+ }
+ 
+-void SegmentArrayProcessor::process(LEGlyphStorage &glyphStorage)
++void SegmentArrayProcessor::process(LEGlyphStorage &glyphStorage, LEErrorCode &success)
+ {
+     const LookupSegment *segments = segmentArrayLookupTable->segments;
+     le_int32 glyphCount = glyphStorage.getGlyphCount();
+@@ -66,17 +65,16 @@
+ 
+     for (glyph = 0; glyph < glyphCount; glyph += 1) {
+         LEGlyphID thisGlyph = glyphStorage[glyph];
+-        const LookupSegment *lookupSegment = segmentArrayLookupTable->lookupSegment(segments, thisGlyph);
++        const LookupSegment *lookupSegment = segmentArrayLookupTable->lookupSegment(segmentArrayLookupTable, segments, thisGlyph, success);
+ 
+         if (lookupSegment != NULL)  {
+             TTGlyphID firstGlyph = SWAPW(lookupSegment->firstGlyph);
+             le_int16  offset = SWAPW(lookupSegment->value);
+ 
+             if (offset != 0) {
+-                TTGlyphID  *glyphArray = (TTGlyphID *) ((char *) subtableHeader + offset);
+-                TTGlyphID   newGlyph   = SWAPW(glyphArray[LE_GET_GLYPH(thisGlyph) - firstGlyph]);
+-
+-                glyphStorage[glyph] = LE_SET_GLYPH(thisGlyph, newGlyph);
++              LEReferenceToArrayOf<TTGlyphID> glyphArray(subtableHeader, success, offset, LE_UNBOUNDED_ARRAY);
++              TTGlyphID   newGlyph   = SWAPW(glyphArray(LE_GET_GLYPH(thisGlyph) - firstGlyph, success));
++              glyphStorage[glyph] = LE_SET_GLYPH(thisGlyph, newGlyph);
+             }
+         }
+     }
+diff --git a/src/share/native/sun/font/layout/SegmentArrayProcessor.h b/src/share/native/sun/font/layout/SegmentArrayProcessor.h
+--- jdk/src/share/native/sun/font/layout/SegmentArrayProcessor.h
++++ jdk/src/share/native/sun/font/layout/SegmentArrayProcessor.h
+@@ -50,9 +50,9 @@
+ class SegmentArrayProcessor : public NonContextualGlyphSubstitutionProcessor
+ {
+ public:
+-    virtual void process(LEGlyphStorage &glyphStorage);
++    virtual void process(LEGlyphStorage &glyphStorage, LEErrorCode &success);
+ 
+-    SegmentArrayProcessor(const MorphSubtableHeader *morphSubtableHeader);
++    SegmentArrayProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success);
+ 
+     virtual ~SegmentArrayProcessor();
+ 
+@@ -74,7 +74,7 @@
+     SegmentArrayProcessor();
+ 
+ protected:
+-    const SegmentArrayLookupTable *segmentArrayLookupTable;
++    LEReferenceTo<SegmentArrayLookupTable> segmentArrayLookupTable;
+ 
+ };
+ 
+diff --git a/src/share/native/sun/font/layout/SegmentSingleProcessor.cpp b/src/share/native/sun/font/layout/SegmentSingleProcessor.cpp
+--- jdk/src/share/native/sun/font/layout/SegmentSingleProcessor.cpp
++++ jdk/src/share/native/sun/font/layout/SegmentSingleProcessor.cpp
+@@ -46,29 +46,28 @@
+ {
+ }
+ 
+-SegmentSingleProcessor::SegmentSingleProcessor(const MorphSubtableHeader *morphSubtableHeader)
+-  : NonContextualGlyphSubstitutionProcessor(morphSubtableHeader)
++SegmentSingleProcessor::SegmentSingleProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success)
++  : NonContextualGlyphSubstitutionProcessor(morphSubtableHeader, success)
+ {
+-    const NonContextualGlyphSubstitutionHeader *header = (const NonContextualGlyphSubstitutionHeader *) morphSubtableHeader;
+-
+-    segmentSingleLookupTable = (const SegmentSingleLookupTable *) &header->table;
++  LEReferenceTo<NonContextualGlyphSubstitutionHeader> header(morphSubtableHeader, success);
++  segmentSingleLookupTable = LEReferenceTo<SegmentSingleLookupTable>(morphSubtableHeader, success, (const SegmentSingleLookupTable*)&header->table);
+ }
+ 
+ SegmentSingleProcessor::~SegmentSingleProcessor()
+ {
+ }
+ 
+-void SegmentSingleProcessor::process(LEGlyphStorage &glyphStorage)
++void SegmentSingleProcessor::process(LEGlyphStorage &glyphStorage, LEErrorCode &success)
+ {
+     const LookupSegment *segments = segmentSingleLookupTable->segments;
+     le_int32 glyphCount = glyphStorage.getGlyphCount();
+     le_int32 glyph;
+ 
+-    for (glyph = 0; glyph < glyphCount; glyph += 1) {
++    for (glyph = 0; glyph < glyphCount && LE_SUCCESS(success); glyph += 1) {
+         LEGlyphID thisGlyph = glyphStorage[glyph];
+-        const LookupSegment *lookupSegment = segmentSingleLookupTable->lookupSegment(segments, thisGlyph);
++        const LookupSegment *lookupSegment = segmentSingleLookupTable->lookupSegment(segmentSingleLookupTable, segments, thisGlyph, success);
+ 
+-        if (lookupSegment != NULL) {
++        if (lookupSegment != NULL && LE_SUCCESS(success)) {
+             TTGlyphID   newGlyph  = (TTGlyphID) LE_GET_GLYPH(thisGlyph) + SWAPW(lookupSegment->value);
+ 
+             glyphStorage[glyph] = LE_SET_GLYPH(thisGlyph, newGlyph);
+diff --git a/src/share/native/sun/font/layout/SegmentSingleProcessor.h b/src/share/native/sun/font/layout/SegmentSingleProcessor.h
+--- jdk/src/share/native/sun/font/layout/SegmentSingleProcessor.h
++++ jdk/src/share/native/sun/font/layout/SegmentSingleProcessor.h
+@@ -50,9 +50,9 @@
+ class SegmentSingleProcessor : public NonContextualGlyphSubstitutionProcessor
+ {
+ public:
+-    virtual void process(LEGlyphStorage &glyphStorage);
++    virtual void process(LEGlyphStorage &glyphStorage, LEErrorCode &success);
+ 
+-    SegmentSingleProcessor(const MorphSubtableHeader *morphSubtableHeader);
++    SegmentSingleProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success);
+ 
+     virtual ~SegmentSingleProcessor();
+ 
+@@ -74,7 +74,7 @@
+     SegmentSingleProcessor();
+ 
+ protected:
+-    const SegmentSingleLookupTable *segmentSingleLookupTable;
++    LEReferenceTo<SegmentSingleLookupTable> segmentSingleLookupTable;
+ 
+ };
+ 
+diff --git a/src/share/native/sun/font/layout/ShapingTypeData.cpp b/src/share/native/sun/font/layout/ShapingTypeData.cpp
+--- jdk/src/share/native/sun/font/layout/ShapingTypeData.cpp
++++ jdk/src/share/native/sun/font/layout/ShapingTypeData.cpp
+@@ -122,4 +122,6 @@
+     0x00, 0x05, 0xFE, 0xFF, 0xFE, 0xFF, 0x00, 0x05, 0xFF, 0xF9, 0xFF, 0xFB, 0x00, 0x05
+ };
+ 
++const size_t ArabicShaping::shapingTypeTableLen = sizeof(shapingTypeTable)/sizeof(shapingTypeTable[0]);
++
+ U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/SimpleArrayProcessor.cpp b/src/share/native/sun/font/layout/SimpleArrayProcessor.cpp
+--- jdk/src/share/native/sun/font/layout/SimpleArrayProcessor.cpp
++++ jdk/src/share/native/sun/font/layout/SimpleArrayProcessor.cpp
+@@ -46,29 +46,29 @@
+ {
+ }
+ 
+-SimpleArrayProcessor::SimpleArrayProcessor(const MorphSubtableHeader *morphSubtableHeader)
+-  : NonContextualGlyphSubstitutionProcessor(morphSubtableHeader)
++SimpleArrayProcessor::SimpleArrayProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success)
++  : NonContextualGlyphSubstitutionProcessor(morphSubtableHeader, success)
+ {
+-    const NonContextualGlyphSubstitutionHeader *header = (const NonContextualGlyphSubstitutionHeader *) morphSubtableHeader;
+-
+-    simpleArrayLookupTable = (const SimpleArrayLookupTable *) &header->table;
++  LEReferenceTo<NonContextualGlyphSubstitutionHeader> header(morphSubtableHeader, success);
++  simpleArrayLookupTable = LEReferenceTo<SimpleArrayLookupTable>(morphSubtableHeader, success, (const SimpleArrayLookupTable*)&header->table);
+ }
+ 
+ SimpleArrayProcessor::~SimpleArrayProcessor()
+ {
+ }
+ 
+-void SimpleArrayProcessor::process(LEGlyphStorage &glyphStorage)
++void SimpleArrayProcessor::process(LEGlyphStorage &glyphStorage, LEErrorCode &success)
+ {
+     le_int32 glyphCount = glyphStorage.getGlyphCount();
+     le_int32 glyph;
+ 
+-    for (glyph = 0; glyph < glyphCount; glyph += 1) {
++    LEReferenceToArrayOf<LookupValue> valueArray(simpleArrayLookupTable, success, (const LookupValue*)&simpleArrayLookupTable->valueArray, LE_UNBOUNDED_ARRAY);
++
++    for (glyph = 0; LE_SUCCESS(success) && (glyph < glyphCount); glyph += 1) {
+         LEGlyphID thisGlyph = glyphStorage[glyph];
+         if (LE_GET_GLYPH(thisGlyph) < 0xFFFF) {
+-            TTGlyphID newGlyph = SWAPW(simpleArrayLookupTable->valueArray[LE_GET_GLYPH(thisGlyph)]);
+-
+-            glyphStorage[glyph] = LE_SET_GLYPH(thisGlyph, newGlyph);
++          TTGlyphID newGlyph = SWAPW(valueArray.getObject(LE_GET_GLYPH(thisGlyph),success));
++          glyphStorage[glyph] = LE_SET_GLYPH(thisGlyph, newGlyph);
+         }
+     }
+ }
+diff --git a/src/share/native/sun/font/layout/SimpleArrayProcessor.h b/src/share/native/sun/font/layout/SimpleArrayProcessor.h
+--- jdk/src/share/native/sun/font/layout/SimpleArrayProcessor.h
++++ jdk/src/share/native/sun/font/layout/SimpleArrayProcessor.h
+@@ -50,9 +50,9 @@
+ class SimpleArrayProcessor : public NonContextualGlyphSubstitutionProcessor
+ {
+ public:
+-    virtual void process(LEGlyphStorage &glyphStorage);
++    virtual void process(LEGlyphStorage &glyphStorage, LEErrorCode &success);
+ 
+-    SimpleArrayProcessor(const MorphSubtableHeader *morphSubtableHeader);
++    SimpleArrayProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success);
+ 
+     virtual ~SimpleArrayProcessor();
+ 
+@@ -74,7 +74,7 @@
+     SimpleArrayProcessor();
+ 
+ protected:
+-    const SimpleArrayLookupTable *simpleArrayLookupTable;
++    LEReferenceTo<SimpleArrayLookupTable> simpleArrayLookupTable;
+ 
+ };
+ 
+diff --git a/src/share/native/sun/font/layout/SinglePositioningSubtables.cpp b/src/share/native/sun/font/layout/SinglePositioningSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/SinglePositioningSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/SinglePositioningSubtables.cpp
+@@ -40,7 +40,7 @@
+ 
+ U_NAMESPACE_BEGIN
+ 
+-le_uint32 SinglePositioningSubtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
++le_uint32 SinglePositioningSubtable::process(const LEReferenceTo<SinglePositioningSubtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const
+ {
+     switch(SWAPW(subtableFormat))
+     {
+@@ -49,16 +49,16 @@
+ 
+     case 1:
+     {
+-        const SinglePositioningFormat1Subtable *subtable = (const SinglePositioningFormat1Subtable *) this;
++      const LEReferenceTo<SinglePositioningFormat1Subtable> subtable(base, success, (const SinglePositioningFormat1Subtable *) this);
+ 
+-        return subtable->process(glyphIterator, fontInstance);
++      return subtable->process(subtable, glyphIterator, fontInstance, success);
+     }
+ 
+     case 2:
+     {
+-        const SinglePositioningFormat2Subtable *subtable = (const SinglePositioningFormat2Subtable *) this;
++      const LEReferenceTo<SinglePositioningFormat2Subtable> subtable(base, success, (const SinglePositioningFormat2Subtable *) this);
+ 
+-        return subtable->process(glyphIterator, fontInstance);
++      return subtable->process(subtable, glyphIterator, fontInstance, success);
+     }
+ 
+     default:
+@@ -66,10 +66,10 @@
+     }
+ }
+ 
+-le_uint32 SinglePositioningFormat1Subtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
++le_uint32 SinglePositioningFormat1Subtable::process(const LEReferenceTo<SinglePositioningFormat1Subtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const
+ {
+     LEGlyphID glyph = glyphIterator->getCurrGlyphID();
+-    le_int32 coverageIndex = getGlyphCoverage(glyph);
++    le_int32 coverageIndex = getGlyphCoverage(base, glyph, success);
+ 
+     if (coverageIndex >= 0) {
+         valueRecord.adjustPosition(SWAPW(valueFormat), (const char *) this, *glyphIterator, fontInstance);
+@@ -80,10 +80,10 @@
+     return 0;
+ }
+ 
+-le_uint32 SinglePositioningFormat2Subtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
++le_uint32 SinglePositioningFormat2Subtable::process(const LEReferenceTo<SinglePositioningFormat2Subtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const
+ {
+     LEGlyphID glyph = glyphIterator->getCurrGlyphID();
+-    le_int16 coverageIndex = (le_int16) getGlyphCoverage(glyph);
++    le_int16 coverageIndex = (le_int16) getGlyphCoverage(base, glyph, success);
+ 
+     if (coverageIndex >= 0) {
+         valueRecordArray[0].adjustPosition(coverageIndex, SWAPW(valueFormat), (const char *) this, *glyphIterator, fontInstance);
+diff --git a/src/share/native/sun/font/layout/SinglePositioningSubtables.h b/src/share/native/sun/font/layout/SinglePositioningSubtables.h
+--- jdk/src/share/native/sun/font/layout/SinglePositioningSubtables.h
++++ jdk/src/share/native/sun/font/layout/SinglePositioningSubtables.h
+@@ -48,7 +48,7 @@
+ 
+ struct SinglePositioningSubtable : GlyphPositioningSubtable
+ {
+-    le_uint32  process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
++    le_uint32  process(const LEReferenceTo<SinglePositioningSubtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const;
+ };
+ 
+ struct SinglePositioningFormat1Subtable : SinglePositioningSubtable
+@@ -56,7 +56,7 @@
+     ValueFormat valueFormat;
+     ValueRecord valueRecord;
+ 
+-    le_uint32  process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
++    le_uint32  process(const LEReferenceTo<SinglePositioningFormat1Subtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const;
+ };
+ 
+ struct SinglePositioningFormat2Subtable : SinglePositioningSubtable
+@@ -65,8 +65,9 @@
+     le_uint16   valueCount;
+     ValueRecord valueRecordArray[ANY_NUMBER];
+ 
+-    le_uint32  process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const;
++    le_uint32  process(const LEReferenceTo<SinglePositioningFormat2Subtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const;
+ };
++LE_VAR_ARRAY(SinglePositioningFormat2Subtable, valueRecordArray)
+ 
+ U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/SingleSubstitutionSubtables.cpp b/src/share/native/sun/font/layout/SingleSubstitutionSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/SingleSubstitutionSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/SingleSubstitutionSubtables.cpp
+@@ -39,7 +39,7 @@
+ 
+ U_NAMESPACE_BEGIN
+ 
+-le_uint32 SingleSubstitutionSubtable::process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const
++le_uint32 SingleSubstitutionSubtable::process(const LEReferenceTo<SingleSubstitutionSubtable> &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter) const
+ {
+     switch(SWAPW(subtableFormat))
+     {
+@@ -48,16 +48,16 @@
+ 
+     case 1:
+     {
+-        const SingleSubstitutionFormat1Subtable *subtable = (const SingleSubstitutionFormat1Subtable *) this;
++      const LEReferenceTo<SingleSubstitutionFormat1Subtable> subtable(base, success, (const SingleSubstitutionFormat1Subtable *) this);
+ 
+-        return subtable->process(glyphIterator, filter);
++      return subtable->process(subtable, glyphIterator, success, filter);
+     }
+ 
+     case 2:
+     {
+-        const SingleSubstitutionFormat2Subtable *subtable = (const SingleSubstitutionFormat2Subtable *) this;
++      const LEReferenceTo<SingleSubstitutionFormat2Subtable> subtable(base, success, (const SingleSubstitutionFormat2Subtable *) this);
+ 
+-        return subtable->process(glyphIterator, filter);
++      return subtable->process(subtable, glyphIterator, success, filter);
+     }
+ 
+     default:
+@@ -65,10 +65,10 @@
+     }
+ }
+ 
+-le_uint32 SingleSubstitutionFormat1Subtable::process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const
++le_uint32 SingleSubstitutionFormat1Subtable::process(const LEReferenceTo<SingleSubstitutionFormat1Subtable> &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter) const
+ {
+     LEGlyphID glyph = glyphIterator->getCurrGlyphID();
+-    le_int32 coverageIndex = getGlyphCoverage(glyph);
++    le_int32 coverageIndex = getGlyphCoverage(base, glyph, success);
+ 
+     if (coverageIndex >= 0) {
+         TTGlyphID substitute = ((TTGlyphID) LE_GET_GLYPH(glyph)) + SWAPW(deltaGlyphID);
+@@ -83,10 +83,10 @@
+     return 0;
+ }
+ 
+-le_uint32 SingleSubstitutionFormat2Subtable::process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const
++le_uint32 SingleSubstitutionFormat2Subtable::process(const LEReferenceTo<SingleSubstitutionFormat2Subtable> &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter) const
+ {
+     LEGlyphID glyph = glyphIterator->getCurrGlyphID();
+-    le_int32 coverageIndex = getGlyphCoverage(glyph);
++    le_int32 coverageIndex = getGlyphCoverage(base, glyph, success);
+ 
+     if (coverageIndex >= 0) {
+         TTGlyphID substitute = SWAPW(substituteArray[coverageIndex]);
+diff --git a/src/share/native/sun/font/layout/SingleSubstitutionSubtables.h b/src/share/native/sun/font/layout/SingleSubstitutionSubtables.h
+--- jdk/src/share/native/sun/font/layout/SingleSubstitutionSubtables.h
++++ jdk/src/share/native/sun/font/layout/SingleSubstitutionSubtables.h
+@@ -47,14 +47,14 @@
+ 
+ struct SingleSubstitutionSubtable : GlyphSubstitutionSubtable
+ {
+-    le_uint32  process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter = NULL) const;
++    le_uint32  process(const LEReferenceTo<SingleSubstitutionSubtable> &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter = NULL) const;
+ };
+ 
+ struct SingleSubstitutionFormat1Subtable : SingleSubstitutionSubtable
+ {
+     le_int16   deltaGlyphID;
+ 
+-    le_uint32  process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter = NULL) const;
++    le_uint32  process(const LEReferenceTo<SingleSubstitutionFormat1Subtable> &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter = NULL) const;
+ };
+ 
+ struct SingleSubstitutionFormat2Subtable : SingleSubstitutionSubtable
+@@ -62,8 +62,9 @@
+     le_uint16  glyphCount;
+     TTGlyphID  substituteArray[ANY_NUMBER];
+ 
+-    le_uint32  process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter = NULL) const;
++    le_uint32  process(const LEReferenceTo<SingleSubstitutionFormat2Subtable> &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter = NULL) const;
+ };
++LE_VAR_ARRAY(SingleSubstitutionFormat2Subtable, substituteArray)
+ 
+ U_NAMESPACE_END
+ #endif
+diff --git a/src/share/native/sun/font/layout/SingleTableProcessor.cpp b/src/share/native/sun/font/layout/SingleTableProcessor.cpp
+--- jdk/src/share/native/sun/font/layout/SingleTableProcessor.cpp
++++ jdk/src/share/native/sun/font/layout/SingleTableProcessor.cpp
+@@ -46,26 +46,25 @@
+ {
+ }
+ 
+-SingleTableProcessor::SingleTableProcessor(const MorphSubtableHeader *moprhSubtableHeader)
+-  : NonContextualGlyphSubstitutionProcessor(moprhSubtableHeader)
++SingleTableProcessor::SingleTableProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success)
++  : NonContextualGlyphSubstitutionProcessor(morphSubtableHeader, success)
+ {
+-    const NonContextualGlyphSubstitutionHeader *header = (const NonContextualGlyphSubstitutionHeader *) moprhSubtableHeader;
+-
+-    singleTableLookupTable = (const SingleTableLookupTable *) &header->table;
++  LEReferenceTo<NonContextualGlyphSubstitutionHeader> header(morphSubtableHeader, success);
++  singleTableLookupTable = LEReferenceTo<SingleTableLookupTable>(morphSubtableHeader, success, (const SingleTableLookupTable*)&header->table);
+ }
+ 
+ SingleTableProcessor::~SingleTableProcessor()
+ {
+ }
+ 
+-void SingleTableProcessor::process(LEGlyphStorage &glyphStorage)
++void SingleTableProcessor::process(LEGlyphStorage &glyphStorage, LEErrorCode &success)
+ {
+     const LookupSingle *entries = singleTableLookupTable->entries;
+     le_int32 glyph;
+     le_int32 glyphCount = glyphStorage.getGlyphCount();
+ 
+     for (glyph = 0; glyph < glyphCount; glyph += 1) {
+-        const LookupSingle *lookupSingle = singleTableLookupTable->lookupSingle(entries, glyphStorage[glyph]);
++      const LookupSingle *lookupSingle = singleTableLookupTable->lookupSingle(singleTableLookupTable, entries, glyphStorage[glyph], success);
+ 
+         if (lookupSingle != NULL) {
+             glyphStorage[glyph] = SWAPW(lookupSingle->value);
+diff --git a/src/share/native/sun/font/layout/SingleTableProcessor.h b/src/share/native/sun/font/layout/SingleTableProcessor.h
+--- jdk/src/share/native/sun/font/layout/SingleTableProcessor.h
++++ jdk/src/share/native/sun/font/layout/SingleTableProcessor.h
+@@ -50,9 +50,9 @@
+ class SingleTableProcessor : public NonContextualGlyphSubstitutionProcessor
+ {
+ public:
+-    virtual void process(LEGlyphStorage &glyphStorage);
++    virtual void process(LEGlyphStorage &glyphStorage, LEErrorCode &success);
+ 
+-    SingleTableProcessor(const MorphSubtableHeader *morphSubtableHeader);
++    SingleTableProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success);
+ 
+     virtual ~SingleTableProcessor();
+ 
+@@ -74,7 +74,7 @@
+     SingleTableProcessor();
+ 
+ protected:
+-    const SingleTableLookupTable *singleTableLookupTable;
++    LEReferenceTo<SingleTableLookupTable> singleTableLookupTable;
+ 
+ };
+ 
+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
+@@ -44,17 +44,18 @@
+ {
+ }
+ 
+-StateTableProcessor::StateTableProcessor(const MorphSubtableHeader *morphSubtableHeader)
+-  : SubtableProcessor(morphSubtableHeader)
++StateTableProcessor::StateTableProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success)
++  : SubtableProcessor(morphSubtableHeader, success), stateTableHeader(morphSubtableHeader, success),
++    stHeader(stateTableHeader, success, (const StateTableHeader*)&stateTableHeader->stHeader)
+ {
+-    stateTableHeader = (const MorphStateTableHeader *) morphSubtableHeader;
+-
++  if(LE_FAILURE(success)) return;
+     stateSize = SWAPW(stateTableHeader->stHeader.stateSize);
+     classTableOffset = SWAPW(stateTableHeader->stHeader.classTableOffset);
+     stateArrayOffset = SWAPW(stateTableHeader->stHeader.stateArrayOffset);
+     entryTableOffset = SWAPW(stateTableHeader->stHeader.entryTableOffset);
+ 
+-    classTable = (const ClassTable *) ((char *) &stateTableHeader->stHeader + classTableOffset);
++    classTable = LEReferenceTo<ClassTable>(stateTableHeader, success, ((char *) &stateTableHeader->stHeader + classTableOffset));
++  if(LE_FAILURE(success)) return;
+     firstGlyph = SWAPW(classTable->firstGlyph);
+     lastGlyph  = firstGlyph + SWAPW(classTable->nGlyphs);
+ }
+@@ -63,9 +64,9 @@
+ {
+ }
+ 
+-void StateTableProcessor::process(LEGlyphStorage &glyphStorage)
++void StateTableProcessor::process(LEGlyphStorage &glyphStorage, LEErrorCode &success)
+ {
+-
++    if (LE_FAILURE(success)) return;
+     LE_STATE_PATIENCE_INIT();
+ 
+     // Start at state 0
+@@ -94,8 +95,8 @@
+             }
+         }
+ 
+-        const EntryTableIndex *stateArray = (const EntryTableIndex *) ((char *) &stateTableHeader->stHeader + currentState);
+-        EntryTableIndex entryTableIndex = stateArray[(le_uint8)classCode];
++        LEReferenceToArrayOf<EntryTableIndex> stateArray(stHeader, success, currentState, LE_UNBOUNDED_ARRAY);
++        EntryTableIndex entryTableIndex = stateArray.getObject((le_uint8)classCode, success);
+         LE_STATE_PATIENCE_CURR(le_int32, currGlyph);
+         currentState = processStateEntry(glyphStorage, currGlyph, entryTableIndex);
+         LE_STATE_PATIENCE_INCR(currGlyph);
+diff --git a/src/share/native/sun/font/layout/StateTableProcessor.h b/src/share/native/sun/font/layout/StateTableProcessor.h
+--- jdk/src/share/native/sun/font/layout/StateTableProcessor.h
++++ jdk/src/share/native/sun/font/layout/StateTableProcessor.h
+@@ -49,7 +49,7 @@
+ class StateTableProcessor : public SubtableProcessor
+ {
+ public:
+-    void process(LEGlyphStorage &glyphStorage);
++    void process(LEGlyphStorage &glyphStorage, LEErrorCode &success);
+ 
+     virtual void beginStateTable() = 0;
+ 
+@@ -58,7 +58,7 @@
+     virtual void endStateTable() = 0;
+ 
+ protected:
+-    StateTableProcessor(const MorphSubtableHeader *morphSubtableHeader);
++    StateTableProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success);
+     virtual ~StateTableProcessor();
+ 
+     StateTableProcessor();
+@@ -68,11 +68,12 @@
+     ByteOffset stateArrayOffset;
+     ByteOffset entryTableOffset;
+ 
+-    const ClassTable *classTable;
++    LEReferenceTo<ClassTable> classTable;
+     TTGlyphID firstGlyph;
+     TTGlyphID lastGlyph;
+ 
+-    const MorphStateTableHeader *stateTableHeader;
++    LEReferenceTo<MorphStateTableHeader> stateTableHeader;
++    LEReferenceTo<StateTableHeader> stHeader; // for convenience
+ 
+ private:
+     StateTableProcessor(const StateTableProcessor &other); // forbid copying of this class
+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
+@@ -103,6 +103,7 @@
+     le_uint16 nGlyphs;
+     ClassCode classArray[ANY_NUMBER];
+ };
++LE_VAR_ARRAY(ClassTable, classArray)
+ 
+ enum StateNumber
+ {
+diff --git a/src/share/native/sun/font/layout/SubtableProcessor.cpp b/src/share/native/sun/font/layout/SubtableProcessor.cpp
+--- jdk/src/share/native/sun/font/layout/SubtableProcessor.cpp
++++ jdk/src/share/native/sun/font/layout/SubtableProcessor.cpp
+@@ -40,10 +40,10 @@
+ {
+ }
+ 
+-SubtableProcessor::SubtableProcessor(const MorphSubtableHeader *morphSubtableHeader)
++SubtableProcessor::SubtableProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success)
++  : length(0), coverage(0), subtableFeatures(0L), subtableHeader(morphSubtableHeader)
+ {
+-    subtableHeader = morphSubtableHeader;
+-
++  if(LE_FAILURE(success)) return;
+     length = SWAPW(subtableHeader->length);
+     coverage = SWAPW(subtableHeader->coverage);
+     subtableFeatures = SWAPL(subtableHeader->subtableFeatures);
+diff --git a/src/share/native/sun/font/layout/SubtableProcessor.h b/src/share/native/sun/font/layout/SubtableProcessor.h
+--- jdk/src/share/native/sun/font/layout/SubtableProcessor.h
++++ jdk/src/share/native/sun/font/layout/SubtableProcessor.h
+@@ -46,11 +46,11 @@
+ 
+ class SubtableProcessor : public UMemory {
+ public:
+-    virtual void process(LEGlyphStorage &glyphStorage) = 0;
++    virtual void process(LEGlyphStorage &glyphStorage, LEErrorCode &success) = 0;
+     virtual ~SubtableProcessor();
+ 
+ protected:
+-    SubtableProcessor(const MorphSubtableHeader *morphSubtableHeader);
++    SubtableProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success);
+ 
+     SubtableProcessor();
+ 
+@@ -58,7 +58,7 @@
+     SubtableCoverage coverage;
+     FeatureFlags subtableFeatures;
+ 
+-    const MorphSubtableHeader *subtableHeader;
++    const LEReferenceTo<MorphSubtableHeader> subtableHeader;
+ 
+ private:
+ 
+diff --git a/src/share/native/sun/font/layout/ThaiLayoutEngine.cpp b/src/share/native/sun/font/layout/ThaiLayoutEngine.cpp
+--- jdk/src/share/native/sun/font/layout/ThaiLayoutEngine.cpp
++++ jdk/src/share/native/sun/font/layout/ThaiLayoutEngine.cpp
+@@ -134,11 +134,10 @@
+         return;
+     }
+ 
+-    if (fTypoFlags & 0x1) { /* kerning enabled */
+-      static const le_uint32 kernTableTag = LE_KERN_TABLE_TAG;
+-
+-      KernTable kt(fFontInstance, getFontTable(kernTableTag));
+-      kt.process(glyphStorage);
++    if (fTypoFlags & LE_Kerning_FEATURE_FLAG) { /* kerning enabled */
++      LETableReference kernTable(fFontInstance, LE_KERN_TABLE_TAG, success);
++      KernTable kt(kernTable, success);
++      kt.process(glyphStorage, success);
+     }
+ 
+     // default is no adjustments
+diff --git a/src/share/native/sun/font/layout/TibetanLayoutEngine.cpp b/src/share/native/sun/font/layout/TibetanLayoutEngine.cpp
+--- jdk/src/share/native/sun/font/layout/TibetanLayoutEngine.cpp
++++ jdk/src/share/native/sun/font/layout/TibetanLayoutEngine.cpp
+@@ -49,7 +49,7 @@
+ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(TibetanOpenTypeLayoutEngine)
+ 
+ TibetanOpenTypeLayoutEngine::TibetanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                    le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success)
++                                                         le_int32 typoFlags, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, LEErrorCode &success)
+     : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success)
+ {
+     fFeatureMap   = TibetanReordering::getFeatureMap(fFeatureMapCount);
+diff --git a/src/share/native/sun/font/layout/TibetanLayoutEngine.h b/src/share/native/sun/font/layout/TibetanLayoutEngine.h
+--- jdk/src/share/native/sun/font/layout/TibetanLayoutEngine.h
++++ jdk/src/share/native/sun/font/layout/TibetanLayoutEngine.h
+@@ -83,7 +83,7 @@
+      * @internal
+      */
+     TibetanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
+-                            le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success);
++                            le_int32 typoFlags, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, LEErrorCode &success);
+ 
+     /**
+      * This constructor is used when the font requires a "canned" GSUB table which can't be known
+diff --git a/src/share/native/sun/font/layout/TrimmedArrayProcessor.cpp b/src/share/native/sun/font/layout/TrimmedArrayProcessor.cpp
+--- jdk/src/share/native/sun/font/layout/TrimmedArrayProcessor.cpp
++++ jdk/src/share/native/sun/font/layout/TrimmedArrayProcessor.cpp
+@@ -46,22 +46,28 @@
+ {
+ }
+ 
+-TrimmedArrayProcessor::TrimmedArrayProcessor(const MorphSubtableHeader *morphSubtableHeader)
+-  : NonContextualGlyphSubstitutionProcessor(morphSubtableHeader)
++TrimmedArrayProcessor::TrimmedArrayProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success)
++  : NonContextualGlyphSubstitutionProcessor(morphSubtableHeader, success), firstGlyph(0), lastGlyph(0)
+ {
+-    const NonContextualGlyphSubstitutionHeader *header = (const NonContextualGlyphSubstitutionHeader *) morphSubtableHeader;
++  LEReferenceTo<NonContextualGlyphSubstitutionHeader> header(morphSubtableHeader, success);
+ 
+-    trimmedArrayLookupTable = (const TrimmedArrayLookupTable *) &header->table;
+-    firstGlyph = SWAPW(trimmedArrayLookupTable->firstGlyph);
+-    lastGlyph = firstGlyph + SWAPW(trimmedArrayLookupTable->glyphCount);
++  if(LE_FAILURE(success)) return;
++
++  trimmedArrayLookupTable = LEReferenceTo<TrimmedArrayLookupTable>(morphSubtableHeader, success, (const TrimmedArrayLookupTable*)&header->table);
++
++  if(LE_FAILURE(success)) return;
++
++  firstGlyph = SWAPW(trimmedArrayLookupTable->firstGlyph);
++  lastGlyph = firstGlyph + SWAPW(trimmedArrayLookupTable->glyphCount);
+ }
+ 
+ TrimmedArrayProcessor::~TrimmedArrayProcessor()
+ {
+ }
+ 
+-void TrimmedArrayProcessor::process(LEGlyphStorage &glyphStorage)
++void TrimmedArrayProcessor::process(LEGlyphStorage &glyphStorage, LEErrorCode &success)
+ {
++  if(LE_FAILURE(success)) return;
+     le_int32 glyphCount = glyphStorage.getGlyphCount();
+     le_int32 glyph;
+ 
+diff --git a/src/share/native/sun/font/layout/TrimmedArrayProcessor.h b/src/share/native/sun/font/layout/TrimmedArrayProcessor.h
+--- jdk/src/share/native/sun/font/layout/TrimmedArrayProcessor.h
++++ jdk/src/share/native/sun/font/layout/TrimmedArrayProcessor.h
+@@ -50,9 +50,9 @@
+ class TrimmedArrayProcessor : public NonContextualGlyphSubstitutionProcessor
+ {
+ public:
+-    virtual void process(LEGlyphStorage &glyphStorage);
++    virtual void process(LEGlyphStorage &glyphStorage, LEErrorCode &success);
+ 
+-    TrimmedArrayProcessor(const MorphSubtableHeader *morphSubtableHeader);
++    TrimmedArrayProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success);
+ 
+     virtual ~TrimmedArrayProcessor();
+ 
+@@ -76,7 +76,7 @@
+ protected:
+     TTGlyphID firstGlyph;
+     TTGlyphID lastGlyph;
+-    const TrimmedArrayLookupTable *trimmedArrayLookupTable;
++    LEReferenceTo<TrimmedArrayLookupTable> trimmedArrayLookupTable;
+ 
+ };
+ 
+diff --git a/src/share/native/sun/font/layout/ValueRecords.h b/src/share/native/sun/font/layout/ValueRecords.h
+--- jdk/src/share/native/sun/font/layout/ValueRecords.h
++++ jdk/src/share/native/sun/font/layout/ValueRecords.h
+@@ -64,6 +64,7 @@
+     static le_int16    getFieldCount(ValueFormat valueFormat);
+     static le_int16    getFieldIndex(ValueFormat valueFormat, ValueRecordField field);
+ };
++LE_VAR_ARRAY(ValueRecord, values)
+ 
+ enum ValueRecordFields
+ {
+diff --git a/src/share/native/sun/font/sunFont.c b/src/share/native/sun/font/sunFont.c
+--- jdk/src/share/native/sun/font/sunFont.c
++++ jdk/src/share/native/sun/font/sunFont.c
+@@ -376,22 +376,20 @@
+ JNIEXPORT TTLayoutTableCache* newLayoutTableCache() {
+   TTLayoutTableCache* ltc = calloc(1, sizeof(TTLayoutTableCache));
+   if (ltc) {
+-    ltc->gsub_len = -1;
+-    ltc->gpos_len = -1;
+-    ltc->gdef_len = -1;
+-    ltc->mort_len = -1;
+-    ltc->kern_len = -1;
++    int i;
++    for(i=0;i<LAYOUTCACHE_ENTRIES;i++) {
++      ltc->entries[i].len = -1;
++    }
+   }
+   return ltc;
+ }
+ 
+ JNIEXPORT void freeLayoutTableCache(TTLayoutTableCache* ltc) {
+   if (ltc) {
+-    if (ltc->gsub) free(ltc->gsub);
+-    if (ltc->gpos) free(ltc->gpos);
+-    if (ltc->gdef) free(ltc->gdef);
+-    if (ltc->mort) free(ltc->mort);
+-    if (ltc->kern) free(ltc->kern);
++    int i;
++    for(i=0;i<LAYOUTCACHE_ENTRIES;i++) {
++      if(ltc->entries[i].ptr) free (ltc->entries[i].ptr);
++    }
+     if (ltc->kernPairs) free(ltc->kernPairs);
+     free(ltc);
+   }

Added: trunk/java/openjdk6/files/icedtea/security/20130416/8001040.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130416/8001040.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130416/8001040.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,113 @@
+# 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;
+     }

Added: trunk/java/openjdk6/files/icedtea/security/20130416/8001322.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130416/8001322.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130416/8001322.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,61 @@
+# 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;

Added: trunk/java/openjdk6/files/icedtea/security/20130416/8001329.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130416/8001329.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130416/8001329.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,32 @@
+# 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;
+     }
+ 

Added: trunk/java/openjdk6/files/icedtea/security/20130416/8003335.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130416/8003335.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130416/8003335.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,63 @@
+# 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();

Added: trunk/java/openjdk6/files/icedtea/security/20130416/8003445.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130416/8003445.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130416/8003445.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,77 @@
+# 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

Added: trunk/java/openjdk6/files/icedtea/security/20130416/8003543.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130416/8003543.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130416/8003543.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,227 @@
+--- /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);
+++            }
+++        }
+++
+++    }
+++
+++
+++}

Added: trunk/java/openjdk6/files/icedtea/security/20130416/8004261.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130416/8004261.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130416/8004261.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,142 @@
+# 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;
+ 

Added: trunk/java/openjdk6/files/icedtea/security/20130416/8004336.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130416/8004336.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130416/8004336.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,29 @@
+# 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;
+   }

Added: trunk/java/openjdk6/files/icedtea/security/20130416/8004986.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130416/8004986.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130416/8004986.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,374 @@
+# 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 at 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;

Added: trunk/java/openjdk6/files/icedtea/security/20130416/8005432.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130416/8005432.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130416/8005432.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,511 @@
+--- 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);

Added: trunk/java/openjdk6/files/icedtea/security/20130416/8005943.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130416/8005943.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130416/8005943.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,202 @@
+# 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);
+             }

Added: trunk/java/openjdk6/files/icedtea/security/20130416/8006309.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130416/8006309.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130416/8006309.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,22 @@
+# 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();

Added: trunk/java/openjdk6/files/icedtea/security/20130416/8006435.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130416/8006435.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130416/8006435.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,76 @@
+# 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.

Added: trunk/java/openjdk6/files/icedtea/security/20130416/8006790.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130416/8006790.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130416/8006790.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,166 @@
+# 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();

Added: trunk/java/openjdk6/files/icedtea/security/20130416/8006795.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130416/8006795.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130416/8006795.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,35 @@
+# 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);

Added: trunk/java/openjdk6/files/icedtea/security/20130416/8007406.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130416/8007406.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130416/8007406.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,31 @@
+# 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

Added: trunk/java/openjdk6/files/icedtea/security/20130416/8007617.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130416/8007617.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130416/8007617.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,376 @@
+# 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,

Added: trunk/java/openjdk6/files/icedtea/security/20130416/8007667.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130416/8007667.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130416/8007667.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,579 @@
+# 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);
+ }

Added: trunk/java/openjdk6/files/icedtea/security/20130416/8007918.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130416/8007918.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130416/8007918.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,357 @@
+# 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

Added: trunk/java/openjdk6/files/icedtea/security/20130416/8009063.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130416/8009063.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130416/8009063.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,67 @@
+# 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);
+         }

Added: trunk/java/openjdk6/files/icedtea/security/20130416/8009305.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130416/8009305.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130416/8009305.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,68 @@
+# 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;

Added: trunk/java/openjdk6/files/icedtea/security/20130416/8009699.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130416/8009699.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130416/8009699.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,25 @@
+# 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()) {

Added: trunk/java/openjdk6/files/icedtea/security/20130416/8009814.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130416/8009814.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130416/8009814.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,27 @@
+# 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

Added: trunk/java/openjdk6/files/icedtea/security/20130416/8009857.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130416/8009857.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130416/8009857.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,66 @@
+# 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");
+         }

Added: trunk/java/openjdk6/files/icedtea/security/20130618/6741606-apache_santuario.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/6741606-apache_santuario.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/6741606-apache_santuario.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,8110 @@
+# HG changeset patch
+# User andrew
+# Date 1371136851 -3600
+# Node ID 7ecadad337414327d0d0ca6a8efcc40b7e8a9d29
+# Parent  a955a845f0d1b8e21e0780986d971b3712db26c7
+6741606: Integrate Apache Santuario
+Reviewed-by: vinnie, hawtin
+
+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
+@@ -2,38 +2,43 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-/*
+- * Copyright  1999-2004 The Apache Software Foundation.
++/**
++ * Licensed to the Apache Software Foundation (ASF) under one
++ * or more contributor license agreements. See the NOTICE file
++ * distributed with this work for additional information
++ * regarding copyright ownership. The ASF licenses this file
++ * to you under the Apache License, Version 2.0 (the
++ * "License"); you may not use this file except in compliance
++ * with the License. You may obtain a copy of the License at
+  *
+- *  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
+  *
+- *      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.
+- *
++ * Unless required by applicable law or agreed to in writing,
++ * software distributed under the License is distributed on an
++ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
++ * KIND, either express or implied. See the License for the
++ * specific language governing permissions and limitations
++ * under the License.
+  */
+ package com.sun.org.apache.xml.internal.security;
+ 
+ import java.io.InputStream;
+ import java.security.AccessController;
+ import java.security.PrivilegedAction;
++import java.util.ArrayList;
++import java.util.List;
++
++import javax.xml.XMLConstants;
+ import javax.xml.parsers.DocumentBuilder;
+ import javax.xml.parsers.DocumentBuilderFactory;
+ 
+ import com.sun.org.apache.xml.internal.security.algorithms.JCEMapper;
+ import com.sun.org.apache.xml.internal.security.algorithms.SignatureAlgorithm;
+ import com.sun.org.apache.xml.internal.security.c14n.Canonicalizer;
+-import com.sun.org.apache.xml.internal.security.keys.KeyInfo;
+ import com.sun.org.apache.xml.internal.security.keys.keyresolver.KeyResolver;
+ import com.sun.org.apache.xml.internal.security.transforms.Transform;
++import com.sun.org.apache.xml.internal.security.utils.ElementProxy;
+ import com.sun.org.apache.xml.internal.security.utils.I18n;
+-//import com.sun.org.apache.xml.internal.security.utils.PRNG;
+ import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
+ import com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolver;
+ import org.w3c.dom.Attr;
+@@ -47,367 +52,317 @@
+  * the mapping of Canonicalization and Transform algorithms. Initialization is
+  * done by calling {@link Init#init} which should be done in any static block
+  * of the files of this library. We ensure that this call is only executed once.
+- *
+- * @author $Author: mullan $
+  */
+-public final class Init {
++public class Init {
+ 
+-  /** {@link java.util.logging} logging facility */
+-  static java.util.logging.Logger log =
++    /** The namespace for CONF file **/
++    public static final String CONF_NS = "http://www.xmlsecurity.org/NS/#configuration";
++
++    /** {@link org.apache.commons.logging} logging facility */
++    private static java.util.logging.Logger log =
+         java.util.logging.Logger.getLogger(Init.class.getName());
+ 
+-   /** Field _initialized */
+-   private static boolean _alreadyInitialized = false;
++    /** Field alreadyInitialized */
++    private static boolean alreadyInitialized = false;
+ 
+-   /** The namespace for CONF file **/
+-   public static final String CONF_NS="http://www.xmlsecurity.org/NS/#configuration";
++    /**
++     * Method isInitialized
++     * @return true if the library is already initialized.
++     */
++    public static synchronized final boolean isInitialized() {
++        return Init.alreadyInitialized;
++    }
+ 
+-   /**
+-    * Method isInitialized
+-    * @return true if the librairy is already initialized.
+-    *
+-    */
+-   public static final boolean isInitialized() {
+-      return Init._alreadyInitialized;
+-   }
++    /**
++     * Method init
++     *
++     */
++    public static synchronized void init() {
++        if (alreadyInitialized) {
++            return;
++        }
+ 
+-   /**
+-    * Method init
+-    *
+-    */
+-   public synchronized static void init() {
++        InputStream is =
++            AccessController.doPrivileged(
++                new PrivilegedAction<InputStream>() {
++                    public InputStream run() {
++                        String cfile =
++                            System.getProperty("com.sun.org.apache.xml.internal.security.resource.config");
++                        if (cfile == null) {
++                            return null;
++                        }
++                        return getClass().getResourceAsStream(cfile);
++                    }
++                });
++        if (is == null) {
++            dynamicInit();
++        } else {
++            fileInit(is);
++        }
+ 
+-      if (_alreadyInitialized) {
+-        return;
+-      }
+-      long XX_configure_i18n_end=0;
+-      long XX_configure_reg_c14n_start=0;
+-      long XX_configure_reg_c14n_end=0;
+-      long XX_configure_reg_jcemapper_end=0;
+-      long XX_configure_reg_keyInfo_start=0;
+-      long XX_configure_reg_keyResolver_end=0;
+-      long XX_configure_reg_prefixes_start=0;
+-      long XX_configure_reg_resourceresolver_start=0;
+-      long XX_configure_reg_sigalgos_end=0;
+-      long XX_configure_reg_transforms_end=0;
+-      long XX_configure_reg_keyInfo_end=0;
+-      long XX_configure_reg_keyResolver_start=0;
+-         _alreadyInitialized = true;
++        alreadyInitialized = true;
++    }
+ 
+-         try {
+-            long XX_init_start = System.currentTimeMillis();
+-            long XX_prng_start = System.currentTimeMillis();
++    /**
++     * Dynamically initialise the library by registering the default algorithms/implementations
++     */
++    private static void dynamicInit() {
++        //
++        // Load the Resource Bundle - the default is the English resource bundle.
++        // To load another resource bundle, call I18n.init(...) before calling this
++        // method.
++        //
++        I18n.init("en", "US");
+ 
+-            //PRNG.init(new java.security.SecureRandom());
++        if (log.isLoggable(java.util.logging.Level.FINE)) {
++            log.log(java.util.logging.Level.FINE, "Registering default algorithms");
++        }
++        try {
++            //
++            // Bind the default prefixes
++            //
++            ElementProxy.registerDefaultPrefixes();
+ 
+-            long XX_prng_end = System.currentTimeMillis();
++            //
++            // Set the default Transforms
++            //
++            Transform.registerDefaultAlgorithms();
+ 
++            //
++            // Set the default signature algorithms
++            //
++            SignatureAlgorithm.registerDefaultAlgorithms();
++
++            //
++            // Set the default JCE algorithms
++            //
++            JCEMapper.registerDefaultAlgorithms();
++
++            //
++            // Set the default c14n algorithms
++            //
++            Canonicalizer.registerDefaultAlgorithms();
++
++            //
++            // Register the default resolvers
++            //
++            ResourceResolver.registerDefaultResolvers();
++
++            //
++            // Register the default key resolvers
++            //
++            KeyResolver.registerDefaultResolvers();
++        } catch (Exception ex) {
++            log.log(java.util.logging.Level.SEVERE, ex.getMessage(), ex);
++            ex.printStackTrace();
++        }
++    }
++
++    /**
++     * Initialise the library from a configuration file
++     */
++    private static void fileInit(InputStream is) {
++        try {
+             /* read library configuration file */
+-            long XX_parsing_start = System.currentTimeMillis();
+             DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
++            dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
+ 
+             dbf.setNamespaceAware(true);
+             dbf.setValidating(false);
+ 
+             DocumentBuilder db = dbf.newDocumentBuilder();
+-            // We don't allow users to override the Apache XML Security
+-            // configuration in the JRE. Users should use the standard security
+-            // provider mechanism instead if implementing their own
+-            // transform or canonicalization algorithms.
+-            // InputStream is = Class.forName("com.sun.org.apache.xml.internal.security.Init").getResourceAsStream("resource/config.xml");
+-            InputStream is = (InputStream) AccessController.doPrivileged(
+-                new PrivilegedAction() {
+-                    public Object run() {
+-//                        String cfile = System.getProperty
+-//                            ("com.sun.org.apache.xml.internal.security.resource.config");
+-                        return getClass().getResourceAsStream
+-//                            (cfile != null ? cfile : "resource/config.xml");
+-                            ("resource/config.xml");
+-                    }
+-                });
+-
+             Document doc = db.parse(is);
+-            long XX_parsing_end = System.currentTimeMillis();
+-            long XX_configure_i18n_start = 0;
+-
+-            {
+-                XX_configure_reg_keyInfo_start = System.currentTimeMillis();
+-               try {
+-                  KeyInfo.init();
+-               } catch (Exception e) {
+-                  e.printStackTrace();
+-
+-                  throw e;
+-               }
+-               XX_configure_reg_keyInfo_end = System.currentTimeMillis();
+-            }
+-
+-                        long XX_configure_reg_transforms_start=0;
+-                        long XX_configure_reg_jcemapper_start=0;
+-                        long XX_configure_reg_sigalgos_start=0;
+-                        long XX_configure_reg_resourceresolver_end=0;
+-                        long XX_configure_reg_prefixes_end=0;
+-            Node config=doc.getFirstChild();
+-            for (;config!=null;config=config.getNextSibling()) {
++            Node config = doc.getFirstChild();
++            for (; config != null; config = config.getNextSibling()) {
+                 if ("Configuration".equals(config.getLocalName())) {
+-                        break;
++                    break;
+                 }
+             }
+-                        for (Node el=config.getFirstChild();el!=null;el=el.getNextSibling()) {
+-                if (el.getNodeType() != Node.ELEMENT_NODE) {
+-                        continue;
++            if (config == null) {
++                log.log(java.util.logging.Level.SEVERE, "Error in reading configuration file - Configuration element not found");
++                return;
++            }
++            for (Node el = config.getFirstChild(); el != null; el = el.getNextSibling()) {
++                if (Node.ELEMENT_NODE != el.getNodeType()) {
++                    continue;
+                 }
+-                String tag=el.getLocalName();
+-//
+-// Commented out: not supported in the JDK. We use the default locale.
+-//
+-//            if (tag.equals("ResourceBundles")){
+-//                XX_configure_i18n_start = System.currentTimeMillis();
+-//                Element resource=(Element)el;
+-//               /* configure internationalization */
+-//               Attr langAttr = resource.getAttributeNode("defaultLanguageCode");
+-//               Attr countryAttr = resource.getAttributeNode("defaultCountryCode");
+-//               String languageCode = (langAttr == null)
+-//                                     ? null
+-//                                     : langAttr.getNodeValue();
+-//               String countryCode = (countryAttr == null)
+-//                                    ? null
+-//                                    : countryAttr.getNodeValue();
+-//
+-//               I18n.init(languageCode, countryCode);
+-//               XX_configure_i18n_end = System.currentTimeMillis();
+-//            }
++                String tag = el.getLocalName();
++                if (tag.equals("ResourceBundles")) {
++                    Element resource = (Element)el;
++                    /* configure internationalization */
++                    Attr langAttr = resource.getAttributeNode("defaultLanguageCode");
++                    Attr countryAttr = resource.getAttributeNode("defaultCountryCode");
++                    String languageCode =
++                        (langAttr == null) ? null : langAttr.getNodeValue();
++                    String countryCode =
++                        (countryAttr == null) ? null : countryAttr.getNodeValue();
++                    I18n.init(languageCode, countryCode);
++                }
+ 
+-            if (tag.equals("CanonicalizationMethods")){
+-                XX_configure_reg_c14n_start = System.currentTimeMillis();
+-               Canonicalizer.init();
+-               Element[] list=XMLUtils.selectNodes(el.getFirstChild(),CONF_NS,"CanonicalizationMethod");
++                if (tag.equals("CanonicalizationMethods")) {
++                    Element[] list =
++                        XMLUtils.selectNodes(el.getFirstChild(), CONF_NS, "CanonicalizationMethod");
+ 
+-               for (int i = 0; i < list.length; i++) {
+-                  String URI = list[i].getAttributeNS(null,
+-                                  "URI");
+-                  String JAVACLASS =
+-                     list[i].getAttributeNS(null,
+-                        "JAVACLASS");
+-                  try {
+-                      Class.forName(JAVACLASS);
+-/*                     Method methods[] = c.getMethods();
++                    for (int i = 0; i < list.length; i++) {
++                        String uri = list[i].getAttributeNS(null, "URI");
++                        String javaClass =
++                            list[i].getAttributeNS(null, "JAVACLASS");
++                        try {
++                            Canonicalizer.register(uri, javaClass);
++                            if (log.isLoggable(java.util.logging.Level.FINE)) {
++                                log.log(java.util.logging.Level.FINE, "Canonicalizer.register(" + uri + ", " + javaClass + ")");
++                            }
++                        } catch (ClassNotFoundException e) {
++                            Object exArgs[] = { uri, javaClass };
++                            log.log(java.util.logging.Level.SEVERE, I18n.translate("algorithm.classDoesNotExist", exArgs));
++                        }
++                    }
++                }
+ 
+-                     for (int j = 0; j < methods.length; j++) {
+-                        Method currMeth = methods[j];
++                if (tag.equals("TransformAlgorithms")) {
++                    Element[] tranElem =
++                        XMLUtils.selectNodes(el.getFirstChild(), CONF_NS, "TransformAlgorithm");
+ 
+-                        if (currMeth.getDeclaringClass().getName()
+-                                .equals(JAVACLASS)) {
+-                           log.log(java.util.logging.Level.FINE, currMeth.getDe claringClass().toString());
++                    for (int i = 0; i < tranElem.length; i++) {
++                        String uri = tranElem[i].getAttributeNS(null, "URI");
++                        String javaClass =
++                            tranElem[i].getAttributeNS(null, "JAVACLASS");
++                        try {
++                            Transform.register(uri, javaClass);
++                            if (log.isLoggable(java.util.logging.Level.FINE)) {
++                                log.log(java.util.logging.Level.FINE, "Transform.register(" + uri + ", " + javaClass + ")");
++                            }
++                        } catch (ClassNotFoundException e) {
++                            Object exArgs[] = { uri, javaClass };
++
++                            log.log(java.util.logging.Level.SEVERE, I18n.translate("algorithm.classDoesNotExist", exArgs));
++                        } catch (NoClassDefFoundError ex) {
++                            log.log(java.util.logging.Level.WARNING, "Not able to found dependencies for algorithm, I'll keep working.");
+                         }
+-                     }*/
+-                      if (log.isLoggable(java.util.logging.Level.FINE))
+-                        log.log(java.util.logging.Level.FINE, "Canonicalizer.register(" + URI + ", "
+-                            + JAVACLASS + ")");
+-                     Canonicalizer.register(URI, JAVACLASS);
+-                  } catch (ClassNotFoundException e) {
+-                     Object exArgs[] = { URI, JAVACLASS };
++                    }
++                }
+ 
+-                     log.log(java.util.logging.Level.SEVERE, I18n.translate("algorithm.classDoesNotExist",
+-                                              exArgs));
+-                  }
+-               }
+-               XX_configure_reg_c14n_end = System.currentTimeMillis();
++                if ("JCEAlgorithmMappings".equals(tag)) {
++                    Node algorithmsNode = ((Element)el).getElementsByTagName("Algorithms").item(0);
++                    if (algorithmsNode != null) {
++                        Element[] algorithms =
++                            XMLUtils.selectNodes(algorithmsNode.getFirstChild(), CONF_NS, "Algorithm");
++                        for (int i = 0; i < algorithms.length; i++) {
++                            Element element = algorithms[i];
++                            String id = element.getAttribute("URI");
++                            JCEMapper.register(id, new JCEMapper.Algorithm(element));
++                        }
++                    }
++                }
++
++                if (tag.equals("SignatureAlgorithms")) {
++                    Element[] sigElems =
++                        XMLUtils.selectNodes(el.getFirstChild(), CONF_NS, "SignatureAlgorithm");
++
++                    for (int i = 0; i < sigElems.length; i++) {
++                        String uri = sigElems[i].getAttributeNS(null, "URI");
++                        String javaClass =
++                            sigElems[i].getAttributeNS(null, "JAVACLASS");
++
++                        /** $todo$ handle registering */
++
++                        try {
++                            SignatureAlgorithm.register(uri, javaClass);
++                            if (log.isLoggable(java.util.logging.Level.FINE)) {
++                                log.log(java.util.logging.Level.FINE, "SignatureAlgorithm.register(" + uri + ", "
++                                          + javaClass + ")");
++                            }
++                        } catch (ClassNotFoundException e) {
++                            Object exArgs[] = { uri, javaClass };
++
++                            log.log(java.util.logging.Level.SEVERE, I18n.translate("algorithm.classDoesNotExist", exArgs));
++                        }
++                    }
++                }
++
++                if (tag.equals("ResourceResolvers")) {
++                    Element[]resolverElem =
++                        XMLUtils.selectNodes(el.getFirstChild(), CONF_NS, "Resolver");
++
++                    for (int i = 0; i < resolverElem.length; i++) {
++                        String javaClass =
++                            resolverElem[i].getAttributeNS(null, "JAVACLASS");
++                        String description =
++                            resolverElem[i].getAttributeNS(null, "DESCRIPTION");
++
++                        if ((description != null) && (description.length() > 0)) {
++                            if (log.isLoggable(java.util.logging.Level.FINE)) {
++                                log.log(java.util.logging.Level.FINE, "Register Resolver: " + javaClass + ": "
++                                          + description);
++                            }
++                        } else {
++                            if (log.isLoggable(java.util.logging.Level.FINE)) {
++                                log.log(java.util.logging.Level.FINE, "Register Resolver: " + javaClass
++                                          + ": For unknown purposes");
++                            }
++                        }
++                        try {
++                            ResourceResolver.register(javaClass);
++                        } catch (Throwable e) {
++                            log.log(java.util.logging.Level.WARNING,
++                                 "Cannot register:" + javaClass
++                                 + " perhaps some needed jars are not installed",
++                                 e
++                             );
++                        }
++                    }
++                }
++
++                if (tag.equals("KeyResolver")){
++                    Element[] resolverElem =
++                        XMLUtils.selectNodes(el.getFirstChild(), CONF_NS, "Resolver");
++                    List<String> classNames = new ArrayList<String>(resolverElem.length);
++                    for (int i = 0; i < resolverElem.length; i++) {
++                        String javaClass =
++                            resolverElem[i].getAttributeNS(null, "JAVACLASS");
++                        String description =
++                            resolverElem[i].getAttributeNS(null, "DESCRIPTION");
++
++                        if ((description != null) && (description.length() > 0)) {
++                            if (log.isLoggable(java.util.logging.Level.FINE)) {
++                                log.log(java.util.logging.Level.FINE, "Register Resolver: " + javaClass + ": "
++                                          + description);
++                            }
++                        } else {
++                            if (log.isLoggable(java.util.logging.Level.FINE)) {
++                                log.log(java.util.logging.Level.FINE, "Register Resolver: " + javaClass
++                                          + ": For unknown purposes");
++                            }
++                        }
++                        classNames.add(javaClass);
++                    }
++                    KeyResolver.registerClassNames(classNames);
++                }
++
++
++                if (tag.equals("PrefixMappings")){
++                    if (log.isLoggable(java.util.logging.Level.FINE)) {
++                        log.log(java.util.logging.Level.FINE, "Now I try to bind prefixes:");
++                    }
++
++                    Element[] nl =
++                        XMLUtils.selectNodes(el.getFirstChild(), CONF_NS, "PrefixMapping");
++
++                    for (int i = 0; i < nl.length; i++) {
++                        String namespace = nl[i].getAttributeNS(null, "namespace");
++                        String prefix = nl[i].getAttributeNS(null, "prefix");
++                        if (log.isLoggable(java.util.logging.Level.FINE)) {
++                            log.log(java.util.logging.Level.FINE, "Now I try to bind " + prefix + " to " + namespace);
++                        }
++                        ElementProxy.setDefaultPrefix(namespace, prefix);
++                    }
++                }
+             }
+-
+-            if (tag.equals("TransformAlgorithms")){
+-               XX_configure_reg_transforms_start = System.currentTimeMillis();
+-               Transform.init();
+-
+-               Element[] tranElem = XMLUtils.selectNodes(el.getFirstChild(),CONF_NS,"TransformAlgorithm");
+-
+-               for (int i = 0; i < tranElem.length; i++) {
+-                  String URI = tranElem[i].getAttributeNS(null,
+-                                  "URI");
+-                  String JAVACLASS =
+-                     tranElem[i].getAttributeNS(null,
+-                        "JAVACLASS");
+-                  try {
+-                     Class.forName(JAVACLASS);
+-                     if (log.isLoggable(java.util.logging.Level.FINE))
+-                        log.log(java.util.logging.Level.FINE, "Transform.register(" + URI + ", " + JAVACLASS + ")");
+-                     Transform.register(URI, JAVACLASS);
+-                  } catch (ClassNotFoundException e) {
+-                     Object exArgs[] = { URI, JAVACLASS };
+-
+-                     log.log(java.util.logging.Level.SEVERE, I18n.translate("algorithm.classDoesNotExist",
+-                                              exArgs));
+-
+-                  } catch (NoClassDefFoundError ex) {
+-                                          log.log(java.util.logging.Level.WARNING, "Not able to found dependecies for algorithm, I'm keep working.");
+-                  }
+-               }
+-               XX_configure_reg_transforms_end = System.currentTimeMillis();
+-            }
+-
+-
+-            if ("JCEAlgorithmMappings".equals(tag)){
+-               XX_configure_reg_jcemapper_start = System.currentTimeMillis();
+-               JCEMapper.init((Element)el);
+-               XX_configure_reg_jcemapper_end = System.currentTimeMillis();
+-            }
+-
+-
+-
+-            if (tag.equals("SignatureAlgorithms")){
+-               XX_configure_reg_sigalgos_start = System.currentTimeMillis();
+-               SignatureAlgorithm.providerInit();
+-
+-               Element[] sigElems = XMLUtils.selectNodes(el.getFirstChild(), CONF_NS,
+-                  "SignatureAlgorithm");
+-
+-               for (int i = 0; i < sigElems.length; i++) {
+-                  String URI = sigElems[i].getAttributeNS(null,
+-                                  "URI");
+-                  String JAVACLASS =
+-                    sigElems[i].getAttributeNS(null,
+-                        "JAVACLASS");
+-
+-                  /** $todo$ handle registering */
+-
+-                  try {
+-                      Class.forName(JAVACLASS);
+- //                    Method methods[] = c.getMethods();
+-
+-//                     for (int j = 0; j < methods.length; j++) {
+-//                        Method currMeth = methods[j];
+-//
+-//                        if (currMeth.getDeclaringClass().getName()
+-//                                .equals(JAVACLASS)) {
+-//                           log.log(java.util.logging.Level.FINE, currMeth.getDe claringClass().toString());
+-//                        }
+-//                     }
+-                      if (log.isLoggable(java.util.logging.Level.FINE))
+-                        log.log(java.util.logging.Level.FINE, "SignatureAlgorithm.register(" + URI + ", " + JAVACLASS + ")");
+-                     SignatureAlgorithm.register(URI, JAVACLASS);
+-                  } catch (ClassNotFoundException e) {
+-                     Object exArgs[] = { URI, JAVACLASS };
+-
+-                     log.log(java.util.logging.Level.SEVERE, I18n.translate("algorithm.classDoesNotExist",
+-                                              exArgs));
+-
+-                  }
+-               }
+-               XX_configure_reg_sigalgos_end = System.currentTimeMillis();
+-            }
+-
+-
+-
+-            if (tag.equals("ResourceResolvers")){
+-               XX_configure_reg_resourceresolver_start = System.currentTimeMillis();
+-               ResourceResolver.init();
+-
+-               Element[]resolverElem = XMLUtils.selectNodes(el.getFirstChild(),CONF_NS,
+-                  "Resolver");
+-
+-               for (int i = 0; i < resolverElem.length; i++) {
+-                  String JAVACLASS =
+-                      resolverElem[i].getAttributeNS(null,
+-                        "JAVACLASS");
+-                  String Description =
+-                     resolverElem[i].getAttributeNS(null,
+-                        "DESCRIPTION");
+-
+-                  if ((Description != null) && (Description.length() > 0)) {
+-                    if (log.isLoggable(java.util.logging.Level.FINE))
+-                        log.log(java.util.logging.Level.FINE, "Register Resolver: " + JAVACLASS + ": " + Description);
+-                  } else {
+-                    if (log.isLoggable(java.util.logging.Level.FINE))
+-                        log.log(java.util.logging.Level.FINE, "Register Resolver: " + JAVACLASS + ": For unknown purposes");
+-                  }
+-                                  try {
+-                                          ResourceResolver.register(JAVACLASS);
+-                                  } catch (Throwable e) {
+-                                          log.log(java.util.logging.Level.WARNING, "Cannot register:"+JAVACLASS+" perhaps some needed jars are not installed",e);
+-                                  }
+-                  XX_configure_reg_resourceresolver_end =
+-                    System.currentTimeMillis();
+-               }
+-
+-            }
+-
+-
+-
+-
+-
+-
+-            if (tag.equals("KeyResolver")){
+-               XX_configure_reg_keyResolver_start =System.currentTimeMillis();
+-               KeyResolver.init();
+-
+-               Element[] resolverElem = XMLUtils.selectNodes(el.getFirstChild(), CONF_NS,"Resolver");
+-
+-               for (int i = 0; i < resolverElem.length; i++) {
+-                  String JAVACLASS =
+-                     resolverElem[i].getAttributeNS(null,
+-                        "JAVACLASS");
+-                  String Description =
+-                     resolverElem[i].getAttributeNS(null,
+-                        "DESCRIPTION");
+-
+-                  if ((Description != null) && (Description.length() > 0)) {
+-                    if (log.isLoggable(java.util.logging.Level.FINE))
+-                        log.log(java.util.logging.Level.FINE, "Register Resolver: " + JAVACLASS + ": " + Description);
+-                  } else {
+-                    if (log.isLoggable(java.util.logging.Level.FINE))
+-                        log.log(java.util.logging.Level.FINE, "Register Resolver: " + JAVACLASS + ": For unknown purposes");
+-                  }
+-
+-                  KeyResolver.register(JAVACLASS);
+-               }
+-               XX_configure_reg_keyResolver_end = System.currentTimeMillis();
+-            }
+-
+-
+-            if (tag.equals("PrefixMappings")){
+-                XX_configure_reg_prefixes_start = System.currentTimeMillis();
+-                if (log.isLoggable(java.util.logging.Level.FINE))
+-                    log.log(java.util.logging.Level.FINE, "Now I try to bind prefixes:");
+-
+-               Element[] nl = XMLUtils.selectNodes(el.getFirstChild(), CONF_NS,"PrefixMapping");
+-
+-               for (int i = 0; i < nl.length; i++) {
+-                  String namespace = nl[i].getAttributeNS(null,
+-                                        "namespace");
+-                  String prefix = nl[i].getAttributeNS(null,
+-                                     "prefix");
+-                  if (log.isLoggable(java.util.logging.Level.FINE))
+-                      log.log(java.util.logging.Level.FINE, "Now I try to bind " + prefix + " to " + namespace);
+-                  com.sun.org.apache.xml.internal.security.utils.ElementProxy
+-                     .setDefaultPrefix(namespace, prefix);
+-               }
+-               XX_configure_reg_prefixes_end = System.currentTimeMillis();
+-            }
+-            }
+-
+-            long XX_init_end = System.currentTimeMillis();
+-
+-            //J-
+-            if (log.isLoggable(java.util.logging.Level.FINE)) {
+-                log.log(java.util.logging.Level.FINE, "XX_init                             " + ((int)(XX_init_end - XX_init_start)) + " ms");
+-                log.log(java.util.logging.Level.FINE, "  XX_prng                           " + ((int)(XX_prng_end - XX_prng_start)) + " ms");
+-                log.log(java.util.logging.Level.FINE, "  XX_parsing                        " + ((int)(XX_parsing_end - XX_parsing_start)) + " ms");
+-                log.log(java.util.logging.Level.FINE, "  XX_configure_i18n                 " + ((int)(XX_configure_i18n_end- XX_configure_i18n_start)) + " ms");
+-                log.log(java.util.logging.Level.FINE, "  XX_configure_reg_c14n             " + ((int)(XX_configure_reg_c14n_end- XX_configure_reg_c14n_start)) + " ms");
+-                log.log(java.util.logging.Level.FINE, "  XX_configure_reg_jcemapper        " + ((int)(XX_configure_reg_jcemapper_end- XX_configure_reg_jcemapper_start)) + " ms");
+-                log.log(java.util.logging.Level.FINE, "  XX_configure_reg_keyInfo          " + ((int)(XX_configure_reg_keyInfo_end- XX_configure_reg_keyInfo_start)) + " ms");
+-                log.log(java.util.logging.Level.FINE, "  XX_configure_reg_keyResolver      " + ((int)(XX_configure_reg_keyResolver_end- XX_configure_reg_keyResolver_start)) + " ms");
+-                log.log(java.util.logging.Level.FINE, "  XX_configure_reg_prefixes         " + ((int)(XX_configure_reg_prefixes_end- XX_configure_reg_prefixes_start)) + " ms");
+-                log.log(java.util.logging.Level.FINE, "  XX_configure_reg_resourceresolver " + ((int)(XX_configure_reg_resourceresolver_end- XX_configure_reg_resourceresolver_start)) + " ms");
+-                log.log(java.util.logging.Level.FINE, "  XX_configure_reg_sigalgos         " + ((int)(XX_configure_reg_sigalgos_end- XX_configure_reg_sigalgos_start)) + " ms");
+-                log.log(java.util.logging.Level.FINE, "  XX_configure_reg_transforms       " + ((int)(XX_configure_reg_transforms_end- XX_configure_reg_transforms_start)) + " ms");
+-            }
+-         } catch (Exception e) {
++        } catch (Exception e) {
+             log.log(java.util.logging.Level.SEVERE, "Bad: ", e);
+             e.printStackTrace();
+-         }
+-
+-   }
+-
++        }
++    }
+ 
+ }
++
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/JCEMapper.java b/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/JCEMapper.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/JCEMapper.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/JCEMapper.java
+@@ -2,167 +2,316 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-/*
+- * Copyright  1999-2004 The Apache Software Foundation.
++/**
++ * Licensed to the Apache Software Foundation (ASF) under one
++ * or more contributor license agreements. See the NOTICE file
++ * distributed with this work for additional information
++ * regarding copyright ownership. The ASF licenses this file
++ * to you under the Apache License, Version 2.0 (the
++ * "License"); you may not use this file except in compliance
++ * with the License. You may obtain a copy of the License at
+  *
+- *  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
+  *
+- *      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.
+- *
++ * Unless required by applicable law or agreed to in writing,
++ * software distributed under the License is distributed on an
++ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
++ * KIND, either express or implied. See the License for the
++ * specific language governing permissions and limitations
++ * under the License.
+  */
+ package com.sun.org.apache.xml.internal.security.algorithms;
+ 
++import java.util.Map;
++import java.util.concurrent.ConcurrentHashMap;
+ 
+-
+-import java.util.HashMap;
+-import java.util.Map;
+-
+-
+-import com.sun.org.apache.xml.internal.security.Init;
+-import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
++import com.sun.org.apache.xml.internal.security.encryption.XMLCipher;
++import com.sun.org.apache.xml.internal.security.signature.XMLSignature;
+ import org.w3c.dom.Element;
+ 
+ 
+-
+ /**
+  * This class maps algorithm identifier URIs to JAVA JCE class names.
+- *
+- * @author $Author: mullan $
+  */
+ public class JCEMapper {
+ 
+-   /** {@link java.util.logging} logging facility */
+-    static java.util.logging.Logger log =
++    /** {@link org.apache.commons.logging} logging facility */
++    private static java.util.logging.Logger log =
+         java.util.logging.Logger.getLogger(JCEMapper.class.getName());
+ 
++    private static Map<String, Algorithm> algorithmsMap =
++        new ConcurrentHashMap<String, Algorithm>();
+ 
++    private static String providerName = null;
+ 
+-   private static Map uriToJCEName;
++    /**
++     * Method register
++     *
++     * @param id
++     * @param algorithm
++     */
++    public static void register(String id, Algorithm algorithm) {
++        algorithmsMap.put(id, algorithm);
++    }
+ 
+-   private static Map algorithmsMap;
++    /**
++     * This method registers the default algorithms.
++     */
++    public static void registerDefaultAlgorithms() {
++        algorithmsMap.put(
++            MessageDigestAlgorithm.ALGO_ID_DIGEST_NOT_RECOMMENDED_MD5,
++            new Algorithm("", "MD5", "MessageDigest")
++        );
++        algorithmsMap.put(
++            MessageDigestAlgorithm.ALGO_ID_DIGEST_RIPEMD160,
++            new Algorithm("", "RIPEMD160", "MessageDigest")
++        );
++        algorithmsMap.put(
++            MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA1,
++            new Algorithm("", "SHA-1", "MessageDigest")
++        );
++        algorithmsMap.put(
++            MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA256,
++            new Algorithm("", "SHA-256", "MessageDigest")
++        );
++        algorithmsMap.put(
++            MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA384,
++            new Algorithm("", "SHA-384", "MessageDigest")
++        );
++        algorithmsMap.put(
++            MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA512,
++            new Algorithm("", "SHA-512", "MessageDigest")
++        );
++        algorithmsMap.put(
++            XMLSignature.ALGO_ID_SIGNATURE_DSA,
++            new Algorithm("", "SHA1withDSA", "Signature")
++        );
++        algorithmsMap.put(
++            XMLSignature.ALGO_ID_SIGNATURE_NOT_RECOMMENDED_RSA_MD5,
++            new Algorithm("", "MD5withRSA", "Signature")
++        );
++        algorithmsMap.put(
++            XMLSignature.ALGO_ID_SIGNATURE_RSA_RIPEMD160,
++            new Algorithm("", "RIPEMD160withRSA", "Signature")
++        );
++        algorithmsMap.put(
++            XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA1,
++            new Algorithm("", "SHA1withRSA", "Signature")
++        );
++        algorithmsMap.put(
++            XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA256,
++            new Algorithm("", "SHA256withRSA", "Signature")
++        );
++        algorithmsMap.put(
++            XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA384,
++            new Algorithm("", "SHA384withRSA", "Signature")
++        );
++        algorithmsMap.put(
++            XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA512,
++            new Algorithm("", "SHA512withRSA", "Signature")
++        );
++        algorithmsMap.put(
++            XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA1,
++            new Algorithm("", "SHA1withECDSA", "Signature")
++        );
++        algorithmsMap.put(
++            XMLSignature.ALGO_ID_MAC_HMAC_NOT_RECOMMENDED_MD5,
++            new Algorithm("", "HmacMD5", "Mac")
++        );
++        algorithmsMap.put(
++            XMLSignature.ALGO_ID_MAC_HMAC_RIPEMD160,
++            new Algorithm("", "HMACRIPEMD160", "Mac")
++        );
++        algorithmsMap.put(
++            XMLSignature.ALGO_ID_MAC_HMAC_SHA1,
++            new Algorithm("", "HmacSHA1", "Mac")
++        );
++        algorithmsMap.put(
++            XMLSignature.ALGO_ID_MAC_HMAC_SHA256,
++            new Algorithm("", "HmacSHA256", "Mac")
++        );
++        algorithmsMap.put(
++            XMLSignature.ALGO_ID_MAC_HMAC_SHA384,
++            new Algorithm("", "HmacSHA384", "Mac")
++        );
++        algorithmsMap.put(
++            XMLSignature.ALGO_ID_MAC_HMAC_SHA512,
++            new Algorithm("", "HmacSHA512", "Mac")
++        );
++        algorithmsMap.put(
++            XMLCipher.TRIPLEDES,
++            new Algorithm("DESede", "DESede/CBC/ISO10126Padding", "BlockEncryption", 192)
++        );
++        algorithmsMap.put(
++            XMLCipher.AES_128,
++            new Algorithm("AES", "AES/CBC/ISO10126Padding", "BlockEncryption", 128)
++        );
++        algorithmsMap.put(
++            XMLCipher.AES_192,
++            new Algorithm("AES", "AES/CBC/ISO10126Padding", "BlockEncryption", 192)
++        );
++        algorithmsMap.put(
++            XMLCipher.AES_256,
++            new Algorithm("AES", "AES/CBC/ISO10126Padding", "BlockEncryption", 256)
++        );
++        algorithmsMap.put(
++            XMLCipher.RSA_v1dot5,
++            new Algorithm("RSA", "RSA/ECB/PKCS1Padding", "KeyTransport")
++        );
++        algorithmsMap.put(
++            XMLCipher.RSA_OAEP,
++            new Algorithm("RSA", "RSA/ECB/OAEPPadding", "KeyTransport")
++        );
++        algorithmsMap.put(
++            XMLCipher.DIFFIE_HELLMAN,
++            new Algorithm("", "", "KeyAgreement")
++        );
++        algorithmsMap.put(
++            XMLCipher.TRIPLEDES_KeyWrap,
++            new Algorithm("DESede", "DESedeWrap", "SymmetricKeyWrap", 192)
++        );
++        algorithmsMap.put(
++            XMLCipher.AES_128_KeyWrap,
++            new Algorithm("AES", "AESWrap", "SymmetricKeyWrap", 128)
++        );
++        algorithmsMap.put(
++            XMLCipher.AES_192_KeyWrap,
++            new Algorithm("AES", "AESWrap", "SymmetricKeyWrap", 192)
++        );
++        algorithmsMap.put(
++            XMLCipher.AES_256_KeyWrap,
++            new Algorithm("AES", "AESWrap", "SymmetricKeyWrap", 256)
++        );
++    }
+ 
+-   private static String providerName = null;
+-   /**
+-    * Method init
+-    *
+-    * @param mappingElement
+-    * @throws Exception
+-    */
+-   public static void init(Element mappingElement) throws Exception {
++    /**
++     * Method translateURItoJCEID
++     *
++     * @param algorithmURI
++     * @return the JCE standard name corresponding to the given URI
++     */
++    public static String translateURItoJCEID(String algorithmURI) {
++        if (log.isLoggable(java.util.logging.Level.FINE)) {
++            log.log(java.util.logging.Level.FINE, "Request for URI " + algorithmURI);
++        }
+ 
+-      loadAlgorithms((Element)mappingElement.getElementsByTagName("Algorithms").item(0));
+-   }
++        Algorithm algorithm = algorithmsMap.get(algorithmURI);
++        if (algorithm != null) {
++            return algorithm.jceName;
++        }
++        return null;
++    }
+ 
+-   static void loadAlgorithms( Element algorithmsEl) {
+-       Element[] algorithms = XMLUtils.selectNodes(algorithmsEl.getFirstChild(),Init.CONF_NS,"Algorithm");
+-       uriToJCEName = new HashMap( algorithms.length * 2);
+-       algorithmsMap = new HashMap( algorithms.length * 2);
+-       for (int i = 0 ;i < algorithms.length ;i ++) {
+-           Element el = algorithms[i];
+-           String id = el.getAttribute("URI");
+-           String jceName = el.getAttribute("JCEName");
+-           uriToJCEName.put(id, jceName);
+-           algorithmsMap.put(id, new Algorithm(el));
+-       }
++    /**
++     * Method getAlgorithmClassFromURI
++     * @param algorithmURI
++     * @return the class name that implements this algorithm
++     */
++    public static String getAlgorithmClassFromURI(String algorithmURI) {
++        if (log.isLoggable(java.util.logging.Level.FINE)) {
++            log.log(java.util.logging.Level.FINE, "Request for URI " + algorithmURI);
++        }
+ 
+-   }
++        Algorithm algorithm = algorithmsMap.get(algorithmURI);
++        if (algorithm != null) {
++            return algorithm.algorithmClass;
++        }
++        return null;
++    }
+ 
+-   static Algorithm getAlgorithmMapping(String algoURI) {
+-           return ((Algorithm)algorithmsMap.get(algoURI));
+-   }
++    /**
++     * Returns the keylength in bits for a particular algorithm.
++     *
++     * @param algorithmURI
++     * @return The length of the key used in the algorithm
++     */
++    public static int getKeyLengthFromURI(String algorithmURI) {
++        if (log.isLoggable(java.util.logging.Level.FINE)) {
++            log.log(java.util.logging.Level.FINE, "Request for URI " + algorithmURI);
++        }
++        Algorithm algorithm = algorithmsMap.get(algorithmURI);
++        if (algorithm != null) {
++            return algorithm.keyLength;
++        }
++        return 0;
++    }
+ 
+-   /**
+-    * Method translateURItoJCEID
+-    *
+-    * @param AlgorithmURI
+-    * @return the JCE standard name corresponding to the given URI
+-    *
+-    */
+-   public static String translateURItoJCEID(String AlgorithmURI) {
+-      if (log.isLoggable(java.util.logging.Level.FINE))
+-          log.log(java.util.logging.Level.FINE, "Request for URI " + AlgorithmURI);
++    /**
++     * Method getJCEKeyAlgorithmFromURI
++     *
++     * @param algorithmURI
++     * @return The KeyAlgorithm for the given URI.
++     */
++    public static String getJCEKeyAlgorithmFromURI(String algorithmURI) {
++        if (log.isLoggable(java.util.logging.Level.FINE)) {
++            log.log(java.util.logging.Level.FINE, "Request for URI " + algorithmURI);
++        }
++        Algorithm algorithm = algorithmsMap.get(algorithmURI);
++        if (algorithm != null) {
++            return algorithm.requiredKey;
++        }
++        return null;
++    }
+ 
+-      String jceName = (String) uriToJCEName.get(AlgorithmURI);
+-      return jceName;
+-   }
++    /**
++     * Gets the default Provider for obtaining the security algorithms
++     * @return the default providerId.
++     */
++    public static String getProviderId() {
++        return providerName;
++    }
+ 
+-   /**
+-    * Method getAlgorithmClassFromURI
+-    * NOTE(Raul Benito) It seems a buggy function the loop doesn't do
+-    * anything??
+-    * @param AlgorithmURI
+-    * @return the class name that implements this algorithm
+-    *
+-    */
+-   public static String getAlgorithmClassFromURI(String AlgorithmURI) {
+-       if (log.isLoggable(java.util.logging.Level.FINE))
+-           log.log(java.util.logging.Level.FINE, "Request for URI " + AlgorithmURI);
++    /**
++     * Sets the default Provider for obtaining the security algorithms
++     * @param provider the default providerId.
++     */
++    public static void setProviderId(String provider) {
++        providerName = provider;
++    }
+ 
+-       return ((Algorithm) algorithmsMap.get(AlgorithmURI)).algorithmClass;
+-   }
++    /**
++     * Represents the Algorithm xml element
++     */
++    public static class Algorithm {
+ 
+-   /**
+-    * Returns the keylength in bit for a particular algorithm.
+-    *
+-    * @param AlgorithmURI
+-    * @return The length of the key used in the alogrithm
+-    */
+-   public static int getKeyLengthFromURI(String AlgorithmURI) {
+-       return Integer.parseInt(((Algorithm) algorithmsMap.get(AlgorithmURI)).keyLength);
+-   }
++        final String requiredKey;
++        final String jceName;
++        final String algorithmClass;
++        final int keyLength;
+ 
+-   /**
+-    * Method getJCEKeyAlgorithmFromURI
+-    *
+-    * @param AlgorithmURI
+-    * @return The KeyAlgorithm for the given URI.
+-    *
+-    */
+-   public static String getJCEKeyAlgorithmFromURI(String AlgorithmURI) {
+-
+-        return  ((Algorithm) algorithmsMap.get(AlgorithmURI)).requiredKey;
+-
+-   }
+-
+-   /**
+-    * Gets the default Provider for obtaining the security algorithms
+-    * @return the default providerId.
+-    */
+-   public static String getProviderId() {
+-                return providerName;
+-   }
+-
+-   /**
+-    * Sets the default Provider for obtaining the security algorithms
+-    * @param provider the default providerId.
+-    */
+-   public static void setProviderId(String provider) {
+-                providerName=provider;
+-   }
+-
+-   /**
+-    * Represents the Algorithm xml element
+-    */
+-   public static class Algorithm {
+-            String algorithmClass;
+-            String keyLength;
+-            String requiredKey;
+         /**
+          * Gets data from element
+          * @param el
+          */
+         public Algorithm(Element el) {
+-                algorithmClass=el.getAttribute("AlgorithmClass");
+-            keyLength=el.getAttribute("KeyLength");
+-            requiredKey=el.getAttribute("RequiredKey");
++            requiredKey = el.getAttribute("RequiredKey");
++            jceName = el.getAttribute("JCEName");
++            algorithmClass = el.getAttribute("AlgorithmClass");
++            if (el.hasAttribute("KeyLength")) {
++                keyLength = Integer.parseInt(el.getAttribute("KeyLength"));
++            } else {
++                keyLength = 0;
++            }
+         }
+-   }
++
++        public Algorithm(String requiredKey, String jceName) {
++            this(requiredKey, jceName, null, 0);
++        }
++
++        public Algorithm(String requiredKey, String jceName, String algorithmClass) {
++            this(requiredKey, jceName, algorithmClass, 0);
++        }
++
++        public Algorithm(String requiredKey, String jceName, int keyLength) {
++            this(requiredKey, jceName, null, keyLength);
++        }
++
++        public Algorithm(String requiredKey, String jceName, String algorithmClass, int keyLength) {
++            this.requiredKey = requiredKey;
++            this.jceName = jceName;
++            this.algorithmClass = algorithmClass;
++            this.keyLength = keyLength;
++        }
++    }
++
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm.java b/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm.java
+@@ -2,459 +2,446 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-/*
+- * Copyright  1999-2004 The Apache Software Foundation.
++/**
++ * Licensed to the Apache Software Foundation (ASF) under one
++ * or more contributor license agreements. See the NOTICE file
++ * distributed with this work for additional information
++ * regarding copyright ownership. The ASF licenses this file
++ * to you under the Apache License, Version 2.0 (the
++ * "License"); you may not use this file except in compliance
++ * with the License. You may obtain a copy of the License at
+  *
+- *  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
+  *
+- *      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.
+- *
++ * Unless required by applicable law or agreed to in writing,
++ * software distributed under the License is distributed on an
++ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
++ * KIND, either express or implied. See the License for the
++ * specific language governing permissions and limitations
++ * under the License.
+  */
+ package com.sun.org.apache.xml.internal.security.algorithms;
+ 
+-
+ import java.security.Key;
+ import java.security.SecureRandom;
+ import java.security.spec.AlgorithmParameterSpec;
+-import java.util.HashMap;
+ import java.util.Map;
++import java.util.concurrent.ConcurrentHashMap;
+ 
+ import com.sun.org.apache.xml.internal.security.algorithms.implementations.IntegrityHmac;
++import com.sun.org.apache.xml.internal.security.algorithms.implementations.SignatureBaseRSA;
++import com.sun.org.apache.xml.internal.security.algorithms.implementations.SignatureDSA;
++import com.sun.org.apache.xml.internal.security.algorithms.implementations.SignatureECDSA;
+ import com.sun.org.apache.xml.internal.security.exceptions.AlgorithmAlreadyRegisteredException;
+ import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
++import com.sun.org.apache.xml.internal.security.signature.XMLSignature;
+ import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException;
++import com.sun.org.apache.xml.internal.security.utils.ClassLoaderUtils;
+ import com.sun.org.apache.xml.internal.security.utils.Constants;
++import org.w3c.dom.Attr;
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+ 
+-
+ /**
+- * Allows selection of digital signature's algorithm, private keys, other security parameters, and algorithm's ID.
++ * Allows selection of digital signature's algorithm, private keys, other
++ * security parameters, and algorithm's ID.
+  *
+  * @author Christian Geuer-Pollmann
+  */
+ public class SignatureAlgorithm extends Algorithm {
+ 
+-   /** {@link java.util.logging} logging facility */
+-    static java.util.logging.Logger log =
++    /** {@link org.apache.commons.logging} logging facility */
++    private static java.util.logging.Logger log =
+         java.util.logging.Logger.getLogger(SignatureAlgorithm.class.getName());
+ 
+-   /** Field _alreadyInitialized */
+-   static boolean _alreadyInitialized = false;
++    /** All available algorithm classes are registered here */
++    private static Map<String, Class<? extends SignatureAlgorithmSpi>> algorithmHash =
++        new ConcurrentHashMap<String, Class<? extends SignatureAlgorithmSpi>>();
+ 
+-   /** All available algorithm classes are registered here */
+-   static HashMap _algorithmHash = null;
++    /** Field signatureAlgorithm */
++    private final SignatureAlgorithmSpi signatureAlgorithm;
+ 
+-   static ThreadLocal instancesSigning=new ThreadLocal() {
+-           protected Object initialValue() {
+-                   return new HashMap();
+-           };
+-   };
++    private final String algorithmURI;
+ 
+-   static ThreadLocal instancesVerify=new ThreadLocal() {
+-           protected Object initialValue() {
+-                   return new HashMap();
+-           };
+-   };
++    /**
++     * Constructor SignatureAlgorithm
++     *
++     * @param doc
++     * @param algorithmURI
++     * @throws XMLSecurityException
++     */
++    public SignatureAlgorithm(Document doc, String algorithmURI) throws XMLSecurityException {
++        super(doc, algorithmURI);
++        this.algorithmURI = algorithmURI;
+ 
+-   static ThreadLocal keysSigning=new ThreadLocal() {
+-           protected Object initialValue() {
+-                   return new HashMap();
+-           };
+-   };
+-   static ThreadLocal keysVerify=new ThreadLocal() {
+-           protected Object initialValue() {
+-                   return new HashMap();
+-           };
+-   };
+-//   boolean isForSigning=false;
++        signatureAlgorithm = getSignatureAlgorithmSpi(algorithmURI);
++        signatureAlgorithm.engineGetContextFromElement(this._constructionElement);
++    }
+ 
+-   /** Field _signatureAlgorithm */
+-   protected SignatureAlgorithmSpi _signatureAlgorithm = null;
++    /**
++     * Constructor SignatureAlgorithm
++     *
++     * @param doc
++     * @param algorithmURI
++     * @param hmacOutputLength
++     * @throws XMLSecurityException
++     */
++    public SignatureAlgorithm(
++        Document doc, String algorithmURI, int hmacOutputLength
++    ) throws XMLSecurityException {
++        super(doc, algorithmURI);
++        this.algorithmURI = algorithmURI;
+ 
+-   private String algorithmURI;
++        signatureAlgorithm = getSignatureAlgorithmSpi(algorithmURI);
++        signatureAlgorithm.engineGetContextFromElement(this._constructionElement);
+ 
+-   /**
+-    * Constructor SignatureAlgorithm
+-    *
+-    * @param doc
+-    * @param algorithmURI
+-    * @throws XMLSecurityException
+-    */
+-   public SignatureAlgorithm(Document doc, String algorithmURI)
+-           throws XMLSecurityException {
+-      super(doc, algorithmURI);
+-      this.algorithmURI = algorithmURI;
+-   }
++        signatureAlgorithm.engineSetHMACOutputLength(hmacOutputLength);
++        ((IntegrityHmac)signatureAlgorithm).engineAddContextToElement(_constructionElement);
++    }
+ 
++    /**
++     * Constructor SignatureAlgorithm
++     *
++     * @param element
++     * @param baseURI
++     * @throws XMLSecurityException
++     */
++    public SignatureAlgorithm(Element element, String baseURI) throws XMLSecurityException {
++        this(element, baseURI, false);
++    }
+ 
+-   private void initializeAlgorithm(boolean isForSigning) throws XMLSignatureException {
+-           if (_signatureAlgorithm!=null) {
+-                   return;
+-           }
+-           _signatureAlgorithm=isForSigning ? getInstanceForSigning(algorithmURI) : getInstanceForVerify(algorithmURI);
+-                this._signatureAlgorithm
+-                      .engineGetContextFromElement(this._constructionElement);
+-   }
+-   private static SignatureAlgorithmSpi getInstanceForSigning(String algorithmURI) throws XMLSignatureException {
+-           SignatureAlgorithmSpi result=(SignatureAlgorithmSpi) ((Map)instancesSigning.get()).get(algorithmURI);
+-           if (result!=null) {
+-                   result.reset();
+-                   return result;
+-           }
+-           result=buildSigner(algorithmURI, result);
+-           ((Map)instancesSigning.get()).put(algorithmURI,result);
+-           return result;
+-   }
+-   private static SignatureAlgorithmSpi getInstanceForVerify(String algorithmURI) throws XMLSignatureException {
+-           SignatureAlgorithmSpi result=(SignatureAlgorithmSpi) ((Map)instancesVerify.get()).get(algorithmURI);
+-           if (result!=null) {
+-                   result.reset();
+-                   return result;
+-           }
+-           result=buildSigner(algorithmURI, result);
+-           ((Map)instancesVerify.get()).put(algorithmURI,result);
+-           return result;
+-   }
++    /**
++     * Constructor SignatureAlgorithm
++     *
++     * @param element
++     * @param baseURI
++     * @param secureValidation
++     * @throws XMLSecurityException
++     */
++    public SignatureAlgorithm(
++        Element element, String baseURI, boolean secureValidation
++    ) throws XMLSecurityException {
++        super(element, baseURI);
++        algorithmURI = this.getURI();
+ 
+-   private static SignatureAlgorithmSpi buildSigner(String algorithmURI, SignatureAlgorithmSpi result) throws XMLSignatureException {
++        Attr attr = element.getAttributeNodeNS(null, "Id");
++        if (attr != null) {
++            element.setIdAttributeNode(attr, true);
++        }
++
++        if (secureValidation && (XMLSignature.ALGO_ID_MAC_HMAC_NOT_RECOMMENDED_MD5.equals(algorithmURI)
++            || XMLSignature.ALGO_ID_SIGNATURE_NOT_RECOMMENDED_RSA_MD5.equals(algorithmURI))) {
++            Object exArgs[] = { algorithmURI };
++
++            throw new XMLSecurityException("signature.signatureAlgorithm", exArgs);
++        }
++
++        signatureAlgorithm = getSignatureAlgorithmSpi(algorithmURI);
++        signatureAlgorithm.engineGetContextFromElement(this._constructionElement);
++    }
++
++    /**
++     * Get a SignatureAlgorithmSpi object corresponding to the algorithmURI argument
++     */
++    private static SignatureAlgorithmSpi getSignatureAlgorithmSpi(String algorithmURI)
++        throws XMLSignatureException {
+         try {
+-         Class implementingClass =
+-            SignatureAlgorithm.getImplementingClass(algorithmURI);
+-         if (log.isLoggable(java.util.logging.Level.FINE))
++            Class<? extends SignatureAlgorithmSpi> implementingClass =
++                algorithmHash.get(algorithmURI);
++            if (log.isLoggable(java.util.logging.Level.FINE)) {
+                 log.log(java.util.logging.Level.FINE, "Create URI \"" + algorithmURI + "\" class \""
+                    + implementingClass + "\"");
+-         result=(SignatureAlgorithmSpi) implementingClass.newInstance();
+-         return   result;
+-      }  catch (IllegalAccessException ex) {
+-         Object exArgs[] = { algorithmURI, ex.getMessage() };
++            }
++            return implementingClass.newInstance();
++        }  catch (IllegalAccessException ex) {
++            Object exArgs[] = { algorithmURI, ex.getMessage() };
++            throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs, ex);
++        } catch (InstantiationException ex) {
++            Object exArgs[] = { algorithmURI, ex.getMessage() };
++            throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs, ex);
++        } catch (NullPointerException ex) {
++            Object exArgs[] = { algorithmURI, ex.getMessage() };
++            throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs, ex);
++        }
++    }
+ 
+-         throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs,
+-                                         ex);
+-      } catch (InstantiationException ex) {
+-         Object exArgs[] = { algorithmURI, ex.getMessage() };
+ 
+-         throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs,
+-                                         ex);
+-      } catch (NullPointerException ex) {
+-         Object exArgs[] = { algorithmURI, ex.getMessage() };
++    /**
++     * Proxy method for {@link java.security.Signature#sign()}
++     * which is executed on the internal {@link java.security.Signature} object.
++     *
++     * @return the result of the {@link java.security.Signature#sign()} method
++     * @throws XMLSignatureException
++     */
++    public byte[] sign() throws XMLSignatureException {
++        return signatureAlgorithm.engineSign();
++    }
+ 
+-         throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs,
+-                                         ex);
+-      }
++    /**
++     * Proxy method for {@link java.security.Signature#getAlgorithm}
++     * which is executed on the internal {@link java.security.Signature} object.
++     *
++     * @return the result of the {@link java.security.Signature#getAlgorithm} method
++     */
++    public String getJCEAlgorithmString() {
++        return signatureAlgorithm.engineGetJCEAlgorithmString();
++    }
++
++    /**
++     * Method getJCEProviderName
++     *
++     * @return The Provider of this Signature Algorithm
++     */
++    public String getJCEProviderName() {
++        return signatureAlgorithm.engineGetJCEProviderName();
++    }
++
++    /**
++     * Proxy method for {@link java.security.Signature#update(byte[])}
++     * which is executed on the internal {@link java.security.Signature} object.
++     *
++     * @param input
++     * @throws XMLSignatureException
++     */
++    public void update(byte[] input) throws XMLSignatureException {
++        signatureAlgorithm.engineUpdate(input);
++    }
++
++    /**
++     * Proxy method for {@link java.security.Signature#update(byte)}
++     * which is executed on the internal {@link java.security.Signature} object.
++     *
++     * @param input
++     * @throws XMLSignatureException
++     */
++    public void update(byte input) throws XMLSignatureException {
++        signatureAlgorithm.engineUpdate(input);
++    }
++
++    /**
++     * Proxy method for {@link java.security.Signature#update(byte[], int, int)}
++     * which is executed on the internal {@link java.security.Signature} object.
++     *
++     * @param buf
++     * @param offset
++     * @param len
++     * @throws XMLSignatureException
++     */
++    public void update(byte buf[], int offset, int len) throws XMLSignatureException {
++        signatureAlgorithm.engineUpdate(buf, offset, len);
++    }
++
++    /**
++     * Proxy method for {@link java.security.Signature#initSign(java.security.PrivateKey)}
++     * which is executed on the internal {@link java.security.Signature} object.
++     *
++     * @param signingKey
++     * @throws XMLSignatureException
++     */
++    public void initSign(Key signingKey) throws XMLSignatureException {
++        signatureAlgorithm.engineInitSign(signingKey);
++    }
++
++    /**
++     * Proxy method for {@link java.security.Signature#initSign(java.security.PrivateKey,
++     * java.security.SecureRandom)}
++     * which is executed on the internal {@link java.security.Signature} object.
++     *
++     * @param signingKey
++     * @param secureRandom
++     * @throws XMLSignatureException
++     */
++    public void initSign(Key signingKey, SecureRandom secureRandom) throws XMLSignatureException {
++        signatureAlgorithm.engineInitSign(signingKey, secureRandom);
++    }
++
++    /**
++     * Proxy method for {@link java.security.Signature#initSign(java.security.PrivateKey)}
++     * which is executed on the internal {@link java.security.Signature} object.
++     *
++     * @param signingKey
++     * @param algorithmParameterSpec
++     * @throws XMLSignatureException
++     */
++    public void initSign(
++        Key signingKey, AlgorithmParameterSpec algorithmParameterSpec
++    ) throws XMLSignatureException {
++        signatureAlgorithm.engineInitSign(signingKey, algorithmParameterSpec);
++    }
++
++    /**
++     * Proxy method for {@link java.security.Signature#setParameter(
++     * java.security.spec.AlgorithmParameterSpec)}
++     * which is executed on the internal {@link java.security.Signature} object.
++     *
++     * @param params
++     * @throws XMLSignatureException
++     */
++    public void setParameter(AlgorithmParameterSpec params) throws XMLSignatureException {
++        signatureAlgorithm.engineSetParameter(params);
++    }
++
++    /**
++     * Proxy method for {@link java.security.Signature#initVerify(java.security.PublicKey)}
++     * which is executed on the internal {@link java.security.Signature} object.
++     *
++     * @param verificationKey
++     * @throws XMLSignatureException
++     */
++    public void initVerify(Key verificationKey) throws XMLSignatureException {
++        signatureAlgorithm.engineInitVerify(verificationKey);
++    }
++
++    /**
++     * Proxy method for {@link java.security.Signature#verify(byte[])}
++     * which is executed on the internal {@link java.security.Signature} object.
++     *
++     * @param signature
++     * @return true if if the signature is valid.
++     *
++     * @throws XMLSignatureException
++     */
++    public boolean verify(byte[] signature) throws XMLSignatureException {
++        return signatureAlgorithm.engineVerify(signature);
++    }
++
++    /**
++     * Returns the URI representation of Transformation algorithm
++     *
++     * @return the URI representation of Transformation algorithm
++     */
++    public final String getURI() {
++        return _constructionElement.getAttributeNS(null, Constants._ATT_ALGORITHM);
++    }
++
++    /**
++     * Registers implementing class of the Transform algorithm with algorithmURI
++     *
++     * @param algorithmURI algorithmURI URI representation of <code>Transform algorithm</code>.
++     * @param implementingClass <code>implementingClass</code> the implementing class of
++     * {@link SignatureAlgorithmSpi}
++     * @throws AlgorithmAlreadyRegisteredException if specified algorithmURI is already registered
++     * @throws XMLSignatureException
++     */
++    @SuppressWarnings("unchecked")
++    public static void register(String algorithmURI, String implementingClass)
++       throws AlgorithmAlreadyRegisteredException, ClassNotFoundException,
++           XMLSignatureException {
++        if (log.isLoggable(java.util.logging.Level.FINE)) {
++            log.log(java.util.logging.Level.FINE, "Try to register " + algorithmURI + " " + implementingClass);
++        }
++
++        // are we already registered?
++        Class<? extends SignatureAlgorithmSpi> registeredClass = algorithmHash.get(algorithmURI);
++        if (registeredClass != null) {
++            Object exArgs[] = { algorithmURI, registeredClass };
++            throw new AlgorithmAlreadyRegisteredException(
++                "algorithm.alreadyRegistered", exArgs
++            );
++        }
++        try {
++            Class<? extends SignatureAlgorithmSpi> clazz =
++                (Class<? extends SignatureAlgorithmSpi>)
++                    ClassLoaderUtils.loadClass(implementingClass, SignatureAlgorithm.class);
++            algorithmHash.put(algorithmURI, clazz);
++        } catch (NullPointerException ex) {
++            Object exArgs[] = { algorithmURI, ex.getMessage() };
++            throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs, ex);
++        }
++    }
++
++    /**
++     * Registers implementing class of the Transform algorithm with algorithmURI
++     *
++     * @param algorithmURI algorithmURI URI representation of <code>Transform algorithm</code>.
++     * @param implementingClass <code>implementingClass</code> the implementing class of
++     * {@link SignatureAlgorithmSpi}
++     * @throws AlgorithmAlreadyRegisteredException if specified algorithmURI is already registered
++     * @throws XMLSignatureException
++     */
++    public static void register(String algorithmURI, Class<? extends SignatureAlgorithmSpi> implementingClass)
++       throws AlgorithmAlreadyRegisteredException, ClassNotFoundException,
++           XMLSignatureException {
++        if (log.isLoggable(java.util.logging.Level.FINE)) {
++            log.log(java.util.logging.Level.FINE, "Try to register " + algorithmURI + " " + implementingClass);
++        }
++
++        // are we already registered?
++        Class<? extends SignatureAlgorithmSpi> registeredClass = algorithmHash.get(algorithmURI);
++        if (registeredClass != null) {
++            Object exArgs[] = { algorithmURI, registeredClass };
++            throw new AlgorithmAlreadyRegisteredException(
++                "algorithm.alreadyRegistered", exArgs
++            );
++        }
++        algorithmHash.put(algorithmURI, implementingClass);
++    }
++
++    /**
++     * This method registers the default algorithms.
++     */
++    public static void registerDefaultAlgorithms() {
++        algorithmHash.put(
++            XMLSignature.ALGO_ID_SIGNATURE_DSA, SignatureDSA.class
++        );
++        algorithmHash.put(
++            XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA1, SignatureBaseRSA.SignatureRSASHA1.class
++        );
++        algorithmHash.put(
++            XMLSignature.ALGO_ID_MAC_HMAC_SHA1, IntegrityHmac.IntegrityHmacSHA1.class
++        );
++        algorithmHash.put(
++            XMLSignature.ALGO_ID_SIGNATURE_NOT_RECOMMENDED_RSA_MD5,
++            SignatureBaseRSA.SignatureRSAMD5.class
++        );
++        algorithmHash.put(
++            XMLSignature.ALGO_ID_SIGNATURE_RSA_RIPEMD160,
++            SignatureBaseRSA.SignatureRSARIPEMD160.class
++        );
++        algorithmHash.put(
++            XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA256, SignatureBaseRSA.SignatureRSASHA256.class
++        );
++        algorithmHash.put(
++            XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA384, SignatureBaseRSA.SignatureRSASHA384.class
++        );
++        algorithmHash.put(
++            XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA512, SignatureBaseRSA.SignatureRSASHA512.class
++        );
++        algorithmHash.put(
++            XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA1, SignatureECDSA.SignatureECDSASHA1.class
++        );
++        algorithmHash.put(
++            XMLSignature.ALGO_ID_MAC_HMAC_NOT_RECOMMENDED_MD5, IntegrityHmac.IntegrityHmacMD5.class
++        );
++        algorithmHash.put(
++            XMLSignature.ALGO_ID_MAC_HMAC_RIPEMD160, IntegrityHmac.IntegrityHmacRIPEMD160.class
++        );
++        algorithmHash.put(
++            XMLSignature.ALGO_ID_MAC_HMAC_SHA256, IntegrityHmac.IntegrityHmacSHA256.class
++        );
++        algorithmHash.put(
++            XMLSignature.ALGO_ID_MAC_HMAC_SHA384, IntegrityHmac.IntegrityHmacSHA384.class
++        );
++        algorithmHash.put(
++            XMLSignature.ALGO_ID_MAC_HMAC_SHA512, IntegrityHmac.IntegrityHmacSHA512.class
++        );
++    }
++
++    /**
++     * Method getBaseNamespace
++     *
++     * @return URI of this element
++     */
++    public String getBaseNamespace() {
++        return Constants.SignatureSpecNS;
++    }
++
++    /**
++     * Method getBaseLocalName
++     *
++     * @return Local name
++     */
++    public String getBaseLocalName() {
++        return Constants._TAG_SIGNATUREMETHOD;
++    }
+ }
+-
+-   /**
+-    * Constructor SignatureAlgorithm
+-    *
+-    * @param doc
+-    * @param algorithmURI
+-    * @param HMACOutputLength
+-    * @throws XMLSecurityException
+-    */
+-   public SignatureAlgorithm(
+-           Document doc, String algorithmURI, int HMACOutputLength)
+-              throws XMLSecurityException {
+-
+-      this(doc, algorithmURI);
+-      this.algorithmURI=algorithmURI;
+-      initializeAlgorithm(true);
+-      this._signatureAlgorithm.engineSetHMACOutputLength(HMACOutputLength);
+-      ((IntegrityHmac)this._signatureAlgorithm)
+-         .engineAddContextToElement(this._constructionElement);
+-   }
+-
+-   /**
+-    * Constructor SignatureAlgorithm
+-    *
+-    * @param element
+-    * @param BaseURI
+-    * @throws XMLSecurityException
+-    */
+-   public SignatureAlgorithm(Element element, String BaseURI)
+-           throws XMLSecurityException {
+-
+-      super(element, BaseURI);
+-      algorithmURI = this.getURI();
+-   }
+-
+-   /**
+-    * Proxy method for {@link java.security.Signature#sign()}
+-    * which is executed on the internal {@link java.security.Signature} object.
+-    *
+-    * @return the result of the {@link java.security.Signature#sign()} method
+-    * @throws XMLSignatureException
+-    */
+-   public byte[] sign() throws XMLSignatureException {
+-      return this._signatureAlgorithm.engineSign();
+-   }
+-
+-   /**
+-    * Proxy method for {@link java.security.Signature#getAlgorithm}
+-    * which is executed on the internal {@link java.security.Signature} object.
+-    *
+-    * @return the result of the {@link java.security.Signature#getAlgorithm} method
+-    */
+-   public String getJCEAlgorithmString() {
+-      try {
+-                return getInstanceForVerify(algorithmURI).engineGetJCEAlgorithmString();
+-        } catch (XMLSignatureException e) {
+-                //Ignore.
+-                return null;
+-        }
+-   }
+-
+-   /**
+-    * Method getJCEProviderName
+-    *
+-    * @return The Provider of this Signature Alogrithm
+-    */
+-   public String getJCEProviderName() {
+-      try {
+-                return getInstanceForVerify(algorithmURI).engineGetJCEProviderName();
+-        } catch (XMLSignatureException e) {
+-                return null;
+-        }
+-   }
+-
+-   /**
+-    * Proxy method for {@link java.security.Signature#update(byte[])}
+-    * which is executed on the internal {@link java.security.Signature} object.
+-    *
+-    * @param input
+-    * @throws XMLSignatureException
+-    */
+-   public void update(byte[] input) throws XMLSignatureException {
+-      this._signatureAlgorithm.engineUpdate(input);
+-   }
+-
+-   /**
+-    * Proxy method for {@link java.security.Signature#update(byte)}
+-    * which is executed on the internal {@link java.security.Signature} object.
+-    *
+-    * @param input
+-    * @throws XMLSignatureException
+-    */
+-   public void update(byte input) throws XMLSignatureException {
+-      this._signatureAlgorithm.engineUpdate(input);
+-   }
+-
+-   /**
+-    * Proxy method for {@link java.security.Signature#update(byte[], int, int)}
+-    * which is executed on the internal {@link java.security.Signature} object.
+-    *
+-    * @param buf
+-    * @param offset
+-    * @param len
+-    * @throws XMLSignatureException
+-    */
+-   public void update(byte buf[], int offset, int len)
+-           throws XMLSignatureException {
+-      this._signatureAlgorithm.engineUpdate(buf, offset, len);
+-   }
+-
+-   /**
+-    * Proxy method for {@link java.security.Signature#initSign(java.security.PrivateKey)}
+-    * which is executed on the internal {@link java.security.Signature} object.
+-    *
+-    * @param signingKey
+-    * @throws XMLSignatureException
+-    */
+-   public void initSign(Key signingKey) throws XMLSignatureException {
+-           initializeAlgorithm(true);
+-           Map map=(Map)keysSigning.get();
+-       if (map.get(this.algorithmURI)==signingKey) {
+-           return;
+-       }
+-       map.put(this.algorithmURI,signingKey);
+-           this._signatureAlgorithm.engineInitSign(signingKey);
+-   }
+-
+-   /**
+-    * Proxy method for {@link java.security.Signature#initSign(java.security.PrivateKey, java.security.SecureRandom)}
+-    * which is executed on the internal {@link java.security.Signature} object.
+-    *
+-    * @param signingKey
+-    * @param secureRandom
+-    * @throws XMLSignatureException
+-    */
+-   public void initSign(Key signingKey, SecureRandom secureRandom)
+-           throws XMLSignatureException {
+-           initializeAlgorithm(true);
+-      this._signatureAlgorithm.engineInitSign(signingKey, secureRandom);
+-   }
+-
+-   /**
+-    * Proxy method for {@link java.security.Signature#initSign(java.security.PrivateKey)}
+-    * which is executed on the internal {@link java.security.Signature} object.
+-    *
+-    * @param signingKey
+-    * @param algorithmParameterSpec
+-    * @throws XMLSignatureException
+-    */
+-   public void initSign(
+-           Key signingKey, AlgorithmParameterSpec algorithmParameterSpec)
+-              throws XMLSignatureException {
+-           initializeAlgorithm(true);
+-      this._signatureAlgorithm.engineInitSign(signingKey,
+-                                              algorithmParameterSpec);
+-   }
+-
+-   /**
+-    * Proxy method for {@link java.security.Signature#setParameter(java.security.spec.AlgorithmParameterSpec)}
+-    * which is executed on the internal {@link java.security.Signature} object.
+-    *
+-    * @param params
+-    * @throws XMLSignatureException
+-    */
+-   public void setParameter(AlgorithmParameterSpec params)
+-           throws XMLSignatureException {
+-      this._signatureAlgorithm.engineSetParameter(params);
+-   }
+-
+-   /**
+-    * Proxy method for {@link java.security.Signature#initVerify(java.security.PublicKey)}
+-    * which is executed on the internal {@link java.security.Signature} object.
+-    *
+-    * @param verificationKey
+-    * @throws XMLSignatureException
+-    */
+-   public void initVerify(Key verificationKey) throws XMLSignatureException {
+-           initializeAlgorithm(false);
+-           Map map=(Map)keysVerify.get();
+-           if (map.get(this.algorithmURI)==verificationKey) {
+-           return;
+-       }
+-           map.put(this.algorithmURI,verificationKey);
+-           this._signatureAlgorithm.engineInitVerify(verificationKey);
+-   }
+-
+-   /**
+-    * Proxy method for {@link java.security.Signature#verify(byte[])}
+-    * which is executed on the internal {@link java.security.Signature} object.
+-    *
+-    * @param signature
+-    * @return true if if the signature is valid.
+-    *
+-    * @throws XMLSignatureException
+-    */
+-   public boolean verify(byte[] signature) throws XMLSignatureException {
+-      return this._signatureAlgorithm.engineVerify(signature);
+-   }
+-
+-   /**
+-    * Returns the URI representation of Transformation algorithm
+-    *
+-    * @return the URI representation of Transformation algorithm
+-    */
+-   public final String getURI() {
+-      return this._constructionElement.getAttributeNS(null,
+-              Constants._ATT_ALGORITHM);
+-   }
+-
+-   /**
+-    * Initalizes for this {@link com.sun.org.apache.xml.internal.security.transforms.Transform}
+-    *
+-    */
+-   public static void providerInit() {
+-
+-      if (SignatureAlgorithm.log == null) {
+-         SignatureAlgorithm.log =
+-            java.util.logging.Logger
+-               .getLogger(SignatureAlgorithm.class.getName());
+-      }
+-
+-      log.log(java.util.logging.Level.FINE, "Init() called");
+-
+-      if (!SignatureAlgorithm._alreadyInitialized) {
+-         SignatureAlgorithm._algorithmHash = new HashMap(10);
+-         SignatureAlgorithm._alreadyInitialized = true;
+-      }
+-   }
+-
+-   /**
+-    * Registers implementing class of the Transform algorithm with algorithmURI
+-    *
+-    * @param algorithmURI algorithmURI URI representation of <code>Transform algorithm</code>.
+-    * @param implementingClass <code>implementingClass</code> the implementing class of {@link SignatureAlgorithmSpi}
+-    * @throws AlgorithmAlreadyRegisteredException if specified algorithmURI is already registered
+-    * @throws XMLSignatureException
+-    */
+-   public static void register(String algorithmURI, String implementingClass)
+-           throws AlgorithmAlreadyRegisteredException,XMLSignatureException {
+-
+-      {
+-         if (log.isLoggable(java.util.logging.Level.FINE))
+-                log.log(java.util.logging.Level.FINE, "Try to register " + algorithmURI + " " + implementingClass);
+-
+-         // are we already registered?
+-         Class registeredClassClass =
+-            SignatureAlgorithm.getImplementingClass(algorithmURI);
+-                 if (registeredClassClass!=null) {
+-                         String registeredClass = registeredClassClass.getName();
+-
+-                         if ((registeredClass != null) && (registeredClass.length() != 0)) {
+-                                 Object exArgs[] = { algorithmURI, registeredClass };
+-
+-                                 throw new AlgorithmAlreadyRegisteredException(
+-                                                 "algorithm.alreadyRegistered", exArgs);
+-                         }
+-                 }
+-                 try {
+-                         SignatureAlgorithm._algorithmHash.put(algorithmURI, Class.forName(implementingClass));
+-              } catch (ClassNotFoundException ex) {
+-                 Object exArgs[] = { algorithmURI, ex.getMessage() };
+-
+-                 throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs,
+-                                                 ex);
+-              } catch (NullPointerException ex) {
+-                 Object exArgs[] = { algorithmURI, ex.getMessage() };
+-
+-                 throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs,
+-                                                 ex);
+-              }
+-
+-      }
+-   }
+-
+-   /**
+-    * Method getImplementingClass
+-    *
+-    * @param URI
+-    * @return the class that implements the URI
+-    */
+-   private static Class getImplementingClass(String URI) {
+-
+-      if (SignatureAlgorithm._algorithmHash == null) {
+-         return null;
+-      }
+-
+-      return (Class) SignatureAlgorithm._algorithmHash.get(URI);
+-   }
+-
+-   /**
+-    * Method getBaseNamespace
+-    *
+-    * @return URI of this element
+-    */
+-   public String getBaseNamespace() {
+-      return Constants.SignatureSpecNS;
+-   }
+-
+-   /**
+-    * Method getBaseLocalName
+-    *
+-    * @return Local name
+-    */
+-   public String getBaseLocalName() {
+-      return Constants._TAG_SIGNATUREMETHOD;
+-   }
+-}
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/Canonicalizer.java b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/Canonicalizer.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/Canonicalizer.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/Canonicalizer.java
+@@ -2,33 +2,43 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-/*
+- * Copyright  1999-2008 The Apache Software Foundation.
++/**
++ * Licensed to the Apache Software Foundation (ASF) under one
++ * or more contributor license agreements. See the NOTICE file
++ * distributed with this work for additional information
++ * regarding copyright ownership. The ASF licenses this file
++ * to you under the Apache License, Version 2.0 (the
++ * "License"); you may not use this file except in compliance
++ * with the License. You may obtain a copy of the License at
+  *
+- *  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
+  *
+- *      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.
+- *
++ * Unless required by applicable law or agreed to in writing,
++ * software distributed under the License is distributed on an
++ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
++ * KIND, either express or implied. See the License for the
++ * specific language governing permissions and limitations
++ * under the License.
+  */
+ package com.sun.org.apache.xml.internal.security.c14n;
+ 
+ import java.io.ByteArrayInputStream;
++import java.io.InputStream;
+ import java.io.OutputStream;
+-import java.util.HashMap;
+ import java.util.Map;
+ import java.util.Set;
++import java.util.concurrent.ConcurrentHashMap;
+ 
++import javax.xml.XMLConstants;
+ import javax.xml.parsers.DocumentBuilder;
+ import javax.xml.parsers.DocumentBuilderFactory;
+ 
++import com.sun.org.apache.xml.internal.security.c14n.implementations.Canonicalizer11_OmitComments;
++import com.sun.org.apache.xml.internal.security.c14n.implementations.Canonicalizer11_WithComments;
++import com.sun.org.apache.xml.internal.security.c14n.implementations.Canonicalizer20010315ExclOmitComments;
++import com.sun.org.apache.xml.internal.security.c14n.implementations.Canonicalizer20010315ExclWithComments;
++import com.sun.org.apache.xml.internal.security.c14n.implementations.Canonicalizer20010315OmitComments;
++import com.sun.org.apache.xml.internal.security.c14n.implementations.Canonicalizer20010315WithComments;
+ import com.sun.org.apache.xml.internal.security.exceptions.AlgorithmAlreadyRegisteredException;
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Node;
+@@ -45,7 +55,7 @@
+     public static final String ENCODING = "UTF8";
+ 
+     /**
+-     * XPath Expresion for selecting every node and continuous comments joined
++     * XPath Expression for selecting every node and continuous comments joined
+      * in only one node
+      */
+     public static final String XPATH_C14N_WITH_COMMENTS_SINGLE_NODE =
+@@ -82,22 +92,10 @@
+     public static final String ALGO_ID_C14N11_WITH_COMMENTS =
+         ALGO_ID_C14N11_OMIT_COMMENTS + "#WithComments";
+ 
+-    static boolean _alreadyInitialized = false;
+-    static Map _canonicalizerHash = null;
++    private static Map<String, Class<? extends CanonicalizerSpi>> canonicalizerHash =
++        new ConcurrentHashMap<String, Class<? extends CanonicalizerSpi>>();
+ 
+-    protected CanonicalizerSpi canonicalizerSpi = null;
+-
+-    /**
+-     * Method init
+-     *
+-     */
+-    public static void init() {
+-
+-        if (!Canonicalizer._alreadyInitialized) {
+-            Canonicalizer._canonicalizerHash = new HashMap(10);
+-            Canonicalizer._alreadyInitialized = true;
+-        }
+-    }
++    private final CanonicalizerSpi canonicalizerSpi;
+ 
+     /**
+      * Constructor Canonicalizer
+@@ -105,20 +103,18 @@
+      * @param algorithmURI
+      * @throws InvalidCanonicalizerException
+      */
+-    private Canonicalizer(String algorithmURI)
+-           throws InvalidCanonicalizerException {
++    private Canonicalizer(String algorithmURI) throws InvalidCanonicalizerException {
++        try {
++            Class<? extends CanonicalizerSpi> implementingClass =
++                canonicalizerHash.get(algorithmURI);
+ 
+-        try {
+-            Class implementingClass = getImplementingClass(algorithmURI);
+-
+-            this.canonicalizerSpi =
+-                (CanonicalizerSpi) implementingClass.newInstance();
+-            this.canonicalizerSpi.reset=true;
++            canonicalizerSpi = implementingClass.newInstance();
++            canonicalizerSpi.reset = true;
+         } catch (Exception e) {
+             Object exArgs[] = { algorithmURI };
+-
+             throw new InvalidCanonicalizerException(
+-               "signature.Canonicalizer.UnknownCanonicalizer", exArgs);
++                "signature.Canonicalizer.UnknownCanonicalizer", exArgs, e
++            );
+         }
+     }
+ 
+@@ -126,15 +122,12 @@
+      * Method getInstance
+      *
+      * @param algorithmURI
+-     * @return a Conicicalizer instance ready for the job
++     * @return a Canonicalizer instance ready for the job
+      * @throws InvalidCanonicalizerException
+      */
+     public static final Canonicalizer getInstance(String algorithmURI)
+-           throws InvalidCanonicalizerException {
+-
+-        Canonicalizer c14nizer = new Canonicalizer(algorithmURI);
+-
+-        return c14nizer;
++        throws InvalidCanonicalizerException {
++        return new Canonicalizer(algorithmURI);
+     }
+ 
+     /**
+@@ -144,24 +137,71 @@
+      * @param implementingClass
+      * @throws AlgorithmAlreadyRegisteredException
+      */
++    @SuppressWarnings("unchecked")
+     public static void register(String algorithmURI, String implementingClass)
+-           throws AlgorithmAlreadyRegisteredException {
+-
++        throws AlgorithmAlreadyRegisteredException, ClassNotFoundException {
+         // check whether URI is already registered
+-        Class registeredClass = getImplementingClass(algorithmURI);
++        Class<? extends CanonicalizerSpi> registeredClass =
++            canonicalizerHash.get(algorithmURI);
+ 
+         if (registeredClass != null)  {
+             Object exArgs[] = { algorithmURI, registeredClass };
+-
+-            throw new AlgorithmAlreadyRegisteredException(
+-                "algorithm.alreadyRegistered", exArgs);
++            throw new AlgorithmAlreadyRegisteredException("algorithm.alreadyRegistered", exArgs);
+         }
+ 
+-        try {
+-            _canonicalizerHash.put(algorithmURI, Class.forName(implementingClass));
+-        } catch (ClassNotFoundException e) {
+-            throw new RuntimeException("c14n class not found");
++        canonicalizerHash.put(
++            algorithmURI, (Class<? extends CanonicalizerSpi>)Class.forName(implementingClass)
++        );
++    }
++
++    /**
++     * Method register
++     *
++     * @param algorithmURI
++     * @param implementingClass
++     * @throws AlgorithmAlreadyRegisteredException
++     */
++    public static void register(String algorithmURI, Class<CanonicalizerSpi> implementingClass)
++        throws AlgorithmAlreadyRegisteredException, ClassNotFoundException {
++        // check whether URI is already registered
++        Class<? extends CanonicalizerSpi> registeredClass = canonicalizerHash.get(algorithmURI);
++
++        if (registeredClass != null)  {
++            Object exArgs[] = { algorithmURI, registeredClass };
++            throw new AlgorithmAlreadyRegisteredException("algorithm.alreadyRegistered", exArgs);
+         }
++
++        canonicalizerHash.put(algorithmURI, implementingClass);
++    }
++
++    /**
++     * This method registers the default algorithms.
++     */
++    public static void registerDefaultAlgorithms() {
++        canonicalizerHash.put(
++            Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS,
++            Canonicalizer20010315OmitComments.class
++        );
++        canonicalizerHash.put(
++            Canonicalizer.ALGO_ID_C14N_WITH_COMMENTS,
++            Canonicalizer20010315WithComments.class
++        );
++        canonicalizerHash.put(
++            Canonicalizer.ALGO_ID_C14N_EXCL_OMIT_COMMENTS,
++            Canonicalizer20010315ExclOmitComments.class
++        );
++        canonicalizerHash.put(
++            Canonicalizer.ALGO_ID_C14N_EXCL_WITH_COMMENTS,
++            Canonicalizer20010315ExclWithComments.class
++        );
++        canonicalizerHash.put(
++            Canonicalizer.ALGO_ID_C14N11_OMIT_COMMENTS,
++            Canonicalizer11_OmitComments.class
++        );
++        canonicalizerHash.put(
++            Canonicalizer.ALGO_ID_C14N11_WITH_COMMENTS,
++            Canonicalizer11_WithComments.class
++        );
+     }
+ 
+     /**
+@@ -170,7 +210,7 @@
+      * @return the URI defined for this c14n instance.
+      */
+     public final String getURI() {
+-        return this.canonicalizerSpi.engineGetURI();
++        return canonicalizerSpi.engineGetURI();
+     }
+ 
+     /**
+@@ -179,7 +219,7 @@
+      * @return true if the c14n respect the comments.
+      */
+     public boolean getIncludeComments() {
+-        return this.canonicalizerSpi.engineGetIncludeComments();
++        return canonicalizerSpi.engineGetIncludeComments();
+     }
+ 
+     /**
+@@ -188,33 +228,32 @@
+      * wrapped with a <CODE>>a<...>/a<</CODE>.
+      *
+      * @param inputBytes
+-     * @return the result of the conicalization.
++     * @return the result of the canonicalization.
+      * @throws CanonicalizationException
+      * @throws java.io.IOException
+      * @throws javax.xml.parsers.ParserConfigurationException
+      * @throws org.xml.sax.SAXException
+      */
+     public byte[] canonicalize(byte[] inputBytes)
+-           throws javax.xml.parsers.ParserConfigurationException,
+-                  java.io.IOException, org.xml.sax.SAXException,
+-                  CanonicalizationException {
+-
+-        ByteArrayInputStream bais = new ByteArrayInputStream(inputBytes);
++        throws javax.xml.parsers.ParserConfigurationException,
++        java.io.IOException, org.xml.sax.SAXException, CanonicalizationException {
++        InputStream bais = new ByteArrayInputStream(inputBytes);
+         InputSource in = new InputSource(bais);
+         DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
++        dfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
+ 
+         dfactory.setNamespaceAware(true);
+ 
+-        // needs to validate for ID attribute nomalization
++        // needs to validate for ID attribute normalization
+         dfactory.setValidating(true);
+ 
+         DocumentBuilder db = dfactory.newDocumentBuilder();
+ 
+         /*
+          * for some of the test vectors from the specification,
+-         * there has to be a validatin parser for ID attributes, default
++         * there has to be a validating parser for ID attributes, default
+          * attribute values, NMTOKENS, etc.
+-         * Unfortunaltely, the test vectors do use different DTDs or
++         * Unfortunately, the test vectors do use different DTDs or
+          * even no DTD. So Xerces 1.3.1 fires many warnings about using
+          * ErrorHandlers.
+          *
+@@ -230,28 +269,23 @@
+          * declaration are used to help create the canonical form, even
+          * though the document type declaration is not retained in the
+          * canonical form.
+-         *
+          */
+-        db.setErrorHandler(new com.sun.org.apache.xml.internal.security.utils
+-            .IgnoreAllErrorHandler());
++        db.setErrorHandler(new com.sun.org.apache.xml.internal.security.utils.IgnoreAllErrorHandler());
+ 
+         Document document = db.parse(in);
+-        byte result[] = this.canonicalizeSubtree(document);
+-
+-        return result;
++        return this.canonicalizeSubtree(document);
+     }
+ 
+     /**
+      * Canonicalizes the subtree rooted by <CODE>node</CODE>.
+      *
+-     * @param node The node to canicalize
++     * @param node The node to canonicalize
+      * @return the result of the c14n.
+      *
+      * @throws CanonicalizationException
+      */
+-    public byte[] canonicalizeSubtree(Node node)
+-           throws CanonicalizationException {
+-        return this.canonicalizerSpi.engineCanonicalizeSubTree(node);
++    public byte[] canonicalizeSubtree(Node node) throws CanonicalizationException {
++        return canonicalizerSpi.engineCanonicalizeSubTree(node);
+     }
+ 
+     /**
+@@ -263,9 +297,8 @@
+      * @throws CanonicalizationException
+      */
+     public byte[] canonicalizeSubtree(Node node, String inclusiveNamespaces)
+-           throws CanonicalizationException {
+-        return this.canonicalizerSpi.engineCanonicalizeSubTree(node,
+-              inclusiveNamespaces);
++        throws CanonicalizationException {
++        return canonicalizerSpi.engineCanonicalizeSubTree(node, inclusiveNamespaces);
+     }
+ 
+     /**
+@@ -277,8 +310,8 @@
+      * @throws CanonicalizationException
+      */
+     public byte[] canonicalizeXPathNodeSet(NodeList xpathNodeSet)
+-           throws CanonicalizationException {
+-        return this.canonicalizerSpi.engineCanonicalizeXPathNodeSet(xpathNodeSet);
++        throws CanonicalizationException {
++        return canonicalizerSpi.engineCanonicalizeXPathNodeSet(xpathNodeSet);
+     }
+ 
+     /**
+@@ -291,10 +324,10 @@
+      * @throws CanonicalizationException
+      */
+     public byte[] canonicalizeXPathNodeSet(
+-           NodeList xpathNodeSet, String inclusiveNamespaces)
+-              throws CanonicalizationException {
+-        return this.canonicalizerSpi.engineCanonicalizeXPathNodeSet(xpathNodeSet,
+-              inclusiveNamespaces);
++        NodeList xpathNodeSet, String inclusiveNamespaces
++    ) throws CanonicalizationException {
++        return
++            canonicalizerSpi.engineCanonicalizeXPathNodeSet(xpathNodeSet, inclusiveNamespaces);
+     }
+ 
+     /**
+@@ -304,9 +337,9 @@
+      * @return the result of the c14n.
+      * @throws CanonicalizationException
+      */
+-    public byte[] canonicalizeXPathNodeSet(Set xpathNodeSet)
+-           throws CanonicalizationException {
+-        return this.canonicalizerSpi.engineCanonicalizeXPathNodeSet(xpathNodeSet);
++    public byte[] canonicalizeXPathNodeSet(Set<Node> xpathNodeSet)
++        throws CanonicalizationException {
++        return canonicalizerSpi.engineCanonicalizeXPathNodeSet(xpathNodeSet);
+     }
+ 
+     /**
+@@ -317,10 +350,11 @@
+      * @return the result of the c14n.
+      * @throws CanonicalizationException
+      */
+-    public byte[] canonicalizeXPathNodeSet(Set xpathNodeSet,
+-        String inclusiveNamespaces) throws CanonicalizationException {
+-        return this.canonicalizerSpi.engineCanonicalizeXPathNodeSet(xpathNodeSet,
+-            inclusiveNamespaces);
++    public byte[] canonicalizeXPathNodeSet(
++        Set<Node> xpathNodeSet, String inclusiveNamespaces
++    ) throws CanonicalizationException {
++        return
++            canonicalizerSpi.engineCanonicalizeXPathNodeSet(xpathNodeSet, inclusiveNamespaces);
+     }
+ 
+     /**
+@@ -329,7 +363,7 @@
+      * @param os
+      */
+     public void setWriter(OutputStream os) {
+-        this.canonicalizerSpi.setWriter(os);
++        canonicalizerSpi.setWriter(os);
+     }
+ 
+     /**
+@@ -338,23 +372,14 @@
+      * @return the name of the implementing {@link CanonicalizerSpi} class
+      */
+     public String getImplementingCanonicalizerClass() {
+-        return this.canonicalizerSpi.getClass().getName();
+-    }
+-
+-    /**
+-     * Method getImplementingClass
+-     *
+-     * @param URI
+-     * @return the name of the class that implements the given URI
+-     */
+-    private static Class getImplementingClass(String URI) {
+-        return (Class) _canonicalizerHash.get(URI);
++        return canonicalizerSpi.getClass().getName();
+     }
+ 
+     /**
+      * Set the canonicalizer behaviour to not reset.
+      */
+     public void notReset() {
+-        this.canonicalizerSpi.reset = false;
++        canonicalizerSpi.reset = false;
+     }
++
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/CanonicalizerSpi.java b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/CanonicalizerSpi.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/CanonicalizerSpi.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/CanonicalizerSpi.java
+@@ -26,8 +26,10 @@
+ import java.io.OutputStream;
+ import java.util.Set;
+ 
++import javax.xml.XMLConstants;
+ import javax.xml.parsers.DocumentBuilder;
+ import javax.xml.parsers.DocumentBuilderFactory;
++import javax.xml.xpath.XPath;
+ 
+ import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
+ import org.w3c.dom.Document;
+@@ -66,6 +68,7 @@
+       java.io.ByteArrayInputStream bais = new ByteArrayInputStream(inputBytes);
+       InputSource in = new InputSource(bais);
+       DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
++      dfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
+ 
+       // needs to validate for ID attribute nomalization
+       dfactory.setNamespaceAware(true);
+@@ -151,7 +154,7 @@
+     * @return the c14n bytes
+     * @throws CanonicalizationException
+     */
+-   public abstract byte[] engineCanonicalizeXPathNodeSet(Set xpathNodeSet)
++   public abstract byte[] engineCanonicalizeXPathNodeSet(Set<Node> xpathNodeSet)
+       throws CanonicalizationException;
+ 
+    /**
+@@ -162,7 +165,7 @@
+     * @return the c14n bytes
+     * @throws CanonicalizationException
+     */
+-   public abstract byte[] engineCanonicalizeXPathNodeSet(Set xpathNodeSet, String inclusiveNamespaces)
++   public abstract byte[] engineCanonicalizeXPathNodeSet(Set<Node> xpathNodeSet, String inclusiveNamespaces)
+       throws CanonicalizationException;
+ 
+    /**
+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
+@@ -41,6 +41,7 @@
+ import javax.crypto.IllegalBlockSizeException;
+ import javax.crypto.NoSuchPaddingException;
+ import javax.crypto.spec.IvParameterSpec;
++import javax.xml.XMLConstants;
+ import javax.xml.parsers.DocumentBuilder;
+ import javax.xml.parsers.DocumentBuilderFactory;
+ import javax.xml.parsers.ParserConfigurationException;
+@@ -1981,22 +1982,23 @@
+             try {
+                 DocumentBuilderFactory dbf =
+                     DocumentBuilderFactory.newInstance();
+-                                dbf.setNamespaceAware(true);
+-                                dbf.setAttribute("http://xml.org/sax/features/namespaces", Boolean.TRUE);
+-                                DocumentBuilder db = dbf.newDocumentBuilder();
+-                                Document d = db.parse(
+-                                    new InputSource(new StringReader(fragment)));
+-
+-                                Element fragElt = (Element) _contextDocument.importNode(
++                dbf.setNamespaceAware(true);
++                dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
++                dbf.setAttribute("http://xml.org/sax/features/namespaces", Boolean.TRUE);
++                DocumentBuilder db = dbf.newDocumentBuilder();
++                Document d = db.parse(
++                    new InputSource(new StringReader(fragment)));
++
++                Element fragElt = (Element) _contextDocument.importNode(
+                                                  d.getDocumentElement(), true);
+-                                result = _contextDocument.createDocumentFragment();
+-                                Node child = fragElt.getFirstChild();
+-                                while (child != null) {
+-                                        fragElt.removeChild(child);
+-                                        result.appendChild(child);
+-                                        child = fragElt.getFirstChild();
+-                                }
+-                                // String outp = serialize(d);
++                result = _contextDocument.createDocumentFragment();
++                Node child = fragElt.getFirstChild();
++                while (child != null) {
++                    fragElt.removeChild(child);
++                    result.appendChild(child);
++                    child = fragElt.getFirstChild();
++                }
++                // String outp = serialize(d);
+ 
+             } catch (SAXException se) {
+                 throw new XMLEncryptionException("empty", se);
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/KeyInfo.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/KeyInfo.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/KeyInfo.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/KeyInfo.java
+@@ -97,12 +97,12 @@
+    /** {@link java.util.logging} logging facility */
+     static java.util.logging.Logger log =
+         java.util.logging.Logger.getLogger(KeyInfo.class.getName());
+-    List x509Datas=null;
+-    List encryptedKeys=null;
++    List<X509Data> x509Datas=null;
++    List<EncryptedKey> encryptedKeys=null;
+ 
+-    static final List nullList;
++    static final List<StorageResolver> nullList;
+     static {
+-        List list = new ArrayList();
++        List<StorageResolver> list = new ArrayList<StorageResolver>(1);
+         list.add(null);
+         nullList = Collections.unmodifiableList(list);
+     }
+@@ -297,7 +297,7 @@
+     */
+    public void add(X509Data x509data) {
+           if (x509Datas==null)
+-                  x509Datas=new ArrayList();
++                  x509Datas=new ArrayList<X509Data>();
+           x509Datas.add(x509data);
+          this._constructionElement.appendChild(x509data.getElement());
+          XMLUtils.addReturnToElement(this._constructionElement);
+@@ -313,7 +313,7 @@
+         public void add(EncryptedKey encryptedKey)
+                 throws XMLEncryptionException {
+                         if (encryptedKeys==null)
+-                                encryptedKeys=new ArrayList();
++                                encryptedKeys=new ArrayList<EncryptedKey>();
+                         encryptedKeys.add(encryptedKey);
+                         XMLCipher cipher = XMLCipher.getInstance();
+                         this._constructionElement.appendChild(cipher.martial(encryptedKey));
+@@ -541,7 +541,7 @@
+     */
+    public X509Data itemX509Data(int i) throws XMLSecurityException {
+            if (x509Datas!=null) {
+-                   return (X509Data) x509Datas.get(i);
++                   return x509Datas.get(i);
+            }
+       Element e = XMLUtils.selectDsNode(this._constructionElement.getFirstChild(),
+                                                 Constants._TAG_X509DATA,i);
+@@ -562,7 +562,7 @@
+ 
+         public EncryptedKey itemEncryptedKey(int i) throws XMLSecurityException {
+                 if (encryptedKeys!=null) {
+-                        return (EncryptedKey) encryptedKeys.get(i);
++                        return encryptedKeys.get(i);
+                 }
+                 Element e =
+                         XMLUtils.selectXencNode(this._constructionElement.getFirstChild(),
+@@ -719,42 +719,36 @@
+       return null;
+    }
+ 
+-   /**
+-    * Searches the library wide keyresolvers for public keys
+-    *
+-    * @return The publick contained in this Node.
+-    * @throws KeyResolverException
+-    */
+-   PublicKey getPublicKeyFromStaticResolvers() throws KeyResolverException {
+-          int length=KeyResolver.length();
+-          int storageLength=this._storageResolvers.size();
+-          Iterator it= KeyResolver.iterator();
+-      for (int i = 0; i < length; i++) {
+-         KeyResolverSpi keyResolver = (KeyResolverSpi) it.next();
+-         Node currentChild=this._constructionElement.getFirstChild();
+-         String uri= this.getBaseURI();
+-         while (currentChild!=null)      {
+-            if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
+-                  for (int k = 0; k < storageLength; k++) {
+-                     StorageResolver storage =
+-                        (StorageResolver) this._storageResolvers.get(k);
++    /**
++     * Searches the library wide keyresolvers for public keys
++     *
++     * @return The public key contained in this Node.
++     * @throws KeyResolverException
++     */
++    PublicKey getPublicKeyFromStaticResolvers() throws KeyResolverException {
++        Iterator<KeyResolverSpi> it = KeyResolver.iterator();
++        while (it.hasNext()) {
++            KeyResolverSpi keyResolver = it.next();
++            Node currentChild = this._constructionElement.getFirstChild();
++            String uri = this.getBaseURI();
++            while (currentChild != null) {
++                if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
++                    for (StorageResolver storage : _storageResolvers) {
++                        PublicKey pk =
++                            keyResolver.engineLookupAndResolvePublicKey(
++                                (Element) currentChild, uri, storage
++                            );
+ 
+-                     PublicKey pk =
+-                           keyResolver.engineLookupAndResolvePublicKey((Element) currentChild,
+-                                                       uri,
+-                                                        storage);
+-
+-                     if (pk != null) {
+-                         KeyResolver.hit(it);
+-                         return pk;
+-                     }
+-                  }
++                        if (pk != null) {
++                            return pk;
++                        }
++                    }
++                }
++                currentChild = currentChild.getNextSibling();
+             }
+-            currentChild=currentChild.getNextSibling();
+-         }
+-      }
+-      return null;
+-   }
++        }
++        return null;
++    }
+ 
+    /**
+     * Searches the per-KeyInfo keyresolvers for public keys
+@@ -776,7 +770,7 @@
+             if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
+                for (int k = 0; k < storageLength; k++) {
+                    StorageResolver storage =
+-                      (StorageResolver) this._storageResolvers.get(k);
++                       this._storageResolvers.get(k);
+                    PublicKey pk = keyResolver
+                            .engineLookupAndResolvePublicKey((Element) currentChild, uri, storage);
+ 
+@@ -829,81 +823,83 @@
+       return null;
+    }
+ 
+-   /**
+-    * This method uses each System-wide {@link KeyResolver} to search the
+-    * child elements. Each combination of {@link KeyResolver} and child element
+-    * is checked against all {@link StorageResolver}s.
+-    *
+-    * @return The certificate contined in this KeyInfo
+-    * @throws KeyResolverException
+-    */
+-   X509Certificate getX509CertificateFromStaticResolvers()
+-           throws KeyResolverException {
+-      if (log.isLoggable(java.util.logging.Level.FINE))
+-        log.log(java.util.logging.Level.FINE, "Start getX509CertificateFromStaticResolvers() with "
+-                + KeyResolver.length() + " resolvers");
+-      String uri=this.getBaseURI();
+-      int length= KeyResolver.length();
+-      int storageLength=this._storageResolvers.size();
+-      Iterator it = KeyResolver.iterator();
+-      for (int i = 0; i <length; i++) {
+-         KeyResolverSpi keyResolver = (KeyResolverSpi) it.next();
+-         X509Certificate cert= applyCurrentResolver(uri, storageLength, keyResolver);
+-         if (cert!=null) {
+-                 KeyResolver.hit(it);
+-                 return cert;
+-         }
+-      }
+-      return null;
+-   }
++    /**
++     * This method uses each System-wide {@link KeyResolver} to search the
++     * child elements. Each combination of {@link KeyResolver} and child element
++     * is checked against all {@link StorageResolver}s.
++     *
++     * @return The certificate contained in this KeyInfo
++     * @throws KeyResolverException
++     */
++    X509Certificate getX509CertificateFromStaticResolvers()
++        throws KeyResolverException {
++        if (log.isLoggable(java.util.logging.Level.FINE)) {
++            log.log(java.util.logging.Level.FINE,
++                "Start getX509CertificateFromStaticResolvers() with " + KeyResolver.length()
++                + " resolvers"
++            );
++        }
++        String uri = this.getBaseURI();
++        Iterator<KeyResolverSpi> it = KeyResolver.iterator();
++        while (it.hasNext()) {
++            KeyResolverSpi keyResolver = it.next();
++            X509Certificate cert = applyCurrentResolver(uri, keyResolver);
++            if (cert != null) {
++                return cert;
++            }
++        }
++        return null;
++    }
+ 
+-   private X509Certificate applyCurrentResolver(String uri, int storageLength, KeyResolverSpi keyResolver) throws KeyResolverException {
+-           Node currentChild=this._constructionElement.getFirstChild();
+-           while (currentChild!=null)      {
+-                   if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
+-               for (int k = 0; k < storageLength; k++) {
+-                   StorageResolver storage =
+-                      (StorageResolver) this._storageResolvers.get(k);
++    private X509Certificate applyCurrentResolver(
++        String uri, KeyResolverSpi keyResolver
++    ) throws KeyResolverException {
++        Node currentChild = this._constructionElement.getFirstChild();
++        while (currentChild != null)      {
++            if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
++                for (StorageResolver storage : _storageResolvers) {
++                    X509Certificate cert =
++                        keyResolver.engineLookupResolveX509Certificate(
++                            (Element) currentChild, uri, storage
++                        );
+ 
+-                   X509Certificate cert = keyResolver
+-                        .engineLookupResolveX509Certificate((Element) currentChild, uri,
+-                                        storage);
++                    if (cert != null) {
++                        return cert;
++                    }
++                }
++            }
++            currentChild = currentChild.getNextSibling();
++        }
++        return null;
++    }
+ 
+-                   if (cert != null) {
+-                       return cert;
+-                  }
+-               }
++    /**
++     * Method getX509CertificateFromInternalResolvers
++     *
++     * @return The certificate contined in this KeyInfo
++     * @throws KeyResolverException
++     */
++    X509Certificate getX509CertificateFromInternalResolvers()
++        throws KeyResolverException {
++        if (log.isLoggable(java.util.logging.Level.FINE)) {
++            log.log(java.util.logging.Level.FINE,
++                "Start getX509CertificateFromInternalResolvers() with "
++                + this.lengthInternalKeyResolver() + " resolvers"
++            );
++        }
++        String uri = this.getBaseURI();
++        for (KeyResolverSpi keyResolver : _internalKeyResolvers) {
++            if (log.isLoggable(java.util.logging.Level.FINE)) {
++                log.log(java.util.logging.Level.FINE, "Try " + keyResolver.getClass().getName());
+             }
+-            currentChild=currentChild.getNextSibling();
+-         }
+-         return null;
+-   }
++            X509Certificate cert = applyCurrentResolver(uri, keyResolver);
++            if (cert != null) {
++                return cert;
++            }
++        }
+ 
+-   /**
+-    * Method getX509CertificateFromInternalResolvers
+-    *
+-    * @return The certificate contined in this KeyInfo
+-    * @throws KeyResolverException
+-    */
+-   X509Certificate getX509CertificateFromInternalResolvers()
+-           throws KeyResolverException {
+-      if (log.isLoggable(java.util.logging.Level.FINE))
+-        log.log(java.util.logging.Level.FINE, "Start getX509CertificateFromInternalResolvers() with "
+-                + this.lengthInternalKeyResolver() + " resolvers");
+-      String uri=this.getBaseURI();
+-      int storageLength=this._storageResolvers.size();
+-      for (int i = 0; i < this.lengthInternalKeyResolver(); i++) {
+-         KeyResolverSpi keyResolver = this.itemInternalKeyResolver(i);
+-         if (log.isLoggable(java.util.logging.Level.FINE))
+-                log.log(java.util.logging.Level.FINE, "Try " + keyResolver.getClass().getName());
+-         X509Certificate cert= applyCurrentResolver(uri, storageLength, keyResolver);
+-         if (cert!=null) {
+-                 return cert;
+-         }
+-      }
+-
+-      return null;
+-   }
++        return null;
++    }
+ 
+    /**
+     * This method returns a secret (symmetric) key. This is for XML Encryption.
+@@ -944,9 +940,9 @@
+    SecretKey getSecretKeyFromStaticResolvers() throws KeyResolverException {
+           final int length=KeyResolver.length();
+           int storageLength=this._storageResolvers.size();
+-          Iterator it = KeyResolver.iterator();
++          Iterator<KeyResolverSpi> it = KeyResolver.iterator();
+       for (int i = 0; i < length; i++) {
+-         KeyResolverSpi keyResolver = (KeyResolverSpi) it.next();
++         KeyResolverSpi keyResolver = it.next();
+ 
+          Node currentChild=this._constructionElement.getFirstChild();
+          String uri=this.getBaseURI();
+@@ -954,7 +950,7 @@
+             if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
+                   for (int k = 0; k < storageLength; k++) {
+                      StorageResolver storage =
+-                        (StorageResolver) this._storageResolvers.get(k);
++                        this._storageResolvers.get(k);
+ 
+                      SecretKey sk =
+                            keyResolver.engineLookupAndResolveSecretKey((Element) currentChild,
+@@ -992,7 +988,7 @@
+             if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
+                for (int k = 0; k < storageLength; k++) {
+                      StorageResolver storage =
+-                        (StorageResolver) this._storageResolvers.get(k);
++                        this._storageResolvers.get(k);
+ 
+                      SecretKey sk = keyResolver
+                            .engineLookupAndResolveSecretKey((Element) currentChild, uri, storage);
+@@ -1012,7 +1008,7 @@
+    /**
+     * Stores the individual (per-KeyInfo) {@link KeyResolver}s
+     */
+-   List _internalKeyResolvers = null;
++   List<KeyResolverSpi> _internalKeyResolvers = null;
+ 
+    /**
+     * This method is used to add a custom {@link KeyResolverSpi} to a KeyInfo
+@@ -1022,7 +1018,7 @@
+     */
+    public void registerInternalKeyResolver(KeyResolverSpi realKeyResolver) {
+            if (_internalKeyResolvers==null) {
+-                   _internalKeyResolvers=new ArrayList();
++                   _internalKeyResolvers=new ArrayList<KeyResolverSpi>();
+            }
+       this._internalKeyResolvers.add(realKeyResolver);
+    }
+@@ -1044,11 +1040,11 @@
+     * @return the KeyResolverSpi for the index.
+     */
+    KeyResolverSpi itemInternalKeyResolver(int i) {
+-      return (KeyResolverSpi) this._internalKeyResolvers.get(i);
++      return this._internalKeyResolvers.get(i);
+    }
+ 
+    /** Field _storageResolvers */
+-   List _storageResolvers = nullList;
++   private List<StorageResolver> _storageResolvers = nullList;
+ 
+    /**
+     * Method addStorageResolver
+@@ -1057,7 +1053,7 @@
+     */
+    public void addStorageResolver(StorageResolver storageResolver) {
+            if  (_storageResolvers == nullList  ){
+-                   _storageResolvers=new ArrayList();
++                   _storageResolvers=new ArrayList<StorageResolver>();
+            }
+          this._storageResolvers.add(storageResolver);
+ 
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolver.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolver.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolver.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolver.java
+@@ -2,356 +2,402 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-/*
+- * Copyright  1999-2004 The Apache Software Foundation.
++/**
++ * Licensed to the Apache Software Foundation (ASF) under one
++ * or more contributor license agreements. See the NOTICE file
++ * distributed with this work for additional information
++ * regarding copyright ownership. The ASF licenses this file
++ * to you under the Apache License, Version 2.0 (the
++ * "License"); you may not use this file except in compliance
++ * with the License. You may obtain a copy of the License at
+  *
+- *  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
+  *
+- *      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.
+- *
++ * Unless required by applicable law or agreed to in writing,
++ * software distributed under the License is distributed on an
++ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
++ * KIND, either express or implied. See the License for the
++ * specific language governing permissions and limitations
++ * under the License.
+  */
+ package com.sun.org.apache.xml.internal.security.keys.keyresolver;
+ 
+-
+-
+ import java.security.PublicKey;
+ import java.security.cert.X509Certificate;
+ import java.util.ArrayList;
+ import java.util.Iterator;
+ import java.util.List;
++import java.util.concurrent.CopyOnWriteArrayList;
+ 
+ import javax.crypto.SecretKey;
+ 
++import com.sun.org.apache.xml.internal.security.keys.keyresolver.implementations.DSAKeyValueResolver;
++import com.sun.org.apache.xml.internal.security.keys.keyresolver.implementations.RSAKeyValueResolver;
++import com.sun.org.apache.xml.internal.security.keys.keyresolver.implementations.RetrievalMethodResolver;
++import com.sun.org.apache.xml.internal.security.keys.keyresolver.implementations.X509CertificateResolver;
++import com.sun.org.apache.xml.internal.security.keys.keyresolver.implementations.X509IssuerSerialResolver;
++import com.sun.org.apache.xml.internal.security.keys.keyresolver.implementations.X509SKIResolver;
++import com.sun.org.apache.xml.internal.security.keys.keyresolver.implementations.X509SubjectNameResolver;
+ import com.sun.org.apache.xml.internal.security.keys.storage.StorageResolver;
+ import org.w3c.dom.Element;
+ import org.w3c.dom.Node;
+ 
+-
+ /**
+  * KeyResolver is factory class for subclass of KeyResolverSpi that
+  * represent child element of KeyInfo.
+- *
+- * @author $Author: mullan $
+- * @version %I%, %G%
+  */
+ public class KeyResolver {
+ 
+-   /** {@link java.util.logging} logging facility */
+-    static java.util.logging.Logger log =
++    /** {@link org.apache.commons.logging} logging facility */
++    private static java.util.logging.Logger log =
+         java.util.logging.Logger.getLogger(KeyResolver.class.getName());
+ 
+-   /** Field _alreadyInitialized */
+-   static boolean _alreadyInitialized = false;
++    /** Field resolverVector */
++    private static List<KeyResolver> resolverVector = new CopyOnWriteArrayList<KeyResolver>();
+ 
+-   /** Field _resolverVector */
+-   static List _resolverVector = null;
++    /** Field resolverSpi */
++    private final KeyResolverSpi resolverSpi;
+ 
+-   /** Field _resolverSpi */
+-   protected KeyResolverSpi _resolverSpi = null;
++    /**
++     * Constructor.
++     *
++     * @param keyResolverSpi a KeyResolverSpi instance
++     */
++    private KeyResolver(KeyResolverSpi keyResolverSpi) {
++        resolverSpi = keyResolverSpi;
++    }
+ 
+-   /** Field _storage */
+-   protected StorageResolver _storage = null;
++    /**
++     * Method length
++     *
++     * @return the length of resolvers registered
++     */
++    public static int length() {
++        return resolverVector.size();
++    }
+ 
+-   /**
+-    * Constructor ResourceResolver
+-    *
+-    * @param className
+-    * @throws ClassNotFoundException
+-    * @throws IllegalAccessException
+-    * @throws InstantiationException
+-    */
+-   private KeyResolver(String className)
+-           throws ClassNotFoundException, IllegalAccessException,
+-                  InstantiationException {
+-      this._resolverSpi =
+-         (KeyResolverSpi) Class.forName(className).newInstance();
+-      this._resolverSpi.setGlobalResolver(true);
+-   }
++    /**
++     * Method getX509Certificate
++     *
++     * @param element
++     * @param baseURI
++     * @param storage
++     * @return The certificate represented by the element.
++     *
++     * @throws KeyResolverException
++     */
++    public static final X509Certificate getX509Certificate(
++        Element element, String baseURI, StorageResolver storage
++    ) throws KeyResolverException {
++        for (KeyResolver resolver : resolverVector) {
++            if (resolver == null) {
++                Object exArgs[] = {
++                                   (((element != null)
++                                       && (element.getNodeType() == Node.ELEMENT_NODE))
++                                       ? element.getTagName() : "null")
++                };
+ 
+-   /**
+-    * Method length
+-    *
+-    * @return the length of resolvers registed
+-    */
+-   public static int length() {
+-      return KeyResolver._resolverVector.size();
+-   }
++                throw new KeyResolverException("utils.resolver.noClass", exArgs);
++            }
++            if (log.isLoggable(java.util.logging.Level.FINE)) {
++                log.log(java.util.logging.Level.FINE, "check resolvability by class " + resolver.getClass());
++            }
+ 
+-   public static void hit(Iterator hintI) {
+-           ResolverIterator hint = (ResolverIterator) hintI;
+-           int i = hint.i;
+-           if (i!=1 && hint.res ==_resolverVector) {
+-                   List resolverVector=(List)((ArrayList)_resolverVector).clone();
+-                Object ob=resolverVector.remove(i-1);
+-                resolverVector.add(0,ob);
+-                 _resolverVector=resolverVector;
+-         } else {
+-                 //System.out.println("KeyResolver hitting");
+-         }
+-   }
++            X509Certificate cert = resolver.resolveX509Certificate(element, baseURI, storage);
++            if (cert != null) {
++                return cert;
++            }
++        }
+ 
+-   /**
+-    * Method getInstance
+-    *
+-    * @param element
+-    * @param BaseURI
+-    * @param storage
+-    * @return The certificate represented by the element.
+-    *
+-    * @throws KeyResolverException
+-    */
+-   public static final X509Certificate getX509Certificate(
+-           Element element, String BaseURI, StorageResolver storage)
+-              throws KeyResolverException {
++        Object exArgs[] = {
++                           (((element != null) && (element.getNodeType() == Node.ELEMENT_NODE))
++                           ? element.getTagName() : "null")
++                          };
+ 
+-          // use the old vector to not be hit by updates
+-          List resolverVector = KeyResolver._resolverVector;
+-      for (int i = 0; i < resolverVector.size(); i++) {
+-                  KeyResolver resolver=
+-            (KeyResolver) resolverVector.get(i);
++        throw new KeyResolverException("utils.resolver.noClass", exArgs);
++    }
+ 
+-                  if (resolver==null) {
+-            Object exArgs[] = {
+-               (((element != null)
+-                 && (element.getNodeType() == Node.ELEMENT_NODE))
+-                ? element.getTagName()
+-                : "null") };
++    /**
++     * Method getPublicKey
++     *
++     * @param element
++     * @param baseURI
++     * @param storage
++     * @return the public key contained in the element
++     *
++     * @throws KeyResolverException
++     */
++    public static final PublicKey getPublicKey(
++        Element element, String baseURI, StorageResolver storage
++    ) throws KeyResolverException {
++        for (KeyResolver resolver : resolverVector) {
++            if (resolver == null) {
++                Object exArgs[] = {
++                                   (((element != null)
++                                       && (element.getNodeType() == Node.ELEMENT_NODE))
++                                       ? element.getTagName() : "null")
++                };
+ 
+-            throw new KeyResolverException("utils.resolver.noClass", exArgs);
+-         }
+-         if (log.isLoggable(java.util.logging.Level.FINE))
++                throw new KeyResolverException("utils.resolver.noClass", exArgs);
++            }
++            if (log.isLoggable(java.util.logging.Level.FINE)) {
+                 log.log(java.util.logging.Level.FINE, "check resolvability by class " + resolver.getClass());
++            }
+ 
+-         X509Certificate cert=resolver.resolveX509Certificate(element, BaseURI, storage);
+-         if (cert!=null) {
+-            return cert;
+-         }
+-      }
++            PublicKey cert = resolver.resolvePublicKey(element, baseURI, storage);
++            if (cert != null) {
++                return cert;
++            }
++        }
+ 
+-      Object exArgs[] = {
+-         (((element != null) && (element.getNodeType() == Node.ELEMENT_NODE))
+-          ? element.getTagName()
+-          : "null") };
++        Object exArgs[] = {
++                           (((element != null) && (element.getNodeType() == Node.ELEMENT_NODE))
++                           ? element.getTagName() : "null")
++                          };
+ 
+-      throw new KeyResolverException("utils.resolver.noClass", exArgs);
+-   }
+-   /**
+-    * Method getInstance
+-    *
+-    * @param element
+-    * @param BaseURI
+-    * @param storage
+-    * @return the public key contained in the element
+-    *
+-    * @throws KeyResolverException
+-    */
+-   public static final PublicKey getPublicKey(
+-           Element element, String BaseURI, StorageResolver storage)
+-              throws KeyResolverException {
++        throw new KeyResolverException("utils.resolver.noClass", exArgs);
++    }
+ 
+-          List resolverVector = KeyResolver._resolverVector;
+-      for (int i = 0; i < resolverVector.size(); i++) {
+-                  KeyResolver resolver=
+-            (KeyResolver) resolverVector.get(i);
++    /**
++     * This method is used for registering {@link KeyResolverSpi}s which are
++     * available to <I>all</I> {@link com.sun.org.apache.xml.internal.security.keys.KeyInfo} objects. This means that
++     * personalized {@link KeyResolverSpi}s should only be registered directly
++     * to the {@link com.sun.org.apache.xml.internal.security.keys.KeyInfo} using
++     * {@link com.sun.org.apache.xml.internal.security.keys.KeyInfo#registerInternalKeyResolver}.
++     * Please note that this method will create a new copy of the underlying array, as the
++     * underlying collection is a CopyOnWriteArrayList.
++     *
++     * @param className
++     * @param globalResolver Whether the KeyResolverSpi is a global resolver or not
++     * @throws InstantiationException
++     * @throws IllegalAccessException
++     * @throws ClassNotFoundException
++     */
++    public static void register(String className, boolean globalResolver)
++        throws ClassNotFoundException, IllegalAccessException, InstantiationException {
++        KeyResolverSpi keyResolverSpi =
++            (KeyResolverSpi) Class.forName(className).newInstance();
++        keyResolverSpi.setGlobalResolver(globalResolver);
++        register(keyResolverSpi, false);
++    }
+ 
+-                  if (resolver==null) {
+-            Object exArgs[] = {
+-               (((element != null)
+-                 && (element.getNodeType() == Node.ELEMENT_NODE))
+-                ? element.getTagName()
+-                : "null") };
++    /**
++     * This method is used for registering {@link KeyResolverSpi}s which are
++     * available to <I>all</I> {@link com.sun.org.apache.xml.internal.security.keys.KeyInfo} objects. This means that
++     * personalized {@link KeyResolverSpi}s should only be registered directly
++     * to the {@link com.sun.org.apache.xml.internal.security.keys.KeyInfo} using
++     * {@link com.sun.org.apache.xml.internal.security.keys.KeyInfo#registerInternalKeyResolver}.
++     * Please note that this method will create a new copy of the underlying array, as the
++     * underlying collection is a CopyOnWriteArrayList.
++     *
++     * @param className
++     * @param globalResolver Whether the KeyResolverSpi is a global resolver or not
++     */
++    public static void registerAtStart(String className, boolean globalResolver) {
++        KeyResolverSpi keyResolverSpi = null;
++        Exception ex = null;
++        try {
++            keyResolverSpi = (KeyResolverSpi) Class.forName(className).newInstance();
++        } catch (ClassNotFoundException e) {
++            ex = e;
++        } catch (IllegalAccessException e) {
++            ex = e;
++        } catch (InstantiationException e) {
++            ex = e;
++        }
+ 
+-            throw new KeyResolverException("utils.resolver.noClass", exArgs);
+-         }
+-         if (log.isLoggable(java.util.logging.Level.FINE))
+-                log.log(java.util.logging.Level.FINE, "check resolvability by class " + resolver.getClass());
++        if (ex != null) {
++            throw (IllegalArgumentException) new
++            IllegalArgumentException("Invalid KeyResolver class name").initCause(ex);
++        }
++        keyResolverSpi.setGlobalResolver(globalResolver);
++        register(keyResolverSpi, true);
++    }
+ 
+-         PublicKey cert=resolver.resolvePublicKey(element, BaseURI, storage);
+-         if (cert!=null) {
+-                 if (i!=0 && resolverVector==_resolverVector) {
+-                         //update resolver.
+-                         resolverVector=(List)((ArrayList)_resolverVector).clone();
+-                                 Object ob=resolverVector.remove(i);
+-                                 resolverVector.add(0,ob);
+-                                 _resolverVector=resolverVector;
+-                 }
+-                 return cert;
+-         }
+-      }
++    /**
++     * This method is used for registering {@link KeyResolverSpi}s which are
++     * available to <I>all</I> {@link com.sun.org.apache.xml.internal.security.keys.KeyInfo} objects. This means that
++     * personalized {@link KeyResolverSpi}s should only be registered directly
++     * to the {@link com.sun.org.apache.xml.internal.security.keys.KeyInfo} using
++     * {@link com.sun.org.apache.xml.internal.security.keys.KeyInfo#registerInternalKeyResolver}.
++     * Please note that this method will create a new copy of the underlying array, as the
++     * underlying collection is a CopyOnWriteArrayList.
++     *
++     * @param keyResolverSpi a KeyResolverSpi instance to register
++     * @param start whether to register the KeyResolverSpi at the start of the list or not
++     */
++    public static void register(
++        KeyResolverSpi keyResolverSpi,
++        boolean start
++    ) {
++        KeyResolver resolver = new KeyResolver(keyResolverSpi);
++        if (start) {
++            resolverVector.add(0, resolver);
++        } else {
++            resolverVector.add(resolver);
++        }
++    }
+ 
+-      Object exArgs[] = {
+-         (((element != null) && (element.getNodeType() == Node.ELEMENT_NODE))
+-          ? element.getTagName()
+-          : "null") };
++    /**
++     * This method is used for registering {@link KeyResolverSpi}s which are
++     * available to <I>all</I> {@link com.sun.org.apache.xml.internal.security.keys.KeyInfo} objects. This means that
++     * personalized {@link KeyResolverSpi}s should only be registered directly
++     * to the {@link com.sun.org.apache.xml.internal.security.keys.KeyInfo} using
++     * {@link com.sun.org.apache.xml.internal.security.keys.KeyInfo#registerInternalKeyResolver}.
++     * The KeyResolverSpi instances are not registered as a global resolver.
++     *
++     *
++     * @param classNames
++     * @throws InstantiationException
++     * @throws IllegalAccessException
++     * @throws ClassNotFoundException
++     */
++    public static void registerClassNames(List<String> classNames)
++        throws ClassNotFoundException, IllegalAccessException, InstantiationException {
++        List<KeyResolver> keyResolverList = new ArrayList<KeyResolver>(classNames.size());
++        for (String className : classNames) {
++            KeyResolverSpi keyResolverSpi =
++                (KeyResolverSpi) Class.forName(className).newInstance();
++            keyResolverSpi.setGlobalResolver(false);
++            keyResolverList.add(new KeyResolver(keyResolverSpi));
++        }
++        resolverVector.addAll(keyResolverList);
++    }
+ 
+-      throw new KeyResolverException("utils.resolver.noClass", exArgs);
+-   }
++    /**
++     * This method registers the default resolvers.
++     */
++    public static void registerDefaultResolvers() {
+ 
+-   /**
+-    * The init() function is called by com.sun.org.apache.xml.internal.security.Init.init()
+-    */
+-   public static void init() {
++        List<KeyResolver> keyResolverList = new ArrayList<KeyResolver>();
++        keyResolverList.add(new KeyResolver(new RSAKeyValueResolver()));
++        keyResolverList.add(new KeyResolver(new DSAKeyValueResolver()));
++        keyResolverList.add(new KeyResolver(new X509CertificateResolver()));
++        keyResolverList.add(new KeyResolver(new X509SKIResolver()));
++        keyResolverList.add(new KeyResolver(new RetrievalMethodResolver()));
++        keyResolverList.add(new KeyResolver(new X509SubjectNameResolver()));
++        keyResolverList.add(new KeyResolver(new X509IssuerSerialResolver()));
+ 
+-      if (!KeyResolver._alreadyInitialized) {
+-         KeyResolver._resolverVector = new ArrayList(10);
+-         _alreadyInitialized = true;
+-      }
+-   }
++        resolverVector.addAll(keyResolverList);
++    }
+ 
+-   /**
+-    * This method is used for registering {@link KeyResolverSpi}s which are
+-    * available to <I>all</I> {@link com.sun.org.apache.xml.internal.security.keys.KeyInfo} objects. This means that
+-    * personalized {@link KeyResolverSpi}s should only be registered directly
+-    * to the {@link com.sun.org.apache.xml.internal.security.keys.KeyInfo} using
+-    * {@link com.sun.org.apache.xml.internal.security.keys.KeyInfo#registerInternalKeyResolver}.
+-    *
+-    * @param className
+- * @throws InstantiationException
+- * @throws IllegalAccessException
+- * @throws ClassNotFoundException
+-    */
+-   public static void register(String className) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
+-      KeyResolver._resolverVector.add(new KeyResolver(className));
+-   }
++    /**
++     * Method resolvePublicKey
++     *
++     * @param element
++     * @param baseURI
++     * @param storage
++     * @return resolved public key from the registered from the elements
++     *
++     * @throws KeyResolverException
++     */
++    public PublicKey resolvePublicKey(
++        Element element, String baseURI, StorageResolver storage
++    ) throws KeyResolverException {
++        return resolverSpi.engineLookupAndResolvePublicKey(element, baseURI, storage);
++    }
+ 
+-   /**
+-    * This method is used for registering {@link KeyResolverSpi}s which are
+-    * available to <I>all</I> {@link com.sun.org.apache.xml.internal.security.keys.KeyInfo} objects. This means that
+-    * personalized {@link KeyResolverSpi}s should only be registered directly
+-    * to the {@link com.sun.org.apache.xml.internal.security.keys.KeyInfo} using {@link com.sun.org.apache.xml.internal.security.keys.KeyInfo#registerInternalKeyResolver}.
+-    *
+-    * @param className
+-    */
+-   public static void registerAtStart(String className) {
+-      KeyResolver._resolverVector.add(0, className);
+-   }
++    /**
++     * Method resolveX509Certificate
++     *
++     * @param element
++     * @param baseURI
++     * @param storage
++     * @return resolved X509certificate key from the registered from the elements
++     *
++     * @throws KeyResolverException
++     */
++    public X509Certificate resolveX509Certificate(
++        Element element, String baseURI, StorageResolver storage
++    ) throws KeyResolverException {
++        return resolverSpi.engineLookupResolveX509Certificate(element, baseURI, storage);
++    }
+ 
+-   /**
+-    * Method resolve
+-    *
+-    * @param element
+-    * @param BaseURI
+-    * @param storage
+-    * @return resolved public key from the registered from the elements
+-    *
+-    * @throws KeyResolverException
+-    */
+-   public PublicKey resolvePublicKey(
+-           Element element, String BaseURI, StorageResolver storage)
+-              throws KeyResolverException {
+-      return this._resolverSpi.engineLookupAndResolvePublicKey(element, BaseURI, storage);
+-   }
++    /**
++     * @param element
++     * @param baseURI
++     * @param storage
++     * @return resolved SecretKey key from the registered from the elements
++     * @throws KeyResolverException
++     */
++    public SecretKey resolveSecretKey(
++        Element element, String baseURI, StorageResolver storage
++    ) throws KeyResolverException {
++        return resolverSpi.engineLookupAndResolveSecretKey(element, baseURI, storage);
++    }
+ 
+-   /**
+-    * Method resolveX509Certificate
+-    *
+-    * @param element
+-    * @param BaseURI
+-    * @param storage
+-    * @return resolved X509certificate key from the registered from the elements
+-    *
+-    * @throws KeyResolverException
+-    */
+-   public X509Certificate resolveX509Certificate(
+-           Element element, String BaseURI, StorageResolver storage)
+-              throws KeyResolverException {
+-      return this._resolverSpi.engineLookupResolveX509Certificate(element, BaseURI,
+-              storage);
+-   }
++    /**
++     * Method setProperty
++     *
++     * @param key
++     * @param value
++     */
++    public void setProperty(String key, String value) {
++        resolverSpi.engineSetProperty(key, value);
++    }
+ 
+-   /**
+-    * @param element
+-    * @param BaseURI
+-    * @param storage
+-    * @return resolved SecretKey key from the registered from the elements
+-    * @throws KeyResolverException
+-    */
+-   public SecretKey resolveSecretKey(
+-           Element element, String BaseURI, StorageResolver storage)
+-              throws KeyResolverException {
+-      return this._resolverSpi.engineLookupAndResolveSecretKey(element, BaseURI,
+-              storage);
+-   }
++    /**
++     * Method getProperty
++     *
++     * @param key
++     * @return the property set for this resolver
++     */
++    public String getProperty(String key) {
++        return resolverSpi.engineGetProperty(key);
++    }
+ 
+-   /**
+-    * Method setProperty
+-    *
+-    * @param key
+-    * @param value
+-    */
+-   public void setProperty(String key, String value) {
+-      this._resolverSpi.engineSetProperty(key, value);
+-   }
+ 
+-   /**
+-    * Method getProperty
+-    *
+-    * @param key
+-    * @return the property setted for this resolver
+-    */
+-   public String getProperty(String key) {
+-      return this._resolverSpi.engineGetProperty(key);
+-   }
++    /**
++     * Method understandsProperty
++     *
++     * @param propertyToTest
++     * @return true if the resolver understands property propertyToTest
++     */
++    public boolean understandsProperty(String propertyToTest) {
++        return resolverSpi.understandsProperty(propertyToTest);
++    }
+ 
+ 
+-   /**
+-    * Method understandsProperty
+-    *
+-    * @param propertyToTest
+-    * @return true if the resolver understands property propertyToTest
+-    */
+-   public boolean understandsProperty(String propertyToTest) {
+-      return this._resolverSpi.understandsProperty(propertyToTest);
+-   }
++    /**
++     * Method resolverClassName
++     *
++     * @return the name of the resolver.
++     */
++    public String resolverClassName() {
++        return resolverSpi.getClass().getName();
++    }
+ 
++    /**
++     * Iterate over the KeyResolverSpi instances
++     */
++    static class ResolverIterator implements Iterator<KeyResolverSpi> {
++        List<KeyResolver> res;
++        Iterator<KeyResolver> it;
+ 
+-   /**
+-    * Method resolverClassName
+-    *
+-    * @return the name of the resolver.
+-    */
+-   public String resolverClassName() {
+-      return this._resolverSpi.getClass().getName();
+-   }
++        public ResolverIterator(List<KeyResolver> list) {
++            res = list;
++            it = res.iterator();
++        }
+ 
+-   static class ResolverIterator implements Iterator {
+-           List res;
+-                Iterator it;
+-                int i;
+-           public ResolverIterator(List list) {
+-                res = list;
+-                it = res.iterator();
++        public boolean hasNext() {
++            return it.hasNext();
+         }
+-                public boolean hasNext() {
+-                        // TODO Auto-generated method stub
+-                        return it.hasNext();
+-                }
+ 
+-                public Object next() {
+-                        i++;
+-                        KeyResolver resolver = (KeyResolver) it.next();
+-                      if (resolver==null) {
+-                         throw new RuntimeException("utils.resolver.noClass");
+-                      }
++        public KeyResolverSpi next() {
++            KeyResolver resolver = it.next();
++            if (resolver == null) {
++                throw new RuntimeException("utils.resolver.noClass");
++            }
+ 
+-                      return resolver._resolverSpi;
+-                }
++            return resolver.resolverSpi;
++        }
+ 
+-                public void remove() {
+-                        // TODO Auto-generated method stub
++        public void remove() {
++            throw new UnsupportedOperationException("Can't remove resolvers using the iterator");
++        }
++    };
+ 
+-                }
+-
+-        };
+-        public static Iterator iterator() {
+-                return new ResolverIterator(_resolverVector);
+-   }
++    public static Iterator<KeyResolverSpi> iterator() {
++        return new ResolverIterator(resolverVector);
++    }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/RetrievalMethodResolver.java b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/RetrievalMethodResolver.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/RetrievalMethodResolver.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/RetrievalMethodResolver.java
+@@ -34,6 +34,7 @@
+ import java.util.ListIterator;
+ import java.util.Set;
+ 
++import javax.xml.XMLConstants;
+ import javax.xml.parsers.ParserConfigurationException;
+ 
+ import com.sun.org.apache.xml.internal.security.c14n.CanonicalizationException;
+@@ -251,6 +252,7 @@
+       try {
+          javax.xml.parsers.DocumentBuilderFactory dbf =javax.xml.parsers.DocumentBuilderFactory.newInstance();
+          dbf.setNamespaceAware(true);
++         dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
+          javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
+          org.w3c.dom.Document doc =
+             db.parse(new java.io.ByteArrayInputStream(bytes));
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/resource/xmlsecurity_en.properties b/src/share/classes/com/sun/org/apache/xml/internal/security/resource/xmlsecurity_en.properties
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/xmlsecurity_en.properties
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/xmlsecurity_en.properties
+@@ -1,123 +1,126 @@
+-algorithm.alreadyRegistered = URI {0} already assigned to class {1}
+-algorithm.classDoesNotExist = Cannot register URI {0} to class {1} because this class does not exist in CLASSPATH
+-algorithm.ClassDoesNotExist = Class {0} does not exist
+-algorithm.extendsWrongClass = Cannot register URI {0} to class {1} because it does not extend {2}
+-algorithms.CannotUseAlgorithmParameterSpecOnDSA = Sorry, but you cannot use a AlgorithmParameterSpec object for creating DSA signatures.
+-algorithms.CannotUseAlgorithmParameterSpecOnRSA = Sorry, but you cannot use a AlgorithmParameterSpec object for creating RSA signatures.
+-algorithms.CannotUseSecureRandomOnMAC = Sorry, but you cannot use a SecureRandom object for creating MACs.
+-algorithms.HMACOutputLengthOnlyForHMAC = A HMACOutputLength can only be specified for HMAC integrity algorithms
+-algorithms.NoSuchAlgorithm = The requested algorithm {0} does not exist. Original Message was: {1}
+-algorithms.NoSuchMap = The algorithm URI "{0}" could not be mapped to a JCE algorithm
+-algorithms.NoSuchProvider = The specified Provider {0} does not exist. Original Message was: {1}
+-algorithms.operationOnlyVerification = A public key can only used for verification of a signature.
+-algorithms.WrongKeyForThisOperation = Sorry, you supplied the wrong key type for this operation! You supplied a {0} but a {1} is needed.
+-attributeValueIllegal = The attribute {0} has value {1} but must be {2}
+-c14n.Canonicalizer.Exception = Exception during Canonicalization:  Original Message was {0}
+-c14n.Canonicalizer.IllegalNode = Illegal node type {0}, node name was {1}
+-c14n.Canonicalizer.NoSuchCanonicalizer = No canonicalizer found with URI {0}
+-c14n.Canonicalizer.ParserConfigurationException = ParserConfigurationException during Canonicalization:  Original Message was {0}
+-c14n.Canonicalizer.RelativeNamespace = Element {0} has a relative namespace: {1}="{2}"
+-c14n.Canonicalizer.SAXException = SAXException during Canonicalization:  Original Message was {0}
+-c14n.Canonicalizer.TraversalNotSupported = This DOM document does not support Traversal {0}
+-c14n.Canonicalizer.UnsupportedEncoding = Unsupported encoding {0}
+-c14n.Canonicalizer.UnsupportedOperation = This canonicalizer does not support this operation
+-c14n.XMLUtils.circumventBug2650forgotten = The tree has not been prepared for canonicalization using XMLUtils#circumventBug2650(Document)
+-certificate.noSki.lowVersion = Certificate cannot contain a SubjectKeyIdentifier because it is only X509v{0}
+-certificate.noSki.notOctetString = Certificates SubjectKeyIdentifier is not a OctetString
+-certificate.noSki.null = Certificate does not contain a SubjectKeyIdentifier
+-defaultNamespaceCannotBeSetHere = Default namespace cannot be set here
+-ElementProxy.nullElement = Cannot create an ElementProxy from a null argument
+-empty = {0}
+-encryption.algorithmCannotBeUsedForEncryptedData = encryption.algorithmCannotBeUsedForEncryptedData {0}
+-encryption.algorithmCannotEatInitParams = encryption.algorithmCannotEatInitParams
+-encryption.algorithmCannotEncryptDecrypt = encryption.algorithmCannotEncryptDecrypt
+-encryption.algorithmCannotWrapUnWrap = encryption.algorithmCannotWrapUnWrap
+-encryption.ExplicitKeySizeMismatch = The xenc:KeySize element requests a key size of {0} bit but the algorithm implements {1} bit
+-encryption.nonceLongerThanDecryptedPlaintext = The given nonce is longer than the available plaintext. I Cannot strip away this.
+-encryption.RSAOAEP.dataHashWrong = data hash wrong
+-encryption.RSAOAEP.dataStartWrong = data wrong start {0}
+-encryption.RSAOAEP.dataTooShort = data too short
+-encryption.RSAPKCS15.blockTruncated = block truncated
+-encryption.RSAPKCS15.noDataInBlock = no data in block
+-encryption.RSAPKCS15.unknownBlockType = unknown block type
+-encryption.nokey = No Key Encryption Key loaded and cannot determine using key resolvers
+-endorsed.jdk1.4.0 = Since it seems that nobody reads our installation notes, we must do it in the exception messages. Hope you read them. You did NOT use the endorsed mechanism from JDK 1.4 properly; look at <http://xml.apache.org/security/Java/installation.html> how to solve this problem.
+-errorMessages.InvalidDigestValueException = INVALID signature -- check reference resolution.
+-errorMessages.InvalidSignatureValueException = INVALID signature -- core validation failed.
+-errorMessages.IOException = Other file I/O and similar exceptions.
+-errorMessages.MissingKeyFailureException = Cannot verify because of missing public key. Provide it via addResource and try again.
+-errorMessages.MissingResourceFailureException = Cannot verify because of unresolved references. Provide it via addResource and try again.
+-errorMessages.NoSuchAlgorithmException = Unknown Algorithm {0}
+-errorMessages.NotYetImplementedException = Functionality not yet there.
+-errorMessages.XMLSignatureException = Verification failed for some other reason.
+-decoding.divisible.four = It should be divisible by four
+-decoding.general = Error while decoding
+-FileKeyStorageImpl.addToDefaultFromRemoteNotImplemented = Method addToDefaultFromRemote() not yet implemented.
+-FileKeyStorageImpl.NoCert.Context = Not found such a X509Certificate including context {0}
+-FileKeyStorageImpl.NoCert.IssNameSerNo = Not found such a X509Certificate with IssuerName {0} and serial number {1}
+-FileKeyStorageImpl.NoCert.SubjName = Not found such a X509Certificate including SubjectName {0}
+-generic.dontHaveConstructionElement = I do not have a construction Element
+-generic.EmptyMessage = {0}
+-generic.NotYetImplemented = {0} Not YET implemented ;-((
+-java.security.InvalidKeyException = Invalid key
+-java.security.NoSuchProviderException = Unknown or unsupported provider
+-java.security.UnknownKeyType = Unknown or unsupported key type {0}
+-KeyInfo.needKeyResolver = More than one keyResovler have to be registered
+-KeyInfo.nokey = Cannot get key from {0}
+-KeyInfo.noKey = Cannot get the public key
+-KeyInfo.wrongNumberOfObject = Need {0} keyObjects
+-KeyInfo.wrongUse = This object was made for getting {0}
+-keyResolver.alreadyRegistered = {1} class has already been registered for {0}
+-KeyResolver.needStorageResolver = Need a StorageResolver to retrieve a Certificate from a {0}
+-KeyResoverSpiImpl.cannotGetCert = Cannot get the Certificate that include or in {1} in implement class {0}
+-KeyResoverSpiImpl.elementGeneration = Cannot make {1} element in implement class {0}
+-KeyResoverSpiImpl.getPoublicKey = Cannot get the public key from implement class {0}
+-KeyResoverSpiImpl.InvalidElement = Cannot set (2) Element in implement class {0}
+-KeyResoverSpiImpl.keyStore = KeyStorage error in implement class {0}
+-KeyResoverSpiImpl.need.Element = {1} type of Element is needed in implement class {0}
+-KeyResoverSpiImpl.wrongCRLElement = Cannot make CRL from {1} in implement class {0}
+-KeyResoverSpiImpl.wrongKeyObject =  Need {1} type of KeyObject for generation Element in implement class{0}
+-KeyResoverSpiImpl.wrongNumberOfObject = Need {1} keyObject in implement class {0}
+-KeyStore.alreadyRegistered = {0} Class has already been registered for {1}
+-KeyStore.register = {1} type class register error  in class {0}
+-KeyStore.registerStore.register = Registeration error for type {0}
+-KeyValue.IllegalArgument = Cannot create a {0} from {1}
+-namespacePrefixAlreadyUsedByOtherURI = Namespace prefix {0} already used by other URI {1}
+-notYetInitialized = The module {0} is not yet initialized
+-prefix.AlreadyAssigned = You want to assign {0} as prefix for namespace {1} but it is already assigned for {2}
+-signature.Canonicalizer.UnknownCanonicalizer = Unknown canonicalizer. No handler installed for URI {0}
+-signature.DSA.invalidFormat = Invalid ASN.1 encoding of the DSA signature
+-signature.Generation.signBeforeGetValue = You have to XMLSignature.sign(java.security.PrivateKey) first
+-signature.signaturePropertyHasNoTarget = The Target attribute of the SignatureProperty must be set
+-signature.Transform.ErrorDuringTransform = A {1} was thrown during the {0} transform
+-signature.Transform.NotYetImplemented = Transform {0} not yet implemented
+-signature.Transform.NullPointerTransform = Null pointer as URI. Programming bug?
+-signature.Transform.UnknownTransform = Unknown transformation. No handler installed for URI {0}
+-signature.Transform.node = Current Node: {0}
+-signature.Transform.nodeAndType = Current Node: {0}, type: {1} 
+-signature.Util.BignumNonPositive = bigInteger.signum() must be positive
+-signature.Util.NonTextNode = Not a text node
+-signature.Util.TooManyChilds = Too many childs of Type {0} in {1}
+-signature.Verification.certificateError = Certificate error
+-signature.Verification.IndexOutOfBounds = Index {0} illegal. We only have {1} References
+-signature.Verification.internalError = Internal error
+-signature.Verification.InvalidDigestOrReference = Invalid digest of reference {0}
+-signature.Verification.keyStore = KeyStore error
+-signature.Verification.MissingID = Cannot resolve element with ID {0}
+-signature.Verification.MissingResources = Cannot resolve external resource {0}
+-signature.Verification.NoSignatureElement = Input document contains no {0} Element in namespace {1}
+-signature.Verification.Reference.NoInput = The Reference for URI {0} has no XMLSignatureInput
+-signature.Verification.SignatureError = Signature error
+-signature.XMLSignatureInput.MissingConstuctor = Cannot construct a XMLSignatureInput from class {0}
+-signature.XMLSignatureInput.SerializeDOM = Input initialized with DOM Element. Use Canonicalization to serialize it
+-signature.XMLSignatureInput.nodesetReference = Unable to convert to nodeset the reference
+-transform.Init.IllegalContextArgument = Invalid context argument of class {0}. Must be String, org.w3c.dom.NodeList or java.io.InputStream.
+-transform.init.NotInitialized =
+-transform.init.wrongURI = Initialized with wrong URI. How could this happen? We implement {0} but {1} was used during initialization
+-utils.Base64.IllegalBitlength = Illegal byte length; Data to be decoded must be a multiple of 4
+-Base64Decoding = Error while decoding
+-utils.resolver.noClass = Could not find a resolver for URI {0} and Base {1}
+-xml.WrongContent = Cannot find {0} in {1}
+-xml.WrongElement = Cannot create a {0} from a {1} element
+-xpath.funcHere.documentsDiffer = The XPath is not in the same document as the context node
+-xpath.funcHere.noXPathContext = Try to evaluate an XPath which uses the here() function but XPath is not inside an ds:XPath Element. XPath was : {0}
++algorithm.alreadyRegistered = URI {0} already assigned to class {1}
++algorithm.classDoesNotExist = Cannot register URI {0} to class {1} because this class does not exist in CLASSPATH
++algorithm.ClassDoesNotExist = Class {0} does not exist
++algorithm.extendsWrongClass = Cannot register URI {0} to class {1} because it does not extend {2}
++algorithms.CannotUseAlgorithmParameterSpecOnDSA = Sorry, but you cannot use a AlgorithmParameterSpec object for creating DSA signatures.
++algorithms.CannotUseAlgorithmParameterSpecOnRSA = Sorry, but you cannot use a AlgorithmParameterSpec object for creating RSA signatures.
++algorithms.CannotUseSecureRandomOnMAC = Sorry, but you cannot use a SecureRandom object for creating MACs.
++algorithms.HMACOutputLengthOnlyForHMAC = A HMACOutputLength can only be specified for HMAC integrity algorithms
++algorithms.NoSuchAlgorithm = The requested algorithm {0} does not exist. Original Message was: {1}
++algorithms.NoSuchMap = The algorithm URI "{0}" could not be mapped to a JCE algorithm
++algorithms.NoSuchProvider = The specified Provider {0} does not exist. Original Message was: {1}
++algorithms.operationOnlyVerification = A public key can only used for verification of a signature.
++algorithms.WrongKeyForThisOperation = Sorry, you supplied the wrong key type for this operation! You supplied a {0} but a {1} is needed.
++attributeValueIllegal = The attribute {0} has value {1} but must be {2}
++c14n.Canonicalizer.Exception = Exception during Canonicalization:  Original Message was {0}
++c14n.Canonicalizer.IllegalNode = Illegal node type {0}, node name was {1}
++c14n.Canonicalizer.NoSuchCanonicalizer = No canonicalizer found with URI {0}
++c14n.Canonicalizer.ParserConfigurationException = ParserConfigurationException during Canonicalization:  Original Message was {0}
++c14n.Canonicalizer.RelativeNamespace = Element {0} has a relative namespace: {1}="{2}"
++c14n.Canonicalizer.SAXException = SAXException during Canonicalization:  Original Message was {0}
++c14n.Canonicalizer.TraversalNotSupported = This DOM document does not support Traversal {0}
++c14n.Canonicalizer.UnsupportedEncoding = Unsupported encoding {0}
++c14n.Canonicalizer.UnsupportedOperation = This canonicalizer does not support this operation
++c14n.XMLUtils.circumventBug2650forgotten = The tree has not been prepared for canonicalization using XMLUtils#circumventBug2650(Document)
++certificate.noSki.lowVersion = Certificate cannot contain a SubjectKeyIdentifier because it is only X509v{0}
++certificate.noSki.notOctetString = Certificates SubjectKeyIdentifier is not a OctetString
++certificate.noSki.null = Certificate does not contain a SubjectKeyIdentifier
++defaultNamespaceCannotBeSetHere = Default namespace cannot be set here
++ElementProxy.nullElement = Cannot create an ElementProxy from a null argument
++empty = {0}
++encryption.algorithmCannotBeUsedForEncryptedData = encryption.algorithmCannotBeUsedForEncryptedData {0}
++encryption.algorithmCannotEatInitParams = encryption.algorithmCannotEatInitParams
++encryption.algorithmCannotEncryptDecrypt = encryption.algorithmCannotEncryptDecrypt
++encryption.algorithmCannotWrapUnWrap = encryption.algorithmCannotWrapUnWrap
++encryption.ExplicitKeySizeMismatch = The xenc:KeySize element requests a key size of {0} bit but the algorithm implements {1} bit
++encryption.nonceLongerThanDecryptedPlaintext = The given nonce is longer than the available plaintext. I Cannot strip away this.
++encryption.RSAOAEP.dataHashWrong = data hash wrong
++encryption.RSAOAEP.dataStartWrong = data wrong start {0}
++encryption.RSAOAEP.dataTooShort = data too short
++encryption.RSAPKCS15.blockTruncated = block truncated
++encryption.RSAPKCS15.noDataInBlock = no data in block
++encryption.RSAPKCS15.unknownBlockType = unknown block type
++encryption.nokey = No Key Encryption Key loaded and cannot determine using key resolvers
++endorsed.jdk1.4.0 = Since it seems that nobody reads our installation notes, we must do it in the exception messages. Hope you read them. You did NOT use the endorsed mechanism from JDK 1.4 properly; look at <http://xml.apache.org/security/Java/installation.html> how to solve this problem.
++errorMessages.InvalidDigestValueException = INVALID signature -- check reference resolution.
++errorMessages.InvalidSignatureValueException = INVALID signature -- core validation failed.
++errorMessages.IOException = Other file I/O and similar exceptions.
++errorMessages.MissingKeyFailureException = Cannot verify because of missing public key. Provide it via addResource and try again.
++errorMessages.MissingResourceFailureException = Cannot verify because of unresolved references. Provide it via addResource and try again.
++errorMessages.NoSuchAlgorithmException = Unknown Algorithm {0}
++errorMessages.NotYetImplementedException = Functionality not yet there.
++errorMessages.XMLSignatureException = Verification failed for some other reason.
++decoding.divisible.four = It should be divisible by four
++decoding.general = Error while decoding
++FileKeyStorageImpl.addToDefaultFromRemoteNotImplemented = Method addToDefaultFromRemote() not yet implemented.
++FileKeyStorageImpl.NoCert.Context = Not found such a X509Certificate including context {0}
++FileKeyStorageImpl.NoCert.IssNameSerNo = Not found such a X509Certificate with IssuerName {0} and serial number {1}
++FileKeyStorageImpl.NoCert.SubjName = Not found such a X509Certificate including SubjectName {0}
++generic.dontHaveConstructionElement = I do not have a construction Element
++generic.EmptyMessage = {0}
++generic.NotYetImplemented = {0} Not YET implemented ;-((
++java.security.InvalidKeyException = Invalid key
++java.security.NoSuchProviderException = Unknown or unsupported provider
++java.security.UnknownKeyType = Unknown or unsupported key type {0}
++KeyInfo.needKeyResolver = More than one keyResovler have to be registered
++KeyInfo.nokey = Cannot get key from {0}
++KeyInfo.noKey = Cannot get the public key
++KeyInfo.wrongNumberOfObject = Need {0} keyObjects
++KeyInfo.wrongUse = This object was made for getting {0}
++keyResolver.alreadyRegistered = {1} class has already been registered for {0}
++KeyResolver.needStorageResolver = Need a StorageResolver to retrieve a Certificate from a {0}
++KeyResoverSpiImpl.cannotGetCert = Cannot get the Certificate that include or in {1} in implement class {0}
++KeyResoverSpiImpl.elementGeneration = Cannot make {1} element in implement class {0}
++KeyResoverSpiImpl.getPoublicKey = Cannot get the public key from implement class {0}
++KeyResoverSpiImpl.InvalidElement = Cannot set (2) Element in implement class {0}
++KeyResoverSpiImpl.keyStore = KeyStorage error in implement class {0}
++KeyResoverSpiImpl.need.Element = {1} type of Element is needed in implement class {0}
++KeyResoverSpiImpl.wrongCRLElement = Cannot make CRL from {1} in implement class {0}
++KeyResoverSpiImpl.wrongKeyObject =  Need {1} type of KeyObject for generation Element in implement class{0}
++KeyResoverSpiImpl.wrongNumberOfObject = Need {1} keyObject in implement class {0}
++KeyStore.alreadyRegistered = {0} Class has already been registered for {1}
++KeyStore.register = {1} type class register error  in class {0}
++KeyStore.registerStore.register = Registeration error for type {0}
++KeyValue.IllegalArgument = Cannot create a {0} from {1}
++namespacePrefixAlreadyUsedByOtherURI = Namespace prefix {0} already used by other URI {1}
++notYetInitialized = The module {0} is not yet initialized
++prefix.AlreadyAssigned = You want to assign {0} as prefix for namespace {1} but it is already assigned for {2}
++signature.Canonicalizer.UnknownCanonicalizer = Unknown canonicalizer. No handler installed for URI {0}
++signature.DSA.invalidFormat = Invalid ASN.1 encoding of the DSA signature
++signature.Generation.signBeforeGetValue = You have to XMLSignature.sign(java.security.PrivateKey) first
++signature.Reference.ForbiddenResolver = It is forbidden to access resolver {0} when secure validation is enabled
++signature.signatureAlgorithm = It is forbidden to use algorithm {0} when secure validation is enabled
++signature.signaturePropertyHasNoTarget = The Target attribute of the SignatureProperty must be set
++signature.Transform.ErrorDuringTransform = A {1} was thrown during the {0} transform
++signature.Transform.NotYetImplemented = Transform {0} not yet implemented
++signature.Transform.NullPointerTransform = Null pointer as URI. Programming bug?
++signature.Transform.UnknownTransform = Unknown transformation. No handler installed for URI {0}
++signature.Transform.node = Current Node: {0}
++signature.Transform.nodeAndType = Current Node: {0}, type: {1} 
++signature.Util.BignumNonPositive = bigInteger.signum() must be positive
++signature.Util.NonTextNode = Not a text node
++signature.Util.TooManyChilds = Too many childs of Type {0} in {1}
++signature.Verification.certificateError = Certificate error
++signature.Verification.IndexOutOfBounds = Index {0} illegal. We only have {1} References
++signature.Verification.internalError = Internal error
++signature.Verification.InvalidDigestOrReference = Invalid digest of reference {0}
++signature.Verification.keyStore = KeyStore error
++signature.Verification.MissingID = Cannot resolve element with ID {0}
++signature.Verification.MissingResources = Cannot resolve external resource {0}
++signature.Verification.MultipleIDs = Multiple Elements with the same ID {0} were detected
++signature.Verification.NoSignatureElement = Input document contains no {0} Element in namespace {1}
++signature.Verification.Reference.NoInput = The Reference for URI {0} has no XMLSignatureInput
++signature.Verification.SignatureError = Signature error
++signature.XMLSignatureInput.MissingConstuctor = Cannot construct a XMLSignatureInput from class {0}
++signature.XMLSignatureInput.SerializeDOM = Input initialized with DOM Element. Use Canonicalization to serialize it
++signature.XMLSignatureInput.nodesetReference = Unable to convert to nodeset the reference
++transform.Init.IllegalContextArgument = Invalid context argument of class {0}. Must be String, org.w3c.dom.NodeList or java.io.InputStream.
++transform.init.NotInitialized =
++transform.init.wrongURI = Initialized with wrong URI. How could this happen? We implement {0} but {1} was used during initialization
++utils.Base64.IllegalBitlength = Illegal byte length; Data to be decoded must be a multiple of 4
++Base64Decoding = Error while decoding
++utils.resolver.noClass = Could not find a resolver for URI {0} and Base {1}
++xml.WrongContent = Cannot find {0} in {1}
++xml.WrongElement = Cannot create a {0} from a {1} element
++xpath.funcHere.documentsDiffer = The XPath is not in the same document as the context node
++xpath.funcHere.noXPathContext = Try to evaluate an XPath which uses the here() function but XPath is not inside an ds:XPath Element. XPath was : {0}
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/SignedInfo.java b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/SignedInfo.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/SignedInfo.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/SignedInfo.java
+@@ -25,6 +25,7 @@
+ import java.io.OutputStream;
+ import javax.crypto.SecretKey;
+ import javax.crypto.spec.SecretKeySpec;
++import javax.xml.XMLConstants;
+ import javax.xml.parsers.ParserConfigurationException;
+ 
+ import com.sun.org.apache.xml.internal.security.algorithms.SignatureAlgorithm;
+@@ -186,8 +187,10 @@
+                 javax.xml.parsers.DocumentBuilderFactory dbf =
+                     javax.xml.parsers.DocumentBuilderFactory.newInstance();
+                 dbf.setNamespaceAware(true);
++                dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING,
++                               Boolean.TRUE);
+                 javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
+-                org.w3c.dom.Document newdoc =
++                Document newdoc =
+                     db.parse(new ByteArrayInputStream(this._c14nizedBytes));
+                 Node imported =
+                     this._doc.importNode(newdoc.getDocumentElement(), true);
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java
+@@ -201,14 +201,13 @@
+ 
+       super(doc);
+ 
+-      String xmlnsDsPrefix =
+-         getDefaultPrefixBindings(Constants.SignatureSpecNS);
++      String xmlnsDsPrefix = getDefaultPrefix(Constants.SignatureSpecNS);
+       if (xmlnsDsPrefix == null) {
+          this._constructionElement.setAttributeNS
+             (Constants.NamespaceSpecNS, "xmlns", Constants.SignatureSpecNS);
+       } else {
+          this._constructionElement.setAttributeNS
+-            (Constants.NamespaceSpecNS, xmlnsDsPrefix, Constants.SignatureSpecNS);
++            (Constants.NamespaceSpecNS, "xmlns:" + xmlnsDsPrefix, Constants.SignatureSpecNS);
+       }
+       XMLUtils.addReturnToElement(this._constructionElement);
+ 
+@@ -242,14 +241,13 @@
+ 
+       super(doc);
+ 
+-      String xmlnsDsPrefix =
+-         getDefaultPrefixBindings(Constants.SignatureSpecNS);
++      String xmlnsDsPrefix = getDefaultPrefix(Constants.SignatureSpecNS);
+       if (xmlnsDsPrefix == null) {
+          this._constructionElement.setAttributeNS
+             (Constants.NamespaceSpecNS, "xmlns", Constants.SignatureSpecNS);
+       } else {
+          this._constructionElement.setAttributeNS
+-            (Constants.NamespaceSpecNS, xmlnsDsPrefix, Constants.SignatureSpecNS);
++            (Constants.NamespaceSpecNS, "xmlns:" + xmlnsDsPrefix, Constants.SignatureSpecNS);
+       }
+       XMLUtils.addReturnToElement(this._constructionElement);
+ 
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignatureInput.java b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignatureInput.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignatureInput.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignatureInput.java
+@@ -31,6 +31,7 @@
+ import java.util.List;
+ import java.util.Set;
+ 
++import javax.xml.XMLConstants;
+ import javax.xml.parsers.DocumentBuilder;
+ import javax.xml.parsers.DocumentBuilderFactory;
+ import javax.xml.parsers.ParserConfigurationException;
+@@ -601,6 +602,8 @@
+         DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
+         dfactory.setValidating(false);
+         dfactory.setNamespaceAware(true);
++        dfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING,
++                            Boolean.TRUE);
+         DocumentBuilder db = dfactory.newDocumentBuilder();
+         // select all nodes, also the comments.
+         try {
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/Transform.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/Transform.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/Transform.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/Transform.java
+@@ -2,29 +2,30 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-/*
+- * Copyright  1999-2004 The Apache Software Foundation.
++/**
++ * Licensed to the Apache Software Foundation (ASF) under one
++ * or more contributor license agreements. See the NOTICE file
++ * distributed with this work for additional information
++ * regarding copyright ownership. The ASF licenses this file
++ * to you under the Apache License, Version 2.0 (the
++ * "License"); you may not use this file except in compliance
++ * with the License. You may obtain a copy of the License at
+  *
+- *  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
+  *
+- *      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.
+- *
++ * Unless required by applicable law or agreed to in writing,
++ * software distributed under the License is distributed on an
++ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
++ * KIND, either express or implied. See the License for the
++ * specific language governing permissions and limitations
++ * under the License.
+  */
+ package com.sun.org.apache.xml.internal.security.transforms;
+ 
+ import java.io.IOException;
+ import java.io.OutputStream;
+-import java.security.AccessController;
+-import java.security.PrivilegedAction;
+-import java.util.HashMap;
++import java.util.concurrent.ConcurrentHashMap;
++import java.util.Map;
+ import javax.xml.parsers.ParserConfigurationException;
+ 
+ import com.sun.org.apache.xml.internal.security.c14n.CanonicalizationException;
+@@ -32,6 +33,18 @@
+ import com.sun.org.apache.xml.internal.security.exceptions.AlgorithmAlreadyRegisteredException;
+ import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
+ import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
++import com.sun.org.apache.xml.internal.security.transforms.implementations.TransformBase64Decode;
++import com.sun.org.apache.xml.internal.security.transforms.implementations.TransformC14N;
++import com.sun.org.apache.xml.internal.security.transforms.implementations.TransformC14N11;
++import com.sun.org.apache.xml.internal.security.transforms.implementations.TransformC14N11_WithComments;
++import com.sun.org.apache.xml.internal.security.transforms.implementations.TransformC14NExclusive;
++import com.sun.org.apache.xml.internal.security.transforms.implementations.TransformC14NExclusiveWithComments;
++import com.sun.org.apache.xml.internal.security.transforms.implementations.TransformC14NWithComments;
++import com.sun.org.apache.xml.internal.security.transforms.implementations.TransformEnvelopedSignature;
++import com.sun.org.apache.xml.internal.security.transforms.implementations.TransformXPath;
++import com.sun.org.apache.xml.internal.security.transforms.implementations.TransformXPath2Filter;
++import com.sun.org.apache.xml.internal.security.transforms.implementations.TransformXSLT;
++import com.sun.org.apache.xml.internal.security.utils.ClassLoaderUtils;
+ import com.sun.org.apache.xml.internal.security.utils.Constants;
+ import com.sun.org.apache.xml.internal.security.utils.HelperNodeList;
+ import com.sun.org.apache.xml.internal.security.utils.SignatureElementProxy;
+@@ -53,112 +66,31 @@
+  * @author Christian Geuer-Pollmann
+  * @see Transforms
+  * @see TransformSpi
+- *
+  */
+ public final class Transform extends SignatureElementProxy {
+ 
+-    /** {@link java.util.logging} logging facility */
+-    static java.util.logging.Logger log =
++    /** {@link org.apache.commons.logging} logging facility */
++    private static java.util.logging.Logger log =
+         java.util.logging.Logger.getLogger(Transform.class.getName());
+ 
+-    /** Field _alreadyInitialized */
+-    private static boolean alreadyInitialized = false;
++    /** All available Transform classes are registered here */
++    private static Map<String, Class<? extends TransformSpi>> transformSpiHash =
++        new ConcurrentHashMap<String, Class<? extends TransformSpi>>();
+ 
+-    /** All available Transform classes are registered here */
+-    private static HashMap transformClassHash = null;
+-
+-    private static HashMap transformSpiHash = new HashMap();
+-
+-    private TransformSpi transformSpi = null;
+-
+-    /**
+-     * Constructs {@link Transform}
+-     *
+-     * @param doc the {@link Document} in which <code>Transform</code> will be
+-     * placed
+-     * @param algorithmURI URI representation of
+-     * <code>Transform algorithm</code> which will be specified as parameter of
+-     * {@link #getInstance(Document, String)}, when generated. </br>
+-     * @param contextNodes the child node list of <code>Transform</code> element
+-     * @throws InvalidTransformException
+-     */
+-    public Transform(Document doc, String algorithmURI, NodeList contextNodes)
+-        throws InvalidTransformException {
+-
+-        super(doc);
+-
+-        this._constructionElement.setAttributeNS
+-            (null, Constants._ATT_ALGORITHM, algorithmURI);
+-
+-        transformSpi = getTransformSpi(algorithmURI);
+-        if (transformSpi == null) {
+-             Object exArgs[] = { algorithmURI };
+-             throw new InvalidTransformException(
+-                "signature.Transform.UnknownTransform", exArgs);
+-        }
+-
+-        if (log.isLoggable(java.util.logging.Level.FINE)) {
+-            log.log(java.util.logging.Level.FINE, "Create URI \"" + algorithmURI + "\" class \""
+-                   + transformSpi.getClass() + "\"");
+-            log.log(java.util.logging.Level.FINE, "The NodeList is " + contextNodes);
+-        }
+-
+-        // give it to the current document
+-        if (contextNodes != null) {
+-            for (int i = 0; i < contextNodes.getLength(); i++) {
+-               this._constructionElement.appendChild
+-                   (contextNodes.item(i).cloneNode(true));
+-            }
+-        }
+-    }
+-
+-    /**
+-     * This constructor can only be called from the {@link Transforms} object,
+-     * so it's protected.
+-     *
+-     * @param element <code>ds:Transform</code> element
+-     * @param BaseURI the URI of the resource where the XML instance was stored
+-     * @throws InvalidTransformException
+-     * @throws TransformationException
+-     * @throws XMLSecurityException
+-     */
+-    public Transform(Element element, String BaseURI)
+-        throws InvalidTransformException, TransformationException,
+-               XMLSecurityException {
+-
+-        super(element, BaseURI);
+-
+-        // retrieve Algorithm Attribute from ds:Transform
+-        String algorithmURI = element.getAttributeNS(null, Constants._ATT_ALGORITHM);
+-
+-        if (algorithmURI == null || algorithmURI.length() == 0) {
+-            Object exArgs[] = { Constants._ATT_ALGORITHM,
+-                                Constants._TAG_TRANSFORM };
+-            throw new TransformationException("xml.WrongContent", exArgs);
+-        }
+-
+-        transformSpi = getTransformSpi(algorithmURI);
+-        if (transformSpi == null) {
+-            Object exArgs[] = { algorithmURI };
+-            throw new InvalidTransformException(
+-                "signature.Transform.UnknownTransform", exArgs);
+-        }
+-    }
++    private final TransformSpi transformSpi;
+ 
+     /**
+      * Generates a Transform object that implements the specified
+      * <code>Transform algorithm</code> URI.
+      *
++     * @param doc the proxy {@link Document}
+      * @param algorithmURI <code>Transform algorithm</code> URI representation,
+      * such as specified in
+      * <a href=http://www.w3.org/TR/xmldsig-core/#sec-TransformAlg>Transform algorithm </a>
+-     * @param doc the proxy {@link Document}
+-     * @return <code>{@link Transform}</code> object
+      * @throws InvalidTransformException
+      */
+-    public static Transform getInstance(
+-        Document doc, String algorithmURI) throws InvalidTransformException {
+-        return getInstance(doc, algorithmURI, (NodeList) null);
++    public Transform(Document doc, String algorithmURI) throws InvalidTransformException {
++        this(doc, algorithmURI, (NodeList)null);
+     }
+ 
+     /**
+@@ -170,82 +102,160 @@
+      * <a href=http://www.w3.org/TR/xmldsig-core/#sec-TransformAlg>Transform algorithm </a>
+      * @param contextChild the child element of <code>Transform</code> element
+      * @param doc the proxy {@link Document}
+-     * @return <code>{@link Transform}</code> object
+      * @throws InvalidTransformException
+      */
+-    public static Transform getInstance(
+-        Document doc, String algorithmURI, Element contextChild)
++    public Transform(Document doc, String algorithmURI, Element contextChild)
+         throws InvalidTransformException {
++        super(doc);
++        HelperNodeList contextNodes = null;
+ 
+-        HelperNodeList contextNodes = new HelperNodeList();
++        if (contextChild != null) {
++            contextNodes = new HelperNodeList();
+ 
+-        XMLUtils.addReturnToElement(doc, contextNodes);
+-        contextNodes.appendChild(contextChild);
+-        XMLUtils.addReturnToElement(doc, contextNodes);
++            XMLUtils.addReturnToElement(doc, contextNodes);
++            contextNodes.appendChild(contextChild);
++            XMLUtils.addReturnToElement(doc, contextNodes);
++        }
+ 
+-        return getInstance(doc, algorithmURI, contextNodes);
++        transformSpi = initializeTransform(algorithmURI, contextNodes);
+     }
+ 
+     /**
+-     * Generates a Transform object that implements the specified
+-     * <code>Transform algorithm</code> URI.
++     * Constructs {@link Transform}
+      *
+-     * @param algorithmURI <code>Transform algorithm</code> URI form, such as
+-     * specified in <a href=http://www.w3.org/TR/xmldsig-core/#sec-TransformAlg>
+-     * Transform algorithm </a>
++     * @param doc the {@link Document} in which <code>Transform</code> will be
++     * placed
++     * @param algorithmURI URI representation of <code>Transform algorithm</code>
+      * @param contextNodes the child node list of <code>Transform</code> element
+-     * @param doc the proxy {@link Document}
+-     * @return <code>{@link Transform}</code> object
+      * @throws InvalidTransformException
+      */
+-    public static Transform getInstance(
+-        Document doc, String algorithmURI, NodeList contextNodes)
++    public Transform(Document doc, String algorithmURI, NodeList contextNodes)
+         throws InvalidTransformException {
+-        return new Transform(doc, algorithmURI, contextNodes);
++        super(doc);
++        transformSpi = initializeTransform(algorithmURI, contextNodes);
+     }
+ 
+     /**
+-     * Initalizes for this {@link Transform}.
++     * @param element <code>ds:Transform</code> element
++     * @param BaseURI the URI of the resource where the XML instance was stored
++     * @throws InvalidTransformException
++     * @throws TransformationException
++     * @throws XMLSecurityException
+      */
+-    public static void init() {
+-        if (!alreadyInitialized) {
+-            transformClassHash = new HashMap(10);
+-            // make sure builtin algorithms are all registered first
+-            com.sun.org.apache.xml.internal.security.Init.init();
+-            alreadyInitialized = true;
++    public Transform(Element element, String BaseURI)
++        throws InvalidTransformException, TransformationException, XMLSecurityException {
++        super(element, BaseURI);
++
++        // retrieve Algorithm Attribute from ds:Transform
++        String algorithmURI = element.getAttributeNS(null, Constants._ATT_ALGORITHM);
++
++        if (algorithmURI == null || algorithmURI.length() == 0) {
++            Object exArgs[] = { Constants._ATT_ALGORITHM, Constants._TAG_TRANSFORM };
++            throw new TransformationException("xml.WrongContent", exArgs);
++        }
++
++        Class<? extends TransformSpi> transformSpiClass = transformSpiHash.get(algorithmURI);
++        if (transformSpiClass == null) {
++            Object exArgs[] = { algorithmURI };
++            throw new InvalidTransformException("signature.Transform.UnknownTransform", exArgs);
++        }
++        try {
++            transformSpi = transformSpiClass.newInstance();
++        } catch (InstantiationException ex) {
++            Object exArgs[] = { algorithmURI };
++            throw new InvalidTransformException(
++                "signature.Transform.UnknownTransform", exArgs, ex
++            );
++        } catch (IllegalAccessException ex) {
++            Object exArgs[] = { algorithmURI };
++            throw new InvalidTransformException(
++                "signature.Transform.UnknownTransform", exArgs, ex
++            );
+         }
+     }
+ 
+     /**
+      * Registers implementing class of the Transform algorithm with algorithmURI
+      *
+-     * @param algorithmURI algorithmURI URI representation of
+-     * <code>Transform algorithm</code> will be specified as parameter of
+-     * {@link #getInstance(Document, String)}, when generate. </br>
++     * @param algorithmURI algorithmURI URI representation of <code>Transform algorithm</code>
+      * @param implementingClass <code>implementingClass</code> the implementing
+      * class of {@link TransformSpi}
+      * @throws AlgorithmAlreadyRegisteredException if specified algorithmURI
+      * is already registered
+      */
++    @SuppressWarnings("unchecked")
+     public static void register(String algorithmURI, String implementingClass)
++        throws AlgorithmAlreadyRegisteredException, ClassNotFoundException,
++            InvalidTransformException {
++        // are we already registered?
++        Class<? extends TransformSpi> transformSpi = transformSpiHash.get(algorithmURI);
++        if (transformSpi != null) {
++            Object exArgs[] = { algorithmURI, transformSpi };
++            throw new AlgorithmAlreadyRegisteredException("algorithm.alreadyRegistered", exArgs);
++        }
++        Class<? extends TransformSpi> transformSpiClass =
++            (Class<? extends TransformSpi>)
++                ClassLoaderUtils.loadClass(implementingClass, Transform.class);
++        transformSpiHash.put(algorithmURI, transformSpiClass);
++    }
++
++    /**
++     * Registers implementing class of the Transform algorithm with algorithmURI
++     *
++     * @param algorithmURI algorithmURI URI representation of <code>Transform algorithm</code>
++     * @param implementingClass <code>implementingClass</code> the implementing
++     * class of {@link TransformSpi}
++     * @throws AlgorithmAlreadyRegisteredException if specified algorithmURI
++     * is already registered
++     */
++    public static void register(String algorithmURI, Class<? extends TransformSpi> implementingClass)
+         throws AlgorithmAlreadyRegisteredException {
++        // are we already registered?
++        Class<? extends TransformSpi> transformSpi = transformSpiHash.get(algorithmURI);
++        if (transformSpi != null) {
++            Object exArgs[] = { algorithmURI, transformSpi };
++            throw new AlgorithmAlreadyRegisteredException("algorithm.alreadyRegistered", exArgs);
++        }
++        transformSpiHash.put(algorithmURI, implementingClass);
++    }
+ 
+-        // are we already registered?
+-        Class registeredClass = getImplementingClass(algorithmURI);
+-        if ((registeredClass != null) ) {
+-            Object exArgs[] = { algorithmURI, registeredClass };
+-            throw new AlgorithmAlreadyRegisteredException(
+-               "algorithm.alreadyRegistered", exArgs);
+-        }
+-
+-        ClassLoader cl = Thread.currentThread().getContextClassLoader();
+-
+-        try {
+-            transformClassHash.put
+-                (algorithmURI, Class.forName(implementingClass, true, cl));
+-        } catch (ClassNotFoundException e) {
+-            throw new RuntimeException(e);
+-        }
++    /**
++     * This method registers the default algorithms.
++     */
++    public static void registerDefaultAlgorithms() {
++        transformSpiHash.put(
++            Transforms.TRANSFORM_BASE64_DECODE, TransformBase64Decode.class
++        );
++        transformSpiHash.put(
++            Transforms.TRANSFORM_C14N_OMIT_COMMENTS, TransformC14N.class
++        );
++        transformSpiHash.put(
++            Transforms.TRANSFORM_C14N_WITH_COMMENTS, TransformC14NWithComments.class
++        );
++        transformSpiHash.put(
++            Transforms.TRANSFORM_C14N11_OMIT_COMMENTS, TransformC14N11.class
++        );
++        transformSpiHash.put(
++            Transforms.TRANSFORM_C14N11_WITH_COMMENTS, TransformC14N11_WithComments.class
++        );
++        transformSpiHash.put(
++            Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS, TransformC14NExclusive.class
++        );
++        transformSpiHash.put(
++            Transforms.TRANSFORM_C14N_EXCL_WITH_COMMENTS, TransformC14NExclusiveWithComments.class
++        );
++        transformSpiHash.put(
++            Transforms.TRANSFORM_XPATH, TransformXPath.class
++        );
++        transformSpiHash.put(
++            Transforms.TRANSFORM_ENVELOPED_SIGNATURE, TransformEnvelopedSignature.class
++        );
++        transformSpiHash.put(
++            Transforms.TRANSFORM_XSLT, TransformXSLT.class
++        );
++        transformSpiHash.put(
++            Transforms.TRANSFORM_XPATH2FILTER, TransformXPath2Filter.class
++        );
+     }
+ 
+     /**
+@@ -254,8 +264,7 @@
+      * @return the URI representation of Transformation algorithm
+      */
+     public String getURI() {
+-        return this._constructionElement.getAttributeNS
+-            (null, Constants._ATT_ALGORITHM);
++        return this._constructionElement.getAttributeNS(null, Constants._ATT_ALGORITHM);
+     }
+ 
+     /**
+@@ -271,30 +280,15 @@
+      * @throws TransformationException
+      */
+     public XMLSignatureInput performTransform(XMLSignatureInput input)
+-         throws IOException, CanonicalizationException,
+-                InvalidCanonicalizerException, TransformationException {
+-
+-        XMLSignatureInput result = null;
+-
+-        try {
+-            result = transformSpi.enginePerformTransform(input, this);
+-        } catch (ParserConfigurationException ex) {
+-            Object exArgs[] = { this.getURI(), "ParserConfigurationException" };
+-            throw new CanonicalizationException(
+-                "signature.Transform.ErrorDuringTransform", exArgs, ex);
+-        } catch (SAXException ex) {
+-            Object exArgs[] = { this.getURI(), "SAXException" };
+-            throw new CanonicalizationException(
+-                "signature.Transform.ErrorDuringTransform", exArgs, ex);
+-        }
+-
+-        return result;
++        throws IOException, CanonicalizationException,
++               InvalidCanonicalizerException, TransformationException {
++        return performTransform(input, null);
+     }
+ 
+     /**
+      * Transforms the input, and generates {@link XMLSignatureInput} as output.
+      *
+-     * @param input input {@link XMLSignatureInput} which can supplied Octet
++     * @param input input {@link XMLSignatureInput} which can supplied Octect
+      * Stream and NodeSet as Input of Transformation
+      * @param os where to output the result of the last transformation
+      * @return the {@link XMLSignatureInput} class as the result of
+@@ -304,10 +298,10 @@
+      * @throws InvalidCanonicalizerException
+      * @throws TransformationException
+      */
+-    public XMLSignatureInput performTransform(XMLSignatureInput input,
+-        OutputStream os) throws IOException, CanonicalizationException,
++    public XMLSignatureInput performTransform(
++        XMLSignatureInput input, OutputStream os
++    ) throws IOException, CanonicalizationException,
+         InvalidCanonicalizerException, TransformationException {
+-
+         XMLSignatureInput result = null;
+ 
+         try {
+@@ -325,43 +319,52 @@
+         return result;
+     }
+ 
+-    /**
+-     * Method getImplementingClass
+-     *
+-     * @param URI
+-     * @return The name of the class implementing the URI.
+-     */
+-    private static Class getImplementingClass(String URI) {
+-        return (Class) transformClassHash.get(URI);
+-    }
+-
+-    private static TransformSpi getTransformSpi(String URI)
+-        throws InvalidTransformException {
+-        try {
+-            Object value = transformSpiHash.get(URI);
+-            if (value != null) {
+-                return (TransformSpi) value;
+-            }
+-            Class cl = (Class) transformClassHash.get(URI);
+-            if (cl != null) {
+-                TransformSpi tr = (TransformSpi) cl.newInstance();
+-                transformSpiHash.put(URI, tr);
+-                return tr;
+-            }
+-        } catch (InstantiationException ex) {
+-            Object exArgs[] = { URI };
+-            throw new InvalidTransformException(
+-                "signature.Transform.UnknownTransform", exArgs, ex);
+-        } catch (IllegalAccessException ex) {
+-            Object exArgs[] = { URI };
+-            throw new InvalidTransformException(
+-                "signature.Transform.UnknownTransform", exArgs, ex);
+-        }
+-        return null;
+-    }
+-
+     /** @inheritDoc */
+     public String getBaseLocalName() {
+         return Constants._TAG_TRANSFORM;
+     }
++
++    /**
++     * Initialize the transform object.
++     */
++    private TransformSpi initializeTransform(String algorithmURI, NodeList contextNodes)
++        throws InvalidTransformException {
++
++        this._constructionElement.setAttributeNS(null, Constants._ATT_ALGORITHM, algorithmURI);
++
++        Class<? extends TransformSpi> transformSpiClass = transformSpiHash.get(algorithmURI);
++        if (transformSpiClass == null) {
++            Object exArgs[] = { algorithmURI };
++            throw new InvalidTransformException("signature.Transform.UnknownTransform", exArgs);
++        }
++        TransformSpi newTransformSpi = null;
++        try {
++            newTransformSpi = transformSpiClass.newInstance();
++        } catch (InstantiationException ex) {
++            Object exArgs[] = { algorithmURI };
++            throw new InvalidTransformException(
++                "signature.Transform.UnknownTransform", exArgs, ex
++            );
++        } catch (IllegalAccessException ex) {
++            Object exArgs[] = { algorithmURI };
++            throw new InvalidTransformException(
++                "signature.Transform.UnknownTransform", exArgs, ex
++            );
++        }
++
++        if (log.isLoggable(java.util.logging.Level.FINE)) {
++            log.log(java.util.logging.Level.FINE, "Create URI \"" + algorithmURI + "\" class \""
++                      + newTransformSpi.getClass() + "\"");
++            log.log(java.util.logging.Level.FINE, "The NodeList is " + contextNodes);
++        }
++
++        // give it to the current document
++        if (contextNodes != null) {
++            for (int i = 0; i < contextNodes.getLength(); i++) {
++                this._constructionElement.appendChild(contextNodes.item(i).cloneNode(true));
++            }
++        }
++        return newTransformSpi;
++    }
++
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/Transforms.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/Transforms.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/Transforms.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/Transforms.java
+@@ -158,8 +158,7 @@
+             if (log.isLoggable(java.util.logging.Level.FINE))
+                 log.log(java.util.logging.Level.FINE, "Transforms.addTransform(" + transformURI + ")");
+ 
+-            Transform transform =
+-                Transform.getInstance(this._doc, transformURI);
++            Transform transform = new Transform(this._doc, transformURI);
+ 
+             this.addTransform(transform);
+         } catch (InvalidTransformException ex) {
+@@ -184,8 +183,7 @@
+             if (log.isLoggable(java.util.logging.Level.FINE))
+                 log.log(java.util.logging.Level.FINE, "Transforms.addTransform(" + transformURI + ")");
+ 
+-            Transform transform =
+-                Transform.getInstance(this._doc, transformURI, contextElement);
++            Transform transform = new Transform(this._doc, transformURI, contextElement);
+ 
+             this.addTransform(transform);
+         } catch (InvalidTransformException ex) {
+@@ -207,8 +205,7 @@
+            throws TransformationException {
+ 
+         try {
+-            Transform transform =
+-                Transform.getInstance(this._doc, transformURI, contextNodes);
++            Transform transform = new Transform(this._doc, transformURI, contextNodes);
+             this.addTransform(transform);
+         } catch (InvalidTransformException ex) {
+             throw new TransformationException("empty", ex);
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformBase64Decode.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformBase64Decode.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformBase64Decode.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformBase64Decode.java
+@@ -26,6 +26,7 @@
+ import java.io.IOException;
+ import java.io.OutputStream;
+ 
++import javax.xml.XMLConstants;
+ import javax.xml.parsers.DocumentBuilderFactory;
+ import javax.xml.parsers.ParserConfigurationException;
+ 
+@@ -145,11 +146,13 @@
+       }
+ 
+          try {
+-            //Exceptional case there is current not text case testing this(Before it was a
+-                    //a common case).
++            // Exceptional case there is current not text case testing this
++            // (before it was a a common case).
++            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
++            dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING,
++                           Boolean.TRUE);
+             Document doc =
+-               DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(
+-                  input.getOctetStream());
++                dbf.newDocumentBuilder().parse(input.getOctetStream());
+ 
+             Element rootNode = doc.getDocumentElement();
+             StringBuffer sb = new StringBuffer();
+@@ -157,13 +160,13 @@
+             byte[] decodedBytes = Base64.decode(sb.toString());
+ 
+             return new XMLSignatureInput(decodedBytes);
+-                  } catch (ParserConfigurationException e) {
+-                          throw new TransformationException("c14n.Canonicalizer.Exception",e);
+-                  } catch (SAXException e) {
+-                          throw new TransformationException("SAX exception", e);
+-                  }
++         } catch (ParserConfigurationException e) {
++            throw new TransformationException("c14n.Canonicalizer.Exception",e);
++         } catch (SAXException e) {
++            throw new TransformationException("SAX exception", e);
++         }
+         } catch (Base64DecodingException e) {
+-        throw new TransformationException("Base64Decoding", e);
++            throw new TransformationException("Base64Decoding", e);
+         }
+    }
+ 
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformXSLT.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformXSLT.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformXSLT.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformXSLT.java
+@@ -26,6 +26,7 @@
+ import java.io.OutputStream;
+ import java.lang.reflect.Method;
+ 
++import javax.xml.XMLConstants;
+ import javax.xml.transform.Source;
+ import javax.xml.transform.Transformer;
+ import javax.xml.transform.TransformerConfigurationException;
+@@ -62,14 +63,6 @@
+    static final String defaultXSLTSpecNSprefix = "xslt";
+    static final String XSLTSTYLESHEET          = "stylesheet";
+ 
+-   // check for secure processing feature
+-   private static Class xClass = null;
+-   static {
+-      try {
+-         xClass = Class.forName("javax.xml.XMLConstants");
+-      } catch (Exception e) {}
+-   }
+-
+    static java.util.logging.Logger log =
+       java.util.logging.Logger.getLogger(
+          TransformXSLT.class.getName());
+@@ -101,10 +94,6 @@
+     protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input,OutputStream baos, Transform _transformObject)
+     throws IOException,
+            TransformationException {
+-      if (xClass == null) {
+-         Object exArgs[] = { "SECURE_PROCESSING_FEATURE not supported" };
+-         throw new TransformationException("generic.EmptyMessage", exArgs);
+-      }
+       try {
+          Element transformElement = _transformObject.getElement();
+ 
+@@ -119,11 +108,10 @@
+          }
+ 
+          TransformerFactory tFactory = TransformerFactory.newInstance();
+-         Class c = tFactory.getClass();
+-         Method m = c.getMethod("setFeature", new Class[] {String.class, boolean.class});
++
+          // Process XSLT stylesheets in a secure manner
+-         m.invoke(tFactory, new Object[] {"http://javax.xml.XMLConstants/feature/secure-processing", Boolean.TRUE});
+-
++         tFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING,
++                             Boolean.TRUE);
+          /*
+           * This transform requires an octet stream as input. If the actual
+           * input is an XPath node-set, then the signature application should
+@@ -193,18 +181,6 @@
+          Object exArgs[] = { ex.getMessage() };
+ 
+          throw new TransformationException("generic.EmptyMessage", exArgs, ex);
+-      } catch (NoSuchMethodException ex) {
+-         Object exArgs[] = { ex.getMessage() };
+-
+-         throw new TransformationException("generic.EmptyMessage", exArgs, ex);
+-      } catch (IllegalAccessException ex) {
+-         Object exArgs[] = { ex.getMessage() };
+-
+-         throw new TransformationException("generic.EmptyMessage", exArgs, ex);
+-      } catch (java.lang.reflect.InvocationTargetException ex) {
+-         Object exArgs[] = { ex.getMessage() };
+-
+-         throw new TransformationException("generic.EmptyMessage", exArgs, ex);
+       }
+    }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/ElementProxy.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/ElementProxy.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/ElementProxy.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/ElementProxy.java
+@@ -2,28 +2,29 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-/*
+- * Copyright 1999-2008 The Apache Software Foundation.
++/**
++ * Licensed to the Apache Software Foundation (ASF) under one
++ * or more contributor license agreements. See the NOTICE file
++ * distributed with this work for additional information
++ * regarding copyright ownership. The ASF licenses this file
++ * to you under the Apache License, Version 2.0 (the
++ * "License"); you may not use this file except in compliance
++ * with the License. You may obtain a copy of the License at
+  *
+- *  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
+  *
+- *      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.
+- *
++ * Unless required by applicable law or agreed to in writing,
++ * software distributed under the License is distributed on an
++ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
++ * KIND, either express or implied. See the License for the
++ * specific language governing permissions and limitations
++ * under the License.
+  */
+ package com.sun.org.apache.xml.internal.security.utils;
+ 
+-
+-
+ import java.math.BigInteger;
+-import java.util.HashMap;
++import java.util.concurrent.ConcurrentHashMap;
++import java.util.Map;
+ 
+ import com.sun.org.apache.xml.internal.security.exceptions.Base64DecodingException;
+ import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
+@@ -34,467 +35,432 @@
+ import org.w3c.dom.NodeList;
+ import org.w3c.dom.Text;
+ 
+-
+ /**
+  * This is the base class to all Objects which have a direct 1:1 mapping to an
+  * Element in a particular namespace.
+- *
+- * @author $Author: mullan $
+  */
+ public abstract class ElementProxy {
+ 
+-   /** {@link java.util.logging} logging facility */
+-    static java.util.logging.Logger log =
++    protected static final java.util.logging.Logger log =
+         java.util.logging.Logger.getLogger(ElementProxy.class.getName());
+ 
+-   /**
+-    * Returns the namespace of the Elements of the sub-class.
+-    *
+-    * @return the namespace of the Elements of the sub-class.
+-    */
+-   public abstract String getBaseNamespace();
++    /** Field constructionElement */
++    protected Element _constructionElement = null;
+ 
+-   /**
+-    * Returns the localname of the Elements of the sub-class.
+-    *
+-    * @return the localname of the Elements of the sub-class.
+-    */
+-   public abstract String getBaseLocalName();
++    /** Field baseURI */
++    protected String _baseURI = null;
+ 
+-   /** Field _constructionElement */
+-   protected Element _constructionElement = null;
++    /** Field doc */
++    protected Document _doc = null;
+ 
+-   /** Field _baseURI */
+-   protected String _baseURI = null;
++    /** Field prefixMappings */
++    private static Map<String, String> prefixMappings = new ConcurrentHashMap<String, String>();
+ 
+-   /** Field _doc */
+-   protected Document _doc = null;
++    /**
++     * Constructor ElementProxy
++     *
++     */
++    public ElementProxy() {
++    }
+ 
+-   /**
+-    * Constructor ElementProxy
+-    *
+-    */
+-   public ElementProxy() {
+-   }
++    /**
++     * Constructor ElementProxy
++     *
++     * @param doc
++     */
++    public ElementProxy(Document doc) {
++        if (doc == null) {
++            throw new RuntimeException("Document is null");
++        }
+ 
+-   /**
+-    * Constructor ElementProxy
+-    *
+-    * @param doc
+-    */
+-   public ElementProxy(Document doc) {
+-      if (doc == null) {
+-         throw new RuntimeException("Document is null");
+-      }
++        this._doc = doc;
++        this._constructionElement =
++            createElementForFamilyLocal(this._doc, this.getBaseNamespace(), this.getBaseLocalName());
++    }
+ 
+-      this._doc = doc;
+-      this._constructionElement = createElementForFamilyLocal(this._doc,
+-                  this.getBaseNamespace(), this.getBaseLocalName());
+-   }
+-   protected Element createElementForFamilyLocal(Document doc, String namespace,
+-           String localName) {
+-                  Element result = null;
+-              if (namespace == null) {
+-                 result = doc.createElementNS(null, localName);
+-              } else {
+-                  String baseName=this.getBaseNamespace();
+-                  String prefix=ElementProxy.getDefaultPrefix(baseName);
+-                 if ((prefix == null) || (prefix.length() == 0)) {
+-                    result = doc.createElementNS(namespace, localName);
++    /**
++     * Constructor ElementProxy
++     *
++     * @param element
++     * @param BaseURI
++     * @throws XMLSecurityException
++     */
++    public ElementProxy(Element element, String BaseURI) throws XMLSecurityException {
++        if (element == null) {
++            throw new XMLSecurityException("ElementProxy.nullElement");
++        }
+ 
+-                    result.setAttributeNS(Constants.NamespaceSpecNS, "xmlns",
+-                                          namespace);
+-                 } else {
+-                         String tagName=null;
+-                         String defaultPrefixNaming=ElementProxy.getDefaultPrefixBindings(baseName);
+-                         StringBuffer sb=new StringBuffer(prefix);
+-                         sb.append(':');
+-                         sb.append(localName);
+-                         tagName=sb.toString();
+-                    result = doc.createElementNS(namespace, tagName );
++        if (log.isLoggable(java.util.logging.Level.FINE)) {
++            log.log(java.util.logging.Level.FINE, "setElement(\"" + element.getTagName() + "\", \"" + BaseURI + "\")");
++        }
+ 
+-                    result.setAttributeNS(Constants.NamespaceSpecNS,  defaultPrefixNaming,
+-                                          namespace);
+-                 }
+-              }
+-              return result;
+-}
++        this._doc = element.getOwnerDocument();
++        this._constructionElement = element;
++        this._baseURI = BaseURI;
+ 
++        this.guaranteeThatElementInCorrectSpace();
++    }
+ 
+-   /**
+-    * This method creates an Element in a given namespace with a given localname.
+-    * It uses the {@link ElementProxy#getDefaultPrefix} method to decide whether
+-    * a particular prefix is bound to that namespace.
+-    * <BR />
+-    * This method was refactored out of the constructor.
+-    *
+-    * @param doc
+-    * @param namespace
+-    * @param localName
+-    * @return The element created.
+-    */
+-   public static Element createElementForFamily(Document doc, String namespace,
+-           String localName) {
+-       //Element nscontext = XMLUtils.createDSctx(doc, "x", namespace);
+-      Element result = null;
+-      String prefix = ElementProxy.getDefaultPrefix(namespace);
++    /**
++     * Returns the namespace of the Elements of the sub-class.
++     *
++     * @return the namespace of the Elements of the sub-class.
++     */
++    public abstract String getBaseNamespace();
+ 
+-      if (namespace == null) {
+-         result = doc.createElementNS(null, localName);
+-      } else {
+-         if ((prefix == null) || (prefix.length() == 0)) {
+-            result = doc.createElementNS(namespace, localName);
++    /**
++     * Returns the localname of the Elements of the sub-class.
++     *
++     * @return the localname of the Elements of the sub-class.
++     */
++    public abstract String getBaseLocalName();
+ 
+-            result.setAttributeNS(Constants.NamespaceSpecNS, "xmlns",
+-                                  namespace);
+-         } else {
+-            result = doc.createElementNS(namespace, prefix + ":" + localName);
+ 
+-            result.setAttributeNS(Constants.NamespaceSpecNS,  ElementProxy.getDefaultPrefixBindings(namespace),
+-                                  namespace);
+-         }
+-      }
++    protected Element createElementForFamilyLocal(
++        Document doc, String namespace, String localName
++    ) {
++        Element result = null;
++        if (namespace == null) {
++            result = doc.createElementNS(null, localName);
++        } else {
++            String baseName = this.getBaseNamespace();
++            String prefix = ElementProxy.getDefaultPrefix(baseName);
++            if ((prefix == null) || (prefix.length() == 0)) {
++                result = doc.createElementNS(namespace, localName);
++                result.setAttributeNS(Constants.NamespaceSpecNS, "xmlns", namespace);
++            } else {
++                result = doc.createElementNS(namespace, prefix + ":" + localName);
++                result.setAttributeNS(Constants.NamespaceSpecNS, "xmlns:" + prefix, namespace);
++            }
++        }
++        return result;
++    }
+ 
+-      return result;
+-   }
+ 
+-   /**
+-    * Method setElement
+-    *
+-    * @param element
+-    * @param BaseURI
+-    * @throws XMLSecurityException
+-    */
+-   public void setElement(Element element, String BaseURI)
+-           throws XMLSecurityException {
++    /**
++     * This method creates an Element in a given namespace with a given localname.
++     * It uses the {@link ElementProxy#getDefaultPrefix} method to decide whether
++     * a particular prefix is bound to that namespace.
++     * <BR />
++     * This method was refactored out of the constructor.
++     *
++     * @param doc
++     * @param namespace
++     * @param localName
++     * @return The element created.
++     */
++    public static Element createElementForFamily(Document doc, String namespace, String localName) {
++        Element result = null;
++        String prefix = ElementProxy.getDefaultPrefix(namespace);
+ 
+-      if (element == null) {
+-         throw new XMLSecurityException("ElementProxy.nullElement");
+-      }
++        if (namespace == null) {
++            result = doc.createElementNS(null, localName);
++        } else {
++            if ((prefix == null) || (prefix.length() == 0)) {
++                result = doc.createElementNS(namespace, localName);
++                result.setAttributeNS(Constants.NamespaceSpecNS, "xmlns", namespace);
++            } else {
++                result = doc.createElementNS(namespace, prefix + ":" + localName);
++                result.setAttributeNS(Constants.NamespaceSpecNS, "xmlns:" + prefix, namespace);
++            }
++        }
+ 
+-      if (log.isLoggable(java.util.logging.Level.FINE)) {
+-        log.log(java.util.logging.Level.FINE, "setElement(" + element.getTagName() + ", \"" + BaseURI + "\"");
+-      }
++        return result;
++    }
+ 
+-      this._doc = element.getOwnerDocument();
+-      this._constructionElement = element;
+-      this._baseURI = BaseURI;
+-   }
++    /**
++     * Method setElement
++     *
++     * @param element
++     * @param BaseURI
++     * @throws XMLSecurityException
++     */
++    public void setElement(Element element, String BaseURI) throws XMLSecurityException {
++        if (element == null) {
++            throw new XMLSecurityException("ElementProxy.nullElement");
++        }
+ 
+-   /**
+-    * Constructor ElementProxy
+-    *
+-    * @param element
+-    * @param BaseURI
+-    * @throws XMLSecurityException
+-    */
+-   public ElementProxy(Element element, String BaseURI)
+-           throws XMLSecurityException {
+-      if (element == null) {
+-         throw new XMLSecurityException("ElementProxy.nullElement");
+-      }
++        if (log.isLoggable(java.util.logging.Level.FINE)) {
++            log.log(java.util.logging.Level.FINE, "setElement(" + element.getTagName() + ", \"" + BaseURI + "\"");
++        }
+ 
+-      if (log.isLoggable(java.util.logging.Level.FINE)) {
+-        log.log(java.util.logging.Level.FINE, "setElement(\"" + element.getTagName() + "\", \"" + BaseURI
+-                + "\")");
+-      }
++        this._doc = element.getOwnerDocument();
++        this._constructionElement = element;
++        this._baseURI = BaseURI;
++    }
+ 
+-      this._doc = element.getOwnerDocument();
+-      this._constructionElement = element;
+-      this._baseURI = BaseURI;
+ 
+-      this.guaranteeThatElementInCorrectSpace();
+-   }
++    /**
++     * Returns the Element which was constructed by the Object.
++     *
++     * @return the Element which was constructed by the Object.
++     */
++    public final Element getElement() {
++        return this._constructionElement;
++    }
+ 
+-   /**
+-    * Returns the Element which was constructed by the Object.
+-    *
+-    * @return the Element which was constructed by the Object.
+-    */
+-   public final Element getElement() {
+-      return this._constructionElement;
+-   }
++    /**
++     * Returns the Element plus a leading and a trailing CarriageReturn Text node.
++     *
++     * @return the Element which was constructed by the Object.
++     */
++    public final NodeList getElementPlusReturns() {
+ 
+-   /**
+-    * Returns the Element plus a leading and a trailing CarriageReturn Text node.
+-    *
+-    * @return the Element which was constructed by the Object.
+-    */
+-   public final NodeList getElementPlusReturns() {
++        HelperNodeList nl = new HelperNodeList();
+ 
+-      HelperNodeList nl = new HelperNodeList();
++        nl.appendChild(this._doc.createTextNode("\n"));
++        nl.appendChild(this.getElement());
++        nl.appendChild(this._doc.createTextNode("\n"));
+ 
+-      nl.appendChild(this._doc.createTextNode("\n"));
+-      nl.appendChild(this.getElement());
+-      nl.appendChild(this._doc.createTextNode("\n"));
++        return nl;
++    }
+ 
+-      return nl;
+-   }
++    /**
++     * Method getDocument
++     *
++     * @return the Document where this element is contained.
++     */
++    public Document getDocument() {
++        return this._doc;
++    }
+ 
+-   /**
+-    * Method getDocument
+-    *
+-    * @return the Document where this element is contained.
+-    */
+-   public Document getDocument() {
+-      return this._doc;
+-   }
++    /**
++     * Method getBaseURI
++     *
++     * @return the base uri of the namespace of this element
++     */
++    public String getBaseURI() {
++        return this._baseURI;
++    }
+ 
+-   /**
+-    * Method getBaseURI
+-    *
+-    * @return the base uri of the namespace of this element
+-    */
+-   public String getBaseURI() {
+-      return this._baseURI;
+-   }
++    /**
++     * Method guaranteeThatElementInCorrectSpace
++     *
++     * @throws XMLSecurityException
++     */
++    void guaranteeThatElementInCorrectSpace() throws XMLSecurityException {
+ 
+-   static ElementChecker checker = new ElementCheckerImpl.InternedNsChecker();
++        String expectedLocalName = this.getBaseLocalName();
++        String expectedNamespaceUri = this.getBaseNamespace();
+ 
+-   /**
+-    * Method guaranteeThatElementInCorrectSpace
+-    *
+-    * @throws XMLSecurityException
+-    */
+-   void guaranteeThatElementInCorrectSpace()
+-           throws XMLSecurityException {
++        String actualLocalName = this._constructionElement.getLocalName();
++        String actualNamespaceUri = this._constructionElement.getNamespaceURI();
+ 
+-          checker.guaranteeThatElementInCorrectSpace(this,this._constructionElement);
++        if(!expectedNamespaceUri.equals(actualNamespaceUri)
++            && !expectedLocalName.equals(actualLocalName)) {
++            Object exArgs[] = { actualNamespaceUri + ":" + actualLocalName,
++                                expectedNamespaceUri + ":" + expectedLocalName};
++            throw new XMLSecurityException("xml.WrongElement", exArgs);
++        }
++    }
+ 
+-   }
++    /**
++     * Method addBigIntegerElement
++     *
++     * @param bi
++     * @param localname
++     */
++    public void addBigIntegerElement(BigInteger bi, String localname) {
++        if (bi != null) {
++            Element e = XMLUtils.createElementInSignatureSpace(this._doc, localname);
+ 
+-   /**
+-    * Method setVal
+-    *
+-    * @param bi
+-    * @param localname
+-    */
+-   public void addBigIntegerElement(BigInteger bi, String localname) {
++            Base64.fillElementWithBigInteger(e, bi);
++            this._constructionElement.appendChild(e);
++            XMLUtils.addReturnToElement(this._constructionElement);
++        }
++    }
+ 
+-      if (bi != null) {
+-         Element e = XMLUtils.createElementInSignatureSpace(this._doc,
+-                        localname);
++    /**
++     * Method addBase64Element
++     *
++     * @param bytes
++     * @param localname
++     */
++    public void addBase64Element(byte[] bytes, String localname) {
++        if (bytes != null) {
++            Element e = Base64.encodeToElement(this._doc, localname, bytes);
+ 
+-         Base64.fillElementWithBigInteger(e, bi);
+-         this._constructionElement.appendChild(e);
+-         XMLUtils.addReturnToElement(this._constructionElement);
+-      }
+-   }
++            this._constructionElement.appendChild(e);
++            if (!XMLUtils.ignoreLineBreaks()) {
++                this._constructionElement.appendChild(this._doc.createTextNode("\n"));
++            }
++        }
++    }
+ 
+-   /**
+-    * Method addBase64Element
+-    *
+-    * @param bytes
+-    * @param localname
+-    */
+-   public void addBase64Element(byte[] bytes, String localname) {
++    /**
++     * Method addTextElement
++     *
++     * @param text
++     * @param localname
++     */
++    public void addTextElement(String text, String localname) {
++        Element e = XMLUtils.createElementInSignatureSpace(this._doc, localname);
++        Text t = this._doc.createTextNode(text);
+ 
+-      if (bytes != null) {
++        e.appendChild(t);
++        this._constructionElement.appendChild(e);
++        XMLUtils.addReturnToElement(this._constructionElement);
++    }
+ 
+-         Element e = Base64.encodeToElement(this._doc, localname, bytes);
++    /**
++     * Method addBase64Text
++     *
++     * @param bytes
++     */
++    public void addBase64Text(byte[] bytes) {
++        if (bytes != null) {
++            Text t = XMLUtils.ignoreLineBreaks()
++                ? this._doc.createTextNode(Base64.encode(bytes))
++                : this._doc.createTextNode("\n" + Base64.encode(bytes) + "\n");
++            this._constructionElement.appendChild(t);
++        }
++    }
+ 
+-         this._constructionElement.appendChild(e);
+-         if (!XMLUtils.ignoreLineBreaks()) {
+-            this._constructionElement.appendChild(this._doc.createTextNode("\n"));
+-         }
+-      }
+-   }
++    /**
++     * Method addText
++     *
++     * @param text
++     */
++    public void addText(String text) {
++        if (text != null) {
++            Text t = this._doc.createTextNode(text);
+ 
+-   /**
+-    * Method addTextElement
+-    *
+-    * @param text
+-    * @param localname
+-    */
+-   public void addTextElement(String text, String localname) {
++            this._constructionElement.appendChild(t);
++        }
++    }
+ 
+-      Element e = XMLUtils.createElementInSignatureSpace(this._doc, localname);
+-      Text t = this._doc.createTextNode(text);
++    /**
++     * Method getVal
++     *
++     * @param localname
++     * @param namespace
++     * @return The biginteger contained in the given element
++     * @throws Base64DecodingException
++     */
++    public BigInteger getBigIntegerFromChildElement(
++        String localname, String namespace
++    ) throws Base64DecodingException {
++        return Base64.decodeBigIntegerFromText(
++            XMLUtils.selectNodeText(
++                this._constructionElement.getFirstChild(), namespace, localname, 0
++            )
++        );
++    }
+ 
+-      e.appendChild(t);
+-      this._constructionElement.appendChild(e);
+-      XMLUtils.addReturnToElement(this._constructionElement);
+-   }
++    /**
++     * Method getBytesFromChildElement
++     * @deprecated
++     * @param localname
++     * @param namespace
++     * @return the bytes
++     * @throws XMLSecurityException
++     */
++    @Deprecated
++    public byte[] getBytesFromChildElement(String localname, String namespace)
++        throws XMLSecurityException {
++        Element e =
++            XMLUtils.selectNode(
++                this._constructionElement.getFirstChild(), namespace, localname, 0
++            );
+ 
+-   /**
+-    * Method addBase64Text
+-    *
+-    * @param bytes
+-    */
+-   public void addBase64Text(byte[] bytes) {
++        return Base64.decode(e);
++    }
+ 
+-      if (bytes != null) {
+-         Text t = XMLUtils.ignoreLineBreaks()
+-             ? this._doc.createTextNode(Base64.encode(bytes))
+-             : this._doc.createTextNode("\n" + Base64.encode(bytes) + "\n");
+-         this._constructionElement.appendChild(t);
+-      }
+-   }
++    /**
++     * Method getTextFromChildElement
++     *
++     * @param localname
++     * @param namespace
++     * @return the Text of the textNode
++     */
++    public String getTextFromChildElement(String localname, String namespace) {
++        return XMLUtils.selectNode(
++                this._constructionElement.getFirstChild(),
++                namespace,
++                localname,
++                0).getTextContent();
++    }
+ 
+-   /**
+-    * Method addText
+-    *
+-    * @param text
+-    */
+-   public void addText(String text) {
++    /**
++     * Method getBytesFromTextChild
++     *
++     * @return The base64 bytes from the text children of this element
++     * @throws XMLSecurityException
++     */
++    public byte[] getBytesFromTextChild() throws XMLSecurityException {
++        return Base64.decode(XMLUtils.getFullTextChildrenFromElement(this._constructionElement));
++    }
+ 
+-      if (text != null) {
+-         Text t = this._doc.createTextNode(text);
++    /**
++     * Method getTextFromTextChild
++     *
++     * @return the Text obtained by concatenating all the text nodes of this
++     *    element
++     */
++    public String getTextFromTextChild() {
++        return XMLUtils.getFullTextChildrenFromElement(this._constructionElement);
++    }
+ 
+-         this._constructionElement.appendChild(t);
+-      }
+-   }
++    /**
++     * Method length
++     *
++     * @param namespace
++     * @param localname
++     * @return the number of elements {namespace}:localname under this element
++     */
++    public int length(String namespace, String localname) {
++        int number = 0;
++        Node sibling = this._constructionElement.getFirstChild();
++        while (sibling != null) {
++            if (localname.equals(sibling.getLocalName())
++                && namespace.equals(sibling.getNamespaceURI())) {
++                number++;
++            }
++            sibling = sibling.getNextSibling();
++        }
++        return number;
++    }
+ 
+-   /**
+-    * Method getVal
+-    *
+-    * @param localname
+-    * @param namespace
+-    * @return The biginter contained in the given element
+- * @throws Base64DecodingException
+-    */
+-   public BigInteger getBigIntegerFromChildElement(
+-           String localname, String namespace) throws Base64DecodingException {
++    /**
++     * Adds an xmlns: definition to the Element. This can be called as follows:
++     *
++     * <PRE>
++     * // set namespace with ds prefix
++     * xpathContainer.setXPathNamespaceContext("ds", "http://www.w3.org/2000/09/xmldsig#");
++     * xpathContainer.setXPathNamespaceContext("xmlns:ds", "http://www.w3.org/2000/09/xmldsig#");
++     * </PRE>
++     *
++     * @param prefix
++     * @param uri
++     * @throws XMLSecurityException
++     */
++    public void setXPathNamespaceContext(String prefix, String uri)
++        throws XMLSecurityException {
++        String ns;
+ 
+-                return Base64.decodeBigIntegerFromText(
+-                                XMLUtils.selectNodeText(this._constructionElement.getFirstChild(),
+-                                                namespace,localname,0));
++        if ((prefix == null) || (prefix.length() == 0)) {
++            throw new XMLSecurityException("defaultNamespaceCannotBeSetHere");
++        } else if (prefix.equals("xmlns")) {
++            throw new XMLSecurityException("defaultNamespaceCannotBeSetHere");
++        } else if (prefix.startsWith("xmlns:")) {
++            ns = prefix;//"xmlns:" + prefix.substring("xmlns:".length());
++        } else {
++            ns = "xmlns:" + prefix;
++        }
+ 
+-   }
++        Attr a = this._constructionElement.getAttributeNodeNS(Constants.NamespaceSpecNS, ns);
+ 
+-   /**
+-    * Method getBytesFromChildElement
+-    * @deprecated
+-    * @param localname
+-    * @param namespace
+-    * @return the bytes
+-    * @throws XMLSecurityException
+-    */
+-   public byte[] getBytesFromChildElement(String localname, String namespace)
+-           throws XMLSecurityException {
++        if (a != null) {
++            if (!a.getNodeValue().equals(uri)) {
++                Object exArgs[] = { ns, this._constructionElement.getAttributeNS(null, ns) };
+ 
+-         Element e =
+-             XMLUtils.selectNode(
+-                 this._constructionElement.getFirstChild(),
+-                 namespace,
+-                 localname,
+-                 0);
++                throw new XMLSecurityException("namespacePrefixAlreadyUsedByOtherURI", exArgs);
++            }
++            return;
++        }
+ 
+-         return Base64.decode(e);
+-   }
+-
+-   /**
+-    * Method getTextFromChildElement
+-    *
+-    * @param localname
+-    * @param namespace
+-    * @return the Text of the textNode
+-    */
+-   public String getTextFromChildElement(String localname, String namespace) {
+-
+-         Text t =
+-             (Text) XMLUtils.selectNode(
+-                        this._constructionElement.getFirstChild(),
+-                        namespace,
+-                        localname,
+-                        0).getFirstChild();
+-
+-         return t.getData();
+-   }
+-
+-   /**
+-    * Method getBytesFromTextChild
+-    *
+-    * @return The base64 bytes from the text children of this element
+-    * @throws XMLSecurityException
+-    */
+-   public byte[] getBytesFromTextChild() throws XMLSecurityException {
+-      return Base64.decode
+-         (XMLUtils.getFullTextChildrenFromElement(this._constructionElement));
+-   }
+-
+-   /**
+-    * Method getTextFromTextChild
+-    *
+-    * @return the Text obtained by concatenating all the text nodes of this
+-    *    element
+-    */
+-   public String getTextFromTextChild() {
+-      return XMLUtils.getFullTextChildrenFromElement(this._constructionElement);
+-   }
+-
+-   /**
+-    * Method length
+-    *
+-    * @param namespace
+-    * @param localname
+-    * @return the number of elements {namespace}:localname under this element
+-    */
+-   public int length(String namespace, String localname) {
+-            int number=0;
+-            Node sibling=this._constructionElement.getFirstChild();
+-            while (sibling!=null) {
+-                if (localname.equals(sibling.getLocalName())
+-                                &&
+-                                        namespace==sibling.getNamespaceURI() ) {
+-                        number++;
+-                }
+-                sibling=sibling.getNextSibling();
+-            }
+-            return number;
+-     }
+-
+-   /**
+-    * Adds an xmlns: definition to the Element. This can be called as follows:
+-    *
+-    * <PRE>
+-    * // set namespace with ds prefix
+-    * xpathContainer.setXPathNamespaceContext("ds", "http://www.w3.org/2000/09/xmldsig#");
+-    * xpathContainer.setXPathNamespaceContext("xmlns:ds", "http://www.w3.org/2000/09/xmldsig#");
+-    * </PRE>
+-    *
+-    * @param prefix
+-    * @param uri
+-    * @throws XMLSecurityException
+-    */
+-   public void setXPathNamespaceContext(String prefix, String uri)
+-           throws XMLSecurityException {
+-
+-      String ns;
+-
+-      if ((prefix == null) || (prefix.length() == 0)) {
+-       throw new XMLSecurityException("defaultNamespaceCannotBeSetHere");
+-      } else if (prefix.equals("xmlns")) {
+-        throw new XMLSecurityException("defaultNamespaceCannotBeSetHere");
+-      } else if (prefix.startsWith("xmlns:")) {
+-         ns = prefix;//"xmlns:" + prefix.substring("xmlns:".length());
+-      } else {
+-         ns = "xmlns:" + prefix;
+-      }
+-
+-
+-
+-      Attr a = this._constructionElement.getAttributeNodeNS(Constants.NamespaceSpecNS, ns);
+-
+-      if (a != null) {
+-       if (!a.getNodeValue().equals(uri)) {
+-         Object exArgs[] = { ns,
+-                             this._constructionElement.getAttributeNS(null,
+-                                                                      ns) };
+-
+-         throw new XMLSecurityException("namespacePrefixAlreadyUsedByOtherURI",
+-                                        exArgs);
+-       }
+-       return;
+-      }
+-
+-      this._constructionElement.setAttributeNS(Constants.NamespaceSpecNS, ns,
+-                                               uri);
+-   }
+-
+-   /** Field _prefixMappings */
+-   static HashMap _prefixMappings = new HashMap();
+-   static HashMap _prefixMappingsBindings = new HashMap();
++        this._constructionElement.setAttributeNS(Constants.NamespaceSpecNS, ns, uri);
++    }
+ 
+     /**
+      * Method setDefaultPrefix
+@@ -505,26 +471,39 @@
+      */
+     public static void setDefaultPrefix(String namespace, String prefix)
+         throws XMLSecurityException {
+-
+-        if (ElementProxy._prefixMappings.containsValue(prefix)) {
+-
+-            Object storedNamespace=ElementProxy._prefixMappings.get(namespace);
+-            if (!storedNamespace.equals(prefix)) {
+-                Object exArgs[] = { prefix, namespace, storedNamespace };
++        if (prefixMappings.containsValue(prefix)) {
++            String storedPrefix = prefixMappings.get(namespace);
++            if (!storedPrefix.equals(prefix)) {
++                Object exArgs[] = { prefix, namespace, storedPrefix };
+ 
+                 throw new XMLSecurityException("prefix.AlreadyAssigned", exArgs);
+             }
+         }
++
+         if (Constants.SignatureSpecNS.equals(namespace)) {
+-            XMLUtils.dsPrefix=prefix;
++            XMLUtils.setDsPrefix(prefix);
+         }
+-        ElementProxy._prefixMappings.put(namespace, prefix.intern());
+-        if (prefix.length() == 0) {
+-            ElementProxy._prefixMappingsBindings.put(namespace, "xmlns");
+-        } else {
+-            ElementProxy._prefixMappingsBindings.put(namespace, ("xmlns:"+prefix).intern());
++        if (EncryptionConstants.EncryptionSpecNS.equals(namespace)) {
++            XMLUtils.setXencPrefix(prefix);
+         }
+-   }
++        prefixMappings.put(namespace, prefix);
++    }
++
++    /**
++     * This method registers the default prefixes.
++     */
++    public static void registerDefaultPrefixes() throws XMLSecurityException {
++        setDefaultPrefix("http://www.w3.org/2000/09/xmldsig#", "ds");
++        setDefaultPrefix("http://www.w3.org/2001/04/xmlenc#", "xenc");
++        setDefaultPrefix("http://www.w3.org/2009/xmlenc11#", "xenc11");
++        setDefaultPrefix("http://www.xmlsecurity.org/experimental#", "experimental");
++        setDefaultPrefix("http://www.w3.org/2002/04/xmldsig-filter2", "dsig-xpath-old");
++        setDefaultPrefix("http://www.w3.org/2002/06/xmldsig-filter2", "dsig-xpath");
++        setDefaultPrefix("http://www.w3.org/2001/10/xml-exc-c14n#", "ec");
++        setDefaultPrefix(
++            "http://www.nue.et-inf.uni-siegen.de/~geuer-pollmann/#xpathFilter", "xx"
++        );
++    }
+ 
+     /**
+      * Method getDefaultPrefix
+@@ -533,10 +512,7 @@
+      * @return the default prefix bind to this element.
+      */
+     public static String getDefaultPrefix(String namespace) {
+-        return (String) ElementProxy._prefixMappings.get(namespace);
++        return prefixMappings.get(namespace);
+     }
+ 
+-    public static String getDefaultPrefixBindings(String namespace) {
+-        return (String) ElementProxy._prefixMappingsBindings.get(namespace);
+-    }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/I18n.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/I18n.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/I18n.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/I18n.java
+@@ -2,21 +2,23 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-/*
+- * Copyright  1999-2004 The Apache Software Foundation.
++/**
++ * Licensed to the Apache Software Foundation (ASF) under one
++ * or more contributor license agreements. See the NOTICE file
++ * distributed with this work for additional information
++ * regarding copyright ownership. The ASF licenses this file
++ * to you under the Apache License, Version 2.0 (the
++ * "License"); you may not use this file except in compliance
++ * with the License. You may obtain a copy of the License at
+  *
+- *  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
+  *
+- *      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.
+- *
++ * Unless required by applicable law or agreed to in writing,
++ * software distributed under the License is distributed on an
++ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
++ * KIND, either express or implied. See the License for the
++ * specific language governing permissions and limitations
++ * under the License.
+  */
+ package com.sun.org.apache.xml.internal.security.utils;
+ 
+@@ -31,202 +33,136 @@
+  */
+ public class I18n {
+ 
+-   /** Field NOT_INITIALIZED_MSG */
+-   public static final String NOT_INITIALIZED_MSG =
+-      "You must initialize the xml-security library correctly before you use it. "
+-      + "Call the static method \"com.sun.org.apache.xml.internal.security.Init.init();\" to do that "
+-      + "before you use any functionality from that library.";
++    /** Field NOT_INITIALIZED_MSG */
++    public static final String NOT_INITIALIZED_MSG =
++        "You must initialize the xml-security library correctly before you use it. "
++        + "Call the static method \"com.sun.org.apache.xml.internal.security.Init.init();\" to do that "
++        + "before you use any functionality from that library.";
+ 
+-   /** Field defaultLanguageCode */
+-   private static String defaultLanguageCode;    // will be set in static{} block
++    /** Field resourceBundle */
++    private static ResourceBundle resourceBundle;
+ 
+-   /** Field defaultCountryCode */
+-   private static String defaultCountryCode;    // will be set in static{} block
++    /** Field alreadyInitialized */
++    private static boolean alreadyInitialized = false;
+ 
+-   /** Field resourceBundle */
+-   private static ResourceBundle resourceBundle =
+-       ResourceBundle.getBundle
+-         (Constants.exceptionMessagesResourceBundleBase, Locale.US);
++    /**
++     * Constructor I18n
++     *
++     */
++    private I18n() {
++        // we don't allow instantiation
++    }
+ 
+-   /** Field alreadyInitialized */
+-   private static boolean alreadyInitialized = false;
++    /**
++     * Method translate
++     *
++     * translates a message ID into an internationalized String, see alse
++     * <CODE>XMLSecurityException.getExceptionMEssage()</CODE>. The strings are
++     * stored in the <CODE>ResourceBundle</CODE>, which is identified in
++     * <CODE>exceptionMessagesResourceBundleBase</CODE>
++     *
++     * @param message
++     * @param args is an <CODE>Object[]</CODE> array of strings which are inserted into
++     * the String which is retrieved from the <CODE>ResouceBundle</CODE>
++     * @return message translated
++     */
++    public static String translate(String message, Object[] args) {
++        return getExceptionMessage(message, args);
++    }
+ 
+-   /** Field _languageCode */
+-   private static String _languageCode = null;
++    /**
++     * Method translate
++     *
++     * translates a message ID into an internationalized String, see also
++     * <CODE>XMLSecurityException.getExceptionMessage()</CODE>
++     *
++     * @param message
++     * @return message translated
++     */
++    public static String translate(String message) {
++        return getExceptionMessage(message);
++    }
+ 
+-   /** Field _countryCode */
+-   private static String _countryCode = null;
++    /**
++     * Method getExceptionMessage
++     *
++     * @param msgID
++     * @return message translated
++     *
++     */
++    public static String getExceptionMessage(String msgID) {
++        try {
++            return resourceBundle.getString(msgID);
++        } catch (Throwable t) {
++            if (com.sun.org.apache.xml.internal.security.Init.isInitialized()) {
++                return "No message with ID \"" + msgID
++                + "\" found in resource bundle \""
++                + Constants.exceptionMessagesResourceBundleBase + "\"";
++            }
++            return I18n.NOT_INITIALIZED_MSG;
++        }
++    }
+ 
+-   /**
+-    * Constructor I18n
+-    *
+-    */
+-   private I18n() {
++    /**
++     * Method getExceptionMessage
++     *
++     * @param msgID
++     * @param originalException
++     * @return message translated
++     */
++    public static String getExceptionMessage(String msgID, Exception originalException) {
++        try {
++            Object exArgs[] = { originalException.getMessage() };
++            return MessageFormat.format(resourceBundle.getString(msgID), exArgs);
++        } catch (Throwable t) {
++            if (com.sun.org.apache.xml.internal.security.Init.isInitialized()) {
++                return "No message with ID \"" + msgID
++                + "\" found in resource bundle \""
++                + Constants.exceptionMessagesResourceBundleBase
++                + "\". Original Exception was a "
++                + originalException.getClass().getName() + " and message "
++                + originalException.getMessage();
++            }
++            return I18n.NOT_INITIALIZED_MSG;
++        }
++    }
+ 
+-      // we don't allow instantiation
+-   }
++    /**
++     * Method getExceptionMessage
++     *
++     * @param msgID
++     * @param exArgs
++     * @return message translated
++     */
++    public static String getExceptionMessage(String msgID, Object exArgs[]) {
++        try {
++            return MessageFormat.format(resourceBundle.getString(msgID), exArgs);
++        } catch (Throwable t) {
++            if (com.sun.org.apache.xml.internal.security.Init.isInitialized()) {
++                return "No message with ID \"" + msgID
++                + "\" found in resource bundle \""
++                + Constants.exceptionMessagesResourceBundleBase + "\"";
++            }
++            return I18n.NOT_INITIALIZED_MSG;
++        }
++    }
+ 
+-   /**
+-    * Method translate
+-    *
+-    * translates a message ID into an internationalized String, see alse
+-    * <CODE>XMLSecurityException.getExceptionMEssage()</CODE>. The strings are
+-    * stored in the <CODE>ResourceBundle</CODE>, which is identified in
+-    * <CODE>exceptionMessagesResourceBundleBase</CODE>
+-    *
+-    * @param message
+-    * @param args is an <CODE>Object[]</CODE> array of strings which are inserted into the String which is retrieved from the <CODE>ResouceBundle</CODE>
+-    * @return message translated
+-    */
+-   public static String translate(String message, Object[] args) {
+-      return getExceptionMessage(message, args);
+-   }
++    /**
++     * Method init
++     *
++     * @param languageCode
++     * @param countryCode
++     */
++    public synchronized static void init(String languageCode, String countryCode) {
++        if (alreadyInitialized) {
++            return;
++        }
+ 
+-   /**
+-    * Method translate
+-    *
+-    * translates a message ID into an internationalized String, see alse
+-    * <CODE>XMLSecurityException.getExceptionMEssage()</CODE>
+-    *
+-    * @param message
+-    * @return message translated
+-    */
+-   public static String translate(String message) {
+-      return getExceptionMessage(message);
+-   }
+-
+-   /**
+-    * Method getExceptionMessage
+-    *
+-    * @param msgID
+-    * @return message translated
+-    *
+-    */
+-   public static String getExceptionMessage(String msgID) {
+-
+-      try {
+-         String s = resourceBundle.getString(msgID);
+-
+-         return s;
+-      } catch (Throwable t) {
+-         if (com.sun.org.apache.xml.internal.security.Init.isInitialized()) {
+-            return "No message with ID \"" + msgID
+-                   + "\" found in resource bundle \""
+-                   + Constants.exceptionMessagesResourceBundleBase + "\"";
+-         }
+-         return I18n.NOT_INITIALIZED_MSG;
+-      }
+-   }
+-
+-   /**
+-    * Method getExceptionMessage
+-    *
+-    * @param msgID
+-    * @param originalException
+-    * @return message translated
+-    */
+-   public static String getExceptionMessage(String msgID,
+-                                            Exception originalException) {
+-
+-      try {
+-         Object exArgs[] = { originalException.getMessage() };
+-         String s = MessageFormat.format(resourceBundle.getString(msgID),
+-                                         exArgs);
+-
+-         return s;
+-      } catch (Throwable t) {
+-         if (com.sun.org.apache.xml.internal.security.Init.isInitialized()) {
+-            return "No message with ID \"" + msgID
+-                   + "\" found in resource bundle \""
+-                   + Constants.exceptionMessagesResourceBundleBase
+-                   + "\". Original Exception was a "
+-                   + originalException.getClass().getName() + " and message "
+-                   + originalException.getMessage();
+-         }
+-          return I18n.NOT_INITIALIZED_MSG;
+-      }
+-   }
+-
+-   /**
+-    * Method getExceptionMessage
+-    *
+-    * @param msgID
+-    * @param exArgs
+-    * @return message translated
+-    */
+-   public static String getExceptionMessage(String msgID, Object exArgs[]) {
+-
+-      try {
+-         String s = MessageFormat.format(resourceBundle.getString(msgID),
+-                                         exArgs);
+-
+-         return s;
+-      } catch (Throwable t) {
+-         if (com.sun.org.apache.xml.internal.security.Init.isInitialized()) {
+-            return "No message with ID \"" + msgID
+-                   + "\" found in resource bundle \""
+-                   + Constants.exceptionMessagesResourceBundleBase + "\"";
+-         }
+-         return I18n.NOT_INITIALIZED_MSG;
+-      }
+-   }
+-
+-//
+-// Commented out because it modifies shared static
+-// state which could be maliciously called by untrusted code
+-//
+-//   /**
+-//    * Method init
+-//    *
+-//    * @param _defaultLanguageCode
+-//    * @param _defaultCountryCode
+-//    */
+-//   public static void init(String _defaultLanguageCode,
+-//                           String _defaultCountryCode) {
+-//
+-//      I18n.defaultLanguageCode = _defaultLanguageCode;
+-//
+-//      if (I18n.defaultLanguageCode == null) {
+-//         I18n.defaultLanguageCode = Locale.getDefault().getLanguage();
+-//      }
+-//
+-//      I18n.defaultCountryCode = _defaultCountryCode;
+-//
+-//      if (I18n.defaultCountryCode == null) {
+-//         I18n.defaultCountryCode = Locale.getDefault().getCountry();
+-//      }
+-//
+-//      initLocale(I18n.defaultLanguageCode, I18n.defaultCountryCode);
+-//   }
+-
+-//
+-// Commented out because it modifies shared static
+-// state which could be maliciously called by untrusted code
+-//
+-//   /**
+-//    * Method initLocale
+-//    *
+-//    * @param languageCode
+-//    * @param countryCode
+-//    */
+-//   public static void initLocale(String languageCode, String countryCode) {
+-//
+-//      if (alreadyInitialized && languageCode.equals(_languageCode)
+-//              && countryCode.equals(_countryCode)) {
+-//         return;
+-//      }
+-//
+-//      if ((languageCode != null) && (countryCode != null)
+-//              && (languageCode.length() > 0) && (countryCode.length() > 0)) {
+-//         _languageCode = languageCode;
+-//         _countryCode = countryCode;
+-//      } else {
+-//         _countryCode = I18n.defaultCountryCode;
+-//         _languageCode = I18n.defaultLanguageCode;
+-//      }
+-//
+-//      I18n.resourceBundle =
+-//         ResourceBundle.getBundle(Constants.exceptionMessagesResourceBundleBase,
+-//                                  new Locale(_languageCode, _countryCode));
+-//   }
++        I18n.resourceBundle =
++            ResourceBundle.getBundle(
++                Constants.exceptionMessagesResourceBundleBase,
++                new Locale(languageCode, countryCode)
++            );
++        alreadyInitialized = true;
++    }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/XMLUtils.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/XMLUtils.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/XMLUtils.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/XMLUtils.java
+@@ -21,14 +21,15 @@
+ package com.sun.org.apache.xml.internal.security.utils;
+ 
+ 
+-
+ import java.io.IOException;
+ import java.io.OutputStream;
+ import java.security.AccessController;
+ import java.security.PrivilegedAction;
++import java.util.ArrayList;
+ import java.util.HashMap;
+ import java.util.HashSet;
+ import java.util.Iterator;
++import java.util.List;
+ import java.util.Map;
+ import java.util.Set;
+ 
+@@ -60,6 +61,12 @@
+          }
+       });
+ 
++    private static volatile String dsPrefix = "ds";
++    private static volatile String xencPrefix = "xenc";
++
++   private static final java.util.logging.Logger log =
++       java.util.logging.Logger.getLogger(XMLUtils.class.getName());
++
+    /**
+     * Constructor XMLUtils
+     *
+@@ -68,6 +75,23 @@
+ 
+       // we don't allow instantiation
+    }
++
++    /**
++     * Set the prefix for the digital signature namespace
++     * @param prefix the new prefix for the digital signature namespace
++     */
++    public static void setDsPrefix(String prefix) {
++        dsPrefix = prefix;
++    }
++
++    /**
++     * Set the prefix for the encryption namespace
++     * @param prefix the new prefix for the encryption namespace
++     */
++    public static void setXencPrefix(String prefix) {
++        xencPrefix = prefix;
++    }
++
+    public static Element getNextElement(Node el) {
+            while ((el!=null) && (el.getNodeType()!=Node.ELEMENT_NODE)) {
+                    el=el.getNextSibling();
+@@ -82,13 +106,15 @@
+     * @param exclude
+     * @param com wheather comments or not
+     */
+-   public static void getSet(Node rootNode,Set result,Node exclude ,boolean com) {
++   public static void getSet(Node rootNode,Set<Node> result,Node exclude ,boolean com) {
+           if ((exclude!=null) && isDescendantOrSelf(exclude,rootNode)){
+                 return;
+       }
+       getSetRec(rootNode,result,exclude,com);
+    }
+-   static final void getSetRec(final Node rootNode,final Set result,
++
++   @SuppressWarnings("fallthrough")
++   static final void getSetRec(final Node rootNode,final Set<Node> result,
+         final Node exclude ,final boolean com) {
+            //Set result = new HashSet();
+        if (rootNode==exclude) {
+@@ -104,7 +130,7 @@
+                                         result.add(nl.item(i));
+                                 }
+                 }
+-                //no return keep working
++                //no return keep working - ignore fallthrough warning
+                 case Node.DOCUMENT_NODE:
+                                 for (Node r=rootNode.getFirstChild();r!=null;r=r.getNextSibling()){
+                                         if (r.getNodeType()==Node.TEXT_NODE) {
+@@ -228,9 +254,8 @@
+       return sb.toString();
+    }
+ 
++   static Map<String, String> namePrefixes=new HashMap<String, String>();
+ 
+-   static  String dsPrefix=null;
+-   static Map namePrefixes=new HashMap();
+    /**
+     * Creates an Element in the XML Signature specification namespace.
+     *
+@@ -248,7 +273,7 @@
+       if ((dsPrefix == null) || (dsPrefix.length() == 0)) {
+          return doc.createElementNS(Constants.SignatureSpecNS, elementName);
+       }
+-      String namePrefix=(String) namePrefixes.get(elementName);
++      String namePrefix= namePrefixes.get(elementName);
+       if (namePrefix==null) {
+           StringBuffer tag=new StringBuffer(dsPrefix);
+           tag.append(':');
+@@ -259,31 +284,38 @@
+       return doc.createElementNS(Constants.SignatureSpecNS, namePrefix);
+    }
+ 
+-   /**
+-    * Returns true if the element is in XML Signature namespace and the local
+-    * name equals the supplied one.
+-    *
+-    * @param element
+-    * @param localName
+-    * @return true if the element is in XML Signature namespace and the local name equals the supplied one
+-    */
+-   public static boolean elementIsInSignatureSpace(Element element,
+-           String localName) {
+-      return ElementProxy.checker.isNamespaceElement(element, localName, Constants.SignatureSpecNS);
+-   }
++    /**
++     * Returns true if the element is in XML Signature namespace and the local
++     * name equals the supplied one.
++     *
++     * @param element
++     * @param localName
++     * @return true if the element is in XML Signature namespace and the local name equals the supplied one
++     */
++    public static boolean elementIsInSignatureSpace(Element element, String localName) {
++        if (element == null) {
++            return false;
++        }
+ 
+-   /**
+-    * Returns true if the element is in XML Encryption namespace and the local
+-    * name equals the supplied one.
+-    *
+-    * @param element
+-    * @param localName
+-    * @return true if the element is in XML Encryption namespace and the local name equals the supplied one
+-    */
+-   public static boolean elementIsInEncryptionSpace(Element element,
+-           String localName) {
+-           return ElementProxy.checker.isNamespaceElement(element, localName, EncryptionConstants.EncryptionSpecNS);
+-   }
++        return Constants.SignatureSpecNS.equals(element.getNamespaceURI())
++            && element.getLocalName().equals(localName);
++    }
++
++    /**
++     * Returns true if the element is in XML Encryption namespace and the local
++     * name equals the supplied one.
++     *
++     * @param element
++     * @param localName
++     * @return true if the element is in XML Encryption namespace and the local name equals the supplied one
++     */
++    public static boolean elementIsInEncryptionSpace(Element element, String localName) {
++        if (element == null) {
++            return false;
++        }
++        return EncryptionConstants.EncryptionSpecNS.equals(element.getNamespaceURI())
++            && element.getLocalName().equals(localName);
++    }
+ 
+    /**
+     * This method returns the owner document of a particular node.
+@@ -318,11 +350,9 @@
+      * @param xpathNodeSet
+      * @return the owner document
+      */
+-    public static Document getOwnerDocument(Set xpathNodeSet) {
++    public static Document getOwnerDocument(Set<Node> xpathNodeSet) {
+        NullPointerException npe = null;
+-       Iterator iterator = xpathNodeSet.iterator();
+-       while(iterator.hasNext()) {
+-           Node node = (Node) iterator.next();
++       for (Node node : xpathNodeSet) {
+            int nodeType =node.getNodeType();
+            if (nodeType == Node.DOCUMENT_NODE) {
+               return (Document) node;
+@@ -397,14 +427,14 @@
+     * @param xpathNodeSet
+     * @return the set with the nodelist
+     */
+-   public static Set convertNodelistToSet(NodeList xpathNodeSet) {
++   public static Set<Node> convertNodelistToSet(NodeList xpathNodeSet) {
+ 
+       if (xpathNodeSet == null) {
+-         return new HashSet();
++         return new HashSet<Node>();
+       }
+ 
+       int length = xpathNodeSet.getLength();
+-      Set set = new HashSet(length);
++      Set<Node> set = new HashSet<Node>(length);
+ 
+       for (int i = 0; i < length; i++) {
+          set.add(xpathNodeSet.item(i));
+@@ -446,6 +476,7 @@
+     * @param node
+     * @see <A HREF="http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2650">Namespace axis resolution is not XPath compliant </A>
+     */
++   @SuppressWarnings("fallthrough")
+    private static void circumventBug2650internal(Node node) {
+            Node parent=null;
+            Node sibling=null;
+@@ -503,45 +534,45 @@
+            } while (true);
+    }
+ 
+-   /**
+-    * @param sibling
+-    * @param nodeName
+-    * @param number
+-    * @return nodes with the constrain
+-    */
+-   public static Element selectDsNode(Node sibling, String nodeName, int number) {
+-        while (sibling!=null) {
+-                if (ElementProxy.checker.isNamespaceElement(sibling, nodeName, Constants.SignatureSpecNS )) {
+-                        if (number==0){
+-                                return (Element)sibling;
+-                        }
+-                        number--;
++    /**
++     * @param sibling
++     * @param nodeName
++     * @param number
++     * @return nodes with the constrain
++     */
++    public static Element selectDsNode(Node sibling, String nodeName, int number) {
++        while (sibling != null) {
++            if (Constants.SignatureSpecNS.equals(sibling.getNamespaceURI())
++                && sibling.getLocalName().equals(nodeName)) {
++                if (number == 0){
++                    return (Element)sibling;
+                 }
+-                sibling=sibling.getNextSibling();
++                number--;
++            }
++            sibling = sibling.getNextSibling();
+         }
+         return null;
+-   }
++    }
+ 
+-   /**
+-    * @param sibling
+-    * @param nodeName
+-    * @param number
+-    * @return nodes with the constrain
+-    */
+-
+-   public static Element selectXencNode(Node sibling, String nodeName, int number) {
+-        while (sibling!=null) {
+-                if (ElementProxy.checker.isNamespaceElement(sibling, nodeName, EncryptionConstants.EncryptionSpecNS )) {
+-                        if (number==0){
+-                                return (Element)sibling;
+-                        }
+-                        number--;
++    /**
++     * @param sibling
++     * @param nodeName
++     * @param number
++     * @return nodes with the constrain
++     */
++    public static Element selectXencNode(Node sibling, String nodeName, int number) {
++        while (sibling != null) {
++            if (EncryptionConstants.EncryptionSpecNS.equals(sibling.getNamespaceURI())
++                && sibling.getLocalName().equals(nodeName)) {
++                if (number == 0){
++                    return (Element)sibling;
+                 }
+-                sibling=sibling.getNextSibling();
++                number--;
++            }
++            sibling = sibling.getNextSibling();
+         }
+         return null;
+-   }
+-
++    }
+ 
+    /**
+     * @param sibling
+@@ -580,74 +611,65 @@
+     return (Text)n;
+    }
+ 
+-   /**
+-    * @param sibling
+-    * @param uri
+-    * @param nodeName
+-    * @param number
+-    * @return nodes with the constrain
+-    */
+-   public static Element selectNode(Node sibling, String uri,String nodeName, int number) {
+-        while (sibling!=null) {
+-                if (ElementProxy.checker.isNamespaceElement(sibling, nodeName, uri)) {
+-                        if (number==0){
+-                                return (Element)sibling;
+-                        }
+-                        number--;
++    /**
++     * @param sibling
++     * @param uri
++     * @param nodeName
++     * @param number
++     * @return nodes with the constrain
++     */
++    public static Element selectNode(Node sibling, String uri, String nodeName, int number) {
++        while (sibling != null) {
++            if (sibling.getNamespaceURI() != null && sibling.getNamespaceURI().equals(uri)
++                && sibling.getLocalName().equals(nodeName)) {
++                if (number == 0){
++                    return (Element)sibling;
+                 }
+-                sibling=sibling.getNextSibling();
++                number--;
++            }
++            sibling = sibling.getNextSibling();
+         }
+         return null;
+-   }
++    }
+ 
+-   /**
+-    * @param sibling
+-    * @param nodeName
+-    * @return nodes with the constrain
+-    */
+-   public static Element[] selectDsNodes(Node sibling,String nodeName) {
+-     return selectNodes(sibling,Constants.SignatureSpecNS,nodeName);
+-   }
+-   /**
+-    * @param sibling
+-    * @param uri
+-    * @param nodeName
+-    * @return nodes with the constrain
+-    */
+-    public static Element[] selectNodes(Node sibling,String uri,String nodeName) {
+-        int size=20;
+-        Element[] a= new Element[size];
+-        int curr=0;
+-        //List list=new ArrayList();
+-        while (sibling!=null) {
+-                if (ElementProxy.checker.isNamespaceElement(sibling, nodeName, uri)) {
+-                        a[curr++]=(Element)sibling;
+-                        if (size<=curr) {
+-                                int cursize= size<<2;
+-                                Element []cp=new Element[cursize];
+-                                System.arraycopy(a,0,cp,0,size);
+-                                a=cp;
+-                                size=cursize;
+-                        }
+-                }
+-                sibling=sibling.getNextSibling();
++    /**
++     * @param sibling
++     * @param nodeName
++     * @return nodes with the constrain
++     */
++    public static Element[] selectDsNodes(Node sibling, String nodeName) {
++        return selectNodes(sibling,Constants.SignatureSpecNS, nodeName);
++    }
++
++    /**
++     * @param sibling
++     * @param uri
++     * @param nodeName
++     * @return nodes with the constrain
++     */
++     public static Element[] selectNodes(Node sibling, String uri, String nodeName) {
++        List<Element> list = new ArrayList<Element>();
++        while (sibling != null) {
++            if (sibling.getNamespaceURI() != null && sibling.getNamespaceURI().equals(uri)
++                && sibling.getLocalName().equals(nodeName)) {
++                list.add((Element)sibling);
++            }
++            sibling = sibling.getNextSibling();
+         }
+-        Element []af=new Element[curr];
+-        System.arraycopy(a,0,af,0,curr);
+-        return af;
+-   }
++        return list.toArray(new Element[list.size()]);
++    }
+ 
+    /**
+     * @param signatureElement
+     * @param inputSet
+     * @return nodes with the constrain
+     */
+-    public static Set excludeNodeFromSet(Node signatureElement, Set inputSet) {
+-          Set resultSet = new HashSet();
+-          Iterator iterator = inputSet.iterator();
++    public static Set<Node> excludeNodeFromSet(Node signatureElement, Set<Node> inputSet) {
++          Set<Node> resultSet = new HashSet<Node>();
++          Iterator<Node> iterator = inputSet.iterator();
+ 
+           while (iterator.hasNext()) {
+-            Node inputNode = (Node) iterator.next();
++            Node inputNode = iterator.next();
+ 
+             if (!XMLUtils
+                     .isDescendantOrSelf(signatureElement, inputNode)) {
+@@ -693,4 +715,127 @@
+     public static boolean ignoreLineBreaks() {
+         return ignoreLineBreaks;
+     }
++
++    /**
++     * This method is a tree-search to help prevent against wrapping attacks.
++     * It checks that no two Elements have ID Attributes that match the "value"
++     * argument, if this is the case then "false" is returned. Note that a
++     * return value of "true" does not necessarily mean that a matching Element
++     * has been found, just that no wrapping attack has been detected.
++     */
++    public static boolean protectAgainstWrappingAttack(Node startNode,
++                                                       String value)
++    {
++        Node startParent = startNode.getParentNode();
++        Node processedNode = null;
++        Element foundElement = null;
++
++        String id = value.trim();
++        if (id.charAt(0) == '#') {
++            id = id.substring(1);
++        }
++
++        while (startNode != null) {
++            if (startNode.getNodeType() == Node.ELEMENT_NODE) {
++                Element se = (Element) startNode;
++
++                NamedNodeMap attributes = se.getAttributes();
++                if (attributes != null) {
++                    for (int i = 0; i < attributes.getLength(); i++) {
++                        Attr attr = (Attr)attributes.item(i);
++                        if (attr.isId() && id.equals(attr.getValue())) {
++                            if (foundElement == null) {
++                                // Continue searching to find duplicates
++                                foundElement = attr.getOwnerElement();
++                            } else {
++                                log.log(java.util.logging.Level.FINE, "Multiple elements with the same 'Id' attribute value!");
++                                return false;
++                            }
++                        }
++                    }
++                }
++            }
++
++            processedNode = startNode;
++            startNode = startNode.getFirstChild();
++
++            // no child, this node is done.
++            if (startNode == null) {
++                // close node processing, get sibling
++                startNode = processedNode.getNextSibling();
++            }
++
++            // no more siblings, get parent, all children
++            // of parent are processed.
++            while (startNode == null) {
++                processedNode = processedNode.getParentNode();
++                if (processedNode == startParent) {
++                    return true;
++                }
++                // close parent node processing (processed node now)
++                startNode = processedNode.getNextSibling();
++            }
++        }
++        return true;
++    }
++
++    /**
++     * This method is a tree-search to help prevent against wrapping attacks.
++     * It checks that no other Element than the given "knownElement" argument
++     * has an ID attribute that matches the "value" argument, which is the ID
++     * value of "knownElement". If this is the case then "false" is returned.
++     */
++    public static boolean protectAgainstWrappingAttack(Node startNode,
++                                                       Element knownElement,
++                                                       String value)
++    {
++        Node startParent = startNode.getParentNode();
++        Node processedNode = null;
++
++        String id = value.trim();
++        if (id.charAt(0) == '#') {
++            id = id.substring(1);
++        }
++
++        while (startNode != null) {
++            if (startNode.getNodeType() == Node.ELEMENT_NODE) {
++                Element se = (Element) startNode;
++
++                NamedNodeMap attributes = se.getAttributes();
++                if (attributes != null) {
++                    for (int i = 0; i < attributes.getLength(); i++) {
++                        Attr attr = (Attr)attributes.item(i);
++                        if (attr.isId() && id.equals(attr.getValue())
++                            && se != knownElement)
++                        {
++                            log.log(java.util.logging.Level.FINE, "Multiple elements with the same 'Id' attribute value!");
++                            return false;
++                        }
++                    }
++                }
++            }
++
++            processedNode = startNode;
++            startNode = startNode.getFirstChild();
++
++            // no child, this node is done.
++            if (startNode == null) {
++                // close node processing, get sibling
++                startNode = processedNode.getNextSibling();
++            }
++
++            // no more siblings, get parent, all children
++            // of parent are processed.
++            while (startNode == null) {
++                processedNode = processedNode.getParentNode();
++                if (processedNode == startParent) {
++                    return true;
++                }
++                // close parent node processing (processed node now)
++                startNode = processedNode.getNextSibling();
++            }
++        }
++        return true;
++    }
++
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolver.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolver.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolver.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolver.java
+@@ -2,21 +2,23 @@
+  * reserved comment block
+  * DO NOT REMOVE OR ALTER!
+  */
+-/*
+- * Copyright  1999-2004 The Apache Software Foundation.
++/**
++ * Licensed to the Apache Software Foundation (ASF) under one
++ * or more contributor license agreements. See the NOTICE file
++ * distributed with this work for additional information
++ * regarding copyright ownership. The ASF licenses this file
++ * to you under the Apache License, Version 2.0 (the
++ * "License"); you may not use this file except in compliance
++ * with the License. You may obtain a copy of the License at
+  *
+- *  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
+  *
+- *      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.
+- *
++ * Unless required by applicable law or agreed to in writing,
++ * software distributed under the License is distributed on an
++ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
++ * KIND, either express or implied. See the License for the
++ * specific language governing permissions and limitations
++ * under the License.
+  */
+ package com.sun.org.apache.xml.internal.security.utils.resolver;
+ 
+@@ -25,300 +27,318 @@
+ import java.util.Map;
+ 
+ import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
++import com.sun.org.apache.xml.internal.security.utils.resolver.implementations.ResolverDirectHTTP;
++import com.sun.org.apache.xml.internal.security.utils.resolver.implementations.ResolverFragment;
++import com.sun.org.apache.xml.internal.security.utils.resolver.implementations.ResolverLocalFilesystem;
++import com.sun.org.apache.xml.internal.security.utils.resolver.implementations.ResolverXPointer;
+ import org.w3c.dom.Attr;
+ 
+ /**
+  * During reference validation, we have to retrieve resources from somewhere.
+  * This is done by retrieving a Resolver. The resolver needs two arguments: The
+- * URI in which the link to the new resource is defined and the BaseURI of the
+- * file/entity in which the URI occurs (the BaseURI is the same as the SystemId.
+- *
+- * <UL xml:lang="DE" LANG="DE">
+- * <LI> Verschiedene Implementierungen k??nnen sich als Resolver registrieren.
+- * <LI> Standardm????ig werden erste Implementierungen auf dem XML config file registrirt.
+- * <LI> Der Benutzer kann bei Bedarf Implementierungen voranstellen oder anf??gen.
+- * <LI> Implementierungen k??nnen mittels Features customized werden ??
+- *      (z.B. um Proxy-Passworter ??bergeben zu k??nnen).
+- * <LI> Jede Implementierung bekommt das URI Attribut und den Base URI
+- *      ??bergeben und muss antworten, ob sie aufl??sen kann.
+- * <LI> Die erste Implementierung, die die Aufgabe erf??llt, f??hrt die Aufl??sung durch.
+- * </UL>
+- *
+- * @author $Author: mullan $
++ * URI in which the link to the new resource is defined and the baseURI of the
++ * file/entity in which the URI occurs (the baseURI is the same as the SystemId).
+  */
+ public class ResourceResolver {
+ 
+-   /** {@link java.util.logging} logging facility */
+-    static java.util.logging.Logger log =
++    /** {@link org.apache.commons.logging} logging facility */
++    private static java.util.logging.Logger log =
+         java.util.logging.Logger.getLogger(ResourceResolver.class.getName());
+ 
+-   /** Field _alreadyInitialized */
+-   static boolean _alreadyInitialized = false;
++    /** these are the system-wide resolvers */
++    private static List<ResourceResolver> resolverList = new ArrayList<ResourceResolver>();
+ 
+-   /** these are the system-wide resolvers */
+-   static List _resolverVector = null;
++    /** Field resolverSpi */
++    private final ResourceResolverSpi resolverSpi;
+ 
+-   static boolean allThreadSafeInList=true;
++    /**
++     * Constructor ResourceResolver
++     *
++     * @param resourceResolver
++     */
++    public ResourceResolver(ResourceResolverSpi resourceResolver) {
++        this.resolverSpi = resourceResolver;
++    }
+ 
+-   /** Field transformSpi */
+-   protected ResourceResolverSpi _resolverSpi = null;
++    /**
++     * Method getInstance
++     *
++     * @param uri
++     * @param baseURI
++     * @return the instance
++     *
++     * @throws ResourceResolverException
++     */
++    public static final ResourceResolver getInstance(Attr uri, String baseURI)
++        throws ResourceResolverException {
++        return getInstance(uri, baseURI, false);
++    }
+ 
+-   /**
+-    * Constructor ResourceResolver
+-    *
+-    * @param className
+-    * @throws ClassNotFoundException
+-    * @throws IllegalAccessException
+-    * @throws InstantiationException
+-    */
+-   private ResourceResolver(String className)
+-           throws ClassNotFoundException, IllegalAccessException,
+-                  InstantiationException {
+-      this._resolverSpi =
+-         (ResourceResolverSpi) Class.forName(className).newInstance();
+-   }
++    /**
++     * Method getInstance
++     *
++     * @param uri
++     * @param baseURI
++     * @param secureValidation
++     * @return the instance
++     *
++     * @throws ResourceResolverException
++     */
++    public static final ResourceResolver getInstance(
++        Attr uri, String baseURI, boolean secureValidation
++    ) throws ResourceResolverException {
++        synchronized (resolverList) {
++            for (ResourceResolver resolver : resolverList) {
++                ResourceResolver resolverTmp = resolver;
++                if (!resolver.resolverSpi.engineIsThreadSafe()) {
++                    try {
++                        resolverTmp =
++                            new ResourceResolver(resolver.resolverSpi.getClass().newInstance());
++                    } catch (InstantiationException e) {
++                        throw new ResourceResolverException("", e, uri, baseURI);
++                    } catch (IllegalAccessException e) {
++                        throw new ResourceResolverException("", e, uri, baseURI);
++                    }
++                }
+ 
+-   /**
+-    * Constructor ResourceResolver
+-    *
+-    * @param resourceResolver
+-    */
+-   public ResourceResolver(ResourceResolverSpi resourceResolver) {
+-      this._resolverSpi = resourceResolver;
+-   }
++                if (log.isLoggable(java.util.logging.Level.FINE)) {
++                    log.log(java.util.logging.Level.FINE,
++                        "check resolvability by class " + resolverTmp.getClass().getName()
++                    );
++                }
+ 
++                resolverTmp.resolverSpi.secureValidation = secureValidation;
++                if ((resolverTmp != null) && resolverTmp.canResolve(uri, baseURI)) {
++                    // Check to see whether the Resolver is allowed
++                    if (secureValidation
++                        && (resolverTmp.resolverSpi instanceof ResolverLocalFilesystem
++                            || resolverTmp.resolverSpi instanceof ResolverDirectHTTP)) {
++                        Object exArgs[] = { resolverTmp.resolverSpi.getClass().getName() };
++                        throw new ResourceResolverException(
++                            "signature.Reference.ForbiddenResolver", exArgs, uri, baseURI
++                        );
++                    }
++                    return resolverTmp;
++                }
++            }
++        }
+ 
+-   /**
+-    * Method getInstance
+-    *
+-    * @param uri
+-    * @param BaseURI
+-    * @return the instnace
+-    *
+-    * @throws ResourceResolverException
+-    */
+-   public static final ResourceResolver getInstance(Attr uri, String BaseURI)
+-           throws ResourceResolverException {
+-      int length=ResourceResolver._resolverVector.size();
+-      for (int i = 0; i < length; i++) {
+-                  ResourceResolver resolver =
+-            (ResourceResolver) ResourceResolver._resolverVector.get(i);
+-                  ResourceResolver resolverTmp=null;
+-                  try {
+-                        resolverTmp =  allThreadSafeInList || resolver._resolverSpi.engineIsThreadSafe() ? resolver :
+-                                        new ResourceResolver((ResourceResolverSpi)resolver._resolverSpi.getClass().newInstance());
+-                  } catch (InstantiationException e) {
+-                          throw new ResourceResolverException("",e,uri,BaseURI);
+-                  } catch (IllegalAccessException e) {
+-                          throw new ResourceResolverException("",e,uri,BaseURI);
+-                  }
++        Object exArgs[] = { ((uri != null) ? uri.getNodeValue() : "null"), baseURI };
+ 
+-         if (log.isLoggable(java.util.logging.Level.FINE))
+-                log.log(java.util.logging.Level.FINE, "check resolvability by class " + resolver._resolverSpi.getClass().getName());
++        throw new ResourceResolverException("utils.resolver.noClass", exArgs, uri, baseURI);
++    }
+ 
+-         if ((resolver != null) && resolverTmp.canResolve(uri, BaseURI)) {
+-                 if (i!=0) {
+-                 //update resolver.
+-                         //System.out.println("Swaping");
+-                         List resolverVector=(List)((ArrayList)_resolverVector).clone();
+-                         resolverVector.remove(i);
+-                         resolverVector.add(0,resolver);
+-                         _resolverVector=resolverVector;
+-                 } else {
+-                         //System.out.println("hitting");
+-                 }
++    /**
++     * Method getInstance
++     *
++     * @param uri
++     * @param baseURI
++     * @param individualResolvers
++     * @return the instance
++     *
++     * @throws ResourceResolverException
++     */
++    public static ResourceResolver getInstance(
++        Attr uri, String baseURI, List<ResourceResolver> individualResolvers
++    ) throws ResourceResolverException {
++        return getInstance(uri, baseURI, individualResolvers, false);
++    }
+ 
+-            return resolverTmp;
+-         }
+-      }
++    /**
++     * Method getInstance
++     *
++     * @param uri
++     * @param baseURI
++     * @param individualResolvers
++     * @param secureValidation
++     * @return the instance
++     *
++     * @throws ResourceResolverException
++     */
++    public static ResourceResolver getInstance(
++        Attr uri, String baseURI, List<ResourceResolver> individualResolvers, boolean secureValidation
++    ) throws ResourceResolverException {
++        if (log.isLoggable(java.util.logging.Level.FINE)) {
++            log.log(java.util.logging.Level.FINE,
++                "I was asked to create a ResourceResolver and got "
++                + (individualResolvers == null ? 0 : individualResolvers.size())
++            );
++        }
+ 
+-      Object exArgs[] = { ((uri != null)
+-                           ? uri.getNodeValue()
+-                           : "null"), BaseURI };
++        // first check the individual Resolvers
++        if (individualResolvers != null) {
++            for (int i = 0; i < individualResolvers.size(); i++) {
++                ResourceResolver resolver = individualResolvers.get(i);
+ 
+-      throw new ResourceResolverException("utils.resolver.noClass", exArgs,
+-                                          uri, BaseURI);
+-   }
+-   /**
+-    * Method getInstance
+-    *
+-    * @param uri
+-    * @param BaseURI
+-    * @param individualResolvers
+-    * @return the instance
+-    *
+-    * @throws ResourceResolverException
+-    */
+-   public static final ResourceResolver getInstance(
+-           Attr uri, String BaseURI, List individualResolvers)
+-              throws ResourceResolverException {
+-      if (log.isLoggable(java.util.logging.Level.FINE)) {
++                if (resolver != null) {
++                    if (log.isLoggable(java.util.logging.Level.FINE)) {
++                        String currentClass = resolver.resolverSpi.getClass().getName();
++                        log.log(java.util.logging.Level.FINE, "check resolvability by class " + currentClass);
++                    }
+ 
+-        log.log(java.util.logging.Level.FINE, "I was asked to create a ResourceResolver and got " + (individualResolvers==null? 0 : individualResolvers.size()) );
+-        log.log(java.util.logging.Level.FINE, " extra resolvers to my existing " + ResourceResolver._resolverVector.size() + " system-wide resolvers");
+-      }
++                    resolver.resolverSpi.secureValidation = secureValidation;
++                    if (resolver.canResolve(uri, baseURI)) {
++                        return resolver;
++                    }
++                }
++            }
++        }
+ 
+-      // first check the individual Resolvers
+-          int size=0;
+-      if ((individualResolvers != null) && ((size=individualResolvers.size()) > 0)) {
+-         for (int i = 0; i < size; i++) {
+-            ResourceResolver resolver =
+-               (ResourceResolver) individualResolvers.get(i);
+-
+-            if (resolver != null) {
+-               String currentClass = resolver._resolverSpi.getClass().getName();
+-               if (log.isLoggable(java.util.logging.Level.FINE))
+-                log.log(java.util.logging.Level.FINE, "check resolvability by class " + currentClass);
+-
+-               if (resolver.canResolve(uri, BaseURI)) {
+-                  return resolver;
+-               }
+-            }
+-         }
+-      }
+-
+-          return getInstance(uri,BaseURI);
+-   }
+-
+-   /**
+-    * The init() function is called by com.sun.org.apache.xml.internal.security.Init.init()
+-    */
+-   public static void init() {
+-
+-      if (!ResourceResolver._alreadyInitialized) {
+-         ResourceResolver._resolverVector = new ArrayList(10);
+-         _alreadyInitialized = true;
+-      }
+-   }
++        return getInstance(uri, baseURI, secureValidation);
++    }
+ 
+     /**
+      * Registers a ResourceResolverSpi class. This method logs a warning if
+      * the class cannot be registered.
+      *
+-     * @param className the name of the ResourceResolverSpi class to be
+-     *    registered
++     * @param className the name of the ResourceResolverSpi class to be registered
+      */
++    @SuppressWarnings("unchecked")
+     public static void register(String className) {
+-        register(className, false);
++        try {
++            Class<ResourceResolverSpi> resourceResolverClass =
++                (Class<ResourceResolverSpi>) Class.forName(className);
++            register(resourceResolverClass, false);
++        } catch (ClassNotFoundException e) {
++            log.log(java.util.logging.Level.WARNING, "Error loading resolver " + className + " disabling it");
++        }
+     }
+ 
+     /**
+      * Registers a ResourceResolverSpi class at the beginning of the provider
+      * list. This method logs a warning if the class cannot be registered.
+      *
+-     * @param className the name of the ResourceResolverSpi class to be
+-     *    registered
++     * @param className the name of the ResourceResolverSpi class to be registered
+      */
++    @SuppressWarnings("unchecked")
+     public static void registerAtStart(String className) {
+-        register(className, true);
+-    }
+-
+-    private static void register(String className, boolean start) {
+         try {
+-            ResourceResolver resolver = new ResourceResolver(className);
+-            if (start) {
+-                ResourceResolver._resolverVector.add(0, resolver);
+-                log.log(java.util.logging.Level.FINE, "registered resolver");
+-            } else {
+-                ResourceResolver._resolverVector.add(resolver);
+-            }
+-            if (!resolver._resolverSpi.engineIsThreadSafe()) {
+-                allThreadSafeInList=false;
+-        }
+-        } catch (Exception e) {
+-            log.log(java.util.logging.Level.WARNING, "Error loading resolver " + className +" disabling it");
+-        } catch (NoClassDefFoundError e) {
+-            log.log(java.util.logging.Level.WARNING, "Error loading resolver " + className +" disabling it");
++            Class<ResourceResolverSpi> resourceResolverClass =
++                (Class<ResourceResolverSpi>) Class.forName(className);
++            register(resourceResolverClass, true);
++        } catch (ClassNotFoundException e) {
++            log.log(java.util.logging.Level.WARNING, "Error loading resolver " + className + " disabling it");
+         }
+     }
+ 
+-   /**
+-    * Method resolve
+-    *
+-    * @param uri
+-    * @param BaseURI
+-    * @return the resource
+-    *
+-    * @throws ResourceResolverException
+-    */
+-   public static XMLSignatureInput resolveStatic(Attr uri, String BaseURI)
+-           throws ResourceResolverException {
++    /**
++     * Registers a ResourceResolverSpi class. This method logs a warning if the class
++     * cannot be registered.
++     * @param className
++     * @param start
++     */
++    public static void register(Class<? extends ResourceResolverSpi> className, boolean start) {
++        try {
++            ResourceResolverSpi resourceResolverSpi = className.newInstance();
++            register(resourceResolverSpi, start);
++        } catch (IllegalAccessException e) {
++            log.log(java.util.logging.Level.WARNING, "Error loading resolver " + className + " disabling it");
++        } catch (InstantiationException e) {
++            log.log(java.util.logging.Level.WARNING, "Error loading resolver " + className + " disabling it");
++        }
++    }
+ 
+-      ResourceResolver myResolver = ResourceResolver.getInstance(uri, BaseURI);
++    /**
++     * Registers a ResourceResolverSpi instance. This method logs a warning if the class
++     * cannot be registered.
++     * @param resourceResolverSpi
++     * @param start
++     */
++    public static void register(ResourceResolverSpi resourceResolverSpi, boolean start) {
++        synchronized(resolverList) {
++            if (start) {
++                resolverList.add(0, new ResourceResolver(resourceResolverSpi));
++            } else {
++                resolverList.add(new ResourceResolver(resourceResolverSpi));
++            }
++        }
++        if (log.isLoggable(java.util.logging.Level.FINE)) {
++            log.log(java.util.logging.Level.FINE, "Registered resolver: " + resourceResolverSpi.toString());
++        }
++    }
+ 
+-      return myResolver.resolve(uri, BaseURI);
+-   }
++    /**
++     * This method registers the default resolvers.
++     */
++    public static void registerDefaultResolvers() {
++        synchronized(resolverList) {
++            resolverList.add(new ResourceResolver(new ResolverFragment()));
++            resolverList.add(new ResourceResolver(new ResolverLocalFilesystem()));
++            resolverList.add(new ResourceResolver(new ResolverXPointer()));
++            resolverList.add(new ResourceResolver(new ResolverDirectHTTP()));
++        }
++    }
+ 
+-   /**
+-    * Method resolve
+-    *
+-    * @param uri
+-    * @param BaseURI
+-    * @return the resource
+-    *
+-    * @throws ResourceResolverException
+-    */
+-   public XMLSignatureInput resolve(Attr uri, String BaseURI)
+-           throws ResourceResolverException {
+-      return this._resolverSpi.engineResolve(uri, BaseURI);
+-   }
++    /**
++     * Method resolve
++     *
++     * @param uri
++     * @param baseURI
++     * @return the resource
++     *
++     * @throws ResourceResolverException
++     */
++    public XMLSignatureInput resolve(Attr uri, String baseURI)
++        throws ResourceResolverException {
++        return resolverSpi.engineResolve(uri, baseURI);
++    }
+ 
+-   /**
+-    * Method setProperty
+-    *
+-    * @param key
+-    * @param value
+-    */
+-   public void setProperty(String key, String value) {
+-      this._resolverSpi.engineSetProperty(key, value);
+-   }
++    /**
++     * Method setProperty
++     *
++     * @param key
++     * @param value
++     */
++    public void setProperty(String key, String value) {
++        resolverSpi.engineSetProperty(key, value);
++    }
+ 
+-   /**
+-    * Method getProperty
+-    *
+-    * @param key
+-    * @return the value of the property
+-    */
+-   public String getProperty(String key) {
+-      return this._resolverSpi.engineGetProperty(key);
+-   }
++    /**
++     * Method getProperty
++     *
++     * @param key
++     * @return the value of the property
++     */
++    public String getProperty(String key) {
++        return resolverSpi.engineGetProperty(key);
++    }
+ 
+-   /**
+-    * Method addProperties
+-    *
+-    * @param properties
+-    */
+-   public void addProperties(Map properties) {
+-      this._resolverSpi.engineAddProperies(properties);
+-   }
++    /**
++     * Method addProperties
++     *
++     * @param properties
++     */
++    public void addProperties(Map<String, String> properties) {
++        resolverSpi.engineAddProperies(properties);
++    }
+ 
+-   /**
+-    * Method getPropertyKeys
+-    *
+-    * @return all property keys.
+-    */
+-   public String[] getPropertyKeys() {
+-      return this._resolverSpi.engineGetPropertyKeys();
+-   }
++    /**
++     * Method getPropertyKeys
++     *
++     * @return all property keys.
++     */
++    public String[] getPropertyKeys() {
++        return resolverSpi.engineGetPropertyKeys();
++    }
+ 
+-   /**
+-    * Method understandsProperty
+-    *
+-    * @param propertyToTest
+-    * @return true if the resolver understands the property
+-    */
+-   public boolean understandsProperty(String propertyToTest) {
+-      return this._resolverSpi.understandsProperty(propertyToTest);
+-   }
++    /**
++     * Method understandsProperty
++     *
++     * @param propertyToTest
++     * @return true if the resolver understands the property
++     */
++    public boolean understandsProperty(String propertyToTest) {
++        return resolverSpi.understandsProperty(propertyToTest);
++    }
+ 
+-   /**
+-    * Method canResolve
+-    *
+-    * @param uri
+-    * @param BaseURI
+-    * @return true if it can resolve the uri
+-    */
+-   private boolean canResolve(Attr uri, String BaseURI) {
+-      return this._resolverSpi.engineCanResolve(uri, BaseURI);
+-   }
++    /**
++     * Method canResolve
++     *
++     * @param uri
++     * @param baseURI
++     * @return true if it can resolve the uri
++     */
++    private boolean canResolve(Attr uri, String baseURI) {
++        return resolverSpi.engineCanResolve(uri, baseURI);
++    }
+ }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolverSpi.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolverSpi.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolverSpi.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolverSpi.java
+@@ -41,7 +41,9 @@
+                     ResourceResolverSpi.class.getName());
+ 
+    /** Field _properties */
+-   protected java.util.Map _properties = null;
++   protected java.util.Map<String,String> _properties = null;
++
++   protected boolean secureValidation;
+ 
+    /**
+     * This is the workhorse method used to resolve resources.
+@@ -63,7 +65,7 @@
+     */
+    public void engineSetProperty(String key, String value) {
+           if (_properties==null) {
+-                  _properties=new HashMap();
++                  _properties=new HashMap<String,String>();
+           }
+       this._properties.put(key, value);
+    }
+@@ -78,17 +80,17 @@
+           if (_properties==null) {
+                         return null;
+           }
+-      return (String) this._properties.get(key);
++      return this._properties.get(key);
+    }
+ 
+    /**
+     *
+     * @param properties
+     */
+-   public void engineAddProperies(Map properties) {
++   public void engineAddProperies(Map<String,String> properties) {
+           if (properties!=null) {
+                   if (_properties==null) {
+-                          _properties=new HashMap();
++                          _properties=new HashMap<String,String>();
+                   }
+                   this._properties.putAll(properties);
+           }
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverFragment.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverFragment.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverFragment.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverFragment.java
+@@ -23,11 +23,12 @@
+ 
+ 
+ import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
+-import com.sun.org.apache.xml.internal.security.utils.IdResolver;
++import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
+ import com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolverException;
+ import com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolverSpi;
+ import org.w3c.dom.Attr;
+ import org.w3c.dom.Document;
++import org.w3c.dom.Element;
+ import org.w3c.dom.Node;
+ 
+ 
+@@ -51,63 +52,68 @@
+    /**
+     * Method engineResolve
+     *
+-    * Wird das gleiche Dokument referenziert?
+-    * Wird ein anderes Dokument referenziert?
+     * @inheritDoc
+     * @param uri
+-    * @param BaseURI
+-    *
++    * @param baseURI
+     */
+-   public XMLSignatureInput engineResolve(Attr uri, String BaseURI)
++   public XMLSignatureInput engineResolve(Attr uri, String baseURI)
+        throws ResourceResolverException
+    {
++        String uriNodeValue = uri.getNodeValue();
++        Document doc = uri.getOwnerElement().getOwnerDocument();
+ 
+-      String uriNodeValue = uri.getNodeValue();
+-      Document doc = uri.getOwnerElement().getOwnerDocument();
++        Node selectedElem = null;
++        if (uriNodeValue.equals("")) {
+ 
++           /*
++            * Identifies the node-set (minus any comment nodes) of the XML
++            * resource containing the signature
++            */
+ 
+-      Node selectedElem = null;
+-      if (uriNodeValue.equals("")) {
++            log.log(java.util.logging.Level.FINE, "ResolverFragment with empty URI (means complete document)");
++            selectedElem = doc;
++        } else {
+ 
+-         /*
+-          * Identifies the node-set (minus any comment nodes) of the XML
+-          * resource containing the signature
+-          */
++            /*
++             * URI="#chapter1"
++             * Identifies a node-set containing the element with ID attribute
++             * value 'chapter1' of the XML resource containing the signature.
++             * XML Signature (and its applications) modify this node-set to
++             * include the element plus all descendents including namespaces and
++             * attributes -- but not comments.
++             */
++            String id = uriNodeValue.substring(1);
+ 
+-         log.log(java.util.logging.Level.FINE, "ResolverFragment with empty URI (means complete document)");
+-         selectedElem = doc;
+-      } else {
++            selectedElem = doc.getElementById(id);
++            if (selectedElem == null) {
++                Object exArgs[] = { id };
++                throw new ResourceResolverException(
++                    "signature.Verification.MissingID", exArgs, uri, baseURI);
++            }
++            if (secureValidation) {
++                Element start = uri.getOwnerDocument().getDocumentElement();
++                if (!XMLUtils.protectAgainstWrappingAttack(start, id)) {
++                    Object exArgs[] = { id };
++                    throw new ResourceResolverException(
++                        "signature.Verification.MultipleIDs", exArgs,
++                        uri, baseURI);
++                }
++            }
++            if (log.isLoggable(java.util.logging.Level.FINE))
++                log.log(java.util.logging.Level.FINE, "Try to catch an Element with ID " + id + " and Element was " + selectedElem);
++        }
+ 
+-         /*
+-          * URI="#chapter1"
+-          * Identifies a node-set containing the element with ID attribute
+-          * value 'chapter1' of the XML resource containing the signature.
+-          * XML Signature (and its applications) modify this node-set to
+-          * include the element plus all descendents including namespaces and
+-          * attributes -- but not comments.
+-          */
+-         String id = uriNodeValue.substring(1);
++        XMLSignatureInput result = new XMLSignatureInput(selectedElem);
++        result.setExcludeComments(true);
+ 
+-         // Element selectedElem = doc.getElementById(id);
+-         selectedElem = IdResolver.getElementById(doc, id);
+-         if (selectedElem==null) {
+-                Object exArgs[] = { id };
+-            throw new ResourceResolverException(
+-               "signature.Verification.MissingID", exArgs, uri, BaseURI);
+-         }
+-         if (log.isLoggable(java.util.logging.Level.FINE))
+-                log.log(java.util.logging.Level.FINE, "Try to catch an Element with ID " + id + " and Element was " + selectedElem);
+-      }
+-
+-      XMLSignatureInput result = new XMLSignatureInput(selectedElem);
+-      result.setExcludeComments(true);
+-
+-      //log.log(java.util.logging.Level.FINE, "We return a nodeset with " + resultSet.size() + " nodes");
+-      result.setMIMEType("text/xml");
+-          result.setSourceURI((BaseURI != null) ? BaseURI.concat(uri.getNodeValue()) :
+-                  uri.getNodeValue());
+-      return result;
+-   }
++        result.setMIMEType("text/xml");
++        if (baseURI != null && baseURI.length() > 0) {
++            result.setSourceURI(baseURI.concat(uri.getNodeValue()));
++        } else {
++            result.setSourceURI(uri.getNodeValue());
++        }
++        return result;
++    }
+ 
+    /**
+     * Method engineCanResolve
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverXPointer.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverXPointer.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverXPointer.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverXPointer.java
+@@ -23,11 +23,12 @@
+ 
+ 
+ import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
+-import com.sun.org.apache.xml.internal.security.utils.IdResolver;
++import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
+ import com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolverException;
+ import com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolverSpi;
+ import org.w3c.dom.Attr;
+ import org.w3c.dom.Document;
++import org.w3c.dom.Element;
+ import org.w3c.dom.Node;
+ 
+ 
+@@ -54,52 +55,55 @@
+                             ResolverXPointer.class.getName());
+ 
+     public boolean engineIsThreadSafe() {
+-           return true;
+-   }
+-   /**
+-    * @inheritDoc
+-    */
+-   public XMLSignatureInput engineResolve(Attr uri, String BaseURI)
++        return true;
++    }
++
++    /**
++     * @inheritDoc
++     */
++    public XMLSignatureInput engineResolve(Attr uri, String baseURI)
+            throws ResourceResolverException {
+ 
+-      Node resultNode = null;
+-      Document doc = uri.getOwnerElement().getOwnerDocument();
++        Node resultNode = null;
++        Document doc = uri.getOwnerElement().getOwnerDocument();
+ 
+-        String uriStr=uri.getNodeValue();
+-         if (isXPointerSlash(uriStr)) {
++        String uriStr = uri.getNodeValue();
++        if (isXPointerSlash(uriStr)) {
+             resultNode = doc;
+ 
+-         } else if (isXPointerId(uriStr)) {
++        } else if (isXPointerId(uriStr)) {
+             String id = getXPointerId(uriStr);
+-            resultNode =IdResolver.getElementById(doc, id);
++            resultNode = doc.getElementById(id);
+ 
+-            // log.log(java.util.logging.Level.FINE, "Use #xpointer(id('" + id + "')) on element " + selectedElem);
++            if (secureValidation) {
++                Element start = uri.getOwnerDocument().getDocumentElement();
++                if (!XMLUtils.protectAgainstWrappingAttack(start, id)) {
++                    Object exArgs[] = { id };
++                    throw new ResourceResolverException(
++                        "signature.Verification.MultipleIDs", exArgs,
++                        uri, baseURI);
++                }
++            }
+ 
+             if (resultNode == null) {
+                Object exArgs[] = { id };
+ 
+                throw new ResourceResolverException(
+-                  "signature.Verification.MissingID", exArgs, uri, BaseURI);
++                  "signature.Verification.MissingID", exArgs, uri, baseURI);
+             }
+-            /*
+-            resultNodes =
+-               cXPathAPI
+-                  .selectNodeList(selectedElem, Canonicalizer
+-                     .XPATH_C14N_WITH_COMMENTS_SINGLE_NODE);*/
+-         }
++        }
+ 
++        XMLSignatureInput result = new XMLSignatureInput(resultNode);
+ 
+-      XMLSignatureInput result = new XMLSignatureInput(resultNode);
++        result.setMIMEType("text/xml");
++        if (baseURI != null && baseURI.length() > 0) {
++            result.setSourceURI(baseURI.concat(uri.getNodeValue()));
++        } else {
++            result.setSourceURI(uri.getNodeValue());
++        }
+ 
+-      result.setMIMEType("text/xml");
+-      if (BaseURI != null && BaseURI.length() > 0) {
+-          result.setSourceURI(BaseURI.concat(uri.getNodeValue()));
+-      } else {
+-          result.setSourceURI(uri.getNodeValue());
+-      }
+-
+-      return result;
+-   }
++        return result;
++    }
+ 
+    /**
+     * @inheritDoc
+diff --git a/src/share/classes/javax/xml/crypto/dsig/dom/DOMValidateContext.java b/src/share/classes/javax/xml/crypto/dsig/dom/DOMValidateContext.java
+--- jdk/src/share/classes/javax/xml/crypto/dsig/dom/DOMValidateContext.java
++++ jdk/src/share/classes/javax/xml/crypto/dsig/dom/DOMValidateContext.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2005, 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
+@@ -74,11 +74,7 @@
+         if (ks == null) {
+             throw new NullPointerException("key selector is null");
+         }
+-        if (node == null) {
+-            throw new NullPointerException("node is null");
+-        }
+-        setKeySelector(ks);
+-        this.node = node;
++        init(node, ks);
+     }
+ 
+     /**
+@@ -97,11 +93,20 @@
+         if (validatingKey == null) {
+             throw new NullPointerException("validatingKey is null");
+         }
++        init(node, KeySelector.singletonKeySelector(validatingKey));
++    }
++
++    private void init(Node node, KeySelector ks) {
+         if (node == null) {
+             throw new NullPointerException("node is null");
+         }
+-        setKeySelector(KeySelector.singletonKeySelector(validatingKey));
++
+         this.node = node;
++        super.setKeySelector(ks);
++        if (System.getSecurityManager() != null) {
++            super.setProperty("org.jcp.xml.dsig.secureValidation",
++                              Boolean.TRUE);
++        }
+     }
+ 
+     /**
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java
+@@ -193,7 +193,7 @@
+ 
+         if (apacheTransform == null) {
+             try {
+-                apacheTransform = Transform.getInstance
++                apacheTransform = new Transform
+                     (ownerDoc, getAlgorithm(), transformElem.getChildNodes());
+                 apacheTransform.setElement(transformElem, xc.getBaseURI());
+                 if (log.isLoggable(Level.FINE)) {
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheTransform.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheTransform.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheTransform.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheTransform.java
+@@ -38,6 +38,7 @@
+ 
+ import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
+ import com.sun.org.apache.xml.internal.security.transforms.Transform;
++import com.sun.org.apache.xml.internal.security.transforms.Transforms;
+ 
+ import javax.xml.crypto.*;
+ import javax.xml.crypto.dom.DOMCryptoContext;
+@@ -117,7 +118,7 @@
+ 
+         if (apacheTransform == null) {
+             try {
+-                apacheTransform = Transform.getInstance
++                apacheTransform = new Transform
+                     (ownerDoc, getAlgorithm(), transformElem.getChildNodes());
+                 apacheTransform.setElement(transformElem, xc.getBaseURI());
+                 if (log.isLoggable(Level.FINE)) {
+@@ -130,6 +131,15 @@
+             }
+         }
+ 
++        if (Utils.secureValidation(xc)) {
++            String algorithm = getAlgorithm();
++            if (Transforms.TRANSFORM_XSLT.equals(algorithm)) {
++                throw new TransformException(
++                    "Transform " + algorithm +
++                    " is forbidden when secure validation is enabled");
++            }
++        }
++
+         XMLSignatureInput in;
+         if (data instanceof ApacheData) {
+             if (log.isLoggable(Level.FINE)) {
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfo.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfo.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfo.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfo.java
+@@ -34,6 +34,7 @@
+ 
+ import java.security.Provider;
+ import java.util.*;
++import org.w3c.dom.Attr;
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+ import org.w3c.dom.Node;
+@@ -87,7 +88,13 @@
+     public DOMKeyInfo(Element kiElem, XMLCryptoContext context,
+         Provider provider) throws MarshalException {
+         // get Id attribute, if specified
+-        id = DOMUtils.getAttributeValue(kiElem, "Id");
++        Attr attr = kiElem.getAttributeNodeNS(null, "Id");
++        if (attr != null) {
++            id = attr.getValue();
++            kiElem.setIdAttributeNode(attr, true);
++        } else {
++            id = null;
++        }
+ 
+         // get all children nodes
+         NodeList nl = kiElem.getChildNodes();
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java
+@@ -32,6 +32,7 @@
+ 
+ import java.security.Provider;
+ import java.util.*;
++import org.w3c.dom.Attr;
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+ import org.w3c.dom.Node;
+@@ -85,12 +86,30 @@
+      */
+     public DOMManifest(Element manElem, XMLCryptoContext context,
+         Provider provider) throws MarshalException {
+-        this.id = DOMUtils.getAttributeValue(manElem, "Id");
++        Attr attr = manElem.getAttributeNodeNS(null, "Id");
++        if (attr != null) {
++            this.id = attr.getValue();
++            manElem.setIdAttributeNode(attr, true);
++        } else {
++            this.id = null;
++        }
++
++        boolean secVal = Utils.secureValidation(context);
+         Element refElem = DOMUtils.getFirstChildElement(manElem);
+         List refs = new ArrayList();
++        int refCount = 0;
+         while (refElem != null) {
+             refs.add(new DOMReference(refElem, context, provider));
+             refElem = DOMUtils.getNextSiblingElement(refElem);
++
++            refCount++;
++            if (secVal && (refCount > DOMSignedInfo.MAXIMUM_REFERENCE_COUNT)) {
++                String error = "A maxiumum of " +
++                               DOMSignedInfo.MAXIMUM_REFERENCE_COUNT +
++                               " references per Manifest are allowed with" +
++                               " secure validation";
++                throw new MarshalException(error);
++            }
+         }
+         this.references = Collections.unmodifiableList(refs);
+     }
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java
+@@ -51,6 +51,7 @@
+ import org.w3c.dom.Node;
+ 
+ import org.jcp.xml.dsig.internal.DigesterOutputStream;
++import com.sun.org.apache.xml.internal.security.algorithms.MessageDigestAlgorithm;
+ import com.sun.org.apache.xml.internal.security.exceptions.Base64DecodingException;
+ import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
+ import com.sun.org.apache.xml.internal.security.utils.Base64;
+@@ -65,6 +66,12 @@
+ public final class DOMReference extends DOMStructure
+     implements Reference, DOMURIReference {
+ 
++    /**
++     * The maximum number of transforms per reference, if secure validation
++     * is enabled.
++     */
++    public static final int MAXIMUM_TRANSFORM_COUNT = 5;
++
+    /**
+     * Look up useC14N11 system property. If true, an explicit C14N11 transform
+     * will be added if necessary when generating the signature. See section
+@@ -184,15 +191,27 @@
+      */
+     public DOMReference(Element refElem, XMLCryptoContext context,
+         Provider provider) throws MarshalException {
++        boolean secVal = Utils.secureValidation(context);
++
+         // unmarshal Transforms, if specified
+         Element nextSibling = DOMUtils.getFirstChildElement(refElem);
+         List transforms = new ArrayList(5);
+         if (nextSibling.getLocalName().equals("Transforms")) {
+             Element transformElem = DOMUtils.getFirstChildElement(nextSibling);
++
++            int transformCount = 0;
+             while (transformElem != null) {
+                 transforms.add
+                     (new DOMTransform(transformElem, context, provider));
+                 transformElem = DOMUtils.getNextSiblingElement(transformElem);
++
++                transformCount++;
++                if (secVal && (transformCount > MAXIMUM_TRANSFORM_COUNT)) {
++                    String error = "A maxiumum of " + MAXIMUM_TRANSFORM_COUNT +
++                                   " transforms per Reference are allowed" +
++                                   " with secure validation";
++                    throw new MarshalException(error);
++                }
+             }
+             nextSibling = DOMUtils.getNextSiblingElement(nextSibling);
+         }
+@@ -200,6 +219,14 @@
+         // unmarshal DigestMethod
+         Element dmElem = nextSibling;
+         this.digestMethod = DOMDigestMethod.unmarshal(dmElem);
++        String digestMethodAlgorithm = this.digestMethod.getAlgorithm();
++        if (secVal
++            && MessageDigestAlgorithm.ALGO_ID_DIGEST_NOT_RECOMMENDED_MD5.equals(digestMethodAlgorithm))
++        {
++             throw new MarshalException("It is forbidden to use algorithm " +
++                                        digestMethod +
++                                        " when secure validation is enabled");
++        }
+ 
+         // unmarshal DigestValue
+         try {
+@@ -211,7 +238,14 @@
+ 
+         // unmarshal attributes
+         this.uri = DOMUtils.getAttributeValue(refElem, "URI");
+-        this.id = DOMUtils.getAttributeValue(refElem, "Id");
++
++        Attr attr = refElem.getAttributeNodeNS(null, "Id");
++        if (attr != null) {
++            this.id = attr.getValue();
++            refElem.setIdAttributeNode(attr, true);
++        } else {
++            this.id = null;
++        }
+ 
+         this.type = DOMUtils.getAttributeValue(refElem, "Type");
+         this.here = refElem.getAttributeNodeNS(null, "URI");
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java
+@@ -38,6 +38,7 @@
+ import java.net.URISyntaxException;
+ import java.security.Provider;
+ import java.util.*;
++import javax.xml.XMLConstants;
+ import javax.xml.crypto.*;
+ import javax.xml.crypto.dsig.*;
+ import javax.xml.crypto.dom.DOMCryptoContext;
+@@ -124,9 +125,13 @@
+         // get here node
+         here = rmElem.getAttributeNodeNS(null, "URI");
+ 
++        boolean secVal = Utils.secureValidation(context);
++
+         // get Transforms, if specified
+         List transforms = new ArrayList();
+         Element transformsElem = DOMUtils.getFirstChildElement(rmElem);
++
++        int transformCount = 0;
+         if (transformsElem != null) {
+             Element transformElem =
+                 DOMUtils.getFirstChildElement(transformsElem);
+@@ -134,6 +139,17 @@
+                 transforms.add
+                     (new DOMTransform(transformElem, context, provider));
+                 transformElem = DOMUtils.getNextSiblingElement(transformElem);
++
++                transformCount++;
++                if (secVal &&
++                    (transformCount > DOMReference.MAXIMUM_TRANSFORM_COUNT))
++                {
++                    String error = "A maxiumum of " +
++                                   DOMReference.MAXIMUM_TRANSFORM_COUNT +
++                                   " transforms per Reference are allowed" +
++                                   " with secure validation";
++                    throw new MarshalException(error);
++                }
+             }
+         }
+         if (transforms.isEmpty()) {
+@@ -224,6 +240,8 @@
+             ApacheData data = (ApacheData) dereference(context);
+             DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+             dbf.setNamespaceAware(true);
++            dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING,
++                           Boolean.TRUE);
+             DocumentBuilder db = dbf.newDocumentBuilder();
+             Document doc = db.parse(new ByteArrayInputStream
+                 (data.getXMLSignatureInput().getBytes()));
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java
+@@ -31,6 +31,7 @@
+ import javax.xml.crypto.dsig.*;
+ 
+ import java.util.*;
++import org.w3c.dom.Attr;
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+ import org.w3c.dom.Node;
+@@ -86,7 +87,13 @@
+      */
+     public DOMSignatureProperties(Element propsElem) throws MarshalException{
+         // unmarshal attributes
+-        id = DOMUtils.getAttributeValue(propsElem, "Id");
++        Attr attr = propsElem.getAttributeNodeNS(null, "Id");
++        if (attr != null) {
++            id = attr.getValue();
++            propsElem.setIdAttributeNode(attr, true);
++        } else {
++            id = null;
++        }
+ 
+         NodeList nodes = propsElem.getChildNodes();
+         int length = nodes.getLength();
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java
+@@ -31,6 +31,7 @@
+ import javax.xml.crypto.dsig.*;
+ 
+ import java.util.*;
++import org.w3c.dom.Attr;
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+ import org.w3c.dom.Node;
+@@ -94,7 +95,13 @@
+         if (target == null) {
+             throw new MarshalException("target cannot be null");
+         }
+-        id = DOMUtils.getAttributeValue(propElem, "Id");
++        Attr attr = propElem.getAttributeNodeNS(null, "Id");
++        if (attr != null) {
++            id = attr.getValue();
++            propElem.setIdAttributeNode(attr, true);
++        } else {
++            id = null;
++        }
+ 
+         NodeList nodes = propElem.getChildNodes();
+         int length = nodes.getLength();
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java
+@@ -45,6 +45,7 @@
+ import org.w3c.dom.Node;
+ 
+ import com.sun.org.apache.xml.internal.security.utils.Base64;
++import com.sun.org.apache.xml.internal.security.utils.Constants;
+ import com.sun.org.apache.xml.internal.security.utils.UnsyncBufferedOutputStream;
+ import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
+ 
+@@ -55,7 +56,22 @@
+  */
+ public final class DOMSignedInfo extends DOMStructure implements SignedInfo {
+ 
++    /**
++     * The maximum number of references per Manifest, if secure validation is
++     * enabled.
++     */
++    public static final int MAXIMUM_REFERENCE_COUNT = 30;
++
+     private static Logger log = Logger.getLogger("org.jcp.xml.dsig.internal.dom");
++
++    /** Signature - NOT Recommended RSAwithMD5 */
++    private static final String ALGO_ID_SIGNATURE_NOT_RECOMMENDED_RSA_MD5 =
++        Constants.MoreAlgorithmsSpecNS + "rsa-md5";
++
++    /** HMAC - NOT Recommended HMAC-MD5 */
++    private static final String ALGO_ID_MAC_HMAC_NOT_RECOMMENDED_MD5 =
++        Constants.MoreAlgorithmsSpecNS + "hmac-md5";
++
+     private List references;
+     private CanonicalizationMethod canonicalizationMethod;
+     private SignatureMethod signatureMethod;
+@@ -143,12 +159,31 @@
+         Element smElem = DOMUtils.getNextSiblingElement(cmElem);
+         signatureMethod = DOMSignatureMethod.unmarshal(smElem);
+ 
++        boolean secVal = Utils.secureValidation(context);
++        String sigMethAlg = signatureMethod.getAlgorithm();
++        if (secVal && ((ALGO_ID_MAC_HMAC_NOT_RECOMMENDED_MD5.equals(sigMethAlg)
++            || ALGO_ID_SIGNATURE_NOT_RECOMMENDED_RSA_MD5.equals(sigMethAlg))))
++        {
++            throw new MarshalException("It is forbidden to use algorithm " +
++                                       signatureMethod +
++                                       " when secure validation is enabled");
++        }
++
+         // unmarshal References
+         ArrayList refList = new ArrayList(5);
+         Element refElem = DOMUtils.getNextSiblingElement(smElem);
++        int refCount = 0;
+         while (refElem != null) {
+             refList.add(new DOMReference(refElem, context, provider));
+             refElem = DOMUtils.getNextSiblingElement(refElem);
++
++            refCount++;
++            if (secVal && (refCount > MAXIMUM_REFERENCE_COUNT)) {
++                String error = "A maxiumum of " + MAXIMUM_REFERENCE_COUNT +
++                               " references per SignedInfo are allowed with" +
++                               " secure validation";
++                throw new MarshalException(error);
++            }
+         }
+         references = Collections.unmodifiableList(refList);
+     }
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMURIDereferencer.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMURIDereferencer.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMURIDereferencer.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMURIDereferencer.java
+@@ -31,7 +31,7 @@
+ import org.w3c.dom.Node;
+ 
+ import com.sun.org.apache.xml.internal.security.Init;
+-import com.sun.org.apache.xml.internal.security.utils.IdResolver;
++import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
+ import com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolver;
+ import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
+ 
+@@ -68,8 +68,11 @@
+         Attr uriAttr = (Attr) domRef.getHere();
+         String uri = uriRef.getURI();
+         DOMCryptoContext dcc = (DOMCryptoContext) context;
++        String baseURI = context.getBaseURI();
+ 
+-        // Check if same-document URI and register ID
++        boolean secVal = Utils.secureValidation(context);
++
++        // Check if same-document URI and already registered on the context
+         if (uri != null && uri.length() != 0 && uri.charAt(0) == '#') {
+             String id = uri.substring(1);
+ 
+@@ -79,19 +82,38 @@
+                 id = id.substring(i1+1, i2);
+             }
+ 
+-            // this is a bit of a hack to check for registered
+-            // IDRefs and manually register them with Apache's IdResolver
+-            // map which includes builtin schema knowledge of DSig/Enc IDs
+-            Node referencedElem = dcc.getElementById(id);
+-            if (referencedElem != null) {
+-                IdResolver.registerElementById((Element) referencedElem, id);
++            Node refElem = dcc.getElementById(id);
++            if (refElem != null) {
++                if (secVal) {
++                    Element start =
++                        refElem.getOwnerDocument().getDocumentElement();
++                    if (!XMLUtils.protectAgainstWrappingAttack(start,
++                                                               (Element)refElem,
++                                                               id)) {
++                        String error = "Multiple Elements with the same ID " +
++                                       id + " were detected";
++                        throw new URIReferenceException(error);
++                    }
++                }
++
++                XMLSignatureInput result = new XMLSignatureInput(refElem);
++                if (!uri.substring(1).startsWith("xpointer(id(")) {
++                    result.setExcludeComments(true);
++                }
++
++                result.setMIMEType("text/xml");
++                if (baseURI != null && baseURI.length() > 0) {
++                    result.setSourceURI(baseURI.concat(uriAttr.getNodeValue()));
++                } else {
++                    result.setSourceURI(uriAttr.getNodeValue());
++                }
++                return new ApacheNodeSetData(result);
+             }
+         }
+ 
+         try {
+-            String baseURI = context.getBaseURI();
+             ResourceResolver apacheResolver =
+-                ResourceResolver.getInstance(uriAttr, baseURI);
++                ResourceResolver.getInstance(uriAttr, baseURI, secVal);
+             XMLSignatureInput in = apacheResolver.resolve(uriAttr, baseURI);
+             if (in.isOctetStream()) {
+                 return new ApacheOctetStreamData(in);
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMUtils.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMUtils.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMUtils.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMUtils.java
+@@ -38,8 +38,6 @@
+ import javax.xml.crypto.dsig.*;
+ import javax.xml.crypto.dsig.spec.*;
+ 
+-import com.sun.org.apache.xml.internal.security.utils.IdResolver;
+-
+ /**
+  * Useful static DOM utility methods.
+  *
+@@ -107,7 +105,7 @@
+     public static void setAttributeID(Element elem, String name, String value) {
+         if (value == null) return;
+         elem.setAttributeNS(null, name, value);
+-        IdResolver.registerElementById(elem, value);
++        elem.setIdAttributeNS(null, name, true);
+     }
+ 
+     /**
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java
+@@ -32,6 +32,7 @@
+ 
+ import java.security.Provider;
+ import java.util.*;
++import org.w3c.dom.Attr;
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+ import org.w3c.dom.Node;
+@@ -91,7 +92,14 @@
+         Provider provider) throws MarshalException {
+         // unmarshal attributes
+         this.encoding = DOMUtils.getAttributeValue(objElem, "Encoding");
+-        this.id = DOMUtils.getAttributeValue(objElem, "Id");
++
++        Attr attr = objElem.getAttributeNodeNS(null, "Id");
++        if (attr != null) {
++            this.id = attr.getValue();
++            objElem.setIdAttributeNode(attr, true);
++        } else {
++            this.id = null;
++        }
+         this.mimeType = DOMUtils.getAttributeValue(objElem, "MimeType");
+ 
+         NodeList nodes = objElem.getChildNodes();
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java
+@@ -50,6 +50,7 @@
+ import java.util.List;
+ import java.util.logging.Level;
+ import java.util.logging.Logger;
++import org.w3c.dom.Attr;
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+ import org.w3c.dom.Node;
+@@ -489,7 +490,13 @@
+                 throw new MarshalException(bde);
+             }
+ 
+-            id = DOMUtils.getAttributeValue(sigValueElem, "Id");
++            Attr attr = sigValueElem.getAttributeNodeNS(null, "Id");
++            if (attr != null) {
++                id = attr.getValue();
++                sigValueElem.setIdAttributeNode(attr, true);
++            } else {
++                id = null;
++            }
+             this.sigValueElem = sigValueElem;
+         }
+ 
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/Utils.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/Utils.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/Utils.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/Utils.java
+@@ -30,6 +30,7 @@
+ import java.io.InputStream;
+ import java.io.IOException;
+ import java.util.*;
++import javax.xml.crypto.XMLCryptoContext;
+ import org.w3c.dom.NamedNodeMap;
+ import org.w3c.dom.Node;
+ 
+@@ -104,4 +105,13 @@
+     public static boolean sameDocumentURI(String uri) {
+         return (uri != null && (uri.length() == 0 || uri.charAt(0) == '#'));
+     }
++
++    static boolean secureValidation(XMLCryptoContext xc) {
++        return getBoolean(xc, "org.jcp.xml.dsig.secureValidation");
++    }
++
++    private static boolean getBoolean(XMLCryptoContext xc, String name) {
++        Boolean value = (Boolean)xc.getProperty(name);
++        return (value != null && value.booleanValue());
++    }
+ }
+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
+@@ -148,7 +148,9 @@
+                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.apache.xml.internal.security.,\
++               com.sun.org.glassfish.,\
++               org.jcp.xml.dsig.internal.
+ 
+ #
+ # List of comma-separated packages that start with or equal this string
+@@ -181,7 +183,9 @@
+                    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.apache.xml.internal.security.,\
++                   com.sun.org.glassfish.,\
++                   org.jcp.xml.dsig.internal.
+ 
+ #
+ # 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
+@@ -149,7 +149,9 @@
+                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.apache.xml.internal.security.,\
++               com.sun.org.glassfish.,\
++               org.jcp.xml.dsig.internal.
+ 
+ #
+ # List of comma-separated packages that start with or equal this string
+@@ -182,7 +184,9 @@
+                    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.apache.xml.internal.security.,\
++                   com.sun.org.glassfish.,\
++                   org.jcp.xml.dsig.internal.
+ 
+ #
+ # 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
+@@ -149,7 +149,9 @@
+                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.security.,\
+                com.sun.org.glassfish.,\
++               org.jcp.xml.dsig.internal.\
+                com.sun.java.accessibility.
+ 
+ #
+@@ -183,7 +185,9 @@
+                    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.security.,\
+                    com.sun.org.glassfish.,\
++                   org.jcp.xml.dsig.internal.\
+                    com.sun.java.accessibility.
+ 
+ #
+diff --git a/test/javax/xml/crypto/dsig/GenerationTests.java b/test/javax/xml/crypto/dsig/GenerationTests.java
+--- jdk/test/javax/xml/crypto/dsig/GenerationTests.java
++++ jdk/test/javax/xml/crypto/dsig/GenerationTests.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2005, 2009, 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
+@@ -27,7 +27,7 @@
+  * @summary Basic unit tests for generating XML Signatures with JSR 105
+  * @compile -XDignore.symbol.file KeySelectors.java SignatureValidator.java
+  *     X509KeySelector.java GenerationTests.java
+- * @run main GenerationTests
++ * @run main/othervm GenerationTests
+  * @author Sean Mullan
+  */
+ 
+@@ -713,6 +713,7 @@
+ 
+         DOMSignContext dsc = new DOMSignContext(signingKey, doc);
+         dsc.setURIDereferencer(httpUd);
++        dsc.setIdAttributeNS(nc, null, "Id");
+ 
+         sig.sign(dsc);
+ 
+@@ -721,6 +722,7 @@
+         File f = new File(DATA_DIR);
+         dvc.setBaseURI(f.toURI().toString());
+         dvc.setURIDereferencer(httpUd);
++        dvc.setIdAttributeNS(nc, null, "Id");
+ 
+         XMLSignature sig2 = fac.unmarshalXMLSignature(dvc);
+ 
+diff --git a/test/javax/xml/crypto/dsig/SecurityManager/XMLDSigWithSecMgr.java b/test/javax/xml/crypto/dsig/SecurityManager/XMLDSigWithSecMgr.java
+--- jdk/test/javax/xml/crypto/dsig/SecurityManager/XMLDSigWithSecMgr.java
++++ jdk/test/javax/xml/crypto/dsig/SecurityManager/XMLDSigWithSecMgr.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2006, 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
+@@ -26,6 +26,7 @@
+  * @bug 6436919 6460930
+  * @summary check that XML Signatures can be generated and validated with
+  *  SecurityManager enabled and default policy
++ * @run main/othervm XMLDSigWithSecMgr
+  * @author Sean Mullan
+  */
+ import java.io.*;
+@@ -139,6 +140,10 @@
+             // validate a signature with SecurityManager enabled
+             DOMValidateContext dvc = new DOMValidateContext
+                 (kp.getPublic(), envelope.getFirstChild());
++
++            // disable secure validation mode so that http reference will work
++            dvc.setProperty("org.jcp.xml.dsig.secureValidation", Boolean.FALSE);
++
+             sig = fac.unmarshalXMLSignature(dvc);
+             if (!sig.validate(dvc)) {
+                 throw new Exception
+diff --git a/test/javax/xml/crypto/dsig/ValidationTests.java b/test/javax/xml/crypto/dsig/ValidationTests.java
+--- jdk/test/javax/xml/crypto/dsig/ValidationTests.java
++++ jdk/test/javax/xml/crypto/dsig/ValidationTests.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2005, 2009, 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
+@@ -27,7 +27,7 @@
+  * @summary Basic unit tests for validating XML Signatures with JSR 105
+  * @compile -XDignore.symbol.file KeySelectors.java SignatureValidator.java
+  *     X509KeySelector.java ValidationTests.java
+- * @run main ValidationTests
++ * @run main/othervm ValidationTests
+  * @author Sean Mullan
+  */
+ import java.io.File;

Added: trunk/java/openjdk6/files/icedtea/security/20130618/7158805-nested_subroutine_rewriting.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/7158805-nested_subroutine_rewriting.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/7158805-nested_subroutine_rewriting.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,467 @@
+# HG changeset patch
+# User chrisphi
+# Date 1373377939 -3600
+# Node ID 2df643057b3d5f75d287a352cadf6fc0501a1682
+# Parent  694e7185c7d959055f6edd878a0e8ff16c5461ba
+7158805: Better rewriting of nested subroutine calls
+
+diff --git a/src/share/vm/memory/allocation.cpp b/src/share/vm/memory/allocation.cpp
+--- hotspot/src/share/vm/memory/allocation.cpp
++++ hotspot/src/share/vm/memory/allocation.cpp
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2011, 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
+@@ -199,7 +199,7 @@
+    ChunkPool(size_t size) : _size(size) { _first = NULL; _num_chunks = _num_used = 0; }
+ 
+   // Allocate a new chunk from the pool (might expand the pool)
+-  void* allocate(size_t bytes) {
++  void* allocate(size_t bytes, AllocFailType alloc_failmode) {
+     assert(bytes == _size, "bad size");
+     void* p = NULL;
+     { ThreadCritical tc;
+@@ -207,9 +207,9 @@
+       p = get_first();
+       if (p == NULL) p = os::malloc(bytes);
+     }
+-    if (p == NULL)
++    if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM) {
+       vm_exit_out_of_memory(bytes, "ChunkPool::allocate");
+-
++    }
+     return p;
+   }
+ 
+@@ -300,7 +300,7 @@
+ //--------------------------------------------------------------------------------------
+ // Chunk implementation
+ 
+-void* Chunk::operator new(size_t requested_size, size_t length) {
++void* Chunk::operator new(size_t requested_size, AllocFailType alloc_failmode, size_t length) {
+   // requested_size is equal to sizeof(Chunk) but in order for the arena
+   // allocations to come out aligned as expected the size must be aligned
+   // to expected arean alignment.
+@@ -308,13 +308,14 @@
+   assert(ARENA_ALIGN(requested_size) == aligned_overhead_size(), "Bad alignment");
+   size_t bytes = ARENA_ALIGN(requested_size) + length;
+   switch (length) {
+-   case Chunk::size:        return ChunkPool::large_pool()->allocate(bytes);
+-   case Chunk::medium_size: return ChunkPool::medium_pool()->allocate(bytes);
+-   case Chunk::init_size:   return ChunkPool::small_pool()->allocate(bytes);
++   case Chunk::size:        return ChunkPool::large_pool()->allocate(bytes, alloc_failmode);
++   case Chunk::medium_size: return ChunkPool::medium_pool()->allocate(bytes, alloc_failmode);
++   case Chunk::init_size:   return ChunkPool::small_pool()->allocate(bytes, alloc_failmode);
+    default: {
+-     void *p =  os::malloc(bytes);
+-     if (p == NULL)
++     void* p = os::malloc(bytes);
++     if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM) {
+        vm_exit_out_of_memory(bytes, "Chunk::new");
++     }
+      return p;
+    }
+   }
+@@ -367,14 +368,14 @@
+ Arena::Arena(size_t init_size) {
+   size_t round_size = (sizeof (char *)) - 1;
+   init_size = (init_size+round_size) & ~round_size;
+-  _first = _chunk = new (init_size) Chunk(init_size);
++  _first = _chunk = new (AllocFailStrategy::EXIT_OOM, init_size) Chunk(init_size);
+   _hwm = _chunk->bottom();      // Save the cached hwm, max
+   _max = _chunk->top();
+   set_size_in_bytes(init_size);
+ }
+ 
+ Arena::Arena() {
+-  _first = _chunk = new (Chunk::init_size) Chunk(Chunk::init_size);
++  _first = _chunk = new (AllocFailStrategy::EXIT_OOM, Chunk::init_size) Chunk(Chunk::init_size);
+   _hwm = _chunk->bottom();      // Save the cached hwm, max
+   _max = _chunk->top();
+   set_size_in_bytes(Chunk::init_size);
+@@ -427,15 +428,15 @@
+ }
+ 
+ // Grow a new Chunk
+-void* Arena::grow( size_t x ) {
++void* Arena::grow(size_t x, AllocFailType alloc_failmode) {
+   // Get minimal required size.  Either real big, or even bigger for giant objs
+   size_t len = MAX2(x, (size_t) Chunk::size);
+ 
+   Chunk *k = _chunk;            // Get filled-up chunk address
+-  _chunk = new (len) Chunk(len);
++  _chunk = new (alloc_failmode, len) Chunk(len);
+ 
+   if (_chunk == NULL) {
+-    signal_out_of_memory(len * Chunk::aligned_overhead_size(), "Arena::grow");
++    return NULL;
+   }
+ 
+   if (k) k->set_next(_chunk);   // Append new chunk to end of linked list
+@@ -451,13 +452,16 @@
+ 
+ 
+ // Reallocate storage in Arena.
+-void *Arena::Arealloc(void* old_ptr, size_t old_size, size_t new_size) {
++void *Arena::Arealloc(void* old_ptr, size_t old_size, size_t new_size, AllocFailType alloc_failmode) {
+   assert(new_size >= 0, "bad size");
+   if (new_size == 0) return NULL;
+ #ifdef ASSERT
+   if (UseMallocOnly) {
+     // always allocate a new object  (otherwise we'll free this one twice)
+-    char* copy = (char*)Amalloc(new_size);
++    char* copy = (char*)Amalloc(new_size, alloc_failmode);
++    if (copy == NULL) {
++      return NULL;
++    }
+     size_t n = MIN2(old_size, new_size);
+     if (n > 0) memcpy(copy, old_ptr, n);
+     Afree(old_ptr,old_size);    // Mostly done to keep stats accurate
+@@ -483,7 +487,10 @@
+   }
+ 
+   // Oops, got to relocate guts
+-  void *new_ptr = Amalloc(new_size);
++  void *new_ptr = Amalloc(new_size, alloc_failmode);
++  if (new_ptr == NULL) {
++    return NULL;
++  }
+   memcpy( new_ptr, c_old, old_size );
+   Afree(c_old,old_size);        // Mostly done to keep stats accurate
+   return new_ptr;
+diff --git a/src/share/vm/memory/allocation.hpp b/src/share/vm/memory/allocation.hpp
+--- hotspot/src/share/vm/memory/allocation.hpp
++++ hotspot/src/share/vm/memory/allocation.hpp
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2011, 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
+@@ -34,10 +34,18 @@
+ #include "opto/c2_globals.hpp"
+ #endif
+ 
++#include <new>
++
+ #define ARENA_ALIGN_M1 (((size_t)(ARENA_AMALLOC_ALIGNMENT)) - 1)
+ #define ARENA_ALIGN_MASK (~((size_t)ARENA_ALIGN_M1))
+ #define ARENA_ALIGN(x) ((((size_t)(x)) + ARENA_ALIGN_M1) & ARENA_ALIGN_MASK)
+ 
++class AllocFailStrategy {
++public:
++  enum AllocFailEnum { EXIT_OOM, RETURN_NULL };
++};
++typedef AllocFailStrategy::AllocFailEnum AllocFailType;
++
+ // All classes in the virtual machine must be subclassed
+ // by one of the following allocation classes:
+ //
+@@ -152,7 +160,7 @@
+   Chunk*       _next;     // Next Chunk in list
+   const size_t _len;      // Size of this Chunk
+  public:
+-  void* operator new(size_t size, size_t length);
++  void* operator new(size_t size, AllocFailType alloc_failmode, size_t length);
+   void  operator delete(void* p);
+   Chunk(size_t length);
+ 
+@@ -200,7 +208,8 @@
+   Chunk *_first;                // First chunk
+   Chunk *_chunk;                // current chunk
+   char *_hwm, *_max;            // High water mark and max in current chunk
+-  void* grow(size_t x);         // Get a new Chunk of at least size x
++  // Get a new Chunk of at least size x
++  void* grow(size_t x, AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
+   NOT_PRODUCT(size_t _size_in_bytes;) // Size of arena (used for memory usage tracing)
+   NOT_PRODUCT(static size_t _bytes_allocated;) // total #bytes allocated since start
+   friend class AllocStats;
+@@ -209,10 +218,15 @@
+ 
+   void signal_out_of_memory(size_t request, const char* whence) const;
+ 
+-  void check_for_overflow(size_t request, const char* whence) const {
++  bool check_for_overflow(size_t request, const char* whence,
++      AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM) const {
+     if (UINTPTR_MAX - request < (uintptr_t)_hwm) {
++      if (alloc_failmode == AllocFailStrategy::RETURN_NULL) {
++        return false;
++      }
+       signal_out_of_memory(request, whence);
+     }
++    return true;
+   }
+ 
+  public:
+@@ -224,14 +238,15 @@
+   char* hwm() const             { return _hwm; }
+ 
+   // Fast allocate in the arena.  Common case is: pointer test + increment.
+-  void* Amalloc(size_t x) {
++  void* Amalloc(size_t x, AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM) {
+     assert(is_power_of_2(ARENA_AMALLOC_ALIGNMENT) , "should be a power of 2");
+     x = ARENA_ALIGN(x);
+     debug_only(if (UseMallocOnly) return malloc(x);)
+-    check_for_overflow(x, "Arena::Amalloc");
++    if (!check_for_overflow(x, "Arena::Amalloc", alloc_failmode))
++      return NULL;
+     NOT_PRODUCT(_bytes_allocated += x);
+     if (_hwm + x > _max) {
+-      return grow(x);
++      return grow(x, alloc_failmode);
+     } else {
+       char *old = _hwm;
+       _hwm += x;
+@@ -239,13 +254,14 @@
+     }
+   }
+   // Further assume size is padded out to words
+-  void *Amalloc_4(size_t x) {
++  void *Amalloc_4(size_t x, AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM) {
+     assert( (x&(sizeof(char*)-1)) == 0, "misaligned size" );
+     debug_only(if (UseMallocOnly) return malloc(x);)
+-    check_for_overflow(x, "Arena::Amalloc_4");
++    if (!check_for_overflow(x, "Arena::Amalloc_4", alloc_failmode))
++      return NULL;
+     NOT_PRODUCT(_bytes_allocated += x);
+     if (_hwm + x > _max) {
+-      return grow(x);
++      return grow(x, alloc_failmode);
+     } else {
+       char *old = _hwm;
+       _hwm += x;
+@@ -255,7 +271,7 @@
+ 
+   // Allocate with 'double' alignment. It is 8 bytes on sparc.
+   // In other cases Amalloc_D() should be the same as Amalloc_4().
+-  void* Amalloc_D(size_t x) {
++  void* Amalloc_D(size_t x, AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM) {
+     assert( (x&(sizeof(char*)-1)) == 0, "misaligned size" );
+     debug_only(if (UseMallocOnly) return malloc(x);)
+ #if defined(SPARC) && !defined(_LP64)
+@@ -263,10 +279,11 @@
+     size_t delta = (((size_t)_hwm + DALIGN_M1) & ~DALIGN_M1) - (size_t)_hwm;
+     x += delta;
+ #endif
+-    check_for_overflow(x, "Arena::Amalloc_D");
++    if (!check_for_overflow(x, "Arena::Amalloc_D", alloc_failmode))
++      return NULL;
+     NOT_PRODUCT(_bytes_allocated += x);
+     if (_hwm + x > _max) {
+-      return grow(x); // grow() returns a result aligned >= 8 bytes.
++      return grow(x, alloc_failmode); // grow() returns a result aligned >= 8 bytes.
+     } else {
+       char *old = _hwm;
+       _hwm += x;
+@@ -286,7 +303,8 @@
+     if (((char*)ptr) + size == _hwm) _hwm = (char*)ptr;
+   }
+ 
+-  void *Arealloc( void *old_ptr, size_t old_size, size_t new_size );
++  void *Arealloc( void *old_ptr, size_t old_size, size_t new_size,
++     AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
+ 
+   // Move contents of this arena into an empty arena
+   Arena *move_contents(Arena *empty_arena);
+@@ -328,9 +346,12 @@
+ 
+ 
+ //%note allocation_1
+-extern char* resource_allocate_bytes(size_t size);
+-extern char* resource_allocate_bytes(Thread* thread, size_t size);
+-extern char* resource_reallocate_bytes( char *old, size_t old_size, size_t new_size);
++extern char* resource_allocate_bytes(size_t size,
++    AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
++extern char* resource_allocate_bytes(Thread* thread, size_t size,
++    AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
++extern char* resource_reallocate_bytes( char *old, size_t old_size, size_t new_size,
++    AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
+ extern void resource_free_bytes( char *old, size_t size );
+ 
+ //----------------------------------------------------------------------
+@@ -376,6 +397,13 @@
+       DEBUG_ONLY(set_allocation_type(res, RESOURCE_AREA);)
+       return res;
+   }
++
++  void* operator new(size_t size, const std::nothrow_t& nothrow_constant) {
++    address res = (address)resource_allocate_bytes(size, AllocFailStrategy::RETURN_NULL);
++    DEBUG_ONLY(if (res != NULL) set_allocation_type(res, RESOURCE_AREA);)
++    return res;
++  }
++
+   void  operator delete(void* p);
+ };
+ 
+@@ -386,6 +414,9 @@
+ #define NEW_RESOURCE_ARRAY(type, size)\
+   (type*) resource_allocate_bytes((size) * sizeof(type))
+ 
++#define NEW_RESOURCE_ARRAY_RETURN_NULL(type, size)\
++  (type*) resource_allocate_bytes((size) * sizeof(type), AllocFailStrategy::RETURN_NULL)
++
+ #define NEW_RESOURCE_ARRAY_IN_THREAD(thread, type, size)\
+   (type*) resource_allocate_bytes(thread, (size) * sizeof(type))
+ 
+diff --git a/src/share/vm/memory/allocation.inline.hpp b/src/share/vm/memory/allocation.inline.hpp
+--- hotspot/src/share/vm/memory/allocation.inline.hpp
++++ hotspot/src/share/vm/memory/allocation.inline.hpp
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2010, 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
+@@ -34,25 +34,29 @@
+ 
+ 
+ // allocate using malloc; will fail if no memory available
+-inline char* AllocateHeap(size_t size, const char* name = NULL) {
++inline char* AllocateHeap(size_t size, const char* name = NULL,
++     AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM) {
+   char* p = (char*) os::malloc(size);
+   #ifdef ASSERT
+   if (PrintMallocFree) trace_heap_malloc(size, name, p);
+   #else
+   Unused_Variable(name);
+   #endif
+-  if (p == NULL) vm_exit_out_of_memory(size, name);
++  if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM)
++    vm_exit_out_of_memory(size, "AllocateHeap");
+   return p;
+ }
+ 
+-inline char* ReallocateHeap(char *old, size_t size, const char* name = NULL) {
++inline char* ReallocateHeap(char *old, size_t size, const char* name = NULL,
++    AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM) {
+   char* p = (char*) os::realloc(old,size);
+   #ifdef ASSERT
+   if (PrintMallocFree) trace_heap_malloc(size, name, p);
+   #else
+   Unused_Variable(name);
+   #endif
+-  if (p == NULL) vm_exit_out_of_memory(size, name);
++  if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM)
++    vm_exit_out_of_memory(size, "ReallocateHeap");
+   return p;
+ }
+ 
+diff --git a/src/share/vm/memory/resourceArea.cpp b/src/share/vm/memory/resourceArea.cpp
+--- hotspot/src/share/vm/memory/resourceArea.cpp
++++ hotspot/src/share/vm/memory/resourceArea.cpp
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2010, 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
+@@ -42,15 +42,16 @@
+ // The following routines are declared in allocation.hpp and used everywhere:
+ 
+ // Allocation in thread-local resource area
+-extern char* resource_allocate_bytes(size_t size) {
+-  return Thread::current()->resource_area()->allocate_bytes(size);
++extern char* resource_allocate_bytes(size_t size, AllocFailType alloc_failmode) {
++  return Thread::current()->resource_area()->allocate_bytes(size, alloc_failmode);
+ }
+-extern char* resource_allocate_bytes(Thread* thread, size_t size) {
+-  return thread->resource_area()->allocate_bytes(size);
++extern char* resource_allocate_bytes(Thread* thread, size_t size, AllocFailType alloc_failmode) {
++  return thread->resource_area()->allocate_bytes(size, alloc_failmode);
+ }
+ 
+-extern char* resource_reallocate_bytes( char *old, size_t old_size, size_t new_size){
+-  return (char*)Thread::current()->resource_area()->Arealloc(old, old_size, new_size);
++extern char* resource_reallocate_bytes( char *old, size_t old_size, size_t new_size,
++    AllocFailType alloc_failmode){
++  return (char*)Thread::current()->resource_area()->Arealloc(old, old_size, new_size, alloc_failmode);
+ }
+ 
+ extern void resource_free_bytes( char *old, size_t size ) {
+diff --git a/src/share/vm/memory/resourceArea.hpp b/src/share/vm/memory/resourceArea.hpp
+--- hotspot/src/share/vm/memory/resourceArea.hpp
++++ hotspot/src/share/vm/memory/resourceArea.hpp
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2010, 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
+@@ -64,7 +64,7 @@
+     debug_only(_nesting = 0;);
+   }
+ 
+-  char* allocate_bytes(size_t size) {
++  char* allocate_bytes(size_t size, AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM) {
+ #ifdef ASSERT
+     if (_nesting < 1 && !_warned++)
+       fatal("memory leak: allocating without ResourceMark");
+@@ -74,7 +74,7 @@
+       return (*save = (char*)os::malloc(size));
+     }
+ #endif
+-    return (char*)Amalloc(size);
++    return (char*)Amalloc(size, alloc_failmode);
+   }
+ 
+   debug_only(int nesting() const { return _nesting; });
+diff --git a/src/share/vm/oops/generateOopMap.cpp b/src/share/vm/oops/generateOopMap.cpp
+--- hotspot/src/share/vm/oops/generateOopMap.cpp
++++ hotspot/src/share/vm/oops/generateOopMap.cpp
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2011, 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
+@@ -643,11 +643,20 @@
+ // CellType handling methods
+ //
+ 
++// Allocate memory and throw LinkageError if failure.
++#define ALLOC_RESOURCE_ARRAY(var, type, count) \
++  var = NEW_RESOURCE_ARRAY_RETURN_NULL(type, count);              \
++  if (var == NULL) {                                              \
++    report_error("Cannot reserve enough memory to analyze this method"); \
++    return;                                                       \
++  }
++
+ void GenerateOopMap::init_state() {
+   _state_len     = _max_locals + _max_stack + _max_monitors;
+-  _state         = NEW_RESOURCE_ARRAY(CellTypeState, _state_len);
++  ALLOC_RESOURCE_ARRAY(_state, CellTypeState, _state_len);
+   memset(_state, 0, _state_len * sizeof(CellTypeState));
+-  _state_vec_buf = NEW_RESOURCE_ARRAY(char, MAX3(_max_locals, _max_stack, _max_monitors) + 1/*for null terminator char */);
++  int count = MAX3(_max_locals, _max_stack, _max_monitors) + 1/*for null terminator char */;
++  ALLOC_RESOURCE_ARRAY(_state_vec_buf, char, count)
+ }
+ 
+ void GenerateOopMap::make_context_uninitialized() {
+@@ -905,7 +914,7 @@
+   // But cumbersome since we don't know the stack heights yet.  (Nor the
+   // monitor stack heights...)
+ 
+-  _basic_blocks = NEW_RESOURCE_ARRAY(BasicBlock, _bb_count);
++  ALLOC_RESOURCE_ARRAY(_basic_blocks, BasicBlock, _bb_count);
+ 
+   // Make a pass through the bytecodes.  Count the number of monitorenters.
+   // This can be used an upper bound on the monitor stack depth in programs
+@@ -976,8 +985,8 @@
+     return;
+   }
+ 
+-  CellTypeState *basicBlockState =
+-      NEW_RESOURCE_ARRAY(CellTypeState, bbNo * _state_len);
++  CellTypeState *basicBlockState;
++  ALLOC_RESOURCE_ARRAY(basicBlockState, CellTypeState, bbNo * _state_len);
+   memset(basicBlockState, 0, bbNo * _state_len * sizeof(CellTypeState));
+ 
+   // Make a pass over the basicblocks and assign their state vectors.

Added: trunk/java/openjdk6/files/icedtea/security/20130618/7170730-windows_network_stack.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/7170730-windows_network_stack.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/7170730-windows_network_stack.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,1057 @@
+# HG changeset patch
+# User andrew
+# Date 1371235188 -3600
+# Node ID 8664ebe88635d671ed0134e9348d5e6caea81d0d
+# Parent  7ecadad337414327d0d0ca6a8efcc40b7e8a9d29
+7170730: Improve Windows network stack support.
+Summary: Enable exclusive binding of ports on Windows
+Contributed-by: Severin Gehwolf <sgehwolf at redhat.com>
+
+diff --git a/make/java/nio/mapfile-linux b/make/java/nio/mapfile-linux
+--- jdk/make/java/nio/mapfile-linux
++++ jdk/make/java/nio/mapfile-linux
+@@ -61,7 +61,8 @@
+ 		Java_sun_nio_ch_NativeThread_init;
+ 		Java_sun_nio_ch_NativeThread_signal;
+ 		Java_sun_nio_ch_Net_socket0;
+-		Java_sun_nio_ch_Net_bind;
++		Java_sun_nio_ch_Net_bind0;
++		Java_sun_nio_ch_Net_isExclusiveBindAvailable;
+ 		Java_sun_nio_ch_Net_connect;
+ 		Java_sun_nio_ch_Net_localPort;
+ 		Java_sun_nio_ch_Net_localInetAddress;
+diff --git a/make/java/nio/mapfile-solaris b/make/java/nio/mapfile-solaris
+--- jdk/make/java/nio/mapfile-solaris
++++ jdk/make/java/nio/mapfile-solaris
+@@ -59,7 +59,8 @@
+ 		Java_sun_nio_ch_NativeThread_init;
+ 		Java_sun_nio_ch_NativeThread_signal;
+ 		Java_sun_nio_ch_Net_socket0;
+-		Java_sun_nio_ch_Net_bind;
++		Java_sun_nio_ch_Net_bind0;
++		Java_sun_nio_ch_Net_isExclusiveBindAvailable;
+ 		Java_sun_nio_ch_Net_connect;
+ 		Java_sun_nio_ch_Net_localPort;
+ 		Java_sun_nio_ch_Net_localInetAddress;
+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
+@@ -473,6 +473,10 @@
+                             {
+                                 Net.setIntOption(fd, opt, arg);
+                             }
++                            boolean getIsBoundCondition()
++                            {
++                                return localAddress != null;
++                            }
+                         };
+                 options = new SocketOptsImpl.IP(d);
+             }
+diff --git a/src/share/classes/sun/nio/ch/Net.java b/src/share/classes/sun/nio/ch/Net.java
+--- jdk/src/share/classes/sun/nio/ch/Net.java
++++ jdk/src/share/classes/sun/nio/ch/Net.java
+@@ -36,8 +36,42 @@
+     private Net() { }
+ 
+ 
++    // set to true if exclusive binding is on for Windows
++    private static final boolean exclusiveBind;
++
++    static {
++        int availLevel = isExclusiveBindAvailable();
++        if (availLevel >= 0) {
++            String exclBindProp =
++                java.security.AccessController.doPrivileged(
++                    new java.security.PrivilegedAction<String>() {
++                        public String run() {
++                            return System.getProperty(
++                                    "sun.net.useExclusiveBind");
++                        }
++                    });
++            if (exclBindProp != null) {
++                exclusiveBind = exclBindProp.length() == 0 ?
++                        true : Boolean.parseBoolean(exclBindProp);
++            } else if (availLevel == 1) {
++                exclusiveBind = true;
++            } else {
++                exclusiveBind = false;
++            }
++        } else {
++            exclusiveBind = false;
++        }
++    }
++
+     // -- Miscellaneous utilities --
+ 
++    /**
++     * Returns true if exclusive binding is on
++     */
++    static boolean useExclusiveBind() {
++        return exclusiveBind;
++    }
++
+     static InetSocketAddress checkAddress(SocketAddress sa) {
+         if (sa == null)
+             throw new IllegalArgumentException();
+@@ -119,10 +153,21 @@
+         return IOUtil.newFD(socket0(stream, true));
+     }
+ 
++    /*
++     * Returns 1 for Windows versions that support exclusive binding by default, 0
++     * for those that do not, and -1 for Solaris/Linux/Mac OS
++     */
++    private static native int isExclusiveBindAvailable();
++
+     // Due to oddities SO_REUSEADDR on windows reuse is ignored
+     private static native int socket0(boolean stream, boolean reuse);
+ 
+-    static native void bind(FileDescriptor fd, InetAddress addr, int port)
++    static void bind(FileDescriptor fd, InetAddress addr, int port)
++        throws IOException {
++        bind0(fd, exclusiveBind, addr, port);
++    }
++
++    private static native void bind0(FileDescriptor fd, boolean useExclBind, InetAddress addr, int port)
+         throws IOException;
+ 
+     static native int connect(FileDescriptor fd,
+diff --git a/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java b/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java
+--- jdk/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java
++++ jdk/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java
+@@ -207,6 +207,10 @@
+                             void setInt(int opt, int arg) throws IOException {
+                                 Net.setIntOption(fd, opt, arg);
+                             }
++                            boolean getIsBoundCondition() {
++                                // always return true
++                                return true;
++                            }
+                         };
+                 options = new SocketOptsImpl.IP.TCP(d);
+             }
+diff --git a/src/share/classes/sun/nio/ch/SocketChannelImpl.java b/src/share/classes/sun/nio/ch/SocketChannelImpl.java
+--- jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java
++++ jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java
+@@ -423,6 +423,11 @@
+                             {
+                                 Net.setIntOption(fd, opt, arg);
+                             }
++                            boolean getIsBoundCondition()
++                            {
++                                // always return true
++                                return true;
++                            }
+                         };
+                 options = new SocketOptsImpl.IP.TCP(d);
+             }
+diff --git a/src/share/classes/sun/nio/ch/SocketOptsImpl.java b/src/share/classes/sun/nio/ch/SocketOptsImpl.java
+--- jdk/src/share/classes/sun/nio/ch/SocketOptsImpl.java
++++ jdk/src/share/classes/sun/nio/ch/SocketOptsImpl.java
+@@ -35,10 +35,17 @@
+ class SocketOptsImpl
+     implements SocketOpts
+ {
++    // set true when socket is bound and SO_REUSEADDRESS is emulated
++    private boolean reuseAddressEmulated;
++
++    // set true/false when socket is already bound and SO_REUSEADDR is emulated
++    private boolean isReuseAddress;
+ 
+     static abstract class Dispatcher {
+         abstract int getInt(int opt) throws IOException;
+         abstract void setInt(int opt, int arg) throws IOException;
++        // Only used meaningfully by DatagramChannelImpl
++        abstract boolean getIsBoundCondition();
+         // Others that pass addresses, etc., will come later
+     }
+ 
+@@ -167,11 +174,21 @@
+     // SO_REUSEADDR
+ 
+     public boolean reuseAddress() throws IOException {
++        if (reuseAddressEmulated) {
++            return isReuseAddress;
++        }
++        // no special handling
+         return getBoolean(SocketOptions.SO_REUSEADDR);
+     }
+ 
+     public SocketOpts reuseAddress(boolean b) throws IOException {
+-        setBoolean(SocketOptions.SO_REUSEADDR, b);
++        if ( Net.useExclusiveBind() && d.getIsBoundCondition() ) {
++            reuseAddressEmulated = true;
++            this.isReuseAddress = b;
++        } else {
++            // no special handling
++            setBoolean(SocketOptions.SO_REUSEADDR, b);
++        }
+         return this;
+     }
+ 
+diff --git a/src/solaris/native/sun/nio/ch/Net.c b/src/solaris/native/sun/nio/ch/Net.c
+--- jdk/src/solaris/native/sun/nio/ch/Net.c
++++ jdk/src/solaris/native/sun/nio/ch/Net.c
+@@ -55,6 +55,11 @@
+     /* Here because Windows native code does need to init IDs */
+ }
+ 
++JNIEXPORT jint JNICALL
++Java_sun_nio_ch_Net_isExclusiveBindAvailable(JNIEnv *env, jclass clazz) {
++    return -1;
++}
++
+ JNIEXPORT int JNICALL
+ Java_sun_nio_ch_Net_socket0(JNIEnv *env, jclass cl, jboolean stream,
+                             jboolean reuse)
+@@ -84,8 +89,8 @@
+ }
+ 
+ JNIEXPORT void JNICALL
+-Java_sun_nio_ch_Net_bind(JNIEnv *env, jclass clazz, /* ## Needs rest of PSI gunk */
+-                         jobject fdo, jobject ia, int port)
++Java_sun_nio_ch_Net_bind0(JNIEnv *env, jclass clazz, /* ## Needs rest of PSI gunk */
++                         jobject fdo, jboolean exclBind, jobject ia, int port)
+ {
+     SOCKADDR sa;
+     int sa_len = SOCKADDR_LEN;
+diff --git a/src/windows/classes/java/net/DefaultDatagramSocketImplFactory.java b/src/windows/classes/java/net/DefaultDatagramSocketImplFactory.java
+--- jdk/src/windows/classes/java/net/DefaultDatagramSocketImplFactory.java
++++ jdk/src/windows/classes/java/net/DefaultDatagramSocketImplFactory.java
+@@ -56,24 +56,45 @@
+     /* If the version supports a dual stack TCP implementation */
+     private static boolean useDualStackImpl = false;
+ 
++    /* sun.net.useExclusiveBind */
++    private static String exclBindProp;
++
++    /* True if exclusive binding is on for Windows */
++    private static boolean exclusiveBind = true;
++
++
+     static {
+         // Determine Windows Version.
+-        java.security.AccessController.doPrivileged( new PrivilegedAction<Object>() {
+-                public Object run() {
+-                    version = 0;
+-                    try {
+-                        version = Float.parseFloat(System.getProperties().getProperty("os.version"));
+-                        preferIPv4Stack = Boolean.parseBoolean(
+-                                          System.getProperties().getProperty("java.net.preferIPv4Stack"));
+-                    } catch (NumberFormatException e ) {
+-                        assert false : e;
++        java.security.AccessController.doPrivileged(
++                new PrivilegedAction<Object>() {
++                    public Object run() {
++                        version = 0;
++                        try {
++                            version = Float.parseFloat(System.getProperties()
++                                    .getProperty("os.version"));
++                            preferIPv4Stack = Boolean.parseBoolean(
++                                              System.getProperties()
++                                              .getProperty(
++                                                   "java.net.preferIPv4Stack"));
++                            exclBindProp = System.getProperty(
++                                    "sun.net.useExclusiveBind");
++                        } catch (NumberFormatException e ) {
++                            assert false : e;
++                        }
++                        return null; // nothing to return
+                     }
+-                    return null; // nothing to return
+-                } });
++                });
+ 
+         // (version >= 6.0) implies Vista or greater.
+         if (version >= 6.0 && !preferIPv4Stack) {
+-            useDualStackImpl = true;
++                useDualStackImpl = true;
++        }
++        if (exclBindProp != null) {
++            // sun.net.useExclusiveBind is true
++            exclusiveBind = exclBindProp.length() == 0 ? true
++                    : Boolean.parseBoolean(exclBindProp);
++        } else if (version < 6.0) {
++            exclusiveBind = false;
+         }
+ 
+         // impl.prefix
+@@ -105,10 +126,12 @@
+                 throw new SocketException("can't instantiate DatagramSocketImpl");
+             }
+         } else {
++            if (isMulticast)
++                exclusiveBind = false;
+             if (useDualStackImpl && !isMulticast)
+-                return new DualStackPlainDatagramSocketImpl();
++                return new DualStackPlainDatagramSocketImpl(exclusiveBind);
+             else
+-                return new TwoStacksPlainDatagramSocketImpl();
++                return new TwoStacksPlainDatagramSocketImpl(exclusiveBind);
+         }
+     }
+ }
+diff --git a/src/windows/classes/java/net/DualStackPlainDatagramSocketImpl.java b/src/windows/classes/java/net/DualStackPlainDatagramSocketImpl.java
+--- jdk/src/windows/classes/java/net/DualStackPlainDatagramSocketImpl.java
++++ jdk/src/windows/classes/java/net/DualStackPlainDatagramSocketImpl.java
+@@ -46,6 +46,22 @@
+ {
+     static JavaIOFileDescriptorAccess fdAccess = SharedSecrets.getJavaIOFileDescriptorAccess();
+ 
++    // true if this socket is exclusively bound
++    private final boolean exclusiveBind;
++
++    /*
++     * Set to true if SO_REUSEADDR is set after the socket is bound to
++     * indicate SO_REUSEADDR is being emulated
++     */
++    private boolean reuseAddressEmulated;
++
++    // emulates SO_REUSEADDR when exclusiveBind is true and socket is bound
++    private boolean isReuseAddress;
++
++    DualStackPlainDatagramSocketImpl(boolean exclBind) {
++        exclusiveBind = exclBind;
++    }
++
+     protected void datagramSocketCreate() throws SocketException {
+         if (fd == null)
+             throw new SocketException("Socket closed");
+@@ -62,7 +78,7 @@
+         if (laddr == null)
+             throw new NullPointerException("argument address");
+ 
+-        socketBind(nativefd, laddr, lport);
++        socketBind(nativefd, laddr, lport, exclusiveBind);
+         if (lport == 0) {
+             localPort = socketLocalPort(nativefd);
+         } else {
+@@ -142,6 +158,7 @@
+         fdAccess.set(fd, -1);
+     }
+ 
++    @SuppressWarnings("fallthrough")
+     protected void socketSetOption(int opt, Object val) throws SocketException {
+         int nativefd = checkAndReturnNativeFD();
+ 
+@@ -154,6 +171,13 @@
+                 optionValue = ((Integer)val).intValue();
+                 break;
+             case SO_REUSEADDR :
++                if (exclusiveBind && localPort != 0)  {
++                    // socket already bound, emulate SO_REUSEADDR
++                    reuseAddressEmulated = true;
++                    isReuseAddress = (Boolean)val;
++                    return;
++                }
++                //Intentional fallthrough
+             case SO_BROADCAST :
+                 optionValue = ((Boolean)val).booleanValue() ? 1 : 0;
+                 break;
+@@ -171,6 +195,8 @@
+         if (opt == SO_BINDADDR) {
+             return socketLocalAddress(nativefd);
+         }
++        if (opt == SO_REUSEADDR && reuseAddressEmulated)
++            return isReuseAddress;
+ 
+         int value = socketGetIntOption(nativefd, opt);
+         Object returnValue = null;
+@@ -238,8 +264,8 @@
+ 
+     private static native int socketCreate(boolean v6Only);
+ 
+-    private static native void socketBind(int fd, InetAddress localAddress, int localport)
+-        throws SocketException;
++    private static native void socketBind(int fd, InetAddress localAddress,
++            int localport, boolean exclBind) throws SocketException;
+ 
+     private static native void socketConnect(int fd, InetAddress address, int port)
+         throws SocketException;
+diff --git a/src/windows/classes/java/net/DualStackPlainSocketImpl.java b/src/windows/classes/java/net/DualStackPlainSocketImpl.java
+--- jdk/src/windows/classes/java/net/DualStackPlainSocketImpl.java
++++ jdk/src/windows/classes/java/net/DualStackPlainSocketImpl.java
+@@ -42,10 +42,20 @@
+ {
+     static JavaIOFileDescriptorAccess fdAccess = SharedSecrets.getJavaIOFileDescriptorAccess();
+ 
+-    public DualStackPlainSocketImpl() {}
+ 
+-    public DualStackPlainSocketImpl(FileDescriptor fd) {
++    // true if this socket is exclusively bound
++    private final boolean exclusiveBind;
++
++    // emulates SO_REUSEADDR when exclusiveBind is true
++    private boolean isReuseAddress;
++
++    public DualStackPlainSocketImpl(boolean exclBind) {
++        exclusiveBind = exclBind;
++    }
++
++    public DualStackPlainSocketImpl(FileDescriptor fd, boolean exclBind) {
+         this.fd = fd;
++        exclusiveBind = exclBind;
+     }
+ 
+     void socketCreate(boolean stream) throws IOException {
+@@ -93,7 +103,7 @@
+         if (address == null)
+             throw new NullPointerException("inet address argument is null.");
+ 
+-        bind0(nativefd, address, port);
++        bind0(nativefd, address, port, exclusiveBind);
+         if (port == 0) {
+             localport = localPort0(nativefd);
+         } else {
+@@ -161,6 +171,8 @@
+         shutdown0(nativefd, howto);
+     }
+ 
++    // Intentional fallthrough after SO_REUSEADDR
++    @SuppressWarnings("fallthrough")
+     void socketSetOption(int opt, boolean on, Object value)
+         throws SocketException {
+         int nativefd = checkAndReturnNativeFD();
+@@ -174,8 +186,13 @@
+         switch(opt) {
+             case TCP_NODELAY :
+             case SO_OOBINLINE :
++            case SO_REUSEADDR :
++                if (exclusiveBind) {
++                    // SO_REUSEADDR emulated when using exclusive bind
++                    isReuseAddress = on;
++                    return;
++                }
+             case SO_KEEPALIVE :
+-            case SO_REUSEADDR :
+                 optionValue = on ? 1 : 0;
+                 break;
+             case SO_SNDBUF :
+@@ -206,6 +223,10 @@
+             return 0;  // return value doesn't matter.
+         }
+ 
++        // SO_REUSEADDR emulated when using exclusive bind
++        if (opt == SO_REUSEADDR && exclusiveBind)
++            return isReuseAddress? 1 : -1;
++
+         int value = getIntOption(nativefd, opt);
+ 
+         switch (opt) {
+@@ -245,7 +266,8 @@
+ 
+     static native int socket0(boolean stream, boolean v6Only) throws IOException;
+ 
+-    static native void bind0(int fd, InetAddress localAddress, int localport)
++    static native void bind0(int fd, InetAddress localAddress, int localport,
++                             boolean exclBind)
+         throws IOException;
+ 
+     static native int connect0(int fd, InetAddress remote, int remotePort)
+diff --git a/src/windows/classes/java/net/PlainSocketImpl.java b/src/windows/classes/java/net/PlainSocketImpl.java
+--- jdk/src/windows/classes/java/net/PlainSocketImpl.java
++++ jdk/src/windows/classes/java/net/PlainSocketImpl.java
+@@ -54,6 +54,12 @@
+     /* If the version supports a dual stack TCP implementation */
+     private static boolean useDualStackImpl = false;
+ 
++    /* sun.net.useExclusiveBind */
++    private static String exclBindProp;
++
++    /* True if exclusive binding is on for Windows */
++    private static boolean exclusiveBind = true;
++
+     static {
+         java.security.AccessController.doPrivileged( new PrivilegedAction<Object>() {
+                 public Object run() {
+@@ -62,6 +68,7 @@
+                         version = Float.parseFloat(System.getProperties().getProperty("os.version"));
+                         preferIPv4Stack = Boolean.parseBoolean(
+                                           System.getProperties().getProperty("java.net.preferIPv4Stack"));
++                        exclBindProp = System.getProperty("sun.net.useExclusiveBind");
+                     } catch (NumberFormatException e ) {
+                         assert false : e;
+                     }
+@@ -70,7 +77,15 @@
+ 
+         // (version >= 6.0) implies Vista or greater.
+         if (version >= 6.0 && !preferIPv4Stack) {
+-            useDualStackImpl = true;
++                useDualStackImpl = true;
++        }
++
++        if (exclBindProp != null) {
++            // sun.net.useExclusiveBind is true
++            exclusiveBind = exclBindProp.length() == 0 ? true
++                    : Boolean.parseBoolean(exclBindProp);
++        } else if (version < 6.0) {
++            exclusiveBind = false;
+         }
+     }
+ 
+@@ -79,9 +94,9 @@
+      */
+     PlainSocketImpl() {
+         if (useDualStackImpl) {
+-            impl = new DualStackPlainSocketImpl();
++            impl = new DualStackPlainSocketImpl(exclusiveBind);
+         } else {
+-            impl = new TwoStacksPlainSocketImpl();
++            impl = new TwoStacksPlainSocketImpl(exclusiveBind);
+         }
+     }
+ 
+@@ -90,9 +105,9 @@
+      */
+     PlainSocketImpl(FileDescriptor fd) {
+         if (useDualStackImpl) {
+-            impl = new DualStackPlainSocketImpl(fd);
++            impl = new DualStackPlainSocketImpl(fd, exclusiveBind);
+         } else {
+-            impl = new TwoStacksPlainSocketImpl(fd);
++            impl = new TwoStacksPlainSocketImpl(fd, exclusiveBind);
+         }
+     }
+ 
+diff --git a/src/windows/classes/java/net/TwoStacksPlainDatagramSocketImpl.java b/src/windows/classes/java/net/TwoStacksPlainDatagramSocketImpl.java
+--- jdk/src/windows/classes/java/net/TwoStacksPlainDatagramSocketImpl.java
++++ jdk/src/windows/classes/java/net/TwoStacksPlainDatagramSocketImpl.java
+@@ -66,6 +66,22 @@
+         init();
+     }
+ 
++    // true if this socket is exclusively bound
++    private final boolean exclusiveBind;
++
++    /*
++     * Set to true if SO_REUSEADDR is set after the socket is bound to
++     * indicate SO_REUSEADDR is being emulated
++     */
++    private boolean reuseAddressEmulated;
++
++    // emulates SO_REUSEADDR when exclusiveBind is true and socket is bound
++    private boolean isReuseAddress;
++
++    TwoStacksPlainDatagramSocketImpl(boolean exclBind) {
++        exclusiveBind = exclBind;
++    }
++
+     protected synchronized void create() throws SocketException {
+         fd1 = new FileDescriptor();
+         super.create();
+@@ -79,6 +95,14 @@
+         }
+     }
+ 
++    @Override
++    protected synchronized void bind0(int lport, InetAddress laddr)
++        throws SocketException
++    {
++        bind0(lport, laddr, exclusiveBind);
++
++    }
++
+     protected synchronized void receive(DatagramPacket p)
+         throws IOException {
+         try {
+@@ -98,8 +122,24 @@
+                 return anyLocalBoundAddr;
+             }
+             return socketGetOption(optID);
+-        } else
++        } else if (optID == SO_REUSEADDR && reuseAddressEmulated) {
++            return isReuseAddress;
++        } else {
+             return super.getOption(optID);
++        }
++    }
++
++    protected void socketSetOption(int opt, Object val)
++        throws SocketException
++    {
++        if (opt == SO_REUSEADDR && exclusiveBind && localPort != 0)  {
++            // socket already bound, emulate
++            reuseAddressEmulated = true;
++            isReuseAddress = (Boolean)val;
++        } else {
++            socketNativeSetOption(opt, val);
++        }
++
+     }
+ 
+     protected boolean isClosed() {
+@@ -117,7 +157,8 @@
+ 
+     /* Native methods */
+ 
+-    protected synchronized native void bind0(int lport, InetAddress laddr)
++    protected synchronized native void bind0(int lport, InetAddress laddr,
++                                             boolean exclBind)
+         throws SocketException;
+ 
+     protected native void send(DatagramPacket p) throws IOException;
+@@ -147,7 +188,7 @@
+ 
+     protected native void datagramSocketClose();
+ 
+-    protected native void socketSetOption(int opt, Object val)
++    protected native void socketNativeSetOption(int opt, Object val)
+         throws SocketException;
+ 
+     protected native Object socketGetOption(int opt) throws SocketException;
+diff --git a/src/windows/classes/java/net/TwoStacksPlainSocketImpl.java b/src/windows/classes/java/net/TwoStacksPlainSocketImpl.java
+--- jdk/src/windows/classes/java/net/TwoStacksPlainSocketImpl.java
++++ jdk/src/windows/classes/java/net/TwoStacksPlainSocketImpl.java
+@@ -65,14 +65,23 @@
+      */
+     private int lastfd = -1;
+ 
++    // true if this socket is exclusively bound
++    private final boolean exclusiveBind;
++
++    // emulates SO_REUSEADDR when exclusiveBind is true
++    private boolean isReuseAddress;
++
+     static {
+         initProto();
+     }
+ 
+-    public TwoStacksPlainSocketImpl() {}
++    public TwoStacksPlainSocketImpl(boolean exclBind) {
++        exclusiveBind = exclBind;
++    }
+ 
+-    public TwoStacksPlainSocketImpl(FileDescriptor fd) {
++    public TwoStacksPlainSocketImpl(FileDescriptor fd, boolean exclBind) {
+         this.fd = fd;
++        exclusiveBind = exclBind;
+     }
+ 
+     /**
+@@ -110,13 +119,33 @@
+             InetAddressContainer in = new InetAddressContainer();
+             socketGetOption(opt, in);
+             return in.addr;
++        } else if (opt == SO_REUSEADDR && exclusiveBind) {
++            // SO_REUSEADDR emulated when using exclusive bind
++            return isReuseAddress;
+         } else
+             return super.getOption(opt);
+     }
+ 
++    @Override
++    void socketBind(InetAddress address, int port) throws IOException {
++        socketBind(address, port, exclusiveBind);
++    }
++
++    @Override
++    void socketSetOption(int opt, boolean on, Object value)
++        throws SocketException
++    {
++        // SO_REUSEADDR emulated when using exclusive bind
++        if (opt == SO_REUSEADDR && exclusiveBind)
++            isReuseAddress = on;
++        else
++            socketNativeSetOption(opt, on, value);
++    }
++
+     /**
+      * Closes the socket.
+      */
++    @Override
+     protected void close() throws IOException {
+         synchronized(fdLock) {
+             if (fd != null || fd1 != null) {
+@@ -146,6 +175,7 @@
+         }
+     }
+ 
++    @Override
+     void reset() throws IOException {
+         if (fd != null || fd1 != null) {
+             socketClose();
+@@ -158,6 +188,7 @@
+     /*
+      * Return true if already closed or close is pending
+      */
++    @Override
+     public boolean isClosedOrPending() {
+         /*
+          * Lock on fdLock to ensure that we wait if a
+@@ -181,7 +212,7 @@
+     native void socketConnect(InetAddress address, int port, int timeout)
+         throws IOException;
+ 
+-    native void socketBind(InetAddress address, int port)
++    native void socketBind(InetAddress address, int port, boolean exclBind)
+         throws IOException;
+ 
+     native void socketListen(int count) throws IOException;
+@@ -194,7 +225,7 @@
+ 
+     native void socketShutdown(int howto) throws IOException;
+ 
+-    native void socketSetOption(int cmd, boolean on, Object value)
++    native void socketNativeSetOption(int cmd, boolean on, Object value)
+         throws SocketException;
+ 
+     native int socketGetOption(int opt, Object iaContainerObj) throws SocketException;
+diff --git a/src/windows/native/java/net/DualStackPlainDatagramSocketImpl.c b/src/windows/native/java/net/DualStackPlainDatagramSocketImpl.c
+--- jdk/src/windows/native/java/net/DualStackPlainDatagramSocketImpl.c
++++ jdk/src/windows/native/java/net/DualStackPlainDatagramSocketImpl.c
+@@ -112,7 +112,7 @@
+  * Signature: (ILjava/net/InetAddress;I)V
+  */
+ JNIEXPORT void JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_socketBind
+-  (JNIEnv *env, jclass clazz, jint fd, jobject iaObj, jint port) {
++  (JNIEnv *env, jclass clazz, jint fd, jobject iaObj, jint port, jboolean exclBind) {
+     SOCKETADDRESS sa;
+     int rv;
+     int sa_len = sizeof(sa);
+@@ -121,8 +121,7 @@
+                                  &sa_len, JNI_TRUE) != 0) {
+         return;
+     }
+-
+-    rv = bind(fd, (struct sockaddr *)&sa, sa_len);
++    rv = NET_WinBind(fd, (struct sockaddr *)&sa, sa_len, exclBind);
+ 
+     if (rv == SOCKET_ERROR) {
+         if (WSAGetLastError() == WSAEACCES) {
+diff --git a/src/windows/native/java/net/DualStackPlainSocketImpl.c b/src/windows/native/java/net/DualStackPlainSocketImpl.c
+--- jdk/src/windows/native/java/net/DualStackPlainSocketImpl.c
++++ jdk/src/windows/native/java/net/DualStackPlainSocketImpl.c
+@@ -82,7 +82,9 @@
+  * Signature: (ILjava/net/InetAddress;I)V
+  */
+ JNIEXPORT void JNICALL Java_java_net_DualStackPlainSocketImpl_bind0
+-  (JNIEnv *env, jclass clazz, jint fd, jobject iaObj, jint port) {
++  (JNIEnv *env, jclass clazz, jint fd, jobject iaObj, jint port,
++   jboolean exclBind)
++{
+     SOCKETADDRESS sa;
+     int rv;
+     int sa_len = sizeof(sa);
+@@ -92,7 +94,7 @@
+       return;
+     }
+ 
+-    rv = NET_Bind(fd, (struct sockaddr *)&sa, sa_len);
++    rv = NET_WinBind(fd, (struct sockaddr *)&sa, sa_len, exclBind);
+ 
+     if (rv == SOCKET_ERROR)
+         NET_ThrowNew(env, WSAGetLastError(), "JVM_Bind");
+diff --git a/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c b/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c
+--- jdk/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c
++++ jdk/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c
+@@ -421,7 +421,8 @@
+ 
+ JNIEXPORT void JNICALL
+ Java_java_net_TwoStacksPlainDatagramSocketImpl_bind0(JNIEnv *env, jobject this,
+-                                           jint port, jobject addressObj) {
++                                           jint port, jobject addressObj,
++                                           jboolean exclBind) {
+     jobject fdObj = (*env)->GetObjectField(env, this, pdsi_fdID);
+     jobject fd1Obj = (*env)->GetObjectField(env, this, pdsi_fd1ID);
+ 
+@@ -464,7 +465,7 @@
+         v6bind.addr = &lcladdr;
+         v6bind.ipv4_fd = fd;
+         v6bind.ipv6_fd = fd1;
+-        if (NET_BindV6(&v6bind) != -1) {
++        if (NET_BindV6(&v6bind, exclBind) != -1) {
+             /* check if the fds have changed */
+             if (v6bind.ipv4_fd != fd) {
+                 fd = v6bind.ipv4_fd;
+@@ -491,7 +492,7 @@
+             return;
+         }
+     } else {
+-        if (bind(fd, (struct sockaddr *)&lcladdr, lcladdrlen) == -1) {
++        if (NET_WinBind(fd, (struct sockaddr *)&lcladdr, lcladdrlen, exclBind) == -1) {
+             if (WSAGetLastError() == WSAEACCES) {
+                 WSASetLastError(WSAEADDRINUSE);
+             }
+@@ -1780,11 +1781,11 @@
+ 
+ /*
+  * Class:     java_net_TwoStacksPlainDatagramSocketImpl
+- * Method:    socketSetOption
++ * Method:    socketNativeSetOption
+  * Signature: (ILjava/lang/Object;)V
+  */
+ JNIEXPORT void JNICALL
+-Java_java_net_TwoStacksPlainDatagramSocketImpl_socketSetOption(JNIEnv *env,jobject this,
++Java_java_net_TwoStacksPlainDatagramSocketImpl_socketNativeSetOption(JNIEnv *env,jobject this,
+                                                       jint opt,jobject value) {
+ 
+     int fd=-1, fd1=-1;
+diff --git a/src/windows/native/java/net/TwoStacksPlainSocketImpl.c b/src/windows/native/java/net/TwoStacksPlainSocketImpl.c
+--- jdk/src/windows/native/java/net/TwoStacksPlainSocketImpl.c
++++ jdk/src/windows/native/java/net/TwoStacksPlainSocketImpl.c
+@@ -393,7 +393,8 @@
+  */
+ JNIEXPORT void JNICALL
+ Java_java_net_TwoStacksPlainSocketImpl_socketBind(JNIEnv *env, jobject this,
+-                                         jobject iaObj, jint localport) {
++                                         jobject iaObj, jint localport,
++                                         jboolean exclBind) {
+ 
+     /* fdObj is the FileDescriptor field on this */
+     jobject fdObj, fd1Obj;
+@@ -437,13 +438,12 @@
+                           (struct sockaddr *)&him, &len, JNI_FALSE) != 0) {
+       return;
+     }
+-
+     if (ipv6_supported) {
+         struct ipv6bind v6bind;
+         v6bind.addr = &him;
+         v6bind.ipv4_fd = fd;
+         v6bind.ipv6_fd = fd1;
+-        rv = NET_BindV6(&v6bind);
++        rv = NET_BindV6(&v6bind, exclBind);
+         if (rv != -1) {
+             /* check if the fds have changed */
+             if (v6bind.ipv4_fd != fd) {
+@@ -468,7 +468,7 @@
+             }
+         }
+     } else {
+-        rv = NET_Bind(fd, (struct sockaddr *)&him, len);
++        rv = NET_WinBind(fd, (struct sockaddr *)&him, len, exclBind);
+     }
+ 
+     if (rv == -1) {
+@@ -829,11 +829,12 @@
+  *
+  *
+  * Class:     java_net_TwoStacksPlainSocketImpl
+- * Method:    socketSetOption
++ * Method:    socketNativeSetOption
+  * Signature: (IZLjava/lang/Object;)V
+  */
+ JNIEXPORT void JNICALL
+-Java_java_net_TwoStacksPlainSocketImpl_socketSetOption(JNIEnv *env, jobject this,
++Java_java_net_TwoStacksPlainSocketImpl_socketNativeSetOption(JNIEnv *env,
++                                              jobject this,
+                                               jint cmd, jboolean on,
+                                               jobject value) {
+     int fd, fd1;
+diff --git a/src/windows/native/java/net/net_util_md.c b/src/windows/native/java/net/net_util_md.c
+--- jdk/src/windows/native/java/net/net_util_md.c
++++ jdk/src/windows/native/java/net/net_util_md.c
+@@ -415,12 +415,24 @@
+                int optlen)
+ {
+     int rv;
++    int parg;
++    int plen = sizeof(parg);
+ 
+     if (level == IPPROTO_IP && optname == IP_TOS) {
+         int *tos = (int *)optval;
+         *tos &= (IPTOS_TOS_MASK | IPTOS_PREC_MASK);
+     }
+ 
++    if (optname == SO_REUSEADDR) {
++        /*
++         * Do not set SO_REUSEADDE if SO_EXCLUSIVEADDUSE is already set
++         */
++        rv = NET_GetSockOpt(s, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, (char *)&parg, &plen);
++        if (rv == 0 && parg == 1) {
++            return rv;
++        }
++    }
++
+     rv = setsockopt(s, level, optname, optval, optlen);
+ 
+     if (rv == SOCKET_ERROR) {
+@@ -484,15 +496,32 @@
+ }
+ 
+ /*
++ * Sets SO_ECLUSIVEADDRUSE if SO_REUSEADDR is not already set.
++ */
++void setExclusiveBind(int fd) {
++    int parg;
++    int plen = sizeof(parg);
++    int rv = 0;
++    rv = NET_GetSockOpt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&parg, &plen);
++    if (rv == 0 && parg == 0) {
++        parg = 1;
++        rv = NET_SetSockOpt(fd, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, (char*)&parg, plen);
++    }
++}
++
++/*
+  * Wrapper for bind winsock call - transparent converts an
+  * error related to binding to a port that has exclusive access
+  * into an error indicating the port is in use (facilitates
+  * better error reporting).
++ *
++ * Should be only called by the wrapper method NET_WinBind
+  */
+ JNIEXPORT int JNICALL
+ NET_Bind(int s, struct sockaddr *him, int len)
+ {
+-    int rv = bind(s, him, len);
++    int rv;
++    rv = bind(s, him, len);
+ 
+     if (rv == SOCKET_ERROR) {
+         /*
+@@ -507,6 +536,18 @@
+     return rv;
+ }
+ 
++/*
++ * Wrapper for NET_Bind call. Sets SO_EXCLUSIVEADDRUSE
++ * if required, and then calls NET_BIND
++ */
++JNIEXPORT int JNICALL
++NET_WinBind(int s, struct sockaddr *him, int len, jboolean exclBind)
++{
++    if (exclBind == JNI_TRUE)
++        setExclusiveBind(s);
++    return NET_Bind(s, him, len);
++}
++
+ JNIEXPORT int JNICALL
+ NET_SocketClose(int fd) {
+     struct linger l;
+@@ -653,7 +694,7 @@
+  */
+ 
+ JNIEXPORT int JNICALL
+-NET_BindV6(struct ipv6bind* b) {
++NET_BindV6(struct ipv6bind* b, jboolean exclBind) {
+     int fd=-1, ofd=-1, rv, len;
+     /* need to defer close until new sockets created */
+     int close_fd=-1, close_ofd=-1;
+@@ -666,8 +707,8 @@
+     if (family == AF_INET && (b->addr->him4.sin_addr.s_addr != INADDR_ANY)) {
+         /* bind to v4 only */
+         int ret;
+-        ret = NET_Bind (b->ipv4_fd, (struct sockaddr *)b->addr,
+-                                sizeof (struct sockaddr_in));
++        ret = NET_WinBind (b->ipv4_fd, (struct sockaddr *)b->addr,
++                                sizeof (struct sockaddr_in), exclBind);
+         if (ret == SOCKET_ERROR) {
+             CLOSE_SOCKETS_AND_RETURN;
+         }
+@@ -678,8 +719,8 @@
+     if (family == AF_INET6 && (!IN6_IS_ADDR_ANY(&b->addr->him6.sin6_addr))) {
+         /* bind to v6 only */
+         int ret;
+-        ret = NET_Bind (b->ipv6_fd, (struct sockaddr *)b->addr,
+-                                sizeof (struct SOCKADDR_IN6));
++        ret = NET_WinBind (b->ipv6_fd, (struct sockaddr *)b->addr,
++                                sizeof (struct SOCKADDR_IN6), exclBind);
+         if (ret == SOCKET_ERROR) {
+             CLOSE_SOCKETS_AND_RETURN;
+         }
+@@ -708,7 +749,7 @@
+         oaddr.him4.sin_addr.s_addr = INADDR_ANY;
+     }
+ 
+-    rv = NET_Bind (fd, (struct sockaddr *)b->addr, SOCKETADDRESS_LEN(b->addr));
++    rv = NET_WinBind(fd, (struct sockaddr *)b->addr, SOCKETADDRESS_LEN(b->addr), exclBind);
+     if (rv == SOCKET_ERROR) {
+         CLOSE_SOCKETS_AND_RETURN;
+     }
+@@ -720,8 +761,8 @@
+     }
+     bound_port = GET_PORT (b->addr);
+     SET_PORT (&oaddr, bound_port);
+-    if ((rv=NET_Bind (ofd, (struct sockaddr *) &oaddr,
+-                                SOCKETADDRESS_LEN (&oaddr))) == SOCKET_ERROR) {
++    if ((rv=NET_WinBind (ofd, (struct sockaddr *) &oaddr,
++                         SOCKETADDRESS_LEN (&oaddr), exclBind)) == SOCKET_ERROR) {
+         int retries;
+         int sotype, arglen=sizeof(sotype);
+ 
+@@ -757,7 +798,8 @@
+ 
+             /* bind random port on first socket */
+             SET_PORT (&oaddr, 0);
+-            rv = NET_Bind (ofd, (struct sockaddr *)&oaddr, SOCKETADDRESS_LEN(&oaddr));
++            rv = NET_WinBind (ofd, (struct sockaddr *)&oaddr, SOCKETADDRESS_LEN(&oaddr),
++                              exclBind);
+             if (rv == SOCKET_ERROR) {
+                 CLOSE_SOCKETS_AND_RETURN;
+             }
+@@ -773,7 +815,8 @@
+             }
+             bound_port = GET_PORT (&oaddr);
+             SET_PORT (b->addr, bound_port);
+-            rv = NET_Bind (fd, (struct sockaddr *)b->addr, SOCKETADDRESS_LEN(b->addr));
++            rv = NET_WinBind (fd, (struct sockaddr *)b->addr, SOCKETADDRESS_LEN(b->addr),
++                              exclBind);
+ 
+             if (rv != SOCKET_ERROR) {
+                 if (family == AF_INET) {
+diff --git a/src/windows/native/java/net/net_util_md.h b/src/windows/native/java/net/net_util_md.h
+--- jdk/src/windows/native/java/net/net_util_md.h
++++ jdk/src/windows/native/java/net/net_util_md.h
+@@ -307,7 +307,7 @@
+  */
+ JNIEXPORT int JNICALL NET_Timeout2(int fd, int fd1, long timeout, int *fdret);
+ 
+-JNIEXPORT int JNICALL NET_BindV6(struct ipv6bind* b);
++JNIEXPORT int JNICALL NET_BindV6(struct ipv6bind* b, jboolean exclBind);
+ 
+ #define NET_WAIT_READ   0x01
+ #define NET_WAIT_WRITE  0x02
+@@ -315,6 +315,9 @@
+ 
+ extern jint NET_Wait(JNIEnv *env, jint fd, jint flags, jint timeout);
+ 
++JNIEXPORT int JNICALL NET_WinBind(int s, struct sockaddr *him, int len,
++                                   jboolean exclBind);
++
+ /* XP versions of the native routines */
+ 
+ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByName0_XP
+diff --git a/src/windows/native/sun/nio/ch/Net.c b/src/windows/native/sun/nio/ch/Net.c
+--- jdk/src/windows/native/sun/nio/ch/Net.c
++++ jdk/src/windows/native/sun/nio/ch/Net.c
+@@ -72,9 +72,20 @@
+     return (jint)s;
+ }
+ 
++JNIEXPORT jint JNICALL
++Java_sun_nio_ch_Net_isExclusiveBindAvailable(JNIEnv *env, jclass clazz) {
++    OSVERSIONINFO ver;
++    int version;
++    ver.dwOSVersionInfoSize = sizeof(ver);
++    GetVersionEx(&ver);
++    version = ver.dwMajorVersion * 10 + ver.dwMinorVersion;
++    //if os <= xp exclusive binding is off by default
++    return version >= 60 ? 1 : 0;
++}
++
+ JNIEXPORT void JNICALL
+-Java_sun_nio_ch_Net_bind(JNIEnv *env, jclass clazz,
+-                         jobject fdo, jobject iao, jint port)
++Java_sun_nio_ch_Net_bind0(JNIEnv *env, jclass clazz,
++                         jobject fdo, jboolean exclBind, jobject iao, jint port)
+ {
+     SOCKETADDRESS sa;
+     int rv;
+@@ -84,7 +95,7 @@
+       return;
+     }
+ 
+-    rv = NET_Bind(fdval(env, fdo), (struct sockaddr *)&sa, sa_len);
++    rv = NET_WinBind(fdval(env, fdo), (struct sockaddr *)&sa, sa_len, isExclBind);
+     if (rv == SOCKET_ERROR)
+         NET_ThrowNew(env, WSAGetLastError(), "bind");
+ }
+@@ -152,7 +163,6 @@
+     return iao;
+ }
+ 
+-
+ JNIEXPORT jint JNICALL
+ Java_sun_nio_ch_Net_getIntOption0(JNIEnv *env, jclass clazz,
+                                   jobject fdo, jint opt)

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8000638-improve_deserialization.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8000638-improve_deserialization.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8000638-improve_deserialization.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,26 @@
+# HG changeset patch
+# User dmocek
+# Date 1362436455 28800
+# Node ID b1c99cf6c26d9df7ca7d02df1687064656c8ae71
+# Parent  8664ebe88635d671ed0134e9348d5e6caea81d0d
+8000638: Improve deserialization
+Reviewed-by: smarks, hawtin, mchung
+
+diff --git a/src/share/classes/java/io/ObjectStreamClass.java b/src/share/classes/java/io/ObjectStreamClass.java
+--- jdk/src/share/classes/java/io/ObjectStreamClass.java
++++ jdk/src/share/classes/java/io/ObjectStreamClass.java
+@@ -1135,7 +1135,14 @@
+             end = end.getSuperclass();
+         }
+ 
++        HashSet<String> oscNames = new HashSet<>(3);
++
+         for (ObjectStreamClass d = this; d != null; d = d.superDesc) {
++            if (oscNames.contains(d.name)) {
++                throw new InvalidClassException("Circular reference.");
++            } else {
++                oscNames.add(d.name);
++            }
+ 
+             // search up inheritance hierarchy for class with matching name
+             String searchName = (d.cl != null) ? d.cl.getName() : d.name;

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8000642-better_transportation_handling.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8000642-better_transportation_handling.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8000642-better_transportation_handling.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,808 @@
+# HG changeset patch
+# User Severin Gehwolf <sgehwolf at redhat.com>
+# Date 1371488468 -7200
+# Node ID bec83758f55670cdb7865e8103f8100dc6f4f0fb
+# Parent  1260b4e54a2373aac77afdcdeb3f7ac8e6319c9e
+8000642: Better handling of objects for transportation
+Summary: Also reviewed by alexander.fomin
+Reviewed-by: alanb, mchung, skoivu
+
+diff --git a/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java b/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java
+--- corba/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java
++++ corba/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2012, 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
+@@ -33,6 +33,8 @@
+ 
+ import java.io.Serializable;
+ import java.math.BigDecimal;
++import java.security.AccessController;
++import java.security.PrivilegedAction;
+ import java.util.List ;
+ import java.util.ArrayList ;
+ 
+@@ -504,7 +506,12 @@
+     public org.omg.CORBA.portable.OutputStream create_output_stream()
+     {
+         //debug.log ("create_output_stream");
+-        return new AnyOutputStream(orb);
++        final ORB finalorb = this.orb;
++        return AccessController.doPrivileged(new PrivilegedAction<AnyOutputStream>() {
++            public AnyOutputStream run() {
++                return new AnyOutputStream(finalorb);
++            }
++        });
+     }
+ 
+     /**
+diff --git a/src/share/classes/com/sun/corba/se/impl/corba/TypeCodeImpl.java b/src/share/classes/com/sun/corba/se/impl/corba/TypeCodeImpl.java
+--- corba/src/share/classes/com/sun/corba/se/impl/corba/TypeCodeImpl.java
++++ corba/src/share/classes/com/sun/corba/se/impl/corba/TypeCodeImpl.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
+@@ -600,7 +600,8 @@
+     }
+ 
+     public static CDROutputStream newOutputStream(ORB orb) {
+-        TypeCodeOutputStream tcos = new TypeCodeOutputStream((ORB)orb);
++        TypeCodeOutputStream tcos =
++            sun.corba.OutputStreamFactory.newTypeCodeOutputStream(orb);
+         //if (debug) System.out.println("Created TypeCodeOutputStream " + tcos +
+         // " with no parent");
+         return tcos;
+diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/IDLJavaSerializationOutputStream.java b/src/share/classes/com/sun/corba/se/impl/encoding/IDLJavaSerializationOutputStream.java
+--- corba/src/share/classes/com/sun/corba/se/impl/encoding/IDLJavaSerializationOutputStream.java
++++ corba/src/share/classes/com/sun/corba/se/impl/encoding/IDLJavaSerializationOutputStream.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2004, 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
+@@ -66,7 +66,7 @@
+  *
+  * @author Ram Jeyaraman
+  */
+-public class IDLJavaSerializationOutputStream extends CDROutputStreamBase {
++final class IDLJavaSerializationOutputStream extends CDROutputStreamBase {
+ 
+     private ORB orb;
+     private byte encodingVersion;
+diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/TypeCodeOutputStream.java b/src/share/classes/com/sun/corba/se/impl/encoding/TypeCodeOutputStream.java
+--- corba/src/share/classes/com/sun/corba/se/impl/encoding/TypeCodeOutputStream.java
++++ corba/src/share/classes/com/sun/corba/se/impl/encoding/TypeCodeOutputStream.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2002, 2003, 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
+@@ -196,7 +196,8 @@
+     }
+ 
+     public TypeCodeOutputStream createEncapsulation(org.omg.CORBA.ORB _orb) {
+-        TypeCodeOutputStream encap = new TypeCodeOutputStream((ORB)_orb, isLittleEndian());
++        TypeCodeOutputStream encap =
++            sun.corba.OutputStreamFactory.newTypeCodeOutputStream((ORB)_orb, isLittleEndian());
+         encap.setEnclosingOutputStream(this);
+         encap.makeEncapsulation();
+         //if (TypeCodeImpl.debug) System.out.println("Created TypeCodeOutputStream " + encap + " with parent " + this);
+@@ -211,7 +212,8 @@
+ 
+     public static TypeCodeOutputStream wrapOutputStream(OutputStream os) {
+         boolean littleEndian = ((os instanceof CDROutputStream) ? ((CDROutputStream)os).isLittleEndian() : false);
+-        TypeCodeOutputStream tos = new TypeCodeOutputStream((ORB)os.orb(), littleEndian);
++        TypeCodeOutputStream tos =
++            sun.corba.OutputStreamFactory.newTypeCodeOutputStream((ORB)os.orb(), littleEndian);
+         tos.setEnclosingOutputStream(os);
+         //if (TypeCodeImpl.debug) System.out.println("Created TypeCodeOutputStream " + tos + " with parent " + os);
+         return tos;
+diff --git a/src/share/classes/com/sun/corba/se/impl/interceptors/CDREncapsCodec.java b/src/share/classes/com/sun/corba/se/impl/interceptors/CDREncapsCodec.java
+--- corba/src/share/classes/com/sun/corba/se/impl/interceptors/CDREncapsCodec.java
++++ corba/src/share/classes/com/sun/corba/se/impl/interceptors/CDREncapsCodec.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2000, 2003, 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
+@@ -155,7 +155,8 @@
+         // be versioned.  This can be handled once this work is complete.
+ 
+         // Create output stream with default endianness.
+-        EncapsOutputStream cdrOut = new EncapsOutputStream(
++        EncapsOutputStream cdrOut =
++            sun.corba.OutputStreamFactory.newEncapsOutputStream(
+             (com.sun.corba.se.spi.orb.ORB)orb, giopVersion );
+ 
+         // This is an encapsulation, so put out the endian:
+diff --git a/src/share/classes/com/sun/corba/se/impl/interceptors/RequestInfoImpl.java b/src/share/classes/com/sun/corba/se/impl/interceptors/RequestInfoImpl.java
+--- corba/src/share/classes/com/sun/corba/se/impl/interceptors/RequestInfoImpl.java
++++ corba/src/share/classes/com/sun/corba/se/impl/interceptors/RequestInfoImpl.java
+@@ -655,7 +655,8 @@
+             // Convert the "core" service context to an
+             // "IOP" ServiceContext by writing it to a
+             // CDROutputStream and reading it back.
+-            EncapsOutputStream out = new EncapsOutputStream(myORB);
++            EncapsOutputStream out =
++                sun.corba.OutputStreamFactory.newEncapsOutputStream(myORB);
+ 
+             context.write( out, GIOPVersion.V1_2 );
+             InputStream inputStream = out.create_input_stream();
+@@ -691,8 +692,8 @@
+     {
+         int id = 0 ;
+         // Convert IOP.service_context to core.ServiceContext:
+-        EncapsOutputStream outputStream = new EncapsOutputStream(
+-            myORB );
++        EncapsOutputStream outputStream =
++           sun.corba.OutputStreamFactory.newEncapsOutputStream(myORB);
+         InputStream inputStream = null;
+         UnknownServiceContext coreServiceContext = null;
+         ServiceContextHelper.write( outputStream, service_context );
+diff --git a/src/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java b/src/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java
+--- corba/src/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java
++++ corba/src/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java
+@@ -300,11 +300,11 @@
+         resetStream();
+     }
+ 
+-    public final void setOrbStream(org.omg.CORBA_2_3.portable.InputStream os) {
++    final void setOrbStream(org.omg.CORBA_2_3.portable.InputStream os) {
+         orbStream = os;
+     }
+ 
+-    public final org.omg.CORBA_2_3.portable.InputStream getOrbStream() {
++    final org.omg.CORBA_2_3.portable.InputStream getOrbStream() {
+         return orbStream;
+     }
+ 
+@@ -327,11 +327,11 @@
+         return (javax.rmi.CORBA.ValueHandler) vhandler;
+     }
+ 
+-    public final void increaseRecursionDepth(){
++    final void increaseRecursionDepth(){
+         recursionDepth++;
+     }
+ 
+-    public final int decreaseRecursionDepth(){
++    final int decreaseRecursionDepth(){
+         return --recursionDepth;
+     }
+ 
+diff --git a/src/share/classes/com/sun/corba/se/impl/io/IIOPOutputStream.java b/src/share/classes/com/sun/corba/se/impl/io/IIOPOutputStream.java
+--- corba/src/share/classes/com/sun/corba/se/impl/io/IIOPOutputStream.java
++++ corba/src/share/classes/com/sun/corba/se/impl/io/IIOPOutputStream.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -124,19 +124,19 @@
+         }
+     }
+ 
+-    public final void setOrbStream(org.omg.CORBA_2_3.portable.OutputStream os) {
++    final void setOrbStream(org.omg.CORBA_2_3.portable.OutputStream os) {
+         orbStream = os;
+     }
+ 
+-    public final org.omg.CORBA_2_3.portable.OutputStream getOrbStream() {
++    final org.omg.CORBA_2_3.portable.OutputStream getOrbStream() {
+         return orbStream;
+     }
+ 
+-    public final void increaseRecursionDepth(){
++    final void increaseRecursionDepth(){
+         recursionDepth++;
+     }
+ 
+-    public final int decreaseRecursionDepth(){
++    final int decreaseRecursionDepth(){
+         return --recursionDepth;
+     }
+ 
+diff --git a/src/share/classes/com/sun/corba/se/impl/io/InputStreamHook.java b/src/share/classes/com/sun/corba/se/impl/io/InputStreamHook.java
+--- corba/src/share/classes/com/sun/corba/se/impl/io/InputStreamHook.java
++++ corba/src/share/classes/com/sun/corba/se/impl/io/InputStreamHook.java
+@@ -251,7 +251,7 @@
+     }
+ 
+     protected abstract byte getStreamFormatVersion();
+-    protected abstract org.omg.CORBA_2_3.portable.InputStream getOrbStream();
++    abstract org.omg.CORBA_2_3.portable.InputStream getOrbStream();
+ 
+     // Description of possible actions
+     protected static class ReadObjectState {
+diff --git a/src/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java b/src/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java
+--- corba/src/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java
++++ corba/src/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java
+@@ -179,7 +179,7 @@
+         putFields.write(this);
+     }
+ 
+-    public abstract org.omg.CORBA_2_3.portable.OutputStream getOrbStream();
++    abstract org.omg.CORBA_2_3.portable.OutputStream getOrbStream();
+ 
+     protected abstract void beginOptionalCustomData();
+ 
+diff --git a/src/share/classes/com/sun/corba/se/impl/ior/EncapsulationUtility.java b/src/share/classes/com/sun/corba/se/impl/ior/EncapsulationUtility.java
+--- corba/src/share/classes/com/sun/corba/se/impl/ior/EncapsulationUtility.java
++++ corba/src/share/classes/com/sun/corba/se/impl/ior/EncapsulationUtility.java
+@@ -128,7 +128,8 @@
+     static public void writeEncapsulation( WriteContents obj,
+         OutputStream os )
+     {
+-        EncapsOutputStream out = new EncapsOutputStream( (ORB)os.orb() ) ;
++        EncapsOutputStream out =
++            sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)os.orb());
+ 
+         out.putEndian() ;
+ 
+diff --git a/src/share/classes/com/sun/corba/se/impl/ior/GenericTaggedProfile.java b/src/share/classes/com/sun/corba/se/impl/ior/GenericTaggedProfile.java
+--- corba/src/share/classes/com/sun/corba/se/impl/ior/GenericTaggedProfile.java
++++ corba/src/share/classes/com/sun/corba/se/impl/ior/GenericTaggedProfile.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2000, 2003, 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
+@@ -95,7 +95,8 @@
+ 
+     public org.omg.IOP.TaggedProfile getIOPProfile()
+     {
+-        EncapsOutputStream os = new EncapsOutputStream( orb ) ;
++        EncapsOutputStream os =
++            sun.corba.OutputStreamFactory.newEncapsOutputStream(orb);
+         write( os ) ;
+         InputStream is = (InputStream)(os.create_input_stream()) ;
+         return org.omg.IOP.TaggedProfileHelper.read( is ) ;
+diff --git a/src/share/classes/com/sun/corba/se/impl/ior/IORImpl.java b/src/share/classes/com/sun/corba/se/impl/ior/IORImpl.java
+--- corba/src/share/classes/com/sun/corba/se/impl/ior/IORImpl.java
++++ corba/src/share/classes/com/sun/corba/se/impl/ior/IORImpl.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2000, 2006, 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,8 @@
+     {
+         StringWriter bs;
+ 
+-        MarshalOutputStream s = new EncapsOutputStream(factory);
++        MarshalOutputStream s =
++            sun.corba.OutputStreamFactory.newEncapsOutputStream(factory);
+         s.putEndian();
+         write( (OutputStream)s );
+         bs = new StringWriter();
+@@ -237,7 +238,8 @@
+     }
+ 
+     public org.omg.IOP.IOR getIOPIOR() {
+-        EncapsOutputStream os = new EncapsOutputStream(factory);
++        EncapsOutputStream os =
++            sun.corba.OutputStreamFactory.newEncapsOutputStream(factory);
+         write(os);
+         InputStream is = (InputStream) (os.create_input_stream());
+         return org.omg.IOP.IORHelper.read(is);
+diff --git a/src/share/classes/com/sun/corba/se/impl/ior/ObjectKeyImpl.java b/src/share/classes/com/sun/corba/se/impl/ior/ObjectKeyImpl.java
+--- corba/src/share/classes/com/sun/corba/se/impl/ior/ObjectKeyImpl.java
++++ corba/src/share/classes/com/sun/corba/se/impl/ior/ObjectKeyImpl.java
+@@ -87,7 +87,8 @@
+ 
+     public byte[] getBytes( org.omg.CORBA.ORB orb )
+     {
+-        EncapsOutputStream os = new EncapsOutputStream( (ORB)orb ) ;
++        EncapsOutputStream os =
++            sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)orb);
+         write( os ) ;
+         return os.toByteArray() ;
+     }
+diff --git a/src/share/classes/com/sun/corba/se/impl/ior/TaggedComponentFactoryFinderImpl.java b/src/share/classes/com/sun/corba/se/impl/ior/TaggedComponentFactoryFinderImpl.java
+--- corba/src/share/classes/com/sun/corba/se/impl/ior/TaggedComponentFactoryFinderImpl.java
++++ corba/src/share/classes/com/sun/corba/se/impl/ior/TaggedComponentFactoryFinderImpl.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2000, 2003, 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
+@@ -61,7 +61,8 @@
+     public TaggedComponent create( org.omg.CORBA.ORB orb,
+         org.omg.IOP.TaggedComponent comp )
+     {
+-        EncapsOutputStream os = new EncapsOutputStream( (ORB)orb ) ;
++        EncapsOutputStream os =
++            sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)orb);
+         org.omg.IOP.TaggedComponentHelper.write( os, comp ) ;
+         InputStream is = (InputStream)(os.create_input_stream() ) ;
+         // Skip the component ID: we just wrote it out above
+diff --git a/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileImpl.java b/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileImpl.java
+--- corba/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileImpl.java
++++ corba/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileImpl.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2000, 2004, 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
+@@ -247,7 +247,8 @@
+ 
+     public org.omg.IOP.TaggedProfile getIOPProfile()
+     {
+-        EncapsOutputStream os = new EncapsOutputStream( orb ) ;
++        EncapsOutputStream os =
++            sun.corba.OutputStreamFactory.newEncapsOutputStream(orb);
+         os.write_long( getId() ) ;
+         write( os ) ;
+         InputStream is = (InputStream)(os.create_input_stream()) ;
+diff --git a/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileTemplateImpl.java b/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileTemplateImpl.java
+--- corba/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileTemplateImpl.java
++++ corba/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileTemplateImpl.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2000, 2003, 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
+@@ -132,8 +132,9 @@
+         // Note that this cannot be accomplished with a codec!
+ 
+         // Use the byte order of the given stream
+-        OutputStream encapsulatedOS = new EncapsOutputStream( (ORB)os.orb(),
+-            ((CDROutputStream)os).isLittleEndian() ) ;
++        OutputStream encapsulatedOS =
++            sun.corba.OutputStreamFactory.newEncapsOutputStream(
++                (ORB)os.orb(), ((CDROutputStream)os).isLittleEndian() ) ;
+ 
+         okeyTemplate.write( id, encapsulatedOS ) ;
+         EncapsulationUtility.writeOutputStream( encapsulatedOS, os ) ;
+diff --git a/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java b/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java
+--- corba/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java
++++ corba/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java
+@@ -564,7 +564,7 @@
+     public synchronized org.omg.CORBA.portable.OutputStream create_output_stream()
+     {
+         checkShutdownState();
+-        return new EncapsOutputStream(this);
++        return sun.corba.OutputStreamFactory.newEncapsOutputStream(this);
+     }
+ 
+     /**
+diff --git a/src/share/classes/com/sun/corba/se/impl/orb/ORBSingleton.java b/src/share/classes/com/sun/corba/se/impl/orb/ORBSingleton.java
+--- corba/src/share/classes/com/sun/corba/se/impl/orb/ORBSingleton.java
++++ corba/src/share/classes/com/sun/corba/se/impl/orb/ORBSingleton.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 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
+@@ -149,7 +149,7 @@
+     }
+ 
+     public OutputStream create_output_stream() {
+-        return new EncapsOutputStream(this);
++        return sun.corba.OutputStreamFactory.newEncapsOutputStream(this);
+     }
+ 
+     public TypeCode create_struct_tc(String id,
+diff --git a/src/share/classes/com/sun/corba/se/impl/protocol/CorbaMessageMediatorImpl.java b/src/share/classes/com/sun/corba/se/impl/protocol/CorbaMessageMediatorImpl.java
+--- corba/src/share/classes/com/sun/corba/se/impl/protocol/CorbaMessageMediatorImpl.java
++++ corba/src/share/classes/com/sun/corba/se/impl/protocol/CorbaMessageMediatorImpl.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2001, 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
+@@ -1792,8 +1792,7 @@
+ 
+         if (msg.getGIOPVersion().lessThan(GIOPVersion.V1_2)) {
+             // locate msgs 1.0 & 1.1 :=> grow,
+-            // REVISIT - build from factory
+-            outputObject = new CDROutputObject(
++            outputObject = sun.corba.OutputStreamFactory.newCDROutputObject(
+                              (ORB) messageMediator.getBroker(),
+                              this,
+                              GIOPVersion.V1_0,
+@@ -1802,8 +1801,7 @@
+                              ORBConstants.STREAM_FORMAT_VERSION_1);
+         } else {
+             // 1.2 :=> stream
+-            // REVISIT - build from factory
+-            outputObject = new CDROutputObject(
++            outputObject = sun.corba.OutputStreamFactory.newCDROutputObject(
+                              (ORB) messageMediator.getBroker(),
+                              messageMediator,
+                              reply,
+@@ -1957,7 +1955,8 @@
+                           ReplyMessage.NEEDS_ADDRESSING_MODE,
+                           null, null);
+             // REVISIT: via acceptor factory.
+-            CDROutputObject outputObject = new CDROutputObject(
++            CDROutputObject outputObject =
++                sun.corba.OutputStreamFactory.newCDROutputObject(
+                 (ORB)messageMediator.getBroker(),
+                 this,
+                 messageMediator.getGIOPVersion(),
+@@ -2124,7 +2123,7 @@
+         ex.printStackTrace(pw);
+         pw.flush(); // NOTE: you must flush or baos will be empty.
+         EncapsOutputStream encapsOutputStream =
+-            new EncapsOutputStream((ORB)mediator.getBroker());
++            sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)mediator.getBroker());
+         encapsOutputStream.putEndian();
+         encapsOutputStream.write_wstring(baos.toString());
+         UnknownServiceContext serviceContext =
+@@ -2201,12 +2200,11 @@
+         // REVISIT = do not use null.
+         //
+         if (messageMediator.getConnection() == null) {
+-            // REVISIT - needs factory
+             replyOutputObject =
+-                new CDROutputObject(orb, messageMediator,
+-                                    messageMediator.getReplyHeader(),
+-                                    messageMediator.getStreamFormatVersion(),
+-                                    BufferManagerFactory.GROW);
++                sun.corba.OutputStreamFactory.newCDROutputObject(orb,
++                            messageMediator, messageMediator.getReplyHeader(),
++                            messageMediator.getStreamFormatVersion(),
++                            BufferManagerFactory.GROW);
+         } else {
+             replyOutputObject = messageMediator.getConnection().getAcceptor()
+              .createOutputObject(messageMediator.getBroker(), messageMediator);
+diff --git a/src/share/classes/com/sun/corba/se/impl/transport/CorbaContactInfoBase.java b/src/share/classes/com/sun/corba/se/impl/transport/CorbaContactInfoBase.java
+--- corba/src/share/classes/com/sun/corba/se/impl/transport/CorbaContactInfoBase.java
++++ corba/src/share/classes/com/sun/corba/se/impl/transport/CorbaContactInfoBase.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -214,7 +214,7 @@
+             messageMediator;
+ 
+         OutputObject outputObject =
+-            new CDROutputObject(orb, messageMediator,
++            sun.corba.OutputStreamFactory.newCDROutputObject(orb, messageMediator,
+                                 corbaMessageMediator.getRequestHeader(),
+                                 corbaMessageMediator.getStreamFormatVersion());
+ 
+diff --git a/src/share/classes/com/sun/corba/se/impl/transport/SharedCDRContactInfoImpl.java b/src/share/classes/com/sun/corba/se/impl/transport/SharedCDRContactInfoImpl.java
+--- corba/src/share/classes/com/sun/corba/se/impl/transport/SharedCDRContactInfoImpl.java
++++ corba/src/share/classes/com/sun/corba/se/impl/transport/SharedCDRContactInfoImpl.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -134,7 +134,7 @@
+             messageMediator;
+         // NOTE: GROW.
+         OutputObject outputObject =
+-            new CDROutputObject(orb, messageMediator,
++            sun.corba.OutputStreamFactory.newCDROutputObject(orb, messageMediator,
+                                 corbaMessageMediator.getRequestHeader(),
+                                 corbaMessageMediator.getStreamFormatVersion(),
+                                 BufferManagerFactory.GROW);
+diff --git a/src/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelAcceptorImpl.java b/src/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelAcceptorImpl.java
+--- corba/src/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelAcceptorImpl.java
++++ corba/src/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelAcceptorImpl.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2001, 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
+@@ -534,9 +534,9 @@
+     {
+         CorbaMessageMediator corbaMessageMediator = (CorbaMessageMediator)
+             messageMediator;
+-        return new CDROutputObject((ORB) broker, corbaMessageMediator,
+-                                   corbaMessageMediator.getReplyHeader(),
+-                                   corbaMessageMediator.getStreamFormatVersion());
++        return sun.corba.OutputStreamFactory.newCDROutputObject((ORB) broker,
++                       corbaMessageMediator, corbaMessageMediator.getReplyHeader(),
++                       corbaMessageMediator.getStreamFormatVersion());
+     }
+ 
+     ////////////////////////////////////////////////////
+diff --git a/src/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelConnectionImpl.java b/src/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelConnectionImpl.java
+--- corba/src/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelConnectionImpl.java
++++ corba/src/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelConnectionImpl.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2001, 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2001, 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
+@@ -1565,8 +1565,8 @@
+     {
+         // REVISIT: See comments in CDROutputObject constructor.
+         CDROutputObject outputObject =
+-            new CDROutputObject((ORB)orb, null, giopVersion, this, msg,
+-                                ORBConstants.STREAM_FORMAT_VERSION_1);
++            sun.corba.OutputStreamFactory.newCDROutputObject((ORB)orb, null, giopVersion,
++                                this, msg, ORBConstants.STREAM_FORMAT_VERSION_1);
+         msg.write(outputObject);
+ 
+         outputObject.writeTo(this);
+diff --git a/src/share/classes/com/sun/corba/se/spi/ior/TaggedComponentBase.java b/src/share/classes/com/sun/corba/se/spi/ior/TaggedComponentBase.java
+--- corba/src/share/classes/com/sun/corba/se/spi/ior/TaggedComponentBase.java
++++ corba/src/share/classes/com/sun/corba/se/spi/ior/TaggedComponentBase.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2000, 2003, 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
+@@ -42,7 +42,8 @@
+     public org.omg.IOP.TaggedComponent getIOPComponent(
+         org.omg.CORBA.ORB orb )
+     {
+-        EncapsOutputStream os = new EncapsOutputStream( (ORB)orb ) ;
++        EncapsOutputStream os =
++            sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)orb);
+         write( os ) ;
+         InputStream is = (InputStream)(os.create_input_stream() ) ;
+         return org.omg.IOP.TaggedComponentHelper.read( is ) ;
+diff --git a/src/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContext.java b/src/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContext.java
+--- corba/src/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContext.java
++++ corba/src/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContext.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -92,7 +92,8 @@
+      */
+     public void write(OutputStream s, GIOPVersion gv) throws SystemException
+     {
+-        EncapsOutputStream os = new EncapsOutputStream( (ORB)(s.orb()), gv ) ;
++        EncapsOutputStream os =
++            sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)(s.orb()), gv);
+         os.putEndian() ;
+         writeData( os ) ;
+         byte[] data = os.toByteArray() ;
+diff --git a/src/share/classes/org/omg/CORBA_2_3/portable/OutputStream.java b/src/share/classes/org/omg/CORBA_2_3/portable/OutputStream.java
+--- corba/src/share/classes/org/omg/CORBA_2_3/portable/OutputStream.java
++++ corba/src/share/classes/org/omg/CORBA_2_3/portable/OutputStream.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -31,6 +31,10 @@
+ 
+ package org.omg.CORBA_2_3.portable;
+ 
++import java.io.SerializablePermission;
++import java.security.AccessController;
++import java.security.PrivilegedAction;
++
+ /**
+  * OutputStream provides interface for writing of all of the mapped IDL type
+  * to the stream. It extends org.omg.CORBA.portable.OutputStream, and defines
+@@ -43,6 +47,39 @@
+ 
+ public abstract class OutputStream extends org.omg.CORBA.portable.OutputStream {
+ 
++    private static final String ALLOW_SUBCLASS_PROP = "jdk.corba.allowOutputStreamSubclass";
++    private static final boolean allowSubclass = AccessController.doPrivileged(
++        new PrivilegedAction<Boolean>() {
++            public Boolean run() {
++            String prop = System.getProperty(ALLOW_SUBCLASS_PROP);
++                return prop == null ? false :
++                           (prop.equalsIgnoreCase("false") ? false : true);
++            }
++        });
++
++    private static Void checkPermission() {
++        SecurityManager sm = System.getSecurityManager();
++        if (sm != null) {
++            if (!allowSubclass)
++                sm.checkPermission(new
++                    SerializablePermission("enableSubclassImplementation"));
++        }
++        return null;
++    }
++    private OutputStream(Void ignore) { }
++
++    /**
++     * Create a new instance of this class.
++     *
++     * throw SecurityException if SecurityManager is installed and
++     * enableSubclassImplementation SerializablePermission
++     * is not granted or jdk.corba.allowOutputStreamSubclass system
++     * property is either not set or is set to 'false'
++     */
++    public OutputStream() {
++        this(checkPermission());
++    }
++
+     /**
+      * Marshals a value type to the output stream.
+      * @param value is the acutal value to write
+diff --git a/src/share/classes/sun/corba/OutputStreamFactory.java b/src/share/classes/sun/corba/OutputStreamFactory.java
+new file mode 100644
+--- /dev/null
++++ corba/src/share/classes/sun/corba/OutputStreamFactory.java
+@@ -0,0 +1,141 @@
++/*
++ * 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 sun.corba;
++
++import com.sun.corba.se.impl.corba.AnyImpl;
++import com.sun.corba.se.impl.encoding.BufferManagerWrite;
++import com.sun.corba.se.impl.encoding.CDROutputObject;
++import com.sun.corba.se.impl.encoding.EncapsOutputStream;
++import com.sun.corba.se.impl.encoding.TypeCodeOutputStream;
++import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
++
++import com.sun.corba.se.pept.protocol.MessageMediator;
++
++import com.sun.corba.se.spi.orb.ORB;
++import com.sun.corba.se.spi.transport.CorbaConnection;
++import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
++import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
++
++import java.security.AccessController;
++import java.security.PrivilegedAction;
++
++public final class OutputStreamFactory {
++
++    private OutputStreamFactory() {
++    }
++
++    public static TypeCodeOutputStream newTypeCodeOutputStream(
++            final ORB orb) {
++        return AccessController.doPrivileged(
++            new PrivilegedAction<TypeCodeOutputStream>() {
++                public TypeCodeOutputStream run() {
++                    return new TypeCodeOutputStream(orb);
++                }
++        });
++    }
++
++    public static TypeCodeOutputStream newTypeCodeOutputStream(
++            final ORB orb, final boolean littleEndian) {
++        return AccessController.doPrivileged(
++            new PrivilegedAction<TypeCodeOutputStream>() {
++                public TypeCodeOutputStream run() {
++                    return new TypeCodeOutputStream(orb, littleEndian);
++                }
++        });
++    }
++
++    public static EncapsOutputStream newEncapsOutputStream(
++            final ORB orb) {
++        return AccessController.doPrivileged(
++            new PrivilegedAction<EncapsOutputStream>() {
++                public EncapsOutputStream run() {
++                    return new EncapsOutputStream(
++                        (com.sun.corba.se.spi.orb.ORB)orb);
++                }
++        });
++    }
++
++    public static EncapsOutputStream newEncapsOutputStream(
++            final ORB orb, final GIOPVersion giopVersion) {
++        return AccessController.doPrivileged(
++            new PrivilegedAction<EncapsOutputStream>() {
++                public EncapsOutputStream run() {
++                    return new EncapsOutputStream(
++                        (com.sun.corba.se.spi.orb.ORB)orb, giopVersion);
++                }
++        });
++    }
++
++    public static EncapsOutputStream newEncapsOutputStream(
++            final ORB orb, final boolean isLittleEndian) {
++        return AccessController.doPrivileged(
++            new PrivilegedAction<EncapsOutputStream>() {
++                public EncapsOutputStream run() {
++                    return new EncapsOutputStream(
++                        (com.sun.corba.se.spi.orb.ORB)orb, isLittleEndian);
++                }
++        });
++    }
++
++    public static CDROutputObject newCDROutputObject(
++            final ORB orb, final MessageMediator messageMediator,
++            final Message header, final byte streamFormatVersion) {
++        return AccessController.doPrivileged(
++            new PrivilegedAction<CDROutputObject>() {
++                public CDROutputObject run() {
++                    return new CDROutputObject(orb, messageMediator,
++                        header, streamFormatVersion);
++                }
++        });
++    }
++
++    public static CDROutputObject newCDROutputObject(
++            final ORB orb, final MessageMediator messageMediator,
++            final Message header, final byte streamFormatVersion,
++            final int strategy) {
++        return AccessController.doPrivileged(
++            new PrivilegedAction<CDROutputObject>() {
++                public CDROutputObject run() {
++                    return new CDROutputObject(orb, messageMediator,
++                        header, streamFormatVersion, strategy);
++                }
++        });
++    }
++
++    public static CDROutputObject newCDROutputObject(
++            final ORB orb, final CorbaMessageMediator mediator,
++            final GIOPVersion giopVersion, final CorbaConnection connection,
++            final Message header, final byte streamFormatVersion) {
++        return AccessController.doPrivileged(
++            new PrivilegedAction<CDROutputObject>() {
++                public CDROutputObject run() {
++                    return new CDROutputObject(orb, mediator,
++                        giopVersion, connection, header, streamFormatVersion);
++                }
++        });
++    }
++
++}

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8001032-restrict_object_access-corba.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8001032-restrict_object_access-corba.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8001032-restrict_object_access-corba.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,544 @@
+# HG changeset patch
+# User Severin Gehwolf <sgehwolf at redhat.com>
+# Date 1371473490 -7200
+# Node ID 7a0a1f984e7fdd43bd9502b6f77ae890d158ccd1
+# Parent  bec83758f55670cdb7865e8103f8100dc6f4f0fb
+8001032: Restrict object access
+Summary: Restrict object access; fix reviewed also by Alexander Fomin
+Reviewed-by: alanb, ahgross
+
+diff --git a/make/com/sun/corba/minclude/com_sun_corba_se_impl_orbutil.jmk b/make/com/sun/corba/minclude/com_sun_corba_se_impl_orbutil.jmk
+--- corba/make/com/sun/corba/minclude/com_sun_corba_se_impl_orbutil.jmk
++++ corba/make/com/sun/corba/minclude/com_sun_corba_se_impl_orbutil.jmk
+@@ -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
+@@ -39,7 +39,6 @@
+ 	com/sun/corba/se/impl/orbutil/ObjectStreamClassUtil_1_3.java \
+ 	com/sun/corba/se/impl/orbutil/ORBConstants.java \
+ 	com/sun/corba/se/impl/orbutil/ORBUtility.java \
+-	com/sun/corba/se/impl/orbutil/ORBClassLoader.java \
+ 	com/sun/corba/se/impl/orbutil/RepIdDelegator.java \
+ 	com/sun/corba/se/impl/orbutil/RepositoryIdFactory.java \
+ 	com/sun/corba/se/impl/orbutil/RepositoryIdStrings.java \
+diff --git a/src/share/classes/com/sun/corba/se/impl/activation/ServerManagerImpl.java b/src/share/classes/com/sun/corba/se/impl/activation/ServerManagerImpl.java
+--- corba/src/share/classes/com/sun/corba/se/impl/activation/ServerManagerImpl.java
++++ corba/src/share/classes/com/sun/corba/se/impl/activation/ServerManagerImpl.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2004, 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
+@@ -81,7 +81,6 @@
+ 
+ import com.sun.corba.se.impl.oa.poa.BadServerIdHandler;
+ import com.sun.corba.se.impl.orbutil.ORBConstants;
+-import com.sun.corba.se.impl.orbutil.ORBClassLoader;
+ import com.sun.corba.se.impl.orbutil.ORBUtility;
+ import com.sun.corba.se.impl.util.Utility;
+ 
+diff --git a/src/share/classes/com/sun/corba/se/impl/interceptors/PIHandlerImpl.java b/src/share/classes/com/sun/corba/se/impl/interceptors/PIHandlerImpl.java
+--- corba/src/share/classes/com/sun/corba/se/impl/interceptors/PIHandlerImpl.java
++++ corba/src/share/classes/com/sun/corba/se/impl/interceptors/PIHandlerImpl.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2002, 2003, 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
+@@ -76,7 +76,6 @@
+ import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+ import com.sun.corba.se.impl.logging.OMGSystemException;
+ import com.sun.corba.se.impl.corba.RequestImpl;
+-import com.sun.corba.se.impl.orbutil.ORBClassLoader;
+ import com.sun.corba.se.impl.orbutil.ORBConstants;
+ import com.sun.corba.se.impl.orbutil.ORBUtility;
+ import com.sun.corba.se.impl.orbutil.StackImpl;
+diff --git a/src/share/classes/com/sun/corba/se/impl/interceptors/RequestInfoImpl.java b/src/share/classes/com/sun/corba/se/impl/interceptors/RequestInfoImpl.java
+--- corba/src/share/classes/com/sun/corba/se/impl/interceptors/RequestInfoImpl.java
++++ corba/src/share/classes/com/sun/corba/se/impl/interceptors/RequestInfoImpl.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2000, 2004, 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
+@@ -86,13 +86,14 @@
+ import com.sun.corba.se.impl.encoding.EncapsOutputStream;
+ 
+ import com.sun.corba.se.impl.orbutil.ORBUtility;
+-import com.sun.corba.se.impl.orbutil.ORBClassLoader;
+ 
+ import com.sun.corba.se.impl.util.RepositoryId;
+ 
+ import com.sun.corba.se.impl.logging.InterceptorsSystemException;
+ import com.sun.corba.se.impl.logging.OMGSystemException;
+ 
++import sun.corba.SharedSecrets;
++
+ /**
+  * Implementation of the RequestInfo interface as specified in
+  * orbos/99-12-02 section 5.4.1.
+@@ -451,7 +452,8 @@
+ 
+             // Find the read method on the helper class:
+             String helperClassName = className + "Helper";
+-            Class helperClass = ORBClassLoader.loadClass( helperClassName );
++            Class<?> helperClass =
++                SharedSecrets.getJavaCorbaAccess().loadClass( helperClassName );
+             Class[] readParams = new Class[1];
+             readParams[0] = org.omg.CORBA.portable.InputStream.class;
+             Method readMethod = helperClass.getMethod( "read", readParams );
+@@ -511,7 +513,8 @@
+                 Class exceptionClass = userException.getClass();
+                 String className = exceptionClass.getName();
+                 String helperClassName = className + "Helper";
+-                Class helperClass = ORBClassLoader.loadClass( helperClassName );
++                Class<?> helperClass =
++                    SharedSecrets.getJavaCorbaAccess().loadClass( helperClassName );
+ 
+                 // Find insert( Any, class ) method
+                 Class[] insertMethodParams = new Class[2];
+diff --git a/src/share/classes/com/sun/corba/se/impl/io/ValueUtility.java b/src/share/classes/com/sun/corba/se/impl/io/ValueUtility.java
+--- corba/src/share/classes/com/sun/corba/se/impl/io/ValueUtility.java
++++ corba/src/share/classes/com/sun/corba/se/impl/io/ValueUtility.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1999, 2012, 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
+@@ -98,6 +98,14 @@
+             public ValueHandlerImpl newValueHandlerImpl() {
+                 return ValueHandlerImpl.getInstance();
+             }
++            public Class<?> loadClass(String className) throws ClassNotFoundException {
++                if (Thread.currentThread().getContextClassLoader() != null) {
++                    return Thread.currentThread().getContextClassLoader().
++                        loadClass(className);
++                } else {
++                    return ClassLoader.getSystemClassLoader().loadClass(className);
++                }
++            }
+         });
+     }
+ 
+diff --git a/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java b/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java
+--- corba/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java
++++ corba/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1999, 2012, 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
+@@ -109,12 +109,9 @@
+ import com.sun.corba.se.impl.util.Utility;
+ import com.sun.corba.se.impl.util.IdentityHashtable;
+ import com.sun.corba.se.impl.util.JDKBridge;
+-import com.sun.corba.se.impl.orbutil.ORBClassLoader;
+ import com.sun.corba.se.impl.logging.UtilSystemException;
+ import com.sun.corba.se.spi.logging.CORBALogDomains;
+ import sun.corba.SharedSecrets;
+-import sun.corba.JavaCorbaAccess;
+-
+ 
+ /**
+  * Provides utility methods that can be used by stubs and ties to
+@@ -263,7 +260,7 @@
+             return new MarshalException(message,inner);
+         } else if (ex instanceof ACTIVITY_REQUIRED) {
+             try {
+-                Class cl = ORBClassLoader.loadClass(
++                Class<?> cl = SharedSecrets.getJavaCorbaAccess().loadClass(
+                                "javax.activity.ActivityRequiredException");
+                 Class[] params = new Class[2];
+                 params[0] = java.lang.String.class;
+@@ -279,7 +276,7 @@
+             }
+         } else if (ex instanceof ACTIVITY_COMPLETED) {
+             try {
+-                Class cl = ORBClassLoader.loadClass(
++                Class<?> cl = SharedSecrets.getJavaCorbaAccess().loadClass(
+                                "javax.activity.ActivityCompletedException");
+                 Class[] params = new Class[2];
+                 params[0] = java.lang.String.class;
+@@ -295,7 +292,7 @@
+               }
+         } else if (ex instanceof INVALID_ACTIVITY) {
+             try {
+-                Class cl = ORBClassLoader.loadClass(
++                Class<?> cl = SharedSecrets.getJavaCorbaAccess().loadClass(
+                                "javax.activity.InvalidActivityException");
+                 Class[] params = new Class[2];
+                 params[0] = java.lang.String.class;
+diff --git a/src/share/classes/com/sun/corba/se/impl/orb/ORBDataParserImpl.java b/src/share/classes/com/sun/corba/se/impl/orb/ORBDataParserImpl.java
+--- corba/src/share/classes/com/sun/corba/se/impl/orb/ORBDataParserImpl.java
++++ corba/src/share/classes/com/sun/corba/se/impl/orb/ORBDataParserImpl.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2002, 2004, 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
+@@ -48,7 +48,6 @@
+ 
+ import com.sun.corba.se.impl.encoding.CodeSetComponentInfo ;
+ import com.sun.corba.se.impl.legacy.connection.USLPort;
+-import com.sun.corba.se.impl.orbutil.ORBClassLoader ;
+ import com.sun.corba.se.impl.orbutil.ORBConstants ;
+ import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+ 
+diff --git a/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java b/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java
+--- corba/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java
++++ corba/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.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
+@@ -149,7 +149,6 @@
+ import com.sun.corba.se.impl.oa.poa.BadServerIdHandler;
+ import com.sun.corba.se.impl.oa.poa.DelegateImpl;
+ import com.sun.corba.se.impl.oa.poa.POAFactory;
+-import com.sun.corba.se.impl.orbutil.ORBClassLoader;
+ import com.sun.corba.se.impl.orbutil.ORBConstants;
+ import com.sun.corba.se.impl.orbutil.ORBUtility;
+ import com.sun.corba.se.impl.orbutil.StackImpl;
+diff --git a/src/share/classes/com/sun/corba/se/impl/orb/ParserTable.java b/src/share/classes/com/sun/corba/se/impl/orb/ParserTable.java
+--- corba/src/share/classes/com/sun/corba/se/impl/orb/ParserTable.java
++++ corba/src/share/classes/com/sun/corba/se/impl/orb/ParserTable.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2002, 2012, 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
+@@ -78,7 +78,6 @@
+ import com.sun.corba.se.impl.legacy.connection.USLPort ;
+ import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+ import com.sun.corba.se.impl.oa.poa.BadServerIdHandler ;
+-import com.sun.corba.se.impl.orbutil.ORBClassLoader ;
+ import com.sun.corba.se.impl.orbutil.ORBConstants ;
+ import com.sun.corba.se.impl.protocol.giopmsgheaders.KeyAddr ;
+ import com.sun.corba.se.impl.protocol.giopmsgheaders.ProfileAddr ;
+@@ -86,6 +85,8 @@
+ import com.sun.corba.se.impl.transport.DefaultIORToSocketInfoImpl;
+ import com.sun.corba.se.impl.transport.DefaultSocketFactoryImpl;
+ 
++import sun.corba.SharedSecrets;
++
+ /** Initialize the parser data for the standard ORB parser.  This is used both
+  * to implement ORBDataParserImpl and to provide the basic testing framework
+  * for ORBDataParserImpl.
+@@ -640,8 +641,8 @@
+                 String param = (String)value ;
+ 
+                 try {
+-                    Class legacySocketFactoryClass =
+-                        ORBClassLoader.loadClass(param);
++                    Class<?> legacySocketFactoryClass =
++                        SharedSecrets.getJavaCorbaAccess().loadClass(param);
+                     // For security reasons avoid creating an instance if
+                     // this socket factory class is not one that would fail
+                     // the class cast anyway.
+@@ -670,7 +671,8 @@
+                 String param = (String)value ;
+ 
+                 try {
+-                    Class socketFactoryClass = ORBClassLoader.loadClass(param);
++                    Class<?> socketFactoryClass =
++                        SharedSecrets.getJavaCorbaAccess().loadClass(param);
+                     // For security reasons avoid creating an instance if
+                     // this socket factory class is not one that would fail
+                     // the class cast anyway.
+@@ -699,7 +701,8 @@
+                 String param = (String)value ;
+ 
+                 try {
+-                    Class iorToSocketInfoClass = ORBClassLoader.loadClass(param);
++                    Class<?> iorToSocketInfoClass =
++                        SharedSecrets.getJavaCorbaAccess().loadClass(param);
+                     // For security reasons avoid creating an instance if
+                     // this socket factory class is not one that would fail
+                     // the class cast anyway.
+@@ -728,7 +731,8 @@
+                 String param = (String)value ;
+ 
+                 try {
+-                    Class iiopPrimaryToContactInfoClass = ORBClassLoader.loadClass(param);
++                    Class<?> iiopPrimaryToContactInfoClass =
++                        SharedSecrets.getJavaCorbaAccess().loadClass(param);
+                     // For security reasons avoid creating an instance if
+                     // this socket factory class is not one that would fail
+                     // the class cast anyway.
+@@ -757,8 +761,8 @@
+                 String param = (String)value ;
+ 
+                 try {
+-                    Class contactInfoListFactoryClass =
+-                        ORBClassLoader.loadClass(param);
++                    Class<?> contactInfoListFactoryClass =
++                        SharedSecrets.getJavaCorbaAccess().loadClass(param);
+                     // For security reasons avoid creating an instance if
+                     // this socket factory class is not one that would fail
+                     // the class cast anyway.
+diff --git a/src/share/classes/com/sun/corba/se/impl/orbutil/ORBClassLoader.java b/src/share/classes/com/sun/corba/se/impl/orbutil/ORBClassLoader.java
+deleted file mode 100644
+--- corba/src/share/classes/com/sun/corba/se/impl/orbutil/ORBClassLoader.java
++++ /dev/null
+@@ -1,47 +0,0 @@
+-/*
+- * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
+- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+- *
+- * This code is free software; you can redistribute 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.corba.se.impl.orbutil;
+-
+-/**
+- * Based on feedback from bug report 4452016, all class loading
+- * in the ORB is isolated here.  It is acceptable to use
+- * Class.forName only when one is certain that the desired class
+- * should come from the core JDK.
+- */
+-public class ORBClassLoader
+-{
+-    public static Class loadClass(String className)
+-        throws ClassNotFoundException
+-    {
+-        return ORBClassLoader.getClassLoader().loadClass(className);
+-    }
+-
+-    public static ClassLoader getClassLoader() {
+-        if (Thread.currentThread().getContextClassLoader() != null)
+-            return Thread.currentThread().getContextClassLoader();
+-        else
+-            return ClassLoader.getSystemClassLoader();
+-    }
+-}
+diff --git a/src/share/classes/com/sun/corba/se/impl/orbutil/ORBUtility.java b/src/share/classes/com/sun/corba/se/impl/orbutil/ORBUtility.java
+--- corba/src/share/classes/com/sun/corba/se/impl/orbutil/ORBUtility.java
++++ corba/src/share/classes/com/sun/corba/se/impl/orbutil/ORBUtility.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
+@@ -90,6 +90,8 @@
+ import com.sun.corba.se.impl.logging.OMGSystemException ;
+ import com.sun.corba.se.impl.ior.iiop.JavaSerializationComponent;
+ 
++import sun.corba.SharedSecrets;
++
+ /**
+  *  Handy class full of static functions that don't belong in util.Utility for pure ORB reasons.
+  */
+@@ -262,8 +264,8 @@
+     {
+         try {
+             String name = classNameOf(strm.read_string());
+-            SystemException ex
+-                = (SystemException)ORBClassLoader.loadClass(name).newInstance();
++            SystemException ex = (SystemException)SharedSecrets.
++                getJavaCorbaAccess().loadClass(name).newInstance();
+             ex.minor = strm.read_long();
+             ex.completed = CompletionStatus.from_int(strm.read_long());
+             return ex;
+diff --git a/src/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyMessage_1_2.java b/src/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyMessage_1_2.java
+--- corba/src/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyMessage_1_2.java
++++ corba/src/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyMessage_1_2.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2000, 2003, 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
+@@ -41,7 +41,6 @@
+ 
+ import com.sun.corba.se.impl.orbutil.ORBUtility;
+ import com.sun.corba.se.impl.orbutil.ORBConstants;
+-import com.sun.corba.se.impl.orbutil.ORBClassLoader;
+ 
+ import com.sun.corba.se.spi.logging.CORBALogDomains ;
+ import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+diff --git a/src/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/MessageBase.java b/src/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/MessageBase.java
+--- corba/src/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/MessageBase.java
++++ corba/src/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/MessageBase.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2000, 2004, 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
+@@ -60,9 +60,10 @@
+ import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+ import com.sun.corba.se.impl.orbutil.ORBUtility;
+ import com.sun.corba.se.impl.orbutil.ORBConstants;
+-import com.sun.corba.se.impl.orbutil.ORBClassLoader;
+ import com.sun.corba.se.impl.protocol.AddressingDispositionException;
+ 
++import sun.corba.SharedSecrets;
++
+ /**
+  * This class acts as the base class for the various GIOP message types. This
+  * also serves as a factory to create various message types. We currently
+@@ -909,7 +910,8 @@
+         SystemException sysEx = null;
+ 
+         try {
+-            Class clazz = ORBClassLoader.loadClass(exClassName);
++            Class<?> clazz =
++                SharedSecrets.getJavaCorbaAccess().loadClass(exClassName);
+             if (message == null) {
+                 sysEx = (SystemException) clazz.newInstance();
+             } else {
+diff --git a/src/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage_1_0.java b/src/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage_1_0.java
+--- corba/src/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage_1_0.java
++++ corba/src/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage_1_0.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2000, 2003, 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
+@@ -37,7 +37,6 @@
+ import com.sun.corba.se.spi.servicecontext.ServiceContexts;
+ import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+ import com.sun.corba.se.impl.orbutil.ORBUtility;
+-import com.sun.corba.se.impl.orbutil.ORBClassLoader;
+ import com.sun.corba.se.spi.ior.IOR;
+ import com.sun.corba.se.impl.encoding.CDRInputStream;
+ 
+diff --git a/src/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage_1_1.java b/src/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage_1_1.java
+--- corba/src/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage_1_1.java
++++ corba/src/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage_1_1.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2000, 2003, 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
+@@ -37,7 +37,6 @@
+ import com.sun.corba.se.spi.servicecontext.ServiceContexts;
+ import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+ import com.sun.corba.se.impl.orbutil.ORBUtility;
+-import com.sun.corba.se.impl.orbutil.ORBClassLoader;
+ import com.sun.corba.se.spi.ior.IOR;
+ import com.sun.corba.se.impl.encoding.CDRInputStream;
+ 
+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, 2012, 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
+@@ -97,8 +97,8 @@
+ 
+ import com.sun.corba.se.impl.presentation.rmi.PresentationManagerImpl ;
+ 
+-import com.sun.corba.se.impl.orbutil.ORBClassLoader ;
+ import sun.awt.AppContext;
++import sun.corba.SharedSecrets;
+ 
+ public abstract class ORB extends com.sun.corba.se.org.omg.CORBA.ORB
+     implements Broker, TypeCodeFactory
+@@ -201,7 +201,7 @@
+ 
+                         try {
+                             // First try the configured class name, if any
+-                            Class cls = ORBClassLoader.loadClass( className ) ;
++                            Class<?> cls = SharedSecrets.getJavaCorbaAccess().loadClass( className ) ;
+                             sff = (PresentationManager.StubFactoryFactory)cls.newInstance() ;
+                         } catch (Exception exc) {
+                             // Use the default. Log the error as a warning.
+diff --git a/src/share/classes/com/sun/corba/se/spi/orb/OperationFactory.java b/src/share/classes/com/sun/corba/se/spi/orb/OperationFactory.java
+--- corba/src/share/classes/com/sun/corba/se/spi/orb/OperationFactory.java
++++ corba/src/share/classes/com/sun/corba/se/spi/orb/OperationFactory.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2002, 2010, 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
+@@ -35,9 +35,10 @@
+ import com.sun.corba.se.spi.logging.CORBALogDomains ;
+ 
+ import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+-import com.sun.corba.se.impl.orbutil.ORBClassLoader ;
+ import com.sun.corba.se.impl.orbutil.ObjectUtility ;
+ 
++import sun.corba.SharedSecrets;
++
+ /** This is a static factory class for commonly used operations
+ * for property parsing.  The following operations are supported:
+ * <ul>
+@@ -247,7 +248,8 @@
+             String className = getString( value ) ;
+ 
+             try {
+-                Class result = ORBClassLoader.loadClass( className ) ;
++                Class<?> result =
++                    SharedSecrets.getJavaCorbaAccess().loadClass( className ) ;
+                 return result ;
+             } catch (Exception exc) {
+                 ORBUtilSystemException wrapper = ORBUtilSystemException.get(
+diff --git a/src/share/classes/sun/corba/JavaCorbaAccess.java b/src/share/classes/sun/corba/JavaCorbaAccess.java
+--- corba/src/share/classes/sun/corba/JavaCorbaAccess.java
++++ corba/src/share/classes/sun/corba/JavaCorbaAccess.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
+@@ -29,4 +29,5 @@
+ 
+ public interface JavaCorbaAccess {
+     public ValueHandlerImpl newValueHandlerImpl();
++    public Class<?> loadClass(String className) throws ClassNotFoundException;
+ }

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8001033-refactor_address_handling.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8001033-refactor_address_handling.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8001033-refactor_address_handling.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,119 @@
+# HG changeset patch
+# User andrew
+# Date 1371235593 -3600
+# Node ID ae6fc01dd3d4d1a7f662ace7ce787c071767c28a
+# Parent  59e36a91e283804e0ff074e43ca67d4002113db9
+8001033: Refactor network address handling in virtual machine identifiers
+Reviewed-by: smarks, hawtin, mchung
+
+diff --git a/src/share/classes/java/rmi/dgc/VMID.java b/src/share/classes/java/rmi/dgc/VMID.java
+--- jdk/src/share/classes/java/rmi/dgc/VMID.java
++++ jdk/src/share/classes/java/rmi/dgc/VMID.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
+@@ -25,10 +25,8 @@
+ 
+ package java.rmi.dgc;
+ 
+-import java.io.*;
+-import java.net.*;
+ import java.rmi.server.UID;
+-import java.security.*;
++import java.security.SecureRandom;
+ 
+ /**
+  * A VMID is a identifier that is unique across all Java virtual
+@@ -39,9 +37,8 @@
+  * @author      Peter Jones
+  */
+ public final class VMID implements java.io.Serializable {
+-
+-    /** array of bytes uniquely identifying this host */
+-    private static byte[] localAddr = computeAddressHash();
++    /** Array of bytes uniquely identifying this host */
++    private static final byte[] randomBytes;
+ 
+     /**
+      * @serial array of bytes uniquely identifying host created on
+@@ -56,6 +53,14 @@
+     /** indicate compatibility with JDK 1.1.x version of class */
+     private static final long serialVersionUID = -538642295484486218L;
+ 
++    static {
++        // Generate 8 bytes of random data.
++        SecureRandom secureRandom = new SecureRandom();
++        byte bytes[] = new byte[8];
++        secureRandom.nextBytes(bytes);
++        randomBytes = bytes;
++    }
++
+     /**
+      * Create a new VMID.  Each new VMID returned from this constructor
+      * is unique for all Java virtual machines under the following
+@@ -65,7 +70,7 @@
+      * for the lifetime of this object.  <p>
+      */
+     public VMID() {
+-        addr = localAddr;
++        addr = randomBytes;
+         uid = new UID();
+     }
+ 
+@@ -126,52 +131,4 @@
+         result.append(uid.toString());
+         return result.toString();
+     }
+-
+-    /**
+-     * Compute the hash an IP address.  The hash is the first 8 bytes
+-     * of the SHA digest of the IP address.
+-     */
+-    private static byte[] computeAddressHash() {
+-
+-        /*
+-         * Get the local host's IP address.
+-         */
+-        byte[] addr = (byte[]) java.security.AccessController.doPrivileged(
+-            new PrivilegedAction() {
+-            public Object run() {
+-                try {
+-                    return InetAddress.getLocalHost().getAddress();
+-                } catch (Exception e) {
+-                }
+-                return new byte[] { 0, 0, 0, 0 };
+-            }
+-        });
+-
+-        byte[] addrHash;
+-        final int ADDR_HASH_LENGTH = 8;
+-
+-        try {
+-            /*
+-             * Calculate message digest of IP address using SHA.
+-             */
+-            MessageDigest md = MessageDigest.getInstance("SHA");
+-            ByteArrayOutputStream sink = new ByteArrayOutputStream(64);
+-            DataOutputStream out = new DataOutputStream(
+-                new DigestOutputStream(sink, md));
+-            out.write(addr, 0, addr.length);
+-            out.flush();
+-
+-            byte digest[] = md.digest();
+-            int hashlength = Math.min(ADDR_HASH_LENGTH, digest.length);
+-            addrHash = new byte[hashlength];
+-            System.arraycopy(digest, 0, addrHash, 0, hashlength);
+-
+-        } catch (IOException ignore) {
+-            /* can't happen, but be deterministic anyway. */
+-            addrHash = new byte[0];
+-        } catch (NoSuchAlgorithmException complain) {
+-            throw new InternalError(complain.toString());
+-        }
+-        return addrHash;
+-    }
+ }

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8001034-memory_management.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8001034-memory_management.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8001034-memory_management.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,78 @@
+# HG changeset patch
+# User bae
+# Date 1361951590 -14400
+# Node ID 5b6f070ddeab14b2d7a731c5f4c61eea406638da
+# Parent  ae6fc01dd3d4d1a7f662ace7ce787c071767c28a
+8001034: Memory management improvements
+Reviewed-by: prr, jgodinez
+
+diff --git a/src/solaris/native/sun/awt/awt_GraphicsEnv.c b/src/solaris/native/sun/awt/awt_GraphicsEnv.c
+--- jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c
++++ jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c
+@@ -924,6 +924,8 @@
+ static jint canUseShmExtPixmaps = UNSET_MITSHM;
+ static jboolean xshmAttachFailed = JNI_FALSE;
+ 
++extern int mitShmPermissionMask;
++
+ int J2DXErrHandler(Display *display, XErrorEvent *xerr) {
+     int ret = 0;
+     if (xerr->minor_code == X_ShmAttach) {
+@@ -962,7 +964,8 @@
+      * we need to test that we can actually do XShmAttach.
+      */
+     if (XShmQueryExtension(awt_display)) {
+-        shminfo.shmid = shmget(IPC_PRIVATE, 0x10000, IPC_CREAT|0777);
++        shminfo.shmid = shmget(IPC_PRIVATE, 0x10000,
++                               IPC_CREAT|mitShmPermissionMask);
+         if (shminfo.shmid < 0) {
+             AWT_UNLOCK();
+             J2dRlsTraceLn1(J2D_TRACE_ERROR,
+diff --git a/src/solaris/native/sun/awt/awt_GraphicsEnv.h b/src/solaris/native/sun/awt/awt_GraphicsEnv.h
+--- jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.h
++++ jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.h
+@@ -47,6 +47,9 @@
+ #include <X11/extensions/shmproto.h>
+ #endif
+ 
++#define MITSHM_PERM_COMMON (0666)
++#define MITSHM_PERM_OWNER  (0600)
++
+ extern int XShmQueryExtension();
+ 
+ void TryInitMITShm(JNIEnv *env, jint *shmExt, jint *shmPixmaps);
+diff --git a/src/solaris/native/sun/java2d/x11/X11SurfaceData.c b/src/solaris/native/sun/java2d/x11/X11SurfaceData.c
+--- jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c
++++ jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c
+@@ -91,6 +91,7 @@
+ jint useMitShmExt = CANT_USE_MITSHM;
+ jint useMitShmPixmaps = CANT_USE_MITSHM;
+ jint forceSharedPixmaps = JNI_FALSE;
++int mitShmPermissionMask = MITSHM_PERM_OWNER;
+ 
+ /* Cached shared image, one for all surface datas. */
+ static XImage * cachedXImage;
+@@ -154,6 +155,13 @@
+     if (getenv("NO_AWT_MITSHM") == NULL &&
+         getenv("NO_J2D_MITSHM") == NULL) {
+         char * force;
++        char * permission = getenv("J2D_MITSHM_PERMISSION");
++        if (permission != NULL) {
++            if (strcmp(permission, "common") == 0) {
++                mitShmPermissionMask = MITSHM_PERM_COMMON;
++            }
++        }
++
+         TryInitMITShm(env, &useMitShmExt, &useMitShmPixmaps);
+         useMitShmPixmaps = (useMitShmPixmaps == CAN_USE_MITSHM);
+         force = getenv("J2D_PIXMAPS");
+@@ -492,7 +500,8 @@
+         return NULL;
+     }
+     shminfo->shmid =
+-        shmget(IPC_PRIVATE, height * img->bytes_per_line, IPC_CREAT|0777);
++        shmget(IPC_PRIVATE, height * img->bytes_per_line,
++               IPC_CREAT|mitShmPermissionMask);
+     if (shminfo->shmid < 0) {
+         J2dRlsTraceLn1(J2D_TRACE_ERROR,
+                        "X11SD_SetupSharedSegment shmget has failed: %s",

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8001038-resourcefully_handle_resources.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8001038-resourcefully_handle_resources.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8001038-resourcefully_handle_resources.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,236 @@
+# HG changeset patch
+# User bae
+# Date 1364494624 -14400
+# Node ID d514062cbfff28dc38f4b429df12f0d174f960e6
+# Parent  5b6f070ddeab14b2d7a731c5f4c61eea406638da
+8001038: Resourcefully handle resources
+Reviewed-by: mschoene, prr, bae
+Contributed-by: jia-hong.chen at oracle.com
+
+diff --git a/src/share/classes/java/awt/Font.java b/src/share/classes/java/awt/Font.java
+--- jdk/src/share/classes/java/awt/Font.java
++++ jdk/src/share/classes/java/awt/Font.java
+@@ -850,6 +850,33 @@
+     public static Font createFont(int fontFormat, InputStream fontStream)
+         throws java.awt.FontFormatException, java.io.IOException {
+ 
++        if (hasTempPermission()) {
++            return createFont0(fontFormat, fontStream, null);
++        }
++
++        // Otherwise, be extra conscious of pending temp file creation and
++        // resourcefully handle the temp file resources, among other things.
++        CreatedFontTracker tracker = CreatedFontTracker.getTracker();
++        boolean acquired = false;
++        try {
++            acquired = tracker.acquirePermit();
++            if (!acquired) {
++                throw new IOException("Timed out waiting for resources.");
++            }
++            return createFont0(fontFormat, fontStream, tracker);
++        } catch (InterruptedException e) {
++            throw new IOException("Problem reading font data.");
++        } finally {
++            if (acquired) {
++                tracker.releasePermit();
++            }
++        }
++    }
++
++    private static Font createFont0(int fontFormat, InputStream fontStream,
++                                    CreatedFontTracker tracker)
++        throws java.awt.FontFormatException, java.io.IOException {
++
+         if (fontFormat != Font.TRUETYPE_FONT &&
+             fontFormat != Font.TYPE1_FONT) {
+             throw new IllegalArgumentException ("font format not recognized");
+@@ -864,9 +891,11 @@
+                     }
+                 }
+             );
++            if (tracker != null) {
++                tracker.add(tFile);
++            }
+ 
+             int totalSize = 0;
+-            CreatedFontTracker tracker = null;
+             try {
+                 final OutputStream outStream =
+                     AccessController.doPrivileged(
+@@ -876,8 +905,8 @@
+                             }
+                         }
+                     );
+-                if (!hasTempPermission()) {
+-                    tracker = CreatedFontTracker.getTracker();
++                if (tracker != null) {
++                    tracker.set(tFile, outStream);
+                 }
+                 try {
+                     byte[] buf = new byte[8192]; 
+@@ -892,7 +921,7 @@
+                             }
+                             if (totalSize+tracker.getNumBytes() >
+                                 tracker.MAX_TOTAL_BYTES)
+-                              {
++                            {
+                                 throw new IOException("Total files too big.");
+                             }
+                             totalSize += bytesRead;
+@@ -918,6 +947,9 @@
+                 Font font = new Font(tFile, fontFormat, true, tracker);
+                 return font;
+             } finally {
++                if (tracker != null) {
++                    tracker.remove(tFile);
++                }
+                 if (!copiedFontData) {
+                     if (tracker != null) {
+                         tracker.subBytes(totalSize);
+diff --git a/src/share/classes/sun/font/CreatedFontTracker.java b/src/share/classes/sun/font/CreatedFontTracker.java
+--- jdk/src/share/classes/sun/font/CreatedFontTracker.java
++++ jdk/src/share/classes/sun/font/CreatedFontTracker.java
+@@ -25,13 +25,22 @@
+ 
+ package sun.font;
+ 
++import java.io.File;
++import java.io.OutputStream;
++import java.util.HashMap;
++import java.util.Map;
++import java.util.concurrent.Semaphore;
++import java.util.concurrent.TimeUnit;
++
++import sun.awt.AppContext;
++
+ public class CreatedFontTracker {
+ 
+     public static final int MAX_FILE_SIZE = 32 * 1024 * 1024;
+     public static final int MAX_TOTAL_BYTES = 10 * MAX_FILE_SIZE;
+ 
+-    static int numBytes;
+     static CreatedFontTracker tracker;
++    int numBytes;
+ 
+     public static synchronized CreatedFontTracker getTracker() {
+         if (tracker == null) {
+@@ -40,6 +49,10 @@
+         return tracker;
+     }
+ 
++    private CreatedFontTracker() {
++        numBytes = 0;
++    }
++
+     public synchronized int getNumBytes() {
+         return numBytes;
+     }
+@@ -51,4 +64,108 @@
+     public synchronized void subBytes(int sz) {
+         numBytes -= sz;
+     }
++
++    /**
++     * Returns an AppContext-specific counting semaphore.
++     */
++    private static synchronized Semaphore getCS() {
++        final AppContext appContext = AppContext.getAppContext();
++        Semaphore cs = (Semaphore) appContext.get(CreatedFontTracker.class);
++        if (cs == null) {
++            // Make a semaphore with 5 permits that obeys the first-in first-out
++            // granting of permits.
++            cs = new Semaphore(5, true);
++            appContext.put(CreatedFontTracker.class, cs);
++        }
++        return cs;
++    }
++
++    public boolean acquirePermit() throws InterruptedException {
++        // This does a timed-out wait.
++        return getCS().tryAcquire(120, TimeUnit.SECONDS);
++    }
++
++    public void releasePermit() {
++        getCS().release();
++    }
++
++    public void add(File file) {
++        TempFileDeletionHook.add(file);
++    }
++
++    public void set(File file, OutputStream os) {
++        TempFileDeletionHook.set(file, os);
++    }
++
++    public void remove(File file) {
++        TempFileDeletionHook.remove(file);
++    }
++
++    /**
++     * Helper class for cleanup of temp files created while processing fonts.
++     * Note that this only applies to createFont() from an InputStream object.
++     */
++    private static class TempFileDeletionHook {
++        private static HashMap<File, OutputStream> files = new HashMap<>();
++
++        private static Thread t = null;
++        static void init() {
++            if (t == null) {
++                // Add a shutdown hook to remove the temp file.
++                java.security.AccessController.doPrivileged(
++                   new java.security.PrivilegedAction() {
++                      public Object run() {
++                          /* The thread must be a member of a thread group
++                           * which will not get GCed before VM exit.
++                           * Make its parent the top-level thread group.
++                           */
++                          ThreadGroup tg =
++                              Thread.currentThread().getThreadGroup();
++                          for (ThreadGroup tgn = tg;
++                               tgn != null;
++                               tg = tgn, tgn = tg.getParent());
++                          t = new Thread(tg, new Runnable() {
++                              public void run() {
++                                  runHooks();
++                              }
++                          });
++                          t.setContextClassLoader(null);
++                          Runtime.getRuntime().addShutdownHook(t);
++                          return null;
++                      }
++                   });
++            }
++        }
++
++        private TempFileDeletionHook() {}
++
++        static synchronized void add(File file) {
++            init();
++            files.put(file, null);
++        }
++
++        static synchronized void set(File file, OutputStream os) {
++            files.put(file, os);
++        }
++
++        static synchronized void remove(File file) {
++            files.remove(file);
++        }
++
++        static synchronized void runHooks() {
++            if (files.isEmpty()) {
++                return;
++            }
++
++            for (Map.Entry<File, OutputStream> entry : files.entrySet()) {
++                // Close the associated output stream, and then delete the file.
++                try {
++                    if (entry.getValue() != null) {
++                        entry.getValue().close();
++                    }
++                } catch (Exception e) {}
++                entry.getKey().delete();
++            }
++        }
++    }
+ }

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8001043-clarify_definition_restrictions.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8001043-clarify_definition_restrictions.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8001043-clarify_definition_restrictions.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,92 @@
+# HG changeset patch
+# User dfuchs
+# Date 1363366750 -3600
+# Node ID 6bf007b78f5c5f9e9bf4721dd4e4bc956f6f343f
+# Parent  d514062cbfff28dc38f4b429df12f0d174f960e6
+8001043: Clarify definition restrictions
+Reviewed-by: alanb, skoivu, smarks
+
+diff --git a/src/share/classes/sun/rmi/server/LoaderHandler.java b/src/share/classes/sun/rmi/server/LoaderHandler.java
+--- jdk/src/share/classes/sun/rmi/server/LoaderHandler.java
++++ jdk/src/share/classes/sun/rmi/server/LoaderHandler.java
+@@ -55,6 +55,7 @@
+ import java.util.Map;
+ import java.util.StringTokenizer;
+ import java.util.WeakHashMap;
++import sun.reflect.misc.ReflectUtil;
+ import sun.rmi.runtime.Log;
+ import sun.security.action.GetPropertyAction;
+ 
+@@ -168,7 +169,7 @@
+ 
+         if (defaultLoader != null) {
+             try {
+-                Class c = Class.forName(name, false, defaultLoader);
++                Class c = loadClassForName(name, false, defaultLoader);
+                 if (loaderLog.isLoggable(Log.VERBOSE)) {
+                     loaderLog.log(Log.VERBOSE,
+                         "class \"" + name + "\" found via defaultLoader, " +
+@@ -373,7 +374,7 @@
+         SecurityManager sm = System.getSecurityManager();
+         if (sm == null) {
+             try {
+-                Class c = Class.forName(name, false, parent);
++                Class c = loadClassForName(name, false, parent);
+                 if (loaderLog.isLoggable(Log.VERBOSE)) {
+                     loaderLog.log(Log.VERBOSE,
+                         "class \"" + name + "\" found via " +
+@@ -422,7 +423,7 @@
+                  * resolved without the security-offending codebase anyway;
+                  * if so, return successfully (see bugids 4191926 & 4349670).
+                  */
+-                Class c = Class.forName(name, false, parent);
++                Class c = loadClassForName(name, false, parent);
+                 if (loaderLog.isLoggable(Log.VERBOSE)) {
+                     loaderLog.log(Log.VERBOSE,
+                         "class \"" + name + "\" found via " +
+@@ -448,7 +449,7 @@
+         }
+ 
+         try {
+-            Class c = Class.forName(name, false, loader);
++            Class c = loadClassForName(name, false, loader);
+             if (loaderLog.isLoggable(Log.VERBOSE)) {
+                 loaderLog.log(Log.VERBOSE,
+                     "class \"" + name + "\" " + "found via codebase, " +
+@@ -726,7 +727,7 @@
+ 
+         for (int i = 0; i < interfaces.length; i++) {
+             Class cl =
+-                (classObjs[i] = Class.forName(interfaces[i], false, loader));
++                (classObjs[i] = loadClassForName(interfaces[i], false, loader));
+ 
+             if (!Modifier.isPublic(cl.getModifiers())) {
+                 ClassLoader current = cl.getClassLoader();
+@@ -1194,5 +1195,27 @@
+         public String toString() {
+             return super.toString() + "[\"" + annotation + "\"]";
+         }
++
++        @Override
++        protected Class<?> loadClass(String name, boolean resolve)
++                throws ClassNotFoundException {
++            if (parent == null) {
++                ReflectUtil.checkPackageAccess(name);
++            }
++            return super.loadClass(name, resolve);
++        }
++
+     }
++
++    private static Class<?> loadClassForName(String name,
++                                              boolean initialize,
++                                              ClassLoader loader)
++            throws ClassNotFoundException
++    {
++        if (loader == null) {
++            ReflectUtil.checkPackageAccess(name);
++        }
++        return Class.forName(name, initialize, loader);
++    }
++
+ }

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8001309-better_handling_of_annotation_interfaces.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8001309-better_handling_of_annotation_interfaces.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8001309-better_handling_of_annotation_interfaces.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,36 @@
+# HG changeset patch
+# User andrew
+# Date 1371236018 -3600
+# Node ID 1226e37bd53ebb2c4fbb9d71dd60ee5e226c9f1b
+# Parent  6bf007b78f5c5f9e9bf4721dd4e4bc956f6f343f
+8001309: Better handling of annotation interfaces
+Reviewed-by: darcy
+
+diff --git a/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java b/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java
+--- jdk/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java
++++ jdk/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -337,12 +337,15 @@
+         try {
+             annotationType = AnnotationType.getInstance(type);
+         } catch(IllegalArgumentException e) {
+-            // Class is no longer an annotation type; all bets are off
+-            return;
++            // Class is no longer an annotation type; time to punch out
++            throw new java.io.InvalidObjectException("Non-annotation type in annotation serial stream");
+         }
+ 
+         Map<String, Class> memberTypes = annotationType.memberTypes();
+ 
++
++        // If there are annotation members without values, that
++        // situation is handled by the invoke method.
+         for (Map.Entry<String, Object> memberValue : memberValues.entrySet()) {
+             String name = memberValue.getKey();
+             Class memberType = memberTypes.get(name);

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8001318-6_fixup.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8001318-6_fixup.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8001318-6_fixup.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,114 @@
+# HG changeset patch
+# User andrew
+# Date 1371826938 18000
+# Node ID ccd06d9c7258aea155d7053d399431bcd1af4405
+# Parent  662fbd43808413b2bd7ae4ae95683da98999023e
+Fix up 8001318
+
+diff --git a/src/share/classes/java/net/ServerSocket.java b/src/share/classes/java/net/ServerSocket.java
+--- jdk/src/share/classes/java/net/ServerSocket.java
++++ jdk/src/share/classes/java/net/ServerSocket.java
+@@ -363,7 +363,7 @@
+             }
+             return in;
+         } catch (SecurityException e) {
+-            return InetAddress.getLoopbackAddress();
++            return InetAddress.impl.loopbackAddress();
+         } catch (SocketException e) {
+             // nothing
+             // If we're bound, the impl has been created
+@@ -675,7 +675,7 @@
+         if (!NetUtil.doRevealLocalAddress() &&
+                 System.getSecurityManager() != null)
+         {
+-            in = InetAddress.getLoopbackAddress();
++            in = InetAddress.impl.loopbackAddress();
+         } else {
+             in = impl.getInetAddress();
+         }
+diff --git a/src/share/classes/java/net/Socket.java b/src/share/classes/java/net/Socket.java
+--- jdk/src/share/classes/java/net/Socket.java
++++ jdk/src/share/classes/java/net/Socket.java
+@@ -666,7 +666,7 @@
+                 in = InetAddress.anyLocalAddress();
+             }
+         } catch (SecurityException e) {
+-            in = InetAddress.getLoopbackAddress();
++            in = InetAddress.impl.loopbackAddress();
+         } catch (Exception e) {
+             in = InetAddress.anyLocalAddress(); // "0.0.0.0"
+         }
+diff --git a/src/share/classes/sun/nio/ch/Net.java b/src/share/classes/sun/nio/ch/Net.java
+--- jdk/src/share/classes/sun/nio/ch/Net.java
++++ jdk/src/share/classes/sun/nio/ch/Net.java
+@@ -29,7 +29,8 @@
+ import java.lang.reflect.*;
+ import java.net.*;
+ import java.nio.channels.*;
+-
++import java.security.AccessController;
++import java.security.PrivilegedExceptionAction;
+ 
+ class Net {                                             // package-private
+ 
+@@ -233,4 +234,60 @@
+         initIDs();
+     }
+ 
++     /**
++     * Returns the local address after performing a SecurityManager#checkConnect.
++     */
++    static InetSocketAddress getRevealedLocalAddress(InetSocketAddress addr) {
++        SecurityManager sm = System.getSecurityManager();
++        if (addr == null || sm == null)
++            return addr;
++
++        if (!getRevealLocalAddress()) {
++            // Return loopback address only if security check fails
++            try{
++                sm.checkConnect(addr.getAddress().getHostAddress(), -1);
++                //Security check passed
++            } catch (SecurityException e) {
++                //Return loopback address
++                addr = getLoopbackAddress(addr.getPort());
++            }
++        }
++        return addr;
++    }
++
++    static String getRevealedLocalAddressAsString(InetSocketAddress addr) {
++        if (!getRevealLocalAddress() && System.getSecurityManager() != null)
++            addr = getLoopbackAddress(addr.getPort());
++        return addr.toString();
++    }
++
++    private static boolean getRevealLocalAddress() {
++        if (!propRevealLocalAddress) {
++            try {
++                revealLocalAddress = Boolean.parseBoolean(
++                      AccessController.doPrivileged(
++                          new PrivilegedExceptionAction<String>() {
++                              public String run() {
++                                  return System.getProperty(
++                                      "jdk.net.revealLocalAddress");
++                              }
++                          }));
++
++            } catch (Exception e) {
++                // revealLocalAddress is false
++            }
++            propRevealLocalAddress = true;
++        }
++        return revealLocalAddress;
++    }
++
++    private static InetSocketAddress getLoopbackAddress(int port) {
++	try {
++	    return new InetSocketAddress(InetAddress.getByName(null),
++					 port);
++	} catch (UnknownHostException e) { 
++	    throw new InternalError("Shouldn't reach here.");
++	}
++    }
++
+ }

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8001318-socket_getlocaladdress_consistency.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8001318-socket_getlocaladdress_consistency.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8001318-socket_getlocaladdress_consistency.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,470 @@
+# HG changeset patch
+# User andrew
+# Date 1371237878 -3600
+# Node ID f2c674e184e04dcd8e39b6ba6f784c75a3553ef5
+# Parent  1226e37bd53ebb2c4fbb9d71dd60ee5e226c9f1b
+8001318: Socket.getLocalAddress not consistent with InetAddress.getLocalHost
+
+diff --git a/src/share/classes/java/net/NetUtil.java b/src/share/classes/java/net/NetUtil.java
+new file mode 100644
+--- /dev/null
++++ jdk/src/share/classes/java/net/NetUtil.java
+@@ -0,0 +1,73 @@
++/*
++ * 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.net;
++
++import java.security.AccessController;
++import java.security.PrivilegedExceptionAction;
++
++class NetUtil {
++
++    // Value of jdk.net.revealLocalAddress
++    private static boolean revealLocalAddress;
++
++    // True if jdk.net.revealLocalAddress had been read
++    private static volatile boolean propRevealLocalAddr;
++
++    /*
++     * Returns true if security check on localAddress is disabled
++     */
++    static boolean doRevealLocalAddress() {
++        return propRevealLocalAddr ? revealLocalAddress
++                                     : readRevealLocalAddr();
++
++    }
++
++    private static boolean readRevealLocalAddr() {
++        SecurityManager sm = System.getSecurityManager();
++        if (sm != null) {
++            try {
++                revealLocalAddress = Boolean.parseBoolean(
++                      AccessController.doPrivileged(
++                          new PrivilegedExceptionAction<String>() {
++                              public String run() {
++                                  return System.getProperty(
++                                      "jdk.net.revealLocalAddress");
++                              }
++                          }));
++
++            } catch (Exception e) {
++                //revealLocalAddress is false
++            }
++            propRevealLocalAddr = true;
++        }
++        /*
++         * No security manager, or security check passed or
++         * jdk.net.revealLocalAddress set to true
++         */
++        return revealLocalAddress;
++    }
++
++}
+diff --git a/src/share/classes/java/net/ServerSocket.java b/src/share/classes/java/net/ServerSocket.java
+--- jdk/src/share/classes/java/net/ServerSocket.java
++++ jdk/src/share/classes/java/net/ServerSocket.java
+@@ -355,7 +355,15 @@
+         if (!isBound())
+             return null;
+         try {
+-            return getImpl().getInetAddress();
++            InetAddress in = getImpl().getInetAddress();
++            if (!NetUtil.doRevealLocalAddress()) {
++                SecurityManager sm = System.getSecurityManager();
++                if (sm != null)
++                    sm.checkConnect(in.getHostAddress(), -1);
++            }
++            return in;
++        } catch (SecurityException e) {
++            return InetAddress.getLoopbackAddress();
+         } catch (SocketException e) {
+             // nothing
+             // If we're bound, the impl has been created
+@@ -660,13 +668,20 @@
+      *
+      * @return  a string representation of this socket.
+      */
+-    public String toString() {
++   public String toString() {
+         if (!isBound())
+             return "ServerSocket[unbound]";
+-        return "ServerSocket[addr=" + impl.getInetAddress() +
+-                ",port=" + impl.getPort() +
++        InetAddress in;
++        if (!NetUtil.doRevealLocalAddress() &&
++                System.getSecurityManager() != null)
++        {
++            in = InetAddress.getLoopbackAddress();
++        } else {
++            in = impl.getInetAddress();
++        }
++        return "ServerSocket[addr=" + in +
+                 ",localport=" + impl.getLocalPort()  + "]";
+-    }
++   }
+ 
+     void setBound() {
+         bound = true;
+diff --git a/src/share/classes/java/net/Socket.java b/src/share/classes/java/net/Socket.java
+--- jdk/src/share/classes/java/net/Socket.java
++++ jdk/src/share/classes/java/net/Socket.java
+@@ -656,9 +656,17 @@
+         InetAddress in = null;
+         try {
+             in = (InetAddress) getImpl().getOption(SocketOptions.SO_BINDADDR);
++
++            if (!NetUtil.doRevealLocalAddress()) {
++                SecurityManager sm = System.getSecurityManager();
++                if (sm != null)
++                    sm.checkConnect(in.getHostAddress(), -1);
++            }
+             if (in.isAnyLocalAddress()) {
+                 in = InetAddress.anyLocalAddress();
+             }
++        } catch (SecurityException e) {
++            in = InetAddress.getLoopbackAddress();
+         } catch (Exception e) {
+             in = InetAddress.anyLocalAddress(); // "0.0.0.0"
+         }
+diff --git a/src/share/classes/java/net/SocksSocketImpl.java b/src/share/classes/java/net/SocksSocketImpl.java
+--- jdk/src/share/classes/java/net/SocksSocketImpl.java
++++ jdk/src/share/classes/java/net/SocksSocketImpl.java
+@@ -28,6 +28,7 @@
+ import java.io.OutputStream;
+ import java.io.BufferedOutputStream;
+ import java.security.AccessController;
++import java.security.PrivilegedAction;
+ import java.security.PrivilegedExceptionAction;
+ import java.util.prefs.Preferences;
+ import sun.net.www.ParseUtil;
+@@ -584,7 +585,13 @@
+         /* Test for AnyLocal */
+         InetAddress naddr = baddr;
+         if (naddr.isAnyLocalAddress()) {
+-            naddr = cmdsock.getLocalAddress();
++            naddr = AccessController.doPrivileged(
++                        new PrivilegedAction<InetAddress>() {
++                            public InetAddress run() {
++                                return cmdsock.getLocalAddress();
++
++                            }
++                        });
+             addr1 = naddr.getAddress();
+         }
+         out.write(PROTO_VERS4);
+diff --git a/src/share/classes/sun/net/NetworkClient.java b/src/share/classes/sun/net/NetworkClient.java
+--- jdk/src/share/classes/sun/net/NetworkClient.java
++++ jdk/src/share/classes/sun/net/NetworkClient.java
+@@ -198,7 +198,13 @@
+     protected InetAddress getLocalAddress() throws IOException {
+         if (serverSocket == null)
+             throw new IOException("not connected");
+-        return serverSocket.getLocalAddress();
++        return  AccessController.doPrivileged(
++                        new PrivilegedAction<InetAddress>() {
++                            public InetAddress run() {
++                                return serverSocket.getLocalAddress();
++
++                            }
++                        });
+     }
+ 
+     /** Close an open connection to the server. */
+diff --git a/src/share/classes/sun/net/httpserver/ServerImpl.java b/src/share/classes/sun/net/httpserver/ServerImpl.java
+--- jdk/src/share/classes/sun/net/httpserver/ServerImpl.java
++++ jdk/src/share/classes/sun/net/httpserver/ServerImpl.java
+@@ -30,6 +30,8 @@
+ import java.nio.*;
+ import java.security.*;
+ import java.nio.channels.*;
++import java.security.AccessController;
++import java.security.PrivilegedAction;
+ import java.util.*;
+ import java.util.concurrent.*;
+ import java.util.logging.Logger;
+@@ -222,7 +224,14 @@
+     }
+ 
+     public InetSocketAddress getAddress() {
+-        return (InetSocketAddress)schan.socket().getLocalSocketAddress();
++        return AccessController.doPrivileged(
++                new PrivilegedAction<InetSocketAddress>() {
++                    public InetSocketAddress run() {
++                        return
++                            (InetSocketAddress)schan.socket()
++                                .getLocalSocketAddress();
++                    }
++                });
+     }
+ 
+     Selector getSelector () {
+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
+@@ -83,8 +83,8 @@
+     private int state = ST_UNINITIALIZED;
+ 
+     // Binding
+-    private SocketAddress localAddress = null;
+-    SocketAddress remoteAddress = null;
++    private InetSocketAddress localAddress = null;
++    InetSocketAddress remoteAddress = null;
+ 
+     // Options
+     private SocketOpts.IP options = null;
+@@ -500,7 +500,7 @@
+                 InetSocketAddress isa = (InetSocketAddress)localAddress;
+                 sm.checkConnect(isa.getAddress().getHostAddress(), -1);
+             }
+-            return localAddress;
++            return Net.getRevealedLocalAddress(localAddress);
+         }
+     }
+ 
+@@ -543,6 +543,7 @@
+         }
+     }
+ 
++    @Override
+     public DatagramChannel connect(SocketAddress sa) throws IOException {
+         int trafficClass = 0;
+         int localPort = 0;
+@@ -565,7 +566,7 @@
+ 
+                     // Connection succeeded; disallow further invocation
+                     state = ST_CONNECTED;
+-                    remoteAddress = sa;
++                    remoteAddress = isa;
+                     sender = isa;
+                     cachedSenderInetAddress = isa.getAddress();
+                     cachedSenderPort = isa.getPort();
+@@ -581,7 +582,7 @@
+                 synchronized (stateLock) {
+                     if (!isConnected() || !isOpen())
+                         return this;
+-                    InetSocketAddress isa = (InetSocketAddress)remoteAddress;
++                    InetSocketAddress isa = remoteAddress;
+                     SecurityManager sm = System.getSecurityManager();
+                     if (sm != null)
+                         sm.checkConnect(isa.getAddress().getHostAddress(),
+diff --git a/src/share/classes/sun/nio/ch/Net.java b/src/share/classes/sun/nio/ch/Net.java
+--- jdk/src/share/classes/sun/nio/ch/Net.java
++++ jdk/src/share/classes/sun/nio/ch/Net.java
+@@ -36,6 +36,12 @@
+     private Net() { }
+ 
+ 
++    // Value of jdk.net.revealLocalAddress
++    private static boolean revealLocalAddress;
++
++    // True if jdk.net.revealLocalAddress had been read
++    private static volatile boolean propRevealLocalAddress;
++
+     // set to true if exclusive binding is on for Windows
+     private static final boolean exclusiveBind;
+ 
+diff --git a/src/share/classes/sun/nio/ch/ServerSocketAdaptor.java b/src/share/classes/sun/nio/ch/ServerSocketAdaptor.java
+--- jdk/src/share/classes/sun/nio/ch/ServerSocketAdaptor.java
++++ jdk/src/share/classes/sun/nio/ch/ServerSocketAdaptor.java
+@@ -83,7 +83,8 @@
+     public InetAddress getInetAddress() {
+         if (!ssc.isBound())
+             return null;
+-        return Net.asInetSocketAddress(ssc.localAddress()).getAddress();
++        return Net.getRevealedLocalAddress(ssc.localAddress()).getAddress();
++
+     }
+ 
+     public int getLocalPort() {
+diff --git a/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java b/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java
+--- jdk/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java
++++ jdk/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java
+@@ -75,7 +75,7 @@
+     private int state = ST_UNINITIALIZED;
+ 
+     // Binding
+-    private SocketAddress localAddress = null; // null => unbound
++    private InetSocketAddress localAddress; // null => unbound
+ 
+     // Options, created on demand
+     private SocketOpts.IP.TCP options = null;
+@@ -118,9 +118,11 @@
+         }
+     }
+ 
+-    public SocketAddress localAddress() {
++    public InetSocketAddress localAddress() {
+         synchronized (stateLock) {
+-            return localAddress;
++            return localAddress == null? localAddress
++                    : Net.getRevealedLocalAddress(
++                          Net.asInetSocketAddress(localAddress));
+         }
+     }
+ 
+@@ -307,14 +309,15 @@
+         StringBuffer sb = new StringBuffer();
+         sb.append(this.getClass().getName());
+         sb.append('[');
+-        if (!isOpen())
++        if (!isOpen()) {
+             sb.append("closed");
+-        else {
++        } else {
+             synchronized (stateLock) {
+-                if (localAddress() == null) {
++                InetSocketAddress addr = localAddress();
++                if (addr == null) {
+                     sb.append("unbound");
+                 } else {
+-                    sb.append(localAddress().toString());
++                    sb.append(Net.getRevealedLocalAddressAsString(addr));
+                 }
+             }
+         }
+diff --git a/src/share/classes/sun/nio/ch/SocketAdaptor.java b/src/share/classes/sun/nio/ch/SocketAdaptor.java
+--- jdk/src/share/classes/sun/nio/ch/SocketAdaptor.java
++++ jdk/src/share/classes/sun/nio/ch/SocketAdaptor.java
+@@ -162,7 +162,7 @@
+     public InetAddress getLocalAddress() {
+         if (!sc.isBound())
+             return new InetSocketAddress(0).getAddress();
+-        return Net.asInetSocketAddress(sc.localAddress()).getAddress();
++        return Net.getRevealedLocalAddress(sc.localAddress()).getAddress();
+     }
+ 
+     public int getPort() {
+diff --git a/src/share/classes/sun/nio/ch/SocketChannelImpl.java b/src/share/classes/sun/nio/ch/SocketChannelImpl.java
+--- jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java
++++ jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java
+@@ -78,8 +78,8 @@
+     private int state = ST_UNINITIALIZED;
+ 
+     // Binding
+-    private SocketAddress localAddress = null;
+-    private SocketAddress remoteAddress = null;
++    private InetSocketAddress localAddress;
++    private InetSocketAddress remoteAddress;
+ 
+     // Input/Output open
+     private boolean isInputOpen = true;
+@@ -443,7 +443,7 @@
+         }
+     }
+ 
+-    public SocketAddress localAddress() {
++    public InetSocketAddress localAddress() {
+         synchronized (stateLock) {
+             if (state == ST_CONNECTED &&
+                 (localAddress == null ||
+@@ -452,7 +452,7 @@
+                     // Socket was bound with an "anyLocalAddress"
+                     localAddress = Net.localAddress(fd);
+             }
+-            return localAddress;
++            return  Net.getRevealedLocalAddress(localAddress);
+         }
+     }
+ 
+@@ -830,6 +830,7 @@
+         return fdVal;
+     }
+ 
++    @Override
+     public String toString() {
+         StringBuffer sb = new StringBuffer();
+         sb.append(this.getClass().getSuperclass().getName());
+@@ -853,9 +854,10 @@
+                         sb.append(" oshut");
+                     break;
+                 }
+-                if (localAddress() != null) {
++                InetSocketAddress addr = localAddress();
++                if (addr != null) {
+                     sb.append(" local=");
+-                    sb.append(localAddress().toString());
++                    sb.append(Net.getRevealedLocalAddressAsString(addr));
+                 }
+                 if (remoteAddress() != null) {
+                     sb.append(" remote=");
+diff --git a/src/share/classes/sun/rmi/server/Activation.java b/src/share/classes/sun/rmi/server/Activation.java
+--- jdk/src/share/classes/sun/rmi/server/Activation.java
++++ jdk/src/share/classes/sun/rmi/server/Activation.java
+@@ -2202,7 +2202,12 @@
+         }
+ 
+         public InetAddress getInetAddress() {
+-            return serverSocket.getInetAddress();
++            return AccessController.doPrivileged(
++                new PrivilegedAction<InetAddress>() {
++                    public InetAddress run() {
++                        return serverSocket.getInetAddress();
++                    }
++                });
+         }
+ 
+         public int getLocalPort() {
+@@ -2210,7 +2215,12 @@
+         }
+ 
+         public SocketAddress getLocalSocketAddress() {
+-            return serverSocket.getLocalSocketAddress();
++            return AccessController.doPrivileged(
++                new PrivilegedAction<SocketAddress>() {
++                    public SocketAddress run() {
++                        return serverSocket.getLocalSocketAddress();
++                    }
++                });
+         }
+ 
+         /**
+diff --git a/src/share/classes/sun/rmi/transport/proxy/WrappedSocket.java b/src/share/classes/sun/rmi/transport/proxy/WrappedSocket.java
+--- jdk/src/share/classes/sun/rmi/transport/proxy/WrappedSocket.java
++++ jdk/src/share/classes/sun/rmi/transport/proxy/WrappedSocket.java
+@@ -28,6 +28,8 @@
+ import java.net.InetAddress;
+ import java.net.Socket;
+ import java.net.SocketException;
++import java.security.AccessController;
++import java.security.PrivilegedAction;
+ 
+ /**
+  * The WrappedSocket class provides a general wrapper for providing an
+@@ -78,7 +80,13 @@
+      * Get the local address to which the socket is bound.
+      */
+     public InetAddress getLocalAddress() {
+-        return socket.getLocalAddress();
++        return  AccessController.doPrivileged(
++                        new PrivilegedAction<InetAddress>() {
++                            public InetAddress run() {
++                                return socket.getLocalAddress();
++
++                            }
++                        });
+     }
+ 
+     /**

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8001330-checking_order_improvement.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8001330-checking_order_improvement.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8001330-checking_order_improvement.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,407 @@
+# HG changeset patch
+# User chrisphi
+# Date 1373378000 -3600
+# Node ID d913c85a5297ea80a71b2f6a1174237cb2fbbbad
+# Parent  2df643057b3d5f75d287a352cadf6fc0501a1682
+8001330: Improve on checking order
+8011896: Add check for invalid offset for new AccessControlContext isAuthorized field
+
+diff --git a/src/share/vm/classfile/javaClasses.cpp b/src/share/vm/classfile/javaClasses.cpp
+--- hotspot/src/share/vm/classfile/javaClasses.cpp
++++ hotspot/src/share/vm/classfile/javaClasses.cpp
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2010, 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
+@@ -2559,6 +2559,7 @@
+ int java_security_AccessControlContext::_context_offset = 0;
+ int java_security_AccessControlContext::_privilegedContext_offset = 0;
+ int java_security_AccessControlContext::_isPrivileged_offset = 0;
++int java_security_AccessControlContext::_isAuthorized_offset = -1;
+ 
+ void java_security_AccessControlContext::compute_offsets() {
+   assert(_isPrivileged_offset == 0, "offsets should be initialized only once");
+@@ -2579,9 +2580,20 @@
+     fatal("Invalid layout of java.security.AccessControlContext");
+   }
+   _isPrivileged_offset = fd.offset();
++
++  // The offset may not be present for bootstrapping with older JDK.
++  if (ik->find_local_field(vmSymbols::isAuthorized_name(), vmSymbols::bool_signature(), &fd)) {
++    _isAuthorized_offset = fd.offset();
++  }
+ }
+ 
+ 
++bool java_security_AccessControlContext::is_authorized(Handle context) {
++  assert(context.not_null() && context->klass() == SystemDictionary::AccessControlContext_klass(), "Invalid type");
++  assert(_isAuthorized_offset != -1, "should be set");
++  return context->bool_field(_isAuthorized_offset) != 0;
++}
++
+ oop java_security_AccessControlContext::create(objArrayHandle context, bool isPrivileged, Handle privileged_context, TRAPS) {
+   assert(_isPrivileged_offset != 0, "offsets should have been initialized");
+   // Ensure klass is initialized
+@@ -2592,6 +2604,8 @@
+   result->obj_field_put(_context_offset, context());
+   result->obj_field_put(_privilegedContext_offset, privileged_context());
+   result->bool_field_put(_isPrivileged_offset, isPrivileged);
++  // whitelist AccessControlContexts created by the JVM.
++  result->bool_field_put(_isAuthorized_offset, true);
+   return result;
+ }
+ 
+@@ -2656,6 +2670,15 @@
+ }
+ 
+ 
++bool java_lang_System::has_security_manager() {
++  instanceKlass* ik = instanceKlass::cast(SystemDictionary::System_klass());
++  address addr = ik->static_field_addr(static_security_offset);
++  if (UseCompressedOops) {
++    return oopDesc::load_decode_heap_oop((narrowOop *)addr) != NULL;
++  } else {
++    return oopDesc::load_decode_heap_oop((oop*)addr) != NULL;
++  }
++}
+ 
+ int java_lang_String::value_offset;
+ int java_lang_String::offset_offset;
+@@ -2712,6 +2735,7 @@
+ int java_lang_System::static_in_offset;
+ int java_lang_System::static_out_offset;
+ int java_lang_System::static_err_offset;
++int java_lang_System::static_security_offset;
+ int java_lang_StackTraceElement::declaringClass_offset;
+ int java_lang_StackTraceElement::methodName_offset;
+ int java_lang_StackTraceElement::fileName_offset;
+@@ -2866,6 +2890,7 @@
+   java_lang_System::static_in_offset  = java_lang_System::hc_static_in_offset  * x;
+   java_lang_System::static_out_offset = java_lang_System::hc_static_out_offset * x;
+   java_lang_System::static_err_offset = java_lang_System::hc_static_err_offset * x;
++  java_lang_System::static_security_offset = java_lang_System::hc_static_security_offset * x;
+ 
+   // java_lang_StackTraceElement
+   java_lang_StackTraceElement::declaringClass_offset = java_lang_StackTraceElement::hc_declaringClass_offset  * x + header;
+@@ -3067,6 +3092,7 @@
+   CHECK_STATIC_OFFSET("java/lang/System", java_lang_System,  in, "Ljava/io/InputStream;");
+   CHECK_STATIC_OFFSET("java/lang/System", java_lang_System, out, "Ljava/io/PrintStream;");
+   CHECK_STATIC_OFFSET("java/lang/System", java_lang_System, err, "Ljava/io/PrintStream;");
++  CHECK_STATIC_OFFSET("java/lang/System", java_lang_System, security, "Ljava/lang/SecurityManager;");
+ 
+   // java.lang.StackTraceElement
+ 
+diff --git a/src/share/vm/classfile/javaClasses.hpp b/src/share/vm/classfile/javaClasses.hpp
+--- hotspot/src/share/vm/classfile/javaClasses.hpp
++++ hotspot/src/share/vm/classfile/javaClasses.hpp
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2010, 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
+@@ -1146,11 +1146,14 @@
+   static int _context_offset;
+   static int _privilegedContext_offset;
+   static int _isPrivileged_offset;
++  static int _isAuthorized_offset;
+ 
+   static void compute_offsets();
+  public:
+   static oop create(objArrayHandle context, bool isPrivileged, Handle privileged_context, TRAPS);
+ 
++  static bool is_authorized(Handle context);
++
+   // Debugging/initialization
+   friend class JavaClasses;
+ };
+@@ -1186,13 +1189,15 @@
+   enum {
+    hc_static_in_offset  = 0,
+    hc_static_out_offset = 1,
+-   hc_static_err_offset = 2
++   hc_static_err_offset = 2,
++   hc_static_security_offset = 3
+   };
+ 
+   static int offset_of_static_fields;
+   static int  static_in_offset;
+   static int static_out_offset;
+   static int static_err_offset;
++  static int static_security_offset;
+ 
+   static void compute_offsets();
+ 
+@@ -1201,6 +1206,8 @@
+   static int out_offset_in_bytes();
+   static int err_offset_in_bytes();
+ 
++  static bool has_security_manager();
++
+   // Debugging
+   friend class JavaClasses;
+ };
+diff --git a/src/share/vm/classfile/vmSymbols.hpp b/src/share/vm/classfile/vmSymbols.hpp
+--- hotspot/src/share/vm/classfile/vmSymbols.hpp
++++ hotspot/src/share/vm/classfile/vmSymbols.hpp
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2011, 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
+@@ -93,6 +93,7 @@
+   template(java_lang_CharSequence,                    "java/lang/CharSequence")                   \
+   template(java_security_AccessControlContext,        "java/security/AccessControlContext")       \
+   template(java_security_ProtectionDomain,            "java/security/ProtectionDomain")           \
++  template(impliesCreateAccessControlContext_name,    "impliesCreateAccessControlContext")        \
+   template(java_io_OutputStream,                      "java/io/OutputStream")                     \
+   template(java_io_Reader,                            "java/io/Reader")                           \
+   template(java_io_BufferedReader,                    "java/io/BufferedReader")                   \
+@@ -315,6 +316,7 @@
+   template(contextClassLoader_name,                   "contextClassLoader")                       \
+   template(inheritedAccessControlContext_name,        "inheritedAccessControlContext")            \
+   template(isPrivileged_name,                         "isPrivileged")                             \
++  template(isAuthorized_name,                         "isAuthorized")                             \
+   template(wait_name,                                 "wait")                                     \
+   template(checkPackageAccess_name,                   "checkPackageAccess")                       \
+   template(stackSize_name,                            "stackSize")                                \
+diff --git a/src/share/vm/memory/universe.cpp b/src/share/vm/memory/universe.cpp
+--- hotspot/src/share/vm/memory/universe.cpp
++++ hotspot/src/share/vm/memory/universe.cpp
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2010, 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
+@@ -143,6 +143,7 @@
+ oop Universe::_the_min_jint_string                   = NULL;
+ LatestMethodOopCache* Universe::_finalizer_register_cache = NULL;
+ LatestMethodOopCache* Universe::_loader_addClass_cache    = NULL;
++LatestMethodOopCache* Universe::_pd_implies_cache         = NULL;
+ ActiveMethodOopsCache* Universe::_reflect_invoke_cache    = NULL;
+ oop Universe::_out_of_memory_error_java_heap          = NULL;
+ oop Universe::_out_of_memory_error_perm_gen           = NULL;
+@@ -265,6 +266,7 @@
+   f->do_oop((oop*)&_the_min_jint_string);
+   _finalizer_register_cache->oops_do(f);
+   _loader_addClass_cache->oops_do(f);
++  _pd_implies_cache->oops_do(f);
+   _reflect_invoke_cache->oops_do(f);
+   f->do_oop((oop*)&_out_of_memory_error_java_heap);
+   f->do_oop((oop*)&_out_of_memory_error_perm_gen);
+@@ -787,6 +789,7 @@
+   // CompactingPermGenGen::initialize_oops() tries to populate them.
+   Universe::_finalizer_register_cache = new LatestMethodOopCache();
+   Universe::_loader_addClass_cache    = new LatestMethodOopCache();
++  Universe::_pd_implies_cache         = new LatestMethodOopCache();
+   Universe::_reflect_invoke_cache     = new ActiveMethodOopsCache();
+ 
+   if (UseSharedSpaces) {
+@@ -1137,6 +1140,23 @@
+   Universe::_loader_addClass_cache->init(
+     SystemDictionary::ClassLoader_klass(), m, CHECK_false);
+ 
++  // Setup method for checking protection domain
++  instanceKlass::cast(SystemDictionary::ProtectionDomain_klass())->link_class(CHECK_false);
++  m = instanceKlass::cast(SystemDictionary::ProtectionDomain_klass())->
++            find_method(vmSymbols::impliesCreateAccessControlContext_name(),
++                        vmSymbols::void_boolean_signature());
++  // Allow NULL which should only happen with bootstrapping.
++  if (m != NULL) {
++    if (m->is_static()) {
++      // NoSuchMethodException doesn't actually work because it tries to run the
++      // <init> function before java_lang_Class is linked. Print error and exit.
++      tty->print_cr("ProtectionDomain.impliesCreateAccessControlContext() has the wrong linkage");
++      return false; // initialization failed
++    }
++    Universe::_pd_implies_cache->init(
++      SystemDictionary::ProtectionDomain_klass(), m, CHECK_false);;
++  }
++
+   // The folowing is initializing converter functions for serialization in
+   // JVM.cpp. If we clean up the StrictMath code above we may want to find
+   // a better solution for this as well.
+@@ -1570,6 +1590,7 @@
+ 
+ 
+ methodOop LatestMethodOopCache::get_methodOop() {
++  if (klass() == NULL) return NULL;
+   instanceKlass* ik = instanceKlass::cast(klass());
+   methodOop m = ik->method_with_idnum(method_idnum());
+   assert(m != NULL, "sanity check");
+diff --git a/src/share/vm/memory/universe.hpp b/src/share/vm/memory/universe.hpp
+--- hotspot/src/share/vm/memory/universe.hpp
++++ hotspot/src/share/vm/memory/universe.hpp
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2010, 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
+@@ -179,6 +179,7 @@
+   static oop          _the_min_jint_string;          // A cache of "-2147483648" as a Java string
+   static LatestMethodOopCache* _finalizer_register_cache; // static method for registering finalizable objects
+   static LatestMethodOopCache* _loader_addClass_cache;    // method for registering loaded classes in class loader vector
++  static LatestMethodOopCache* _pd_implies_cache;         // method for checking protection domain attributes
+   static ActiveMethodOopsCache* _reflect_invoke_cache;    // method for security checks
+   static oop          _out_of_memory_error_java_heap; // preallocated error object (no backtrace)
+   static oop          _out_of_memory_error_perm_gen;  // preallocated error object (no backtrace)
+@@ -322,6 +323,7 @@
+   static oop          the_min_jint_string()          { return _the_min_jint_string;          }
+   static methodOop    finalizer_register_method()     { return _finalizer_register_cache->get_methodOop(); }
+   static methodOop    loader_addClass_method()        { return _loader_addClass_cache->get_methodOop(); }
++  static methodOop protection_domain_implies_method() { return _pd_implies_cache->get_methodOop(); }
+   static ActiveMethodOopsCache* reflect_invoke_cache() { return _reflect_invoke_cache; }
+   static oop          null_ptr_exception_instance()   { return _null_ptr_exception_instance;   }
+   static oop          arithmetic_exception_instance() { return _arithmetic_exception_instance; }
+diff --git a/src/share/vm/oops/instanceKlass.cpp b/src/share/vm/oops/instanceKlass.cpp
+--- hotspot/src/share/vm/oops/instanceKlass.cpp
++++ hotspot/src/share/vm/oops/instanceKlass.cpp
+@@ -1992,6 +1992,11 @@
+   }
+ }
+ 
++address instanceKlass::static_field_addr(int offset) {
++  return (address)(offset + instanceKlass::offset_of_static_fields() + (intptr_t)java_mirror());
++}
++
++
+ const char* instanceKlass::signature_name() const {
+   const char* src = (const char*) (name()->as_C_string());
+   const int src_length = (int)strlen(src);
+diff --git a/src/share/vm/oops/instanceKlass.hpp b/src/share/vm/oops/instanceKlass.hpp
+--- hotspot/src/share/vm/oops/instanceKlass.hpp
++++ hotspot/src/share/vm/oops/instanceKlass.hpp
+@@ -675,6 +675,8 @@
+ 
+   intptr_t* end_of_itable() const          { return start_of_itable() + itable_length(); }
+ 
++  address static_field_addr(int offset);
++
+   int offset_of_static_fields() const {
+     return (intptr_t)start_of_static_fields() - (intptr_t)as_klassOop();
+   }
+diff --git a/src/share/vm/prims/jvm.cpp b/src/share/vm/prims/jvm.cpp
+--- hotspot/src/share/vm/prims/jvm.cpp
++++ hotspot/src/share/vm/prims/jvm.cpp
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2010, 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
+@@ -1101,6 +1101,56 @@
+   }
+ JVM_END
+ 
++static bool is_authorized(Handle context, instanceKlassHandle klass, TRAPS) {
++  // If there is a security manager and protection domain, check the access
++  // in the protection domain, otherwise it is authorized.
++  if (java_lang_System::has_security_manager()) {
++
++    // For bootstrapping, if pd implies method isn't in the JDK, allow
++    // this context to revert to older behavior.
++    // In this case the isAuthorized field in AccessControlContext is also not
++    // present.
++    if (Universe::protection_domain_implies_method() == NULL) {
++      return true;
++    }
++
++    // Whitelist certain access control contexts
++    if (java_security_AccessControlContext::is_authorized(context)) {
++      return true;
++    }
++
++    oop prot = klass->protection_domain();
++    if (prot != NULL) {
++      // Call pd.implies(new SecurityPermission("createAccessControlContext"))
++      // in the new wrapper.
++      methodHandle m(THREAD, Universe::protection_domain_implies_method());
++      Handle h_prot(THREAD, prot);
++      JavaValue result(T_BOOLEAN);
++      JavaCallArguments args(h_prot);
++      JavaCalls::call(&result, m, &args, CHECK_false);
++      return (result.get_jboolean() != 0);
++    }
++  }
++  return true;
++}
++
++// Create an AccessControlContext with a protection domain with null codesource
++// and null permissions - which gives no permissions.
++oop create_dummy_access_control_context(TRAPS) {
++  instanceKlassHandle pd_klass (THREAD, SystemDictionary::ProtectionDomain_klass());
++  // new ProtectionDomain(null,null);
++  oop null_protection_domain = pd_klass->allocate_instance(CHECK_NULL);
++  Handle null_pd(THREAD, null_protection_domain);
++
++  // new ProtectionDomain[] {pd};
++  objArrayOop context = oopFactory::new_objArray(pd_klass(), 1, CHECK_NULL);
++  context->obj_at_put(0, null_pd());
++
++  // new AccessControlContext(new ProtectionDomain[] {pd})
++  objArrayHandle h_context(THREAD, context);
++  oop result = java_security_AccessControlContext::create(h_context, false, Handle(), CHECK_NULL);
++  return result;
++}
+ 
+ JVM_ENTRY(jobject, JVM_DoPrivileged(JNIEnv *env, jclass cls, jobject action, jobject context, jboolean wrapException))
+   JVMWrapper("JVM_DoPrivileged");
+@@ -1109,8 +1159,29 @@
+     THROW_MSG_0(vmSymbols::java_lang_NullPointerException(), "Null action");
+   }
+ 
+-  // Stack allocated list of privileged stack elements
+-  PrivilegedElement pi;
++  // Compute the frame initiating the do privileged operation and setup the privileged stack
++  vframeStream vfst(thread);
++  vfst.security_get_caller_frame(1);
++
++  if (vfst.at_end()) {
++    THROW_MSG_0(vmSymbols::java_lang_InternalError(), "no caller?");
++  }
++
++  methodOop method      = vfst.method();
++  instanceKlassHandle klass (THREAD, method->method_holder());
++
++  // Check that action object understands "Object run()"
++  Handle h_context;
++  if (context != NULL) {
++    h_context = Handle(THREAD, JNIHandles::resolve(context));
++    bool authorized = is_authorized(h_context, klass, CHECK_NULL);
++    if (!authorized) {
++      // Create an unprivileged access control object and call it's run function
++      // instead.
++      oop noprivs = create_dummy_access_control_context(CHECK_NULL);
++      h_context = Handle(THREAD, noprivs);
++    }
++  }
+ 
+   // Check that action object understands "Object run()"
+   Handle object (THREAD, JNIHandles::resolve(action));
+@@ -1124,12 +1195,10 @@
+     THROW_MSG_0(vmSymbols::java_lang_InternalError(), "No run method");
+   }
+ 
+-  // Compute the frame initiating the do privileged operation and setup the privileged stack
+-  vframeStream vfst(thread);
+-  vfst.security_get_caller_frame(1);
+-
++  // Stack allocated list of privileged stack elements
++  PrivilegedElement pi;
+   if (!vfst.at_end()) {
+-    pi.initialize(&vfst, JNIHandles::resolve(context), thread->privileged_stack_top(), CHECK_NULL);
++    pi.initialize(&vfst, h_context(), thread->privileged_stack_top(), CHECK_NULL);
+     thread->set_privileged_stack_top(&pi);
+   }
+ 

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8001330-improve_checking_order.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8001330-improve_checking_order.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8001330-improve_checking_order.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,97 @@
+# HG changeset patch
+# User andrew
+# Date 1371238187 -3600
+# Node ID 66880d810dc10655031bfbbb1e4ea6ff66061f08
+# Parent  f2c674e184e04dcd8e39b6ba6f784c75a3553ef5
+8001330: Improve on checking order
+Reviewed-by: acorn, hawtin
+
+diff --git a/src/share/classes/java/security/AccessControlContext.java b/src/share/classes/java/security/AccessControlContext.java
+--- jdk/src/share/classes/java/security/AccessControlContext.java
++++ jdk/src/share/classes/java/security/AccessControlContext.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2011, 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
+@@ -79,7 +79,10 @@
+ public final class AccessControlContext {
+ 
+     private ProtectionDomain context[];
++    // isPrivileged and isAuthorized are referenced by the VM - do not remove
++    // or change their names
+     private boolean isPrivileged;
++    private boolean isAuthorized = false;
+ 
+     // Note: This field is directly used by the virtual machine
+     // native codes. Don't touch it.
+@@ -192,6 +195,7 @@
+         SecurityManager sm = System.getSecurityManager();
+         if (sm != null) {
+             sm.checkPermission(SecurityConstants.CREATE_ACC_PERMISSION);
++            this.isAuthorized = true;
+         }
+ 
+         this.context = acc.context;
+@@ -213,6 +217,7 @@
+             this.context = context.clone();
+         }
+         this.combiner = combiner;
++        this.isAuthorized = true;
+     }
+ 
+     /**
+@@ -220,10 +225,11 @@
+      */
+ 
+     AccessControlContext(ProtectionDomain context[],
+-                                 boolean isPrivileged)
++                         boolean isPrivileged)
+     {
+         this.context = context;
+         this.isPrivileged = isPrivileged;
++        this.isAuthorized = true;
+     }
+ 
+     /**
+@@ -504,7 +510,7 @@
+     }
+ 
+     private AccessControlContext goCombiner(ProtectionDomain[] current,
+-                                        AccessControlContext assigned) {
++                                            AccessControlContext assigned) {
+ 
+         // the assigned ACC's combiner is not null --
+         // let the combiner do its thing
+@@ -526,6 +532,7 @@
+         this.context = combinedPds;
+         this.combiner = assigned.combiner;
+         this.isPrivileged = false;
++        this.isAuthorized = assigned.isAuthorized;
+ 
+         return this;
+     }
+diff --git a/src/share/classes/java/security/ProtectionDomain.java b/src/share/classes/java/security/ProtectionDomain.java
+--- jdk/src/share/classes/java/security/ProtectionDomain.java
++++ jdk/src/share/classes/java/security/ProtectionDomain.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2009, 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
+@@ -246,6 +246,11 @@
+         return false;
+     }
+ 
++    // called by the VM -- do not remove
++    boolean impliesCreateAccessControlContext() {
++        return implies(SecurityConstants.CREATE_ACC_PERMISSION);
++    }
++
+     /**
+      * Convert a ProtectionDomain to a String.
+      */

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8003703-update_rmi_connection_dialog.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8003703-update_rmi_connection_dialog.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8003703-update_rmi_connection_dialog.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,131 @@
+# HG changeset patch
+# User andrew
+# Date 1371238398 -3600
+# Node ID 672b00f8dd800d0b494cde9eb219bd82179c5ff5
+# Parent  66880d810dc10655031bfbbb1e4ea6ff66061f08
+8003703: Update RMI connection dialog box
+Reviewed-by: skoivu, ahgross, mchung, jbachorik
+
+diff --git a/src/share/classes/sun/tools/jconsole/ProxyClient.java b/src/share/classes/sun/tools/jconsole/ProxyClient.java
+--- jdk/src/share/classes/sun/tools/jconsole/ProxyClient.java
++++ jdk/src/share/classes/sun/tools/jconsole/ProxyClient.java
+@@ -309,11 +309,11 @@
+         }
+     }
+ 
+-    void connect() {
++    void connect(boolean requireSSL) {
+         setConnectionState(ConnectionState.CONNECTING);
+         Exception exception = null;
+         try {
+-            tryConnect();
++            tryConnect(requireSSL);
+         } catch (IOException ex) {
+             if (JConsole.isDebug()) {
+                 ex.printStackTrace();
+@@ -333,7 +333,7 @@
+         }
+     }
+ 
+-    private void tryConnect() throws IOException {
++    private void tryConnect(boolean requireRemoteSSL) throws IOException {
+         if (jmxUrl == null && "localhost".equals(hostName) && port == 0) {
+             // Monitor self
+             this.jmxc = null;
+@@ -353,6 +353,10 @@
+                     this.jmxUrl = new JMXServiceURL(lvm.connectorAddress());
+                 }
+             }
++            Map<String, Object> env = new HashMap<String, Object>();
++            if (requireRemoteSSL) {
++                env.put("jmx.remote.x.check.stub", "true");
++            }
+             // Need to pass in credentials ?
+             if (userName == null && password == null) {
+                 if (isVmConnector()) {
+@@ -361,12 +365,11 @@
+                         checkSslConfig();
+                     }
+                     this.jmxc = new RMIConnector(stub, null);
+-                    jmxc.connect();
++                    jmxc.connect(env);
+                 } else {
+-                    this.jmxc = JMXConnectorFactory.connect(jmxUrl);
++                    this.jmxc = JMXConnectorFactory.connect(jmxUrl, env);
+                 }
+             } else {
+-                Map<String, String[]> env = new HashMap<String, String[]>();
+                 env.put(JMXConnector.CREDENTIALS,
+                         new String[] {userName, password});
+                 if (isVmConnector()) {
+diff --git a/src/share/classes/sun/tools/jconsole/VMPanel.java b/src/share/classes/sun/tools/jconsole/VMPanel.java
+--- jdk/src/share/classes/sun/tools/jconsole/VMPanel.java
++++ jdk/src/share/classes/sun/tools/jconsole/VMPanel.java
+@@ -62,6 +62,7 @@
+     private static ArrayList<TabInfo> tabInfos = new ArrayList<TabInfo>();
+ 
+     private boolean wasConnected = false;
++    private boolean shouldUseSSL = true;
+ 
+     // The everConnected flag keeps track of whether the window can be
+     // closed if the user clicks Cancel after a failed connection attempt.
+@@ -295,7 +296,7 @@
+         } else {
+             new Thread("VMPanel.connect") {
+                 public void run() {
+-                    proxyClient.connect();
++                    proxyClient.connect(shouldUseSSL);
+                 }
+             }.start();
+         }
+@@ -472,6 +473,7 @@
+ 
+         final String connectStr   = getText("Connect");
+         final String reconnectStr = getText("Reconnect");
++        final String insecureStr = getText("Insecure");
+         final String cancelStr    = getText("Cancel");
+ 
+         String msgTitle, msgExplanation, buttonStr;
+@@ -481,6 +483,10 @@
+             msgTitle = getText("connectionLost1");
+             msgExplanation = getText("connectionLost2", getConnectionName());
+             buttonStr = reconnectStr;
++        } else if (shouldUseSSL) {
++            msgTitle = getText("connectionFailedSSL1");
++            msgExplanation = getText("connectionFailedSSL2", getConnectionName());
++            buttonStr = insecureStr;
+         } else {
+             msgTitle = getText("connectionFailed1");
+             msgExplanation = getText("connectionFailed2", getConnectionName());
+@@ -503,6 +509,9 @@
+ 
+                     if (value == reconnectStr || value == connectStr) {
+                         connect();
++                    } else if (value == insecureStr) {
++                        shouldUseSSL = false;
++                        connect();
+                     } else if (!everConnected) {
+                         try {
+                             getFrame().setClosed(true);
+diff --git a/src/share/classes/sun/tools/jconsole/resources/JConsoleResources.java b/src/share/classes/sun/tools/jconsole/resources/JConsoleResources.java
+--- jdk/src/share/classes/sun/tools/jconsole/resources/JConsoleResources.java
++++ jdk/src/share/classes/sun/tools/jconsole/resources/JConsoleResources.java
+@@ -212,6 +212,7 @@
+         {"Impact","Impact"},
+         {"Info","Info"},
+         {"INFO","INFO"},
++        {"Insecure", "Insecure connection"},
+         {"Invalid plugin path", "Warning: Invalid plugin path: {0}"},
+         {"Invalid URL", "Invalid URL: {0}"},
+         {"Is","Is"},
+@@ -417,6 +418,10 @@
+         {"connectionFailed1","Connection Failed: Retry?"},
+         {"connectionFailed2","The connection to {0} did not succeed.<br>" +
+                              "Would you like to try again?"},
++        {"connectionFailedSSL1","Secure connection failed. Retry insecurely?"},
++        {"connectionFailedSSL2","The connection to {0} could not be made using SSL.<br>" +
++                             "Would you like to try without SSL?<br>" +
++                             "(Username and password will be sent in plain text.)"},
+         {"connectionLost1","Connection Lost: Reconnect?"},
+         {"connectionLost2","The connection to {0} has been lost " +
+                            "because the remote process has been terminated.<br>" +

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8004584-augment_applet_contextualization.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8004584-augment_applet_contextualization.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8004584-augment_applet_contextualization.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,322 @@
+# HG changeset patch
+# User andrew
+# Date 1371392356 18000
+# Node ID 148e0adac8e895f2cee0d121f0699bb9d4923044
+# Parent  672b00f8dd800d0b494cde9eb219bd82179c5ff5
+8004584: Augment applet contextualization
+Summary: Do not create the main AppContext for applets
+
+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
+@@ -342,27 +342,23 @@
+                 // from the execution stack.
+                 Object ecx = javaAwtAccess.getExecutionContext();
+                 if (ecx == null) {
+-                    // fall back to AppContext.getAppContext()
++                    // fall back to thread group seach of AppContext
+                     ecx = javaAwtAccess.getContext();
+                 }
+-                context = (LoggerContext) javaAwtAccess.get(ecx, LoggerContext.class);
+-                if (context == null) {
+-                    if (javaAwtAccess.isMainAppContext()) {
+-                        context = userContext;
+-                    } else {
+-                        context = new LoggerContext();
+-                        // during initialization, rootLogger is null when
+-                        // instantiating itself RootLogger
+-                        if (manager.rootLogger != null)
+-                            context.addLocalLogger(manager.rootLogger);
++                if (ecx != null) {
++                    context = (LoggerContext)javaAwtAccess.get(ecx, LoggerContext.class);
++                    if (context == null) {
++                        if (javaAwtAccess.isMainAppContext()) {
++                            context = userContext;
++                        } else {
++                            context = new LoggerContext();
++                        }
++                        javaAwtAccess.put(ecx, LoggerContext.class, context);
+                     }
+-                    javaAwtAccess.put(ecx, LoggerContext.class, context);
+                 }
+             }
+-        } else {
+-            context = userContext;
+         }
+-        return context;
++        return context != null ? context : userContext;
+     }
+ 
+     private List<LoggerContext> contexts() {
+@@ -489,9 +485,22 @@
+             return logger;
+         }
+ 
++        synchronized void ensureRootLogger(Logger logger) {
++            if (logger == manager.rootLogger)
++                return;
++
++            // during initialization, rootLogger is null when
++            // instantiating itself RootLogger
++            if (findLogger("") == null && manager.rootLogger != null) {
++                addLocalLogger(manager.rootLogger);
++            }
++        }
++
+         // 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) {
++            ensureRootLogger(logger);
++
+             final String name = logger.getName();
+             if (name == null) {
+                 throw new NullPointerException();
+diff --git a/src/share/classes/sun/applet/AppletSecurity.java b/src/share/classes/sun/applet/AppletSecurity.java
+--- jdk/src/share/classes/sun/applet/AppletSecurity.java
++++ jdk/src/share/classes/sun/applet/AppletSecurity.java
+@@ -52,7 +52,6 @@
+  */
+ public
+ class AppletSecurity extends AWTSecurityManager {
+-    private AppContext mainAppContext;
+ 
+     //URLClassLoader.acc
+     private static Field facc = null;
+@@ -77,7 +76,6 @@
+      */
+     public AppletSecurity() {
+         reset();
+-        mainAppContext = AppContext.getAppContext();
+     }
+ 
+     // Cache to store known restricted packages
+@@ -312,7 +310,7 @@
+         AppContext appContext = AppContext.getAppContext();
+         AppletClassLoader appletClassLoader = currentAppletClassLoader();
+ 
+-        if ((appContext == mainAppContext) && (appletClassLoader != null)) {
++        if (AppContext.isMainContext(appContext) && (appletClassLoader != null)) {
+             // If we're about to allow access to the main EventQueue,
+             // and anything untrusted is on the class context stack,
+             // disallow access.
+diff --git a/src/share/classes/sun/awt/AppContext.java b/src/share/classes/sun/awt/AppContext.java
+--- jdk/src/share/classes/sun/awt/AppContext.java
++++ jdk/src/share/classes/sun/awt/AppContext.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -42,6 +42,7 @@
+ import java.util.HashSet;
+ import java.beans.PropertyChangeSupport;
+ import java.beans.PropertyChangeListener;
++import java.util.concurrent.atomic.AtomicInteger;
+ 
+ /**
+  * The AppContext is a table referenced by ThreadGroup which stores
+@@ -147,8 +148,9 @@
+     }
+ 
+     /* The main "system" AppContext, used by everything not otherwise
+-       contained in another AppContext.
+-     */
++       contained in another AppContext. It is implicitly created for
++       standalone apps only (i.e. not applets)
++    */
+     private static AppContext mainAppContext = null;
+ 
+     /*
+@@ -181,27 +183,6 @@
+     }
+ 
+ 
+-    static {
+-        // On the main Thread, we get the ThreadGroup, make a corresponding
+-        // AppContext, and instantiate the Java EventQueue.  This way, legacy
+-        // code is unaffected by the move to multiple AppContext ability.
+-        AccessController.doPrivileged(new PrivilegedAction() {
+-          public Object run() {
+-            ThreadGroup currentThreadGroup =
+-                                Thread.currentThread().getThreadGroup();
+-            ThreadGroup parentThreadGroup = currentThreadGroup.getParent();
+-            while (parentThreadGroup != null) {
+-                // Find the root ThreadGroup to construct our main AppContext
+-                currentThreadGroup = parentThreadGroup;
+-                parentThreadGroup = currentThreadGroup.getParent();
+-            }
+-            mainAppContext = new AppContext(currentThreadGroup);
+-            numAppContexts = 1;
+-            return mainAppContext;
+-          }
+-        });
+-    }
+-
+     /*
+      * The total number of AppContexts, system-wide.  This number is
+      * incremented at the beginning of the constructor, and decremented
+@@ -209,7 +190,7 @@
+      * number is 1.  If so, it returns the sole AppContext without
+      * checking Thread.currentThread().
+      */
+-    private static int numAppContexts;
++    private static final AtomicInteger numAppContexts = new AtomicInteger(0);
+ 
+     /*
+      * The context ClassLoader that was used to create this AppContext.
+@@ -230,7 +211,7 @@
+      * @since   1.2
+      */
+     AppContext(ThreadGroup threadGroup) {
+-        numAppContexts++;
++        numAppContexts.incrementAndGet();
+ 
+         this.threadGroup = threadGroup;
+         threadGroup2appContext.put(threadGroup, this);
+@@ -245,6 +226,27 @@
+ 
+     private static MostRecentThreadAppContext mostRecentThreadAppContext = null;
+ 
++    private final static void initMainAppContext() {
++        // On the main Thread, we get the ThreadGroup, make a corresponding
++        // AppContext, and instantiate the Java EventQueue.  This way, legacy
++        // code is unaffected by the move to multiple AppContext ability.
++        AccessController.doPrivileged(new PrivilegedAction<Void>() {
++            public Void run() {
++                ThreadGroup currentThreadGroup =
++                        Thread.currentThread().getThreadGroup();
++                ThreadGroup parentThreadGroup = currentThreadGroup.getParent();
++                while (parentThreadGroup != null) {
++                    // Find the root ThreadGroup to construct our main AppContext
++                    currentThreadGroup = parentThreadGroup;
++                    parentThreadGroup = currentThreadGroup.getParent();
++                }
++
++                mainAppContext = SunToolkit.createNewAppContext(currentThreadGroup);
++                return null;
++            }
++        });
++    }
++
+     /**
+      * Returns the appropriate AppContext for the caller,
+      * as determined by its ThreadGroup.  If the main "system" AppContext
+@@ -257,8 +259,10 @@
+      * @since   1.2
+      */
+     public final static AppContext getAppContext() {
+-        if (numAppContexts == 1)   // If there's only one system-wide,
+-            return mainAppContext; // return the main system AppContext.
++        // we are standalone app, return the main app context
++        if (numAppContexts.get() == 1 && mainAppContext != null) {
++            return mainAppContext;
++        }
+ 
+         final Thread currentThread = Thread.currentThread();
+ 
+@@ -284,16 +288,25 @@
+             // when new AppContext objects are created.
+             ThreadGroup currentThreadGroup = currentThread.getThreadGroup();
+             ThreadGroup threadGroup = currentThreadGroup;
++
++                    // Special case: we implicitly create the main app context
++                    // if no contexts have been created yet. This covers standalone apps
++                    // and excludes applets because by the time applet starts
++                    // a number of contexts have already been created by the plugin.
++                    if (numAppContexts.get() == 0) {
++                        // This check is not necessary, its purpose is to help
++                        // Plugin devs to catch all the cases of main AC creation.
++                        if (System.getProperty("javaplugin.version") == null &&
++                                System.getProperty("javawebstart.version") == null) {
++                            initMainAppContext();
++                        }
++                    }
++
+             AppContext context = threadGroup2appContext.get(threadGroup);
+             while (context == null) {
+                 threadGroup = threadGroup.getParent();
+                 if (threadGroup == null) {
+-                    // If we get here, we're running under a ThreadGroup that
+-                    // has no AppContext associated with it.  This should never
+-                    // happen, because createNewContext() should be used by the
+-                    // toolkit to create the ThreadGroup that everything runs
+-                    // under.
+-                    throw new RuntimeException("Invalid ThreadGroup");
++		    return null;
+                 }
+                 context = threadGroup2appContext.get(threadGroup);
+             }
+@@ -303,10 +316,8 @@
+             for (ThreadGroup tg = currentThreadGroup; tg != threadGroup; tg = tg.getParent()) {
+                 threadGroup2appContext.put(tg, context);
+             }
++
+             // Now we're done, so we cache the latest key/value pair.
+-            // (we do this before checking with any AWTSecurityManager, so if
+-            // this Thread equates with the main AppContext in the cache, it
+-            // still will)
+             mostRecentThreadAppContext =
+                 new MostRecentThreadAppContext(currentThread, context);
+ 
+@@ -315,17 +326,17 @@
+          });
+         }
+ 
+-        if (appContext == mainAppContext)  {
+-            // Before we return the main "system" AppContext, check to
+-            // see if there's an AWTSecurityManager installed.  If so,
+-            // allow it to choose the AppContext to return.
+-            AppContext secAppContext = getExecutionAppContext();
+-            if (secAppContext != null) {
+-               appContext = secAppContext; // Return what we're told
+-            }
+-        }
++        return appContext;
++    }
+ 
+-        return appContext;
++    /**
++     * Returns true if the specified AppContext is the main AppContext.
++     *
++     * @param   ctx the context to compare with the main context
++     * @return  true if the specified AppContext is the main AppContext.
++     */
++    public final static boolean isMainContext(AppContext ctx) {
++        return (ctx != null && ctx == mainAppContext);
+     }
+ 
+     private final static AppContext getExecutionAppContext() {
+@@ -500,7 +511,7 @@
+             this.table.clear(); // Clear out the Hashtable to ease garbage collection
+         }
+ 
+-        numAppContexts--;
++        numAppContexts.decrementAndGet();
+ 
+         mostRecentKeyValue = null;
+     }
+@@ -790,7 +801,7 @@
+                 return getAppContext().isDisposed();
+             }
+             public boolean isMainAppContext() {
+-                return (numAppContexts == 1);
++                return (numAppContexts.get() == 1 && mainAppContext != null);
+             }
+             public Object getContext() {
+                 return getAppContext();
+diff --git a/src/share/classes/sun/awt/SunToolkit.java b/src/share/classes/sun/awt/SunToolkit.java
+--- jdk/src/share/classes/sun/awt/SunToolkit.java
++++ jdk/src/share/classes/sun/awt/SunToolkit.java
+@@ -293,6 +293,10 @@
+      */
+     public static AppContext createNewAppContext() {
+         ThreadGroup threadGroup = Thread.currentThread().getThreadGroup();
++        return createNewAppContext(threadGroup);
++    }
++
++    static final AppContext createNewAppContext(ThreadGroup threadGroup) {
+         EventQueue eventQueue;
+         String eqName = System.getProperty("AWT.EventQueueClass",
+                                            "java.awt.EventQueue");

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8005007-better_glyph_processing.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8005007-better_glyph_processing.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8005007-better_glyph_processing.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,118 @@
+# HG changeset patch
+# User prr
+# Date 1364745958 25200
+# Node ID ff15c4e83482223b179baee18be068908c7e2dce
+# Parent  148e0adac8e895f2cee0d121f0699bb9d4923044
+8005007: Better glyph processing
+Reviewed-by: srl, mschoene, bae
+
+diff --git a/src/share/classes/sun/font/ExtendedTextSourceLabel.java b/src/share/classes/sun/font/ExtendedTextSourceLabel.java
+--- jdk/src/share/classes/sun/font/ExtendedTextSourceLabel.java
++++ jdk/src/share/classes/sun/font/ExtendedTextSourceLabel.java
+@@ -366,6 +366,9 @@
+     validate(index);
+     float[] charinfo = getCharinfo();
+     index = l2v(index) * numvals;
++    if ((index+vish) >= charinfo.length) {
++        return new Rectangle2D.Float();
++    }
+     return new Rectangle2D.Float(
+                                  charinfo[index + visx],
+                                  charinfo[index + visy],
+@@ -455,6 +458,10 @@
+     int length = source.getLength();
+     --start;
+     while (width >= 0 && ++start < length) {
++      int cidx = l2v(start) * numvals + advx;
++      if (cidx >= charinfo.length) {
++          break; // layout bailed for some reason
++      }
+       float adv = charinfo[l2v(start) * numvals + advx];
+       width -= adv;
+     }
+@@ -468,7 +475,11 @@
+     float[] charinfo = getCharinfo();
+     --start;
+     while (++start < limit) {
+-      a += charinfo[l2v(start) * numvals + advx];
++      int cidx = l2v(start) * numvals + advx;
++      if (cidx >= charinfo.length) {
++          break; // layout bailed for some reason
++      }
++      a += charinfo[cidx];
+     }
+ 
+     return a;
+diff --git a/src/share/native/sun/font/layout/LEGlyphStorage.cpp b/src/share/native/sun/font/layout/LEGlyphStorage.cpp
+--- jdk/src/share/native/sun/font/layout/LEGlyphStorage.cpp
++++ jdk/src/share/native/sun/font/layout/LEGlyphStorage.cpp
+@@ -584,7 +584,7 @@
+ {
+     le_int32 growAmount = fInsertionList->getGrowAmount();
+ 
+-    if (growAmount == 0) {
++    if (growAmount <= 0) {
+         return fGlyphCount;
+     }
+ 
+@@ -613,7 +613,9 @@
+         fAuxData = (le_uint32 *)newAuxData;
+     }
+ 
+-    fSrcIndex  = fGlyphCount - 1;
++    if (fGlyphCount > 0) {
++       fSrcIndex  = fGlyphCount - 1;
++    }
+     fDestIndex = newGlyphCount - 1;
+ 
+ #if 0
+@@ -653,6 +655,10 @@
+     }
+ #endif
+ 
++    if (atPosition < 0 || fSrcIndex < 0 || fDestIndex < 0) {
++        return FALSE;
++    }
++
+     if (fAuxData != NULL) {
+         le_int32 src = fSrcIndex, dest = fDestIndex;
+ 
+@@ -665,7 +671,7 @@
+         }
+     }
+ 
+-    while (fSrcIndex > atPosition) {
++    while (fSrcIndex > atPosition && fSrcIndex >= 0 && fDestIndex >= 0) {
+         fGlyphs[fDestIndex]      = fGlyphs[fSrcIndex];
+         fCharIndices[fDestIndex] = fCharIndices[fSrcIndex];
+ 
+@@ -673,7 +679,7 @@
+         fSrcIndex  -= 1;
+     }
+ 
+-    for (le_int32 i = count - 1; i >= 0; i -= 1) {
++    for (le_int32 i = count - 1; i >= 0 && fDestIndex >= 0; i -= 1) {
+         fGlyphs[fDestIndex]      = newGlyphs[i];
+         fCharIndices[fDestIndex] = fCharIndices[atPosition];
+ 
+@@ -682,7 +688,7 @@
+ 
+     // the source glyph we're pointing at
+     // just got replaced by the insertion
+-    fSrcIndex -= 1;
++        fSrcIndex -= 1;
+ 
+     return FALSE;
+ }
+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
+@@ -61,7 +61,7 @@
+ 
+         delta = applySubtable(lookupSubtable, lookupType, glyphIterator, fontInstance, success);
+ 
+-        if (delta > 0 && LE_FAILURE(success)) {
++        if (delta > 0 || LE_FAILURE(success)) {
+             return 1;
+         }
+ 

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8006328-6_fixup.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8006328-6_fixup.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8006328-6_fixup.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,31 @@
+# HG changeset patch
+# User andrew
+# Date 1371827929 18000
+# Node ID 9892a997b49abd5ae9a5e1ec8fef1f93631f87ae
+# Parent  059ac6834c32c540ad86b99c0e5339554398def2
+Fix up 8006328
+
+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
+@@ -531,7 +531,7 @@
+      * Also, it has some optimizations regarding sending to the Receivers,
+      * for known Receivers, and managing itself in the TransmitterList.
+      */
+-    class BasicTransmitter implements MidiDeviceTransmitter {
++    class BasicTransmitter implements Transmitter {
+ 
+         private Receiver receiver = null;
+         TransmitterList tlist = null;
+diff --git a/src/share/classes/com/sun/media/sound/AudioFloatFormatConverter.java b/src/share/classes/com/sun/media/sound/AudioFloatFormatConverter.java
+--- jdk/src/share/classes/com/sun/media/sound/AudioFloatFormatConverter.java
++++ jdk/src/share/classes/com/sun/media/sound/AudioFloatFormatConverter.java
+@@ -470,7 +470,7 @@
+ 
+     private final Encoding[] formats = {Encoding.PCM_SIGNED,
+                                         Encoding.PCM_UNSIGNED,
+-                                        Encoding.PCM_FLOAT};
++                                        AudioFloatConverter.PCM_FLOAT};
+ 
+     public AudioInputStream getAudioInputStream(Encoding targetEncoding,
+             AudioInputStream sourceStream) {

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8006328-sound_class_robustness.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8006328-sound_class_robustness.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8006328-sound_class_robustness.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,6937 @@
+# HG changeset patch
+# User andrew
+# Date 1371394319 18000
+# Node ID 5c9fbf7443a24076a6545cb043102cb2527f62ca
+# Parent  ff15c4e83482223b179baee18be068908c7e2dce
+8006328: Improve robustness of sound classes
+8009057: Improve MIDI event handling
+Reviewed-by: amenkov, art, skoivu
+
+diff --git a/src/share/classes/com/sun/media/sound/AbstractDataLine.java b/src/share/classes/com/sun/media/sound/AbstractDataLine.java
+--- jdk/src/share/classes/com/sun/media/sound/AbstractDataLine.java
++++ jdk/src/share/classes/com/sun/media/sound/AbstractDataLine.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
+@@ -25,15 +25,12 @@
+ 
+ package com.sun.media.sound;
+ 
+-import java.util.Vector;
+-
+ import javax.sound.sampled.AudioFormat;
+ import javax.sound.sampled.AudioSystem;
+ import javax.sound.sampled.Control;
+ import javax.sound.sampled.DataLine;
+ import javax.sound.sampled.LineEvent;
+ import javax.sound.sampled.LineUnavailableException;
+-import javax.sound.sampled.Mixer;
+ 
+ 
+ /**
+@@ -46,13 +43,13 @@
+     // DEFAULTS
+ 
+     // default format
+-    protected /*final*/ AudioFormat defaultFormat;
++    private final AudioFormat defaultFormat;
+ 
+     // default buffer size in bytes
+-    protected /*final*/ int defaultBufferSize;
++    private final int defaultBufferSize;
+ 
+     // the lock for synchronization
+-    protected Object lock = new Object();
++    protected final Object lock = new Object();
+ 
+     // STATE
+ 
+@@ -103,7 +100,7 @@
+ 
+     // DATA LINE METHODS
+ 
+-    public void open(AudioFormat format, int bufferSize) throws LineUnavailableException {
++    public final void open(AudioFormat format, int bufferSize) throws LineUnavailableException {
+         //$$fb 2001-10-09: Bug #4517739: avoiding deadlock by synchronizing to mixer !
+         synchronized (mixer) {
+             if (Printer.trace) Printer.trace("> AbstractDataLine.open(format, bufferSize) (class: "+getClass().getName());
+@@ -152,7 +149,7 @@
+     }
+ 
+ 
+-    public void open(AudioFormat format) throws LineUnavailableException {
++    public final void open(AudioFormat format) throws LineUnavailableException {
+         open(format, AudioSystem.NOT_SPECIFIED);
+     }
+ 
+@@ -181,7 +178,7 @@
+     }
+ 
+ 
+-    public void start() {
++    public final void start() {
+         //$$fb 2001-10-09: Bug #4517739: avoiding deadlock by synchronizing to mixer !
+         synchronized(mixer) {
+             if (Printer.trace) Printer.trace("> "+getClass().getName()+".start() - AbstractDataLine");
+@@ -205,7 +202,7 @@
+     }
+ 
+ 
+-    public void stop() {
++    public final void stop() {
+ 
+         //$$fb 2001-10-09: Bug #4517739: avoiding deadlock by synchronizing to mixer !
+         synchronized(mixer) {
+@@ -249,16 +246,16 @@
+     // in MixerSourceLine and MixerClip, and I want to touch as little
+     // code as possible to change isStarted() back to isRunning().
+ 
+-    public boolean isRunning() {
++    public final boolean isRunning() {
+         return started;
+     }
+ 
+-    public boolean isActive() {
++    public final boolean isActive() {
+         return active;
+     }
+ 
+ 
+-    public long getMicrosecondPosition() {
++    public final long getMicrosecondPosition() {
+ 
+         long microseconds = getLongFramePosition();
+         if (microseconds != AudioSystem.NOT_SPECIFIED) {
+@@ -268,26 +265,26 @@
+     }
+ 
+ 
+-    public AudioFormat getFormat() {
++    public final AudioFormat getFormat() {
+         return format;
+     }
+ 
+ 
+-    public int getBufferSize() {
++    public final int getBufferSize() {
+         return bufferSize;
+     }
+ 
+     /**
+      * This implementation does NOT change the buffer size
+      */
+-    public int setBufferSize(int newSize) {
++    public final int setBufferSize(int newSize) {
+         return getBufferSize();
+     }
+ 
+     /**
+      * This implementation returns AudioSystem.NOT_SPECIFIED.
+      */
+-    public float getLevel() {
++    public final float getLevel() {
+         return (float)AudioSystem.NOT_SPECIFIED;
+     }
+ 
+@@ -304,7 +301,7 @@
+     // it to isStartedRunning().  This is part of backing out the
+     // change denied in RFE 4297981.
+ 
+-    protected boolean isStartedRunning() {
++    final boolean isStartedRunning() {
+         return running;
+     }
+ 
+@@ -312,7 +309,7 @@
+      * This method sets the active state and generates
+      * events if it changes.
+      */
+-    protected void setActive(boolean active) {
++    final void setActive(boolean active) {
+ 
+         if (Printer.trace) Printer.trace("> AbstractDataLine: setActive(" + active + ")");
+ 
+@@ -351,7 +348,7 @@
+      * This method sets the started state and generates
+      * events if it changes.
+      */
+-    protected void setStarted(boolean started) {
++    final void setStarted(boolean started) {
+ 
+         if (Printer.trace) Printer.trace("> AbstractDataLine: setStarted(" + started + ")");
+ 
+@@ -388,7 +385,7 @@
+      * This method generates a STOP event and sets the started state to false.
+      * It is here for historic reasons when an EOM event existed.
+      */
+-    protected void setEOM() {
++    final void setEOM() {
+ 
+         if (Printer.trace) Printer.trace("> AbstractDataLine: setEOM()");
+         //$$fb 2002-04-21: sometimes, 2 STOP events are generated.
+@@ -408,7 +405,7 @@
+      * line is open, this should return quietly because the values
+      * requested will match the current ones.
+      */
+-    public void open() throws LineUnavailableException {
++    public final void open() throws LineUnavailableException {
+ 
+         if (Printer.trace) Printer.trace("> "+getClass().getName()+".open() - AbstractDataLine");
+ 
+@@ -422,7 +419,7 @@
+      * This should also stop the line.  The closed line should not be running or active.
+      * After we close the line, we reset the format and buffer size to the defaults.
+      */
+-    public void close() {
++    public final void close() {
+         //$$fb 2001-10-09: Bug #4517739: avoiding deadlock by synchronizing to mixer !
+         synchronized (mixer) {
+             if (Printer.trace) Printer.trace("> "+getClass().getName()+".close() - in AbstractDataLine.");
+diff --git a/src/share/classes/com/sun/media/sound/AbstractLine.java b/src/share/classes/com/sun/media/sound/AbstractLine.java
+--- jdk/src/share/classes/com/sun/media/sound/AbstractLine.java
++++ jdk/src/share/classes/com/sun/media/sound/AbstractLine.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
+@@ -25,11 +25,12 @@
+ 
+ package com.sun.media.sound;
+ 
++import java.util.Map;
+ import java.util.Vector;
++import java.util.WeakHashMap;
+ 
+ import javax.sound.sampled.AudioSystem;
+ import javax.sound.sampled.Control;
+-import javax.sound.sampled.Mixer;
+ import javax.sound.sampled.Line;
+ import javax.sound.sampled.LineEvent;
+ import javax.sound.sampled.LineListener;
+@@ -43,28 +44,17 @@
+  */
+ abstract class AbstractLine implements Line {
+ 
+-    protected Line.Info info;
++    protected final Line.Info info;
+     protected Control[] controls;
+-    protected AbstractMixer mixer;
++    AbstractMixer mixer;
+     private boolean open     = false;
+-    private Vector listeners = new Vector();
++    private final Vector listeners = new Vector();
+ 
+     /**
+-     * Global event thread
++     * Contains event dispatcher per thread group.
+      */
+-    private static final EventDispatcher eventDispatcher;
+-
+-    static {
+-        // create and start the global event thread
+-
+-        // $$kk: 12.21.98:
+-        // 1) probably don't want a single global event queue
+-        // 2) need a way to stop this thread when the engine is done
+-
+-        eventDispatcher = new EventDispatcher();
+-        eventDispatcher.start();
+-    }
+-
++    private static final Map<ThreadGroup, EventDispatcher> dispatchers =
++            new WeakHashMap<>();
+ 
+     /**
+      * Constructs a new AbstractLine.
+@@ -85,18 +75,17 @@
+ 
+     // LINE METHODS
+ 
+-    public Line.Info getLineInfo() {
++    public final Line.Info getLineInfo() {
+         return info;
+     }
+ 
+ 
+-    public boolean isOpen() {
++    public final boolean isOpen() {
+         return open;
+     }
+ 
+ 
+-    public void addLineListener(LineListener listener) {
+-
++    public final void addLineListener(LineListener listener) {
+         synchronized(listeners) {
+             if ( ! (listeners.contains(listener)) ) {
+                 listeners.addElement(listener);
+@@ -109,7 +98,7 @@
+      * Removes an audio listener.
+      * @param listener listener to remove
+      */
+-    public void removeLineListener(LineListener listener) {
++    public final void removeLineListener(LineListener listener) {
+         listeners.removeElement(listener);
+     }
+ 
+@@ -120,8 +109,7 @@
+      * array of length 0.
+      * @return control set
+      */
+-    public Control[] getControls() {
+-
++    public final Control[] getControls() {
+         Control[] returnedArray = new Control[controls.length];
+ 
+         for (int i = 0; i < controls.length; i++) {
+@@ -132,8 +120,7 @@
+     }
+ 
+ 
+-    public boolean isControlSupported(Control.Type controlType) {
+-
++    public final boolean isControlSupported(Control.Type controlType) {
+         // protect against a NullPointerException
+         if (controlType == null) {
+             return false;
+@@ -149,8 +136,7 @@
+     }
+ 
+ 
+-    public Control getControl(Control.Type controlType) {
+-
++    public final Control getControl(Control.Type controlType) {
+         // protect against a NullPointerException
+         if (controlType != null) {
+ 
+@@ -172,7 +158,7 @@
+      * This method sets the open state and generates
+      * events if it changes.
+      */
+-    protected void setOpen(boolean open) {
++    final void setOpen(boolean open) {
+ 
+         if (Printer.trace) Printer.trace("> "+getClass().getName()+" (AbstractLine): setOpen(" + open + ")  this.open: " + this.open);
+ 
+@@ -200,8 +186,8 @@
+     /**
+      * Send line events.
+      */
+-    protected void sendEvents(LineEvent event) {
+-        eventDispatcher.sendAudioEvents(event, listeners);
++    final void sendEvents(LineEvent event) {
++        getEventDispatcher().sendAudioEvents(event, listeners);
+     }
+ 
+ 
+@@ -227,12 +213,23 @@
+     // $$kk: 06.03.99: returns the mixer used in construction.
+     // this is a hold-over from when there was a public method like
+     // this on line and should be fixed!!
+-    protected AbstractMixer getMixer() {
++    final AbstractMixer getMixer() {
+         return mixer;
+     }
+ 
+-    protected EventDispatcher getEventDispatcher() {
+-        return eventDispatcher;
++    final EventDispatcher getEventDispatcher() {
++        // create and start the global event thread
++        //TODO  need a way to stop this thread when the engine is done
++        final ThreadGroup tg = Thread.currentThread().getThreadGroup();
++        synchronized (dispatchers) {
++            EventDispatcher eventDispatcher = dispatchers.get(tg);
++            if (eventDispatcher == null) {
++                eventDispatcher = new EventDispatcher();
++                dispatchers.put(tg, eventDispatcher);
++                eventDispatcher.start();
++            }
++            return eventDispatcher;
++        }
+     }
+ 
+     // ABSTRACT METHODS
+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
+@@ -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
+@@ -60,12 +60,12 @@
+ 
+     // DEVICE ATTRIBUTES
+ 
+-    private MidiDevice.Info info;
++    private final MidiDevice.Info info;
+ 
+ 
+     // DEVICE STATE
+ 
+-    protected /*private*/ boolean open          = false;
++    private boolean open          = false;
+     private int openRefCount;
+ 
+     /** List of Receivers and Transmitters that opened the device implicitely.
+@@ -102,7 +102,7 @@
+ 
+     // MIDI DEVICE METHODS
+ 
+-    public MidiDevice.Info getDeviceInfo() {
++    public final MidiDevice.Info getDeviceInfo() {
+         return info;
+     }
+ 
+@@ -111,7 +111,7 @@
+      * opened the the device implicitly from closing it. The only way to close the device after
+      * this call is a call to close().
+      */
+-    public void open() throws MidiUnavailableException {
++    public final void open() throws MidiUnavailableException {
+         if (Printer.trace) Printer.trace("> AbstractMidiDevice: open()");
+         synchronized(this) {
+             openRefCount = -1;
+@@ -159,7 +159,7 @@
+     }
+ 
+ 
+-    public void close() {
++    public final void close() {
+         if (Printer.trace) Printer.trace("> AbstractMidiDevice: close()");
+         synchronized (this) {
+             doClose();
+@@ -181,7 +181,7 @@
+      * @param object The object that might have been opening the device implicitely (for now,
+      * this may be a Transmitter or receiver).
+      */
+-    public void closeInternal(Object object) {
++    public final void closeInternal(Object object) {
+         if (Printer.trace) Printer.trace("> AbstractMidiDevice: closeInternal()");
+         synchronized(this) {
+             if (getOpenKeepingObjects().remove(object)) {
+@@ -197,7 +197,7 @@
+     }
+ 
+ 
+-    public void doClose() {
++    public final void doClose() {
+         if (Printer.trace) Printer.trace("> AbstractMidiDevice: doClose()");
+         synchronized(this) {
+             if (isOpen()) {
+@@ -209,7 +209,7 @@
+     }
+ 
+ 
+-    public boolean isOpen() {
++    public final boolean isOpen() {
+         return open;
+     }
+ 
+@@ -329,7 +329,7 @@
+ 
+     // HELPER METHODS
+ 
+-    long getId() {
++    final long getId() {
+         return id;
+     }
+ 
+@@ -339,7 +339,8 @@
+     /** Retrieve a Receiver and open the device implicitly.
+         This method is called by MidiSystem.getReceiver().
+      */
+-    public Receiver getReceiverReferenceCounting() throws MidiUnavailableException {
++    public final Receiver getReceiverReferenceCounting()
++            throws MidiUnavailableException {
+         /* Keep this order of commands! If getReceiver() throws an exception,
+            openInternal() should not be called!
+         */
+@@ -355,7 +356,8 @@
+     /** Retrieve a Transmitter and open the device implicitly.
+         This method is called by MidiSystem.getTransmitter().
+      */
+-    public Transmitter getTransmitterReferenceCounting() throws MidiUnavailableException {
++    public final Transmitter getTransmitterReferenceCounting()
++            throws MidiUnavailableException {
+         /* Keep this order of commands! If getTransmitter() throws an exception,
+            openInternal() should not be called!
+         */
+@@ -422,7 +424,7 @@
+ 
+     /** Return the internal list of Transmitters, possibly creating it first.
+      */
+-    protected TransmitterList getTransmitterList() {
++    final TransmitterList getTransmitterList() {
+         synchronized (traRecLock) {
+             if (transmitterList == null) {
+                 transmitterList = new TransmitterList();
+@@ -462,7 +464,7 @@
+     /**
+      * close this device if discarded by the garbage collector
+      */
+-    protected void finalize() {
++    protected final void finalize() {
+         close();
+     }
+ 
+@@ -529,7 +531,7 @@
+      * Also, it has some optimizations regarding sending to the Receivers,
+      * for known Receivers, and managing itself in the TransmitterList.
+      */
+-    protected class BasicTransmitter implements Transmitter {
++    class BasicTransmitter implements MidiDeviceTransmitter {
+ 
+         private Receiver receiver = null;
+         TransmitterList tlist = null;
+@@ -541,7 +543,7 @@
+             this.tlist = tlist;
+         }
+ 
+-        public void setReceiver(Receiver receiver) {
++        public final void setReceiver(Receiver receiver) {
+             if (tlist != null && this.receiver != receiver) {
+                 if (Printer.debug) Printer.debug("Transmitter "+toString()+": set receiver "+receiver);
+                 tlist.receiverChanged(this, this.receiver, receiver);
+@@ -549,7 +551,7 @@
+             }
+         }
+ 
+-        public Receiver getReceiver() {
++        public final Receiver getReceiver() {
+             return receiver;
+         }
+ 
+@@ -559,7 +561,7 @@
+          * Therefore, subclasses that override this method must call
+          * 'super.close()'.
+          */
+-        public void close() {
++        public final void close() {
+             AbstractMidiDevice.this.closeInternal(this);
+             if (tlist != null) {
+                 tlist.receiverChanged(this, this.receiver, null);
+@@ -575,9 +577,9 @@
+     /**
+      * a class to manage a list of transmitters
+      */
+-    class TransmitterList {
++    final class TransmitterList {
+ 
+-        private ArrayList<Transmitter> transmitters = new ArrayList<Transmitter>();
++        private final ArrayList<Transmitter> transmitters = new ArrayList<Transmitter>();
+         private MidiOutDevice.MidiOutReceiver midiOutReceiver;
+ 
+         // how many transmitters must be present for optimized
+diff --git a/src/share/classes/com/sun/media/sound/AbstractMidiDeviceProvider.java b/src/share/classes/com/sun/media/sound/AbstractMidiDeviceProvider.java
+--- jdk/src/share/classes/com/sun/media/sound/AbstractMidiDeviceProvider.java
++++ jdk/src/share/classes/com/sun/media/sound/AbstractMidiDeviceProvider.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
+@@ -36,7 +36,7 @@
+  */
+ public abstract class AbstractMidiDeviceProvider extends MidiDeviceProvider {
+ 
+-    private static boolean enabled;
++    private static final boolean enabled;
+ 
+     /**
+      * Create objects representing all MIDI output devices on the system.
+@@ -52,7 +52,7 @@
+     }
+ 
+ 
+-    synchronized void readDeviceInfos() {
++    final synchronized void readDeviceInfos() {
+         Info[] infos = getInfoCache();
+         MidiDevice[] devices = getDeviceCache();
+         if (!enabled) {
+@@ -118,7 +118,7 @@
+     }
+ 
+ 
+-    public MidiDevice.Info[] getDeviceInfo() {
++    public final MidiDevice.Info[] getDeviceInfo() {
+         readDeviceInfos();
+         Info[] infos = getInfoCache();
+         MidiDevice.Info[] localArray = new MidiDevice.Info[infos.length];
+@@ -127,7 +127,7 @@
+     }
+ 
+ 
+-    public MidiDevice getDevice(MidiDevice.Info info) {
++    public final MidiDevice getDevice(MidiDevice.Info info) {
+         if (info instanceof Info) {
+             readDeviceInfos();
+             MidiDevice[] devices = getDeviceCache();
+@@ -164,7 +164,7 @@
+             this.index = index;
+         }
+ 
+-        boolean equalStrings(Info info) {
++        final boolean equalStrings(Info info) {
+             return      (info != null
+                          && getName().equals(info.getName())
+                          && getVendor().equals(info.getVendor())
+@@ -172,11 +172,11 @@
+                          && getVersion().equals(info.getVersion()));
+         }
+ 
+-        int getIndex() {
++        final int getIndex() {
+             return index;
+         }
+ 
+-        void setIndex(int index) {
++        final void setIndex(int index) {
+             this.index = index;
+         }
+ 
+diff --git a/src/share/classes/com/sun/media/sound/AbstractMixer.java b/src/share/classes/com/sun/media/sound/AbstractMixer.java
+--- jdk/src/share/classes/com/sun/media/sound/AbstractMixer.java
++++ jdk/src/share/classes/com/sun/media/sound/AbstractMixer.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
+@@ -27,14 +27,9 @@
+ 
+ import java.util.Vector;
+ 
+-import javax.sound.sampled.AudioFormat;
+-import javax.sound.sampled.AudioSystem;
+ import javax.sound.sampled.Control;
+-import javax.sound.sampled.DataLine;
+ import javax.sound.sampled.Mixer;
+ import javax.sound.sampled.Line;
+-import javax.sound.sampled.LineEvent;
+-import javax.sound.sampled.LineListener;
+ import javax.sound.sampled.LineUnavailableException;
+ 
+ /**
+@@ -95,13 +90,13 @@
+     /**
+      * Source lines (ports) currently open
+      */
+-    protected Vector sourceLines = new Vector();
++    private final Vector sourceLines = new Vector();
+ 
+ 
+     /**
+      * Target lines currently open.
+      */
+-    protected Vector targetLines = new Vector();
++    private final Vector targetLines = new Vector();
+ 
+ 
+     /**
+@@ -133,19 +128,19 @@
+     // MIXER METHODS
+ 
+ 
+-    public Mixer.Info getMixerInfo() {
++    public final Mixer.Info getMixerInfo() {
+         return mixerInfo;
+     }
+ 
+ 
+-    public Line.Info[] getSourceLineInfo() {
++    public final Line.Info[] getSourceLineInfo() {
+         Line.Info[] localArray = new Line.Info[sourceLineInfo.length];
+         System.arraycopy(sourceLineInfo, 0, localArray, 0, sourceLineInfo.length);
+         return localArray;
+     }
+ 
+ 
+-    public Line.Info[] getTargetLineInfo() {
++    public final Line.Info[] getTargetLineInfo() {
+ 
+         Line.Info[] localArray = new Line.Info[targetLineInfo.length];
+         System.arraycopy(targetLineInfo, 0, localArray, 0, targetLineInfo.length);
+@@ -153,7 +148,7 @@
+     }
+ 
+ 
+-    public Line.Info[] getSourceLineInfo(Line.Info info) {
++    public final Line.Info[] getSourceLineInfo(Line.Info info) {
+ 
+         int i;
+         Vector vec = new Vector();
+@@ -174,7 +169,7 @@
+     }
+ 
+ 
+-    public Line.Info[] getTargetLineInfo(Line.Info info) {
++    public final Line.Info[] getTargetLineInfo(Line.Info info) {
+ 
+         int i;
+         Vector vec = new Vector();
+@@ -195,7 +190,7 @@
+     }
+ 
+ 
+-    public boolean isLineSupported(Line.Info info) {
++    public final boolean isLineSupported(Line.Info info) {
+ 
+         int i;
+ 
+@@ -227,7 +222,7 @@
+     protected abstract void implClose();
+ 
+ 
+-    public Line[] getSourceLines() {
++    public final Line[] getSourceLines() {
+ 
+         Line[] localLines;
+ 
+@@ -244,7 +239,7 @@
+     }
+ 
+ 
+-    public Line[] getTargetLines() {
++    public final Line[] getTargetLines() {
+ 
+         Line[] localLines;
+ 
+@@ -264,7 +259,7 @@
+     /**
+      * Default implementation always throws an exception.
+      */
+-    public void synchronize(Line[] lines, boolean maintainSync) {
++    public final void synchronize(Line[] lines, boolean maintainSync) {
+         throw new IllegalArgumentException("Synchronization not supported by this mixer.");
+     }
+ 
+@@ -272,7 +267,7 @@
+     /**
+      * Default implementation always throws an exception.
+      */
+-    public void unsynchronize(Line[] lines) {
++    public final void unsynchronize(Line[] lines) {
+         throw new IllegalArgumentException("Synchronization not supported by this mixer.");
+     }
+ 
+@@ -280,7 +275,8 @@
+     /**
+      * Default implementation always returns false.
+      */
+-    public boolean isSynchronizationSupported(Line[] lines, boolean maintainSync) {
++    public final boolean isSynchronizationSupported(Line[] lines,
++                                                    boolean maintainSync) {
+         return false;
+     }
+ 
+@@ -290,14 +286,14 @@
+     /**
+      * This implementation tries to open the mixer with its current format and buffer size settings.
+      */
+-    public synchronized void open() throws LineUnavailableException {
++    public final synchronized void open() throws LineUnavailableException {
+         open(true);
+     }
+ 
+     /**
+      * This implementation tries to open the mixer with its current format and buffer size settings.
+      */
+-    protected synchronized void open(boolean manual) throws LineUnavailableException {
++    final synchronized void open(boolean manual) throws LineUnavailableException {
+         if (Printer.trace) Printer.trace(">> AbstractMixer: open()");
+         if (!isOpen()) {
+             implOpen();
+@@ -322,7 +318,7 @@
+      * The mixer may be opened at a format different than the line's
+      * format if it is a DataLine.
+      */
+-    protected synchronized void open(Line line) throws LineUnavailableException {
++    final synchronized void open(Line line) throws LineUnavailableException {
+ 
+         if (Printer.trace) Printer.trace(">> AbstractMixer: open(line = " + line + ")");
+ 
+@@ -367,7 +363,7 @@
+      * open target lines, if it exists in either.
+      * If the list is now empty, closes the mixer.
+      */
+-    protected synchronized void close(Line line) {
++    final synchronized void close(Line line) {
+ 
+         if (Printer.trace) Printer.trace(">> AbstractMixer: close(" + line + ")");
+ 
+@@ -396,7 +392,7 @@
+     /**
+      * Close all lines and then close this mixer.
+      */
+-    public synchronized void close() {
++    public final synchronized void close() {
+         if (Printer.trace) Printer.trace(">> AbstractMixer: close()");
+         if (isOpen()) {
+             // close all source lines
+@@ -423,7 +419,7 @@
+     /**
+      * Starts the mixer.
+      */
+-    protected synchronized void start(Line line) {
++    final synchronized void start(Line line) {
+ 
+         if (Printer.trace) Printer.trace(">> AbstractMixer: start(" + line + ")");
+ 
+@@ -447,7 +443,7 @@
+     /**
+      * Stops the mixer if this was the last running line.
+      */
+-    protected synchronized void stop(Line line) {
++    final synchronized void stop(Line line) {
+ 
+         if (Printer.trace) Printer.trace(">> AbstractMixer: stop(" + line + ")");
+ 
+@@ -501,7 +497,7 @@
+      * Right now this just checks whether it's supported, but should
+      * check whether it actually belongs to this mixer....
+      */
+-    boolean isSourceLine(Line.Info info) {
++    final boolean isSourceLine(Line.Info info) {
+ 
+         for (int i = 0; i < sourceLineInfo.length; i++) {
+             if (info.matches(sourceLineInfo[i])) {
+@@ -518,7 +514,7 @@
+      * Right now this just checks whether it's supported, but should
+      * check whether it actually belongs to this mixer....
+      */
+-    boolean isTargetLine(Line.Info info) {
++    final boolean isTargetLine(Line.Info info) {
+ 
+         for (int i = 0; i < targetLineInfo.length; i++) {
+             if (info.matches(targetLineInfo[i])) {
+@@ -535,7 +531,7 @@
+      * matches the one specified, or null if no matching Line.Info
+      * object is found.
+      */
+-    Line.Info getLineInfo(Line.Info info) {
++    final Line.Info getLineInfo(Line.Info info) {
+         if (info == null) {
+             return null;
+         }
+diff --git a/src/share/classes/com/sun/media/sound/AiffFileFormat.java b/src/share/classes/com/sun/media/sound/AiffFileFormat.java
+--- jdk/src/share/classes/com/sun/media/sound/AiffFileFormat.java
++++ jdk/src/share/classes/com/sun/media/sound/AiffFileFormat.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
+@@ -35,7 +35,7 @@
+  * @author Jan Borgersen
+  */
+ 
+-class AiffFileFormat extends AudioFileFormat {
++final class AiffFileFormat extends AudioFileFormat {
+ 
+     static final int AIFF_MAGIC         = 1179603533;
+ 
+@@ -62,13 +62,13 @@
+     //$$fb 2001-07-13: added management of header size in this class
+ 
+     /** header size in bytes */
+-    private int headerSize=AIFF_HEADERSIZE;
++    private final int headerSize=AIFF_HEADERSIZE;
+ 
+     /** comm chunk size in bytes, inclusive magic and length field */
+-    private int commChunkSize=26;
++    private final int commChunkSize=26;
+ 
+     /** FVER chunk size in bytes, inclusive magic and length field */
+-    private int fverChunkSize=0;
++    private final int fverChunkSize=0;
+ 
+     AiffFileFormat( AudioFileFormat aff ) {
+         this( aff.getType(), aff.getByteLength(), aff.getFormat(), aff.getFrameLength() );
+diff --git a/src/share/classes/com/sun/media/sound/AiffFileReader.java b/src/share/classes/com/sun/media/sound/AiffFileReader.java
+--- jdk/src/share/classes/com/sun/media/sound/AiffFileReader.java
++++ jdk/src/share/classes/com/sun/media/sound/AiffFileReader.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
+@@ -25,28 +25,17 @@
+ 
+ package com.sun.media.sound;
+ 
+-import java.util.Vector;
++import java.io.DataInputStream;
++import java.io.DataOutputStream;
+ import java.io.File;
++import java.io.FileInputStream;
++import java.io.IOException;
+ import java.io.InputStream;
+-import java.io.OutputStream;
+-import java.io.IOException;
+-import java.io.EOFException;
+ import java.net.URL;
+-import java.net.MalformedURLException;
+-
+-import java.io.BufferedInputStream;
+-import java.io.BufferedOutputStream;
+-import java.io.DataInputStream;
+-import java.io.FileInputStream;
+-import java.io.DataOutputStream;
+-import java.io.FileOutputStream;
+-import java.io.ByteArrayInputStream;
+-import java.io.ByteArrayOutputStream;
+-import java.io.SequenceInputStream;
+ 
+ import javax.sound.sampled.AudioFileFormat;
++import javax.sound.sampled.AudioFormat;
+ import javax.sound.sampled.AudioInputStream;
+-import javax.sound.sampled.AudioFormat;
+ import javax.sound.sampled.AudioSystem;
+ import javax.sound.sampled.UnsupportedAudioFileException;
+ 
+@@ -58,19 +47,10 @@
+  * @author Jan Borgersen
+  * @author Florian Bomers
+  */
+-public class AiffFileReader extends SunFileReader  {
++public final class AiffFileReader extends SunFileReader {
+ 
+     private static final int MAX_READ_LENGTH = 8;
+ 
+-
+-    /**
+-     * AIFF parser type
+-     */
+-    public static final AudioFileFormat.Type types[] = {
+-        AudioFileFormat.Type.AIFF
+-    };
+-
+-
+     /**
+      * Constructs a new AiffParser object.
+      */
+diff --git a/src/share/classes/com/sun/media/sound/AiffFileWriter.java b/src/share/classes/com/sun/media/sound/AiffFileWriter.java
+--- jdk/src/share/classes/com/sun/media/sound/AiffFileWriter.java
++++ jdk/src/share/classes/com/sun/media/sound/AiffFileWriter.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
+@@ -52,21 +52,13 @@
+  *
+  * @author Jan Borgersen
+  */
+-public class AiffFileWriter extends SunFileWriter {
+-
+-    /**
+-     * AIFF type
+-     */
+-    private static final AudioFileFormat.Type aiffTypes[] = {
+-        AudioFileFormat.Type.AIFF
+-    };
+-
++public final class AiffFileWriter extends SunFileWriter {
+ 
+     /**
+      * Constructs a new AiffFileWriter object.
+      */
+     public AiffFileWriter() {
+-        super(aiffTypes);
++        super(new AudioFileFormat.Type[]{AudioFileFormat.Type.AIFF});
+     }
+ 
+ 
+diff --git a/src/share/classes/com/sun/media/sound/AlawCodec.java b/src/share/classes/com/sun/media/sound/AlawCodec.java
+--- jdk/src/share/classes/com/sun/media/sound/AlawCodec.java
++++ jdk/src/share/classes/com/sun/media/sound/AlawCodec.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
+@@ -25,14 +25,12 @@
+ 
+ package com.sun.media.sound;
+ 
+-import java.io.InputStream;
+ import java.io.IOException;
+-
+ import java.util.Vector;
+ 
+ import javax.sound.sampled.AudioFormat;
++import javax.sound.sampled.AudioInputStream;
+ import javax.sound.sampled.AudioSystem;
+-import javax.sound.sampled.AudioInputStream;
+ 
+ 
+ /**
+@@ -40,12 +38,12 @@
+  *
+  * @author Kara Kytle
+  */
+-public class AlawCodec extends SunCodec {
++public final class AlawCodec extends SunCodec {
+ 
+     /* Tables used for A-law decoding */
+ 
+-    final static byte ALAW_TABH[] = new byte[256];
+-    final static byte ALAW_TABL[] = new byte[256];
++    private static final byte[] ALAW_TABH = new byte[256];
++    private static final byte[] ALAW_TABL = new byte[256];
+ 
+     private static final AudioFormat.Encoding[] alawEncodings = { AudioFormat.Encoding.ALAW, AudioFormat.Encoding.PCM_SIGNED };
+ 
+@@ -262,7 +260,7 @@
+     }
+ 
+ 
+-    class AlawCodecStream extends AudioInputStream {
++    final class AlawCodecStream extends AudioInputStream {
+ 
+         /**
+          * True to encode to a-law, false to decode to linear
+diff --git a/src/share/classes/com/sun/media/sound/AuFileFormat.java b/src/share/classes/com/sun/media/sound/AuFileFormat.java
+--- jdk/src/share/classes/com/sun/media/sound/AuFileFormat.java
++++ jdk/src/share/classes/com/sun/media/sound/AuFileFormat.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
+@@ -36,7 +36,7 @@
+  * @author Jan Borgersen
+  */
+ 
+-class AuFileFormat extends AudioFileFormat {
++final class AuFileFormat extends AudioFileFormat {
+ 
+     // magic numbers
+     static final int AU_SUN_MAGIC =     0x2e736e64;
+@@ -60,7 +60,7 @@
+ 
+     static final int AU_HEADERSIZE       = 24;
+ 
+-    int auType;
++    private int auType;
+ 
+     AuFileFormat( AudioFileFormat aff ) {
+ 
+diff --git a/src/share/classes/com/sun/media/sound/AuFileReader.java b/src/share/classes/com/sun/media/sound/AuFileReader.java
+--- jdk/src/share/classes/com/sun/media/sound/AuFileReader.java
++++ jdk/src/share/classes/com/sun/media/sound/AuFileReader.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
+@@ -25,28 +25,17 @@
+ 
+ package com.sun.media.sound;
+ 
+-import java.util.Vector;
++import java.io.BufferedInputStream;
++import java.io.DataInputStream;
+ import java.io.File;
++import java.io.FileInputStream;
++import java.io.IOException;
+ import java.io.InputStream;
+-import java.io.OutputStream;
+-import java.io.IOException;
+-import java.io.EOFException;
+ import java.net.URL;
+-import java.net.MalformedURLException;
+-
+-import java.io.BufferedInputStream;
+-import java.io.BufferedOutputStream;
+-import java.io.DataInputStream;
+-import java.io.FileInputStream;
+-import java.io.DataOutputStream;
+-import java.io.FileOutputStream;
+-import java.io.ByteArrayInputStream;
+-import java.io.ByteArrayOutputStream;
+-import java.io.SequenceInputStream;
+ 
+ import javax.sound.sampled.AudioFileFormat;
++import javax.sound.sampled.AudioFormat;
+ import javax.sound.sampled.AudioInputStream;
+-import javax.sound.sampled.AudioFormat;
+ import javax.sound.sampled.AudioSystem;
+ import javax.sound.sampled.UnsupportedAudioFileException;
+ 
+@@ -58,16 +47,7 @@
+  * @author Jan Borgersen
+  * @author Florian Bomers
+  */
+-public class AuFileReader extends SunFileReader {
+-
+-    /**
+-     * AU reader type
+-     */
+-
+-    public static final AudioFileFormat.Type types[] = {
+-        AudioFileFormat.Type.AU
+-    };
+-
++public final class AuFileReader extends SunFileReader {
+ 
+     /**
+      * Constructs a new AuFileReader object.
+diff --git a/src/share/classes/com/sun/media/sound/AuFileWriter.java b/src/share/classes/com/sun/media/sound/AuFileWriter.java
+--- jdk/src/share/classes/com/sun/media/sound/AuFileWriter.java
++++ jdk/src/share/classes/com/sun/media/sound/AuFileWriter.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
+@@ -51,28 +51,18 @@
+  *
+  * @author Jan Borgersen
+  */
+-public class AuFileWriter extends SunFileWriter {
++public final class AuFileWriter extends SunFileWriter {
+ 
+     //$$fb value for length field if length is not known
+     public final static int UNKNOWN_SIZE=-1;
+ 
+     /**
+-     * AU type
+-     */
+-    private static final AudioFileFormat.Type auTypes[] = {
+-        AudioFileFormat.Type.AU
+-    };
+-
+-
+-    /**
+      * Constructs a new AuFileWriter object.
+      */
+     public AuFileWriter() {
+-        super(auTypes);
++        super(new AudioFileFormat.Type[]{AudioFileFormat.Type.AU});
+     }
+ 
+-
+-
+     public AudioFileFormat.Type[] getAudioFileTypes(AudioInputStream stream) {
+ 
+         AudioFileFormat.Type[] filetypes = new AudioFileFormat.Type[types.length];
+diff --git a/src/share/classes/com/sun/media/sound/AudioFileSoundbankReader.java b/src/share/classes/com/sun/media/sound/AudioFileSoundbankReader.java
+--- jdk/src/share/classes/com/sun/media/sound/AudioFileSoundbankReader.java
++++ jdk/src/share/classes/com/sun/media/sound/AudioFileSoundbankReader.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -43,7 +43,7 @@
+  * 
+  * @author Karl Helgason
+  */
+-public class AudioFileSoundbankReader extends SoundbankReader {
++public final class AudioFileSoundbankReader extends SoundbankReader {
+ 
+     public Soundbank getSoundbank(URL url) 
+             throws InvalidMidiDataException, IOException {
+diff --git a/src/share/classes/com/sun/media/sound/AudioFloatConverter.java b/src/share/classes/com/sun/media/sound/AudioFloatConverter.java
+--- jdk/src/share/classes/com/sun/media/sound/AudioFloatConverter.java
++++ jdk/src/share/classes/com/sun/media/sound/AudioFloatConverter.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -53,7 +53,7 @@
+ 
+     private static class AudioFloatLSBFilter extends AudioFloatConverter {
+ 
+-        private AudioFloatConverter converter;
++        private final AudioFloatConverter converter;
+ 
+         final private int offset;
+ 
+@@ -63,8 +63,7 @@
+ 
+         private byte[] mask_buffer;
+ 
+-        public AudioFloatLSBFilter(AudioFloatConverter converter,
+-                AudioFormat format) {
++        AudioFloatLSBFilter(AudioFloatConverter converter, AudioFormat format) {
+             int bits = format.getSampleSizeInBits();
+             boolean bigEndian = format.isBigEndian();
+             this.converter = converter;
+@@ -742,7 +741,7 @@
+ 
+         final int xbytes;
+ 
+-        public AudioFloatConversion32xSL(int xbytes) {
++        AudioFloatConversion32xSL(int xbytes) {
+             this.xbytes = xbytes;
+         }
+ 
+@@ -783,7 +782,7 @@
+ 
+         final int xbytes;
+ 
+-        public AudioFloatConversion32xSB(int xbytes) {
++        AudioFloatConversion32xSB(int xbytes) {
+             this.xbytes = xbytes;
+         }
+ 
+@@ -825,7 +824,7 @@
+ 
+         final int xbytes;
+ 
+-        public AudioFloatConversion32xUL(int xbytes) {
++        AudioFloatConversion32xUL(int xbytes) {
+             this.xbytes = xbytes;
+         }
+ 
+@@ -868,7 +867,7 @@
+ 
+         final int xbytes;
+ 
+-        public AudioFloatConversion32xUB(int xbytes) {
++        AudioFloatConversion32xUB(int xbytes) {
+             this.xbytes = xbytes;
+         }
+ 
+@@ -1010,49 +1009,51 @@
+ 
+     private AudioFormat format;
+ 
+-    public AudioFormat getFormat() {
++    public final AudioFormat getFormat() {
+         return format;
+     }
+ 
+     public abstract float[] toFloatArray(byte[] in_buff, int in_offset,
+             float[] out_buff, int out_offset, int out_len);
+ 
+-    public float[] toFloatArray(byte[] in_buff, float[] out_buff,
++    public final float[] toFloatArray(byte[] in_buff, float[] out_buff,
+             int out_offset, int out_len) {
+         return toFloatArray(in_buff, 0, out_buff, out_offset, out_len);
+     }
+ 
+-    public float[] toFloatArray(byte[] in_buff, int in_offset,
++    public final float[] toFloatArray(byte[] in_buff, int in_offset,
+             float[] out_buff, int out_len) {
+         return toFloatArray(in_buff, in_offset, out_buff, 0, out_len);
+     }
+ 
+-    public float[] toFloatArray(byte[] in_buff, float[] out_buff, int out_len) {
++    public final float[] toFloatArray(byte[] in_buff, float[] out_buff,
++                                      int out_len) {
+         return toFloatArray(in_buff, 0, out_buff, 0, out_len);
+     }
+ 
+-    public float[] toFloatArray(byte[] in_buff, float[] out_buff) {
++    public final float[] toFloatArray(byte[] in_buff, float[] out_buff) {
+         return toFloatArray(in_buff, 0, out_buff, 0, out_buff.length);
+     }
+ 
+     public abstract byte[] toByteArray(float[] in_buff, int in_offset,
+             int in_len, byte[] out_buff, int out_offset);
+ 
+-    public byte[] toByteArray(float[] in_buff, int in_len, byte[] out_buff,
+-            int out_offset) {
++    public final byte[] toByteArray(float[] in_buff, int in_len,
++                                    byte[] out_buff, int out_offset) {
+         return toByteArray(in_buff, 0, in_len, out_buff, out_offset);
+     }
+ 
+-    public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
+-            byte[] out_buff) {
++    public final byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
++                                    byte[] out_buff) {
+         return toByteArray(in_buff, in_offset, in_len, out_buff, 0);
+     }
+ 
+-    public byte[] toByteArray(float[] in_buff, int in_len, byte[] out_buff) {
++    public final byte[] toByteArray(float[] in_buff, int in_len,
++                                    byte[] out_buff) {
+         return toByteArray(in_buff, 0, in_len, out_buff, 0);
+     }
+ 
+-    public byte[] toByteArray(float[] in_buff, byte[] out_buff) {
++    public final byte[] toByteArray(float[] in_buff, byte[] out_buff) {
+         return toByteArray(in_buff, 0, in_buff.length, out_buff, 0);
+     }
+ }
+diff --git a/src/share/classes/com/sun/media/sound/AudioFloatFormatConverter.java b/src/share/classes/com/sun/media/sound/AudioFloatFormatConverter.java
+--- jdk/src/share/classes/com/sun/media/sound/AudioFloatFormatConverter.java
++++ jdk/src/share/classes/com/sun/media/sound/AudioFloatFormatConverter.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2008, 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
+@@ -42,19 +42,19 @@
+  * 
+  * @author Karl Helgason
+  */
+-public class AudioFloatFormatConverter extends FormatConversionProvider {
++public final class AudioFloatFormatConverter extends FormatConversionProvider {
+ 
+     private static class AudioFloatFormatConverterInputStream extends
+             InputStream {
+-        private AudioFloatConverter converter;
++        private final AudioFloatConverter converter;
+ 
+-        private AudioFloatInputStream stream;
++        private final AudioFloatInputStream stream;
+ 
+         private float[] readfloatbuffer;
+ 
+-        private int fsize = 0;
++        private final int fsize;
+ 
+-        public AudioFloatFormatConverterInputStream(AudioFormat targetFormat,
++        AudioFloatFormatConverterInputStream(AudioFormat targetFormat,
+                 AudioFloatInputStream stream) {
+             this.stream = stream;
+             converter = AudioFloatConverter.getConverter(targetFormat);
+@@ -116,17 +116,17 @@
+     private static class AudioFloatInputStreamChannelMixer extends
+             AudioFloatInputStream {
+ 
+-        private int targetChannels;
++        private final int targetChannels;
+ 
+-        private int sourceChannels;
++        private final int sourceChannels;
+ 
+-        private AudioFloatInputStream ais;
++        private final AudioFloatInputStream ais;
+ 
+-        private AudioFormat targetFormat;
++        private final AudioFormat targetFormat;
+ 
+         private float[] conversion_buffer;
+ 
+-        public AudioFloatInputStreamChannelMixer(AudioFloatInputStream ais,
++        AudioFloatInputStreamChannelMixer(AudioFloatInputStream ais,
+                 int targetChannels) {
+             this.sourceChannels = ais.getFormat().getChannels();
+             this.targetChannels = targetChannels;
+@@ -226,37 +226,37 @@
+     private static class AudioFloatInputStreamResampler extends
+             AudioFloatInputStream {
+ 
+-        private AudioFloatInputStream ais;
++        private final AudioFloatInputStream ais;
+ 
+-        private AudioFormat targetFormat;
++        private final AudioFormat targetFormat;
+ 
+         private float[] skipbuffer;
+ 
+         private SoftAbstractResampler resampler;
+ 
+-        private float[] pitch = new float[1];
++        private final float[] pitch = new float[1];
+ 
+-        private float[] ibuffer2;
++        private final float[] ibuffer2;
+ 
+-        private float[][] ibuffer;
++        private final float[][] ibuffer;
+ 
+         private float ibuffer_index = 0;
+ 
+         private int ibuffer_len = 0;
+ 
+-        private int nrofchannels = 0;
++        private final int nrofchannels;
+ 
+         private float[][] cbuffer;
+ 
+-        private int buffer_len = 512;
++        private final int buffer_len = 512;
+ 
+-        private int pad;
++        private final int pad;
+ 
+-        private int pad2;
++        private final int pad2;
+ 
+-        private float[] ix = new float[1];
++        private final float[] ix = new float[1];
+ 
+-        private int[] ox = new int[1];
++        private final int[] ox = new int[1];
+ 
+         private float[][] mark_ibuffer = null;
+ 
+@@ -264,7 +264,7 @@
+ 
+         private int mark_ibuffer_len = 0;
+ 
+-        public AudioFloatInputStreamResampler(AudioFloatInputStream ais,
++        AudioFloatInputStreamResampler(AudioFloatInputStream ais,
+                 AudioFormat format) {
+             this.ais = ais;
+             AudioFormat sourceFormat = ais.getFormat();
+@@ -468,8 +468,9 @@
+ 
+     }
+ 
+-    private Encoding[] formats = { Encoding.PCM_SIGNED, Encoding.PCM_UNSIGNED,
+-            AudioFloatConverter.PCM_FLOAT };
++    private final Encoding[] formats = {Encoding.PCM_SIGNED,
++                                        Encoding.PCM_UNSIGNED,
++                                        Encoding.PCM_FLOAT};
+ 
+     public AudioInputStream getAudioInputStream(Encoding targetEncoding,
+             AudioInputStream sourceStream) {
+diff --git a/src/share/classes/com/sun/media/sound/AudioFloatInputStream.java b/src/share/classes/com/sun/media/sound/AudioFloatInputStream.java
+--- jdk/src/share/classes/com/sun/media/sound/AudioFloatInputStream.java
++++ jdk/src/share/classes/com/sun/media/sound/AudioFloatInputStream.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -48,14 +48,14 @@
+ 
+         private int pos = 0;
+         private int markpos = 0;
+-        private AudioFloatConverter converter;
+-        private AudioFormat format;
+-        private byte[] buffer;
+-        private int buffer_offset;
+-        private int buffer_len;
+-        private int framesize_pc;
++        private final AudioFloatConverter converter;
++        private final AudioFormat format;
++        private final byte[] buffer;
++        private final int buffer_offset;
++        private final int buffer_len;
++        private final int framesize_pc;
+ 
+-        public BytaArrayAudioFloatInputStream(AudioFloatConverter converter,
++        BytaArrayAudioFloatInputStream(AudioFloatConverter converter,
+                 byte[] buffer, int offset, int len) {
+             this.converter = converter;
+             this.format = converter.getFormat();
+@@ -125,12 +125,12 @@
+     private static class DirectAudioFloatInputStream
+             extends AudioFloatInputStream {
+ 
+-        private AudioInputStream stream;
++        private final AudioInputStream stream;
+         private AudioFloatConverter converter;
+-        private int framesize_pc; // framesize / channels
++        private final int framesize_pc; // framesize / channels
+         private byte[] buffer;
+ 
+-        public DirectAudioFloatInputStream(AudioInputStream stream) {
++        DirectAudioFloatInputStream(AudioInputStream stream) {
+             converter = AudioFloatConverter.getConverter(stream.getFormat());
+             if (converter == null) {
+                 AudioFormat format = stream.getFormat();
+@@ -255,11 +255,11 @@
+ 
+     public abstract int read(float[] b, int off, int len) throws IOException;
+ 
+-    public int read(float[] b) throws IOException {
++    public final int read(float[] b) throws IOException {
+         return read(b, 0, b.length);
+     }
+ 
+-    public float read() throws IOException {
++    public final float read() throws IOException {
+         float[] b = new float[1];
+         int ret = read(b, 0, 1);
+         if (ret == -1 || ret == 0)
+diff --git a/src/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java b/src/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java
+--- jdk/src/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java
++++ jdk/src/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -29,7 +29,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class AudioSynthesizerPropertyInfo {
++public final class AudioSynthesizerPropertyInfo {
+ 
+     /**
+      * Constructs a <code>AudioSynthesizerPropertyInfo</code> object with a given
+diff --git a/src/share/classes/com/sun/media/sound/DLSInfo.java b/src/share/classes/com/sun/media/sound/DLSInfo.java
+--- jdk/src/share/classes/com/sun/media/sound/DLSInfo.java
++++ jdk/src/share/classes/com/sun/media/sound/DLSInfo.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -30,7 +30,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class DLSInfo {
++public final class DLSInfo {
+ 
+     /**
+      * (INAM) Title or subject.
+diff --git a/src/share/classes/com/sun/media/sound/DLSInstrument.java b/src/share/classes/com/sun/media/sound/DLSInstrument.java
+--- jdk/src/share/classes/com/sun/media/sound/DLSInstrument.java
++++ jdk/src/share/classes/com/sun/media/sound/DLSInstrument.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -39,15 +39,15 @@
+  *
+  * @author Karl Helgason
+  */
+-public class DLSInstrument extends ModelInstrument {
++public final class DLSInstrument extends ModelInstrument {
+ 
+-    protected int preset = 0;
+-    protected int bank = 0;
+-    protected boolean druminstrument = false;
+-    protected byte[] guid = null;
+-    protected DLSInfo info = new DLSInfo();
+-    protected List<DLSRegion> regions = new ArrayList<DLSRegion>();
+-    protected List<DLSModulator> modulators = new ArrayList<DLSModulator>();
++    int preset = 0;
++    int bank = 0;
++    boolean druminstrument = false;
++    byte[] guid = null;
++    DLSInfo info = new DLSInfo();
++    List<DLSRegion> regions = new ArrayList<DLSRegion>();
++    List<DLSModulator> modulators = new ArrayList<DLSModulator>();
+ 
+     public DLSInstrument() {
+         super(null, null, null, null);
+diff --git a/src/share/classes/com/sun/media/sound/DLSModulator.java b/src/share/classes/com/sun/media/sound/DLSModulator.java
+--- jdk/src/share/classes/com/sun/media/sound/DLSModulator.java
++++ jdk/src/share/classes/com/sun/media/sound/DLSModulator.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -33,7 +33,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class DLSModulator {
++public final class DLSModulator {
+ 
+     // DLS1 Destinations
+     public static final int CONN_DST_NONE = 0x000; // 0
+@@ -102,12 +102,12 @@
+     public static final int DST_FORMAT_CENT = 1;
+     public static final int DST_FORMAT_TIMECENT = 2;
+     public static final int DST_FORMAT_PERCENT = 3;
+-    protected int source;
+-    protected int control;
+-    protected int destination;
+-    protected int transform;
+-    protected int scale;
+-    protected int version = 1;
++    int source;
++    int control;
++    int destination;
++    int transform;
++    int scale;
++    int version = 1;
+ 
+     public int getControl() {
+         return control;
+diff --git a/src/share/classes/com/sun/media/sound/DLSRegion.java b/src/share/classes/com/sun/media/sound/DLSRegion.java
+--- jdk/src/share/classes/com/sun/media/sound/DLSRegion.java
++++ jdk/src/share/classes/com/sun/media/sound/DLSRegion.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -36,21 +36,21 @@
+  *
+  * @author Karl Helgason
+  */
+-public class DLSRegion {
++public final class DLSRegion {
+ 
+     public final static int OPTION_SELFNONEXCLUSIVE = 0x0001;
+-    protected List<DLSModulator> modulators = new ArrayList<DLSModulator>();
+-    protected int keyfrom;
+-    protected int keyto;
+-    protected int velfrom;
+-    protected int velto;
+-    protected int options;
+-    protected int exclusiveClass;
+-    protected int fusoptions;
+-    protected int phasegroup;
+-    protected long channel;
+-    protected DLSSample sample = null;
+-    protected DLSSampleOptions sampleoptions;
++    List<DLSModulator> modulators = new ArrayList<DLSModulator>();
++    int keyfrom;
++    int keyto;
++    int velfrom;
++    int velto;
++    int options;
++    int exclusiveClass;
++    int fusoptions;
++    int phasegroup;
++    long channel;
++    DLSSample sample = null;
++    DLSSampleOptions sampleoptions;
+ 
+     public List<DLSModulator> getModulators() {
+         return modulators;
+diff --git a/src/share/classes/com/sun/media/sound/DLSSample.java b/src/share/classes/com/sun/media/sound/DLSSample.java
+--- jdk/src/share/classes/com/sun/media/sound/DLSSample.java
++++ jdk/src/share/classes/com/sun/media/sound/DLSSample.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -39,13 +39,13 @@
+  *
+  * @author Karl Helgason
+  */
+-public class DLSSample extends SoundbankResource {
++public final class DLSSample extends SoundbankResource {
+ 
+-    protected byte[] guid = null;
+-    protected DLSInfo info = new DLSInfo();
+-    protected DLSSampleOptions sampleoptions;
+-    protected ModelByteBuffer data;
+-    protected AudioFormat format;
++    byte[] guid = null;
++    DLSInfo info = new DLSInfo();
++    DLSSampleOptions sampleoptions;
++    ModelByteBuffer data;
++    AudioFormat format;
+ 
+     public DLSSample(Soundbank soundBank) {
+         super(soundBank, null, AudioInputStream.class);
+diff --git a/src/share/classes/com/sun/media/sound/DLSSampleLoop.java b/src/share/classes/com/sun/media/sound/DLSSampleLoop.java
+--- jdk/src/share/classes/com/sun/media/sound/DLSSampleLoop.java
++++ jdk/src/share/classes/com/sun/media/sound/DLSSampleLoop.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -29,13 +29,13 @@
+  *
+  * @author Karl Helgason
+  */
+-public class DLSSampleLoop {
++public final class DLSSampleLoop {
+ 
+     public final static int LOOP_TYPE_FORWARD = 0;
+     public final static int LOOP_TYPE_RELEASE = 1;
+-    protected long type;
+-    protected long start;
+-    protected long length;
++    long type;
++    long start;
++    long length;
+ 
+     public long getLength() {
+         return length;
+diff --git a/src/share/classes/com/sun/media/sound/DLSSampleOptions.java b/src/share/classes/com/sun/media/sound/DLSSampleOptions.java
+--- jdk/src/share/classes/com/sun/media/sound/DLSSampleOptions.java
++++ jdk/src/share/classes/com/sun/media/sound/DLSSampleOptions.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -34,13 +34,13 @@
+  *
+  * @author Karl Helgason
+  */
+-public class DLSSampleOptions {
++public final class DLSSampleOptions {
+ 
+-    protected int unitynote;
+-    protected short finetune;
+-    protected int attenuation;
+-    protected long options;
+-    protected List<DLSSampleLoop> loops = new ArrayList<DLSSampleLoop>();
++    int unitynote;
++    short finetune;
++    int attenuation;
++    long options;
++    List<DLSSampleLoop> loops = new ArrayList<DLSSampleLoop>();
+ 
+     public int getAttenuation() {
+         return attenuation;
+diff --git a/src/share/classes/com/sun/media/sound/DLSSoundbank.java b/src/share/classes/com/sun/media/sound/DLSSoundbank.java
+--- jdk/src/share/classes/com/sun/media/sound/DLSSoundbank.java
++++ jdk/src/share/classes/com/sun/media/sound/DLSSoundbank.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -51,7 +51,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class DLSSoundbank implements Soundbank {
++public final class DLSSoundbank implements Soundbank {
+ 
+     static private class DLSID {
+         long i1;
+@@ -69,7 +69,7 @@
+         private DLSID() {
+         }
+ 
+-        public DLSID(long i1, int s1, int s2, int x1, int x2, int x3, int x4,
++        DLSID(long i1, int s1, int s2, int x1, int x2, int x3, int x4,
+                 int x5, int x6, int x7, int x8) {
+             this.i1 = i1;
+             this.s1 = s1;
+@@ -174,10 +174,10 @@
+     private long major = -1;
+     private long minor = -1;
+ 
+-    private DLSInfo info = new DLSInfo();
++    private final DLSInfo info = new DLSInfo();
+ 
+-    private List<DLSInstrument> instruments = new ArrayList<DLSInstrument>();
+-    private List<DLSSample> samples = new ArrayList<DLSSample>();
++    private final List<DLSInstrument> instruments = new ArrayList<DLSInstrument>();
++    private final List<DLSSample> samples = new ArrayList<DLSSample>();
+ 
+     private boolean largeFormat = false;
+     private File sampleFile;
+diff --git a/src/share/classes/com/sun/media/sound/DLSSoundbankReader.java b/src/share/classes/com/sun/media/sound/DLSSoundbankReader.java
+--- jdk/src/share/classes/com/sun/media/sound/DLSSoundbankReader.java
++++ jdk/src/share/classes/com/sun/media/sound/DLSSoundbankReader.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -39,7 +39,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class DLSSoundbankReader extends SoundbankReader {
++public final class DLSSoundbankReader extends SoundbankReader {
+ 
+     public Soundbank getSoundbank(URL url)
+             throws InvalidMidiDataException, IOException {
+diff --git a/src/share/classes/com/sun/media/sound/DataPusher.java b/src/share/classes/com/sun/media/sound/DataPusher.java
+--- jdk/src/share/classes/com/sun/media/sound/DataPusher.java
++++ jdk/src/share/classes/com/sun/media/sound/DataPusher.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
+@@ -37,13 +37,13 @@
+  * @author Florian Bomers
+  */
+ 
+-public class DataPusher implements Runnable {
++public final class DataPusher implements Runnable {
+ 
+     private static final int AUTO_CLOSE_TIME = 5000;
+     private static final boolean DEBUG = false;
+ 
+-    private SourceDataLine source = null;
+-    private AudioFormat format = null;
++    private final SourceDataLine source;
++    private final AudioFormat format;
+ 
+     // stream as source data
+     private AudioInputStream ais = null;
+diff --git a/src/share/classes/com/sun/media/sound/DirectAudioDevice.java b/src/share/classes/com/sun/media/sound/DirectAudioDevice.java
+--- jdk/src/share/classes/com/sun/media/sound/DirectAudioDevice.java
++++ jdk/src/share/classes/com/sun/media/sound/DirectAudioDevice.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
+@@ -42,7 +42,7 @@
+  *
+  * @author Florian Bomers
+  */
+-class DirectAudioDevice extends AbstractMixer {
++final class DirectAudioDevice extends AbstractMixer {
+ 
+     // CONSTANTS
+     private static final int CLIP_BUFFER_TIME = 1000; // in milliseconds
+@@ -335,8 +335,8 @@
+      * but isFormatSupported() also returns true
+      * for formats with wrong endianness.
+      */
+-    private static class DirectDLI extends DataLine.Info {
+-        AudioFormat[] hardwareFormats;
++    private static final class DirectDLI extends DataLine.Info {
++        final AudioFormat[] hardwareFormats;
+ 
+         private DirectDLI(Class clazz, AudioFormat[] formatArray,
+                           AudioFormat[] hardwareFormatArray,
+@@ -370,12 +370,12 @@
+      * Private inner class as base class for direct lines
+      */
+     private static class DirectDL extends AbstractDataLine implements EventDispatcher.LineMonitor {
+-        protected int mixerIndex;
+-        protected int deviceID;
++        protected final int mixerIndex;
++        protected final int deviceID;
+         protected long id;
+         protected int waitTime;
+         protected volatile boolean flushing = false;
+-        protected boolean isSource;         // true for SourceDataLine, false for TargetDataLine
++        protected final boolean isSource;         // true for SourceDataLine, false for TargetDataLine
+         protected volatile long bytePosition;
+         protected volatile boolean doIO = false;     // true in between start() and stop() calls
+         protected volatile boolean stoppedWritten = false; // true if a write occured in stopped state
+@@ -387,10 +387,10 @@
+         protected int softwareConversionSize = 0;
+         protected AudioFormat hardwareFormat;
+ 
+-        private Gain gainControl = new Gain();
+-        private Mute muteControl = new Mute();
+-        private Balance balanceControl = new Balance();
+-        private Pan panControl = new Pan();
++        private final Gain gainControl = new Gain();
++        private final Mute muteControl = new Mute();
++        private final Balance balanceControl = new Balance();
++        private final Pan panControl = new Pan();
+         private float leftGain, rightGain;
+         protected volatile boolean noService = false; // do not run the nService method
+ 
+@@ -865,7 +865,7 @@
+ 
+         /////////////////// CONTROLS /////////////////////////////
+ 
+-        protected class Gain extends FloatControl {
++        protected final class Gain extends FloatControl {
+ 
+             private float linearGain = 1.0f;
+ 
+@@ -898,7 +898,7 @@
+         } // class Gain
+ 
+ 
+-        private class Mute extends BooleanControl {
++        private final class Mute extends BooleanControl {
+ 
+             private Mute() {
+                 super(BooleanControl.Type.MUTE, false, "True", "False");
+@@ -910,7 +910,7 @@
+             }
+         }  // class Mute
+ 
+-        private class Balance extends FloatControl {
++        private final class Balance extends FloatControl {
+ 
+             private Balance() {
+                 super(FloatControl.Type.BALANCE, -1.0f, 1.0f, (1.0f / 128.0f), -1, 0.0f,
+@@ -929,7 +929,7 @@
+ 
+         } // class Balance
+ 
+-        private class Pan extends FloatControl {
++        private final class Pan extends FloatControl {
+ 
+             private Pan() {
+                 super(FloatControl.Type.PAN, -1.0f, 1.0f, (1.0f / 128.0f), -1, 0.0f,
+@@ -954,7 +954,8 @@
+     /**
+      * Private inner class representing a SourceDataLine
+      */
+-    private static class DirectSDL extends DirectDL implements SourceDataLine {
++    private static final class DirectSDL extends DirectDL
++            implements SourceDataLine {
+ 
+         // CONSTRUCTOR
+         private DirectSDL(DataLine.Info info,
+@@ -970,7 +971,8 @@
+     /**
+      * Private inner class representing a TargetDataLine
+      */
+-    private static class DirectTDL extends DirectDL implements TargetDataLine {
++    private static final class DirectTDL extends DirectDL
++            implements TargetDataLine {
+ 
+         // CONSTRUCTOR
+         private DirectTDL(DataLine.Info info,
+@@ -1049,7 +1051,9 @@
+      * Private inner class representing a Clip
+      * This clip is realized in software only
+      */
+-    private static class DirectClip extends DirectDL implements Clip,  Runnable, AutoClosingClip {
++    private static final class DirectClip extends DirectDL
++            implements Clip, Runnable, AutoClosingClip {
++
+         private Thread thread;
+         private byte[] audioData = null;
+         private int frameSize;         // size of one frame in bytes
+@@ -1082,7 +1086,7 @@
+ 
+             byte[] newData = new byte[bufferSize];
+             System.arraycopy(data, offset, newData, 0, bufferSize);
+-            open(format, data, bufferSize / format.getFrameSize());
++            open(format, newData, bufferSize / format.getFrameSize());
+         }
+ 
+         // this method does not copy the data array
+@@ -1478,7 +1482,7 @@
+      * which allows retrieval of the internal array
+      */
+     private static class DirectBAOS extends ByteArrayOutputStream {
+-        public DirectBAOS() {
++        DirectBAOS() {
+             super();
+         }
+ 
+diff --git a/src/share/classes/com/sun/media/sound/DirectAudioDeviceProvider.java b/src/share/classes/com/sun/media/sound/DirectAudioDeviceProvider.java
+--- jdk/src/share/classes/com/sun/media/sound/DirectAudioDeviceProvider.java
++++ jdk/src/share/classes/com/sun/media/sound/DirectAudioDeviceProvider.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
+@@ -25,8 +25,6 @@
+ 
+ package com.sun.media.sound;
+ 
+-import java.util.Vector;
+-
+ import javax.sound.sampled.Mixer;
+ import javax.sound.sampled.spi.MixerProvider;
+ 
+@@ -36,7 +34,7 @@
+  *
+  * @author Florian Bomers
+  */
+-public class DirectAudioDeviceProvider extends MixerProvider {
++public final class DirectAudioDeviceProvider extends MixerProvider {
+ 
+     // STATIC VARIABLES
+ 
+@@ -66,16 +64,17 @@
+      * Required public no-arg constructor.
+      */
+     public DirectAudioDeviceProvider() {
+-        //if (Printer.trace) Printer.trace("DirectAudioDeviceProvider: constructor");
+-        if (Platform.isDirectAudioEnabled()) {
+-            init();
+-        } else {
+-            infos = new DirectAudioDeviceInfo[0];
+-            devices = new DirectAudioDevice[0];
++        synchronized (DirectAudioDeviceProvider.class) {
++            if (Platform.isDirectAudioEnabled()) {
++                init();
++            } else {
++                infos = new DirectAudioDeviceInfo[0];
++                devices = new DirectAudioDevice[0];
++            }
+         }
+     }
+ 
+-    private synchronized static void init() {
++    private static void init() {
+         // get the number of input devices
+         int numDevices = nGetNumDevices();
+ 
+@@ -94,36 +93,39 @@
+     }
+ 
+     public Mixer.Info[] getMixerInfo() {
+-        Mixer.Info[] localArray = new Mixer.Info[infos.length];
+-        System.arraycopy(infos, 0, localArray, 0, infos.length);
+-        return localArray;
++        synchronized (DirectAudioDeviceProvider.class) {
++            Mixer.Info[] localArray = new Mixer.Info[infos.length];
++            System.arraycopy(infos, 0, localArray, 0, infos.length);
++            return localArray;
++        }
+     }
+ 
+ 
+     public Mixer getMixer(Mixer.Info info) {
+-        // if the default device is asked, we provide the mixer
+-        // with SourceDataLine's
+-        if (info == null) {
++        synchronized (DirectAudioDeviceProvider.class) {
++            // if the default device is asked, we provide the mixer
++            // with SourceDataLine's
++            if (info == null) {
++                for (int i = 0; i < infos.length; i++) {
++                    Mixer mixer = getDevice(infos[i]);
++                    if (mixer.getSourceLineInfo().length > 0) {
++                        return mixer;
++                    }
++                }
++            }
++            // otherwise get the first mixer that matches
++            // the requested info object
+             for (int i = 0; i < infos.length; i++) {
+-                Mixer mixer = getDevice(infos[i]);
+-                if (mixer.getSourceLineInfo().length > 0) {
+-                    return mixer;
++                if (infos[i].equals(info)) {
++                    return getDevice(infos[i]);
+                 }
+             }
+         }
+-        // otherwise get the first mixer that matches
+-        // the requested info object
+-        for (int i = 0; i < infos.length; i++) {
+-            if (infos[i].equals(info)) {
+-                return getDevice(infos[i]);
+-            }
+-        }
+-
+         throw new IllegalArgumentException("Mixer " + info.toString() + " not supported by this provider.");
+     }
+ 
+ 
+-    private Mixer getDevice(DirectAudioDeviceInfo info) {
++    private static Mixer getDevice(DirectAudioDeviceInfo info) {
+         int index = info.getIndex();
+         if (devices[index] == null) {
+             devices[index] = new DirectAudioDevice(info);
+@@ -139,12 +141,12 @@
+      * making native references to a particular device.
+      * This constructor is called from native.
+      */
+-    static class DirectAudioDeviceInfo extends Mixer.Info {
+-        private int index;
+-        private int maxSimulLines;
++    static final class DirectAudioDeviceInfo extends Mixer.Info {
++        private final int index;
++        private final int maxSimulLines;
+ 
+         // For ALSA, the deviceID contains the encoded card index, device index, and sub-device-index
+-        private int deviceID;
++        private final int deviceID;
+ 
+         private DirectAudioDeviceInfo(int index, int deviceID, int maxSimulLines,
+                                       String name, String vendor,
+diff --git a/src/share/classes/com/sun/media/sound/EmergencySoundbank.java b/src/share/classes/com/sun/media/sound/EmergencySoundbank.java
+--- jdk/src/share/classes/com/sun/media/sound/EmergencySoundbank.java
++++ jdk/src/share/classes/com/sun/media/sound/EmergencySoundbank.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -35,7 +35,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class EmergencySoundbank {
++public final class EmergencySoundbank {
+ 
+     private final static String[] general_midi_instruments = {
+         "Acoustic Grand Piano",
+diff --git a/src/share/classes/com/sun/media/sound/EventDispatcher.java b/src/share/classes/com/sun/media/sound/EventDispatcher.java
+--- jdk/src/share/classes/com/sun/media/sound/EventDispatcher.java
++++ jdk/src/share/classes/com/sun/media/sound/EventDispatcher.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -25,20 +25,16 @@
+ 
+ package com.sun.media.sound;
+ 
+-import java.util.EventObject;
+ import java.util.ArrayList;
+ import java.util.List;
+ 
+-import javax.sound.sampled.Clip;
+-import javax.sound.sampled.Line;
++import javax.sound.midi.ControllerEventListener;
++import javax.sound.midi.MetaEventListener;
++import javax.sound.midi.MetaMessage;
++import javax.sound.midi.ShortMessage;
+ import javax.sound.sampled.LineEvent;
+ import javax.sound.sampled.LineListener;
+ 
+-import javax.sound.midi.MetaMessage;
+-import javax.sound.midi.ShortMessage;
+-import javax.sound.midi.MetaEventListener;
+-import javax.sound.midi.ControllerEventListener;
+-
+ 
+ 
+ /**
+@@ -49,7 +45,7 @@
+  * @author Kara Kytle
+  * @author Florian Bomers
+  */
+-class EventDispatcher implements Runnable {
++final class EventDispatcher implements Runnable {
+ 
+     /**
+      * time of inactivity until the auto closing clips
+@@ -61,7 +57,7 @@
+     /**
+      * List of events
+      */
+-    private ArrayList eventQueue = new ArrayList();
++    private final ArrayList eventQueue = new ArrayList();
+ 
+ 
+     /**
+@@ -73,12 +69,12 @@
+     /*
+      * support for auto-closing Clips
+      */
+-    private ArrayList<ClipInfo> autoClosingClips = new ArrayList<ClipInfo>();
++    private final ArrayList<ClipInfo> autoClosingClips = new ArrayList<ClipInfo>();
+ 
+     /*
+      * support for monitoring data lines
+      */
+-    private ArrayList<LineMonitor> lineMonitors = new ArrayList<LineMonitor>();
++    private final ArrayList<LineMonitor> lineMonitors = new ArrayList<LineMonitor>();
+ 
+     /**
+      * Approximate interval between calls to LineMonitor.checkLine
+@@ -105,7 +101,7 @@
+      * Invoked when there is at least one event in the queue.
+      * Implement this as a callback to process one event.
+      */
+-    protected void processEvent(EventInfo eventInfo) {
++    void processEvent(EventInfo eventInfo) {
+         int count = eventInfo.getListenerCount();
+ 
+         // process an LineEvent
+@@ -166,7 +162,7 @@
+      * exclusive access over the code where an event is removed from the
+      *queue.
+      */
+-    protected void dispatchEvents() {
++    void dispatchEvents() {
+ 
+         EventInfo eventInfo = null;
+ 
+@@ -388,8 +384,8 @@
+      */
+     private class EventInfo {
+ 
+-        private Object event;
+-        private Object[] listeners;
++        private final Object event;
++        private final Object[] listeners;
+ 
+         /**
+          * Create a new instance of this event Info class
+@@ -421,8 +417,8 @@
+      */
+     private class ClipInfo {
+ 
+-        private AutoClosingClip clip;
+-        private long expiration;
++        private final AutoClosingClip clip;
++        private final long expiration;
+ 
+         /**
+          * Create a new instance of this clip Info class
+diff --git a/src/share/classes/com/sun/media/sound/FFT.java b/src/share/classes/com/sun/media/sound/FFT.java
+--- jdk/src/share/classes/com/sun/media/sound/FFT.java
++++ jdk/src/share/classes/com/sun/media/sound/FFT.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -31,11 +31,11 @@
+  */
+ public final class FFT {
+ 
+-    private double[] w;
+-    private int fftFrameSize;
+-    private int sign;
+-    private int[] bitm_array;
+-    private int fftFrameSize2;
++    private final double[] w;
++    private final int fftFrameSize;
++    private final int sign;
++    private final int[] bitm_array;
++    private final int fftFrameSize2;
+ 
+     // Sign = -1 is FFT, 1 is IFFT (inverse FFT)
+     // Data = Interlaced double array to be transformed.
+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
+@@ -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
+@@ -35,13 +35,13 @@
+ final class FastShortMessage extends ShortMessage {
+     private int packedMsg;
+ 
+-    public FastShortMessage(int packedMsg) throws InvalidMidiDataException {
++    FastShortMessage(int packedMsg) throws InvalidMidiDataException {
+         this.packedMsg = packedMsg;
+         getDataLength(packedMsg & 0xFF); // to check for validity
+     }
+ 
+     /** Creates a FastShortMessage from this ShortMessage */
+-    public FastShortMessage(ShortMessage msg) {
++    FastShortMessage(ShortMessage msg) {
+         this.packedMsg = msg.getStatus()
+             | (msg.getData1() << 8)
+             | (msg.getData2() << 16);
+diff --git a/src/share/classes/com/sun/media/sound/JARSoundbankReader.java b/src/share/classes/com/sun/media/sound/JARSoundbankReader.java
+--- jdk/src/share/classes/com/sun/media/sound/JARSoundbankReader.java
++++ jdk/src/share/classes/com/sun/media/sound/JARSoundbankReader.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -36,14 +36,16 @@
+ import javax.sound.midi.Soundbank;
+ import javax.sound.midi.spi.SoundbankReader;
+ 
++import sun.reflect.misc.ReflectUtil;
++
+ /**
+- * JarSoundbankReader is used to read sounbank object from jar files.
++ * JarSoundbankReader is used to read soundbank object from jar files.
+  *
+  * @author Karl Helgason
+  */
+-public class JARSoundbankReader extends SoundbankReader {
++public final class JARSoundbankReader extends SoundbankReader {
+ 
+-    public boolean isZIP(URL url) {
++    private static boolean isZIP(URL url) {
+         boolean ok = false;
+         try {
+             InputStream stream = url.openStream();
+@@ -81,14 +83,14 @@
+             while (line != null) {
+                 if (!line.startsWith("#")) {
+                     try {
+-                        Class c = Class.forName(line.trim(), true, ucl);
+-                        Object o = c.newInstance();
+-                        if (o instanceof Soundbank) {
++                        Class<?> c = Class.forName(line.trim(), false, ucl);
++                        if (Soundbank.class.isAssignableFrom(c)) {
++                            Object o = ReflectUtil.newInstance(c);
+                             soundbanks.add((Soundbank) o);
+                         }
+-                    } catch (ClassNotFoundException  e) {
+-                    } catch (InstantiationException  e) {
+-                    } catch (IllegalAccessException  e) {
++                    } catch (ClassNotFoundException ignored) {
++                    } catch (InstantiationException ignored) {
++                    } catch (IllegalAccessException ignored) {
+                     }
+                 }
+                 line = r.readLine();
+diff --git a/src/share/classes/com/sun/media/sound/JDK13Services.java b/src/share/classes/com/sun/media/sound/JDK13Services.java
+--- jdk/src/share/classes/com/sun/media/sound/JDK13Services.java
++++ jdk/src/share/classes/com/sun/media/sound/JDK13Services.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1999, 2009, 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
+@@ -31,16 +31,6 @@
+ import java.util.Map;
+ import java.util.Properties;
+ 
+-import javax.sound.sampled.spi.AudioFileReader;
+-import javax.sound.sampled.spi.AudioFileWriter;
+-import javax.sound.sampled.spi.FormatConversionProvider;
+-import javax.sound.sampled.spi.MixerProvider;
+-
+-import javax.sound.midi.spi.MidiFileReader;
+-import javax.sound.midi.spi.MidiFileWriter;
+-import javax.sound.midi.spi.SoundbankReader;
+-import javax.sound.midi.spi.MidiDeviceProvider;
+-
+ import javax.sound.midi.Receiver;
+ import javax.sound.midi.Sequencer;
+ import javax.sound.midi.Synthesizer;
+@@ -62,7 +52,7 @@
+  *
+  * @author Matthias Pfisterer
+  */
+-public class JDK13Services {
++public final class JDK13Services {
+ 
+     /** The default for the length of the period to hold the cache.
+         This value is given in milliseconds. It is equivalent to
+@@ -80,7 +70,7 @@
+         Class objects of the provider type (MixerProvider, MidiDeviceProvider
+         ...) are used as keys. The values are instances of ProviderCache.
+     */
+-    private static Map providersCacheMap = new HashMap();
++    private static final Map providersCacheMap = new HashMap();
+ 
+ 
+     /** The length of the period to hold the cache.
+diff --git a/src/share/classes/com/sun/media/sound/JSSecurityManager.java b/src/share/classes/com/sun/media/sound/JSSecurityManager.java
+--- jdk/src/share/classes/com/sun/media/sound/JSSecurityManager.java
++++ jdk/src/share/classes/com/sun/media/sound/JSSecurityManager.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1999, 2009, 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
+@@ -49,7 +49,7 @@
+  *
+  * @author Matthias Pfisterer
+  */
+-class JSSecurityManager {
++final class JSSecurityManager {
+ 
+     /** Prevent instantiation.
+      */
+@@ -75,30 +75,6 @@
+         }
+     }
+ 
+-
+-    static void loadLibrary(final String libName) {
+-        try {
+-            if (hasSecurityManager()) {
+-                if(Printer.debug) Printer.debug("using security manager to load library");
+-                PrivilegedAction action = new PrivilegedAction() {
+-                        public Object run() {
+-                            System.loadLibrary(libName);
+-                            return null;
+-                        }
+-                    };
+-                AccessController.doPrivileged(action);
+-            } else {
+-                if(Printer.debug) Printer.debug("not using security manager to load library");
+-                System.loadLibrary(libName);
+-            }
+-            if (Printer.debug) Printer.debug("loaded library " + libName);
+-        } catch (UnsatisfiedLinkError e2) {
+-            if (Printer.err)Printer.err("UnsatisfiedLinkError loading native library " + libName);
+-            throw(e2);
+-        }
+-    }
+-
+-
+     static String getProperty(final String propertyName) {
+         String propertyValue;
+         if (hasSecurityManager()) {
+@@ -191,83 +167,13 @@
+         if(Printer.trace)Printer.trace("<< JSSecurityManager: loadPropertiesImpl() completed");
+     }
+ 
+-
+-    private static ThreadGroup getTopmostThreadGroup() {
+-        ThreadGroup topmostThreadGroup;
+-        if(hasSecurityManager()) {
+-            try {
+-                // invoke the privileged action using 1.2 security
+-                PrivilegedAction action = new PrivilegedAction() {
+-                        public Object run() {
+-                            try {
+-                                return getTopmostThreadGroupImpl();
+-                            } catch (Throwable t) {
+-                                return null;
+-                            }
+-                        }
+-                    };
+-                topmostThreadGroup = (ThreadGroup) AccessController.doPrivileged(action);
+-                if(Printer.debug)Printer.debug("Got topmost thread group with JDK 1.2 security");
+-            } catch (Exception e) {
+-                if(Printer.debug)Printer.debug("Exception getting topmost thread group with JDK 1.2 security");
+-                // try without using JDK 1.2 security
+-                topmostThreadGroup = getTopmostThreadGroupImpl();
+-            }
+-        } else {
+-            // not JDK 1.2 security, assume we already have permission
+-            topmostThreadGroup = getTopmostThreadGroupImpl();
+-        }
+-        return topmostThreadGroup;
+-    }
+-
+-
+-    private static ThreadGroup getTopmostThreadGroupImpl() {
+-        if(Printer.trace)Printer.trace(">> JSSecurityManager: getTopmostThreadGroupImpl()");
+-        ThreadGroup g = Thread.currentThread().getThreadGroup();
+-        while ((g.getParent() != null) && (g.getParent().getParent() != null)) {
+-            g = g.getParent();
+-        }
+-        if(Printer.trace)Printer.trace("<< JSSecurityManager: getTopmostThreadGroupImpl() completed");
+-        return g;
+-    }
+-
+-
+-    /** Create a Thread in the topmost ThreadGroup.
++    /** Create a Thread in the current ThreadGroup.
+      */
+     static Thread createThread(final Runnable runnable,
+                                final String threadName,
+                                final boolean isDaemon, final int priority,
+                                final boolean doStart) {
+-        Thread thread = null;
+-        if(hasSecurityManager()) {
+-            PrivilegedAction action = new PrivilegedAction() {
+-                    public Object run() {
+-                        try {
+-                            return createThreadImpl(runnable, threadName,
+-                                                    isDaemon, priority,
+-                                                    doStart);
+-                        } catch (Throwable t) {
+-                            return null;
+-                        }
+-                    }
+-                };
+-            thread = (Thread) AccessController.doPrivileged(action);
+-            if(Printer.debug) Printer.debug("created thread with JDK 1.2 security");
+-        } else {
+-            if(Printer.debug)Printer.debug("not using JDK 1.2 security");
+-            thread = createThreadImpl(runnable, threadName, isDaemon, priority,
+-                                      doStart);
+-        }
+-        return thread;
+-    }
+-
+-
+-    private static Thread createThreadImpl(Runnable runnable,
+-                                           String threadName,
+-                                           boolean isDaemon, int priority,
+-                                           boolean doStart) {
+-        ThreadGroup threadGroup = getTopmostThreadGroupImpl();
+-        Thread thread = new Thread(threadGroup, runnable);
++        Thread thread = new Thread(runnable);
+         if (threadName != null) {
+             thread.setName(threadName);
+         }
+@@ -281,7 +187,6 @@
+         return thread;
+     }
+ 
+-
+     static List getProviders(final Class providerClass) {
+         List p = new ArrayList();
+         // Service.providers(Class) just creates "lazy" iterator instance,
+diff --git a/src/share/classes/com/sun/media/sound/JavaSoundAudioClip.java b/src/share/classes/com/sun/media/sound/JavaSoundAudioClip.java
+--- jdk/src/share/classes/com/sun/media/sound/JavaSoundAudioClip.java
++++ jdk/src/share/classes/com/sun/media/sound/JavaSoundAudioClip.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
+@@ -28,25 +28,19 @@
+ import java.io.IOException;
+ import java.io.InputStream;
+ import java.io.BufferedInputStream;
+-import java.io.ByteArrayInputStream;
+ import java.io.ByteArrayOutputStream;
+ import java.applet.AudioClip;
+-import java.lang.InterruptedException;
+ 
+ import javax.sound.sampled.AudioSystem;
+-import javax.sound.sampled.Mixer;
+ import javax.sound.sampled.Clip;
+-import javax.sound.sampled.Control;
+ import javax.sound.sampled.AudioInputStream;
+ import javax.sound.sampled.AudioFormat;
+ import javax.sound.sampled.DataLine;
+ import javax.sound.sampled.SourceDataLine;
+ import javax.sound.sampled.LineEvent;
+ import javax.sound.sampled.LineListener;
+-import javax.sound.sampled.LineUnavailableException;
+ import javax.sound.sampled.UnsupportedAudioFileException;
+ 
+-
+ import javax.sound.midi.MidiSystem;
+ import javax.sound.midi.MidiFileFormat;
+ import javax.sound.midi.MetaMessage;
+@@ -63,7 +57,7 @@
+  * @author Florian Bomers
+  */
+ 
+-public class JavaSoundAudioClip implements AudioClip, MetaEventListener, LineListener {
++public final class JavaSoundAudioClip implements AudioClip, MetaEventListener, LineListener {
+ 
+     private static final boolean DEBUG = false;
+     private static final int BUFFER_SIZE = 16384; // number of bytes written each time to the source data line
+@@ -476,7 +470,7 @@
+      * which allows retrieval of the internal array
+      */
+     private static class DirectBAOS extends ByteArrayOutputStream {
+-        public DirectBAOS() {
++        DirectBAOS() {
+             super();
+         }
+ 
+diff --git a/src/share/classes/com/sun/media/sound/MidiInDevice.java b/src/share/classes/com/sun/media/sound/MidiInDevice.java
+--- jdk/src/share/classes/com/sun/media/sound/MidiInDevice.java
++++ jdk/src/share/classes/com/sun/media/sound/MidiInDevice.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
+@@ -25,9 +25,6 @@
+ 
+ package com.sun.media.sound;
+ 
+-import java.util.ArrayList;
+-import java.util.List;
+-
+ import javax.sound.midi.*;
+ 
+ 
+@@ -39,7 +36,7 @@
+  * @author Kara Kytle
+  * @author Florian Bomers
+  */
+-class MidiInDevice extends AbstractMidiDevice implements Runnable {
++final class MidiInDevice extends AbstractMidiDevice implements Runnable {
+ 
+     private Thread midiInThread = null;
+ 
+@@ -127,7 +124,7 @@
+       * An own class to distinguish the class name from
+       * the transmitter of other devices
+       */
+-    private class MidiInTransmitter extends BasicTransmitter {
++    private final class MidiInTransmitter extends BasicTransmitter {
+         private MidiInTransmitter() {
+             super();
+         }
+diff --git a/src/share/classes/com/sun/media/sound/MidiInDeviceProvider.java b/src/share/classes/com/sun/media/sound/MidiInDeviceProvider.java
+--- jdk/src/share/classes/com/sun/media/sound/MidiInDeviceProvider.java
++++ jdk/src/share/classes/com/sun/media/sound/MidiInDeviceProvider.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
+@@ -26,7 +26,6 @@
+ package com.sun.media.sound;
+ 
+ import javax.sound.midi.MidiDevice;
+-import javax.sound.midi.spi.MidiDeviceProvider;
+ 
+ 
+ /**
+@@ -35,15 +34,15 @@
+  * @author Kara Kytle
+  * @author Florian Bomers
+  */
+-public class MidiInDeviceProvider extends AbstractMidiDeviceProvider {
++public final class MidiInDeviceProvider extends AbstractMidiDeviceProvider {
+ 
+     /** Cache of info objects for all MIDI output devices on the system. */
+-    static Info[] infos = null;
++    private static Info[] infos = null;
+ 
+     /** Cache of open MIDI input devices on the system. */
+-    static MidiDevice[] devices = null;
++    private static MidiDevice[] devices = null;
+ 
+-    private static boolean enabled;
++    private static final boolean enabled;
+ 
+     // STATIC
+ 
+@@ -106,8 +105,8 @@
+      * previous instance may still exist and be open / in use / etc.,
+      * the new instance will not reflect that state...
+      */
+-    static class MidiInDeviceInfo extends AbstractMidiDeviceProvider.Info {
+-        private Class providerClass;
++    static final class MidiInDeviceInfo extends AbstractMidiDeviceProvider.Info {
++        private final Class providerClass;
+ 
+         private MidiInDeviceInfo(int index, Class providerClass) {
+             super(nGetName(index), nGetVendor(index), nGetDescription(index), nGetVersion(index), index);
+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
+@@ -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
+@@ -36,7 +36,7 @@
+  * @author Kara Kytle
+  * @author Florian Bomers
+  */
+-class MidiOutDevice extends AbstractMidiDevice {
++final class MidiOutDevice extends AbstractMidiDevice {
+ 
+     // CONSTRUCTOR
+ 
+@@ -101,7 +101,7 @@
+ 
+     // INNER CLASSES
+ 
+-    class MidiOutReceiver extends AbstractReceiver {
++    final class MidiOutReceiver extends AbstractReceiver {
+ 
+         void implSend(final MidiMessage message, final long timeStamp) {
+             final int length = message.getLength();
+diff --git a/src/share/classes/com/sun/media/sound/MidiOutDeviceProvider.java b/src/share/classes/com/sun/media/sound/MidiOutDeviceProvider.java
+--- jdk/src/share/classes/com/sun/media/sound/MidiOutDeviceProvider.java
++++ jdk/src/share/classes/com/sun/media/sound/MidiOutDeviceProvider.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
+@@ -26,7 +26,6 @@
+ package com.sun.media.sound;
+ 
+ import javax.sound.midi.MidiDevice;
+-import javax.sound.midi.spi.MidiDeviceProvider;
+ 
+ 
+ /**
+@@ -35,15 +34,15 @@
+  * @author Kara Kytle
+  * @author Florian Bomers
+  */
+-public class MidiOutDeviceProvider extends AbstractMidiDeviceProvider {
++public final class MidiOutDeviceProvider extends AbstractMidiDeviceProvider {
+ 
+     /** Cache of info objects for all MIDI output devices on the system. */
+-    static Info[] infos = null;
++    private static Info[] infos = null;
+ 
+     /** Cache of open MIDI output devices on the system. */
+-    static MidiDevice[] devices = null;
++    private static MidiDevice[] devices = null;
+ 
+-    private static boolean enabled;
++    private final static boolean enabled;
+ 
+     // STATIC
+ 
+@@ -104,8 +103,8 @@
+      * previous instance may still exist and be open / in use / etc.,
+      * the new instance will not reflect that state...
+      */
+-    static class MidiOutDeviceInfo extends AbstractMidiDeviceProvider.Info {
+-        private Class providerClass;
++    static final class MidiOutDeviceInfo extends AbstractMidiDeviceProvider.Info {
++        private final Class providerClass;
+ 
+         private MidiOutDeviceInfo(int index, Class providerClass) {
+             super(nGetName(index), nGetVendor(index), nGetDescription(index), nGetVersion(index), index);
+diff --git a/src/share/classes/com/sun/media/sound/MidiUtils.java b/src/share/classes/com/sun/media/sound/MidiUtils.java
+--- jdk/src/share/classes/com/sun/media/sound/MidiUtils.java
++++ jdk/src/share/classes/com/sun/media/sound/MidiUtils.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -36,12 +36,17 @@
+  *
+  * @author Florian Bomers
+  */
+-public class MidiUtils {
++public final class MidiUtils {
+ 
+     public final static int DEFAULT_TEMPO_MPQ = 500000; // 120bpm
+     public final static int META_END_OF_TRACK_TYPE = 0x2F;
+     public final static int META_TEMPO_TYPE = 0x51;
+ 
++    /**
++     * Suppresses default constructor, ensuring non-instantiability.
++     */
++    private MidiUtils() {
++    }
+ 
+     /** return true if the passed message is Meta End Of Track */
+     public static boolean isMetaEndOfTrack(MidiMessage midiMsg) {
+@@ -262,7 +267,7 @@
+     }
+ 
+ 
+-    public static class TempoCache {
++    public static final class TempoCache {
+         long[] ticks;
+         int[] tempos; // in MPQ
+         // index in ticks/tempos at the snapshot
+diff --git a/src/share/classes/com/sun/media/sound/ModelByteBuffer.java b/src/share/classes/com/sun/media/sound/ModelByteBuffer.java
+--- jdk/src/share/classes/com/sun/media/sound/ModelByteBuffer.java
++++ jdk/src/share/classes/com/sun/media/sound/ModelByteBuffer.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -38,7 +38,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class ModelByteBuffer {
++public final class ModelByteBuffer {
+ 
+     private ModelByteBuffer root = this;
+     private File file;
+@@ -49,12 +49,12 @@
+ 
+     private class RandomFileInputStream extends InputStream {
+ 
+-        private RandomAccessFile raf;
++        private final RandomAccessFile raf;
+         private long left;
+         private long mark = 0;
+         private long markleft = 0;
+ 
+-        public RandomFileInputStream() throws IOException {
++        RandomFileInputStream() throws IOException {
+             raf = new RandomAccessFile(root.file, "r");
+             raf.seek(root.fileoffset + arrayOffset());
+             left = capacity();
+diff --git a/src/share/classes/com/sun/media/sound/ModelByteBufferWavetable.java b/src/share/classes/com/sun/media/sound/ModelByteBufferWavetable.java
+--- jdk/src/share/classes/com/sun/media/sound/ModelByteBufferWavetable.java
++++ jdk/src/share/classes/com/sun/media/sound/ModelByteBufferWavetable.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -36,18 +36,18 @@
+  *
+  * @author Karl Helgason
+  */
+-public class ModelByteBufferWavetable implements ModelWavetable {
++public final class ModelByteBufferWavetable implements ModelWavetable {
+ 
+     private class Buffer8PlusInputStream extends InputStream {
+ 
+-        private boolean bigendian;
+-        private int framesize_pc;
++        private final boolean bigendian;
++        private final int framesize_pc;
+         int pos = 0;
+         int pos2 = 0;
+         int markpos = 0;
+         int markpos2 = 0;
+ 
+-        public Buffer8PlusInputStream() {
++        Buffer8PlusInputStream() {
+             framesize_pc = format.getFrameSize() / format.getChannels();
+             bigendian = format.isBigEndian();
+         }
+@@ -127,7 +127,7 @@
+ 
+     private float loopStart = -1;
+     private float loopLength = -1;
+-    private ModelByteBuffer buffer;
++    private final ModelByteBuffer buffer;
+     private ModelByteBuffer buffer8 = null;
+     private AudioFormat format = null;
+     private float pitchcorrection = 0;
+diff --git a/src/share/classes/com/sun/media/sound/ModelConnectionBlock.java b/src/share/classes/com/sun/media/sound/ModelConnectionBlock.java
+--- jdk/src/share/classes/com/sun/media/sound/ModelConnectionBlock.java
++++ jdk/src/share/classes/com/sun/media/sound/ModelConnectionBlock.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -32,7 +32,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class ModelConnectionBlock {
++public final class ModelConnectionBlock {
+ 
+     //
+     //   source1 * source2 * scale -> destination
+diff --git a/src/share/classes/com/sun/media/sound/ModelDestination.java b/src/share/classes/com/sun/media/sound/ModelDestination.java
+--- jdk/src/share/classes/com/sun/media/sound/ModelDestination.java
++++ jdk/src/share/classes/com/sun/media/sound/ModelDestination.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -30,7 +30,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class ModelDestination {
++public final class ModelDestination {
+ 
+     public static final ModelIdentifier DESTINATION_NONE = null;
+     public static final ModelIdentifier DESTINATION_KEYNUMBER
+diff --git a/src/share/classes/com/sun/media/sound/ModelIdentifier.java b/src/share/classes/com/sun/media/sound/ModelIdentifier.java
+--- jdk/src/share/classes/com/sun/media/sound/ModelIdentifier.java
++++ jdk/src/share/classes/com/sun/media/sound/ModelIdentifier.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -30,7 +30,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class ModelIdentifier {
++public final class ModelIdentifier {
+ 
+     /*
+      *  Object    Variable
+diff --git a/src/share/classes/com/sun/media/sound/ModelInstrument.java b/src/share/classes/com/sun/media/sound/ModelInstrument.java
+--- jdk/src/share/classes/com/sun/media/sound/ModelInstrument.java
++++ jdk/src/share/classes/com/sun/media/sound/ModelInstrument.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -69,7 +69,7 @@
+     }
+ 
+     // Get General MIDI 2 Alias patch for this instrument.
+-    public Patch getPatchAlias() {
++    public final Patch getPatchAlias() {
+         Patch patch = getPatch();
+         int program = patch.getProgram();
+         int bank = patch.getBank();
+@@ -87,7 +87,7 @@
+     // Return name of all the keys.
+     // This information is generated from ModelPerformer.getName()
+     // returned from getPerformers().
+-    public String[] getKeys() {
++    public final String[] getKeys() {
+         String[] keys = new String[128];
+         for (ModelPerformer performer : getPerformers()) {
+             for (int k = performer.getKeyFrom(); k <= performer.getKeyTo(); k++) {
+@@ -104,7 +104,7 @@
+ 
+     // Return what channels this instrument will probably response
+     // on General MIDI synthesizer.
+-    public boolean[] getChannels() {
++    public final boolean[] getChannels() {
+         boolean percussion = false;
+         if (getPatch() instanceof ModelPatch)
+             percussion = ((ModelPatch)getPatch()).isPercussion();
+diff --git a/src/share/classes/com/sun/media/sound/ModelInstrumentComparator.java b/src/share/classes/com/sun/media/sound/ModelInstrumentComparator.java
+--- jdk/src/share/classes/com/sun/media/sound/ModelInstrumentComparator.java
++++ jdk/src/share/classes/com/sun/media/sound/ModelInstrumentComparator.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -34,7 +34,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class ModelInstrumentComparator implements Comparator<Instrument> {
++public final class ModelInstrumentComparator implements Comparator<Instrument> {
+ 
+     public int compare(Instrument arg0, Instrument arg1) {
+         Patch p0 = arg0.getPatch();
+diff --git a/src/share/classes/com/sun/media/sound/ModelMappedInstrument.java b/src/share/classes/com/sun/media/sound/ModelMappedInstrument.java
+--- jdk/src/share/classes/com/sun/media/sound/ModelMappedInstrument.java
++++ jdk/src/share/classes/com/sun/media/sound/ModelMappedInstrument.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -33,9 +33,9 @@
+  *
+  * @author Karl Helgason
+  */
+-public class ModelMappedInstrument extends ModelInstrument {
++public final class ModelMappedInstrument extends ModelInstrument {
+ 
+-    private ModelInstrument ins;
++    private final ModelInstrument ins;
+ 
+     public ModelMappedInstrument(ModelInstrument ins, Patch patch) {
+         super(ins.getSoundbank(), patch, ins.getName(), ins.getDataClass());
+diff --git a/src/share/classes/com/sun/media/sound/ModelPatch.java b/src/share/classes/com/sun/media/sound/ModelPatch.java
+--- jdk/src/share/classes/com/sun/media/sound/ModelPatch.java
++++ jdk/src/share/classes/com/sun/media/sound/ModelPatch.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -33,7 +33,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class ModelPatch extends Patch {
++public final class ModelPatch extends Patch {
+ 
+     private boolean percussion = false;
+ 
+diff --git a/src/share/classes/com/sun/media/sound/ModelPerformer.java b/src/share/classes/com/sun/media/sound/ModelPerformer.java
+--- jdk/src/share/classes/com/sun/media/sound/ModelPerformer.java
++++ jdk/src/share/classes/com/sun/media/sound/ModelPerformer.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -33,9 +33,9 @@
+  *
+  * @author Karl Helgason
+  */
+-public class ModelPerformer {
++public final class ModelPerformer {
+ 
+-    private List<ModelOscillator> oscillators = new ArrayList<ModelOscillator>();
++    private final List<ModelOscillator> oscillators = new ArrayList<ModelOscillator>();
+     private List<ModelConnectionBlock> connectionBlocks
+             = new ArrayList<ModelConnectionBlock>();
+     private int keyFrom = 0;
+diff --git a/src/share/classes/com/sun/media/sound/ModelSource.java b/src/share/classes/com/sun/media/sound/ModelSource.java
+--- jdk/src/share/classes/com/sun/media/sound/ModelSource.java
++++ jdk/src/share/classes/com/sun/media/sound/ModelSource.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -30,7 +30,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class ModelSource {
++public final class ModelSource {
+ 
+     public static final ModelIdentifier SOURCE_NONE = null;
+     public static final ModelIdentifier SOURCE_NOTEON_KEYNUMBER =
+diff --git a/src/share/classes/com/sun/media/sound/ModelStandardDirector.java b/src/share/classes/com/sun/media/sound/ModelStandardDirector.java
+--- jdk/src/share/classes/com/sun/media/sound/ModelStandardDirector.java
++++ jdk/src/share/classes/com/sun/media/sound/ModelStandardDirector.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -30,7 +30,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class ModelStandardDirector implements ModelDirector {
++public final class ModelStandardDirector implements ModelDirector {
+ 
+     ModelPerformer[] performers;
+     ModelDirectedPlayer player;
+diff --git a/src/share/classes/com/sun/media/sound/ModelStandardIndexedDirector.java b/src/share/classes/com/sun/media/sound/ModelStandardIndexedDirector.java
+--- jdk/src/share/classes/com/sun/media/sound/ModelStandardIndexedDirector.java
++++ jdk/src/share/classes/com/sun/media/sound/ModelStandardIndexedDirector.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2010, 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
+@@ -30,7 +30,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class ModelStandardIndexedDirector implements ModelDirector {
++public final class ModelStandardIndexedDirector implements ModelDirector {
+ 
+     ModelPerformer[] performers;
+     ModelDirectedPlayer player;
+diff --git a/src/share/classes/com/sun/media/sound/ModelStandardTransform.java b/src/share/classes/com/sun/media/sound/ModelStandardTransform.java
+--- jdk/src/share/classes/com/sun/media/sound/ModelStandardTransform.java
++++ jdk/src/share/classes/com/sun/media/sound/ModelStandardTransform.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -36,7 +36,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class ModelStandardTransform implements ModelTransform {
++public final class ModelStandardTransform implements ModelTransform {
+ 
+     public static final boolean DIRECTION_MIN2MAX = false;
+     public static final boolean DIRECTION_MAX2MIN = true;
+diff --git a/src/share/classes/com/sun/media/sound/PCMtoPCMCodec.java b/src/share/classes/com/sun/media/sound/PCMtoPCMCodec.java
+--- jdk/src/share/classes/com/sun/media/sound/PCMtoPCMCodec.java
++++ jdk/src/share/classes/com/sun/media/sound/PCMtoPCMCodec.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
+@@ -25,14 +25,12 @@
+ 
+ package com.sun.media.sound;
+ 
+-import java.io.InputStream;
+ import java.io.IOException;
+-
+ import java.util.Vector;
+ 
+ import javax.sound.sampled.AudioFormat;
++import javax.sound.sampled.AudioInputStream;
+ import javax.sound.sampled.AudioSystem;
+-import javax.sound.sampled.AudioInputStream;
+ 
+ 
+ /**
+@@ -40,7 +38,7 @@
+  *
+  * @author Jan Borgersen
+  */
+-public class PCMtoPCMCodec extends SunCodec {
++public final class PCMtoPCMCodec extends SunCodec {
+ 
+ 
+     private static final AudioFormat.Encoding[] inputEncodings = {
+@@ -356,7 +354,7 @@
+         private final int PCM_UNSIGNED_BE2SIGNED_LE             = 7;
+         private final int PCM_SIGNED_BE2UNSIGNED_LE             = 8;
+ 
+-        private int sampleSizeInBytes = 0;
++        private final int sampleSizeInBytes;
+         private int conversionType = 0;
+ 
+ 
+diff --git a/src/share/classes/com/sun/media/sound/Platform.java b/src/share/classes/com/sun/media/sound/Platform.java
+--- jdk/src/share/classes/com/sun/media/sound/Platform.java
++++ jdk/src/share/classes/com/sun/media/sound/Platform.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
+@@ -25,6 +25,8 @@
+ 
+ package com.sun.media.sound;
+ 
++import java.security.AccessController;
++import java.security.PrivilegedAction;
+ import java.util.StringTokenizer;
+ 
+ 
+@@ -35,7 +37,7 @@
+  * @author Kara Kytle
+  * @author Florian Bomers
+  */
+-class Platform {
++final class Platform {
+ 
+ 
+     // STATIC FINAL CHARACTERISTICS
+@@ -157,7 +159,13 @@
+ 
+         try {
+             // load the main library
+-            JSSecurityManager.loadLibrary(libNameMain);
++            AccessController.doPrivileged(new PrivilegedAction<Void>() {
++                @Override
++                public Void run() {
++                    System.loadLibrary(libNameMain);
++                    return null;
++                }
++            });
+             // just for the heck of it...
+             loadedLibs |= LIB_MAIN;
+         } catch (SecurityException e) {
+@@ -171,9 +179,16 @@
+         // the string is the libraries, separated by white space
+         StringTokenizer st = new StringTokenizer(extraLibs);
+         while (st.hasMoreTokens()) {
+-            String lib = st.nextToken();
++            final String lib = st.nextToken();
+             try {
+-                JSSecurityManager.loadLibrary(lib);
++                AccessController.doPrivileged(new PrivilegedAction<Void>() {
++                    @Override
++                    public Void run() {
++                        System.loadLibrary(lib);
++                        return null;
++                    }
++                });
++
+                 if (lib.equals(libNameALSA)) {
+                     loadedLibs |= LIB_ALSA;
+                     if (Printer.debug) Printer.debug("Loaded ALSA lib successfully.");
+diff --git a/src/share/classes/com/sun/media/sound/PortMixer.java b/src/share/classes/com/sun/media/sound/PortMixer.java
+--- jdk/src/share/classes/com/sun/media/sound/PortMixer.java
++++ jdk/src/share/classes/com/sun/media/sound/PortMixer.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
+@@ -41,7 +41,7 @@
+  *
+  * @author Florian Bomers
+  */
+-class PortMixer extends AbstractMixer {
++final class PortMixer extends AbstractMixer {
+ 
+     // CONSTANTS
+     private static final int SRC_UNKNOWN      = 0x01;
+@@ -228,8 +228,10 @@
+     /**
+      * Private inner class representing a Port for the PortMixer.
+      */
+-    private static class PortMixerPort extends AbstractLine implements Port {
+-        private int portIndex;
++    private static final class PortMixerPort extends AbstractLine
++            implements Port {
++
++        private final int portIndex;
+         private long id;
+ 
+         // CONSTRUCTOR
+@@ -342,9 +344,9 @@
+     /**
+      * Private inner class representing a BooleanControl for PortMixerPort
+      */
+-    private static class BoolCtrl extends BooleanControl {
++    private static final class BoolCtrl extends BooleanControl {
+         // the handle to the native control function
+-        private long controlID;
++        private final long controlID;
+         private boolean closed = false;
+ 
+         private static BooleanControl.Type createType(String name) {
+@@ -386,7 +388,7 @@
+         /**
+          * inner class for custom types
+          */
+-        private static class BCT extends BooleanControl.Type {
++        private static final class BCT extends BooleanControl.Type {
+             private BCT(String name) {
+                 super(name);
+             }
+@@ -396,7 +398,7 @@
+     /**
+      * Private inner class representing a CompoundControl for PortMixerPort
+      */
+-    private static class CompCtrl extends CompoundControl {
++    private static final class CompCtrl extends CompoundControl {
+         private CompCtrl(String name, Control[] controls) {
+             super(new CCT(name), controls);
+         }
+@@ -404,7 +406,7 @@
+         /**
+          * inner class for custom compound control types
+          */
+-        private static class CCT extends CompoundControl.Type {
++        private static final class CCT extends CompoundControl.Type {
+             private CCT(String name) {
+                 super(name);
+             }
+@@ -414,9 +416,9 @@
+     /**
+      * Private inner class representing a BooleanControl for PortMixerPort
+      */
+-    private static class FloatCtrl extends FloatControl {
++    private static final class FloatCtrl extends FloatControl {
+         // the handle to the native control function
+-        private long controlID;
++        private final long controlID;
+         private boolean closed = false;
+ 
+         // predefined float control types. See also Ports.h
+@@ -462,7 +464,7 @@
+         /**
+          * inner class for custom types
+          */
+-        private static class FCT extends FloatControl.Type {
++        private static final class FCT extends FloatControl.Type {
+             private FCT(String name) {
+                 super(name);
+             }
+@@ -472,7 +474,7 @@
+     /**
+      * Private inner class representing a port info
+      */
+-    private static class PortInfo extends Port.Info {
++    private static final class PortInfo extends Port.Info {
+         private PortInfo(String name, boolean isSource) {
+             super(Port.class, name, isSource);
+         }
+diff --git a/src/share/classes/com/sun/media/sound/PortMixerProvider.java b/src/share/classes/com/sun/media/sound/PortMixerProvider.java
+--- jdk/src/share/classes/com/sun/media/sound/PortMixerProvider.java
++++ jdk/src/share/classes/com/sun/media/sound/PortMixerProvider.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
+@@ -25,8 +25,6 @@
+ 
+ package com.sun.media.sound;
+ 
+-import java.util.Vector;
+-
+ import javax.sound.sampled.Mixer;
+ import javax.sound.sampled.spi.MixerProvider;
+ 
+@@ -36,7 +34,7 @@
+  *
+  * @author Florian Bomers
+  */
+-public class PortMixerProvider extends MixerProvider {
++public final class PortMixerProvider extends MixerProvider {
+ 
+     // STATIC VARIABLES
+ 
+@@ -66,16 +64,17 @@
+      * Required public no-arg constructor.
+      */
+     public PortMixerProvider() {
+-        //if (Printer.trace) Printer.trace("PortMixerProvider: constructor");
+-        if (Platform.isPortsEnabled()) {
+-            init();
+-        } else {
+-            infos = new PortMixerInfo[0];
+-            devices = new PortMixer[0];
++        synchronized (PortMixerProvider.class) {
++            if (Platform.isPortsEnabled()) {
++                init();
++            } else {
++                infos = new PortMixerInfo[0];
++                devices = new PortMixer[0];
++            }
+         }
+     }
+ 
+-    private static synchronized void init() {
++    private static void init() {
+         // get the number of input devices
+         int numDevices = nGetNumDevices();
+ 
+@@ -95,23 +94,28 @@
+     }
+ 
+     public Mixer.Info[] getMixerInfo() {
+-        Mixer.Info[] localArray = new Mixer.Info[infos.length];
+-        System.arraycopy(infos, 0, localArray, 0, infos.length);
+-        return localArray;
++        synchronized (PortMixerProvider.class) {
++            Mixer.Info[] localArray = new Mixer.Info[infos.length];
++            System.arraycopy(infos, 0, localArray, 0, infos.length);
++            return localArray;
++        }
+     }
+ 
+ 
+     public Mixer getMixer(Mixer.Info info) {
+-        for (int i = 0; i < infos.length; i++) {
+-            if (infos[i].equals(info)) {
+-                return getDevice(infos[i]);
++        synchronized (PortMixerProvider.class) {
++            for (int i = 0; i < infos.length; i++) {
++                if (infos[i].equals(info)) {
++                    return getDevice(infos[i]);
++                }
+             }
+         }
+-        throw new IllegalArgumentException("Mixer " + info.toString() + " not supported by this provider.");
++        throw new IllegalArgumentException("Mixer " + info.toString()
++                                           + " not supported by this provider.");
+     }
+ 
+ 
+-    private Mixer getDevice(PortMixerInfo info) {
++    private static Mixer getDevice(PortMixerInfo info) {
+         int index = info.getIndex();
+         if (devices[index] == null) {
+             devices[index] = new PortMixer(info);
+@@ -127,8 +131,8 @@
+      * making native references to a particular device.
+      * This constructor is called from native.
+      */
+-    static class PortMixerInfo extends Mixer.Info {
+-        private int index;
++    static final class PortMixerInfo extends Mixer.Info {
++        private final int index;
+ 
+         private PortMixerInfo(int index, String name, String vendor, String description, String version) {
+             super("Port " + name, vendor, description, version);
+diff --git a/src/share/classes/com/sun/media/sound/Printer.java b/src/share/classes/com/sun/media/sound/Printer.java
+--- jdk/src/share/classes/com/sun/media/sound/Printer.java
++++ jdk/src/share/classes/com/sun/media/sound/Printer.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -32,7 +32,7 @@
+  * @author David Rivas
+  * @author Kara Kytle
+  */
+-class Printer {
++final class Printer {
+ 
+     static final boolean err = false;
+     static final boolean debug = false;
+@@ -68,6 +68,12 @@
+       release = on;
+       }*/
+ 
++    /**
++     * Suppresses default constructor, ensuring non-instantiability.
++     */
++    private Printer() {
++    }
++
+     public static void err(String str) {
+ 
+         if (err)
+diff --git a/src/share/classes/com/sun/media/sound/RIFFInvalidDataException.java b/src/share/classes/com/sun/media/sound/RIFFInvalidDataException.java
+--- jdk/src/share/classes/com/sun/media/sound/RIFFInvalidDataException.java
++++ jdk/src/share/classes/com/sun/media/sound/RIFFInvalidDataException.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -29,7 +29,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class RIFFInvalidDataException extends InvalidDataException {
++public final class RIFFInvalidDataException extends InvalidDataException {
+ 
+     private static final long serialVersionUID = 1L;
+ 
+diff --git a/src/share/classes/com/sun/media/sound/RIFFInvalidFormatException.java b/src/share/classes/com/sun/media/sound/RIFFInvalidFormatException.java
+--- jdk/src/share/classes/com/sun/media/sound/RIFFInvalidFormatException.java
++++ jdk/src/share/classes/com/sun/media/sound/RIFFInvalidFormatException.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -30,7 +30,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class RIFFInvalidFormatException extends InvalidFormatException {
++public final class RIFFInvalidFormatException extends InvalidFormatException {
+ 
+     private static final long serialVersionUID = 1L;
+ 
+diff --git a/src/share/classes/com/sun/media/sound/RIFFReader.java b/src/share/classes/com/sun/media/sound/RIFFReader.java
+--- jdk/src/share/classes/com/sun/media/sound/RIFFReader.java
++++ jdk/src/share/classes/com/sun/media/sound/RIFFReader.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -33,11 +33,11 @@
+  *
+  * @author Karl Helgason
+  */
+-public class RIFFReader extends InputStream {
++public final class RIFFReader extends InputStream {
+ 
+-    private RIFFReader root;
++    private final RIFFReader root;
+     private long filepointer = 0;
+-    private String fourcc;
++    private final String fourcc;
+     private String riff_type = null;
+     private long ckSize = 0;
+     private InputStream stream;
+diff --git a/src/share/classes/com/sun/media/sound/RIFFWriter.java b/src/share/classes/com/sun/media/sound/RIFFWriter.java
+--- jdk/src/share/classes/com/sun/media/sound/RIFFWriter.java
++++ jdk/src/share/classes/com/sun/media/sound/RIFFWriter.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -35,7 +35,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class RIFFWriter extends OutputStream {
++public final class RIFFWriter extends OutputStream {
+ 
+     private interface RandomAccessWriter {
+ 
+@@ -60,11 +60,11 @@
+ 
+         RandomAccessFile raf;
+ 
+-        public RandomAccessFileWriter(File file) throws FileNotFoundException {
++        RandomAccessFileWriter(File file) throws FileNotFoundException {
+             this.raf = new RandomAccessFile(file, "rw");
+         }
+ 
+-        public RandomAccessFileWriter(String name) throws FileNotFoundException {
++        RandomAccessFileWriter(String name) throws FileNotFoundException {
+             this.raf = new RandomAccessFile(name, "rw");
+         }
+ 
+@@ -107,9 +107,9 @@
+         int length = 0;
+         int pos = 0;
+         byte[] s;
+-        OutputStream stream;
++        final OutputStream stream;
+ 
+-        public RandomAccessByteWriter(OutputStream stream) {
++        RandomAccessByteWriter(OutputStream stream) {
+             this.stream = stream;
+         }
+ 
+@@ -163,8 +163,8 @@
+     }
+     private int chunktype = 0; // 0=RIFF, 1=LIST; 2=CHUNK
+     private RandomAccessWriter raf;
+-    private long chunksizepointer;
+-    private long startpointer;
++    private final long chunksizepointer;
++    private final long startpointer;
+     private RIFFWriter childchunk = null;
+     private boolean open = true;
+     private boolean writeoverride = false;
+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
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -25,14 +25,13 @@
+ 
+ package com.sun.media.sound;
+ 
+-import java.io.ByteArrayOutputStream;
+-import java.io.ByteArrayInputStream;
+-import java.io.DataOutputStream;
+ import java.io.IOException;
+ import java.io.InputStream;
+ 
+ import java.util.ArrayList;
+ import java.util.List;
++import java.util.Map;
++import java.util.WeakHashMap;
+ 
+ import javax.sound.midi.*;
+ 
+@@ -46,7 +45,8 @@
+ /* TODO:
+  * - rename PlayThread to PlayEngine (because isn't a thread)
+  */
+-class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoConnectSequencer {
++final class RealTimeSequencer extends AbstractMidiDevice
++        implements Sequencer, AutoConnectSequencer {
+ 
+     // STATIC VARIABLES
+ 
+@@ -58,7 +58,8 @@
+      * Event Dispatcher thread. Should be using a shared event
+      * dispatcher instance with a factory in EventDispatcher
+      */
+-    private static final EventDispatcher eventDispatcher;
++    private static final Map<ThreadGroup, EventDispatcher> dispatchers =
++            new WeakHashMap<>();
+ 
+     /**
+      * All RealTimeSequencers share this info object.
+@@ -66,11 +67,11 @@
+     static final RealTimeSequencerInfo info = new RealTimeSequencerInfo();
+ 
+ 
+-    private static Sequencer.SyncMode[] masterSyncModes = { Sequencer.SyncMode.INTERNAL_CLOCK };
+-    private static Sequencer.SyncMode[] slaveSyncModes  = { Sequencer.SyncMode.NO_SYNC };
++    private static final Sequencer.SyncMode[] masterSyncModes = { Sequencer.SyncMode.INTERNAL_CLOCK };
++    private static final Sequencer.SyncMode[] slaveSyncModes  = { Sequencer.SyncMode.NO_SYNC };
+ 
+-    private static Sequencer.SyncMode masterSyncMode    = Sequencer.SyncMode.INTERNAL_CLOCK;
+-    private static Sequencer.SyncMode slaveSyncMode     = Sequencer.SyncMode.NO_SYNC;
++    private static final Sequencer.SyncMode masterSyncMode    = Sequencer.SyncMode.INTERNAL_CLOCK;
++    private static final Sequencer.SyncMode slaveSyncMode     = Sequencer.SyncMode.NO_SYNC;
+ 
+ 
+     /**
+@@ -100,7 +101,7 @@
+     private boolean[] trackSolo = null;
+ 
+     /** tempo cache for getMicrosecondPosition */
+-    private MidiUtils.TempoCache tempoCache = new MidiUtils.TempoCache();
++    private final MidiUtils.TempoCache tempoCache = new MidiUtils.TempoCache();
+ 
+     /**
+      * True if the sequence is running.
+@@ -121,7 +122,7 @@
+     /**
+      * List of tracks to which we're recording
+      */
+-    private List recordingTracks = new ArrayList();
++    private final List recordingTracks = new ArrayList();
+ 
+ 
+     private long loopStart = 0;
+@@ -132,13 +133,13 @@
+     /**
+      * Meta event listeners
+      */
+-    private ArrayList metaEventListeners = new ArrayList();
++    private final ArrayList metaEventListeners = new ArrayList();
+ 
+ 
+     /**
+      * Control change listeners
+      */
+-    private ArrayList controllerEventListeners = new ArrayList();
++    private final ArrayList controllerEventListeners = new ArrayList();
+ 
+ 
+     /** automatic connection support */
+@@ -151,16 +152,9 @@
+     Receiver autoConnectedReceiver = null;
+ 
+ 
+-    static {
+-        // create and start the global event thread
+-        eventDispatcher = new EventDispatcher();
+-        eventDispatcher.start();
+-    }
+-
+-
+     /* ****************************** CONSTRUCTOR ****************************** */
+ 
+-    protected RealTimeSequencer() throws MidiUnavailableException {
++    RealTimeSequencer() throws MidiUnavailableException {
+         super(info);
+ 
+         if (Printer.trace) Printer.trace(">> RealTimeSequencer CONSTRUCTOR");
+@@ -574,7 +568,7 @@
+         return returnedModes;
+     }
+ 
+-    protected int getTrackCount() {
++    int getTrackCount() {
+         Sequence seq = getSequence();
+         if (seq != null) {
+             // $$fb wish there was a nicer way to get the number of tracks...
+@@ -865,7 +859,7 @@
+         if (Printer.trace) Printer.trace("<< RealTimeSequencer: implClose() completed");
+     }
+ 
+-    protected void implStart() {
++    void implStart() {
+         if (Printer.trace) Printer.trace(">> RealTimeSequencer: implStart()");
+ 
+         if (playThread == null) {
+@@ -882,7 +876,7 @@
+     }
+ 
+ 
+-    protected void implStop() {
++    void implStop() {
+         if (Printer.trace) Printer.trace(">> RealTimeSequencer: implStop()");
+ 
+         if (playThread == null) {
+@@ -898,22 +892,36 @@
+         if (Printer.trace) Printer.trace("<< RealTimeSequencer: implStop() completed");
+     }
+ 
++    private static EventDispatcher getEventDispatcher() {
++        // create and start the global event thread
++        //TODO  need a way to stop this thread when the engine is done
++        final ThreadGroup tg = Thread.currentThread().getThreadGroup();
++        synchronized (dispatchers) {
++            EventDispatcher eventDispatcher = dispatchers.get(tg);
++            if (eventDispatcher == null) {
++                eventDispatcher = new EventDispatcher();
++                dispatchers.put(tg, eventDispatcher);
++                eventDispatcher.start();
++            }
++            return eventDispatcher;
++        }
++    }
+ 
+     /**
+      * Send midi player events.
+      * must not be synchronized on "this"
+      */
+-    protected void sendMetaEvents(MidiMessage message) {
++    void sendMetaEvents(MidiMessage message) {
+         if (metaEventListeners.size() == 0) return;
+ 
+         //if (Printer.debug) Printer.debug("sending a meta event");
+-        eventDispatcher.sendAudioEvents(message, metaEventListeners);
++        getEventDispatcher().sendAudioEvents(message, metaEventListeners);
+     }
+ 
+     /**
+      * Send midi player events.
+      */
+-    protected void sendControllerEvents(MidiMessage message) {
++    void sendControllerEvents(MidiMessage message) {
+         int size = controllerEventListeners.size();
+         if (size == 0) return;
+ 
+@@ -935,7 +943,7 @@
+                 }
+             }
+         }
+-        eventDispatcher.sendAudioEvents(message, sendToListeners);
++        getEventDispatcher().sendAudioEvents(message, sendToListeners);
+     }
+ 
+ 
+@@ -1017,7 +1025,7 @@
+     }
+ 
+ 
+-    class SequencerReceiver extends AbstractReceiver {
++    final class SequencerReceiver extends AbstractReceiver {
+ 
+         void implSend(MidiMessage message, long timeStamp) {
+             if (recording) {
+@@ -1085,7 +1093,7 @@
+         //       easier to deal with than turning all the
+         //       ints into objects to use a Vector
+         int []  controllers;
+-        ControllerEventListener listener;
++        final ControllerEventListener listener;
+ 
+         private ControllerListElement(ControllerEventListener listener, int[] controllers) {
+ 
+@@ -1190,7 +1198,7 @@
+ 
+     static class RecordingTrack {
+ 
+-        private Track track;
++        private final Track track;
+         private int channel;
+ 
+         RecordingTrack(Track track, int channel) {
+@@ -1230,15 +1238,15 @@
+     }
+ 
+ 
+-    class PlayThread implements Runnable {
++    final class PlayThread implements Runnable {
+         private Thread thread;
+-        private Object lock = new Object();
++        private final Object lock = new Object();
+ 
+         /** true if playback is interrupted (in close) */
+         boolean interrupted = false;
+         boolean isPumping = false;
+ 
+-        private DataPump dataPump = new DataPump();
++        private final DataPump dataPump = new DataPump();
+ 
+ 
+         PlayThread() {
+diff --git a/src/share/classes/com/sun/media/sound/RealTimeSequencerProvider.java b/src/share/classes/com/sun/media/sound/RealTimeSequencerProvider.java
+--- jdk/src/share/classes/com/sun/media/sound/RealTimeSequencerProvider.java
++++ jdk/src/share/classes/com/sun/media/sound/RealTimeSequencerProvider.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -34,7 +34,7 @@
+  *
+  * @author Florian Bomers
+  */
+-public class RealTimeSequencerProvider extends MidiDeviceProvider {
++public final class RealTimeSequencerProvider extends MidiDeviceProvider {
+ 
+ 
+     public MidiDevice.Info[] getDeviceInfo() {
+diff --git a/src/share/classes/com/sun/media/sound/SF2GlobalRegion.java b/src/share/classes/com/sun/media/sound/SF2GlobalRegion.java
+--- jdk/src/share/classes/com/sun/media/sound/SF2GlobalRegion.java
++++ jdk/src/share/classes/com/sun/media/sound/SF2GlobalRegion.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -29,5 +29,5 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SF2GlobalRegion extends SF2Region {
++public final class SF2GlobalRegion extends SF2Region {
+ }
+diff --git a/src/share/classes/com/sun/media/sound/SF2Instrument.java b/src/share/classes/com/sun/media/sound/SF2Instrument.java
+--- jdk/src/share/classes/com/sun/media/sound/SF2Instrument.java
++++ jdk/src/share/classes/com/sun/media/sound/SF2Instrument.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -36,16 +36,16 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SF2Instrument extends ModelInstrument {
++public final class SF2Instrument extends ModelInstrument {
+ 
+-    protected String name = "";
+-    protected int preset = 0;
+-    protected int bank = 0;
+-    protected long library = 0;
+-    protected long genre = 0;
+-    protected long morphology = 0;
+-    protected SF2GlobalRegion globalregion = null;
+-    protected List<SF2InstrumentRegion> regions
++    String name = "";
++    int preset = 0;
++    int bank = 0;
++    long library = 0;
++    long genre = 0;
++    long morphology = 0;
++    SF2GlobalRegion globalregion = null;
++    List<SF2InstrumentRegion> regions
+             = new ArrayList<SF2InstrumentRegion>();
+ 
+     public SF2Instrument() {
+@@ -730,7 +730,7 @@
+         return msrc;
+     }
+ 
+-    protected static ModelDestination convertDestination(int dst,
++    static ModelDestination convertDestination(int dst,
+             double[] amountcorrection, ModelSource[] extrasrc) {
+         ModelIdentifier id = null;
+         switch (dst) {
+diff --git a/src/share/classes/com/sun/media/sound/SF2InstrumentRegion.java b/src/share/classes/com/sun/media/sound/SF2InstrumentRegion.java
+--- jdk/src/share/classes/com/sun/media/sound/SF2InstrumentRegion.java
++++ jdk/src/share/classes/com/sun/media/sound/SF2InstrumentRegion.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -29,9 +29,9 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SF2InstrumentRegion extends SF2Region {
++public final class SF2InstrumentRegion extends SF2Region {
+ 
+-    protected SF2Layer layer;
++    SF2Layer layer;
+ 
+     public SF2Layer getLayer() {
+         return layer;
+diff --git a/src/share/classes/com/sun/media/sound/SF2Layer.java b/src/share/classes/com/sun/media/sound/SF2Layer.java
+--- jdk/src/share/classes/com/sun/media/sound/SF2Layer.java
++++ jdk/src/share/classes/com/sun/media/sound/SF2Layer.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -34,11 +34,11 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SF2Layer extends SoundbankResource {
++public final class SF2Layer extends SoundbankResource {
+ 
+-    protected String name = "";
+-    protected SF2GlobalRegion globalregion = null;
+-    protected List<SF2LayerRegion> regions = new ArrayList<SF2LayerRegion>();
++    String name = "";
++    SF2GlobalRegion globalregion = null;
++    List<SF2LayerRegion> regions = new ArrayList<SF2LayerRegion>();
+ 
+     public SF2Layer(SF2Soundbank soundBank) {
+         super(soundBank, null, null);
+diff --git a/src/share/classes/com/sun/media/sound/SF2LayerRegion.java b/src/share/classes/com/sun/media/sound/SF2LayerRegion.java
+--- jdk/src/share/classes/com/sun/media/sound/SF2LayerRegion.java
++++ jdk/src/share/classes/com/sun/media/sound/SF2LayerRegion.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -29,9 +29,9 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SF2LayerRegion extends SF2Region {
++public final class SF2LayerRegion extends SF2Region {
+ 
+-    protected SF2Sample sample;
++    SF2Sample sample;
+ 
+     public SF2Sample getSample() {
+         return sample;
+diff --git a/src/share/classes/com/sun/media/sound/SF2Modulator.java b/src/share/classes/com/sun/media/sound/SF2Modulator.java
+--- jdk/src/share/classes/com/sun/media/sound/SF2Modulator.java
++++ jdk/src/share/classes/com/sun/media/sound/SF2Modulator.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -29,7 +29,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SF2Modulator {
++public final class SF2Modulator {
+ 
+     public final static int SOURCE_NONE = 0;
+     public final static int SOURCE_NOTE_ON_VELOCITY = 2;
+@@ -49,11 +49,11 @@
+     public final static int SOURCE_TYPE_SWITCH = 1024 * 3;
+     public final static int TRANSFORM_LINEAR = 0;
+     public final static int TRANSFORM_ABSOLUTE = 2;
+-    protected int sourceOperator;
+-    protected int destinationOperator;
+-    protected short amount;
+-    protected int amountSourceOperator;
+-    protected int transportOperator;
++    int sourceOperator;
++    int destinationOperator;
++    short amount;
++    int amountSourceOperator;
++    int transportOperator;
+ 
+     public short getAmount() {
+         return amount;
+diff --git a/src/share/classes/com/sun/media/sound/SF2Sample.java b/src/share/classes/com/sun/media/sound/SF2Sample.java
+--- jdk/src/share/classes/com/sun/media/sound/SF2Sample.java
++++ jdk/src/share/classes/com/sun/media/sound/SF2Sample.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -36,18 +36,18 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SF2Sample extends SoundbankResource {
++public final class SF2Sample extends SoundbankResource {
+ 
+-    protected String name = "";
+-    protected long startLoop = 0;
+-    protected long endLoop = 0;
+-    protected long sampleRate = 44100;
+-    protected int originalPitch = 60;
+-    protected byte pitchCorrection = 0;
+-    protected int sampleLink = 0;
+-    protected int sampleType = 0;
+-    protected ModelByteBuffer data;
+-    protected ModelByteBuffer data24;
++    String name = "";
++    long startLoop = 0;
++    long endLoop = 0;
++    long sampleRate = 44100;
++    int originalPitch = 60;
++    byte pitchCorrection = 0;
++    int sampleLink = 0;
++    int sampleType = 0;
++    ModelByteBuffer data;
++    ModelByteBuffer data24;
+ 
+     public SF2Sample(Soundbank soundBank) {
+         super(soundBank, null, AudioInputStream.class);
+diff --git a/src/share/classes/com/sun/media/sound/SF2Soundbank.java b/src/share/classes/com/sun/media/sound/SF2Soundbank.java
+--- jdk/src/share/classes/com/sun/media/sound/SF2Soundbank.java
++++ jdk/src/share/classes/com/sun/media/sound/SF2Soundbank.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -50,40 +50,40 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SF2Soundbank implements Soundbank {
++public final class SF2Soundbank implements Soundbank {
+ 
+     // version of the Sound Font RIFF file
+-    protected int major = 2;
+-    protected int minor = 1;
++    int major = 2;
++    int minor = 1;
+     // target Sound Engine
+-    protected String targetEngine = "EMU8000";
++    String targetEngine = "EMU8000";
+     // Sound Font Bank Name
+-    protected String name = "untitled";
++    String name = "untitled";
+     // Sound ROM Name
+-    protected String romName = null;
++    String romName = null;
+     // Sound ROM Version
+-    protected int romVersionMajor = -1;
+-    protected int romVersionMinor = -1;
++    int romVersionMajor = -1;
++    int romVersionMinor = -1;
+     // Date of Creation of the Bank
+-    protected String creationDate = null;
++    String creationDate = null;
+     // Sound Designers and Engineers for the Bank
+-    protected String engineers = null;
++    String engineers = null;
+     // Product for which the Bank was intended
+-    protected String product = null;
++    String product = null;
+     // Copyright message
+-    protected String copyright = null;
++    String copyright = null;
+     // Comments
+-    protected String comments = null;
++    String comments = null;
+     // The SoundFont tools used to create and alter the bank
+-    protected String tools = null;
++    String tools = null;
+     // The Sample Data loaded from the SoundFont
+     private ModelByteBuffer sampleData = null;
+     private ModelByteBuffer sampleData24 = null;
+     private File sampleFile = null;
+     private boolean largeFormat = false;
+-    private List<SF2Instrument> instruments = new ArrayList<SF2Instrument>();
+-    private List<SF2Layer> layers = new ArrayList<SF2Layer>();
+-    private List<SF2Sample> samples = new ArrayList<SF2Sample>();
++    private final List<SF2Instrument> instruments = new ArrayList<SF2Instrument>();
++    private final List<SF2Layer> layers = new ArrayList<SF2Layer>();
++    private final List<SF2Sample> samples = new ArrayList<SF2Sample>();
+ 
+     public SF2Soundbank() {
+     }
+diff --git a/src/share/classes/com/sun/media/sound/SF2SoundbankReader.java b/src/share/classes/com/sun/media/sound/SF2SoundbankReader.java
+--- jdk/src/share/classes/com/sun/media/sound/SF2SoundbankReader.java
++++ jdk/src/share/classes/com/sun/media/sound/SF2SoundbankReader.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -38,7 +38,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SF2SoundbankReader extends SoundbankReader {
++public final class SF2SoundbankReader extends SoundbankReader {
+ 
+     public Soundbank getSoundbank(URL url)
+             throws InvalidMidiDataException, IOException {
+diff --git a/src/share/classes/com/sun/media/sound/SoftAbstractResampler.java b/src/share/classes/com/sun/media/sound/SoftAbstractResampler.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftAbstractResampler.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftAbstractResampler.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -67,7 +67,7 @@
+         float samplerateconv = 1;
+         float pitchcorrection = 0;
+ 
+-        public ModelAbstractResamplerStream() {
++        ModelAbstractResamplerStream() {
+             pad = getPadding();
+             pad2 = getPadding() * 2;
+             ibuffer = new float[2][sector_size + pad2];
+@@ -384,7 +384,7 @@
+             float in_end, float[] pitch, float pitchstep, float[] out,
+             int[] out_offset, int out_end);
+ 
+-    public SoftResamplerStreamer openStreamer() {
++    public final SoftResamplerStreamer openStreamer() {
+         return new ModelAbstractResamplerStream();
+     }
+ }
+diff --git a/src/share/classes/com/sun/media/sound/SoftAudioBuffer.java b/src/share/classes/com/sun/media/sound/SoftAudioBuffer.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftAudioBuffer.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftAudioBuffer.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -33,7 +33,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SoftAudioBuffer {
++public final class SoftAudioBuffer {
+ 
+     private int size;
+     private float[] buffer;
+diff --git a/src/share/classes/com/sun/media/sound/SoftAudioPusher.java b/src/share/classes/com/sun/media/sound/SoftAudioPusher.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftAudioPusher.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftAudioPusher.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -34,13 +34,13 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SoftAudioPusher implements Runnable {
++public final class SoftAudioPusher implements Runnable {
+ 
+     private volatile boolean active = false;
+     private SourceDataLine sourceDataLine = null;
+     private Thread audiothread;
+-    private AudioInputStream ais;
+-    private byte[] buffer;
++    private final AudioInputStream ais;
++    private final byte[] buffer;
+ 
+     public SoftAudioPusher(SourceDataLine sourceDataLine, AudioInputStream ais,
+             int workbuffersizer) {
+diff --git a/src/share/classes/com/sun/media/sound/SoftChannel.java b/src/share/classes/com/sun/media/sound/SoftChannel.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftChannel.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftChannel.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -39,7 +39,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SoftChannel implements MidiChannel, ModelDirectedPlayer {
++public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
+ 
+     private static boolean[] dontResetControls = new boolean[128];
+     static {
+@@ -90,15 +90,15 @@
+     private static final int RPN_NULL_VALUE = (127 << 7) + 127;
+     private int rpn_control = RPN_NULL_VALUE;
+     private int nrpn_control = RPN_NULL_VALUE;
+-    protected double portamento_time = 1; // keyschanges per control buffer time
+-    protected int[] portamento_lastnote = new int[128];
+-    protected int portamento_lastnote_ix = 0;
++    double portamento_time = 1; // keyschanges per control buffer time
++    int[] portamento_lastnote = new int[128];
++    int portamento_lastnote_ix = 0;
+     private boolean portamento = false;
+     private boolean mono = false;
+     private boolean mute = false;
+     private boolean solo = false;
+     private boolean solomute = false;
+-    private Object control_mutex;
++    private final Object control_mutex;
+     private int channel;
+     private SoftVoice[] voices;
+     private int bank;
+@@ -111,21 +111,21 @@
+     private int pitchbend;
+     private double[] co_midi_pitch = new double[1];
+     private double[] co_midi_channel_pressure = new double[1];
+-    protected SoftTuning tuning = new SoftTuning();
+-    protected int tuning_bank = 0;
+-    protected int tuning_program = 0;
+-    protected SoftInstrument current_instrument = null;
+-    protected ModelChannelMixer current_mixer = null;
+-    protected ModelDirector current_director = null;
++    SoftTuning tuning = new SoftTuning();
++    int tuning_bank = 0;
++    int tuning_program = 0;
++    SoftInstrument current_instrument = null;
++    ModelChannelMixer current_mixer = null;
++    ModelDirector current_director = null;
+ 
+     // Controller Destination Settings
+-    protected int cds_control_number = -1;
+-    protected ModelConnectionBlock[] cds_control_connections = null;
+-    protected ModelConnectionBlock[] cds_channelpressure_connections = null;
+-    protected ModelConnectionBlock[] cds_polypressure_connections = null;
+-    protected boolean sustain = false;
+-    protected boolean[][] keybasedcontroller_active = null;
+-    protected double[][] keybasedcontroller_value = null;
++    int cds_control_number = -1;
++    ModelConnectionBlock[] cds_control_connections = null;
++    ModelConnectionBlock[] cds_channelpressure_connections = null;
++    ModelConnectionBlock[] cds_polypressure_connections = null;
++    boolean sustain = false;
++    boolean[][] keybasedcontroller_active = null;
++    double[][] keybasedcontroller_value = null;
+ 
+     private class MidiControlObject implements SoftControl {
+         double[] pitch = co_midi_pitch;
+@@ -336,7 +336,7 @@
+ 
+     }
+ 
+-    protected void initVoice(SoftVoice voice, SoftPerformer p, int voiceID,
++    void initVoice(SoftVoice voice, SoftPerformer p, int voiceID,
+             int noteNumber, int velocity, int delay, ModelConnectionBlock[] connectionBlocks,
+             ModelChannelMixer channelmixer, boolean releaseTriggered) {
+         if (voice.active) {
+@@ -414,7 +414,7 @@
+     /* A special noteOn with delay parameter, which is used to
+      * start note within control buffers.   
+      */
+-    protected void noteOn(int noteNumber, int velocity, int delay) {
++    void noteOn(int noteNumber, int velocity, int delay) {
+         noteNumber = restrict7Bit(noteNumber);
+         velocity = restrict7Bit(velocity);        
+         noteOn_internal(noteNumber, velocity, delay);
+@@ -707,7 +707,7 @@
+         }
+     }
+ 
+-    protected void applyInstrumentCustomization() {
++    void applyInstrumentCustomization() {
+         if (cds_control_connections == null
+                 && cds_channelpressure_connections == null
+                 && cds_polypressure_connections == null) {
+diff --git a/src/share/classes/com/sun/media/sound/SoftChannelProxy.java b/src/share/classes/com/sun/media/sound/SoftChannelProxy.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftChannelProxy.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftChannelProxy.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2008, 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
+@@ -32,7 +32,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SoftChannelProxy implements MidiChannel {
++public final class SoftChannelProxy implements MidiChannel {
+ 
+     private MidiChannel channel = null;
+ 
+diff --git a/src/share/classes/com/sun/media/sound/SoftChorus.java b/src/share/classes/com/sun/media/sound/SoftChorus.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftChorus.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftChorus.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -32,11 +32,11 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SoftChorus implements SoftAudioProcessor {
++public final class SoftChorus implements SoftAudioProcessor {
+ 
+     private static class VariableDelay {
+ 
+-        private float[] delaybuffer;
++        private final float[] delaybuffer;
+         private int rovepos = 0;
+         private float gain = 1;
+         private float rgain = 0;
+@@ -44,7 +44,7 @@
+         private float lastdelay = 0;
+         private float feedback = 0;
+ 
+-        public VariableDelay(int maxbuffersize) {
++        VariableDelay(int maxbuffersize) {
+             delaybuffer = new float[maxbuffersize];
+         }
+ 
+@@ -119,10 +119,10 @@
+         private double phase_step = 0;
+         private double depth = 0;
+         private VariableDelay vdelay;
+-        private double samplerate;
+-        private double controlrate;
++        private final double samplerate;
++        private final double controlrate;
+ 
+-        public LFODelay(double samplerate, double controlrate) {
++        LFODelay(double samplerate, double controlrate) {
+             this.samplerate = samplerate;
+             this.controlrate = controlrate;
+             // vdelay = new VariableDelay((int)(samplerate*4));
+diff --git a/src/share/classes/com/sun/media/sound/SoftCubicResampler.java b/src/share/classes/com/sun/media/sound/SoftCubicResampler.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftCubicResampler.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftCubicResampler.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -29,7 +29,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SoftCubicResampler extends SoftAbstractResampler {
++public final class SoftCubicResampler extends SoftAbstractResampler {
+ 
+     public int getPadding() {
+         return 3;
+diff --git a/src/share/classes/com/sun/media/sound/SoftEnvelopeGenerator.java b/src/share/classes/com/sun/media/sound/SoftEnvelopeGenerator.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftEnvelopeGenerator.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftEnvelopeGenerator.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -29,7 +29,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SoftEnvelopeGenerator implements SoftProcess {
++public final class SoftEnvelopeGenerator implements SoftProcess {
+ 
+     public final static int EG_OFF = 0;
+     public final static int EG_DELAY = 1;
+@@ -42,23 +42,23 @@
+     public final static int EG_END = 8;
+     int max_count = 10;
+     int used_count = 0;
+-    private int[] stage = new int[max_count];
+-    private int[] stage_ix = new int[max_count];
+-    private double[] stage_v = new double[max_count];
+-    private int[] stage_count = new int[max_count];
+-    private double[][] on = new double[max_count][1];
+-    private double[][] active = new double[max_count][1];
+-    private double[][] out = new double[max_count][1];
+-    private double[][] delay = new double[max_count][1];
+-    private double[][] attack = new double[max_count][1];
+-    private double[][] hold = new double[max_count][1];
+-    private double[][] decay = new double[max_count][1];
+-    private double[][] sustain = new double[max_count][1];
+-    private double[][] release = new double[max_count][1];
+-    private double[][] shutdown = new double[max_count][1];
+-    private double[][] release2 = new double[max_count][1];
+-    private double[][] attack2 = new double[max_count][1];
+-    private double[][] decay2 = new double[max_count][1];
++    private final int[] stage = new int[max_count];
++    private final int[] stage_ix = new int[max_count];
++    private final double[] stage_v = new double[max_count];
++    private final int[] stage_count = new int[max_count];
++    private final double[][] on = new double[max_count][1];
++    private final double[][] active = new double[max_count][1];
++    private final double[][] out = new double[max_count][1];
++    private final double[][] delay = new double[max_count][1];
++    private final double[][] attack = new double[max_count][1];
++    private final double[][] hold = new double[max_count][1];
++    private final double[][] decay = new double[max_count][1];
++    private final double[][] sustain = new double[max_count][1];
++    private final double[][] release = new double[max_count][1];
++    private final double[][] shutdown = new double[max_count][1];
++    private final double[][] release2 = new double[max_count][1];
++    private final double[][] attack2 = new double[max_count][1];
++    private final double[][] decay2 = new double[max_count][1];
+     private double control_time = 0;
+ 
+     public void reset() {
+diff --git a/src/share/classes/com/sun/media/sound/SoftFilter.java b/src/share/classes/com/sun/media/sound/SoftFilter.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftFilter.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftFilter.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -33,7 +33,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SoftFilter {
++public final class SoftFilter {
+ 
+     public final static int FILTERTYPE_LP6 = 0x00;
+     public final static int FILTERTYPE_LP12 = 0x01;
+@@ -55,7 +55,7 @@
+     // 0x30 = NP, Notch or Band Elimination Filter
+     //
+     private int filtertype = FILTERTYPE_LP6;
+-    private float samplerate;
++    private final float samplerate;
+     private float x1;
+     private float x2;
+     private float y1;
+diff --git a/src/share/classes/com/sun/media/sound/SoftInstrument.java b/src/share/classes/com/sun/media/sound/SoftInstrument.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftInstrument.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftInstrument.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -32,12 +32,12 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SoftInstrument extends Instrument {
++public final class SoftInstrument extends Instrument {
+ 
+     private SoftPerformer[] performers;
+     private ModelPerformer[] modelperformers;
+-    private Object data;
+-    private ModelInstrument ins;
++    private final Object data;
++    private final ModelInstrument ins;
+ 
+     public SoftInstrument(ModelInstrument ins) {
+         super(ins.getSoundbank(), ins.getPatch(), ins.getName(),
+diff --git a/src/share/classes/com/sun/media/sound/SoftJitterCorrector.java b/src/share/classes/com/sun/media/sound/SoftJitterCorrector.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftJitterCorrector.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftJitterCorrector.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -36,7 +36,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SoftJitterCorrector extends AudioInputStream {
++public final class SoftJitterCorrector extends AudioInputStream {
+ 
+     private static class JitterStream extends InputStream {
+ 
+@@ -48,7 +48,7 @@
+         int writepos = 0;
+         int readpos = 0;
+         byte[][] buffers;
+-        Object buffers_mutex = new Object();
++        private final Object buffers_mutex = new Object();
+ 
+         // Adapative Drift Statistics
+         int w_count = 1000;
+@@ -112,7 +112,7 @@
+             }
+         }
+ 
+-        public JitterStream(AudioInputStream s, int buffersize,
++        JitterStream(AudioInputStream s, int buffersize,
+                 int smallbuffersize) {
+             this.w_count = 10 * (buffersize / smallbuffersize);
+             if (w_count < 100)
+diff --git a/src/share/classes/com/sun/media/sound/SoftLanczosResampler.java b/src/share/classes/com/sun/media/sound/SoftLanczosResampler.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftLanczosResampler.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftLanczosResampler.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -29,7 +29,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SoftLanczosResampler extends SoftAbstractResampler {
++public final class SoftLanczosResampler extends SoftAbstractResampler {
+ 
+     float[][] sinc_table;
+     int sinc_table_fsize = 2000;
+diff --git a/src/share/classes/com/sun/media/sound/SoftLimiter.java b/src/share/classes/com/sun/media/sound/SoftLimiter.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftLimiter.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftLimiter.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -30,7 +30,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SoftLimiter implements SoftAudioProcessor {
++public final class SoftLimiter implements SoftAudioProcessor {
+ 
+     float lastmax = 0;
+     float gain = 1;
+diff --git a/src/share/classes/com/sun/media/sound/SoftLinearResampler.java b/src/share/classes/com/sun/media/sound/SoftLinearResampler.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftLinearResampler.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftLinearResampler.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -29,7 +29,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SoftLinearResampler extends SoftAbstractResampler {
++public final class SoftLinearResampler extends SoftAbstractResampler {
+ 
+     public int getPadding() {
+         return 2;
+diff --git a/src/share/classes/com/sun/media/sound/SoftLinearResampler2.java b/src/share/classes/com/sun/media/sound/SoftLinearResampler2.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftLinearResampler2.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftLinearResampler2.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -31,7 +31,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SoftLinearResampler2 extends SoftAbstractResampler {
++public final class SoftLinearResampler2 extends SoftAbstractResampler {
+ 
+     public int getPadding() {
+         return 2;
+diff --git a/src/share/classes/com/sun/media/sound/SoftLowFrequencyOscillator.java b/src/share/classes/com/sun/media/sound/SoftLowFrequencyOscillator.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftLowFrequencyOscillator.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftLowFrequencyOscillator.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -29,21 +29,21 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SoftLowFrequencyOscillator implements SoftProcess {
++public final class SoftLowFrequencyOscillator implements SoftProcess {
+ 
+-    private int max_count = 10;
++    private final int max_count = 10;
+     private int used_count = 0;
+-    private double[][] out = new double[max_count][1];
+-    private double[][] delay = new double[max_count][1];
+-    private double[][] delay2 = new double[max_count][1];
+-    private double[][] freq = new double[max_count][1];
+-    private int[] delay_counter = new int[max_count];
+-    private double[] sin_phase = new double[max_count];
+-    private double[] sin_stepfreq = new double[max_count];
+-    private double[] sin_step = new double[max_count];
++    private final double[][] out = new double[max_count][1];
++    private final double[][] delay = new double[max_count][1];
++    private final double[][] delay2 = new double[max_count][1];
++    private final double[][] freq = new double[max_count][1];
++    private final int[] delay_counter = new int[max_count];
++    private final double[] sin_phase = new double[max_count];
++    private final double[] sin_stepfreq = new double[max_count];
++    private final double[] sin_step = new double[max_count];
+     private double control_time = 0;
+     private double sin_factor = 0;
+-    private static double PI2 = 2.0 * Math.PI;
++    private static final double PI2 = 2.0 * Math.PI;
+ 
+     public SoftLowFrequencyOscillator() {
+         // If sin_step is 0 then sin_stepfreq must be -INF
+diff --git a/src/share/classes/com/sun/media/sound/SoftMainMixer.java b/src/share/classes/com/sun/media/sound/SoftMainMixer.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftMainMixer.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftMainMixer.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -43,7 +43,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SoftMainMixer {
++public final class SoftMainMixer {
+ 
+     // A private class thats contains a ModelChannelMixer and it's private buffers.
+     // This becomes necessary when we want to have separate delay buffers for each channel mixer.
+@@ -67,13 +67,13 @@
+     public final static int CHANNEL_RIGHT_DRY = 11;
+     public final static int CHANNEL_SCRATCH1 = 12;
+     public final static int CHANNEL_SCRATCH2 = 13;
+-    protected boolean active_sensing_on = false;
++    boolean active_sensing_on = false;
+     private long msec_last_activity = -1;
+     private boolean pusher_silent = false;
+     private int pusher_silent_count = 0;
+     private long sample_pos = 0;
+-    protected boolean readfully = true;
+-    private Object control_mutex;
++    boolean readfully = true;
++    private final Object control_mutex;
+     private SoftSynthesizer synth;
+     private float samplerate = 44100;
+     private int nrofchannels = 2;
+@@ -84,7 +84,7 @@
+     private SoftAudioProcessor agc;
+     private long msec_buffer_len = 0;
+     private int buffer_len = 0;
+-    protected TreeMap<Long, Object> midimessages = new TreeMap<Long, Object>();
++    TreeMap<Long, Object> midimessages = new TreeMap<Long, Object>();
+     private int delay_midievent = 0;
+     private int max_delay_midievent = 0;
+     double last_volume_left = 1.0;
+@@ -97,7 +97,7 @@
+     private Set<SoftChannelMixerContainer> registeredMixers = null;
+     private Set<ModelChannelMixer> stoppedMixers = null;
+     private SoftChannelMixerContainer[] cur_registeredMixers = null;
+-    protected SoftControl co_master = new SoftControl() {
++    SoftControl co_master = new SoftControl() {
+ 
+         double[] balance = co_master_balance;
+         double[] volume = co_master_volume;
+@@ -438,7 +438,7 @@
+         delay_midievent = 0;
+     }
+ 
+-    protected void processAudioBuffers() {
++    void processAudioBuffers() {
+ 
+         if(synth.weakstream != null && synth.weakstream.silent_samples != 0)
+         {
+@@ -860,16 +860,16 @@
+ 
+         InputStream in = new InputStream() {
+ 
+-            private SoftAudioBuffer[] buffers = SoftMainMixer.this.buffers;
+-            private int nrofchannels
++            private final SoftAudioBuffer[] buffers = SoftMainMixer.this.buffers;
++            private final int nrofchannels
+                     = SoftMainMixer.this.synth.getFormat().getChannels();
+-            private int buffersize = buffers[0].getSize();
+-            private byte[] bbuffer = new byte[buffersize
++            private final int buffersize = buffers[0].getSize();
++            private final byte[] bbuffer = new byte[buffersize
+                     * (SoftMainMixer.this.synth.getFormat()
+                         .getSampleSizeInBits() / 8)
+                     * nrofchannels];
+             private int bbuffer_pos = 0;
+-            private byte[] single = new byte[1];
++            private final byte[] single = new byte[1];
+ 
+             public void fillBuffer() {
+                 /*
+diff --git a/src/share/classes/com/sun/media/sound/SoftMidiAudioFileReader.java b/src/share/classes/com/sun/media/sound/SoftMidiAudioFileReader.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftMidiAudioFileReader.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftMidiAudioFileReader.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -50,7 +50,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SoftMidiAudioFileReader extends AudioFileReader {
++public final class SoftMidiAudioFileReader extends AudioFileReader {
+ 
+     public static final Type MIDI = new Type("MIDI", "mid");
+     private static AudioFormat format = new AudioFormat(44100, 16, 2, true, false);
+diff --git a/src/share/classes/com/sun/media/sound/SoftMixingClip.java b/src/share/classes/com/sun/media/sound/SoftMixingClip.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftMixingClip.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftMixingClip.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2008, 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
+@@ -42,7 +42,7 @@
+  * 
+  * @author Karl Helgason
+  */
+-public class SoftMixingClip extends SoftMixingDataLine implements Clip {
++public final class SoftMixingClip extends SoftMixingDataLine implements Clip {
+ 
+     private AudioFormat format;
+ 
+@@ -50,7 +50,7 @@
+ 
+     private byte[] data;
+ 
+-    private InputStream datastream = new InputStream() {
++    private final InputStream datastream = new InputStream() {
+ 
+         public int read() throws IOException {
+             byte[] b = new byte[1];
+@@ -162,7 +162,7 @@
+ 
+     private AudioFloatInputStream afis;
+ 
+-    protected SoftMixingClip(SoftMixingMixer mixer, DataLine.Info info) {
++    SoftMixingClip(SoftMixingMixer mixer, DataLine.Info info) {
+         super(mixer, info);
+     }
+ 
+diff --git a/src/share/classes/com/sun/media/sound/SoftMixingDataLine.java b/src/share/classes/com/sun/media/sound/SoftMixingDataLine.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftMixingDataLine.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftMixingDataLine.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2008, 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,22 +50,22 @@
+             "Chorus Send") {
+     };
+ 
+-    protected static class AudioFloatInputStreamResampler extends
++    protected static final class AudioFloatInputStreamResampler extends
+             AudioFloatInputStream {
+ 
+-        private AudioFloatInputStream ais;
++        private final AudioFloatInputStream ais;
+ 
+-        private AudioFormat targetFormat;
++        private final AudioFormat targetFormat;
+ 
+         private float[] skipbuffer;
+ 
+         private SoftAbstractResampler resampler;
+ 
+-        private float[] pitch = new float[1];
++        private final float[] pitch = new float[1];
+ 
+-        private float[] ibuffer2;
++        private final float[] ibuffer2;
+ 
+-        private float[][] ibuffer;
++        private final float[][] ibuffer;
+ 
+         private float ibuffer_index = 0;
+ 
+@@ -75,15 +75,15 @@
+ 
+         private float[][] cbuffer;
+ 
+-        private int buffer_len = 512;
++        private final int buffer_len = 512;
+ 
+-        private int pad;
++        private final int pad;
+ 
+-        private int pad2;
++        private final int pad2;
+ 
+-        private float[] ix = new float[1];
++        private final float[] ix = new float[1];
+ 
+-        private int[] ox = new int[1];
++        private final int[] ox = new int[1];
+ 
+         private float[][] mark_ibuffer = null;
+ 
+@@ -294,7 +294,7 @@
+ 
+     }
+ 
+-    private class Gain extends FloatControl {
++    private final class Gain extends FloatControl {
+ 
+         private Gain() {
+ 
+@@ -308,7 +308,7 @@
+         }
+     }
+ 
+-    private class Mute extends BooleanControl {
++    private final class Mute extends BooleanControl {
+ 
+         private Mute() {
+             super(BooleanControl.Type.MUTE, false, "True", "False");
+@@ -320,7 +320,7 @@
+         }
+     }
+ 
+-    private class ApplyReverb extends BooleanControl {
++    private final class ApplyReverb extends BooleanControl {
+ 
+         private ApplyReverb() {
+             super(BooleanControl.Type.APPLY_REVERB, false, "True", "False");
+@@ -333,7 +333,7 @@
+ 
+     }
+ 
+-    private class Balance extends FloatControl {
++    private final class Balance extends FloatControl {
+ 
+         private Balance() {
+             super(FloatControl.Type.BALANCE, -1.0f, 1.0f, (1.0f / 128.0f), -1,
+@@ -347,7 +347,7 @@
+ 
+     }
+ 
+-    private class Pan extends FloatControl {
++    private final class Pan extends FloatControl {
+ 
+         private Pan() {
+             super(FloatControl.Type.PAN, -1.0f, 1.0f, (1.0f / 128.0f), -1,
+@@ -365,7 +365,7 @@
+ 
+     }
+ 
+-    private class ReverbSend extends FloatControl {
++    private final class ReverbSend extends FloatControl {
+ 
+         private ReverbSend() {
+             super(FloatControl.Type.REVERB_SEND, -80f, 6.0206f, 80f / 128.0f,
+@@ -379,7 +379,7 @@
+ 
+     }
+ 
+-    private class ChorusSend extends FloatControl {
++    private final class ChorusSend extends FloatControl {
+ 
+         private ChorusSend() {
+             super(CHORUS_SEND, -80f, 6.0206f, 80f / 128.0f, -1, -80f, "dB",
+@@ -393,43 +393,43 @@
+ 
+     }
+ 
+-    private Gain gain_control = new Gain();
++    private final Gain gain_control = new Gain();
+ 
+-    private Mute mute_control = new Mute();
++    private final Mute mute_control = new Mute();
+ 
+-    private Balance balance_control = new Balance();
++    private final Balance balance_control = new Balance();
+ 
+-    private Pan pan_control = new Pan();
++    private final Pan pan_control = new Pan();
+ 
+-    private ReverbSend reverbsend_control = new ReverbSend();
++    private final ReverbSend reverbsend_control = new ReverbSend();
+ 
+-    private ChorusSend chorussend_control = new ChorusSend();
++    private final ChorusSend chorussend_control = new ChorusSend();
+ 
+-    private ApplyReverb apply_reverb = new ApplyReverb();
++    private final ApplyReverb apply_reverb = new ApplyReverb();
+ 
+-    private Control[] controls;
++    private final Control[] controls;
+ 
+-    protected float leftgain = 1;
++    float leftgain = 1;
+ 
+-    protected float rightgain = 1;
++    float rightgain = 1;
+ 
+-    protected float eff1gain = 0;
++    float eff1gain = 0;
+ 
+-    protected float eff2gain = 0;
++    float eff2gain = 0;
+ 
+-    protected List<LineListener> listeners = new ArrayList<LineListener>();
++    List<LineListener> listeners = new ArrayList<LineListener>();
+ 
+-    protected Object control_mutex;
++    final Object control_mutex;
+ 
+-    protected SoftMixingMixer mixer;
++    SoftMixingMixer mixer;
+ 
+-    protected DataLine.Info info;
++    DataLine.Info info;
+ 
+     protected abstract void processControlLogic();
+ 
+     protected abstract void processAudioLogic(SoftAudioBuffer[] buffers);
+ 
+-    protected SoftMixingDataLine(SoftMixingMixer mixer, DataLine.Info info) {
++    SoftMixingDataLine(SoftMixingMixer mixer, DataLine.Info info) {
+         this.mixer = mixer;
+         this.info = info;
+         this.control_mutex = mixer.control_mutex;
+@@ -440,7 +440,7 @@
+         calcVolume();
+     }
+ 
+-    protected void calcVolume() {
++    final void calcVolume() {
+         synchronized (control_mutex) {
+             double gain = Math.pow(10.0, gain_control.getValue() / 20.0);
+             if (mute_control.getValue())
+@@ -466,7 +466,7 @@
+         }
+     }
+ 
+-    protected void sendEvent(LineEvent event) {
++    final void sendEvent(LineEvent event) {
+         if (listeners.size() == 0)
+             return;
+         LineListener[] listener_array = listeners
+@@ -476,23 +476,23 @@
+         }
+     }
+ 
+-    public void addLineListener(LineListener listener) {
++    public final void addLineListener(LineListener listener) {
+         synchronized (control_mutex) {
+             listeners.add(listener);
+         }
+     }
+ 
+-    public void removeLineListener(LineListener listener) {
++    public final void removeLineListener(LineListener listener) {
+         synchronized (control_mutex) {
+             listeners.add(listener);
+         }
+     }
+ 
+-    public javax.sound.sampled.Line.Info getLineInfo() {
++    public final javax.sound.sampled.Line.Info getLineInfo() {
+         return info;
+     }
+ 
+-    public Control getControl(Type control) {
++    public final Control getControl(Type control) {
+         if (control != null) {
+             for (int i = 0; i < controls.length; i++) {
+                 if (controls[i].getType() == control) {
+@@ -504,11 +504,11 @@
+                 + control);
+     }
+ 
+-    public Control[] getControls() {
++    public final Control[] getControls() {
+         return controls;
+     }
+ 
+-    public boolean isControlSupported(Type control) {
++    public final boolean isControlSupported(Type control) {
+         if (control != null) {
+             for (int i = 0; i < controls.length; i++) {
+                 if (controls[i].getType() == control) {
+diff --git a/src/share/classes/com/sun/media/sound/SoftMixingMainMixer.java b/src/share/classes/com/sun/media/sound/SoftMixingMainMixer.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftMixingMainMixer.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftMixingMainMixer.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2008, 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 @@
+  * 
+  * @author Karl Helgason
+  */
+-public class SoftMixingMainMixer {
++public final class SoftMixingMainMixer {
+ 
+     public final static int CHANNEL_LEFT = 0;
+ 
+@@ -63,23 +63,23 @@
+ 
+     public final static int CHANNEL_CHANNELMIXER_RIGHT = 15;
+ 
+-    private SoftMixingMixer mixer;
++    private final SoftMixingMixer mixer;
+ 
+-    private AudioInputStream ais;
++    private final AudioInputStream ais;
+ 
+-    private SoftAudioBuffer[] buffers;
++    private final SoftAudioBuffer[] buffers;
+ 
+-    private SoftAudioProcessor reverb;
++    private final SoftAudioProcessor reverb;
+ 
+-    private SoftAudioProcessor chorus;
++    private final SoftAudioProcessor chorus;
+ 
+-    private SoftAudioProcessor agc;
++    private final SoftAudioProcessor agc;
+ 
+-    private int nrofchannels;
++    private final int nrofchannels;
+ 
+-    private Object control_mutex;
++    private final Object control_mutex;
+ 
+-    private List<SoftMixingDataLine> openLinesList = new ArrayList<SoftMixingDataLine>();
++    private final List<SoftMixingDataLine> openLinesList = new ArrayList<SoftMixingDataLine>();
+ 
+     private SoftMixingDataLine[] openLines = new SoftMixingDataLine[0];
+ 
+@@ -87,7 +87,7 @@
+         return ais;
+     }
+ 
+-    protected void processAudioBuffers() {
++    void processAudioBuffers() {
+         for (int i = 0; i < buffers.length; i++) {
+             buffers[i].clear();
+         }
+@@ -162,20 +162,20 @@
+ 
+         InputStream in = new InputStream() {
+ 
+-            private SoftAudioBuffer[] buffers = SoftMixingMainMixer.this.buffers;
++            private final SoftAudioBuffer[] buffers = SoftMixingMainMixer.this.buffers;
+ 
+-            private int nrofchannels = SoftMixingMainMixer.this.mixer
++            private final int nrofchannels = SoftMixingMainMixer.this.mixer
+                     .getFormat().getChannels();
+ 
+-            private int buffersize = buffers[0].getSize();
++            private final int buffersize = buffers[0].getSize();
+ 
+-            private byte[] bbuffer = new byte[buffersize
++            private final byte[] bbuffer = new byte[buffersize
+                     * (SoftMixingMainMixer.this.mixer.getFormat()
+                             .getSampleSizeInBits() / 8) * nrofchannels];
+ 
+             private int bbuffer_pos = 0;
+ 
+-            private byte[] single = new byte[1];
++            private final byte[] single = new byte[1];
+ 
+             public void fillBuffer() {
+                 processAudioBuffers();
+diff --git a/src/share/classes/com/sun/media/sound/SoftMixingMixer.java b/src/share/classes/com/sun/media/sound/SoftMixingMixer.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftMixingMixer.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftMixingMixer.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2008, 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
+@@ -48,27 +48,27 @@
+  * 
+  * @author Karl Helgason
+  */
+-public class SoftMixingMixer implements Mixer {
++public final class SoftMixingMixer implements Mixer {
+ 
+     private static class Info extends Mixer.Info {
+-        public Info() {
++        Info() {
+             super(INFO_NAME, INFO_VENDOR, INFO_DESCRIPTION, INFO_VERSION);
+         }
+     }
+ 
+-    protected static final String INFO_NAME = "Gervill Sound Mixer";
++    static final String INFO_NAME = "Gervill Sound Mixer";
+ 
+-    protected static final String INFO_VENDOR = "OpenJDK Proposal";
++    static final String INFO_VENDOR = "OpenJDK Proposal";
+ 
+-    protected static final String INFO_DESCRIPTION = "Software Sound Mixer";
++    static final String INFO_DESCRIPTION = "Software Sound Mixer";
+ 
+-    protected static final String INFO_VERSION = "1.0";
++    static final String INFO_VERSION = "1.0";
+ 
+-    protected final static Mixer.Info info = new Info();
++    static final Mixer.Info info = new Info();
+ 
+-    protected Object control_mutex = this;
++    final Object control_mutex = this;
+ 
+-    protected boolean implicitOpen = false;
++    boolean implicitOpen = false;
+ 
+     private boolean open = false;
+ 
+@@ -82,15 +82,15 @@
+ 
+     private AudioInputStream pusher_stream = null;
+ 
+-    private float controlrate = 147f;
++    private final float controlrate = 147f;
+ 
+-    private long latency = 100000; // 100 msec
++    private final long latency = 100000; // 100 msec
+ 
+-    private boolean jitter_correction = false;
++    private final boolean jitter_correction = false;
+ 
+-    private List<LineListener> listeners = new ArrayList<LineListener>();
++    private final List<LineListener> listeners = new ArrayList<LineListener>();
+ 
+-    private javax.sound.sampled.Line.Info[] sourceLineInfo;
++    private final javax.sound.sampled.Line.Info[] sourceLineInfo;
+ 
+     public SoftMixingMixer() {
+ 
+@@ -516,11 +516,11 @@
+         }
+     }
+ 
+-    protected float getControlRate() {
++    float getControlRate() {
+         return controlrate;
+     }
+ 
+-    protected SoftMixingMainMixer getMainMixer() {
++    SoftMixingMainMixer getMainMixer() {
+         if (!isOpen())
+             return null;
+         return mainmixer;
+diff --git a/src/share/classes/com/sun/media/sound/SoftMixingMixerProvider.java b/src/share/classes/com/sun/media/sound/SoftMixingMixerProvider.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftMixingMixerProvider.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftMixingMixerProvider.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2008, 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
+@@ -33,13 +33,13 @@
+  * 
+  * @author Karl Helgason
+  */
+-public class SoftMixingMixerProvider extends MixerProvider {
++public final class SoftMixingMixerProvider extends MixerProvider {
+ 
+     static SoftMixingMixer globalmixer = null;
+ 
+     static Thread lockthread = null;
+ 
+-    protected final static Object mutex = new Object();
++    static final Object mutex = new Object();
+ 
+     public Mixer getMixer(Info info) {
+         if (!(info == null || info == SoftMixingMixer.info)) {
+diff --git a/src/share/classes/com/sun/media/sound/SoftMixingSourceDataLine.java b/src/share/classes/com/sun/media/sound/SoftMixingSourceDataLine.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftMixingSourceDataLine.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftMixingSourceDataLine.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2008, 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
+@@ -41,8 +41,8 @@
+  * 
+  * @author Karl Helgason
+  */
+-public class SoftMixingSourceDataLine extends SoftMixingDataLine implements
+-        SourceDataLine {
++public final class SoftMixingSourceDataLine extends SoftMixingDataLine
++        implements SourceDataLine {
+ 
+     private boolean open = false;
+ 
+@@ -72,7 +72,7 @@
+             AudioFloatInputStream {
+         AudioFloatInputStream ais;
+ 
+-        public NonBlockingFloatInputStream(AudioFloatInputStream ais) {
++        NonBlockingFloatInputStream(AudioFloatInputStream ais) {
+             this.ais = ais;
+         }
+ 
+@@ -120,7 +120,7 @@
+ 
+     }
+ 
+-    protected SoftMixingSourceDataLine(SoftMixingMixer mixer, DataLine.Info info) {
++    SoftMixingSourceDataLine(SoftMixingMixer mixer, DataLine.Info info) {
+         super(mixer, info);
+     }
+ 
+diff --git a/src/share/classes/com/sun/media/sound/SoftPerformer.java b/src/share/classes/com/sun/media/sound/SoftPerformer.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftPerformer.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftPerformer.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -37,7 +37,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SoftPerformer {
++public final class SoftPerformer {
+ 
+     static ModelConnectionBlock[] defaultconnections
+             = new ModelConnectionBlock[42];
+diff --git a/src/share/classes/com/sun/media/sound/SoftPointResampler.java b/src/share/classes/com/sun/media/sound/SoftPointResampler.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftPointResampler.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftPointResampler.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -29,7 +29,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SoftPointResampler extends SoftAbstractResampler {
++public final class SoftPointResampler extends SoftAbstractResampler {
+ 
+     public int getPadding() {
+         return 100;
+diff --git a/src/share/classes/com/sun/media/sound/SoftProvider.java b/src/share/classes/com/sun/media/sound/SoftProvider.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftProvider.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftProvider.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -33,10 +33,10 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SoftProvider extends MidiDeviceProvider {
++public final class SoftProvider extends MidiDeviceProvider {
+ 
+-    protected final static Info softinfo = SoftSynthesizer.info;
+-    private static Info[] softinfos = {softinfo};
++    static final Info softinfo = SoftSynthesizer.info;
++    private static final Info[] softinfos = {softinfo};
+ 
+     public MidiDevice.Info[] getDeviceInfo() {
+         return softinfos;
+diff --git a/src/share/classes/com/sun/media/sound/SoftReceiver.java b/src/share/classes/com/sun/media/sound/SoftReceiver.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftReceiver.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftReceiver.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -35,13 +35,13 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SoftReceiver implements MidiDeviceReceiver {
++public final class SoftReceiver implements MidiDeviceReceiver {
+ 
+-    protected boolean open = true;
+-    private Object control_mutex;
+-    private SoftSynthesizer synth;
+-    protected TreeMap<Long, Object> midimessages;
+-    protected SoftMainMixer mainmixer;
++    boolean open = true;
++    private final Object control_mutex;
++    private final SoftSynthesizer synth;
++    TreeMap<Long, Object> midimessages;
++    SoftMainMixer mainmixer;
+ 
+     public SoftReceiver(SoftSynthesizer synth) {
+         this.control_mutex = synth.control_mutex;
+diff --git a/src/share/classes/com/sun/media/sound/SoftReverb.java b/src/share/classes/com/sun/media/sound/SoftReverb.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftReverb.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftReverb.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -33,14 +33,14 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SoftReverb implements SoftAudioProcessor {
++public final class SoftReverb implements SoftAudioProcessor {
+ 
+     private final static class Delay {
+ 
+         private float[] delaybuffer;
+         private int rovepos = 0;
+ 
+-        public Delay() {
++        Delay() {
+             delaybuffer = null;
+         }
+ 
+@@ -77,7 +77,7 @@
+         private int rovepos = 0;
+         private float feedback;
+ 
+-        public AllPass(int size) {
++        AllPass(int size) {
+             delaybuffer = new float[size];
+             delaybuffersize = size;
+         }
+@@ -127,7 +127,7 @@
+         private float filtercoeff1 = 0;
+         private float filtercoeff2 = 1;
+ 
+-        public Comb(int size) {
++        Comb(int size) {
+             delaybuffer = new float[size];
+             delaybuffersize = size;
+         }
+diff --git a/src/share/classes/com/sun/media/sound/SoftShortMessage.java b/src/share/classes/com/sun/media/sound/SoftShortMessage.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftShortMessage.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftShortMessage.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -32,7 +32,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SoftShortMessage extends ShortMessage {
++public final class SoftShortMessage extends ShortMessage {
+ 
+     int channel = 0;
+ 
+diff --git a/src/share/classes/com/sun/media/sound/SoftSincResampler.java b/src/share/classes/com/sun/media/sound/SoftSincResampler.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftSincResampler.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftSincResampler.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -31,7 +31,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SoftSincResampler extends SoftAbstractResampler {
++public final class SoftSincResampler extends SoftAbstractResampler {
+ 
+     float[][][] sinc_table;
+     int sinc_scale_size = 100;
+diff --git a/src/share/classes/com/sun/media/sound/SoftSynthesizer.java b/src/share/classes/com/sun/media/sound/SoftSynthesizer.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftSynthesizer.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftSynthesizer.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2008, 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
+@@ -66,10 +66,10 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SoftSynthesizer implements AudioSynthesizer,
++public final class SoftSynthesizer implements AudioSynthesizer,
+         ReferenceCountingDevice {
+ 
+-    protected static class WeakAudioStream extends InputStream
++    protected static final class WeakAudioStream extends InputStream
+     {
+         private volatile AudioInputStream stream;
+         public SoftAudioPusher pusher = null;
+@@ -166,39 +166,39 @@
+     }
+ 
+     private static class Info extends MidiDevice.Info {
+-        public Info() {
++        Info() {
+             super(INFO_NAME, INFO_VENDOR, INFO_DESCRIPTION, INFO_VERSION);
+         }
+     }
+ 
+-    protected static final String INFO_NAME = "Gervill";
+-    protected static final String INFO_VENDOR = "OpenJDK";
+-    protected static final String INFO_DESCRIPTION = "Software MIDI Synthesizer";
+-    protected static final String INFO_VERSION = "1.0";
+-    protected final static MidiDevice.Info info = new Info();
++    static final String INFO_NAME = "Gervill";
++    static final String INFO_VENDOR = "OpenJDK";
++    static final String INFO_DESCRIPTION = "Software MIDI Synthesizer";
++    static final String INFO_VERSION = "1.0";
++    final static MidiDevice.Info info = new Info();
+ 
+     private static SourceDataLine testline = null;
+ 
+     private static Soundbank defaultSoundBank = null;
+ 
+-    protected WeakAudioStream weakstream = null;
++    WeakAudioStream weakstream = null;
+ 
+-    protected Object control_mutex = this;
++    final Object control_mutex = this;
+ 
+-    protected int voiceIDCounter = 0;
++    int voiceIDCounter = 0;
+ 
+     // 0: default
+     // 1: DLS Voice Allocation
+-    protected int voice_allocation_mode = 0;
++    int voice_allocation_mode = 0;
+ 
+-    protected boolean load_default_soundbank = false;
+-    protected boolean reverb_light = true;
+-    protected boolean reverb_on = true;
+-    protected boolean chorus_on = true;
+-    protected boolean agc_on = true;
++    boolean load_default_soundbank = false;
++    boolean reverb_light = true;
++    boolean reverb_on = true;
++    boolean chorus_on = true;
++    boolean agc_on = true;
+ 
+-    protected SoftChannel[] channels;
+-    protected SoftChannelProxy[] external_channels = null;
++    SoftChannel[] channels;
++    SoftChannelProxy[] external_channels = null;
+ 
+     private boolean largemode = false;
+ 
+@@ -371,7 +371,7 @@
+         this.format = format;
+     }
+ 
+-    protected void removeReceiver(Receiver recv) {
++    void removeReceiver(Receiver recv) {
+         boolean perform_close = false;
+         synchronized (control_mutex) {
+             if (recvslist.remove(recv)) {
+@@ -383,13 +383,13 @@
+             close();
+     }
+ 
+-    protected SoftMainMixer getMainMixer() {
++    SoftMainMixer getMainMixer() {
+         if (!isOpen())
+             return null;
+         return mainmixer;
+     }
+ 
+-    protected SoftInstrument findInstrument(int program, int bank, int channel) {
++    SoftInstrument findInstrument(int program, int bank, int channel) {
+ 
+         // Add support for GM2 banks 0x78 and 0x79
+         // as specified in DLS 2.2 in Section 1.4.6
+@@ -450,31 +450,31 @@
+         return null;
+     }
+ 
+-    protected int getVoiceAllocationMode() {
++    int getVoiceAllocationMode() {
+         return voice_allocation_mode;
+     }
+ 
+-    protected int getGeneralMidiMode() {
++    int getGeneralMidiMode() {
+         return gmmode;
+     }
+ 
+-    protected void setGeneralMidiMode(int gmmode) {
++    void setGeneralMidiMode(int gmmode) {
+         this.gmmode = gmmode;
+     }
+ 
+-    protected int getDeviceID() {
++    int getDeviceID() {
+         return deviceid;
+     }
+ 
+-    protected float getControlRate() {
++    float getControlRate() {
+         return controlrate;
+     }
+ 
+-    protected SoftVoice[] getVoices() {
++    SoftVoice[] getVoices() {
+         return voices;
+     }
+ 
+-    protected SoftTuning getTuning(Patch patch) {
++    SoftTuning getTuning(Patch patch) {
+         String t_id = patchToString(patch);
+         SoftTuning tuning = tunings.get(t_id);
+         if (tuning == null) {
+diff --git a/src/share/classes/com/sun/media/sound/SoftTuning.java b/src/share/classes/com/sun/media/sound/SoftTuning.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftTuning.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftTuning.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -34,10 +34,10 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SoftTuning {
++public final class SoftTuning {
+ 
+     private String name = null;
+-    private double[] tuning = new double[128];
++    private final double[] tuning = new double[128];
+     private Patch patch = null;
+ 
+     public SoftTuning() {
+diff --git a/src/share/classes/com/sun/media/sound/SoftVoice.java b/src/share/classes/com/sun/media/sound/SoftVoice.java
+--- jdk/src/share/classes/com/sun/media/sound/SoftVoice.java
++++ jdk/src/share/classes/com/sun/media/sound/SoftVoice.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -36,7 +36,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class SoftVoice extends VoiceStatus {
++public final class SoftVoice extends VoiceStatus {
+ 
+     public int exclusiveClass = 0;
+     public boolean releaseTriggered = false;
+@@ -44,32 +44,32 @@
+     private int noteOn_velocity = 0;
+     private int noteOff_velocity = 0;
+     private int delay = 0;
+-    protected ModelChannelMixer channelmixer = null;
+-    protected double tunedKey = 0;
+-    protected SoftTuning tuning = null;
+-    protected SoftChannel stealer_channel = null;
+-    protected ModelConnectionBlock[] stealer_extendedConnectionBlocks = null;
+-    protected SoftPerformer stealer_performer = null;
+-    protected ModelChannelMixer stealer_channelmixer = null;
+-    protected int stealer_voiceID = -1;
+-    protected int stealer_noteNumber = 0;
+-    protected int stealer_velocity = 0;
+-    protected boolean stealer_releaseTriggered = false;
+-    protected int voiceID = -1;
+-    protected boolean sustain = false;
+-    protected boolean sostenuto = false;
+-    protected boolean portamento = false;
+-    private SoftFilter filter_left;
+-    private SoftFilter filter_right;
+-    private SoftProcess eg = new SoftEnvelopeGenerator();
+-    private SoftProcess lfo = new SoftLowFrequencyOscillator();
+-    protected Map<String, SoftControl> objects =
++    ModelChannelMixer channelmixer = null;
++    double tunedKey = 0;
++    SoftTuning tuning = null;
++    SoftChannel stealer_channel = null;
++    ModelConnectionBlock[] stealer_extendedConnectionBlocks = null;
++    SoftPerformer stealer_performer = null;
++    ModelChannelMixer stealer_channelmixer = null;
++    int stealer_voiceID = -1;
++    int stealer_noteNumber = 0;
++    int stealer_velocity = 0;
++    boolean stealer_releaseTriggered = false;
++    int voiceID = -1;
++    boolean sustain = false;
++    boolean sostenuto = false;
++    boolean portamento = false;
++    private final SoftFilter filter_left;
++    private final SoftFilter filter_right;
++    private final SoftProcess eg = new SoftEnvelopeGenerator();
++    private final SoftProcess lfo = new SoftLowFrequencyOscillator();
++    Map<String, SoftControl> objects =
+             new HashMap<String, SoftControl>();
+-    protected SoftSynthesizer synthesizer;
+-    protected SoftInstrument instrument;
+-    protected SoftPerformer performer;
+-    protected SoftChannel softchannel = null;
+-    protected boolean on = false;
++    SoftSynthesizer synthesizer;
++    SoftInstrument instrument;
++    SoftPerformer performer;
++    SoftChannel softchannel = null;
++    boolean on = false;
+     private boolean audiostarted = false;
+     private boolean started = false;
+     private boolean stopping = false;
+@@ -87,7 +87,7 @@
+     private float last_out_mixer_right = 0;
+     private float last_out_mixer_effect1 = 0;
+     private float last_out_mixer_effect2 = 0;
+-    protected ModelConnectionBlock[] extendedConnectionBlocks = null;
++    ModelConnectionBlock[] extendedConnectionBlocks = null;
+     private ModelConnectionBlock[] connections;
+     // Last value added to destination
+     private double[] connections_last = new double[50];
+@@ -100,10 +100,10 @@
+     private boolean soundoff = false;
+     private float lastMuteValue = 0;
+     private float lastSoloMuteValue = 0;
+-    protected double[] co_noteon_keynumber = new double[1];
+-    protected double[] co_noteon_velocity = new double[1];
+-    protected double[] co_noteon_on = new double[1];
+-    private SoftControl co_noteon = new SoftControl() {
++    double[] co_noteon_keynumber = new double[1];
++    double[] co_noteon_velocity = new double[1];
++    double[] co_noteon_on = new double[1];
++    private final SoftControl co_noteon = new SoftControl() {
+         double[] keynumber = co_noteon_keynumber;
+         double[] velocity = co_noteon_velocity;
+         double[] on = co_noteon_on;
+@@ -119,13 +119,13 @@
+             return null;
+         }
+     };
+-    private double[] co_mixer_active = new double[1];
+-    private double[] co_mixer_gain = new double[1];
+-    private double[] co_mixer_pan = new double[1];
+-    private double[] co_mixer_balance = new double[1];
+-    private double[] co_mixer_reverb = new double[1];
+-    private double[] co_mixer_chorus = new double[1];
+-    private SoftControl co_mixer = new SoftControl() {
++    private final double[] co_mixer_active = new double[1];
++    private final double[] co_mixer_gain = new double[1];
++    private final double[] co_mixer_pan = new double[1];
++    private final double[] co_mixer_balance = new double[1];
++    private final double[] co_mixer_reverb = new double[1];
++    private final double[] co_mixer_chorus = new double[1];
++    private final SoftControl co_mixer = new SoftControl() {
+         double[] active = co_mixer_active;
+         double[] gain = co_mixer_gain;
+         double[] pan = co_mixer_pan;
+@@ -150,8 +150,8 @@
+             return null;
+         }
+     };
+-    private double[] co_osc_pitch = new double[1];
+-    private SoftControl co_osc = new SoftControl() {
++    private final double[] co_osc_pitch = new double[1];
++    private final SoftControl co_osc = new SoftControl() {
+         double[] pitch = co_osc_pitch;
+         public double[] get(int instance, String name) {
+             if (name == null)
+@@ -161,10 +161,10 @@
+             return null;
+         }
+     };
+-    private double[] co_filter_freq = new double[1];
+-    private double[] co_filter_type = new double[1];
+-    private double[] co_filter_q = new double[1];
+-    private SoftControl co_filter = new SoftControl() {
++    private final double[] co_filter_freq = new double[1];
++    private final double[] co_filter_type = new double[1];
++    private final double[] co_filter_q = new double[1];
++    private final SoftControl co_filter = new SoftControl() {
+         double[] freq = co_filter_freq;
+         double[] ftype = co_filter_type;
+         double[] q = co_filter_q;
+@@ -180,8 +180,8 @@
+             return null;
+         }
+     };
+-    protected SoftResamplerStreamer resampler;
+-    private int nrofchannels;
++    SoftResamplerStreamer resampler;
++    private final int nrofchannels;
+ 
+     public SoftVoice(SoftSynthesizer synth) {
+         synthesizer = synth;
+@@ -278,7 +278,7 @@
+         // co_mixer_gain[0] = 0;
+     }
+ 
+-    protected void updateTuning(SoftTuning newtuning) {
++    void updateTuning(SoftTuning newtuning) {
+         tuning = newtuning;
+         tunedKey = tuning.getTuning(note) / 100.0;
+         if (!portamento) {
+@@ -293,12 +293,12 @@
+         }
+     }
+ 
+-    protected void setNote(int noteNumber) {
++    void setNote(int noteNumber) {
+         note = noteNumber;
+         tunedKey = tuning.getTuning(noteNumber) / 100.0;
+     }
+ 
+-    protected void noteOn(int noteNumber, int velocity, int delay) {
++    void noteOn(int noteNumber, int velocity, int delay) {
+ 
+         sustain = false;
+         sostenuto = false;
+@@ -435,7 +435,7 @@
+ 
+     }
+ 
+-    protected void setPolyPressure(int pressure) {
++    void setPolyPressure(int pressure) {
+         if(performer == null)
+             return;
+         int[] c = performer.midi_connections[2];
+@@ -445,7 +445,7 @@
+             processConnection(c[i]);
+     }
+ 
+-    protected void setChannelPressure(int pressure) {
++    void setChannelPressure(int pressure) {
+         if(performer == null)
+             return;
+         int[] c = performer.midi_connections[1];
+@@ -455,7 +455,7 @@
+             processConnection(c[i]);
+     }
+ 
+-    protected void controlChange(int controller, int value) {
++    void controlChange(int controller, int value) {
+         if(performer == null)
+             return;
+         int[] c = performer.midi_ctrl_connections[controller];
+@@ -465,7 +465,7 @@
+             processConnection(c[i]);
+     }
+ 
+-    protected void nrpnChange(int controller, int value) {
++    void nrpnChange(int controller, int value) {
+         if(performer == null)
+             return;
+         int[] c = performer.midi_nrpn_connections.get(controller);
+@@ -475,7 +475,7 @@
+             processConnection(c[i]);
+     }
+ 
+-    protected void rpnChange(int controller, int value) {
++    void rpnChange(int controller, int value) {
+         if(performer == null)
+             return;
+         int[] c = performer.midi_rpn_connections.get(controller);
+@@ -485,7 +485,7 @@
+             processConnection(c[i]);
+     }
+ 
+-    protected void setPitchBend(int bend) {
++    void setPitchBend(int bend) {
+         if(performer == null)
+             return;
+         int[] c = performer.midi_connections[0];
+@@ -495,19 +495,19 @@
+             processConnection(c[i]);
+     }
+ 
+-    protected void setMute(boolean mute) {
++    void setMute(boolean mute) {
+         co_mixer_gain[0] -= lastMuteValue;
+         lastMuteValue = mute ? -960 : 0;
+         co_mixer_gain[0] += lastMuteValue;
+     }
+ 
+-    protected void setSoloMute(boolean mute) {
++    void setSoloMute(boolean mute) {
+         co_mixer_gain[0] -= lastSoloMuteValue;
+         lastSoloMuteValue = mute ? -960 : 0;
+         co_mixer_gain[0] += lastSoloMuteValue;
+     }
+ 
+-    protected void shutdown() {
++    void shutdown() {
+         if (co_noteon_on[0] < -0.5)
+             return;
+         on = false;
+@@ -523,12 +523,12 @@
+             processConnection(c[i]);
+     }
+ 
+-    protected void soundOff() {
++    void soundOff() {
+         on = false;
+         soundoff = true;
+     }
+ 
+-    protected void noteOff(int velocity) {
++    void noteOff(int velocity) {
+         if (!on)
+             return;
+         on = false;
+@@ -553,7 +553,7 @@
+             processConnection(c[i]);
+     }
+ 
+-    protected void redamp() {
++    void redamp() {
+         if (co_noteon_on[0] > 0.5)
+             return;
+         if (co_noteon_on[0] < -0.5)
+@@ -571,7 +571,7 @@
+             processConnection(c[i]);
+     }
+ 
+-    protected void processControlLogic() {
++    void processControlLogic() {
+         if (stopping) {
+             active = false;
+             stopping = false;
+@@ -760,9 +760,9 @@
+ 
+     }
+ 
+-    protected void mixAudioStream(SoftAudioBuffer in, SoftAudioBuffer out,
+-            SoftAudioBuffer dout,
+-            float amp_from, float amp_to) {
++    void mixAudioStream(SoftAudioBuffer in, SoftAudioBuffer out,
++                                SoftAudioBuffer dout, float amp_from,
++                                float amp_to) {
+         int bufferlen = in.getSize();
+         if (amp_from < 0.000000001 && amp_to < 0.000000001)
+             return;
+@@ -815,7 +815,7 @@
+ 
+     }
+ 
+-    protected void processAudioLogic(SoftAudioBuffer[] buffer) {
++    void processAudioLogic(SoftAudioBuffer[] buffer) {
+         if (!audiostarted)
+             return;
+ 
+diff --git a/src/share/classes/com/sun/media/sound/StandardMidiFileReader.java b/src/share/classes/com/sun/media/sound/StandardMidiFileReader.java
+--- jdk/src/share/classes/com/sun/media/sound/StandardMidiFileReader.java
++++ jdk/src/share/classes/com/sun/media/sound/StandardMidiFileReader.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
+@@ -26,22 +26,13 @@
+ package com.sun.media.sound;
+ 
+ import java.io.DataInputStream;
+-import java.io.DataOutputStream;
+-import java.io.PipedInputStream;
+-import java.io.PipedOutputStream;
+-import java.io.ByteArrayOutputStream;
+-import java.io.ByteArrayInputStream;
+-import java.io.SequenceInputStream;
+ import java.io.File;
+ import java.io.FileInputStream;
+ import java.io.InputStream;
+ import java.io.IOException;
+ import java.io.EOFException;
+-import java.io.OutputStream;
+-import java.io.RandomAccessFile;
+ import java.io.BufferedInputStream;
+ import java.net.URL;
+-import java.net.MalformedURLException;
+ 
+ import javax.sound.midi.MidiFileFormat;
+ import javax.sound.midi.InvalidMidiDataException;
+@@ -49,7 +40,6 @@
+ import javax.sound.midi.MidiEvent;
+ import javax.sound.midi.MidiMessage;
+ import javax.sound.midi.Sequence;
+-import javax.sound.midi.ShortMessage;
+ import javax.sound.midi.SysexMessage;
+ import javax.sound.midi.Track;
+ import javax.sound.midi.spi.MidiFileReader;
+@@ -64,23 +54,12 @@
+  * @author Florian Bomers
+  */
+ 
+-public class StandardMidiFileReader extends MidiFileReader {
++public final class StandardMidiFileReader extends MidiFileReader {
+ 
+     private static final int MThd_MAGIC = 0x4d546864;  // 'MThd'
+ 
+-    private static final int MIDI_TYPE_0 = 0;
+-    private static final int MIDI_TYPE_1 = 1;
+-
+     private static final int bisBufferSize = 1024; // buffer size in buffered input streams
+ 
+-    /**
+-     * MIDI parser types
+-     */
+-    private static final int types[] = {
+-        MIDI_TYPE_0,
+-        MIDI_TYPE_1
+-    };
+-
+     public MidiFileFormat getMidiFileFormat(InputStream stream) throws InvalidMidiDataException, IOException {
+         return getMidiFileFormatFromStream(stream, MidiFileFormat.UNKNOWN_LENGTH, null);
+     }
+@@ -253,7 +232,7 @@
+ /**
+  * State variables during parsing of a MIDI file
+  */
+-class SMFParser {
++final class SMFParser {
+     private static final int MTrk_MAGIC = 0x4d54726b;  // 'MTrk'
+ 
+     // set to true to not allow corrupt MIDI files tombe loaded
+@@ -268,7 +247,7 @@
+     private byte[] trackData = null;
+     private int pos = 0;
+ 
+-    public SMFParser() {
++    SMFParser() {
+     }
+ 
+     private int readUnsigned() throws IOException {
+diff --git a/src/share/classes/com/sun/media/sound/StandardMidiFileWriter.java b/src/share/classes/com/sun/media/sound/StandardMidiFileWriter.java
+--- jdk/src/share/classes/com/sun/media/sound/StandardMidiFileWriter.java
++++ jdk/src/share/classes/com/sun/media/sound/StandardMidiFileWriter.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1999, 2009, 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
+@@ -25,7 +25,6 @@
+ 
+ package com.sun.media.sound;
+ 
+-import java.io.DataInputStream;
+ import java.io.DataOutputStream;
+ import java.io.PipedInputStream;
+ import java.io.PipedOutputStream;
+@@ -34,18 +33,13 @@
+ import java.io.SequenceInputStream;
+ import java.io.File;
+ import java.io.FileOutputStream;
+-import java.io.BufferedOutputStream;
+ import java.io.InputStream;
+ import java.io.IOException;
+-import java.lang.IllegalArgumentException;
+ import java.io.OutputStream;
+-import java.util.Vector;
+ 
+-import javax.sound.midi.MidiFileFormat;
+ import javax.sound.midi.InvalidMidiDataException;
+ import javax.sound.midi.MidiEvent;
+ import javax.sound.midi.MetaMessage;
+-import javax.sound.midi.MidiMessage;
+ import javax.sound.midi.Sequence;
+ import javax.sound.midi.ShortMessage;
+ import javax.sound.midi.SysexMessage;
+@@ -59,7 +53,7 @@
+  * @author Kara Kytle
+  * @author Jan Borgersen
+  */
+-public class StandardMidiFileWriter extends MidiFileWriter {
++public final class StandardMidiFileWriter extends MidiFileWriter {
+ 
+     private static final int MThd_MAGIC = 0x4d546864;  // 'MThd'
+     private static final int MTrk_MAGIC = 0x4d54726b;  // 'MTrk'
+diff --git a/src/share/classes/com/sun/media/sound/SunCodec.java b/src/share/classes/com/sun/media/sound/SunCodec.java
+--- jdk/src/share/classes/com/sun/media/sound/SunCodec.java
++++ jdk/src/share/classes/com/sun/media/sound/SunCodec.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
+@@ -25,8 +25,6 @@
+ 
+ package com.sun.media.sound;
+ 
+-import java.io.InputStream;
+-
+ import javax.sound.sampled.AudioFormat;
+ import javax.sound.sampled.AudioInputStream;
+ 
+@@ -48,14 +46,14 @@
+  */
+ abstract class SunCodec extends FormatConversionProvider {
+ 
+-    AudioFormat.Encoding[] inputEncodings;
+-    AudioFormat.Encoding[] outputEncodings;
++    private final AudioFormat.Encoding[] inputEncodings;
++    private final AudioFormat.Encoding[] outputEncodings;
+ 
+     /**
+      * Constructs a new codec object.
+      */
+-    protected SunCodec(AudioFormat.Encoding[] inputEncodings, AudioFormat.Encoding[] outputEncodings) {
+-
++    SunCodec(final AudioFormat.Encoding[] inputEncodings,
++             final AudioFormat.Encoding[] outputEncodings) {
+         this.inputEncodings = inputEncodings;
+         this.outputEncodings = outputEncodings;
+     }
+@@ -63,16 +61,14 @@
+ 
+     /**
+      */
+-    public AudioFormat.Encoding[] getSourceEncodings() {
+-
++    public final AudioFormat.Encoding[] getSourceEncodings() {
+         AudioFormat.Encoding[] encodings = new AudioFormat.Encoding[inputEncodings.length];
+         System.arraycopy(inputEncodings, 0, encodings, 0, inputEncodings.length);
+         return encodings;
+     }
+     /**
+      */
+-    public AudioFormat.Encoding[] getTargetEncodings() {
+-
++    public final AudioFormat.Encoding[] getTargetEncodings() {
+         AudioFormat.Encoding[] encodings = new AudioFormat.Encoding[outputEncodings.length];
+         System.arraycopy(outputEncodings, 0, encodings, 0, outputEncodings.length);
+         return encodings;
+diff --git a/src/share/classes/com/sun/media/sound/SunFileReader.java b/src/share/classes/com/sun/media/sound/SunFileReader.java
+--- jdk/src/share/classes/com/sun/media/sound/SunFileReader.java
++++ jdk/src/share/classes/com/sun/media/sound/SunFileReader.java
+@@ -27,7 +27,6 @@
+ 
+ import java.io.File;
+ import java.io.InputStream;
+-import java.io.OutputStream;
+ import java.io.IOException;
+ import java.io.DataInputStream;
+ import java.net.URL;
+@@ -52,7 +51,7 @@
+     /**
+      * Constructs a new SunFileReader object.
+      */
+-    public SunFileReader() {
++    SunFileReader() {
+     }
+ 
+ 
+@@ -167,7 +166,7 @@
+      * @return 32 bits swapped value.
+      * @exception IOException
+      */
+-    protected int rllong(DataInputStream dis) throws IOException {
++    final int rllong(DataInputStream dis) throws IOException {
+ 
+         int b1, b2, b3, b4 ;
+         int i = 0;
+@@ -190,7 +189,7 @@
+      * @param int
+      * @return 32 bits swapped value
+      */
+-    protected int big2little(int i) {
++    final int big2little(int i) {
+ 
+         int b1, b2, b3, b4 ;
+ 
+@@ -211,7 +210,7 @@
+      * @return the swapped value.
+      * @exception IOException
+      */
+-    protected short rlshort(DataInputStream dis)  throws IOException {
++    final short rlshort(DataInputStream dis)  throws IOException {
+ 
+         short s=0;
+         short high, low;
+@@ -232,7 +231,7 @@
+      * @param int
+      * @return 16 bits swapped value
+      */
+-    protected short big2littleShort(short i) {
++    final short big2littleShort(short i) {
+ 
+         short high, low;
+ 
+@@ -244,16 +243,14 @@
+         return i;
+     }
+ 
+-
+-        /** Calculates the frame size for PCM frames.
+-         * Note that this method is appropriate for non-packed samples.
+-         * For instance, 12 bit, 2 channels will return 4 bytes, not 3.
+-         * @param sampleSizeInBits the size of a single sample in bits
+-         * @param channels the number of channels
+-         * @return the size of a PCM frame in bytes.
+-         */
+-        protected static int calculatePCMFrameSize(int sampleSizeInBits,
+-                                                                                        int channels) {
+-                return ((sampleSizeInBits + 7) / 8) * channels;
+-        }
++    /** Calculates the frame size for PCM frames.
++     * Note that this method is appropriate for non-packed samples.
++     * For instance, 12 bit, 2 channels will return 4 bytes, not 3.
++     * @param sampleSizeInBits the size of a single sample in bits
++     * @param channels the number of channels
++     * @return the size of a PCM frame in bytes.
++     */
++    static final int calculatePCMFrameSize(int sampleSizeInBits, int channels) {
++        return ((sampleSizeInBits + 7) / 8) * channels;
++    }
+ }
+diff --git a/src/share/classes/com/sun/media/sound/SunFileWriter.java b/src/share/classes/com/sun/media/sound/SunFileWriter.java
+--- jdk/src/share/classes/com/sun/media/sound/SunFileWriter.java
++++ jdk/src/share/classes/com/sun/media/sound/SunFileWriter.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
+@@ -74,8 +74,7 @@
+ 
+     // new, 10.27.99
+ 
+-    public AudioFileFormat.Type[] getAudioFileTypes(){
+-
++    public final AudioFileFormat.Type[] getAudioFileTypes(){
+         AudioFileFormat.Type[] localArray = new AudioFileFormat.Type[types.length];
+         System.arraycopy(types, 0, localArray, 0, types.length);
+         return localArray;
+@@ -100,7 +99,7 @@
+      * @return 32 bits swapped value.
+      * @exception IOException
+      */
+-    protected int rllong(DataInputStream dis) throws IOException {
++    final int rllong(DataInputStream dis) throws IOException {
+ 
+         int b1, b2, b3, b4 ;
+         int i = 0;
+@@ -123,7 +122,7 @@
+      * @param int
+      * @return 32 bits swapped value
+      */
+-    protected int big2little(int i) {
++    final int big2little(int i) {
+ 
+         int b1, b2, b3, b4 ;
+ 
+@@ -144,7 +143,7 @@
+      * @return the swapped value.
+      * @exception IOException
+      */
+-    protected short rlshort(DataInputStream dis)  throws IOException {
++    final short rlshort(DataInputStream dis)  throws IOException {
+ 
+         short s=0;
+         short high, low;
+@@ -165,7 +164,7 @@
+      * @param int
+      * @return 16 bits swapped value
+      */
+-    protected short big2littleShort(short i) {
++    final short big2littleShort(short i) {
+ 
+         short high, low;
+ 
+diff --git a/src/share/classes/com/sun/media/sound/Toolkit.java b/src/share/classes/com/sun/media/sound/Toolkit.java
+--- jdk/src/share/classes/com/sun/media/sound/Toolkit.java
++++ jdk/src/share/classes/com/sun/media/sound/Toolkit.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
+@@ -35,8 +35,13 @@
+  * @author Kara Kytle
+  * @author Florian Bomers
+  */
+-public class Toolkit {
++public final class Toolkit {
+ 
++    /**
++     * Suppresses default constructor, ensuring non-instantiability.
++     */
++    private Toolkit() {
++    }
+ 
+     /**
+      * Converts bytes from signed to unsigned.
+diff --git a/src/share/classes/com/sun/media/sound/UlawCodec.java b/src/share/classes/com/sun/media/sound/UlawCodec.java
+--- jdk/src/share/classes/com/sun/media/sound/UlawCodec.java
++++ jdk/src/share/classes/com/sun/media/sound/UlawCodec.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
+@@ -25,7 +25,6 @@
+ 
+ package com.sun.media.sound;
+ 
+-import java.io.InputStream;
+ import java.io.IOException;
+ 
+ import java.util.Vector;
+@@ -40,12 +39,12 @@
+  *
+  * @author Kara Kytle
+  */
+-public class UlawCodec extends SunCodec {
++public final class UlawCodec extends SunCodec {
+ 
+     /* Tables used for U-law decoding */
+ 
+-    final static byte ULAW_TABH[] = new byte[256];
+-    final static byte ULAW_TABL[] = new byte[256];
++    private final static byte[] ULAW_TABH = new byte[256];
++    private final static byte[] ULAW_TABL = new byte[256];
+ 
+     private static final AudioFormat.Encoding[] ulawEncodings = {AudioFormat.Encoding.ULAW,
+                                                                  AudioFormat.Encoding.PCM_SIGNED};
+diff --git a/src/share/classes/com/sun/media/sound/WaveExtensibleFileReader.java b/src/share/classes/com/sun/media/sound/WaveExtensibleFileReader.java
+--- jdk/src/share/classes/com/sun/media/sound/WaveExtensibleFileReader.java
++++ jdk/src/share/classes/com/sun/media/sound/WaveExtensibleFileReader.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -46,7 +46,7 @@
+  * 
+  * @author Karl Helgason
+  */
+-public class WaveExtensibleFileReader extends AudioFileReader {
++public final class WaveExtensibleFileReader extends AudioFileReader {
+ 
+     static private class GUID {
+         long i1;
+@@ -74,7 +74,7 @@
+         private GUID() {
+         }
+ 
+-        public GUID(long i1, int s1, int s2, int x1, int x2, int x3, int x4,
++        GUID(long i1, int s1, int s2, int x1, int x2, int x3, int x4,
+                 int x5, int x6, int x7, int x8) {
+             this.i1 = i1;
+             this.s1 = s1;
+@@ -140,13 +140,13 @@
+ 
+     }
+ 
+-    private static String[] channelnames = { "FL", "FR", "FC", "LF",
++    private static final String[] channelnames = { "FL", "FR", "FC", "LF",
+             "BL",
+             "BR", // 5.1
+             "FLC", "FLR", "BC", "SL", "SR", "TC", "TFL", "TFC", "TFR", "TBL",
+             "TBC", "TBR" };
+ 
+-    private static String[] allchannelnames = { "w1", "w2", "w3", "w4", "w5",
++    private static final String[] allchannelnames = { "w1", "w2", "w3", "w4", "w5",
+             "w6", "w7", "w8", "w9", "w10", "w11", "w12", "w13", "w14", "w15",
+             "w16", "w17", "w18", "w19", "w20", "w21", "w22", "w23", "w24",
+             "w25", "w26", "w27", "w28", "w29", "w30", "w31", "w32", "w33",
+@@ -155,10 +155,10 @@
+             "w52", "w53", "w54", "w55", "w56", "w57", "w58", "w59", "w60",
+             "w61", "w62", "w63", "w64" };
+ 
+-    private static GUID SUBTYPE_PCM = new GUID(0x00000001, 0x0000, 0x0010,
++    private static final GUID SUBTYPE_PCM = new GUID(0x00000001, 0x0000, 0x0010,
+             0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
+ 
+-    private static GUID SUBTYPE_IEEE_FLOAT = new GUID(0x00000003, 0x0000,
++    private static final GUID SUBTYPE_IEEE_FLOAT = new GUID(0x00000003, 0x0000,
+             0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
+ 
+     private String decodeChannelMask(long channelmask) {
+diff --git a/src/share/classes/com/sun/media/sound/WaveFileFormat.java b/src/share/classes/com/sun/media/sound/WaveFileFormat.java
+--- jdk/src/share/classes/com/sun/media/sound/WaveFileFormat.java
++++ jdk/src/share/classes/com/sun/media/sound/WaveFileFormat.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
+@@ -25,24 +25,8 @@
+ 
+ package com.sun.media.sound;
+ 
+-import java.util.Vector;
+-import java.io.File;
+-import java.io.InputStream;
+-import java.io.OutputStream;
+-import java.io.IOException;
+-import java.lang.IllegalArgumentException;
+-
+-import java.io.BufferedOutputStream;
+-import java.io.DataOutputStream;
+-import java.io.FileOutputStream;
+-import java.io.ByteArrayInputStream;
+-import java.io.ByteArrayOutputStream;
+-import java.io.SequenceInputStream;
+-
+ import javax.sound.sampled.AudioFileFormat;
+-import javax.sound.sampled.AudioInputStream;
+ import javax.sound.sampled.AudioFormat;
+-import javax.sound.sampled.AudioSystem;
+ 
+ 
+ /**
+@@ -51,12 +35,12 @@
+  * @author Jan Borgersen
+  */
+ 
+-class WaveFileFormat extends AudioFileFormat {
++final class WaveFileFormat extends AudioFileFormat {
+ 
+     /**
+      * Wave format type.
+      */
+-    private int waveType;
++    private final int waveType;
+ 
+     //$$fb 2001-07-13: added management of header size in this class
+     //$$fb 2002-04-16: Fix for 4636355: RIFF audio headers could be _more_ spec compliant
+diff --git a/src/share/classes/com/sun/media/sound/WaveFileReader.java b/src/share/classes/com/sun/media/sound/WaveFileReader.java
+--- jdk/src/share/classes/com/sun/media/sound/WaveFileReader.java
++++ jdk/src/share/classes/com/sun/media/sound/WaveFileReader.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
+@@ -25,28 +25,17 @@
+ 
+ package com.sun.media.sound;
+ 
+-import java.util.Vector;
++import java.io.DataInputStream;
++import java.io.EOFException;
+ import java.io.File;
++import java.io.FileInputStream;
++import java.io.IOException;
+ import java.io.InputStream;
+-import java.io.OutputStream;
+-import java.io.IOException;
+-import java.io.EOFException;
+ import java.net.URL;
+-import java.net.MalformedURLException;
+-
+-import java.io.BufferedInputStream;
+-import java.io.BufferedOutputStream;
+-import java.io.DataInputStream;
+-import java.io.FileInputStream;
+-import java.io.DataOutputStream;
+-import java.io.FileOutputStream;
+-import java.io.ByteArrayInputStream;
+-import java.io.ByteArrayOutputStream;
+-import java.io.SequenceInputStream;
+ 
+ import javax.sound.sampled.AudioFileFormat;
++import javax.sound.sampled.AudioFormat;
+ import javax.sound.sampled.AudioInputStream;
+-import javax.sound.sampled.AudioFormat;
+ import javax.sound.sampled.AudioSystem;
+ import javax.sound.sampled.UnsupportedAudioFileException;
+ 
+@@ -59,20 +48,11 @@
+  * @author Jan Borgersen
+  * @author Florian Bomers
+  */
+-public class WaveFileReader extends SunFileReader {
++public final class WaveFileReader extends SunFileReader {
+ 
+     private static final int MAX_READ_LENGTH = 12;
+ 
+     /**
+-     * WAVE reader type
+-     */
+-
+-    public static final AudioFileFormat.Type types[] = {
+-        AudioFileFormat.Type.WAVE
+-    };
+-
+-
+-    /**
+      * Constructs a new WaveFileReader object.
+      */
+     public WaveFileReader() {
+diff --git a/src/share/classes/com/sun/media/sound/WaveFileWriter.java b/src/share/classes/com/sun/media/sound/WaveFileWriter.java
+--- jdk/src/share/classes/com/sun/media/sound/WaveFileWriter.java
++++ jdk/src/share/classes/com/sun/media/sound/WaveFileWriter.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
+@@ -52,7 +52,7 @@
+  *
+  * @author Jan Borgersen
+  */
+-public class WaveFileWriter extends SunFileWriter {
++public final class WaveFileWriter extends SunFileWriter {
+ 
+     // magic numbers
+     static  final int RIFF_MAGIC = 1380533830;
+@@ -76,18 +76,10 @@
+     static final int WAVE_FORMAT_SX7383    = 0x1C07;
+ 
+     /**
+-     * WAVE type
+-     */
+-    private static final AudioFileFormat.Type waveTypes[] = {
+-        AudioFileFormat.Type.WAVE
+-    };
+-
+-
+-    /**
+      * Constructs a new WaveFileWriter object.
+      */
+     public WaveFileWriter() {
+-        super(waveTypes);
++        super(new AudioFileFormat.Type[]{AudioFileFormat.Type.WAVE});
+     }
+ 
+ 
+diff --git a/src/share/classes/com/sun/media/sound/WaveFloatFileReader.java b/src/share/classes/com/sun/media/sound/WaveFloatFileReader.java
+--- jdk/src/share/classes/com/sun/media/sound/WaveFloatFileReader.java
++++ jdk/src/share/classes/com/sun/media/sound/WaveFloatFileReader.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -43,7 +43,7 @@
+  *
+  * @author Karl Helgason
+  */
+-public class WaveFloatFileReader extends AudioFileReader {
++public final class WaveFloatFileReader extends AudioFileReader {
+ 
+     public AudioFileFormat getAudioFileFormat(InputStream stream)
+             throws UnsupportedAudioFileException, IOException {
+diff --git a/src/share/classes/com/sun/media/sound/WaveFloatFileWriter.java b/src/share/classes/com/sun/media/sound/WaveFloatFileWriter.java
+--- jdk/src/share/classes/com/sun/media/sound/WaveFloatFileWriter.java
++++ jdk/src/share/classes/com/sun/media/sound/WaveFloatFileWriter.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2008, 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
+@@ -40,7 +40,7 @@
+  * 
+  * @author Karl Helgason
+  */
+-public class WaveFloatFileWriter extends AudioFileWriter {
++public final class WaveFloatFileWriter extends AudioFileWriter {
+ 
+     public Type[] getAudioFileTypes() {
+         return new Type[] { Type.WAVE };
+@@ -87,9 +87,9 @@
+     }
+ 
+     private static class NoCloseOutputStream extends OutputStream {
+-        OutputStream out;
++        final OutputStream out;
+ 
+-        public NoCloseOutputStream(OutputStream out) {
++        NoCloseOutputStream(OutputStream out) {
+             this.out = out;
+         }
+ 
+diff --git a/src/share/classes/javax/sound/midi/MetaMessage.java b/src/share/classes/javax/sound/midi/MetaMessage.java
+--- jdk/src/share/classes/javax/sound/midi/MetaMessage.java
++++ jdk/src/share/classes/javax/sound/midi/MetaMessage.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1999, 2003, 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
+@@ -25,10 +25,6 @@
+ 
+ package javax.sound.midi;
+ 
+-import java.io.ByteArrayOutputStream;
+-import java.io.DataOutputStream;
+-import java.io.IOException;
+-
+ 
+ /**
+  * A <code>MetaMessage</code> is a <code>{@link MidiMessage}</code> that is not meaningful to synthesizers, but
+@@ -71,14 +67,6 @@
+      */
+     public static final int META                                                = 0xFF; // 255
+ 
+-
+-    // Default meta message data: just the META status byte value
+-    // $$kk: 09.09.99: need a real event here!!
+-
+-    private static byte[] defaultMessage                                = { (byte)META, 0 };
+-
+-
+-
+     // Instance variables
+ 
+     /**
+@@ -98,8 +86,8 @@
+      * to set them subsequently.
+      */
+     public MetaMessage() {
+-        //super(defaultMessage);
+-        this(defaultMessage);
++        // Default meta message data: just the META status byte value
++        this(new byte[]{(byte) META, 0});
+     }
+ 
+ 
+diff --git a/src/share/classes/javax/sound/sampled/Mixer.java b/src/share/classes/javax/sound/sampled/Mixer.java
+--- jdk/src/share/classes/javax/sound/sampled/Mixer.java
++++ jdk/src/share/classes/javax/sound/sampled/Mixer.java
+@@ -253,22 +253,22 @@
+         /**
+          * Mixer name.
+          */
+-        private /*final*/ String name;
++        private final String name;
+ 
+         /**
+          * Mixer vendor.
+          */
+-        private /*final*/ String vendor;
++        private final String vendor;
+ 
+         /**
+          * Mixer description.
+          */
+-        private /*final*/ String description;
++        private final String description;
+ 
+         /**
+          * Mixer version.
+          */
+-        private /*final*/ String version;
++        private final String version;
+ 
+         /**
+          * Constructs a mixer's info object, passing it the given
+diff --git a/src/share/classes/sun/audio/AudioData.java b/src/share/classes/sun/audio/AudioData.java
+--- jdk/src/share/classes/sun/audio/AudioData.java
++++ jdk/src/share/classes/sun/audio/AudioData.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1999, 2002, 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
+@@ -48,7 +48,7 @@
+   */
+ 
+ 
+-public class AudioData {
++public final class AudioData {
+ 
+     private static final AudioFormat DEFAULT_FORMAT =
+         new AudioFormat(AudioFormat.Encoding.ULAW,
+diff --git a/src/share/classes/sun/audio/AudioDataStream.java b/src/share/classes/sun/audio/AudioDataStream.java
+--- jdk/src/share/classes/sun/audio/AudioDataStream.java
++++ jdk/src/share/classes/sun/audio/AudioDataStream.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1999, 2002, 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
+@@ -26,8 +26,6 @@
+ package sun.audio;
+ 
+ import java.io.*;
+-import javax.sound.sampled.*;
+-import javax.sound.midi.*;
+ 
+ /**
+  * An input stream to play AudioData.
+@@ -39,18 +37,18 @@
+  */
+ public class AudioDataStream extends ByteArrayInputStream {
+ 
+-    AudioData ad;
++    private final AudioData ad;
+ 
+     /**
+      * Constructor
+      */
+-    public AudioDataStream(AudioData data) {
++    public AudioDataStream(final AudioData data) {
+ 
+         super(data.buffer);
+         this.ad = data;
+     }
+ 
+-    AudioData getAudioData() {
++    final AudioData getAudioData() {
+         return ad;
+     }
+ }
+diff --git a/src/share/classes/sun/audio/AudioDevice.java b/src/share/classes/sun/audio/AudioDevice.java
+--- jdk/src/share/classes/sun/audio/AudioDevice.java
++++ jdk/src/share/classes/sun/audio/AudioDevice.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1999, 2003, 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
+@@ -27,12 +27,9 @@
+ 
+ import java.util.Hashtable;
+ import java.util.Vector;
+-import java.util.Enumeration;
+ import java.io.IOException;
+ import java.io.InputStream;
+ import java.io.BufferedInputStream;
+-import java.io.OutputStream;
+-import java.io.ByteArrayInputStream;
+ 
+ import javax.sound.sampled.*;
+ import javax.sound.midi.*;
+@@ -57,8 +54,7 @@
+  * @author Florian Bomers
+  */
+ 
+-public class
+-    AudioDevice {
++public final class AudioDevice {
+ 
+     private boolean DEBUG = false  /*true*/ ;
+ 
+@@ -404,11 +400,11 @@
+ 
+     // INFO CLASS
+ 
+-    class Info implements MetaEventListener {
++    final class Info implements MetaEventListener {
+ 
+-        Sequencer   sequencer;
+-        InputStream in;
+-        DataPusher  datapusher;
++        final Sequencer   sequencer;
++        final InputStream in;
++        final DataPusher  datapusher;
+ 
+         Info( Sequencer sequencer, InputStream in, DataPusher datapusher ) {
+ 
+diff --git a/src/share/classes/sun/audio/AudioPlayer.java b/src/share/classes/sun/audio/AudioPlayer.java
+--- jdk/src/share/classes/sun/audio/AudioPlayer.java
++++ jdk/src/share/classes/sun/audio/AudioPlayer.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1999, 2003, 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
+@@ -25,13 +25,7 @@
+ 
+ package sun.audio;
+ 
+-import java.util.Vector;
+-import java.util.Enumeration;
+-import java.io.IOException;
+ import java.io.InputStream;
+-import java.io.OutputStream;
+-import java.io.FileOutputStream;
+-
+ import java.security.AccessController;
+ import java.security.PrivilegedAction;
+ 
+@@ -69,11 +63,10 @@
+  * @author Arthur van Hoff, Thomas Ball
+  */
+ 
+-public
+-    class AudioPlayer extends Thread {
++public final class AudioPlayer extends Thread {
+ 
+-        private AudioDevice devAudio;
+-        private static boolean DEBUG = false /*true*/;
++        private final AudioDevice devAudio;
++        private final static boolean DEBUG = false /*true*/;
+ 
+         /**
+          * The default audio player. This audio player is initialized
+diff --git a/src/share/classes/sun/audio/AudioStream.java b/src/share/classes/sun/audio/AudioStream.java
+--- jdk/src/share/classes/sun/audio/AudioStream.java
++++ jdk/src/share/classes/sun/audio/AudioStream.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1999, 2002, 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
+@@ -26,9 +26,7 @@
+ package sun.audio;
+ 
+ import java.io.InputStream;
+-import java.io.DataInputStream;
+ import java.io.FilterInputStream;
+-import java.io.ByteArrayInputStream;
+ import java.io.BufferedInputStream;
+ import java.io.IOException;
+ 
+@@ -41,13 +39,13 @@
+  */
+ 
+ 
+-public class AudioStream extends FilterInputStream {
++public final class AudioStream extends FilterInputStream {
+ 
+     // AudioContainerInputStream acis;
+-    protected AudioInputStream ais = null;
+-    protected AudioFormat format = null;
+-    protected MidiFileFormat midiformat = null;
+-    protected InputStream stream = null;
++    AudioInputStream ais = null;
++    AudioFormat format = null;
++    MidiFileFormat midiformat = null;
++    InputStream stream = null;
+ 
+ 
+     /*
+diff --git a/src/share/classes/sun/audio/AudioStreamSequence.java b/src/share/classes/sun/audio/AudioStreamSequence.java
+--- jdk/src/share/classes/sun/audio/AudioStreamSequence.java
++++ jdk/src/share/classes/sun/audio/AudioStreamSequence.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1999, 2002, 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
+@@ -25,7 +25,6 @@
+ 
+ package sun.audio;
+ 
+-import java.io.IOException;
+ import java.io.InputStream;
+ import java.io.SequenceInputStream;
+ import java.util.Enumeration;
+@@ -44,8 +43,8 @@
+  * @see AudioPlayer
+  * @author Arthur van Hoff
+  */
+-public
+-    class AudioStreamSequence extends SequenceInputStream {
++public final class AudioStreamSequence extends SequenceInputStream {
++
+         Enumeration e;
+         InputStream in;
+ 
+diff --git a/src/share/classes/sun/audio/AudioTranslatorStream.java b/src/share/classes/sun/audio/AudioTranslatorStream.java
+--- jdk/src/share/classes/sun/audio/AudioTranslatorStream.java
++++ jdk/src/share/classes/sun/audio/AudioTranslatorStream.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1999, 2002, 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
+@@ -26,18 +26,15 @@
+ package sun.audio;
+ 
+ import java.io.InputStream;
+-import java.io.DataInputStream;
+-import java.io.FilterInputStream;
+ import java.io.IOException;
+ 
+ /**
+  * Translator for native audio formats (not implemented in this release).
+  *
+  */
+-public
+-    class AudioTranslatorStream extends NativeAudioStream {
++public final class AudioTranslatorStream extends NativeAudioStream {
+ 
+-        private int length = 0;
++        private final int length = 0;
+ 
+         public AudioTranslatorStream(InputStream in) throws IOException {
+             super(in);
+diff --git a/src/share/classes/sun/audio/ContinuousAudioDataStream.java b/src/share/classes/sun/audio/ContinuousAudioDataStream.java
+--- jdk/src/share/classes/sun/audio/ContinuousAudioDataStream.java
++++ jdk/src/share/classes/sun/audio/ContinuousAudioDataStream.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1999, 2002, 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
+@@ -42,11 +42,10 @@
+  * @author Arthur van Hoff
+  */
+ 
+-public
+-    class ContinuousAudioDataStream extends AudioDataStream {
++public final class ContinuousAudioDataStream extends AudioDataStream {
+ 
+ 
+-        /**
++    /**
+          * Create a continuous stream of audio.
+          */
+         public ContinuousAudioDataStream(AudioData data) {
+diff --git a/src/share/classes/sun/audio/InvalidAudioFormatException.java b/src/share/classes/sun/audio/InvalidAudioFormatException.java
+--- jdk/src/share/classes/sun/audio/InvalidAudioFormatException.java
++++ jdk/src/share/classes/sun/audio/InvalidAudioFormatException.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1999, 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
+@@ -29,20 +29,20 @@
+ /**
+  * Signals an invalid audio stream for the stream handler.
+  */
+-class InvalidAudioFormatException extends IOException {
++final class InvalidAudioFormatException extends IOException {
+ 
+ 
+     /**
+      * Constructor.
+      */
+-    public InvalidAudioFormatException() {
++    InvalidAudioFormatException() {
+         super();
+     }
+ 
+     /**
+      * Constructor with a detail message.
+      */
+-    public InvalidAudioFormatException(String s) {
++    InvalidAudioFormatException(String s) {
+         super(s);
+     }
+ }

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8006611-improve_scripting.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8006611-improve_scripting.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8006611-improve_scripting.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,78 @@
+# HG changeset patch
+# User sundar
+# Date 1365156565 -19800
+# Node ID 1d5eff0bd9b504b7191279bfc6a417f6a2e2251f
+# Parent  5c9fbf7443a24076a6545cb043102cb2527f62ca
+8006611: Improve scripting
+Reviewed-by: mchung, jdn
+
+diff --git a/src/share/classes/javax/script/ScriptEngineManager.java b/src/share/classes/javax/script/ScriptEngineManager.java
+--- jdk/src/share/classes/javax/script/ScriptEngineManager.java
++++ jdk/src/share/classes/javax/script/ScriptEngineManager.java
+@@ -30,8 +30,6 @@
+ import java.security.*;
+ import sun.misc.Service;
+ import sun.misc.ServiceConfigurationError;
+-import sun.reflect.Reflection;
+-import sun.security.util.SecurityConstants;
+ 
+ /**
+  * The <code>ScriptEngineManager</code> implements a discovery and instantiation
+@@ -64,13 +62,7 @@
+      */
+     public ScriptEngineManager() {
+         ClassLoader ctxtLoader = Thread.currentThread().getContextClassLoader();
+-        if (canCallerAccessLoader(ctxtLoader)) {
+-            if (DEBUG) System.out.println("using " + ctxtLoader);
+-            init(ctxtLoader);
+-        } else {
+-            if (DEBUG) System.out.println("using bootstrap loader");
+-            init(null);
+-        }
++        init(ctxtLoader);
+     }
+ 
+     /**
+@@ -418,42 +410,4 @@
+ 
+     /** Global bindings associated with script engines created by this manager. */
+     private Bindings globalScope;
+-
+-    private boolean canCallerAccessLoader(ClassLoader loader) {
+-        SecurityManager sm = System.getSecurityManager();
+-        if (sm != null) {
+-            ClassLoader callerLoader = getCallerClassLoader();
+-            if (callerLoader != null) {
+-                if (loader != callerLoader || !isAncestor(loader, callerLoader)) {
+-                    try {
+-                        sm.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION);
+-                    } catch (SecurityException exp) {
+-                        if (DEBUG) exp.printStackTrace();
+-                        return false;
+-                    }
+-                } // else fallthru..
+-            } // else fallthru..
+-        } // else fallthru..
+-
+-        return true;
+-    }
+-
+-    // Note that this code is same as ClassLoader.getCallerClassLoader().
+-    // But, that method is package private and hence we can't call here.
+-    private ClassLoader getCallerClassLoader() {
+-        Class caller = Reflection.getCallerClass(3);
+-        if (caller == null) {
+-            return null;
+-        }
+-        return caller.getClassLoader();
+-    }
+-
+-    // is cl1 ancestor of cl2?
+-    private boolean isAncestor(ClassLoader cl1, ClassLoader cl2) {
+-        do {
+-            cl2 = cl2.getParent();
+-            if (cl1 == cl2) return true;
+-        } while (cl2 != null);
+-        return false;
+-    }
+ }

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8007467-improve_jmx_internal_api_robustness.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8007467-improve_jmx_internal_api_robustness.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8007467-improve_jmx_internal_api_robustness.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,108 @@
+# HG changeset patch
+# User andrew
+# Date 1371404383 18000
+# Node ID 65ed365feeae0a68d89dd63143b6be3c0be11c81
+# Parent  1d5eff0bd9b504b7191279bfc6a417f6a2e2251f
+8007467: Improve robustness of JMX internal APIs
+Reviewed-by: dfuchs, mchung, skoivu
+
+diff --git a/src/share/classes/com/sun/jmx/mbeanserver/ConvertingMethod.java b/src/share/classes/com/sun/jmx/mbeanserver/ConvertingMethod.java
+--- jdk/src/share/classes/com/sun/jmx/mbeanserver/ConvertingMethod.java
++++ jdk/src/share/classes/com/sun/jmx/mbeanserver/ConvertingMethod.java
+@@ -33,6 +33,7 @@
+ import javax.management.MBeanException;
+ import javax.management.openmbean.OpenDataException;
+ import javax.management.openmbean.OpenType;
++import sun.reflect.misc.MethodUtil;
+ 
+ final class ConvertingMethod {
+     static ConvertingMethod from(Method m) {
+@@ -177,7 +178,7 @@
+                 "from open values: " + e;
+             throw new MBeanException(e, msg);
+         }
+-        final Object javaReturn = method.invoke(obj, javaParams);
++        final Object javaReturn = MethodUtil.invoke(method, obj, javaParams);
+         try {
+             return returnConverter.toOpenValue(lookup, javaReturn);
+         } catch (OpenDataException e) {
+diff --git a/src/share/classes/com/sun/jmx/mbeanserver/StandardMBeanIntrospector.java b/src/share/classes/com/sun/jmx/mbeanserver/StandardMBeanIntrospector.java
+--- jdk/src/share/classes/com/sun/jmx/mbeanserver/StandardMBeanIntrospector.java
++++ jdk/src/share/classes/com/sun/jmx/mbeanserver/StandardMBeanIntrospector.java
+@@ -38,6 +38,7 @@
+ import javax.management.NotCompliantMBeanException;
+ import javax.management.NotificationBroadcaster;
+ import javax.management.NotificationBroadcasterSupport;
++import sun.reflect.misc.MethodUtil;
+ 
+ /**
+  * @since 1.6
+@@ -108,7 +109,7 @@
+     Object invokeM2(Method m, Object target, Object[] args, Object cookie)
+             throws InvocationTargetException, IllegalAccessException,
+                    MBeanException {
+-        return m.invoke(target, args);
++        return MethodUtil.invoke(m, target, args);
+     }
+ 
+     @Override
+diff --git a/src/share/classes/javax/management/openmbean/CompositeDataInvocationHandler.java b/src/share/classes/javax/management/openmbean/CompositeDataInvocationHandler.java
+--- jdk/src/share/classes/javax/management/openmbean/CompositeDataInvocationHandler.java
++++ jdk/src/share/classes/javax/management/openmbean/CompositeDataInvocationHandler.java
+@@ -172,6 +172,8 @@
+                    the only non-final methods in Object that are not
+                    handled above are finalize and clone, and these
+                    are not overridden in generated proxies.  */
++                // this plain Method.invoke is called only if the declaring class
++                // is Object and so it's safe.
+                 return method.invoke(this, args);
+             }
+         }
+diff --git a/src/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java b/src/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java
+--- jdk/src/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java
++++ jdk/src/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java
+@@ -45,6 +45,9 @@
+ import javax.management.ImmutableDescriptor;
+ import javax.management.MBeanAttributeInfo;
+ import com.sun.jmx.remote.util.EnvHelp;
++import sun.reflect.misc.ConstructorUtil;
++import sun.reflect.misc.MethodUtil;
++import sun.reflect.misc.ReflectUtil;
+ 
+ /**
+  * Describes an attribute of an open MBean.
+@@ -690,6 +693,7 @@
+     private static <T> T convertFromString(String s, OpenType<T> openType) {
+         Class<T> c;
+         try {
++            ReflectUtil.checkPackageAccess(openType.safeGetClassName());
+             c = cast(Class.forName(openType.safeGetClassName()));
+         } catch (ClassNotFoundException e) {
+             throw new NoClassDefFoundError(e.toString());  // can't happen
+@@ -698,6 +702,8 @@
+         // Look for: public static T valueOf(String)
+         Method valueOf;
+         try {
++            // It is safe to call this plain Class.getMethod because the class "c"
++            // was checked before by ReflectUtil.checkPackageAccess(openType.safeGetClassName());
+             valueOf = c.getMethod("valueOf", String.class);
+             if (!Modifier.isStatic(valueOf.getModifiers()) ||
+                     valueOf.getReturnType() != c)
+@@ -707,7 +713,7 @@
+         }
+         if (valueOf != null) {
+             try {
+-                return c.cast(valueOf.invoke(null, s));
++                return c.cast(MethodUtil.invoke(valueOf, null, new Object[] {s}));
+             } catch (Exception e) {
+                 final String msg =
+                     "Could not convert \"" + s + "\" using method: " + valueOf;
+@@ -718,6 +724,8 @@
+         // Look for: public T(String)
+         Constructor<T> con;
+         try {
++            // It is safe to call this plain Class.getConstructor because the class "c"
++            // was checked before by ReflectUtil.checkPackageAccess(openType.safeGetClassName());
+             con = c.getConstructor(String.class);
+         } catch (NoSuchMethodException e) {
+             con = null;

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8007471-6_fixup.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8007471-6_fixup.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8007471-6_fixup.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,25 @@
+# HG changeset patch
+# User andrew
+# Date 1371827420 18000
+# Node ID ae1f55ff0e864d754b3dd7f2ad86fd93062e9744
+# Parent  ccd06d9c7258aea155d7053d399431bcd1af4405
+Fix up 8007471
+
+diff --git a/src/share/classes/com/sun/jmx/remote/internal/ArrayNotificationBuffer.java b/src/share/classes/com/sun/jmx/remote/internal/ArrayNotificationBuffer.java
+--- jdk/src/share/classes/com/sun/jmx/remote/internal/ArrayNotificationBuffer.java
++++ jdk/src/share/classes/com/sun/jmx/remote/internal/ArrayNotificationBuffer.java
+@@ -402,7 +402,13 @@
+                         try {
+                             ServerNotifForwarder.checkMBeanPermission(this.mBeanServer,
+                                                       candidate.getObjectName(),"addNotificationListener");
+-                        } catch (InstanceNotFoundException | SecurityException e) {
++                        } catch (InstanceNotFoundException e) {
++                            if (logger.debugOn()) {
++                                logger.debug("fetchNotifications", "candidate: " + candidate + " skipped. exception " + e);
++                            }
++                            ++nextSeq;
++                            continue;
++                        } catch (SecurityException e) {
+                             if (logger.debugOn()) {
+                                 logger.debug("fetchNotifications", "candidate: " + candidate + " skipped. exception " + e);
+                             }

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8007471-improve_mbean_notifications.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8007471-improve_mbean_notifications.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8007471-improve_mbean_notifications.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,89 @@
+# HG changeset patch
+# User andrew
+# Date 1371404736 18000
+# Node ID 5c4ab66b87e3b640978d71e1af2952f00e721ada
+# Parent  65ed365feeae0a68d89dd63143b6be3c0be11c81
+8007471: Improve MBean notifications
+Summary: Improve MBean notifications
+
+diff --git a/src/share/classes/com/sun/jmx/remote/internal/ArrayNotificationBuffer.java b/src/share/classes/com/sun/jmx/remote/internal/ArrayNotificationBuffer.java
+--- jdk/src/share/classes/com/sun/jmx/remote/internal/ArrayNotificationBuffer.java
++++ jdk/src/share/classes/com/sun/jmx/remote/internal/ArrayNotificationBuffer.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -397,6 +397,20 @@
+ 
+                 if (nextSeq < nextSequenceNumber()) {
+                     candidate = notificationAt(nextSeq);
++                    // Skip security check if NotificationBufferFilter is not overloaded
++                    if (!(filter instanceof ServerNotifForwarder.NotifForwarderBufferFilter)) {
++                        try {
++                            ServerNotifForwarder.checkMBeanPermission(this.mBeanServer,
++                                                      candidate.getObjectName(),"addNotificationListener");
++                        } catch (InstanceNotFoundException | SecurityException e) {
++                            if (logger.debugOn()) {
++                                logger.debug("fetchNotifications", "candidate: " + candidate + " skipped. exception " + e);
++                            }
++                            ++nextSeq;
++                            continue;
++                        }
++                    }
++
+                     if (logger.debugOn()) {
+                         logger.debug("fetchNotifications", "candidate: " +
+                                      candidate);
+diff --git a/src/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java b/src/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java
+--- jdk/src/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java
++++ jdk/src/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2002, 2006, 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
+@@ -228,8 +228,9 @@
+      * why we add the found notifications to a supplied List rather than
+      * just returning a boolean.
+      */
+-    private final NotificationBufferFilter bufferFilter =
+-            new NotificationBufferFilter() {
++    private final NotifForwarderBufferFilter bufferFilter = new NotifForwarderBufferFilter();
++
++    final class NotifForwarderBufferFilter implements NotificationBufferFilter {
+         public void apply(List<TargetedNotification> targetedNotifs,
+                           ObjectName source, Notification notif) {
+             // We proceed in two stages here, to avoid holding the listenerMap
+@@ -330,9 +331,16 @@
+      * Explicitly check the MBeanPermission for
+      * the current access control context.
+      */
+-    private void checkMBeanPermission(final ObjectName name,
+-        final String actions)
++    public final void checkMBeanPermission(
++             final ObjectName name, final String actions)
+         throws InstanceNotFoundException, SecurityException {
++        checkMBeanPermission(mbeanServer,name,actions);
++    }
++
++    static void checkMBeanPermission(
++            final MBeanServer mbs, final ObjectName name, final String actions)
++            throws InstanceNotFoundException, SecurityException {
++
+         SecurityManager sm = System.getSecurityManager();
+         if (sm != null) {
+             AccessControlContext acc = AccessController.getContext();
+@@ -342,7 +350,7 @@
+                     new PrivilegedExceptionAction<ObjectInstance>() {
+                         public ObjectInstance run()
+                         throws InstanceNotFoundException {
+-                            return mbeanServer.getObjectInstance(name);
++                            return mbs.getObjectInstance(name);
+                         }
+                 });
+             } catch (PrivilegedActionException e) {

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8007812-getenclosingmethod.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8007812-getenclosingmethod.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8007812-getenclosingmethod.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,89 @@
+# HG changeset patch
+# User andrew
+# Date 1371404993 18000
+# Node ID a9d86a9899a5ecfdb22e5ca279a834771684b0fe
+# Parent  5c4ab66b87e3b640978d71e1af2952f00e721ada
+8007812: (reflect) Class.getEnclosingMethod problematic for some classes
+Summary: Better checking in getEnclosing(Method|Constructor|Class)
+Reviewed-by: darcy, ahgross, 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
+@@ -912,13 +912,22 @@
+             for(int i = 0; i < parameterClasses.length; i++)
+                 parameterClasses[i] = toClass(parameterTypes[i]);
+ 
++            // Perform access check
++            Class<?> enclosingCandidate = enclosingInfo.getEnclosingClass();
++            // be very careful not to change the stack depth of this
++            // checkMemberAccess call for security reasons
++            // see java.lang.SecurityManager.checkMemberAccess
++            //
++            // Note that we need to do this on the enclosing class
++            enclosingCandidate.checkMemberAccess(Member.DECLARED,
++                        ClassLoader.getCallerClassLoader(), true);
+             /*
+              * Loop over all declared methods; match method name,
+              * number of and type of parameters, *and* return
+              * type.  Matching return type is also necessary
+              * because of covariant returns, etc.
+              */
+-            for(Method m: enclosingInfo.getEnclosingClass().getDeclaredMethods()) {
++            for(Method m: enclosingCandidate.getDeclaredMethods()) {
+                 if (m.getName().equals(enclosingInfo.getName()) ) {
+                     Class<?>[] candidateParamClasses = m.getParameterTypes();
+                     if (candidateParamClasses.length == parameterClasses.length) {
+@@ -1039,11 +1048,20 @@
+             for(int i = 0; i < parameterClasses.length; i++)
+                 parameterClasses[i] = toClass(parameterTypes[i]);
+ 
++            // Perform access check
++            Class<?> enclosingCandidate = enclosingInfo.getEnclosingClass();
++            // be very careful not to change the stack depth of this
++            // checkMemberAccess call for security reasons
++            // see java.lang.SecurityManager.checkMemberAccess
++            //
++            // Note that we need to do this on the enclosing class
++            enclosingCandidate.checkMemberAccess(Member.DECLARED,
++                        ClassLoader.getCallerClassLoader(), true);
+             /*
+              * Loop over all declared constructors; match number
+              * of and type of parameters.
+              */
+-            for(Constructor c: enclosingInfo.getEnclosingClass().getDeclaredConstructors()) {
++            for(Constructor<?> c: enclosingCandidate.getDeclaredConstructors()) {
+                 Class<?>[] candidateParamClasses = c.getParameterTypes();
+                 if (candidateParamClasses.length == parameterClasses.length) {
+                     boolean matches = true;
+@@ -1098,18 +1116,28 @@
+         // attribute if and only if it is a local class or an
+         // anonymous class.
+         EnclosingMethodInfo enclosingInfo = getEnclosingMethodInfo();
++        Class<?> enclosingCandidate;
+ 
+         if (enclosingInfo == null) {
+             // This is a top level or a nested class or an inner class (a, b, or c)
+-            return getDeclaringClass();
++            enclosingCandidate = getDeclaringClass();
+         } else {
+             Class<?> enclosingClass = enclosingInfo.getEnclosingClass();
+             // This is a local class or an anonymous class (d or e)
+             if (enclosingClass == this || enclosingClass == null)
+                 throw new InternalError("Malformed enclosing method information");
+             else
+-                return enclosingClass;
++                enclosingCandidate = enclosingClass;
+         }
++
++        // be very careful not to change the stack depth of this
++        // checkMemberAccess call for security reasons
++        // see java.lang.SecurityManager.checkMemberAccess
++        if (enclosingCandidate != null) {
++            enclosingCandidate.checkMemberAccess(Member.DECLARED,
++                    ClassLoader.getCallerClassLoader(), true);
++        }
++        return enclosingCandidate;
+     }
+ 
+     /**

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8008120-improve_jmx_class_checking.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8008120-improve_jmx_class_checking.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8008120-improve_jmx_class_checking.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,332 @@
+# HG changeset patch
+# User andrew
+# Date 1371483960 18000
+# Node ID 100c93da24f90ae93063fdd0affbc29c691424e8
+# Parent  a9d86a9899a5ecfdb22e5ca279a834771684b0fe
+8008120: Improve JMX class checking
+Summary: Improve JMX class checking
+Reviewed-by: mchung, dfuchs, alanb, skoivu
+
+diff --git a/src/share/classes/javax/management/relation/RelationNotification.java b/src/share/classes/javax/management/relation/RelationNotification.java
+--- jdk/src/share/classes/javax/management/relation/RelationNotification.java
++++ jdk/src/share/classes/javax/management/relation/RelationNotification.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2000, 2006, 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
+@@ -28,6 +28,7 @@
+ import javax.management.Notification;
+ import javax.management.ObjectName;
+ 
++import java.io.InvalidObjectException;
+ import java.io.IOException;
+ import java.io.ObjectInputStream;
+ import java.io.ObjectOutputStream;
+@@ -37,8 +38,11 @@
+ import java.security.PrivilegedAction;
+ 
+ import java.util.ArrayList;
++import java.util.Arrays;
+ import java.util.Collections;
++import java.util.HashSet;
+ import java.util.List;
++import java.util.Set;
+ 
+ import com.sun.jmx.mbeanserver.GetPropertyAction;
+ import static com.sun.jmx.mbeanserver.Util.cast;
+@@ -256,21 +260,14 @@
+ 
+         super(notifType, sourceObj, sequence, timeStamp, message);
+ 
+-        // Can throw IllegalArgumentException
+-        initMembers(1,
+-                    notifType,
+-                    sourceObj,
+-                    sequence,
+-                    timeStamp,
+-                    message,
+-                    id,
+-                    typeName,
+-                    objectName,
+-                    unregMBeanList,
+-                    null,
+-                    null,
+-                    null);
+-        return;
++        if (!isValidBasic(notifType,sourceObj,id,typeName) || !isValidCreate(notifType)) {
++            throw new IllegalArgumentException("Invalid parameter.");
++        }
++
++        relationId = id;
++        relationTypeName = typeName;
++        relationObjName = safeGetObjectName(objectName);
++        unregisterMBeanList = safeGetObjectNameList(unregMBeanList);
+     }
+ 
+     /**
+@@ -313,21 +310,17 @@
+ 
+         super(notifType, sourceObj, sequence, timeStamp, message);
+ 
+-        // Can throw IllegalArgumentException
+-        initMembers(2,
+-                    notifType,
+-                    sourceObj,
+-                    sequence,
+-                    timeStamp,
+-                    message,
+-                    id,
+-                    typeName,
+-                    objectName,
+-                    null,
+-                    name,
+-                    newValue,
+-                    oldValue);
+-        return;
++        if (!isValidBasic(notifType,sourceObj,id,typeName) || !isValidUpdate(notifType,name,newValue,oldValue)) {
++            throw new IllegalArgumentException("Invalid parameter.");
++        }
++
++        relationId = id;
++        relationTypeName = typeName;
++        relationObjName = safeGetObjectName(objectName);
++
++        roleName = name;
++        oldRoleValue = safeGetObjectNameList(oldValue);
++        newRoleValue = safeGetObjectNameList(newValue);
+     }
+ 
+     //
+@@ -463,83 +456,64 @@
+     //  - no role name (for role update)
+     //  - no role old value (for role update)
+     //  - no role new value (for role update)
+-    private void initMembers(int notifKind,
+-                             String notifType,
+-                             Object sourceObj,
+-                             long sequence,
+-                             long timeStamp,
+-                             String message,
+-                             String id,
+-                             String typeName,
+-                             ObjectName objectName,
+-                             List<ObjectName> unregMBeanList,
+-                             String name,
+-                             List<ObjectName> newValue,
+-                             List<ObjectName> oldValue)
+-            throws IllegalArgumentException {
+ 
+-        boolean badInitFlg = false;
+-
+-        if (notifType == null ||
+-            sourceObj == null ||
+-            (!(sourceObj instanceof RelationService) &&
+-             !(sourceObj instanceof ObjectName)) ||
+-            id == null ||
+-            typeName == null) {
+-
+-            badInitFlg = true;
++    private boolean isValidBasic(String notifType, Object sourceObj, String id, String typeName){
++        if (notifType == null || sourceObj == null ||
++            id == null || typeName == null) {
++            return false;
+         }
+ 
+-        if (notifKind == 1) {
++        if (!(sourceObj instanceof RelationService) &&
++            !(sourceObj instanceof ObjectName)) {
++            return false;
++        }
+ 
+-            if ((!(notifType.equals(RelationNotification.RELATION_BASIC_CREATION)))
+-                &&
+-                (!(notifType.equals(RelationNotification.RELATION_MBEAN_CREATION)))
+-                &&
+-                (!(notifType.equals(RelationNotification.RELATION_BASIC_REMOVAL)))
+-                &&
+-                (!(notifType.equals(RelationNotification.RELATION_MBEAN_REMOVAL)))
+-                ) {
++        return true;
++    }
+ 
+-                // Creation/removal
+-                badInitFlg = true;
+-            }
++    private boolean isValidCreate(String notifType) {
++        String[] validTypes= {RelationNotification.RELATION_BASIC_CREATION,
++                              RelationNotification.RELATION_MBEAN_CREATION,
++                              RelationNotification.RELATION_BASIC_REMOVAL,
++                              RelationNotification.RELATION_MBEAN_REMOVAL};
+ 
+-        } else if (notifKind == 2) {
++        Set<String> ctSet = new HashSet<String>(Arrays.asList(validTypes));
++        return ctSet.contains(notifType);
++    }
+ 
+-            if (((!(notifType.equals(RelationNotification.RELATION_BASIC_UPDATE)))
+-                 &&
+-                 (!(notifType.equals(RelationNotification.RELATION_MBEAN_UPDATE))))
+-                || name == null ||
+-                oldValue == null ||
+-                newValue == null) {
++    private boolean isValidUpdate(String notifType, String name,
++                                  List<ObjectName> newValue, List<ObjectName> oldValue) {
+ 
+-                // Role update
+-                badInitFlg = true;
++        if (!(notifType.equals(RelationNotification.RELATION_BASIC_UPDATE)) &&
++            !(notifType.equals(RelationNotification.RELATION_MBEAN_UPDATE))) {
++            return false;
++        }
++
++        if (name == null || oldValue == null || newValue == null) {
++            return false;
++        }
++
++        return true;
++    }
++
++    private ArrayList<ObjectName> safeGetObjectNameList(List<ObjectName> src){
++        ArrayList<ObjectName> dest = null;
++        if (src != null) {
++            dest = new ArrayList<ObjectName>();
++            for (ObjectName item : src) {
++                // NPE thrown if we attempt to add null object
++                dest.add(ObjectName.getInstance(item));
+             }
+         }
++        return dest;
++    }
+ 
+-        if (badInitFlg) {
+-            String excMsg = "Invalid parameter.";
+-            throw new IllegalArgumentException(excMsg);
++    private ObjectName safeGetObjectName(ObjectName src){
++        ObjectName dest = null;
++        if (src != null) {
++            dest = ObjectName.getInstance(src);
+         }
+-
+-        relationId = id;
+-        relationTypeName = typeName;
+-        relationObjName = objectName;
+-        if (unregMBeanList != null) {
+-            unregisterMBeanList = new ArrayList<ObjectName>(unregMBeanList);
+-        }
+-        if (name != null) {
+-            roleName = name;
+-        }
+-        if (oldValue != null) {
+-            oldRoleValue = new ArrayList<ObjectName>(oldValue);
+-        }
+-        if (newValue != null) {
+-            newRoleValue = new ArrayList<ObjectName>(newValue);
+-        }
+-        return;
++        return dest;
+     }
+ 
+     /**
+@@ -547,53 +521,56 @@
+      */
+     private void readObject(ObjectInputStream in)
+             throws IOException, ClassNotFoundException {
+-      if (compat)
+-      {
+-        // Read an object serialized in the old serial form
+-        //
++
++        String tmpRelationId, tmpRelationTypeName, tmpRoleName;
++
++        ObjectName tmpRelationObjName;
++        List<ObjectName> tmpNewRoleValue, tmpOldRoleValue, tmpUnregMBeanList;
++
+         ObjectInputStream.GetField fields = in.readFields();
+-        newRoleValue = cast(fields.get("myNewRoleValue", null));
+-        if (fields.defaulted("myNewRoleValue"))
+-        {
+-          throw new NullPointerException("newRoleValue");
++
++        if (compat) {
++            tmpRelationId = (String)fields.get("myRelId", null);
++            tmpRelationTypeName = (String)fields.get("myRelTypeName", null);
++            tmpRoleName = (String)fields.get("myRoleName", null);
++
++            tmpRelationObjName = (ObjectName)fields.get("myRelObjName", null);
++            tmpNewRoleValue = cast(fields.get("myNewRoleValue", null));
++            tmpOldRoleValue = cast(fields.get("myOldRoleValue", null));
++            tmpUnregMBeanList = cast(fields.get("myUnregMBeanList", null));
+         }
+-        oldRoleValue = cast(fields.get("myOldRoleValue", null));
+-        if (fields.defaulted("myOldRoleValue"))
+-        {
+-          throw new NullPointerException("oldRoleValue");
++        else {
++            tmpRelationId = (String)fields.get("relationId", null);
++            tmpRelationTypeName = (String)fields.get("relationTypeName", null);
++            tmpRoleName = (String)fields.get("roleName", null);
++
++            tmpRelationObjName = (ObjectName)fields.get("relationObjName", null);
++            tmpNewRoleValue = cast(fields.get("newRoleValue", null));
++            tmpOldRoleValue = cast(fields.get("oldRoleValue", null));
++            tmpUnregMBeanList = cast(fields.get("unregisterMBeanList", null));
+         }
+-        relationId = (String) fields.get("myRelId", null);
+-        if (fields.defaulted("myRelId"))
+-        {
+-          throw new NullPointerException("relationId");
++
++        // Validate fields we just read, throw InvalidObjectException
++        // if something goes wrong
++
++        String notifType = super.getType();
++        if (!isValidBasic(notifType,super.getSource(),tmpRelationId,tmpRelationTypeName)  ||
++            (!isValidCreate(notifType) &&
++             !isValidUpdate(notifType,tmpRoleName,tmpNewRoleValue,tmpOldRoleValue))) {
++
++            super.setSource(null);
++            throw new InvalidObjectException("Invalid object read");
+         }
+-        relationObjName = (ObjectName) fields.get("myRelObjName", null);
+-        if (fields.defaulted("myRelObjName"))
+-        {
+-          throw new NullPointerException("relationObjName");
+-        }
+-        relationTypeName = (String) fields.get("myRelTypeName", null);
+-        if (fields.defaulted("myRelTypeName"))
+-        {
+-          throw new NullPointerException("relationTypeName");
+-        }
+-        roleName = (String) fields.get("myRoleName", null);
+-        if (fields.defaulted("myRoleName"))
+-        {
+-          throw new NullPointerException("roleName");
+-        }
+-        unregisterMBeanList = cast(fields.get("myUnregMBeanList", null));
+-        if (fields.defaulted("myUnregMBeanList"))
+-        {
+-          throw new NullPointerException("unregisterMBeanList");
+-        }
+-      }
+-      else
+-      {
+-        // Read an object serialized in the new serial form
+-        //
+-        in.defaultReadObject();
+-      }
++
++        // assign deserialized vaules to object fields
++        relationObjName = safeGetObjectName(tmpRelationObjName);
++        newRoleValue = safeGetObjectNameList(tmpNewRoleValue);
++        oldRoleValue = safeGetObjectNameList(tmpOldRoleValue);
++        unregisterMBeanList = safeGetObjectNameList(tmpUnregMBeanList);
++
++        relationId = tmpRelationId;
++        relationTypeName = tmpRelationTypeName;
++        roleName = tmpRoleName;
+     }
+ 
+ 

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8008124-better_compliance_testing.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8008124-better_compliance_testing.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8008124-better_compliance_testing.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,20 @@
+# HG changeset patch
+# User dsamersoff
+# Date 1364499568 -14400
+# Node ID f880d5294bdd9d8d555fe3fbf06e39a5b80ad125
+# Parent  100c93da24f90ae93063fdd0affbc29c691424e8
+8008124: Better compliance testing
+Summary: Better compliance testing
+Reviewed-by: dfuchs, jfdenise, skoivu, alanb
+
+diff --git a/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java b/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java
+--- jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java
++++ jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java
+@@ -235,6 +235,7 @@
+             throws NotCompliantMBeanException {
+         if (mbeanInterface == null)
+             mbeanInterface = getStandardMBeanInterface(baseClass);
++        ReflectUtil.checkPackageAccess(mbeanInterface);
+         MBeanIntrospector<?> introspector = StandardMBeanIntrospector.getInstance();
+         return getClassMBeanInfo(introspector, baseClass, mbeanInterface);
+     }

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8008128-better_jmx_api_coherence.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8008128-better_jmx_api_coherence.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8008128-better_jmx_api_coherence.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,110 @@
+# HG changeset patch
+# User andrew
+# Date 1370952792 -3600
+# Node ID 9bfe1c4dabb13428827ab592c4ee120593407603
+# Parent  f880d5294bdd9d8d555fe3fbf06e39a5b80ad125
+8008128: Better API coherence for JMX
+Summary: Permission for getting classloader
+Reviewed-by: alanb, dfuchs, skoivu
+Contributed-by: jean-francois.denise at oracle.com
+
+diff --git a/src/share/classes/com/sun/jmx/mbeanserver/ClassLoaderRepositorySupport.java b/src/share/classes/com/sun/jmx/mbeanserver/ClassLoaderRepositorySupport.java
+--- jdk/src/share/classes/com/sun/jmx/mbeanserver/ClassLoaderRepositorySupport.java
++++ jdk/src/share/classes/com/sun/jmx/mbeanserver/ClassLoaderRepositorySupport.java
+@@ -27,12 +27,14 @@
+ 
+ 
+ import static com.sun.jmx.defaults.JmxProperties.MBEANSERVER_LOGGER;
++import java.security.Permission;
+ import java.util.ArrayList;
+ import java.util.Arrays;
+ import java.util.Hashtable;
+ import java.util.List;
+ import java.util.Map;
+ import java.util.logging.Level;
++import javax.management.MBeanPermission;
+ 
+ import javax.management.ObjectName;
+ import javax.management.loading.PrivateClassLoader;
+@@ -300,7 +302,19 @@
+     }
+ 
+     public final ClassLoader getClassLoader(ObjectName name) {
+-        return loadersWithNames.get(name);
++        ClassLoader instance = loadersWithNames.get(name);
++        if (instance != null) {
++            SecurityManager sm = System.getSecurityManager();
++            if (sm != null) {
++                Permission perm =
++                        new MBeanPermission(instance.getClass().getName(),
++                        null,
++                        name,
++                        "getClassLoader");
++                sm.checkPermission(perm);
++            }
++        }
++        return instance;
+     }
+ 
+ }
+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
+@@ -32,7 +32,12 @@
+ import java.io.ObjectInputStream;
+ import java.lang.reflect.Constructor;
+ import java.lang.reflect.InvocationTargetException;
++import java.security.AccessControlContext;
++import java.security.AccessController;
+ import java.security.Permission;
++import java.security.Permissions;
++import java.security.PrivilegedAction;
++import java.security.ProtectionDomain;
+ import java.util.Map;
+ import java.util.logging.Level;
+ 
+@@ -126,9 +131,8 @@
+ 
+         // Retrieve the class loader from the repository
+         ClassLoader loader = null;
+-        synchronized(this) {
+-            if (clr!=null)
+-                loader = clr.getClassLoader(aLoader);
++        synchronized (this) {
++            loader = getClassLoader(aLoader);
+         }
+         if (loader == null) {
+             throw new InstanceNotFoundException("The loader named " +
+@@ -429,8 +433,7 @@
+             try {
+                 ClassLoader instance = null;
+ 
+-                if (clr!=null)
+-                    instance = clr.getClassLoader(loaderName);
++                instance = getClassLoader(loaderName);
+                 if (instance == null)
+                     throw new ClassNotFoundException(className);
+                 theClass = Class.forName(className, false, instance);
+@@ -742,4 +745,22 @@
+             sm.checkPermission(perm);
+         }
+     }
++
++    private ClassLoader getClassLoader(final ObjectName name) {
++        if(clr == null){
++            return null;
++        }
++        // Restrict to getClassLoader permission only
++        Permissions permissions = new Permissions();
++        permissions.add(new MBeanPermission("*", null, name, "getClassLoader"));
++        ProtectionDomain protectionDomain = new ProtectionDomain(null, permissions);
++        ProtectionDomain[] domains = {protectionDomain};
++        AccessControlContext ctx = new AccessControlContext(domains);
++        ClassLoader loader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
++            public ClassLoader run() {
++                return clr.getClassLoader(name);
++            }
++        }, ctx);
++        return loader;
++    }
+ }

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8008132-better_serialization.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8008132-better_serialization.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8008132-better_serialization.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,121 @@
+# HG changeset patch
+# User Severin Gehwolf <sgehwolf at redhat.com>
+# Date 1371476865 -7200
+# Node ID 5dd7618fd14c647d21d765fcc2431c9ee6289ae4
+# Parent  60c57caf0348c7eed93900e4395607af759e6ba9
+8008132: Better serialization support
+Reviewed-by: alanb, hawtin
+
+diff --git a/src/share/classes/java/io/ObjectOutputStream.java b/src/share/classes/java/io/ObjectOutputStream.java
+--- jdk/src/share/classes/java/io/ObjectOutputStream.java
++++ jdk/src/share/classes/java/io/ObjectOutputStream.java
+@@ -36,6 +36,7 @@
+ import java.util.concurrent.ConcurrentMap;
+ import static java.io.ObjectStreamClass.processQueue;
+ import java.io.SerialCallbackContext;
++import sun.reflect.misc.ReflectUtil;
+ 
+ /**
+  * An ObjectOutputStream writes primitive data types and graphs of Java objects
+@@ -1228,6 +1229,12 @@
+         }
+     }
+ 
++    private boolean isCustomSubclass() {
++        // Return true if this class is a custom subclass of ObjectOutputStream
++        return getClass().getClassLoader()
++                   != ObjectOutputStream.class.getClassLoader();
++    }
++
+     /**
+      * Writes class descriptor representing a dynamic proxy class to stream.
+      */
+@@ -1245,6 +1252,9 @@
+         }
+ 
+         bout.setBlockDataMode(true);
++        if (isCustomSubclass()) {
++            ReflectUtil.checkPackageAccess(cl);
++        }
+         annotateProxyClass(cl);
+         bout.setBlockDataMode(false);
+         bout.writeByte(TC_ENDBLOCKDATA);
+@@ -1271,6 +1281,9 @@
+ 
+         Class cl = desc.forClass();
+         bout.setBlockDataMode(true);
++        if (isCustomSubclass()) {
++            ReflectUtil.checkPackageAccess(cl);
++        }
+         annotateClass(cl);
+         bout.setBlockDataMode(false);
+         bout.writeByte(TC_ENDBLOCKDATA);
+diff --git a/src/share/classes/java/io/ObjectStreamClass.java b/src/share/classes/java/io/ObjectStreamClass.java
+--- jdk/src/share/classes/java/io/ObjectStreamClass.java
++++ jdk/src/share/classes/java/io/ObjectStreamClass.java
+@@ -50,6 +50,7 @@
+ import java.util.concurrent.ConcurrentMap;
+ import sun.misc.Unsafe;
+ import sun.reflect.ReflectionFactory;
++import sun.reflect.misc.ReflectUtil;
+ 
+ /**
+  * Serialization's descriptor for classes.  It contains the name and
+@@ -234,6 +235,13 @@
+      * @return  the <code>Class</code> instance that this descriptor represents
+      */
+     public Class<?> forClass() {
++        if (cl == null) {
++            return null;
++        }
++        ClassLoader ccl = ObjectStreamField.getCallerClassLoader();
++        if (ReflectUtil.needsPackageAccessCheck(ccl, cl.getClassLoader())) {
++            ReflectUtil.checkPackageAccess(cl);
++        }
+         return cl;
+     }
+ 
+diff --git a/src/share/classes/java/io/ObjectStreamField.java b/src/share/classes/java/io/ObjectStreamField.java
+--- jdk/src/share/classes/java/io/ObjectStreamField.java
++++ jdk/src/share/classes/java/io/ObjectStreamField.java
+@@ -26,6 +26,8 @@
+ package java.io;
+ 
+ import java.lang.reflect.Field;
++import sun.reflect.Reflection;
++import sun.reflect.misc.ReflectUtil;
+ 
+ /**
+  * A description of a Serializable field from a Serializable class.  An array
+@@ -158,9 +160,31 @@
+      *          serializable field
+      */
+     public Class<?> getType() {
++        ClassLoader ccl = getCallerClassLoader();
++        if (ReflectUtil.needsPackageAccessCheck(ccl, type.getClassLoader())) {
++            ReflectUtil.checkPackageAccess(type);
++        }
+         return type;
+     }
+ 
++    // Returns the invoker's class loader.
++    // This is package private because it is accessed from ObjectStreamClass.
++    // NOTE: This must always be invoked when there is exactly one intervening
++    // frame from the core libraries on the stack between this method's
++    // invocation and the desired invoker. The frame count of 3 is determined
++    // as follows:
++    //
++    // 0: Reflection.getCallerClass
++    // 1: getCallerClassLoader()
++    // 2: ObjectStreamField.getType() or ObjectStreamClass.forClass()
++    // 3: the caller we want to check
++    //
++    // NOTE: copied from java.lang.ClassLoader and modified.
++    static ClassLoader getCallerClassLoader() {
++        Class caller = Reflection.getCallerClass(3);
++        return caller.getClassLoader();
++    }
++
+     /**
+      * Returns character encoding of field type.  The encoding is as follows:
+      * <blockquote><pre>

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8008585-jmx_data_handling.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8008585-jmx_data_handling.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8008585-jmx_data_handling.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,69 @@
+# HG changeset patch
+# User Severin Gehwolf <sgehwolf at redhat.com>
+# Date 1371477101 -7200
+# Node ID 1fd002800d60c1c6291d49f3a2d27ccc02b296ec
+# Parent  5dd7618fd14c647d21d765fcc2431c9ee6289ae4
+8008585: Better JMX data handling
+Reviewed-by: alanb, dfuchs, jfdenise, skoivu, sjiang
+
+diff --git a/src/share/classes/javax/management/remote/JMXConnectorFactory.java b/src/share/classes/javax/management/remote/JMXConnectorFactory.java
+--- jdk/src/share/classes/javax/management/remote/JMXConnectorFactory.java
++++ jdk/src/share/classes/javax/management/remote/JMXConnectorFactory.java
+@@ -39,6 +39,7 @@
+ 
+ import com.sun.jmx.remote.util.ClassLogger;
+ import com.sun.jmx.remote.util.EnvHelp;
++import sun.reflect.misc.ReflectUtil;
+ 
+ 
+ /**
+@@ -397,10 +398,10 @@
+     }
+ 
+     static <T> T getProvider(JMXServiceURL serviceURL,
+-                             Map<String, Object> environment,
++                             final Map<String, Object> environment,
+                              String providerClassName,
+                              Class<T> targetInterface,
+-                             ClassLoader loader)
++                             final ClassLoader loader)
+             throws IOException {
+ 
+         final String protocol = serviceURL.getProtocol();
+@@ -410,11 +411,14 @@
+         T instance = null;
+ 
+         if (pkgs != null) {
+-            environment.put(PROTOCOL_PROVIDER_CLASS_LOADER, loader);
+-
+             instance =
+                 getProvider(protocol, pkgs, loader, providerClassName,
+                             targetInterface);
++
++            if (instance != null) {
++                boolean needsWrap = (loader != instance.getClass().getClassLoader());
++                environment.put(PROTOCOL_PROVIDER_CLASS_LOADER, needsWrap ? wrap(loader) : loader);
++            }
+         }
+ 
+         return instance;
+@@ -428,6 +432,19 @@
+        return serviceLoader.iterator();
+     }
+ 
++    private static ClassLoader wrap(final ClassLoader parent) {
++        return parent != null ? AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
++            public ClassLoader run() {
++                return new ClassLoader(parent) {
++                    protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
++                        ReflectUtil.checkPackageAccess(name);
++                        return super.loadClass(name, resolve);
++                    }
++                };
++            }
++        }) : null;
++    }
++
+     private static JMXConnector getConnectorAsService(ClassLoader loader,
+                                                       JMXServiceURL url,
+                                                       Map<String, ?> map)

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8008593-better_urlclassloader.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8008593-better_urlclassloader.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8008593-better_urlclassloader.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,270 @@
+# HG changeset patch
+# User andrew
+# Date 1371485843 18000
+# Node ID 56bbd9db0a4965701dc64b41dac04507fa74f934
+# Parent  9bfe1c4dabb13428827ab592c4ee120593407603
+8008593: Better URLClassLoader resource management
+
+diff --git a/make/java/zip/mapfile-vers b/make/java/zip/mapfile-vers
+--- jdk/make/java/zip/mapfile-vers
++++ jdk/make/java/zip/mapfile-vers
+@@ -64,6 +64,7 @@
+ 		Java_java_util_zip_ZipFile_initIDs;
+ 		Java_java_util_zip_ZipFile_open;
+ 		Java_java_util_zip_ZipFile_read;
++		Java_java_util_zip_ZipFile_startsWithLOC;
+ 
+ 		ZIP_Close;
+ 		ZIP_CRC32;
+diff --git a/make/java/zip/reorder-i586 b/make/java/zip/reorder-i586
+--- jdk/make/java/zip/reorder-i586
++++ jdk/make/java/zip/reorder-i586
+@@ -19,6 +19,7 @@
+ text: .text%Java_java_util_zip_ZipFile_initIDs;
+ text: .text%Java_java_util_zip_ZipFile_open;
+ text: .text%Java_java_util_zip_ZipFile_getTotal;
++text: .text%Java_java_util_zip_ZipFile_startsWithLOC;
+ text: .text%Java_java_util_zip_ZipFile_getEntry;
+ text: .text%Java_java_util_zip_ZipEntry_initIDs;
+ text: .text%Java_java_util_zip_ZipEntry_initFields;
+diff --git a/make/java/zip/reorder-sparc b/make/java/zip/reorder-sparc
+--- jdk/make/java/zip/reorder-sparc
++++ jdk/make/java/zip/reorder-sparc
+@@ -18,6 +18,7 @@
+ text: .text%Java_java_util_zip_ZipFile_initIDs;
+ text: .text%Java_java_util_zip_ZipFile_open;
+ text: .text%Java_java_util_zip_ZipFile_getTotal;
++text: .text%Java_java_util_zip_ZipFile_startsWithLOC;
+ text: .text%Java_java_util_zip_ZipFile_getEntry;
+ text: .text%Java_java_util_zip_ZipEntry_initIDs;
+ text: .text%Java_java_util_zip_ZipEntry_initFields;
+diff --git a/make/java/zip/reorder-sparcv9 b/make/java/zip/reorder-sparcv9
+--- jdk/make/java/zip/reorder-sparcv9
++++ jdk/make/java/zip/reorder-sparcv9
+@@ -19,6 +19,7 @@
+ text: .text%Java_java_util_zip_ZipFile_initIDs;
+ text: .text%Java_java_util_zip_ZipFile_open;
+ text: .text%Java_java_util_zip_ZipFile_getTotal;
++text: .text%Java_java_util_zip_ZipFile_startsWithLOC;
+ text: .text%Java_java_util_zip_ZipFile_getEntry;
+ text: .text%Java_java_util_zip_ZipEntry_initIDs;
+ text: .text%Java_java_util_zip_ZipEntry_initFields;
+diff --git a/src/share/classes/java/util/zip/ZipFile.java b/src/share/classes/java/util/zip/ZipFile.java
+--- jdk/src/share/classes/java/util/zip/ZipFile.java
++++ jdk/src/share/classes/java/util/zip/ZipFile.java
+@@ -44,9 +44,10 @@
+  */
+ public
+ class ZipFile implements ZipConstants {
+-    private long jzfile;  // address of jzfile data
+-    private String name;  // zip file name
+-    private int total;    // total number of entries
++    private long jzfile;           // address of jzfile data
++    private final String name;     // zip file name
++    private final int total;       // total number of entries
++    private final boolean locsig;  // if zip file starts with LOCSIG (usually true)
+     private boolean closeRequested;
+ 
+     private static final int STORED = ZipEntry.STORED;
+@@ -132,10 +133,30 @@
+ 
+         this.name = name;
+         this.total = getTotal(jzfile);
++        this.locsig = startsWithLOC(jzfile);
++    }
++
++    static {
++        sun.misc.SharedSecrets.setJavaUtilZipFileAccess(
++            new sun.misc.JavaUtilZipFileAccess() {
++                public boolean startsWithLocHeader(ZipFile zip) {
++                    return zip.startsWithLocHeader();
++                }
++             }
++        );
++    }
++
++    /**
++     * Returns {@code true} if, and only if, the zip file begins with {@code
++     * LOCSIG}.
++     */
++    private boolean startsWithLocHeader() {
++        return locsig;
+     }
+ 
+     private static native long open(String name, int mode, long lastModified);
+     private static native int getTotal(long jzfile);
++    private static native boolean startsWithLOC(long jzfile);
+ 
+ 
+     /**
+diff --git a/src/share/classes/sun/misc/JavaUtilZipFileAccess.java b/src/share/classes/sun/misc/JavaUtilZipFileAccess.java
+new file mode 100644
+--- /dev/null
++++ jdk/src/share/classes/sun/misc/JavaUtilZipFileAccess.java
+@@ -0,0 +1,32 @@
++/*
++ * 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 sun.misc;
++
++import java.util.zip.ZipFile;
++
++public interface JavaUtilZipFileAccess {
++    public boolean startsWithLocHeader(ZipFile zip);
++}
+diff --git a/src/share/classes/sun/misc/SharedSecrets.java b/src/share/classes/sun/misc/SharedSecrets.java
+--- jdk/src/share/classes/sun/misc/SharedSecrets.java
++++ jdk/src/share/classes/sun/misc/SharedSecrets.java
+@@ -52,6 +52,7 @@
+     private static JavaIOFileDescriptorAccess javaIOFileDescriptorAccess;
+     private static JavaSecurityProtectionDomainAccess javaSecurityProtectionDomainAccess;
+     private static JavaSecurityAccess javaSecurityAccess;
++    private static JavaUtilZipFileAccess javaUtilZipFileAccess;
+     private static JavaAWTAccess javaAWTAccess;
+     private static JavaIOFileAccess javaIOFileAccess;
+ 
+@@ -141,6 +142,16 @@
+         return javaSecurityAccess;
+     }
+ 
++    public static JavaUtilZipFileAccess getJavaUtilZipFileAccess() {
++        if (javaUtilZipFileAccess == null)
++            unsafe.ensureClassInitialized(java.util.zip.ZipFile.class);
++        return javaUtilZipFileAccess;
++    }
++
++    public static void setJavaUtilZipFileAccess(JavaUtilZipFileAccess access) {
++        javaUtilZipFileAccess = access;
++    }
++
+     public static void setJavaAWTAccess(JavaAWTAccess jaa) {
+         javaAWTAccess = jaa;
+     }
+diff --git a/src/share/classes/sun/misc/URLClassPath.java b/src/share/classes/sun/misc/URLClassPath.java
+--- jdk/src/share/classes/sun/misc/URLClassPath.java
++++ jdk/src/share/classes/sun/misc/URLClassPath.java
+@@ -77,12 +77,16 @@
+     final static String USER_AGENT_JAVA_VERSION = "UA-Java-Version";
+     final static String JAVA_VERSION;
+     private static final boolean DEBUG;
++    private static final boolean DISABLE_JAR_CHECKING;
+ 
+     static {
+         JAVA_VERSION = java.security.AccessController.doPrivileged(
+             new sun.security.action.GetPropertyAction("java.version"));
+         DEBUG        = (java.security.AccessController.doPrivileged(
+             new sun.security.action.GetPropertyAction("sun.misc.URLClassPath.debug")) != null);
++        String p = java.security.AccessController.doPrivileged(
++            new sun.security.action.GetPropertyAction("sun.misc.URLClassPath.disableJarChecking"));
++        DISABLE_JAR_CHECKING = p != null ? p.equals("true") || p.equals("") : false;
+     }
+ 
+     /* The original search path of URLs. */
+@@ -559,6 +563,8 @@
+         private MetaIndex metaIndex;
+         private URLStreamHandler handler;
+         private HashMap lmap;
++        private static final sun.misc.JavaUtilZipFileAccess zipAccess =
++                sun.misc.SharedSecrets.getJavaUtilZipFileAccess();
+ 
+         /*
+          * Creates a new JarLoader for the specified URL referring to
+@@ -650,6 +656,14 @@
+             }
+         }
+ 
++        /* Throws if the given jar file is does not start with the correct LOC */
++        static JarFile checkJar(JarFile jar) throws IOException {
++            if (System.getSecurityManager() != null && !DISABLE_JAR_CHECKING
++                && !zipAccess.startsWithLocHeader(jar))
++                throw new IOException("Invalid Jar file");
++            return jar;
++        }
++
+         private JarFile getJarFile(URL url) throws IOException {
+             // Optimize case where url refers to a local jar file
+             if (isOptimizable(url)) {
+@@ -657,11 +671,12 @@
+                 if (!p.exists()) {
+                     throw new FileNotFoundException(p.getPath());
+                 }
+-                return new JarFile (p.getPath());
++                return checkJar(new JarFile(p.getPath()));
+             }
+             URLConnection uc = getBaseURL().openConnection();
+             uc.setRequestProperty(USER_AGENT_JAVA_VERSION, JAVA_VERSION);
+-            return ((JarURLConnection)uc).getJarFile();
++            JarFile jarFile = ((JarURLConnection)uc).getJarFile();
++            return checkJar(jarFile);
+         }
+ 
+         /*
+diff --git a/src/share/native/java/util/zip/ZipFile.c b/src/share/native/java/util/zip/ZipFile.c
+--- jdk/src/share/native/java/util/zip/ZipFile.c
++++ jdk/src/share/native/java/util/zip/ZipFile.c
+@@ -133,6 +133,14 @@
+     return zip->total;
+ }
+ 
++JNIEXPORT jboolean JNICALL
++Java_java_util_zip_ZipFile_startsWithLOC(JNIEnv *env, jclass cls, jlong zfile)
++{
++    jzfile *zip = jlong_to_ptr(zfile);
++
++    return zip->locsig;
++}
++
+ JNIEXPORT void JNICALL
+ Java_java_util_zip_ZipFile_close(JNIEnv *env, jclass cls, jlong zfile)
+ {
+diff --git a/src/share/native/java/util/zip/zip_util.c b/src/share/native/java/util/zip/zip_util.c
+--- jdk/src/share/native/java/util/zip/zip_util.c
++++ jdk/src/share/native/java/util/zip/zip_util.c
+@@ -721,6 +721,14 @@
+         return NULL;
+     }
+ 
++    // Assumption, zfd refers to start of file. Trivially, reuse errbuf.
++    if (readFully(zfd, errbuf, 4) != -1) {  // errors will be handled later
++        if (GETSIG(errbuf) == LOCSIG)
++            zip->locsig = JNI_TRUE;
++        else
++            zip->locsig = JNI_FALSE;
++    }
++
+     len = zip->len = ZFILE_Lseek(zfd, 0, SEEK_END);
+     if (len == -1) {
+         if (pmsg && JVM_GetLastErrorString(errbuf, sizeof(errbuf)) > 0)
+diff --git a/src/share/native/java/util/zip/zip_util.h b/src/share/native/java/util/zip/zip_util.h
+--- jdk/src/share/native/java/util/zip/zip_util.h
++++ jdk/src/share/native/java/util/zip/zip_util.h
+@@ -179,6 +179,7 @@
+ #else
+     cencache cencache;    /* CEN header cache */
+ #endif
++    jboolean locsig;      /* if zip file starts with LOCSIG */
+     ZFILE zfd;            /* open file descriptor */
+     void *lock;           /* read lock */
+     char *comment;        /* zip file comment */

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8008603-jmx_provider_provision.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8008603-jmx_provider_provision.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8008603-jmx_provider_provision.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,29 @@
+# HG changeset patch
+# User andrew
+# Date 1371485992 18000
+# Node ID cd93c29052e6930c24a0350b8fe607ac1f1be068
+# Parent  56bbd9db0a4965701dc64b41dac04507fa74f934
+8008603: Improve provision of JMX providers
+Reviewed-by: alanb, dfuchs, jfdenise, skoivu
+
+diff --git a/src/share/classes/javax/management/remote/JMXConnectorFactory.java b/src/share/classes/javax/management/remote/JMXConnectorFactory.java
+--- jdk/src/share/classes/javax/management/remote/JMXConnectorFactory.java
++++ jdk/src/share/classes/javax/management/remote/JMXConnectorFactory.java
+@@ -527,14 +527,9 @@
+             }
+         }
+ 
+-        if (loader == null)
+-            loader =
+-                AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+-                        public ClassLoader run() {
+-                            return
+-                                Thread.currentThread().getContextClassLoader();
+-                        }
+-                    });
++        if (loader == null) {
++            loader = Thread.currentThread().getContextClassLoader();
++        }
+ 
+         return loader;
+     }

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8008611-6_fixup.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8008611-6_fixup.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8008611-6_fixup.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,20 @@
+# HG changeset patch
+# User andrew
+# Date 1371827429 18000
+# Node ID 059ac6834c32c540ad86b99c0e5339554398def2
+# Parent  ae1f55ff0e864d754b3dd7f2ad86fd93062e9744
+Fix up 8008611
+
+diff --git a/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java b/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java
+--- jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java
++++ jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java
+@@ -44,6 +44,9 @@
+ 
+ import com.sun.jmx.mbeanserver.Util;
+ 
++import sun.reflect.misc.MethodUtil;
++import sun.reflect.misc.ReflectUtil;
++
+ /**
+  * This class contains the methods for performing all the tests needed to verify
+  * that a class represents a JMX compliant MBean.

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8008611-jmx_annotations.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8008611-jmx_annotations.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8008611-jmx_annotations.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,32 @@
+# HG changeset patch
+# User egahlin
+# Date 1363870588 -3600
+# Node ID 0ffc0656881cac6747ac1a62895e855750d1a04e
+# Parent  cd93c29052e6930c24a0350b8fe607ac1f1be068
+8008611: Better handling of annotations in JMX
+Reviewed-by: skoivu, dholmes, jfdenise
+
+diff --git a/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java b/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java
+--- jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java
++++ jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java
+@@ -359,13 +359,19 @@
+         for (Annotation a : annots) {
+             Class<? extends Annotation> c = a.annotationType();
+             Method[] elements = c.getMethods();
++            boolean packageAccess = false;
+             for (Method element : elements) {
+                 DescriptorKey key = element.getAnnotation(DescriptorKey.class);
+                 if (key != null) {
+                     String name = key.value();
+                     Object value;
+                     try {
+-                        value = element.invoke(a);
++                        // Avoid checking access more than once per annotation
++                        if (!packageAccess) {
++                            ReflectUtil.checkPackageAccess(c);
++                            packageAccess = true;
++                        }
++                        value = MethodUtil.invoke(element, a, null);
+                     } catch (RuntimeException e) {
+                         // we don't expect this - except for possibly
+                         // security exceptions?

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8008615-jmx_internal_api_robustness.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8008615-jmx_internal_api_robustness.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8008615-jmx_internal_api_robustness.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,70 @@
+# HG changeset patch
+# User andrew
+# Date 1371486356 18000
+# Node ID 9d9e6637b14441f87a7561fe23981abb4beaf5c4
+# Parent  0ffc0656881cac6747ac1a62895e855750d1a04e
+8008615: Improve robustness of JMX internal APIs
+Reviewed-by: dfuchs, skoivu, dholmes
+
+diff --git a/src/share/classes/com/sun/jmx/mbeanserver/ObjectInputStreamWithLoader.java b/src/share/classes/com/sun/jmx/mbeanserver/ObjectInputStreamWithLoader.java
+--- jdk/src/share/classes/com/sun/jmx/mbeanserver/ObjectInputStreamWithLoader.java
++++ jdk/src/share/classes/com/sun/jmx/mbeanserver/ObjectInputStreamWithLoader.java
+@@ -30,7 +30,7 @@
+ import java.io.InputStream;
+ import java.io.ObjectInputStream;
+ import java.io.ObjectStreamClass;
+-import java.io.StreamCorruptedException;
++import sun.reflect.misc.ReflectUtil;
+ 
+ /**
+  * This class deserializes an object in the context of a specific class loader.
+@@ -60,6 +60,7 @@
+             return super.resolveClass(aClass);
+         } else {
+             String name = aClass.getName();
++            ReflectUtil.checkPackageAccess(name);
+             // Query the class loader ...
+             return Class.forName(name, false, loader);
+         }
+diff --git a/src/share/classes/javax/management/MBeanServerFactory.java b/src/share/classes/javax/management/MBeanServerFactory.java
+--- jdk/src/share/classes/javax/management/MBeanServerFactory.java
++++ jdk/src/share/classes/javax/management/MBeanServerFactory.java
+@@ -34,6 +34,7 @@
+ import java.util.ArrayList;
+ import java.util.logging.Level;
+ import javax.management.loading.ClassLoaderRepository;
++import sun.reflect.misc.ReflectUtil;
+ 
+ /**
+  * <p>Provides MBean server references.  There are no instances of
+@@ -442,7 +443,7 @@
+         }
+ 
+         // No context class loader? Try with Class.forName()
+-        return Class.forName(builderClassName);
++        return ReflectUtil.forName(builderClassName);
+     }
+ 
+     /**
+diff --git a/src/share/classes/javax/management/remote/rmi/RMIConnector.java b/src/share/classes/javax/management/remote/rmi/RMIConnector.java
+--- jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java
++++ jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java
+@@ -104,6 +104,7 @@
+ import javax.rmi.PortableRemoteObject;
+ import javax.rmi.ssl.SslRMIClientSocketFactory;
+ import javax.security.auth.Subject;
++import sun.reflect.misc.ReflectUtil;
+ import org.omg.CORBA.BAD_OPERATION;
+ import org.omg.CORBA.ORB;
+ import sun.rmi.server.UnicastRef2;
+@@ -1970,7 +1971,9 @@
+ 
+         protected Class resolveClass(ObjectStreamClass classDesc)
+                 throws IOException, ClassNotFoundException {
+-            return Class.forName(classDesc.getName(), false, loader);
++            String name = classDesc.getName();
++            ReflectUtil.checkPackageAccess(name);
++            return Class.forName(name, false, loader);
+         }
+ 
+         private final ClassLoader loader;

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8008623-mbeanserver_handling.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8008623-mbeanserver_handling.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8008623-mbeanserver_handling.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,121 @@
+# HG changeset patch
+# User andrew
+# Date 1371486568 18000
+# Node ID 299b73e94d28adb15d73b943104ac2562ed8b189
+# Parent  9d9e6637b14441f87a7561fe23981abb4beaf5c4
+8008623: Better handling of MBeanServers
+
+diff --git a/src/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java b/src/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java
+--- jdk/src/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java
++++ jdk/src/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java
+@@ -449,8 +449,7 @@
+         Object resource = getResource(instance);
+         if (resource instanceof ClassLoader
+             && resource != server.getClass().getClassLoader()) {
+-            final ModifiableClassLoaderRepository clr =
+-                instantiator.getClassLoaderRepository();
++	    final ModifiableClassLoaderRepository clr = getInstantiatorCLR();
+             if (clr != null) clr.removeClassLoader(name);
+         }
+ 
+@@ -1008,7 +1007,7 @@
+         final Object resource = getResource(mbean);
+         if (resource instanceof ClassLoader) {
+             final ModifiableClassLoaderRepository clr =
+-                instantiator.getClassLoaderRepository();
++                getInstantiatorCLR();
+             if (clr == null) {
+                 final RuntimeException wrapped =
+                     new IllegalArgumentException(
+@@ -1869,4 +1868,12 @@
+         }
+     }
+ 
++    private ModifiableClassLoaderRepository getInstantiatorCLR() {
++        return AccessController.doPrivileged(new PrivilegedAction<ModifiableClassLoaderRepository>() {
++            @Override
++            public ModifiableClassLoaderRepository run() {
++                return instantiator != null ? instantiator.getClassLoaderRepository() : null;
++            }
++        });
++    }
+ }
+diff --git a/src/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java b/src/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java
+--- jdk/src/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java
++++ jdk/src/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java
+@@ -31,6 +31,7 @@
+ import java.io.ObjectInputStream;
+ import java.security.AccessController;
+ import java.security.Permission;
++import java.security.PrivilegedAction;
+ import java.security.PrivilegedExceptionAction;
+ 
+ // RI import
+@@ -231,8 +232,16 @@
+                 clr = new ClassLoaderRepositorySupport();
+             instantiator = new MBeanInstantiator(clr);
+         }
++
++        final MBeanInstantiator fInstantiator = instantiator;
+         this.secureClr = new
+-          SecureClassLoaderRepository(instantiator.getClassLoaderRepository());
++            SecureClassLoaderRepository(AccessController.doPrivileged(new PrivilegedAction<ClassLoaderRepository>() {
++                @Override
++                public ClassLoaderRepository run() {
++                    return fInstantiator.getClassLoaderRepository();
++                }
++            })
++        );
+         if (delegate == null)
+             delegate = new MBeanServerDelegateImpl();
+         if (outer == null)
+@@ -1246,8 +1255,14 @@
+            class loader.  The ClassLoaderRepository knows how
+            to handle that case.  */
+         ClassLoader myLoader = outerShell.getClass().getClassLoader();
+-        final ModifiableClassLoaderRepository loaders =
+-            instantiator.getClassLoaderRepository();
++        final ModifiableClassLoaderRepository loaders = AccessController.doPrivileged(new PrivilegedAction<ModifiableClassLoaderRepository>() {
++
++            @Override
++            public ModifiableClassLoaderRepository run() {
++                return instantiator.getClassLoaderRepository();
++            }
++        });
++
+         if (loaders != null) {
+             loaders.addClassLoader(myLoader);
+ 
+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
+@@ -625,6 +625,7 @@
+      * Return the Default Loader Repository used by this instantiator object.
+      **/
+     public ModifiableClassLoaderRepository getClassLoaderRepository() {
++        checkMBeanPermission((String)null, null, null, "getClassLoaderRepository");
+         return clr;
+     }
+ 
+@@ -736,9 +737,19 @@
+                                              String member,
+                                              ObjectName objectName,
+                                              String actions) {
++        if (clazz != null) {
++            checkMBeanPermission(clazz.getName(), member, objectName, actions);
++        }
++    }
++
++    private static void checkMBeanPermission(String classname,
++                                             String member,
++                                             ObjectName objectName,
++                                             String actions)
++        throws SecurityException {
+         SecurityManager sm = System.getSecurityManager();
+-        if (clazz != null && sm != null) {
+-            Permission perm = new MBeanPermission(clazz.getName(),
++        if (sm != null) {
++            Permission perm = new MBeanPermission(classname,
+                                                   member,
+                                                   objectName,
+                                                   actions);

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8008744-6741606_rework.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8008744-6741606_rework.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8008744-6741606_rework.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,882 @@
+# HG changeset patch
+# User mullan
+# Date 1367443144 14400
+# Node ID ebb30aed90ea44ffadd97b3c462b14e328b5dfd2
+# Parent  299b73e94d28adb15d73b943104ac2562ed8b189
+8008744: Rework part of fix for JDK-6741606
+Reviewed-by: xuelei, ahgross
+
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/ClassLoaderUtils.java b/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/ClassLoaderUtils.java
+new file mode 100644
+--- /dev/null
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/ClassLoaderUtils.java
+@@ -0,0 +1,280 @@
++/*
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
++ */
++/**
++ * Licensed to the Apache Software Foundation (ASF) under one
++ * or more contributor license agreements. See the NOTICE file
++ * distributed with this work for additional information
++ * regarding copyright ownership. The ASF licenses this file
++ * to you under the Apache License, Version 2.0 (the
++ * "License"); you may not use this file except in compliance
++ * with the License. You may obtain a copy of the License at
++ *
++ * http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing,
++ * software distributed under the License is distributed on an
++ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
++ * KIND, either express or implied. See the License for the
++ * specific language governing permissions and limitations
++ * under the License.
++ */
++
++package com.sun.org.apache.xml.internal.security.algorithms;
++
++import java.io.IOException;
++import java.io.InputStream;
++import java.net.URL;
++import java.util.ArrayList;
++import java.util.Enumeration;
++import java.util.List;
++
++/**
++ * This class is extremely useful for loading resources and classes in a fault
++ * tolerant manner that works across different applications servers. Do not
++ * touch this unless you're a grizzled classloading guru veteran who is going to
++ * verify any change on 6 different application servers.
++ */
++// NOTE! This is a duplicate of utils.ClassLoaderUtils with public
++// modifiers changed to package-private. Make sure to integrate any future
++// changes to utils.ClassLoaderUtils to this file.
++final class ClassLoaderUtils {
++
++    /** {@link org.apache.commons.logging} logging facility */
++    private static final java.util.logging.Logger log =
++        java.util.logging.Logger.getLogger(ClassLoaderUtils.class.getName());
++
++    private ClassLoaderUtils() {
++    }
++
++    /**
++     * Load a given resource. <p/> This method will try to load the resource
++     * using the following methods (in order):
++     * <ul>
++     * <li>From Thread.currentThread().getContextClassLoader()
++     * <li>From ClassLoaderUtil.class.getClassLoader()
++     * <li>callingClass.getClassLoader()
++     * </ul>
++     *
++     * @param resourceName The name of the resource to load
++     * @param callingClass The Class object of the calling object
++     */
++    static URL getResource(String resourceName, Class<?> callingClass) {
++        URL url = Thread.currentThread().getContextClassLoader().getResource(resourceName);
++        if (url == null && resourceName.startsWith("/")) {
++            //certain classloaders need it without the leading /
++            url =
++                Thread.currentThread().getContextClassLoader().getResource(
++                    resourceName.substring(1)
++                );
++        }
++
++        ClassLoader cluClassloader = ClassLoaderUtils.class.getClassLoader();
++        if (cluClassloader == null) {
++            cluClassloader = ClassLoader.getSystemClassLoader();
++        }
++        if (url == null) {
++            url = cluClassloader.getResource(resourceName);
++        }
++        if (url == null && resourceName.startsWith("/")) {
++            //certain classloaders need it without the leading /
++            url = cluClassloader.getResource(resourceName.substring(1));
++        }
++
++        if (url == null) {
++            ClassLoader cl = callingClass.getClassLoader();
++
++            if (cl != null) {
++                url = cl.getResource(resourceName);
++            }
++        }
++
++        if (url == null) {
++            url = callingClass.getResource(resourceName);
++        }
++
++        if ((url == null) && (resourceName != null) && (resourceName.charAt(0) != '/')) {
++            return getResource('/' + resourceName, callingClass);
++        }
++
++        return url;
++    }
++
++    /**
++     * Load a given resources. <p/> This method will try to load the resources
++     * using the following methods (in order):
++     * <ul>
++     * <li>From Thread.currentThread().getContextClassLoader()
++     * <li>From ClassLoaderUtil.class.getClassLoader()
++     * <li>callingClass.getClassLoader()
++     * </ul>
++     *
++     * @param resourceName The name of the resource to load
++     * @param callingClass The Class object of the calling object
++     */
++    static List<URL> getResources(String resourceName, Class<?> callingClass) {
++        List<URL> ret = new ArrayList<URL>();
++        Enumeration<URL> urls = new Enumeration<URL>() {
++            public boolean hasMoreElements() {
++                return false;
++            }
++            public URL nextElement() {
++                return null;
++            }
++
++        };
++        try {
++            urls = Thread.currentThread().getContextClassLoader().getResources(resourceName);
++        } catch (IOException e) {
++            if (log.isLoggable(java.util.logging.Level.FINE)) {
++                log.log(java.util.logging.Level.FINE, e.getMessage(), e);
++            }
++            //ignore
++        }
++        if (!urls.hasMoreElements() && resourceName.startsWith("/")) {
++            //certain classloaders need it without the leading /
++            try {
++                urls =
++                    Thread.currentThread().getContextClassLoader().getResources(
++                        resourceName.substring(1)
++                    );
++            } catch (IOException e) {
++                if (log.isLoggable(java.util.logging.Level.FINE)) {
++                    log.log(java.util.logging.Level.FINE, e.getMessage(), e);
++                }
++                // ignore
++            }
++        }
++
++        ClassLoader cluClassloader = ClassLoaderUtils.class.getClassLoader();
++        if (cluClassloader == null) {
++            cluClassloader = ClassLoader.getSystemClassLoader();
++        }
++        if (!urls.hasMoreElements()) {
++            try {
++                urls = cluClassloader.getResources(resourceName);
++            } catch (IOException e) {
++                if (log.isLoggable(java.util.logging.Level.FINE)) {
++                    log.log(java.util.logging.Level.FINE, e.getMessage(), e);
++                }
++                // ignore
++            }
++        }
++        if (!urls.hasMoreElements() && resourceName.startsWith("/")) {
++            //certain classloaders need it without the leading /
++            try {
++                urls = cluClassloader.getResources(resourceName.substring(1));
++            } catch (IOException e) {
++                if (log.isLoggable(java.util.logging.Level.FINE)) {
++                    log.log(java.util.logging.Level.FINE, e.getMessage(), e);
++                }
++                // ignore
++            }
++        }
++
++        if (!urls.hasMoreElements()) {
++            ClassLoader cl = callingClass.getClassLoader();
++
++            if (cl != null) {
++                try {
++                    urls = cl.getResources(resourceName);
++                } catch (IOException e) {
++                    if (log.isLoggable(java.util.logging.Level.FINE)) {
++                        log.log(java.util.logging.Level.FINE, e.getMessage(), e);
++                    }
++                    // ignore
++                }
++            }
++        }
++
++        if (!urls.hasMoreElements()) {
++            URL url = callingClass.getResource(resourceName);
++            if (url != null) {
++                ret.add(url);
++            }
++        }
++        while (urls.hasMoreElements()) {
++            ret.add(urls.nextElement());
++        }
++
++
++        if (ret.isEmpty() && (resourceName != null) && (resourceName.charAt(0) != '/')) {
++            return getResources('/' + resourceName, callingClass);
++        }
++        return ret;
++    }
++
++
++    /**
++     * This is a convenience method to load a resource as a stream. <p/> The
++     * algorithm used to find the resource is given in getResource()
++     *
++     * @param resourceName The name of the resource to load
++     * @param callingClass The Class object of the calling object
++     */
++    static InputStream getResourceAsStream(String resourceName, Class<?> callingClass) {
++        URL url = getResource(resourceName, callingClass);
++
++        try {
++            return (url != null) ? url.openStream() : null;
++        } catch (IOException e) {
++            if (log.isLoggable(java.util.logging.Level.FINE)) {
++                log.log(java.util.logging.Level.FINE, e.getMessage(), e);
++            }
++            return null;
++        }
++    }
++
++    /**
++     * Load a class with a given name. <p/> It will try to load the class in the
++     * following order:
++     * <ul>
++     * <li>From Thread.currentThread().getContextClassLoader()
++     * <li>Using the basic Class.forName()
++     * <li>From ClassLoaderUtil.class.getClassLoader()
++     * <li>From the callingClass.getClassLoader()
++     * </ul>
++     *
++     * @param className The name of the class to load
++     * @param callingClass The Class object of the calling object
++     * @throws ClassNotFoundException If the class cannot be found anywhere.
++     */
++    static Class<?> loadClass(String className, Class<?> callingClass)
++        throws ClassNotFoundException {
++        try {
++            ClassLoader cl = Thread.currentThread().getContextClassLoader();
++
++            if (cl != null) {
++                return cl.loadClass(className);
++            }
++        } catch (ClassNotFoundException e) {
++            if (log.isLoggable(java.util.logging.Level.FINE)) {
++                log.log(java.util.logging.Level.FINE, e.getMessage(), e);
++            }
++            //ignore
++        }
++        return loadClass2(className, callingClass);
++    }
++
++    private static Class<?> loadClass2(String className, Class<?> callingClass)
++        throws ClassNotFoundException {
++        try {
++            return Class.forName(className);
++        } catch (ClassNotFoundException ex) {
++            try {
++                if (ClassLoaderUtils.class.getClassLoader() != null) {
++                    return ClassLoaderUtils.class.getClassLoader().loadClass(className);
++                }
++            } catch (ClassNotFoundException exc) {
++                if (callingClass != null && callingClass.getClassLoader() != null) {
++                    return callingClass.getClassLoader().loadClass(className);
++                }
++            }
++            if (log.isLoggable(java.util.logging.Level.FINE)) {
++                log.log(java.util.logging.Level.FINE, ex.getMessage(), ex);
++            }
++            throw ex;
++        }
++    }
++}
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm.java b/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm.java
+@@ -36,7 +36,6 @@
+ import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
+ import com.sun.org.apache.xml.internal.security.signature.XMLSignature;
+ import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException;
+-import com.sun.org.apache.xml.internal.security.utils.ClassLoaderUtils;
+ import com.sun.org.apache.xml.internal.security.utils.Constants;
+ import org.w3c.dom.Attr;
+ import org.w3c.dom.Document;
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/ClassLoaderUtils.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/ClassLoaderUtils.java
+new file mode 100644
+--- /dev/null
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/ClassLoaderUtils.java
+@@ -0,0 +1,280 @@
++/*
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
++ */
++/**
++ * Licensed to the Apache Software Foundation (ASF) under one
++ * or more contributor license agreements. See the NOTICE file
++ * distributed with this work for additional information
++ * regarding copyright ownership. The ASF licenses this file
++ * to you under the Apache License, Version 2.0 (the
++ * "License"); you may not use this file except in compliance
++ * with the License. You may obtain a copy of the License at
++ *
++ * http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing,
++ * software distributed under the License is distributed on an
++ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
++ * KIND, either express or implied. See the License for the
++ * specific language governing permissions and limitations
++ * under the License.
++ */
++
++package com.sun.org.apache.xml.internal.security.transforms;
++
++import java.io.IOException;
++import java.io.InputStream;
++import java.net.URL;
++import java.util.ArrayList;
++import java.util.Enumeration;
++import java.util.List;
++
++/**
++ * This class is extremely useful for loading resources and classes in a fault
++ * tolerant manner that works across different applications servers. Do not
++ * touch this unless you're a grizzled classloading guru veteran who is going to
++ * verify any change on 6 different application servers.
++ */
++// NOTE! This is a duplicate of utils.ClassLoaderUtils with public
++// modifiers changed to package-private. Make sure to integrate any future
++// changes to utils.ClassLoaderUtils to this file.
++final class ClassLoaderUtils {
++
++    /** {@link org.apache.commons.logging} logging facility */
++    private static final java.util.logging.Logger log =
++        java.util.logging.Logger.getLogger(ClassLoaderUtils.class.getName());
++
++    private ClassLoaderUtils() {
++    }
++
++    /**
++     * Load a given resource. <p/> This method will try to load the resource
++     * using the following methods (in order):
++     * <ul>
++     * <li>From Thread.currentThread().getContextClassLoader()
++     * <li>From ClassLoaderUtil.class.getClassLoader()
++     * <li>callingClass.getClassLoader()
++     * </ul>
++     *
++     * @param resourceName The name of the resource to load
++     * @param callingClass The Class object of the calling object
++     */
++    static URL getResource(String resourceName, Class<?> callingClass) {
++        URL url = Thread.currentThread().getContextClassLoader().getResource(resourceName);
++        if (url == null && resourceName.startsWith("/")) {
++            //certain classloaders need it without the leading /
++            url =
++                Thread.currentThread().getContextClassLoader().getResource(
++                    resourceName.substring(1)
++                );
++        }
++
++        ClassLoader cluClassloader = ClassLoaderUtils.class.getClassLoader();
++        if (cluClassloader == null) {
++            cluClassloader = ClassLoader.getSystemClassLoader();
++        }
++        if (url == null) {
++            url = cluClassloader.getResource(resourceName);
++        }
++        if (url == null && resourceName.startsWith("/")) {
++            //certain classloaders need it without the leading /
++            url = cluClassloader.getResource(resourceName.substring(1));
++        }
++
++        if (url == null) {
++            ClassLoader cl = callingClass.getClassLoader();
++
++            if (cl != null) {
++                url = cl.getResource(resourceName);
++            }
++        }
++
++        if (url == null) {
++            url = callingClass.getResource(resourceName);
++        }
++
++        if ((url == null) && (resourceName != null) && (resourceName.charAt(0) != '/')) {
++            return getResource('/' + resourceName, callingClass);
++        }
++
++        return url;
++    }
++
++    /**
++     * Load a given resources. <p/> This method will try to load the resources
++     * using the following methods (in order):
++     * <ul>
++     * <li>From Thread.currentThread().getContextClassLoader()
++     * <li>From ClassLoaderUtil.class.getClassLoader()
++     * <li>callingClass.getClassLoader()
++     * </ul>
++     *
++     * @param resourceName The name of the resource to load
++     * @param callingClass The Class object of the calling object
++     */
++    static List<URL> getResources(String resourceName, Class<?> callingClass) {
++        List<URL> ret = new ArrayList<URL>();
++        Enumeration<URL> urls = new Enumeration<URL>() {
++            public boolean hasMoreElements() {
++                return false;
++            }
++            public URL nextElement() {
++                return null;
++            }
++
++        };
++        try {
++            urls = Thread.currentThread().getContextClassLoader().getResources(resourceName);
++        } catch (IOException e) {
++            if (log.isLoggable(java.util.logging.Level.FINE)) {
++                log.log(java.util.logging.Level.FINE, e.getMessage(), e);
++            }
++            //ignore
++        }
++        if (!urls.hasMoreElements() && resourceName.startsWith("/")) {
++            //certain classloaders need it without the leading /
++            try {
++                urls =
++                    Thread.currentThread().getContextClassLoader().getResources(
++                        resourceName.substring(1)
++                    );
++            } catch (IOException e) {
++                if (log.isLoggable(java.util.logging.Level.FINE)) {
++                    log.log(java.util.logging.Level.FINE, e.getMessage(), e);
++                }
++                // ignore
++            }
++        }
++
++        ClassLoader cluClassloader = ClassLoaderUtils.class.getClassLoader();
++        if (cluClassloader == null) {
++            cluClassloader = ClassLoader.getSystemClassLoader();
++        }
++        if (!urls.hasMoreElements()) {
++            try {
++                urls = cluClassloader.getResources(resourceName);
++            } catch (IOException e) {
++                if (log.isLoggable(java.util.logging.Level.FINE)) {
++                    log.log(java.util.logging.Level.FINE, e.getMessage(), e);
++                }
++                // ignore
++            }
++        }
++        if (!urls.hasMoreElements() && resourceName.startsWith("/")) {
++            //certain classloaders need it without the leading /
++            try {
++                urls = cluClassloader.getResources(resourceName.substring(1));
++            } catch (IOException e) {
++                if (log.isLoggable(java.util.logging.Level.FINE)) {
++                    log.log(java.util.logging.Level.FINE, e.getMessage(), e);
++                }
++                // ignore
++            }
++        }
++
++        if (!urls.hasMoreElements()) {
++            ClassLoader cl = callingClass.getClassLoader();
++
++            if (cl != null) {
++                try {
++                    urls = cl.getResources(resourceName);
++                } catch (IOException e) {
++                    if (log.isLoggable(java.util.logging.Level.FINE)) {
++                        log.log(java.util.logging.Level.FINE, e.getMessage(), e);
++                    }
++                    // ignore
++                }
++            }
++        }
++
++        if (!urls.hasMoreElements()) {
++            URL url = callingClass.getResource(resourceName);
++            if (url != null) {
++                ret.add(url);
++            }
++        }
++        while (urls.hasMoreElements()) {
++            ret.add(urls.nextElement());
++        }
++
++
++        if (ret.isEmpty() && (resourceName != null) && (resourceName.charAt(0) != '/')) {
++            return getResources('/' + resourceName, callingClass);
++        }
++        return ret;
++    }
++
++
++    /**
++     * This is a convenience method to load a resource as a stream. <p/> The
++     * algorithm used to find the resource is given in getResource()
++     *
++     * @param resourceName The name of the resource to load
++     * @param callingClass The Class object of the calling object
++     */
++    static InputStream getResourceAsStream(String resourceName, Class<?> callingClass) {
++        URL url = getResource(resourceName, callingClass);
++
++        try {
++            return (url != null) ? url.openStream() : null;
++        } catch (IOException e) {
++            if (log.isLoggable(java.util.logging.Level.FINE)) {
++                log.log(java.util.logging.Level.FINE, e.getMessage(), e);
++            }
++            return null;
++        }
++    }
++
++    /**
++     * Load a class with a given name. <p/> It will try to load the class in the
++     * following order:
++     * <ul>
++     * <li>From Thread.currentThread().getContextClassLoader()
++     * <li>Using the basic Class.forName()
++     * <li>From ClassLoaderUtil.class.getClassLoader()
++     * <li>From the callingClass.getClassLoader()
++     * </ul>
++     *
++     * @param className The name of the class to load
++     * @param callingClass The Class object of the calling object
++     * @throws ClassNotFoundException If the class cannot be found anywhere.
++     */
++    static Class<?> loadClass(String className, Class<?> callingClass)
++        throws ClassNotFoundException {
++        try {
++            ClassLoader cl = Thread.currentThread().getContextClassLoader();
++
++            if (cl != null) {
++                return cl.loadClass(className);
++            }
++        } catch (ClassNotFoundException e) {
++            if (log.isLoggable(java.util.logging.Level.FINE)) {
++                log.log(java.util.logging.Level.FINE, e.getMessage(), e);
++            }
++            //ignore
++        }
++        return loadClass2(className, callingClass);
++    }
++
++    private static Class<?> loadClass2(String className, Class<?> callingClass)
++        throws ClassNotFoundException {
++        try {
++            return Class.forName(className);
++        } catch (ClassNotFoundException ex) {
++            try {
++                if (ClassLoaderUtils.class.getClassLoader() != null) {
++                    return ClassLoaderUtils.class.getClassLoader().loadClass(className);
++                }
++            } catch (ClassNotFoundException exc) {
++                if (callingClass != null && callingClass.getClassLoader() != null) {
++                    return callingClass.getClassLoader().loadClass(className);
++                }
++            }
++            if (log.isLoggable(java.util.logging.Level.FINE)) {
++                log.log(java.util.logging.Level.FINE, ex.getMessage(), ex);
++            }
++            throw ex;
++        }
++    }
++}
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/Transform.java b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/Transform.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/Transform.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/Transform.java
+@@ -44,7 +44,6 @@
+ import com.sun.org.apache.xml.internal.security.transforms.implementations.TransformXPath;
+ import com.sun.org.apache.xml.internal.security.transforms.implementations.TransformXPath2Filter;
+ import com.sun.org.apache.xml.internal.security.transforms.implementations.TransformXSLT;
+-import com.sun.org.apache.xml.internal.security.utils.ClassLoaderUtils;
+ import com.sun.org.apache.xml.internal.security.utils.Constants;
+ import com.sun.org.apache.xml.internal.security.utils.HelperNodeList;
+ import com.sun.org.apache.xml.internal.security.utils.SignatureElementProxy;
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/ClassLoaderUtils.java b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/ClassLoaderUtils.java
+deleted file mode 100644
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/ClassLoaderUtils.java
++++ /dev/null
+@@ -1,277 +0,0 @@
+-/*
+- * reserved comment block
+- * DO NOT REMOVE OR ALTER!
+- */
+-/**
+- * Licensed to the Apache Software Foundation (ASF) under one
+- * or more contributor license agreements. See the NOTICE file
+- * distributed with this work for additional information
+- * regarding copyright ownership. The ASF licenses this file
+- * to you under the Apache License, Version 2.0 (the
+- * "License"); you may not use this file except in compliance
+- * with the License. You may obtain a copy of the License at
+- *
+- * http://www.apache.org/licenses/LICENSE-2.0
+- *
+- * Unless required by applicable law or agreed to in writing,
+- * software distributed under the License is distributed on an
+- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+- * KIND, either express or implied. See the License for the
+- * specific language governing permissions and limitations
+- * under the License.
+- */
+-
+-package com.sun.org.apache.xml.internal.security.utils;
+-
+-import java.io.IOException;
+-import java.io.InputStream;
+-import java.net.URL;
+-import java.util.ArrayList;
+-import java.util.Enumeration;
+-import java.util.List;
+-
+-/**
+- * This class is extremely useful for loading resources and classes in a fault
+- * tolerant manner that works across different applications servers. Do not
+- * touch this unless you're a grizzled classloading guru veteran who is going to
+- * verify any change on 6 different application servers.
+- */
+-public final class ClassLoaderUtils {
+-
+-    /** {@link org.apache.commons.logging} logging facility */
+-    private static final java.util.logging.Logger log =
+-        java.util.logging.Logger.getLogger(ClassLoaderUtils.class.getName());
+-
+-    private ClassLoaderUtils() {
+-    }
+-
+-    /**
+-     * Load a given resource. <p/> This method will try to load the resource
+-     * using the following methods (in order):
+-     * <ul>
+-     * <li>From Thread.currentThread().getContextClassLoader()
+-     * <li>From ClassLoaderUtil.class.getClassLoader()
+-     * <li>callingClass.getClassLoader()
+-     * </ul>
+-     *
+-     * @param resourceName The name of the resource to load
+-     * @param callingClass The Class object of the calling object
+-     */
+-    public static URL getResource(String resourceName, Class<?> callingClass) {
+-        URL url = Thread.currentThread().getContextClassLoader().getResource(resourceName);
+-        if (url == null && resourceName.startsWith("/")) {
+-            //certain classloaders need it without the leading /
+-            url =
+-                Thread.currentThread().getContextClassLoader().getResource(
+-                    resourceName.substring(1)
+-                );
+-        }
+-
+-        ClassLoader cluClassloader = ClassLoaderUtils.class.getClassLoader();
+-        if (cluClassloader == null) {
+-            cluClassloader = ClassLoader.getSystemClassLoader();
+-        }
+-        if (url == null) {
+-            url = cluClassloader.getResource(resourceName);
+-        }
+-        if (url == null && resourceName.startsWith("/")) {
+-            //certain classloaders need it without the leading /
+-            url = cluClassloader.getResource(resourceName.substring(1));
+-        }
+-
+-        if (url == null) {
+-            ClassLoader cl = callingClass.getClassLoader();
+-
+-            if (cl != null) {
+-                url = cl.getResource(resourceName);
+-            }
+-        }
+-
+-        if (url == null) {
+-            url = callingClass.getResource(resourceName);
+-        }
+-
+-        if ((url == null) && (resourceName != null) && (resourceName.charAt(0) != '/')) {
+-            return getResource('/' + resourceName, callingClass);
+-        }
+-
+-        return url;
+-    }
+-
+-    /**
+-     * Load a given resources. <p/> This method will try to load the resources
+-     * using the following methods (in order):
+-     * <ul>
+-     * <li>From Thread.currentThread().getContextClassLoader()
+-     * <li>From ClassLoaderUtil.class.getClassLoader()
+-     * <li>callingClass.getClassLoader()
+-     * </ul>
+-     *
+-     * @param resourceName The name of the resource to load
+-     * @param callingClass The Class object of the calling object
+-     */
+-    public static List<URL> getResources(String resourceName, Class<?> callingClass) {
+-        List<URL> ret = new ArrayList<URL>();
+-        Enumeration<URL> urls = new Enumeration<URL>() {
+-            public boolean hasMoreElements() {
+-                return false;
+-            }
+-            public URL nextElement() {
+-                return null;
+-            }
+-
+-        };
+-        try {
+-            urls = Thread.currentThread().getContextClassLoader().getResources(resourceName);
+-        } catch (IOException e) {
+-            if (log.isLoggable(java.util.logging.Level.FINE)) {
+-                log.log(java.util.logging.Level.FINE, e.getMessage(), e);
+-            }
+-            //ignore
+-        }
+-        if (!urls.hasMoreElements() && resourceName.startsWith("/")) {
+-            //certain classloaders need it without the leading /
+-            try {
+-                urls =
+-                    Thread.currentThread().getContextClassLoader().getResources(
+-                        resourceName.substring(1)
+-                    );
+-            } catch (IOException e) {
+-                if (log.isLoggable(java.util.logging.Level.FINE)) {
+-                    log.log(java.util.logging.Level.FINE, e.getMessage(), e);
+-                }
+-                // ignore
+-            }
+-        }
+-
+-        ClassLoader cluClassloader = ClassLoaderUtils.class.getClassLoader();
+-        if (cluClassloader == null) {
+-            cluClassloader = ClassLoader.getSystemClassLoader();
+-        }
+-        if (!urls.hasMoreElements()) {
+-            try {
+-                urls = cluClassloader.getResources(resourceName);
+-            } catch (IOException e) {
+-                if (log.isLoggable(java.util.logging.Level.FINE)) {
+-                    log.log(java.util.logging.Level.FINE, e.getMessage(), e);
+-                }
+-                // ignore
+-            }
+-        }
+-        if (!urls.hasMoreElements() && resourceName.startsWith("/")) {
+-            //certain classloaders need it without the leading /
+-            try {
+-                urls = cluClassloader.getResources(resourceName.substring(1));
+-            } catch (IOException e) {
+-                if (log.isLoggable(java.util.logging.Level.FINE)) {
+-                    log.log(java.util.logging.Level.FINE, e.getMessage(), e);
+-                }
+-                // ignore
+-            }
+-        }
+-
+-        if (!urls.hasMoreElements()) {
+-            ClassLoader cl = callingClass.getClassLoader();
+-
+-            if (cl != null) {
+-                try {
+-                    urls = cl.getResources(resourceName);
+-                } catch (IOException e) {
+-                    if (log.isLoggable(java.util.logging.Level.FINE)) {
+-                        log.log(java.util.logging.Level.FINE, e.getMessage(), e);
+-                    }
+-                    // ignore
+-                }
+-            }
+-        }
+-
+-        if (!urls.hasMoreElements()) {
+-            URL url = callingClass.getResource(resourceName);
+-            if (url != null) {
+-                ret.add(url);
+-            }
+-        }
+-        while (urls.hasMoreElements()) {
+-            ret.add(urls.nextElement());
+-        }
+-
+-
+-        if (ret.isEmpty() && (resourceName != null) && (resourceName.charAt(0) != '/')) {
+-            return getResources('/' + resourceName, callingClass);
+-        }
+-        return ret;
+-    }
+-
+-
+-    /**
+-     * This is a convenience method to load a resource as a stream. <p/> The
+-     * algorithm used to find the resource is given in getResource()
+-     *
+-     * @param resourceName The name of the resource to load
+-     * @param callingClass The Class object of the calling object
+-     */
+-    public static InputStream getResourceAsStream(String resourceName, Class<?> callingClass) {
+-        URL url = getResource(resourceName, callingClass);
+-
+-        try {
+-            return (url != null) ? url.openStream() : null;
+-        } catch (IOException e) {
+-            if (log.isLoggable(java.util.logging.Level.FINE)) {
+-                log.log(java.util.logging.Level.FINE, e.getMessage(), e);
+-            }
+-            return null;
+-        }
+-    }
+-
+-    /**
+-     * Load a class with a given name. <p/> It will try to load the class in the
+-     * following order:
+-     * <ul>
+-     * <li>From Thread.currentThread().getContextClassLoader()
+-     * <li>Using the basic Class.forName()
+-     * <li>From ClassLoaderUtil.class.getClassLoader()
+-     * <li>From the callingClass.getClassLoader()
+-     * </ul>
+-     *
+-     * @param className The name of the class to load
+-     * @param callingClass The Class object of the calling object
+-     * @throws ClassNotFoundException If the class cannot be found anywhere.
+-     */
+-    public static Class<?> loadClass(String className, Class<?> callingClass)
+-        throws ClassNotFoundException {
+-        try {
+-            ClassLoader cl = Thread.currentThread().getContextClassLoader();
+-
+-            if (cl != null) {
+-                return cl.loadClass(className);
+-            }
+-        } catch (ClassNotFoundException e) {
+-            if (log.isLoggable(java.util.logging.Level.FINE)) {
+-                log.log(java.util.logging.Level.FINE, e.getMessage(), e);
+-            }
+-            //ignore
+-        }
+-        return loadClass2(className, callingClass);
+-    }
+-
+-    private static Class<?> loadClass2(String className, Class<?> callingClass)
+-        throws ClassNotFoundException {
+-        try {
+-            return Class.forName(className);
+-        } catch (ClassNotFoundException ex) {
+-            try {
+-                if (ClassLoaderUtils.class.getClassLoader() != null) {
+-                    return ClassLoaderUtils.class.getClassLoader().loadClass(className);
+-                }
+-            } catch (ClassNotFoundException exc) {
+-                if (callingClass != null && callingClass.getClassLoader() != null) {
+-                    return callingClass.getClassLoader().loadClass(className);
+-                }
+-            }
+-            if (log.isLoggable(java.util.logging.Level.FINE)) {
+-                log.log(java.util.logging.Level.FINE, ex.getMessage(), ex);
+-            }
+-            throw ex;
+-        }
+-    }
+-}

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8008982-jmx_interface_changes.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8008982-jmx_interface_changes.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8008982-jmx_interface_changes.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,168 @@
+# HG changeset patch
+# User andrew
+# Date 1371487600 18000
+# Node ID a844309d9f0a490f8ac56d21f1323e8deb65ffd1
+# Parent  ebb30aed90ea44ffadd97b3c462b14e328b5dfd2
+8008982: Adjust JMX for underlying interface changes
+Reviewed-by: mchung, dholmes, dfuchs, skoivu
+
+diff --git a/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java b/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java
+--- jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java
++++ jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java
+@@ -215,6 +215,11 @@
+         MXBeanIntrospector.getInstance().getAnalyzer(interfaceClass);
+     }
+ 
++    public static void testComplianceMBeanInterface(Class<?> interfaceClass)
++            throws NotCompliantMBeanException{
++        StandardMBeanIntrospector.getInstance().getAnalyzer(interfaceClass);
++    }
++
+     /**
+      * Basic method for testing if a given class is a JMX compliant
+      * Standard MBean.  This method is only called by the legacy code
+diff --git a/src/share/classes/javax/management/JMX.java b/src/share/classes/javax/management/JMX.java
+--- jdk/src/share/classes/javax/management/JMX.java
++++ jdk/src/share/classes/javax/management/JMX.java
+@@ -27,7 +27,9 @@
+ 
+ import com.sun.jmx.mbeanserver.Introspector;
+ import java.lang.reflect.InvocationHandler;
++import java.lang.reflect.Modifier;
+ import java.lang.reflect.Proxy;
++import sun.reflect.misc.ReflectUtil;
+ 
+ /**
+  * Static methods from the JMX API.  There are no instances of this class.
+@@ -203,11 +205,7 @@
+                                       ObjectName objectName,
+                                       Class<T> interfaceClass,
+                                       boolean notificationBroadcaster) {
+-        return MBeanServerInvocationHandler.newProxyInstance(
+-                connection,
+-                objectName,
+-                interfaceClass,
+-                notificationBroadcaster);
++        return createProxy(connection, objectName, interfaceClass, notificationBroadcaster, false);
+     }
+ 
+     /**
+@@ -345,26 +343,7 @@
+                                        ObjectName objectName,
+                                        Class<T> interfaceClass,
+                                        boolean notificationBroadcaster) {
+-        // Check interface for MXBean compliance
+-        //
+-        try {
+-            Introspector.testComplianceMXBeanInterface(interfaceClass);
+-        } catch (NotCompliantMBeanException e) {
+-            throw new IllegalArgumentException(e);
+-        }
+-        InvocationHandler handler = new MBeanServerInvocationHandler(
+-                connection, objectName, true);
+-        final Class[] interfaces;
+-        if (notificationBroadcaster) {
+-            interfaces =
+-                new Class<?>[] {interfaceClass, NotificationEmitter.class};
+-        } else
+-            interfaces = new Class[] {interfaceClass};
+-        Object proxy = Proxy.newProxyInstance(
+-                interfaceClass.getClassLoader(),
+-                interfaces,
+-                handler);
+-        return interfaceClass.cast(proxy);
++        return createProxy(connection, objectName, interfaceClass, notificationBroadcaster, true);
+     }
+ 
+     /**
+@@ -392,4 +371,65 @@
+         // exactly the string "MXBean" since that would mean there
+         // was no package name, which is pretty unlikely in practice.
+     }
++
++    /**
++     * Centralised M(X)Bean proxy creation code
++     * @param connection {@linkplain MBeanServerConnection} to use
++     * @param objectName M(X)Bean object name
++     * @param interfaceClass M(X)Bean interface class
++     * @param notificationEmitter Is a notification emitter?
++     * @param isMXBean Is an MXBean?
++     * @return Returns an M(X)Bean proxy generated for the provided interface class
++     * @throws SecurityException
++     * @throws IllegalArgumentException
++     */
++    private static <T> T createProxy(MBeanServerConnection connection,
++                                     ObjectName objectName,
++                                     Class<T> interfaceClass,
++                                     boolean notificationEmitter,
++                                     boolean isMXBean) {
++
++        if (System.getSecurityManager() != null) {
++            checkProxyInterface(interfaceClass);
++        }
++        try {
++            if (isMXBean) {
++                // Check interface for MXBean compliance
++                Introspector.testComplianceMXBeanInterface(interfaceClass);
++            } else {
++                // Check interface for MBean compliance
++                Introspector.testComplianceMBeanInterface(interfaceClass);
++            }
++        } catch (NotCompliantMBeanException e) {
++            throw new IllegalArgumentException(e);
++        }
++
++        InvocationHandler handler = new MBeanServerInvocationHandler(
++                connection, objectName, isMXBean);
++        final Class<?>[] interfaces;
++        if (notificationEmitter) {
++            interfaces =
++                new Class<?>[] {interfaceClass, NotificationEmitter.class};
++        } else
++            interfaces = new Class<?>[] {interfaceClass};
++
++        Object proxy = Proxy.newProxyInstance(
++                interfaceClass.getClassLoader(),
++                interfaces,
++                handler);
++        return interfaceClass.cast(proxy);
++    }
++
++    /**
++     * Checks for the M(X)Bean proxy interface being public and not restricted
++     * @param interfaceClass MBean proxy interface
++     * @throws SecurityException when the proxy interface comes from a restricted
++     *                           package or is not public
++     */
++    private static void checkProxyInterface(Class<?> interfaceClass) {
++        if (!Modifier.isPublic(interfaceClass.getModifiers())) {
++            throw new SecurityException("mbean proxy interface non-public");
++        }
++        ReflectUtil.checkPackageAccess(interfaceClass);
++    }
+ }
+diff --git a/src/share/classes/javax/management/MBeanServerInvocationHandler.java b/src/share/classes/javax/management/MBeanServerInvocationHandler.java
+--- jdk/src/share/classes/javax/management/MBeanServerInvocationHandler.java
++++ jdk/src/share/classes/javax/management/MBeanServerInvocationHandler.java
+@@ -231,20 +231,7 @@
+                                          ObjectName objectName,
+                                          Class<T> interfaceClass,
+                                          boolean notificationBroadcaster) {
+-        final InvocationHandler handler =
+-            new MBeanServerInvocationHandler(connection, objectName);
+-        final Class[] interfaces;
+-        if (notificationBroadcaster) {
+-            interfaces =
+-                new Class[] {interfaceClass, NotificationEmitter.class};
+-        } else
+-            interfaces = new Class[] {interfaceClass};
+-
+-        Object proxy =
+-            Proxy.newProxyInstance(interfaceClass.getClassLoader(),
+-                                   interfaces,
+-                                   handler);
+-        return interfaceClass.cast(proxy);
++        return JMX.newMBeanProxy(connection, objectName, interfaceClass, notificationBroadcaster);
+     }
+ 
+     public Object invoke(Object proxy, Method method, Object[] args)

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8009004-rmi_connection_improvement.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8009004-rmi_connection_improvement.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8009004-rmi_connection_improvement.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,54 @@
+# HG changeset patch
+# User andrew
+# Date 1371555603 18000
+# Node ID 546df033118c15bdfb5cc08f73db87805bc56277
+# Parent  60c57caf0348c7eed93900e4395607af759e6ba9
+8009004: Better implementation of RMI connections
+Summary: Better class handling.
+Reviewed-by: alanb, dfuchs, skoivu, jbachorik
+Contributed-by: jean-francois.denise at oracle.com
+
+diff --git a/src/share/classes/com/sun/jmx/remote/util/OrderClassLoaders.java b/src/share/classes/com/sun/jmx/remote/util/OrderClassLoaders.java
+--- jdk/src/share/classes/com/sun/jmx/remote/util/OrderClassLoaders.java
++++ jdk/src/share/classes/com/sun/jmx/remote/util/OrderClassLoaders.java
+@@ -25,6 +25,8 @@
+ 
+ package com.sun.jmx.remote.util;
+ 
++import sun.reflect.misc.ReflectUtil;
++
+ public class OrderClassLoaders extends ClassLoader {
+     public OrderClassLoaders(ClassLoader cl1, ClassLoader cl2) {
+         super(cl1);
+@@ -32,9 +34,10 @@
+         this.cl2 = cl2;
+     }
+ 
+-    protected Class findClass(String name) throws ClassNotFoundException {
++    protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
++        ReflectUtil.checkPackageAccess(name);
+         try {
+-            return super.findClass(name);
++            return super.loadClass(name, resolve);
+         } catch (ClassNotFoundException cne) {
+             if (cl2 != null) {
+                 return cl2.loadClass(name);
+diff --git a/src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java b/src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java
+--- jdk/src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java
++++ jdk/src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java
+@@ -80,6 +80,7 @@
+ import javax.management.remote.NotificationResult;
+ import javax.management.remote.TargetedNotification;
+ import javax.security.auth.Subject;
++import sun.reflect.misc.ReflectUtil;
+ 
+ /**
+  * <p>Implementation of the {@link RMIConnection} interface.  User
+@@ -1804,6 +1805,7 @@
+         @Override
+         protected Class<?> loadClass(String name, boolean resolve)
+         throws ClassNotFoundException {
++            ReflectUtil.checkPackageAccess(name);
+             try {
+                 super.loadClass(name, resolve);
+             } catch(Exception e) {

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8009013-t2k_glyphs.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8009013-t2k_glyphs.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8009013-t2k_glyphs.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,39 @@
+# HG changeset patch
+# User bae
+# Date 1364284560 -14400
+# Node ID 7311e449c298f769d7e9761678d28741f6cd1537
+# Parent  546df033118c15bdfb5cc08f73db87805bc56277
+8009013: Better handling of T2K glyphs
+Reviewed-by: bae, prr
+Contributed-by: jia-hong.chen at oracle.com
+
+diff --git a/src/share/native/sun/font/freetypeScaler.c b/src/share/native/sun/font/freetypeScaler.c
+--- jdk/src/share/native/sun/font/freetypeScaler.c
++++ jdk/src/share/native/sun/font/freetypeScaler.c
+@@ -1350,17 +1350,22 @@
+     FTScalerInfo *scalerInfo =
+              (FTScalerInfo*) jlong_to_ptr(pScaler);
+ 
+-    glyphs = (jint*) malloc(numGlyphs*sizeof(jint));
++    glyphs = NULL;
++    if (numGlyphs > 0 && 0xffffffffu / sizeof(jint) >= numGlyphs) {
++        glyphs = (jint*) malloc(numGlyphs*sizeof(jint));
++    }
+     if (glyphs == NULL) {
++        // We reach here if:
++        // 1. numGlyphs <= 0,
++        // 2. overflow check failed, or
++        // 3. malloc failed.
+         gp = (*env)->NewObject(env, sunFontIDs.gpClass, sunFontIDs.gpCtrEmpty);
+-        if (!isNullScalerContext(context) && scalerInfo != NULL) {
+-            invalidateJavaScaler(env, scaler, scalerInfo);
+-        }
+         return gp;
+     }
+ 
+     (*env)->GetIntArrayRegion(env, glyphArray, 0, numGlyphs, glyphs);
+ 
++    gpdata.numCoords = 0;
+     for (i=0; i<numGlyphs;i++) {
+         if (glyphs[i] >= INVISIBLE_GLYPHS) {
+             continue;

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8009034-jmx_notification_improvement.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8009034-jmx_notification_improvement.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8009034-jmx_notification_improvement.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,30 @@
+# HG changeset patch
+# User jbachorik
+# Date 1363082977 -3600
+# Node ID 4b57646ef873f1b5db05907da8e410e8a937957c
+# Parent  7311e449c298f769d7e9761678d28741f6cd1537
+8009034: Improve resulting notifications in JMX
+Summary: Disallowing access to mutable shared arrays
+Reviewed-by: dfuchs, mchung, skoivu
+
+diff --git a/src/share/classes/javax/management/remote/NotificationResult.java b/src/share/classes/javax/management/remote/NotificationResult.java
+--- jdk/src/share/classes/javax/management/remote/NotificationResult.java
++++ jdk/src/share/classes/javax/management/remote/NotificationResult.java
+@@ -89,7 +89,7 @@
+ 
+         this.earliestSequenceNumber = earliestSequenceNumber;
+         this.nextSequenceNumber = nextSequenceNumber;
+-        this.targetedNotifications = targetedNotifications;
++        this.targetedNotifications = (targetedNotifications.length == 0 ? targetedNotifications : targetedNotifications.clone());
+     }
+ 
+     /**
+@@ -122,7 +122,7 @@
+      * listeners they correspond to.  This array can be empty.
+      */
+     public TargetedNotification[] getTargetedNotifications() {
+-        return targetedNotifications;
++        return targetedNotifications.length == 0 ? targetedNotifications : targetedNotifications.clone();
+     }
+ 
+     /**

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8009038-jmx_notification_support_improvement.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8009038-jmx_notification_support_improvement.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8009038-jmx_notification_support_improvement.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,89 @@
+# HG changeset patch
+# User jbachorik
+# Date 1363077266 -3600
+# Node ID ae61ba2bcdfa02807ead8b20311953a52f5ae96e
+# Parent  4b57646ef873f1b5db05907da8e410e8a937957c
+8009038: Improve JMX notification support
+Summary: Disallowing access to mutable shared arrays
+Reviewed-by: dfuchs, mchung, skoivu
+
+diff --git a/src/share/classes/javax/management/StandardEmitterMBean.java b/src/share/classes/javax/management/StandardEmitterMBean.java
+--- jdk/src/share/classes/javax/management/StandardEmitterMBean.java
++++ jdk/src/share/classes/javax/management/StandardEmitterMBean.java
+@@ -64,6 +64,9 @@
+ public class StandardEmitterMBean extends StandardMBean
+         implements NotificationEmitter {
+ 
++    private static final MBeanNotificationInfo[] NO_NOTIFICATION_INFO =
++        new MBeanNotificationInfo[0];
++
+     private final NotificationEmitter emitter;
+     private final MBeanNotificationInfo[] notificationInfo;
+ 
+@@ -99,11 +102,7 @@
+      */
+     public <T> StandardEmitterMBean(T implementation, Class<T> mbeanInterface,
+                                     NotificationEmitter emitter) {
+-        super(implementation, mbeanInterface, false);
+-        if (emitter == null)
+-            throw new IllegalArgumentException("Null emitter");
+-        this.emitter = emitter;
+-        this.notificationInfo = emitter.getNotificationInfo();
++        this(implementation, mbeanInterface, false, emitter);
+     }
+ 
+     /**
+@@ -148,7 +147,12 @@
+         if (emitter == null)
+             throw new IllegalArgumentException("Null emitter");
+         this.emitter = emitter;
+-        this.notificationInfo = emitter.getNotificationInfo();
++        MBeanNotificationInfo[] infos = emitter.getNotificationInfo();
++        if (infos == null || infos.length == 0) {
++            this.notificationInfo = NO_NOTIFICATION_INFO;
++        } else {
++            this.notificationInfo = infos.clone();
++        }
+     }
+ 
+     /**
+@@ -184,11 +188,7 @@
+      */
+     protected StandardEmitterMBean(Class<?> mbeanInterface,
+                                    NotificationEmitter emitter) {
+-        super(mbeanInterface, false);
+-        if (emitter == null)
+-            throw new IllegalArgumentException("Null emitter");
+-        this.emitter = emitter;
+-        this.notificationInfo = emitter.getNotificationInfo();
++        this(mbeanInterface, false, emitter);
+     }
+ 
+     /**
+@@ -231,7 +231,12 @@
+         if (emitter == null)
+             throw new IllegalArgumentException("Null emitter");
+         this.emitter = emitter;
+-        this.notificationInfo = emitter.getNotificationInfo();
++        MBeanNotificationInfo[] infos = emitter.getNotificationInfo();
++        if (infos == null || infos.length == 0) {
++            this.notificationInfo = NO_NOTIFICATION_INFO;
++        } else {
++            this.notificationInfo = infos.clone();
++        }
+     }
+ 
+     public void removeNotificationListener(NotificationListener listener)
+@@ -253,7 +258,11 @@
+     }
+ 
+     public MBeanNotificationInfo[] getNotificationInfo() {
+-        return notificationInfo;
++        if (notificationInfo.length == 0) {
++            return notificationInfo;
++        } else {
++            return notificationInfo.clone();
++        }
+     }
+ 
+     /**

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8009067-improve_key_storing.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8009067-improve_key_storing.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8009067-improve_key_storing.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,20 @@
+# HG changeset patch
+# User vinnie
+# Date 1363862556 0
+# Node ID 3bb3933b9704ad855b64933be52c6aa252a04d83
+# Parent  ae61ba2bcdfa02807ead8b20311953a52f5ae96e
+8009067: Improve storing keys in KeyStore
+Reviewed-by: mullan, skoivu
+
+diff --git a/src/share/classes/java/security/KeyStore.java b/src/share/classes/java/security/KeyStore.java
+--- jdk/src/share/classes/java/security/KeyStore.java
++++ jdk/src/share/classes/java/security/KeyStore.java
+@@ -1716,7 +1716,7 @@
+                              oldException);
+                     }
+                     try {
+-                        return AccessController.doPrivileged(action);
++                        return AccessController.doPrivileged(action, context);
+                     } catch (PrivilegedActionException e) {
+                         Throwable cause = e.getCause();
+                         throw new KeyStoreException

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8009071-improve_shape_handling.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8009071-improve_shape_handling.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8009071-improve_shape_handling.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,364 @@
+
+# HG changeset patch
+# User anthony
+# Date 1363871041 -14400
+# Node ID c98afec1bf864430f7a63a018f0e93c36fa66d6b
+# Parent 8ebdc80ffbc738897297ad274c5f5728f6c4ac69
+8009071: Improve shape handling
+Reviewed-by: art, mschoene
+
+--- jdk/src/share/native/sun/awt/splashscreen/java_awt_SplashScreen.c	Thu Mar 21 10:42:36 2013 +0000
++++ jdk/src/share/native/sun/awt/splashscreen/java_awt_SplashScreen.c	Thu Mar 21 17:04:01 2013 +0400
+@@ -26,6 +26,7 @@
+ #include "splashscreen_impl.h"
+ #include <jni.h>
+ #include <jlong_md.h>
++#include <sizecalc.h>
+ 
+ JNIEXPORT jint JNICALL
+ JNI_OnLoad(JavaVM * vm, void *reserved)
+@@ -57,7 +58,7 @@ Java_java_awt_SplashScreen__1update(JNIE
+     if (splash->overlayData) {
+         free(splash->overlayData);
+     }
+-    splash->overlayData = malloc(dataSize * sizeof(rgbquad_t));
++    splash->overlayData = SAFE_SIZE_ARRAY_ALLOC(malloc, dataSize, sizeof(rgbquad_t));
+     if (splash->overlayData) {
+         /* we need a copy anyway, so we'll be using GetIntArrayRegion */
+         (*env)->GetIntArrayRegion(env, data, 0, dataSize,
+--- jdk/src/share/native/sun/awt/splashscreen/splashscreen_gif.c	Thu Mar 21 10:42:36 2013 +0000
++++ jdk/src/share/native/sun/awt/splashscreen/splashscreen_gif.c	Thu Mar 21 17:04:01 2013 +0400
+@@ -27,6 +27,8 @@
+ #include "splashscreen_gfx.h"
+ 
+ #include "../giflib/gif_lib.h"
++
++#include "sizecalc.h"
+ 
+ #define GIF_TRANSPARENT     0x01
+ #define GIF_USER_INPUT      0x02
+@@ -120,7 +122,7 @@ SplashDecodeGif(Splash * splash, GifFile
+     splash->height = gif->SHeight;
+     splash->frameCount = gif->ImageCount;
+     splash->frames = (SplashImage *)
+-        malloc(sizeof(SplashImage) * gif->ImageCount);
++        SAFE_SIZE_ARRAY_ALLOC(malloc, sizeof(SplashImage), gif->ImageCount);
+     if (!splash->frames) {
+       free(pBitmapBits);
+       free(pOldBitmapBits);
+--- jdk/src/share/native/sun/java2d/pipe/Region.c	Thu Mar 21 10:42:36 2013 +0000
++++ jdk/src/share/native/sun/java2d/pipe/Region.c	Thu Mar 21 17:04:01 2013 +0400
+@@ -28,6 +28,7 @@
+ #include "jni_util.h"
+ 
+ #include "Region.h"
++#include "sizecalc.h"
+ 
+ static jfieldID endIndexID;
+ static jfieldID bandsID;
+@@ -260,8 +261,8 @@ RegionToYXBandedRectangles(JNIEnv *env,
+         }
+         Region_StartIteration(env, &clipInfo);
+         numrects = Region_CountIterationRects(&clipInfo);
+-        if (numrects > initialBufferSize) {
+-            *pRect = (RECT_T *) malloc(numrects * sizeof(RECT_T));
++        if ((unsigned long)numrects > initialBufferSize) {
++            *pRect = (RECT_T *) SAFE_SIZE_ARRAY_ALLOC(malloc, numrects, sizeof(RECT_T));
+             if (*pRect == NULL) {
+                 Region_EndIteration(env, &clipInfo);
+                 JNU_ThrowOutOfMemoryError(env,
+--- jdk/src/solaris/native/sun/awt/awt_Robot.c	Thu Mar 21 10:42:36 2013 +0000
++++ jdk/src/solaris/native/sun/awt/awt_Robot.c	Thu Mar 21 17:04:01 2013 +0400
+@@ -40,6 +40,7 @@
+ #include <X11/extensions/XInput.h>
+ #include <X11/extensions/XI.h>
+ #include <jni.h>
++#include <sizecalc.h>
+ #include "robot_common.h"
+ #include "canvas.h"
+ #include "wsutils.h"
+@@ -232,8 +233,9 @@ Java_sun_awt_X11_XRobotPeer_getRGBPixels
+     image = getWindowImage(awt_display, rootWindow, x, y, width, height);
+ 
+     /* Array to use to crunch around the pixel values */
+-    ary = (jint *) malloc(width * height * sizeof (jint));
+-    if (ary == NULL) {
++    if (!IS_SAFE_SIZE_MUL(width, height) ||
++        !(ary = (jint *) SAFE_SIZE_ARRAY_ALLOC(malloc, width * height, sizeof (jint))))
++    {
+         JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
+         XDestroyImage(image);
+         AWT_UNLOCK();
+--- jdk/src/solaris/native/sun/awt/awt_UNIXToolkit.c	Thu Mar 21 10:42:36 2013 +0000
++++ jdk/src/solaris/native/sun/awt/awt_UNIXToolkit.c	Thu Mar 21 17:04:01 2013 +0400
+@@ -29,6 +29,7 @@
+ #include <dlfcn.h>
+ 
+ #include <jni.h>
++#include <sizecalc.h>
+ #include "sun_awt_UNIXToolkit.h"
+ 
+ #ifndef HEADLESS
+@@ -148,7 +149,8 @@ Java_sun_awt_UNIXToolkit_load_1gtk_1icon
+     }
+ 
+     len = (*env)->GetStringUTFLength(env, filename);
+-    filename_str = (char *)malloc(sizeof(char) * (len + 1));
++    filename_str = (char *)SAFE_SIZE_ARRAY_ALLOC(malloc,
++            sizeof(char), len + 1);
+     if (filename_str == NULL) {
+         JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
+         return JNI_FALSE;
+@@ -189,7 +191,8 @@ Java_sun_awt_UNIXToolkit_load_1stock_1ic
+     }
+ 
+     len = (*env)->GetStringUTFLength(env, stock_id);
+-    stock_id_str = (char *)malloc(sizeof(char) * (len + 1));
++    stock_id_str = (char *)SAFE_SIZE_ARRAY_ALLOC(malloc,
++            sizeof(char), len + 1);
+     if (stock_id_str == NULL) {
+         JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
+         return JNI_FALSE;
+@@ -200,7 +203,8 @@ Java_sun_awt_UNIXToolkit_load_1stock_1ic
+     if (detail != NULL)
+     {
+         len = (*env)->GetStringUTFLength(env, detail);
+-        detail_str = (char *)malloc(sizeof(char) * (len + 1));
++        detail_str = (char *)SAFE_SIZE_ARRAY_ALLOC(malloc,
++                sizeof(char), len + 1);
+         if (detail_str == NULL) {
+             JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
+             return JNI_FALSE;
+--- jdk/src/solaris/native/sun/awt/fontpath.c	Thu Mar 21 10:42:36 2013 +0000
++++ jdk/src/solaris/native/sun/awt/fontpath.c	Thu Mar 21 17:04:01 2013 +0400
+@@ -37,6 +37,7 @@
+ #ifdef __solaris__
+ #include <sys/systeminfo.h>
+ #endif
++#include <sizecalc.h>
+ 
+ #include <jni.h>
+ #include <jni_util.h>
+@@ -182,7 +183,7 @@
+ 
+     if ( fDirP->num == 0 ) return;
+ 
+-    appendDirList = malloc ( fDirP->num * sizeof ( int ));
++    appendDirList = SAFE_SIZE_ARRAY_ALLOC(malloc, fDirP->num, sizeof ( int ));
+     if ( appendDirList == NULL ) {
+       return;  /* if it fails we cannot do much */
+     }
+@@ -239,7 +240,7 @@
+     }
+ 
+ 
+-    newFontPath = malloc ( totalDirCount * sizeof ( char **) );
++    newFontPath = SAFE_SIZE_ARRAY_ALLOC(malloc, totalDirCount, sizeof ( char **) );
+     /* if it fails free things and get out */
+     if ( newFontPath == NULL ) {
+       free ( ( void *) appendDirList );
+@@ -260,7 +261,12 @@
+ 
+         /* printf ( "Appending %s\n", fDirP->name[index] ); */
+ 
+-        onePath = malloc ( ( strlen (fDirP->name[index]) + 2 )* sizeof( char ) );
++        onePath = SAFE_SIZE_ARRAY_ALLOC(malloc, strlen (fDirP->name[index]) + 2, sizeof( char ) );
++        if (onePath == NULL) {
++            free ( ( void *) appendDirList );
++            XFreeFontPath ( origFontPath );
++            return;
++        }
+         strcpy ( onePath, fDirP->name[index] );
+         strcat ( onePath, "/" );
+         newFontPath[nPaths++] = onePath;
+--- jdk/src/solaris/native/sun/awt/gtk2_interface.c	Thu Mar 21 10:42:36 2013 +0000
++++ jdk/src/solaris/native/sun/awt/gtk2_interface.c	Thu Mar 21 17:04:01 2013 +0400
+@@ -28,6 +28,7 @@
+ #include <limits.h>
+ #include <stdio.h>
+ #include <string.h>
++#include "sizecalc.h"
+ #include "gtk2_interface.h"
+ #include "java_awt_Transparency.h"
+ 
+@@ -637,7 +638,8 @@
+     {
+         gchar *tmp_env = strdup (gtk_modules_env);
+         /* the new env will be smaller than the old one */
+-        gchar *s, *new_env = malloc (sizeof(ENV_PREFIX)+strlen (gtk_modules_env));
++        gchar *s, *new_env = SAFE_SIZE_STRUCT_ALLOC(malloc,
++                sizeof(ENV_PREFIX), 1, strlen (gtk_modules_env));
+ 
+         if (new_env != NULL )
+         {
+--- jdk/src/solaris/native/sun/awt/splashscreen/splashscreen_sys.c	Thu Mar 21 10:42:36 2013 +0000
++++ jdk/src/solaris/native/sun/awt/splashscreen/splashscreen_sys.c	Thu Mar 21 17:04:01 2013 +0400
+@@ -40,6 +40,7 @@
+ #include <langinfo.h>
+ #include <locale.h>
+ #include <fcntl.h>
++#include <sizecalc.h>
+ 
+ static Bool shapeSupported;
+ static int shapeEventBase, shapeErrorBase;
+@@ -75,9 +76,12 @@
+         goto done;
+     }
+     inSize = strlen(in);
++    buf = SAFE_SIZE_ARRAY_ALLOC(malloc, inSize, 2);
++    if (!buf) {
++        return NULL;
++    }
+     bufSize = inSize*2; // need 2 bytes per char for UCS-2, this is
+                         // 2 bytes per source byte max
+-    buf = malloc(bufSize);
+     out = buf; outSize = bufSize;
+     /* linux iconv wants char** source and solaris wants const char**...
+        cast to void* */
+@@ -113,12 +117,20 @@
+     initRect(&maskRect, 0, 0, splash->width, splash->height, 1,
+             splash->width * splash->imageFormat.depthBytes,
+             splash->frames[imageIndex].bitmapBits, &splash->imageFormat);
+-    rects =
+-        malloc(sizeof(XRectangle) * (splash->width / 2 + 1) * splash->height);
++    if (!IS_SAFE_SIZE_MUL(splash->width / 2 + 1, splash->height)) {
++        return;
++    }
++    rects = SAFE_SIZE_ARRAY_ALLOC(malloc,
++            sizeof(XRectangle), (splash->width / 2 + 1) * splash->height);
++    if (!rects) {
++        return;
++    }
+ 
+     frame->numRects = BitmapToYXBandedRectangles(&maskRect, rects);
+-    frame->rects = malloc(frame->numRects * sizeof(XRectangle));
+-    memcpy(frame->rects, rects, frame->numRects * sizeof(XRectangle));
++    frame->rects = SAFE_SIZE_ARRAY_ALLOC(malloc, frame->numRects, sizeof(XRectangle));
++    if (frame->rects) { // handle the error after the if(){}
++        memcpy(frame->rects, rects, frame->numRects * sizeof(XRectangle));
++    }
+     free(rects);
+ }
+ 
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ jdk/src/share/native/common/sizecalc.h	Thu Mar 21 17:04:01 2013 +0400
+@@ -0,0 +1,118 @@
++/*
++ * 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 SIZECALC_H
++#define SIZECALC_H
++
++/*
++ * A machinery for safe calculation of sizes used when allocating memory.
++ *
++ * All size checks are performed against the SIZE_MAX (the maximum value for
++ * size_t). All numerical arguments as well as the result of calculation must
++ * be non-negative integers less than or equal to SIZE_MAX, otherwise the
++ * calculated size is considered unsafe.
++ *
++ * If the SIZECALC_ALLOC_THROWING_BAD_ALLOC macro is defined, then _ALLOC_
++ * helper macros throw the std::bad_alloc instead of returning NULL.
++ */
++
++#include <stdint.h> /* SIZE_MAX for C99+ */
++/* http://stackoverflow.com/questions/3472311/what-is-a-portable-method-to-find-the-maximum-value-of-size-t */
++#ifndef SIZE_MAX
++#define SIZE_MAX ((size_t)-1)
++#endif
++
++#define IS_SAFE_SIZE_T(x) ((x) >= 0 && (unsigned long long)(x) <= SIZE_MAX)
++
++#define IS_SAFE_SIZE_MUL(m, n) \
++    (IS_SAFE_SIZE_T(m) && IS_SAFE_SIZE_T(n) && ((m) == 0 || (n) == 0 || (size_t)(n) <= (SIZE_MAX / (size_t)(m))))
++
++#define IS_SAFE_SIZE_ADD(a, b) \
++    (IS_SAFE_SIZE_T(a) && IS_SAFE_SIZE_T(b) && (size_t)(b) <= (SIZE_MAX - (size_t)(a)))
++
++
++
++/* Helper macros */
++
++#ifdef SIZECALC_ALLOC_THROWING_BAD_ALLOC
++#define FAILURE_RESULT throw std::bad_alloc()
++#else
++#define FAILURE_RESULT NULL
++#endif
++
++/*
++ * A helper macro to safely allocate an array of size m*n.
++ * Example usage:
++ *    int* p = (int*)SAFE_SIZE_ARRAY_ALLOC(malloc, sizeof(int), n);
++ *    if (!p) throw OutOfMemory;
++ *    // Use the allocated array...
++ */
++#define SAFE_SIZE_ARRAY_ALLOC(func, m, n) \
++    (IS_SAFE_SIZE_MUL((m), (n)) ? ((func)((m) * (n))) : FAILURE_RESULT)
++
++#define SAFE_SIZE_ARRAY_REALLOC(func, p, m, n) \
++    (IS_SAFE_SIZE_MUL((m), (n)) ? ((func)((p), (m) * (n))) : FAILURE_RESULT)
++
++/*
++ * A helper macro to safely allocate an array of type 'type' with 'n' items
++ * using the C++ new[] operator.
++ * Example usage:
++ *    MyClass* p = SAFE_SIZE_NEW_ARRAY(MyClass, n);
++ *    // Use the pointer.
++ * This macro throws the std::bad_alloc C++ exception to indicate
++ * a failure.
++ * NOTE: if 'n' is calculated, the calling code is responsible for using the
++ * IS_SAFE_... macros to check if the calculations are safe.
++ */
++#define SAFE_SIZE_NEW_ARRAY(type, n) \
++    (IS_SAFE_SIZE_MUL(sizeof(type), (n)) ? (new type[(n)]) : throw std::bad_alloc())
++
++#define SAFE_SIZE_NEW_ARRAY2(type, n, m) \
++    (IS_SAFE_SIZE_MUL((m), (n)) && IS_SAFE_SIZE_MUL(sizeof(type), (n) * (m)) ? \
++     (new type[(n) * (m)]) : throw std::bad_alloc())
++
++/*
++ * Checks if a data structure of size (a + m*n) can be safely allocated
++ * w/o producing an integer overflow when calculating its size.
++ */
++#define IS_SAFE_STRUCT_SIZE(a, m, n) \
++    ( \
++      IS_SAFE_SIZE_MUL((m), (n)) && IS_SAFE_SIZE_ADD((m) * (n), (a)) \
++    )
++
++/*
++ * A helper macro for implementing safe memory allocation for a data structure
++ * of size (a + m * n).
++ * Example usage:
++ *    void * p = SAFE_SIZE_ALLOC(malloc, header, num, itemSize);
++ *    if (!p) throw OutOfMemory;
++ *    // Use the allocated memory...
++ */
++#define SAFE_SIZE_STRUCT_ALLOC(func, a, m, n) \
++    (IS_SAFE_STRUCT_SIZE((a), (m), (n)) ? ((func)((a) + (m) * (n))) : FAILURE_RESULT)
++
++
++#endif /* SIZECALC_H */
++
+

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8009235-improve_tsa_data_handling.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8009235-improve_tsa_data_handling.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8009235-improve_tsa_data_handling.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,80 @@
+# HG changeset patch
+# User andrew
+# Date 1371556240 18000
+# Node ID 97f318cdfb834385beb7370348582daebccc8987
+# Parent  3bb3933b9704ad855b64933be52c6aa252a04d83
+8009235: Improve handling of TSA data
+Reviewed-by: ahgross, mullan
+
+diff --git a/src/share/classes/sun/security/timestamp/TimestampToken.java b/src/share/classes/sun/security/timestamp/TimestampToken.java
+--- jdk/src/share/classes/sun/security/timestamp/TimestampToken.java
++++ jdk/src/share/classes/sun/security/timestamp/TimestampToken.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -115,6 +115,10 @@
+         return nonce;
+     }
+ 
++    public BigInteger getSerialNumber() {
++        return serialNumber;
++    }
++
+     /*
+      * Parses the timestamp token info.
+      *
+diff --git a/src/share/classes/sun/security/util/SignatureFileVerifier.java b/src/share/classes/sun/security/util/SignatureFileVerifier.java
+--- jdk/src/share/classes/sun/security/util/SignatureFileVerifier.java
++++ jdk/src/share/classes/sun/security/util/SignatureFileVerifier.java
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 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
+@@ -541,6 +541,8 @@
+                 // Create a timestamp token info object
+                 TimestampToken timestampTokenInfo =
+                     new TimestampToken(encodedTimestampTokenInfo);
++                // Check that the signature timestamp applies to this signature
++                verifyTimestamp(timestampTokenInfo, info.getEncryptedDigest());
+                 // Create a timestamp object
+                 timestamp =
+                     new Timestamp(timestampTokenInfo.getDate(), tsaChain);
+@@ -549,6 +551,31 @@
+         return timestamp;
+     }
+ 
++    /*
++     * Check that the signature timestamp applies to this signature.
++     * Match the hash present in the signature timestamp token against the hash
++     * of this signature.
++     */
++    private void verifyTimestamp(TimestampToken token, byte[] signature)
++        throws NoSuchAlgorithmException, SignatureException {
++
++        MessageDigest md =
++            MessageDigest.getInstance(token.getHashAlgorithm().getName());
++
++        if (!Arrays.equals(token.getHashedMessage(), md.digest(signature))) {
++            throw new SignatureException("Signature timestamp (#" +
++                token.getSerialNumber() + ") generated on " + token.getDate() +
++                " is inapplicable");
++        }
++
++        if (debug != null) {
++            debug.println();
++            debug.println("Detected signature timestamp (#" +
++                token.getSerialNumber() + ") generated on " + token.getDate());
++            debug.println();
++        }
++    }
++
+     // for the toHex function
+     private static final char[] hexc =
+             {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8011243-improve_imaginglib.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8011243-improve_imaginglib.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8011243-improve_imaginglib.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,618 @@
+# HG changeset patch
+# User bae
+# Date 1365505409 -14400
+# Node ID 8d4760ec16ecfc5abb647dfb1a28d5b3c01f6a12
+# Parent  0f5e355fe68c0ff29e28a962199185e4bd3d7e04
+8011243: Improve ImagingLib
+Reviewed-by: mschoene, prr, vadim
+
+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
+@@ -1152,22 +1152,127 @@
+     return retStatus;
+ }
+ 
++typedef struct {
++    jobject jArray;
++    jsize length;
++    unsigned char *table;
++} LookupArrayInfo;
++
++#define NLUT 8
++
++#ifdef _LITTLE_ENDIAN
++#define INDEXES    { 3, 2, 1, 0, 7, 6, 5, 4 }
++#else
++#define INDEXES    { 0, 1, 2, 3, 4, 5, 6, 7 }
++#endif
++
++static int lookupShortData(mlib_image* src, mlib_image* dst,
++    LookupArrayInfo* lookup)
++{
++    int x, y;
++    unsigned int mask = NLUT-1;
++
++    unsigned short* srcLine = (unsigned short*)src->data;
++    unsigned char* dstLine = (unsigned char*)dst->data;
++
++    static int indexes[NLUT] = INDEXES;
++
++    for (y=0; y < src->height; y++) {
++        int nloop, nx;
++        int npix = src->width;
++
++        unsigned short* srcPixel = srcLine;
++        unsigned char* dstPixel = dstLine;
++
++#ifdef SIMPLE_LOOKUP_LOOP
++        for (x=0; status && x < width; x++) {
++            unsigned short s = *srcPixel++;
++            if (s >= lookup->length) {
++                /* we can not handle source image using
++                * byte lookup table. Fall back to processing
++                * images in java
++                */
++                return 0;
++            }
++            *dstPixel++ = lookup->table[s];
++        }
++#else
++        /* Get to 32 bit-aligned point */
++        while(((uintptr_t)dstPixel & 0x3) != 0 && npix>0) {
++            unsigned short s = *srcPixel++;
++            if (s >= lookup->length) {
++                return 0;
++            }
++            *dstPixel++ = lookup->table[s];
++            npix--;
++        }
++
++        /*
++         * Do NLUT pixels per loop iteration.
++         * Pack into ints and write out 2 at a time.
++         */
++        nloop = npix/NLUT;
++        nx = npix%NLUT;
++
++        for(x=nloop; x!=0; x--) {
++            int i = 0;
++            int* dstP = (int*)dstPixel;
++
++            for (i = 0; i < NLUT; i++) {
++                if (srcPixel[i] >= lookup->length) {
++                    return 0;
++                }
++            }
++
++            dstP[0] = (int)
++                ((lookup->table[srcPixel[indexes[0]]] << 24) |
++                 (lookup->table[srcPixel[indexes[1]]] << 16) |
++                 (lookup->table[srcPixel[indexes[2]]] << 8)  |
++                  lookup->table[srcPixel[indexes[3]]]);
++            dstP[1] = (int)
++                ((lookup->table[srcPixel[indexes[4]]] << 24) |
++                 (lookup->table[srcPixel[indexes[5]]] << 16) |
++                 (lookup->table[srcPixel[indexes[6]]] << 8)  |
++                  lookup->table[srcPixel[indexes[7]]]);
++
++
++            dstPixel += NLUT;
++            srcPixel += NLUT;
++        }
++
++        /*
++         * Complete any remaining pixels
++         */
++        for(x=nx; x!=0; x--) {
++            unsigned short s = *srcPixel++;
++            if (s >= lookup->length) {
++                return 0;
++            }
++            *dstPixel++ = lookup->table[s];
++        }
++#endif
++
++        dstLine += dst->stride;     // array of bytes, scan stride in bytes
++        srcLine += src->stride / 2; // array of shorts, scan stride in bytes
++    }
++    return 1;
++}
++
+ JNIEXPORT jint JNICALL
+-Java_sun_awt_image_ImagingLib_lookupByteBI(JNIEnv *env, jobject this,
++Java_sun_awt_image_ImagingLib_lookupByteBI(JNIEnv *env, jobject thisLib,
+                                            jobject jsrc, jobject jdst,
+                                            jobjectArray jtableArrays)
+ {
+     mlib_image *src;
+     mlib_image *dst;
+     void *sdata, *ddata;
+-    unsigned char **table;
+     unsigned char **tbl;
+     unsigned char lut[256];
+     int retStatus = 1;
+     int i;
+     mlib_status status;
+-    int jlen;
+-    jobject *jtable;
++    int lut_nbands;
++    LookupArrayInfo *jtable;
+     BufImageS_t *srcImageP, *dstImageP;
+     int nbands;
+     int ncomponents;
+@@ -1193,12 +1298,29 @@
+         return 0;
+     }
+ 
+-    jlen = (*env)->GetArrayLength(env, jtableArrays);
++    lut_nbands = (*env)->GetArrayLength(env, jtableArrays);
+ 
+     ncomponents = srcImageP->cmodel.isDefaultCompatCM
+         ? 4
+         : srcImageP->cmodel.numComponents;
+ 
++    if (lut_nbands > ncomponents) {
++        lut_nbands = ncomponents;
++    }
++
++    /* Make sure that color order can be used for
++     * re-ordering of lookup arrays.
++     */
++    for (i = 0; i < ncomponents; i++) {
++        int idx = srcImageP->hints.colorOrder[i];
++
++        if (idx < 0 || idx >= ncomponents) {
++            awt_freeParsedImage(srcImageP, TRUE);
++            awt_freeParsedImage(dstImageP, TRUE);
++            return 0;
++        }
++    }
++
+     tbl = NULL;
+     if (SAFE_TO_ALLOC_2(ncomponents, sizeof(unsigned char *))) {
+         tbl = (unsigned char **)
+@@ -1206,18 +1328,12 @@
+     }
+ 
+     jtable = NULL;
+-    if (SAFE_TO_ALLOC_2(jlen, sizeof(jobject *))) {
+-        jtable = (jobject *)malloc(jlen * sizeof (jobject *));
++    if (SAFE_TO_ALLOC_2(lut_nbands, sizeof(LookupArrayInfo))) {
++        jtable = (LookupArrayInfo *)malloc(lut_nbands * sizeof (LookupArrayInfo));
+     }
+ 
+-    table = NULL;
+-    if (SAFE_TO_ALLOC_2(jlen, sizeof(unsigned char *))) {
+-        table = (unsigned char **)malloc(jlen * sizeof(unsigned char *));
+-    }
+-
+-    if (tbl == NULL || table == NULL || jtable == NULL) {
++    if (tbl == 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);
+@@ -1225,11 +1341,21 @@
+         return 0;
+     }
+     /* Need to grab these pointers before we lock down arrays */
+-    for (i=0; i < jlen; i++) {
+-        jtable[i] = (*env)->GetObjectArrayElement(env, jtableArrays, i);
+-        if (jtable[i] == NULL) {
++    for (i=0; i < lut_nbands; i++) {
++        jtable[i].jArray = (*env)->GetObjectArrayElement(env, jtableArrays, i);
++
++        if (jtable[i].jArray != NULL) {
++            jtable[i].length = (*env)->GetArrayLength(env, jtable[i].jArray);
++            jtable[i].table = NULL;
++
++            if (jtable[i].length < 256) {
++                /* we may read outside the table during lookup */
++                jtable[i].jArray = NULL;
++                jtable[i].length = 0;
++            }
++        }
++        if (jtable[i].jArray == NULL) {
+             free(tbl);
+-            free(table);
+             free(jtable);
+             awt_freeParsedImage(srcImageP, TRUE);
+             awt_freeParsedImage(dstImageP, TRUE);
+@@ -1242,7 +1368,6 @@
+     if (nbands < 1) {
+         /* Can't handle any custom images */
+         free(tbl);
+-        free(table);
+         free(jtable);
+         awt_freeParsedImage(srcImageP, TRUE);
+         awt_freeParsedImage(dstImageP, TRUE);
+@@ -1253,7 +1378,6 @@
+     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);
+@@ -1262,7 +1386,6 @@
+     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);
+@@ -1278,7 +1401,7 @@
+      * sufficient number of lookup arrays we add references to identity
+      * lookup array to make medialib happier.
+      */
+-    if (jlen < ncomponents) {
++    if (lut_nbands < ncomponents) {
+         int j;
+         /* REMIND: This should be the size of the input lut!! */
+         for (j=0; j < 256; j++) {
+@@ -1287,65 +1410,45 @@
+         for (j=0; j < ncomponents; j++) {
+             tbl[j] = lut;
+         }
+-
+     }
+ 
+-    for (i=0; i < jlen; i++) {
+-        table[i] = (unsigned char *)
+-            (*env)->GetPrimitiveArrayCritical(env, jtable[i], NULL);
+-        if (table[i] == NULL) {
++    for (i=0; i < lut_nbands; i++) {
++        jtable[i].table = (unsigned char *)
++            (*env)->GetPrimitiveArrayCritical(env, jtable[i].jArray, NULL);
++        if (jtable[i].table == NULL) {
+             /* Free what we've got so far. */
+             int j;
+             for (j = 0; j < i; j++) {
+                 (*env)->ReleasePrimitiveArrayCritical(env,
+-                                                      jtable[j],
+-                                                      (jbyte *) table[j],
++                                                      jtable[j].jArray,
++                                                      (jbyte *) jtable[j].table,
+                                                       JNI_ABORT);
+             }
+             free(tbl);
+-            free(table);
+             free(jtable);
+             freeArray(env, srcImageP, src, sdata, NULL, NULL, NULL);
+             awt_freeParsedImage(srcImageP, TRUE);
+             awt_freeParsedImage(dstImageP, TRUE);
+             return 0;
+         }
+-        tbl[srcImageP->hints.colorOrder[i]] = table[i];
++        tbl[srcImageP->hints.colorOrder[i]] = jtable[i].table;
+     }
+ 
+-    if (jlen == 1) {
++    if (lut_nbands == 1) {
+         for (i=1; i < nbands -
+                  srcImageP->cmodel.supportsAlpha; i++) {
+-            tbl[srcImageP->hints.colorOrder[i]] = table[0];
++                     tbl[srcImageP->hints.colorOrder[i]] = jtable[0].table;
+         }
+     }
+ 
+     /* Mlib needs 16bit lookuptable and must be signed! */
+     if (src->type == MLIB_SHORT) {
+-        unsigned short *sdataP = (unsigned short *) src->data;
+-        unsigned short *sP;
+         if (dst->type == MLIB_BYTE) {
+-            unsigned char *cdataP  = (unsigned char *)  dst->data;
+-            unsigned char *cP;
+             if (nbands > 1) {
+                 retStatus = 0;
+             }
+             else {
+-                int x, y;
+-                for (y=0; y < src->height; y++) {
+-                    cP = cdataP;
+-                    sP = sdataP;
+-                    for (x=0; x < src->width; x++) {
+-                        *cP++ = table[0][*sP++];
+-                    }
+-
+-                    /*
+-                     * 4554571: increment pointers using the scanline stride
+-                     * in pixel units (not byte units)
+-                     */
+-                    cdataP += dstImageP->raster.scanlineStride;
+-                    sdataP += srcImageP->raster.scanlineStride;
+-                }
++                retStatus = lookupShortData(src, dst, &jtable[0]);
+             }
+         }
+         /* How about ddata == null? */
+@@ -1370,12 +1473,11 @@
+     }
+ 
+     /* Release the LUT */
+-    for (i=0; i < jlen; i++) {
+-        (*env)->ReleasePrimitiveArrayCritical(env, jtable[i],
+-                                              (jbyte *) table[i], JNI_ABORT);
++    for (i=0; i < lut_nbands; i++) {
++        (*env)->ReleasePrimitiveArrayCritical(env, jtable[i].jArray,
++            (jbyte *) jtable[i].table, JNI_ABORT);
+     }
+     free ((void *) jtable);
+-    free ((void *) table);
+     free ((void *) tbl);
+ 
+     /* Release the pinned memory */
+@@ -1389,7 +1491,6 @@
+     return retStatus;
+ }
+ 
+-
+ JNIEXPORT jint JNICALL
+ Java_sun_awt_image_ImagingLib_lookupByteRaster(JNIEnv *env,
+                                                jobject this,
+@@ -1403,8 +1504,8 @@
+     mlib_image*    dst;
+     void*          sdata;
+     void*          ddata;
+-    jobject        jtable[4];
+-    unsigned char* table[4];
++    LookupArrayInfo jtable[4];
++    unsigned char* mlib_lookupTable[4];
+     int            i;
+     int            retStatus = 1;
+     mlib_status    status;
+@@ -1452,6 +1553,11 @@
+     src_nbands = srcRasterP->numBands;
+     dst_nbands = dstRasterP->numBands;
+ 
++    /* adjust number of lookup bands */
++    if (lut_nbands > src_nbands) {
++        lut_nbands = src_nbands;
++    }
++
+     /* MediaLib can't do more than 4 bands */
+     if (src_nbands <= 0 || src_nbands > 4 ||
+         dst_nbands <= 0 || dst_nbands > 4 ||
+@@ -1516,22 +1622,37 @@
+     /* Get references to the lookup table arrays */
+     /* Need to grab these pointers before we lock down arrays */
+     for (i=0; i < lut_nbands; i++) {
+-        jtable[i] = (*env)->GetObjectArrayElement(env, jtableArrays, i);
+-        if (jtable[i] == NULL) {
++        jtable[i].jArray = (*env)->GetObjectArrayElement(env, jtableArrays, i);
++        jtable[i].table = NULL;
++        if (jtable[i].jArray != NULL) {
++            jtable[i].length = (*env)->GetArrayLength(env, jtable[i].jArray);
++            if (jtable[i].length < 256) {
++                 /* we may read outside the table during lookup */
++                jtable[i].jArray = NULL;
++            }
++        }
++
++        if (jtable[i].jArray == NULL)
++        {
++            freeDataArray(env, srcRasterP->jdata, src, sdata,
++                          dstRasterP->jdata, dst, ddata);
++
++            awt_freeParsedRaster(srcRasterP, TRUE);
++            awt_freeParsedRaster(dstRasterP, TRUE);
+             return 0;
+         }
+     }
+ 
+     for (i=0; i < lut_nbands; i++) {
+-        table[i] = (unsigned char *)
+-            (*env)->GetPrimitiveArrayCritical(env, jtable[i], NULL);
+-        if (table[i] == NULL) {
++        jtable[i].table = (unsigned char *)
++            (*env)->GetPrimitiveArrayCritical(env, jtable[i].jArray, NULL);
++        if (jtable[i].table == NULL) {
+             /* Free what we've got so far. */
+             int j;
+             for (j = 0; j < i; j++) {
+                 (*env)->ReleasePrimitiveArrayCritical(env,
+-                                                      jtable[j],
+-                                                      (jbyte *) table[j],
++                                                      jtable[j].jArray,
++                                                      (jbyte *) jtable[j].table,
+                                                       JNI_ABORT);
+             }
+             freeDataArray(env, srcRasterP->jdata, src, sdata,
+@@ -1540,6 +1661,7 @@
+             awt_freeParsedRaster(dstRasterP, TRUE);
+             return 0;
+         }
++        mlib_lookupTable[i] = jtable[i].table;
+     }
+ 
+     /*
+@@ -1548,107 +1670,28 @@
+      * contains single lookup array.
+      */
+     for (i = lut_nbands; i < src_nbands; i++) {
+-        table[i] = table[0];
++        mlib_lookupTable[i] = jtable[0].table;
+     }
+ 
+     /*
+      * Setup lookup array for "extra" channels
+      */
+     for ( ; i < src->channels; i++) {
+-        table[i] = ilut;
++        mlib_lookupTable[i] = ilut;
+     }
+ 
+-#define NLUT 8
+     /* Mlib needs 16bit lookuptable and must be signed! */
+     if (src->type == MLIB_SHORT) {
+-        unsigned short *sdataP = (unsigned short *) src->data;
+-        unsigned short *sP;
+         if (dst->type == MLIB_BYTE) {
+-            unsigned char *cdataP  = (unsigned char *)  dst->data;
+-            unsigned char *cP;
+             if (lut_nbands > 1) {
+                 retStatus = 0;
+             } else {
+-                int x, y;
+-                unsigned int mask = NLUT-1;
+-                unsigned char* pLut = table[0];
+-                unsigned int endianTest = 0xff000000;
+-                for (y=0; y < src->height; y++) {
+-                    int nloop, nx;
+-                    unsigned short* srcP;
+-                    int* dstP;
+-                    int npix = src->width;
+-                    cP = cdataP;
+-                    sP = sdataP;
+-                    /* Get to 32 bit-aligned point */
+-                    while(((uintptr_t)cP & 0x3) != 0 && npix>0) {
+-                          *cP++ = pLut[*sP++];
+-                          npix--;
+-                    }
+-
+-                    /*
+-                     * Do NLUT pixels per loop iteration.
+-                     * Pack into ints and write out 2 at a time.
+-                     */
+-                    nloop = npix/NLUT;
+-                    nx = npix%NLUT;
+-                    srcP = sP;
+-                    dstP = (int*)cP;
+-
+-                    if(((char*)(&endianTest))[0] != 0) {
+-                        /* Big endian loop */
+-                        for(x=nloop; x!=0; x--) {
+-                            dstP[0] = (int)
+-                                    ((pLut[srcP[0]] << 24) |
+-                                     (pLut[srcP[1]] << 16) |
+-                                     (pLut[srcP[2]] << 8)  |
+-                                      pLut[srcP[3]]);
+-                            dstP[1] = (int)
+-                                    ((pLut[srcP[4]] << 24) |
+-                                     (pLut[srcP[5]] << 16) |
+-                                     (pLut[srcP[6]] << 8)  |
+-                                      pLut[srcP[7]]);
+-                            dstP += NLUT/4;
+-                            srcP += NLUT;
+-                        }
+-                    } else {
+-                        /* Little endian loop */
+-                        for(x=nloop; x!=0; x--) {
+-                            dstP[0] = (int)
+-                                    ((pLut[srcP[3]] << 24) |
+-                                     (pLut[srcP[2]] << 16) |
+-                                     (pLut[srcP[1]] << 8)  |
+-                                      pLut[srcP[0]]);
+-                            dstP[1] = (int)
+-                                    ((pLut[srcP[7]] << 24) |
+-                                     (pLut[srcP[6]] << 16) |
+-                                     (pLut[srcP[5]] << 8)  |
+-                                      pLut[srcP[4]]);
+-                            dstP += NLUT/4;
+-                            srcP += NLUT;
+-                        }
+-                    }
+-                    /*
+-                     * Complete any remaining pixels
+-                     */
+-                    cP = cP + NLUT * nloop;
+-                    sP = sP + NLUT * nloop;
+-                    for(x=nx; x!=0; x--) {
+-                        *cP++ = pLut[*sP++];
+-                    }
+-
+-                    /*
+-                     * 4554571: increment pointers using the scanline stride
+-                     * in pixel units (not byte units)
+-                     */
+-                    cdataP += dstRasterP->scanlineStride;
+-                    sdataP += srcRasterP->scanlineStride;
+-                }
++                retStatus = lookupShortData(src, dst, &jtable[0]);
+             }
+         }
+         /* How about ddata == null? */
+     } else if ((status = (*sMlibFns[MLIB_LOOKUP].fptr)(dst, src,
+-                                      (void **)table) != MLIB_SUCCESS)) {
++                                      (void **)mlib_lookupTable) != MLIB_SUCCESS)) {
+         printMedialibError(status);
+         retStatus = 0;
+     }
+@@ -1677,8 +1720,8 @@
+ 
+     /* Release the LUT */
+     for (i=0; i < lut_nbands; i++) {
+-        (*env)->ReleasePrimitiveArrayCritical(env, jtable[i],
+-                                              (jbyte *) table[i], JNI_ABORT);
++        (*env)->ReleasePrimitiveArrayCritical(env, jtable[i].jArray,
++                                              (jbyte *) jtable[i].table, JNI_ABORT);
+     }
+ 
+     /* Release the pinned memory */
+diff --git a/src/share/native/sun/awt/medialib/mlib_ImageCreate.c b/src/share/native/sun/awt/medialib/mlib_ImageCreate.c
+--- jdk/src/share/native/sun/awt/medialib/mlib_ImageCreate.c
++++ jdk/src/share/native/sun/awt/medialib/mlib_ImageCreate.c
+@@ -160,27 +160,46 @@
+ /* Check if stride == width
+    * If it is then image can be treated as a 1-D vector
+  */
++
++  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;
+       mask = 7;
+       break;
+     case MLIB_FLOAT:
+     case MLIB_INT:
+-      wb = width * channels * 4;
++      if (!SAFE_TO_MULT(wb, 4)) {
++        return NULL;
++      }
++      wb *= 4;
+       mask = 3;
+       break;
+     case MLIB_USHORT:
+     case MLIB_SHORT:
+-      wb = width * channels * 2;
++      if (!SAFE_TO_MULT(wb, 2)) {
++        return NULL;
++      }
++      wb *= 2;
+       mask = 1;
+       break;
+     case MLIB_BYTE:
+-      wb = width * channels;
++      // wb is ready
+       mask = 0;
+       break;
+     case MLIB_BIT:
+-      wb = (width * channels + 7) / 8;
++      if (!SAFE_TO_ADD(7, wb)) {
++        return NULL;
++      }
++      wb = (wb + 7) / 8;
+       mask = 0;
+       break;
+     default:
+@@ -270,7 +289,7 @@
+       break;
+     case MLIB_USHORT:
+     case MLIB_SHORT:
+-      if (!SAFE_TO_MULT(wb, 4)) {
++      if (!SAFE_TO_MULT(wb, 2)) {
+         return NULL;
+       }
+       wb *= 2;

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8011248-better_component_rasters.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8011248-better_component_rasters.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8011248-better_component_rasters.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,51 @@
+# HG changeset patch
+# User prr
+# Date 1365450069 25200
+# Node ID 7024e2f3b69c998420d5d765c056048b8b6b5c2b
+# Parent  8d4760ec16ecfc5abb647dfb1a28d5b3c01f6a12
+8011248: Better Component Rasters
+Reviewed-by: bae, vadim, mschoene
+
+diff --git a/src/share/classes/sun/awt/image/IntegerComponentRaster.java b/src/share/classes/sun/awt/image/IntegerComponentRaster.java
+--- jdk/src/share/classes/sun/awt/image/IntegerComponentRaster.java
++++ jdk/src/share/classes/sun/awt/image/IntegerComponentRaster.java
+@@ -654,9 +654,6 @@
+                                             ") must be >= 0");
+         }
+ 
+-        int maxSize = 0;
+-        int size;
+-
+         // we can be sure that width and height are greater than 0
+         if (scanlineStride < 0 ||
+             scanlineStride > (Integer.MAX_VALUE / height))
+@@ -682,21 +679,23 @@
+         }
+         lastPixelOffset += lastScanOffset;
+ 
++        int index;
++        int maxIndex = 0;
+         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];
++            index = lastPixelOffset + dataOffsets[i];
+ 
+-            if (size > maxSize) {
+-                maxSize = size;
++            if (index > maxIndex) {
++                maxIndex = index;
+             }
+         }
+-        if (data.length < maxSize) {
+-            throw new RasterFormatException("Data array too small (should be "
+-                    + maxSize + " )");
++        if (data.length <= maxIndex) {
++            throw new RasterFormatException("Data array too small (should be > "
++                    + maxIndex + " )");
+         }
+     }
+ 

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8011253-better_short_component_rasters.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8011253-better_short_component_rasters.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8011253-better_short_component_rasters.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,140 @@
+# HG changeset patch
+# User prr
+# Date 1365450380 25200
+# Node ID 02f545e014b0b73094bd295643f8b33965fe8bcf
+# Parent  7024e2f3b69c998420d5d765c056048b8b6b5c2b
+8011253: Better Short Component Rasters
+Reviewed-by: bae, vadim, mschoene
+
+diff --git a/src/share/classes/sun/awt/image/ShortBandedRaster.java b/src/share/classes/sun/awt/image/ShortBandedRaster.java
+--- jdk/src/share/classes/sun/awt/image/ShortBandedRaster.java
++++ jdk/src/share/classes/sun/awt/image/ShortBandedRaster.java
+@@ -156,7 +156,7 @@
+             throw new RasterFormatException("ShortBandedRasters must have "+
+                 "BandedSampleModels");
+         }
+-        verify(false);
++        verify();
+     }
+ 
+     /**
+@@ -730,16 +730,30 @@
+     }
+ 
+     /**
+-     * 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.
++     * Verify that the layout parameters are consistent with the data.
++     * Verifies whether the data buffer has enough data for the raster,
++     * taking into account offsets, after ensuring all offsets are >=0.
++     * @throws RasterFormatException if a problem is detected.
+      */
+-    private void verify (boolean strictCheck) {
++    private 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 (scanlineStride < 0 ||
++            scanlineStride > (Integer.MAX_VALUE / height))
++        {
++            // integer overflow
++            throw new RasterFormatException("Incorrect scanline stride: "
++                    + scanlineStride);
++        }
++
+         // Make sure data for Raster is in a legal range
+         for (int i=0; i < dataOffsets.length; i++) {
+             if (dataOffsets[i] < 0) {
+@@ -749,19 +763,28 @@
+             }
+         }
+ 
+-        int maxSize = 0;
+-        int size;
++        int lastScanOffset = (height - 1) * scanlineStride;
++        int lastPixelOffset = lastScanOffset + (width-1);
++        if (lastPixelOffset < lastScanOffset) {
++            throw new RasterFormatException("Invalid raster dimension");
++        }
++
++        int maxIndex = 0;
++        int index;
+ 
+         for (int i=0; i < numDataElements; i++) {
+-            size = (height-1)*scanlineStride + (width-1) + dataOffsets[i];
+-            if (size > maxSize) {
+-                maxSize = size;
++            index = lastPixelOffset + dataOffsets[i];
++            if (index < lastPixelOffset) {
++                throw new RasterFormatException("Invalid raster dimension");
++            }
++            if (index > maxIndex) {
++                maxIndex = index;
+             }
+         }
+         for (int i=0; i < numDataElements; i++) {
+-            if (data[i].length < maxSize) {
+-                throw new RasterFormatException("Data array too small (should be "+
+-                                                maxSize+" )");
++            if (data[i].length <= maxIndex) {
++                throw new RasterFormatException("Data array too small " +
++                      "(should be > "+ maxIndex+" )");
+             }
+         }
+     }
+diff --git a/src/share/classes/sun/awt/image/ShortComponentRaster.java b/src/share/classes/sun/awt/image/ShortComponentRaster.java
+--- jdk/src/share/classes/sun/awt/image/ShortComponentRaster.java
++++ jdk/src/share/classes/sun/awt/image/ShortComponentRaster.java
+@@ -819,9 +819,6 @@
+             }
+         }
+ 
+-        int maxSize = 0;
+-        int size;
+-
+         // we can be sure that width and height are greater than 0
+         if (scanlineStride < 0 ||
+             scanlineStride > (Integer.MAX_VALUE / height))
+@@ -847,21 +844,23 @@
+         }
+         lastPixelOffset += lastScanOffset;
+ 
++        int index;
++        int maxIndex = 0;
+         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];
++            index = lastPixelOffset + dataOffsets[i];
+ 
+-            if (size > maxSize) {
+-                maxSize = size;
++            if (index > maxIndex) {
++                maxIndex = index;
+             }
+         }
+-        if (data.length < maxSize) {
+-            throw new RasterFormatException("Data array too small (should be "
+-                    + maxSize + " )");
++        if (data.length <= maxIndex) {
++            throw new RasterFormatException("Data array too small (should be > "
++                    + maxIndex + " )");
+         }
+     }
+ 

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8011257-better_byte_component_rasters.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8011257-better_byte_component_rasters.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8011257-better_byte_component_rasters.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,157 @@
+# HG changeset patch
+# User prr
+# Date 1365450499 25200
+# Node ID b606e9565b5d9deed95c621829673ae930e7d596
+# Parent  02f545e014b0b73094bd295643f8b33965fe8bcf
+8011257: Better Byte Component Rasters
+Reviewed-by: bae, vadim, mschoene
+
+diff --git a/src/share/classes/sun/awt/image/ByteBandedRaster.java b/src/share/classes/sun/awt/image/ByteBandedRaster.java
+--- jdk/src/share/classes/sun/awt/image/ByteBandedRaster.java
++++ jdk/src/share/classes/sun/awt/image/ByteBandedRaster.java
+@@ -159,7 +159,7 @@
+             throw new RasterFormatException("ByteBandedRasters must have"+
+                 "BandedSampleModels");
+         }
+-        verify(false);
++        verify();
+     }
+ 
+ 
+@@ -731,16 +731,30 @@
+     }
+ 
+     /**
+-     * 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.
++     * Verify that the layout parameters are consistent with the data.
++     * Verifies whether the data buffer has enough data for the raster,
++     * taking into account offsets, after ensuring all offsets are >=0.
++     * @throws RasterFormatException if a problem is detected.
+      */
+-    private void verify (boolean strictCheck) {
++    private 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 (scanlineStride < 0 ||
++            scanlineStride > (Integer.MAX_VALUE / height))
++        {
++            // integer overflow
++            throw new RasterFormatException("Incorrect scanline stride: "
++                    + scanlineStride);
++        }
++
+         // Make sure data for Raster is in a legal range
+         for (int i=0; i < dataOffsets.length; i++) {
+             if (dataOffsets[i] < 0) {
+@@ -750,32 +764,41 @@
+             }
+         }
+ 
+-        int maxSize = 0;
+-        int size;
++        int lastScanOffset = (height - 1) * scanlineStride;
++        int lastPixelOffset = lastScanOffset + (width-1);
++        if (lastPixelOffset < lastScanOffset) {
++            throw new RasterFormatException("Invalid raster dimension");
++        }
++
++        int maxIndex = 0;
++        int index;
+ 
+         for (int i=0; i < numDataElements; i++) {
+-            size = (height-1)*scanlineStride + (width-1) + dataOffsets[i];
+-            if (size > maxSize) {
+-                maxSize = size;
++            index = lastPixelOffset + dataOffsets[i];
++            if (index < lastPixelOffset) {
++                throw new RasterFormatException("Invalid raster dimension");
++            }
++            if (index > maxIndex) {
++                maxIndex = index;
+             }
+         }
+ 
+         if (data.length == 1) {
+-            if (data[0].length < maxSize*numDataElements) {
++            if (data[0].length <= maxIndex*numDataElements) {
+                 throw new RasterFormatException("Data array too small "+
+                                                 "(it is "+data[0].length+
+-                                                " and should be "+
+-                                                (maxSize*numDataElements)+
++                                                " and should be > "+
++                                                (maxIndex*numDataElements)+
+                                                 " )");
+             }
+         }
+         else {
+             for (int i=0; i < numDataElements; i++) {
+-                if (data[i].length < maxSize) {
++                if (data[i].length <= maxIndex) {
+                     throw new RasterFormatException("Data array too small "+
+                                                     "(it is "+data[i].length+
+-                                                    " and should be "+
+-                                                    maxSize+" )");
++                                                    " and should be > "+
++                                                    maxIndex+" )");
+                 }
+             }
+         }
+diff --git a/src/share/classes/sun/awt/image/ByteComponentRaster.java b/src/share/classes/sun/awt/image/ByteComponentRaster.java
+--- jdk/src/share/classes/sun/awt/image/ByteComponentRaster.java
++++ jdk/src/share/classes/sun/awt/image/ByteComponentRaster.java
+@@ -885,9 +885,6 @@
+             }
+         }
+ 
+-        int maxSize = 0;
+-        int size;
+-
+         // we can be sure that width and height are greater than 0
+         if (scanlineStride < 0 ||
+             scanlineStride > (Integer.MAX_VALUE / height))
+@@ -913,6 +910,8 @@
+         }
+         lastPixelOffset += lastScanOffset;
+ 
++        int index;
++        int maxIndex = 0;
+         for (int i = 0; i < numDataElements; i++) {
+             if (dataOffsets[i] > (Integer.MAX_VALUE - lastPixelOffset)) {
+                 throw new RasterFormatException("Incorrect band offset: "
+@@ -920,15 +919,15 @@
+ 
+             }
+ 
+-            size = lastPixelOffset + dataOffsets[i];
++            index = lastPixelOffset + dataOffsets[i];
+ 
+-            if (size > maxSize) {
+-                maxSize = size;
++            if (index > maxIndex) {
++                maxIndex = index;
+             }
+         }
+-        if (data.length < maxSize) {
+-            throw new RasterFormatException("Data array too small (should be "
+-                    + maxSize + " )");
++        if (data.length <= maxIndex) {
++            throw new RasterFormatException("Data array too small (should be > "
++                    + maxIndex + " )");
+         }
+     }
+ 

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8011557-improve_reflection.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8011557-improve_reflection.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8011557-improve_reflection.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,132 @@
+# HG changeset patch
+# User andrew
+# Date 1371562105 18000
+# Node ID 3b7e8e89595d6f0f967981d3e08fe170fd3898ef
+# Parent  b606e9565b5d9deed95c621829673ae930e7d596
+8011557: Improve reflection utility classes
+Reviewed-by: ahgross, alanb
+
+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
+@@ -2210,7 +2210,7 @@
+                 if (i != -1) {
+                     // 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)) {
++                    if (!Proxy.isProxyClass(this) || ReflectUtil.isNonPublicProxyClass(this)) {
+                         s.checkPackageAccess(pkg);
+                     }
+                 }
+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
+@@ -300,13 +300,11 @@
+                 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;
++            if (ReflectUtil.isNonPublicProxyClass(proxyClass)) {
++                for (Class<?> intf : proxyClass.getInterfaces()) {
++                    if (!Modifier.isPublic(intf.getModifiers())) {
++                        return true;
++                    }
+                 }
+             }
+             return false;
+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
+@@ -27,6 +27,7 @@
+ package sun.reflect.misc;
+ 
+ import java.lang.reflect.Modifier;
++import java.lang.reflect.Proxy;
+ import sun.reflect.Reflection;
+ 
+ public final class ReflectUtil {
+@@ -123,10 +124,26 @@
+     }
+ 
+ 
+-    public static void checkPackageAccess(Class clazz) {
++    /**
++     * Checks package access on the given class.
++     *
++     * If it is a {@link Proxy#isProxyClass(java.lang.Class)} that implements
++     * a non-public interface (i.e. may be in a non-restricted package),
++     * also check the package access on the proxy interfaces.
++     */
++    public static void checkPackageAccess(Class<?> clazz) {
+         checkPackageAccess(clazz.getName());
++        if (isNonPublicProxyClass(clazz)) {
++            checkProxyPackageAccess(clazz);
++        }
+     }
+ 
++    /**
++     * Checks package access on the given classname.
++     * This method is typically called when the Class instance is not
++     * available and the caller attempts to load a class on behalf
++     * the true caller (application).
++     */
+     public static void checkPackageAccess(String name) {
+         SecurityManager s = System.getSecurityManager();
+         if (s != null) {
+@@ -188,13 +205,30 @@
+     }
+ 
+     /**
++     * Check package access on the proxy interfaces that the given proxy class
++     * implements.
++     *
++     * @param clazz Proxy class object
++     */
++    public static void checkProxyPackageAccess(Class<?> clazz) {
++        SecurityManager s = System.getSecurityManager();
++        if (s != null) {
++            // check proxy interfaces if the given class is a proxy class
++            if (Proxy.isProxyClass(clazz)) {
++                for (Class<?> intf : clazz.getInterfaces()) {
++                    checkPackageAccess(intf);
++                }
++            }
++        }
++    }
++
++    /**
+      * Access check on the interfaces that a proxy class implements and throw
+-     * {@code SecurityException} if it accesses a restricted package.
++     * {@code SecurityException} if it accesses a restricted package from
++     * the caller's class loader.
+      *
+      * @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)
+@@ -211,4 +245,16 @@
+     }
+ 
+     public static final String PROXY_PACKAGE = "sun.proxy";
++
++    /**
++     * Test if the given class is a proxy class that implements
++     * non-public interface.  Such proxy class may be in a non-restricted
++     * package that bypasses checkPackageAccess.
++     */
++    public static boolean isNonPublicProxyClass(Class<?> cls) {
++        String name = cls.getName();
++        int i = name.lastIndexOf('.');
++        String pkg = (i != -1) ? name.substring(0, i) : "";
++        return Proxy.isProxyClass(cls) && !pkg.equals(PROXY_PACKAGE);
++    }
+ }

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8012375-javadoc_framing.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8012375-javadoc_framing.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8012375-javadoc_framing.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,61 @@
+# HG changeset patch
+# User andrew
+# Date 1371731018 18000
+# Node ID b4954380fa25058f1a6cfb9cb96f78d90cf0fc5c
+# Parent  445134ee98c84b6d139fab0f9a9d8718c686c63b
+8012375: Improve Javadoc framing
+Reviewed-by: mduigou, jlaskey
+
+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
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 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
+@@ -309,8 +309,41 @@
+         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 +
++                "    if (targetPage.indexOf(\":\") != -1 || (targetPage != \"\" && !validURL(targetPage)))" + DocletConstants.NL +
+                 "        targetPage = \"undefined\";" + DocletConstants.NL +
++                "    function validURL(url) {" + DocletConstants.NL +
++                "        if (!(url.indexOf(\".html\") == url.length - 5))" + DocletConstants.NL +
++                "            return false;" + DocletConstants.NL +
++                "        var allowNumber = false;" + DocletConstants.NL +
++                "        var allowSep = false;" + DocletConstants.NL +
++                "        var seenDot = false;" + DocletConstants.NL +
++                "        for (var i = 0; i < url.length - 5; i++) {" + DocletConstants.NL +
++                "            var ch = url.charAt(i);" + DocletConstants.NL +
++                "            if ('a' <= ch && ch <= 'z' ||" + DocletConstants.NL +
++                "                    'A' <= ch && ch <= 'Z' ||" + DocletConstants.NL +
++                "                    ch == '$' ||" + DocletConstants.NL +
++                "                    ch == '_') {" + DocletConstants.NL +
++                "                allowNumber = true;" + DocletConstants.NL +
++                "                allowSep = true;" + DocletConstants.NL +
++                "            } else if ('0' <= ch && ch <= '9'" + DocletConstants.NL +
++                "                    || ch == '-') {" + DocletConstants.NL +
++                "                if (!allowNumber)" + DocletConstants.NL +
++                "                     return false;" + DocletConstants.NL +
++                "            } else if (ch == '/' || ch == '.') {" + DocletConstants.NL +
++                "                if (!allowSep)" + DocletConstants.NL +
++                "                    return false;" + DocletConstants.NL +
++                "                allowNumber = false;" + DocletConstants.NL +
++                "                allowSep = false;" + DocletConstants.NL +
++                "                if (ch == '.')" + DocletConstants.NL +
++                "                     seenDot = true;" + DocletConstants.NL +
++                "                if (ch == '/' && seenDot)" + DocletConstants.NL +
++                "                     return false;" + DocletConstants.NL +
++                "            } else {" + DocletConstants.NL +
++                "                return false;"+ DocletConstants.NL +
++                "            }" + DocletConstants.NL +
++                "        }" + DocletConstants.NL +
++                "        return true;" + DocletConstants.NL +
++                "    }" + DocletConstants.NL +
+                 "    function loadFrames() {" + DocletConstants.NL +
+                 "        if (targetPage != \"\" && targetPage != \"undefined\")" + DocletConstants.NL +
+                 "             top.classFrame.location = top.targetPage;" + DocletConstants.NL +

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8012421-better_positioning.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8012421-better_positioning.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8012421-better_positioning.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,100 @@
+# HG changeset patch
+# User prr
+# Date 1366411203 25200
+# Node ID 92ad159889b19b66a64cd3c89b628132fe089354
+# Parent  3b7e8e89595d6f0f967981d3e08fe170fd3898ef
+8012421: Better positioning of PairPositioning
+Reviewed-by: srl, mschoene, vadim
+
+diff --git a/src/share/native/sun/font/layout/PairPositioningSubtables.cpp b/src/share/native/sun/font/layout/PairPositioningSubtables.cpp
+--- jdk/src/share/native/sun/font/layout/PairPositioningSubtables.cpp
++++ jdk/src/share/native/sun/font/layout/PairPositioningSubtables.cpp
+@@ -76,23 +76,30 @@
+ {
+     LEGlyphID firstGlyph = glyphIterator->getCurrGlyphID();
+     le_int32 coverageIndex = getGlyphCoverage(base, firstGlyph, success);
++
++    if (LE_FAILURE(success)) {
++      return 0;
++    }
+     GlyphIterator tempIterator(*glyphIterator);
+ 
+     if (coverageIndex >= 0 && glyphIterator->next()) {
+         Offset pairSetTableOffset = SWAPW(pairSetTableOffsetArray[coverageIndex]);
+-        PairSetTable *pairSetTable = (PairSetTable *) ((char *) this + pairSetTableOffset);
++        LEReferenceTo<PairSetTable> pairSetTable(base, success, ((char *) this + pairSetTableOffset));
++        if (LE_FAILURE(success)) {
++          return 0;
++        }
+         le_uint16 pairValueCount = SWAPW(pairSetTable->pairValueCount);
+         le_int16 valueRecord1Size = ValueRecord::getSize(SWAPW(valueFormat1));
+         le_int16 valueRecord2Size = ValueRecord::getSize(SWAPW(valueFormat2));
+         le_int16 recordSize = sizeof(PairValueRecord) - sizeof(ValueRecord) + valueRecord1Size + valueRecord2Size;
+         LEGlyphID secondGlyph = glyphIterator->getCurrGlyphID();
+-        const PairValueRecord *pairValueRecord = NULL;
++        LEReferenceTo<PairValueRecord> pairValueRecord;
+ 
+         if (pairValueCount != 0) {
+-            pairValueRecord = findPairValueRecord((TTGlyphID) LE_GET_GLYPH(secondGlyph), pairSetTable->pairValueRecordArray, pairValueCount, recordSize);
++            pairValueRecord = findPairValueRecord(base, (TTGlyphID) LE_GET_GLYPH(secondGlyph), pairSetTable->pairValueRecordArray, pairValueCount, recordSize, success);
+         }
+ 
+-        if (pairValueRecord == NULL) {
++        if (pairValueRecord.isEmpty()) {
+             return 0;
+         }
+ 
+@@ -154,22 +161,26 @@
+     return 0;
+ }
+ 
+-const PairValueRecord *PairPositioningFormat1Subtable::findPairValueRecord(TTGlyphID glyphID, const PairValueRecord *records, le_uint16 recordCount, le_uint16 recordSize) const
++LEReferenceTo<PairValueRecord> PairPositioningFormat1Subtable::findPairValueRecord(const LETableReference &base, TTGlyphID glyphID, const PairValueRecord *records, le_uint16 recordCount, le_uint16 recordSize, LEErrorCode &success) const
+ {
+ #if 1
+         // The OpenType spec. says that the ValueRecord table is
+         // sorted by secondGlyph. Unfortunately, there are fonts
+         // around that have an unsorted ValueRecord table.
+-        const PairValueRecord *record = records;
++        LEReferenceTo<PairValueRecord> record(base, success, records);
++        record.verifyLength(0, recordSize, success);
+ 
+         for(le_int32 r = 0; r < recordCount; r += 1) {
++           if (LE_FAILURE(success)) return (const PairValueRecord*)NULL;
+                 if (SWAPW(record->secondGlyph) == glyphID) {
+                         return record;
+                 }
+ 
+-                record = (const PairValueRecord *) ((char *) record + recordSize);
++                record =  LEReferenceTo<PairValueRecord>(base, success, ((const char*)record.getAlias())+ recordSize);
++                record.verifyLength(0, recordSize, success);
+         }
+ #else
++  #error dead code - not updated.
+     le_uint8 bit = OpenTypeUtilities::highBit(recordCount);
+     le_uint16 power = 1 << bit;
+     le_uint16 extra = (recordCount - power) * recordSize;
+@@ -195,7 +206,7 @@
+     }
+ #endif
+ 
+-    return NULL;
++    return (const PairValueRecord*)NULL;
+ }
+ 
+ U_NAMESPACE_END
+diff --git a/src/share/native/sun/font/layout/PairPositioningSubtables.h b/src/share/native/sun/font/layout/PairPositioningSubtables.h
+--- jdk/src/share/native/sun/font/layout/PairPositioningSubtables.h
++++ jdk/src/share/native/sun/font/layout/PairPositioningSubtables.h
+@@ -77,8 +77,9 @@
+     le_uint32  process(const LEReferenceTo<PairPositioningFormat1Subtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const;
+ 
+ private:
+-    const PairValueRecord *findPairValueRecord(TTGlyphID glyphID, const PairValueRecord *records,
+-        le_uint16 recordCount, le_uint16 recordSize) const;
++    LEReferenceTo<PairValueRecord> findPairValueRecord(const LETableReference &base, TTGlyphID glyphID, const PairValueRecord *records,
++        le_uint16 recordCount, le_uint16 recordSize, LEErrorCode &success) const;
++
+ };
+ LE_VAR_ARRAY(PairPositioningFormat1Subtable, pairSetTableOffsetArray)
+ 

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8012438-better_image_validation.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8012438-better_image_validation.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8012438-better_image_validation.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,283 @@
+# HG changeset patch
+# User bae
+# Date 1366802624 -14400
+# Node ID 63028eef41bcd0e7ea49d333dc25ad27cd5e33a4
+# Parent  92ad159889b19b66a64cd3c89b628132fe089354
+8012438: Better image validation
+Reviewed-by: mschoene, prr, vadim
+
+diff --git a/src/share/classes/java/awt/image/ComponentSampleModel.java b/src/share/classes/java/awt/image/ComponentSampleModel.java
+--- jdk/src/share/classes/java/awt/image/ComponentSampleModel.java
++++ jdk/src/share/classes/java/awt/image/ComponentSampleModel.java
+@@ -148,7 +148,7 @@
+         this.pixelStride = pixelStride;
+         this.scanlineStride  = scanlineStride;
+         this.bandOffsets = (int[])bandOffsets.clone();
+-        numBands = bandOffsets.length;
++        numBands = this.bandOffsets.length;
+         if (pixelStride < 0) {
+             throw new IllegalArgumentException("Pixel stride must be >= 0");
+         }
+@@ -223,24 +223,24 @@
+             (dataType > DataBuffer.TYPE_DOUBLE)) {
+             throw new IllegalArgumentException("Unsupported dataType.");
+         }
+-        int maxBank = bankIndices[0];
++        int maxBank = this.bankIndices[0];
+         if (maxBank < 0) {
+             throw new IllegalArgumentException("Index of bank 0 is less than "+
+                                                "0 ("+maxBank+")");
+         }
+-        for (int i=1; i < bankIndices.length; i++) {
+-            if (bankIndices[i] > maxBank) {
+-                maxBank = bankIndices[i];
++        for (int i=1; i < this.bankIndices.length; i++) {
++            if (this.bankIndices[i] > maxBank) {
++                maxBank = this.bankIndices[i];
+             }
+-            else if (bankIndices[i] < 0) {
++            else if (this.bankIndices[i] < 0) {
+                 throw new IllegalArgumentException("Index of bank "+i+
+                                                    " is less than 0 ("+
+                                                    maxBank+")");
+             }
+         }
+         numBanks         = maxBank+1;
+-        numBands         = bandOffsets.length;
+-        if (bandOffsets.length != bankIndices.length) {
++        numBands         = this.bandOffsets.length;
++        if (this.bandOffsets.length != this.bankIndices.length) {
+             throw new IllegalArgumentException("Length of bandOffsets must "+
+                                                "equal length of bankIndices.");
+         }
+diff --git a/src/share/classes/java/awt/image/PixelInterleavedSampleModel.java b/src/share/classes/java/awt/image/PixelInterleavedSampleModel.java
+--- jdk/src/share/classes/java/awt/image/PixelInterleavedSampleModel.java
++++ jdk/src/share/classes/java/awt/image/PixelInterleavedSampleModel.java
+@@ -85,11 +85,11 @@
+                                        int scanlineStride,
+                                        int bandOffsets[]) {
+         super(dataType, w, h, pixelStride, scanlineStride, bandOffsets);
+-        int minBandOff=bandOffsets[0];
+-        int maxBandOff=bandOffsets[0];
+-        for (int i=1; i<bandOffsets.length; i++) {
+-            minBandOff = Math.min(minBandOff,bandOffsets[i]);
+-            maxBandOff = Math.max(maxBandOff,bandOffsets[i]);
++        int minBandOff=this.bandOffsets[0];
++        int maxBandOff=this.bandOffsets[0];
++        for (int i=1; i<this.bandOffsets.length; i++) {
++            minBandOff = Math.min(minBandOff,this.bandOffsets[i]);
++            maxBandOff = Math.max(maxBandOff,this.bandOffsets[i]);
+         }
+         maxBandOff -= minBandOff;
+         if (maxBandOff > scanlineStride) {
+diff --git a/src/share/classes/java/awt/image/Raster.java b/src/share/classes/java/awt/image/Raster.java
+--- jdk/src/share/classes/java/awt/image/Raster.java
++++ jdk/src/share/classes/java/awt/image/Raster.java
+@@ -257,15 +257,10 @@
+                                                          int bandOffsets[],
+                                                          Point location) {
+         DataBuffer d;
+-        int bands = bandOffsets.length;
+ 
+-        int maxBandOff = bandOffsets[0];
+-        for (int i=1; i < bands; i++) {
+-            if (bandOffsets[i] > maxBandOff) {
+-                maxBandOff = bandOffsets[i];
+-            }
+-        }
+-        int size = maxBandOff + scanlineStride*(h-1) + pixelStride*(w-1) + 1;
++        int size = scanlineStride * (h - 1) + // fisrt (h - 1) scans
++            pixelStride * w; // last scan
++
+         switch(dataType) {
+         case DataBuffer.TYPE_BYTE:
+             d = new DataBufferByte(size);
+@@ -397,7 +392,8 @@
+             }
+         }
+         int banks = maxBank + 1;
+-        int size = maxBandOff + scanlineStride*(h-1) + (w-1) + 1;
++        int size = scanlineStride * (h - 1) + // fisrt (h - 1) scans
++            w; // last scan
+ 
+         switch(dataType) {
+         case DataBuffer.TYPE_BYTE:
+diff --git a/src/share/classes/sun/awt/image/ByteBandedRaster.java b/src/share/classes/sun/awt/image/ByteBandedRaster.java
+--- jdk/src/share/classes/sun/awt/image/ByteBandedRaster.java
++++ jdk/src/share/classes/sun/awt/image/ByteBandedRaster.java
+@@ -755,6 +755,13 @@
+                     + scanlineStride);
+         }
+ 
++        for (int i = 0; i < data.length; i++) {
++            if (scanlineStride > data[i].length) {
++                throw new RasterFormatException("Incorrect scanline stride: "
++                    + scanlineStride);
++            }
++        }
++
+         // Make sure data for Raster is in a legal range
+         for (int i=0; i < dataOffsets.length; i++) {
+             if (dataOffsets[i] < 0) {
+@@ -765,19 +772,20 @@
+         }
+ 
+         int lastScanOffset = (height - 1) * scanlineStride;
+-        int lastPixelOffset = lastScanOffset + (width-1);
+-        if (lastPixelOffset < lastScanOffset) {
++
++        if ((width - 1) > (Integer.MAX_VALUE - lastScanOffset)) {
+             throw new RasterFormatException("Invalid raster dimension");
+         }
++        int lastPixelOffset = lastScanOffset + (width-1);
+ 
+         int maxIndex = 0;
+         int index;
+ 
+         for (int i=0; i < numDataElements; i++) {
+-            index = lastPixelOffset + dataOffsets[i];
+-            if (index < lastPixelOffset) {
++            if (dataOffsets[i] > (Integer.MAX_VALUE - lastPixelOffset)) {
+                 throw new RasterFormatException("Invalid raster dimension");
+             }
++            index = lastPixelOffset + dataOffsets[i];
+             if (index > maxIndex) {
+                 maxIndex = index;
+             }
+diff --git a/src/share/classes/sun/awt/image/ByteComponentRaster.java b/src/share/classes/sun/awt/image/ByteComponentRaster.java
+--- jdk/src/share/classes/sun/awt/image/ByteComponentRaster.java
++++ jdk/src/share/classes/sun/awt/image/ByteComponentRaster.java
+@@ -887,7 +887,8 @@
+ 
+         // we can be sure that width and height are greater than 0
+         if (scanlineStride < 0 ||
+-            scanlineStride > (Integer.MAX_VALUE / height))
++            scanlineStride > (Integer.MAX_VALUE / height) ||
++            scanlineStride > data.length)
+         {
+             // integer overflow
+             throw new RasterFormatException("Incorrect scanline stride: "
+@@ -896,7 +897,8 @@
+         int lastScanOffset = (height - 1) * scanlineStride;
+ 
+         if (pixelStride < 0 ||
+-            pixelStride > (Integer.MAX_VALUE / width))
++            pixelStride > (Integer.MAX_VALUE / width) ||
++            pixelStride > data.length)
+         {
+             // integer overflow
+             throw new RasterFormatException("Incorrect pixel stride: "
+diff --git a/src/share/classes/sun/awt/image/BytePackedRaster.java b/src/share/classes/sun/awt/image/BytePackedRaster.java
+--- jdk/src/share/classes/sun/awt/image/BytePackedRaster.java
++++ jdk/src/share/classes/sun/awt/image/BytePackedRaster.java
+@@ -1387,7 +1387,8 @@
+         }
+ 
+         if (scanlineStride < 0 ||
+-            scanlineStride > (Integer.MAX_VALUE / height))
++            scanlineStride > (Integer.MAX_VALUE / height) ||
++            scanlineStride > data.length)
+         {
+             throw new RasterFormatException("Invalid scanline stride");
+         }
+diff --git a/src/share/classes/sun/awt/image/IntegerComponentRaster.java b/src/share/classes/sun/awt/image/IntegerComponentRaster.java
+--- jdk/src/share/classes/sun/awt/image/IntegerComponentRaster.java
++++ jdk/src/share/classes/sun/awt/image/IntegerComponentRaster.java
+@@ -656,7 +656,8 @@
+ 
+         // we can be sure that width and height are greater than 0
+         if (scanlineStride < 0 ||
+-            scanlineStride > (Integer.MAX_VALUE / height))
++            scanlineStride > (Integer.MAX_VALUE / height) ||
++            scanlineStride > data.length)
+         {
+             // integer overflow
+             throw new RasterFormatException("Incorrect scanline stride: "
+@@ -665,7 +666,8 @@
+         int lastScanOffset = (height - 1) * scanlineStride;
+ 
+         if (pixelStride < 0 ||
+-            pixelStride > (Integer.MAX_VALUE / width))
++            pixelStride > (Integer.MAX_VALUE / width) ||
++            pixelStride > data.length)
+         {
+             // integer overflow
+             throw new RasterFormatException("Incorrect pixel stride: "
+diff --git a/src/share/classes/sun/awt/image/ShortBandedRaster.java b/src/share/classes/sun/awt/image/ShortBandedRaster.java
+--- jdk/src/share/classes/sun/awt/image/ShortBandedRaster.java
++++ jdk/src/share/classes/sun/awt/image/ShortBandedRaster.java
+@@ -754,6 +754,13 @@
+                     + scanlineStride);
+         }
+ 
++        for (int i = 0; i < data.length; i++) {
++            if (scanlineStride > data[i].length) {
++                throw new RasterFormatException("Incorrect scanline stride: "
++                    + scanlineStride);
++            }
++        }
++
+         // Make sure data for Raster is in a legal range
+         for (int i=0; i < dataOffsets.length; i++) {
+             if (dataOffsets[i] < 0) {
+@@ -764,19 +771,19 @@
+         }
+ 
+         int lastScanOffset = (height - 1) * scanlineStride;
+-        int lastPixelOffset = lastScanOffset + (width-1);
+-        if (lastPixelOffset < lastScanOffset) {
++        if ((width - 1) > (Integer.MAX_VALUE - lastScanOffset)) {
+             throw new RasterFormatException("Invalid raster dimension");
+         }
++        int lastPixelOffset = lastScanOffset + (width - 1);
+ 
+         int maxIndex = 0;
+         int index;
+ 
+         for (int i=0; i < numDataElements; i++) {
+-            index = lastPixelOffset + dataOffsets[i];
+-            if (index < lastPixelOffset) {
++            if (dataOffsets[i] > (Integer.MAX_VALUE - lastPixelOffset)) {
+                 throw new RasterFormatException("Invalid raster dimension");
+             }
++            index = lastPixelOffset + dataOffsets[i];
+             if (index > maxIndex) {
+                 maxIndex = index;
+             }
+diff --git a/src/share/classes/sun/awt/image/ShortComponentRaster.java b/src/share/classes/sun/awt/image/ShortComponentRaster.java
+--- jdk/src/share/classes/sun/awt/image/ShortComponentRaster.java
++++ jdk/src/share/classes/sun/awt/image/ShortComponentRaster.java
+@@ -821,7 +821,8 @@
+ 
+         // we can be sure that width and height are greater than 0
+         if (scanlineStride < 0 ||
+-            scanlineStride > (Integer.MAX_VALUE / height))
++            scanlineStride > (Integer.MAX_VALUE / height) ||
++            scanlineStride > data.length)
+         {
+             // integer overflow
+             throw new RasterFormatException("Incorrect scanline stride: "
+@@ -830,7 +831,8 @@
+         int lastScanOffset = (height - 1) * scanlineStride;
+ 
+         if (pixelStride < 0 ||
+-            pixelStride > (Integer.MAX_VALUE / width))
++            pixelStride > (Integer.MAX_VALUE / width) ||
++            pixelStride > data.length)
+         {
+             // integer overflow
+             throw new RasterFormatException("Incorrect pixel stride: "
+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
+@@ -1177,6 +1177,10 @@
+ 
+     static int indexes[NLUT] = INDEXES;
+ 
++    if (src->width != dst->width || src->height != dst->height) {
++        return 0;
++    }
++
+     for (y=0; y < src->height; y++) {
+         int nloop, nx;
+         int npix = src->width;

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8012597-better_image_channel_validation.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8012597-better_image_channel_validation.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8012597-better_image_channel_validation.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,597 @@
+# HG changeset patch
+# User bae
+# Date 1367281246 -14400
+# Node ID 940eac3712db0f139069d1048f021f0e70cbbb3a
+# Parent  63028eef41bcd0e7ea49d333dc25ad27cd5e33a4
+8012597: Better image channel verification
+Reviewed-by: ahgross, vadim, prr
+
+diff --git a/src/share/classes/java/awt/image/BufferedImage.java b/src/share/classes/java/awt/image/BufferedImage.java
+--- jdk/src/share/classes/java/awt/image/BufferedImage.java
++++ jdk/src/share/classes/java/awt/image/BufferedImage.java
+@@ -654,17 +654,19 @@
+         int csType = cs.getType();
+         if (csType != ColorSpace.TYPE_RGB) {
+             if (csType == ColorSpace.TYPE_GRAY
+-                && cm instanceof ComponentColorModel) {
++                && ComponentColorModel.class.equals(cm.getClass())) {
+                 // Check if this might be a child raster (fix for bug 4240596)
+                 if (sm instanceof ComponentSampleModel &&
+                     ((ComponentSampleModel)sm).getPixelStride() != numBands) {
+                     imageType = TYPE_CUSTOM;
+                 } else if (raster instanceof ByteComponentRaster &&
++                       PixelInterleavedSampleModel.class.equals(sm.getClass()) &&
+                        raster.getNumBands() == 1 &&
+                        cm.getComponentSize(0) == 8 &&
+                        ((ByteComponentRaster)raster).getPixelStride() == 1) {
+                     imageType = TYPE_BYTE_GRAY;
+                 } else if (raster instanceof ShortComponentRaster &&
++                       PixelInterleavedSampleModel.class.equals(sm.getClass()) &&
+                        raster.getNumBands() == 1 &&
+                        cm.getComponentSize(0) == 16 &&
+                        ((ShortComponentRaster)raster).getPixelStride() == 1) {
+@@ -684,7 +686,8 @@
+             // are correct
+             int pixSize = cm.getPixelSize();
+             if (iraster.getPixelStride() == 1 &&
+-                cm instanceof DirectColorModel  &&
++                DirectColorModel.class.equals(cm.getClass())  &&
++                SinglePixelPackedSampleModel.class.equals(sm.getClass()) &&
+                 (pixSize == 32 || pixSize == 24))
+             {
+                 // Now check on the DirectColorModel params
+@@ -715,16 +718,21 @@
+                 }  // if (rmask == DCM_BGR_RED_MASK &&
+             }   // if (iraster.getPixelStride() == 1
+         }   // ((raster instanceof IntegerComponentRaster) &&
+-        else if ((cm instanceof IndexColorModel) && (numBands == 1) &&
++        else if ((IndexColorModel.class.equals(cm.getClass())) &&
++                 (numBands == 1) &&
+                  (!cm.hasAlpha() || !isAlphaPre))
+         {
+             IndexColorModel icm = (IndexColorModel) cm;
+             int pixSize = icm.getPixelSize();
+ 
+-            if (raster instanceof BytePackedRaster) {
++            if (raster instanceof BytePackedRaster &&
++                MultiPixelPackedSampleModel.class.equals(sm.getClass()))
++            {
+                 imageType = TYPE_BYTE_BINARY;
+             }   // if (raster instanceof BytePackedRaster)
+-            else if (raster instanceof ByteComponentRaster) {
++            else if (raster instanceof ByteComponentRaster &&
++                     PixelInterleavedSampleModel.class.equals(sm.getClass()))
++            {
+                 ByteComponentRaster braster = (ByteComponentRaster) raster;
+                 if (braster.getPixelStride() == 1 && pixSize <= 8) {
+                     imageType = TYPE_BYTE_INDEXED;
+@@ -732,7 +740,8 @@
+             }
+         }   // else if (cm instanceof IndexColorModel) && (numBands == 1))
+         else if ((raster instanceof ShortComponentRaster)
+-                 && (cm instanceof DirectColorModel)
++                 && (DirectColorModel.class.equals(cm.getClass()))
++                 && (SinglePixelPackedSampleModel.class.equals(sm.getClass()))
+                  && (numBands == 3)
+                  && !cm.hasAlpha())
+         {
+@@ -778,12 +787,14 @@
+             if (is8bit &&
+                 offs[0] == numBands-1 &&
+                 offs[1] == numBands-2 &&
+-                offs[2] == numBands-3)
++                offs[2] == numBands-3 &&
++                ComponentColorModel.class.equals(ccm.getClass()) &&
++                PixelInterleavedSampleModel.class.equals(csm.getClass()))
+             {
+-                if (numBands == 3) {
++                if (numBands == 3 && !ccm.hasAlpha()) {
+                     imageType = TYPE_3BYTE_BGR;
+                 }
+-                else if (offs[3] == 0) {
++                else if (offs[3] == 0 && ccm.hasAlpha()) {
+                     imageType = (isAlphaPre
+                                  ? TYPE_4BYTE_ABGR_PRE
+                                  : TYPE_4BYTE_ABGR);
+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
+@@ -385,10 +385,39 @@
+     return 1;
+ }
+ 
++static int getColorModelType(JNIEnv *env, jobject jcmodel) {
++    int type = UNKNOWN_CM_TYPE;
++
++    if ((*env)->IsInstanceOf(env, jcmodel,
++                 (*env)->FindClass(env, "java/awt/image/IndexColorModel")))
++    {
++        type = INDEX_CM_TYPE;
++    } else if ((*env)->IsInstanceOf(env, jcmodel,
++                 (*env)->FindClass(env, "java/awt/image/PackedColorModel")))
++    {
++        if  ((*env)->IsInstanceOf(env, jcmodel,
++                (*env)->FindClass(env, "java/awt/image/DirectColorModel"))) {
++            type = DIRECT_CM_TYPE;
++        }
++        else {
++            type = PACKED_CM_TYPE;
++        }
++    }
++    else if ((*env)->IsInstanceOf(env, jcmodel,
++                 (*env)->FindClass(env, "java/awt/image/ComponentColorModel")))
++    {
++        type = COMPONENT_CM_TYPE;
++    }
++
++    return type;
++}
++
+ int awt_parseColorModel (JNIEnv *env, jobject jcmodel, int imageType,
+                          ColorModelS_t *cmP) {
+     /*jmethodID jID;   */
+     jobject jnBits;
++    jsize   nBitsLength;
++
+     int i;
+     static jobject s_jdefCM = NULL;
+ 
+@@ -410,15 +439,55 @@
+     cmP->transparency = (*env)->GetIntField(env, jcmodel,
+                                             g_CMtransparencyID);
+ 
++    jnBits = (*env)->GetObjectField(env, jcmodel, g_CMnBitsID);
++    if (jnBits == NULL) {
++        JNU_ThrowNullPointerException(env, "null nBits structure in CModel");
++        return -1;
++    }
++
++    nBitsLength = (*env)->GetArrayLength(env, jnBits);
++    if (nBitsLength != cmP->numComponents) {
++        // invalid number of components?
++        return -1;
++    }
++
++    cmP->nBits = NULL;
++    if (SAFE_TO_ALLOC_2(cmP->numComponents, sizeof(jint))) {
++        cmP->nBits = (jint *)malloc(cmP->numComponents * sizeof(jint));
++    }
++
++    if (cmP->nBits == NULL){
++        JNU_ThrowOutOfMemoryError(env, "Out of memory");
++        return -1;
++    }
++    (*env)->GetIntArrayRegion(env, jnBits, 0, cmP->numComponents,
++                              cmP->nBits);
++    cmP->maxNbits = 0;
++    for (i=0; i < cmP->numComponents; i++) {
++        if (cmP->maxNbits < cmP->nBits[i]) {
++            cmP->maxNbits = cmP->nBits[i];
++        }
++    }
++
++    cmP->is_sRGB = (*env)->GetBooleanField(env, cmP->jcmodel, g_CMis_sRGBID);
++
++    cmP->csType = (*env)->GetIntField(env, cmP->jcmodel, g_CMcsTypeID);
++
++    cmP->cmType = getColorModelType(env, jcmodel);
++
++    cmP->isDefaultCM = FALSE;
++    cmP->isDefaultCompatCM = FALSE;
++
++    /* look for standard cases */
+     if (imageType == java_awt_image_BufferedImage_TYPE_INT_ARGB) {
+         cmP->isDefaultCM = TRUE;
+         cmP->isDefaultCompatCM = TRUE;
+     } else if (imageType == java_awt_image_BufferedImage_TYPE_INT_ARGB_PRE ||
+-             imageType == java_awt_image_BufferedImage_TYPE_INT_RGB) {
+-        cmP->isDefaultCompatCM = TRUE;
+-    } else if (imageType == java_awt_image_BufferedImage_TYPE_INT_BGR ||
++               imageType == java_awt_image_BufferedImage_TYPE_INT_RGB ||
++               imageType == java_awt_image_BufferedImage_TYPE_INT_BGR ||
+                imageType == java_awt_image_BufferedImage_TYPE_4BYTE_ABGR ||
+-               imageType == java_awt_image_BufferedImage_TYPE_4BYTE_ABGR_PRE){
++               imageType == java_awt_image_BufferedImage_TYPE_4BYTE_ABGR_PRE)
++    {
+         cmP->isDefaultCompatCM = TRUE;
+     }
+     else {
+@@ -439,50 +508,25 @@
+         cmP->isDefaultCompatCM = cmP->isDefaultCM;
+     }
+ 
++    /* check whether image attributes correspond to default cm */
+     if (cmP->isDefaultCompatCM) {
+-        cmP->cmType = DIRECT_CM_TYPE;
+-        cmP->nBits = (jint *) malloc(sizeof(jint)*4);
+-        cmP->nBits[0] = cmP->nBits[1] = cmP->nBits[2] = cmP->nBits[3] = 8;
+-        cmP->maxNbits = 8;
+-        cmP->is_sRGB = TRUE;
+-        cmP->csType  = java_awt_color_ColorSpace_TYPE_RGB;
++        if (cmP->csType != java_awt_color_ColorSpace_TYPE_RGB ||
++            !cmP->is_sRGB)
++        {
++            return -1;
++        }
+ 
+-        return 1;
+-    }
+-
+-    jnBits = (*env)->GetObjectField(env, jcmodel, g_CMnBitsID);
+-    if (jnBits == NULL) {
+-        JNU_ThrowNullPointerException(env, "null nBits structure in CModel");
+-        return -1;
+-    }
+-
+-    cmP->nBits = NULL;
+-    if (SAFE_TO_ALLOC_2(cmP->numComponents, sizeof(jint))) {
+-        cmP->nBits = (jint *)malloc(cmP->numComponents * sizeof(jint));
+-    }
+-    if (cmP->nBits == NULL){
+-        JNU_ThrowOutOfMemoryError(env, "Out of memory");
+-        return -1;
+-    }
+-    (*env)->GetIntArrayRegion(env, jnBits, 0, cmP->numComponents,
+-                              cmP->nBits);
+-    cmP->maxNbits = 0;
+-    for (i=0; i < cmP->numComponents; i++) {
+-        if (cmP->maxNbits < cmP->nBits[i]) {
+-            cmP->maxNbits = cmP->nBits[i];
++        for (i = 0; i < cmP->numComponents; i++) {
++            if (cmP->nBits[i] != 8) {
++                return -1;
++            }
+         }
+     }
+ 
+-    cmP->is_sRGB = (*env)->GetBooleanField(env, cmP->jcmodel, g_CMis_sRGBID);
+-
+-    cmP->csType = (*env)->GetIntField(env, cmP->jcmodel, g_CMcsTypeID);
+-
+-    /* Find out what type of colol model */
++    /* Get index color model attributes */
+     if (imageType == java_awt_image_BufferedImage_TYPE_BYTE_INDEXED ||
+-        (*env)->IsInstanceOf(env, jcmodel,
+-                 (*env)->FindClass(env, "java/awt/image/IndexColorModel")))
++        cmP->cmType == INDEX_CM_TYPE)
+     {
+-        cmP->cmType = INDEX_CM_TYPE;
+         cmP->transIdx = (*env)->GetIntField(env, jcmodel, g_ICMtransIdxID);
+         cmP->mapSize = (*env)->GetIntField(env, jcmodel, g_ICMmapSizeID);
+         cmP->jrgb    = (*env)->GetObjectField(env, jcmodel, g_ICMrgbID);
+@@ -508,31 +552,6 @@
+             }
+         }
+     }
+-    else if ((*env)->IsInstanceOf(env, jcmodel,
+-                 (*env)->FindClass(env, "java/awt/image/PackedColorModel")))
+-    {
+-        if  ((*env)->IsInstanceOf(env, jcmodel,
+-                (*env)->FindClass(env, "java/awt/image/DirectColorModel"))){
+-            cmP->cmType = DIRECT_CM_TYPE;
+-        }
+-        else {
+-            cmP->cmType = PACKED_CM_TYPE;
+-        }
+-    }
+-    else if ((*env)->IsInstanceOf(env, jcmodel,
+-                 (*env)->FindClass(env, "java/awt/image/ComponentColorModel")))
+-    {
+-        cmP->cmType = COMPONENT_CM_TYPE;
+-    }
+-    else if ((*env)->IsInstanceOf(env, jcmodel,
+-              (*env)->FindClass(env, "java/awt/image/PackedColorModel")))
+-    {
+-        cmP->cmType = PACKED_CM_TYPE;
+-    }
+-    else {
+-        cmP->cmType = UNKNOWN_CM_TYPE;
+-    }
+-
+ 
+     return 1;
+ }
+@@ -572,6 +591,13 @@
+     ColorModelS_t *cmodelP = &imageP->cmodel;
+     int imageType = imageP->imageType;
+ 
++    // check whether raster and color model are compatible
++    if (cmodelP->numComponents != rasterP->numBands) {
++        if (cmodelP->cmType != INDEX_CM_TYPE) {
++            return -1;
++        }
++    }
++
+     hintP->numChans = imageP->cmodel.numComponents;
+     hintP->colorOrder = NULL;
+     if (SAFE_TO_ALLOC_2(hintP->numChans, sizeof(int))) {
+@@ -1063,6 +1089,10 @@
+     jsm = (*env)->GetObjectField(env, rasterP->jraster, g_RasterSampleModelID);
+     jdatabuffer = (*env)->GetObjectField(env, rasterP->jraster,
+                                          g_RasterDataBufferID);
++    if (band >= numBands) {
++        JNU_ThrowInternalError(env, "Band out of range.");
++        return -1;
++    }
+     /* Here is the generic code */
+     jdata = (*env)->NewIntArray(env, maxBytes*rasterP->numBands*maxLines);
+     if (JNU_IsNull(env, jdata)) {
+@@ -1071,11 +1101,6 @@
+     }
+     if (band >= 0) {
+         int dOff;
+-        if (band >= numBands) {
+-            (*env)->DeleteLocalRef(env, jdata);
+-            JNU_ThrowInternalError(env, "Band out of range.");
+-            return -1;
+-        }
+         off = 0;
+         for (y=0; y < h; y+=maxLines) {
+             if (y+maxLines > h) {
+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
+@@ -2605,6 +2605,41 @@
+     return 0;
+ }
+ 
++#define ERR_BAD_IMAGE_LAYOUT (-2)
++
++#define CHECK_DST_ARRAY(start_offset, elements_per_pixel)             \
++    do {                                                              \
++        int offset = (start_offset);                                  \
++        int lastScanOffset;                                           \
++                                                                      \
++        if (!SAFE_TO_MULT(rasterP->scanlineStride,                    \
++                          (rasterP->height - 1)))                     \
++        {                                                             \
++            return ERR_BAD_IMAGE_LAYOUT;                              \
++        }                                                             \
++        lastScanOffset = rasterP->scanlineStride *                    \
++            (rasterP->height - 1);                                    \
++                                                                      \
++        if (!SAFE_TO_ADD(offset, lastScanOffset)) {                   \
++            return ERR_BAD_IMAGE_LAYOUT;                              \
++        }                                                             \
++        lastScanOffset += offset;                                     \
++                                                                      \
++        if (!SAFE_TO_MULT((elements_per_pixel), rasterP->width)) {    \
++            return ERR_BAD_IMAGE_LAYOUT;                              \
++        }                                                             \
++        offset = (elements_per_pixel) * rasterP->width;               \
++                                                                      \
++        if (!SAFE_TO_ADD(offset, lastScanOffset)) {                   \
++            return ERR_BAD_IMAGE_LAYOUT;                              \
++        }                                                             \
++        lastScanOffset += offset;                                     \
++                                                                      \
++        if (dataArrayLength < lastScanOffset) {                       \
++            return ERR_BAD_IMAGE_LAYOUT;                              \
++        }                                                             \
++    } while(0);                                                       \
++
+ static int
+ storeImageArray(JNIEnv *env, BufImageS_t *srcP, BufImageS_t *dstP,
+                 mlib_image *mlibImP) {
+@@ -2612,6 +2647,7 @@
+     unsigned char *cmDataP, *dataP, *cDataP;
+     HintS_t *hintP = &dstP->hints;
+     RasterS_t *rasterP = &dstP->raster;
++    jsize dataArrayLength = (*env)->GetArrayLength(env, rasterP->jdata);
+     int y;
+ 
+     /* REMIND: Store mlib data type? */
+@@ -2630,14 +2666,15 @@
+ 
+     if (hintP->packing == BYTE_INTERLEAVED) {
+         /* Write it back to the destination */
++        CHECK_DST_ARRAY(hintP->channelOffset, hintP->numChans);
+         cmDataP = (unsigned char *) mlib_ImageGetData(mlibImP);
+         mStride = mlib_ImageGetStride(mlibImP);
+         dataP = (unsigned char *)(*env)->GetPrimitiveArrayCritical(env,
+                                                       rasterP->jdata, NULL);
+         if (dataP == NULL) return 0;
+-        cDataP = dataP + hintP->dataOffset;
++        cDataP = dataP + hintP->channelOffset;
+         for (y=0; y < rasterP->height;
+-             y++, cmDataP += mStride, cDataP += hintP->sStride)
++             y++, cmDataP += mStride, cDataP += rasterP->scanlineStride)
+         {
+             memcpy(cDataP, cmDataP, rasterP->width*hintP->numChans);
+         }
+@@ -2648,13 +2685,14 @@
+         /* Write it back to the destination */
+         unsigned short *sdataP, *sDataP;
+         unsigned short *smDataP = (unsigned short *)mlib_ImageGetData(mlibImP);
++        CHECK_DST_ARRAY(hintP->channelOffset, hintP->numChans);
+         mStride = mlib_ImageGetStride(mlibImP);
+         sdataP = (unsigned short *)(*env)->GetPrimitiveArrayCritical(env,
+                                                       rasterP->jdata, NULL);
+         if (sdataP == NULL) return -1;
+-        sDataP = sdataP + hintP->dataOffset;
++        sDataP = sdataP + hintP->channelOffset;
+         for (y=0; y < rasterP->height;
+-             y++, smDataP += mStride, sDataP += hintP->sStride)
++            y++, smDataP += mStride, sDataP += rasterP->scanlineStride)
+         {
+             memcpy(sDataP, smDataP, rasterP->width*hintP->numChans);
+         }
+@@ -3447,7 +3485,8 @@
+     unsigned char *inP = inDataP;
+     unsigned char *lineOutP, *outP;
+     jarray jOutDataP;
+-    jint   *outDataP;
++    jsize dataArrayLength;
++    unsigned char *outDataP;
+     int loff[MAX_NUMBANDS], roff[MAX_NUMBANDS];
+ 
+     if (rasterP->numBands > MAX_NUMBANDS) {
+@@ -3456,11 +3495,18 @@
+ 
+     /* Grab data ptr, strides, offsets from raster */
+     jOutDataP = (*env)->GetObjectField(env, rasterP->jraster, g_BCRdataID);
++    if (JNU_IsNull(env, jOutDataP)) {
++        return -1;
++    }
++
++    dataArrayLength = (*env)->GetArrayLength(env, jOutDataP);
++    CHECK_DST_ARRAY(rasterP->chanOffsets[0], 1);
++
+     outDataP = (*env)->GetPrimitiveArrayCritical(env, jOutDataP, 0);
+     if (outDataP == NULL) {
+         return -1;
+     }
+-    lineOutP =  (unsigned char *)outDataP + rasterP->chanOffsets[0];
++    lineOutP = outDataP + rasterP->chanOffsets[0];
+ 
+     if (component < 0) {
+         for (c=0; c < rasterP->numBands; c++) {
+@@ -3515,7 +3561,8 @@
+     unsigned char *inP = inDataP;
+     unsigned short *lineOutP, *outP;
+     jarray jOutDataP;
+-    jint   *outDataP;
++    jsize dataArrayLength;
++    unsigned short *outDataP;
+     int loff[MAX_NUMBANDS], roff[MAX_NUMBANDS];
+ 
+     if (rasterP->numBands > MAX_NUMBANDS) {
+@@ -3524,11 +3571,18 @@
+ 
+     /* Grab data ptr, strides, offsets from raster */
+     jOutDataP = (*env)->GetObjectField(env, rasterP->jraster, g_SCRdataID);
++    if (JNU_IsNull(env, jOutDataP)) {
++        return -1;
++    }
++
++    dataArrayLength = (*env)->GetArrayLength(env, jOutDataP);
++    CHECK_DST_ARRAY(rasterP->chanOffsets[0], 1);
++
+     outDataP = (*env)->GetPrimitiveArrayCritical(env, jOutDataP, 0);
+     if (outDataP == NULL) {
+         return -1;
+     }
+-    lineOutP =  (unsigned short *)outDataP + rasterP->chanOffsets[0];
++    lineOutP = outDataP + rasterP->chanOffsets[0];
+ 
+     if (component < 0) {
+         for (c=0; c < rasterP->numBands; c++) {
+@@ -3583,7 +3637,8 @@
+     unsigned char *inP = inDataP;
+     unsigned int *lineOutP, *outP;
+     jarray jOutDataP;
+-    jint   *outDataP;
++    jsize dataArrayLength;
++    unsigned int *outDataP;
+     int loff[MAX_NUMBANDS], roff[MAX_NUMBANDS];
+ 
+     if (rasterP->numBands > MAX_NUMBANDS) {
+@@ -3592,11 +3647,18 @@
+ 
+     /* Grab data ptr, strides, offsets from raster */
+     jOutDataP = (*env)->GetObjectField(env, rasterP->jraster, g_ICRdataID);
++    if (JNU_IsNull(env, jOutDataP)) {
++        return -1;
++    }
++
++    dataArrayLength = (*env)->GetArrayLength(env, jOutDataP);
++    CHECK_DST_ARRAY(rasterP->chanOffsets[0], 1);
++
+     outDataP = (*env)->GetPrimitiveArrayCritical(env, jOutDataP, 0);
+     if (outDataP == NULL) {
+         return -1;
+     }
+-    lineOutP =  (unsigned int *)outDataP + rasterP->chanOffsets[0];
++    lineOutP = outDataP + rasterP->chanOffsets[0];
+ 
+     if (component < 0) {
+         for (c=0; c < rasterP->numBands; c++) {
+@@ -3653,7 +3715,8 @@
+     unsigned char *inP = inDataP;
+     unsigned char *lineOutP, *outP;
+     jarray jOutDataP;
+-    jint   *outDataP;
++    jsize  dataArrayLength;
++    unsigned char *outDataP;
+     int loff[MAX_NUMBANDS], roff[MAX_NUMBANDS];
+     int a = rasterP->numBands - 1;
+ 
+@@ -3663,11 +3726,18 @@
+ 
+     /* Grab data ptr, strides, offsets from raster */
+     jOutDataP = (*env)->GetObjectField(env, rasterP->jraster, g_BCRdataID);
++    if (JNU_IsNull(env, jOutDataP)) {
++        return -1;
++    }
++
++    dataArrayLength = (*env)->GetArrayLength(env, jOutDataP);
++    CHECK_DST_ARRAY(rasterP->chanOffsets[0], 1);
++
+     outDataP = (*env)->GetPrimitiveArrayCritical(env, jOutDataP, 0);
+     if (outDataP == NULL) {
+         return -1;
+     }
+-    lineOutP =  (unsigned char *)outDataP + rasterP->chanOffsets[0];
++    lineOutP = outDataP + rasterP->chanOffsets[0];
+ 
+     if (component < 0) {
+         for (c=0; c < rasterP->numBands; c++) {
+@@ -3743,7 +3813,8 @@
+     unsigned char *inP = inDataP;
+     unsigned short *lineOutP, *outP;
+     jarray jOutDataP;
+-    jint   *outDataP;
++    jsize dataArrayLength;
++    unsigned short *outDataP;
+     int loff[MAX_NUMBANDS], roff[MAX_NUMBANDS];
+     int a = rasterP->numBands - 1;
+ 
+@@ -3753,11 +3824,17 @@
+ 
+     /* Grab data ptr, strides, offsets from raster */
+     jOutDataP = (*env)->GetObjectField(env, rasterP->jraster, g_SCRdataID);
++    if (JNU_IsNull(env, jOutDataP)) {
++        return -1;
++    }
++    dataArrayLength = (*env)->GetArrayLength(env, jOutDataP);
++    CHECK_DST_ARRAY(rasterP->chanOffsets[0], 1);
++
+     outDataP = (*env)->GetPrimitiveArrayCritical(env, jOutDataP, 0);
+     if (outDataP == NULL) {
+         return -1;
+     }
+-    lineOutP =  (unsigned short *)outDataP + rasterP->chanOffsets[0];
++    lineOutP = outDataP + rasterP->chanOffsets[0];
+ 
+     if (component < 0) {
+         for (c=0; c < rasterP->numBands; c++) {
+@@ -3833,7 +3910,8 @@
+     unsigned char *inP = inDataP;
+     unsigned int *lineOutP, *outP;
+     jarray jOutDataP;
+-    jint   *outDataP;
++    jsize dataArrayLength;
++    unsigned int *outDataP;
+     int loff[MAX_NUMBANDS], roff[MAX_NUMBANDS];
+     int a = rasterP->numBands - 1;
+ 
+@@ -3843,11 +3921,18 @@
+ 
+     /* Grab data ptr, strides, offsets from raster */
+     jOutDataP = (*env)->GetObjectField(env, rasterP->jraster, g_ICRdataID);
++    if (JNU_IsNull(env, jOutDataP)) {
++        return -1;
++    }
++
++    dataArrayLength = (*env)->GetArrayLength(env, jOutDataP);
++    CHECK_DST_ARRAY(rasterP->chanOffsets[0], 1);
++
+     outDataP = (*env)->GetPrimitiveArrayCritical(env, jOutDataP, 0);
+     if (outDataP == NULL) {
+         return -1;
+     }
+-    lineOutP =  (unsigned int *)outDataP + rasterP->chanOffsets[0];
++    lineOutP = outDataP + rasterP->chanOffsets[0];
+ 
+     if (component < 0) {
+         for (c=0; c < rasterP->numBands; c++) {

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8012601-better_layout_validation.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8012601-better_layout_validation.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8012601-better_layout_validation.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,125 @@
+# HG changeset patch
+# User bae
+# Date 1366954254 -14400
+# Node ID 81cfa2275a01fdc479901031e089c76c892d1c03
+# Parent  940eac3712db0f139069d1048f021f0e70cbbb3a
+8012601: Better validation of image layouts
+Reviewed-by: mschoene, prr, vadim
+
+diff --git a/src/share/classes/java/awt/image/BufferedImage.java b/src/share/classes/java/awt/image/BufferedImage.java
+--- jdk/src/share/classes/java/awt/image/BufferedImage.java
++++ jdk/src/share/classes/java/awt/image/BufferedImage.java
+@@ -785,6 +785,7 @@
+                 }
+             }
+             if (is8bit &&
++                braster.getPixelStride() == numBands &&
+                 offs[0] == numBands-1 &&
+                 offs[1] == numBands-2 &&
+                 offs[2] == numBands-3 &&
+diff --git a/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java b/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java
+--- jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java
++++ jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java
+@@ -96,6 +96,7 @@
+     int width;
+     int height;
+     int nextRowOffset;
++    private int nextPixelOffset;
+     int offset;
+ 
+     Object dataArray;
+@@ -107,6 +108,7 @@
+         this.pixelType = pixelType;
+         width = np;
+         height = 1;
++        nextPixelOffset = pixelSize;
+         nextRowOffset = safeMult(pixelSize, np);
+         offset = 0;
+     }
+@@ -118,6 +120,7 @@
+         this.pixelType = pixelType;
+         this.width = width;
+         this.height = height;
++        nextPixelOffset = pixelSize;
+         nextRowOffset = safeMult(pixelSize, width);
+         offset = 0;
+     }
+@@ -213,6 +216,7 @@
+                 intRaster = (IntegerComponentRaster)image.getRaster();
+ 
+                 nextRowOffset = safeMult(4, intRaster.getScanlineStride());
++                nextPixelOffset = safeMult(4, intRaster.getPixelStride());
+ 
+                 offset = safeMult(4, intRaster.getDataOffset(0));
+ 
+@@ -225,6 +229,8 @@
+             case BufferedImage.TYPE_4BYTE_ABGR:
+                 byteRaster = (ByteComponentRaster)image.getRaster();
+                 nextRowOffset = byteRaster.getScanlineStride();
++                nextPixelOffset = byteRaster.getPixelStride();
++
+                 int firstBand = image.getSampleModel().getNumBands() - 1;
+                 offset = byteRaster.getDataOffset(firstBand);
+                 dataArray = byteRaster.getDataStorage();
+@@ -235,6 +241,8 @@
+             case BufferedImage.TYPE_BYTE_GRAY:
+                 byteRaster = (ByteComponentRaster)image.getRaster();
+                 nextRowOffset = byteRaster.getScanlineStride();
++                nextPixelOffset = byteRaster.getPixelStride();
++
+                 offset = byteRaster.getDataOffset(0);
+                 dataArray = byteRaster.getDataStorage();
+                 dataArrayLength = byteRaster.getDataStorage().length;
+@@ -244,6 +252,8 @@
+             case BufferedImage.TYPE_USHORT_GRAY:
+                 shortRaster = (ShortComponentRaster)image.getRaster();
+                 nextRowOffset = safeMult(2, shortRaster.getScanlineStride());
++                nextPixelOffset = safeMult(2, shortRaster.getPixelStride());
++
+                 offset = safeMult(2, shortRaster.getDataOffset(0));
+                 dataArray = shortRaster.getDataStorage();
+                 dataArrayLength = 2 * shortRaster.getDataStorage().length;
+@@ -273,9 +283,15 @@
+             throw new ImageLayoutException("Invalid image layout");
+         }
+ 
+-        int lastPixelOffset = safeMult(nextRowOffset, (height - 1));
++        if (nextPixelOffset != getBytesPerPixel(pixelType)) {
++            throw new ImageLayoutException("Invalid image layout");
++        }
+ 
+-        lastPixelOffset = safeAdd(lastPixelOffset, (width - 1));
++        int lastScanOffset = safeMult(nextRowOffset, (height - 1));
++
++        int lastPixelOffset = safeMult(nextPixelOffset, (width -1 ));
++
++        lastPixelOffset = safeAdd(lastPixelOffset, lastScanOffset);
+ 
+         int off = safeAdd(offset, lastPixelOffset);
+ 
+@@ -307,4 +323,25 @@
+             super(message);
+         }
+     }
++
++    /**
++     * Derives number of bytes per pixel from the pixel format.
++     * Following bit fields are used here:
++     *  [0..2] - bytes per sample
++     *  [3..6] - number of color samples per pixel
++     *  [7..9] - number of non-color samples per pixel
++     *
++     * A complete description of the pixel format can be found
++     * here: lcms2.h, lines 651 - 667.
++     *
++     * @param pixelType pixel format in lcms2 notation.
++     * @return number of bytes per pixel for given pixel format.
++     */
++    private static int getBytesPerPixel(int pixelType) {
++        int bytesPerSample = (0x7 & pixelType);
++        int colorSamplesPerPixel = 0xF & (pixelType >> 3);
++        int extraSamplesPerPixel = 0x7 & (pixelType >> 7);
++
++        return bytesPerSample * (colorSamplesPerPixel + extraSamplesPerPixel);
++    }
+ }

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8014281-better_xml_signature_checking.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8014281-better_xml_signature_checking.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8014281-better_xml_signature_checking.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,49 @@
+# HG changeset patch
+# User xuelei
+# Date 1368495045 25200
+# Node ID 0e01465ca15f49a2b5ebfca89d85c2f0575b96e4
+# Parent  81cfa2275a01fdc479901031e089c76c892d1c03
+8014281: Better checking of XML signature
+Summary: also reviewed by Andrew Gross and Christophe Ravel
+Reviewed-by: mullan
+
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMCanonicalizationMethod.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMCanonicalizationMethod.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMCanonicalizationMethod.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMCanonicalizationMethod.java
+@@ -51,6 +51,11 @@
+     public DOMCanonicalizationMethod(TransformService spi)
+         throws InvalidAlgorithmParameterException {
+         super(spi);
++        if (!(spi instanceof ApacheCanonicalizer) &&
++                !isC14Nalg(spi.getAlgorithm())) {
++            throw new InvalidAlgorithmParameterException(
++                "Illegal CanonicalizationMethod");
++        }
+     }
+ 
+     /**
+@@ -63,6 +68,10 @@
+     public DOMCanonicalizationMethod(Element cmElem, XMLCryptoContext context,
+         Provider provider) throws MarshalException {
+         super(cmElem, context, provider);
++        if (!(spi instanceof ApacheCanonicalizer) &&
++                !isC14Nalg(spi.getAlgorithm())) {
++            throw new MarshalException("Illegal CanonicalizationMethod");
++        }
+     }
+ 
+     /**
+@@ -101,4 +110,13 @@
+         return (getAlgorithm().equals(ocm.getAlgorithm()) &&
+             DOMUtils.paramsEqual(getParameterSpec(), ocm.getParameterSpec()));
+     }
++
++    private static boolean isC14Nalg(String alg) {
++        return (alg.equals(CanonicalizationMethod.INCLUSIVE) ||
++                alg.equals(CanonicalizationMethod.INCLUSIVE_WITH_COMMENTS) ||
++                alg.equals(CanonicalizationMethod.EXCLUSIVE) ||
++                alg.equals(CanonicalizationMethod.EXCLUSIVE_WITH_COMMENTS) ||
++                alg.equals(DOMCanonicalXMLC14N11Method.C14N_11) ||
++                alg.equals(DOMCanonicalXMLC14N11Method.C14N_11_WITH_COMMENTS));
++     }
+ }

Added: trunk/java/openjdk6/files/icedtea/security/20130618/8015997-more_javadoc_framing.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/8015997-more_javadoc_framing.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/8015997-more_javadoc_framing.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,21 @@
+# HG changeset patch
+# User bpatel
+# Date 1370467914 25200
+# Node ID f422c843b477501acc2526c69609fd94204cdce1
+# Parent  b4954380fa25058f1a6cfb9cb96f78d90cf0fc5c
+8015997: Additional improvement in Javadoc framing
+Reviewed-by: jjg
+
+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
+@@ -312,7 +312,8 @@
+                 "    if (targetPage.indexOf(\":\") != -1 || (targetPage != \"\" && !validURL(targetPage)))" + DocletConstants.NL +
+                 "        targetPage = \"undefined\";" + DocletConstants.NL +
+                 "    function validURL(url) {" + DocletConstants.NL +
+-                "        if (!(url.indexOf(\".html\") == url.length - 5))" + DocletConstants.NL +
++                "        var pos = url.indexOf(\".html\");" + DocletConstants.NL +
++                "        if (pos == -1 || pos != url.length - 5)" + DocletConstants.NL +
+                 "            return false;" + DocletConstants.NL +
+                 "        var allowNumber = false;" + DocletConstants.NL +
+                 "        var allowSep = false;" + DocletConstants.NL +

Added: trunk/java/openjdk6/files/icedtea/security/20130618/diamond_fix.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/diamond_fix.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/diamond_fix.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,55 @@
+# HG changeset patch
+# User andrew
+# Date 1371488944 18000
+# Node ID 60c57caf0348c7eed93900e4395607af759e6ba9
+# Parent  a844309d9f0a490f8ac56d21f1323e8deb65ffd1
+Fix introduction of diamond operator in some classes.
+
+diff --git a/src/share/classes/com/sun/media/sound/AbstractLine.java b/src/share/classes/com/sun/media/sound/AbstractLine.java
+--- jdk/src/share/classes/com/sun/media/sound/AbstractLine.java
++++ jdk/src/share/classes/com/sun/media/sound/AbstractLine.java
+@@ -54,7 +54,7 @@
+      * Contains event dispatcher per thread group.
+      */
+     private static final Map<ThreadGroup, EventDispatcher> dispatchers =
+-            new WeakHashMap<>();
++      new WeakHashMap<ThreadGroup, EventDispatcher>();
+ 
+     /**
+      * Constructs a new AbstractLine.
+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
+@@ -59,7 +59,7 @@
+      * dispatcher instance with a factory in EventDispatcher
+      */
+     private static final Map<ThreadGroup, EventDispatcher> dispatchers =
+-            new WeakHashMap<>();
++      new WeakHashMap<ThreadGroup, EventDispatcher>();
+ 
+     /**
+      * All RealTimeSequencers share this info object.
+diff --git a/src/share/classes/java/io/ObjectStreamClass.java b/src/share/classes/java/io/ObjectStreamClass.java
+--- jdk/src/share/classes/java/io/ObjectStreamClass.java
++++ jdk/src/share/classes/java/io/ObjectStreamClass.java
+@@ -1135,7 +1135,7 @@
+             end = end.getSuperclass();
+         }
+ 
+-        HashSet<String> oscNames = new HashSet<>(3);
++        HashSet<String> oscNames = new HashSet<String>(3);
+ 
+         for (ObjectStreamClass d = this; d != null; d = d.superDesc) {
+             if (oscNames.contains(d.name)) {
+diff --git a/src/share/classes/sun/font/CreatedFontTracker.java b/src/share/classes/sun/font/CreatedFontTracker.java
+--- jdk/src/share/classes/sun/font/CreatedFontTracker.java
++++ jdk/src/share/classes/sun/font/CreatedFontTracker.java
+@@ -106,7 +106,7 @@
+      * Note that this only applies to createFont() from an InputStream object.
+      */
+     private static class TempFileDeletionHook {
+-        private static HashMap<File, OutputStream> files = new HashMap<>();
++        private static HashMap<File, OutputStream> files = new HashMap<File, OutputStream>();
+ 
+         private static Thread t = null;
+         static void init() {

Added: trunk/java/openjdk6/files/icedtea/security/20130618/handle_npe.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/handle_npe.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/handle_npe.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,21 @@
+# HG changeset patch
+# User andrew
+# Date 1371200704 -3600
+# Node ID 662fbd43808413b2bd7ae4ae95683da98999023e
+# Parent  0e01465ca15f49a2b5ebfca89d85c2f0575b96e4
+Handle NullPointerException in getNotificationInfo
+
+diff --git a/src/share/classes/javax/management/StandardEmitterMBean.java b/src/share/classes/javax/management/StandardEmitterMBean.java
+--- jdk/src/share/classes/javax/management/StandardEmitterMBean.java
++++ jdk/src/share/classes/javax/management/StandardEmitterMBean.java
+@@ -258,8 +258,8 @@
+     }
+ 
+     public MBeanNotificationInfo[] getNotificationInfo() {
+-        if (notificationInfo.length == 0) {
+-            return notificationInfo;
++        if (notificationInfo == null || notificationInfo.length == 0) {
++            return NO_NOTIFICATION_INFO;
+         } else {
+             return notificationInfo.clone();
+         }

Added: trunk/java/openjdk6/files/icedtea/security/20130618/javac_issue.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/javac_issue.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/javac_issue.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,60 @@
+# HG changeset patch
+# User andrew
+# Date 1371835374 18000
+# Node ID 471dd797c10d400a89503d94ab3832ab1cdb67ad
+# Parent  9892a997b49abd5ae9a5e1ec8fef1f93631f87ae
+Workaround javac issue
+
+diff --git a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315Excl.java b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315Excl.java
+--- jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315Excl.java
++++ jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315Excl.java
+@@ -207,7 +207,7 @@
+          * @param inclusiveNamespaces
+          * @throws CanonicalizationException
+          */
+-        public byte[] engineCanonicalizeXPathNodeSet(Set xpathNodeSet,
++        public byte[] engineCanonicalizeXPathNodeSet(Set<Node> xpathNodeSet,
+                         String inclusiveNamespaces) throws CanonicalizationException {
+ 
+ 
+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
+@@ -97,7 +97,7 @@
+    List nodeFilter;
+ 
+    boolean _includeComments;
+-   Set _xpathNodeSet = null;
++   Set<Node> _xpathNodeSet = null;
+    /**
+     * The node to be skiped/excluded from the DOM tree
+     * in subtree canonicalizations.
+@@ -130,7 +130,7 @@
+     * @param xpathNodeSet
+     * @throws CanonicalizationException
+     */
+-   public byte[] engineCanonicalizeXPathNodeSet(Set xpathNodeSet)
++   public byte[] engineCanonicalizeXPathNodeSet(Set<Node> xpathNodeSet)
+            throws CanonicalizationException {
+            this._xpathNodeSet = xpathNodeSet;
+            return engineCanonicalizeXPathNodeSetInternal(XMLUtils.getOwnerDocument(this._xpathNodeSet));
+diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java
+--- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java
++++ jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java
+@@ -48,6 +48,7 @@
+ import com.sun.org.apache.xml.internal.security.transforms.Transform;
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
++import org.w3c.dom.Node;
+ import org.w3c.dom.NodeList;
+ 
+ public abstract class ApacheCanonicalizer extends TransformService {
+@@ -119,7 +120,7 @@
+         }
+ 
+         try {
+-            Set nodeSet = null;
++            Set<Node> nodeSet = null;
+             if (data instanceof ApacheData) {
+                 XMLSignatureInput in =
+                     ((ApacheData) data).getXMLSignatureInput();

Added: trunk/java/openjdk6/files/icedtea/security/20130618/langtools_generics.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/langtools_generics.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/langtools_generics.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,600 @@
+# HG changeset patch
+# User andrew
+# Date 1371740021 18000
+# Node ID a5c99fd80b4c9f5049351bf5bff8517dd6d3b613
+# Parent  335cdc9887c56f560991275fe8d32e6edb6b3f1e
+Add generics
+
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java
+@@ -41,29 +41,29 @@
+ public class ClassUseWriter extends SubWriterHolderWriter {
+ 
+     final ClassDoc classdoc;
+-    Set pkgToPackageAnnotations = null;
+-    final Map pkgToClassTypeParameter;
+-    final Map pkgToClassAnnotations;
+-    final Map pkgToMethodTypeParameter;
+-    final Map pkgToMethodArgTypeParameter;
+-    final Map pkgToMethodReturnTypeParameter;
+-    final Map pkgToMethodAnnotations;
+-    final Map pkgToMethodParameterAnnotations;
+-    final Map pkgToFieldTypeParameter;
+-    final Map pkgToFieldAnnotations;
+-    final Map pkgToSubclass;
+-    final Map pkgToSubinterface;
+-    final Map pkgToImplementingClass;
+-    final Map pkgToField;
+-    final Map pkgToMethodReturn;
+-    final Map pkgToMethodArgs;
+-    final Map pkgToMethodThrows;
+-    final Map pkgToConstructorAnnotations;
+-    final Map pkgToConstructorParameterAnnotations;
+-    final Map pkgToConstructorArgs;
+-    final Map pkgToConstructorArgTypeParameter;
+-    final Map pkgToConstructorThrows;
+-    final SortedSet pkgSet;
++    Set<PackageDoc> pkgToPackageAnnotations = null;
++    final Map<String,List<ProgramElementDoc>> pkgToClassTypeParameter;
++    final Map<String,List<ProgramElementDoc>> pkgToClassAnnotations;
++    final Map<String,List<ProgramElementDoc>> pkgToMethodTypeParameter;
++    final Map<String,List<ProgramElementDoc>> pkgToMethodArgTypeParameter;
++    final Map<String,List<ProgramElementDoc>> pkgToMethodReturnTypeParameter;
++    final Map<String,List<ProgramElementDoc>> pkgToMethodAnnotations;
++    final Map<String,List<ProgramElementDoc>> pkgToMethodParameterAnnotations;
++    final Map<String,List<ProgramElementDoc>> pkgToFieldTypeParameter;
++    final Map<String,List<ProgramElementDoc>> pkgToFieldAnnotations;
++    final Map<String,List<ProgramElementDoc>> pkgToSubclass;
++    final Map<String,List<ProgramElementDoc>> pkgToSubinterface;
++    final Map<String,List<ProgramElementDoc>> pkgToImplementingClass;
++    final Map<String,List<ProgramElementDoc>> pkgToField;
++    final Map<String,List<ProgramElementDoc>> pkgToMethodReturn;
++    final Map<String,List<ProgramElementDoc>> pkgToMethodArgs;
++    final Map<String,List<ProgramElementDoc>> pkgToMethodThrows;
++    final Map<String,List<ProgramElementDoc>> pkgToConstructorAnnotations;
++    final Map<String,List<ProgramElementDoc>> pkgToConstructorParameterAnnotations;
++    final Map<String,List<ProgramElementDoc>> pkgToConstructorArgs;
++    final Map<String,List<ProgramElementDoc>> pkgToConstructorArgTypeParameter;
++    final Map<String,List<ProgramElementDoc>> pkgToConstructorThrows;
++    final SortedSet<PackageDoc> pkgSet;
+     final MethodWriterImpl methodSubWriter;
+     final ConstructorWriterImpl constrSubWriter;
+     final FieldWriterImpl fieldSubWriter;
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java
+@@ -52,12 +52,12 @@
+      *
+      * @see Group
+      */
+-    private Map groupPackageMap;
++    private Map<String,List<PackageDoc>> groupPackageMap;
+ 
+     /**
+      * List to store the order groups as specified on the command line.
+      */
+-    private List groupList;
++    private List<String> groupList;
+ 
+     /**
+      * Construct the PackageIndexWriter. Also constructs the grouping
+@@ -103,8 +103,8 @@
+      */
+     protected void addIndex(Content body) {
+         for (int i = 0; i < groupList.size(); i++) {
+-        String groupname = (String)groupList.get(i);
+-        List list = (List)groupPackageMap.get(groupname);
++        String groupname = groupList.get(i);
++        List<PackageDoc> list = groupPackageMap.get(groupname);
+             if (list != null && list.size() > 0) {
+                 addIndexContents(list.toArray(new PackageDoc[list.size()]),
+                         groupname, configuration.getText("doclet.Member_Table_Summary",
+diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java
+--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java
++++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java
+@@ -41,7 +41,7 @@
+ public class PackageUseWriter extends SubWriterHolderWriter {
+ 
+     final PackageDoc pkgdoc;
+-    final SortedMap usingPackageToUsedClasses = new TreeMap();
++    final SortedMap<String,Set<ClassDoc>> usingPackageToUsedClasses = new TreeMap<String,Set<ClassDoc>>();
+ 
+     /**
+      * Constructor.
+@@ -64,15 +64,15 @@
+         ClassDoc[] content = pkgdoc.allClasses();
+         for (int i = 0; i < content.length; ++i) {
+             ClassDoc usedClass = content[i];
+-            Set usingClasses = (Set)mapper.classToClass.get(usedClass.qualifiedName());
++            Set<ClassDoc> usingClasses = mapper.classToClass.get(usedClass.qualifiedName());
+             if (usingClasses != null) {
+-                for (Iterator it = usingClasses.iterator(); it.hasNext(); ) {
+-                    ClassDoc usingClass = (ClassDoc)it.next();
++                for (Iterator<ClassDoc> it = usingClasses.iterator(); it.hasNext(); ) {
++                    ClassDoc usingClass = it.next();
+                     PackageDoc usingPackage = usingClass.containingPackage();
+-                    Set usedClasses = (Set)usingPackageToUsedClasses
++                    Set<ClassDoc> usedClasses = (Set)usingPackageToUsedClasses
+                         .get(usingPackage.name());
+                     if (usedClasses == null) {
+-                        usedClasses = new TreeSet();
++                        usedClasses = new TreeSet<ClassDoc>();
+                         usingPackageToUsedClasses.put(Util.getPackageName(usingPackage),
+                                                       usedClasses);
+                     }
+@@ -153,9 +153,9 @@
+                 getPackageLinkString(pkgdoc, Util.getPackageName(pkgdoc), false))));
+         table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
+         Content tbody = new HtmlTree(HtmlTag.TBODY);
+-        Iterator it = usingPackageToUsedClasses.keySet().iterator();
++        Iterator<String> it = usingPackageToUsedClasses.keySet().iterator();
+         for (int i = 0; it.hasNext(); i++) {
+-            PackageDoc pkg = configuration.root.packageNamed((String)it.next());
++            PackageDoc pkg = configuration.root.packageNamed(it.next());
+             HtmlTree tr = new HtmlTree(HtmlTag.TR);
+             if (i % 2 == 0) {
+                 tr.addStyle(HtmlStyle.altColor);
+@@ -181,9 +181,9 @@
+                     configuration.getText("doclet.Class"),
+                     configuration.getText("doclet.Description"))
+         };
+-        Iterator itp = usingPackageToUsedClasses.keySet().iterator();
++        Iterator<String> itp = usingPackageToUsedClasses.keySet().iterator();
+         while (itp.hasNext()) {
+-            String packageName = (String)itp.next();
++            String packageName = itp.next();
+             PackageDoc usingPackage = configuration.root.packageNamed(packageName);
+             HtmlTree li = new HtmlTree(HtmlTag.LI);
+             li.addStyle(HtmlStyle.blockList);
+@@ -199,9 +199,8 @@
+                     getPackageLinkString(usingPackage,Util.getPackageName(usingPackage), false))));
+             table.addContent(getSummaryTableHeader(classTableHeader, "col"));
+             Content tbody = new HtmlTree(HtmlTag.TBODY);
+-            Iterator itc =
+-                ((Collection)usingPackageToUsedClasses.get(packageName))
+-                .iterator();
++            Iterator<ClassDoc> itc =
++		usingPackageToUsedClasses.get(packageName).iterator();
+             for (int i = 0; itc.hasNext(); i++) {
+                 HtmlTree tr = new HtmlTree(HtmlTag.TR);
+                 if (i % 2 == 0) {
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java
+@@ -97,7 +97,7 @@
+      * @param node the XML element that specifies which component to document.
+      * @param contentTree content tree to which the documentation will be added
+      */
+-    protected void build(XMLNode node) {
++    protected void build(XMLNode node, Content contentTree) {
+         String component = node.name;
+         try {
+             invokeMethod("build" + component,
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java
+@@ -80,7 +80,7 @@
+      */
+     public XMLNode parseXML(String root) {
+         if (xmlElementsMap.containsKey(root)) {
+-            return (List) xmlElementsMap.get(root);
++            return xmlElementsMap.get(root);
+         }
+         try {
+             currentRoot = root;
+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
+@@ -375,8 +375,7 @@
+      */
+     public void buildFieldSerializationOverview(ClassDoc classDoc, Content classContentTree) {
+         if (classDoc.definesSerializableFields()) {
+-            FieldDoc serialPersistentField =
+-                Util.asList(classDoc.serializableFields()).get(0);
++            FieldDoc serialPersistentField = classDoc.serializableFields()[0];
+             // Check to see if there are inline comments, tags or deprecation
+             // information to be printed.
+             if (fieldWriter.shouldPrintOverview(serialPersistentField)) {
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassUseMapper.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassUseMapper.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassUseMapper.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassUseMapper.java
+@@ -46,150 +46,150 @@
+      * Mapping of ClassDocs to set of PackageDoc used by that class.
+      * Entries may be null.
+      */
+-    public Map classToPackage = new HashMap();
++    public Map<String,Set<PackageDoc>> classToPackage = new HashMap<String,Set<PackageDoc>>();
+ 
+     /**
+      * Mapping of Annotations to set of PackageDoc that use the annotation.
+      */
+-    public Map classToPackageAnnotations = new HashMap();
++    public Map<String,List<PackageDoc>> classToPackageAnnotations = new HashMap<String,List<PackageDoc>>();
+ 
+     /**
+      * Mapping of ClassDocs to set of ClassDoc used by that class.
+      * Entries may be null.
+      */
+-    public Map classToClass = new HashMap();
++    public Map<String,Set<ClassDoc>> classToClass = new HashMap<String,Set<ClassDoc>>();
+ 
+     /**
+      * Mapping of ClassDocs to list of ClassDoc which are direct or
+      * indirect subclasses of that class.
+      * Entries may be null.
+      */
+-    public Map classToSubclass = new HashMap();
++    public Map<String,List<ClassDoc>> classToSubclass = new HashMap<String,List<ClassDoc>>();
+ 
+     /**
+      * Mapping of ClassDocs to list of ClassDoc which are direct or
+      * indirect subinterfaces of that interface.
+      * Entries may be null.
+      */
+-    public Map classToSubinterface = new HashMap();
++    public Map<String,List<ClassDoc>> classToSubinterface = new HashMap<String,List<ClassDoc>>();
+ 
+     /**
+      * Mapping of ClassDocs to list of ClassDoc which implement
+      * this interface.
+      * Entries may be null.
+      */
+-    public Map classToImplementingClass = new HashMap();
++    public Map<String,List<ClassDoc>> classToImplementingClass = new HashMap<String,List<ClassDoc>>();
+ 
+     /**
+      * Mapping of ClassDocs to list of FieldDoc declared as that class.
+      * Entries may be null.
+      */
+-    public Map classToField = new HashMap();
++    public Map<String,List<FieldDoc>> classToField = new HashMap<String,List<FieldDoc>>();
+ 
+     /**
+      * Mapping of ClassDocs to list of MethodDoc returning that class.
+      * Entries may be null.
+      */
+-    public Map classToMethodReturn = new HashMap();
++    public Map<String,List<MethodDoc>> classToMethodReturn = new HashMap<String,List<MethodDoc>>();
+ 
+     /**
+      * Mapping of ClassDocs to list of MethodDoc having that class
+      * as an arg.
+      * Entries may be null.
+      */
+-    public Map classToMethodArgs = new HashMap();
++    public Map<String,List<ExecutableMemberDoc>> classToMethodArgs = new HashMap<String,List<ExecutableMemberDoc>>();
+ 
+     /**
+      * Mapping of ClassDocs to list of MethodDoc which throws that class.
+      * Entries may be null.
+      */
+-    public Map classToMethodThrows = new HashMap();
++    public Map<String,List<ExecutableMemberDoc>> classToMethodThrows = new HashMap<String,List<ExecutableMemberDoc>>();
+ 
+     /**
+      * Mapping of ClassDocs to list of ConstructorDoc having that class
+      * as an arg.
+      * Entries may be null.
+      */
+-    public Map classToConstructorArgs = new HashMap();
++    public Map<String,List<ExecutableMemberDoc>> classToConstructorArgs = new HashMap<String,List<ExecutableMemberDoc>>();
+ 
+     /**
+      * Mapping of ClassDocs to list of ConstructorDoc which throws that class.
+      * Entries may be null.
+      */
+-    public Map classToConstructorThrows = new HashMap();
++    public Map<String,List<ExecutableMemberDoc>> classToConstructorThrows = new HashMap<String,List<ExecutableMemberDoc>>();
+ 
+     /**
+      * The mapping of AnnotationTypeDocs to constructors that use them.
+      */
+-    public Map classToConstructorAnnotations = new HashMap();
+-
+-    /**
+-     * The mapping of AnnotationTypeDocs to Constructor parameters that use them.
+-     */
+-    public Map classToConstructorParamAnnotation = new HashMap();
++    public Map<String,List<ConstructorDoc>> classToConstructorAnnotations = new HashMap<String,List<ConstructorDoc>>();
++ 
++     /**
++      * The mapping of AnnotationTypeDocs to Constructor parameters that use them.
++      */
++    public Map<String,List<ExecutableMemberDoc>> classToConstructorParamAnnotation = new HashMap<String,List<ExecutableMemberDoc>>();
+ 
+     /**
+      * The mapping of ClassDocs to Constructor arguments that use them as type parameters.
+      */
+-    public Map classToConstructorDocArgTypeParam = new HashMap();
++    public Map<String,List<ExecutableMemberDoc>> classToConstructorDocArgTypeParam = new HashMap<String,List<ExecutableMemberDoc>>();
+ 
+     /**
+      * The mapping of ClassDocs to ClassDocs that use them as type parameters.
+      */
+-    public Map classToClassTypeParam = new HashMap();
++    public Map<String,List<ClassDoc>> classToClassTypeParam = new HashMap<String,List<ClassDoc>>();
+ 
+     /**
+      * The mapping of AnnotationTypeDocs to ClassDocs that use them.
+      */
+-    public Map classToClassAnnotations = new HashMap();
++    public Map<String,List<ClassDoc>> classToClassAnnotations = new HashMap<String,List<ClassDoc>>();
+ 
+     /**
+      * The mapping of ClassDocs to ExecutableMemberDocs that use them as type parameters.
+      */
+-    public Map classToExecMemberDocTypeParam = new HashMap();
++    public Map<String,List<MethodDoc>> classToExecMemberDocTypeParam = new HashMap<String,List<MethodDoc>>();
+ 
+     /**
+      * The mapping of ClassDocs to ExecutableMemberDocs arguments that use them as type parameters.
+      */
+-    public Map classToExecMemberDocArgTypeParam = new HashMap();
++    public Map<String,List<ExecutableMemberDoc>> classToExecMemberDocArgTypeParam = new HashMap<String,List<ExecutableMemberDoc>>();
+ 
+     /**
+      * The mapping of AnnotationTypeDocs to ExecutableMemberDocs that use them.
+      */
+-    public Map classToExecMemberDocAnnotations = new HashMap();
++    public Map<String,List<MethodDoc>> classToExecMemberDocAnnotations = new HashMap<String,List<MethodDoc>>();
+ 
+     /**
+      * The mapping of ClassDocs to ExecutableMemberDocs that have return type
+      * with type parameters of that class.
+      */
+-    public Map classToExecMemberDocReturnTypeParam = new HashMap();
++    public Map<String,List<MethodDoc>> classToExecMemberDocReturnTypeParam = new HashMap<String,List<MethodDoc>>();
+ 
+     /**
+      * The mapping of AnnotationTypeDocs to MethodDoc parameters that use them.
+      */
+-    public Map classToExecMemberDocParamAnnotation = new HashMap();
++    public Map<String,List<ExecutableMemberDoc>> classToExecMemberDocParamAnnotation = new HashMap<String,List<ExecutableMemberDoc>>();
+ 
+     /**
+      * The mapping of ClassDocs to FieldDocs that use them as type parameters.
+      */
+-    public Map classToFieldDocTypeParam = new HashMap();
++    public Map<String,List<FieldDoc>> classToFieldDocTypeParam = new HashMap<String,List<FieldDoc>>();
+ 
+     /**
+      * The mapping of AnnotationTypeDocs to FieldDocs that use them.
+      */
+-    public Map annotationToFieldDoc = new HashMap();
++    public Map<String,List<FieldDoc>> annotationToFieldDoc = new HashMap<String,List<FieldDoc>>();
+ 
+ 
+     public ClassUseMapper(RootDoc root, ClassTree classtree) {
+         this.classtree = classtree;
+ 
+         // Map subclassing, subinterfacing implementing, ...
+-        for (Iterator it = classtree.baseclasses().iterator(); it.hasNext();) {
+-            subclasses((ClassDoc)it.next());
++        for (Iterator<ClassDoc> it = classtree.baseclasses().iterator(); it.hasNext();) {
++            subclasses(it.next());
+         }
+-        for (Iterator it = classtree.baseinterfaces().iterator(); it.hasNext();) {
++        for (Iterator<ClassDoc> it = classtree.baseinterfaces().iterator(); it.hasNext();) {
+             // does subinterfacing as side-effect
+-            implementingClasses((ClassDoc)it.next());
++            implementingClasses(it.next());
+         }
+         // Map methods, fields, constructors using a class.
+         ClassDoc[] classes = root.classes();
+@@ -231,15 +231,15 @@
+     /**
+      * Return all subclasses of a class AND fill-in classToSubclass map.
+      */
+-    private Collection subclasses(ClassDoc cd) {
+-        Collection ret = (Collection)classToSubclass.get(cd.qualifiedName());
++    private Collection<ClassDoc> subclasses(ClassDoc cd) {
++        Collection<ClassDoc> ret = classToSubclass.get(cd.qualifiedName());
+         if (ret == null) {
+-            ret = new TreeSet();
+-            List subs = classtree.subclasses(cd);
++            ret = new TreeSet<ClassDoc>();
++            List<ClassDoc> subs = classtree.subclasses(cd);
+             if (subs != null) {
+                 ret.addAll(subs);
+-                for (Iterator it = subs.iterator(); it.hasNext();) {
+-                    ret.addAll(subclasses((ClassDoc)it.next()));
++                for (Iterator<ClassDoc> it = subs.iterator(); it.hasNext();) {
++                    ret.addAll(subclasses(it.next()));
+                 }
+             }
+             addAll(classToSubclass, cd, ret);
+@@ -250,15 +250,15 @@
+     /**
+      * Return all subinterfaces of an interface AND fill-in classToSubinterface map.
+      */
+-    private Collection subinterfaces(ClassDoc cd) {
+-        Collection ret = (Collection)classToSubinterface.get(cd.qualifiedName());
++    private Collection<ClassDoc> subinterfaces(ClassDoc cd) {
++        Collection<ClassDoc> ret = classToSubinterface.get(cd.qualifiedName());
+         if (ret == null) {
+-            ret = new TreeSet();
+-            List subs = classtree.subinterfaces(cd);
++            ret = new TreeSet<ClassDoc>();
++            List<ClassDoc> subs = classtree.subinterfaces(cd);
+             if (subs != null) {
+                 ret.addAll(subs);
+-                for (Iterator it = subs.iterator(); it.hasNext();) {
+-                    ret.addAll(subinterfaces((ClassDoc)it.next()));
++                for (Iterator<ClassDoc> it = subs.iterator(); it.hasNext();) {
++                    ret.addAll(subinterfaces(it.next()));
+                 }
+             }
+             addAll(classToSubinterface, cd, ret);
+@@ -272,19 +272,19 @@
+      * implementing subinterfaces) AND fill-in both classToImplementingClass
+      * and classToSubinterface maps.
+      */
+-    private Collection implementingClasses(ClassDoc cd) {
+-        Collection ret = (List)classToImplementingClass.get(cd.qualifiedName());
++    private Collection<ClassDoc> implementingClasses(ClassDoc cd) {
++        Collection<ClassDoc> ret = classToImplementingClass.get(cd.qualifiedName());
+         if (ret == null) {
+-            ret = new TreeSet();
+-            List impl = classtree.implementingclasses(cd);
++            ret = new TreeSet<ClassDoc>();
++            List<ClassDoc> impl = classtree.implementingclasses(cd);
+             if (impl != null) {
+                 ret.addAll(impl);
+-                for (Iterator it = impl.iterator(); it.hasNext();) {
+-                    ret.addAll(subclasses((ClassDoc)it.next()));
++                for (Iterator<ClassDoc> it = impl.iterator(); it.hasNext();) {
++                    ret.addAll(subclasses(it.next()));
+                 }
+             }
+-            for (Iterator it = subinterfaces(cd).iterator(); it.hasNext();) {
+-                ret.addAll(implementingClasses((ClassDoc)it.next()));
++            for (Iterator<ClassDoc> it = subinterfaces(cd).iterator(); it.hasNext();) {
++                ret.addAll(implementingClasses(it.next()));
+             }
+             addAll(classToImplementingClass, cd, ret);
+         }
+@@ -298,7 +298,7 @@
+     private void mapExecutable(ExecutableMemberDoc em) {
+         Parameter[] params = em.parameters();
+         boolean isConstructor = em.isConstructor();
+-        List classArgs = new ArrayList();
++        List<Type> classArgs = new ArrayList();
+         for (int k = 0; k < params.length; k++) {
+             Type pcd = params[k].type();
+             // primitives don't get mapped, also avoid dups
+@@ -325,34 +325,36 @@
+         }
+     }
+ 
+-    private List refList(Map map, ClassDoc cd) {
+-        List list = (List)map.get(cd.qualifiedName());
++    private <T> List<T> refList(Map<String,List<T>> map, ClassDoc cd) {
++        List<T> list = map.get(cd.qualifiedName());
+         if (list == null) {
+-            list = new ArrayList();
++            List<T> l = new ArrayList<T>();
++            list = l;
+             map.put(cd.qualifiedName(), list);
+         }
+         return list;
+     }
+ 
+-    private Set packageSet(ClassDoc cd) {
+-        Set pkgSet = (Set)classToPackage.get(cd.qualifiedName());
++    private Set<PackageDoc> packageSet(ClassDoc cd) {
++        Set<PackageDoc> pkgSet = classToPackage.get(cd.qualifiedName());
+         if (pkgSet == null) {
+-            pkgSet = new TreeSet();
++            pkgSet = new TreeSet<PackageDoc>();
+             classToPackage.put(cd.qualifiedName(), pkgSet);
+         }
+         return pkgSet;
+     }
+ 
+-    private Set classSet(ClassDoc cd) {
+-        Set clsSet = (Set)classToClass.get(cd.qualifiedName());
++    private Set<ClassDoc> classSet(ClassDoc cd) {
++        Set<ClassDoc> clsSet = classToClass.get(cd.qualifiedName());
+         if (clsSet == null) {
+-            clsSet = new TreeSet();
++            Set<ClassDoc> s = new TreeSet<ClassDoc>();
++            clsSet = s;
+             classToClass.put(cd.qualifiedName(), clsSet);
+         }
+         return clsSet;
+     }
+ 
+-    private void add(Map map, ClassDoc cd, ProgramElementDoc ref) {
++    private <T extends ProgramElementDoc> void add(Map<String,List<T>> map, ClassDoc cd, T ref) {
+         // add to specified map
+         refList(map, cd).add(ref);
+ 
+@@ -361,7 +363,7 @@
+ 
+         classSet(cd).add(ref instanceof MemberDoc?
+                 ((MemberDoc)ref).containingClass() :
+-                    ref);
++                    (ClassDoc)ref);
+     }
+ 
+     private void addAll(Map map, ClassDoc cd, Collection refs) {
+@@ -371,15 +373,13 @@
+         // add to specified map
+         refList(map, cd).addAll(refs);
+ 
+-        Set pkgSet = packageSet(cd);
+-        Set clsSet = classSet(cd);
++        Set<PackageDoc> pkgSet = packageSet(cd);
++        Set<ClassDoc> clsSet = classSet(cd);
+         // add ref's package to package map and class map
+-        for (Iterator it = refs.iterator(); it.hasNext();) {
+-            ProgramElementDoc pedoc = (ProgramElementDoc)it.next();
+-            pkgSet.add(pedoc.containingPackage());
+-            clsSet.add(pedoc instanceof MemberDoc?
+-                    ((MemberDoc)pedoc).containingClass() :
+-                        pedoc);
++        for (Iterator<ClassDoc> it = refs.iterator(); it.hasNext();) {
++	    ClassDoc cls = it.next();
++            pkgSet.add(cls.containingPackage());
++            clsSet.add(cls);
+ 
+         }
+     }
+@@ -392,8 +392,8 @@
+      * @param doc the doc whose type parameters are being checked.
+      * @param holder the holder that owns the type parameters.
+      */
+-    private void mapTypeParameters(Map map, Object doc,
+-            ProgramElementDoc holder) {
++    private <T extends ProgramElementDoc> void mapTypeParameters(Map<String,List<T>> map, Object doc,
++            T holder) {
+         TypeVariable[] typeVariables;
+         if (doc instanceof ClassDoc) {
+             typeVariables = ((ClassDoc) doc).typeParameters();
+@@ -438,8 +438,8 @@
+      * @param doc the doc whose type parameters are being checked.
+      * @param holder the holder that owns the type parameters.
+      */
+-    private void mapAnnotations(Map map, Object doc,
+-            Object holder) {
++    private <T extends ProgramElementDoc> void mapAnnotations(Map<String,List<T>> map, Object doc,
++            T holder) {
+         TypeVariable[] typeVariables;
+         AnnotationDesc[] annotations;
+         boolean isPackage = false;
+@@ -458,12 +458,31 @@
+             if (isPackage)
+                 refList(map, annotationDoc).add(holder);
+             else
+-                add(map, annotationDoc, (ProgramElementDoc) holder);
++                add(map, annotationDoc, holder);
+         }
+     }
+ 
+-    private void addTypeParameterToMap(Map map, Type type,
+-            ProgramElementDoc holder) {
++
++    /**
++     * Map the AnnotationType to the ProgramElementDocs that use them as
++     * type parameters.
++     *
++     * @param map the map the insert the information into.
++     * @param doc the doc whose type parameters are being checked.
++     * @param holder the holder that owns the type parameters.
++     */
++    private <T extends PackageDoc> void mapAnnotations(Map<String,List<T>> map, PackageDoc doc,
++            T holder) {
++        AnnotationDesc[] annotations;
++        annotations = doc.annotations();
++        for (int i = 0; i < annotations.length; i++) {
++            AnnotationTypeDoc annotationDoc = annotations[i].annotationType();
++            refList(map, annotationDoc).add(holder);
++	}
++    }
++
++    private <T extends ProgramElementDoc> void addTypeParameterToMap(Map<String,List<T>> map, Type type,
++            T holder) {
+         if (type instanceof ClassDoc) {
+             add(map, (ClassDoc) type, holder);
+         } else if (type instanceof ParameterizedType) {

Added: trunk/java/openjdk6/files/icedtea/security/20130618/langtools_merge-01.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/langtools_merge-01.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/langtools_merge-01.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,30 @@
+# HG changeset patch
+# User andrew
+# Date 1371734829 18000
+# Node ID 9aefba5680d55a2e3f718c03cd27cf027c7fc1f9
+# Parent  f422c843b477501acc2526c69609fd94204cdce1
+Fix merge error
+
+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,7 +36,6 @@
+ 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.
+@@ -362,11 +361,4 @@
+     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;
+-    }
+ }

Added: trunk/java/openjdk6/files/icedtea/security/20130618/langtools_merge-02.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/langtools_merge-02.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/langtools_merge-02.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,30 @@
+# HG changeset patch
+# User andrew
+# Date 1371735102 18000
+# Node ID 335cdc9887c56f560991275fe8d32e6edb6b3f1e
+# Parent  9aefba5680d55a2e3f718c03cd27cf027c7fc1f9
+Fix more merge issues
+
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java
+@@ -102,6 +102,8 @@
+                     builder.methods,
+                     configuration.getMemberComparator());
+         }
++	return builder;
++    }
+ 
+     /**
+      * {@inheritDoc}
+diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java
+--- langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java
++++ langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java
+@@ -179,6 +179,7 @@
+                     configuration.getText("doclet.Interface_Summary"),
+                     interfaceTableSummary, interfaceTableHeader, summaryContentTree);
+         }
++    }
+ 
+     /**
+      * Build the summary for the classes in this package.

Added: trunk/java/openjdk6/files/icedtea/security/20130618/langtools_merge-03.patch
===================================================================
--- trunk/java/openjdk6/files/icedtea/security/20130618/langtools_merge-03.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/icedtea/security/20130618/langtools_merge-03.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,18 @@
+# HG changeset patch
+# User andrew
+# Date 1371838665 18000
+# Node ID 41f5d151d8477b8450ecea825143c608c312291e
+# Parent  a5c99fd80b4c9f5049351bf5bff8517dd6d3b613
+Remove leftover tag
+
+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
+@@ -141,7 +141,6 @@
+                 <ConstantMembers/>
+             </ClassConstantSummary>
+         </ConstantSummaries>    
+-        <Footer/>
+     </ConstantSummary>
+     
+     <SerializedForm>

Index: trunk/java/openjdk6/files/patch-ZoneInfoFile.java
===================================================================
--- trunk/java/openjdk6/files/patch-ZoneInfoFile.java	2013-09-17 02:40:23 UTC (rev 15459)
+++ trunk/java/openjdk6/files/patch-ZoneInfoFile.java	2013-09-17 03:10:26 UTC (rev 15460)

Property changes on: trunk/java/openjdk6/files/patch-ZoneInfoFile.java
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.1
\ No newline at end of property
Modified: trunk/java/openjdk6/files/patch-set
===================================================================
--- trunk/java/openjdk6/files/patch-set	2013-09-17 02:40:23 UTC (rev 15459)
+++ trunk/java/openjdk6/files/patch-set	2013-09-17 03:10:26 UTC (rev 15460)
@@ -1,5 +1,5 @@
---- Makefile	2011-07-05 14:29:12.000000000 -0400
-+++ Makefile	2011-07-07 19:17:02.000000000 -0400
+--- Makefile
++++ Makefile
 @@ -236,6 +236,18 @@
  
  clean: clobber
@@ -19,8 +19,8 @@
  #
  # Dev builds
  #
---- corba/make/common/Defs-bsd.gmk	2011-07-07 19:16:00.000000000 -0400
-+++ corba/make/common/Defs-bsd.gmk	2011-07-07 19:17:02.000000000 -0400
+--- corba/make/common/Defs-bsd.gmk
++++ corba/make/common/Defs-bsd.gmk
 @@ -40,18 +40,12 @@
  # Get shared JDK settings
  include $(BUILDDIR)/common/shared/Defs.gmk
@@ -142,8 +142,8 @@
  override OTHER_M4FLAGS           = -D__GLIBC__ -DGNU_ASSEMBLER
  override SUN_CMM_SUBDIR          =
  override THREADS_FLAG            = native
---- corba/make/common/Defs-linux.gmk	2011-07-05 14:29:22.000000000 -0400
-+++ corba/make/common/Defs-linux.gmk	2011-07-07 19:17:02.000000000 -0400
+--- corba/make/common/Defs-linux.gmk
++++ corba/make/common/Defs-linux.gmk
 @@ -290,7 +290,7 @@
  override LIBTHREAD               =
  override MOOT_PRIORITIES         = true
@@ -153,8 +153,8 @@
  ifeq ($(ARCH), amd64)
  override OPENWIN_LIB             = $(OPENWIN_HOME)/lib64
  else
---- corba/make/common/Defs.gmk	2011-07-05 14:29:22.000000000 -0400
-+++ corba/make/common/Defs.gmk	2011-07-07 19:17:02.000000000 -0400
+--- corba/make/common/Defs.gmk
++++ corba/make/common/Defs.gmk
 @@ -53,6 +53,24 @@
  
  _OUTPUTDIR=$(TOPDIR)/build/$(PLATFORM)-$(ARCH)
@@ -190,8 +190,8 @@
  endif # PROGRAM
  
  LDLIBS_COMMON += $(EXTRA_LIBS)
---- corba/make/common/Mapfile-vers.gmk	2011-07-05 14:29:22.000000000 -0400
-+++ corba/make/common/Mapfile-vers.gmk	2011-07-07 19:17:02.000000000 -0400
+--- corba/make/common/Mapfile-vers.gmk
++++ corba/make/common/Mapfile-vers.gmk
 @@ -77,7 +77,7 @@
  endif # PLATFORM
  
@@ -201,8 +201,8 @@
  
  ifeq ($(VARIANT), OPT)
    # OPT build MUST have a mapfile?
---- corba/make/common/shared/Compiler-gcc.gmk	2011-07-05 14:29:22.000000000 -0400
-+++ corba/make/common/shared/Compiler-gcc.gmk	2011-07-07 19:17:02.000000000 -0400
+--- corba/make/common/shared/Compiler-gcc.gmk
++++ corba/make/common/shared/Compiler-gcc.gmk
 @@ -100,6 +100,24 @@
  
  endif
@@ -209,9 +209,9 @@
  
 +ifeq ($(PLATFORM), bsd)
 +  # Settings specific to BSD
-+  CC             = $(COMPILER_PATH)gcc
-+  CPP            = $(COMPILER_PATH)gcc -E
-+  CXX            = $(COMPILER_PATH)g++
++  CC             ?= $(COMPILER_PATH)gcc
++  CPP            ?= $(COMPILER_PATH)gcc -E
++  CXX            ?= $(COMPILER_PATH)g++
 +  REQUIRED_CC_VER = 3.3
 +  REQUIRED_GCC_VER = 3.3.*
 +
@@ -228,8 +228,8 @@
  ifeq ($(PLATFORM), solaris)
  
    # Settings specific to Solaris
---- corba/make/common/shared/Compiler.gmk	2011-07-05 14:29:22.000000000 -0400
-+++ corba/make/common/shared/Compiler.gmk	2011-07-07 19:17:02.000000000 -0400
+--- corba/make/common/shared/Compiler.gmk
++++ corba/make/common/shared/Compiler.gmk
 @@ -42,6 +42,11 @@
    override CC_VERSION = gcc
  endif
@@ -242,8 +242,8 @@
  # Get the compiler specific settings
  include $(BUILDDIR)/common/shared/Compiler-$(CC_VERSION).gmk
  
---- corba/make/common/shared/Defs-bsd.gmk	2011-07-07 19:16:00.000000000 -0400
-+++ corba/make/common/shared/Defs-bsd.gmk	2011-07-07 19:17:02.000000000 -0400
+--- corba/make/common/shared/Defs-bsd.gmk
++++ corba/make/common/shared/Defs-bsd.gmk
 @@ -54,7 +54,7 @@
  endef
  
@@ -262,8 +262,8 @@
  endif
  
  # _BOOTDIR1: First choice for a Bootstrap JDK, previous released JDK.
---- corba/make/common/shared/Defs-java.gmk	2011-07-05 14:29:22.000000000 -0400
-+++ corba/make/common/shared/Defs-java.gmk	2011-07-07 19:17:02.000000000 -0400
+--- corba/make/common/shared/Defs-java.gmk
++++ corba/make/common/shared/Defs-java.gmk
 @@ -38,7 +38,7 @@
    #   Suspect this may not be needed anymore.
    JAVA_MEM_FLAGS   += -Xms$(MAX_VM_MEMORY)m -XX:-Inline
@@ -273,8 +273,8 @@
  endif
  
  # 
---- corba/make/common/shared/Defs-utils.gmk	2011-07-05 14:29:22.000000000 -0400
-+++ corba/make/common/shared/Defs-utils.gmk	2011-07-07 19:17:02.000000000 -0400
+--- corba/make/common/shared/Defs-utils.gmk
++++ corba/make/common/shared/Defs-utils.gmk
 @@ -53,6 +53,13 @@
    UTILS_DEVTOOL_PATH=$(USRBIN_PATH)
  endif
@@ -322,17 +322,17 @@
 +    TAR        = $(UTILS_USR_BIN_PATH)tar
 +  endif
 +endif
---- corba/make/common/shared/Platform.gmk	2011-07-05 14:29:22.000000000 -0400
-+++ corba/make/common/shared/Platform.gmk	2011-07-07 19:17:02.000000000 -0400
+--- corba/make/common/shared/Platform.gmk
++++ corba/make/common/shared/Platform.gmk
 @@ -261,6 +261,76 @@
    MB_OF_MEMORY := $(shell free -m | fgrep Mem: | sed -e 's@\ \ *@ @g' | cut -d' ' -f2)
  endif
  
-+ifeq ($(SYSTEM_UNAME), MidnightBSD)
++ifeq ($(SYSTEM_UNAME), FreeBSD)
 +  PLATFORM = bsd
-+  OS_NAME = midnightbsd
-+  OS_VENDOR = MidnightBSD
-+ REQUIRED_OS_VERSION = 0.3
++  OS_NAME = freebsd
++  OS_VENDOR = FreeBSD
++ REQUIRED_OS_VERSION = 6.0
 +endif
 +
 +ifeq ($(SYSTEM_UNAME), Darwin)
@@ -401,7 +401,7 @@
  # Windows with and without CYGWIN will be slightly different
  ifeq ($(SYSTEM_UNAME), Windows_NT)
    PLATFORM = windows
-@@ -375,7 +445,14 @@
+@@ -408,7 +478,14 @@
  #    build machines and adjustments will be made to prevent excessing
  #    system swapping during the build.
  #    If we don't know, assume 512. Subtract 128 from MB for VM MAX.
@@ -417,7 +417,7 @@
  ifneq ($(MB_OF_MEMORY),)
    LOW_MEMORY_MACHINE := $(shell \
      if [ $(MB_OF_MEMORY) -le 512 ] ; then \
-@@ -387,7 +464,7 @@
+@@ -420,7 +497,7 @@
      if [ $(MB_OF_MEMORY) -le 1024 ] ; then \
        expr $(MB_OF_MEMORY) '-' 128 ; \
      else \
@@ -426,8 +426,8 @@
      fi)
    MIN_VM_MEMORY := $(shell \
      if [ $(MAX_VM_MEMORY) -le 128 ] ; then \
---- hotspot/agent/make/Makefile	2011-07-05 14:30:51.000000000 -0400
-+++ hotspot/agent/make/Makefile	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/agent/make/Makefile
++++ hotspot/agent/make/Makefile
 @@ -52,6 +52,9 @@
  sun.jvm.hotspot.compiler \
  sun.jvm.hotspot.debugger \
@@ -468,8 +468,8 @@
  sun/jvm/hotspot/runtime/ia64/*.java \
  sun/jvm/hotspot/runtime/linux/*.java \
  sun/jvm/hotspot/runtime/linux_amd64/*.java \
---- hotspot/agent/src/os/bsd/BsdDebuggerLocal.c	2011-07-07 19:15:59.000000000 -0400
-+++ hotspot/agent/src/os/bsd/BsdDebuggerLocal.c	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/agent/src/os/bsd/BsdDebuggerLocal.c
++++ hotspot/agent/src/os/bsd/BsdDebuggerLocal.c
 @@ -22,6 +22,7 @@
   *
   */
@@ -609,17 +609,19 @@
  
  #endif /* amd64 */
  
---- hotspot/agent/src/os/bsd/Makefile	2012-01-12 17:22:08.000000000 -0500
-+++ hotspot/agent/src/os/bsd/Makefile	2012-01-12 16:53:06.000000000 -0500
-@@ -22,7 +22,7 @@
+--- hotspot/agent/src/os/bsd/Makefile
++++ hotspot/agent/src/os/bsd/Makefile
+@@ -22,8 +22,8 @@
  #  
  #
  
 -ARCH := $(shell if ([ `uname -m` = "ia64" ])  ; then echo ia64 ; elif ([ `uname -m` = "x86_64" ]) ; then echo amd64; elif ([ `uname -m` = "sparc64" ]) ; then echo sparc; else echo i386 ; fi )
+-GCC      = gcc
 +ARCH := $(shell if ([ `uname -m` = "ia64" ])  ; then echo ia64 ; elif ([ `uname -m` = "amd64" ]) ; then echo amd64; elif ([ `uname -m` = "sparc64" ]) ; then echo sparc; else echo i386 ; fi )
- GCC      = gcc
++GCC      ?= gcc
  
  JAVAH    = ${JAVA_HOME}/bin/javah
+ 
 @@ -32,25 +32,24 @@
  	libproc_impl.c  \
  	ps_proc.c       \
@@ -684,8 +686,8 @@
 +	rm -f test.o
 +	-rmdir $(ARCH)
  
---- hotspot/agent/src/os/bsd/elfmacros.h	2011-07-07 19:15:59.000000000 -0400
-+++ hotspot/agent/src/os/bsd/elfmacros.h	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/agent/src/os/bsd/elfmacros.h
++++ hotspot/agent/src/os/bsd/elfmacros.h
 @@ -25,16 +25,19 @@
  #ifndef _ELFMACROS_H_
  #define _ELFMACROS_H_
@@ -721,8 +723,8 @@
  
  #endif
  
---- hotspot/agent/src/os/bsd/libproc.h	2011-07-07 19:15:59.000000000 -0400
-+++ hotspot/agent/src/os/bsd/libproc.h	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/agent/src/os/bsd/libproc.h
++++ hotspot/agent/src/os/bsd/libproc.h
 @@ -27,7 +27,8 @@
  
  #include <unistd.h>
@@ -783,8 +785,8 @@
  
  // get number of shared objects
  int get_num_libs(struct ps_prochandle* ph);
---- hotspot/agent/src/os/bsd/libproc_impl.c	2011-07-07 19:15:59.000000000 -0400
-+++ hotspot/agent/src/os/bsd/libproc_impl.c	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/agent/src/os/bsd/libproc_impl.c
++++ hotspot/agent/src/os/bsd/libproc_impl.c
 @@ -174,10 +174,13 @@
        return NULL;
     }
@@ -804,7 +806,7 @@
  }
  
  // add a thread to ps_prochandle
-+#ifdef __MidnightBSD__
++#ifdef __FreeBSD__
 +thread_info* add_thread_info(struct ps_prochandle* ph, lwpid_t lwp_id) {
 +   thread_info* newthr;
 +   if ( (newthr = (thread_info*) calloc(1, sizeof(thread_info))) == NULL) {
@@ -837,7 +839,7 @@
      return err;
    }
  
-+#ifdef __MidnightBSD__
++#ifdef __FreeBSD__
 +  print_debug("thread_db : lwp %d\n", ti.ti_lid);
 +
 +  if (ptr->callback(ptr->ph, ti.ti_lid) != true)
@@ -927,8 +929,8 @@
 +  print_debug("ps_pcontinue not implemented\n");
    return PS_OK;
  }
---- hotspot/agent/src/os/bsd/libproc_impl.h	2011-07-07 19:15:59.000000000 -0400
-+++ hotspot/agent/src/os/bsd/libproc_impl.h	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/agent/src/os/bsd/libproc_impl.h
++++ hotspot/agent/src/os/bsd/libproc_impl.h
 @@ -47,7 +47,7 @@
  typedef struct thread_info {
     lwpid_t                  lwp_id;
@@ -962,7 +964,7 @@
  void print_debug(const char* format,...);
  bool is_debug();
  
-+#ifdef __MidnightBSD__
++#ifdef __FreeBSD__
 +typedef bool (*thread_info_callback)(struct ps_prochandle* ph, lwpid_t lwpid);
 +#else
  typedef bool (*thread_info_callback)(struct ps_prochandle* ph, pthread_t pid, lwpid_t lwpid);
@@ -974,7 +976,7 @@
                            uintptr_t base);
  
  // adds a new thread to threads list, returns NULL on failure
-+#ifdef __MidnightBSD__
++#ifdef __FreeBSD__
 +thread_info* add_thread_info(struct ps_prochandle* ph, lwpid_t lwp_id);
 +#else
  thread_info* add_thread_info(struct ps_prochandle* ph, pthread_t pthread_id, lwpid_t lwp_id);
@@ -982,8 +984,8 @@
  
  // a test for ELF signature without using libelf
  bool is_elf_file(int fd);
---- hotspot/agent/src/os/bsd/mapfile	2011-07-07 19:15:59.000000000 -0400
-+++ hotspot/agent/src/os/bsd/mapfile	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/agent/src/os/bsd/mapfile
++++ hotspot/agent/src/os/bsd/mapfile
 @@ -43,13 +43,17 @@
  		# proc_service.h functions - to be used by libthread_db
  		ps_getpid;
@@ -1005,8 +1007,8 @@
  
                  # used by attach test program
                  init_libproc;
---- hotspot/agent/src/os/bsd/proc_service.h	2011-07-07 19:15:59.000000000 -0400
-+++ hotspot/agent/src/os/bsd/proc_service.h	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/agent/src/os/bsd/proc_service.h
++++ hotspot/agent/src/os/bsd/proc_service.h	1969-12-31 19:00:00.000000000 -0500
 @@ -1,76 +0,0 @@
 -/*
 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
@@ -1084,8 +1086,8 @@
 -ps_err_e ps_get_thread_area();
 -
 -#endif /* _PROC_SERVICE_H_ */
---- hotspot/agent/src/os/bsd/ps_core.c	2011-07-07 19:15:59.000000000 -0400
-+++ hotspot/agent/src/os/bsd/ps_core.c	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/agent/src/os/bsd/ps_core.c
++++ hotspot/agent/src/os/bsd/ps_core.c
 @@ -142,6 +142,7 @@
  
     map->next = ph->core->class_share_maps;
@@ -1191,7 +1193,7 @@
     prstatus_t* prstat = (prstatus_t*) buf;
     thread_info* newthr;
     print_debug("got integer regset for lwp %d\n", prstat->pr_pid);
-+#ifdef __MidnightBSD__
++#ifdef __FreeBSD__
 +   if((newthr = add_thread_info(ph, prstat->pr_pid)) == NULL)
 +      return false;
 +#else
@@ -1407,8 +1409,8 @@
  
     struct ps_prochandle* ph = (struct ps_prochandle*) calloc(1, sizeof(struct ps_prochandle));
     if (ph == NULL) {
---- hotspot/agent/src/os/bsd/ps_proc.c	2011-07-07 19:15:59.000000000 -0400
-+++ hotspot/agent/src/os/bsd/ps_proc.c	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/agent/src/os/bsd/ps_proc.c
++++ hotspot/agent/src/os/bsd/ps_proc.c
 @@ -22,20 +22,22 @@
   *
   */
@@ -1659,7 +1661,7 @@
 -
 -   return i;
 +// callback for read_thread_info
-+#ifdef __MidnightBSD__
++#ifdef __FreeBSD__
 +static bool add_new_thread(struct ps_prochandle* ph, lwpid_t lwp_id) {
 +  return add_thread_info(ph, lwp_id) != NULL;
 +}
@@ -1807,7 +1809,7 @@
 -  if (fp == NULL) {
 -    print_debug("can't open /proc/%d/maps file\n", ph->pid);
 -    return false;
-+#if defined(__MidnightBSD__) && __MidnightBSD_version >= 3000
++#if defined(__FreeBSD__) && __FreeBSD_version >= 701000
 +  struct kinfo_vmentry *freep, *kve;
 +  int i, cnt;
 +
@@ -1980,8 +1982,8 @@
 -  }
    return ph;
  }
---- hotspot/agent/src/os/bsd/salibelf.c	2011-07-07 19:15:59.000000000 -0400
-+++ hotspot/agent/src/os/bsd/salibelf.c	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/agent/src/os/bsd/salibelf.c
++++ hotspot/agent/src/os/bsd/salibelf.c
 @@ -25,6 +25,7 @@
  #include "salibelf.h"
  #include <stdlib.h>
@@ -1990,8 +1992,8 @@
  
  extern void print_debug(const char*,...);
  
---- hotspot/agent/src/os/bsd/symtab.c	2012-01-12 17:22:08.000000000 -0500
-+++ hotspot/agent/src/os/bsd/symtab.c	2012-01-12 16:54:45.000000000 -0500
+--- hotspot/agent/src/os/bsd/symtab.c
++++ hotspot/agent/src/os/bsd/symtab.c
 @@ -23,10 +23,11 @@
   */
  
@@ -2536,8 +2538,8 @@
    }
    return NULL;
  }
---- hotspot/agent/src/os/bsd/symtab.h	2011-07-07 19:15:59.000000000 -0400
-+++ hotspot/agent/src/os/bsd/symtab.h	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/agent/src/os/bsd/symtab.h
++++ hotspot/agent/src/os/bsd/symtab.h
 @@ -32,7 +32,7 @@
  struct symtab;
  
@@ -2547,8 +2549,8 @@
  
  // destroy the symbol table
  void destroy_symtab(struct symtab* symtab);
---- hotspot/agent/src/os/bsd/test.c	2011-07-07 19:15:59.000000000 -0400
-+++ hotspot/agent/src/os/bsd/test.c	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/agent/src/os/bsd/test.c
++++ hotspot/agent/src/os/bsd/test.c
 @@ -44,7 +44,7 @@
        }
  
@@ -2558,8 +2560,8 @@
          return 1;
        }
     }
---- hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java	2011-07-05 14:30:52.000000000 -0400
-+++ hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java
++++ hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java
 @@ -28,6 +28,7 @@
  import java.net.*;
  import java.rmi.*;
@@ -2629,8 +2631,8 @@
      /** Convenience routine which should be called by per-platform
        debugger setup. Should not be called when startupMode is
        REMOTE_MODE. */
---- hotspot/agent/src/share/classes/sun/jvm/hotspot/bugspot/BugSpotAgent.java	2011-07-05 14:30:53.000000000 -0400
-+++ hotspot/agent/src/share/classes/sun/jvm/hotspot/bugspot/BugSpotAgent.java	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/agent/src/share/classes/sun/jvm/hotspot/bugspot/BugSpotAgent.java
++++ hotspot/agent/src/share/classes/sun/jvm/hotspot/bugspot/BugSpotAgent.java
 @@ -29,6 +29,7 @@
  import java.rmi.*;
  import sun.jvm.hotspot.*;
@@ -2702,8 +2704,8 @@
      /** Convenience routine which should be called by per-platform
        debugger setup. Should not be called when startupMode is
        REMOTE_MODE. */
---- hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdCDebugger.java	2011-07-07 19:16:00.000000000 -0400
-+++ hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdCDebugger.java	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdCDebugger.java
++++ hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdCDebugger.java
 @@ -30,10 +30,8 @@
  import sun.jvm.hotspot.debugger.cdbg.*;
  import sun.jvm.hotspot.debugger.x86.*;
@@ -2729,8 +2731,8 @@
      } else {
         throw new DebuggerException(cpu + " is not yet supported");
      }
---- hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdThreadContextFactory.java	2011-07-07 19:16:00.000000000 -0400
-+++ hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdThreadContextFactory.java	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdThreadContextFactory.java
++++ hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdThreadContextFactory.java
 @@ -26,9 +26,7 @@
  
  import sun.jvm.hotspot.debugger.*;
@@ -2752,30 +2754,30 @@
        } else {
           throw new RuntimeException("cpu " + cpu + " is not yet supported");
        }
---- hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ConnectorImpl.java	2011-07-05 14:30:54.000000000 -0400
-+++ hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ConnectorImpl.java	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ConnectorImpl.java
++++ hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ConnectorImpl.java
 @@ -217,7 +217,7 @@
      }
  
      protected void checkNativeLink(SecurityManager sm, String os) {
 -        if (os.equals("SunOS") || os.equals("Linux")) {
-+        if (os.equals("SunOS") || os.equals("Linux") || os.equals("MidnightBSD")) {
++        if (os.equals("SunOS") || os.equals("Linux") || os.equals("FreeBSD")) {
              // link "saproc" - SA native library on SunOS and Linux?
              sm.checkLink("saproc");
          } else if (os.startsWith("Windows")) {
---- hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/SAPIDAttachingConnector.java	2011-07-05 14:30:54.000000000 -0400
-+++ hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/SAPIDAttachingConnector.java	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/SAPIDAttachingConnector.java
++++ hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/SAPIDAttachingConnector.java
 @@ -66,7 +66,7 @@
              try {
                  // Whether the caller can perform link against SA native library?
                  checkNativeLink(sm, os);
 -                if (os.equals("SunOS") || os.equals("Linux")) {
-+                if (os.equals("SunOS") || os.equals("Linux") || os.equals("MidnightBSD")) {
++                if (os.equals("SunOS") || os.equals("Linux") || os.equals("FreeBSD")) {
                      // Whether the caller can read /proc/<pid> file?
                      sm.checkRead("/proc/" + pid);
                  }
---- hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java	2011-07-05 14:30:55.000000000 -0400
-+++ hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java
++++ hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java
 @@ -37,6 +37,8 @@
  import sun.jvm.hotspot.runtime.linux_ia64.LinuxIA64JavaThreadPDAccess;
  import sun.jvm.hotspot.runtime.linux_amd64.LinuxAMD64JavaThreadPDAccess;
@@ -2799,8 +2801,8 @@
          }
  
          if (access == null) {
---- hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd/BsdSignals.java	2011-07-07 19:16:00.000000000 -0400
-+++ hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd/BsdSignals.java	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd/BsdSignals.java
++++ hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd/BsdSignals.java
 @@ -28,37 +28,36 @@
    private static String[] signalNames = {
      "",           /* No signal 0 */
@@ -2861,8 +2863,8 @@
    };
  
    public static String getSignalName(int sigNum) {
---- hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd_x86/BsdSignals.java	2011-07-07 19:16:00.000000000 -0400
-+++ hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd_x86/BsdSignals.java	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd_x86/BsdSignals.java
++++ hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd_x86/BsdSignals.java
 @@ -28,37 +28,36 @@
    private static String[] signalNames = {
      "",           /* No signal 0 */
@@ -2923,13 +2925,13 @@
    };
  
    public static String getSignalName(int sigNum) {
---- hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java	2011-07-05 14:30:55.000000000 -0400
-+++ hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java
++++ hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java
 @@ -37,6 +37,14 @@
        return "solaris";
      } else if (os.equals("Linux")) {
        return "linux";
-+    } else if (os.equals("MidnightBSD")) {
++    } else if (os.equals("FreeBSD")) {
 +      return "bsd";
 +    } else if (os.equals("NetBSD")) {
 +      return "bsd";
@@ -2940,8 +2942,8 @@
      } else if (os.startsWith("Windows")) {
        return "win32";
      } else {
---- hotspot/make/Makefile	2011-07-05 14:30:56.000000000 -0400
-+++ hotspot/make/Makefile	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/make/Makefile
++++ hotspot/make/Makefile
 @@ -321,28 +321,28 @@
  ifneq ($(OSNAME),windows)
    ifeq ($(ZERO_BUILD), true)
@@ -2981,48 +2983,32 @@
  	$(install-file)
    endif
  endif
---- hotspot/make/bsd/Makefile	2011-07-07 19:16:00.000000000 -0400
-+++ hotspot/make/bsd/Makefile	2011-07-07 19:17:02.000000000 -0400
-@@ -39,11 +39,11 @@
- # One can set ALT_BOOTDIR or BOOTDIR to point to a jdk that runs on
- # an architecture that differs from the target architecture, as long
- # as the bootstrap jdk runs under the same flavor of OS as the target
--# (i.e., if the target is bsd, point to a jdk that runs on a bsd
-+# (i.e., if the target is linux, point to a jdk that runs on a linux
- # box).  In order to use such a bootstrap jdk, set the make variable
- # REMOTE to the desired remote command mechanism, e.g.,
- #
--#    make REMOTE="rsh -l me myotherbsdbox"
-+#    make REMOTE="rsh -l me myotherlinuxbox"
- 
- # Along with VM, Serviceability Agent (SA) is built for SA/JDI binding.
- # JDI binding on SA produces two binaries:
-@@ -94,7 +94,7 @@
- #
- # We only do this on SunOS variants, for a couple of reasons:
- #  * It is extremely rare that source trees exist on other systems
--#  * It has been claimed that the Bsd automounter is flakey, so
-+#  * It has been claimed that the Linux automounter is flakey, so
- #    changing GAMMADIR in a way that exercises the automounter could
- #    prove to be a source of unreliability in the build process.
- # Obviously, this Makefile is only relevant on SunOS boxes to begin
-@@ -226,11 +226,12 @@
- 
- checks: check_os_version check_j2se_version
- 
--# We do not want people accidentally building on old systems (e.g. Bsd 2.2.x,
-+# We do not want people accidentally building on old systems (e.g. Linux 2.2.x,
+--- hotspot/make/bsd/Makefile
++++ hotspot/make/bsd/Makefile
+@@ -230,7 +230,8 @@
  # Solaris 2.5.1, 2.6).
  # Disable this check by setting DISABLE_HOTSPOT_OS_VERSION_CHECK=ok.
  
--SUPPORTED_OS_VERSION = 2.4% 2.5% 2.6% 2.7%
-+#SUPPORTED_OS_VERSION = 2.4% 2.5% 2.6% 2.7%
+-SUPPORTED_OS_VERSION = 2.4% 2.5% 2.6% 3%
++#SUPPORTED_OS_VERSION = 2.4% 2.5% 2.6% 3%
 +DISABLE_HOTSPOT_OS_VERSION_CHECK = ok
  OS_VERSION := $(shell uname -r)
  EMPTY_IF_NOT_SUPPORTED = $(filter $(SUPPORTED_OS_VERSION),$(OS_VERSION))
  
---- hotspot/make/bsd/makefiles/buildtree.make	2011-07-07 19:16:00.000000000 -0400
-+++ hotspot/make/bsd/makefiles/buildtree.make	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/make/bsd/makefiles/adlc.make
++++ hotspot/make/bsd/makefiles/adlc.make
+@@ -60,7 +60,8 @@
+ 
+ # CFLAGS_WARN holds compiler options to suppress/enable warnings.
+ # Compiler warnings are treated as errors
+-CFLAGS_WARN = -Werror
++WARNINGS_ARE_ERRORS ?= -Werror
++CFLAGS_WARN = $(WARNINGS_ARE_ERRORS)
+ CFLAGS += $(CFLAGS_WARN)
+ 
+ OBJECTNAMES = \
+--- hotspot/make/bsd/makefiles/buildtree.make
++++ hotspot/make/bsd/makefiles/buildtree.make
 @@ -303,10 +303,11 @@
  	[ -n "$$JAVA_HOME" ] && { echo ": \$${JAVA_HOME:=$${JAVA_HOME}}"; }; \
  	{ \
@@ -3036,8 +3022,8 @@
  	) > $@
  
  env.csh: env.sh
---- hotspot/make/bsd/makefiles/cscope.make	2011-07-07 19:16:00.000000000 -0400
-+++ hotspot/make/bsd/makefiles/cscope.make	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/make/bsd/makefiles/cscope.make
++++ hotspot/make/bsd/makefiles/cscope.make
 @@ -71,7 +71,7 @@
  # OS-specific files for other systems are excluded by default.  Use CS_OS=yes
  # to include platform-specific files for other platforms.
@@ -3047,8 +3033,8 @@
  CS_PRUNE_OS	= $(patsubst %,-o -name '*%*',$(filter-out ${OS},${CS_OS}))
  endif
  
---- hotspot/make/bsd/makefiles/defs.make	2011-07-07 19:16:00.000000000 -0400
-+++ hotspot/make/bsd/makefiles/defs.make	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/make/bsd/makefiles/defs.make
++++ hotspot/make/bsd/makefiles/defs.make
 @@ -72,8 +72,8 @@
    HS_ARCH            = sparc
  endif
@@ -3155,8 +3141,8 @@
  EXPORT_LIST += $(ADD_SA_BINARIES/$(HS_ARCH))
 -
 -
---- hotspot/make/bsd/makefiles/gcc.make	2011-07-07 19:16:00.000000000 -0400
-+++ hotspot/make/bsd/makefiles/gcc.make	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/make/bsd/makefiles/gcc.make
++++ hotspot/make/bsd/makefiles/gcc.make
 @@ -22,20 +22,24 @@
  #  
  #
@@ -3210,6 +3196,15 @@
  endif
  
  CFLAGS     += $(ARCHFLAG)
+@@ -115,7 +121,7 @@
+ endif
+ 
+ # Compiler warnings are treated as errors
+-WARNINGS_ARE_ERRORS = -Werror
++WARNINGS_ARE_ERRORS ?= -Werror
+ 
+ # Except for a few acceptable ones
+ # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit
 @@ -130,6 +136,11 @@
  CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(ACCEPTABLE_WARNINGS)
  # Special cases
@@ -3280,8 +3275,8 @@
  
  #------------------------------------------------------------------------
  # Debug flags
---- hotspot/make/bsd/makefiles/jsig.make	2011-07-07 19:16:00.000000000 -0400
-+++ hotspot/make/bsd/makefiles/jsig.make	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/make/bsd/makefiles/jsig.make
++++ hotspot/make/bsd/makefiles/jsig.make
 @@ -25,11 +25,16 @@
  # Rules to build signal interposition library, used by vm.make
  
@@ -3321,8 +3316,8 @@
  	$(QUIETLY) [ -f $(LIBJSIG_G) ] || { ln -s $@ $(LIBJSIG_G); }
  
  install_jsig: $(LIBJSIG)
---- hotspot/make/bsd/makefiles/launcher.make	2011-07-07 19:16:00.000000000 -0400
-+++ hotspot/make/bsd/makefiles/launcher.make	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/make/bsd/makefiles/launcher.make
++++ hotspot/make/bsd/makefiles/launcher.make
 @@ -50,7 +50,7 @@
    LIBS_LAUNCHER             += $(STATIC_STDCXX) $(LIBS)
  else
@@ -3332,8 +3327,8 @@
    LIBS_LAUNCHER             += -l$(JVM) $(LIBS)
  endif
  
---- hotspot/make/bsd/makefiles/sa.make	2011-07-07 19:16:00.000000000 -0400
-+++ hotspot/make/bsd/makefiles/sa.make	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/make/bsd/makefiles/sa.make
++++ hotspot/make/bsd/makefiles/sa.make
 @@ -45,8 +45,8 @@
  
  # gnumake 3.78.1 does not accept the *s that
@@ -3345,8 +3340,8 @@
  
  AGENT_FILES1_LIST := $(GENERATED)/agent1.classes.list
  AGENT_FILES2_LIST := $(GENERATED)/agent2.classes.list
---- hotspot/make/bsd/makefiles/saproc.make	2012-01-12 17:22:09.000000000 -0500
-+++ hotspot/make/bsd/makefiles/saproc.make	2012-01-12 16:55:29.000000000 -0500
+--- hotspot/make/bsd/makefiles/saproc.make
++++ hotspot/make/bsd/makefiles/saproc.make
 @@ -25,23 +25,33 @@
  # Rules to build serviceability agent library, used by vm.make
  
@@ -3371,7 +3366,7 @@
  
  SASRCDIR = $(AGENT_DIR)/src/os/$(Platform_os_family)
  
-+ifeq ($(OS_VENDOR), MidnightBSD)
++ifeq ($(OS_VENDOR), FreeBSD)
  SASRCFILES = $(SASRCDIR)/salibelf.c                   \
               $(SASRCDIR)/symtab.c                     \
               $(SASRCDIR)/libproc_impl.c               \
@@ -3413,8 +3408,8 @@
  	$(QUIETLY) [ -f $(LIBSAPROC_G) ] || { ln -s $@ $(LIBSAPROC_G); }
  
  install_saproc: $(BUILDLIBSAPROC)
---- hotspot/make/bsd/makefiles/vm.make	2011-07-07 19:16:00.000000000 -0400
-+++ hotspot/make/bsd/makefiles/vm.make	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/make/bsd/makefiles/vm.make
++++ hotspot/make/bsd/makefiles/vm.make
 @@ -91,6 +91,10 @@
    ${JRE_VERSION}     \
    ${VM_DISTRO}
@@ -3532,8 +3527,8 @@
  	}
  
  DEST_JVM = $(JDK_LIBDIR)/$(VM_SUBDIR)/$(LIBJVM)
---- hotspot/make/bsd/platform_amd64	2011-07-07 19:16:00.000000000 -0400
-+++ hotspot/make/bsd/platform_amd64	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/make/bsd/platform_amd64
++++ hotspot/make/bsd/platform_amd64
 @@ -12,4 +12,4 @@
  
  compiler = gcc
@@ -3540,8 +3535,8 @@
  
 -sysdefs = -DBSD -D_GNU_SOURCE -DAMD64
 +sysdefs = -D_ALLBSD_SOURCE -D_GNU_SOURCE -DAMD64
---- hotspot/make/bsd/platform_i486	2011-07-07 19:16:00.000000000 -0400
-+++ hotspot/make/bsd/platform_i486	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/make/bsd/platform_i486
++++ hotspot/make/bsd/platform_i486
 @@ -12,4 +12,4 @@
  
  compiler = gcc
@@ -3548,8 +3543,8 @@
  
 -sysdefs = -DBSD -D_GNU_SOURCE -DIA32
 +sysdefs = -D_ALLBSD_SOURCE -D_GNU_SOURCE -DIA32
---- hotspot/make/defs.make	2011-07-05 14:30:56.000000000 -0400
-+++ hotspot/make/defs.make	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/make/defs.make
++++ hotspot/make/defs.make
 @@ -118,13 +118,23 @@
  # Windows should have OS predefined
  ifeq ($(OS),)
@@ -3576,8 +3571,8 @@
    else
      OSNAME=solaris
    endif
---- hotspot/make/sa.files	2011-07-05 14:30:56.000000000 -0400
-+++ hotspot/make/sa.files	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/make/sa.files
++++ hotspot/make/sa.files
 @@ -50,6 +50,9 @@
  $(AGENT_SRC_DIR)/sun/jvm/hotspot/compiler/*.java \
  $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/*.java \
@@ -3598,8 +3593,8 @@
  $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/ia64/*.java \
  $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/linux/*.java \
  $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/linux_amd64/*.java \
---- hotspot/src/cpu/x86/vm/bytes_x86.hpp	2011-07-05 14:30:57.000000000 -0400
-+++ hotspot/src/cpu/x86/vm/bytes_x86.hpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/cpu/x86/vm/bytes_x86.hpp
++++ hotspot/src/cpu/x86/vm/bytes_x86.hpp
 @@ -81,6 +81,9 @@
  #ifdef TARGET_OS_ARCH_windows_x86
  # include "bytes_windows_x86.inline.hpp"
@@ -3610,8 +3605,8 @@
  
  
  #endif // CPU_X86_VM_BYTES_X86_HPP
---- hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	2011-07-05 14:30:57.000000000 -0400
-+++ hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp
++++ hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp
 @@ -481,8 +481,8 @@
    // Fetch the exception from TLS and clear out exception related thread state
    __ get_thread(rsi);
@@ -3623,8 +3618,8 @@
  
    __ bind(_unwind_handler_entry);
    __ verify_not_null_oop(rax);
---- hotspot/src/cpu/x86/vm/copy_x86.hpp	2011-07-05 14:30:57.000000000 -0400
-+++ hotspot/src/cpu/x86/vm/copy_x86.hpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/cpu/x86/vm/copy_x86.hpp
++++ hotspot/src/cpu/x86/vm/copy_x86.hpp
 @@ -37,6 +37,9 @@
  #ifdef TARGET_OS_ARCH_windows_x86
  # include "copy_windows_x86.inline.hpp"
@@ -3635,8 +3630,8 @@
  
  
  static void pd_fill_to_words(HeapWord* tohw, size_t count, juint value) {
---- hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp	2011-07-05 14:30:57.000000000 -0400
-+++ hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp
++++ hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp
 @@ -45,6 +45,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -3665,8 +3660,8 @@
      // index is positive and so should have correct value if this code were
      // used on 64bits
      imulptr(index, reg2);
---- hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp	2011-07-05 14:30:57.000000000 -0400
-+++ hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp
++++ hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp
 @@ -45,6 +45,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -3677,8 +3672,8 @@
  
  
  // Implementation of InterpreterMacroAssembler
---- hotspot/src/cpu/x86/vm/jni_x86.h	2011-07-05 14:30:57.000000000 -0400
-+++ hotspot/src/cpu/x86/vm/jni_x86.h	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/cpu/x86/vm/jni_x86.h
++++ hotspot/src/cpu/x86/vm/jni_x86.h
 @@ -26,7 +26,7 @@
  #ifndef _JAVASOFT_JNI_MD_H_
  #define _JAVASOFT_JNI_MD_H_
@@ -3688,8 +3683,8 @@
    #define JNIEXPORT
    #define JNIIMPORT
    #define JNICALL
---- hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp	2011-07-05 14:30:57.000000000 -0400
-+++ hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp
++++ hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp
 @@ -47,6 +47,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -3700,8 +3695,8 @@
  #ifdef COMPILER2
  #include "opto/runtime.hpp"
  #endif
---- hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp	2011-07-05 14:30:57.000000000 -0400
-+++ hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp
++++ hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp
 @@ -47,6 +47,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -3712,8 +3707,8 @@
  #ifdef COMPILER2
  #include "opto/runtime.hpp"
  #endif
---- hotspot/src/cpu/x86/vm/stubRoutines_x86_32.cpp	2011-07-05 14:30:57.000000000 -0400
-+++ hotspot/src/cpu/x86/vm/stubRoutines_x86_32.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/cpu/x86/vm/stubRoutines_x86_32.cpp
++++ hotspot/src/cpu/x86/vm/stubRoutines_x86_32.cpp
 @@ -35,6 +35,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -3724,8 +3719,8 @@
  
  // Implementation of the platform-specific part of StubRoutines - for
  // a description of how to extend it, see the stubRoutines.hpp file.
---- hotspot/src/cpu/x86/vm/stubRoutines_x86_64.cpp	2011-07-05 14:30:57.000000000 -0400
-+++ hotspot/src/cpu/x86/vm/stubRoutines_x86_64.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/cpu/x86/vm/stubRoutines_x86_64.cpp
++++ hotspot/src/cpu/x86/vm/stubRoutines_x86_64.cpp
 @@ -35,6 +35,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -3736,8 +3731,8 @@
  
  // Implementation of the platform-specific part of StubRoutines - for
  // a description of how to extend it, see the stubRoutines.hpp file.
---- hotspot/src/cpu/x86/vm/vm_version_x86.cpp	2011-07-05 14:30:57.000000000 -0400
-+++ hotspot/src/cpu/x86/vm/vm_version_x86.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/cpu/x86/vm/vm_version_x86.cpp
++++ hotspot/src/cpu/x86/vm/vm_version_x86.cpp
 @@ -37,6 +37,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "os_windows.inline.hpp"
@@ -3748,8 +3743,8 @@
  
  
  int VM_Version::_cpu;
---- hotspot/src/cpu/zero/vm/bytes_zero.hpp	2011-07-05 14:30:57.000000000 -0400
-+++ hotspot/src/cpu/zero/vm/bytes_zero.hpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/cpu/zero/vm/bytes_zero.hpp
++++ hotspot/src/cpu/zero/vm/bytes_zero.hpp
 @@ -168,6 +168,9 @@
  #ifdef TARGET_OS_ARCH_linux_zero
  # include "bytes_linux_zero.inline.hpp"
@@ -3760,8 +3755,8 @@
  
  #endif // VM_LITTLE_ENDIAN
  
---- hotspot/src/cpu/zero/vm/interp_masm_zero.cpp	2011-07-05 14:30:58.000000000 -0400
-+++ hotspot/src/cpu/zero/vm/interp_masm_zero.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/cpu/zero/vm/interp_masm_zero.cpp
++++ hotspot/src/cpu/zero/vm/interp_masm_zero.cpp
 @@ -40,5 +40,8 @@
  #ifdef TARGET_OS_FAMILY_linux
  # include "thread_linux.inline.hpp"
@@ -3771,8 +3766,8 @@
 +#endif
  
  // This file is intentionally empty
---- hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp	2011-07-05 14:30:58.000000000 -0400
-+++ hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp
++++ hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp
 @@ -43,6 +43,9 @@
  #ifdef TARGET_OS_FAMILY_linux
  # include "thread_linux.inline.hpp"
@@ -3783,8 +3778,8 @@
  #ifdef COMPILER2
  #include "opto/runtime.hpp"
  #endif
---- hotspot/src/cpu/zero/vm/stubRoutines_zero.cpp	2011-07-05 14:30:58.000000000 -0400
-+++ hotspot/src/cpu/zero/vm/stubRoutines_zero.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/cpu/zero/vm/stubRoutines_zero.cpp
++++ hotspot/src/cpu/zero/vm/stubRoutines_zero.cpp
 @@ -30,6 +30,9 @@
  #ifdef TARGET_OS_FAMILY_linux
  # include "thread_linux.inline.hpp"
@@ -3795,8 +3790,8 @@
  
  #ifdef IA32
  address StubRoutines::x86::_call_stub_compiled_return = NULL;
---- hotspot/src/cpu/zero/vm/vm_version_zero.cpp	2011-07-05 14:30:58.000000000 -0400
-+++ hotspot/src/cpu/zero/vm/vm_version_zero.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/cpu/zero/vm/vm_version_zero.cpp
++++ hotspot/src/cpu/zero/vm/vm_version_zero.cpp
 @@ -32,5 +32,8 @@
  #ifdef TARGET_OS_FAMILY_linux
  # include "os_linux.inline.hpp"
@@ -3806,8 +3801,8 @@
 +#endif
  
  // This file is intentionally empty
---- hotspot/src/os/bsd/vm/attachListener_bsd.cpp	2011-07-07 19:15:59.000000000 -0400
-+++ hotspot/src/os/bsd/vm/attachListener_bsd.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/os/bsd/vm/attachListener_bsd.cpp
++++ hotspot/src/os/bsd/vm/attachListener_bsd.cpp
 @@ -170,53 +170,41 @@
  // Initialization - create a listener socket and bind it to a file
  
@@ -3931,8 +3926,8 @@
    if (ret == 0) {
      // simple check to avoid starting the attach mechanism when
      // a bogus user creates the file
---- hotspot/src/os/bsd/vm/jsig.c	2011-07-07 19:15:59.000000000 -0400
-+++ hotspot/src/os/bsd/vm/jsig.c	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/os/bsd/vm/jsig.c
++++ hotspot/src/os/bsd/vm/jsig.c
 @@ -143,7 +143,8 @@
  }
  
@@ -3943,8 +3938,8 @@
   }
  
  static int call_os_sigaction(int sig, const struct sigaction  *act,
---- hotspot/src/os/bsd/vm/jvm_bsd.cpp	2011-07-07 19:15:59.000000000 -0400
-+++ hotspot/src/os/bsd/vm/jvm_bsd.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/os/bsd/vm/jvm_bsd.cpp
++++ hotspot/src/os/bsd/vm/jvm_bsd.cpp
 @@ -146,38 +146,31 @@
    "ILL",        SIGILL,         /* Illegal instruction (ANSI).  */
    "TRAP",       SIGTRAP,        /* Trace trap (POSIX).  */
@@ -3994,8 +3989,8 @@
    };
  
  JVM_ENTRY_NO_ENV(jint, JVM_FindSignal(const char *name))
---- hotspot/src/os/bsd/vm/jvm_bsd.h	2011-07-07 19:15:59.000000000 -0400
-+++ hotspot/src/os/bsd/vm/jvm_bsd.h	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/os/bsd/vm/jvm_bsd.h
++++ hotspot/src/os/bsd/vm/jvm_bsd.h
 @@ -54,7 +54,11 @@
  #define AGENT_ONATTACH_SYMBOLS  {"Agent_OnAttach"}
  
@@ -4029,13 +4024,13 @@
  #endif /* JVM_MD_H */
  
  // Reconciliation History
---- hotspot/src/os/bsd/vm/osThread_bsd.cpp	2011-07-07 19:15:59.000000000 -0400
-+++ hotspot/src/os/bsd/vm/osThread_bsd.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/os/bsd/vm/osThread_bsd.cpp
++++ hotspot/src/os/bsd/vm/osThread_bsd.cpp
 @@ -43,8 +43,12 @@
  
  void OSThread::pd_initialize() {
    assert(this != NULL, "check");
-+#ifdef __MidnightBSD__
++#ifdef __FreeBSD__
    _thread_id        = 0;
 -  _pthread_id       = 0;
 +#else
@@ -4045,13 +4040,13 @@
    _siginfo = NULL;
    _ucontext = NULL;
    _expanding_stack = 0;
---- hotspot/src/os/bsd/vm/osThread_bsd.hpp	2011-07-07 19:15:59.000000000 -0400
-+++ hotspot/src/os/bsd/vm/osThread_bsd.hpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/os/bsd/vm/osThread_bsd.hpp
++++ hotspot/src/os/bsd/vm/osThread_bsd.hpp
 @@ -39,6 +39,7 @@
  
   private:
  
-+#ifdef __MidnightBSD__
++#ifdef __FreeBSD__
    // _thread_id is kernel thread id (similar to LWP id on Solaris). Each
    // thread has a unique thread_id (BsdThreads or NPTL). It can be used
    // to access /proc.
@@ -4072,7 +4067,7 @@
    sigset_t  caller_sigmask() const       { return _caller_sigmask; }
    void    set_caller_sigmask(sigset_t sigmask)  { _caller_sigmask = sigmask; }
  
-+#ifdef __MidnightBSD__
++#ifdef __FreeBSD__
    pid_t thread_id() const {
      return _thread_id;
    }
@@ -4083,7 +4078,7 @@
 +#endif
  #ifndef PRODUCT
    // Used for debugging, return a unique integer for each thread.
-+#ifdef __MidnightBSD__
++#ifdef __FreeBSD__
    int thread_identifier() const   { return _thread_id; }
 +#else
 +  intptr_t thread_identifier() const   { return (intptr_t)_pthread_id; }
@@ -4095,7 +4090,7 @@
      return false;
    }
  #endif // ASSERT
-+#ifdef __MidnightBSD__
++#ifdef __FreeBSD__
    void set_thread_id(pid_t id) {
      _thread_id = id;
    }
@@ -4107,8 +4102,8 @@
    pthread_t pthread_id() const {
      return _pthread_id;
    }
---- hotspot/src/os/bsd/vm/os_bsd.cpp	2011-07-07 19:15:59.000000000 -0400
-+++ hotspot/src/os/bsd/vm/os_bsd.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/os/bsd/vm/os_bsd.cpp
++++ hotspot/src/os/bsd/vm/os_bsd.cpp
 @@ -88,7 +88,6 @@
  # include <sys/mman.h>
  # include <sys/stat.h>
@@ -4117,7 +4112,7 @@
  # include <signal.h>
  # include <errno.h>
  # include <dlfcn.h>
-@@ -102,21 +101,51 @@
+@@ -102,21 +101,57 @@
  # include <sys/utsname.h>
  # include <sys/socket.h>
  # include <sys/wait.h>
@@ -4142,8 +4137,14 @@
  # include <inttypes.h>
  # include <sys/ioctl.h>
  
-+#ifdef __MidnightBSD__
-+#if __MidnightBSD_version > 4016
++#ifdef __FreeBSD__
++#if __FreeBSD_version > 700109
++#include <bitset>
++#include <sys/cpuset.h>
++#endif
++#include <vm/swap_pager.h>
++#include <vm/vm_param.h>
++#if __FreeBSD_version > 900030
 +#include <pthread_np.h>
 +#else
 +extern "C" int thr_self(long *); // XXX #include <sys/thr.h>
@@ -4154,7 +4155,7 @@
 +# include <link.h>
 +#endif
 +
-+#if defined(__MidnightBSD__) || defined(__NetBSD__)
++#if defined(__FreeBSD__) || defined(__NetBSD__)
 +# include <elf.h>
 +#endif
 +
@@ -4170,7 +4171,7 @@
  #define MAX_PATH    (2 * K)
  
  // for timer info max values which include all bits
-@@ -127,19 +156,25 @@
+@@ -127,19 +162,25 @@
  // global variables
  julong os::Bsd::_physical_memory = 0;
  
@@ -4196,7 +4197,7 @@
  
  static jlong initial_time_count=0;
  
-@@ -157,8 +192,6 @@
+@@ -157,8 +198,6 @@
  static int SR_signum = SIGUSR2;
  sigset_t SR_sigset;
  
@@ -4205,11 +4206,33 @@
  
  ////////////////////////////////////////////////////////////////////////////////
  // utility functions
-@@ -171,11 +204,16 @@
+@@ -171,11 +210,38 @@
  }
  
  julong os::Bsd::available_memory() {
 +#ifdef _ALLBSD_SOURCE
++#ifdef __FreeBSD__
++  static const char *vm_stats[] = {
++    "vm.stats.vm.v_free_count",
++    "vm.stats.vm.v_cache_count",
++    /* "vm.stats.vm.v_inactive_count", */
++    NULL
++  };
++  size_t size;
++  julong free_pages;
++  u_int i, npages;
++
++  for (i = 0, free_pages = 0, size = sizeof(npages); vm_stats[i] != NULL; i++) {
++    if (sysctlbyname(vm_stats[i], &npages, &size, NULL, 0) == -1) {
++      free_pages = 0;
++      break;
++    }
++    free_pages += npages;
++  }
++  if (free_pages > 0)
++    free_pages *= os::vm_page_size();
++  else
++#endif
 +  // XXXBSD: this is just a stopgap implementation
 +  return physical_memory() >> 2;
 +#else
@@ -4222,7 +4245,7 @@
  }
  
  julong os::physical_memory() {
-@@ -223,6 +261,7 @@
+@@ -223,6 +289,7 @@
  }
  
  
@@ -4230,7 +4253,7 @@
  #ifndef SYS_gettid
  // i386: 224, ia64: 1105, amd64: 186, sparc 143
  #ifdef __ia64__
-@@ -237,6 +276,7 @@
+@@ -237,6 +304,7 @@
  #error define gettid for the arch
  #endif
  #endif
@@ -4238,7 +4261,7 @@
  
  // Cpu architecture string
  #if   defined(ZERO)
-@@ -267,28 +307,58 @@
+@@ -267,28 +335,86 @@
  // Returns the kernel thread id of the currently running thread. Kernel
  // thread id is used to access /proc.
  //
@@ -4245,7 +4268,7 @@
 -// (Note that getpid() on BsdThreads returns kernel thread id too; but
 -// on NPTL, it returns the same pid for all threads, as required by POSIX.)
 -//
-+#ifdef __MidnightBSD__
++#ifdef __FreeBSD__
  pid_t os::Bsd::gettid() {
 -  int rslt = syscall(SYS_gettid);
 -  if (rslt == -1) {
@@ -4254,7 +4277,7 @@
 -  } else {
 -     return (pid_t)rslt;
 -  }
-+#if __MidnightBSD_version > 4016
++#if __FreeBSD_version > 900030
 +  return pthread_getthreadid_np();
 +#else
 +  long tid;
@@ -4261,21 +4284,41 @@
 +  thr_self(&tid);
 +  return (pid_t)tid;
 +#endif
- }
++}
 +#endif
- 
--// Most versions of bsd have a bug where the number of processors are
--// determined by looking at the /proc file system.  In a chroot environment,
--// the system call returns 1.  This causes the VM to act as if it is
--// a single processor and elide locking (see is_MP() call).
--static bool unsafe_chroot_detected = false;
--static const char *unstable_chroot_error = "/proc file system not found.\n"
--                     "Java may be unstable running multithreaded in a chroot "
--                     "environment on Bsd when /proc filesystem is not mounted.";
-+#ifdef _ALLBSD_SOURCE
++
++#if defined(__FreeBSD__)
 +void os::Bsd::initialize_system_info() {
++  int cpu_val = sysconf(_SC_NPROCESSORS_CONF);
++  if (cpu_val >= 1)
++    set_processor_count(cpu_val);
++  else
++    set_processor_count(1);   // fallback
++
++#ifdef _SC_PHYS_PAGES
++  long phys_pages = sysconf(_SC_PHYS_PAGES);
++  if (phys_pages > 0)
++    _physical_memory = (julong)phys_pages * _page_size;
++  else
++    _physical_memory = 256*1024*1024;       // fallback (XXXBSD?)
++#else
 +  int mib[2];
 +  size_t len;
++  u_long mem_val;
++
++  mib[0] = CTL_HW;
++  mib[1] = HW_PHYSMEM;
++  len = sizeof(mem_val);
++  if (sysctl(mib, 2, &mem_val, &len, NULL, 0) != -1)
++    _physical_memory = mem_val;
++  else
++    _physical_memory = 256*1024*1024;       // fallback (XXXBSD?)
++#endif
+ }
++#elif defined(_ALLBSD_SOURCE)
++void os::Bsd::initialize_system_info() {
++  int mib[2];
++  size_t len;
 +  int cpu_val;
 +  u_long mem_val;
 +
@@ -4290,6 +4333,14 @@
 +       set_processor_count(1);   // fallback
 +  }
  
+-// Most versions of bsd have a bug where the number of processors are
+-// determined by looking at the /proc file system.  In a chroot environment,
+-// the system call returns 1.  This causes the VM to act as if it is
+-// a single processor and elide locking (see is_MP() call).
+-static bool unsafe_chroot_detected = false;
+-static const char *unstable_chroot_error = "/proc file system not found.\n"
+-                     "Java may be unstable running multithreaded in a chroot "
+-                     "environment on Bsd when /proc filesystem is not mounted.";
 +  /* get physical memory via hw.usermem sysctl (hw.usermem is used
 +   * instead of hw.physmem because we need size of allocatable memory
 +   */
@@ -4300,7 +4351,7 @@
 +       _physical_memory = mem_val;
 +  else
 +       _physical_memory = 256*1024*1024;       // fallback (XXXBSD?)
-+
+ 
 +#ifdef __OpenBSD__
 +  {
 +       // limit _physical_memory memory view on OpenBSD since
@@ -4315,7 +4366,7 @@
  void os::Bsd::initialize_system_info() {
    set_processor_count(sysconf(_SC_NPROCESSORS_CONF));
    if (processor_count() == 1) {
-@@ -305,6 +375,7 @@
+@@ -305,6 +431,7 @@
    _physical_memory = (julong)sysconf(_SC_PHYS_PAGES) * (julong)sysconf(_SC_PAGESIZE);
    assert(processor_count() > 0, "bsd error");
  }
@@ -4323,7 +4374,7 @@
  
  void os::init_system_properties_values() {
  //  char arch[12];
-@@ -348,9 +419,7 @@
+@@ -348,9 +475,7 @@
   *        ...
   *        7: The default directories, normally /lib and /usr/lib.
   */
@@ -4334,7 +4385,7 @@
  #define DEFAULT_LIBPATH "/lib:/usr/lib"
  #endif
  
-@@ -429,7 +498,11 @@
+@@ -429,7 +554,11 @@
           * should always exist (until the legacy problem cited above is
           * addressed).
           */
@@ -4346,7 +4397,7 @@
          if (v != NULL) {
              char *t = ld_library_path;
              /* That's +1 for the colon and +1 for the trailing '\0' */
-@@ -588,6 +661,7 @@
+@@ -588,6 +717,7 @@
    }
  }
  
@@ -4354,7 +4405,7 @@
  //////////////////////////////////////////////////////////////////////////////
  // detecting pthread library
  
-@@ -751,6 +825,7 @@
+@@ -751,6 +881,7 @@
    }
    return false;
  }
@@ -4362,7 +4413,7 @@
  
  //////////////////////////////////////////////////////////////////////////////
  // create new thread
-@@ -759,6 +834,9 @@
+@@ -759,6 +890,9 @@
  
  // check if it's safe to start a new thread
  static bool _thread_safety_check(Thread* thread) {
@@ -4372,7 +4423,7 @@
    if (os::Bsd::is_BsdThreads() && !os::Bsd::is_floating_stack()) {
      // Fixed stack BsdThreads (SuSE Bsd/x86, and some versions of Redhat)
      //   Heap is mmap'ed at lower end of memory space. Thread stacks are
-@@ -792,6 +870,7 @@
+@@ -792,6 +926,7 @@
      //   here, that means enough space has been reserved for stack.
      return true;
    }
@@ -4380,11 +4431,11 @@
  }
  
  // Thread start routine for all newly created threads
-@@ -819,15 +898,22 @@
+@@ -819,15 +954,22 @@
      return NULL;
    }
  
-+#ifdef __MidnightBSD__
++#ifdef __FreeBSD__
    // thread_id is kernel thread id (similar to Solaris LWP id)
    osthread->set_thread_id(os::Bsd::gettid());
 +#else
@@ -4403,7 +4454,7 @@
    // initialize signal mask for this thread
    os::Bsd::hotspot_sigmask(thread);
  
-@@ -910,17 +996,22 @@
+@@ -910,17 +1052,22 @@
      // let pthread_create() pick the default value.
    }
  
@@ -4426,7 +4477,7 @@
  
      pthread_t tid;
      int ret = pthread_create(&tid, &attr, (void* (*)(void*)) java_start, thread);
-@@ -934,7 +1025,9 @@
+@@ -934,7 +1081,9 @@
        // Need to clean up stuff we've allocated so far
        thread->set_osthread(NULL);
        delete osthread;
@@ -4436,7 +4487,7 @@
        return false;
      }
  
-@@ -950,9 +1043,11 @@
+@@ -950,9 +1099,11 @@
        }
      }
  
@@ -4448,11 +4499,11 @@
    }
  
    // Aborted due to thread limit being reached
-@@ -990,7 +1085,11 @@
+@@ -990,7 +1141,11 @@
    }
  
    // Store pthread info into the OSThread
-+#ifdef __MidnightBSD__
++#ifdef __FreeBSD__
    osthread->set_thread_id(os::Bsd::gettid());
 +#else
 +  osthread->set_thread_id(::pthread_self());
@@ -4460,7 +4511,7 @@
    osthread->set_pthread_id(::pthread_self());
  
    // initialize floating point control register
-@@ -1001,6 +1100,7 @@
+@@ -1001,6 +1156,7 @@
  
    thread->set_osthread(osthread);
  
@@ -4468,7 +4519,7 @@
    if (UseNUMA) {
      int lgrp_id = os::numa_get_group_id();
      if (lgrp_id != -1) {
-@@ -1027,6 +1127,7 @@
+@@ -1027,6 +1183,7 @@
      os::Bsd::manually_expand_stack(jt, addr);
      osthread->clear_expanding_stack();
    }
@@ -4476,7 +4527,7 @@
  
    // initialize signal mask for this thread
    // and save the caller's signal mask
-@@ -1085,6 +1186,7 @@
+@@ -1085,6 +1242,7 @@
  //////////////////////////////////////////////////////////////////////////////
  // initial thread
  
@@ -4484,7 +4535,7 @@
  // Check if current thread is the initial thread, similar to Solaris thr_main.
  bool os::Bsd::is_initial_thread(void) {
    char dummy;
-@@ -1321,6 +1423,7 @@
+@@ -1321,6 +1479,7 @@
    _initial_thread_stack_size = align_size_down(_initial_thread_stack_size, page_size());
    _initial_thread_stack_bottom = (address)stack_top - _initial_thread_stack_size;
  }
@@ -4492,7 +4543,7 @@
  
  ////////////////////////////////////////////////////////////////////////////////
  // time support
-@@ -1342,9 +1445,7 @@
+@@ -1342,9 +1501,7 @@
    return (1000 * 1000);
  }
  
@@ -4503,7 +4554,7 @@
  bool os::supports_vtime() { return false; }
  bool os::enable_vtime()   { return false; }
  bool os::vtime_enabled()  { return false; }
-@@ -1364,6 +1465,21 @@
+@@ -1364,6 +1521,21 @@
  #define CLOCK_MONOTONIC (1)
  #endif
  
@@ -4525,7 +4576,7 @@
  void os::Bsd::clock_init() {
    // we do dlopen's in this particular order due to bug in bsd
    // dynamical loader (see 6348968) leading to crash on exit
-@@ -1399,7 +1515,9 @@
+@@ -1399,7 +1571,9 @@
      }
    }
  }
@@ -4535,7 +4586,7 @@
  #ifndef SYS_clock_getres
  
  #if defined(IA32) || defined(AMD64)
-@@ -1440,6 +1558,7 @@
+@@ -1440,6 +1614,7 @@
      _pthread_getcpuclockid = pthread_getcpuclockid_func;
    }
  }
@@ -4543,7 +4594,7 @@
  
  jlong os::javaTimeNanos() {
    if (Bsd::supports_monotonic_clock()) {
-@@ -1608,7 +1727,14 @@
+@@ -1608,7 +1783,14 @@
  
  // DLL functions
  
@@ -4559,7 +4610,7 @@
  
  // This must be hard coded because it's the system's temporary
  // directory not the java application's temp directory, ala java.io.tmpdir.
-@@ -1628,13 +1754,13 @@
+@@ -1628,13 +1810,13 @@
    const size_t pnamelen = pname ? strlen(pname) : 0;
  
    // Quietly truncate on buffer overflow.  Should be an error.
@@ -4575,7 +4626,7 @@
    } else if (strchr(pname, *os::path_separator()) != NULL) {
      int n;
      char** pelements = split_path(pname, &n);
-@@ -1643,7 +1769,8 @@
+@@ -1643,7 +1825,8 @@
        if (pelements[i] == NULL || strlen(pelements[i]) == 0) {
          continue; // skip the empty path values
        }
@@ -4585,7 +4636,7 @@
        if (file_exists(buffer)) {
          break;
        }
-@@ -1658,7 +1785,7 @@
+@@ -1658,7 +1841,7 @@
        FREE_C_HEAP_ARRAY(char*, pelements);
      }
    } else {
@@ -4594,7 +4645,7 @@
    }
  }
  
-@@ -1708,6 +1835,23 @@
+@@ -1708,6 +1891,23 @@
    return false;
  }
  
@@ -4618,7 +4669,7 @@
  struct _address_to_library_name {
    address addr;          // input : memory address
    size_t  buflen;        //         size of fname
-@@ -1782,11 +1926,27 @@
+@@ -1782,11 +1982,27 @@
       return false;
    }
  }
@@ -4635,11 +4686,11 @@
 +    // Successful loading
 +    return result;
 +  }
- 
++
 +  // Read system error message into ebuf
 +  ::strncpy(ebuf, ::dlerror(), ebuflen-1);
 +  ebuf[ebuflen-1]='\0';
-+
+ 
 +  return NULL;
 +}
 +#else
@@ -4646,7 +4697,7 @@
  void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
  {
    void * result= ::dlopen(filename, RTLD_LAZY);
-@@ -1839,6 +1999,26 @@
+@@ -1839,6 +2055,26 @@
    #define EM_486          6               /* Intel 80486 */
    #endif
  
@@ -4673,7 +4724,7 @@
    static const arch_t arch_array[]={
      {EM_386,         EM_386,     ELFCLASS32, ELFDATA2LSB, (char*)"IA 32"},
      {EM_486,         EM_386,     ELFCLASS32, ELFDATA2LSB, (char*)"IA 32"},
-@@ -1942,17 +2122,11 @@
+@@ -1942,17 +2178,11 @@
  
    return NULL;
  }
@@ -4694,7 +4745,7 @@
  }
  
  
-@@ -1975,7 +2149,51 @@
+@@ -1975,7 +2205,51 @@
  
  void os::print_dll_info(outputStream *st) {
     st->print_cr("Dynamic libraries:");
@@ -4747,7 +4798,7 @@
     char fname[32];
     pid_t pid = os::Bsd::gettid();
  
-@@ -1984,6 +2202,7 @@
+@@ -1984,6 +2258,7 @@
     if (!_print_ascii_file(fname, st)) {
       st->print("Can not get library information for pid = %d\n", pid);
     }
@@ -4755,7 +4806,7 @@
  }
  
  
-@@ -2018,6 +2237,7 @@
+@@ -2018,6 +2293,7 @@
    st->print(name.machine);
    st->cr();
  
@@ -4763,7 +4814,7 @@
    // Print warning if unsafe chroot environment detected
    if (unsafe_chroot_detected) {
      st->print("WARNING!! ");
-@@ -2032,6 +2252,7 @@
+@@ -2032,6 +2308,7 @@
       st->print("(%s stack)", os::Bsd::is_floating_stack() ? "floating" : "fixed");
    }
    st->cr();
@@ -4771,7 +4822,7 @@
  
    // rlimit
    st->print("rlimit:");
-@@ -2057,6 +2278,7 @@
+@@ -2057,6 +2334,7 @@
    if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
    else st->print("%d", rlim.rlim_cur);
  
@@ -4779,7 +4830,7 @@
    st->print(", AS ");
    getrlimit(RLIMIT_AS, &rlim);
    if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
-@@ -2069,11 +2291,7 @@
+@@ -2069,11 +2347,7 @@
    os::loadavg(loadavg, 3);
    st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]);
    st->cr();
@@ -4792,11 +4843,29 @@
  }
  
  void os::print_memory_info(outputStream* st) {
-@@ -2081,18 +2299,27 @@
+@@ -2081,19 +2355,55 @@
    st->print("Memory:");
    st->print(" %dk page", os::vm_page_size()>>10);
  
-+#ifndef _ALLBSD_SOURCE
++#ifdef _ALLBSD_SOURCE
++#ifdef __FreeBSD__
++  struct xswdev xsw;
++  size_t mibsize, size;
++  int mib[16], n, total = 0, used = 0;
++
++  mibsize = sizeof(mib) / sizeof(mib[0]);
++  if (sysctlnametomib("vm.swap_info", mib, &mibsize) != -1) {
++    for (n = 0; ; n++) {
++      mib[mibsize] = n;
++      size = sizeof(xsw);
++      if (sysctl(mib, mibsize + 1, &xsw, &size, NULL, 0) == -1)
++        break;
++      total += xsw.xsw_nblks;
++      used += xsw.xsw_used;
++    }
++  }
++#endif
++#else
    // values in struct sysinfo are "unsigned long"
    struct sysinfo si;
    sysinfo(&si);
@@ -4806,7 +4875,14 @@
              os::physical_memory() >> 10);
    st->print("(" UINT64_FORMAT "k free)",
              os::available_memory() >> 10);
-+#ifndef _ALLBSD_SOURCE
++#ifdef _ALLBSD_SOURCE
++#ifdef __FreeBSD__
++  st->print(", swap " UINT64_FORMAT "k",
++            ((jlong)total * os::vm_page_size()) >> 10);
++  st->print("(" UINT64_FORMAT "k free)",
++            ((jlong)(total - used) * os::vm_page_size()) >> 10);
++#endif
++#else
    st->print(", swap " UINT64_FORMAT "k",
              ((jlong)si.totalswap * si.mem_unit) >> 10);
    st->print("(" UINT64_FORMAT "k free)",
@@ -4814,13 +4890,16 @@
 +#endif
 +  st->cr();
 +
++#ifndef _ALLBSD_SOURCE
 +  // meminfo
 +  st->print("\n/proc/meminfo:\n");
 +  _print_ascii_file("/proc/meminfo", st);
    st->cr();
++#endif
  }
  
-@@ -2333,19 +2560,29 @@
+ // Taken from /usr/include/bits/siginfo.h  Supposed to be architecture specific
+@@ -2333,19 +2643,29 @@
  static volatile jint pending_signals[NSIG+1] = { 0 };
  
  // Bsd(POSIX) specific hand shaking semaphore.
@@ -4852,7 +4931,7 @@
  }
  
  static int check_pending_signals(bool wait) {
-@@ -2367,7 +2604,7 @@
+@@ -2367,7 +2687,7 @@
      do {
        thread->set_suspend_equivalent();
        // cleared by handle_special_suspend_equivalent_condition() or java_suspend_self()
@@ -4861,7 +4940,7 @@
  
        // were we externally suspended while we were waiting?
        threadIsSuspended = thread->handle_special_suspend_equivalent_condition();
-@@ -2378,7 +2615,7 @@
+@@ -2378,7 +2698,7 @@
          // while suspended because that would surprise the thread that
          // suspended us.
          //
@@ -4870,7 +4949,7 @@
  
          thread->java_suspend_self();
        }
-@@ -2422,10 +2659,10 @@
+@@ -2422,10 +2742,10 @@
      return;
    }
  
@@ -4883,7 +4962,7 @@
             os::get_temp_directory(), os::current_process_id(), num);
    unlink(buf);
  
-@@ -2451,9 +2688,14 @@
+@@ -2451,9 +2771,14 @@
  //       problem.
  bool os::commit_memory(char* addr, size_t size, bool exec) {
    int prot = exec ? PROT_READ|PROT_WRITE|PROT_EXEC : PROT_READ|PROT_WRITE;
@@ -4898,7 +4977,7 @@
  }
  
  bool os::commit_memory(char* addr, size_t size, size_t alignment_hint,
-@@ -2469,36 +2711,27 @@
+@@ -2469,36 +2794,27 @@
  }
  
  void os::numa_make_global(char *addr, size_t bytes) {
@@ -4940,7 +5019,7 @@
  }
  
  bool os::get_page_info(char *start, page_info* info) {
-@@ -2509,6 +2742,7 @@
+@@ -2509,6 +2825,7 @@
    return end;
  }
  
@@ -4948,7 +5027,7 @@
  extern "C" void numa_warn(int number, char *where, ...) { }
  extern "C" void numa_error(char *where) { }
  
-@@ -2610,104 +2844,26 @@
+@@ -2610,104 +2927,26 @@
  os::Bsd::numa_tonode_memory_func_t os::Bsd::_numa_tonode_memory;
  os::Bsd::numa_interleave_memory_func_t os::Bsd::_numa_interleave_memory;
  unsigned long* os::Bsd::_numa_all_nodes;
@@ -5060,7 +5139,7 @@
    return os::uncommit_memory(addr, size);
  }
  
-@@ -2812,6 +2968,9 @@
+@@ -2812,6 +3051,9 @@
  static size_t _large_page_size = 0;
  
  bool os::large_page_init() {
@@ -5070,7 +5149,7 @@
    if (!UseLargePages) return false;
  
    if (LargePageSizeInBytes) {
-@@ -2869,6 +3028,7 @@
+@@ -2869,6 +3111,7 @@
    // We optimistically assume the support is available. If later it turns out
    // not true, VM will automatically switch to use regular page size.
    return true;
@@ -5078,7 +5157,7 @@
  }
  
  #ifndef SHM_HUGETLB
-@@ -3045,7 +3205,7 @@
+@@ -3045,7 +3288,7 @@
  }
  
  size_t os::read(int fd, void *buf, unsigned int nBytes) {
@@ -5087,7 +5166,7 @@
  }
  
  // TODO-FIXME: reconcile Solaris' os::sleep with the bsd variation.
-@@ -3181,6 +3341,44 @@
+@@ -3181,6 +3424,44 @@
  // this reason, the code should not be used as default (ThreadPriorityPolicy=0).
  // It is only used when ThreadPriorityPolicy=1 and requires root privilege.
  
@@ -5132,7 +5211,7 @@
  int os::java_to_os_priority[MaxPriority + 1] = {
    19,              // 0 Entry should never be used
  
-@@ -3198,6 +3396,7 @@
+@@ -3198,6 +3479,7 @@
  
    -5               // 10 MaxPriority
  };
@@ -5140,7 +5219,7 @@
  
  static int prio_init() {
    if (ThreadPriorityPolicy == 1) {
-@@ -3217,8 +3416,28 @@
+@@ -3217,8 +3499,28 @@
  OSReturn os::set_native_priority(Thread* thread, int newpri) {
    if ( !UseThreadPriorities || ThreadPriorityPolicy == 0 ) return OS_OK;
  
@@ -5147,7 +5226,7 @@
 +#ifdef __OpenBSD__
 +  // OpenBSD pthread_setprio starves low priority threads
 +  return OS_OK;
-+#elif defined(__MidnightBSD__)
++#elif defined(__FreeBSD__)
 +  int ret = pthread_setprio(thread->osthread()->pthread_id(), newpri);
 +#elif defined(__APPLE__) || defined(__NetBSD__)
 +  struct sched_param sp;
@@ -5169,11 +5248,11 @@
  }
  
  OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr) {
-@@ -3228,7 +3447,17 @@
+@@ -3228,7 +3530,17 @@
    }
  
    errno = 0;
-+#if defined(__OpenBSD__) || defined(__MidnightBSD__)
++#if defined(__OpenBSD__) || defined(__FreeBSD__)
 +  *priority_ptr = pthread_getprio(thread->osthread()->pthread_id());
 +#elif defined(__APPLE__) || defined(__NetBSD__)
 +  int policy;
@@ -5187,7 +5266,7 @@
    return (*priority_ptr != -1 || errno == 0 ? OS_OK : OS_ERR);
  }
  
-@@ -3338,7 +3567,7 @@
+@@ -3338,7 +3650,7 @@
    /* Get signal number to use for suspend/resume */
    if ((s = ::getenv("_JAVA_SR_SIGNUM")) != 0) {
      int sig = ::strtol(s, 0, 10);
@@ -5196,7 +5275,7 @@
          SR_signum = sig;
      }
    }
-@@ -3682,6 +3911,28 @@
+@@ -3682,6 +3994,28 @@
      set_signal_handler(SIGFPE, true);
      set_signal_handler(SIGXFSZ, true);
  
@@ -5225,7 +5304,7 @@
      if (libjsig_is_loaded) {
        // Tell libjsig jvm finishes setting signal handlers
        (*end_signal_setting)();
-@@ -3702,6 +3953,7 @@
+@@ -3702,6 +4036,7 @@
    }
  }
  
@@ -5233,7 +5312,7 @@
  // This is the fastest way to get thread cpu time on Bsd.
  // Returns cpu time (user+sys) for any thread, not only for current.
  // POSIX compliant clocks are implemented in the kernels 2.6.16+.
-@@ -3716,6 +3968,7 @@
+@@ -3716,6 +4051,7 @@
  
    return (tp.tv_sec * SEC_IN_NANOSECS) + tp.tv_nsec;
  }
@@ -5241,7 +5320,7 @@
  
  /////
  // glibc on Bsd platform uses non-documented flag
-@@ -3937,13 +4190,13 @@
+@@ -3937,13 +4273,13 @@
  
    _initial_pid = (java_launcher_pid > 0) ? java_launcher_pid : getpid();
  
@@ -5257,7 +5336,7 @@
    if (Bsd::page_size() == -1) {
      fatal(err_msg("os_bsd.cpp: os::init: sysconf failed (%s)",
                    strerror(errno)));
-@@ -3957,7 +4210,16 @@
+@@ -3957,7 +4293,16 @@
  
    Bsd::clock_init();
    initial_time_count = os::elapsed_counter();
@@ -5275,7 +5354,7 @@
  }
  
  // To install functions for atexit system call
-@@ -3970,7 +4232,9 @@
+@@ -3970,7 +4315,9 @@
  // this is called _after_ the global arguments have been parsed
  jint os::init_2(void)
  {
@@ -5285,7 +5364,7 @@
  
    // Allocate a single page and mark it as readable for safepoint polling
    address polling_page = (address) ::mmap(NULL, Bsd::page_size(), PROT_READ, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
-@@ -4028,6 +4292,7 @@
+@@ -4028,6 +4375,7 @@
    JavaThread::set_stack_size_at_create(round_to(threadStackSizeInBytes,
          vm_page_size()));
  
@@ -5293,7 +5372,7 @@
    Bsd::capture_initial_stack(JavaThread::stack_size_at_create());
  
    Bsd::libpthread_init();
-@@ -4050,6 +4315,7 @@
+@@ -4050,6 +4398,7 @@
        UseNUMA = true;
      }
    }
@@ -5301,7 +5380,7 @@
  
    if (MaxFDLimit) {
      // set the number of file descriptors to max. print out error
-@@ -4061,6 +4327,14 @@
+@@ -4061,6 +4410,14 @@
          perror("os::init_2 getrlimit failed");
      } else {
        nbr_files.rlim_cur = nbr_files.rlim_max;
@@ -5316,7 +5395,7 @@
        status = setrlimit(RLIMIT_NOFILE, &nbr_files);
        if (status != 0) {
          if (PrintMiscellaneous && (Verbose || WizardMode))
-@@ -4069,8 +4343,10 @@
+@@ -4069,8 +4426,10 @@
      }
    }
  
@@ -5327,11 +5406,25 @@
  
    // at-exit methods are called in the reverse order of their registration.
    // atexit functions are called on return from main or as a result of a
-@@ -4114,11 +4390,15 @@
+@@ -4114,11 +4473,29 @@
  };
  
  int os::active_processor_count() {
 +#ifdef _ALLBSD_SOURCE
++#ifdef __FreeBSD__
++  int online_cpus = 0;
++#if __FreeBSD_version > 700109
++  std::bitset<CPU_SETSIZE> mask;
++  assert(sizeof(mask) == sizeof(cpuset_t), "Invalid bitset for cpuset_t");
++  if (cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, sizeof(mask),
++      reinterpret_cast<cpuset_t*>(&mask)) == 0)
++    online_cpus = mask.count();
++#else
++  online_cpus = ::sysconf(_SC_NPROCESSORS_ONLN);
++#endif
++  if (online_cpus > 0 && online_cpus <= _processor_count)
++    return online_cpus;
++#endif
 +  return _processor_count;
 +#else
    // Bsd doesn't yet have a (official) notion of processor sets,
@@ -5343,7 +5436,7 @@
  }
  
  bool os::distribute_processes(uint length, uint* distribution) {
-@@ -4160,6 +4440,9 @@
+@@ -4160,6 +4537,9 @@
  
  int os::Bsd::safe_cond_timedwait(pthread_cond_t *_cond, pthread_mutex_t *_mutex, const struct timespec *_abstime)
  {
@@ -5353,7 +5446,7 @@
     if (is_NPTL()) {
        return pthread_cond_timedwait(_cond, _mutex, _abstime);
     } else {
-@@ -4175,6 +4458,7 @@
+@@ -4175,6 +4555,7 @@
  #endif // IA64
        return status;
     }
@@ -5361,7 +5454,7 @@
  }
  
  ////////////////////////////////////////////////////////////////////////////////
-@@ -4322,14 +4606,14 @@
+@@ -4322,14 +4703,14 @@
    int o_delete = (oflag & O_DELETE);
    oflag = oflag & ~O_DELETE;
  
@@ -5380,7 +5473,7 @@
  
      if (ret != -1) {
        if ((st_mode & S_IFMT) == S_IFDIR) {
-@@ -4386,17 +4670,17 @@
+@@ -4386,17 +4767,17 @@
    if (!rewrite_existing) {
      oflags |= O_EXCL;
    }
@@ -5401,7 +5494,7 @@
  }
  
  // This code originates from JDK's sysAvailable
-@@ -4405,10 +4689,10 @@
+@@ -4405,10 +4786,10 @@
  int os::available(int fd, jlong *bytes) {
    jlong cur, end;
    int mode;
@@ -5415,7 +5508,7 @@
      if (S_ISCHR(mode) || S_ISFIFO(mode) || S_ISSOCK(mode)) {
        /*
        * XXX: is the following call interruptible? If so, this might
-@@ -4422,11 +4706,11 @@
+@@ -4422,11 +4803,11 @@
        }
      }
    }
@@ -5430,7 +5523,7 @@
      return 0;
    }
    *bytes = end - cur;
-@@ -4489,6 +4773,7 @@
+@@ -4489,6 +4870,7 @@
    return munmap(addr, bytes) == 0;
  }
  
@@ -5438,7 +5531,7 @@
  static jlong slow_thread_cpu_time(Thread *thread, bool user_sys_cpu_time);
  
  static clockid_t thread_cpu_clockid(Thread* thread) {
-@@ -4500,6 +4785,7 @@
+@@ -4500,6 +4882,7 @@
    assert(rc == 0, "pthread_getcpuclockid is expected to return 0 code");
    return clockid;
  }
@@ -5446,7 +5539,7 @@
  
  // current_thread_cpu_time(bool) and thread_cpu_time(Thread*, bool)
  // are used by JVM M&M and JVMTI to get user+sys or user CPU time
-@@ -4509,39 +4795,71 @@
+@@ -4509,39 +4892,71 @@
  // the fast estimate available on the platform.
  
  jlong os::current_thread_cpu_time() {
@@ -5518,7 +5611,7 @@
  //
  //  -1 on error.
  //
-@@ -4631,6 +4949,7 @@
+@@ -4631,6 +5046,7 @@
      return (jlong)user_time * (1000000000 / clock_tics_per_sec);
    }
  }
@@ -5526,21 +5619,21 @@
  
  void os::current_thread_cpu_time_info(jvmtiTimerInfo *info_ptr) {
    info_ptr->max_value = ALL_64_BITS;       // will not wrap in less than 64 bits
-@@ -4647,7 +4966,13 @@
+@@ -4647,7 +5063,13 @@
  }
  
  bool os::is_thread_cpu_time_supported() {
 +#ifdef __APPLE__
-+  return true;
+   return true;
 +#elif defined(_ALLBSD_SOURCE)
 +  return false;
 +#else
-   return true;
++  return true;
 +#endif
  }
  
  // System loadavg support.  Returns -1 if load average cannot be obtained.
-@@ -4780,7 +5105,7 @@
+@@ -4780,7 +5202,7 @@
  // abstime will be the absolute timeout time
  // TODO: replace compute_abstime() with unpackTime()
  
@@ -5549,7 +5642,7 @@
    if (millis < 0)  millis = 0;
    struct timeval now;
    int status = gettimeofday(&now, NULL);
-@@ -4832,7 +5157,7 @@
+@@ -4832,7 +5254,7 @@
          status = pthread_cond_wait(_cond, _mutex);
          // for some reason, under 2.7 lwp_cond_wait() may return ETIME ...
          // Treat this the same as if the wait was interrupted
@@ -5558,7 +5651,7 @@
          assert_status(status == 0 || status == EINTR, status, "cond_wait");
       }
       -- _nParked ;
-@@ -4890,10 +5215,10 @@
+@@ -4890,10 +5312,10 @@
        pthread_cond_init (_cond, NULL) ;
      }
      assert_status(status == 0 || status == EINTR ||
@@ -5571,7 +5664,7 @@
      // We consume and ignore EINTR and spurious wakeups.
    }
    --_nParked ;
-@@ -4985,7 +5310,7 @@
+@@ -4985,7 +5407,7 @@
   * years from "now".
   */
  
@@ -5580,7 +5673,7 @@
    assert (time > 0, "convertTime");
  
    struct timeval now;
-@@ -5045,7 +5370,7 @@
+@@ -5045,7 +5467,7 @@
    }
  
    // Next, demultiplex/decode time arguments
@@ -5589,7 +5682,7 @@
    if (time < 0 || (isAbsolute && time == 0) ) { // don't wait at all
      return;
    }
-@@ -5099,7 +5424,7 @@
+@@ -5099,7 +5521,7 @@
      }
    }
    assert_status(status == 0 || status == EINTR ||
@@ -5598,7 +5691,7 @@
                  status, "cond_timedwait");
  
  #ifdef ASSERT
-@@ -5142,14 +5467,12 @@
+@@ -5142,14 +5564,12 @@
  }
  
  
@@ -5618,7 +5711,7 @@
  #endif
  
  // Run the specified command in a separate process. Return its exit value,
-@@ -5164,8 +5487,7 @@
+@@ -5164,8 +5584,7 @@
    // separate process to execve. Make a direct syscall to fork process.
    // On IA64 there's no fork syscall, we have to use fork() and hope for
    // the best...
@@ -5628,7 +5721,7 @@
  
    if (pid < 0) {
      // fork failed
-@@ -5181,8 +5503,7 @@
+@@ -5181,8 +5600,7 @@
      // in the new process, so make a system call directly.
      // IA64 should use normal execve() from glibc to match the glibc fork()
      // above.
@@ -5638,8 +5731,8 @@
  
      // execve failed
      _exit(-1);
---- hotspot/src/os/bsd/vm/os_bsd.hpp	2011-07-07 19:15:59.000000000 -0400
-+++ hotspot/src/os/bsd/vm/os_bsd.hpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/os/bsd/vm/os_bsd.hpp
++++ hotspot/src/os/bsd/vm/os_bsd.hpp
 @@ -30,6 +30,12 @@
  /* pthread_getattr_np comes with BsdThreads-0.9-7 on RedHat 7.1 */
  typedef int (*pthread_getattr_func_type) (pthread_t, pthread_attr_t *);
@@ -5706,7 +5799,7 @@
 +#endif
    static pthread_t main_thread(void)                                { return _main_thread; }
 +
-+#ifdef __MidnightBSD__
++#ifdef __FreeBSD__
    // returns kernel thread id (similar to LWP id on Solaris), which can be
    // used to access /proc
    static pid_t gettid();
@@ -5778,13 +5871,13 @@
  
    // Stack repair handling
  
---- hotspot/src/os/bsd/vm/os_bsd.inline.hpp	2011-07-07 19:15:59.000000000 -0400
-+++ hotspot/src/os/bsd/vm/os_bsd.inline.hpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/os/bsd/vm/os_bsd.inline.hpp
++++ hotspot/src/os/bsd/vm/os_bsd.inline.hpp
 @@ -86,7 +86,15 @@
  
  inline bool os::allocate_stack_guard_pages() {
    assert(uses_stack_guard_pages(), "sanity check");
-+#if !defined(__MidnightBSD__)
++#if !defined(__FreeBSD__) || __FreeBSD__ < 5
 +  // Since FreeBSD 4 uses malloc() for allocating the thread stack
 +  // there is no need to do anything extra to allocate the guard pages
 +  return false;
@@ -5814,9 +5907,51 @@
  }
  
  inline struct dirent* os::readdir(DIR* dirp, dirent *dbuf)
---- hotspot/src/os/posix/launcher/java_md.c	2011-07-05 14:30:58.000000000 -0400
-+++ hotspot/src/os/posix/launcher/java_md.c	2011-07-07 19:17:02.000000000 -0400
-@@ -41,14 +41,21 @@
+--- hotspot/src/os/bsd/vm/vmError_bsd.cpp
++++ hotspot/src/os/bsd/vm/vmError_bsd.cpp
+@@ -34,6 +34,12 @@
+ #include <unistd.h>
+ #include <signal.h>
+ 
++#ifdef __FreeBSD__
++#define	GDB_LAUNCHER	"gdb /proc/%d/file %d"
++#else
++#define	GDB_LAUNCHER	"gdb /proc/%d/exe %d"
++#endif
++
+ void VMError::show_message_box(char *buf, int buflen) {
+   bool yes;
+   do {
+@@ -44,7 +50,7 @@
+     jio_snprintf(p, buflen - len,
+                "\n\n"
+                "Do you want to debug the problem?\n\n"
+-               "To debug, run 'gdb /proc/%d/exe %d'; then switch to thread " INTX_FORMAT " (" INTPTR_FORMAT ")\n"
++               "To debug, run '" GDB_LAUNCHER "'; then switch to thread " INTX_FORMAT " (" INTPTR_FORMAT ")\n"
+                "Enter 'yes' to launch gdb automatically (PATH must include gdb)\n"
+                "Otherwise, press RETURN to abort...",
+                os::current_process_id(), os::current_process_id(),
+@@ -54,7 +60,7 @@
+ 
+     if (yes) {
+       // yes, user asked VM to launch debugger
+-      jio_snprintf(buf, buflen, "gdb /proc/%d/exe %d",
++      jio_snprintf(buf, buflen, GDB_LAUNCHER,
+                    os::current_process_id(), os::current_process_id());
+ 
+       os::fork_and_exec(buf);
+--- hotspot/src/os/posix/launcher/java_md.c
++++ hotspot/src/os/posix/launcher/java_md.c
+@@ -35,20 +35,30 @@
+ #include <sys/stat.h>
+ #include <unistd.h>
+ #include <sys/types.h>
++#ifndef _SC_PHYS_PAGES
++#include <sys/sysctl.h>
++#endif
+ 
+ #ifndef GAMMA
+ #include "manifest_info.h"
  #include "version_comp.h"
  #endif
  
@@ -5839,7 +5974,7 @@
  
  #ifndef GAMMA   /* launcher.make defines ARCH */
  /*
-@@ -89,7 +96,7 @@
+@@ -89,7 +99,7 @@
   *      A collection of useful strings. One should think of these as #define
   *      entries, but actual strings can be more efficient (with many compilers).
   */
@@ -5848,7 +5983,7 @@
  static const char *system_dir   = "/usr/java";
  static const char *user_dir     = "/java";
  #else /* Solaris */
-@@ -423,10 +430,10 @@
+@@ -423,10 +433,10 @@
         * If not on Solaris, assume only a single LD_LIBRARY_PATH
         * variable.
         */
@@ -5861,7 +5996,7 @@
        /*
         * On linux, if a binary is running as sgid or suid, glibc sets
         * LD_LIBRARY_PATH to the empty string for security purposes.  (In
-@@ -442,6 +449,22 @@
+@@ -442,6 +452,22 @@
        if((getgid() != getegid()) || (getuid() != geteuid()) ) {
          return;
        }
@@ -5884,7 +6019,7 @@
  #endif
  
        /* runpath contains current effective LD_LIBRARY_PATH setting */
-@@ -450,7 +473,7 @@
+@@ -450,7 +476,7 @@
        new_runpath = JLI_MemAlloc( ((runpath!=NULL)?strlen(runpath):0) +
                                2*strlen(jrepath) + 2*strlen(arch) +
                                strlen(jvmpath) + 52);
@@ -5893,7 +6028,7 @@
  
  
        /*
-@@ -465,7 +488,7 @@
+@@ -465,7 +491,7 @@
  
          /* jvmpath, ((running != wanted)?((wanted==64)?"/"LIBARCH64NAME:"/.."):""), */
  
@@ -5902,7 +6037,16 @@
                  "%s:"
                  "%s/lib/%s:"
                  "%s/../lib/%s",
-@@ -792,7 +815,7 @@
+@@ -503,7 +529,7 @@
+        * LD_LIBRARY_PATH.  Note that this prevents any possible infinite
+        * loop of execv() because we test for the prefix, above.
+        */
+-      if (runpath != 0) {
++      if (runpath != 0 && runpath[0] != '\0') {
+         strcat(new_runpath, ":");
+         strcat(new_runpath, runpath);
+       }
+@@ -792,7 +818,7 @@
  jboolean
  GetApplicationHome(char *buf, jint bufsize)
  {
@@ -5911,7 +6055,7 @@
      char *execname = GetExecname();
      if (execname) {
          strncpy(buf, execname, bufsize-1);
-@@ -961,7 +984,7 @@
+@@ -961,9 +987,13 @@
              }
          }
      }
@@ -5918,9 +6062,15 @@
 -#elif defined(__linux__)
 +#elif defined(__linux__) || defined(_ALLBSD_SOURCE)
      {
++#ifdef __FreeBSD__
++        const char* self = "/proc/curproc/file";
++#else
          const char* self = "/proc/self/exe";
++#endif
          char buf[PATH_MAX+1];
-@@ -971,7 +994,7 @@
+         int len = readlink(self, buf, PATH_MAX);
+         if (len >= 0) {
+@@ -971,7 +1001,7 @@
              exec_path = JLI_StringDup(buf);
          }
      }
@@ -5929,8 +6079,45 @@
      {
          /* Not implemented */
      }
-@@ -1175,7 +1198,7 @@
+@@ -1069,6 +1099,7 @@
+ /* Compute physical memory by asking the OS */
+ uint64_t
+ physical_memory(void) {
++#ifdef _SC_PHYS_PAGES
+   const uint64_t pages     = (uint64_t) sysconf(_SC_PHYS_PAGES);
+   const uint64_t page_size = (uint64_t) sysconf(_SC_PAGESIZE);
+   const uint64_t result    = pages * page_size;
+@@ -1080,6 +1111,28 @@
+            "  physical memory: " UINT64_FORMAT " (%.3fGB)\n",
+            pages, page_size, result, result / (double) GB);
+   }
++#else
++#ifdef HW_PHYSMEM64
++  int64_t physmem;
++  int name[2] = { CTL_HW, HW_PHYSMEM64 };
++#else
++  unsigned long physmem;
++  int name[2] = { CTL_HW, HW_PHYSMEM };
++#endif
++  size_t physmem_len = sizeof(physmem);
++  uint64_t result;
++# define UINT64_FORMAT "%" PRIu64
++
++  if (sysctl(name, 2, &physmem, &physmem_len, NULL, 0) == -1)
++       physmem = 256 * MB;
++
++  result = (uint64_t)physmem;
++
++  if (_launcher_debug) {
++    printf("physical memory: " UINT64_FORMAT " (%.3fGB)\n",
++           result, result / (double) GB);
++  }
++#endif
+   return result;
+ }
  
+@@ -1175,7 +1228,7 @@
+ 
  #endif /* __sun && i586 */
  
 -#if defined(__linux__) && defined(i586)
@@ -5938,7 +6125,7 @@
  
  /*
   * A utility method for asking the CPU about itself.
-@@ -1240,7 +1263,7 @@
+@@ -1240,7 +1293,7 @@
  #endif
  }
  
@@ -5947,7 +6134,7 @@
  
  #ifdef i586
  /*
-@@ -1452,6 +1475,39 @@
+@@ -1452,6 +1505,39 @@
  
  #endif /* __linux__ && i586 */
  
@@ -5976,7 +6163,7 @@
 +    }
 +  }
 +  if (_launcher_debug) {
-+    printf("linux_" LIBARCHNAME "_ServerClassMachine: %s\n",
++    printf("bsd_" LIBARCHNAME "_ServerClassMachine: %s\n",
 +           (result == JNI_TRUE ? "true" : "false"));
 +  }
 +  return result;
@@ -5987,7 +6174,7 @@
  /* Dispatch to the platform-specific definition of "server-class" */
  jboolean
  ServerClassMachine(void) {
-@@ -1466,6 +1522,8 @@
+@@ -1466,6 +1552,8 @@
    result = solaris_i586_ServerClassMachine();
  #elif defined(__linux__) && defined(i586)
    result = linux_i586_ServerClassMachine();
@@ -5996,7 +6183,16 @@
  #else
    if (_launcher_debug) {
      printf("ServerClassMachine: returns default value of %s\n",
-@@ -1821,7 +1879,7 @@
+@@ -1606,7 +1694,7 @@
+     while (dp != NULL) {
+         cp = strchr(dp, (int)':');
+         if (cp != NULL)
+-            *cp = (char)NULL;
++            *cp = '\0';
+         if ((target = ProcessDir(info, dp)) != NULL)
+             break;
+         dp = cp;
+@@ -1821,7 +1909,7 @@
  int
  ContinueInNewThread(int (JNICALL *continuation)(void *), jlong stack_size, void * args) {
      int rslt;
@@ -6005,8 +6201,19 @@
      pthread_t tid;
      pthread_attr_t attr;
      pthread_attr_init(&attr);
---- hotspot/src/os/posix/launcher/launcher.script	2011-07-05 14:30:58.000000000 -0400
-+++ hotspot/src/os/posix/launcher/launcher.script	2011-07-07 19:17:02.000000000 -0400
+@@ -1865,8 +1953,8 @@
+ #define MAX_PID_STR_SZ   20
+ 
+ void SetJavaLauncherPlatformProps() {
+-   /* Linux only */
+-#ifdef __linux__
++   /* Linux and BSDs only */
++#if defined(__linux__) || defined(_ALLBSD_SOURCE)
+     const char *substr = "-Dsun.java.launcher.pid=";
+     char *pid_prop_str = (char *)JLI_MemAlloc(strlen(substr) + MAX_PID_STR_SZ + 1);
+     sprintf(pid_prop_str, "%s%d", substr, getpid());
+--- hotspot/src/os/posix/launcher/launcher.script
++++ hotspot/src/os/posix/launcher/launcher.script
 @@ -1,4 +1,4 @@
 -#!/bin/bash
 +#!/bin/sh
@@ -6013,8 +6220,8 @@
  
  # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
---- hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_32.s	2011-07-07 19:15:59.000000000 -0400
-+++ hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_32.s	2011-07-11 10:45:37.000000000 -0400
+--- hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_32.s
++++ hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_32.s
 @@ -21,6 +21,17 @@
  # questions.
  # 
@@ -6138,6 +6345,15 @@
          pushl    %esi
          movl     4+12(%esp),%ecx      # count
          pushl    %edi
+@@ -241,7 +272,7 @@
+         jbe      2f                   # <= 32 dwords
+         rep;     smovl
+         jmp      4f
+-	.=.+8
++	.skip 8
+ 2:      subl     %esi,%edi
+         .p2align 4,,15
+ 3:      movl     (%esi),%edx
 @@ -269,8 +300,8 @@
          #                                                void* to,
          #                                                size_t count)
@@ -6160,6 +6376,15 @@
          pushl    %esi
          movl     4+12(%esp),%ecx      # count
          pushl    %edi
+@@ -378,7 +409,7 @@
+         rep;     smovl
+         jmp      4f 
+         # copy aligned dwords
+-        .=.+5
++        .skip 5
+ 2:      subl     %esi,%edi 
+         .p2align 4,,15
+ 3:      movl     (%esi),%edx
 @@ -433,10 +464,10 @@
          # Equivalent to
          #   arrayof_conjoint_jints
@@ -6175,6 +6400,15 @@
          pushl    %esi
          movl     4+12(%esp),%ecx      # count
          pushl    %edi
+@@ -454,7 +485,7 @@
+         popl     %edi
+         popl     %esi
+         ret
+-        .=.+10
++        .skip 10
+ 2:      subl     %esi,%edi
+         jmp      4f
+         .p2align 4,,15
 @@ -498,7 +529,7 @@
          #
          # count treated as signed
@@ -6228,8 +6462,8 @@
          movl     4(%esp), %eax   # src
          fildll    (%eax)
          movl     8(%esp), %eax   # dest
---- hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_64.s	2011-07-07 19:15:59.000000000 -0400
-+++ hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_64.s	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_64.s
++++ hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_64.s
 @@ -21,6 +21,14 @@
  # questions.
  #
@@ -6377,8 +6611,8 @@
          cmpq     %rdi,%rsi
          leaq     -8(%rdi,%rdx,8),%rax # from + count*8 - 8
          jbe      acl_CopyRight
---- hotspot/src/os_cpu/bsd_x86/vm/bytes_bsd_x86.inline.hpp	2011-07-07 19:15:59.000000000 -0400
-+++ hotspot/src/os_cpu/bsd_x86/vm/bytes_bsd_x86.inline.hpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/os_cpu/bsd_x86/vm/bytes_bsd_x86.inline.hpp
++++ hotspot/src/os_cpu/bsd_x86/vm/bytes_bsd_x86.inline.hpp
 @@ -25,7 +25,33 @@
  #ifndef OS_CPU_BSD_X86_VM_BYTES_BSD_X86_INLINE_HPP
  #define OS_CPU_BSD_X86_VM_BYTES_BSD_X86_INLINE_HPP
@@ -6413,8 +6647,8 @@
  
  // Efficient swapping of data bytes from Java byte
  // ordering to native byte ordering and vice versa.
---- hotspot/src/os_cpu/bsd_x86/vm/globals_bsd_x86.hpp	2011-07-07 19:15:59.000000000 -0400
-+++ hotspot/src/os_cpu/bsd_x86/vm/globals_bsd_x86.hpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/os_cpu/bsd_x86/vm/globals_bsd_x86.hpp
++++ hotspot/src/os_cpu/bsd_x86/vm/globals_bsd_x86.hpp
 @@ -25,9 +25,10 @@
  #ifndef OS_CPU_BSD_X86_VM_GLOBALS_BSD_X86_HPP
  #define OS_CPU_BSD_X86_VM_GLOBALS_BSD_X86_HPP
@@ -6442,9 +6676,29 @@
  // Only used on 64 bit Windows platforms
  define_pd_global(bool, UseVectoredExceptions,    false);
  
---- hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	2011-07-07 19:15:59.000000000 -0400
-+++ hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	2011-07-07 19:17:02.000000000 -0400
-@@ -78,23 +78,202 @@
+--- hotspot/src/os_cpu/bsd_x86/vm/orderAccess_bsd_x86.inline.hpp
++++ hotspot/src/os_cpu/bsd_x86/vm/orderAccess_bsd_x86.inline.hpp
+@@ -93,7 +93,7 @@
+ 
+ inline void     OrderAccess::store_fence(jbyte*  p, jbyte  v) {
+   __asm__ volatile (  "xchgb (%2),%0"
+-                    : "=r" (v)
++                    : "=q" (v)
+                     : "0" (v), "r" (p)
+                     : "memory");
+ }
+@@ -155,7 +155,7 @@
+ // Must duplicate definitions instead of calling store_fence because we don't want to cast away volatile.
+ inline void     OrderAccess::release_store_fence(volatile jbyte*  p, jbyte  v) {
+   __asm__ volatile (  "xchgb (%2),%0"
+-                    : "=r" (v)
++                    : "=q" (v)
+                     : "0" (v), "r" (p)
+                     : "memory");
+ }
+--- hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp
++++ hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp
+@@ -78,25 +78,209 @@
  # include <sys/wait.h>
  # include <pwd.h>
  # include <poll.h>
@@ -6471,7 +6725,7 @@
  #define SPELL_REG_FP "ebp"
  #endif // AMD64
  
-+#ifdef __MidnightBSD__
++#ifdef __FreeBSD__
 +# define context_trapno uc_mcontext.mc_trapno
 +# ifdef AMD64
 +#  define context_pc uc_mcontext.mc_rip
@@ -6652,9 +6906,17 @@
 +#endif
 +
  address os::current_stack_pointer() {
- #ifdef SPARC_WORKS
+-#ifdef SPARC_WORKS
++#if defined(__clang__)
++  register void *esp;
++  // XXX must be compiled with -O1 or above.
++  __asm__ volatile("mov %%" SPELL_REG_SP ", %0" : "=r"(esp));
++  return (address) esp;
++#elif defined(SPARC_WORKS)
    register void *esp;
-@@ -119,15 +298,15 @@
+   __asm__("mov %%"SPELL_REG_SP", %0":"=r"(esp));
+   return (address) ((char*)esp + sizeof(long)*2);
+@@ -119,15 +303,15 @@
  }
  
  address os::Bsd::ucontext_get_pc(ucontext_t * uc) {
@@ -6673,7 +6935,20 @@
  }
  
  // For Forte Analyzer AsyncGetCallTrace profiling support - thread
-@@ -279,18 +458,18 @@
+@@ -179,7 +363,11 @@
+ }
+ 
+ intptr_t* _get_previous_fp() {
+-#ifdef SPARC_WORKS
++#if defined(__clang__)
++  register intptr_t **ebp;
++  // XXX must be compiled with -O1 or above.
++  __asm__ volatile("mov %%" SPELL_REG_FP ", %0" : "=r"(ebp));
++#elif defined(SPARC_WORKS)
+   register intptr_t **ebp;
+   __asm__("mov %%"SPELL_REG_FP", %0":"=r"(ebp));
+ #else
+@@ -279,18 +467,18 @@
      pc = (address) os::Bsd::ucontext_get_pc(uc);
  
      if (pc == (address) Fetch32PFI) {
@@ -6695,7 +6970,7 @@
        address addr = (address) info->si_addr;
  
        // check if fault address is within thread stack
-@@ -312,6 +491,7 @@
+@@ -312,6 +500,7 @@
            // to handle_unexpected_exception way down below.
            thread->disable_stack_red_zone();
            tty->print_raw_cr("An irrecoverable stack overflow has occurred.");
@@ -6703,7 +6978,7 @@
          } else {
            // Accessing stack address below sp may cause SEGV if current
            // thread has MAP_GROWSDOWN stack. This should only happen when
-@@ -327,6 +507,7 @@
+@@ -327,6 +516,7 @@
            } else {
               fatal("recursive segv. expanding stack.");
            }
@@ -6711,7 +6986,7 @@
          }
        }
      }
-@@ -335,9 +516,16 @@
+@@ -335,9 +525,16 @@
        // Java thread running in Java code => find exception handler if any
        // a fault inside compiled code, the interpreter, or a stub
  
@@ -6729,7 +7004,7 @@
          // BugId 4454115: A read from a MappedByteBuffer can fault
          // here if the underlying file has been truncated.
          // Do not crash the VM in such a case.
-@@ -358,6 +546,28 @@
+@@ -358,6 +555,28 @@
                                                pc,
                                                SharedRuntime::
                                                IMPLICIT_DIVIDE_BY_ZERO);
@@ -6758,7 +7033,7 @@
  #else
        if (sig == SIGFPE /* && info->si_code == FPE_INTDIV */) {
          // HACK: si_code does not work on bsd 2.2.12-20!!!
-@@ -385,7 +595,7 @@
+@@ -385,7 +604,7 @@
            fatal("please update this code.");
          }
  #endif // AMD64
@@ -6767,7 +7042,7 @@
                 !MacroAssembler::needs_explicit_null_check((intptr_t)info->si_addr)) {
            // Determination of interpreter/vtable stub/compiled code null exception
            stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);
-@@ -409,7 +619,7 @@
+@@ -409,7 +628,7 @@
      // process of write protecting the memory serialization page.
      // It write enables the page immediately after protecting it
      // so we can just return to retry the write.
@@ -6776,7 +7051,7 @@
          os::is_memory_serialize_page(thread, (address) info->si_addr)) {
        // Block current thread until the memory serialize page permission restored.
        os::block_on_serialize_page_trap();
-@@ -430,7 +640,7 @@
+@@ -430,7 +649,7 @@
    // Furthermore, a false-positive should be harmless.
    if (UnguardOnExecutionViolation > 0 &&
        (sig == SIGSEGV || sig == SIGBUS) &&
@@ -6785,7 +7060,7 @@
      int page_size = os::vm_page_size();
      address addr = (address) info->si_addr;
      address pc = os::Bsd::ucontext_get_pc(uc);
-@@ -500,7 +710,7 @@
+@@ -500,7 +719,7 @@
      // save all thread context in case we need to restore it
      if (thread != NULL) thread->set_saved_exception_pc(pc);
  
@@ -6794,7 +7069,7 @@
      return true;
    }
  
-@@ -530,13 +740,24 @@
+@@ -530,13 +749,24 @@
    ShouldNotReachHere();
  }
  
@@ -6819,7 +7094,7 @@
  int os::Bsd::get_fpu_control_word(void) {
  #ifdef AMD64
    return 0;
-@@ -552,11 +773,12 @@
+@@ -552,11 +782,12 @@
    _FPU_SETCW(fpu_control);
  #endif // !AMD64
  }
@@ -6833,7 +7108,7 @@
    return true;
  #else
    struct utsname uts;
-@@ -610,6 +832,9 @@
+@@ -610,6 +841,9 @@
  #define GET_GS() ({int gs; __asm__ volatile("movw %%gs, %w0":"=q"(gs)); gs&0xffff;})
  #endif
  
@@ -6843,7 +7118,7 @@
  // Test if pthread library can support variable thread stack size. BsdThreads
  // in fixed stack mode allocates 2M fixed slot for each thread. BsdThreads
  // in floating stack mode and NPTL support variable stack size.
-@@ -632,7 +857,7 @@
+@@ -632,7 +866,7 @@
      //
      // Note that %gs is a reserved glibc register since early 2001, so
      // applications are not allowed to change its value (Ulrich Drepper from
@@ -6852,7 +7127,7 @@
      // either %fs or TSD). In the worst case scenario, when VM is embedded in
      // a native application that plays with %gs, we might see non-zero %gs
      // even BsdThreads is running in fixed stack mode. As the result, we'll
-@@ -646,6 +871,7 @@
+@@ -646,6 +880,7 @@
  #endif
    }
  }
@@ -6860,7 +7135,7 @@
  #endif // AMD64
  
  // return default stack size for thr_type
-@@ -699,6 +925,41 @@
+@@ -699,6 +934,41 @@
  //    pthread_attr_getstack()
  
  static void current_stack_region(address * bottom, size_t * size) {
@@ -6902,7 +7177,7 @@
    if (os::Bsd::is_initial_thread()) {
       // initial thread needs special handling because pthread_getattr_np()
       // may return bogus value.
-@@ -725,6 +986,7 @@
+@@ -725,6 +995,7 @@
       pthread_attr_destroy(&attr);
  
    }
@@ -6910,7 +7185,7 @@
    assert(os::current_stack_pointer() >= *bottom &&
           os::current_stack_pointer() < *bottom + *size, "just checking");
  }
-@@ -753,46 +1015,44 @@
+@@ -753,46 +1024,44 @@
    ucontext_t *uc = (ucontext_t*)context;
    st->print_cr("Registers:");
  #ifdef AMD64
@@ -6995,7 +7270,7 @@
  #endif // AMD64
    st->cr();
    st->cr();
-@@ -825,31 +1085,31 @@
+@@ -825,31 +1094,31 @@
    // this is only for the "general purpose" registers
  
  #ifdef AMD64
@@ -7052,8 +7327,8 @@
  #endif // AMD64
  
    st->cr();
---- hotspot/src/os_cpu/bsd_x86/vm/threadLS_bsd_x86.hpp	2011-07-07 19:15:59.000000000 -0400
-+++ hotspot/src/os_cpu/bsd_x86/vm/threadLS_bsd_x86.hpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/os_cpu/bsd_x86/vm/threadLS_bsd_x86.hpp
++++ hotspot/src/os_cpu/bsd_x86/vm/threadLS_bsd_x86.hpp
 @@ -30,8 +30,10 @@
  #ifndef AMD64
    // map stack pointer to thread pointer - see notes in threadLS_bsd_x86.cpp
@@ -7065,13 +7340,13 @@
    static Thread* _sp_map[1UL << (SP_BITLENGTH - PAGE_SHIFT)];
  #endif // !AMD64
  
---- hotspot/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp	2011-07-07 19:15:59.000000000 -0400
-+++ hotspot/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp
++++ hotspot/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp
 @@ -29,6 +29,7 @@
  // constants required by the Serviceability Agent. This file is
  // referenced by vmStructs.cpp.
  
-+#ifdef __MidnightBSD__
++#ifdef __FreeBSD__
  #define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field, last_entry) \
                                                                                                                                       \
    /******************************/                                                                                                   \
@@ -7093,8 +7368,8 @@
  
  
  #define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type, last_entry) \
---- hotspot/src/share/vm/adlc/adlc.hpp	2011-07-05 14:31:00.000000000 -0400
-+++ hotspot/src/share/vm/adlc/adlc.hpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/share/vm/adlc/adlc.hpp
++++ hotspot/src/share/vm/adlc/adlc.hpp
 @@ -72,9 +72,9 @@
  #endif
  #endif // _WIN32
@@ -7107,8 +7382,8 @@
  
  // Macros
  #define uint32 unsigned int
---- hotspot/src/share/vm/c1/c1_globals.hpp	2011-07-05 14:31:00.000000000 -0400
-+++ hotspot/src/share/vm/c1/c1_globals.hpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/share/vm/c1/c1_globals.hpp
++++ hotspot/src/share/vm/c1/c1_globals.hpp
 @@ -41,6 +41,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "c1_globals_windows.hpp"
@@ -7119,8 +7394,8 @@
  
  //
  // Defines all global flags used by the client compiler.
---- hotspot/src/share/vm/classfile/classLoader.cpp	2011-07-05 14:31:01.000000000 -0400
-+++ hotspot/src/share/vm/classfile/classLoader.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/share/vm/classfile/classLoader.cpp
++++ hotspot/src/share/vm/classfile/classLoader.cpp
 @@ -68,6 +68,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "os_windows.inline.hpp"
@@ -7131,8 +7406,8 @@
  
  
  // Entry points in zip.dll for loading zip/jar file entries
---- hotspot/src/share/vm/classfile/javaClasses.cpp	2011-07-05 14:31:01.000000000 -0400
-+++ hotspot/src/share/vm/classfile/javaClasses.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/share/vm/classfile/javaClasses.cpp
++++ hotspot/src/share/vm/classfile/javaClasses.cpp
 @@ -55,6 +55,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7152,8 +7427,8 @@
      }
    }
  
---- hotspot/src/share/vm/code/stubs.hpp	2011-07-05 14:31:01.000000000 -0400
-+++ hotspot/src/share/vm/code/stubs.hpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/share/vm/code/stubs.hpp
++++ hotspot/src/share/vm/code/stubs.hpp
 @@ -35,6 +35,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "os_windows.inline.hpp"
@@ -7164,8 +7439,8 @@
  
  // The classes in this file provide a simple framework for the
  // management of little pieces of machine code - or stubs -
---- hotspot/src/share/vm/compiler/disassembler.hpp	2011-07-05 14:31:01.000000000 -0400
-+++ hotspot/src/share/vm/compiler/disassembler.hpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/share/vm/compiler/disassembler.hpp
++++ hotspot/src/share/vm/compiler/disassembler.hpp
 @@ -35,6 +35,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "os_windows.inline.hpp"
@@ -7176,8 +7451,8 @@
  
  class decode_env;
  
---- hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.cpp	2011-07-05 14:31:01.000000000 -0400
-+++ hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.cpp
++++ hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.cpp
 @@ -37,6 +37,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "os_windows.inline.hpp"
@@ -7188,8 +7463,8 @@
  elapsedTimer CMSAdaptiveSizePolicy::_concurrent_timer;
  elapsedTimer CMSAdaptiveSizePolicy::_STW_timer;
  
---- hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp	2011-07-05 14:31:01.000000000 -0400
-+++ hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp
++++ hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp
 @@ -50,6 +50,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7200,8 +7475,8 @@
  
  //
  // ConcurrentMarkSweepPolicy methods
---- hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp	2011-07-05 14:31:01.000000000 -0400
-+++ hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp
++++ hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp
 @@ -36,6 +36,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7212,8 +7487,8 @@
  
  class ConcurrentMarkSweepGeneration;
  class CMSCollector;
---- hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/freeBlockDictionary.cpp	2011-07-05 14:31:01.000000000 -0400
-+++ hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/freeBlockDictionary.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/freeBlockDictionary.cpp
++++ hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/freeBlockDictionary.cpp
 @@ -33,6 +33,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7224,8 +7499,8 @@
  
  #ifndef PRODUCT
  Mutex* FreeBlockDictionary::par_lock() const {
---- hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp	2011-07-05 14:31:01.000000000 -0400
-+++ hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp
++++ hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp
 @@ -39,6 +39,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7236,8 +7511,8 @@
  
  bool DirtyCardQueue::apply_closure(CardTableEntryClosure* cl,
                                     bool consume,
---- hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp	2011-07-05 14:31:01.000000000 -0400
-+++ hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp
++++ hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp
 @@ -37,6 +37,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7248,8 +7523,8 @@
  
  G1SATBCardTableModRefBS::G1SATBCardTableModRefBS(MemRegion whole_heap,
                                                   int max_covered_regions) :
---- hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp	2011-07-05 14:31:02.000000000 -0400
-+++ hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp
++++ hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp
 @@ -37,6 +37,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7260,8 +7535,8 @@
  
  PtrQueue::PtrQueue(PtrQueueSet* qset, bool perm, bool active) :
    _qset(qset), _buf(NULL), _index(0), _active(active),
---- hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp	2011-07-05 14:31:02.000000000 -0400
-+++ hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp
++++ hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp
 @@ -38,6 +38,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "os_windows.inline.hpp"
@@ -7272,8 +7547,8 @@
  
  bool
  ParMarkBitMap::initialize(MemRegion covered_region)
---- hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp	2011-07-05 14:31:02.000000000 -0400
-+++ hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp
++++ hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp
 @@ -35,6 +35,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "os_windows.inline.hpp"
@@ -7284,8 +7559,8 @@
  
  // PSVirtualSpace
  
---- hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp	2011-07-05 14:31:02.000000000 -0400
-+++ hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp
++++ hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp
 @@ -37,6 +37,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7296,8 +7571,8 @@
  
  
  MutableNUMASpace::MutableNUMASpace(size_t alignment) : MutableSpace(alignment) {
---- hotspot/src/share/vm/gc_interface/collectedHeap.cpp	2011-07-05 14:31:02.000000000 -0400
-+++ hotspot/src/share/vm/gc_interface/collectedHeap.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/share/vm/gc_interface/collectedHeap.cpp
++++ hotspot/src/share/vm/gc_interface/collectedHeap.cpp
 @@ -39,6 +39,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7308,8 +7583,8 @@
  
  
  #ifdef ASSERT
---- hotspot/src/share/vm/gc_interface/collectedHeap.inline.hpp	2011-07-05 14:31:02.000000000 -0400
-+++ hotspot/src/share/vm/gc_interface/collectedHeap.inline.hpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/share/vm/gc_interface/collectedHeap.inline.hpp
++++ hotspot/src/share/vm/gc_interface/collectedHeap.inline.hpp
 @@ -43,6 +43,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7320,8 +7595,8 @@
  
  // Inline allocation implementations.
  
---- hotspot/src/share/vm/interpreter/abstractInterpreter.hpp	2011-07-05 14:31:02.000000000 -0400
-+++ hotspot/src/share/vm/interpreter/abstractInterpreter.hpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/share/vm/interpreter/abstractInterpreter.hpp
++++ hotspot/src/share/vm/interpreter/abstractInterpreter.hpp
 @@ -50,6 +50,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7332,8 +7607,8 @@
  
  // This file contains the platform-independent parts
  // of the abstract interpreter and the abstract interpreter generator.
---- hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp	2011-07-05 14:31:02.000000000 -0400
-+++ hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp
++++ hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp
 @@ -59,6 +59,12 @@
  #ifdef TARGET_OS_ARCH_windows_x86
  # include "orderAccess_windows_x86.inline.hpp"
@@ -7347,8 +7622,8 @@
  
  
  // no precompiled headers
---- hotspot/src/share/vm/interpreter/bytecodeTracer.cpp	2011-07-05 14:31:02.000000000 -0400
-+++ hotspot/src/share/vm/interpreter/bytecodeTracer.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/interpreter/bytecodeTracer.cpp
++++ hotspot/src/share/vm/interpreter/bytecodeTracer.cpp
 @@ -92,7 +92,7 @@
        // the incoming method.  We could lose a line of trace output.
        // This is acceptable in a debug-only feature.
@@ -7367,8 +7642,8 @@
      if (Verbose) {
        st->print("%8d  %4d  " INTPTR_FORMAT " " INTPTR_FORMAT " %s",
             BytecodeCounter::counter_value(), bci, tos, tos2, Bytecodes::name(code));
---- hotspot/src/share/vm/interpreter/interpreterRuntime.hpp	2011-07-05 14:31:02.000000000 -0400
-+++ hotspot/src/share/vm/interpreter/interpreterRuntime.hpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/share/vm/interpreter/interpreterRuntime.hpp
++++ hotspot/src/share/vm/interpreter/interpreterRuntime.hpp
 @@ -41,6 +41,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7379,8 +7654,8 @@
  
  // The InterpreterRuntime is called by the interpreter for everything
  // that cannot/should not be dealt with in assembly and needs C support.
---- hotspot/src/share/vm/interpreter/linkResolver.cpp	2011-07-05 14:31:02.000000000 -0400
-+++ hotspot/src/share/vm/interpreter/linkResolver.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/share/vm/interpreter/linkResolver.cpp
++++ hotspot/src/share/vm/interpreter/linkResolver.cpp
 @@ -52,6 +52,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7391,8 +7666,8 @@
  
  //------------------------------------------------------------------------------------------------------------------------
  // Implementation of FieldAccessInfo
---- hotspot/src/share/vm/memory/allocation.cpp	2011-07-05 14:31:02.000000000 -0400
-+++ hotspot/src/share/vm/memory/allocation.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/share/vm/memory/allocation.cpp
++++ hotspot/src/share/vm/memory/allocation.cpp
 @@ -39,6 +39,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "os_windows.inline.hpp"
@@ -7403,8 +7678,8 @@
  
  void* CHeapObj::operator new(size_t size){
    return (void *) AllocateHeap(size, "CHeapObj-new");
---- hotspot/src/share/vm/memory/collectorPolicy.cpp	2011-07-05 14:31:02.000000000 -0400
-+++ hotspot/src/share/vm/memory/collectorPolicy.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/share/vm/memory/collectorPolicy.cpp
++++ hotspot/src/share/vm/memory/collectorPolicy.cpp
 @@ -47,6 +47,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7415,8 +7690,8 @@
  #ifndef SERIALGC
  #include "gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.hpp"
  #include "gc_implementation/concurrentMarkSweep/cmsGCAdaptivePolicyCounters.hpp"
---- hotspot/src/share/vm/memory/defNewGeneration.cpp	2011-07-05 14:31:02.000000000 -0400
-+++ hotspot/src/share/vm/memory/defNewGeneration.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/share/vm/memory/defNewGeneration.cpp
++++ hotspot/src/share/vm/memory/defNewGeneration.cpp
 @@ -48,6 +48,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7427,8 +7702,8 @@
  
  //
  // DefNewGeneration functions.
---- hotspot/src/share/vm/memory/gcLocker.hpp	2011-07-05 14:31:02.000000000 -0400
-+++ hotspot/src/share/vm/memory/gcLocker.hpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/share/vm/memory/gcLocker.hpp
++++ hotspot/src/share/vm/memory/gcLocker.hpp
 @@ -41,6 +41,10 @@
  # include "os_windows.inline.hpp"
  # include "thread_windows.inline.hpp"
@@ -7440,8 +7715,8 @@
  
  // The direct lock/unlock calls do not force a collection if an unlock
  // decrements the count to zero. Avoid calling these if at all possible.
---- hotspot/src/share/vm/memory/genMarkSweep.cpp	2011-07-05 14:31:03.000000000 -0400
-+++ hotspot/src/share/vm/memory/genMarkSweep.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/share/vm/memory/genMarkSweep.cpp
++++ hotspot/src/share/vm/memory/genMarkSweep.cpp
 @@ -55,6 +55,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7452,8 +7727,8 @@
  
  void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp,
    bool clear_all_softrefs) {
---- hotspot/src/share/vm/memory/resourceArea.cpp	2011-07-05 14:31:03.000000000 -0400
-+++ hotspot/src/share/vm/memory/resourceArea.cpp	2011-07-07 19:17:02.000000000 -0400
+--- hotspot/src/share/vm/memory/resourceArea.cpp
++++ hotspot/src/share/vm/memory/resourceArea.cpp
 @@ -35,6 +35,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7464,8 +7739,8 @@
  
  //------------------------------ResourceMark-----------------------------------
  debug_only(int ResourceArea::_warned;)      // to suppress multiple warnings
---- hotspot/src/share/vm/memory/resourceArea.hpp	2011-07-05 14:31:03.000000000 -0400
-+++ hotspot/src/share/vm/memory/resourceArea.hpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/memory/resourceArea.hpp
++++ hotspot/src/share/vm/memory/resourceArea.hpp
 @@ -35,6 +35,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7476,8 +7751,8 @@
  
  // The resource area holds temporary data structures in the VM.
  // The actual allocation areas are thread local. Typical usage:
---- hotspot/src/share/vm/memory/space.hpp	2011-07-05 14:31:03.000000000 -0400
-+++ hotspot/src/share/vm/memory/space.hpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/memory/space.hpp
++++ hotspot/src/share/vm/memory/space.hpp
 @@ -44,6 +44,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "os_windows.inline.hpp"
@@ -7488,8 +7763,8 @@
  
  // A space is an abstraction for the "storage units" backing
  // up the generation abstraction. It includes specific
---- hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp	2011-07-05 14:31:03.000000000 -0400
-+++ hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp
++++ hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp
 @@ -38,6 +38,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7500,8 +7775,8 @@
  
  // Thread-Local Edens support
  
---- hotspot/src/share/vm/memory/universe.cpp	2011-07-05 14:31:03.000000000 -0400
-+++ hotspot/src/share/vm/memory/universe.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/memory/universe.cpp
++++ hotspot/src/share/vm/memory/universe.cpp
 @@ -89,6 +89,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7512,8 +7787,8 @@
  #ifndef SERIALGC
  #include "gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.hpp"
  #include "gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp"
---- hotspot/src/share/vm/oops/constantPoolKlass.cpp	2011-07-05 14:31:03.000000000 -0400
-+++ hotspot/src/share/vm/oops/constantPoolKlass.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/oops/constantPoolKlass.cpp
++++ hotspot/src/share/vm/oops/constantPoolKlass.cpp
 @@ -44,6 +44,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7524,8 +7799,8 @@
  #ifndef SERIALGC
  #include "gc_implementation/parNew/parOopClosures.inline.hpp"
  #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
---- hotspot/src/share/vm/oops/instanceKlass.cpp	2011-07-05 14:31:03.000000000 -0400
-+++ hotspot/src/share/vm/oops/instanceKlass.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/oops/instanceKlass.cpp
++++ hotspot/src/share/vm/oops/instanceKlass.cpp
 @@ -59,6 +59,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7536,8 +7811,8 @@
  #ifndef SERIALGC
  #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
  #include "gc_implementation/g1/g1OopClosures.inline.hpp"
---- hotspot/src/share/vm/oops/markOop.cpp	2011-07-05 14:31:03.000000000 -0400
-+++ hotspot/src/share/vm/oops/markOop.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/oops/markOop.cpp
++++ hotspot/src/share/vm/oops/markOop.cpp
 @@ -33,6 +33,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7548,8 +7823,8 @@
  
  
  void markOopDesc::print_on(outputStream* st) const {
---- hotspot/src/share/vm/oops/oop.cpp	2011-07-05 14:31:03.000000000 -0400
-+++ hotspot/src/share/vm/oops/oop.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/oops/oop.cpp
++++ hotspot/src/share/vm/oops/oop.cpp
 @@ -36,6 +36,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7560,8 +7835,8 @@
  
  bool always_do_update_barrier = false;
  
---- hotspot/src/share/vm/oops/oopsHierarchy.cpp	2011-07-05 14:31:03.000000000 -0400
-+++ hotspot/src/share/vm/oops/oopsHierarchy.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/oops/oopsHierarchy.cpp
++++ hotspot/src/share/vm/oops/oopsHierarchy.cpp
 @@ -37,6 +37,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7572,8 +7847,8 @@
  
  #ifdef CHECK_UNHANDLED_OOPS
  
---- hotspot/src/share/vm/opto/c2_globals.hpp	2011-07-05 14:31:03.000000000 -0400
-+++ hotspot/src/share/vm/opto/c2_globals.hpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/opto/c2_globals.hpp
++++ hotspot/src/share/vm/opto/c2_globals.hpp
 @@ -41,6 +41,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "c2_globals_windows.hpp"
@@ -7584,8 +7859,8 @@
  
  //
  // Defines all globals flags used by the server compiler.
---- hotspot/src/share/vm/prims/forte.cpp	2011-07-05 14:31:04.000000000 -0400
-+++ hotspot/src/share/vm/prims/forte.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/prims/forte.cpp
++++ hotspot/src/share/vm/prims/forte.cpp
 @@ -639,6 +639,11 @@
  // Method to let libcollector know about a dynamically loaded function.
  // Because it is weakly bound, the calls become NOP's when the library
@@ -7606,8 +7881,8 @@
  #endif // !_WINDOWS
  
  } // end extern "C"
---- hotspot/src/share/vm/prims/jni.cpp	2011-07-05 14:31:04.000000000 -0400
-+++ hotspot/src/share/vm/prims/jni.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/prims/jni.cpp
++++ hotspot/src/share/vm/prims/jni.cpp
 @@ -88,6 +88,10 @@
  # include "os_windows.inline.hpp"
  # include "thread_windows.inline.hpp"
@@ -7619,8 +7894,8 @@
  
  static jint CurrentVersion = JNI_VERSION_1_6;
  
---- hotspot/src/share/vm/prims/jvm.cpp	2011-07-05 14:31:04.000000000 -0400
-+++ hotspot/src/share/vm/prims/jvm.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/prims/jvm.cpp
++++ hotspot/src/share/vm/prims/jvm.cpp
 @@ -72,6 +72,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "jvm_windows.h"
@@ -7631,8 +7906,8 @@
  
  #include <errno.h>
  
---- hotspot/src/share/vm/prims/jvm.h	2011-07-05 14:31:04.000000000 -0400
-+++ hotspot/src/share/vm/prims/jvm.h	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/prims/jvm.h
++++ hotspot/src/share/vm/prims/jvm.h
 @@ -36,6 +36,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "jvm_windows.h"
@@ -7643,8 +7918,8 @@
  
  #ifndef _JAVASOFT_JVM_H_
  #define _JAVASOFT_JVM_H_
---- hotspot/src/share/vm/prims/jvmtiEnv.cpp	2011-07-05 14:31:04.000000000 -0400
-+++ hotspot/src/share/vm/prims/jvmtiEnv.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/prims/jvmtiEnv.cpp
++++ hotspot/src/share/vm/prims/jvmtiEnv.cpp
 @@ -68,6 +68,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7655,8 +7930,8 @@
  
  
  
---- hotspot/src/share/vm/prims/jvmtiImpl.cpp	2011-07-05 14:31:04.000000000 -0400
-+++ hotspot/src/share/vm/prims/jvmtiImpl.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/prims/jvmtiImpl.cpp
++++ hotspot/src/share/vm/prims/jvmtiImpl.cpp
 @@ -51,6 +51,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7667,8 +7942,8 @@
  
  //
  // class JvmtiAgentThread
---- hotspot/src/share/vm/prims/nativeLookup.cpp	2011-07-05 14:31:04.000000000 -0400
-+++ hotspot/src/share/vm/prims/nativeLookup.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/prims/nativeLookup.cpp
++++ hotspot/src/share/vm/prims/nativeLookup.cpp
 @@ -49,6 +49,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "os_windows.inline.hpp"
@@ -7679,8 +7954,8 @@
  
  
  static void mangle_name_on(outputStream* st, symbolOop name, int begin, int end) {
---- hotspot/src/share/vm/runtime/arguments.cpp	2011-07-05 14:31:04.000000000 -0400
-+++ hotspot/src/share/vm/runtime/arguments.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/arguments.cpp
++++ hotspot/src/share/vm/runtime/arguments.cpp
 @@ -55,6 +55,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "os_windows.inline.hpp"
@@ -7691,8 +7966,8 @@
  #ifndef SERIALGC
  #include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp"
  #endif
---- hotspot/src/share/vm/runtime/atomic.cpp	2011-07-05 14:31:04.000000000 -0400
-+++ hotspot/src/share/vm/runtime/atomic.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/atomic.cpp
++++ hotspot/src/share/vm/runtime/atomic.cpp
 @@ -33,6 +33,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "os_windows.inline.hpp"
@@ -7716,8 +7991,8 @@
  
  jbyte Atomic::cmpxchg(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
    assert(sizeof(jbyte) == 1, "assumption.");
---- hotspot/src/share/vm/runtime/fprofiler.hpp	2011-07-05 14:31:04.000000000 -0400
-+++ hotspot/src/share/vm/runtime/fprofiler.hpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/fprofiler.hpp
++++ hotspot/src/share/vm/runtime/fprofiler.hpp
 @@ -35,6 +35,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7728,8 +8003,8 @@
  
  // a simple flat profiler for Java
  
---- hotspot/src/share/vm/runtime/globals.hpp	2011-07-05 14:31:04.000000000 -0400
-+++ hotspot/src/share/vm/runtime/globals.hpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/globals.hpp
++++ hotspot/src/share/vm/runtime/globals.hpp
 @@ -44,6 +44,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "globals_windows.hpp"
@@ -7773,8 +8048,8 @@
  #endif
  #ifdef SHARK
  #ifdef TARGET_ARCH_zero
---- hotspot/src/share/vm/runtime/handles.cpp	2011-07-05 14:31:04.000000000 -0400
-+++ hotspot/src/share/vm/runtime/handles.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/handles.cpp
++++ hotspot/src/share/vm/runtime/handles.cpp
 @@ -38,6 +38,10 @@
  # include "os_windows.inline.hpp"
  # include "thread_windows.inline.hpp"
@@ -7786,8 +8061,8 @@
  
  #ifdef ASSERT
  oop* HandleArea::allocate_handle(oop obj) {
---- hotspot/src/share/vm/runtime/handles.inline.hpp	2011-07-05 14:31:04.000000000 -0400
-+++ hotspot/src/share/vm/runtime/handles.inline.hpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/handles.inline.hpp
++++ hotspot/src/share/vm/runtime/handles.inline.hpp
 @@ -35,6 +35,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7798,8 +8073,8 @@
  
  // these inline functions are in a separate file to break an include cycle
  // between Thread and Handle
---- hotspot/src/share/vm/runtime/interfaceSupport.hpp	2011-07-05 14:31:04.000000000 -0400
-+++ hotspot/src/share/vm/runtime/interfaceSupport.hpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/interfaceSupport.hpp
++++ hotspot/src/share/vm/runtime/interfaceSupport.hpp
 @@ -44,6 +44,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7820,8 +8095,8 @@
  
  };
  
---- hotspot/src/share/vm/runtime/java.cpp	2011-07-05 14:31:04.000000000 -0400
-+++ hotspot/src/share/vm/runtime/java.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/java.cpp
++++ hotspot/src/share/vm/runtime/java.cpp
 @@ -79,6 +79,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7832,8 +8107,8 @@
  #ifndef SERIALGC
  #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
  #include "gc_implementation/parallelScavenge/psScavenge.hpp"
---- hotspot/src/share/vm/runtime/javaCalls.cpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/runtime/javaCalls.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/javaCalls.cpp
++++ hotspot/src/share/vm/runtime/javaCalls.cpp
 @@ -48,6 +48,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7844,8 +8119,8 @@
  
  // -----------------------------------------------------
  // Implementation of JavaCallWrapper
---- hotspot/src/share/vm/runtime/javaCalls.hpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/runtime/javaCalls.hpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/javaCalls.hpp
++++ hotspot/src/share/vm/runtime/javaCalls.hpp
 @@ -48,6 +48,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7856,8 +8131,8 @@
  
  // A JavaCallWrapper is constructed before each JavaCall and destructed after the call.
  // Its purpose is to allocate/deallocate a new handle block and to save/restore the last
---- hotspot/src/share/vm/runtime/javaFrameAnchor.hpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/runtime/javaFrameAnchor.hpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/javaFrameAnchor.hpp
++++ hotspot/src/share/vm/runtime/javaFrameAnchor.hpp
 @@ -44,6 +44,12 @@
  #ifdef TARGET_OS_ARCH_windows_x86
  # include "orderAccess_windows_x86.inline.hpp"
@@ -7871,8 +8146,8 @@
  //
  // An object for encapsulating the machine/os dependent part of a JavaThread frame state
  //
---- hotspot/src/share/vm/runtime/jniHandles.cpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/runtime/jniHandles.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/jniHandles.cpp
++++ hotspot/src/share/vm/runtime/jniHandles.cpp
 @@ -37,6 +37,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7883,8 +8158,8 @@
  
  
  JNIHandleBlock* JNIHandles::_global_handles       = NULL;
---- hotspot/src/share/vm/runtime/memprofiler.cpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/runtime/memprofiler.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/memprofiler.cpp
++++ hotspot/src/share/vm/runtime/memprofiler.cpp
 @@ -46,6 +46,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7895,8 +8170,8 @@
  
  #ifndef PRODUCT
  
---- hotspot/src/share/vm/runtime/mutex.cpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/runtime/mutex.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/mutex.cpp
++++ hotspot/src/share/vm/runtime/mutex.cpp
 @@ -39,6 +39,10 @@
  # include "mutex_windows.inline.hpp"
  # include "thread_windows.inline.hpp"
@@ -7908,8 +8183,8 @@
  
  // o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o
  //
---- hotspot/src/share/vm/runtime/mutexLocker.cpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/runtime/mutexLocker.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/mutexLocker.cpp
++++ hotspot/src/share/vm/runtime/mutexLocker.cpp
 @@ -36,6 +36,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -7920,8 +8195,8 @@
  
  // Mutexes used in the VM (see comment in mutexLocker.hpp):
  //
---- hotspot/src/share/vm/runtime/mutexLocker.hpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/runtime/mutexLocker.hpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/mutexLocker.hpp
++++ hotspot/src/share/vm/runtime/mutexLocker.hpp
 @@ -36,6 +36,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "os_windows.inline.hpp"
@@ -7932,8 +8207,8 @@
  
  // Mutexes used in the VM.
  
---- hotspot/src/share/vm/runtime/objectMonitor.cpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/runtime/objectMonitor.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/objectMonitor.cpp
++++ hotspot/src/share/vm/runtime/objectMonitor.cpp
 @@ -50,6 +50,10 @@
  # include "os_windows.inline.hpp"
  # include "thread_windows.inline.hpp"
@@ -7945,8 +8220,8 @@
  
  #if defined(__GNUC__) && !defined(IA64)
    // Need to inhibit inlining for older versions of GCC to avoid build-time failures
---- hotspot/src/share/vm/runtime/os.cpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/runtime/os.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/os.cpp
++++ hotspot/src/share/vm/runtime/os.cpp
 @@ -60,6 +60,10 @@
  # include "os_windows.inline.hpp"
  # include "thread_windows.inline.hpp"
@@ -7970,8 +8245,8 @@
  
    // If daylight savings time is in effect,
    // we are 1 hour East of our time zone
---- hotspot/src/share/vm/runtime/os.hpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/runtime/os.hpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/os.hpp
++++ hotspot/src/share/vm/runtime/os.hpp
 @@ -30,6 +30,9 @@
  #include "runtime/extendedPC.hpp"
  #include "runtime/handles.hpp"
@@ -8005,8 +8280,8 @@
  
  
    // debugging support (mostly used by debug.cpp but also fatal error handler)
---- hotspot/src/share/vm/runtime/osThread.hpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/runtime/osThread.hpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/osThread.hpp
++++ hotspot/src/share/vm/runtime/osThread.hpp
 @@ -109,6 +109,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "osThread_windows.hpp"
@@ -8017,8 +8292,8 @@
  
  };
  
---- hotspot/src/share/vm/runtime/safepoint.cpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/runtime/safepoint.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/safepoint.cpp
++++ hotspot/src/share/vm/runtime/safepoint.cpp
 @@ -70,6 +70,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -8029,8 +8304,8 @@
  #ifndef SERIALGC
  #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
  #include "gc_implementation/shared/concurrentGCThread.hpp"
---- hotspot/src/share/vm/runtime/synchronizer.cpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/runtime/synchronizer.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/synchronizer.cpp
++++ hotspot/src/share/vm/runtime/synchronizer.cpp
 @@ -51,6 +51,10 @@
  # include "os_windows.inline.hpp"
  # include "thread_windows.inline.hpp"
@@ -8042,8 +8317,8 @@
  
  #if defined(__GNUC__) && !defined(IA64)
    // Need to inhibit inlining for older versions of GCC to avoid build-time failures
---- hotspot/src/share/vm/runtime/task.cpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/runtime/task.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/task.cpp
++++ hotspot/src/share/vm/runtime/task.cpp
 @@ -39,6 +39,10 @@
  # include "os_windows.inline.hpp"
  # include "thread_windows.inline.hpp"
@@ -8055,8 +8330,8 @@
  
  int PeriodicTask::_num_tasks = 0;
  PeriodicTask* PeriodicTask::_tasks[PeriodicTask::max_tasks];
---- hotspot/src/share/vm/runtime/thread.cpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/runtime/thread.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/thread.cpp
++++ hotspot/src/share/vm/runtime/thread.cpp
 @@ -88,6 +88,10 @@
  # include "os_windows.inline.hpp"
  # include "thread_windows.inline.hpp"
@@ -8068,8 +8343,8 @@
  #ifndef SERIALGC
  #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
  #include "gc_implementation/g1/concurrentMarkThread.inline.hpp"
---- hotspot/src/share/vm/runtime/thread.hpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/runtime/thread.hpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/thread.hpp
++++ hotspot/src/share/vm/runtime/thread.hpp
 @@ -1598,6 +1598,12 @@
  #ifdef TARGET_OS_ARCH_windows_x86
  # include "thread_windows_x86.hpp"
@@ -8083,8 +8358,8 @@
  
  
   public:
---- hotspot/src/share/vm/runtime/threadLocalStorage.cpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/runtime/threadLocalStorage.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/threadLocalStorage.cpp
++++ hotspot/src/share/vm/runtime/threadLocalStorage.cpp
 @@ -36,6 +36,10 @@
  # include "os_windows.inline.hpp"
  # include "thread_windows.inline.hpp"
@@ -8096,8 +8371,8 @@
  
  // static member initialization
  int ThreadLocalStorage::_thread_index = -1;
---- hotspot/src/share/vm/runtime/threadLocalStorage.hpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/runtime/threadLocalStorage.hpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/threadLocalStorage.hpp
++++ hotspot/src/share/vm/runtime/threadLocalStorage.hpp
 @@ -62,6 +62,12 @@
  #ifdef TARGET_OS_ARCH_windows_x86
  # include "threadLS_windows_x86.hpp"
@@ -8111,8 +8386,8 @@
  
  
   public:
---- hotspot/src/share/vm/runtime/timer.cpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/runtime/timer.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/timer.cpp
++++ hotspot/src/share/vm/runtime/timer.cpp
 @@ -35,6 +35,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "os_windows.inline.hpp"
@@ -8123,8 +8398,8 @@
  
  
  void elapsedTimer::add(elapsedTimer t) {
---- hotspot/src/share/vm/runtime/virtualspace.cpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/runtime/virtualspace.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/virtualspace.cpp
++++ hotspot/src/share/vm/runtime/virtualspace.cpp
 @@ -35,6 +35,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "os_windows.inline.hpp"
@@ -8135,8 +8410,8 @@
  
  
  // ReservedSpace
---- hotspot/src/share/vm/runtime/vmStructs.cpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/runtime/vmStructs.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/vmStructs.cpp
++++ hotspot/src/share/vm/runtime/vmStructs.cpp
 @@ -118,6 +118,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -8160,8 +8435,8 @@
  #ifndef SERIALGC
  #include "gc_implementation/concurrentMarkSweep/cmsPermGen.hpp"
  #include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp"
---- hotspot/src/share/vm/runtime/vmThread.cpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/runtime/vmThread.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/vmThread.cpp
++++ hotspot/src/share/vm/runtime/vmThread.cpp
 @@ -46,6 +46,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -8172,8 +8447,8 @@
  
  HS_DTRACE_PROBE_DECL3(hotspot, vmops__request, char *, uintptr_t, int);
  HS_DTRACE_PROBE_DECL3(hotspot, vmops__begin, char *, uintptr_t, int);
---- hotspot/src/share/vm/runtime/vmThread.hpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/runtime/vmThread.hpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/vmThread.hpp
++++ hotspot/src/share/vm/runtime/vmThread.hpp
 @@ -36,6 +36,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -8184,8 +8459,8 @@
  
  //
  // Prioritized queue of VM operations.
---- hotspot/src/share/vm/runtime/vm_operations.cpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/runtime/vm_operations.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/vm_operations.cpp
++++ hotspot/src/share/vm/runtime/vm_operations.cpp
 @@ -43,6 +43,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -8196,8 +8471,8 @@
  
  #define VM_OP_NAME_INITIALIZE(name) #name,
  
---- hotspot/src/share/vm/runtime/vm_version.cpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/runtime/vm_version.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/runtime/vm_version.cpp
++++ hotspot/src/share/vm/runtime/vm_version.cpp
 @@ -160,7 +160,8 @@
  
  #define OS       LINUX_ONLY("linux")             \
@@ -8208,8 +8483,8 @@
  
  #ifdef ZERO
  #define CPU      ZERO_LIBARCH
---- hotspot/src/share/vm/utilities/accessFlags.cpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/utilities/accessFlags.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/utilities/accessFlags.cpp
++++ hotspot/src/share/vm/utilities/accessFlags.cpp
 @@ -34,6 +34,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "os_windows.inline.hpp"
@@ -8220,8 +8495,8 @@
  
  
  void AccessFlags::atomic_set_bits(jint bits) {
---- hotspot/src/share/vm/utilities/array.cpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/utilities/array.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/utilities/array.cpp
++++ hotspot/src/share/vm/utilities/array.cpp
 @@ -34,6 +34,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -8232,8 +8507,8 @@
  
  
  #ifdef ASSERT
---- hotspot/src/share/vm/utilities/bitMap.cpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/utilities/bitMap.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/utilities/bitMap.cpp
++++ hotspot/src/share/vm/utilities/bitMap.cpp
 @@ -35,6 +35,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "os_windows.inline.hpp"
@@ -8244,8 +8519,8 @@
  
  
  BitMap::BitMap(bm_word_t* map, idx_t size_in_bits) :
---- hotspot/src/share/vm/utilities/debug.cpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/utilities/debug.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/utilities/debug.cpp
++++ hotspot/src/share/vm/utilities/debug.cpp
 @@ -62,6 +62,10 @@
  # include "os_windows.inline.hpp"
  # include "thread_windows.inline.hpp"
@@ -8257,8 +8532,8 @@
  
  #ifndef ASSERT
  #  ifdef _DEBUG
---- hotspot/src/share/vm/utilities/elfFile.hpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/utilities/elfFile.hpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/utilities/elfFile.hpp
++++ hotspot/src/share/vm/utilities/elfFile.hpp
 @@ -41,7 +41,9 @@
  typedef Elf64_Shdr      Elf_Shdr;
  typedef Elf64_Sym       Elf_Sym;
@@ -8280,8 +8555,8 @@
  
  #include "globalDefinitions.hpp"
  #include "memory/allocation.hpp"
---- hotspot/src/share/vm/utilities/events.cpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/utilities/events.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/utilities/events.cpp
++++ hotspot/src/share/vm/utilities/events.cpp
 @@ -38,6 +38,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -8292,8 +8567,8 @@
  
  
  #ifndef PRODUCT
---- hotspot/src/share/vm/utilities/exceptions.cpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/utilities/exceptions.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/utilities/exceptions.cpp
++++ hotspot/src/share/vm/utilities/exceptions.cpp
 @@ -42,6 +42,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -8304,8 +8579,8 @@
  
  
  // Implementation of ThreadShadow
---- hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp
++++ hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp
 @@ -76,13 +76,26 @@
  # include <sys/procfs.h>
  # endif
@@ -8373,8 +8648,8 @@
  inline int g_isnan(float  f) { return isnanf(f); }
  inline int g_isnan(double f) { return isnan(f); }
  #else
---- hotspot/src/share/vm/utilities/growableArray.cpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/utilities/growableArray.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/utilities/growableArray.cpp
++++ hotspot/src/share/vm/utilities/growableArray.cpp
 @@ -34,6 +34,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -8385,8 +8660,19 @@
  #ifdef ASSERT
  void GenericGrowableArray::set_nesting() {
    if (on_stack()) {
---- hotspot/src/share/vm/utilities/histogram.hpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/utilities/histogram.hpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/utilities/hashtable.hpp
++++ hotspot/src/share/vm/utilities/hashtable.hpp
+@@ -283,7 +283,7 @@
+   }
+ 
+   int index_for(symbolHandle name, Handle loader) {
+-    return hash_to_index(compute_hash(name, loader));
++    return this->hash_to_index(compute_hash(name, loader));
+   }
+ };
+ 
+--- hotspot/src/share/vm/utilities/histogram.hpp
++++ hotspot/src/share/vm/utilities/histogram.hpp
 @@ -37,6 +37,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "os_windows.inline.hpp"
@@ -8397,13 +8683,13 @@
  
  // This class provides a framework for collecting various statistics.
  // The current implementation is oriented towards counting invocations
---- hotspot/src/share/vm/utilities/macros.hpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/utilities/macros.hpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/utilities/macros.hpp
++++ hotspot/src/share/vm/utilities/macros.hpp
 @@ -161,6 +161,14 @@
  #define NOT_WINDOWS(code) code
  #endif
  
-+#if defined(__MidnightBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
++#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
 +#define BSD_ONLY(code) code
 +#define NOT_BSD(code)
 +#else
@@ -8414,8 +8700,8 @@
  #if defined(IA32) || defined(AMD64)
  #define X86
  #define X86_ONLY(code) code
---- hotspot/src/share/vm/utilities/ostream.cpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/utilities/ostream.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/utilities/ostream.cpp
++++ hotspot/src/share/vm/utilities/ostream.cpp
 @@ -39,6 +39,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "os_windows.inline.hpp"
@@ -8435,8 +8721,8 @@
  #include <sys/types.h>
  #include <sys/socket.h>
  #include <netinet/in.h>
---- hotspot/src/share/vm/utilities/preserveException.hpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/utilities/preserveException.hpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/utilities/preserveException.hpp
++++ hotspot/src/share/vm/utilities/preserveException.hpp
 @@ -35,6 +35,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -8447,8 +8733,8 @@
  
  // This file provides more support for exception handling; see also exceptions.hpp
  class PreserveExceptionMark {
---- hotspot/src/share/vm/utilities/taskqueue.cpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/utilities/taskqueue.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/utilities/taskqueue.cpp
++++ hotspot/src/share/vm/utilities/taskqueue.cpp
 @@ -37,6 +37,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -8459,8 +8745,8 @@
  
  #ifdef TRACESPINNING
  uint ParallelTaskTerminator::_total_yields = 0;
---- hotspot/src/share/vm/utilities/taskqueue.hpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/utilities/taskqueue.hpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/utilities/taskqueue.hpp
++++ hotspot/src/share/vm/utilities/taskqueue.hpp
 @@ -47,6 +47,12 @@
  #ifdef TARGET_OS_ARCH_windows_x86
  # include "orderAccess_windows_x86.inline.hpp"
@@ -8474,8 +8760,8 @@
  
  // Simple TaskQueue stats that are collected by default in debug builds.
  
---- hotspot/src/share/vm/utilities/vmError.cpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/utilities/vmError.cpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/utilities/vmError.cpp
++++ hotspot/src/share/vm/utilities/vmError.cpp
 @@ -44,13 +44,18 @@
    "JAVA_HOME", "JRE_HOME", "JAVA_TOOL_OPTIONS", "_JAVA_OPTIONS", "CLASSPATH",
    "JAVA_COMPILER", "PATH", "USERNAME",
@@ -8505,8 +8791,8 @@
        out.print_raw   ("/bin/sh -c ");
  #elif defined(SOLARIS)
        out.print_raw   ("/usr/bin/sh -c ");
---- hotspot/src/share/vm/utilities/workgroup.hpp	2011-07-05 14:31:05.000000000 -0400
-+++ hotspot/src/share/vm/utilities/workgroup.hpp	2011-07-07 19:17:03.000000000 -0400
+--- hotspot/src/share/vm/utilities/workgroup.hpp
++++ hotspot/src/share/vm/utilities/workgroup.hpp
 @@ -35,6 +35,9 @@
  #ifdef TARGET_OS_FAMILY_windows
  # include "thread_windows.inline.hpp"
@@ -8517,8 +8803,21 @@
  
  // Forward declarations of classes defined here
  
---- jdk/make/com/sun/java/pack/Makefile	2011-07-05 14:35:27.000000000 -0400
-+++ jdk/make/com/sun/java/pack/Makefile	2011-07-07 19:17:03.000000000 -0400
+--- jaxp/jaxp.properties
++++ jaxp/jaxp.properties
+@@ -25,8 +25,8 @@
+ 
+ drops.master.copy.base=${drops.dir}
+ 
+-jaxp_src.bundle.name=jaxp144_04.zip
+-jaxp_src.bundle.md5.checksum=0ace787aa12177d201947e8ba0ba9bdd
++jaxp_src.bundle.name=jaxp144_05.zip
++jaxp_src.bundle.md5.checksum=03be10db6ee87a8163316a87a3d3cba5
+ jaxp_src.master.bundle.dir=${drops.master.copy.base}
+ jaxp_src.master.bundle.url.base=http://download.java.net/jaxp/openjdk/jdk6
+ 
+--- jdk/make/com/sun/java/pack/Makefile
++++ jdk/make/com/sun/java/pack/Makefile
 @@ -61,6 +61,7 @@
  
  
@@ -8550,8 +8849,28 @@
    OTHER_LDLIBS  += $(LIBCXX)
  # setup the list of libraries to link in...
  ifeq ($(PLATFORM), linux)
---- jdk/make/com/sun/security/auth/module/Makefile	2011-07-05 14:35:27.000000000 -0400
-+++ jdk/make/com/sun/security/auth/module/Makefile	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/com/sun/jmx/Makefile
++++ jdk/make/com/sun/jmx/Makefile
+@@ -102,16 +102,7 @@
+ # when available, we need to run with latest rmic version available. rmic 
+ # launch tool not built at this stage but we can invoke via rmi class.
+ 
+-RMIC_JAVA = $(OUTPUTDIR)/bin/java
+-# need to treat 64bit solaris differently
+-ifeq ($(PLATFORM)-$(LIBARCH), solaris-amd64)
+-RMIC_JAVA = $(OUTPUTDIR)/bin/amd64/java
+-endif
+-ifeq ($(PLATFORM)-$(LIBARCH), solaris-sparcv9)
+-RMIC_JAVA = $(OUTPUTDIR)/bin/sparcv9/java
+-endif
+-
+-RMIC = $(RMIC_JAVA) $(JAVA_TOOLS_FLAGS) -cp $(OUTPUTDIR)/classes sun.rmi.rmic.Main
++RMIC = $(BOOT_JAVA_CMD) -cp $(OUTPUTDIR)/classes sun.rmi.rmic.Main
+ 
+ $(CLASSDESTDIR)/%_Stub.class: $(CLASSDESTDIR)/%.class
+ 	$(prep-target)
+--- jdk/make/com/sun/security/auth/module/Makefile
++++ jdk/make/com/sun/security/auth/module/Makefile
 @@ -70,7 +70,7 @@
    include FILES_c_solaris.gmk
  endif # solaris
@@ -8561,8 +8880,8 @@
    LIBRARY = jaas_unix
    include FILES_export_unix.gmk
    include FILES_c_unix.gmk
---- jdk/make/com/sun/tools/attach/Exportedfiles.gmk	2011-07-05 14:35:27.000000000 -0400
-+++ jdk/make/com/sun/tools/attach/Exportedfiles.gmk	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/com/sun/tools/attach/Exportedfiles.gmk
++++ jdk/make/com/sun/tools/attach/Exportedfiles.gmk
 @@ -43,5 +43,7 @@
  	sun/tools/attach/LinuxVirtualMachine.java
  endif
@@ -8573,8 +8892,8 @@
 +FILES_export = \
 +	sun/tools/attach/BsdVirtualMachine.java
 +endif
---- jdk/make/com/sun/tools/attach/FILES_c.gmk	2011-07-05 14:35:27.000000000 -0400
-+++ jdk/make/com/sun/tools/attach/FILES_c.gmk	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/com/sun/tools/attach/FILES_c.gmk
++++ jdk/make/com/sun/tools/attach/FILES_c.gmk
 @@ -39,4 +39,7 @@
  	LinuxVirtualMachine.c
  endif
@@ -8584,8 +8903,8 @@
 +FILES_c = \
 +	BsdVirtualMachine.c
 +endif
---- jdk/make/com/sun/tools/attach/FILES_java.gmk	2011-07-05 14:35:27.000000000 -0400
-+++ jdk/make/com/sun/tools/attach/FILES_java.gmk	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/com/sun/tools/attach/FILES_java.gmk
++++ jdk/make/com/sun/tools/attach/FILES_java.gmk
 @@ -43,6 +43,11 @@
  	sun/tools/attach/LinuxAttachProvider.java
  endif
@@ -8598,8 +8917,8 @@
  #
  # Files that need to be copied
  #
---- jdk/make/com/sun/tools/attach/Makefile	2011-07-05 14:35:27.000000000 -0400
-+++ jdk/make/com/sun/tools/attach/Makefile	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/com/sun/tools/attach/Makefile
++++ jdk/make/com/sun/tools/attach/Makefile
 @@ -36,6 +36,9 @@
  ifeq ($(PLATFORM), linux)
  FILES_m = mapfile-linux
@@ -8610,8 +8929,8 @@
  include $(BUILDDIR)/common/Mapfile-vers.gmk
  
  #
---- jdk/make/com/sun/tools/attach/mapfile-bsd	2011-07-07 19:16:00.000000000 -0400
-+++ jdk/make/com/sun/tools/attach/mapfile-bsd	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/com/sun/tools/attach/mapfile-bsd
++++ jdk/make/com/sun/tools/attach/mapfile-bsd
 @@ -30,14 +30,12 @@
  	    Java_sun_tools_attach_BsdVirtualMachine_checkPermissions;
  	    Java_sun_tools_attach_BsdVirtualMachine_close;
@@ -8628,8 +8947,8 @@
  	local:
  		*;
  };
---- jdk/make/common/Defs-bsd.gmk	2011-07-07 19:16:00.000000000 -0400
-+++ jdk/make/common/Defs-bsd.gmk	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/common/Defs-bsd.gmk
++++ jdk/make/common/Defs-bsd.gmk
 @@ -43,12 +43,6 @@
  # Get shared JDK settings
  include $(JDK_MAKE_SHARED_DIR)/Defs.gmk
@@ -8769,7 +9088,7 @@
  # DPS (Displayable PostScript) is available on Solaris machines
  HAVE_DPS = no
  
-+ifeq ($(OS_VENDOR), MidnightBSD)
++ifeq ($(OS_VENDOR), FreeBSD)
 +  SYSTEM_ZLIB = true
 +endif
 +
@@ -8780,8 +9099,8 @@
  #
  # Japanese manpages
  #
---- jdk/make/common/Defs-linux.gmk	2011-07-05 14:35:27.000000000 -0400
-+++ jdk/make/common/Defs-linux.gmk	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/common/Defs-linux.gmk
++++ jdk/make/common/Defs-linux.gmk
 @@ -318,7 +318,7 @@
  override LIBTHREAD               =
  override MOOT_PRIORITIES         = true
@@ -8791,8 +9110,8 @@
  ifeq ($(ARCH), amd64)
  override OPENWIN_LIB             = $(OPENWIN_HOME)/lib64
  else
---- jdk/make/common/Defs.gmk	2011-07-05 14:35:27.000000000 -0400
-+++ jdk/make/common/Defs.gmk	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/common/Defs.gmk
++++ jdk/make/common/Defs.gmk
 @@ -117,6 +117,24 @@
  _OUTPUTDIR=$(JDK_TOPDIR)/build/$(PLATFORM)-$(ARCH)
  endif
@@ -8837,8 +9156,8 @@
  endif # PROGRAM
  
  LDLIBS_COMMON += $(EXTRA_LIBS)
---- jdk/make/common/Program.gmk	2011-07-05 14:35:27.000000000 -0400
-+++ jdk/make/common/Program.gmk	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/common/Program.gmk
++++ jdk/make/common/Program.gmk
 @@ -67,11 +67,27 @@
  # Create a dependency on libjli (Java Launcher Infrastructure)
  #
@@ -8858,7 +9177,7 @@
 +    LDFLAGS += -Wl,--whole-archive
 +    LDFLAGS += $(OUTPUTDIR)/tmp/java/jli/$(OBJDIRNAME)/static/libjli.a
 +    LDFLAGS += -Wl,--no-whole-archive
-+# Work-around an dlsym(RTLD_DEFAULT) bug in at least MidnightBSD & OpenBSD
++# Work-around an dlsym(RTLD_DEFAULT) bug in at least FreeBSD & OpenBSD
 +    LDFLAGS += -Wl,--export-dynamic
 +  endif
 +  ifeq ($(SYSTEM_ZLIB),true)
@@ -8899,8 +9218,8 @@
  
  OTHER_CPPFLAGS += -DPROGNAME='"$(PROGRAM)"'
  VERSION_DEFINES += -DFULL_VERSION='"$(FULL_VERSION)"'
---- jdk/make/common/Release.gmk	2011-07-05 14:35:27.000000000 -0400
-+++ jdk/make/common/Release.gmk	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/common/Release.gmk
++++ jdk/make/common/Release.gmk
 @@ -145,14 +145,13 @@
  	tnameserv.1     \
  	unpack200.1
@@ -8969,8 +9288,8 @@
  	       | ($(CD) $(JDK_IMAGE_DIR)/src && $(TAR) xf -); \
  	  fi; \
  	done
---- jdk/make/common/shared/Compiler-gcc.gmk	2011-07-05 14:35:27.000000000 -0400
-+++ jdk/make/common/shared/Compiler-gcc.gmk	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/common/shared/Compiler-gcc.gmk
++++ jdk/make/common/shared/Compiler-gcc.gmk
 @@ -99,6 +99,24 @@
  
  endif
@@ -8978,9 +9297,9 @@
 +ifeq ($(PLATFORM), bsd)
 +
 +  # Settings specific to BSD
-+  CC             = $(COMPILER_PATH)gcc
-+  CPP            = $(COMPILER_PATH)gcc -E
-+  CXX            = $(COMPILER_PATH)g++
++  CC             ?= $(COMPILER_PATH)gcc
++  CPP            ?= $(COMPILER_PATH)gcc -E
++  CXX            ?= $(COMPILER_PATH)g++
 +  REQUIRED_CC_VER = 3.2
 +
 +  # Option used to create a shared library
@@ -8996,8 +9315,8 @@
  ifeq ($(PLATFORM), solaris)
  
    # Settings specific to Solaris
---- jdk/make/common/shared/Compiler.gmk	2011-07-05 14:35:27.000000000 -0400
-+++ jdk/make/common/shared/Compiler.gmk	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/common/shared/Compiler.gmk
++++ jdk/make/common/shared/Compiler.gmk
 @@ -37,8 +37,8 @@
    override CC_VERSION = sun
  endif
@@ -9009,8 +9328,8 @@
    override CC_VERSION = gcc
  endif
  
---- jdk/make/common/shared/Defs-bsd.gmk	2011-07-07 19:16:00.000000000 -0400
-+++ jdk/make/common/shared/Defs-bsd.gmk	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/common/shared/Defs-bsd.gmk
++++ jdk/make/common/shared/Defs-bsd.gmk
 @@ -70,7 +70,7 @@
  endef
  
@@ -9049,8 +9368,8 @@
  # Import JDK images allow for partial builds, components not built are
  #    imported (or copied from) these import areas when needed.
  
---- jdk/make/common/shared/Defs-java.gmk	2011-07-05 14:35:27.000000000 -0400
-+++ jdk/make/common/shared/Defs-java.gmk	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/common/shared/Defs-java.gmk
++++ jdk/make/common/shared/Defs-java.gmk
 @@ -42,7 +42,7 @@
    #   Suspect this may not be needed anymore.
    JAVA_MEM_FLAGS   += -Xms$(MAX_VM_MEMORY)m -XX:-Inline
@@ -9060,8 +9379,8 @@
  endif
  
  # 
---- jdk/make/common/shared/Defs-utils.gmk	2011-07-05 14:35:27.000000000 -0400
-+++ jdk/make/common/shared/Defs-utils.gmk	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/common/shared/Defs-utils.gmk
++++ jdk/make/common/shared/Defs-utils.gmk
 @@ -80,6 +80,13 @@
    endif
  endif
@@ -9109,8 +9428,8 @@
 +    TAR        = $(UTILS_USR_BIN_PATH)tar
 +  endif
 +endif
---- jdk/make/common/shared/Defs.gmk	2011-07-05 14:35:27.000000000 -0400
-+++ jdk/make/common/shared/Defs.gmk	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/common/shared/Defs.gmk
++++ jdk/make/common/shared/Defs.gmk
 @@ -143,7 +143,7 @@
          echo older; \
        else \
@@ -9120,17 +9439,17 @@
            echo older; \
          else \
            echo newer; \
---- jdk/make/common/shared/Platform.gmk	2011-07-05 14:35:27.000000000 -0400
-+++ jdk/make/common/shared/Platform.gmk	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/common/shared/Platform.gmk
++++ jdk/make/common/shared/Platform.gmk
 @@ -264,6 +264,76 @@
    MB_OF_MEMORY := $(shell free -m | fgrep Mem: | sed -e 's@\ \ *@ @g' | cut -d' ' -f2)
  endif
  
-+ifeq ($(SYSTEM_UNAME), MidnightBSD)
++ifeq ($(SYSTEM_UNAME), FreeBSD)
 +  PLATFORM = bsd
-+  OS_NAME = midnightbsd
-+  OS_VENDOR = MidnightBSD
-+  REQUIRED_OS_VERSION = 0.3
++  OS_NAME = freebsd
++  OS_VENDOR = FreeBSD
++  REQUIRED_OS_VERSION = 6.0
 +endif
 +
 +ifeq ($(SYSTEM_UNAME), Darwin)
@@ -9199,7 +9518,7 @@
  # Windows with and without CYGWIN will be slightly different
  ifeq ($(SYSTEM_UNAME), Windows_NT)
    PLATFORM = windows
-@@ -380,6 +450,13 @@
+@@ -413,6 +483,13 @@
  #    system swapping during the build.
  #    If we don't know, assume 512. Subtract 128 from MB for VM MAX.
  #    Don't set VM max over 1024-128=896.
@@ -9213,7 +9532,7 @@
  ifneq ($(MB_OF_MEMORY),)
    LOW_MEMORY_MACHINE := $(shell \
      if [ $(MB_OF_MEMORY) -le 512 ] ; then \
-@@ -391,7 +468,7 @@
+@@ -424,7 +501,7 @@
      if [ $(MB_OF_MEMORY) -le 1024 ] ; then \
        expr $(MB_OF_MEMORY) '-' 128 ; \
      else \
@@ -9222,7 +9541,7 @@
      fi)
    MIN_VM_MEMORY := $(shell \
      if [ $(MAX_VM_MEMORY) -le 128 ] ; then \
-@@ -443,6 +520,15 @@
+@@ -476,6 +553,15 @@
    ARCH_VM_SUBDIR=jre/lib/$(LIBARCH)
  endif
  
@@ -9238,8 +9557,8 @@
  # If blanks in the username, use the first 4 words and pack them together
  _USER1:=$(subst ', ,$(_USER))
  _USER2:=$(subst ", ,$(_USER1))
---- jdk/make/common/shared/Sanity-Settings.gmk	2011-07-05 14:35:27.000000000 -0400
-+++ jdk/make/common/shared/Sanity-Settings.gmk	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/common/shared/Sanity-Settings.gmk
++++ jdk/make/common/shared/Sanity-Settings.gmk
 @@ -242,6 +242,7 @@
    ALL_SETTINGS+=$(call addAltSetting,FREETYPE_HEADERS_PATH)
    ALL_SETTINGS+=$(call addAltSetting,FREETYPE_LIB_PATH)
@@ -9248,8 +9567,8 @@
  ALL_SETTINGS+=$(call addOptionalSetting,PLUG_LIBRARY_NAMES)
  
  ifdef OPENJDK
---- jdk/make/common/shared/Sanity.gmk	2011-07-05 14:35:27.000000000 -0400
-+++ jdk/make/common/shared/Sanity.gmk	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/common/shared/Sanity.gmk
++++ jdk/make/common/shared/Sanity.gmk
 @@ -90,6 +90,11 @@
      $(EGREP) "\#define" | $(NAWK) '{print $$3}')
  endif
@@ -9262,8 +9581,8 @@
  # Get the version numbers of what we are using
  _MAKE_VER  :=$(shell $(MAKE) --version 2>&1 | $(HEAD) -n 1)
  _ZIP_VER   :=$(shell $(ZIPEXE) -help 2>&1 | $(HEAD) -n 4 | $(EGREP) '^Zip')
---- jdk/make/java/Makefile	2011-07-05 14:35:27.000000000 -0400
-+++ jdk/make/java/Makefile	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/java/Makefile
++++ jdk/make/java/Makefile
 @@ -49,7 +49,7 @@
    endif
  endif # PLATFORM
@@ -9273,8 +9592,8 @@
    SUBDIRS += jexec
  endif # PLATFORM
  
---- jdk/make/java/hpi/hpi_common.gmk	2011-07-05 14:35:27.000000000 -0400
-+++ jdk/make/java/hpi/hpi_common.gmk	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/java/hpi/hpi_common.gmk
++++ jdk/make/java/hpi/hpi_common.gmk
 @@ -86,5 +86,9 @@
  # Things that must be linked in.
  #
@@ -9285,8 +9604,8 @@
  OTHER_LDLIBS += $(LIBSOCKET) -lnsl $(LIBM) -ldl
  endif
 +endif
---- jdk/make/java/hpi/native/Makefile	2011-07-05 14:35:28.000000000 -0400
-+++ jdk/make/java/hpi/native/Makefile	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/java/hpi/native/Makefile
++++ jdk/make/java/hpi/native/Makefile
 @@ -72,11 +72,18 @@
  ifeq ($(MOOT_PRIORITIES),true)
  OTHER_CPPFLAGS += -DMOOT_PRIORITIES
@@ -9306,8 +9625,8 @@
  ifeq ($(HAVE_GETHRVTIME),true)
  OTHER_CPPFLAGS += -DHAVE_GETHRVTIME
  endif
---- jdk/make/java/instrument/Makefile	2011-07-05 14:35:28.000000000 -0400
-+++ jdk/make/java/instrument/Makefile	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/java/instrument/Makefile
++++ jdk/make/java/instrument/Makefile
 @@ -102,6 +102,21 @@
    # equivalent of strcasecmp is stricmp on Windows
    CPPFLAGS_COMMON += -Dstrcasecmp=stricmp
@@ -9338,8 +9657,8 @@
  
  #
  # Library to compile.
---- jdk/make/java/java/Makefile	2011-07-05 14:35:28.000000000 -0400
-+++ jdk/make/java/java/Makefile	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/java/java/Makefile
++++ jdk/make/java/java/Makefile
 @@ -167,8 +167,10 @@
  # Is the altzone extern documented in ctime(3C) available?
  #
@@ -9366,8 +9685,8 @@
  
  #
  # Rules.
---- jdk/make/java/java/genlocales.gmk	2011-07-05 14:35:28.000000000 -0400
-+++ jdk/make/java/java/genlocales.gmk	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/java/java/genlocales.gmk
++++ jdk/make/java/java/genlocales.gmk
 @@ -76,11 +76,16 @@
  $(LocaleDataMetaInfo_Dest):$(LocaleDataMetaInfo_Src) $(LOCALEGEN_SH)
  	@$(RM) $@.tmp.euro $@.tmp.noneuro;
@@ -9390,8 +9709,8 @@
  		$@.tmp.noneuro $< $@
  	@$(RM) $@.tmp.euro $@.tmp.noneuro;
  	
---- jdk/make/java/java/localegen.sh	2011-07-05 14:35:28.000000000 -0400
-+++ jdk/make/java/java/localegen.sh	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/java/java/localegen.sh
++++ jdk/make/java/java/localegen.sh
 @@ -29,7 +29,7 @@
  # This script is to generate the supported locale list string and replace the
  # LocaleDataMetaInfo-XLocales.java in <ws>/src/share/classes/sun/util
@@ -9422,8 +9741,8 @@
  done
  
  sed_script=$sed_script"$INPUT_FILE > $OUTPUT_FILE"
---- jdk/make/java/java_hprof_demo/Makefile	2011-07-05 14:35:28.000000000 -0400
-+++ jdk/make/java/java_hprof_demo/Makefile	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/java/java_hprof_demo/Makefile
++++ jdk/make/java/java_hprof_demo/Makefile
 @@ -83,8 +83,10 @@
  ifeq ($(PLATFORM), windows)
    OTHER_LDLIBS += wsock32.lib winmm.lib
@@ -9435,8 +9754,8 @@
  
  #
  # Tell library.gmk to copy the txt file first
---- jdk/make/java/jli/Makefile	2011-07-05 14:35:28.000000000 -0400
-+++ jdk/make/java/jli/Makefile	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/java/jli/Makefile
++++ jdk/make/java/jli/Makefile
 @@ -44,8 +44,10 @@
  
  include $(BUILDDIR)/common/Defs.gmk
@@ -9512,8 +9831,8 @@
 +endif
 +
  
---- jdk/make/java/management/Makefile	2011-07-05 14:35:28.000000000 -0400
-+++ jdk/make/java/management/Makefile	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/java/management/Makefile
++++ jdk/make/java/management/Makefile
 @@ -85,6 +85,11 @@
  OTHER_INCLUDES += \
    -I$(SHARE_SRC)/native/sun/management 
@@ -9526,13 +9845,13 @@
  ifeq ($(PLATFORM),windows)
    OTHER_LDLIBS += $(JVMLIB)
  endif
---- jdk/make/java/net/FILES_c.gmk	2011-07-05 14:35:28.000000000 -0400
-+++ jdk/make/java/net/FILES_c.gmk	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/java/net/FILES_c.gmk
++++ jdk/make/java/net/FILES_c.gmk
 @@ -43,6 +43,10 @@
      FILES_c += linux_close.c
  endif
  
-+ifeq ($(OS_VENDOR), MidnightBSD)
++ifeq ($(OS_VENDOR), FreeBSD)
 +    FILES_c += bsd_close.c
 +endif
 +
@@ -9539,8 +9858,8 @@
  ifeq ($(PLATFORM), windows)
      FILES_c += TwoStacksPlainSocketImpl.c
      FILES_c += DualStackPlainSocketImpl.c
---- jdk/make/java/net/Makefile	2011-07-05 14:35:28.000000000 -0400
-+++ jdk/make/java/net/Makefile	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/java/net/Makefile
++++ jdk/make/java/net/Makefile
 @@ -92,6 +92,12 @@
  
  include $(BUILDDIR)/common/Library.gmk
@@ -9562,8 +9881,8 @@
  
  CLASSES.export += java.lang.Integer java.io.FileDescriptor java.net.InetAddressImplFactory java.net.Inet4AddressImpl java.net.Inet6AddressImpl
  
---- jdk/make/java/nio/Makefile	2011-07-05 14:35:28.000000000 -0400
-+++ jdk/make/java/nio/Makefile	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/java/nio/Makefile
++++ jdk/make/java/nio/Makefile
 @@ -104,6 +104,28 @@
  	sun/nio/ch/NativeThread.java
  endif # PLATFORM = linux
@@ -9625,8 +9944,8 @@
  include $(BUILDDIR)/common/Mapfile-vers.gmk
  include $(BUILDDIR)/common/Library.gmk
  
---- jdk/make/java/npt/Makefile	2011-07-05 14:35:28.000000000 -0400
-+++ jdk/make/java/npt/Makefile	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/java/npt/Makefile
++++ jdk/make/java/npt/Makefile
 @@ -70,6 +70,18 @@
    OTHER_LCF += -export:nptInitialize -export:nptTerminate
  endif
@@ -9646,8 +9965,8 @@
  #
  # Add to ambient vpath so we pick up the library files
  #
---- jdk/make/java/redist/FILES.gmk	2011-07-05 14:35:28.000000000 -0400
-+++ jdk/make/java/redist/FILES.gmk	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/java/redist/FILES.gmk
++++ jdk/make/java/redist/FILES.gmk
 @@ -38,6 +38,14 @@
  	$(LIBDIR)/fonts/LucidaSansDemiBold.ttf       	\
  
@@ -9663,8 +9982,8 @@
  
  # The oblique versions of the font are derived from the base versions
  # and since 2D can do this derivation on the fly at run time there is no
---- jdk/make/java/redist/Makefile	2011-07-05 14:35:28.000000000 -0400
-+++ jdk/make/java/redist/Makefile	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/java/redist/Makefile
++++ jdk/make/java/redist/Makefile
 @@ -311,7 +311,7 @@
  $(FONTSDIRFILE): $(PLATFORM_SRC)/classes/sun/awt/motif/java.fonts.dir
  	$(install-file)
@@ -9683,8 +10002,8 @@
  endif # !OPENJDK
  
  # Import internal files (ones that are stashed in this source tree)
---- jdk/make/java/security/Makefile	2011-07-05 14:35:28.000000000 -0400
-+++ jdk/make/java/security/Makefile	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/java/security/Makefile
++++ jdk/make/java/security/Makefile
 @@ -51,7 +51,15 @@
    ifneq ($(ARCH_DATA_MODEL), 64)
      PROPS_SRC   = $(TOPDIR)/src/share/lib/security/java.security-windows
@@ -9701,8 +10020,8 @@
  endif # PLATFORM
  
  
---- jdk/make/java/zip/FILES_c.gmk	2011-07-05 14:35:28.000000000 -0400
-+++ jdk/make/java/zip/FILES_c.gmk	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/java/zip/FILES_c.gmk
++++ jdk/make/java/zip/FILES_c.gmk
 @@ -30,6 +30,10 @@
  	Inflater.c \
  	ZipFile.c \
@@ -9722,8 +10041,8 @@
 -	zip_util.c
 +	inffast.c
 +endif
---- jdk/make/java/zip/Makefile	2011-07-05 14:35:28.000000000 -0400
-+++ jdk/make/java/zip/Makefile	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/java/zip/Makefile
++++ jdk/make/java/zip/Makefile
 @@ -72,16 +72,24 @@
  CPPFLAGS += -UDEBUG 
  endif
@@ -9750,8 +10069,8 @@
  OTHER_LDLIBS = $(JVMLIB)
 +endif
 +
---- jdk/make/javax/sound/FILES_c.gmk	2011-07-05 14:35:28.000000000 -0400
-+++ jdk/make/javax/sound/FILES_c.gmk	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/javax/sound/FILES_c.gmk
++++ jdk/make/javax/sound/FILES_c.gmk
 @@ -34,6 +34,8 @@
  
  FILES_linux = 
@@ -9761,8 +10080,8 @@
  FILES_windows = \
  	PLATFORM_API_WinOS_MidiIn.c \
  	PLATFORM_API_WinOS_MidiOut.c \
---- jdk/make/javax/sound/SoundDefs.gmk	2011-07-05 14:35:28.000000000 -0400
-+++ jdk/make/javax/sound/SoundDefs.gmk	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/javax/sound/SoundDefs.gmk
++++ jdk/make/javax/sound/SoundDefs.gmk
 @@ -40,6 +40,10 @@
    CPPFLAGS += -DX_PLATFORM=X_LINUX
  endif # PLATFORM linux
@@ -9774,8 +10093,8 @@
  ifeq ($(PLATFORM), solaris)
    CPPFLAGS += -DX_PLATFORM=X_SOLARIS
  
---- jdk/make/javax/sound/jsoundalsa/Makefile	2011-07-05 14:35:28.000000000 -0400
-+++ jdk/make/javax/sound/jsoundalsa/Makefile	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/javax/sound/jsoundalsa/Makefile
++++ jdk/make/javax/sound/jsoundalsa/Makefile
 @@ -65,6 +65,15 @@
  	$(MIDIFILES_export) \
  	$(PORTFILES_export)
@@ -9800,8 +10119,8 @@
  
  #
  # Add to the ambient VPATH.
---- jdk/make/jpda/back/Makefile	2011-07-05 14:35:28.000000000 -0400
-+++ jdk/make/jpda/back/Makefile	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/jpda/back/Makefile
++++ jdk/make/jpda/back/Makefile
 @@ -49,8 +49,10 @@
                   -I$(GENNATIVESRCDIR)/jdwp
  
@@ -9813,8 +10132,8 @@
  
  #
  # This turns off all assert() checking in the optimized library
---- jdk/make/sun/awt/Makefile	2011-07-05 14:35:28.000000000 -0400
-+++ jdk/make/sun/awt/Makefile	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/sun/awt/Makefile
++++ jdk/make/sun/awt/Makefile
 @@ -129,6 +129,14 @@
  OTHER_LDLIBS = $(JVMLIB) $(LIBM) -ldl
  endif
@@ -9884,8 +10203,8 @@
  LDFLAGS += -L$(MOTIF_LIB) -L$(OPENWIN_LIB)
  endif
  
---- jdk/make/sun/awt/mawt.gmk	2011-07-05 14:35:28.000000000 -0400
-+++ jdk/make/sun/awt/mawt.gmk	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/sun/awt/mawt.gmk
++++ jdk/make/sun/awt/mawt.gmk
 @@ -174,7 +174,7 @@
  OTHER_LDLIBS = $(LIBXM) -lXt -lXext $(LIBXTST) $(LIBXMU) -lX11 -lXi
  endif
@@ -9942,8 +10261,8 @@
  
  LDFLAGS += -L$(LIBDIR)/$(LIBARCH)/$(TSOBJDIR) \
  	   $(AWT_RUNPATH)
---- jdk/make/sun/font/Makefile	2011-07-05 14:35:29.000000000 -0400
-+++ jdk/make/sun/font/Makefile	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/sun/font/Makefile
++++ jdk/make/sun/font/Makefile
 @@ -177,6 +177,15 @@
  # Libraries to link, and other C flags.
  #
@@ -9968,8 +10287,8 @@
  
  endif # PLATFORM
  
---- jdk/make/sun/image/generic/Makefile	2011-07-05 14:35:29.000000000 -0400
-+++ jdk/make/sun/image/generic/Makefile	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/sun/image/generic/Makefile
++++ jdk/make/sun/image/generic/Makefile
 @@ -69,5 +69,9 @@
              -I$(PLATFORM_SRC)/native/$(PKGDIR)/medialib 
  
@@ -9981,8 +10300,8 @@
 +endif
 +
  
---- jdk/make/sun/jawt/Makefile	2011-07-05 14:35:29.000000000 -0400
-+++ jdk/make/sun/jawt/Makefile	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/sun/jawt/Makefile
++++ jdk/make/sun/jawt/Makefile
 @@ -98,9 +98,7 @@
  #
  # Other extra flags needed for compiling.
@@ -10012,8 +10331,8 @@
  OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -lawt -L$(LIBDIR)/$(LIBARCH)/xawt -lmawt
  endif # PLATFORM
  
---- jdk/make/sun/security/jgss/wrapper/Makefile	2011-07-05 14:35:29.000000000 -0400
-+++ jdk/make/sun/security/jgss/wrapper/Makefile	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/sun/security/jgss/wrapper/Makefile
++++ jdk/make/sun/security/jgss/wrapper/Makefile
 @@ -71,6 +71,10 @@
  #
  # Libraries to link
@@ -10026,9 +10345,9 @@
 +ifeq ($(PLATFORM), bsd)
 +  OTHER_LDLIBS = $(JVMLIB)
 +endif
---- jdk/make/sun/security/pkcs11/Makefile	2011-07-05 14:35:29.000000000 -0400
-+++ jdk/make/sun/security/pkcs11/Makefile	2011-07-07 19:17:03.000000000 -0400
-@@ -155,7 +155,7 @@
+--- jdk/make/sun/security/pkcs11/Makefile
++++ jdk/make/sun/security/pkcs11/Makefile
+@@ -156,7 +156,7 @@
  #
  # Libraries to link
  #
@@ -10037,8 +10356,8 @@
    OTHER_LDLIBS = $(JVMLIB)
  else
    OTHER_LDLIBS = -ldl $(JVMLIB)
---- jdk/make/sun/security/smartcardio/Makefile	2011-07-05 14:35:29.000000000 -0400
-+++ jdk/make/sun/security/smartcardio/Makefile	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/sun/security/smartcardio/Makefile
++++ jdk/make/sun/security/smartcardio/Makefile
 @@ -75,6 +75,10 @@
  ifeq ($(PLATFORM), windows)
    OTHER_LDLIBS = $(JVMLIB) winscard.lib
@@ -10051,8 +10370,8 @@
 +  endif
    OTHER_CFLAGS = -D__sun_jdk
  endif
---- jdk/make/sun/splashscreen/FILES_c.gmk	2011-07-05 14:35:29.000000000 -0400
-+++ jdk/make/sun/splashscreen/FILES_c.gmk	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/sun/splashscreen/FILES_c.gmk
++++ jdk/make/sun/splashscreen/FILES_c.gmk
 @@ -49,20 +49,6 @@
  	dgif_lib.c \
  	gif_err.c \
@@ -10095,8 +10414,8 @@
 +	zcrc32.c \
 +	zutil.c
 +endif
---- jdk/make/sun/splashscreen/Makefile	2011-07-05 14:35:29.000000000 -0400
-+++ jdk/make/sun/splashscreen/Makefile	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/sun/splashscreen/Makefile
++++ jdk/make/sun/splashscreen/Makefile
 @@ -61,10 +61,26 @@
  
  CFLAGS += -DSPLASHSCREEN
@@ -10144,8 +10463,8 @@
  ifeq ($(PLATFORM), linux)
    ifeq ($(ARCH_DATA_MODEL), 64)
      # 64-bit gcc has problems compiling MMX instructions.
---- jdk/make/sun/xawt/Makefile	2011-07-05 14:35:29.000000000 -0400
-+++ jdk/make/sun/xawt/Makefile	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/sun/xawt/Makefile
++++ jdk/make/sun/xawt/Makefile
 @@ -53,6 +53,11 @@
  dummy := $(shell $(MKDIR) -p $(LIB_LOCATION))
  endif
@@ -10209,8 +10528,8 @@
  ifeq ($(MILESTONE), internal)
    CPPFLAGS += -DINTERNAL_BUILD
  endif
---- jdk/make/tools/freetypecheck/Makefile	2011-07-05 14:35:29.000000000 -0400
-+++ jdk/make/tools/freetypecheck/Makefile	2011-07-07 19:17:03.000000000 -0400
+--- jdk/make/tools/freetypecheck/Makefile
++++ jdk/make/tools/freetypecheck/Makefile
 @@ -60,8 +60,12 @@
    #add runtime lib search path to ensure test will be runnable
    ifeq ($(PLATFORM), solaris)
@@ -10226,8 +10545,8 @@
    endif
  endif
  
---- jdk/src/share/back/commonRef.c	2011-07-05 14:35:30.000000000 -0400
-+++ jdk/src/share/back/commonRef.c	2011-07-07 19:17:03.000000000 -0400
+--- jdk/src/share/back/commonRef.c
++++ jdk/src/share/back/commonRef.c
 @@ -23,6 +23,10 @@
   * questions.
   */
@@ -10239,8 +10558,8 @@
  #include "util.h"
  #include "commonRef.h"
  
---- jdk/src/share/bin/java.c	2011-07-05 14:35:31.000000000 -0400
-+++ jdk/src/share/bin/java.c	2011-07-07 19:17:03.000000000 -0400
+--- jdk/src/share/bin/java.c
++++ jdk/src/share/bin/java.c
 @@ -104,6 +104,11 @@
  static char *launchername;
  jboolean _launcher_debug = JNI_FALSE;
@@ -10435,8 +10754,8 @@
  static void
  FreeKnownVMs()
  {
---- jdk/src/share/bin/java.h	2011-07-05 14:35:31.000000000 -0400
-+++ jdk/src/share/bin/java.h	2011-07-07 19:17:03.000000000 -0400
+--- jdk/src/share/bin/java.h
++++ jdk/src/share/bin/java.h
 @@ -91,11 +91,17 @@
  void PrintMachineDependentOptions();
  
@@ -10457,8 +10776,8 @@
  
  /* sun.java.launcher.* platform properties. */
  void SetJavaLauncherPlatformProps(void);
---- jdk/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java	2011-07-05 14:35:32.000000000 -0400
-+++ jdk/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java	2011-07-07 19:17:03.000000000 -0400
+--- jdk/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java
++++ jdk/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java
 @@ -477,6 +477,10 @@
                  String[] dirs = new String[] {
                      userHome + sep + ".themes",
@@ -10470,8 +10789,8 @@
                      "/usr/share/themes",
                      "/usr/gnome/share/themes",  // Debian/Redhat/Solaris
                      "/opt/gnome2/share/themes"  // SuSE
---- jdk/src/share/classes/com/sun/jmx/snmp/SnmpPduTrap.java	2011-07-05 14:35:33.000000000 -0400
-+++ jdk/src/share/classes/com/sun/jmx/snmp/SnmpPduTrap.java	2011-07-07 19:17:03.000000000 -0400
+--- jdk/src/share/classes/com/sun/jmx/snmp/SnmpPduTrap.java
++++ jdk/src/share/classes/com/sun/jmx/snmp/SnmpPduTrap.java
 @@ -78,6 +78,9 @@
       */
      public long            timeStamp ;
@@ -10482,8 +10801,8 @@
  
  
      /**
---- jdk/src/share/classes/java/awt/Font.java	2011-07-05 14:35:37.000000000 -0400
-+++ jdk/src/share/classes/java/awt/Font.java	2011-07-07 19:17:03.000000000 -0400
+--- jdk/src/share/classes/java/awt/Font.java
++++ jdk/src/share/classes/java/awt/Font.java
 @@ -449,18 +449,19 @@
       */
      private AttributeValues getAttributeValues() {
@@ -10510,8 +10829,8 @@
          }
  
          return values;
---- jdk/src/share/classes/java/awt/GraphicsEnvironment.java	2011-07-05 14:35:37.000000000 -0400
-+++ jdk/src/share/classes/java/awt/GraphicsEnvironment.java	2011-07-07 19:17:03.000000000 -0400
+--- jdk/src/share/classes/java/awt/GraphicsEnvironment.java
++++ jdk/src/share/classes/java/awt/GraphicsEnvironment.java
 @@ -148,7 +148,12 @@
                          } else {
                              String osName = System.getProperty("os.name");
@@ -10519,7 +10838,7 @@
 -                                Boolean.valueOf(("Linux".equals(osName) || "SunOS".equals(osName)) &&
 +                                Boolean.valueOf(("Linux".equals(osName) ||
 +                                                "SunOS".equals(osName) ||
-+                                                "MidnightBSD".equals(osName) ||
++                                                "FreeBSD".equals(osName) ||
 +                                                "NetBSD".equals(osName) ||
 +                                                "OpenBSD".equals(osName) ||
 +                                                "Darwin".equals(osName)) &&
@@ -10526,9 +10845,9 @@
                                                  (System.getenv("DISPLAY") == null));
                          }
                      } else if (nm.equals("true")) {
---- jdk/src/share/classes/java/util/TimeZone.java	2011-07-05 14:35:42.000000000 -0400
-+++ jdk/src/share/classes/java/util/TimeZone.java	2011-07-07 19:17:03.000000000 -0400
-@@ -776,15 +776,13 @@
+--- jdk/src/share/classes/java/util/TimeZone.java
++++ jdk/src/share/classes/java/util/TimeZone.java
+@@ -833,15 +833,13 @@
          }
          int gmtOffset =  (hours * 60 + num) * 60 * 1000;
  
@@ -10545,8 +10864,8 @@
          }
          return zi;
      }
---- jdk/src/share/classes/sun/awt/FontConfiguration.java	2011-07-05 14:35:50.000000000 -0400
-+++ jdk/src/share/classes/sun/awt/FontConfiguration.java	2011-07-07 19:17:03.000000000 -0400
+--- jdk/src/share/classes/sun/awt/FontConfiguration.java
++++ jdk/src/share/classes/sun/awt/FontConfiguration.java
 @@ -1073,7 +1073,7 @@
       */
      HashMap<String, Boolean> existsMap;
@@ -10565,8 +10884,8 @@
                      errors++;
                  }
              }
---- jdk/src/share/classes/sun/font/TrueTypeFont.java	2011-07-05 14:35:51.000000000 -0400
-+++ jdk/src/share/classes/sun/font/TrueTypeFont.java	2011-07-07 19:17:03.000000000 -0400
+--- jdk/src/share/classes/sun/font/TrueTypeFont.java
++++ jdk/src/share/classes/sun/font/TrueTypeFont.java
 @@ -160,6 +160,13 @@
      private boolean supportsJA;
      private boolean supportsCJK;
@@ -10677,8 +10996,8 @@
              } else {
                  return name;
              }
---- jdk/src/share/classes/sun/java2d/SunGraphicsEnvironment.java	2011-07-05 14:35:52.000000000 -0400
-+++ jdk/src/share/classes/sun/java2d/SunGraphicsEnvironment.java	2011-07-07 19:17:03.000000000 -0400
+--- jdk/src/share/classes/sun/java2d/SunGraphicsEnvironment.java
++++ jdk/src/share/classes/sun/java2d/SunGraphicsEnvironment.java
 @@ -76,7 +76,7 @@
  public abstract class SunGraphicsEnvironment extends GraphicsEnvironment
      implements FontSupport, DisplayChangedListener {
@@ -10694,7 +11013,7 @@
                  if ("Linux".equals(osName)) {
 -                    isLinux = true;
 +                    isLinuxOrBSD = true;
-+                } else if ("MidnightBSD".equals(osName)) {
++                } else if ("FreeBSD".equals(osName)) {
 +                    isLinuxOrBSD = true;
 +                } else if ("Darwin".equals(osName)) {
 +                    isLinuxOrBSD = true;
@@ -10716,8 +11035,8 @@
                      registerFontDir(jreFontDirName);
                  }
                  registerFontsInDir(jreFontDirName, true, Font2D.JRE_RANK,
---- jdk/src/share/classes/sun/nio/ch/KqueueSelectorProvider.java	2011-07-07 19:17:03.000000000 -0400
-+++ jdk/src/share/classes/sun/nio/ch/KqueueSelectorProvider.java	2011-07-07 19:17:03.000000000 -0400
+--- jdk/src/share/classes/sun/nio/ch/KqueueSelectorProvider.java	1969-12-31 19:00:00.000000000 -0500
++++ jdk/src/share/classes/sun/nio/ch/KqueueSelectorProvider.java
 @@ -0,0 +1,17 @@
 +package sun.nio.ch;
 +
@@ -10736,8 +11055,8 @@
 +	return InheritedChannel.getChannel();
 +    }
 +}
---- jdk/src/share/classes/sun/print/PSPrinterJob.java	2011-07-05 14:35:57.000000000 -0400
-+++ jdk/src/share/classes/sun/print/PSPrinterJob.java	2011-07-07 19:17:03.000000000 -0400
+--- jdk/src/share/classes/sun/print/PSPrinterJob.java
++++ jdk/src/share/classes/sun/print/PSPrinterJob.java
 @@ -1531,7 +1531,9 @@
              pFlags |= NOSHEET;
              ncomps+=1;
@@ -10745,12 +11064,12 @@
 -       if (System.getProperty("os.name").equals("Linux")) {
 +
 +       String osname = System.getProperty("os.name");
-+       if (osname.equals("Linux") || osname.equals("MidnightBSD") || osname.equals("NetBSD") || osname.equals("OpenBSD") || osname.equals("Darwin")) {
++       if (osname.equals("Linux") || osname.equals("FreeBSD") || osname.equals("NetBSD") || osname.equals("OpenBSD") || osname.equals("Darwin")) {
              execCmd = new String[ncomps];
              execCmd[n++] = "/usr/bin/lpr";
              if ((pFlags & PRINTER) != 0) {
---- jdk/src/share/classes/sun/security/jgss/GSSManagerImpl.java	2011-07-05 14:35:58.000000000 -0400
-+++ jdk/src/share/classes/sun/security/jgss/GSSManagerImpl.java	2011-07-07 19:17:03.000000000 -0400
+--- jdk/src/share/classes/sun/security/jgss/GSSManagerImpl.java
++++ jdk/src/share/classes/sun/security/jgss/GSSManagerImpl.java
 @@ -49,8 +49,12 @@
              AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
                      public Boolean run() {
@@ -10759,7 +11078,7 @@
 -                                osname.startsWith("Linux")) {
 +                            if (osname.startsWith("SunOS")
 +                                    || osname.startsWith("Linux")
-+                                    || osname.startsWith("MidnightBSD")
++                                    || osname.startsWith("FreeBSD")
 +                                    || osname.startsWith("NetBSD")
 +                                    || osname.startsWith("OpenBSD")
 +                                    || osname.startsWith("Darwin")) {
@@ -10766,8 +11085,8 @@
                                  return new Boolean(System.getProperty
                                      (USE_NATIVE_PROP));
                              }
---- jdk/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java	2011-07-05 14:35:58.000000000 -0400
-+++ jdk/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java	2011-07-07 19:17:03.000000000 -0400
+--- jdk/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java
++++ jdk/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java
 @@ -82,7 +82,11 @@
                              String osname = System.getProperty("os.name");
                              if (osname.startsWith("SunOS")) {
@@ -10774,7 +11093,7 @@
                                  gssLib = "libgss.so";
 -                            } else if (osname.startsWith("Linux")) {
 +                            } else if (osname.startsWith("Linux")
-+                                    || osname.startsWith("MidnightBSD")
++                                    || osname.startsWith("FreeBSD")
 +                                    || osname.startsWith("NetBSD")
 +                                    || osname.startsWith("OpenBSD")
 +                                    || osname.startsWith("Darwin")) {
@@ -10781,8 +11100,8 @@
                                  gssLib = "libgssapi.so";
                              }
                          }
---- jdk/src/share/classes/sun/security/krb5/Config.java	2011-07-05 14:35:58.000000000 -0400
-+++ jdk/src/share/classes/sun/security/krb5/Config.java	2011-07-07 19:17:03.000000000 -0400
+--- jdk/src/share/classes/sun/security/krb5/Config.java
++++ jdk/src/share/classes/sun/security/krb5/Config.java
 @@ -711,7 +711,11 @@
                      }
                  } else if (osname.startsWith("SunOS")) {
@@ -10789,7 +11108,7 @@
                      name =  "/etc/krb5/krb5.conf";
 -                } else if (osname.startsWith("Linux")) {
 +                } else if (osname.startsWith("Linux")
-+                        || osname.startsWith("MidnightBSD")
++                        || osname.startsWith("FreeBSD")
 +                        || osname.startsWith("NetBSD")
 +                        || osname.startsWith("OpenBSD")
 +                        || osname.startsWith("Darwin")) {
@@ -10796,9 +11115,9 @@
                      name =  "/etc/krb5.conf";
                  }
              }
---- jdk/src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java	2011-07-05 14:35:58.000000000 -0400
-+++ jdk/src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java	2011-07-07 19:17:03.000000000 -0400
-@@ -383,8 +383,12 @@
+--- jdk/src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java
++++ jdk/src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java
+@@ -386,8 +386,12 @@
              String uidStr = null;
              long uid = 0;
  
@@ -10806,7 +11125,7 @@
 -                (osname.startsWith("Linux"))) {
 +            if (osname.startsWith("SunOS")
 +                    || osname.startsWith("Linux")
-+                    || osname.startsWith("MidnightBSD")
++                    || osname.startsWith("FreeBSD")
 +                    || osname.startsWith("NetBSD")
 +                    || osname.startsWith("OpenBSD")
 +                    || osname.startsWith("Darwin")) {
@@ -10813,15 +11132,15 @@
                  try {
                      Class<?> c = Class.forName
                          ("com.sun.security.auth.module.UnixSystem");
---- jdk/src/share/classes/sun/tools/attach/META-INF/services/com.sun.tools.attach.spi.AttachProvider	2011-07-05 14:36:01.000000000 -0400
-+++ jdk/src/share/classes/sun/tools/attach/META-INF/services/com.sun.tools.attach.spi.AttachProvider	2011-07-07 19:17:03.000000000 -0400
+--- jdk/src/share/classes/sun/tools/attach/META-INF/services/com.sun.tools.attach.spi.AttachProvider
++++ jdk/src/share/classes/sun/tools/attach/META-INF/services/com.sun.tools.attach.spi.AttachProvider
 @@ -30,3 +30,4 @@
  #[solaris]sun.tools.attach.SolarisAttachProvider
  #[windows]sun.tools.attach.WindowsAttachProvider
  #[linux]sun.tools.attach.LinuxAttachProvider
 +#[bsd]sun.tools.attach.BsdAttachProvider
---- jdk/src/share/classes/sun/tools/jar/Main.java	2011-07-05 14:36:01.000000000 -0400
-+++ jdk/src/share/classes/sun/tools/jar/Main.java	2011-07-07 19:17:03.000000000 -0400
+--- jdk/src/share/classes/sun/tools/jar/Main.java
++++ jdk/src/share/classes/sun/tools/jar/Main.java
 @@ -48,6 +48,7 @@
      String zname = "";
      String[] files;
@@ -10869,8 +11188,8 @@
                  if (!d.exists() && !d.mkdirs() || !d.isDirectory()) {
                      throw new IOException(formatMsg(
                          "error.create.dir", d.getPath()));
---- jdk/src/share/classes/sun/tools/jar/resources/jar.properties	2011-07-05 14:36:01.000000000 -0400
-+++ jdk/src/share/classes/sun/tools/jar/resources/jar.properties	2011-07-07 19:17:03.000000000 -0400
+--- jdk/src/share/classes/sun/tools/jar/resources/jar.properties
++++ jdk/src/share/classes/sun/tools/jar/resources/jar.properties
 @@ -44,6 +44,8 @@
          {0} : could not create directory
  error.incorrect.length=\
@@ -10880,8 +11199,8 @@
  out.added.manifest=\
          added manifest
  out.update.manifest=\
---- jdk/src/share/hpi/include/hpi_impl.h	2011-07-05 14:36:05.000000000 -0400
-+++ jdk/src/share/hpi/include/hpi_impl.h	2011-07-07 19:17:03.000000000 -0400
+--- jdk/src/share/hpi/include/hpi_impl.h
++++ jdk/src/share/hpi/include/hpi_impl.h
 @@ -138,7 +138,11 @@
  int sysBind(int fd, struct sockaddr *him, int len);
  int sysAccept(int fd, struct sockaddr *him, int *len);
@@ -10895,8 +11214,8 @@
  ssize_t sysSendTo(int fd, char *buf, int len, int flags, struct sockaddr *to,
                int tolen);
  ssize_t sysRecvFrom(int fd, char *buf, int nbytes, int flags,
---- jdk/src/share/native/com/sun/java/util/jar/pack/defines.h	2011-07-05 14:36:05.000000000 -0400
-+++ jdk/src/share/native/com/sun/java/util/jar/pack/defines.h	2011-07-07 19:17:03.000000000 -0400
+--- jdk/src/share/native/com/sun/java/util/jar/pack/defines.h
++++ jdk/src/share/native/com/sun/java/util/jar/pack/defines.h
 @@ -32,6 +32,10 @@
  #include <unistd.h>
  #endif
@@ -10919,11 +11238,11 @@
  typedef unsigned long uLong;
  #endif
 +#endif
- #ifdef _MSC_VER
- typedef LONGLONG        jlong;
- typedef DWORDLONG       julong;
---- jdk/src/share/native/com/sun/java/util/jar/pack/main.cpp	2011-07-05 14:36:05.000000000 -0400
-+++ jdk/src/share/native/com/sun/java/util/jar/pack/main.cpp	2011-07-07 19:17:03.000000000 -0400
+ #ifdef _MSC_VER 
+ typedef LONGLONG 	jlong;
+ typedef DWORDLONG 	julong;
+--- jdk/src/share/native/com/sun/java/util/jar/pack/main.cpp
++++ jdk/src/share/native/com/sun/java/util/jar/pack/main.cpp
 @@ -33,9 +33,14 @@
  #include <limits.h>
  #include <time.h>
@@ -10961,8 +11280,8 @@
            true));
  }
  
---- jdk/src/share/native/com/sun/media/sound/DirectAudioDevice.c	2011-07-05 14:36:05.000000000 -0400
-+++ jdk/src/share/native/com/sun/media/sound/DirectAudioDevice.c	2011-07-07 19:17:03.000000000 -0400
+--- jdk/src/share/native/com/sun/media/sound/DirectAudioDevice.c
++++ jdk/src/share/native/com/sun/media/sound/DirectAudioDevice.c
 @@ -33,7 +33,11 @@
  
  #include <jni.h>
@@ -10975,8 +11294,8 @@
  #include "SoundDefs.h"
  #include "DirectAudio.h"
  #include "Utilities.h"
---- jdk/src/share/native/com/sun/media/sound/SoundDefs.h	2011-07-05 14:36:05.000000000 -0400
-+++ jdk/src/share/native/com/sun/media/sound/SoundDefs.h	2011-07-07 19:17:03.000000000 -0400
+--- jdk/src/share/native/com/sun/media/sound/SoundDefs.h
++++ jdk/src/share/native/com/sun/media/sound/SoundDefs.h
 @@ -31,6 +31,7 @@
  #define X_WINDOWS       1
  #define X_SOLARIS       2
@@ -11004,8 +11323,8 @@
 +
 +
  #endif  // __SOUNDDEFS_INCLUDED__
---- jdk/src/share/native/common/check_code.c	2011-07-05 14:36:05.000000000 -0400
-+++ jdk/src/share/native/common/check_code.c	2011-07-07 19:17:03.000000000 -0400
+--- jdk/src/share/native/common/check_code.c
++++ jdk/src/share/native/common/check_code.c
 @@ -1069,7 +1069,7 @@
   * Make sure that branches don't go into the middle of nowhere.
   */
@@ -11067,8 +11386,8 @@
              /* There can't be more than 64K labels because of the limit
               * on per-method byte code length.
               */
---- jdk/src/share/native/java/io/io_util.h	2011-07-05 14:36:05.000000000 -0400
-+++ jdk/src/share/native/java/io/io_util.h	2011-07-07 19:17:03.000000000 -0400
+--- jdk/src/share/native/java/io/io_util.h
++++ jdk/src/share/native/java/io/io_util.h
 @@ -29,7 +29,15 @@
  extern jfieldID IO_fd_fdID;
  extern jfieldID IO_handle_fdID;
@@ -11086,8 +11405,8 @@
  #define O_SYNC  (0x0800)
  #define O_DSYNC (0x2000)
  #endif
---- jdk/src/share/native/java/lang/fdlibm/include/fdlibm.h	2011-07-05 14:36:05.000000000 -0400
-+++ jdk/src/share/native/java/lang/fdlibm/include/fdlibm.h	2011-07-07 19:17:03.000000000 -0400
+--- jdk/src/share/native/java/lang/fdlibm/include/fdlibm.h
++++ jdk/src/share/native/java/lang/fdlibm/include/fdlibm.h
 @@ -25,6 +25,10 @@
   * questions.
   */
@@ -11113,8 +11432,8 @@
  
  /*
   * ANSI/POSIX
---- jdk/src/share/native/java/lang/fdlibm/include/jfdlibm.h	2011-07-05 14:36:05.000000000 -0400
-+++ jdk/src/share/native/java/lang/fdlibm/include/jfdlibm.h	2011-07-07 19:17:03.000000000 -0400
+--- jdk/src/share/native/java/lang/fdlibm/include/jfdlibm.h
++++ jdk/src/share/native/java/lang/fdlibm/include/jfdlibm.h
 @@ -61,7 +61,7 @@
  #define log1p   jlog1p
  #define expm1   jexpm1
@@ -11124,8 +11443,8 @@
  #define __ieee754_sqrt          __j__ieee754_sqrt
  #define __ieee754_acos          __j__ieee754_acos
  #define __ieee754_acosh         __j__ieee754_acosh
---- jdk/src/share/native/java/util/zip/Inflater.c	2011-07-05 14:36:06.000000000 -0400
-+++ jdk/src/share/native/java/util/zip/Inflater.c	2011-07-07 19:17:03.000000000 -0400
+--- jdk/src/share/native/java/util/zip/Inflater.c
++++ jdk/src/share/native/java/util/zip/Inflater.c
 @@ -65,6 +65,10 @@
  	return jlong_zero;
      } else {
@@ -11148,8 +11467,8 @@
  }
  
  JNIEXPORT void JNICALL
---- jdk/src/share/native/java/util/zip/zlib-1.1.3/zconf.h	2011-07-05 14:36:06.000000000 -0400
-+++ jdk/src/share/native/java/util/zip/zlib-1.1.3/zconf.h	2011-07-07 19:17:03.000000000 -0400
+--- jdk/src/share/native/java/util/zip/zlib-1.1.3/zconf.h
++++ jdk/src/share/native/java/util/zip/zlib-1.1.3/zconf.h
 @@ -42,44 +42,49 @@
  /* for _LP64 */
  #include <sys/types.h>
@@ -11233,8 +11552,8 @@
  #endif
  
  #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
---- jdk/src/share/native/sun/awt/debug/debug_util.h	2011-07-05 14:36:06.000000000 -0400
-+++ jdk/src/share/native/sun/awt/debug/debug_util.h	2011-07-07 19:17:03.000000000 -0400
+--- jdk/src/share/native/sun/awt/debug/debug_util.h
++++ jdk/src/share/native/sun/awt/debug/debug_util.h
 @@ -50,7 +50,9 @@
  #include <stdio.h>
  #include <string.h>
@@ -11245,8 +11564,8 @@
  #include <limits.h>
  
  /* keep these after the other headers */
---- jdk/src/share/native/sun/awt/image/BufImgSurfaceData.c	2011-07-05 14:36:06.000000000 -0400
-+++ jdk/src/share/native/sun/awt/image/BufImgSurfaceData.c	2011-07-07 19:17:03.000000000 -0400
+--- jdk/src/share/native/sun/awt/image/BufImgSurfaceData.c
++++ jdk/src/share/native/sun/awt/image/BufImgSurfaceData.c
 @@ -24,7 +24,11 @@
   */
  
@@ -11259,8 +11578,8 @@
  
  #include "sun_awt_image_BufImgSurfaceData.h"
  
---- jdk/src/share/native/sun/awt/image/DataBufferNative.c	2011-07-05 14:36:06.000000000 -0400
-+++ jdk/src/share/native/sun/awt/image/DataBufferNative.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/share/native/sun/awt/image/DataBufferNative.c
++++ jdk/src/share/native/sun/awt/image/DataBufferNative.c
 @@ -23,7 +23,11 @@
   * questions.
   */
@@ -11273,8 +11592,8 @@
  
  #include "SurfaceData.h"
  #include "sun_awt_image_DataBufferNative.h"
---- jdk/src/share/native/sun/awt/medialib/mlib_ImageConv2x2_f.c	2011-07-05 14:36:07.000000000 -0400
-+++ jdk/src/share/native/sun/awt/medialib/mlib_ImageConv2x2_f.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/share/native/sun/awt/medialib/mlib_ImageConv2x2_f.c
++++ jdk/src/share/native/sun/awt/medialib/mlib_ImageConv2x2_f.c
 @@ -86,7 +86,7 @@
  #endif /* MLIB_USE_FTOI_CLAMPING */
  
@@ -11314,8 +11633,8 @@
  
  #endif /* _NO_LONGLONG */
  
---- jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16ext.c	2011-07-05 14:36:07.000000000 -0400
-+++ jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16ext.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16ext.c
++++ jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16ext.c
 @@ -126,7 +126,7 @@
  #define D2I(x) CLAMP_S32((x) SAT_OFF)
  
@@ -11355,8 +11674,8 @@
  #endif /* _NO_LONGLONG */
  
  /***************************************************************/
---- jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16nw.c	2011-07-05 14:36:07.000000000 -0400
-+++ jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16nw.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16nw.c
++++ jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16nw.c
 @@ -94,7 +94,7 @@
  #define D2I(x) CLAMP_S32((x) SAT_OFF)
  
@@ -11396,8 +11715,8 @@
  #endif /* _NO_LONGLONG */
  
  /***************************************************************/
---- jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8ext.c	2011-07-05 14:36:07.000000000 -0400
-+++ jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8ext.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8ext.c
++++ jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8ext.c
 @@ -126,7 +126,7 @@
  #define D2I(x) CLAMP_S32((x) SAT_OFF)
  
@@ -11437,8 +11756,8 @@
  #endif /* _NO_LONGLONG */
  
  /***************************************************************/
---- jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8nw.c	2011-07-05 14:36:07.000000000 -0400
-+++ jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8nw.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8nw.c
++++ jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8nw.c
 @@ -95,7 +95,7 @@
  #define D2I(x) CLAMP_S32((x) SAT_OFF)
  
@@ -11478,8 +11797,8 @@
  #endif /* _NO_LONGLONG */
  
  /***************************************************************/
---- jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16ext.c	2011-07-05 14:36:07.000000000 -0400
-+++ jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16ext.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16ext.c
++++ jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16ext.c
 @@ -126,7 +126,7 @@
  #define D2I(x) CLAMP_S32((x) SAT_OFF)
  
@@ -11519,8 +11838,8 @@
  #endif /* _NO_LONGLONG */
  
  /***************************************************************/
---- jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16nw.c	2011-07-05 14:36:07.000000000 -0400
-+++ jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16nw.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16nw.c
++++ jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16nw.c
 @@ -94,7 +94,7 @@
  #define D2I(x) CLAMP_S32((x) SAT_OFF)
  
@@ -11560,8 +11879,8 @@
  #endif /* _NO_LONGLONG */
  
  /***************************************************************/
---- jdk/src/share/native/sun/awt/medialib/mlib_ImageCopy_Bit.c	2011-07-05 14:36:07.000000000 -0400
-+++ jdk/src/share/native/sun/awt/medialib/mlib_ImageCopy_Bit.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/share/native/sun/awt/medialib/mlib_ImageCopy_Bit.c
++++ jdk/src/share/native/sun/awt/medialib/mlib_ImageCopy_Bit.c
 @@ -95,7 +95,7 @@
      dst = dp[0];
      if (ld_offset + size < 32) {
@@ -11781,8 +12100,8 @@
    }
  
  #else  /* _LONGLONG */
---- jdk/src/share/native/sun/awt/medialib/mlib_ImageLookUp_64.c	2011-07-05 14:36:07.000000000 -0400
-+++ jdk/src/share/native/sun/awt/medialib/mlib_ImageLookUp_64.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/share/native/sun/awt/medialib/mlib_ImageLookUp_64.c
++++ jdk/src/share/native/sun/awt/medialib/mlib_ImageLookUp_64.c
 @@ -168,7 +168,7 @@
  }
  
@@ -12063,8 +12382,8 @@
        dp[12] = t0;
        dp[13] = t1;
        dp[14] = t2;
---- jdk/src/share/native/sun/awt/medialib/mlib_ImageLookUp_Bit.c	2011-07-05 14:36:07.000000000 -0400
-+++ jdk/src/share/native/sun/awt/medialib/mlib_ImageLookUp_Bit.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/share/native/sun/awt/medialib/mlib_ImageLookUp_Bit.c
++++ jdk/src/share/native/sun/awt/medialib/mlib_ImageLookUp_Bit.c
 @@ -88,7 +88,7 @@
  } d64_2_f32;
  
@@ -12216,8 +12535,8 @@
  
    ((mlib_u32*)lh)[0] = l;  ((mlib_u32*)lh)[1] = l;
    ((mlib_u32*)lh)[2] = l;  ((mlib_u32*)lh)[3] = h;
---- jdk/src/share/native/sun/awt/medialib/mlib_ImageUtils.c	2011-07-05 14:36:07.000000000 -0400
-+++ jdk/src/share/native/sun/awt/medialib/mlib_ImageUtils.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/share/native/sun/awt/medialib/mlib_ImageUtils.c
++++ jdk/src/share/native/sun/awt/medialib/mlib_ImageUtils.c
 @@ -30,7 +30,7 @@
  typedef union {
    mlib_d64 db;
@@ -12227,8 +12546,8 @@
      mlib_s32 int1, int0;
  #else
      mlib_s32 int0, int1;
---- jdk/src/share/native/sun/awt/medialib/mlib_c_ImageCopy.c	2011-07-05 14:36:07.000000000 -0400
-+++ jdk/src/share/native/sun/awt/medialib/mlib_c_ImageCopy.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/share/native/sun/awt/medialib/mlib_c_ImageCopy.c
++++ jdk/src/share/native/sun/awt/medialib/mlib_c_ImageCopy.c
 @@ -275,11 +275,11 @@
        for (i = 0; j <= (b_size - 4); j += 4, i++) {
          src0 = src1;
@@ -12327,8 +12646,8 @@
          s0 = s1;
          dp += SIZE;
          sp += SIZE;
---- jdk/src/share/native/sun/awt/medialib/mlib_c_ImageLookUp_f.c	2011-07-05 14:36:07.000000000 -0400
-+++ jdk/src/share/native/sun/awt/medialib/mlib_c_ImageLookUp_f.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/share/native/sun/awt/medialib/mlib_c_ImageLookUp_f.c
++++ jdk/src/share/native/sun/awt/medialib/mlib_c_ImageLookUp_f.c
 @@ -120,7 +120,7 @@
    }                                                               \
  }
@@ -13561,8 +13880,8 @@
        dp[12] = t0;
        dp[13] = t1;
        dp[14] = t2;
---- jdk/src/share/native/sun/awt/medialib/mlib_image.h	2011-07-05 14:36:07.000000000 -0400
-+++ jdk/src/share/native/sun/awt/medialib/mlib_image.h	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/share/native/sun/awt/medialib/mlib_image.h
++++ jdk/src/share/native/sun/awt/medialib/mlib_image.h
 @@ -27,6 +27,11 @@
  #ifndef MLIB_IMAGE_H
  #define MLIB_IMAGE_H
@@ -13575,8 +13894,8 @@
  #include <mlib_types.h>
  #include <mlib_status.h>
  #include <mlib_sys.h>
---- jdk/src/share/native/sun/awt/medialib/mlib_sys.c	2011-07-05 14:36:07.000000000 -0400
-+++ jdk/src/share/native/sun/awt/medialib/mlib_sys.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/share/native/sun/awt/medialib/mlib_sys.c
++++ jdk/src/share/native/sun/awt/medialib/mlib_sys.c
 @@ -26,9 +26,15 @@
  
  #include <stdlib.h>
@@ -13598,7 +13917,7 @@
     */
    return (void *) malloc(size);
 -#else /* _MSC_VER */
-+#elif defined(__MidnightBSD__) && (__MidnightBSD_version >= 3000)
++#elif defined(__FreeBSD__) && (__FreeBSD_version >= 700013)
 +  void *ret;
 +  return posix_memalign(&ret, 8, size) ? NULL : ret;
 +#elif defined(_ALLBSD_SOURCE)
@@ -13607,8 +13926,8 @@
    return (void *) memalign(8, size);
  #endif /* _MSC_VER */
  }
---- jdk/src/share/native/sun/awt/medialib/mlib_types.h	2011-07-05 14:36:07.000000000 -0400
-+++ jdk/src/share/native/sun/awt/medialib/mlib_types.h	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/share/native/sun/awt/medialib/mlib_types.h
++++ jdk/src/share/native/sun/awt/medialib/mlib_types.h
 @@ -59,7 +59,10 @@
  
  #if defined(__SUNPRO_C) || defined(__SUNPRO_CC) || defined(__GNUC__)
@@ -13621,8 +13940,8 @@
  #include <stdint.h>                     /* for uintptr_t */
  #include <malloc.h>                     /* for ptrdiff_t */
  #else
---- jdk/src/share/native/sun/font/AccelGlyphCache.c	2011-07-05 14:36:07.000000000 -0400
-+++ jdk/src/share/native/sun/font/AccelGlyphCache.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/share/native/sun/font/AccelGlyphCache.c
++++ jdk/src/share/native/sun/font/AccelGlyphCache.c
 @@ -23,7 +23,11 @@
   * questions.
   */
@@ -13635,8 +13954,8 @@
  #include "jni.h"
  #include "AccelGlyphCache.h"
  #include "Trace.h"
---- jdk/src/share/native/sun/font/DrawGlyphList.c	2011-07-05 14:36:07.000000000 -0400
-+++ jdk/src/share/native/sun/font/DrawGlyphList.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/share/native/sun/font/DrawGlyphList.c
++++ jdk/src/share/native/sun/font/DrawGlyphList.c
 @@ -26,7 +26,11 @@
  #include "jlong.h"
  #include "math.h"
@@ -13649,8 +13968,8 @@
  #include "sunfontids.h"
  #include "fontscalerdefs.h"
  #include "glyphblitting.h"
---- jdk/src/share/native/sun/font/sunFont.c	2011-07-05 14:36:07.000000000 -0400
-+++ jdk/src/share/native/sun/font/sunFont.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/share/native/sun/font/sunFont.c
++++ jdk/src/share/native/sun/font/sunFont.c
 @@ -24,7 +24,9 @@
   */
  
@@ -13661,8 +13980,8 @@
  #include "string.h"
  #include "gdefs.h"
  #include "jlong.h"
---- jdk/src/share/native/sun/java2d/SurfaceData.c	2011-07-05 14:36:07.000000000 -0400
-+++ jdk/src/share/native/sun/java2d/SurfaceData.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/share/native/sun/java2d/SurfaceData.c
++++ jdk/src/share/native/sun/java2d/SurfaceData.c
 @@ -28,7 +28,11 @@
  #include "jni_util.h"
  #include "Disposer.h"
@@ -13675,8 +13994,8 @@
  #include "string.h"
  
  /**
---- jdk/src/share/native/sun/java2d/opengl/OGLFuncs.h	2011-07-05 14:36:08.000000000 -0400
-+++ jdk/src/share/native/sun/java2d/opengl/OGLFuncs.h	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/share/native/sun/java2d/opengl/OGLFuncs.h
++++ jdk/src/share/native/sun/java2d/opengl/OGLFuncs.h
 @@ -26,6 +26,9 @@
  #ifndef OGLFuncs_h_Included
  #define OGLFuncs_h_Included
@@ -13687,8 +14006,8 @@
  #include "jni.h"
  #include "J2D_GL/gl.h"
  #include "J2D_GL/glext.h"
---- jdk/src/share/native/sun/java2d/opengl/OGLRenderQueue.c	2011-07-05 14:36:08.000000000 -0400
-+++ jdk/src/share/native/sun/java2d/opengl/OGLRenderQueue.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/share/native/sun/java2d/opengl/OGLRenderQueue.c
++++ jdk/src/share/native/sun/java2d/opengl/OGLRenderQueue.c
 @@ -25,7 +25,11 @@
  
  #ifndef HEADLESS
@@ -13701,8 +14020,8 @@
  
  #include "sun_java2d_pipe_BufferedOpCodes.h"
  
---- jdk/src/share/native/sun/java2d/opengl/OGLTextRenderer.c	2011-07-05 14:36:08.000000000 -0400
-+++ jdk/src/share/native/sun/java2d/opengl/OGLTextRenderer.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/share/native/sun/java2d/opengl/OGLTextRenderer.c
++++ jdk/src/share/native/sun/java2d/opengl/OGLTextRenderer.c
 @@ -25,7 +25,11 @@
  
  #ifndef HEADLESS
@@ -13715,8 +14034,8 @@
  #include <math.h>
  #include <jlong.h>
  
---- jdk/src/share/transport/socket/socketTransport.c	2011-07-05 14:36:09.000000000 -0400
-+++ jdk/src/share/transport/socket/socketTransport.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/share/transport/socket/socketTransport.c
++++ jdk/src/share/transport/socket/socketTransport.c
 @@ -65,6 +65,9 @@
  #define HEADER_SIZE     11
  #define MAX_DATA_SIZE 1000
@@ -13804,8 +14123,8 @@
              return res;
          } else if (res == 0) {
              break; /* eof, return nbytes which is less than len */
---- jdk/src/solaris/back/exec_md.c	2011-07-05 14:36:09.000000000 -0400
-+++ jdk/src/solaris/back/exec_md.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/back/exec_md.c
++++ jdk/src/solaris/back/exec_md.c
 @@ -30,7 +30,7 @@
  #include "sys.h"
  #include "util.h"
@@ -13815,8 +14134,8 @@
    /* Linux */
    #define FORK() fork()
  #else
---- jdk/src/solaris/back/linker_md.c	2011-07-05 14:36:09.000000000 -0400
-+++ jdk/src/solaris/back/linker_md.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/back/linker_md.c
++++ jdk/src/solaris/back/linker_md.c
 @@ -48,6 +48,12 @@
  #include "threads_md.h"
  #endif
@@ -13842,8 +14161,8 @@
      }
  }
  
---- jdk/src/solaris/back/util_md.h	2011-07-05 14:36:09.000000000 -0400
-+++ jdk/src/solaris/back/util_md.h	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/back/util_md.h
++++ jdk/src/solaris/back/util_md.h
 @@ -29,7 +29,7 @@
  #include <stddef.h>
  
@@ -13870,8 +14189,8 @@
  
  #define HOST_TO_JAVA_CHAR(x) (((x & 0xff) << 8) | ((x >> 8) & (0xff)))
  #define HOST_TO_JAVA_SHORT(x) (((x & 0xff) << 8) | ((x >> 8) & (0xff)))
---- jdk/src/solaris/bin/java_md.c	2011-07-05 14:36:09.000000000 -0400
-+++ jdk/src/solaris/bin/java_md.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/bin/java_md.c
++++ jdk/src/solaris/bin/java_md.c
 @@ -24,6 +24,7 @@
   */
  
@@ -13932,7 +14251,7 @@
   */
 -#ifdef __linux__
 -static const char *system_dir   = "/usr/java";
-+#if defined(__MidnightBSD__)
++#if defined(__FreeBSD__)
 +static const char *system_dir	= "/usr/local/openjdk6";
 +static const char *user_dir	= "/java";
 +#elif defined(__NetBSD__)
@@ -13958,11 +14277,34 @@
  #endif /* __sun */
  
 -#ifdef __linux
-+#if defined(__linux__) || defined(_ALLBSD_SOURCE)
++#if defined(__linux__)
        /*
         * On linux, if a binary is running as sgid or suid, glibc sets
         * LD_LIBRARY_PATH to the empty string for security purposes.  (In
-@@ -431,7 +465,7 @@
+@@ -423,6 +457,22 @@
+       if((getgid() != getegid()) || (getuid() != geteuid()) ) {
+         return;
+       }
++#elif defined(_ALLBSD_SOURCE)
++      /*
++       * On BSD, if a binary is running as sgid or suid, libc sets
++       * LD_LIBRARY_PATH to the empty string for security purposes.  (In
++       * contrast, on Solaris the LD_LIBRARY_PATH variable for a
++       * privileged binary does not lose its settings; but the dynamic
++       * linker does apply more scrutiny to the path.) The launcher uses
++       * the value of LD_LIBRARY_PATH to prevent an exec loop.
++       * Therefore, if we are running sgid or suid, this function's
++       * setting of LD_LIBRARY_PATH will be ineffective and we should
++       * return from the function now.  Getting the right libraries to
++       * be found must be handled through other mechanisms.
++       */
++      if(issetugid()) {
++        return;
++      }
+ #endif
+ 
+       /* runpath contains current effective LD_LIBRARY_PATH setting */
+@@ -431,7 +481,7 @@
        new_runpath = JLI_MemAlloc( ((runpath!=NULL)?strlen(runpath):0) +
                                2*strlen(jrepath) + 2*strlen(arch) +
                                strlen(jvmpath) + 52);
@@ -13971,7 +14313,7 @@
  
  
        /*
-@@ -446,7 +480,7 @@
+@@ -446,7 +496,7 @@
  
          /* jvmpath, ((running != wanted)?((wanted==64)?"/"LIBARCH64NAME:"/.."):""), */
  
@@ -13980,7 +14322,40 @@
                  "%s:"
                  "%s/lib/%s:"
                  "%s/../lib/%s",
-@@ -977,6 +1011,7 @@
+@@ -721,7 +771,7 @@
+ jboolean
+ GetApplicationHome(char *buf, jint bufsize)
+ {
+-#ifdef __linux__
++#if defined(__linux__) || defined(_ALLBSD_SOURCE)
+     char *execname = GetExecname();
+     if (execname) {
+         strncpy(buf, execname, bufsize-1);
+@@ -878,9 +928,13 @@
+             }
+         }
+     }
+-#elif defined(__linux__)
++#elif defined(__linux__) || defined(_ALLBSD_SOURCE)
+     {
++#ifdef __FreeBSD__
++        const char* self = "/proc/curproc/file";
++#else
+         const char* self = "/proc/self/exe";
++#endif
+         char buf[PATH_MAX+1];
+         int len = readlink(self, buf, PATH_MAX);
+         if (len >= 0) {
+@@ -888,7 +942,7 @@
+             exec_path = JLI_StringDup(buf);
+         }
+     }
+-#else /* !__sun && !__linux */
++#else /* !__sun && !__linux && !_ALLBSD_SOURCE */
+     {
+         /* Not implemented */
+     }
+@@ -977,6 +1031,7 @@
  /* Compute physical memory by asking the OS */
  uint64_t
  physical_memory(void) {
@@ -13988,7 +14363,7 @@
    const uint64_t pages     = (uint64_t) sysconf(_SC_PHYS_PAGES);
    const uint64_t page_size = (uint64_t) sysconf(_SC_PAGESIZE);
    const uint64_t result    = pages * page_size;
-@@ -988,6 +1023,28 @@
+@@ -988,6 +1043,28 @@
             "  physical memory: " UINT64_FORMAT " (%.3fGB)\n",
             pages, page_size, result, result / (double) GB);
    }
@@ -14017,7 +14392,7 @@
    return result;
  }
  
-@@ -1083,7 +1140,7 @@
+@@ -1083,7 +1160,7 @@
  
  #endif /* __sun && i586 */
  
@@ -14026,7 +14401,74 @@
  
  /*
   * A utility method for asking the CPU about itself.
-@@ -1692,9 +1749,23 @@
+@@ -1148,7 +1225,7 @@
+ #endif
+ }
+ 
+-#endif /* __linux__ && i586 */
++#endif /* (__linux__ || _ALLBSD_SOURCE) && i586 */
+ 
+ #ifdef i586
+ /*
+@@ -1360,6 +1437,39 @@
+ 
+ #endif /* __linux__ && i586 */
+ 
++#if defined(_ALLBSD_SOURCE) && defined(i586)
++
++/* The definition of a server-class machine for bsd-i586 */
++jboolean
++bsd_i586_ServerClassMachine(void) {
++  jboolean            result            = JNI_FALSE;
++  /* How big is a server class machine? */
++  const unsigned long server_processors = 2UL;
++  const uint64_t      server_memory     = 2UL * GB;
++  /*
++   * We seem not to get our full complement of memory.
++   *     We allow some part (1/8?) of the memory to be "missing",
++   *     based on the sizes of DIMMs, and maybe graphics cards.
++   */
++  const uint64_t      missing_memory    = 256UL * MB;
++  const uint64_t      actual_memory     = physical_memory();
++
++  /* Is this a server class machine? */
++  if (actual_memory >= (server_memory - missing_memory)) {
++    const unsigned long actual_processors = physical_processors();
++    if (actual_processors >= server_processors) {
++      result = JNI_TRUE;
++    }
++  }
++  if (_launcher_debug) {
++    printf("bsd_" LIBARCHNAME "_ServerClassMachine: %s\n",
++           (result == JNI_TRUE ? "true" : "false"));
++  }
++  return result;
++}
++
++#endif /* _ALLBSD_SOURCE && i586 */
++
+ /* Dispatch to the platform-specific definition of "server-class" */
+ jboolean
+ ServerClassMachine(void) {
+@@ -1374,6 +1484,8 @@
+   result = solaris_i586_ServerClassMachine();
+ #elif defined(__linux__) && defined(i586)
+   result = linux_i586_ServerClassMachine();
++#elif defined(_ALLBSD_SOURCE) && defined(i586)
++  result = bsd_i586_ServerClassMachine();
+ #else
+   if (_launcher_debug) {
+     printf("ServerClassMachine: returns default value of %s\n",
+@@ -1514,7 +1626,7 @@
+     while (dp != NULL) {
+         cp = strchr(dp, (int)':');
+         if (cp != NULL)
+-            *cp = (char)NULL;
++            *cp = '\0';
+         if ((target = ProcessDir(info, dp)) != NULL)
+             break;
+         dp = cp;
+@@ -1692,9 +1804,29 @@
      return(borrowed_unsetenv(name));
  }
  
@@ -14037,9 +14479,15 @@
 +int64_t
 +CounterGet()
 +{
++#ifdef __FreeBSD__
++	struct timespec tp;
++	clock_gettime(CLOCK_MONOTONIC, &tp);
++	return (uint64_t)tp.tv_sec * 1000000 + tp.tv_nsec / 1000;
++#else
 +	struct timeval tv;
 +	gettimeofday(&tv, NULL);
-+	return (tv.tv_sec * 1000) + tv.tv_usec;
++	return (uint64_t)tv.tv_sec * 1000000 + tv.tv_usec;
++#endif
 +}
 +#endif
 +
@@ -14051,7 +14499,7 @@
  
  static void* hSplashLib = NULL;
  
-@@ -1722,13 +1793,15 @@
+@@ -1722,13 +1854,15 @@
      return "%lld";
  }
  
@@ -14069,7 +14517,23 @@
      pthread_t tid;
      pthread_attr_t attr;
      pthread_attr_init(&attr);
-@@ -1765,13 +1838,11 @@
+@@ -1741,7 +1875,7 @@
+     if (pthread_create(&tid, &attr, (void *(*)(void*))continuation, (void*)args) == 0) {
+       void * tmp;
+       pthread_join(tid, &tmp);
+-      rslt = (int)tmp;
++      rslt = (int)(intptr_t)tmp;
+     } else {
+      /*
+       * Continue execution in current thread if for some reason (e.g. out of
+@@ -1759,25 +1893,23 @@
+     if (thr_create(NULL, stack_size, (void *(*)(void *))continuation, args, flags, &tid) == 0) {
+       void * tmp;
+       thr_join(tid, NULL, &tmp);
+-      rslt = (int)tmp;
++      rslt = (int)(intptr_t)tmp;
+     } else {
+       /* See above. Continue in current thread if thr_create() failed */
        rslt = continuation(args);
      }
  #endif
@@ -14086,8 +14550,16 @@
  /* Coarse estimation of number of digits assuming the worst case is a 64-bit pid. */
  #define MAX_PID_STR_SZ   20
  
---- jdk/src/solaris/bin/java_md.h	2011-07-05 14:36:09.000000000 -0400
-+++ jdk/src/solaris/bin/java_md.h	2011-07-07 19:17:04.000000000 -0400
+ void SetJavaLauncherPlatformProps() {
+-   /* Linux only */
+-#ifdef __linux__
++   /* Linux and BSDs only */
++#if defined(__linux__) || defined(_ALLBSD_SOURCE)
+     const char *substr = "-Dsun.java.launcher.pid=";
+     char *pid_prop_str = (char *)JLI_MemAlloc(strlen(substr) + MAX_PID_STR_SZ + 1);
+     sprintf(pid_prop_str, "%s%d", substr, getpid());
+--- jdk/src/solaris/bin/java_md.h
++++ jdk/src/solaris/bin/java_md.h
 @@ -58,10 +58,14 @@
  #include <sys/time.h>
  #define CounterGet()              (gethrtime()/1000)
@@ -14104,8 +14576,8 @@
  
  /*
   * Function prototypes.
---- jdk/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java	2011-07-05 14:36:09.000000000 -0400
-+++ jdk/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java
++++ jdk/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java
 @@ -403,7 +403,7 @@
          if (fontID != null) {
              fileName = (String)fontNameMap.get(fontID);
@@ -14124,13 +14596,13 @@
              fontConfigDirs.add(jreLibDirName+File.separator+"oblique-fonts");
          }
          fontdirs = (String[])fontConfigDirs.toArray(new String[0]);
---- jdk/src/solaris/classes/sun/nio/ch/DefaultSelectorProvider.java	2011-07-05 14:36:10.000000000 -0400
-+++ jdk/src/solaris/classes/sun/nio/ch/DefaultSelectorProvider.java	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/classes/sun/nio/ch/DefaultSelectorProvider.java
++++ jdk/src/solaris/classes/sun/nio/ch/DefaultSelectorProvider.java
 @@ -47,6 +47,10 @@
      public static SelectorProvider create() {
          String osname = AccessController.doPrivileged(
              new GetPropertyAction("os.name"));
-+	if ("MidnightBSD".equals(osname)) {
++	if ("FreeBSD".equals(osname)) {
 +            return new sun.nio.ch.KqueueSelectorProvider();
 +        }
 +
@@ -14137,8 +14609,8 @@
          if ("SunOS".equals(osname)) {
              return new sun.nio.ch.DevPollSelectorProvider();
          }
---- jdk/src/solaris/classes/sun/nio/ch/KqueueArrayWrapper.java	2011-07-07 19:17:04.000000000 -0400
-+++ jdk/src/solaris/classes/sun/nio/ch/KqueueArrayWrapper.java	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/classes/sun/nio/ch/KqueueArrayWrapper.java	1969-12-31 19:00:00.000000000 -0500
++++ jdk/src/solaris/classes/sun/nio/ch/KqueueArrayWrapper.java
 @@ -0,0 +1,231 @@
 +/*
 + * Scratched by davidxu at freebsd.org
@@ -14371,8 +14843,8 @@
 +    private static native short getKeventFlags(long address, int index);
 +    private static native int getKeventIdent(long address, int index);
 +}
---- jdk/src/solaris/classes/sun/nio/ch/KqueueSelectorImpl.java	2011-07-07 19:17:04.000000000 -0400
-+++ jdk/src/solaris/classes/sun/nio/ch/KqueueSelectorImpl.java	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/classes/sun/nio/ch/KqueueSelectorImpl.java	1969-12-31 19:00:00.000000000 -0500
++++ jdk/src/solaris/classes/sun/nio/ch/KqueueSelectorImpl.java
 @@ -0,0 +1,205 @@
 +/*
 + * scratched by davidxu at freebsd.org
@@ -14388,7 +14860,7 @@
 +
 +
 +/**
-+ * An implementation of Selector for MidnightBSD.
++ * An implementation of Selector for FreeBSD.
 + */
 +class KqueueSelectorImpl
 +    extends SelectorImpl
@@ -14579,8 +15051,8 @@
 +    }
 +
 +}
---- jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java	2011-07-05 14:36:10.000000000 -0400
-+++ jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java
++++ jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java
 @@ -119,7 +119,11 @@
      }
  
@@ -14587,7 +15059,7 @@
      static boolean isBSD() {
 -        return osname.equals("Linux");
 +	return (osname.equals("Linux") ||
-+		osname.equals("MidnightBSD") ||
++		osname.equals("FreeBSD") ||
 +		osname.equals("Darwin") ||
 +		osname.equals("NetBSD") ||
 +		osname.equals("OpenBSD"));
@@ -14594,8 +15066,8 @@
      }
  
      static final int UNINITIALIZED = -1;
---- jdk/src/solaris/classes/sun/tools/attach/BsdVirtualMachine.java	2011-07-07 19:16:00.000000000 -0400
-+++ jdk/src/solaris/classes/sun/tools/attach/BsdVirtualMachine.java	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/classes/sun/tools/attach/BsdVirtualMachine.java
++++ jdk/src/solaris/classes/sun/tools/attach/BsdVirtualMachine.java
 @@ -38,9 +38,6 @@
   */
  public class BsdVirtualMachine extends HotSpotVirtualMachine {
@@ -14699,8 +15171,8 @@
 -        isBsdThreads = isBsdThreads();
      }
  }
---- jdk/src/solaris/demo/jvmti/hprof/hprof_md.c	2011-07-05 14:36:10.000000000 -0400
-+++ jdk/src/solaris/demo/jvmti/hprof/hprof_md.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/demo/jvmti/hprof/hprof_md.c
++++ jdk/src/solaris/demo/jvmti/hprof/hprof_md.c
 @@ -33,7 +33,7 @@
  #include <sys/stat.h>
  #include <fcntl.h>
@@ -14746,14 +15218,14 @@
      addr = (void*)&Agent_OnLoad;
  #else
      /* Just using &Agent_OnLoad will get the first external symbol with
---- jdk/src/solaris/hpi/include/interrupt.h	2011-07-05 14:36:10.000000000 -0400
-+++ jdk/src/solaris/hpi/include/interrupt.h	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/hpi/include/interrupt.h
++++ jdk/src/solaris/hpi/include/interrupt.h
 @@ -75,7 +75,7 @@
   *      N_INTERRUPTS  - The number of interrupt channels.  These
   *                      are numbered from 0 to (N_INTERRUPTS - 1).
   */
 -#ifdef __linux__
-+#if defined(__linux__) || defined(__MidnightBSD__)
++#if defined(__linux__) || defined(__FreeBSD__)
  #define       N_INTERRUPTS    NSIG    /* 0 to NSIG - 1*/
  #else
  #define N_INTERRUPTS    32      /* 0 to 31 */
@@ -14761,7 +15233,7 @@
  #error signal.h has not been included?
  #endif
  
-+#if defined(__MidnightBSD__) && !defined(SA_SIGINFO)
++#if defined(__FreeBSD__) && !defined(SA_SIGINFO)
 +#error signal.h has not been included?
 +#endif
 +
@@ -14768,8 +15240,8 @@
  #ifdef SA_SIGINFO
  /* Thread implementation dependent interrupt dispatcher. */
  void intrDispatchMD(int sig, siginfo_t *info, void *uc);
---- jdk/src/solaris/hpi/include/largefile.h	2011-07-05 14:36:10.000000000 -0400
-+++ jdk/src/solaris/hpi/include/largefile.h	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/hpi/include/largefile.h
++++ jdk/src/solaris/hpi/include/largefile.h
 @@ -34,6 +34,10 @@
  #include "largefile_linux.h"
  #endif
@@ -14781,8 +15253,8 @@
  /*
   * Prototypes for wrappers that we define.  These wrapper functions
   * are low-level I/O routines that will use 64 bit versions if
---- jdk/src/solaris/hpi/include/largefile_bsd.h	2011-07-07 19:16:00.000000000 -0400
-+++ jdk/src/solaris/hpi/include/largefile_bsd.h	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/hpi/include/largefile_bsd.h
++++ jdk/src/solaris/hpi/include/largefile_bsd.h
 @@ -23,14 +23,28 @@
   * questions.
   */
@@ -14819,8 +15291,8 @@
 +#define                pwrite64        pwrite
 +
 +#endif /* _JAVASOFT_BSD_LARGEFILE_SUPPORT_H_ */
---- jdk/src/solaris/hpi/native_threads/include/threads_md.h	2011-07-05 14:36:10.000000000 -0400
-+++ jdk/src/solaris/hpi/native_threads/include/threads_md.h	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/hpi/native_threads/include/threads_md.h
++++ jdk/src/solaris/hpi/native_threads/include/threads_md.h
 @@ -36,6 +36,8 @@
  #define N_TRACED_REGS 12
  #elif i386
@@ -14867,8 +15339,8 @@
  
  #ifdef __linux__
  extern thread_key_t intrJmpbufkey;
---- jdk/src/solaris/hpi/native_threads/src/condvar_md.c	2011-07-05 14:36:10.000000000 -0400
-+++ jdk/src/solaris/hpi/native_threads/src/condvar_md.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/hpi/native_threads/src/condvar_md.c
++++ jdk/src/solaris/hpi/native_threads/src/condvar_md.c
 @@ -58,7 +58,7 @@
  {
      int err;
@@ -14878,8 +15350,8 @@
      err = pthread_cond_destroy((cond_t *) &condvar->cond);
  #else
      err = cond_destroy((cond_t *) condvar);
---- jdk/src/solaris/hpi/native_threads/src/monitor_md.c	2011-07-05 14:36:10.000000000 -0400
-+++ jdk/src/solaris/hpi/native_threads/src/monitor_md.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/hpi/native_threads/src/monitor_md.c
++++ jdk/src/solaris/hpi/native_threads/src/monitor_md.c
 @@ -147,7 +147,7 @@
          mid->monitor_owner = self;
          mid->entry_count = 1;
@@ -14889,8 +15361,8 @@
          if (mid->monitor_owner == self) {
              mid->entry_count++;
              return SYS_OK;
---- jdk/src/solaris/hpi/native_threads/src/sys_api_td.c	2011-07-05 14:36:10.000000000 -0400
-+++ jdk/src/solaris/hpi/native_threads/src/sys_api_td.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/hpi/native_threads/src/sys_api_td.c
++++ jdk/src/solaris/hpi/native_threads/src/sys_api_td.c
 @@ -39,6 +39,10 @@
  #include <sys/ioctl.h>
  #endif
@@ -14913,8 +15385,8 @@
  #ifdef NO_INTERRUPTIBLE_IO
  #undef CLOSEIO
  #else
---- jdk/src/solaris/hpi/native_threads/src/threads_bsd.c	2011-07-07 19:16:00.000000000 -0400
-+++ jdk/src/solaris/hpi/native_threads/src/threads_bsd.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/hpi/native_threads/src/threads_bsd.c
++++ jdk/src/solaris/hpi/native_threads/src/threads_bsd.c
 @@ -23,79 +23,44 @@
   * questions.
   */
@@ -14947,7 +15419,7 @@
 +#include <sys/sysctl.h>
 +
 +#include <pthread.h>
-+#if defined(__MidnightBSD__) || defined(__OpenBSD__)
++#if defined(__FreeBSD__) || defined(__OpenBSD__)
 +#include <pthread_np.h>
 +#endif
 +#ifdef __NetBSD__
@@ -15790,8 +16262,8 @@
 -
 -    print_lwps();
  }
---- jdk/src/solaris/hpi/native_threads/src/threads_md.c	2011-07-05 14:36:10.000000000 -0400
-+++ jdk/src/solaris/hpi/native_threads/src/threads_md.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/hpi/native_threads/src/threads_md.c
++++ jdk/src/solaris/hpi/native_threads/src/threads_md.c
 @@ -54,6 +54,10 @@
  #error That can NOT possibly be right.
  #endif
@@ -15873,8 +16345,8 @@
  
          info.isMP = (cpus < 0) ? 1 : (cpus > 1);
          info.name = "native threads";
---- jdk/src/solaris/hpi/src/linker_md.c	2011-07-05 14:36:10.000000000 -0400
-+++ jdk/src/solaris/hpi/src/linker_md.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/hpi/src/linker_md.c
++++ jdk/src/solaris/hpi/src/linker_md.c
 @@ -44,11 +44,19 @@
  #include "threads_md.h"
  #endif
@@ -15941,8 +16413,8 @@
  #endif
      /*
       * This is a bit of bulletproofing to catch the commonly occurring
---- jdk/src/solaris/hpi/src/memory_md.c	2011-07-05 14:36:10.000000000 -0400
-+++ jdk/src/solaris/hpi/src/memory_md.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/hpi/src/memory_md.c
++++ jdk/src/solaris/hpi/src/memory_md.c
 @@ -50,12 +50,24 @@
  #include <stdlib.h>
  #include <stdio.h>      /* For perror() */
@@ -15974,7 +16446,7 @@
  static size_t memGrainSize;     /* A page for Linux */
 +#elif defined(_ALLBSD_SOURCE)
 +static size_t memGrainSize;	/* A page for FreeBSD */
-+#if defined(__MidnightBSD__) && (__MidnightBSD_version >= 3000)
++#if defined(__FreeBSD__) && (__FreeBSD_version >= 700013)
 +static inline void *
 +memalign(size_t alignment, size_t size)
 +{
@@ -15981,7 +16453,7 @@
 +    void *ret;
 +    return posix_memalign(&ret, alignment, size) ? NULL : ret;
 +}
-+#else /* ! __MidnightBSD_version >= 3000 */
++#else /* ! __FreeBSD_version >= 700013 */
 +#define memalign(a, b)	valloc(b)
 +#endif
  #else
@@ -16032,8 +16504,8 @@
      ret = committedAddr;
  #else
      ret = requestedAddr;
---- jdk/src/solaris/hpi/src/system_md.c	2011-07-05 14:36:10.000000000 -0400
-+++ jdk/src/solaris/hpi/src/system_md.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/hpi/src/system_md.c
++++ jdk/src/solaris/hpi/src/system_md.c
 @@ -41,6 +41,7 @@
  #include <dlfcn.h>
  
@@ -16087,8 +16559,8 @@
      fd = open64_w(path, oflag, mode);
      if (delete != 0) {
          unlink(path);
---- jdk/src/solaris/instrument/EncodingSupport_md.c	2011-07-05 14:36:10.000000000 -0400
-+++ jdk/src/solaris/instrument/EncodingSupport_md.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/instrument/EncodingSupport_md.c
++++ jdk/src/solaris/instrument/EncodingSupport_md.c
 @@ -28,7 +28,10 @@
  #include <string.h>
  #include <ctype.h>
@@ -16118,8 +16590,8 @@
  
      /* Open conversion descriptors */
      iconvToPlatform   = iconv_open(codeset, "UTF-8");
---- jdk/src/solaris/javavm/export/jvm_md.h	2011-07-05 14:36:10.000000000 -0400
-+++ jdk/src/solaris/javavm/export/jvm_md.h	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/javavm/export/jvm_md.h
++++ jdk/src/solaris/javavm/export/jvm_md.h
 @@ -39,7 +39,14 @@
  #define JNI_ONUNLOAD_SYMBOLS {"JNI_OnUnload"}
  
@@ -16144,8 +16616,8 @@
  
  /* Signals */
  
---- jdk/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c	2011-07-05 14:36:10.000000000 -0400
-+++ jdk/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c
++++ jdk/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c
 @@ -32,10 +32,16 @@
  
  #include <sys/types.h>
@@ -16167,7 +16639,7 @@
  #include <limits.h>
  #include <stdlib.h>
  #include <unistd.h>
-+#if defined(__MidnightBSD__)
++#if defined(__FreeBSD__)
 +#include <vm/vm_param.h>
 +#endif
  
@@ -16206,7 +16678,7 @@
      avail = (jlong)si.freeswap * si.mem_unit;
  
      return available ? avail : total;
-+#elif defined(__MidnightBSD__)
++#elif defined(__FreeBSD__)
 +    struct xswdev xsw;
 +    size_t mibsize, size;
 +    jlong npages;
@@ -16244,7 +16716,7 @@
  
      fclose(fp);
      return (jlong)vsize;
-+#elif defined(__MidnightBSD__)
++#elif defined(__FreeBSD__)
 +    FILE *fp;
 +    unsigned long end, start;
 +    jlong total = 0;
@@ -16288,17 +16760,26 @@
      clk_tck = 100;
  #endif
      if (clk_tck == -1) {
-@@ -244,32 +310,70 @@
+@@ -244,32 +310,79 @@
  Java_com_sun_management_UnixOperatingSystem_getFreePhysicalMemorySize
    (JNIEnv *env, jobject mbean)
  {
-+#if defined (__MidnightBSD__)
-+    int npages;
++#if defined (__FreeBSD__)
++    static const char *vm_stats[] = {
++	"vm.stats.vm.v_free_count",
++	"vm.stats.vm.v_cache_count",
++	/* "vm.stats.vm.v_inactive_count", */
++	NULL
++    };
 +    size_t size;
-+    size = sizeof(npages);
-+    if (sysctlbyname("vm.stats.vm.v_free_count", &npages, &size, NULL, 0) == - 1)
-+	return (0);
-+    return ((jlong)npages * page_size);
++    jlong free_pages;
++    u_int i, npages;
++    for (i = 0, free_pages = 0, size = sizeof(npages); vm_stats[i] != NULL; i++) {
++	if (sysctlbyname(vm_stats[i], &npages, &size, NULL, 0) == -1)
++	    return 0;
++	free_pages += npages;
++    }
++    return (free_pages * page_size);
 +#elif defined(_ALLBSD_SOURCE)
 +    // throw_internal_error(env, "Unimplemented in BSD");
 +    return (128 * MB);
@@ -16334,7 +16815,7 @@
  Java_com_sun_management_UnixOperatingSystem_getOpenFileDescriptorCount
    (JNIEnv *env, jobject mbean)
  {
-+#if defined(_ALLBSD_SOURCE) && !defined(__MidnightBSD__)
++#if defined(_ALLBSD_SOURCE) && !defined(__FreeBSD__)
 +    // throw_internal_error(env, "Unimplemented in BSD");
 +    return (100);
 +#else /* solaris/linux */
@@ -16343,7 +16824,7 @@
      struct dirent* dentp;
      jlong fds = 0;
  
-+#if defined(__MidnightBSD__)
++#if defined(__FreeBSD__)
 +    dirp = opendir("/dev/fd");
 +    if (dirp == NULL) {
 +        throw_internal_error(env, "Unable to open directory /dev/fd");
@@ -16359,7 +16840,7 @@
  
      // iterate through directory entries, skipping '.' and '..'
      // each entry represents an open file descriptor.
-@@ -282,6 +386,7 @@
+@@ -282,6 +395,7 @@
      closedir(dirp);
      // subtract by 1 which was the fd open for this implementation
      return (fds - 1);
@@ -16367,8 +16848,8 @@
  }
  
  JNIEXPORT jlong JNICALL
---- jdk/src/solaris/native/java/io/UnixFileSystem_md.c	2011-07-05 14:36:10.000000000 -0400
-+++ jdk/src/solaris/native/java/io/UnixFileSystem_md.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/java/io/UnixFileSystem_md.c
++++ jdk/src/solaris/native/java/io/UnixFileSystem_md.c
 @@ -41,6 +41,11 @@
  #include "java_io_FileSystem.h"
  #include "java_io_UnixFileSystem.h"
@@ -16415,7 +16896,7 @@
  
  /* -- Path operations -- */
  
-@@ -483,7 +490,7 @@
+@@ -485,7 +492,7 @@
  #endif
  
          /* Preserve access time */
@@ -16424,8 +16905,8 @@
          struct stat sb;
  
          if (stat(path, &sb) == 0) {
---- jdk/src/solaris/native/java/io/canonicalize_md.c	2011-07-05 14:36:10.000000000 -0400
-+++ jdk/src/solaris/native/java/io/canonicalize_md.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/java/io/canonicalize_md.c
++++ jdk/src/solaris/native/java/io/canonicalize_md.c
 @@ -33,7 +33,9 @@
  #include <sys/stat.h>
  #include <errno.h>
@@ -16436,8 +16917,8 @@
  
  
  /* Note: The comments in this file use the terminology
---- jdk/src/solaris/native/java/io/io_util_md.c	2011-07-05 14:36:10.000000000 -0400
-+++ jdk/src/solaris/native/java/io/io_util_md.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/java/io/io_util_md.c
++++ jdk/src/solaris/native/java/io/io_util_md.c
 @@ -36,7 +36,7 @@
      WITH_PLATFORM_STRING(env, path, ps) {
          FD fd;
@@ -16447,8 +16928,8 @@
          /* Remove trailing slashes, since the kernel won't */
          char *p = (char *)ps + strlen(ps) - 1;
          while ((p > ps) && (*p == '/'))
---- jdk/src/solaris/native/java/lang/ProcessEnvironment_md.c	2011-07-05 14:36:10.000000000 -0400
-+++ jdk/src/solaris/native/java/lang/ProcessEnvironment_md.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/java/lang/ProcessEnvironment_md.c
++++ jdk/src/solaris/native/java/lang/ProcessEnvironment_md.c
 @@ -28,6 +28,11 @@
  #include "jni.h"
  #include "jni_util.h"
@@ -16489,8 +16970,8 @@
              jbyteArray var, val;
              const char * valBeg = varEnd + 1;
              jsize varLength = varEnd - environ[i];
---- jdk/src/solaris/native/java/lang/UNIXProcess_md.c	2011-07-05 14:36:10.000000000 -0400
-+++ jdk/src/solaris/native/java/lang/UNIXProcess_md.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/java/lang/UNIXProcess_md.c
++++ jdk/src/solaris/native/java/lang/UNIXProcess_md.c
 @@ -40,7 +40,11 @@
  #include <stdlib.h>
  #include <sys/types.h>
@@ -16507,7 +16988,7 @@
  #include <fcntl.h>
  #include <limits.h>
  
-+#ifdef __MidnightBSD__
++#ifdef __FreeBSD__
 +#include <dlfcn.h>
 +#include <pthread.h>
 +#include <pthread_np.h>
@@ -16525,7 +17006,7 @@
      }
  }
  
-+#if defined(__MidnightBSD__)
++#if defined(__FreeBSD__)
 +
 +extern pid_t   __sys_fork(void);
 +
@@ -16575,7 +17056,7 @@
 +
 +    return resultPid;
 +}
-+#endif /* __MidnightBSD__ */
++#endif /* __FreeBSD__ */
 +
 +#if defined(__OpenBSD__)
 +/*
@@ -16650,7 +17131,7 @@
      }
  }
  
-+#if defined(__MidnightBSD__)
++#if defined(__FreeBSD__)
 +#undef fork1
 +#define fork1() jdk_fork_wrapper()
 +#else
@@ -16693,8 +17174,8 @@
          /* Close the parent sides of the pipe.
             Give the child sides of the pipes the right fileno's.
             Closing pipe fds here is redundant, since closeDescriptors()
---- jdk/src/solaris/native/java/lang/java_props_md.c	2011-07-05 14:36:10.000000000 -0400
-+++ jdk/src/solaris/native/java/lang/java_props_md.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/java/lang/java_props_md.c
++++ jdk/src/solaris/native/java/lang/java_props_md.c
 @@ -23,7 +23,7 @@
   * questions.
   */
@@ -16828,8 +17309,8 @@
  
      return &sprops;
  }
---- jdk/src/solaris/native/java/net/Inet4AddressImpl.c	2011-07-05 14:36:10.000000000 -0400
-+++ jdk/src/solaris/native/java/net/Inet4AddressImpl.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/java/net/Inet4AddressImpl.c
++++ jdk/src/solaris/native/java/net/Inet4AddressImpl.c
 @@ -35,17 +35,293 @@
  #include <stdlib.h>
  #include <ctype.h>
@@ -16845,7 +17326,7 @@
  
  #include "java_net_Inet4AddressImpl.h"
  
-+#if defined(__GLIBC__) || (defined(__MidnightBSD__) && (__MidnightBSD_version >= 3000))
++#if defined(__GLIBC__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 601104))
 +#define HAS_GLIBC_GETHOSTBY_R	1
 +#endif
 +
@@ -17186,8 +17667,8 @@
  #define SET_NONBLOCKING(fd) {           \
          int flags = fcntl(fd, F_GETFL); \
          flags |= O_NONBLOCK;            \
---- jdk/src/solaris/native/java/net/Inet6AddressImpl.c	2011-07-05 14:36:10.000000000 -0400
-+++ jdk/src/solaris/native/java/net/Inet6AddressImpl.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/java/net/Inet6AddressImpl.c
++++ jdk/src/solaris/native/java/net/Inet6AddressImpl.c
 @@ -32,6 +32,9 @@
  #include <strings.h>
  #include <stdlib.h>
@@ -17237,8 +17718,8 @@
      }
      return (*env)->NewStringUTF(env, hostname);
  }
---- jdk/src/solaris/native/java/net/NetworkInterface.c	2011-07-05 14:36:10.000000000 -0400
-+++ jdk/src/solaris/native/java/net/NetworkInterface.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/java/net/NetworkInterface.c
++++ jdk/src/solaris/native/java/net/NetworkInterface.c
 @@ -23,13 +23,13 @@
   * questions.
   */
@@ -17262,7 +17743,7 @@
 +#if defined(_ALLBSD_SOURCE)
 +#include <sys/param.h>
 +#include <sys/ioctl.h>
-+#if defined(__MidnightBSD__) || defined(__APPLE__)
++#if defined(__FreeBSD__) || defined(__APPLE__)
 +#include <net/ethernet.h>
 +#include <net/if_var.h>
 +#elif defined(__OpenBSD__)
@@ -17515,8 +17996,8 @@
      memset((char *) &if2, 0, sizeof(if2));
      strcpy(if2.ifr_name, name_utf);
  
---- jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c	2011-07-05 14:36:11.000000000 -0400
-+++ jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
++++ jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
 @@ -23,12 +23,12 @@
   * questions.
   */
@@ -17556,7 +18037,7 @@
  #ifdef AF_INET6
          if (ipv6_available()) {
              struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)&addr;
-+#ifdef __MidnightBSD__
++#ifdef __FreeBSD__
 +            him6->sin6_family = AF_INET6;
 +#else
              him6->sin6_family = AF_UNSPEC;
@@ -17566,7 +18047,7 @@
  #endif
          {
              struct sockaddr_in *him4 = (struct sockaddr_in*)&addr;
-+#ifdef __MidnightBSD__
++#ifdef __FreeBSD__
 +            him4->sin_family = AF_INET;
 +#else
              him4->sin_family = AF_UNSPEC;
@@ -17651,6 +18132,42 @@
          int ttl = 1;
          setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, (char *)&ttl,
                     sizeof(ttl));
+@@ -1317,7 +1338,7 @@
+         /*
+          * value is an InetAddress.
+          */
+-#ifdef __solaris__
++#if defined(__solaris__) || defined(_ALLBSD_SOURCE)
+         if (ipv6_available()) {
+             mcast_set_if_by_addr_v6(env, this, fd, value);
+         } else {
+@@ -1336,7 +1357,7 @@
+         /*
+          * value is a NetworkInterface.
+          */
+-#ifdef __solaris__
++#if defined(__solaris__) || defined(_ALLBSD_SOURCE)
+         if (ipv6_available()) {
+             mcast_set_if_by_if_v6(env, this, fd, value);
+         } else {
+@@ -1413,7 +1434,7 @@
+  */
+ static void setMulticastLoopbackMode(JNIEnv *env, jobject this, int fd,
+                                   jint opt, jobject value) {
+-#ifdef __solaris__
++#if defined(__solaris__) || defined(_ALLBSD_SOURCE)
+     if (ipv6_available()) {
+         mcast_set_loop_v6(env, this, fd, value);
+     } else {
+@@ -1981,7 +2002,7 @@
+         fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
+     }
+     /* setsockopt to be correct ttl */
+-#ifdef __solaris__
++#if defined(__solaris__) || defined(_ALLBSD_SOURCE)
+     if (ipv6_available()) {
+         setHopLimit(env, fd, ttl);
+     } else {
 @@ -2374,18 +2395,30 @@
              mname6.ipv6mr_interface = idx;
          }
@@ -17685,8 +18202,8 @@
                  }
              }
          }
---- jdk/src/solaris/native/java/net/PlainSocketImpl.c	2011-07-05 14:36:11.000000000 -0400
-+++ jdk/src/solaris/native/java/net/PlainSocketImpl.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/java/net/PlainSocketImpl.c
++++ jdk/src/solaris/native/java/net/PlainSocketImpl.c
 @@ -253,7 +253,12 @@
                                             jboolean stream) {
      jobject fdObj, ssObj;
@@ -17772,8 +18289,8 @@
          } else if (errno == ECONNREFUSED) {
              NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "ConnectException",
                             "Connection refused");
---- jdk/src/solaris/native/java/net/bsd_close.c	2011-07-07 19:16:00.000000000 -0400
-+++ jdk/src/solaris/native/java/net/bsd_close.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/java/net/bsd_close.c
++++ jdk/src/solaris/native/java/net/bsd_close.c
 @@ -57,7 +57,7 @@
  /*
   * Signal to unblock thread
@@ -17783,8 +18300,8 @@
  
  /*
   * The fd table and the number of file descriptors
---- jdk/src/solaris/native/java/net/net_util_md.c	2011-07-05 14:36:11.000000000 -0400
-+++ jdk/src/solaris/native/java/net/net_util_md.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/java/net/net_util_md.c
++++ jdk/src/solaris/native/java/net/net_util_md.c
 @@ -34,6 +34,15 @@
  #include <stdlib.h>
  #include <dlfcn.h>
@@ -17801,7 +18318,7 @@
  #ifdef __solaris__
  #include <sys/sockio.h>
  #include <stropts.h>
-@@ -219,6 +228,14 @@
+@@ -220,6 +229,14 @@
      return (*env)->GetFieldID(env, cls, "fd", "I");
  }
  
@@ -17816,7 +18333,7 @@
  jint  IPv6_supported()
  {
  #ifndef AF_INET6
-@@ -229,7 +246,7 @@
+@@ -230,7 +247,7 @@
      int fd;
      void *ipv6_fn;
      SOCKADDR sa;
@@ -17825,7 +18342,7 @@
  
      fd = JVM_Socket(AF_INET6, SOCK_STREAM, 0) ;
      if (fd < 0) {
-@@ -355,6 +372,7 @@
+@@ -356,6 +373,7 @@
      close(fd);
      return JNI_TRUE;
  }
@@ -17833,7 +18350,7 @@
  
  void
  NET_AllocSockaddr(struct sockaddr **him, int *len) {
-@@ -689,6 +707,10 @@
+@@ -710,6 +728,10 @@
          him6->sin6_family = AF_INET6;
          *len = sizeof(struct sockaddr_in6) ;
  
@@ -17844,7 +18361,7 @@
          /*
           * On Linux if we are connecting to a link-local address
           * we need to specify the interface in the scope_id (2.4 kernel only)
-@@ -1086,7 +1108,16 @@
+@@ -1107,7 +1129,16 @@
      }
  #endif
  
@@ -17861,7 +18378,7 @@
      if (rv < 0) {
          return rv;
      }
-@@ -1133,6 +1164,24 @@
+@@ -1154,6 +1185,24 @@
  #define IPTOS_PREC_MASK 0xe0
  #endif
  
@@ -17886,7 +18403,7 @@
      /*
       * IPPROTO/IP_TOS :-
       * 1. IPv6 on Solaris: no-op and will be set in flowinfo
-@@ -1165,6 +1214,10 @@
+@@ -1186,6 +1235,10 @@
          *iptos &= (IPTOS_TOS_MASK | IPTOS_PREC_MASK);
      }
  
@@ -17897,7 +18414,7 @@
      /*
       * SOL_SOCKET/{SO_SNDBUF,SO_RCVBUF} - On Solaris need to
       * ensure that value is <= max_buf as otherwise we get
-@@ -1212,6 +1265,84 @@
+@@ -1233,6 +1286,84 @@
      }
  #endif
  
@@ -17982,19 +18499,19 @@
      return setsockopt(fd, level, opt, arg, len);
  }
  
---- jdk/src/solaris/native/java/net/net_util_md.h	2011-07-05 14:36:11.000000000 -0400
-+++ jdk/src/solaris/native/java/net/net_util_md.h	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/java/net/net_util_md.h
++++ jdk/src/solaris/native/java/net/net_util_md.h
 @@ -37,7 +37,7 @@
  #endif
  
  
 -#ifdef __linux__
-+#if defined(__linux__) || defined(__MidnightBSD__)
++#if defined(__linux__) || defined(__FreeBSD__)
  extern int NET_Timeout(int s, long timeout);
  extern int NET_Read(int s, void* buf, size_t len);
  extern int NET_RecvFrom(int s, void *buf, int len, unsigned int flags,
---- jdk/src/solaris/native/java/nio/MappedByteBuffer.c	2011-07-05 14:36:11.000000000 -0400
-+++ jdk/src/solaris/native/java/nio/MappedByteBuffer.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/java/nio/MappedByteBuffer.c
++++ jdk/src/solaris/native/java/nio/MappedByteBuffer.c
 @@ -38,7 +38,11 @@
                                          jlong address, jlong len)
  {
@@ -18019,8 +18536,8 @@
      unsigned long lAddress = address;
  
      jlong offset = lAddress % pageSize;
---- jdk/src/solaris/native/java/util/FileSystemPreferences.c	2011-07-05 14:36:11.000000000 -0400
-+++ jdk/src/solaris/native/java/util/FileSystemPreferences.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/java/util/FileSystemPreferences.c
++++ jdk/src/solaris/native/java/util/FileSystemPreferences.c
 @@ -47,8 +47,11 @@
      return (jint) result;
  }
@@ -18058,8 +18575,8 @@
  
      if (rc < 0) {
          close(fd);
---- jdk/src/solaris/native/java/util/TimeZone_md.c	2011-07-05 14:36:11.000000000 -0400
-+++ jdk/src/solaris/native/java/util/TimeZone_md.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/java/util/TimeZone_md.c
++++ jdk/src/solaris/native/java/util/TimeZone_md.c
 @@ -31,7 +31,7 @@
  #include <errno.h>
  #include <stddef.h>
@@ -18192,8 +18709,8 @@
      sprintf(buf, (const char *)"GMT%c%02d:%02d",
              sign, (int)(offset/3600), (int)((offset%3600)/60));
      return strdup(buf);
---- jdk/src/solaris/native/sun/awt/CUPSfuncs.c	2011-07-05 14:36:11.000000000 -0400
-+++ jdk/src/solaris/native/sun/awt/CUPSfuncs.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/awt/CUPSfuncs.c
++++ jdk/src/solaris/native/sun/awt/CUPSfuncs.c
 @@ -25,6 +25,7 @@
  
  #include <jni.h>
@@ -18216,8 +18733,8 @@
      if (handle == NULL) {
        return JNI_FALSE;
      }
---- jdk/src/solaris/native/sun/awt/VDrawingArea.c	2011-07-05 14:36:11.000000000 -0400
-+++ jdk/src/solaris/native/sun/awt/VDrawingArea.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/awt/VDrawingArea.c
++++ jdk/src/solaris/native/sun/awt/VDrawingArea.c
 @@ -31,7 +31,11 @@
  #endif /* !HEADLESS */
  
@@ -18230,8 +18747,8 @@
  
  #ifdef __linux__
  /* XXX: Shouldn't be necessary. */
---- jdk/src/solaris/native/sun/awt/X11Color.c	2011-07-05 14:36:11.000000000 -0400
-+++ jdk/src/solaris/native/sun/awt/X11Color.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/awt/X11Color.c
++++ jdk/src/solaris/native/sun/awt/X11Color.c
 @@ -33,7 +33,9 @@
  #include <math.h>
  #include <sys/time.h>
@@ -18242,8 +18759,8 @@
  #ifndef HEADLESS
  #include <X11/Xlib.h>
  #include <X11/Xatom.h>
---- jdk/src/solaris/native/sun/awt/XDrawingArea.c	2011-07-05 14:36:11.000000000 -0400
-+++ jdk/src/solaris/native/sun/awt/XDrawingArea.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/awt/XDrawingArea.c
++++ jdk/src/solaris/native/sun/awt/XDrawingArea.c
 @@ -30,7 +30,11 @@
  #include <Xm/XmP.h>
  
@@ -18256,8 +18773,8 @@
  
  #ifdef DEBUG
  #include <jvm.h>  /* To get jio_fprintf() */
---- jdk/src/solaris/native/sun/awt/awt_Font.c	2011-07-05 14:36:11.000000000 -0400
-+++ jdk/src/solaris/native/sun/awt/awt_Font.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/awt/awt_Font.c
++++ jdk/src/solaris/native/sun/awt/awt_Font.c
 @@ -334,7 +334,7 @@
              if (strcmp(style, "regular") == 0) {
                  altstyle = "roman";
@@ -18267,8 +18784,8 @@
              if (!strcmp(family, "lucidasans")) {
                  family = "lucida";
              }
---- jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c	2011-07-05 14:36:11.000000000 -0400
-+++ jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c
++++ jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c
 @@ -40,6 +40,7 @@
  #include <jni.h>
  #include <jni_util.h>
@@ -18393,8 +18910,8 @@
      if (pLibRandR == NULL) {
          J2dRlsTraceLn(J2D_TRACE_ERROR,
                        "X11GD_InitXrandrFuncs: Could not open libXrandr.so.2");
---- jdk/src/solaris/native/sun/awt/awt_InputMethod.c	2011-07-05 14:36:11.000000000 -0400
-+++ jdk/src/solaris/native/sun/awt/awt_InputMethod.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/awt/awt_InputMethod.c
++++ jdk/src/solaris/native/sun/awt/awt_InputMethod.c
 @@ -69,7 +69,7 @@
                                  XIMPreeditDrawCallbackStruct *);
  static void PreeditCaretCallback(XIC, XPointer,
@@ -18634,8 +19151,8 @@
      AWT_LOCK();
      adjustStatusWindow(window);
      AWT_UNLOCK();
---- jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c	2011-07-05 14:36:11.000000000 -0400
-+++ jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c
++++ jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c
 @@ -260,7 +260,11 @@
          }
      }
@@ -18648,8 +19165,8 @@
  
      JNU_CallStaticMethodByName(env, NULL, "java/lang/System", "load",
                                 "(Ljava/lang/String;)V",
---- jdk/src/solaris/native/sun/awt/awt_MToolkit.c	2011-07-05 14:36:11.000000000 -0400
-+++ jdk/src/solaris/native/sun/awt/awt_MToolkit.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/awt/awt_MToolkit.c
++++ jdk/src/solaris/native/sun/awt/awt_MToolkit.c
 @@ -63,8 +63,9 @@
  extern JavaVM *jvm;
  
@@ -18670,8 +19187,8 @@
                statusWindowEventHandler(xev);
  #endif
                xembed_eventHandler(&xev);
---- jdk/src/solaris/native/sun/awt/awt_Mlib.c	2011-07-05 14:36:11.000000000 -0400
-+++ jdk/src/solaris/native/sun/awt/awt_Mlib.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/awt/awt_Mlib.c
++++ jdk/src/solaris/native/sun/awt/awt_Mlib.c
 @@ -32,6 +32,7 @@
  #include <dlfcn.h>
  #include "jni.h"
@@ -18694,8 +19211,8 @@
      }
  
      if (handle == NULL) {
---- jdk/src/solaris/native/sun/awt/awt_Robot.c	2011-07-05 14:36:11.000000000 -0400
-+++ jdk/src/solaris/native/sun/awt/awt_Robot.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/awt/awt_Robot.c
++++ jdk/src/solaris/native/sun/awt/awt_Robot.c
 @@ -45,7 +45,7 @@
  #include "wsutils.h"
  #include "list.h"
@@ -18705,8 +19222,8 @@
  #include <sys/socket.h>
  #endif
  
---- jdk/src/solaris/native/sun/awt/awt_util.h	2011-07-05 14:36:11.000000000 -0400
-+++ jdk/src/solaris/native/sun/awt/awt_util.h	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/awt/awt_util.h
++++ jdk/src/solaris/native/sun/awt/awt_util.h
 @@ -187,15 +187,20 @@
  #ifdef __solaris__
  extern Widget awt_util_getXICStatusAreaWindow(Widget w);
@@ -18729,8 +19246,8 @@
  typedef struct _XmImRefRec {
    Cardinal      num_refs;       /* Number of referencing widgets. */
    Cardinal      max_refs;       /* Maximum length of refs array. */
---- jdk/src/solaris/native/sun/awt/awt_wm.c	2011-07-05 14:36:11.000000000 -0400
-+++ jdk/src/solaris/native/sun/awt/awt_wm.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/awt/awt_wm.c
++++ jdk/src/solaris/native/sun/awt/awt_wm.c
 @@ -121,12 +121,19 @@
  static Atom XA_KWM_WIN_MAXIMIZED;
  
@@ -18828,8 +19345,8 @@
          awt_wmgr = OPENLOOK_WM;
      }
      else {
---- jdk/src/solaris/native/sun/awt/awt_wm.h	2011-07-05 14:36:11.000000000 -0400
-+++ jdk/src/solaris/native/sun/awt/awt_wm.h	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/awt/awt_wm.h
++++ jdk/src/solaris/native/sun/awt/awt_wm.h
 @@ -45,7 +45,10 @@
      KDE2_WM,
      SAWFISH_WM,
@@ -18842,8 +19359,8 @@
  };
  
  extern void awt_wm_init(void);
---- jdk/src/solaris/native/sun/awt/extutil.h	2011-07-05 14:36:11.000000000 -0400
-+++ jdk/src/solaris/native/sun/awt/extutil.h	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/awt/extutil.h
++++ jdk/src/solaris/native/sun/awt/extutil.h
 @@ -58,7 +58,7 @@
   */
  /* $XFree86: xc/include/extensions/extutil.h,v 1.5 2001/01/17 17:53:20 dawes Exp $ */
@@ -18859,8 +19376,8 @@
  
 -#endif /* __linux__ */
 +#endif /* __linux__ || _ALLBSD_SOURCE */
---- jdk/src/solaris/native/sun/awt/fontpath.c	2011-07-05 14:36:11.000000000 -0400
-+++ jdk/src/solaris/native/sun/awt/fontpath.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/awt/fontpath.c
++++ jdk/src/solaris/native/sun/awt/fontpath.c
 @@ -23,7 +23,7 @@
   * questions.
   */
@@ -19018,8 +19535,8 @@
          if (libfontconfig == NULL) {
              return NULL;
          }
---- jdk/src/solaris/native/sun/awt/gtk2_interface.c	2011-07-05 14:36:11.000000000 -0400
-+++ jdk/src/solaris/native/sun/awt/gtk2_interface.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/awt/gtk2_interface.c
++++ jdk/src/solaris/native/sun/awt/gtk2_interface.c
 @@ -30,8 +30,9 @@
  #include <string.h>
  #include "gtk2_interface.h"
@@ -19031,8 +19548,8 @@
  
  #define G_TYPE_INVALID                  G_TYPE_MAKE_FUNDAMENTAL (0)
  #define G_TYPE_NONE                     G_TYPE_MAKE_FUNDAMENTAL (1)
---- jdk/src/solaris/native/sun/awt/list.c	2011-07-05 14:36:11.000000000 -0400
-+++ jdk/src/solaris/native/sun/awt/list.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/awt/list.c
++++ jdk/src/solaris/native/sun/awt/list.c
 @@ -66,7 +66,11 @@
    ----------------------------------------------------------------------- **/
  
@@ -19045,8 +19562,8 @@
  #include "list.h"
  
  
---- jdk/src/solaris/native/sun/awt/robot_common.c	2011-07-05 14:36:11.000000000 -0400
-+++ jdk/src/solaris/native/sun/awt/robot_common.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/awt/robot_common.c
++++ jdk/src/solaris/native/sun/awt/robot_common.c
 @@ -27,6 +27,9 @@
      #error This file should not be included in headless library
  #endif
@@ -19057,8 +19574,8 @@
  #include "robot_common.h"
  
  /*
---- jdk/src/solaris/native/sun/font/X11FontScaler.c	2011-07-05 14:36:11.000000000 -0400
-+++ jdk/src/solaris/native/sun/font/X11FontScaler.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/font/X11FontScaler.c
++++ jdk/src/solaris/native/sun/font/X11FontScaler.c
 @@ -32,7 +32,11 @@
   * into X11FontScaler_md.c, which is compiled into another library.
   */
@@ -19071,8 +19588,8 @@
  #include <ctype.h>
  #include <sys/utsname.h>
  
---- jdk/src/solaris/native/sun/font/X11TextRenderer.c	2011-07-05 14:36:11.000000000 -0400
-+++ jdk/src/solaris/native/sun/font/X11TextRenderer.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/font/X11TextRenderer.c
++++ jdk/src/solaris/native/sun/font/X11TextRenderer.c
 @@ -39,7 +39,11 @@
  #include "GraphicsPrimitiveMgr.h"
  #include "glyphblitting.h"
@@ -19085,8 +19602,8 @@
  
  
  JNIEXPORT void JNICALL AWTDrawGlyphList
---- jdk/src/solaris/native/sun/java2d/j2d_md.h	2011-07-05 14:36:11.000000000 -0400
-+++ jdk/src/solaris/native/sun/java2d/j2d_md.h	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/java2d/j2d_md.h
++++ jdk/src/solaris/native/sun/java2d/j2d_md.h
 @@ -28,11 +28,11 @@
  #include <sys/types.h>
  
@@ -19102,8 +19619,8 @@
  
  typedef unsigned char   jubyte;
  typedef unsigned short  jushort;
---- jdk/src/solaris/native/sun/java2d/loops/mlib_ImageZoom_NN.c	2011-07-05 14:36:11.000000000 -0400
-+++ jdk/src/solaris/native/sun/java2d/loops/mlib_ImageZoom_NN.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/java2d/loops/mlib_ImageZoom_NN.c
++++ jdk/src/solaris/native/sun/java2d/loops/mlib_ImageZoom_NN.c
 @@ -66,6 +66,10 @@
   *    MLIB_EDGE_SRC_PADDED
   */
@@ -19209,8 +19726,8 @@
          LOGIC(da[0], dtmp, dtmp1, |);
        }
        else {                                               /* aligned */
---- jdk/src/solaris/native/sun/java2d/loops/vis_FuncArray.c	2011-07-05 14:36:12.000000000 -0400
-+++ jdk/src/solaris/native/sun/java2d/loops/vis_FuncArray.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/java2d/loops/vis_FuncArray.c
++++ jdk/src/solaris/native/sun/java2d/loops/vis_FuncArray.c
 @@ -794,7 +794,7 @@
  static int initialized;
  static int usevis = JNI_TRUE;
@@ -19220,8 +19737,8 @@
  #   define ULTRA_CHIP   "sparc64"
  #else
  #   define ULTRA_CHIP   "sun4u"
---- jdk/src/solaris/native/sun/java2d/opengl/OGLFuncs_md.h	2011-07-05 14:36:12.000000000 -0400
-+++ jdk/src/solaris/native/sun/java2d/opengl/OGLFuncs_md.h	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/java2d/opengl/OGLFuncs_md.h
++++ jdk/src/solaris/native/sun/java2d/opengl/OGLFuncs_md.h
 @@ -27,7 +27,10 @@
  #define OGLFuncs_md_h_Included
  
@@ -19242,8 +19759,8 @@
          } \
          OGL_LIB_HANDLE = dlopen(libGLPath, RTLD_LAZY | RTLD_LOCAL); \
      } \
---- jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c	2011-07-05 14:36:12.000000000 -0400
-+++ jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c
++++ jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c
 @@ -32,6 +32,7 @@
  #include "gdefs.h"
  
@@ -19261,8 +19778,8 @@
      }
      dgaAvailable = JNI_FALSE;
      if (lib != NULL) {
---- jdk/src/solaris/native/sun/jdga/dgalock.c	2011-07-05 14:36:12.000000000 -0400
-+++ jdk/src/solaris/native/sun/jdga/dgalock.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/jdga/dgalock.c
++++ jdk/src/solaris/native/sun/jdga/dgalock.c
 @@ -44,6 +44,7 @@
  #include <X11/Xlib.h>
  
@@ -19285,8 +19802,8 @@
              void *sym = dlsym(handle, "IsXineramaOn");
              IsXineramaOn = (IsXineramaOnFunc *)sym;
              if (IsXineramaOn != 0 && (*IsXineramaOn)(display)) {
---- jdk/src/solaris/native/sun/management/FileSystemImpl.c	2011-07-05 14:36:12.000000000 -0400
-+++ jdk/src/solaris/native/sun/management/FileSystemImpl.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/management/FileSystemImpl.c
++++ jdk/src/solaris/native/sun/management/FileSystemImpl.c
 @@ -26,6 +26,10 @@
  #include <sys/types.h>
  #include <sys/stat.h>
@@ -19298,8 +19815,8 @@
  #include "jni.h"
  #include "jni_util.h"
  #include "sun_management_FileSystemImpl.h"
---- jdk/src/solaris/native/sun/net/dns/ResolverConfigurationImpl.c	2011-07-05 14:36:12.000000000 -0400
-+++ jdk/src/solaris/native/sun/net/dns/ResolverConfigurationImpl.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/net/dns/ResolverConfigurationImpl.c
++++ jdk/src/solaris/native/sun/net/dns/ResolverConfigurationImpl.c
 @@ -33,7 +33,7 @@
  #include <strings.h>
  #endif
@@ -19309,8 +19826,8 @@
  #include <string.h>
  #endif
  
---- jdk/src/solaris/native/sun/net/spi/DefaultProxySelector.c	2011-07-05 14:36:12.000000000 -0400
-+++ jdk/src/solaris/native/sun/net/spi/DefaultProxySelector.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/net/spi/DefaultProxySelector.c
++++ jdk/src/solaris/native/sun/net/spi/DefaultProxySelector.c
 @@ -26,11 +26,12 @@
  #include "jni.h"
  #include "jni_util.h"
@@ -19337,8 +19854,8 @@
      gconf_ver = 2;
    }
    if (gconf_ver > 0) {
---- jdk/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c	2011-07-05 14:36:12.000000000 -0400
-+++ jdk/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c
++++ jdk/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c
 @@ -35,7 +35,7 @@
  #include <string.h>
  #include <errno.h>
@@ -19388,8 +19905,8 @@
      }
  #endif
  
---- jdk/src/solaris/native/sun/nio/ch/DatagramDispatcher.c	2011-07-05 14:36:12.000000000 -0400
-+++ jdk/src/solaris/native/sun/nio/ch/DatagramDispatcher.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/nio/ch/DatagramDispatcher.c
++++ jdk/src/solaris/native/sun/nio/ch/DatagramDispatcher.c
 @@ -72,7 +72,7 @@
      m.msg_accrightslen = 0;
  #endif
@@ -19408,8 +19925,8 @@
      m.msg_control = NULL;
      m.msg_controllen = 0;
  #endif
---- jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c	2011-07-05 14:36:12.000000000 -0400
-+++ jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c
++++ jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c
 @@ -26,15 +26,21 @@
  #include "jni.h"
  #include "jni_util.h"
@@ -19446,12 +19963,12 @@
 +#ifdef __APPLE__
 +typedef int sendfile_func(int fd, int s, off_t offset, off_t *len,
 +                          struct sf_hdtr *hdtr, int flags);
-+#elif defined(__MidnightBSD__)
++#elif defined(__FreeBSD__)
 +typedef int sendfile_func(int fd, int s, off_t offset, size_t nbytes,
 +                          struct sf_hdtr *hdtr, off_t *sbytes, int flags);
 +#endif
 +
-+#if defined(__APPLE__) || defined(__MidnightBSD__)
++#if defined(__APPLE__) || defined(__FreeBSD__)
 +sendfile_func* my_sendfile_func = NULL;
 +#endif
  #endif
@@ -19471,7 +19988,7 @@
      my_sendfile64_func = (sendfile64_func*) dlsym(RTLD_DEFAULT, "sendfile64");
  #endif
  
-+#if defined(__APPLE__) || defined(__MidnightBSD__)
++#if defined(__APPLE__) || defined(__FreeBSD__)
 +    my_sendfile_func = (sendfile_func*) dlsym(RTLD_DEFAULT, "sendfile");
 +#endif
 +
@@ -19484,7 +20001,7 @@
  #endif
 +
 +#ifdef _ALLBSD_SOURCE
-+#if defined(__APPLE__) || defined(__MidnightBSD__)
++#if defined(__APPLE__) || defined(__FreeBSD__)
 +    if (my_sendfile_func == NULL)
 +        return IOS_UNSUPPORTED;
 +
@@ -19496,7 +20013,7 @@
 +#ifdef __APPLE__
 +    result = (*my_sendfile_func)(srcFD, dstFD, position,
 +                                     &numBytes, NULL, 0);
-+#elif defined(__MidnightBSD__)
++#elif defined(__FreeBSD__)
 +    result = (*my_sendfile_func)(srcFD, dstFD, position,
 +                                     count, NULL, &numBytes, 0);
 +#else
@@ -19531,7 +20048,7 @@
      fl.l_start = (off64_t)pos;
      fl.l_type = F_UNLCK;
      lockResult = fcntl(fd, cmd, &fl);
-+#if defined(__MidnightBSD__) || defined(__OpenBSD__)
++#if defined(__FreeBSD__) || defined(__OpenBSD__)
 +    /* XXXFREEBSD:  While doing of preClose0() we're closing actual fd which
 +       was locked, so here we'll get an error which need to be ignored to
 +       satisfy TCK FileLock test */
@@ -19551,8 +20068,8 @@
      if (lockResult < 0) {
          JNU_ThrowIOExceptionWithLastError(env, "Release failed");
      }
---- jdk/src/solaris/native/sun/nio/ch/FileDispatcher.c	2011-07-05 14:36:12.000000000 -0400
-+++ jdk/src/solaris/native/sun/nio/ch/FileDispatcher.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/nio/ch/FileDispatcher.c
++++ jdk/src/solaris/native/sun/nio/ch/FileDispatcher.c
 @@ -32,8 +32,12 @@
  #include <sys/socket.h>
  #include <fcntl.h>
@@ -19566,8 +20083,8 @@
  
  static int preCloseFD = -1;     /* File descriptor to which we dup other fd's
                                     before closing them for real */
---- jdk/src/solaris/native/sun/nio/ch/FileKey.c	2011-07-05 14:36:12.000000000 -0400
-+++ jdk/src/solaris/native/sun/nio/ch/FileKey.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/nio/ch/FileKey.c
++++ jdk/src/solaris/native/sun/nio/ch/FileKey.c
 @@ -30,6 +30,10 @@
  #include "nio_util.h"
  #include "sun_nio_ch_FileKey.h"
@@ -19579,8 +20096,8 @@
  static jfieldID key_st_dev;    /* id for FileKey.st_dev */
  static jfieldID key_st_ino;    /* id for FileKey.st_ino */
  
---- jdk/src/solaris/native/sun/nio/ch/KqueueArrayWrapper.c	2011-07-07 19:17:04.000000000 -0400
-+++ jdk/src/solaris/native/sun/nio/ch/KqueueArrayWrapper.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/nio/ch/KqueueArrayWrapper.c	1969-12-31 19:00:00.000000000 -0500
++++ jdk/src/solaris/native/sun/nio/ch/KqueueArrayWrapper.c
 @@ -0,0 +1,186 @@
 +/*
 + * Scratched by davidxu at freebsd.org
@@ -19768,8 +20285,8 @@
 +#ifdef __cplusplus
 +}
 +#endif
---- jdk/src/solaris/native/sun/nio/ch/Net.c	2011-07-05 14:36:12.000000000 -0400
-+++ jdk/src/solaris/native/sun/nio/ch/Net.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/nio/ch/Net.c
++++ jdk/src/solaris/native/sun/nio/ch/Net.c
 @@ -60,17 +60,33 @@
                              jboolean reuse)
  {
@@ -19940,8 +20457,8 @@
          case ECONNREFUSED:
              xn = JNU_JAVANETPKG "ConnectException";
              break;
---- jdk/src/solaris/native/sun/security/jgss/wrapper/NativeFunc.c	2011-07-05 14:36:12.000000000 -0400
-+++ jdk/src/solaris/native/sun/security/jgss/wrapper/NativeFunc.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/security/jgss/wrapper/NativeFunc.c
++++ jdk/src/solaris/native/sun/security/jgss/wrapper/NativeFunc.c
 @@ -26,7 +26,9 @@
  #include <stdio.h>
  #include <stdlib.h>
@@ -19952,8 +20469,8 @@
  #include "NativeFunc.h"
  
  /* standard GSS method names (ordering is from mapfile) */
---- jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.c	2011-07-05 14:36:12.000000000 -0400
-+++ jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.c
++++ jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.c
 @@ -28,12 +28,19 @@
  #include <string.h>
  
@@ -19996,8 +20513,8 @@
      (*env)->ReleaseStringUTFChars(env, jLibName, libName);
      dprintf2("-handle: %u (0X%X)\n", hModule, hModule);
  
---- jdk/src/solaris/native/sun/security/pkcs11/wrapper/p11_md.c	2011-07-05 14:36:12.000000000 -0400
-+++ jdk/src/solaris/native/sun/security/pkcs11/wrapper/p11_md.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/security/pkcs11/wrapper/p11_md.c
++++ jdk/src/solaris/native/sun/security/pkcs11/wrapper/p11_md.c
 @@ -64,7 +64,9 @@
  #include <assert.h>
  
@@ -20008,8 +20525,8 @@
  
  #include <jni.h>
  
---- jdk/src/solaris/native/sun/security/smartcardio/pcsc_md.c	2011-07-05 14:36:12.000000000 -0400
-+++ jdk/src/solaris/native/sun/security/smartcardio/pcsc_md.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/security/smartcardio/pcsc_md.c
++++ jdk/src/solaris/native/sun/security/smartcardio/pcsc_md.c
 @@ -29,7 +29,9 @@
  #include <assert.h>
  
@@ -20020,8 +20537,8 @@
  
  #include <winscard.h>
  
---- jdk/src/solaris/native/sun/tools/attach/BsdVirtualMachine.c	2011-07-07 19:16:00.000000000 -0400
-+++ jdk/src/solaris/native/sun/tools/attach/BsdVirtualMachine.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/tools/attach/BsdVirtualMachine.c
++++ jdk/src/solaris/native/sun/tools/attach/BsdVirtualMachine.c
 @@ -35,10 +35,10 @@
  #include <dirent.h>
  #include <ctype.h>
@@ -20326,8 +20843,8 @@
 +        JNU_ReleaseStringPlatformChars(env, path, _path);
 +    }
 +}
---- jdk/src/solaris/native/sun/xawt/XWindow.c	2011-07-05 14:36:12.000000000 -0400
-+++ jdk/src/solaris/native/sun/xawt/XWindow.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/xawt/XWindow.c
++++ jdk/src/solaris/native/sun/xawt/XWindow.c
 @@ -228,10 +228,10 @@
      {java_awt_event_KeyEvent_VK_DOWN, XK_Down, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
  
@@ -20352,8 +20869,8 @@
      /* The following code on Linux will cause the keypad keys
       * not to echo on JTextField when the NumLock is on. The
       * keysyms will be 0, because the last parameter 2 is not defined.
---- jdk/src/solaris/native/sun/xawt/awt_Desktop.c	2011-07-05 14:36:12.000000000 -0400
-+++ jdk/src/solaris/native/sun/xawt/awt_Desktop.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/native/sun/xawt/awt_Desktop.c
++++ jdk/src/solaris/native/sun/xawt/awt_Desktop.c
 @@ -24,6 +24,7 @@
   */
  
@@ -20380,8 +20897,8 @@
      if (gnome_handle == NULL) {
  #ifdef INTERNAL_BUILD
          fprintf(stderr, "can not load libgnome-2.so\n");
---- jdk/src/solaris/npt/npt_md.h	2011-07-05 14:36:12.000000000 -0400
-+++ jdk/src/solaris/npt/npt_md.h	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/npt/npt_md.h
++++ jdk/src/solaris/npt/npt_md.h
 @@ -32,9 +32,10 @@
  #include <string.h>
  #include <errno.h>
@@ -20404,8 +20921,8 @@
          if ( _handle == NULL ) NPT_ERROR("Cannot open library");        \
          _sym = dlsym(_handle, "nptInitialize");                         \
          if ( _sym == NULL ) NPT_ERROR("Cannot find nptInitialize");     \
---- jdk/src/solaris/transport/socket/socket_md.c	2011-07-05 14:36:12.000000000 -0400
-+++ jdk/src/solaris/transport/socket/socket_md.c	2011-07-07 19:17:04.000000000 -0400
+--- jdk/src/solaris/transport/socket/socket_md.c
++++ jdk/src/solaris/transport/socket/socket_md.c
 @@ -36,7 +36,7 @@
  #ifdef __solaris__
  #include <thread.h>
@@ -20424,16 +20941,16 @@
  int
  dbgsysTlsAlloc() {
      pthread_key_t key;
---- langtools/src/share/classes/com/sun/tools/javah/Util.java	2011-07-05 14:36:55.000000000 -0400
-+++ langtools/src/share/classes/com/sun/tools/javah/Util.java	2011-07-07 19:17:04.000000000 -0400
+--- langtools/src/share/classes/com/sun/tools/javah/Util.java
++++ langtools/src/share/classes/com/sun/tools/javah/Util.java
 @@ -180,6 +180,14 @@
              os = "win32";
          } else if (os.indexOf("Linux") >= 0) {
              os = "Linux";
++	} else if (os.indexOf("FreeBSD") >= 0) {
++	    os = "FreeBSD";
 +	} else if (os.indexOf("MidnightBSD") >= 0) {
-+	    os = "MidnightBSD";
-+	} else if (os.indexOf("Darwin") >= 0) {
-+	    os = "Darwin";
++	    os = "FreeBSD";
 +	} else if (os.indexOf("NetBSD") >= 0) {
 +	    os = "NetBSD";
 +	} else if (os.indexOf("OpenBSD") >= 0) {


Property changes on: trunk/java/openjdk6/files/patch-set
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.2
\ No newline at end of property
Added: trunk/java/openjdk6/files/patch-sharedRuntime_x86_64.cpp
===================================================================
--- trunk/java/openjdk6/files/patch-sharedRuntime_x86_64.cpp	                        (rev 0)
+++ trunk/java/openjdk6/files/patch-sharedRuntime_x86_64.cpp	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,76 @@
+
+# HG changeset patch
+# User never
+# Date 1320440131 25200
+# Node ID 1feb272af3a704c03d544ef6c606db32049e492c
+# Parent 448691f285a54cd944c45c79ff0ba13ec8e3e205
+6636110: unaligned stackpointer leads to crash during deoptimization
+Reviewed-by: never, kvn
+Contributed-by: Andreas Schoesser <andreas.schoesser at sap.com>
+
+--- hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp.orig	Thu Nov 03 04:12:49 2011 -0700
++++ hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Fri Nov 04 13:55:31 2011 -0700
+@@ -2797,17 +2797,25 @@ void SharedRuntime::generate_deopt_blob(
+   // void Deoptimization::unpack_frames(JavaThread* thread, int exec_mode)
+ 
+   // Use rbp because the frames look interpreted now
+-  __ set_last_Java_frame(noreg, rbp, NULL);
+-
++  // Save "the_pc" since it cannot easily be retrieved using the last_java_SP after we aligned SP.
++  // Don't need the precise return PC here, just precise enough to point into this code blob.
++  address the_pc = __ pc();
++  __ set_last_Java_frame(noreg, rbp, the_pc);
++
++  __ andptr(rsp, -(StackAlignmentInBytes));  // Fix stack alignment as required by ABI
+   __ mov(c_rarg0, r15_thread);
+   __ movl(c_rarg1, r14); // second arg: exec_mode
+   __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::unpack_frames)));
++  // Revert SP alignment after call since we're going to do some SP relative addressing below
++  __ movptr(rsp, Address(r15_thread, JavaThread::last_Java_sp_offset()));
+ 
+   // Set an oopmap for the call site
+-  oop_maps->add_gc_map(__ pc() - start,
++  // Use the same PC we used for the last java frame
++  oop_maps->add_gc_map(the_pc - start,
+                        new OopMap( frame_size_in_words, 0 ));
+ 
+-  __ reset_last_Java_frame(true, false);
++  // Clear fp AND pc
++  __ reset_last_Java_frame(true, true);
+ 
+   // Collect return values
+   __ movdbl(xmm0, Address(rsp, RegisterSaver::xmm0_offset_in_bytes()));
+@@ -2968,7 +2976,10 @@ void SharedRuntime::generate_uncommon_tr
+                               // Prolog
+ 
+   // Use rbp because the frames look interpreted now
+-  __ set_last_Java_frame(noreg, rbp, NULL);
++  // Save "the_pc" since it cannot easily be retrieved using the last_java_SP after we aligned SP.
++  // Don't need the precise return PC here, just precise enough to point into this code blob.
++  address the_pc = __ pc();
++  __ set_last_Java_frame(noreg, rbp, the_pc);
+ 
+   // Call C code.  Need thread but NOT official VM entry
+   // crud.  We cannot block on this call, no GC can happen.  Call should
+@@ -2977,14 +2988,17 @@ void SharedRuntime::generate_uncommon_tr
+   //
+   // BasicType unpack_frames(JavaThread* thread, int exec_mode);
+ 
++  __ andptr(rsp, -(StackAlignmentInBytes)); // Align SP as required by ABI
+   __ mov(c_rarg0, r15_thread);
+   __ movl(c_rarg1, Deoptimization::Unpack_uncommon_trap);
+   __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::unpack_frames)));
+ 
+   // Set an oopmap for the call site
+-  oop_maps->add_gc_map(__ pc() - start, new OopMap(SimpleRuntimeFrame::framesize, 0));
+-
+-  __ reset_last_Java_frame(true, false);
++  // Use the same PC we used for the last java frame
++  oop_maps->add_gc_map(the_pc - start, new OopMap(SimpleRuntimeFrame::framesize, 0));
++
++  // Clear fp AND pc
++  __ reset_last_Java_frame(true, true);
+ 
+   // Pop self-frame.
+   __ leave();                 // Epilog
+

Modified: trunk/java/openjdk6/files/patch-test
===================================================================
--- trunk/java/openjdk6/files/patch-test	2013-09-17 02:40:23 UTC (rev 15459)
+++ trunk/java/openjdk6/files/patch-test	2013-09-17 03:10:26 UTC (rev 15460)
@@ -1,5 +1,113 @@
---- jdk/test/java/nio/channels/SocketChannel/LocalAddress.java.orig	2010-01-18 12:03:26.000000000 +0100
-+++ jdk/test/java/nio/channels/SocketChannel/LocalAddress.java	2010-01-18 12:03:42.000000000 +0100
+--- jdk/test/TestEnv.java	2012-05-01 17:18:38.000000000 -0400
++++ jdk/test/TestEnv.java	2012-09-26 19:07:59.000000000 -0400
+@@ -65,14 +65,14 @@
+         // Reachable host with the following services running:
+         // - echo service (port 7)
+         // - day time port (port 13)
+-        { "host", "javaweb.sfbay.sun.com"  },
++        { "host", "icedtea.classpath.org"  },
+ 
+         // Reachable host that refuses connections to port 80
+-        { "refusing_host", "jano1.sfbay.sun.com" },
++        { "refusing_host", "ns1.gnu.org" },
+ 
+         // Reachable host that is of sufficient hops away that a connection
+         // takes a while to be established (connect doesn't complete immediatly)
+-        { "far_host", "irejano.ireland.sun.com" },
++        { "far_host", "developer.classpath.org" },
+ 
+         // Hostname that cannot be resolved by named service
+         { "unresovable_host", "blah-blah.blah-blah.blah" },
+--- jdk/test/com/sun/management/OperatingSystemMXBean/TestTotalSwap.sh	2012-09-26 19:05:45.000000000 -0400
++++ jdk/test/com/sun/management/OperatingSystemMXBean/TestTotalSwap.sh	2012-09-26 19:07:59.000000000 -0400
+@@ -72,6 +72,16 @@
+    done
+ }
+ 
++freebsd_swap_size()
++{
++   total_swap=0
++   for i in `/usr/sbin/swapinfo -k | awk '{print $2}' | grep -v blocks`
++   do
++      # swapinfo -k returns size in blocks of 1024 bytes.
++      total_swap=`expr $i \* 1024 + $total_swap`
++   done
++}
++
+ # Test GetTotalSwapSpaceSize if we are running on Unix
+ total_swap=0
+ case `uname -s` in
+@@ -80,7 +90,7 @@
+        runOne GetTotalSwapSpaceSize $total_swap 
+        ;;
+      FreeBSD )
+-       total_swap=`free -b | grep -i swap | awk '{print $2}'`
++       freebsd_swap_size
+        runOne GetTotalSwapSpaceSize $total_swap 
+        ;;
+     * )
+--- jdk/test/java/io/File/GetXSpace.java	2012-05-01 17:18:41.000000000 -0400
++++ jdk/test/java/io/File/GetXSpace.java	2012-09-26 19:07:59.000000000 -0400
+@@ -49,7 +49,7 @@
+     private static final String name = System.getProperty("os.name");
+     private static final String dfFormat;
+     static {
+-        if (name.equals("SunOS") || name.equals("Linux")) {
++        if (name.equals("FreeBSD") || name.equals("SunOS") || name.equals("Linux")) {
+             // FileSystem Total Used Available Use% MountedOn
+             dfFormat = "([^\\s]+)\\s+(\\d+)\\s+\\d+\\s+(\\d+)\\s+\\d+%\\s+([^\\s]+)";
+         } else if (name.startsWith("Windows")) {
+--- jdk/test/java/lang/ProcessBuilder/Basic.java	2012-05-01 17:18:42.000000000 -0400
++++ jdk/test/java/lang/ProcessBuilder/Basic.java	2012-09-26 19:07:59.000000000 -0400
+@@ -1096,7 +1096,7 @@
+             String[] cmdp = childArgs.toArray(new String[childArgs.size()]);
+             String[] envp = {"=ExitValue=3", "=C:=\\"};
+             Process p = Runtime.getRuntime().exec(cmdp, envp);
+-            String expected = Windows.is() ? "=C:=\\,=ExitValue=3," : "=C:=\\,";
++            String expected = Windows.is() ? "=C:=\\,=ExitValue=3," : "";
+             equal(commandOutput(p), expected);
+             if (Windows.is()) {
+                 ProcessBuilder pb = new ProcessBuilder(childArgs);
+--- jdk/test/java/lang/ProcessBuilder/Zombies.java	2012-05-01 17:18:42.000000000 -0400
++++ jdk/test/java/lang/ProcessBuilder/Zombies.java	2012-09-26 19:07:59.000000000 -0400
+@@ -49,11 +49,11 @@
+         } catch (IOException _) {/* OK */}
+ 
+         try {
+-            rt.exec("/bin/true", null, new File("no-such-dir"));
++            rt.exec("/usr/bin/true", null, new File("no-such-dir"));
+             throw new Error("expected IOException not thrown");
+         } catch (IOException _) {/* OK */}
+ 
+-        rt.exec("/bin/true").waitFor();
++        rt.exec("/usr/bin/true").waitFor();
+ 
+         // Count all the zombies that are children of this Java process
+         final String[] zombieCounter = {
+--- jdk/test/java/lang/management/OperatingSystemMXBean/GetSystemLoadAverage.java	2012-05-01 17:18:43.000000000 -0400
++++ jdk/test/java/lang/management/OperatingSystemMXBean/GetSystemLoadAverage.java	2012-09-26 19:07:59.000000000 -0400
+@@ -79,7 +79,7 @@
+         System.out.println("Test passed.");
+     }
+ 
+-    private static String LOAD_AVERAGE_TEXT = "load average:";
++    private static String LOAD_AVERAGE_TEXT = "load averages:";
+     private static void checkLoadAvg() throws Exception {
+         // Obtain load average from OS command
+         ProcessBuilder pb = new ProcessBuilder("/usr/bin/uptime");
+--- jdk/test/java/net/ServerSocket/AcceptCauseFileDescriptorLeak.java	2012-05-01 17:18:44.000000000 -0400
++++ jdk/test/java/net/ServerSocket/AcceptCauseFileDescriptorLeak.java	2012-09-26 19:07:59.000000000 -0400
+@@ -79,7 +79,7 @@
+      * on Windows, too.
+      */
+     private static int countOpenFD() {
+-        File dirOfFD = new File("/proc/self/fd");
++        File dirOfFD = new File("/dev/fd");
+         File[] fds = dirOfFD.listFiles();
+ 
+         if (fds != null)
+--- jdk/test/java/nio/channels/SocketChannel/LocalAddress.java	2012-05-01 17:18:45.000000000 -0400
++++ jdk/test/java/nio/channels/SocketChannel/LocalAddress.java	2012-09-26 19:07:59.000000000 -0400
 @@ -40,7 +40,7 @@
          InetAddress bogus = InetAddress.getByName("0.0.0.0");
          SocketChannel sc = SocketChannel.open();
@@ -9,8 +117,8 @@
  
          //Test1: connect only
          sc.connect(saddr);
---- jdk/test/java/nio/channels/SocketChannel/Shutdown.java.orig	2010-01-18 12:04:09.000000000 +0100
-+++ jdk/test/java/nio/channels/SocketChannel/Shutdown.java	2010-01-18 12:04:20.000000000 +0100
+--- jdk/test/java/nio/channels/SocketChannel/Shutdown.java	2012-05-01 17:18:45.000000000 -0400
++++ jdk/test/java/nio/channels/SocketChannel/Shutdown.java	2012-09-26 19:07:59.000000000 -0400
 @@ -35,7 +35,7 @@
  
      public static void main(String args[]) throws Exception {
@@ -20,8 +128,54 @@
          SocketChannel sc = SocketChannel.open(sa);
          boolean before = sc.socket().isInputShutdown();
          sc.socket().shutdownInput();
---- jdk/test/sun/net/InetAddress/nameservice/dns/cname.sh.orig	2010-01-18 12:04:54.000000000 +0100
-+++ jdk/test/sun/net/InetAddress/nameservice/dns/cname.sh	2010-01-18 12:05:15.000000000 +0100
+--- jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/Launcher.c	2012-05-01 17:18:45.000000000 -0400
++++ jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/Launcher.c	2012-09-26 19:07:59.000000000 -0400
+@@ -135,7 +135,7 @@
+     }
+     close(thisFd);
+ 
+-    if ((dp = opendir("/proc/self/fd")) == NULL) {
++    if ((dp = opendir("/dev/fd")) == NULL) {
+         _exit(-1);
+     }
+ 
+--- jdk/test/java/nio/charset/Charset/default.sh	2012-09-26 19:05:46.000000000 -0400
++++ jdk/test/java/nio/charset/Charset/default.sh	2012-09-26 19:07:59.000000000 -0400
+@@ -76,22 +76,20 @@
+ 
+ }
+ 
+-go  en_US       iso-8859-1
+-go  ja_JP.utf8  utf-8
+-go  tr_TR       iso-8859-9
+-go  C           us-ascii
++go  en_US            iso-8859-1
++go  ja_JP.UTF-8      utf-8
++go  tr_TR.ISO-8859-9 iso-8859-9
++go  C                iso-8859-1
+ 
++# FreeBSD
+ if [ "$s" = FreeBSD ]; then
+-  go  ja_JP        x-euc-jp-linux
+-  go  ja_JP.eucjp  x-euc-jp-linux
+-  go  ja_JP.ujis   x-euc-jp-linux
+-  go  ja_JP.utf8   utf-8
++  go  ja_JP.eucJP    euc-jp
++  go  ja_JP.SJIS     shift_jis
+ fi
+ 
+ # Solaris
+ if [ "$s" = SunOS ]; then
+-  go  ja           x-eucjp-open
+-  go  ja_JP.eucJP  x-eucjp-open
+-  go  ja_JP.PCK    x-PCK
+-  go  ja_JP.UTF-8  utf-8
++  go  ja             x-eucjp-open
++  go  ja_JP.eucJP    x-eucjp-open
++  go  ja_JP.PCK      x-PCK
+ fi
+--- jdk/test/sun/net/InetAddress/nameservice/dns/cname.sh	2012-09-26 19:05:47.000000000 -0400
++++ jdk/test/sun/net/InetAddress/nameservice/dns/cname.sh	2012-09-26 19:07:59.000000000 -0400
 @@ -33,7 +33,7 @@
  
  # The host that we try to resolve
@@ -31,48 +185,17 @@
  
  # fail gracefully if DNS is not configured or there 
  # isn't a CNAME record.
---- jdk/test/TestEnv.java.orig	2010-01-18 12:05:45.000000000 +0100
-+++ jdk/test/TestEnv.java	2010-01-18 12:06:40.000000000 +0100
-@@ -65,14 +65,14 @@
-         // Reachable host with the following services running:
-         // - echo service (port 7)
-         // - day time port (port 13)
--        { "host", "javaweb.sfbay.sun.com"  },
-+        { "host", "icedtea.classpath.org"  },
- 
-         // Reachable host that refuses connections to port 80
--        { "refusing_host", "jano1.sfbay.sun.com" },
-+        { "refusing_host", "ns1.gnu.org" },
- 
-         // Reachable host that is of sufficient hops away that a connection
-         // takes a while to be established (connect doesn't complete immediatly)
--        { "far_host", "irejano.ireland.sun.com" },
-+        { "far_host", "developer.classpath.org" },
- 
-         // Hostname that cannot be resolved by named service
-         { "unresovable_host", "blah-blah.blah-blah.blah" },
---- jdk/test/java/io/File/GetXSpace.java.orig	2010-01-20 14:12:07.000000000 +0100
-+++ jdk/test/java/io/File/GetXSpace.java	2010-01-20 14:12:25.000000000 +0100
-@@ -49,7 +49,7 @@
-     private static final String name = System.getProperty("os.name");
-     private static final String dfFormat;
-     static {
--        if (name.equals("SunOS") || name.equals("Linux")) {
-+        if (name.equals("MidnightBSD") || name.equals("SunOS") || name.equals("Linux")) {
-             // FileSystem Total Used Available Use% MountedOn
-             dfFormat = "([^\\s]+)\\s+(\\d+)\\s+\\d+\\s+(\\d+)\\s+\\d+%\\s+([^\\s]+)";
-         } else if (name.startsWith("Windows")) {
---- jdk/test/tools/pack200/MemoryAllocatorTest.java.orig	2010-01-20 14:47:29.000000000 +0100
-+++ jdk/test/tools/pack200/MemoryAllocatorTest.java	2010-01-20 14:48:02.000000000 +0100
+--- jdk/test/tools/pack200/MemoryAllocatorTest.java	2012-05-01 17:18:53.000000000 -0400
++++ jdk/test/tools/pack200/MemoryAllocatorTest.java	2012-09-26 19:07:59.000000000 -0400
 @@ -81,6 +81,7 @@
  
      static final boolean debug = Boolean.getBoolean("MemoryAllocatorTest.Debug");
      static final boolean WINDOWS = System.getProperty("os.name").startsWith("Windows");
-+    static final boolean FREEBSD = System.getProperty("os.name").startsWith("MidnightBSD");
++    static final boolean FREEBSD = System.getProperty("os.name").startsWith("FreeBSD");
      static final boolean LINUX = System.getProperty("os.name").startsWith("Linux");
      static final boolean SIXTYFOUR_BIT = System.getProperty("sun.arch.data.model", "32").equals("64");
      static final private int NATIVE_EXPECTED_EXIT_CODE = (WINDOWS) ? -1 : 255;
-@@ -424,7 +425,7 @@
+@@ -425,7 +426,7 @@
           * the error message is not accurate for us to discern if the test
           * passes successfully.
           */
@@ -81,8 +204,8 @@
              System.out.println("Warning: Windows/Linux 64bit tests passes vacuously");
              return;
          }
---- jdk/test/tools/pack200/Pack200Simple.sh.orig	2010-01-20 14:48:44.000000000 +0100
-+++ jdk/test/tools/pack200/Pack200Simple.sh	2010-01-20 14:50:05.000000000 +0100
+--- jdk/test/tools/pack200/Pack200Simple.sh	2012-09-26 19:05:49.000000000 -0400
++++ jdk/test/tools/pack200/Pack200Simple.sh	2012-09-26 19:07:59.000000000 -0400
 @@ -134,7 +134,7 @@
    # A quick crc compare test to ensure a well formed zip
    # archive, this is a critical unpack200 behaviour.
@@ -92,41 +215,3 @@
    if [ $? != 0 ]; then
      errorOut "$jfName unzip -t test failed"
    fi
---- jdk/test/java/lang/ProcessBuilder/Zombies.java.orig	2010-01-20 15:54:25.000000000 +0100
-+++ jdk/test/java/lang/ProcessBuilder/Zombies.java	2010-01-20 15:54:41.000000000 +0100
-@@ -49,11 +49,11 @@
-         } catch (IOException _) {/* OK */}
- 
-         try {
--            rt.exec("/bin/true", null, new File("no-such-dir"));
-+            rt.exec("/usr/bin/true", null, new File("no-such-dir"));
-             throw new Error("expected IOException not thrown");
-         } catch (IOException _) {/* OK */}
- 
--        rt.exec("/bin/true").waitFor();
-+        rt.exec("/usr/bin/true").waitFor();
- 
-         // Count all the zombies that are children of this Java process
-         final String[] zombieCounter = {
---- jdk/test/java/lang/ProcessBuilder/Basic.java.orig	2010-01-20 16:02:00.000000000 +0100
-+++ jdk/test/java/lang/ProcessBuilder/Basic.java	2010-01-20 16:05:07.000000000 +0100
-@@ -1096,7 +1096,7 @@
-             String[] cmdp = childArgs.toArray(new String[childArgs.size()]);
-             String[] envp = {"=ExitValue=3", "=C:=\\"};
-             Process p = Runtime.getRuntime().exec(cmdp, envp);
--            String expected = Windows.is() ? "=C:=\\,=ExitValue=3," : "=C:=\\,";
-+            String expected = Windows.is() ? "=C:=\\,=ExitValue=3," : "";
-             equal(commandOutput(p), expected);
-             if (Windows.is()) {
-                 ProcessBuilder pb = new ProcessBuilder(childArgs);
---- jdk/test/java/lang/management/OperatingSystemMXBean/GetSystemLoadAverage.java.orig	2010-01-20 16:17:05.000000000 +0100
-+++ jdk/test/java/lang/management/OperatingSystemMXBean/GetSystemLoadAverage.java	2010-01-20 16:19:55.000000000 +0100
-@@ -79,7 +79,7 @@
-         System.out.println("Test passed.");
-     }
- 
--    private static String LOAD_AVERAGE_TEXT = "load average:";
-+    private static String LOAD_AVERAGE_TEXT = "load averages:";
-     private static void checkLoadAvg() throws Exception {
-         // Obtain load average from OS command
-         ProcessBuilder pb = new ProcessBuilder("/usr/bin/uptime");


Property changes on: trunk/java/openjdk6/files/patch-test
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.1
\ No newline at end of property
Added: trunk/java/openjdk6/files/test_gamma-disable.patch
===================================================================
--- trunk/java/openjdk6/files/test_gamma-disable.patch	                        (rev 0)
+++ trunk/java/openjdk6/files/test_gamma-disable.patch	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,45 @@
+--- hotspot/make/bsd/Makefile
++++ hotspot/make/bsd/Makefile
+@@ -287,42 +288,36 @@
+ 
+ $(TARGETS_C2):  $(SUBDIRS_C2)
+ 	cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS)
+-	cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && ./test_gamma
+ ifdef INSTALL
+ 	cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS) install
+ endif
+ 
+ $(TARGETS_TIERED):  $(SUBDIRS_TIERED)
+ 	cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && $(MAKE) $(MFLAGS)
+-	cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && ./test_gamma
+ ifdef INSTALL
+ 	cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && $(MAKE) $(MFLAGS) install
+ endif
+ 
+ $(TARGETS_C1):  $(SUBDIRS_C1)
+ 	cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && $(MAKE) $(MFLAGS)
+-	cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && ./test_gamma
+ ifdef INSTALL
+ 	cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && $(MAKE) $(MFLAGS) install
+ endif
+ 
+ $(TARGETS_CORE):  $(SUBDIRS_CORE)
+ 	cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS)
+-	cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && ./test_gamma
+ ifdef INSTALL
+ 	cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS) install
+ endif
+ 
+ $(TARGETS_ZERO):  $(SUBDIRS_ZERO)
+ 	cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && $(MAKE) $(MFLAGS)
+-	cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && ./test_gamma
+ ifdef INSTALL
+ 	cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && $(MAKE) $(MFLAGS) install
+ endif
+ 
+ $(TARGETS_SHARK):  $(SUBDIRS_SHARK)
+ 	cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && $(MAKE) $(MFLAGS)
+-	cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && ./test_gamma
+ ifdef INSTALL
+ 	cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && $(MAKE) $(MFLAGS) install
+ endif

Index: trunk/java/openjdk6/pkg-descr
===================================================================
--- trunk/java/openjdk6/pkg-descr	2013-09-17 02:40:23 UTC (rev 15459)
+++ trunk/java/openjdk6/pkg-descr	2013-09-17 03:10:26 UTC (rev 15460)

Property changes on: trunk/java/openjdk6/pkg-descr
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.3
\ No newline at end of property
Added: trunk/java/openjdk6/pkg-message
===================================================================
--- trunk/java/openjdk6/pkg-message	                        (rev 0)
+++ trunk/java/openjdk6/pkg-message	2013-09-17 03:10:26 UTC (rev 15460)
@@ -0,0 +1,16 @@
+======================================================================
+
+This OpenJDK implementation requires fdescfs(5) mounted on /dev/fd and
+procfs(5) mounted on /proc.
+
+If you have not done it yet, please do the following:
+
+	mount -t fdescfs fdesc /dev/fd
+	mount -t procfs proc /proc
+
+To make it permanent, you need the following lines in /etc/fstab:
+
+	fdesc	/dev/fd		fdescfs		rw	0	0
+	proc	/proc		procfs		rw	0	0
+
+======================================================================



More information about the Midnightbsd-cvs mailing list