summaryrefslogtreecommitdiff
path: root/java/openjdk6/files/icedtea/security/20130618
diff options
context:
space:
mode:
Diffstat (limited to 'java/openjdk6/files/icedtea/security/20130618')
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/6741606-apache_santuario.patch8110
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/7158805-nested_subroutine_rewriting.patch467
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/7170730-windows_network_stack.patch1057
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8000638-improve_deserialization.patch26
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8000642-better_transportation_handling.patch808
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8001032-restrict_object_access-corba.patch544
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8001033-refactor_address_handling.patch119
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8001034-memory_management.patch78
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8001038-resourcefully_handle_resources.patch236
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8001043-clarify_definition_restrictions.patch92
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8001309-better_handling_of_annotation_interfaces.patch36
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8001318-6_fixup.patch114
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8001318-socket_getlocaladdress_consistency.patch470
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8001330-checking_order_improvement.patch407
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8001330-improve_checking_order.patch97
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8003703-update_rmi_connection_dialog.patch131
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8004584-augment_applet_contextualization.patch322
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8005007-better_glyph_processing.patch118
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8006328-6_fixup.patch31
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8006328-sound_class_robustness.patch6937
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8006611-improve_scripting.patch78
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8007467-improve_jmx_internal_api_robustness.patch108
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8007471-6_fixup.patch25
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8007471-improve_mbean_notifications.patch89
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8007812-getenclosingmethod.patch89
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8008120-improve_jmx_class_checking.patch332
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8008124-better_compliance_testing.patch20
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8008128-better_jmx_api_coherence.patch110
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8008132-better_serialization.patch121
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8008585-jmx_data_handling.patch69
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8008593-better_urlclassloader.patch270
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8008603-jmx_provider_provision.patch29
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8008611-6_fixup.patch20
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8008611-jmx_annotations.patch32
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8008615-jmx_internal_api_robustness.patch70
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8008623-mbeanserver_handling.patch121
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8008744-6741606_rework.patch882
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8008982-jmx_interface_changes.patch168
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8009004-rmi_connection_improvement.patch54
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8009013-t2k_glyphs.patch39
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8009034-jmx_notification_improvement.patch30
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8009038-jmx_notification_support_improvement.patch89
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8009067-improve_key_storing.patch20
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8009071-improve_shape_handling.patch364
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8009235-improve_tsa_data_handling.patch80
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8011243-improve_imaginglib.patch618
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8011248-better_component_rasters.patch51
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8011253-better_short_component_rasters.patch140
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8011257-better_byte_component_rasters.patch157
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8011557-improve_reflection.patch132
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8012375-javadoc_framing.patch61
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8012421-better_positioning.patch100
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8012438-better_image_validation.patch283
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8012597-better_image_channel_validation.patch597
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8012601-better_layout_validation.patch125
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8014281-better_xml_signature_checking.patch49
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/8015997-more_javadoc_framing.patch21
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/diamond_fix.patch55
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/handle_npe.patch21
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/javac_issue.patch60
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/langtools_generics.patch600
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/langtools_merge-01.patch30
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/langtools_merge-02.patch30
-rw-r--r--java/openjdk6/files/icedtea/security/20130618/langtools_merge-03.patch18
64 files changed, 0 insertions, 26657 deletions
diff --git a/java/openjdk6/files/icedtea/security/20130618/6741606-apache_santuario.patch b/java/openjdk6/files/icedtea/security/20130618/6741606-apache_santuario.patch
deleted file mode 100644
index 76d4bc8c00cd..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/6741606-apache_santuario.patch
+++ /dev/null
@@ -1,8110 +0,0 @@
-# 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>&gt;a&lt;...&gt;/a&lt;</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
deleted file mode 100644
index 18fa9d7a53c4..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/7158805-nested_subroutine_rewriting.patch
+++ /dev/null
@@ -1,467 +0,0 @@
-# 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
deleted file mode 100644
index 5083b81afc4e..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/7170730-windows_network_stack.patch
+++ /dev/null
@@ -1,1057 +0,0 @@
-# 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
deleted file mode 100644
index 96611775f571..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8000638-improve_deserialization.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-# 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
deleted file mode 100644
index 34f477f35f85..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8000642-better_transportation_handling.patch
+++ /dev/null
@@ -1,808 +0,0 @@
-# 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
deleted file mode 100644
index 523d8894d96d..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8001032-restrict_object_access-corba.patch
+++ /dev/null
@@ -1,544 +0,0 @@
-# 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
deleted file mode 100644
index 33878e60d141..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8001033-refactor_address_handling.patch
+++ /dev/null
@@ -1,119 +0,0 @@
-# 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
deleted file mode 100644
index 67632b862c6d..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8001034-memory_management.patch
+++ /dev/null
@@ -1,78 +0,0 @@
-# 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
deleted file mode 100644
index 0f86771996fc..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8001038-resourcefully_handle_resources.patch
+++ /dev/null
@@ -1,236 +0,0 @@
-# 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
deleted file mode 100644
index b798681def41..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8001043-clarify_definition_restrictions.patch
+++ /dev/null
@@ -1,92 +0,0 @@
-# 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
deleted file mode 100644
index c3d3493d8555..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8001309-better_handling_of_annotation_interfaces.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-# 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
deleted file mode 100644
index e94edecbc50b..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8001318-6_fixup.patch
+++ /dev/null
@@ -1,114 +0,0 @@
-# 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
deleted file mode 100644
index 29106a91f497..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8001318-socket_getlocaladdress_consistency.patch
+++ /dev/null
@@ -1,470 +0,0 @@
-# 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
deleted file mode 100644
index 646ea8ed8745..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8001330-checking_order_improvement.patch
+++ /dev/null
@@ -1,407 +0,0 @@
-# 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
deleted file mode 100644
index cf0883e4a1ca..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8001330-improve_checking_order.patch
+++ /dev/null
@@ -1,97 +0,0 @@
-# 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
deleted file mode 100644
index 10a75b29a4e8..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8003703-update_rmi_connection_dialog.patch
+++ /dev/null
@@ -1,131 +0,0 @@
-# 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
deleted file mode 100644
index d60c20205938..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8004584-augment_applet_contextualization.patch
+++ /dev/null
@@ -1,322 +0,0 @@
-# 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
deleted file mode 100644
index e0e8f6a17a59..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8005007-better_glyph_processing.patch
+++ /dev/null
@@ -1,118 +0,0 @@
-# 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
deleted file mode 100644
index 828e897898c5..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8006328-6_fixup.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-# 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
deleted file mode 100644
index dde18a947d21..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8006328-sound_class_robustness.patch
+++ /dev/null
@@ -1,6937 +0,0 @@
-# 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
deleted file mode 100644
index 831c3512020f..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8006611-improve_scripting.patch
+++ /dev/null
@@ -1,78 +0,0 @@
-# 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
deleted file mode 100644
index 8a69255dcc00..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8007467-improve_jmx_internal_api_robustness.patch
+++ /dev/null
@@ -1,108 +0,0 @@
-# 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
deleted file mode 100644
index 55ecc7026be2..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8007471-6_fixup.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-# 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
deleted file mode 100644
index e4060617b01e..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8007471-improve_mbean_notifications.patch
+++ /dev/null
@@ -1,89 +0,0 @@
-# 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
deleted file mode 100644
index 01d3a8784d2f..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8007812-getenclosingmethod.patch
+++ /dev/null
@@ -1,89 +0,0 @@
-# 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
deleted file mode 100644
index d55c33c44d14..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8008120-improve_jmx_class_checking.patch
+++ /dev/null
@@ -1,332 +0,0 @@
-# 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
deleted file mode 100644
index 780d7573248d..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8008124-better_compliance_testing.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-# 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
deleted file mode 100644
index 355b844f47f5..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8008128-better_jmx_api_coherence.patch
+++ /dev/null
@@ -1,110 +0,0 @@
-# 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
deleted file mode 100644
index 9d2605eab931..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8008132-better_serialization.patch
+++ /dev/null
@@ -1,121 +0,0 @@
-# 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
deleted file mode 100644
index 0badbaffc9f7..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8008585-jmx_data_handling.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-# 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
deleted file mode 100644
index 54c918875142..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8008593-better_urlclassloader.patch
+++ /dev/null
@@ -1,270 +0,0 @@
-# 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
deleted file mode 100644
index a58564f08d4b..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8008603-jmx_provider_provision.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-# 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
deleted file mode 100644
index 675a8a049bbf..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8008611-6_fixup.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-# 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
deleted file mode 100644
index 55c46fd18cec..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8008611-jmx_annotations.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-# 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
deleted file mode 100644
index 3ba82e8cff44..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8008615-jmx_internal_api_robustness.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-# 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
deleted file mode 100644
index e671e66f8636..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8008623-mbeanserver_handling.patch
+++ /dev/null
@@ -1,121 +0,0 @@
-# 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
deleted file mode 100644
index 5746e70c3f05..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8008744-6741606_rework.patch
+++ /dev/null
@@ -1,882 +0,0 @@
-# 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
deleted file mode 100644
index 88fea66f44db..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8008982-jmx_interface_changes.patch
+++ /dev/null
@@ -1,168 +0,0 @@
-# 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
deleted file mode 100644
index 8218120fb894..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8009004-rmi_connection_improvement.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-# 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
deleted file mode 100644
index 29b95a958c0d..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8009013-t2k_glyphs.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-# 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
deleted file mode 100644
index 020c3c8837c7..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8009034-jmx_notification_improvement.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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
deleted file mode 100644
index e7e9418f8717..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8009038-jmx_notification_support_improvement.patch
+++ /dev/null
@@ -1,89 +0,0 @@
-# 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
deleted file mode 100644
index aa93c972d123..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8009067-improve_key_storing.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-# 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
deleted file mode 100644
index 9164142a0c5e..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8009071-improve_shape_handling.patch
+++ /dev/null
@@ -1,364 +0,0 @@
-
-# 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
deleted file mode 100644
index c83d57022253..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8009235-improve_tsa_data_handling.patch
+++ /dev/null
@@ -1,80 +0,0 @@
-# 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
deleted file mode 100644
index 3f0852f13b56..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8011243-improve_imaginglib.patch
+++ /dev/null
@@ -1,618 +0,0 @@
-# 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
deleted file mode 100644
index 1530fd3ba632..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8011248-better_component_rasters.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-# 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
deleted file mode 100644
index 4ea3ec3a052f..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8011253-better_short_component_rasters.patch
+++ /dev/null
@@ -1,140 +0,0 @@
-# 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
deleted file mode 100644
index 8af449ee9a27..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8011257-better_byte_component_rasters.patch
+++ /dev/null
@@ -1,157 +0,0 @@
-# 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
deleted file mode 100644
index 7c356823619b..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8011557-improve_reflection.patch
+++ /dev/null
@@ -1,132 +0,0 @@
-# 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
deleted file mode 100644
index e1ba1e070fc2..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8012375-javadoc_framing.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-# 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
deleted file mode 100644
index 9d76b93f3907..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8012421-better_positioning.patch
+++ /dev/null
@@ -1,100 +0,0 @@
-# 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
deleted file mode 100644
index a1c248e340d4..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8012438-better_image_validation.patch
+++ /dev/null
@@ -1,283 +0,0 @@
-# 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
deleted file mode 100644
index 2f83a8e2b893..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8012597-better_image_channel_validation.patch
+++ /dev/null
@@ -1,597 +0,0 @@
-# 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
deleted file mode 100644
index c1d52312f086..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8012601-better_layout_validation.patch
+++ /dev/null
@@ -1,125 +0,0 @@
-# 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
deleted file mode 100644
index e198cb12482e..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8014281-better_xml_signature_checking.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-# 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
deleted file mode 100644
index a6c738e6f898..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/8015997-more_javadoc_framing.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-# 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
deleted file mode 100644
index 1c5d036e2d86..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/diamond_fix.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-# 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
deleted file mode 100644
index ffd44736c4e7..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/handle_npe.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-# 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
deleted file mode 100644
index 0f1ee2dd2acf..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/javac_issue.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-# 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
deleted file mode 100644
index 7e59e30347c4..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/langtools_generics.patch
+++ /dev/null
@@ -1,600 +0,0 @@
-# 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
deleted file mode 100644
index 6eb0a75db14e..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/langtools_merge-01.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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
deleted file mode 100644
index e30ce6e420cf..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/langtools_merge-02.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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
deleted file mode 100644
index bc7e5e85b733..000000000000
--- a/java/openjdk6/files/icedtea/security/20130618/langtools_merge-03.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-# 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>