diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2013-07-16 21:07:25 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2013-07-16 21:07:25 +0000 |
commit | ab26ef78141c6d3e19e8011b7d5e5570b4e53f59 (patch) | |
tree | 2f06d03438c702d537ce93a79f7930297e601de0 /java | |
parent | d4ba53c21b0562e38efb63ad24e759affc801801 (diff) | |
download | ports-ab26ef78141c6d3e19e8011b7d5e5570b4e53f59.tar.gz ports-ab26ef78141c6d3e19e8011b7d5e5570b4e53f59.zip |
Notes
Diffstat (limited to 'java')
81 files changed, 91164 insertions, 85 deletions
diff --git a/java/openjdk6/Makefile b/java/openjdk6/Makefile index e17fcccd7687..e98cef1bfbfa 100644 --- a/java/openjdk6/Makefile +++ b/java/openjdk6/Makefile @@ -3,7 +3,7 @@ PORTNAME= openjdk6 PORTVERSION= b27 -PORTREVISION?= 3 +PORTREVISION?= 4 CATEGORIES= java devel MASTER_SITES= http://download.java.net/openjdk/jdk6/promoted/${PORTVERSION}/ \ http://download.java.net/jaxp/openjdk/jdk6/:jaxp \ @@ -39,84 +39,6 @@ RUN_DEPENDS= javavm:${PORTSDIR}/java/javavmwrapper \ OPENJDK_BUILDDATE= 26_oct_2012 -EXTRA_PATCHES= ${FILESDIR}/icedtea/jaxp.patch \ - ${FILESDIR}/icedtea/jaxws.patch \ - ${FILESDIR}/icedtea/security/20120830/7182135-impossible_to_use_some_editors_directly.patch \ - ${FILESDIR}/icedtea/security/20130201/7201068.patch \ - ${FILESDIR}/icedtea/security/20130201/6563318.patch \ - ${FILESDIR}/icedtea/security/20130201/6664509.patch \ - ${FILESDIR}/icedtea/security/20130201/6776941.patch \ - ${FILESDIR}/icedtea/security/20130201/7141694.patch \ - ${FILESDIR}/icedtea/security/20130201/7173145.patch \ - ${FILESDIR}/icedtea/security/20130201/7186945.patch \ - ${FILESDIR}/icedtea/security/20130201/7186948.patch \ - ${FILESDIR}/icedtea/security/20130201/7186952.patch \ - ${FILESDIR}/icedtea/security/20130201/7186954.patch \ - ${FILESDIR}/icedtea/security/20130201/7192392.patch \ - ${FILESDIR}/icedtea/security/20130201/7192393.patch \ - ${FILESDIR}/icedtea/security/20130201/7192977.patch \ - ${FILESDIR}/icedtea/security/20130201/7197546.patch \ - ${FILESDIR}/icedtea/security/20130201/7200491.patch \ - ${FILESDIR}/icedtea/security/20130201/7200500.patch \ - ${FILESDIR}/icedtea/security/20130201/7201064.patch \ - ${FILESDIR}/icedtea/security/20130201/7201066.patch \ - ${FILESDIR}/icedtea/security/20130201/7201070.patch \ - ${FILESDIR}/icedtea/security/20130201/7201071.patch \ - ${FILESDIR}/icedtea/security/20130201/8000210.patch \ - ${FILESDIR}/icedtea/security/20130201/8000537.patch \ - ${FILESDIR}/icedtea/security/20130201/8000540.patch \ - ${FILESDIR}/icedtea/security/20130201/8000631.patch \ - ${FILESDIR}/icedtea/security/20130201/8001242.patch \ - ${FILESDIR}/icedtea/security/20130201/8001307.patch \ - ${FILESDIR}/icedtea/security/20130201/8001972.patch \ - ${FILESDIR}/icedtea/security/20130201/8002325.patch \ - ${FILESDIR}/icedtea/security/20130219/8006446.patch \ - ${FILESDIR}/icedtea/security/20130219/8006777.patch \ - ${FILESDIR}/icedtea/security/20130219/8007688.patch \ - ${FILESDIR}/icedtea/security/20130304/8007014.patch \ - ${FILESDIR}/icedtea/security/20130304/8007675.patch \ - ${FILESDIR}/icedtea/openjdk/7036559-concurrenthashmap_improvements.patch \ - ${FILESDIR}/icedtea/security/20130416/8009063.patch \ - ${FILESDIR}/icedtea/openjdk/8004302-soap_test_failure.patch \ - ${FILESDIR}/icedtea/security/20130416/6657673.patch \ - ${FILESDIR}/icedtea/security/20130416/6657673-fixup.patch \ - ${FILESDIR}/icedtea/openjdk/7133220-factory_finder_parser_transform_useBSClassLoader.patch \ - ${FILESDIR}/icedtea/security/20130416/6657673-factory_finder.patch \ - ${FILESDIR}/icedtea/openjdk/6669869-queries_per_appcontext.patch \ - ${FILESDIR}/icedtea/openjdk/5102804-memory_leak.patch \ - ${FILESDIR}/icedtea/openjdk/6963811-deadlock_fix.patch \ - ${FILESDIR}/icedtea/openjdk/7064279-resource_release.patch \ - ${FILESDIR}/icedtea/openjdk/7064279-fixup.patch \ - ${FILESDIR}/icedtea/security/20130416/7200507.patch \ - ${FILESDIR}/icedtea/security/20130416/8000724.patch \ - ${FILESDIR}/icedtea/security/20130416/8004986.patch \ - ${FILESDIR}/icedtea/openjdk/6501644-icu_sync.patch \ - ${FILESDIR}/icedtea/openjdk/6886358-layout_update.patch \ - ${FILESDIR}/icedtea/security/20130416/8001031.patch \ - ${FILESDIR}/icedtea/openjdk/7017324-kerning_crash.patch \ - ${FILESDIR}/icedtea/security/20130416/8001040.patch \ - ${FILESDIR}/icedtea/security/20130416/8001322.patch \ - ${FILESDIR}/icedtea/security/20130416/8001329.patch \ - ${FILESDIR}/icedtea/security/20130416/8003335.patch \ - ${FILESDIR}/icedtea/security/20130416/8003445.patch \ - ${FILESDIR}/icedtea/security/20130416/8003543.patch \ - ${FILESDIR}/icedtea/security/20130416/8004261.patch \ - ${FILESDIR}/icedtea/security/20130416/8004336.patch \ - ${FILESDIR}/icedtea/security/20130416/8005432.patch \ - ${FILESDIR}/icedtea/security/20130416/8005943.patch \ - ${FILESDIR}/icedtea/security/20130416/8006309.patch \ - ${FILESDIR}/icedtea/security/20130416/8006435.patch \ - ${FILESDIR}/icedtea/security/20130416/8006790.patch \ - ${FILESDIR}/icedtea/security/20130416/8006795.patch \ - ${FILESDIR}/icedtea/security/20130416/8007406.patch \ - ${FILESDIR}/icedtea/security/20130416/8007617.patch \ - ${FILESDIR}/icedtea/security/20130416/8007667.patch \ - ${FILESDIR}/icedtea/security/20130416/8007918.patch \ - ${FILESDIR}/icedtea/security/20130416/8009305.patch \ - ${FILESDIR}/icedtea/security/20130416/8009699.patch \ - ${FILESDIR}/icedtea/security/20130416/8009814.patch \ - ${FILESDIR}/icedtea/security/20130416/8009857.patch - OPTIONS_DEFINE= ICEDTEA IPV6 POLICY SOUND TZUPDATE OPTIONS_DEFAULT=ICEDTEA IPV6 TZUPDATE ICEDTEA_DESC= Apply additional patches from IcedTea @@ -134,6 +56,9 @@ TEST_DESC= Add support for running regression test USES= gmake motif .include <bsd.port.options.mk> +.include "${.CURDIR}/Makefile.icedtea" + +EXTRA_PATCHES= ${ICEDTEA_PATCHES} # java extracts directly to the cwd WRKSRC= ${WRKDIR} @@ -231,12 +156,6 @@ MAKE_ENV+= SKIP_FASTDEBUG_BUILD=false MAKE_ENV+= SKIP_FASTDEBUG_BUILD=true .endif -.if ${PORT_OPTIONS:MICEDTEA} -EXTRA_PATCHES+= ${FILESDIR}/icedtea/openjdk/7032388-work_without_cmov_instruction.patch \ - ${FILESDIR}/icedtea/applet_hole.patch \ - ${FILESDIR}/icedtea/jpegclasses.patch -.endif - .if empty(PORT_OPTIONS:MIPV6) MAKE_ENV+= DONT_ENABLE_IPV6="YES" .endif diff --git a/java/openjdk6/Makefile.icedtea b/java/openjdk6/Makefile.icedtea new file mode 100644 index 000000000000..2e666f8c6aa5 --- /dev/null +++ b/java/openjdk6/Makefile.icedtea @@ -0,0 +1,170 @@ +# $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+= \ + openjdk/7032388-work_without_cmov_instruction.patch \ + applet_hole.patch \ + jpegclasses.patch +.endif + +.for p in ${_PATCHES} +ICEDTEA_PATCHES+= ${FILESDIR}/icedtea/${p} +.endfor diff --git a/java/openjdk6/files/icedtea/openjdk/6469266-xmlsec_1.4.2.patch b/java/openjdk6/files/icedtea/openjdk/6469266-xmlsec_1.4.2.patch new file mode 100644 index 000000000000..eb64e0a61366 --- /dev/null +++ b/java/openjdk6/files/icedtea/openjdk/6469266-xmlsec_1.4.2.patch @@ -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@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@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@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()); diff --git a/java/openjdk6/files/icedtea/openjdk/6786028-wcag_bold_tags.patch b/java/openjdk6/files/icedtea/openjdk/6786028-wcag_bold_tags.patch new file mode 100644 index 000000000000..06392d278b3e --- /dev/null +++ b/java/openjdk6/files/icedtea/openjdk/6786028-wcag_bold_tags.patch @@ -0,0 +1,2914 @@ +# 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) " + diff --git a/java/openjdk6/files/icedtea/openjdk/6786682-wcag_lang.patch b/java/openjdk6/files/icedtea/openjdk/6786682-wcag_lang.patch new file mode 100644 index 000000000000..7bf290c8dae5 --- /dev/null +++ b/java/openjdk6/files/icedtea/openjdk/6786682-wcag_lang.patch @@ -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 {} diff --git a/java/openjdk6/files/icedtea/openjdk/6786688-wcag_table.patch b/java/openjdk6/files/icedtea/openjdk/6786688-wcag_table.patch new file mode 100644 index 000000000000..fb0dc47d499a --- /dev/null +++ b/java/openjdk6/files/icedtea/openjdk/6786688-wcag_table.patch @@ -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; + diff --git a/java/openjdk6/files/icedtea/openjdk/6786690-wcag_dl.patch b/java/openjdk6/files/icedtea/openjdk/6786690-wcag_dl.patch new file mode 100644 index 000000000000..1e85fea140d3 --- /dev/null +++ b/java/openjdk6/files/icedtea/openjdk/6786690-wcag_dl.patch @@ -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 ++ */ ++@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. ++ */ ++@Documented ++@Retention(RetentionPolicy.RUNTIME) ++@Target(ElementType.TYPE) ++@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. ++ */ ++@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; diff --git a/java/openjdk6/files/icedtea/openjdk/6802694-no_deprecated.patch b/java/openjdk6/files/icedtea/openjdk/6802694-no_deprecated.patch new file mode 100644 index 000000000000..ba797822c5e4 --- /dev/null +++ b/java/openjdk6/files/icedtea/openjdk/6802694-no_deprecated.patch @@ -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. ++ */ ++@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() { ++ ++ } ++} diff --git a/java/openjdk6/files/icedtea/openjdk/6851834-handle_renames.patch b/java/openjdk6/files/icedtea/openjdk/6851834-handle_renames.patch new file mode 100644 index 000000000000..0b9d615e7b91 --- /dev/null +++ b/java/openjdk6/files/icedtea/openjdk/6851834-handle_renames.patch @@ -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(); +- } +-} diff --git a/java/openjdk6/files/icedtea/openjdk/6851834-restructure.patch b/java/openjdk6/files/icedtea/openjdk/6851834-restructure.patch new file mode 100644 index 000000000000..66011ee8189e --- /dev/null +++ b/java/openjdk6/files/icedtea/openjdk/6851834-restructure.patch @@ -0,0 +1,26853 @@ +# 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; diff --git a/java/openjdk6/files/icedtea/openjdk/6888167-medialib_memory_leaks.patch b/java/openjdk6/files/icedtea/openjdk/6888167-medialib_memory_leaks.patch new file mode 100644 index 000000000000..0d34b1ae4100 --- /dev/null +++ b/java/openjdk6/files/icedtea/openjdk/6888167-medialib_memory_leaks.patch @@ -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; + } + diff --git a/java/openjdk6/files/icedtea/openjdk/6961178-doclet_xml.patch b/java/openjdk6/files/icedtea/openjdk/6961178-doclet_xml.patch new file mode 100644 index 000000000000..dccc894c9ddb --- /dev/null +++ b/java/openjdk6/files/icedtea/openjdk/6961178-doclet_xml.patch @@ -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; ++} diff --git a/java/openjdk6/files/icedtea/openjdk/7006270-regressions.patch b/java/openjdk6/files/icedtea/openjdk/7006270-regressions.patch new file mode 100644 index 000000000000..1a71b415bdee --- /dev/null +++ b/java/openjdk6/files/icedtea/openjdk/7006270-regressions.patch @@ -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(); + } + } diff --git a/java/openjdk6/files/icedtea/openjdk/7195301-no_instanceof_node.patch b/java/openjdk6/files/icedtea/openjdk/7195301-no_instanceof_node.patch new file mode 100644 index 000000000000..fe6d8acae545 --- /dev/null +++ b/java/openjdk6/files/icedtea/openjdk/7195301-no_instanceof_node.patch @@ -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 + diff --git a/java/openjdk6/files/icedtea/openjdk/8005615-failure_to_load_logger_implementation.patch b/java/openjdk6/files/icedtea/openjdk/8005615-failure_to_load_logger_implementation.patch new file mode 100644 index 000000000000..c9d6607a0ba9 --- /dev/null +++ b/java/openjdk6/files/icedtea/openjdk/8005615-failure_to_load_logger_implementation.patch @@ -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()); + } diff --git a/java/openjdk6/files/icedtea/openjdk/8007393.patch b/java/openjdk6/files/icedtea/openjdk/8007393.patch new file mode 100644 index 000000000000..632fe1b1cf9a --- /dev/null +++ b/java/openjdk6/files/icedtea/openjdk/8007393.patch @@ -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; + } + } + + diff --git a/java/openjdk6/files/icedtea/openjdk/8007611.patch b/java/openjdk6/files/icedtea/openjdk/8007611.patch new file mode 100644 index 000000000000..e67b9c75b499 --- /dev/null +++ b/java/openjdk6/files/icedtea/openjdk/8007611.patch @@ -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); + } + diff --git a/java/openjdk6/files/icedtea/security/20130618/6741606-apache_santuario.patch b/java/openjdk6/files/icedtea/security/20130618/6741606-apache_santuario.patch new file mode 100644 index 000000000000..76d4bc8c00cd --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/6741606-apache_santuario.patch @@ -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; diff --git a/java/openjdk6/files/icedtea/security/20130618/7158805-nested_subroutine_rewriting.patch b/java/openjdk6/files/icedtea/security/20130618/7158805-nested_subroutine_rewriting.patch new file mode 100644 index 000000000000..18fa9d7a53c4 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/7158805-nested_subroutine_rewriting.patch @@ -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. diff --git a/java/openjdk6/files/icedtea/security/20130618/7170730-windows_network_stack.patch b/java/openjdk6/files/icedtea/security/20130618/7170730-windows_network_stack.patch new file mode 100644 index 000000000000..5083b81afc4e --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/7170730-windows_network_stack.patch @@ -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@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) diff --git a/java/openjdk6/files/icedtea/security/20130618/8000638-improve_deserialization.patch b/java/openjdk6/files/icedtea/security/20130618/8000638-improve_deserialization.patch new file mode 100644 index 000000000000..96611775f571 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8000638-improve_deserialization.patch @@ -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; diff --git a/java/openjdk6/files/icedtea/security/20130618/8000642-better_transportation_handling.patch b/java/openjdk6/files/icedtea/security/20130618/8000642-better_transportation_handling.patch new file mode 100644 index 000000000000..34f477f35f85 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8000642-better_transportation_handling.patch @@ -0,0 +1,808 @@ +# HG changeset patch +# User Severin Gehwolf <sgehwolf@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); ++ } ++ }); ++ } ++ ++} diff --git a/java/openjdk6/files/icedtea/security/20130618/8001032-restrict_object_access-corba.patch b/java/openjdk6/files/icedtea/security/20130618/8001032-restrict_object_access-corba.patch new file mode 100644 index 000000000000..523d8894d96d --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8001032-restrict_object_access-corba.patch @@ -0,0 +1,544 @@ +# HG changeset patch +# User Severin Gehwolf <sgehwolf@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; + } diff --git a/java/openjdk6/files/icedtea/security/20130618/8001033-refactor_address_handling.patch b/java/openjdk6/files/icedtea/security/20130618/8001033-refactor_address_handling.patch new file mode 100644 index 000000000000..33878e60d141 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8001033-refactor_address_handling.patch @@ -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; +- } + } diff --git a/java/openjdk6/files/icedtea/security/20130618/8001034-memory_management.patch b/java/openjdk6/files/icedtea/security/20130618/8001034-memory_management.patch new file mode 100644 index 000000000000..67632b862c6d --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8001034-memory_management.patch @@ -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", diff --git a/java/openjdk6/files/icedtea/security/20130618/8001038-resourcefully_handle_resources.patch b/java/openjdk6/files/icedtea/security/20130618/8001038-resourcefully_handle_resources.patch new file mode 100644 index 000000000000..0f86771996fc --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8001038-resourcefully_handle_resources.patch @@ -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@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(); ++ } ++ } ++ } + } diff --git a/java/openjdk6/files/icedtea/security/20130618/8001043-clarify_definition_restrictions.patch b/java/openjdk6/files/icedtea/security/20130618/8001043-clarify_definition_restrictions.patch new file mode 100644 index 000000000000..b798681def41 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8001043-clarify_definition_restrictions.patch @@ -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); ++ } ++ + } diff --git a/java/openjdk6/files/icedtea/security/20130618/8001309-better_handling_of_annotation_interfaces.patch b/java/openjdk6/files/icedtea/security/20130618/8001309-better_handling_of_annotation_interfaces.patch new file mode 100644 index 000000000000..c3d3493d8555 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8001309-better_handling_of_annotation_interfaces.patch @@ -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); diff --git a/java/openjdk6/files/icedtea/security/20130618/8001318-6_fixup.patch b/java/openjdk6/files/icedtea/security/20130618/8001318-6_fixup.patch new file mode 100644 index 000000000000..e94edecbc50b --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8001318-6_fixup.patch @@ -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."); ++ } ++ } ++ + } diff --git a/java/openjdk6/files/icedtea/security/20130618/8001318-socket_getlocaladdress_consistency.patch b/java/openjdk6/files/icedtea/security/20130618/8001318-socket_getlocaladdress_consistency.patch new file mode 100644 index 000000000000..29106a91f497 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8001318-socket_getlocaladdress_consistency.patch @@ -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(); ++ ++ } ++ }); + } + + /** diff --git a/java/openjdk6/files/icedtea/security/20130618/8001330-checking_order_improvement.patch b/java/openjdk6/files/icedtea/security/20130618/8001330-checking_order_improvement.patch new file mode 100644 index 000000000000..646ea8ed8745 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8001330-checking_order_improvement.patch @@ -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); + } + diff --git a/java/openjdk6/files/icedtea/security/20130618/8001330-improve_checking_order.patch b/java/openjdk6/files/icedtea/security/20130618/8001330-improve_checking_order.patch new file mode 100644 index 000000000000..cf0883e4a1ca --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8001330-improve_checking_order.patch @@ -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. + */ diff --git a/java/openjdk6/files/icedtea/security/20130618/8003703-update_rmi_connection_dialog.patch b/java/openjdk6/files/icedtea/security/20130618/8003703-update_rmi_connection_dialog.patch new file mode 100644 index 000000000000..10a75b29a4e8 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8003703-update_rmi_connection_dialog.patch @@ -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>" + diff --git a/java/openjdk6/files/icedtea/security/20130618/8004584-augment_applet_contextualization.patch b/java/openjdk6/files/icedtea/security/20130618/8004584-augment_applet_contextualization.patch new file mode 100644 index 000000000000..d60c20205938 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8004584-augment_applet_contextualization.patch @@ -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"); diff --git a/java/openjdk6/files/icedtea/security/20130618/8005007-better_glyph_processing.patch b/java/openjdk6/files/icedtea/security/20130618/8005007-better_glyph_processing.patch new file mode 100644 index 000000000000..e0e8f6a17a59 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8005007-better_glyph_processing.patch @@ -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; + } + diff --git a/java/openjdk6/files/icedtea/security/20130618/8006328-6_fixup.patch b/java/openjdk6/files/icedtea/security/20130618/8006328-6_fixup.patch new file mode 100644 index 000000000000..828e897898c5 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8006328-6_fixup.patch @@ -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) { diff --git a/java/openjdk6/files/icedtea/security/20130618/8006328-sound_class_robustness.patch b/java/openjdk6/files/icedtea/security/20130618/8006328-sound_class_robustness.patch new file mode 100644 index 000000000000..dde18a947d21 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8006328-sound_class_robustness.patch @@ -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); + } + } diff --git a/java/openjdk6/files/icedtea/security/20130618/8006611-improve_scripting.patch b/java/openjdk6/files/icedtea/security/20130618/8006611-improve_scripting.patch new file mode 100644 index 000000000000..831c3512020f --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8006611-improve_scripting.patch @@ -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; +- } + } diff --git a/java/openjdk6/files/icedtea/security/20130618/8007467-improve_jmx_internal_api_robustness.patch b/java/openjdk6/files/icedtea/security/20130618/8007467-improve_jmx_internal_api_robustness.patch new file mode 100644 index 000000000000..8a69255dcc00 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8007467-improve_jmx_internal_api_robustness.patch @@ -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; diff --git a/java/openjdk6/files/icedtea/security/20130618/8007471-6_fixup.patch b/java/openjdk6/files/icedtea/security/20130618/8007471-6_fixup.patch new file mode 100644 index 000000000000..55ecc7026be2 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8007471-6_fixup.patch @@ -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); + } diff --git a/java/openjdk6/files/icedtea/security/20130618/8007471-improve_mbean_notifications.patch b/java/openjdk6/files/icedtea/security/20130618/8007471-improve_mbean_notifications.patch new file mode 100644 index 000000000000..e4060617b01e --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8007471-improve_mbean_notifications.patch @@ -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) { diff --git a/java/openjdk6/files/icedtea/security/20130618/8007812-getenclosingmethod.patch b/java/openjdk6/files/icedtea/security/20130618/8007812-getenclosingmethod.patch new file mode 100644 index 000000000000..01d3a8784d2f --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8007812-getenclosingmethod.patch @@ -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; + } + + /** diff --git a/java/openjdk6/files/icedtea/security/20130618/8008120-improve_jmx_class_checking.patch b/java/openjdk6/files/icedtea/security/20130618/8008120-improve_jmx_class_checking.patch new file mode 100644 index 000000000000..d55c33c44d14 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8008120-improve_jmx_class_checking.patch @@ -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; + } + + diff --git a/java/openjdk6/files/icedtea/security/20130618/8008124-better_compliance_testing.patch b/java/openjdk6/files/icedtea/security/20130618/8008124-better_compliance_testing.patch new file mode 100644 index 000000000000..780d7573248d --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8008124-better_compliance_testing.patch @@ -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); + } diff --git a/java/openjdk6/files/icedtea/security/20130618/8008128-better_jmx_api_coherence.patch b/java/openjdk6/files/icedtea/security/20130618/8008128-better_jmx_api_coherence.patch new file mode 100644 index 000000000000..355b844f47f5 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8008128-better_jmx_api_coherence.patch @@ -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@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; ++ } + } diff --git a/java/openjdk6/files/icedtea/security/20130618/8008132-better_serialization.patch b/java/openjdk6/files/icedtea/security/20130618/8008132-better_serialization.patch new file mode 100644 index 000000000000..9d2605eab931 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8008132-better_serialization.patch @@ -0,0 +1,121 @@ +# HG changeset patch +# User Severin Gehwolf <sgehwolf@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> diff --git a/java/openjdk6/files/icedtea/security/20130618/8008585-jmx_data_handling.patch b/java/openjdk6/files/icedtea/security/20130618/8008585-jmx_data_handling.patch new file mode 100644 index 000000000000..0badbaffc9f7 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8008585-jmx_data_handling.patch @@ -0,0 +1,69 @@ +# HG changeset patch +# User Severin Gehwolf <sgehwolf@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) diff --git a/java/openjdk6/files/icedtea/security/20130618/8008593-better_urlclassloader.patch b/java/openjdk6/files/icedtea/security/20130618/8008593-better_urlclassloader.patch new file mode 100644 index 000000000000..54c918875142 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8008593-better_urlclassloader.patch @@ -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 */ diff --git a/java/openjdk6/files/icedtea/security/20130618/8008603-jmx_provider_provision.patch b/java/openjdk6/files/icedtea/security/20130618/8008603-jmx_provider_provision.patch new file mode 100644 index 000000000000..a58564f08d4b --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8008603-jmx_provider_provision.patch @@ -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; + } diff --git a/java/openjdk6/files/icedtea/security/20130618/8008611-6_fixup.patch b/java/openjdk6/files/icedtea/security/20130618/8008611-6_fixup.patch new file mode 100644 index 000000000000..675a8a049bbf --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8008611-6_fixup.patch @@ -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. diff --git a/java/openjdk6/files/icedtea/security/20130618/8008611-jmx_annotations.patch b/java/openjdk6/files/icedtea/security/20130618/8008611-jmx_annotations.patch new file mode 100644 index 000000000000..55c46fd18cec --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8008611-jmx_annotations.patch @@ -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? diff --git a/java/openjdk6/files/icedtea/security/20130618/8008615-jmx_internal_api_robustness.patch b/java/openjdk6/files/icedtea/security/20130618/8008615-jmx_internal_api_robustness.patch new file mode 100644 index 000000000000..3ba82e8cff44 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8008615-jmx_internal_api_robustness.patch @@ -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; diff --git a/java/openjdk6/files/icedtea/security/20130618/8008623-mbeanserver_handling.patch b/java/openjdk6/files/icedtea/security/20130618/8008623-mbeanserver_handling.patch new file mode 100644 index 000000000000..e671e66f8636 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8008623-mbeanserver_handling.patch @@ -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); diff --git a/java/openjdk6/files/icedtea/security/20130618/8008744-6741606_rework.patch b/java/openjdk6/files/icedtea/security/20130618/8008744-6741606_rework.patch new file mode 100644 index 000000000000..5746e70c3f05 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8008744-6741606_rework.patch @@ -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; +- } +- } +-} diff --git a/java/openjdk6/files/icedtea/security/20130618/8008982-jmx_interface_changes.patch b/java/openjdk6/files/icedtea/security/20130618/8008982-jmx_interface_changes.patch new file mode 100644 index 000000000000..88fea66f44db --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8008982-jmx_interface_changes.patch @@ -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) diff --git a/java/openjdk6/files/icedtea/security/20130618/8009004-rmi_connection_improvement.patch b/java/openjdk6/files/icedtea/security/20130618/8009004-rmi_connection_improvement.patch new file mode 100644 index 000000000000..8218120fb894 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8009004-rmi_connection_improvement.patch @@ -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@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) { diff --git a/java/openjdk6/files/icedtea/security/20130618/8009013-t2k_glyphs.patch b/java/openjdk6/files/icedtea/security/20130618/8009013-t2k_glyphs.patch new file mode 100644 index 000000000000..29b95a958c0d --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8009013-t2k_glyphs.patch @@ -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@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; diff --git a/java/openjdk6/files/icedtea/security/20130618/8009034-jmx_notification_improvement.patch b/java/openjdk6/files/icedtea/security/20130618/8009034-jmx_notification_improvement.patch new file mode 100644 index 000000000000..020c3c8837c7 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8009034-jmx_notification_improvement.patch @@ -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(); + } + + /** diff --git a/java/openjdk6/files/icedtea/security/20130618/8009038-jmx_notification_support_improvement.patch b/java/openjdk6/files/icedtea/security/20130618/8009038-jmx_notification_support_improvement.patch new file mode 100644 index 000000000000..e7e9418f8717 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8009038-jmx_notification_support_improvement.patch @@ -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(); ++ } + } + + /** diff --git a/java/openjdk6/files/icedtea/security/20130618/8009067-improve_key_storing.patch b/java/openjdk6/files/icedtea/security/20130618/8009067-improve_key_storing.patch new file mode 100644 index 000000000000..aa93c972d123 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8009067-improve_key_storing.patch @@ -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 diff --git a/java/openjdk6/files/icedtea/security/20130618/8009071-improve_shape_handling.patch b/java/openjdk6/files/icedtea/security/20130618/8009071-improve_shape_handling.patch new file mode 100644 index 000000000000..9164142a0c5e --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8009071-improve_shape_handling.patch @@ -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 */ ++ + diff --git a/java/openjdk6/files/icedtea/security/20130618/8009235-improve_tsa_data_handling.patch b/java/openjdk6/files/icedtea/security/20130618/8009235-improve_tsa_data_handling.patch new file mode 100644 index 000000000000..c83d57022253 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8009235-improve_tsa_data_handling.patch @@ -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'}; diff --git a/java/openjdk6/files/icedtea/security/20130618/8011243-improve_imaginglib.patch b/java/openjdk6/files/icedtea/security/20130618/8011243-improve_imaginglib.patch new file mode 100644 index 000000000000..3f0852f13b56 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8011243-improve_imaginglib.patch @@ -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; diff --git a/java/openjdk6/files/icedtea/security/20130618/8011248-better_component_rasters.patch b/java/openjdk6/files/icedtea/security/20130618/8011248-better_component_rasters.patch new file mode 100644 index 000000000000..1530fd3ba632 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8011248-better_component_rasters.patch @@ -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 + " )"); + } + } + diff --git a/java/openjdk6/files/icedtea/security/20130618/8011253-better_short_component_rasters.patch b/java/openjdk6/files/icedtea/security/20130618/8011253-better_short_component_rasters.patch new file mode 100644 index 000000000000..4ea3ec3a052f --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8011253-better_short_component_rasters.patch @@ -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 + " )"); + } + } + diff --git a/java/openjdk6/files/icedtea/security/20130618/8011257-better_byte_component_rasters.patch b/java/openjdk6/files/icedtea/security/20130618/8011257-better_byte_component_rasters.patch new file mode 100644 index 000000000000..8af449ee9a27 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8011257-better_byte_component_rasters.patch @@ -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 + " )"); + } + } + diff --git a/java/openjdk6/files/icedtea/security/20130618/8011557-improve_reflection.patch b/java/openjdk6/files/icedtea/security/20130618/8011557-improve_reflection.patch new file mode 100644 index 000000000000..7c356823619b --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8011557-improve_reflection.patch @@ -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); ++ } + } diff --git a/java/openjdk6/files/icedtea/security/20130618/8012375-javadoc_framing.patch b/java/openjdk6/files/icedtea/security/20130618/8012375-javadoc_framing.patch new file mode 100644 index 000000000000..e1ba1e070fc2 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8012375-javadoc_framing.patch @@ -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 + diff --git a/java/openjdk6/files/icedtea/security/20130618/8012421-better_positioning.patch b/java/openjdk6/files/icedtea/security/20130618/8012421-better_positioning.patch new file mode 100644 index 000000000000..9d76b93f3907 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8012421-better_positioning.patch @@ -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) + diff --git a/java/openjdk6/files/icedtea/security/20130618/8012438-better_image_validation.patch b/java/openjdk6/files/icedtea/security/20130618/8012438-better_image_validation.patch new file mode 100644 index 000000000000..a1c248e340d4 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8012438-better_image_validation.patch @@ -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; diff --git a/java/openjdk6/files/icedtea/security/20130618/8012597-better_image_channel_validation.patch b/java/openjdk6/files/icedtea/security/20130618/8012597-better_image_channel_validation.patch new file mode 100644 index 000000000000..2f83a8e2b893 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8012597-better_image_channel_validation.patch @@ -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++) { diff --git a/java/openjdk6/files/icedtea/security/20130618/8012601-better_layout_validation.patch b/java/openjdk6/files/icedtea/security/20130618/8012601-better_layout_validation.patch new file mode 100644 index 000000000000..c1d52312f086 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8012601-better_layout_validation.patch @@ -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); ++ } + } diff --git a/java/openjdk6/files/icedtea/security/20130618/8014281-better_xml_signature_checking.patch b/java/openjdk6/files/icedtea/security/20130618/8014281-better_xml_signature_checking.patch new file mode 100644 index 000000000000..e198cb12482e --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8014281-better_xml_signature_checking.patch @@ -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)); ++ } + } diff --git a/java/openjdk6/files/icedtea/security/20130618/8015997-more_javadoc_framing.patch b/java/openjdk6/files/icedtea/security/20130618/8015997-more_javadoc_framing.patch new file mode 100644 index 000000000000..a6c738e6f898 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/8015997-more_javadoc_framing.patch @@ -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 + diff --git a/java/openjdk6/files/icedtea/security/20130618/diamond_fix.patch b/java/openjdk6/files/icedtea/security/20130618/diamond_fix.patch new file mode 100644 index 000000000000..1c5d036e2d86 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/diamond_fix.patch @@ -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() { diff --git a/java/openjdk6/files/icedtea/security/20130618/handle_npe.patch b/java/openjdk6/files/icedtea/security/20130618/handle_npe.patch new file mode 100644 index 000000000000..ffd44736c4e7 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/handle_npe.patch @@ -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(); + } diff --git a/java/openjdk6/files/icedtea/security/20130618/javac_issue.patch b/java/openjdk6/files/icedtea/security/20130618/javac_issue.patch new file mode 100644 index 000000000000..0f1ee2dd2acf --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/javac_issue.patch @@ -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(); diff --git a/java/openjdk6/files/icedtea/security/20130618/langtools_generics.patch b/java/openjdk6/files/icedtea/security/20130618/langtools_generics.patch new file mode 100644 index 000000000000..7e59e30347c4 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/langtools_generics.patch @@ -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) { diff --git a/java/openjdk6/files/icedtea/security/20130618/langtools_merge-01.patch b/java/openjdk6/files/icedtea/security/20130618/langtools_merge-01.patch new file mode 100644 index 000000000000..6eb0a75db14e --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/langtools_merge-01.patch @@ -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; +- } + } diff --git a/java/openjdk6/files/icedtea/security/20130618/langtools_merge-02.patch b/java/openjdk6/files/icedtea/security/20130618/langtools_merge-02.patch new file mode 100644 index 000000000000..e30ce6e420cf --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/langtools_merge-02.patch @@ -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. diff --git a/java/openjdk6/files/icedtea/security/20130618/langtools_merge-03.patch b/java/openjdk6/files/icedtea/security/20130618/langtools_merge-03.patch new file mode 100644 index 000000000000..bc7e5e85b733 --- /dev/null +++ b/java/openjdk6/files/icedtea/security/20130618/langtools_merge-03.patch @@ -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> |