changeset 7515:3ffa38871143

Merge
author lana
date Fri, 28 Jun 2013 19:37:48 -0700
parents 5cfcd545ce4a 2f1386fc2079
children 6dda4a069a83
files make/sun/xawt/ToBin.java makefiles/sun/awt/X11/ToBin.java src/share/classes/sun/misc/FDBigInt.java src/share/classes/sun/misc/Hashing.java src/solaris/classes/sun/awt/X11/XIconInfo.java src/solaris/classes/sun/awt/X11/security-icon-bw16.png src/solaris/classes/sun/awt/X11/security-icon-bw24.png src/solaris/classes/sun/awt/X11/security-icon-bw32.png src/solaris/classes/sun/awt/X11/security-icon-bw48.png src/solaris/classes/sun/awt/X11/security-icon-interim16.png src/solaris/classes/sun/awt/X11/security-icon-interim24.png src/solaris/classes/sun/awt/X11/security-icon-interim32.png src/solaris/classes/sun/awt/X11/security-icon-interim48.png src/solaris/classes/sun/awt/X11/security-icon-yellow16.png src/solaris/classes/sun/awt/X11/security-icon-yellow24.png src/solaris/classes/sun/awt/X11/security-icon-yellow32.png src/solaris/classes/sun/awt/X11/security-icon-yellow48.png test/java/lang/invoke/7196190/MHProxyTest.java test/sun/misc/Hashing.java
diffstat 885 files changed, 24604 insertions(+), 14397 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Wed Jun 26 13:49:16 2013 +0400
+++ b/.hgtags	Fri Jun 28 19:37:48 2013 -0700
@@ -216,3 +216,5 @@
 a2a2a91075ad85becbe10a39d7fd04ef9bea8df5 jdk8-b92
 691d6c6cd332d98b0f0221445a73906776f31f72 jdk8-b93
 51479fa56b7c4363c6d87c2e8b898d8185cf4b22 jdk8-b94
+42aa9f1828852bb8b77e98ec695211493ae0759d jdk8-b95
+4a5d3cf2b3af1660db0237e8da324c140e534fa4 jdk8-b96
--- a/make/com/oracle/jfr/Makefile	Wed Jun 26 13:49:16 2013 +0400
+++ b/make/com/oracle/jfr/Makefile	Fri Jun 28 19:37:48 2013 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,11 @@
 
 AUTO_FILES_JAVA_DIRS = com/oracle/jrockit/jfr oracle/jrockit/jfr
 
+JFC_XSD = oracle/jrockit/jfr/settings/jfc.xsd
+JFC_XSD_SRC = $(CLOSED_SHARE_SRC)/classes/$(JFC_XSD)
+JFC_XSD_FILE = $(CLASSDESTDIR)/$(JFC_XSD)
+
+
 # Find C source files
 #
 vpath %.c $(CLOSED_SHARE_SRC)/native/oracle/jfr
@@ -59,15 +64,17 @@
 	$(RM) -r $(CLASSDESTDIR)/com/oracle/jrockit/jfr
 	$(RM) -r $(CLASSDESTDIR)/oracle/jrockit/jfr
 
+# Copy pre-shipped .jfc files
+JFR_LIBDIR = $(LIBDIR)/jfr
+JFC_SRCDIR = $(CLOSED_SHARE_SRC)/classes/oracle/jrockit/jfr/settings
 
-# Copy pre-shipped .jfs files
-JFR_LIBDIR = $(LIBDIR)/jfr
-JFR_SRCDIR = $(CLOSED_SHARE_SRC)/lib/jfr
-
-$(JFR_LIBDIR)/%.jfs: $(JFR_SRCDIR)/%.jfs
+$(JFR_LIBDIR)/%.jfc: $(JFC_SRCDIR)/%.jfc
 	$(install-file)
 
-JFS_FILES := $(subst $(JFR_SRCDIR),$(JFR_LIBDIR),$(wildcard $(JFR_SRCDIR)/*.jfs))
+JFC_FILES := $(subst $(JFC_SRCDIR),$(JFR_LIBDIR),$(wildcard $(JFC_SRCDIR)/*.jfc))
 
-all build : $(JFS_FILES)
+$(JFC_XSD_FILE) : $(JFC_XSD_SRC)
+	$(install-file)
 
+all build : $(JFC_FILES) $(JFC_XSD_FILE)
+
--- a/make/java/nio/mapfile-bsd	Wed Jun 26 13:49:16 2013 +0400
+++ b/make/java/nio/mapfile-bsd	Fri Jun 28 19:37:48 2013 -0700
@@ -109,6 +109,7 @@
 		Java_sun_nio_ch_Net_getInterface6;
 		Java_sun_nio_ch_Net_shutdown;
 		Java_sun_nio_ch_Net_poll;
+                Java_sun_nio_ch_Net_isExclusiveBindAvailable;
                 Java_sun_nio_ch_PollArrayWrapper_interrupt;
                 Java_sun_nio_ch_PollArrayWrapper_poll0;
                 Java_sun_nio_ch_ServerSocketChannelImpl_accept0;
--- a/make/java/nio/mapfile-linux	Wed Jun 26 13:49:16 2013 +0400
+++ b/make/java/nio/mapfile-linux	Fri Jun 28 19:37:48 2013 -0700
@@ -117,6 +117,7 @@
 		Java_sun_nio_ch_Net_getInterface6;
 		Java_sun_nio_ch_Net_shutdown;
 		Java_sun_nio_ch_Net_poll;
+                Java_sun_nio_ch_Net_isExclusiveBindAvailable;
                 Java_sun_nio_ch_PollArrayWrapper_interrupt;
                 Java_sun_nio_ch_PollArrayWrapper_poll0;
                 Java_sun_nio_ch_ServerSocketChannelImpl_accept0;
--- a/make/java/nio/mapfile-solaris	Wed Jun 26 13:49:16 2013 +0400
+++ b/make/java/nio/mapfile-solaris	Fri Jun 28 19:37:48 2013 -0700
@@ -105,6 +105,7 @@
 		Java_sun_nio_ch_Net_getInterface6;
 		Java_sun_nio_ch_Net_shutdown;
 		Java_sun_nio_ch_Net_poll;
+                Java_sun_nio_ch_Net_isExclusiveBindAvailable;
                 Java_sun_nio_ch_PollArrayWrapper_interrupt;
                 Java_sun_nio_ch_PollArrayWrapper_poll0;
                 Java_sun_nio_ch_ServerSocketChannelImpl_accept0;
--- a/make/java/zip/mapfile-vers	Wed Jun 26 13:49:16 2013 +0400
+++ b/make/java/zip/mapfile-vers	Fri Jun 28 19:37:48 2013 -0700
@@ -65,6 +65,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;
--- a/make/java/zip/reorder-i586	Wed Jun 26 13:49:16 2013 +0400
+++ b/make/java/zip/reorder-i586	Fri Jun 28 19:37:48 2013 -0700
@@ -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_ZipFile_freeEntry;
 text: .text%Java_java_util_zip_ZipFile_getEntryTime;
--- a/make/java/zip/reorder-sparc	Wed Jun 26 13:49:16 2013 +0400
+++ b/make/java/zip/reorder-sparc	Fri Jun 28 19:37:48 2013 -0700
@@ -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_ZipFile_freeEntry;
 text: .text%Java_java_util_zip_ZipFile_getEntryTime;
--- a/make/java/zip/reorder-sparcv9	Wed Jun 26 13:49:16 2013 +0400
+++ b/make/java/zip/reorder-sparcv9	Fri Jun 28 19:37:48 2013 -0700
@@ -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_ZipFile_freeEntry;
 text: .text%Java_java_util_zip_ZipFile_getEntryTime;
--- a/make/netbeans/common/shared.xml	Wed Jun 26 13:49:16 2013 +0400
+++ b/make/netbeans/common/shared.xml	Fri Jun 28 19:37:48 2013 -0700
@@ -77,7 +77,7 @@
         <echo level="verbose">System configuration claims architecture is ${platform}-${arch}</echo>
         <property name="build.dir" location="${root}/build/${platform}-${arch}"/>
         <property name="bin.dir" location="${build.dir}/bin"/>
-        <property name="make.dir" location="${root}/make"/>
+        <property name="make.dir" location="${root}/make"/> <!-- this is old build make files! -->
         <property name="gensrc.dir" location="${build.dir}/gensrc"/>
         <property name="classes.dir" location="${build.dir}/classes"/>
         <property name="jtreg.dir" location="${build.dir}/jtreg/${ant.project.name}"/>
@@ -126,7 +126,7 @@
             <attribute name="classesdir" default="${classes.dir}"/>
             <sequential>
                 <mkdir dir="@{classesdir}"/>
-                <javac srcdir="@{srcdir}" includes="@{includes}" excludes="@{excludes}" sourcepath="" 
+                <javac srcdir="@{srcdir}" includes="@{includes}" excludes="@{excludes}" sourcepath=""
                     destdir="@{classesdir}" fork="true" executable="${bootstrap.javac}"
                     debug="${javac.debug}" debuglevel="${javac.debuglevel}">
                     <!-- Mandatory for compiling partial JDK sources against a snapshot; should NEVER be used for any other purpose: -->
@@ -146,7 +146,7 @@
         <!-- Empty placeholder for easier customization. -->
         <!-- You can override this target in the ../build.xml file. -->
     </target>
-    
+
     <target name="build" depends="-init,-pre-compile,-build-ant,-build-make,-post-compile" description="Build sources."/>
     <target name="-do-build-ant">
         <depend srcdir="${share.src.dir}:${platform.src.dir}:${root}/src/closed/share/classes:${gensrc.dir}" destdir="${classes.dir}" cache="${build.dir}/depcache" includes="${includes}" excludes="${excludes}"/>
@@ -312,7 +312,7 @@
             <param name="jtreg.vm.options" value="-Xdebug -Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
         </antcall>
     </target>
-    
+
     <target name="debug" depends="-init" if="netbeans.home">
         <!-- No package decls -> "source root" is immediately containing dir -->
         <dirname file="${root}/test/${jtreg.tests}" property="test.dir"/>
--- a/make/netbeans/j2se/build.xml	Wed Jun 26 13:49:16 2013 +0400
+++ b/make/netbeans/j2se/build.xml	Fri Jun 28 19:37:48 2013 -0700
@@ -37,11 +37,11 @@
     <import file="../common/shared.xml"/>
 
     <target name="-build-make" depends="-make.init" if="use.make">
-        <make-run target="all" dir="${make.dir}"/>
+        <make-run target="jdk" dir="${root}/.."/>
     </target>
 
     <target name="-clean-make" depends="-make.init" if="use.make">
-        <make-run target="clean" dir="${make.dir}"/>
+        <make-run target="clean-jdk" dir="${root}/.."/>
     </target>
 
 </project>
--- a/make/sun/awt/Makefile	Wed Jun 26 13:49:16 2013 +0400
+++ b/make/sun/awt/Makefile	Fri Jun 28 19:37:48 2013 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,10 @@
 
 OTHER_CFLAGS += -D__MEDIALIB_OLD_NAMES -D__USE_J2D_NAMES
 
+ifneq  ($(PLATFORM), windows)
+CLASSES_INIT += $(TEMPDIR)/.gen_icons
+endif
+
 #
 # Files
 #
@@ -208,6 +212,79 @@
 endif
 build: fontconfigs
 
+ifneq ($(PLATFORM), windows)
+
+GEN_DIR=$(GENSRCDIR)/sun/awt/
+
+ifdef OPENJDK
+    ICONS_PATH_PREFIX=$(PLATFORM_SRC)
+else
+    ICONS_PATH_PREFIX=$(CLOSED_SRC)/solaris
+endif
+
+ICONS = \
+    $(ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon16.png \
+    $(ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon24.png \
+    $(ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon32.png \
+    $(ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon48.png
+
+ICONPATH=$(SHARE_SRC)/classes/sun/awt/resources
+
+ICONS += \
+   $(ICONPATH)/security-icon-bw16.png \
+   $(ICONPATH)/security-icon-interim16.png \
+   $(ICONPATH)/security-icon-yellow16.png \
+   $(ICONPATH)/security-icon-bw24.png \
+   $(ICONPATH)/security-icon-interim24.png \
+   $(ICONPATH)/security-icon-yellow24.png \
+   $(ICONPATH)/security-icon-bw32.png \
+   $(ICONPATH)/security-icon-interim32.png \
+   $(ICONPATH)/security-icon-yellow32.png \
+   $(ICONPATH)/security-icon-bw48.png \
+   $(ICONPATH)/security-icon-interim48.png \
+   $(ICONPATH)/security-icon-yellow48.png
+
+TEMPDIR_CLASSES = $(TEMPDIR)/classes
+   
+generated.clean:
+	$(RM) -r $(GEN_DIR)/*.java
+	$(RM) -r $(TEMPDIR)/.gen_icons   
+
+$(TEMPDIR_CLASSES)/sun/awt/ToBin.class: ToBin.java
+	@$(prep-target)
+	$(BOOT_JAVAC_CMD) -d $(TEMPDIR_CLASSES) $<
+
+$(TEMPDIR)/.gen_icons: $(TEMPDIR_CLASSES)/sun/awt/ToBin.class $(ICONS)
+	$(prep-target)
+	for i in $(ICONS); do \
+            filename=`basename $$i`; \
+	    name=`$(ECHO) $$filename | $(TR) '\-.' '__'`;  \
+            classname=$(GEN_DIR)/AWTIcon32_$$name.java; \
+	    $(RM) $$classname; \
+	    $(ECHO) "package sun.awt;" >> $$classname ; \
+	    $(ECHO) "public class AWTIcon32_$$name {" >> $$classname; \
+	    $(ECHO) "public final static int[] $$name = { " >> $$classname;  \
+	    $(CAT) $$i | \
+	      $(BOOT_JAVA_CMD) -cp $(TEMPDIR_CLASSES)  \
+		-Djava.awt.headless=true \
+		sun.awt.ToBin >> $$classname; \
+	    $(ECHO) "}; }" >> $$classname;  \
+            classname=$(GEN_DIR)/AWTIcon64_$$name.java; \
+	    $(RM) $$classname; \
+	    $(ECHO) "package sun.awt;" >> $$classname ; \
+	    $(ECHO) "public class AWTIcon64_$$name {" >> $$classname; \
+	    $(ECHO) "public final static long[] $$name = { " >> $$classname;  \
+	    $(CAT) $$i | \
+	      $(BOOT_JAVA_CMD) -cp $(TEMPDIR_CLASSES)  \
+		-Djava.awt.headless=true \
+		sun.awt.ToBin >> $$classname; \
+	    $(ECHO) "}; }" >> $$classname;  \
+	done
+	$(TOUCH) $@
+
+clean clobber:: generated.clean    
+endif
+
 
 ifeq ($(PLATFORM), windows)
 # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv WINDOWS
@@ -570,5 +647,5 @@
 		  java.lang.Integer \
 		  java.lang.ThreadGroup
 
-.PHONY: dgalibs dgalib.clean fontconfigs fontconfigs.clean
+.PHONY: dgalibs dgalib.clean fontconfigs fontconfigs.clean generated.clean
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/sun/awt/ToBin.java	Fri Jun 28 19:37:48 2013 -0700
@@ -0,0 +1,59 @@
+/*
+ * 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
+ * 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.awt;
+
+import java.io.*;
+import java.awt.image.*;
+import javax.imageio.*;
+import java.awt.*;
+
+public class ToBin {
+    public static void main(String[] args) throws Exception {
+        BufferedImage im = ImageIO.read(System.in);
+        BufferedImage bi = null;
+        int iconWidth = im.getWidth(null);
+        int iconHeight = im.getHeight(null);
+        if (im != null && iconHeight != 0 &&  iconWidth != 0) {
+            bi = new BufferedImage(iconWidth, iconHeight, BufferedImage.TYPE_INT_ARGB);
+            Graphics g = bi.getGraphics();
+            try {
+                g.drawImage(im, 0, 0, iconWidth, iconHeight, null);
+            } finally {
+                g.dispose();
+            }
+        }
+        DataBuffer srcBuf = bi.getData().getDataBuffer();
+        int[] buf = ((DataBufferInt)srcBuf).getData();
+        System.out.print(iconWidth + ",");
+        System.out.println(iconHeight + ",");
+        for (int i = 0; i < buf.length; i++) {
+            System.out.print("0x" + Integer.toHexString(buf[i]) + ", ");
+            if (i % 10 == 0) {
+                System.out.println();
+            }
+        }
+    }
+}
--- a/make/sun/lwawt/FILES_export_macosx.gmk	Wed Jun 26 13:49:16 2013 +0400
+++ b/make/sun/lwawt/FILES_export_macosx.gmk	Fri Jun 28 19:37:48 2013 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -109,6 +109,7 @@
         sun/lwawt/LWToolkit.java \
         sun/lwawt/LWWindowPeer.java \
         sun/lwawt/PlatformWindow.java \
+        sun/lwawt/SecurityWarningWindow.java \
         sun/lwawt/SelectionClearListener.java \
         sun/lwawt/macosx/CPrinterDevice.java \
         sun/lwawt/macosx/CPrinterDialog.java \
@@ -143,6 +144,7 @@
         sun/lwawt/macosx/CMouseInfoPeer.java \
         sun/lwawt/macosx/CPlatformView.java \
         sun/lwawt/macosx/CPlatformWindow.java \
+        sun/lwawt/macosx/CWarningWindow.java \
         sun/lwawt/macosx/CPlatformComponent.java \
         sun/lwawt/macosx/CEmbeddedFrame.java \
         sun/lwawt/macosx/CPlatformEmbeddedFrame.java \
--- a/make/sun/xawt/Makefile	Wed Jun 26 13:49:16 2013 +0400
+++ b/make/sun/xawt/Makefile	Fri Jun 28 19:37:48 2013 -0700
@@ -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
@@ -32,7 +32,7 @@
 
 GEN_DIR=$(GENSRCDIR)/sun/awt/X11
 
-CLASSES_INIT += $(TEMPDIR)/.gen.wrappers $(TEMPDIR)/.gen_icons touch.wrappers
+CLASSES_INIT += $(TEMPDIR)/.gen.wrappers touch.wrappers
 
 .PHONY: generated.clean
 
@@ -317,70 +317,7 @@
 	$(RM) -r $(WRAPPER_GENERATOR_TEMPDIR)
 	$(RM) -r $(WRAPPER_GENERATOR_DIR)
 	$(RM) -r $(GEN_DIR)/*.java
-	$(RM) -r $(TEMPDIR)/.gen_icons
 
-ifdef OPENJDK
-    ICONS_PATH_PREFIX=$(PLATFORM_SRC)
-else
-    ICONS_PATH_PREFIX=$(CLOSED_SRC)/solaris
-endif
-
-ICONS = \
-    $(ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon16.png \
-    $(ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon24.png \
-    $(ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon32.png \
-    $(ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon48.png
-
-
-ICONPATH=$(PLATFORM_SRC)/classes/sun/awt/X11
-
-ICONS += \
-   $(ICONPATH)/security-icon-bw16.png \
-   $(ICONPATH)/security-icon-interim16.png \
-   $(ICONPATH)/security-icon-yellow16.png \
-   $(ICONPATH)/security-icon-bw24.png \
-   $(ICONPATH)/security-icon-interim24.png \
-   $(ICONPATH)/security-icon-yellow24.png \
-   $(ICONPATH)/security-icon-bw32.png \
-   $(ICONPATH)/security-icon-interim32.png \
-   $(ICONPATH)/security-icon-yellow32.png \
-   $(ICONPATH)/security-icon-bw48.png \
-   $(ICONPATH)/security-icon-interim48.png \
-   $(ICONPATH)/security-icon-yellow48.png
-
-TEMPDIR_CLASSES = $(TEMPDIR)/classes
-
-$(TEMPDIR_CLASSES)/sun/awt/X11/ToBin.class: ToBin.java
-	@$(prep-target)
-	$(BOOT_JAVAC_CMD) -d $(TEMPDIR_CLASSES) $<
-
-$(TEMPDIR)/.gen_icons: $(TEMPDIR_CLASSES)/sun/awt/X11/ToBin.class $(ICONS)
-	$(prep-target)
-	for i in $(ICONS); do \
-            filename=`basename $$i`; \
-	    name=`$(ECHO) $$filename | $(TR) '\-.' '__'`;  \
-            classname=$(GEN_DIR)/XAWTIcon32_$$name.java; \
-	    $(RM) $$classname; \
-	    $(ECHO) "package sun.awt.X11;" >> $$classname ; \
-	    $(ECHO) "public class XAWTIcon32_$$name {" >> $$classname; \
-	    $(ECHO) "public static int[] $$name = { " >> $$classname;  \
-	    $(CAT) $$i | \
-	      $(BOOT_JAVA_CMD) -cp $(TEMPDIR_CLASSES)  \
-		-Djava.awt.headless=true \
-		sun.awt.X11.ToBin >> $$classname; \
-	    $(ECHO) "}; }" >> $$classname;  \
-            classname=$(GEN_DIR)/XAWTIcon64_$$name.java; \
-	    $(RM) $$classname; \
-	    $(ECHO) "package sun.awt.X11;" >> $$classname ; \
-	    $(ECHO) "public class XAWTIcon64_$$name {" >> $$classname; \
-	    $(ECHO) "public static long[] $$name = { " >> $$classname;  \
-	    $(CAT) $$i | \
-	      $(BOOT_JAVA_CMD) -cp $(TEMPDIR_CLASSES)  \
-		-Djava.awt.headless=true \
-		sun.awt.X11.ToBin >> $$classname; \
-	    $(ECHO) "}; }" >> $$classname;  \
-	done
-	$(TOUCH) $@
 
 clean clobber:: generated.clean
 
--- a/make/sun/xawt/ToBin.java	Wed Jun 26 13:49:16 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.awt.X11;
-
-import java.io.*;
-import java.awt.image.*;
-import javax.imageio.*;
-import java.awt.*;
-
-public class ToBin {
-    public static void main(String[] args) throws Exception {
-        BufferedImage im = ImageIO.read(System.in);
-        BufferedImage bi = null;
-        int iconWidth = im.getWidth(null);
-        int iconHeight = im.getHeight(null);
-        if (im != null && iconHeight != 0 &&  iconWidth != 0) {
-            bi = new BufferedImage(iconWidth, iconHeight, BufferedImage.TYPE_INT_ARGB);
-            Graphics g = bi.getGraphics();
-            try {
-                g.drawImage(im, 0, 0, iconWidth, iconHeight, null);
-            } finally {
-                g.dispose();
-            }
-        }
-        DataBuffer srcBuf = bi.getData().getDataBuffer();
-        int[] buf = ((DataBufferInt)srcBuf).getData();
-        System.out.print(iconWidth + ",");
-        System.out.println(iconHeight + ",");
-        for (int i = 0; i < buf.length; i++) {
-            System.out.print("0x" + Integer.toHexString(buf[i]) + ", ");
-            if (i % 10 == 0) {
-                System.out.println();
-            }
-        }
-    }
-}
--- a/makefiles/CompileNativeLibraries.gmk	Wed Jun 26 13:49:16 2013 +0400
+++ b/makefiles/CompileNativeLibraries.gmk	Fri Jun 28 19:37:48 2013 -0700
@@ -2055,7 +2055,7 @@
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
 	BUILD_LIBJLI_FILES += java_md.c \
-			      cmdtoargs.c
+			      cmdtoargs.c	
         # Staticically link with c runtime on windows.
 	LIBJLI_CFLAGS:=$(filter-out -MD,$(LIBJLI_CFLAGS))
 else ifneq ($(OPENJDK_TARGET_OS), macosx)
@@ -2916,7 +2916,7 @@
 				PLATFORM_API_LinuxOS_ALSA_Ports.c,\
 		LANG:=C,\
 		OPTIMIZATION:=LOW, \
-		CFLAGS:=$(CFLAGS_JDKLIB) \
+		CFLAGS:=$(CFLAGS_JDKLIB) $(ALSA_CFLAGS) \
 			$(LIBJSOUND_CFLAGS) \
 			-DUSE_DAUDIO=TRUE \
 			-DUSE_PORTS=TRUE  \
@@ -2925,7 +2925,7 @@
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjsoundalsa/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB)\
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		LDFLAGS_SUFFIX:=-lasound -ljava -ljvm,\
+		LDFLAGS_SUFFIX:=$(ALSA_LIBS) -ljava -ljvm,\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjsoundalsa,\
 		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
--- a/makefiles/CopyFiles.gmk	Wed Jun 26 13:49:16 2013 +0400
+++ b/makefiles/CopyFiles.gmk	Fri Jun 28 19:37:48 2013 -0700
@@ -200,7 +200,7 @@
 
 ifdef OPENJDK
     ICCPROFILE_SRC_DIR := $(JDK_TOPDIR)/src/share/lib/cmm/lcms
-else 
+else
     ICCPROFILE_SRC_DIR := $(JDK_TOPDIR)/src/closed/share/lib/cmm/kcms
 endif
 
@@ -217,29 +217,29 @@
 
 #make sure freetype dll will be available at runtime as well as link time
 #
-#NB: Default freetype build system uses -h linker option and 
-#   result .so contains hardcoded library name that is later 
-#   used for adding dependencies to other objects 
+#NB: Default freetype build system uses -h linker option and
+#   result .so contains hardcoded library name that is later
+#   used for adding dependencies to other objects
 #   (e.g. libfontmanager.so).
-#   
+#
 #   It is not obvious how to extract that hardcoded name (libfreetype.so.6)
 #   without overcomplicating logic here.
 #   To workaround this we hardcode .6 suffix for now.
 #
 #   Note that .so.6 library will not be found by System.loadLibrary()
-#        but fortunately we need to load FreeType library explicitly 
-#        on windows only  
+#        but fortunately we need to load FreeType library explicitly
+#        on windows only
 #
 #TODO: rework this to avoid hardcoding library name in the makefile
 #
 ifdef OPENJDK
     ifeq ($(OPENJDK_TARGET_OS), windows)
         FREETYPE_LIB = $(JDK_OUTPUTDIR)/bin/$(call SHARED_LIBRARY,freetype)
-    else 
+    else
         ifeq ($(USING_SYSTEM_FT_LIB), false)
             FREETYPE_LIB = $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/$(call SHARED_LIBRARY,freetype).6
         endif
-    endif 
+    endif
 
     $(FREETYPE_LIB): $(FREETYPE2_LIB_PATH)/$(call SHARED_LIBRARY,freetype)
 	$(CP) $(FREETYPE2_LIB_PATH)/$(call SHARED_LIBRARY,freetype) $@
@@ -537,3 +537,5 @@
 COPY_FILES += $(JDK_OUTPUTDIR)/lib/sound.properties
 
 ##########################################################################################
+
+-include $(CUSTOM_MAKE_DIR)/CopyFiles.gmk
--- a/makefiles/CopyIntoClasses.gmk	Wed Jun 26 13:49:16 2013 +0400
+++ b/makefiles/CopyIntoClasses.gmk	Fri Jun 28 19:37:48 2013 -0700
@@ -42,7 +42,7 @@
   $(JSTAT_RESOURCEDIR)/jstat_options \
   $(JSTAT_RESOURCEDIR)/jstat_unsupported_options
 
-# Extra jhat files 
+# Extra jhat files
 JHAT_RESOURCEDIR = $(JDK_TOPDIR)/src/share/classes/com/sun/tools/hat/resources
 COPY_FILES += \
   $(JHAT_RESOURCEDIR)/hat.js \
@@ -53,7 +53,7 @@
 JRUNSCRIPT_RESOURCEDIR = $(JDK_TOPDIR)/src/share/classes/com/sun/tools/script/shell
 COPY_FILES += \
   $(JRUNSCRIPT_RESOURCEDIR)/init.js \
-  $(JRUNSCRIPT_RESOURCEDIR)/messages.properties 
+  $(JRUNSCRIPT_RESOURCEDIR)/messages.properties
 
 # Extra jvmstat files
 COPY_FILES += \
@@ -91,6 +91,12 @@
     $(SWING_PLAF_WINDOWS_RESOURCES_DIR_CLOSED)/icons/JavaCup32.png
 endif
 
+ifndef OPENJDK
+  JFR_CONFIGURATION_DIR_CLOSED = $(JDK_TOPDIR)/src/closed/share/classes/oracle/jrockit/jfr/settings
+  COPY_FILES += \
+    $(JFR_CONFIGURATION_DIR_CLOSED)/jfc.xsd
+endif
+
 SWING_PLAF_BASIC_RESOURCES_DIR = $(JDK_TOPDIR)/src/share/classes/javax/swing/plaf/basic
 COPY_FILES += \
   $(wildcard $(SWING_PLAF_BASIC_RESOURCES_DIR)/icons/*.png)
@@ -154,7 +160,7 @@
 # Copy the META-INF/services configuration files that are scattered around the source tree
 # into classes/META-INF/services. Be aware that META-INF directories that are located at a
 # source root (.../classes/META-INF) are automatically copied verbatim by the
-# SetupJavaCompilation macro. 
+# SetupJavaCompilation macro.
 #
 # Any other META-INF/services configuration file is found here and platform specific comments
 # are uncommented and the configuration file is stored in the output META-INF directory.
@@ -207,7 +213,7 @@
 # Eval the newly created rules to incorporate them into the make tree.
 define addto_meta-inf_services
 $1
-	echo $(LOG_INFO) Installing META-INF/services/$$(@F) 
+	echo $(LOG_INFO) Installing META-INF/services/$$(@F)
 	$(CAT) $$< | $(SED) -e "s/^#\[$(OPENJDK_TARGET_OS)\]//" > $$@
 endef
 $(foreach i,$(META-INF_RULES_SERVICES),$(eval $(call addto_meta-inf_services,$i)))
--- a/makefiles/CreateJars.gmk	Wed Jun 26 13:49:16 2013 +0400
+++ b/makefiles/CreateJars.gmk	Fri Jun 28 19:37:48 2013 -0700
@@ -426,6 +426,7 @@
 ifeq ($(ENABLE_JFR), true)
     $(eval $(call SetupArchive,BUILD_JFR_JAR,,\
 		SRCS:=$(JDK_OUTPUTDIR)/classes,\
+		SUFFIXES:=.class .jfc .xsd,\
 		INCLUDES:=com/oracle/jrockit/jfr \
 			  oracle/jrockit/jfr,\
 		JAR:=$(IMAGES_OUTPUTDIR)/lib/jfr.jar,\
--- a/makefiles/GenerateJavaSources.gmk	Wed Jun 26 13:49:16 2013 +0400
+++ b/makefiles/GenerateJavaSources.gmk	Fri Jun 28 19:37:48 2013 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -67,7 +67,7 @@
 
 ifneq ($(OPENJDK_TARGET_OS),windows)
 include GensrcIcons.gmk
-GENSRC += $(GENSRC_X11_ICONS)
+GENSRC += $(GENSRC_AWT_ICONS)
 
 ifeq ($(OPENJDK_TARGET_OS),macosx)
 GENSRC += $(GENSRC_OSX_ICONS)
--- a/makefiles/GensrcIcons.gmk	Wed Jun 26 13:49:16 2013 +0400
+++ b/makefiles/GensrcIcons.gmk	Fri Jun 28 19:37:48 2013 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -23,10 +23,10 @@
 # questions.
 #
 
-GENSRC_X11_ICONS :=
-GENSRC_X11_ICONS_SRC :=
-GENSRC_X11_ICONS_TMP := $(JDK_OUTPUTDIR)/gensrc
-GENSRC_X11_ICONS_DST := $(GENSRC_X11_ICONS_TMP)/sun/awt/X11
+GENSRC_AWT_ICONS :=
+GENSRC_AWT_ICONS_SRC :=
+GENSRC_AWT_ICONS_TMP := $(JDK_OUTPUTDIR)/gensrc
+GENSRC_AWT_ICONS_DST := $(GENSRC_AWT_ICONS_TMP)/sun/awt/
 
 ifdef OPENJDK
   X11_ICONS_PATH_PREFIX := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)
@@ -34,76 +34,76 @@
   X11_ICONS_PATH_PREFIX := $(JDK_TOPDIR)/src/closed/solaris
 endif
 
-GENSRC_X11_ICONS_SRC += \
+GENSRC_AWT_ICONS_SRC += \
     $(X11_ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon16.png \
     $(X11_ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon24.png \
     $(X11_ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon32.png \
     $(X11_ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon48.png
 
 
-X11_ICONPATH := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes/sun/awt/X11
+AWT_ICONPATH := $(JDK_TOPDIR)/src/share/classes/sun/awt/resources
 
-GENSRC_X11_ICONS_SRC += \
-   $(X11_ICONPATH)/security-icon-bw16.png \
-   $(X11_ICONPATH)/security-icon-interim16.png \
-   $(X11_ICONPATH)/security-icon-yellow16.png \
-   $(X11_ICONPATH)/security-icon-bw24.png \
-   $(X11_ICONPATH)/security-icon-interim24.png \
-   $(X11_ICONPATH)/security-icon-yellow24.png \
-   $(X11_ICONPATH)/security-icon-bw32.png \
-   $(X11_ICONPATH)/security-icon-interim32.png \
-   $(X11_ICONPATH)/security-icon-yellow32.png \
-   $(X11_ICONPATH)/security-icon-bw48.png \
-   $(X11_ICONPATH)/security-icon-interim48.png \
-   $(X11_ICONPATH)/security-icon-yellow48.png
+GENSRC_AWT_ICONS_SRC += \
+   $(AWT_ICONPATH)/security-icon-bw16.png \
+   $(AWT_ICONPATH)/security-icon-interim16.png \
+   $(AWT_ICONPATH)/security-icon-yellow16.png \
+   $(AWT_ICONPATH)/security-icon-bw24.png \
+   $(AWT_ICONPATH)/security-icon-interim24.png \
+   $(AWT_ICONPATH)/security-icon-yellow24.png \
+   $(AWT_ICONPATH)/security-icon-bw32.png \
+   $(AWT_ICONPATH)/security-icon-interim32.png \
+   $(AWT_ICONPATH)/security-icon-yellow32.png \
+   $(AWT_ICONPATH)/security-icon-bw48.png \
+   $(AWT_ICONPATH)/security-icon-interim48.png \
+   $(AWT_ICONPATH)/security-icon-yellow48.png
 
-GENSRC_X11_ICONS_FILES := $(notdir $(GENSRC_X11_ICONS_SRC))
+GENSRC_AWT_ICONS_FILES := $(notdir $(GENSRC_AWT_ICONS_SRC))
 
-GENSRC_X11_ICONS_SHORT_NAME = $(subst .,_,$(subst -,_,$(1)))
-GENSRC_X11_ICONS_DST_NAME = XAWTIcon$(2)_$(subst .,_,$(subst -,_,$(1)))
+GENSRC_AWT_ICONS_SHORT_NAME = $(subst .,_,$(subst -,_,$(1)))
+GENSRC_AWT_ICONS_DST_NAME = AWTIcon$(2)_$(subst .,_,$(subst -,_,$(1)))
 
 ###
 
-$(GENSRC_X11_ICONS_TMP)/_the.icons.dir :
+$(GENSRC_AWT_ICONS_TMP)/_the.icons.dir :
 	$(ECHO) Generating icon classes
-	$(MKDIR) -p $(GENSRC_X11_ICONS_DST)
+	$(MKDIR) -p $(GENSRC_AWT_ICONS_DST)
 	$(TOUCH) $@
 
 ###
 
-define SetupGensrcX11Icon
+define SetupGensrcAWTIcon
         # param 1 is for src-file
         # param 2 is for src-dir
-	$1_SHORTNAME := $(call GENSRC_X11_ICONS_SHORT_NAME,$1)
-	$1_NAME32 := $(call GENSRC_X11_ICONS_DST_NAME,$1,32)
-	$1_TARGET32 := $(GENSRC_X11_ICONS_DST)/$$($1_NAME32).java
-	$1_NAME64 := $(call GENSRC_X11_ICONS_DST_NAME,$1,64)
-	$1_TARGET64 := $(GENSRC_X11_ICONS_DST)/$$($1_NAME64).java
+	$1_SHORTNAME := $(call GENSRC_AWT_ICONS_SHORT_NAME,$1)
+	$1_NAME32 := $(call GENSRC_AWT_ICONS_DST_NAME,$1,32)
+	$1_TARGET32 := $(GENSRC_AWT_ICONS_DST)/$$($1_NAME32).java
+	$1_NAME64 := $(call GENSRC_AWT_ICONS_DST_NAME,$1,64)
+	$1_TARGET64 := $(GENSRC_AWT_ICONS_DST)/$$($1_NAME64).java
 
-$$($1_TARGET32) : $2/$1 $(GENSRC_X11_ICONS_TMP)/_the.icons.dir
+$$($1_TARGET32) : $2/$1 $(GENSRC_AWT_ICONS_TMP)/_the.icons.dir
 	$(RM) $$@ $$@.tmp
-	$(ECHO) "package sun.awt.X11;" > $$@.tmp
+	$(ECHO) "package sun.awt;" > $$@.tmp
 	$(ECHO) "public class $$($1_NAME32) {" >> $$@.tmp
 	$(ECHO) "public static int[] $$($1_SHORTNAME) = { " >> $$@.tmp
-	$(CAT) $$< | $(TOOL_X11_TOBIN) >> $$@.tmp
+	$(CAT) $$< | $(TOOL_AWT_TOBIN) >> $$@.tmp
 	$(ECHO) "}; }" >> $$@.tmp
 	$(MV) $$@.tmp $$@
 
-GENSRC_X11_ICONS += $$($1_TARGET32)
+GENSRC_AWT_ICONS += $$($1_TARGET32)
 
-$$($1_TARGET64) : $2/$1 $(GENSRC_X11_ICONS_TMP)/_the.icons.dir
+$$($1_TARGET64) : $2/$1 $(GENSRC_AWT_ICONS_TMP)/_the.icons.dir
 	$(RM) $$@ $$@.tmp
-	$(ECHO) "package sun.awt.X11;" > $$@.tmp
+	$(ECHO) "package sun.awt;" > $$@.tmp
 	$(ECHO) "public class $$($1_NAME64) {" >> $$@.tmp
 	$(ECHO) "public static long[] $$($1_SHORTNAME) = { " >> $$@.tmp
-	$(CAT) $$< | $(TOOL_X11_TOBIN) >> $$@.tmp
+	$(CAT) $$< | $(TOOL_AWT_TOBIN) >> $$@.tmp
 	$(ECHO) "}; }" >> $$@.tmp
 	$(MV) $$@.tmp $$@
 
-GENSRC_X11_ICONS += $$($1_TARGET64)
+GENSRC_AWT_ICONS += $$($1_TARGET64)
 endef
 
-$(foreach I,$(GENSRC_X11_ICONS_SRC), $(eval $(call SetupGensrcX11Icon,$(notdir $(I)),$(dir $(I)))))
+$(foreach I,$(GENSRC_AWT_ICONS_SRC), $(eval $(call SetupGensrcAWTIcon,$(notdir $(I)),$(dir $(I)))))
 
 ###
 
--- a/makefiles/Tools.gmk	Wed Jun 26 13:49:16 2013 +0400
+++ b/makefiles/Tools.gmk	Fri Jun 28 19:37:48 2013 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
     $(JDK_TOPDIR)/makefiles/sun))
 
 TOOLS_SRC:=$(JDK_TOPDIR)/make/tools/src \
-           $(JDK_TOPDIR)/makefiles/sun/awt/X11 \
+           $(JDK_TOPDIR)/makefiles/sun/awt/ \
            $(JDK_TOPDIR)/makefiles/sun/osxapp \
            $(JDK_TOPDIR)/make/tools/swing-beans
 
@@ -134,8 +134,8 @@
 TOOL_WRAPPERGENERATOR=$(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
 	WrapperGenerator
 
-TOOL_X11_TOBIN=$(JAVA) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \
-	sun.awt.X11.ToBin
+TOOL_AWT_TOBIN=$(JAVA) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \
+	sun.awt.ToBin
 
 TOOL_OSX_TOBIN=$(JAVA) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \
 	sun.osxapp.ToBin
--- a/makefiles/mapfiles/libjfr/mapfile-vers	Wed Jun 26 13:49:16 2013 +0400
+++ b/makefiles/mapfiles/libjfr/mapfile-vers	Fri Jun 28 19:37:48 2013 -0700
@@ -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.
 # ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 #
 
@@ -17,7 +17,7 @@
       Java_oracle_jrockit_jfr_VMJFR_addConstPool;
       Java_oracle_jrockit_jfr_VMJFR_removeConstPool;
       Java_oracle_jrockit_jfr_VMJFR_storeConstPool;
-      Java_oracle_jrockit_jfr_VMJFR_classID;
+      Java_oracle_jrockit_jfr_VMJFR_classID0;
       Java_oracle_jrockit_jfr_VMJFR_stackTraceID;
       Java_oracle_jrockit_jfr_VMJFR_threadID;
       Java_oracle_jrockit_jfr_VMJFR_rotate;
@@ -33,7 +33,8 @@
       Java_oracle_jrockit_jfr_VMJFR_setPeriod;
       Java_oracle_jrockit_jfr_VMJFR_getPeriod;
       Java_oracle_jrockit_jfr_VMJFR_descriptors;
-            JNI_OnLoad;
+      Java_oracle_jrockit_jfr_VMJFR_redefineClass0;
+      JNI_OnLoad;
   local:
       *;
 };
--- a/makefiles/mapfiles/libjli/mapfile-vers	Wed Jun 26 13:49:16 2013 +0400
+++ b/makefiles/mapfiles/libjli/mapfile-vers	Fri Jun 28 19:37:48 2013 -0700
@@ -36,6 +36,7 @@
 		JLI_ReportExceptionDescription;
 		JLI_GetStdArgs;
 		JLI_GetStdArgc;
+		
 	local:
 		*;
 };
--- a/makefiles/mapfiles/libnio/mapfile-linux	Wed Jun 26 13:49:16 2013 +0400
+++ b/makefiles/mapfiles/libnio/mapfile-linux	Fri Jun 28 19:37:48 2013 -0700
@@ -117,6 +117,7 @@
 		Java_sun_nio_ch_Net_getInterface6;
 		Java_sun_nio_ch_Net_shutdown;
 		Java_sun_nio_ch_Net_poll;
+                Java_sun_nio_ch_Net_isExclusiveBindAvailable;
                 Java_sun_nio_ch_PollArrayWrapper_interrupt;
                 Java_sun_nio_ch_PollArrayWrapper_poll0;
                 Java_sun_nio_ch_ServerSocketChannelImpl_accept0;
--- a/makefiles/mapfiles/libnio/mapfile-macosx	Wed Jun 26 13:49:16 2013 +0400
+++ b/makefiles/mapfiles/libnio/mapfile-macosx	Fri Jun 28 19:37:48 2013 -0700
@@ -109,6 +109,7 @@
 		Java_sun_nio_ch_Net_getInterface6;
 		Java_sun_nio_ch_Net_shutdown;
 		Java_sun_nio_ch_Net_poll;
+                Java_sun_nio_ch_Net_isExclusiveBindAvailable;
                 Java_sun_nio_ch_PollArrayWrapper_interrupt;
                 Java_sun_nio_ch_PollArrayWrapper_poll0;
                 Java_sun_nio_ch_ServerSocketChannelImpl_accept0;
--- a/makefiles/mapfiles/libnio/mapfile-solaris	Wed Jun 26 13:49:16 2013 +0400
+++ b/makefiles/mapfiles/libnio/mapfile-solaris	Fri Jun 28 19:37:48 2013 -0700
@@ -105,6 +105,7 @@
 		Java_sun_nio_ch_Net_getInterface6;
 		Java_sun_nio_ch_Net_shutdown;
 		Java_sun_nio_ch_Net_poll;
+                Java_sun_nio_ch_Net_isExclusiveBindAvailable;
                 Java_sun_nio_ch_PollArrayWrapper_interrupt;
                 Java_sun_nio_ch_PollArrayWrapper_poll0;
                 Java_sun_nio_ch_ServerSocketChannelImpl_accept0;
--- a/makefiles/mapfiles/libzip/mapfile-vers	Wed Jun 26 13:49:16 2013 +0400
+++ b/makefiles/mapfiles/libzip/mapfile-vers	Fri Jun 28 19:37:48 2013 -0700
@@ -65,6 +65,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;
--- a/makefiles/mapfiles/libzip/reorder-sparc	Wed Jun 26 13:49:16 2013 +0400
+++ b/makefiles/mapfiles/libzip/reorder-sparc	Fri Jun 28 19:37:48 2013 -0700
@@ -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_ZipFile_freeEntry;
 text: .text%Java_java_util_zip_ZipFile_getEntryTime;
--- a/makefiles/mapfiles/libzip/reorder-sparcv9	Wed Jun 26 13:49:16 2013 +0400
+++ b/makefiles/mapfiles/libzip/reorder-sparcv9	Fri Jun 28 19:37:48 2013 -0700
@@ -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_ZipFile_freeEntry;
 text: .text%Java_java_util_zip_ZipFile_getEntryTime;
--- a/makefiles/mapfiles/libzip/reorder-x86	Wed Jun 26 13:49:16 2013 +0400
+++ b/makefiles/mapfiles/libzip/reorder-x86	Fri Jun 28 19:37:48 2013 -0700
@@ -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_ZipFile_freeEntry;
 text: .text%Java_java_util_zip_ZipFile_getEntryTime;
--- a/makefiles/scripts/genExceptions.sh	Wed Jun 26 13:49:16 2013 +0400
+++ b/makefiles/scripts/genExceptions.sh	Fri Jun 28 19:37:48 2013 -0700
@@ -70,7 +70,7 @@
     private $ARG_TYPE $ARG_ID;
 
     /**
-     * Constructs an instance of this class. </p>
+     * Constructs an instance of this class.
      *
      * @param  $ARG_ID
      *         The $ARG_PHRASE
@@ -81,7 +81,7 @@
     }
 
     /**
-     * Retrieves the $ARG_PHRASE. </p>
+     * Retrieves the $ARG_PHRASE.
      *
      * @return  The $ARG_PHRASE
      */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/makefiles/sun/awt/ToBin.java	Fri Jun 28 19:37:48 2013 -0700
@@ -0,0 +1,59 @@
+/*
+ * 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
+ * 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.awt;
+
+import java.io.*;
+import java.awt.image.*;
+import javax.imageio.*;
+import java.awt.*;
+
+public class ToBin {
+    public static void main(String[] args) throws Exception {
+        BufferedImage im = ImageIO.read(System.in);
+        BufferedImage bi = null;
+        int iconWidth = im.getWidth(null);
+        int iconHeight = im.getHeight(null);
+        if (im != null && iconHeight != 0 &&  iconWidth != 0) {
+            bi = new BufferedImage(iconWidth, iconHeight, BufferedImage.TYPE_INT_ARGB);
+            Graphics g = bi.getGraphics();
+            try {
+                g.drawImage(im, 0, 0, iconWidth, iconHeight, null);
+            } finally {
+                g.dispose();
+            }
+        }
+        DataBuffer srcBuf = bi.getData().getDataBuffer();
+        int[] buf = ((DataBufferInt)srcBuf).getData();
+        System.out.print(iconWidth + ",");
+        System.out.println(iconHeight + ",");
+        for (int i = 0; i < buf.length; i++) {
+            System.out.print("0x" + Integer.toHexString(buf[i]) + ", ");
+            if (i % 10 == 0) {
+                System.out.println();
+            }
+        }
+    }
+}
--- a/makefiles/sun/awt/X11/ToBin.java	Wed Jun 26 13:49:16 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.awt.X11;
-
-import java.io.*;
-import java.awt.image.*;
-import javax.imageio.*;
-import java.awt.*;
-
-public class ToBin {
-    public static void main(String[] args) throws Exception {
-        BufferedImage im = ImageIO.read(System.in);
-        BufferedImage bi = null;
-        int iconWidth = im.getWidth(null);
-        int iconHeight = im.getHeight(null);
-        if (im != null && iconHeight != 0 &&  iconWidth != 0) {
-            bi = new BufferedImage(iconWidth, iconHeight, BufferedImage.TYPE_INT_ARGB);
-            Graphics g = bi.getGraphics();
-            try {
-                g.drawImage(im, 0, 0, iconWidth, iconHeight, null);
-            } finally {
-                g.dispose();
-            }
-        }
-        DataBuffer srcBuf = bi.getData().getDataBuffer();
-        int[] buf = ((DataBufferInt)srcBuf).getData();
-        System.out.print(iconWidth + ",");
-        System.out.println(iconHeight + ",");
-        for (int i = 0; i < buf.length; i++) {
-            System.out.print("0x" + Integer.toHexString(buf[i]) + ", ");
-            if (i % 10 == 0) {
-                System.out.println();
-            }
-        }
-    }
-}
--- a/src/macosx/classes/com/apple/laf/resources/aqua_pt_BR.properties	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/macosx/classes/com/apple/laf/resources/aqua_pt_BR.properties	Fri Jun 28 19:37:48 2013 -0700
@@ -154,7 +154,7 @@
 ############ Abstract Document Strings ############
 AbstractDocument.styleChange.textAndMnemonic=altera\u00E7\u00E3o de estilo
 AbstractDocument.addition.textAndMnemonic=adi\u00E7\u00E3o
-AbstractDocument.deletion.textAndMnemonic=dele\u00E7\u00E3o
+AbstractDocument.deletion.textAndMnemonic=exclus\u00E3o
 AbstractDocument.undo.textAndMnemonic=Desfazer
 AbstractDocument.redo.textAndMnemonic=Refazer
 
--- a/src/macosx/classes/sun/java2d/opengl/CGLLayer.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/macosx/classes/sun/java2d/opengl/CGLLayer.java	Fri Jun 28 19:37:48 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -73,8 +73,7 @@
     }
 
     public int getTransparency() {
-        return peer.isTranslucent() ? Transparency.TRANSLUCENT :
-               Transparency.OPAQUE;
+        return isOpaque() ? Transparency.OPAQUE : Transparency.TRANSLUCENT;
     }
 
     public Object getDestination() {
@@ -82,14 +81,14 @@
     }
 
     public SurfaceData replaceSurfaceData() {
-        if (peer.getBounds().isEmpty()) {
+        if (getBounds().isEmpty()) {
             surfaceData = NullSurfaceData.theInstance;
             return surfaceData;
         }
 
         // the layer redirects all painting to the buffer's graphics
         // and blits the buffer to the layer surface (in drawInCGLContext callback)
-        CGraphicsConfig gc = (CGraphicsConfig)peer.getGraphicsConfiguration();
+        CGraphicsConfig gc = (CGraphicsConfig)getGraphicsConfiguration();
         surfaceData = gc.createSurfaceData(this);
         setScale(gc.getDevice().getScaleFactor());
         // the layer holds a reference to the buffer, which in
--- a/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Fri Jun 28 19:37:48 2013 -0700
@@ -899,7 +899,7 @@
                                 boolean focusedWindowChangeAllowed, long time,
                                 CausedFocusEvent.Cause cause)
     {
-        if (focusLog.isLoggable(PlatformLogger.FINEST)) {
+        if (focusLog.isLoggable(PlatformLogger.Level.FINEST)) {
             focusLog.finest("lightweightChild=" + lightweightChild + ", temporary=" + temporary +
                             ", focusedWindowChangeAllowed=" + focusedWindowChangeAllowed +
                             ", time= " + time + ", cause=" + cause);
@@ -940,7 +940,7 @@
                         LWWindowPeer.getOwnerFrameDialog(parentPeer) : parentPeer;
 
                     if (decoratedPeer == null || !decoratedPeer.getPlatformWindow().isActive()) {
-                        if (focusLog.isLoggable(PlatformLogger.FINE)) {
+                        if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
                             focusLog.fine("request rejected, focusedWindowChangeAllowed==false, " +
                                           "decoratedPeer is inactive: " + decoratedPeer);
                         }
@@ -953,7 +953,7 @@
                 // If parent window can be made focused and has been made focused (synchronously)
                 // then we can proceed with children, otherwise we retreat
                 if (!res || !parentWindow.isFocused()) {
-                    if (focusLog.isLoggable(PlatformLogger.FINE)) {
+                    if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
                         focusLog.fine("request rejected, res= " + res + ", parentWindow.isFocused()=" +
                                       parentWindow.isFocused());
                     }
--- a/src/macosx/classes/sun/lwawt/LWKeyboardFocusManagerPeer.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/macosx/classes/sun/lwawt/LWKeyboardFocusManagerPeer.java	Fri Jun 28 19:37:48 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,9 +44,26 @@
 
     @Override
     public void setCurrentFocusedWindow(Window win) {
+        LWWindowPeer from, to;
+
         synchronized (this) {
+            if (focusedWindow == win) {
+                return;
+            }
+
+            from = (LWWindowPeer)LWToolkit.targetToPeer(focusedWindow);
+            to = (LWWindowPeer)LWToolkit.targetToPeer(win);
+
             focusedWindow = win;
         }
+
+        if (from != null) {
+            from.updateSecurityWarningVisibility();
+        }
+
+        if (to != null) {
+            to.updateSecurityWarningVisibility();
+        }
     }
 
     @Override
--- a/src/macosx/classes/sun/lwawt/LWToolkit.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/macosx/classes/sun/lwawt/LWToolkit.java	Fri Jun 28 19:37:48 2013 -0700
@@ -513,6 +513,8 @@
         return clipboard;
     }
 
+    protected abstract SecurityWarningWindow createSecurityWarning(Window ownerWindow, LWWindowPeer ownerPeer);
+
     // ---- DELEGATES ---- //
 
     public abstract Clipboard createPlatformClipboard();
--- a/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Fri Jun 28 19:37:48 2013 -0700
@@ -41,7 +41,7 @@
 
 public class LWWindowPeer
     extends LWContainerPeer<Window, JComponent>
-    implements FramePeer, DialogPeer, FullScreenCapable, DisplayChangedListener
+    implements FramePeer, DialogPeer, FullScreenCapable, DisplayChangedListener, PlatformEventNotifier
 {
     public static enum PeerType {
         SIMPLEWINDOW,
@@ -112,6 +112,8 @@
 
     private final PeerType peerType;
 
+    private final SecurityWarningWindow warningWindow;
+
     /**
      * Current modal blocker or null.
      *
@@ -158,11 +160,26 @@
         }
 
         platformWindow.initialize(target, this, ownerDelegate);
+
+        // Init warning window(for applets)
+        SecurityWarningWindow warn = null;
+        if (((Window)target).getWarningString() != null) {
+            // accessSystemTray permission allows to display TrayIcon, TrayIcon tooltip
+            // and TrayIcon balloon windows without a warning window.
+            if (!AWTAccessor.getWindowAccessor().isTrayIconWindow((Window)target)) {
+                LWToolkit toolkit = (LWToolkit)Toolkit.getDefaultToolkit();
+                warn = toolkit.createSecurityWarning(target, this);
+            }
+        }
+
+        warningWindow = warn;
     }
 
     @Override
     void initializeImpl() {
         super.initializeImpl();
+
+
         if (getTarget() instanceof Frame) {
             setTitle(((Frame) getTarget()).getTitle());
             setState(((Frame) getTarget()).getExtendedState());
@@ -217,12 +234,20 @@
         if (isGrabbing()) {
             ungrab();
         }
+        if (warningWindow != null) {
+            warningWindow.dispose();
+        }
+
         platformWindow.dispose();
         super.disposeImpl();
     }
 
     @Override
     protected void setVisibleImpl(final boolean visible) {
+        if (!visible && warningWindow != null) {
+            warningWindow.setVisible(false, false);
+        }
+
         super.setVisibleImpl(visible);
         // TODO: update graphicsConfig, see 4868278
         platformWindow.setVisible(visible);
@@ -453,7 +478,15 @@
 
     @Override
     public void repositionSecurityWarning() {
-        throw new RuntimeException("not implemented");
+        if (warningWindow != null) {
+            AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
+            Window target = getTarget();
+            int x = compAccessor.getX(target);
+            int y = compAccessor.getY(target);
+            int width = compAccessor.getWidth(target);
+            int height = compAccessor.getHeight(target);
+            warningWindow.reposition(x, y, width, height);
+        }
     }
 
     // ---- FRAME PEER METHODS ---- //
@@ -513,6 +546,7 @@
 
     // ---- PEER NOTIFICATIONS ---- //
 
+    @Override
     public void notifyIconify(boolean iconify) {
         //The toplevel target is Frame and states are applicable to it.
         //Otherwise, the target is Window and it don't have state property.
@@ -537,6 +571,7 @@
         }
     }
 
+    @Override
     public void notifyZoom(boolean isZoomed) {
         int newWindowState = isZoomed ? Frame.MAXIMIZED_BOTH : Frame.NORMAL;
         postWindowStateChangedEvent(newWindowState);
@@ -546,7 +581,8 @@
      * Called by the {@code PlatformWindow} when any part of the window should
      * be repainted.
      */
-    public final void notifyExpose(final Rectangle r) {
+    @Override
+    public void notifyExpose(final Rectangle r) {
         repaintPeer(r);
     }
 
@@ -556,7 +592,8 @@
      * LWComponentPeer as the only components which could be resized by user are
      * top-level windows.
      */
-    public final void notifyReshape(int x, int y, int w, int h) {
+    @Override
+    public void notifyReshape(int x, int y, int w, int h) {
         final boolean moved;
         final boolean resized;
         final boolean invalid = updateInsets(platformWindow.getInsets());
@@ -590,6 +627,8 @@
             handleResize(w, h, true);
             repaintPeer();
         }
+
+        repositionSecurityWarning();
     }
 
     private void clearBackground(final int w, final int h) {
@@ -617,16 +656,19 @@
         }
     }
 
+    @Override
     public void notifyUpdateCursor() {
         getLWToolkit().getCursorManager().updateCursorLater(this);
     }
 
+    @Override
     public void notifyActivation(boolean activation, LWWindowPeer opposite) {
         Window oppositeWindow = (opposite == null)? null : opposite.getTarget();
         changeFocusedWindow(activation, oppositeWindow);
     }
 
     // MouseDown in non-client area
+    @Override
     public void notifyNCMouseDown() {
         // Ungrab except for a click on a Dialog with the grabbing owner
         if (grabbingWindow != null &&
@@ -643,10 +685,11 @@
      * coordinates are relative to non-client window are, i.e. the top-left
      * point of the client area is (insets.top, insets.left).
      */
-    public void dispatchMouseEvent(int id, long when, int button,
-                                   int x, int y, int screenX, int screenY,
-                                   int modifiers, int clickCount, boolean popupTrigger,
-                                   byte[] bdata)
+    @Override
+    public void notifyMouseEvent(int id, long when, int button,
+                                 int x, int y, int screenX, int screenY,
+                                 int modifiers, int clickCount, boolean popupTrigger,
+                                 byte[] bdata)
     {
         // TODO: fill "bdata" member of AWTEvent
         Rectangle r = getBounds();
@@ -659,11 +702,9 @@
                 if (lastMouseEventPeer.isEnabled()) {
                     Point lp = lastMouseEventPeer.windowToLocal(x, y,
                             this);
-                    postEvent(new MouseEvent(lastMouseEventPeer.getTarget(),
-                            MouseEvent.MOUSE_EXITED, when,
-                            modifiers, lp.x, lp.y, screenX,
-                            screenY, clickCount, popupTrigger,
-                            button));
+                    Component target = lastMouseEventPeer.getTarget();
+                    postMouseExitedEvent(target, when, modifiers, lp,
+                            screenX, screenY, clickCount, popupTrigger, button);
                 }
 
                 // Sometimes we may get MOUSE_EXITED after lastCommonMouseEventPeer is switched
@@ -679,11 +720,9 @@
             if (targetPeer != null) {
                 if (targetPeer.isEnabled()) {
                     Point lp = targetPeer.windowToLocal(x, y, this);
-                        postEvent(new MouseEvent(targetPeer.getTarget(),
-                            MouseEvent.MOUSE_ENTERED, when,
-                            modifiers, lp.x, lp.y, screenX,
-                            screenY, clickCount, popupTrigger,
-                            button));
+                    Component target = targetPeer.getTarget();
+                    postMouseEnteredEvent(target, when, modifiers, lp,
+                            screenX, screenY, clickCount, popupTrigger, button);
                 }
                 lastCommonMouseEventPeer = targetPeer;
                 lastMouseEventPeer = targetPeer;
@@ -810,11 +849,9 @@
         // Generate Mouse Exit for components
         if (lastMouseEventPeer != null && lastMouseEventPeer.isEnabled()) {
             Point oldp = lastMouseEventPeer.windowToLocal(x, y, this);
-            postEvent(new MouseEvent(lastMouseEventPeer.getTarget(),
-                    MouseEvent.MOUSE_EXITED,
-                    when, modifiers,
-                    oldp.x, oldp.y, screenX, screenY,
-                    clickCount, popupTrigger, button));
+            Component target = lastMouseEventPeer.getTarget();
+            postMouseExitedEvent(target, when, modifiers, oldp, screenX, screenY,
+                    clickCount, popupTrigger, button);
         }
         lastCommonMouseEventPeer = targetPeer;
         lastMouseEventPeer = targetPeer;
@@ -822,18 +859,42 @@
         // Generate Mouse Enter for components
         if (targetPeer != null && targetPeer.isEnabled()) {
             Point newp = targetPeer.windowToLocal(x, y, this);
-            postEvent(new MouseEvent(targetPeer.getTarget(),
-                    MouseEvent.MOUSE_ENTERED,
-                    when, modifiers,
-                    newp.x, newp.y, screenX, screenY,
-                    clickCount, popupTrigger, button));
+            Component target = targetPeer.getTarget();
+            postMouseEnteredEvent(target, when, modifiers, newp, screenX, screenY, clickCount, popupTrigger, button);
         }
     }
 
-    public void dispatchMouseWheelEvent(long when, int x, int y, int modifiers,
-                                        int scrollType, int scrollAmount,
-                                        int wheelRotation, double preciseWheelRotation,
-                                        byte[] bdata)
+    private void postMouseEnteredEvent(Component target, long when, int modifiers,
+                                       Point loc, int xAbs, int yAbs,
+                                       int clickCount, boolean popupTrigger, int button) {
+
+        updateSecurityWarningVisibility();
+
+        postEvent(new MouseEvent(target,
+                MouseEvent.MOUSE_ENTERED,
+                when, modifiers,
+                loc.x, loc.y, xAbs, yAbs,
+                clickCount, popupTrigger, button));
+    }
+
+    private void postMouseExitedEvent(Component target, long when, int modifiers,
+                                      Point loc, int xAbs, int yAbs,
+                                      int clickCount, boolean popupTrigger, int button) {
+
+        updateSecurityWarningVisibility();
+
+        postEvent(new MouseEvent(target,
+                MouseEvent.MOUSE_EXITED,
+                when, modifiers,
+                loc.x, loc.y, xAbs, yAbs,
+                clickCount, popupTrigger, button));
+    }
+
+    @Override
+    public void notifyMouseWheelEvent(long when, int x, int y, int modifiers,
+                                      int scrollType, int scrollAmount,
+                                      int wheelRotation, double preciseWheelRotation,
+                                      byte[] bdata)
     {
         // TODO: could we just use the last mouse event target here?
         Rectangle r = getBounds();
@@ -859,8 +920,9 @@
     /*
      * Called by the delegate when a key is pressed.
      */
-    public void dispatchKeyEvent(int id, long when, int modifiers,
-                                 int keyCode, char keyChar, int keyLocation)
+    @Override
+    public void notifyKeyEvent(int id, long when, int modifiers,
+                               int keyCode, char keyChar, int keyLocation)
     {
         LWKeyboardFocusManagerPeer kfmPeer = LWKeyboardFocusManagerPeer.getInstance();
         Component focusOwner = kfmPeer.getCurrentFocusOwner();
@@ -874,7 +936,6 @@
         postEvent(new KeyEvent(focusOwner, id, when, modifiers, keyCode, keyChar, keyLocation));
     }
 
-
     // ---- UTILITY METHODS ---- //
 
     private void activateDisplayListener() {
@@ -894,11 +955,14 @@
             AWTAccessor.getFrameAccessor().setExtendedState(
                     (Frame)getTarget(), newWindowState);
         }
+
         WindowEvent stateChangedEvent = new WindowEvent(getTarget(),
                 WindowEvent.WINDOW_STATE_CHANGED,
                 windowState, newWindowState);
         postEvent(stateChangedEvent);
         windowState = newWindowState;
+
+        updateSecurityWarningVisibility();
     }
 
     private static int getGraphicsConfigScreen(GraphicsConfiguration gc) {
@@ -1059,7 +1123,7 @@
      * In case of a simple window, triggers appropriate java focus change.
      */
     public boolean requestWindowFocus(CausedFocusEvent.Cause cause) {
-        if (focusLog.isLoggable(PlatformLogger.FINE)) {
+        if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
             focusLog.fine("requesting native focus to " + this);
         }
 
@@ -1085,7 +1149,7 @@
             // If owner is not natively active, request native
             // activation on it w/o sending events up to java.
             if (owner != null && !owner.platformWindow.isActive()) {
-                if (focusLog.isLoggable(PlatformLogger.FINE)) {
+                if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
                     focusLog.fine("requesting native focus to the owner " + owner);
                 }
                 LWWindowPeer currentActivePeer = (currentActive != null ?
@@ -1093,7 +1157,7 @@
 
                 // Ensure the opposite is natively active and suppress sending events.
                 if (currentActivePeer != null && currentActivePeer.platformWindow.isActive()) {
-                    if (focusLog.isLoggable(PlatformLogger.FINE)) {
+                    if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
                         focusLog.fine("the opposite is " + currentActivePeer);
                     }
                     currentActivePeer.skipNextFocusChange = true;
@@ -1150,7 +1214,7 @@
      * Changes focused window on java level.
      */
     protected void changeFocusedWindow(boolean becomesFocused, Window opposite) {
-        if (focusLog.isLoggable(PlatformLogger.FINE)) {
+        if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
             focusLog.fine((becomesFocused?"gaining":"loosing") + " focus window: " + this);
         }
         if (skipNextFocusChange) {
@@ -1165,7 +1229,7 @@
         if (becomesFocused) {
             synchronized (getPeerTreeLock()) {
                 if (blocker != null) {
-                    if (focusLog.isLoggable(PlatformLogger.FINEST)) {
+                    if (focusLog.isLoggable(PlatformLogger.Level.FINEST)) {
                         focusLog.finest("the window is blocked by " + blocker);
                     }
                     return;
@@ -1179,7 +1243,7 @@
         if (!becomesFocused &&
             (isGrabbing() || getOwnerFrameDialog(grabbingWindow) == this))
         {
-            if (focusLog.isLoggable(PlatformLogger.FINE)) {
+            if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
                 focusLog.fine("ungrabbing on " + grabbingWindow);
             }
             // ungrab a simple window if its owner looses activation.
@@ -1222,10 +1286,12 @@
 
     public void enterFullScreenMode() {
         platformWindow.enterFullScreenMode();
+        updateSecurityWarningVisibility();
     }
 
     public void exitFullScreenMode() {
         platformWindow.exitFullScreenMode();
+        updateSecurityWarningVisibility();
     }
 
     public long getLayerPtr() {
@@ -1260,6 +1326,33 @@
         return peerType;
     }
 
+    public void updateSecurityWarningVisibility() {
+        if (warningWindow == null) {
+            return;
+        }
+
+        if (!isVisible()) {
+            return; // The warning window should already be hidden.
+        }
+
+        boolean show = false;
+
+        if (!platformWindow.isFullScreenMode()) {
+            if (isVisible()) {
+                if (LWKeyboardFocusManagerPeer.getInstance().getCurrentFocusedWindow() ==
+                        getTarget()) {
+                    show = true;
+                }
+
+                if (platformWindow.isUnderMouse() || warningWindow.isUnderMouse()) {
+                    show = true;
+                }
+            }
+        }
+
+        warningWindow.setVisible(show, true);
+    }
+
     @Override
     public String toString() {
         return super.toString() + " [target is " + getTarget() + "]";
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/macosx/classes/sun/lwawt/PlatformEventNotifier.java	Fri Jun 28 19:37:48 2013 -0700
@@ -0,0 +1,65 @@
+/*
+ * 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.lwawt;
+
+import java.awt.Rectangle;
+
+public interface PlatformEventNotifier {
+    void notifyIconify(boolean iconify);
+
+    void notifyZoom(boolean isZoomed);
+
+    void notifyExpose(Rectangle r);
+
+    void notifyReshape(int x, int y, int w, int h);
+
+    void notifyUpdateCursor();
+
+    void notifyActivation(boolean activation, LWWindowPeer opposite);
+
+    // MouseDown in non-client area
+    void notifyNCMouseDown();
+
+    /*
+     * Called by the delegate to dispatch the event to Java. Event
+     * coordinates are relative to non-client window are, i.e. the top-left
+     * point of the client area is (insets.top, insets.left).
+     */
+    void notifyMouseEvent(int id, long when, int button,
+                          int x, int y, int screenX, int screenY,
+                          int modifiers, int clickCount, boolean popupTrigger,
+                          byte[] bdata);
+
+    void notifyMouseWheelEvent(long when, int x, int y, int modifiers,
+                               int scrollType, int scrollAmount,
+                               int wheelRotation, double preciseWheelRotation,
+                               byte[] bdata);
+    /*
+     * Called by the delegate when a key is pressed.
+     */
+    void notifyKeyEvent(int id, long when, int modifiers,
+                        int keyCode, char keyChar, int keyLocation);
+}
--- a/src/macosx/classes/sun/lwawt/PlatformWindow.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/macosx/classes/sun/lwawt/PlatformWindow.java	Fri Jun 28 19:37:48 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -146,6 +146,8 @@
 
     public void exitFullScreenMode();
 
+    public boolean isFullScreenMode();
+
     public void setWindowState(int windowState);
 
     public long getLayerPtr();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/macosx/classes/sun/lwawt/SecurityWarningWindow.java	Fri Jun 28 19:37:48 2013 -0700
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.lwawt;
+
+public interface SecurityWarningWindow extends PlatformWindow {
+    /**
+     * @param x,y,w,h coordinates of the untrusted window
+     */
+    public void reposition(int x, int y, int w, int h);
+
+    public void setVisible(boolean visible, boolean doSchedule);
+}
--- a/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java	Fri Jun 28 19:37:48 2013 -0700
@@ -38,7 +38,8 @@
 public class CEmbeddedFrame extends EmbeddedFrame {
 
     private CPlatformResponder responder;
-    private boolean focused = true;
+    private static final Object classLock = new Object();
+    private static volatile CEmbeddedFrame focusedWindow;
     private boolean parentWindowActive = true;
 
     public CEmbeddedFrame() {
@@ -104,9 +105,16 @@
         responder.handleInputEvent(text);
     }
 
+    // handleFocusEvent is called when the applet becames focused/unfocused.
+    // This method can be called from different threads.
     public void handleFocusEvent(boolean focused) {
-        this.focused = focused;
-        if (focused) {
+        synchronized (classLock) {
+            // In some cases an applet may not receive the focus lost event
+            // from the parent window (see 8012330)
+            focusedWindow = (focused) ? this
+                    : ((focusedWindow == this) ? null : focusedWindow);
+        }
+        if (focusedWindow == this) {
             // see bug 8010925
             // we can't put this to handleWindowFocusEvent because
             // it won't be invoced if focuse is moved to a html element
@@ -119,11 +127,14 @@
         }
     }
 
+    // handleWindowFocusEvent is called for all applets, when the browser
+    // becames active/inactive. This event should be filtered out for
+    // non-focused applet. This method can be called from different threads.
     public void handleWindowFocusEvent(boolean parentWindowActive) {
         this.parentWindowActive = parentWindowActive;
         // ignore focus "lost" native request as it may mistakenly
         // deactivate active window (see 8001161)
-        if (focused && parentWindowActive) {
+        if (focusedWindow == this && parentWindowActive) {
             responder.handleWindowFocusEvent(parentWindowActive, null);
         }
     }
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java	Fri Jun 28 19:37:48 2013 -0700
@@ -186,6 +186,11 @@
     public void exitFullScreenMode() {}
 
     @Override
+    public boolean isFullScreenMode() {
+        return false;
+    }
+
+    @Override
     public void setWindowState(int windowState) {}
 
     @Override
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java	Fri Jun 28 19:37:48 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
 
 import sun.awt.SunToolkit;
 import sun.lwawt.LWWindowPeer;
+import sun.lwawt.PlatformEventNotifier;
 import sun.lwawt.macosx.event.NSEvent;
 import java.awt.Toolkit;
 import java.awt.event.MouseEvent;
@@ -39,12 +40,13 @@
  */
 final class CPlatformResponder {
 
-    private final LWWindowPeer peer;
+    private final PlatformEventNotifier eventNotifier;
     private final boolean isNpapiCallback;
     private int lastKeyPressCode = KeyEvent.VK_UNDEFINED;
 
-    CPlatformResponder(final LWWindowPeer peer, final boolean isNpapiCallback) {
-        this.peer = peer;
+    CPlatformResponder(final PlatformEventNotifier eventNotifier,
+                       final boolean isNpapiCallback) {
+        this.eventNotifier = eventNotifier;
         this.isNpapiCallback = isNpapiCallback;
     }
 
@@ -78,9 +80,9 @@
                                                         modifierFlags);
         boolean jpopupTrigger = NSEvent.isPopupTrigger(jmodifiers);
 
-        peer.dispatchMouseEvent(jeventType, System.currentTimeMillis(), jbuttonNumber,
-                                x, y, absoluteX, absoluteY, jmodifiers, jclickCount,
-                                jpopupTrigger, null);
+        eventNotifier.notifyMouseEvent(jeventType, System.currentTimeMillis(), jbuttonNumber,
+                x, y, absoluteX, absoluteY, jmodifiers, jclickCount,
+                jpopupTrigger, null);
     }
 
     /**
@@ -116,8 +118,8 @@
             wheelRotation = signum;
         }
         // invert the wheelRotation for the peer
-        peer.dispatchMouseWheelEvent(when, x, y, modifiers, scrollType,
-                                     scrollAmount, -wheelRotation, -delta, null);
+        eventNotifier.notifyMouseWheelEvent(when, x, y, modifiers, scrollType,
+                scrollAmount, -wheelRotation, -delta, null);
     }
 
     /**
@@ -187,8 +189,8 @@
         if (jeventType == KeyEvent.KEY_PRESSED) {
             lastKeyPressCode = jkeyCode;
         }
-        peer.dispatchKeyEvent(jeventType, when, jmodifiers,
-                              jkeyCode, javaChar, jkeyLocation);
+        eventNotifier.notifyKeyEvent(jeventType, when, jmodifiers,
+                jkeyCode, javaChar, jkeyLocation);
 
         // Current browser may be sending input events, so don't
         // post the KEY_TYPED here.
@@ -206,12 +208,12 @@
             if (needsKeyReleased && (jkeyCode == KeyEvent.VK_ENTER || jkeyCode == KeyEvent.VK_SPACE)) {
                 return;
             }
-            peer.dispatchKeyEvent(KeyEvent.KEY_TYPED, when, jmodifiers,
-                                  KeyEvent.VK_UNDEFINED, javaChar,
-                                  KeyEvent.KEY_LOCATION_UNKNOWN);
+            eventNotifier.notifyKeyEvent(KeyEvent.KEY_TYPED, when, jmodifiers,
+                    KeyEvent.VK_UNDEFINED, javaChar,
+                    KeyEvent.KEY_LOCATION_UNKNOWN);
             //If events come from Firefox, released events should also be generated.
             if (needsKeyReleased) {
-                peer.dispatchKeyEvent(KeyEvent.KEY_RELEASED, when, jmodifiers,
+                eventNotifier.notifyKeyEvent(KeyEvent.KEY_RELEASED, when, jmodifiers,
                         jkeyCode, javaChar,
                         KeyEvent.KEY_LOCATION_UNKNOWN);
             }
@@ -224,13 +226,13 @@
             char c = 0;
             while (index < length) {
                 c = text.charAt(index);
-                peer.dispatchKeyEvent(KeyEvent.KEY_TYPED,
+                eventNotifier.notifyKeyEvent(KeyEvent.KEY_TYPED,
                         System.currentTimeMillis(),
                         0, KeyEvent.VK_UNDEFINED, c,
                         KeyEvent.KEY_LOCATION_UNKNOWN);
                 index++;
             }
-            peer.dispatchKeyEvent(KeyEvent.KEY_RELEASED,
+            eventNotifier.notifyKeyEvent(KeyEvent.KEY_RELEASED,
                     System.currentTimeMillis(),
                     0, lastKeyPressCode, c,
                     KeyEvent.KEY_LOCATION_UNKNOWN);
@@ -238,6 +240,6 @@
     }
 
     void handleWindowFocusEvent(boolean gained, LWWindowPeer opposite) {
-        peer.notifyActivation(gained, opposite);
+        eventNotifier.notifyActivation(gained, opposite);
     }
 }
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java	Fri Jun 28 19:37:48 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -57,11 +57,15 @@
         initializeBase(peer, responder);
 
         if (!LWCToolkit.getSunAwtDisableCALayers()) {
-            this.windowLayer = new CGLLayer(peer);
+            this.windowLayer = createCGLayer();
         }
         setPtr(nativeCreateView(0, 0, 0, 0, getWindowLayerPtr()));
     }
 
+    public CGLLayer createCGLayer() {
+        return new CGLLayer(peer);
+    }
+
     protected void initializeBase(LWWindowPeer peer, CPlatformResponder responder) {
         this.peer = peer;
         this.responder = responder;
@@ -69,7 +73,7 @@
 
     public long getAWTView() {
         return ptr;
-        }
+    }
 
     public boolean isOpaque() {
         return !peer.isTranslucent();
@@ -100,6 +104,10 @@
         CWrapper.NSView.exitFullScreenMode(ptr);
     }
 
+    public void setToolTip(String msg) {
+        CWrapper.NSView.setToolTip(ptr, msg);
+    }
+
     // ----------------------------------------------------------------------
     // PAINTING METHODS
     // ----------------------------------------------------------------------
@@ -108,7 +116,7 @@
             surfaceData = windowLayer.replaceSurfaceData();
         } else {
             if (surfaceData == null) {
-                CGraphicsConfig graphicsConfig = (CGraphicsConfig)peer.getGraphicsConfiguration();
+                CGraphicsConfig graphicsConfig = (CGraphicsConfig)getGraphicsConfiguration();
                 surfaceData = graphicsConfig.createSurfaceData(this);
             } else {
                 validateSurface();
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Fri Jun 28 19:37:48 2013 -0700
@@ -204,9 +204,9 @@
 
     private Window target;
     private LWWindowPeer peer;
-    private CPlatformView contentView;
-    private CPlatformWindow owner;
-    private boolean visible = false; // visibility status from native perspective
+    protected CPlatformView contentView;
+    protected CPlatformWindow owner;
+    protected boolean visible = false; // visibility status from native perspective
     private boolean undecorated; // initialized in getInitialStyleBits()
     private Rectangle normalBounds = null; // not-null only for undecorated maximized windows
     private CPlatformResponder responder;
@@ -226,19 +226,13 @@
 
         final int styleBits = getInitialStyleBits();
 
-        // TODO: handle these misc properties
-        final long parentNSWindowPtr = (owner != null ? owner.getNSWindowPtr() : 0);
-        String warningString = target.getWarningString();
-
-        responder = new CPlatformResponder(peer, false);
+        responder = createPlatformResponder();
+        contentView = createContentView();
         contentView.initialize(peer, responder);
 
         final long nativeWindowPtr = nativeCreateNSWindow(contentView.getAWTView(), styleBits, 0, 0, 0, 0);
         setPtr(nativeWindowPtr);
 
-        // TODO: implement on top of JObjC bridged class
-    //    NSWindow window = JObjC.getInstance().AppKit().NSWindow().getInstance(nativeWindowPtr, JObjCRuntime.getInstance());
-
         if (target instanceof javax.swing.RootPaneContainer) {
             final javax.swing.JRootPane rootpane = ((javax.swing.RootPaneContainer)target).getRootPane();
             if (rootpane != null) rootpane.addPropertyChangeListener("ancestor", new PropertyChangeListener() {
@@ -261,7 +255,15 @@
         this.contentView = view;
     }
 
-    private int getInitialStyleBits() {
+    protected CPlatformResponder createPlatformResponder() {
+        return new CPlatformResponder(peer, false);
+    }
+
+    protected CPlatformView createContentView() {
+        return new CPlatformView();
+    }
+
+    protected int getInitialStyleBits() {
         // defaults style bits
         int styleBits = DECORATED | HAS_SHADOW | CLOSEABLE | MINIMIZABLE | ZOOMABLE | RESIZABLE;
 
@@ -467,7 +469,7 @@
     }
 
     private void maximize() {
-        if (isMaximized()) {
+        if (peer == null || isMaximized()) {
             return;
         }
         if (!undecorated) {
@@ -502,7 +504,7 @@
         }
     }
 
-    private boolean isVisible() {
+    public boolean isVisible() {
         return this.visible;
     }
 
@@ -534,7 +536,7 @@
         updateFocusabilityForAutoRequestFocus(false);
 
         // Actually show or hide the window
-        LWWindowPeer blocker = peer.getBlocker();
+        LWWindowPeer blocker = (peer == null)? null : peer.getBlocker();
         if (blocker == null || !visible) {
             // If it ain't blocked, or is being hidden, go regular way
             if (visible) {
@@ -633,7 +635,7 @@
     public long getNSWindowPtr() {
         final long nsWindowPtr = ptr;
         if (nsWindowPtr == 0L) {
-            if(logger.isLoggable(PlatformLogger.FINE)) {
+            if(logger.isLoggable(PlatformLogger.Level.FINE)) {
                 logger.fine("NSWindow already disposed?", new Exception("Pointer to native NSWindow is invalid."));
             }
         }
@@ -726,7 +728,8 @@
     @Override
     public void setOpaque(boolean isOpaque) {
         CWrapper.NSWindow.setOpaque(getNSWindowPtr(), isOpaque);
-        if (!isOpaque && !peer.isTextured()) {
+        boolean isTextured = (peer == null)? false : peer.isTextured();
+        if (!isOpaque && !isTextured) {
             long clearColor = CWrapper.NSColor.clearColor();
             CWrapper.NSWindow.setBackgroundColor(getNSWindowPtr(), clearColor);
         }
@@ -766,8 +769,13 @@
     }
 
     @Override
+    public boolean isFullScreenMode() {
+        return isFullScreenMode;
+    }
+
+    @Override
     public void setWindowState(int windowState) {
-        if (!peer.isVisible()) {
+        if (peer == null || !peer.isVisible()) {
             // setVisible() applies the state
             return;
         }
@@ -804,8 +812,6 @@
                 throw new RuntimeException("Unknown window state: " + windowState);
         }
 
-        nativeSynthesizeMouseEnteredExitedEvents();
-
         // NOTE: the SWP.windowState field gets updated to the newWindowState
         //       value when the native notification comes to us
     }
@@ -914,7 +920,7 @@
         responder.handleWindowFocusEvent(gained, oppositePeer);
     }
 
-    private void deliverMoveResizeEvent(int x, int y, int width, int height,
+    protected void deliverMoveResizeEvent(int x, int y, int width, int height,
                                         boolean byUser) {
         // when the content view enters the full-screen mode, the native
         // move/resize notifications contain a bounds smaller than
@@ -927,9 +933,13 @@
         final Rectangle oldB = nativeBounds;
         nativeBounds = new Rectangle(x, y, width, height);
         final GraphicsConfiguration oldGC = peer.getGraphicsConfiguration();
-        peer.notifyReshape(x, y, width, height);
+
         final GraphicsConfiguration newGC = peer.getGraphicsConfiguration();
         // System-dependent appearance optimization.
+        if (peer != null) {
+            peer.notifyReshape(x, y, width, height);
+        }
+
         if ((byUser && !oldB.getSize().equals(nativeBounds.getSize()))
             || isFullScreenAnimationOn || !Objects.equals(newGC, oldGC)) {
             flushBuffers();
@@ -937,21 +947,29 @@
     }
 
     private void deliverWindowClosingEvent() {
-        if (peer.getBlocker() == null)  {
-            peer.postEvent(new WindowEvent(target, WindowEvent.WINDOW_CLOSING));
+        if (peer != null) {
+            if (peer.getBlocker() == null)  {
+                peer.postEvent(new WindowEvent(target, WindowEvent.WINDOW_CLOSING));
+            }
         }
     }
 
     private void deliverIconify(final boolean iconify) {
-        peer.notifyIconify(iconify);
+        if (peer != null) {
+            peer.notifyIconify(iconify);
+        }
     }
 
     private void deliverZoom(final boolean isZoomed) {
-        peer.notifyZoom(isZoomed);
+        if (peer != null) {
+            peer.notifyZoom(isZoomed);
+        }
     }
 
     private void deliverNCMouseDown() {
-        peer.notifyNCMouseDown();
+        if (peer != null) {
+            peer.notifyNCMouseDown();
+        }
     }
 
     /*
@@ -959,6 +977,10 @@
      * may become natively focusable window.
      */
     private boolean isNativelyFocusableWindow() {
+        if (peer == null) {
+            return false;
+        }
+
         return !peer.isSimpleWindow() && target.getFocusableWindowState();
     }
 
@@ -973,7 +995,7 @@
     }
 
     private boolean checkBlocking() {
-        LWWindowPeer blocker = peer.getBlocker();
+        LWWindowPeer blocker = (peer == null)? null : peer.getBlocker();
         if (blocker == null) {
             return false;
         }
--- a/src/macosx/classes/sun/lwawt/macosx/CTrayIcon.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/macosx/classes/sun/lwawt/macosx/CTrayIcon.java	Fri Jun 28 19:37:48 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
 
 package sun.lwawt.macosx;
 
+import sun.awt.AWTAccessor;
 import sun.awt.SunToolkit;
 import sun.lwawt.macosx.event.NSEvent;
 
@@ -339,6 +340,9 @@
 
         dialog.addWindowListener(handler);
 
+        // suppress security warning for untrusted windows
+        AWTAccessor.getWindowAccessor().setTrayIconWindow(dialog, true);
+
         dialog.pack();
 
         return dialog;
--- a/src/macosx/classes/sun/lwawt/macosx/CViewPlatformEmbeddedFrame.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/macosx/classes/sun/lwawt/macosx/CViewPlatformEmbeddedFrame.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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
@@ -201,6 +201,11 @@
     }
 
     @Override
+    public boolean isFullScreenMode() {
+        return false;
+    }
+
+    @Override
     public void setWindowState(int windowState) {
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java	Fri Jun 28 19:37:48 2013 -0700
@@ -0,0 +1,444 @@
+/*
+ * 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.lwawt.macosx;
+
+import sun.awt.AWTAccessor;
+import sun.awt.IconInfo;
+import sun.awt.SunToolkit;
+import sun.java2d.SunGraphics2D;
+import sun.java2d.SurfaceData;
+import sun.java2d.opengl.CGLLayer;
+import sun.lwawt.LWWindowPeer;
+import sun.lwawt.PlatformEventNotifier;
+import sun.lwawt.SecurityWarningWindow;
+
+import java.awt.*;
+import java.awt.event.MouseEvent;
+import java.awt.geom.Point2D;
+import java.lang.ref.WeakReference;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeUnit;
+
+public final class CWarningWindow extends CPlatformWindow
+        implements SecurityWarningWindow, PlatformEventNotifier {
+
+    private static class Lock {};
+    private final Lock lock = new Lock();
+
+    private final static int SHOWING_DELAY = 300;
+    private final static int HIDING_DELAY = 2000;
+
+    private Rectangle bounds = new Rectangle();
+    private final WeakReference<LWWindowPeer> ownerPeer;
+    private final Window ownerWindow;
+
+    /**
+     * Animation stage.
+     */
+    private volatile int currentIcon = 0;
+
+    /* -1 - uninitialized.
+     * 0 - 16x16
+     * 1 - 24x24
+     * 2 - 32x32
+     * 3 - 48x48
+     */
+    private int currentSize = -1;
+    private static IconInfo[][] icons;
+    private static IconInfo getSecurityIconInfo(int size, int num) {
+        synchronized (CWarningWindow.class) {
+            if (icons == null) {
+                icons = new IconInfo[4][3];
+                icons[0][0] = new IconInfo(sun.awt.AWTIcon32_security_icon_bw16_png.security_icon_bw16_png);
+                icons[0][1] = new IconInfo(sun.awt.AWTIcon32_security_icon_interim16_png.security_icon_interim16_png);
+                icons[0][2] = new IconInfo(sun.awt.AWTIcon32_security_icon_yellow16_png.security_icon_yellow16_png);
+                icons[1][0] = new IconInfo(sun.awt.AWTIcon32_security_icon_bw24_png.security_icon_bw24_png);
+                icons[1][1] = new IconInfo(sun.awt.AWTIcon32_security_icon_interim24_png.security_icon_interim24_png);
+                icons[1][2] = new IconInfo(sun.awt.AWTIcon32_security_icon_yellow24_png.security_icon_yellow24_png);
+                icons[2][0] = new IconInfo(sun.awt.AWTIcon32_security_icon_bw32_png.security_icon_bw32_png);
+                icons[2][1] = new IconInfo(sun.awt.AWTIcon32_security_icon_interim32_png.security_icon_interim32_png);
+                icons[2][2] = new IconInfo(sun.awt.AWTIcon32_security_icon_yellow32_png.security_icon_yellow32_png);
+                icons[3][0] = new IconInfo(sun.awt.AWTIcon32_security_icon_bw48_png.security_icon_bw48_png);
+                icons[3][1] = new IconInfo(sun.awt.AWTIcon32_security_icon_interim48_png.security_icon_interim48_png);
+                icons[3][2] = new IconInfo(sun.awt.AWTIcon32_security_icon_yellow48_png.security_icon_yellow48_png);
+            }
+        }
+        final int sizeIndex = size % icons.length;
+        return icons[sizeIndex][num % icons[sizeIndex].length];
+    }
+
+    public CWarningWindow(final Window _ownerWindow, final LWWindowPeer _ownerPeer) {
+        super();
+
+        this.ownerPeer = new WeakReference<LWWindowPeer>(_ownerPeer);
+        this.ownerWindow = _ownerWindow;
+
+        initialize(null, null, _ownerPeer.getPlatformWindow());
+
+        setOpaque(false);
+
+        String warningString = ownerWindow.getWarningString();
+        if (warningString != null) {
+            contentView.setToolTip(ownerWindow.getWarningString());
+        }
+
+        updateIconSize();
+    }
+
+    /**
+     * @param x,y,w,h coordinates of the untrusted window
+     */
+    public void reposition(int x, int y, int w, int h) {
+        final Point2D point = AWTAccessor.getWindowAccessor().
+                calculateSecurityWarningPosition(ownerWindow, x, y, w, h);
+        setBounds((int)point.getX(), (int)point.getY(), getWidth(), getHeight());
+    }
+
+    public void setVisible(boolean visible, boolean doSchedule) {
+        synchronized (scheduler) {
+            if (showingTaskHandle != null) {
+                showingTaskHandle.cancel(false);
+                showingTaskHandle = null;
+            }
+
+            if (hidingTaskHandle != null) {
+                hidingTaskHandle.cancel(false);
+                hidingTaskHandle = null;
+            }
+
+            if (visible) {
+                if (isVisible()) {
+                    currentIcon = 0;
+                } else {
+                    currentIcon = 2;
+                }
+
+                showingTaskHandle = scheduler.schedule(showingTask, 50,
+                        TimeUnit.MILLISECONDS);
+
+            } else {
+                if (!isVisible()) {
+                    return;
+                }
+
+                if (doSchedule) {
+                    hidingTaskHandle = scheduler.schedule(hidingTask, HIDING_DELAY,
+                            TimeUnit.MILLISECONDS);
+                } else {
+                    hidingTaskHandle = scheduler.schedule(hidingTask, 50,
+                            TimeUnit.MILLISECONDS);
+                }
+            }
+        }
+    }
+
+    @Override
+    public void notifyIconify(boolean iconify) {
+    }
+
+    @Override
+    public void notifyZoom(boolean isZoomed) {
+    }
+
+    @Override
+    public void notifyExpose(final Rectangle r) {
+        repaint();
+    }
+
+    @Override
+    public void notifyReshape(int x, int y, int w, int h) {
+    }
+
+    @Override
+    public void notifyUpdateCursor() {
+    }
+
+    @Override
+    public void notifyActivation(boolean activation, LWWindowPeer opposite) {
+    }
+
+    @Override
+    public void notifyNCMouseDown() {
+    }
+
+    @Override
+    public void notifyMouseEvent(int id, long when, int button, int x, int y,
+                                 int screenX, int screenY, int modifiers,
+                                 int clickCount, boolean popupTrigger,
+                                 byte[] bdata) {
+        LWWindowPeer peer = ownerPeer.get();
+        if (id == MouseEvent.MOUSE_EXITED) {
+            if (peer != null) {
+                peer.updateSecurityWarningVisibility();
+            }
+        } else if(id == MouseEvent.MOUSE_ENTERED) {
+            if (peer != null) {
+                peer.updateSecurityWarningVisibility();
+            }
+        }
+    }
+
+    public Rectangle getBounds() {
+        synchronized (lock) {
+            return bounds.getBounds();
+        }
+    }
+
+    @Override
+    public boolean isVisible() {
+        synchronized (lock) {
+            return visible;
+        }
+    }
+
+    @Override
+    public void setVisible(boolean visible) {
+        synchronized (lock) {
+            final long nsWindowPtr = getNSWindowPtr();
+
+            // Process parent-child relationship when hiding
+            if (!visible) {
+                // Unparent myself
+                if (owner != null && owner.isVisible()) {
+                    CWrapper.NSWindow.removeChildWindow(
+                            owner.getNSWindowPtr(), nsWindowPtr);
+                }
+            }
+
+            // Actually show or hide the window
+            if (visible) {
+                CWrapper.NSWindow.orderFront(nsWindowPtr);
+            } else {
+                CWrapper.NSWindow.orderOut(nsWindowPtr);
+            }
+
+            this.visible = visible;
+
+            // Manage parent-child relationship when showing
+            if (visible) {
+                // Add myself as a child
+                if (owner != null && owner.isVisible()) {
+                    CWrapper.NSWindow.addChildWindow(owner.getNSWindowPtr(),
+                            nsWindowPtr, CWrapper.NSWindow.NSWindowAbove);
+
+                    // do not allow security warning to be obscured by other windows
+                    if (ownerWindow.isAlwaysOnTop()) {
+                        CWrapper.NSWindow.setLevel(nsWindowPtr,
+                                CWrapper.NSWindow.NSFloatingWindowLevel);
+                    }
+                }
+            }
+        }
+    }
+
+    @Override
+    public void notifyMouseWheelEvent(long when, int x, int y, int modifiers,
+                                      int scrollType, int scrollAmount,
+                                      int wheelRotation, double preciseWheelRotation,
+                                      byte[] bdata) {
+    }
+
+    @Override
+    public void notifyKeyEvent(int id, long when, int modifiers, int keyCode,
+                               char keyChar, int keyLocation) {
+    }
+
+    protected int getInitialStyleBits() {
+        int styleBits = 0;
+        CPlatformWindow.SET(styleBits, CPlatformWindow.UTILITY, true);
+        return styleBits;
+    }
+
+    protected void deliverMoveResizeEvent(int x, int y, int width, int height,
+                                          boolean byUser) {
+
+        boolean isResize;
+        synchronized (lock) {
+            isResize = (bounds.width != width || bounds.height != height);
+            bounds = new Rectangle(x, y, width, height);
+        }
+
+        if (isResize) {
+            replaceSurface();
+        }
+
+        super.deliverMoveResizeEvent(x, y, width, height, byUser);
+    }
+
+    protected CPlatformResponder createPlatformResponder() {
+        return new CPlatformResponder(this, false);
+    }
+
+    protected CPlatformView createContentView() {
+        return new CPlatformView() {
+            public GraphicsConfiguration getGraphicsConfiguration() {
+                LWWindowPeer peer = ownerPeer.get();
+                return peer.getGraphicsConfiguration();
+            }
+
+            public Rectangle getBounds() {
+                return CWarningWindow.this.getBounds();
+            }
+
+            public CGLLayer createCGLayer() {
+                return new CGLLayer(null) {
+                    public Rectangle getBounds() {
+                        return CWarningWindow.this.getBounds();
+                    }
+
+                    public GraphicsConfiguration getGraphicsConfiguration() {
+                        LWWindowPeer peer = ownerPeer.get();
+                        return peer.getGraphicsConfiguration();
+                    }
+
+                    public boolean isOpaque() {
+                        return false;
+                    }
+                };
+            }
+        };
+    }
+
+    private void updateIconSize() {
+        int newSize = -1;
+
+        if (ownerWindow != null) {
+            Insets insets = ownerWindow.getInsets();
+            int max = Math.max(insets.top, Math.max(insets.bottom,
+                    Math.max(insets.left, insets.right)));
+            if (max < 24) {
+                newSize = 0;
+            } else if (max < 32) {
+                newSize = 1;
+            } else if (max < 48) {
+                newSize = 2;
+            } else {
+                newSize = 3;
+            }
+        }
+        // Make sure we have a valid size
+        if (newSize == -1) {
+            newSize = 0;
+        }
+
+        synchronized (lock) {
+            if (newSize != currentSize) {
+                currentSize = newSize;
+                IconInfo ico = getSecurityIconInfo(currentSize, 0);
+                AWTAccessor.getWindowAccessor().setSecurityWarningSize(
+                    ownerWindow, ico.getWidth(), ico.getHeight());
+            }
+        }
+    }
+
+    private final Graphics getGraphics() {
+        SurfaceData sd = contentView.getSurfaceData();
+        if (ownerWindow == null || sd == null) {
+            return null;
+        }
+
+        return transformGraphics(new SunGraphics2D(sd, SystemColor.windowText,
+                SystemColor.window, ownerWindow.getFont()));
+    }
+
+
+    private void repaint() {
+        final Graphics g = getGraphics();
+        if (g != null) {
+            try {
+                ((Graphics2D) g).setComposite(AlphaComposite.Src);
+                g.drawImage(getSecurityIconInfo().getImage(), 0, 0, null);
+            } finally {
+                g.dispose();
+            }
+        }
+    }
+
+    private void replaceSurface() {
+        SurfaceData oldData = contentView.getSurfaceData();
+
+        replaceSurfaceData();
+
+        if (oldData != null && oldData != contentView.getSurfaceData()) {
+            oldData.flush();
+        }
+    }
+
+    private int getWidth() {
+        return getSecurityIconInfo().getWidth();
+    }
+
+    private int getHeight() {
+        return getSecurityIconInfo().getHeight();
+    }
+
+    private IconInfo getSecurityIconInfo() {
+        return getSecurityIconInfo(currentSize, currentIcon);
+    }
+
+    private final Runnable hidingTask = new Runnable() {
+        public void run() {
+            synchronized (lock) {
+                setVisible(false);
+            }
+
+            synchronized (scheduler) {
+                hidingTaskHandle = null;
+            }
+        }
+    };
+
+    private final Runnable showingTask = new Runnable() {
+        public void run() {
+            synchronized (lock) {
+                if (!isVisible()) {
+                    setVisible(true);
+                }
+
+                repaint();
+            }
+
+            synchronized (scheduler) {
+                if (currentIcon > 0) {
+                    currentIcon--;
+                    showingTaskHandle = scheduler.schedule(showingTask, SHOWING_DELAY,
+                            TimeUnit.MILLISECONDS);
+                } else {
+                    showingTaskHandle = null;
+                }
+            }
+        }
+    };
+
+    private final ScheduledExecutorService scheduler =
+            Executors.newSingleThreadScheduledExecutor();
+
+    private ScheduledFuture hidingTaskHandle;
+    private ScheduledFuture showingTaskHandle;
+}
+
--- a/src/macosx/classes/sun/lwawt/macosx/CWrapper.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/macosx/classes/sun/lwawt/macosx/CWrapper.java	Fri Jun 28 19:37:48 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -87,6 +87,8 @@
         public static native void exitFullScreenMode(long view);
 
         public static native void setHidden(long view, boolean hidden);
+
+        public static native void setToolTip(long view, String msg);
     }
 
     public static final class NSObject {
--- a/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Fri Jun 28 19:37:48 2013 -0700
@@ -179,6 +179,11 @@
     }
 
     @Override
+    protected SecurityWarningWindow createSecurityWarning(Window ownerWindow, LWWindowPeer ownerPeer) {
+        return new CWarningWindow(ownerWindow, ownerPeer);
+    }
+
+    @Override
     protected PlatformComponent createPlatformComponent() {
         return new CPlatformComponent();
     }
--- a/src/macosx/native/com/apple/laf/AquaFileView.m	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/macosx/native/com/apple/laf/AquaFileView.m	Fri Jun 28 19:37:48 2013 -0700
@@ -187,13 +187,13 @@
 JNF_COCOA_ENTER(env);
 
     UInt8 pathCString[MAXPATHLEN + 1];
-    size_t pathSize = sizeof(pathCString);
+    size_t maxPathLen = sizeof(pathCString) - 1;
 
     jbyte *byteArray = (*env)->GetByteArrayElements(env, pathToAlias, NULL);
     jsize length = (*env)->GetArrayLength(env, pathToAlias);
 
-    if (length > pathSize) {
-        length = pathSize;
+    if (length > maxPathLen) {
+        length = maxPathLen;
     }
     strncpy((char *)pathCString, (char *)byteArray, length);
     // make sure it's null terminated
--- a/src/macosx/native/sun/awt/AWTWindow.m	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/macosx/native/sun/awt/AWTWindow.m	Fri Jun 28 19:37:48 2013 -0700
@@ -447,6 +447,8 @@
         // TODO: create generic AWT assert
     }
 
+    [AWTWindow synthesizeMouseEnteredExitedEventsForAllWindows];
+
     NSRect frame = ConvertNSScreenRect(env, [self.nsWindow frame]);
 
     static JNF_MEMBER_CACHE(jm_deliverMoveResizeEvent, jc_CPlatformWindow, "deliverMoveResizeEvent", "(IIIIZ)V");
@@ -630,6 +632,7 @@
         [self _notifyFullScreenOp:com_apple_eawt_FullScreenHandler_FULLSCREEN_DID_ENTER withEnv:env];
         (*env)->DeleteLocalRef(env, platformWindow);
     }
+    [AWTWindow synthesizeMouseEnteredExitedEventsForAllWindows];
 }
 
 - (void)windowWillExitFullScreen:(NSNotification *)notification {
@@ -652,6 +655,7 @@
         [self _notifyFullScreenOp:com_apple_eawt_FullScreenHandler_FULLSCREEN_DID_EXIT withEnv:env];
         (*env)->DeleteLocalRef(env, platformWindow);
     }
+    [AWTWindow synthesizeMouseEnteredExitedEventsForAllWindows];
 }
 
 - (void)sendEvent:(NSEvent *)event {
@@ -891,8 +895,6 @@
         // ensure we repaint the whole window after the resize operation
         // (this will also re-enable screen updates, which were disabled above)
         // TODO: send PaintEvent
-
-        [AWTWindow synthesizeMouseEnteredExitedEventsForAllWindows];
     }];
 
 JNF_COCOA_EXIT(env);
--- a/src/macosx/native/sun/awt/CRobot.m	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/macosx/native/sun/awt/CRobot.m	Fri Jun 28 19:37:48 2013 -0700
@@ -29,6 +29,7 @@
 #import "LWCToolkit.h"
 #import "sun_lwawt_macosx_CRobot.h"
 #import "java_awt_event_InputEvent.h"
+#import "sizecalc.h"
 
 
 // Starting number for event numbers generated by Robot.
@@ -115,7 +116,7 @@
         gsLastClickTime = 0;
         gsEventNumber = ROBOT_EVENT_NUMBER_START;
 
-        gsButtonEventNumber = (int*)malloc(sizeof(int) * gNumberOfButtons);
+        gsButtonEventNumber = (int*)SAFE_SIZE_ARRAY_ALLOC(malloc, sizeof(int), gNumberOfButtons);
         if (gsButtonEventNumber == NULL) {
             JNU_ThrowOutOfMemoryError(env, NULL);
             return;
--- a/src/macosx/native/sun/awt/CWrapper.m	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/macosx/native/sun/awt/CWrapper.m	Fri Jun 28 19:37:48 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -669,6 +669,27 @@
     JNF_COCOA_EXIT(env);
 }
 
+/*
+ * Class:     sun_lwawt_macosx_CWrapper$NSView
+ * Method:    setToolTip
+ * Signature: (JLjava/lang/String;)V
+ */
+JNIEXPORT void JNICALL
+Java_sun_lwawt_macosx_CWrapper_00024NSView_setToolTip
+(JNIEnv *env, jclass cls, jlong viewPtr, jstring msg)
+{
+
+JNF_COCOA_ENTER(env);
+
+    NSView *view = (NSView *)jlong_to_ptr(viewPtr);
+    NSString* s = JNFJavaToNSString(env, msg); 
+    [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
+        [view setToolTip: s];
+    }];
+
+JNF_COCOA_EXIT(env);
+}
+
 
 /*
  * Class:     sun_lwawt_macosx_CWrapper$NSScreen
@@ -735,7 +756,7 @@
 {
     __block jlong screenPtr = 0L;
 
-JNF_COCOA_ENTER(env);
+JNF_COCOA_ENTER(env); 
 
     [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
         NSArray *screens = [NSScreen screens];
--- a/src/macosx/native/sun/awt/LWCToolkit.m	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/macosx/native/sun/awt/LWCToolkit.m	Fri Jun 28 19:37:48 2013 -0700
@@ -37,6 +37,8 @@
 
 #import "sun_lwawt_macosx_LWCToolkit.h"
 
+#import "sizecalc.h"
+
 int gNumberOfButtons;
 jint* gButtonDownMasks;
 
@@ -202,7 +204,7 @@
     jintArray obj = (jintArray)(*env)->CallStaticObjectMethod(env, inputEventClazz, getButtonDownMasksID);
     jint * tmp = (*env)->GetIntArrayElements(env, obj, JNI_FALSE);
 
-    gButtonDownMasks = (jint*)malloc(sizeof(jint) * gNumberOfButtons);
+    gButtonDownMasks = (jint*)SAFE_SIZE_ARRAY_ALLOC(malloc, sizeof(jint), gNumberOfButtons);
     if (gButtonDownMasks == NULL) {
         gNumberOfButtons = 0;
         JNU_ThrowOutOfMemoryError(env, NULL);
--- a/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m	Fri Jun 28 19:37:48 2013 -0700
@@ -44,6 +44,7 @@
 #include <unistd.h>
 #include <dlfcn.h>
 
+#include <sizecalc.h>
 
 static NSScreen* SplashNSScreen()
 {
@@ -99,9 +100,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* */
--- a/src/share/classes/com/sun/accessibility/internal/resources/accessibility_ja.properties	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/accessibility/internal/resources/accessibility_ja.properties	Fri Jun 28 19:37:48 2013 -0700
@@ -102,7 +102,7 @@
 #
 # accessible actions
 #
-toggle expand=\u30C8\u30B0\u30EB\u5C55\u958B
+toggle expand=\u5C55\u958B\u306E\u30C8\u30B0\u30EB
 
 # new relations, roles and states for J2SE 1.5.0
 
--- a/src/share/classes/com/sun/accessibility/internal/resources/accessibility_ko.properties	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/accessibility/internal/resources/accessibility_ko.properties	Fri Jun 28 19:37:48 2013 -0700
@@ -102,7 +102,7 @@
 #
 # accessible actions
 #
-toggle \uD655\uC7A5=\uD1A0\uAE00 \uD655\uC7A5
+toggle expand=\uD1A0\uAE00 \uD655\uC7A5
 
 # new relations, roles and states for J2SE 1.5.0
 
--- a/src/share/classes/com/sun/accessibility/internal/resources/accessibility_pt_BR.properties	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/accessibility/internal/resources/accessibility_pt_BR.properties	Fri Jun 28 19:37:48 2013 -0700
@@ -102,7 +102,7 @@
 #
 # accessible actions
 #
-toggle expandir=alternar expans\u00E3o
+toggle expand=alternar expans\u00E3o
 
 # new relations, roles and states for J2SE 1.5.0
 
--- a/src/share/classes/com/sun/accessibility/internal/resources/accessibility_sv.properties	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/accessibility/internal/resources/accessibility_sv.properties	Fri Jun 28 19:37:48 2013 -0700
@@ -102,7 +102,7 @@
 #
 # accessible actions
 #
-toggle ut\u00F6ka=v\u00E4xla ut\u00F6ka
+toggle expand=v\u00E4xla ut\u00F6ka
 
 # new relations, roles and states for J2SE 1.5.0
 
--- a/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_de.properties	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_de.properties	Fri Jun 28 19:37:48 2013 -0700
@@ -41,7 +41,7 @@
 FileChooser.openDialogTitle.textAndMnemonic=\u00D6ffnen
 FileChooser.pathLabel.textAndMnemonic=Aus&wahl:
 FileChooser.filterLabel.textAndMnemonic=Filter:
-FileChooser.foldersLabel.textAndMnemonic=&Ordner
+FileChooser.foldersLabel.textAndMnemonic=Or&dner
 FileChooser.filesLabel.textAndMnemonic=&Dateien
 
 FileChooser.cancelButtonToolTip.textAndMnemonic=Dialogfeld f\u00FCr Dateiauswahl schlie\u00DFen.
--- a/src/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java	Fri Jun 28 19:37:48 2013 -0700
@@ -1973,8 +1973,7 @@
          * does not add it to the list that is consulted by
          * ClassLoaderRepository.loadClass.
          */
-        final ModifiableClassLoaderRepository clr =
-                instantiator.getClassLoaderRepository();
+        final ModifiableClassLoaderRepository clr = getInstantiatorCLR();
         if (clr == null) {
             final RuntimeException wrapped =
                     new IllegalArgumentException(
@@ -2000,8 +1999,7 @@
          * Removes the  MBean from the default loader repository.
          */
         if (loader != server.getClass().getClassLoader()) {
-            final ModifiableClassLoaderRepository clr =
-                    instantiator.getClassLoaderRepository();
+            final ModifiableClassLoaderRepository clr = getInstantiatorCLR();
             if (clr != null) {
                 clr.removeClassLoader(logicalName);
             }
@@ -2060,5 +2058,12 @@
         return ResourceContext.NONE;
     }
 
-
+    private ModifiableClassLoaderRepository getInstantiatorCLR() {
+        return AccessController.doPrivileged(new PrivilegedAction<ModifiableClassLoaderRepository>() {
+            @Override
+            public ModifiableClassLoaderRepository run() {
+                return instantiator != null ? instantiator.getClassLoaderRepository() : null;
+            }
+        });
+    }
 }
--- a/src/share/classes/com/sun/jmx/mbeanserver/ClassLoaderRepositorySupport.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/jmx/mbeanserver/ClassLoaderRepositorySupport.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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;
     }
 
 }
--- a/src/share/classes/com/sun/jmx/mbeanserver/ConvertingMethod.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/jmx/mbeanserver/ConvertingMethod.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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) {
@@ -189,7 +190,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 returnMapping.toOpenValue(javaReturn);
         } catch (OpenDataException e) {
--- a/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java	Fri Jun 28 19:37:48 2013 -0700
@@ -74,6 +74,8 @@
 import javax.management.openmbean.TabularData;
 import javax.management.openmbean.TabularDataSupport;
 import javax.management.openmbean.TabularType;
+import sun.reflect.misc.MethodUtil;
+import sun.reflect.misc.ReflectUtil;
 
 /**
  *   <p>A converter between Java types and the limited set of classes
@@ -299,6 +301,7 @@
 
     private static <T extends Enum<T>> MXBeanMapping
             makeEnumMapping(Class<?> enumClass, Class<T> fake) {
+        ReflectUtil.checkPackageAccess(enumClass);
         return new EnumMapping<T>(Util.<Class<T>>cast(enumClass));
     }
 
@@ -423,6 +426,7 @@
             (c.getName().equals("com.sun.management.GcInfo") &&
                 c.getClassLoader() == null);
 
+        ReflectUtil.checkPackageAccess(c);
         final List<Method> methods =
                 MBeanAnalyzer.eliminateCovariantMethods(Arrays.asList(c.getMethods()));
         final SortedMap<String,Method> getterMap = newSortedMap();
@@ -828,7 +832,7 @@
             Object[] values = new Object[getters.length];
             for (int i = 0; i < getters.length; i++) {
                 try {
-                    Object got = getters[i].invoke(value, (Object[]) null);
+                    Object got = MethodUtil.invoke(getters[i], value, (Object[]) null);
                     values[i] = getterMappings[i].toOpenValue(got);
                 } catch (Exception e) {
                     throw openDataException("Error calling getter for " +
@@ -1011,7 +1015,7 @@
                                        MXBeanMapping[] converters)
                 throws InvalidObjectException {
             try {
-                return fromMethod.invoke(null, cd);
+                return MethodUtil.invoke(fromMethod, null, new Object[] {cd});
             } catch (Exception e) {
                 final String msg = "Failed to invoke from(CompositeData)";
                 throw invalidObjectException(msg, e);
@@ -1107,13 +1111,15 @@
                 throws InvalidObjectException {
             Object o;
             try {
-                o = getTargetClass().newInstance();
+                final Class<?> targetClass = getTargetClass();
+                ReflectUtil.checkPackageAccess(targetClass);
+                o = targetClass.newInstance();
                 for (int i = 0; i < itemNames.length; i++) {
                     if (cd.containsKey(itemNames[i])) {
                         Object openItem = cd.get(itemNames[i]);
                         Object javaItem =
                             converters[i].fromOpenValue(openItem);
-                        setters[i].invoke(o, javaItem);
+                        MethodUtil.invoke(setters[i], o, new Object[] {javaItem});
                     }
                 }
             } catch (Exception e) {
@@ -1363,6 +1369,7 @@
             }
 
             try {
+                ReflectUtil.checkPackageAccess(max.constructor.getDeclaringClass());
                 return max.constructor.newInstance(params);
             } catch (Exception e) {
                 final String msg =
--- a/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java	Fri Jun 28 19:37:48 2013 -0700
@@ -228,6 +228,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
@@ -248,6 +253,7 @@
             throws NotCompliantMBeanException {
         if (mbeanInterface == null)
             mbeanInterface = getStandardMBeanInterface(baseClass);
+        ReflectUtil.checkPackageAccess(mbeanInterface);
         MBeanIntrospector<?> introspector = StandardMBeanIntrospector.getInstance();
         return getClassMBeanInfo(introspector, baseClass, mbeanInterface);
     }
@@ -372,13 +378,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?
--- a/src/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java	Fri Jun 28 19:37:48 2013 -0700
@@ -32,6 +32,7 @@
 import java.io.ObjectInputStream;
 import java.security.AccessController;
 import java.security.Permission;
+import java.security.PrivilegedAction;
 import java.security.PrivilegedExceptionAction;
 import java.util.List;
 import java.util.Set;
@@ -227,8 +228,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)
@@ -1242,8 +1251,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);
 
--- a/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java	Fri Jun 28 19:37:48 2013 -0700
@@ -33,7 +33,12 @@
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Modifier;
+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;
 
@@ -127,9 +132,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);
@@ -622,6 +625,7 @@
      * Return the Default Loader Repository used by this instantiator object.
      **/
     public ModifiableClassLoaderRepository getClassLoaderRepository() {
+        checkMBeanPermission((String)null, null, null, "getClassLoaderRepository");
         return clr;
     }
 
@@ -733,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);
@@ -751,4 +765,22 @@
             throw new IllegalAccessException("Class is not public and can't be instantiated");
         }
     }
+
+    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;
+    }
 }
--- a/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java	Fri Jun 28 19:37:48 2013 -0700
@@ -51,6 +51,7 @@
 import javax.management.NotCompliantMBeanException;
 import javax.management.NotificationBroadcaster;
 import javax.management.ReflectionException;
+import sun.reflect.misc.ReflectUtil;
 
 /**
  * An introspector for MBeans of a certain type.  There is one instance
@@ -175,7 +176,8 @@
     /**
      * Get the methods to be analyzed to build the MBean interface.
      */
-    List<Method> getMethods(final Class<?> mbeanType) {
+    final List<Method> getMethods(final Class<?> mbeanType) {
+        ReflectUtil.checkPackageAccess(mbeanType);
         return Arrays.asList(mbeanType.getMethods());
     }
 
--- a/src/share/classes/com/sun/jmx/mbeanserver/ObjectInputStreamWithLoader.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/jmx/mbeanserver/ObjectInputStreamWithLoader.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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.
@@ -61,6 +61,7 @@
             return super.resolveClass(aClass);
         } else {
             String name = aClass.getName();
+            ReflectUtil.checkPackageAccess(name);
             // Query the class loader ...
             return Class.forName(name, false, loader);
         }
--- a/src/share/classes/com/sun/jmx/mbeanserver/StandardMBeanIntrospector.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/jmx/mbeanserver/StandardMBeanIntrospector.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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
--- a/src/share/classes/com/sun/jmx/remote/internal/ArrayNotificationBuffer.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/jmx/remote/internal/ArrayNotificationBuffer.java	Fri Jun 28 19:37:48 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2008, 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);
--- a/src/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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
@@ -226,8 +226,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
@@ -366,9 +367,16 @@
      * Explicitly check the MBeanPermission for
      * the current access control context.
      */
-    public void checkMBeanPermission(
+    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();
@@ -378,7 +386,7 @@
                     new PrivilegedExceptionAction<ObjectInstance>() {
                         public ObjectInstance run()
                         throws InstanceNotFoundException {
-                            return mbeanServer.getObjectInstance(name);
+                            return mbs.getObjectInstance(name);
                         }
                 });
             } catch (PrivilegedActionException e) {
--- a/src/share/classes/com/sun/jmx/remote/util/OrderClassLoaders.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/jmx/remote/util/OrderClassLoaders.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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);
--- a/src/share/classes/com/sun/jndi/toolkit/dir/SearchFilter.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/jndi/toolkit/dir/SearchFilter.java	Fri Jun 28 19:37:48 2013 -0700
@@ -396,7 +396,7 @@
 
             // do we need to begin with the first token?
             if(proto.charAt(0) != WILDCARD_TOKEN &&
-                    !value.toString().toLowerCase(Locale.ENGLISH).startsWith(
+                    !value.toLowerCase(Locale.ENGLISH).startsWith(
                         subStrs.nextToken().toLowerCase(Locale.ENGLISH))) {
                 if(debug) {
                     System.out.println("faild initial test");
--- a/src/share/classes/com/sun/media/sound/AbstractDataLine.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/AbstractDataLine.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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.");
--- a/src/share/classes/com/sun/media/sound/AbstractLine.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/AbstractLine.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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
--- a/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java	Fri Jun 28 19:37:48 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, 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();
     }
 
@@ -534,7 +536,7 @@
      * Also, it has some optimizations regarding sending to the Receivers,
      * for known Receivers, and managing itself in the TransmitterList.
      */
-    protected class BasicTransmitter implements MidiDeviceTransmitter {
+    class BasicTransmitter implements MidiDeviceTransmitter {
 
         private Receiver receiver = null;
         TransmitterList tlist = null;
@@ -546,7 +548,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);
@@ -554,7 +556,7 @@
             }
         }
 
-        public Receiver getReceiver() {
+        public final Receiver getReceiver() {
             return receiver;
         }
 
@@ -564,7 +566,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);
@@ -573,7 +575,7 @@
             }
         }
 
-        public MidiDevice getMidiDevice() {
+        public final MidiDevice getMidiDevice() {
             return AbstractMidiDevice.this;
         }
 
@@ -583,9 +585,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
--- a/src/share/classes/com/sun/media/sound/AbstractMidiDeviceProvider.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/AbstractMidiDeviceProvider.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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;
         }
 
--- a/src/share/classes/com/sun/media/sound/AbstractMixer.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/AbstractMixer.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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;
         }
--- a/src/share/classes/com/sun/media/sound/AiffFileFormat.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/AiffFileFormat.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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() );
--- a/src/share/classes/com/sun/media/sound/AiffFileReader.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/AiffFileReader.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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.
      */
--- a/src/share/classes/com/sun/media/sound/AiffFileWriter.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/AiffFileWriter.java	Fri Jun 28 19:37:48 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, 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
@@ -50,21 +50,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});
     }
 
 
--- a/src/share/classes/com/sun/media/sound/AlawCodec.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/AlawCodec.java	Fri Jun 28 19:37:48 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, 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 };
 
@@ -256,7 +254,7 @@
     }
 
 
-    class AlawCodecStream extends AudioInputStream {
+    final class AlawCodecStream extends AudioInputStream {
 
         // tempBuffer required only for encoding (when encode is true)
         private static final int tempBufferSize = 64;
--- a/src/share/classes/com/sun/media/sound/AuFileFormat.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/AuFileFormat.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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 ) {
 
--- a/src/share/classes/com/sun/media/sound/AuFileReader.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/AuFileReader.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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.
--- a/src/share/classes/com/sun/media/sound/AuFileWriter.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/AuFileWriter.java	Fri Jun 28 19:37:48 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, 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,28 +49,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];
--- a/src/share/classes/com/sun/media/sound/AudioFileSoundbankReader.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/AudioFileSoundbankReader.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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 {
--- a/src/share/classes/com/sun/media/sound/AudioFloatConverter.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/AudioFloatConverter.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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
@@ -51,7 +51,7 @@
 
     private static class AudioFloatLSBFilter extends AudioFloatConverter {
 
-        private AudioFloatConverter converter;
+        private final AudioFloatConverter converter;
 
         final private int offset;
 
@@ -61,8 +61,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;
@@ -740,7 +739,7 @@
 
         final int xbytes;
 
-        public AudioFloatConversion32xSL(int xbytes) {
+        AudioFloatConversion32xSL(int xbytes) {
             this.xbytes = xbytes;
         }
 
@@ -781,7 +780,7 @@
 
         final int xbytes;
 
-        public AudioFloatConversion32xSB(int xbytes) {
+        AudioFloatConversion32xSB(int xbytes) {
             this.xbytes = xbytes;
         }
 
@@ -823,7 +822,7 @@
 
         final int xbytes;
 
-        public AudioFloatConversion32xUL(int xbytes) {
+        AudioFloatConversion32xUL(int xbytes) {
             this.xbytes = xbytes;
         }
 
@@ -866,7 +865,7 @@
 
         final int xbytes;
 
-        public AudioFloatConversion32xUB(int xbytes) {
+        AudioFloatConversion32xUB(int xbytes) {
             this.xbytes = xbytes;
         }
 
@@ -1008,49 +1007,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);
     }
 }
--- a/src/share/classes/com/sun/media/sound/AudioFloatFormatConverter.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/AudioFloatFormatConverter.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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,
-            Encoding.PCM_FLOAT };
+    private final Encoding[] formats = {Encoding.PCM_SIGNED,
+                                        Encoding.PCM_UNSIGNED,
+                                        Encoding.PCM_FLOAT};
 
     public AudioInputStream getAudioInputStream(Encoding targetEncoding,
             AudioInputStream sourceStream) {
--- a/src/share/classes/com/sun/media/sound/AudioFloatInputStream.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/AudioFloatInputStream.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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)
--- a/src/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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
--- a/src/share/classes/com/sun/media/sound/DLSInfo.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/DLSInfo.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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.
--- a/src/share/classes/com/sun/media/sound/DLSInstrument.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/DLSInstrument.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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
@@ -40,15 +40,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);
--- a/src/share/classes/com/sun/media/sound/DLSModulator.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/DLSModulator.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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;
--- a/src/share/classes/com/sun/media/sound/DLSRegion.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/DLSRegion.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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;
--- a/src/share/classes/com/sun/media/sound/DLSSample.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/DLSSample.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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
@@ -40,13 +40,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);
--- a/src/share/classes/com/sun/media/sound/DLSSampleLoop.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/DLSSampleLoop.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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;
--- a/src/share/classes/com/sun/media/sound/DLSSampleOptions.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/DLSSampleOptions.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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;
--- a/src/share/classes/com/sun/media/sound/DLSSoundbank.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/DLSSoundbank.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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
@@ -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;
--- a/src/share/classes/com/sun/media/sound/DLSSoundbankReader.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/DLSSoundbankReader.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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 {
--- a/src/share/classes/com/sun/media/sound/DataPusher.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/DataPusher.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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;
--- a/src/share/classes/com/sun/media/sound/DirectAudioDevice.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/DirectAudioDevice.java	Fri Jun 28 19:37:48 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -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
 
@@ -829,7 +829,7 @@
 
         /////////////////// CONTROLS /////////////////////////////
 
-        protected class Gain extends FloatControl {
+        protected final class Gain extends FloatControl {
 
             private float linearGain = 1.0f;
 
@@ -862,7 +862,7 @@
         } // class Gain
 
 
-        private class Mute extends BooleanControl {
+        private final class Mute extends BooleanControl {
 
             private Mute() {
                 super(BooleanControl.Type.MUTE, false, "True", "False");
@@ -874,7 +874,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,
@@ -893,7 +893,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,
@@ -918,7 +918,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,
@@ -934,7 +935,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,
@@ -1012,7 +1014,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
@@ -1045,7 +1049,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
@@ -1443,7 +1447,7 @@
      * which allows retrieval of the internal array
      */
     private static class DirectBAOS extends ByteArrayOutputStream {
-        public DirectBAOS() {
+        DirectBAOS() {
             super();
         }
 
--- a/src/share/classes/com/sun/media/sound/DirectAudioDeviceProvider.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/DirectAudioDeviceProvider.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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,
--- a/src/share/classes/com/sun/media/sound/EmergencySoundbank.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/EmergencySoundbank.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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",
--- a/src/share/classes/com/sun/media/sound/EventDispatcher.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/EventDispatcher.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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
--- a/src/share/classes/com/sun/media/sound/FFT.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/FFT.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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.
--- a/src/share/classes/com/sun/media/sound/FastShortMessage.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/FastShortMessage.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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);
--- a/src/share/classes/com/sun/media/sound/JARSoundbankReader.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/JARSoundbankReader.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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();
--- a/src/share/classes/com/sun/media/sound/JDK13Services.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/JDK13Services.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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.
--- a/src/share/classes/com/sun/media/sound/JSSecurityManager.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/JSSecurityManager.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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
@@ -47,7 +47,7 @@
  *
  * @author Matthias Pfisterer
  */
-class JSSecurityManager {
+final class JSSecurityManager {
 
     /** Prevent instantiation.
      */
@@ -73,30 +73,6 @@
         }
     }
 
-
-    static void loadLibrary(final String libName) {
-        try {
-            if (hasSecurityManager()) {
-                if(Printer.debug) Printer.debug("using security manager to load library");
-                PrivilegedAction<Void> action = new PrivilegedAction<Void>() {
-                        public Void 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()) {
@@ -189,83 +165,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<ThreadGroup> action = new PrivilegedAction<ThreadGroup>() {
-                        public ThreadGroup run() {
-                            try {
-                                return getTopmostThreadGroupImpl();
-                            } catch (Throwable t) {
-                                return null;
-                            }
-                        }
-                    };
-                topmostThreadGroup = 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<Thread> action = new PrivilegedAction<Thread>() {
-                    public Thread run() {
-                        try {
-                            return createThreadImpl(runnable, threadName,
-                                                    isDaemon, priority,
-                                                    doStart);
-                        } catch (Throwable t) {
-                            return null;
-                        }
-                    }
-                };
-            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);
         }
@@ -279,7 +185,6 @@
         return thread;
     }
 
-
     static <T> List<T> getProviders(final Class<T> providerClass) {
         List<T> p = new ArrayList<>();
         // ServiceLoader creates "lazy" iterator instance, so it doesn't,
--- a/src/share/classes/com/sun/media/sound/JavaSoundAudioClip.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/JavaSoundAudioClip.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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();
         }
 
--- a/src/share/classes/com/sun/media/sound/MidiDeviceReceiverEnvelope.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/MidiDeviceReceiverEnvelope.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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
@@ -33,7 +33,7 @@
  *
  * @author Alex Menkov
  */
-public class MidiDeviceReceiverEnvelope implements MidiDeviceReceiver {
+public final class MidiDeviceReceiverEnvelope implements MidiDeviceReceiver {
 
     private final MidiDevice device;
     private final Receiver receiver;
--- a/src/share/classes/com/sun/media/sound/MidiDeviceTransmitterEnvelope.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/MidiDeviceTransmitterEnvelope.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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
@@ -33,7 +33,7 @@
  *
  * @author Alex Menkov
  */
-public class MidiDeviceTransmitterEnvelope implements MidiDeviceTransmitter {
+public final class MidiDeviceTransmitterEnvelope implements MidiDeviceTransmitter {
 
     private final MidiDevice device;
     private final Transmitter transmitter;
--- a/src/share/classes/com/sun/media/sound/MidiInDevice.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/MidiInDevice.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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();
         }
--- a/src/share/classes/com/sun/media/sound/MidiInDeviceProvider.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/MidiInDeviceProvider.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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);
--- a/src/share/classes/com/sun/media/sound/MidiOutDevice.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/MidiOutDevice.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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();
--- a/src/share/classes/com/sun/media/sound/MidiOutDeviceProvider.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/MidiOutDeviceProvider.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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);
--- a/src/share/classes/com/sun/media/sound/MidiUtils.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/MidiUtils.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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
--- a/src/share/classes/com/sun/media/sound/ModelByteBuffer.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/ModelByteBuffer.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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();
--- a/src/share/classes/com/sun/media/sound/ModelByteBufferWavetable.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/ModelByteBufferWavetable.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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;
--- a/src/share/classes/com/sun/media/sound/ModelConnectionBlock.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/ModelConnectionBlock.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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 ModelConnectionBlock {
+public final class ModelConnectionBlock {
 
     //
     //   source1 * source2 * scale -> destination
--- a/src/share/classes/com/sun/media/sound/ModelDestination.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/ModelDestination.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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
--- a/src/share/classes/com/sun/media/sound/ModelIdentifier.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/ModelIdentifier.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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
--- a/src/share/classes/com/sun/media/sound/ModelInstrument.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/ModelInstrument.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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();
--- a/src/share/classes/com/sun/media/sound/ModelInstrumentComparator.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/ModelInstrumentComparator.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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();
--- a/src/share/classes/com/sun/media/sound/ModelMappedInstrument.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/ModelMappedInstrument.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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());
--- a/src/share/classes/com/sun/media/sound/ModelPatch.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/ModelPatch.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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;
 
--- a/src/share/classes/com/sun/media/sound/ModelPerformer.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/ModelPerformer.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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;
--- a/src/share/classes/com/sun/media/sound/ModelSource.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/ModelSource.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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 =
--- a/src/share/classes/com/sun/media/sound/ModelStandardDirector.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/ModelStandardDirector.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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;
--- a/src/share/classes/com/sun/media/sound/ModelStandardIndexedDirector.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/ModelStandardIndexedDirector.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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;
--- a/src/share/classes/com/sun/media/sound/ModelStandardTransform.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/ModelStandardTransform.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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;
--- a/src/share/classes/com/sun/media/sound/PCMtoPCMCodec.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/PCMtoPCMCodec.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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;
 
 
--- a/src/share/classes/com/sun/media/sound/Platform.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/Platform.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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.");
--- a/src/share/classes/com/sun/media/sound/PortMixer.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/PortMixer.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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);
         }
--- a/src/share/classes/com/sun/media/sound/PortMixerProvider.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/PortMixerProvider.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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);
--- a/src/share/classes/com/sun/media/sound/Printer.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/Printer.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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)
--- a/src/share/classes/com/sun/media/sound/RIFFInvalidDataException.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/RIFFInvalidDataException.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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;
 
--- a/src/share/classes/com/sun/media/sound/RIFFInvalidFormatException.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/RIFFInvalidFormatException.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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;
 
--- a/src/share/classes/com/sun/media/sound/RIFFReader.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/RIFFReader.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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;
--- a/src/share/classes/com/sun/media/sound/RIFFWriter.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/RIFFWriter.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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;
--- a/src/share/classes/com/sun/media/sound/RealTimeSequencer.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/RealTimeSequencer.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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
@@ -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...
@@ -872,7 +866,7 @@
         if (Printer.trace) Printer.trace("<< RealTimeSequencer: implClose() completed");
     }
 
-    protected void implStart() {
+    void implStart() {
         if (Printer.trace) Printer.trace(">> RealTimeSequencer: implStart()");
 
         if (playThread == null) {
@@ -889,7 +883,7 @@
     }
 
 
-    protected void implStop() {
+    void implStop() {
         if (Printer.trace) Printer.trace(">> RealTimeSequencer: implStop()");
 
         if (playThread == null) {
@@ -905,22 +899,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;
 
@@ -942,7 +950,7 @@
                 }
             }
         }
-        eventDispatcher.sendAudioEvents(message, sendToListeners);
+        getEventDispatcher().sendAudioEvents(message, sendToListeners);
     }
 
 
@@ -1024,7 +1032,7 @@
     }
 
 
-    class SequencerReceiver extends AbstractReceiver {
+    final class SequencerReceiver extends AbstractReceiver {
 
         void implSend(MidiMessage message, long timeStamp) {
             if (recording) {
@@ -1092,7 +1100,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) {
 
@@ -1197,7 +1205,7 @@
 
     static class RecordingTrack {
 
-        private Track track;
+        private final Track track;
         private int channel;
 
         RecordingTrack(Track track, int channel) {
@@ -1237,15 +1245,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() {
--- a/src/share/classes/com/sun/media/sound/RealTimeSequencerProvider.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/RealTimeSequencerProvider.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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() {
--- a/src/share/classes/com/sun/media/sound/SF2GlobalRegion.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/SF2GlobalRegion.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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 {
 }
--- a/src/share/classes/com/sun/media/sound/SF2Instrument.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/SF2Instrument.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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) {
--- a/src/share/classes/com/sun/media/sound/SF2InstrumentRegion.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/SF2InstrumentRegion.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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;
--- a/src/share/classes/com/sun/media/sound/SF2Layer.java	Wed Jun 26 13:49:16 2013 +0400
+++ b/src/share/classes/com/sun/media/sound/SF2Layer.java	Fri Jun 28 19:37:48 2013 -0700
@@ -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